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>2014-02-12 03:29:15 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-02-12 03:29:15 +0400
commitbfd0b582ca6c9d7a851490a1f37fb98d4a9cf050 (patch)
tree05c7d782ea0bd26ac107827d420ba87db5f9cb95 /source/blender
parent18a8d88923e69fad33c29bddd1f67cb1b6790bef (diff)
fix/workaround for v3d object mode selector flipping direction
Allow menu functions to define their own direction, this way menu_item_enum_opname_menu can keep menu flipping from 2.69.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/include/UI_interface.h2
-rw-r--r--source/blender/editors/interface/interface.c2
-rw-r--r--source/blender/editors/interface/interface_layout.c3
-rw-r--r--source/blender/editors/interface/interface_regions.c17
4 files changed, 17 insertions, 7 deletions
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 1dbef0ba014..d235441d53e 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -418,7 +418,7 @@ void uiExplicitBoundsBlock(uiBlock *block, int minx, int miny, int maxx, int max
int uiBlocksGetYMin(struct ListBase *lb);
-void uiBlockSetDirection(uiBlock *block, int direction);
+void uiBlockSetDirection(uiBlock *block, char direction);
void uiBlockFlipOrder(uiBlock *block);
void uiBlockSetFlag(uiBlock *block, int flag);
void uiBlockClearFlag(uiBlock *block, int flag);
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 2e6cb35faaa..aa3be71aa5d 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -3684,7 +3684,7 @@ int uiBlocksGetYMin(ListBase *lb)
return min;
}
-void uiBlockSetDirection(uiBlock *block, int direction)
+void uiBlockSetDirection(uiBlock *block, char direction)
{
block->direction = direction;
}
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index e27177be4b4..57e7ebfd800 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -1793,6 +1793,9 @@ static void menu_item_enum_opname_menu(bContext *UNUSED(C), uiLayout *layout, vo
uiLayoutSetOperatorContext(layout, lvl->opcontext);
uiItemsEnumO(layout, lvl->opname, lvl->propname);
+
+ /* override default, needed since this was assumed pre 2.70 */
+ uiBlockSetDirection(layout->root->block, UI_DOWN);
}
void uiItemMenuEnumO(uiLayout *layout, bContext *C, const char *opname, const char *propname, const char *name, int icon)
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index 9bb8ed0d1e0..e413808f1dd 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -2102,7 +2102,9 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi
uiBlock *block;
uiBut *bt;
uiPopupMenu *pup = arg_pup;
- int offset[2], direction, minwidth, width, height, flip;
+ int offset[2], minwidth, width, height;
+ char direction;
+ bool flip;
if (pup->menu_func) {
pup->block->handle = handle;
@@ -2116,21 +2118,26 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi
/* settings (typically rna-enum-popups) show above the button,
* menu's like file-menu, show below */
- if (pup->but->type == PULLDOWN || (uiButGetMenuType(pup->but) != NULL)) {
+ if (pup->block->direction != 0) {
+ /* allow overriding the direction from menu_func */
+ direction = pup->block->direction;
+ }
+ else if ((pup->but->type == PULLDOWN) ||
+ (uiButGetMenuType(pup->but) != NULL))
+ {
direction = UI_DOWN;
- flip = 1;
}
else {
direction = UI_TOP;
- flip = 0;
}
}
else {
minwidth = 50;
direction = UI_DOWN;
- flip = 1;
}
+ flip = (direction == UI_DOWN);
+
block = pup->block;
/* in some cases we create the block before the region,