diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2010-04-18 06:03:19 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2010-04-18 06:03:19 +0400 |
commit | dfe2f8dc03267e041102837e92f547fb04881510 (patch) | |
tree | d9582c4667ce5b9e39e2adce40832aa4f44b4fe7 /source/blender/editors/interface/interface_panel.c | |
parent | d7e08f2d33207fdf76b1b597ef0de9dec26e3987 (diff) | |
parent | 00e46ef739cf2bfddb8805af056aa59fd3b3c71c (diff) |
Merged changes in the trunk up to revision 28247.
Diffstat (limited to 'source/blender/editors/interface/interface_panel.c')
-rw-r--r-- | source/blender/editors/interface/interface_panel.c | 49 |
1 files changed, 39 insertions, 10 deletions
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index e4088a64a17..20b7901beef 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -864,6 +864,8 @@ void uiEndPanels(const bContext *C, ARegion *ar) if(firstpa) firstpa->runtime_flag |= PNL_FIRST; + UI_ThemeClearColor(TH_BACK); + /* draw panels, selected on top */ for(block= ar->uiblocks.first; block; block=block->next) { if(block->active && block->panel && !(block->panel->flag & PNL_SELECT)) { @@ -954,7 +956,7 @@ static void ui_do_drag(const bContext *C, wmEvent *event, Panel *panel) /* this function is supposed to call general window drawing too */ /* also it supposes a block has panel, and isnt a menu */ -static void ui_handle_panel_header(const bContext *C, uiBlock *block, int mx, int my) +static void ui_handle_panel_header(const bContext *C, uiBlock *block, int mx, int my, int event) { ScrArea *sa= CTX_wm_area(C); ARegion *ar= CTX_wm_region(C); @@ -966,7 +968,11 @@ static void ui_handle_panel_header(const bContext *C, uiBlock *block, int mx, in /* XXX weak code, currently it assumes layout style for location of widgets */ /* check open/collapsed button */ - if(block->panel->flag & PNL_CLOSEDX) { + if(event==RETKEY) + button= 1; + else if(event==AKEY) + button= 1; + else if(block->panel->flag & PNL_CLOSEDX) { if(my >= block->maxy) button= 1; } else if(block->panel->control & UI_PNL_CLOSE) { @@ -1019,6 +1025,9 @@ 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); @@ -1027,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; @@ -1049,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) { @@ -1066,9 +1088,16 @@ int ui_handler_panel_region(bContext *C, wmEvent *event) } if(event->val==KM_PRESS) { - if(event->type == LEFTMOUSE) { + /* open close on header */ + if(ELEM(event->type, RETKEY, PADENTER)) { + if(inside_header) { + ui_handle_panel_header(C, block, mx, my, RETKEY); + break; + } + } + else if(event->type == LEFTMOUSE) { if(inside_header) { - ui_handle_panel_header(C, block, mx, my); + ui_handle_panel_header(C, block, mx, my, 0); break; } else if(inside_scale && !(pa->flag & PNL_CLOSED)) { |