diff options
author | Ton Roosendaal <ton@blender.org> | 2010-04-12 21:45:51 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2010-04-12 21:45:51 +0400 |
commit | 7814d42ec79601cd4bafc7a8dfe2596f892757c9 (patch) | |
tree | 8f64772897e8b994d89e4451b0f5ab7bf116b78c /source | |
parent | 919565f196b66026f0adf23ed1ee2214e5a517f7 (diff) |
Button panels need to get handlers and keymaps... but for now sneaked
in a handy key : Akey in buttons window on a panel will
open or close it.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 3 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_panel.c | 29 |
2 files changed, 24 insertions, 8 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 9bd29532628..950975de2ab 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -5587,8 +5587,7 @@ static int ui_handler_region(bContext *C, wmEvent *event, void *userdata) /* either handle events for already activated button or try to activate */ but= ui_but_find_activated(ar); - if(!but || !button_modal_state(but->active->state)) - retval= ui_handler_panel_region(C, event); + retval= ui_handler_panel_region(C, event); if(retval == WM_UI_HANDLER_CONTINUE) retval= ui_handle_list_event(C, event, ar); diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 39283231b7c..20b7901beef 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -970,6 +970,8 @@ static void ui_handle_panel_header(const bContext *C, uiBlock *block, int mx, in /* check open/collapsed button */ if(event==RETKEY) button= 1; + else if(event==AKEY) + button= 1; else if(block->panel->flag & PNL_CLOSEDX) { if(my >= block->maxy) button= 1; } @@ -1024,6 +1026,8 @@ static void ui_handle_panel_header(const bContext *C, uiBlock *block, int mx, in } /* XXX should become modal keymap */ +/* AKey is opening/closing panels, independent of button state now */ + int ui_handler_panel_region(bContext *C, wmEvent *event) { ARegion *ar= CTX_wm_region(C); @@ -1032,11 +1036,6 @@ int ui_handler_panel_region(bContext *C, wmEvent *event) int retval, mx, my, inside_header= 0, inside_scale= 0, inside; retval= WM_UI_HANDLER_CONTINUE; - - /* buttons get priority */ - if(ui_button_is_active(ar)) - return retval; - for(block=ar->uiblocks.last; block; block=block->prev) { mx= event->x; my= event->y; @@ -1054,7 +1053,25 @@ int ui_handler_panel_region(bContext *C, wmEvent *event) if(block->minx <= mx && block->maxx >= mx) if(block->miny <= my && block->maxy+PNL_HEADER >= my) inside= 1; - + + if(inside && event->val==KM_PRESS) { + if(event->type == AKEY) { + + if(pa->flag & PNL_CLOSEDY) { + if((block->maxy <= my) && (block->maxy+PNL_HEADER >= my)) + ui_handle_panel_header(C, block, mx, my, event->type); + } + else + ui_handle_panel_header(C, block, mx, my, event->type); + + continue; + } + } + + /* on active button, do not handle panels */ + if(ui_button_is_active(ar)) + continue; + if(inside) { /* clicked at panel header? */ if(pa->flag & PNL_CLOSEDX) { |