diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-01-20 17:47:49 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-01-20 17:47:49 +0300 |
commit | 99efebd2dd24a8e0827cf0f13bc40c2844946676 (patch) | |
tree | 3b4dc335f6b5a99295cf84d682b3cbd347aa4b4e /source/blender/editors/screen/screen_ops.c | |
parent | a177d64213cbebdd282c6dda542e277f9351db6b (diff) | |
parent | dd35048602a3dea450192195cfbedcaaca555c21 (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/editors/screen/screen_ops.c')
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 278 |
1 files changed, 214 insertions, 64 deletions
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index d0cdf77d3cc..a69f9188f59 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -93,7 +93,9 @@ #define KM_MODAL_SNAP_ON 3 #define KM_MODAL_SNAP_OFF 4 -/* ************** Exported Poll tests ********************** */ +/* -------------------------------------------------------------------- */ +/** \name Public Poll API + * \{ */ int ED_operator_regionactive(bContext *C) { @@ -127,36 +129,6 @@ static int ED_operator_screenactive_norender(bContext *C) return 1; } - -static int screen_active_editable(bContext *C) -{ - if (ED_operator_screenactive(C)) { - /* no full window splitting allowed */ - if (CTX_wm_screen(C)->state != SCREENNORMAL) - return 0; - return 1; - } - return 0; -} - -static ARegion *screen_find_region_type(bContext *C, int type) -{ - ARegion *ar = CTX_wm_region(C); - - /* find the header region - * - try context first, but upon failing, search all regions in area... - */ - if ((ar == NULL) || (ar->regiontype != type)) { - ScrArea *sa = CTX_wm_area(C); - ar = BKE_area_find_region_type(sa, type); - } - else { - ar = NULL; - } - - return ar; -} - /* when mouse is over area-edge */ int ED_operator_screen_mainwinactive(bContext *C) { @@ -589,7 +561,46 @@ int ED_operator_camera(bContext *C) return (cam != NULL); } -/* *************************** action zone operator ************************** */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Internal Screen Utilities + * \{ */ + +static int screen_active_editable(bContext *C) +{ + if (ED_operator_screenactive(C)) { + /* no full window splitting allowed */ + if (CTX_wm_screen(C)->state != SCREENNORMAL) + return 0; + return 1; + } + return 0; +} + +static ARegion *screen_find_region_type(bContext *C, int type) +{ + ARegion *ar = CTX_wm_region(C); + + /* find the header region + * - try context first, but upon failing, search all regions in area... + */ + if ((ar == NULL) || (ar->regiontype != type)) { + ScrArea *sa = CTX_wm_area(C); + ar = BKE_area_find_region_type(sa, type); + } + else { + ar = NULL; + } + + return ar; +} + +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Action Zone Operator + * \{ */ /* operator state vars used: * none @@ -861,7 +872,11 @@ static void SCREEN_OT_actionzone(wmOperatorType *ot) RNA_def_int(ot->srna, "modifier", 0, 0, 2, "Modifier", "Modifier state", 0, 2); } -/* ************** swap area operator *********************************** */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Swap Area Operator + * \{ */ /* operator state vars used: * sa1 start area @@ -981,7 +996,13 @@ static void SCREEN_OT_area_swap(wmOperatorType *ot) ot->flag = OPTYPE_BLOCKING; } -/* *********** Duplicate area as new window operator ****************** */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Area Duplicate Operator + * + * Create new window from area. + * \{ */ /* operator callback */ static int area_dupli_invoke(bContext *C, wmOperator *op, const wmEvent *event) @@ -1062,8 +1083,11 @@ static void SCREEN_OT_area_dupli(wmOperatorType *ot) ot->poll = ED_operator_areaactive; } +/** \} */ -/* ************** move area edge operator *********************************** */ +/* -------------------------------------------------------------------- */ +/** \name Move Area Edge Operator + * \{ */ /* operator state vars used: * x, y mouse coord near edge @@ -1405,7 +1429,11 @@ static void SCREEN_OT_area_move(wmOperatorType *ot) RNA_def_int(ot->srna, "delta", 0, INT_MIN, INT_MAX, "Delta", "", INT_MIN, INT_MAX); } -/* ************** split area operator *********************************** */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Split Area Operator + * \{ */ /* * operator state vars: @@ -1888,9 +1916,11 @@ static void SCREEN_OT_area_split(wmOperatorType *ot) RNA_def_int(ot->srna, "mouse_y", -100, INT_MIN, INT_MAX, "Mouse Y", "", INT_MIN, INT_MAX); } +/** \} */ - -/* ************** scale region edge operator *********************************** */ +/* -------------------------------------------------------------------- */ +/** \name Scale Region Edge Operator + * \{ */ typedef struct RegionMoveData { AZone *az; @@ -2159,8 +2189,11 @@ static void SCREEN_OT_region_scale(wmOperatorType *ot) ot->flag = OPTYPE_BLOCKING | OPTYPE_INTERNAL; } +/** \} */ -/* ************** frame change operator ***************************** */ +/* -------------------------------------------------------------------- */ +/** \name Frame Change Operator + * \{ */ static void areas_do_frame_follow(bContext *C, bool middle) { @@ -2241,6 +2274,11 @@ static void SCREEN_OT_frame_offset(wmOperatorType *ot) RNA_def_int(ot->srna, "delta", 0, INT_MIN, INT_MAX, "Delta", "", INT_MIN, INT_MAX); } +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Frame Jump Operator + * \{ */ /* function to be called outside UI context, or for redo */ static int frame_jump_exec(bContext *C, wmOperator *op) @@ -2295,8 +2333,11 @@ static void SCREEN_OT_frame_jump(wmOperatorType *ot) RNA_def_boolean(ot->srna, "end", 0, "Last Frame", "Jump to the last frame of the frame range"); } +/** \} */ -/* ************** jump to keyframe operator ***************************** */ +/* -------------------------------------------------------------------- */ +/** \name Jump to Key-Frame Operator + * \{ */ /* function to be called outside UI context, or for redo */ static int keyframe_jump_exec(bContext *C, wmOperator *op) @@ -2405,7 +2446,11 @@ static void SCREEN_OT_keyframe_jump(wmOperatorType *ot) RNA_def_boolean(ot->srna, "next", true, "Next Keyframe", ""); } -/* ************** jump to marker operator ***************************** */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Jump to Marker Operator + * \{ */ /* function to be called outside UI context, or for redo */ static int marker_jump_exec(bContext *C, wmOperator *op) @@ -2468,7 +2513,11 @@ static void SCREEN_OT_marker_jump(wmOperatorType *ot) RNA_def_boolean(ot->srna, "next", true, "Next Marker", ""); } -/* ************** switch screen operator ***************************** */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Set Screen Operator + * \{ */ /* function to be called outside UI context, or for redo */ static int screen_set_exec(bContext *C, wmOperator *op) @@ -2496,8 +2545,11 @@ static void SCREEN_OT_screen_set(wmOperatorType *ot) RNA_def_int(ot->srna, "delta", 0, INT_MIN, INT_MAX, "Delta", "", INT_MIN, INT_MAX); } -/* ************** screen full-area operator ***************************** */ +/** \} */ +/* -------------------------------------------------------------------- */ +/** \name Screen Full-Area Operator + * \{ */ /* function to be called outside UI context, or for redo */ static int screen_maximize_area_exec(bContext *C, wmOperator *op) @@ -2548,7 +2600,11 @@ static void SCREEN_OT_screen_full_area(wmOperatorType *ot) RNA_def_property_flag(prop, PROP_SKIP_SAVE); } -/* ************** join area operator ********************************************** */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Screen Join-Area Operator + * \{ */ /* operator state vars used: * x1, y1 mouse coord in first area, which will disappear @@ -2833,7 +2889,11 @@ static void SCREEN_OT_area_join(wmOperatorType *ot) RNA_def_int(ot->srna, "max_y", -100, INT_MIN, INT_MAX, "Y 2", "", INT_MIN, INT_MAX); } -/* ******************************* */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Screen Area Options Operator + * \{ */ static int screen_area_options_invoke(bContext *C, wmOperator *op, const wmEvent *event) { @@ -2886,9 +2946,11 @@ static void SCREEN_OT_area_options(wmOperatorType *ot) ot->flag = OPTYPE_INTERNAL; } +/** \} */ -/* ******************************* */ - +/* -------------------------------------------------------------------- */ +/** \name Space Data Cleanup Operator + * \{ */ static int spacedata_cleanup_exec(bContext *C, wmOperator *op) { @@ -2927,7 +2989,11 @@ static void SCREEN_OT_spacedata_cleanup(wmOperatorType *ot) } -/* ************** repeat last operator ***************************** */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Repeat Last Operator + * \{ */ static int repeat_last_exec(bContext *C, wmOperator *UNUSED(op)) { @@ -2966,6 +3032,12 @@ static void SCREEN_OT_repeat_last(wmOperatorType *ot) } +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Repeat History Operator + * \{ */ + static int repeat_history_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) { wmWindowManager *wm = CTX_wm_manager(C); @@ -3023,7 +3095,11 @@ static void SCREEN_OT_repeat_history(wmOperatorType *ot) RNA_def_int(ot->srna, "index", 0, 0, INT_MAX, "Index", "", 0, 1000); } -/* ********************** redo operator ***************************** */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Redo Operator + * \{ */ static int redo_last_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *UNUSED(event)) { @@ -3048,7 +3124,11 @@ static void SCREEN_OT_redo_last(wmOperatorType *ot) ot->poll = ED_operator_screenactive; } -/* ************** region four-split operator ***************************** */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Region Quad-View Operator + * \{ */ static void view3d_localview_update_rv3d(struct RegionView3D *rv3d) { @@ -3201,8 +3281,11 @@ static void SCREEN_OT_region_quadview(wmOperatorType *ot) ot->flag = 0; } +/** \} */ -/* ************** region flip operator ***************************** */ +/* -------------------------------------------------------------------- */ +/** \name Region Flip Operator + * \{ */ /* flip a region alignment */ static int region_flip_exec(bContext *C, wmOperator *UNUSED(op)) @@ -3241,7 +3324,11 @@ static void SCREEN_OT_region_flip(wmOperatorType *ot) ot->flag = 0; } -/* ************** header operator ***************************** */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Header Toggle Operator + * \{ */ static int header_exec(bContext *C, wmOperator *UNUSED(op)) { @@ -3271,8 +3358,11 @@ static void SCREEN_OT_header(wmOperatorType *ot) ot->exec = header_exec; } +/** \} */ -/* ************** show menus operator ***************************** */ +/* -------------------------------------------------------------------- */ +/** \name Header Toggle Menu Operator + * \{ */ /* show/hide header text menus */ static int header_toggle_menus_exec(bContext *C, wmOperator *UNUSED(op)) @@ -3301,8 +3391,11 @@ static void SCREEN_OT_header_toggle_menus(wmOperatorType *ot) ot->flag = 0; } +/** \} */ -/* ************** header tools operator ***************************** */ +/* -------------------------------------------------------------------- */ +/** \name Header Tools Operator + * \{ */ void ED_screens_header_tools_menu_create(bContext *C, uiLayout *layout, void *UNUSED(arg)) { @@ -3355,7 +3448,13 @@ static void SCREEN_OT_header_toolbox(wmOperatorType *ot) ot->invoke = header_toolbox_invoke; } -/* ****************** anim player, with timer ***************** */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Animation Step Operator + * + * Animation Step. + * \{ */ static int match_area_with_refresh(int spacetype, int refresh) { @@ -3652,7 +3751,13 @@ static void SCREEN_OT_animation_step(wmOperatorType *ot) } -/* ****************** anim player, starts or ends timer ***************** */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Animation Playback Operator + * + * Animation Playback with Timer. + * \{ */ /* find window that owns the animation timer */ bScreen *ED_screen_animation_playing(const wmWindowManager *wm) @@ -3745,6 +3850,12 @@ static void SCREEN_OT_animation_play(wmOperatorType *ot) RNA_def_property_flag(prop, PROP_SKIP_SAVE); } +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Animation Cancel Operator + * \{ */ + static int screen_animation_cancel_exec(bContext *C, wmOperator *op) { bScreen *screen = ED_screen_animation_playing(CTX_wm_manager(C)); @@ -3784,7 +3895,11 @@ static void SCREEN_OT_animation_cancel(wmOperatorType *ot) RNA_def_boolean(ot->srna, "restore_frame", true, "Restore Frame", "Restore the frame when animation was initialized"); } -/* ************** border select operator (template) ***************************** */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Border Select Operator (Template) + * \{ */ /* operator state vars used: (added by default WM callbacks) * xmin, ymin @@ -3839,6 +3954,12 @@ static void SCREEN_OT_border_select(wmOperatorType *ot) } #endif +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Full Screen Back Operator + * \{ */ + /* *********************** generic fullscreen 'back' button *************** */ @@ -3873,7 +3994,11 @@ static void SCREEN_OT_back_to_previous(struct wmOperatorType *ot) ot->poll = ED_operator_screenactive; } -/* *********** show user pref window ****** */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Show User Preferences Operator + * \{ */ static int userpref_show_invoke(bContext *C, wmOperator *op, const wmEvent *event) { @@ -3903,7 +4028,11 @@ static void SCREEN_OT_userpref_show(struct wmOperatorType *ot) ot->poll = ED_operator_screenactive; } -/********************* new screen operator *********************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name New Screen Operator + * \{ */ static int screen_new_exec(bContext *C, wmOperator *UNUSED(op)) { @@ -3930,7 +4059,11 @@ static void SCREEN_OT_new(wmOperatorType *ot) ot->poll = WM_operator_winactive; } -/********************* delete screen operator *********************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Delete Screen Operator + * \{ */ static int screen_delete_exec(bContext *C, wmOperator *UNUSED(op)) { @@ -3954,7 +4087,11 @@ static void SCREEN_OT_delete(wmOperatorType *ot) ot->exec = screen_delete_exec; } -/* ***************** region alpha blending ***************** */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Region Alpha Blending Operator + * \{ */ /* implementation note: a disappearing region needs at least 1 last draw with 100% backbuffer * texture over it- then triple buffer will clear it entirely. @@ -4096,7 +4233,11 @@ static void SCREEN_OT_region_blend(wmOperatorType *ot) /* properties */ } -/* ******************** space context cycling operator ******************** */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Space Context Cycle Operator + * \{ */ /* SCREEN_OT_space_context_cycle direction */ enum { @@ -4179,9 +4320,11 @@ static void SCREEN_OT_space_context_cycle(wmOperatorType *ot) "Direction to cycle through"); } +/** \} */ -/* **************** Assigning operatortypes to global list, adding handlers **************** */ - +/* -------------------------------------------------------------------- */ +/** \name Assigning Operator Types + * \{ */ /* called in spacetypes.c */ void ED_operatortypes_screen(void) @@ -4240,6 +4383,12 @@ void ED_operatortypes_screen(void) } +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Operator Key Map + * \{ */ + static void keymap_modal_set(wmKeyConfig *keyconf) { static const EnumPropertyItem modal_items[] = { @@ -4441,3 +4590,4 @@ void ED_keymap_screen(wmKeyConfig *keyconf) keymap_modal_set(keyconf); } +/** \} */ |