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>2012-09-10 10:44:25 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-09-10 10:44:25 +0400
commitb1ff5651fbd8e392c616fba55d3fb4455fe9d3a7 (patch)
tree7469558bc00f388889b8004aa1dcbc0f9da2f266
parent1352a955ca61b20d071d064d88f981711f80dd1d (diff)
make alphanumeric key shortcuts work for submenu's so you can chain keys together to select items in a menu.
eg: 'Ctrl+V, E, S' for - Vertex, Separate, Selection
-rw-r--r--source/blender/editors/interface/interface_regions.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index a4f1067d069..9c22b06fc1c 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -1648,6 +1648,18 @@ uiPopupBlockHandle *ui_popup_block_create(bContext *C, ARegion *butregion, uiBut
ar->regiondata = handle;
+ /* set UI_BLOCK_NUMSELECT before uiEndBlock() so we get alphanumeric keys assigned */
+ if (but) {
+ if (but->type == PULLDOWN) {
+ block->flag |= UI_BLOCK_NUMSELECT;
+ }
+ }
+ else {
+ block->flag |= UI_BLOCK_POPUP | UI_BLOCK_NUMSELECT;
+ }
+
+ block->flag |= UI_BLOCK_LOOP;
+
if (!block->endblock)
uiEndBlock(C, block);
@@ -1665,7 +1677,6 @@ uiPopupBlockHandle *ui_popup_block_create(bContext *C, ARegion *butregion, uiBut
saferct = MEM_callocN(sizeof(uiSafetyRct), "uiSafetyRct");
saferct->safety = block->safety;
BLI_addhead(&block->saferct, saferct);
- block->flag |= UI_BLOCK_POPUP | UI_BLOCK_NUMSELECT;
}
/* clip block with window boundary */
@@ -1680,8 +1691,6 @@ uiPopupBlockHandle *ui_popup_block_create(bContext *C, ARegion *butregion, uiBut
ar->winrct.ymax = block->rect.ymax + MENU_TOP;
ui_block_translate(block, -ar->winrct.xmin, -ar->winrct.ymin);
-
- block->flag |= UI_BLOCK_LOOP;
/* adds subwindow */
ED_region_init(C, ar);
@@ -2427,6 +2436,7 @@ uiPopupBlockHandle *ui_popup_menu_create(bContext *C, ARegion *butregion, uiBut
uiPopupMenu *pup;
pup = MEM_callocN(sizeof(uiPopupMenu), __func__);
pup->block = uiBeginBlock(C, NULL, __func__, UI_EMBOSSP);
+ pup->block->flag |= UI_BLOCK_NUMSELECT; /* default menus to numselect */
pup->layout = uiBlockLayout(pup->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_MENU, 0, 0, 200, 0, style);
pup->slideout = (but && (but->block->flag & UI_BLOCK_LOOP));
pup->but = but;