From e69e62a90ad85500e9e17d02ba95130a8db1a57b Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 26 Jun 2018 11:57:22 +0200 Subject: UI: decrease status bar height. --- source/blender/editors/screen/area.c | 29 ++++++++++++++++++----------- source/blender/editors/screen/screen_edit.c | 2 +- 2 files changed, 19 insertions(+), 12 deletions(-) (limited to 'source/blender/editors/screen') diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index d9851487569..1eda6da6e40 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -2208,26 +2208,33 @@ void ED_region_header_layout(const bContext *C, ARegion *ar) uiLayout *layout; HeaderType *ht; Header header = {NULL}; - int maxco, xco, yco; - int headery = ED_area_headersize(); bool region_layout_based = ar->flag & RGN_FLAG_DYNAMIC_SIZE; - /* set view2d view matrix for scrolling (without scrollers) */ - UI_view2d_view_ortho(&ar->v2d); + /* Height of buttons and scaling needed to achieve it. */ + const int buttony = min_ii(UI_UNIT_Y, ar->winy - 2 * UI_DPI_FAC); + const float buttony_scale = buttony / (float)UI_UNIT_Y; - xco = maxco = UI_HEADER_OFFSET; - yco = headery + (ar->winy - headery) / 2 - floor(0.2f * UI_UNIT_Y); + /* Vertically center buttons. */ + int xco = UI_HEADER_OFFSET; + int yco = buttony + (ar->winy - buttony) / 2; + int maxco = xco; /* XXX workaround for 1 px alignment issue. Not sure what causes it... Would prefer a proper fix - Julian */ - if (CTX_wm_area(C)->spacetype == SPACE_TOPBAR) { - xco += 1; - yco += 1; + if (!ELEM(CTX_wm_area(C)->spacetype, SPACE_TOPBAR, SPACE_STATUSBAR)) { + yco -= 1; } + /* set view2d view matrix for scrolling (without scrollers) */ + UI_view2d_view_ortho(&ar->v2d); + /* draw all headers types */ for (ht = ar->type->headertypes.first; ht; ht = ht->next) { block = UI_block_begin(C, ar, ht->idname, UI_EMBOSS); - layout = UI_block_layout(block, UI_LAYOUT_HORIZONTAL, UI_LAYOUT_HEADER, xco, yco, UI_UNIT_Y, 1, 0, style); + layout = UI_block_layout(block, UI_LAYOUT_HORIZONTAL, UI_LAYOUT_HEADER, xco, yco, buttony, 1, 0, style); + + if (buttony_scale != 1.0f) { + uiLayoutSetScaleY(layout, buttony_scale); + } if (ht->draw) { header.type = ht; @@ -2264,7 +2271,7 @@ void ED_region_header_layout(const bContext *C, ARegion *ar) } /* always as last */ - UI_view2d_totRect_set(&ar->v2d, maxco, headery); + UI_view2d_totRect_set(&ar->v2d, maxco, ar->winy); /* restore view matrix */ UI_view2d_view_restore(C); diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index e4de3cdfa38..3d18d2abafd 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -1141,7 +1141,7 @@ static void screen_global_topbar_area_create(wmWindow *win) static void screen_global_statusbar_area_create(wmWindow *win) { - const short size_y = HEADERY; + const short size_y = 0.8f * HEADERY; rcti rect; BLI_rcti_init(&rect, 0, WM_window_pixels_x(win) - 1, 0, WM_window_pixels_y(win) - 1); -- cgit v1.2.3