diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-06-26 12:57:22 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-06-26 18:15:43 +0300 |
commit | e69e62a90ad85500e9e17d02ba95130a8db1a57b (patch) | |
tree | 6e2488442228a247fd940d117acabc86d3ba311e /source/blender/editors/screen/area.c | |
parent | cf8a0597693de8fbf3dccf607d81e6e1f2c0d2aa (diff) |
UI: decrease status bar height.
Diffstat (limited to 'source/blender/editors/screen/area.c')
-rw-r--r-- | source/blender/editors/screen/area.c | 29 |
1 files changed, 18 insertions, 11 deletions
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); |