forked from bartvdbraak/blender
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.
This commit is contained in:
parent
919565f196
commit
7814d42ec7
@ -5587,7 +5587,6 @@ static int ui_handler_region(bContext *C, wmEvent *event, void *userdata)
|
|||||||
/* either handle events for already activated button or try to activate */
|
/* either handle events for already activated button or try to activate */
|
||||||
but= ui_but_find_activated(ar);
|
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)
|
if(retval == WM_UI_HANDLER_CONTINUE)
|
||||||
|
@ -970,6 +970,8 @@ static void ui_handle_panel_header(const bContext *C, uiBlock *block, int mx, in
|
|||||||
/* check open/collapsed button */
|
/* check open/collapsed button */
|
||||||
if(event==RETKEY)
|
if(event==RETKEY)
|
||||||
button= 1;
|
button= 1;
|
||||||
|
else if(event==AKEY)
|
||||||
|
button= 1;
|
||||||
else if(block->panel->flag & PNL_CLOSEDX) {
|
else if(block->panel->flag & PNL_CLOSEDX) {
|
||||||
if(my >= block->maxy) button= 1;
|
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 */
|
/* XXX should become modal keymap */
|
||||||
|
/* AKey is opening/closing panels, independent of button state now */
|
||||||
|
|
||||||
int ui_handler_panel_region(bContext *C, wmEvent *event)
|
int ui_handler_panel_region(bContext *C, wmEvent *event)
|
||||||
{
|
{
|
||||||
ARegion *ar= CTX_wm_region(C);
|
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;
|
int retval, mx, my, inside_header= 0, inside_scale= 0, inside;
|
||||||
|
|
||||||
retval= WM_UI_HANDLER_CONTINUE;
|
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) {
|
for(block=ar->uiblocks.last; block; block=block->prev) {
|
||||||
mx= event->x;
|
mx= event->x;
|
||||||
my= event->y;
|
my= event->y;
|
||||||
@ -1055,6 +1054,24 @@ int ui_handler_panel_region(bContext *C, wmEvent *event)
|
|||||||
if(block->miny <= my && block->maxy+PNL_HEADER >= my)
|
if(block->miny <= my && block->maxy+PNL_HEADER >= my)
|
||||||
inside= 1;
|
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) {
|
if(inside) {
|
||||||
/* clicked at panel header? */
|
/* clicked at panel header? */
|
||||||
if(pa->flag & PNL_CLOSEDX) {
|
if(pa->flag & PNL_CLOSEDX) {
|
||||||
|
Loading…
Reference in New Issue
Block a user