UI: decrease status bar height.

This commit is contained in:
Brecht Van Lommel 2018-06-26 11:57:22 +02:00
parent cf8a059769
commit e69e62a90a
4 changed files with 27 additions and 15 deletions

View File

@ -3861,6 +3861,11 @@ static void ui_item_scale(uiLayout *litem, const float scale[2])
int x, y, w, h;
for (item = litem->items.last; item; item = item->prev) {
if (item->type != ITEM_BUTTON) {
uiLayout *subitem = (uiLayout *)item;
ui_item_scale(subitem, scale);
}
ui_item_size(item, &w, &h);
ui_item_offset(item, &x, &y);

View File

@ -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;
/* 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;
/* 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 (!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);
xco = maxco = UI_HEADER_OFFSET;
yco = headery + (ar->winy - headery) / 2 - floor(0.2f * UI_UNIT_Y);
/* 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;
}
/* 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);

View File

@ -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);

View File

@ -186,7 +186,7 @@ void ED_spacetype_statusbar(void)
/* regions: header window */
art = MEM_callocN(sizeof(*art), "spacetype statusbar header region");
art->regionid = RGN_TYPE_HEADER;
art->prefsizey = HEADERY;
art->prefsizey = 0.8f * HEADERY;
art->prefsizex = UI_UNIT_X * 5; /* Mainly to avoid glitches */
art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_HEADER;
art->init = statusbar_header_region_init;