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
path: root/source
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2016-10-13 11:21:38 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2016-10-13 11:23:24 +0300
commit918e6cf4c9b74ff96ad06753ef9e541837eb3b22 (patch)
treedb047278cc57ebe58f98855b15ee9067b1ed158a /source
parent786c0966ec19e95b37c352f3fdc74cd36803537a (diff)
Fix T49635: column_flow Layout - last column is too small.
Column flow layout was abuse ui_item_fit in a weird way, which was broken for last column items. Now rather use own code, which basically spread available width as equally as possible between all columns.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/interface/interface_layout.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index b52068d8bd1..875522e01c6 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -2488,10 +2488,12 @@ static void ui_litem_layout_column_flow(uiLayout *litem)
/* create column per column */
col = 0;
+ w = (litem->w - (flow->totcol - 1) * style->columnspace) / flow->totcol;
for (item = litem->items.first; item; item = item->next) {
- ui_item_size(item, NULL, &itemh);
- itemw = ui_item_fit(1, x - litem->x, flow->totcol, w, col == flow->totcol - 1, litem->alignment);
-
+ ui_item_size(item, &itemw, &itemh);
+
+ itemw = (litem->alignment == UI_LAYOUT_ALIGN_EXPAND) ? w : min_ii(w, itemw);
+
y -= itemh;
emy -= itemh;
ui_item_position(item, x, y, itemw, itemh);
@@ -2500,10 +2502,13 @@ static void ui_litem_layout_column_flow(uiLayout *litem)
/* decide to go to next one */
if (col < flow->totcol - 1 && emy <= -emh) {
- x += itemw + style->columnspace;
+ x += w + style->columnspace;
y = litem->y;
emy = 0; /* need to reset height again for next column */
col++;
+
+ /* (< remaining width > - < space between remaining columns >) / <remamining columns > */
+ w = ((litem->w - (x - litem->x)) - (flow->totcol - col - 1) * style->columnspace) / (flow->totcol - col);
}
}