Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-10-27 21:00:56 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-10-28 14:40:12 +0300
commitdf9f1d91daec6c3a613dcc177104d55a7197fbc9 (patch)
tree0e805c142f5e4540fd0a3b6d5643ac8a2e3f12dd /source/blender/editors/interface/interface_layout.c
parent23f4c3b12689cdd0b26c5eb7c4318fe6bdf6b80a (diff)
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.
Diffstat (limited to 'source/blender/editors/interface/interface_layout.c')
-rw-r--r--source/blender/editors/interface/interface_layout.c30
1 files changed, 20 insertions, 10 deletions
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 */