From dfc72b3f90644d28151f9fc8c8c27f7c9c56dcd7 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Fri, 21 Nov 2003 13:14:50 +0000 Subject: [PATCH] - Fix: the MKEY 'movetolayer' option doesnt close anymore on numeric input. Somewhere in end NaN period this was changed... weird. Now you can set layers with numeric buttons, including using ALT for numbers larger than 10, and using SHIFT for extend-select buttons. for the UI diehards who like to know; when you create a menu block, you can provide two flags to control behaviour on keyboard input: UI_BLOCK_RET_1 == return on any keypress (not mouse) UI_BLOCK_ENTER_OK == return on Enter key this was not correct in the doc/interface_API.txt , which will be fixed. --- source/blender/src/interface.c | 10 +++++++--- source/blender/src/toolbox.c | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/source/blender/src/interface.c b/source/blender/src/interface.c index 17610e08579..6ce2d968dd6 100644 --- a/source/blender/src/interface.c +++ b/source/blender/src/interface.c @@ -2609,10 +2609,14 @@ static int ui_do_block(uiBlock *block, uiEvent *uevent) if(count==act) { but->flag |= UI_ACTIVE; if(uevent->val==1) ui_draw_but(but); - else { + else if(block->flag & UI_BLOCK_RET_1) { /* to make UI_BLOCK_RET_1 working */ uevent->event= RETKEY; - uevent->val= 1; /* patch: to avoid UI_BLOCK_RET_1 type not working */ - addqueue(block->winq, RIGHTARROWKEY, 1); + uevent->val= 1; + //addqueue(block->winq, RIGHTARROWKEY, 1); (why! (ton)) + } + else { + uevent->event= LEFTMOUSE; /* to make sure the button is handled further on */ + uevent->val= 1; } } else if(but->flag & UI_ACTIVE) { diff --git a/source/blender/src/toolbox.c b/source/blender/src/toolbox.c index 25e7a5a961d..bff97796e79 100644 --- a/source/blender/src/toolbox.c +++ b/source/blender/src/toolbox.c @@ -1228,7 +1228,7 @@ int movetolayer_buts(unsigned int *lay) y1= pivot[1]-sizey/2; block= uiNewBlock(&listb, "button", UI_EMBOSS, UI_HELV, G.curscreen->mainwin); - uiBlockSetFlag(block, UI_BLOCK_LOOP|UI_BLOCK_REDRAW|UI_BLOCK_NUMSELECT|UI_BLOCK_RET_1); + uiBlockSetFlag(block, UI_BLOCK_LOOP|UI_BLOCK_REDRAW|UI_BLOCK_NUMSELECT|UI_BLOCK_ENTER_OK); dx= (sizex-5)/12; dy= sizey/2;