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:
authorTon Roosendaal <ton@blender.org>2009-07-21 15:03:07 +0400
committerTon Roosendaal <ton@blender.org>2009-07-21 15:03:07 +0400
commited921058573dca5277f062e992ad0db0393071fe (patch)
tree75a86f6b33c38242cd1e116e37206555383ed376 /source/blender/editors/transform/transform.h
parent0865bf295947e5cd0b59429edf084f738321aef0 (diff)
2.5
Modal keymaps. I've tried to make it as simple as possible, yet still using sufficient facilities to enable self-documenting UIs, saving/reading in files, and proper Python support. The simplicity is: the 'modal keymap' just checks an event, uses event matching similarly to other keymap matching, and if there's a match it changes the event type, and sets the event value to what the modal keymap has defined. The event values are being defined using EnumPropertyItem structs, so the UI will be able to show all options in self-documenting way. This system also allows to still handle hardcoded own events. Tech doc: 1) define keymap - Create map with unique name, WM_modalkeymap_add() - Give map property definitions (EnumPropertyItem *) This only for UI, so user can get information on available options 2) items - WM_modalkeymap_add_item(): give it an enum value for events 3) activate - In keymap definition code, assign the modal keymap to operatortype WM_modalkeymap_assign() 4) event manager - The event handler will check for modal keymap, if so: - If the modal map has a match: - Sets event->type to EVT_MODAL_MAP - Sets event->val to the enum value 5) modal handler - If event type is EVT_MODAL_MAP: - Check event->val, handle it - Other events can just be handled still Two examples added in the code: editors/transform/transform.c: transform_modal_keymap() editors/screen/screen_ops.c: keymap_modal_set() Also: to support 'key release' the define KM_RELEASE now is officially used in event manager, this is not '0', so don't check key events with the old convention if(event->val) but use if(event->val==KM_PRESS)
Diffstat (limited to 'source/blender/editors/transform/transform.h')
-rw-r--r--source/blender/editors/transform/transform.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h
index db78632e76a..efa60b15293 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -47,6 +47,7 @@ struct bConstraint;
struct BezTriple;
struct wmOperatorType;
struct wmOperator;
+struct wmWindowManager;
struct bContext;
struct wmEvent;
struct wmTimer;
@@ -482,9 +483,11 @@ int Mirror(TransInfo *t, short mval[2]);
void initAlign(TransInfo *t);
int Align(TransInfo *t, short mval[2]);
-
void drawPropCircle(const struct bContext *C, TransInfo *t);
+void transform_modal_keymap(struct wmWindowManager *wm);
+
+
/*********************** transform_conversions.c ********** */
struct ListBase;