diff options
author | Ton Roosendaal <ton@blender.org> | 2008-12-15 14:59:42 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2008-12-15 14:59:42 +0300 |
commit | b4aef1673369b8f0a4e8009f9aab38c7c586ef4f (patch) | |
tree | d801dec85eed7db39132a0fd69339c714e1c73c7 | |
parent | 21ca5946258a6a79e309e8e2f7de3c9caa8d7a53 (diff) |
2.5
Testing toy for space editor devs: press F5key in header or channel list
(or any 'alignment constrained' region to flip it to other side.
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index cb45f1a2680..a818c47bbbd 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -1256,6 +1256,38 @@ void ED_SCR_OT_region_split(wmOperatorType *ot) RNA_def_property_enum_default(prop, 'h'); } +/* ************** region flip operator ***************************** */ + +/* flip a region alignment */ +static int region_flip_exec(bContext *C, wmOperator *op) +{ + if(C->region->alignment==RGN_ALIGN_TOP) + C->region->alignment= RGN_ALIGN_BOTTOM; + else if(C->region->alignment==RGN_ALIGN_BOTTOM) + C->region->alignment= RGN_ALIGN_TOP; + else if(C->region->alignment==RGN_ALIGN_LEFT) + C->region->alignment= RGN_ALIGN_RIGHT; + else if(C->region->alignment==RGN_ALIGN_RIGHT) + C->region->alignment= RGN_ALIGN_LEFT; + + WM_event_add_notifier(C, WM_NOTE_SCREEN_CHANGED, 0, NULL); + + return OPERATOR_FINISHED; +} + +void ED_SCR_OT_region_flip(wmOperatorType *ot) +{ + + /* identifiers */ + ot->name= "Flip Region"; + ot->idname= "ED_SCR_OT_region_flip"; + + /* api callbacks */ + ot->exec= region_flip_exec; + + ot->poll= ED_operator_areaactive; +} + /* ************** border select operator (template) ***************************** */ @@ -1331,6 +1363,7 @@ void ED_operatortypes_screen(void) WM_operatortype_append(ED_SCR_OT_area_join); WM_operatortype_append(ED_SCR_OT_area_rip); WM_operatortype_append(ED_SCR_OT_region_split); + WM_operatortype_append(ED_SCR_OT_region_flip); /* tools shared by more space types */ ED_marker_operatortypes(); @@ -1353,6 +1386,7 @@ void ED_keymap_screen(wmWindowManager *wm) /* tests */ WM_keymap_add_item(keymap, "ED_SCR_OT_region_split", SKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "ED_SCR_OT_region_split", SKEY, KM_PRESS, KM_SHIFT, 0); + WM_keymap_add_item(keymap, "ED_SCR_OT_region_flip", F5KEY, KM_PRESS, 0, 0); WM_keymap_verify_item(keymap, "ED_SCR_OT_repeat_last", F4KEY, KM_PRESS, 0, 0); } |