Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2010-02-08 02:39:44 +0300
committerJoshua Leung <aligorith@gmail.com>2010-02-08 02:39:44 +0300
commit2f72b91a54faa7cfbdfd97eff608c8911df1d221 (patch)
tree82db3f8d8b5c80a2e7fc2c268048967480b2f3f9 /source/blender/windowmanager
parentf99d06bc83449162a62378e5f832e52fbc765426 (diff)
Operator Execution Contexts Bugfix:
This commit adds a few more execution contexts for operators, given the increasing tendency for some special regiontypes to exist within areas that must have their own set of special operators. Examples of these include the "channel" operators in the Animation Editors (i.e. those in the 'Channels' menu), and the "Fit to Preview Window" operator for the Sequencer. Previously, operators such as these would not function when clicked on from the menus, and they would not show the hotkeys they were mapped to. Also, fixed a few operator definitions in the Animation Editors which were missing ot->prop defines. This meant that some hotkeys (mainly selection) were shown incorrectly in the menus.
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r--source/blender/windowmanager/WM_types.h4
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c35
-rw-r--r--source/blender/windowmanager/intern/wm_keymap.c24
3 files changed, 50 insertions, 13 deletions
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h
index 3efa2b85174..7a08320cc19 100644
--- a/source/blender/windowmanager/WM_types.h
+++ b/source/blender/windowmanager/WM_types.h
@@ -58,11 +58,15 @@ enum {
/* if there's invoke, call it, otherwise exec */
WM_OP_INVOKE_DEFAULT,
WM_OP_INVOKE_REGION_WIN,
+ WM_OP_INVOKE_REGION_CHANNELS,
+ WM_OP_INVOKE_REGION_PREVIEW,
WM_OP_INVOKE_AREA,
WM_OP_INVOKE_SCREEN,
/* only call exec */
WM_OP_EXEC_DEFAULT,
WM_OP_EXEC_REGION_WIN,
+ WM_OP_EXEC_REGION_CHANNELS,
+ WM_OP_EXEC_REGION_PREVIEW,
WM_OP_EXEC_AREA,
WM_OP_EXEC_SCREEN
};
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 7e7dfe7a968..685e671c31a 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -48,6 +48,7 @@
#include "BKE_main.h"
#include "BKE_report.h"
#include "BKE_scene.h"
+#include "BKE_screen.h"
#include "BKE_utildefines.h"
#include "ED_fileselect.h"
@@ -656,17 +657,37 @@ static int wm_operator_call_internal(bContext *C, wmOperatorType *ot, int contex
case WM_OP_EXEC_REGION_WIN:
case WM_OP_INVOKE_REGION_WIN:
+ case WM_OP_EXEC_REGION_CHANNELS:
+ case WM_OP_INVOKE_REGION_CHANNELS:
+ case WM_OP_EXEC_REGION_PREVIEW:
+ case WM_OP_INVOKE_REGION_PREVIEW:
{
- /* forces operator to go to the region window, for header menus
- but we stay in the same region if we are already in one */
+ /* forces operator to go to the region window/channels/preview, for header menus
+ * but we stay in the same region if we are already in one
+ */
ARegion *ar= CTX_wm_region(C);
ScrArea *area= CTX_wm_area(C);
+ int type = RGN_TYPE_WINDOW;
- if(!(ar && ar->regiontype == RGN_TYPE_WINDOW) && area) {
- ARegion *ar1= area->regionbase.first;
- for(; ar1; ar1= ar1->next)
- if(ar1->regiontype==RGN_TYPE_WINDOW)
- break;
+ switch (context) {
+ case WM_OP_EXEC_REGION_CHANNELS:
+ case WM_OP_INVOKE_REGION_CHANNELS:
+ type = RGN_TYPE_CHANNELS;
+
+ case WM_OP_EXEC_REGION_PREVIEW:
+ case WM_OP_INVOKE_REGION_PREVIEW:
+ type = RGN_TYPE_PREVIEW;
+ break;
+
+ case WM_OP_EXEC_REGION_WIN:
+ case WM_OP_INVOKE_REGION_WIN:
+ default:
+ type = RGN_TYPE_WINDOW;
+ break;
+ }
+
+ if(!(ar && ar->regiontype == type) && area) {
+ ARegion *ar1= BKE_area_find_region_type(area, type);
if(ar1)
CTX_wm_region_set(C, ar1);
}
diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c
index 9b0f6823522..e0d4cf13efd 100644
--- a/source/blender/windowmanager/intern/wm_keymap.c
+++ b/source/blender/windowmanager/intern/wm_keymap.c
@@ -43,6 +43,7 @@
#include "BKE_idprop.h"
#include "BKE_library.h"
#include "BKE_main.h"
+#include "BKE_screen.h"
#include "BKE_utildefines.h"
#include "RNA_access.h"
@@ -475,16 +476,27 @@ static wmKeyMapItem *wm_keymap_item_find_props(const bContext *C, const char *op
if(found==NULL) {
if(ELEM(opcontext, WM_OP_EXEC_REGION_WIN, WM_OP_INVOKE_REGION_WIN)) {
if(sa) {
- if(!(ar && ar->regiontype == RGN_TYPE_WINDOW)) {
- for(ar= sa->regionbase.first; ar; ar= ar->next)
- if(ar->regiontype==RGN_TYPE_WINDOW)
- break;
- }
-
+ if (!(ar && ar->regiontype == RGN_TYPE_WINDOW))
+ ar= BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
+
if(ar)
found= wm_keymap_item_find_handlers(C, &ar->handlers, opname, opcontext, properties, hotkey, compare_props, keymap_r);
}
}
+ else if(ELEM(opcontext, WM_OP_EXEC_REGION_CHANNELS, WM_OP_INVOKE_REGION_CHANNELS)) {
+ if (!(ar && ar->regiontype == RGN_TYPE_CHANNELS))
+ ar= BKE_area_find_region_type(sa, RGN_TYPE_CHANNELS);
+
+ if(ar)
+ found= wm_keymap_item_find_handlers(C, &ar->handlers, opname, opcontext, properties, hotkey, compare_props, keymap_r);
+ }
+ else if(ELEM(opcontext, WM_OP_EXEC_REGION_PREVIEW, WM_OP_INVOKE_REGION_PREVIEW)) {
+ if (!(ar && ar->regiontype == RGN_TYPE_PREVIEW))
+ ar= BKE_area_find_region_type(sa, RGN_TYPE_PREVIEW);
+
+ if(ar)
+ found= wm_keymap_item_find_handlers(C, &ar->handlers, opname, opcontext, properties, hotkey, compare_props, keymap_r);
+ }
else {
if(ar)
found= wm_keymap_item_find_handlers(C, &ar->handlers, opname, opcontext, properties, hotkey, compare_props, keymap_r);