diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-02-17 06:46:07 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-02-17 06:46:07 +0400 |
commit | c971aac3b1550e081e87903e9f7463ef1ff7e0ea (patch) | |
tree | 47410b05107b9acac0fd55bbc410cad9ad7f0ac1 /source | |
parent | cc7cfd661736f67d3f97108c38998b159d87ec9b (diff) |
UI: wheel switches tabs over the tab area, or ctrl+wheel anywhere
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/interface/interface_panel.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 1c6ea14b60b..9435ca4d4c5 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -1311,9 +1311,6 @@ static void ui_panel_category_draw_tab(int mode, float minx, float miny, float m mul_v2_fl(vec[a], rad); } - (void)use_shadow; - (void)use_highlight; - glBegin(mode); /* start with corner right-top */ @@ -1644,6 +1641,25 @@ int ui_handler_panel_region(bContext *C, const wmEvent *event, ARegion *ar) retval = WM_UI_HANDLER_BREAK; } } + else if (ELEM(event->type, WHEELUPMOUSE, WHEELDOWNMOUSE)) { + /* mouse wheel cycle tabs */ + + /* first check if the mouse is in the tab region */ + if (event->ctrl || (event->x < ((PanelCategoryDyn *)ar->panels_category.first)->rect.xmax)) { + const char *category = UI_panel_category_active_get(ar, false); + if (LIKELY(category)) { + PanelCategoryDyn *pc_dyn = UI_panel_category_find(ar, category); + if (LIKELY(pc_dyn)) { + pc_dyn = (event->type == WHEELDOWNMOUSE) ? pc_dyn->next : pc_dyn->prev; + if (pc_dyn) { + UI_panel_category_active_set(ar, pc_dyn->idname); + ED_region_tag_redraw(ar); + } + } + } + retval = WM_UI_HANDLER_BREAK; + } + } } } |