fix for arrow keys being reversed in the snap menu (Ctrl+Shift+Tab)

also - when expanding rna enums into existing menus - don't nest inside a row/column.
This commit is contained in:
Campbell Barton 2013-01-17 01:03:56 +00:00
parent 0601d54068
commit 350a776a52
3 changed files with 14 additions and 7 deletions

@ -509,8 +509,7 @@ class WM_MT_context_menu_enum(Menu):
layout = self.layout
layout.label(prop.name, icon=prop.icon)
col = self.layout.column()
col.prop(value_base, prop_string, expand=True)
layout.prop(value_base, prop_string, expand=True)
class WM_OT_context_menu_enum(Operator):

@ -6559,6 +6559,7 @@ static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle
ui_pan_to_scroll(event, &type, &val);
if (val == KM_PRESS) {
const eButType type_flip = BUT | ROW;
PASS_EVENT_TO_PARENT_IF_NONACTIVE;
@ -6571,13 +6572,13 @@ static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle
{
/* the following is just a hack - uiBut->type set to BUT and BUTM have there menus built
* opposite ways - this should be changed so that all popup-menus use the same uiBlock->direction */
if (but->type & BUT)
if (but->type & type_flip)
but = ui_but_next(but);
else
but = ui_but_prev(but);
}
else {
if (but->type & BUT)
if (but->type & type_flip)
but = ui_but_prev(but);
else
but = ui_but_next(but);
@ -6594,7 +6595,7 @@ static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle
((ELEM(type, UPARROWKEY, WHEELUPMOUSE)) && (block->direction & UI_RIGHT)) ||
((ELEM(type, DOWNARROWKEY, WHEELDOWNMOUSE)) && (block->direction & UI_TOP)))
{
if ((bt = ui_but_first(block)) && (bt->type & BUT)) {
if ((bt = ui_but_first(block)) && (bt->type & type_flip)) {
bt = ui_but_last(block);
}
else {
@ -6602,7 +6603,7 @@ static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle
}
}
else {
if ((bt = ui_but_first(block)) && (bt->type & BUT)) {
if ((bt = ui_but_first(block)) && (bt->type & type_flip)) {
/* keep ui_but_first() */
}
else {

@ -491,7 +491,14 @@ static void ui_item_enum_expand(uiLayout *layout, uiBlock *block, PointerRNA *pt
RNA_property_enum_items_gettexted(block->evil_C, ptr, prop, &item, &totitem, &free);
uiBlockSetCurLayout(block, ui_item_local_sublayout(layout, layout, 1));
/* we dont want nested rows, cols in menus */
if (layout->root->type != UI_LAYOUT_MENU) {
uiBlockSetCurLayout(block, ui_item_local_sublayout(layout, layout, 1));
}
else {
uiBlockSetCurLayout(block, layout);
}
for (a = 0; a < totitem; a++) {
if (!item[a].identifier[0])
continue;