[Bf-blender-cvs] [e69e62a90ad] blender2.8: UI: decrease status bar height.

Brecht Van Lommel noreply at git.blender.org
Tue Jun 26 17:18:11 CEST 2018


Commit: e69e62a90ad85500e9e17d02ba95130a8db1a57b
Author: Brecht Van Lommel
Date:   Tue Jun 26 11:57:22 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBe69e62a90ad85500e9e17d02ba95130a8db1a57b

UI: decrease status bar height.

===================================================================

M	source/blender/editors/interface/interface_layout.c
M	source/blender/editors/screen/area.c
M	source/blender/editors/screen/screen_edit.c
M	source/blender/editors/space_statusbar/space_statusbar.c

===================================================================

diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 05af133616e..1b6a1bd27a0 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -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);
 
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);
diff --git a/source/blender/editors/space_statusbar/space_statusbar.c b/source/blender/editors/space_statusbar/space_statusbar.c
index 4c6a2eea469..2d98431bf0c 100644
--- a/source/blender/editors/space_statusbar/space_statusbar.c
+++ b/source/blender/editors/space_statusbar/space_statusbar.c
@@ -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;



More information about the Bf-blender-cvs mailing list