diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-11-15 16:32:23 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-11-15 16:40:10 +0300 |
commit | c1e48c0ff085f9f575dc596c9e97f5f67137c8a6 (patch) | |
tree | 8b4142ef14ff6401351f28e04aa0633c01d93de8 /source/blender/editors/interface/interface_layout.c | |
parent | 694f15dee37e46eb4dc3843bdeb5168366cc1f11 (diff) |
UI: cleanup next/prev order in menu code
Recent flag re-order broke it since bits overlap, but logic here was far too complicated & fragile,
Checked the type of each button when testing which direction to handle events as well as block direction.
Now store the block-flipped state as a flag.
Diffstat (limited to 'source/blender/editors/interface/interface_layout.c')
-rw-r--r-- | source/blender/editors/interface/interface_layout.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index e8e9475c338..47b9c85fb0b 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -977,6 +977,11 @@ void uiItemsFullEnumO(uiLayout *layout, const char *opname, const char *propname if (free) { MEM_freeN(item_array); } + + if ((block->flag & UI_BLOCK_NO_FLIP) == 0) { + BLI_assert((block->flag & UI_BLOCK_IS_FLIP) == 0); + block->flag |= UI_BLOCK_IS_FLIP; + } } else if (prop && RNA_property_type(prop) != PROP_ENUM) { RNA_warning("%s.%s, not an enum type", RNA_struct_identifier(ptr.type), propname); @@ -1431,6 +1436,11 @@ void uiItemsEnumR(uiLayout *layout, struct PointerRNA *ptr, const char *propname MEM_freeN(item); } } + + if ((block->flag & UI_BLOCK_NO_FLIP) == 0) { + BLI_assert((block->flag & UI_BLOCK_IS_FLIP) == 0); + block->flag |= UI_BLOCK_IS_FLIP; + } } /* Pointer RNA button with search */ @@ -1663,6 +1673,9 @@ static void ui_item_menutype_func(bContext *C, uiLayout *layout, void *arg_mt) if (layout->context) CTX_store_set(C, NULL); + + /* menus are created flipped (from event handling pov) */ + layout->root->block->flag ^= UI_BLOCK_IS_FLIP; } static uiBut *ui_item_menu(uiLayout *layout, const char *name, int icon, uiMenuCreateFunc func, void *arg, void *argN, |