diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-08-09 00:38:55 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-08-09 00:38:55 +0400 |
commit | 5e0f254afa8caed1febbe02130cc313a53149efe (patch) | |
tree | 859b5590307db3310e070b258c04697dabaac2a1 /source/blender/windowmanager | |
parent | 6cfb7f50d2856068f74125321a348e43b7c9c3d4 (diff) |
utility functions for getting/setting rectangles for operators.
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r-- | source/blender/windowmanager/WM_api.h | 2 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_operators.c | 21 |
2 files changed, 20 insertions, 3 deletions
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index 60efc3b3541..ee7b44fb1e9 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -208,6 +208,8 @@ void WM_operator_properties_create(struct PointerRNA *ptr, const char *opstring void WM_operator_properties_create_ptr(struct PointerRNA *ptr, struct wmOperatorType *ot); void WM_operator_properties_free(struct PointerRNA *ptr); void WM_operator_properties_filesel(struct wmOperatorType *ot, int filter, short type, short action, short flag, short display); +void WM_operator_properties_border(struct wmOperatorType *ot); +void WM_operator_properties_border_to_rcti(struct wmOperator *op, struct rcti *rect); void WM_operator_properties_gesture_border(struct wmOperatorType *ot, int extend); void WM_operator_properties_mouse_select(struct wmOperatorType *ot); void WM_operator_properties_gesture_straightline(struct wmOperatorType *ot, int cursor); diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 685ef467ad3..52436b6564c 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -906,16 +906,31 @@ void WM_operator_properties_select_all(wmOperatorType *ot) RNA_def_enum(ot->srna, "action", select_all_actions, SEL_TOGGLE, "Action", "Selection action to execute"); } -void WM_operator_properties_gesture_border(wmOperatorType *ot, int extend) +void WM_operator_properties_border(wmOperatorType *ot) { - RNA_def_int(ot->srna, "gesture_mode", 0, INT_MIN, INT_MAX, "Gesture Mode", "", INT_MIN, INT_MAX); RNA_def_int(ot->srna, "xmin", 0, INT_MIN, INT_MAX, "X Min", "", INT_MIN, INT_MAX); RNA_def_int(ot->srna, "xmax", 0, INT_MIN, INT_MAX, "X Max", "", INT_MIN, INT_MAX); RNA_def_int(ot->srna, "ymin", 0, INT_MIN, INT_MAX, "Y Min", "", INT_MIN, INT_MAX); RNA_def_int(ot->srna, "ymax", 0, INT_MIN, INT_MAX, "Y Max", "", INT_MIN, INT_MAX); +} + +void WM_operator_properties_border_to_rcti(struct wmOperator *op, rcti *rect) +{ + rect->xmin = RNA_int_get(op->ptr, "xmin"); + rect->ymin = RNA_int_get(op->ptr, "ymin"); + rect->xmax = RNA_int_get(op->ptr, "xmax"); + rect->ymax = RNA_int_get(op->ptr, "ymax"); +} - if (extend) +void WM_operator_properties_gesture_border(wmOperatorType *ot, int extend) +{ + RNA_def_int(ot->srna, "gesture_mode", 0, INT_MIN, INT_MAX, "Gesture Mode", "", INT_MIN, INT_MAX); + + WM_operator_properties_border(ot); + + if (extend) { RNA_def_boolean(ot->srna, "extend", 1, "Extend", "Extend selection instead of deselecting everything first"); + } } void WM_operator_properties_mouse_select(wmOperatorType *ot) |