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:
authorBastien Montagne <montagne29@wanadoo.fr>2014-04-15 18:49:49 +0400
committerBastien Montagne <montagne29@wanadoo.fr>2014-04-15 18:49:49 +0400
commit09e5aa5156486585b3d23f52f927db744fb9a055 (patch)
tree5eff713af7632a2d68d2e8d0f0ba1280074131dd /source/blender/editors/util
parent09874df135888b89f51d7becaa369ebb1d1623c6 (diff)
Fix T39234: popup menus behave poorly when they have not enough width for all their columns.
Issue fixed by: * Not having constant width for all columns, but adapt each to its content's width; * Adapting undo's menu height to undo list length (so that we never have more than three columns). It is still possible to get issues in extreme cases (small screen, high DPI size, long op names everywhere...), but this should now be rare corner cases. Also fixes a minor glitch with undo menu (first column had one item less than the others...).
Diffstat (limited to 'source/blender/editors/util')
-rw-r--r--source/blender/editors/util/undo.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c
index 434f1e30188..733b45f560d 100644
--- a/source/blender/editors/util/undo.c
+++ b/source/blender/editors/util/undo.c
@@ -533,14 +533,20 @@ static int undo_history_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSE
uiLayout *layout = uiPupMenuLayout(pup);
uiLayout *split = uiLayoutSplit(layout, 0.0f, false);
uiLayout *column = NULL;
+ const int col_size = 20 + totitem / 12;
int i, c;
+ bool add_col = true;
- for (c = 0, i = totitem - 1; i >= 0; i--, c++) {
- if ( (c % 20) == 0)
+ for (c = 0, i = totitem; i--;) {
+ if (add_col && !(c % col_size)) {
column = uiLayoutColumn(split, false);
- if (item[i].identifier)
+ add_col = false;
+ }
+ if (item[i].identifier) {
uiItemIntO(column, item[i].name, item[i].icon, op->type->idname, "item", item[i].value);
-
+ ++c;
+ add_col = true;
+ }
}
MEM_freeN(item);