[Bf-blender-cvs] [df9f1d91dae] master: UI: use zero box-spacing when used in headers

Campbell Barton noreply at git.blender.org
Mon Oct 28 13:00:55 CET 2019


Commit: df9f1d91daec6c3a613dcc177104d55a7197fbc9
Author: Campbell Barton
Date:   Mon Oct 28 05:00:56 2019 +1100
Branches: master
https://developer.blender.org/rBdf9f1d91daec6c3a613dcc177104d55a7197fbc9

UI: use zero box-spacing when used in headers

Without this, boxes are unusable in header layouts as they
add vertical space which shifts the items out of the header.

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

M	source/blender/editors/interface/interface_layout.c

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

diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index a6f8ba4560d..2a4c2aba4a1 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -3650,8 +3650,13 @@ static void ui_litem_estimate_box(uiLayout *litem)
   uiStyle *style = litem->root->style;
 
   ui_litem_estimate_column(litem, true);
-  litem->w += 2 * style->boxspace;
-  litem->h += 2 * style->boxspace;
+
+  int boxspace = style->boxspace;
+  if (litem->root->type == UI_LAYOUT_HEADER) {
+    boxspace = 0;
+  }
+  litem->w += 2 * boxspace;
+  litem->h += 2 * boxspace;
 }
 
 static void ui_litem_layout_box(uiLayout *litem)
@@ -3661,29 +3666,34 @@ static void ui_litem_layout_box(uiLayout *litem)
   uiBut *but;
   int w, h;
 
+  int boxspace = style->boxspace;
+  if (litem->root->type == UI_LAYOUT_HEADER) {
+    boxspace = 0;
+  }
+
   w = litem->w;
   h = litem->h;
 
-  litem->x += style->boxspace;
-  litem->y -= style->boxspace;
+  litem->x += boxspace;
+  litem->y -= boxspace;
 
   if (w != 0) {
-    litem->w -= 2 * style->boxspace;
+    litem->w -= 2 * boxspace;
   }
   if (h != 0) {
-    litem->h -= 2 * style->boxspace;
+    litem->h -= 2 * boxspace;
   }
 
   ui_litem_layout_column(litem, true);
 
-  litem->x -= style->boxspace;
-  litem->y -= style->boxspace;
+  litem->x -= boxspace;
+  litem->y -= boxspace;
 
   if (w != 0) {
-    litem->w += 2 * style->boxspace;
+    litem->w += 2 * boxspace;
   }
   if (h != 0) {
-    litem->h += 2 * style->boxspace;
+    litem->h += 2 * boxspace;
   }
 
   /* roundbox around the sublayout */



More information about the Bf-blender-cvs mailing list