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:
Diffstat (limited to 'source/blender/editors/screen/screen_ops.c')
-rw-r--r--source/blender/editors/screen/screen_ops.c113
1 files changed, 89 insertions, 24 deletions
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index 417bdf84232..0b374617cce 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -38,7 +38,6 @@
#include "DNA_lattice_types.h"
#include "DNA_object_types.h"
#include "DNA_curve_types.h"
-#include "DNA_gpencil_types.h"
#include "DNA_scene_types.h"
#include "DNA_meta_types.h"
#include "DNA_mesh_types.h"
@@ -48,7 +47,6 @@
#include "DNA_userdef_types.h"
#include "BKE_context.h"
-#include "BKE_customdata.h"
#include "BKE_editmesh.h"
#include "BKE_fcurve.h"
#include "BKE_global.h"
@@ -1043,28 +1041,28 @@ static int actionzone_modal(bContext *C, wmOperator *op, const wmEvent *event)
if (BKE_screen_find_area_xy(sc, SPACE_TYPE_ANY, event->x, event->y) == sad->sa1) {
/* Same area, so possible split. */
WM_cursor_set(
- win, (ELEM(sad->gesture_dir, 'n', 's')) ? BC_V_SPLITCURSOR : BC_H_SPLITCURSOR);
+ win, (ELEM(sad->gesture_dir, 'n', 's')) ? WM_CURSOR_H_SPLIT : WM_CURSOR_V_SPLIT);
is_gesture = (delta_max > split_threshold);
}
else {
/* Different area, so possible join. */
if (sad->gesture_dir == 'n') {
- WM_cursor_set(win, BC_N_ARROWCURSOR);
+ WM_cursor_set(win, WM_CURSOR_N_ARROW);
}
else if (sad->gesture_dir == 's') {
- WM_cursor_set(win, BC_S_ARROWCURSOR);
+ WM_cursor_set(win, WM_CURSOR_S_ARROW);
}
else if (sad->gesture_dir == 'e') {
- WM_cursor_set(win, BC_E_ARROWCURSOR);
+ WM_cursor_set(win, WM_CURSOR_E_ARROW);
}
else {
- WM_cursor_set(win, BC_W_ARROWCURSOR);
+ WM_cursor_set(win, WM_CURSOR_W_ARROW);
}
is_gesture = (delta_max > join_threshold);
}
}
else {
- WM_cursor_set(CTX_wm_window(C), BC_CROSSCURSOR);
+ WM_cursor_set(CTX_wm_window(C), WM_CURSOR_CROSS);
is_gesture = false;
}
}
@@ -1229,7 +1227,7 @@ static int area_swap_invoke(bContext *C, wmOperator *op, const wmEvent *event)
}
/* add modal handler */
- WM_cursor_modal_set(CTX_wm_window(C), BC_SWAPAREA_CURSOR);
+ WM_cursor_modal_set(CTX_wm_window(C), WM_CURSOR_SWAP_AREA);
WM_event_add_modal_handler(C, op);
return OPERATOR_RUNNING_MODAL;
@@ -2121,7 +2119,7 @@ static void area_split_preview_update_cursor(bContext *C, wmOperator *op)
{
wmWindow *win = CTX_wm_window(C);
int dir = RNA_enum_get(op->ptr, "direction");
- WM_cursor_set(win, (dir == 'n' || dir == 's') ? BC_V_SPLITCURSOR : BC_H_SPLITCURSOR);
+ WM_cursor_set(win, (dir == 'n' || dir == 's') ? WM_CURSOR_H_SPLIT : WM_CURSOR_V_SPLIT);
}
/* UI callback, adds new handler */
@@ -3363,7 +3361,9 @@ static int area_join_modal(bContext *C, wmOperator *op, const wmEvent *event)
sAreaJoinData *jd;
if (op->customdata == NULL) {
- area_join_init(C, op, NULL, NULL);
+ if (!area_join_init(C, op, NULL, NULL)) {
+ return OPERATOR_CANCELLED;
+ }
}
jd = (sAreaJoinData *)op->customdata;
@@ -3418,19 +3418,19 @@ static int area_join_modal(bContext *C, wmOperator *op, const wmEvent *event)
}
if (dir == 1) {
- WM_cursor_set(win, BC_N_ARROWCURSOR);
+ WM_cursor_set(win, WM_CURSOR_N_ARROW);
}
else if (dir == 3) {
- WM_cursor_set(win, BC_S_ARROWCURSOR);
+ WM_cursor_set(win, WM_CURSOR_S_ARROW);
}
else if (dir == 2) {
- WM_cursor_set(win, BC_E_ARROWCURSOR);
+ WM_cursor_set(win, WM_CURSOR_E_ARROW);
}
else if (dir == 0) {
- WM_cursor_set(win, BC_W_ARROWCURSOR);
+ WM_cursor_set(win, WM_CURSOR_W_ARROW);
}
else {
- WM_cursor_set(win, BC_STOPCURSOR);
+ WM_cursor_set(win, WM_CURSOR_STOP);
}
break;
@@ -3846,10 +3846,7 @@ static int region_quadview_exec(bContext *C, wmOperator *op)
for (ar = sa->regionbase.first; ar; ar = arn) {
arn = ar->next;
if (ar->alignment == RGN_ALIGN_QSPLIT) {
- ED_region_exit(C, ar);
- BKE_area_region_free(sa->type, ar);
- BLI_remlink(&sa->regionbase, ar);
- MEM_freeN(ar);
+ ED_region_remove(C, sa, ar);
}
}
ED_area_tag_redraw(sa);
@@ -3934,6 +3931,65 @@ static void SCREEN_OT_region_quadview(wmOperatorType *ot)
/** \} */
/* -------------------------------------------------------------------- */
+/** \name Region Toggle Operator
+ * \{ */
+
+static int region_toggle_exec(bContext *C, wmOperator *op)
+{
+ PropertyRNA *prop = RNA_struct_find_property(op->ptr, "region_type");
+ ARegion *region;
+
+ if (RNA_property_is_set(op->ptr, prop)) {
+ region = BKE_area_find_region_type(CTX_wm_area(C), RNA_property_enum_get(op->ptr, prop));
+ }
+ else {
+ region = CTX_wm_region(C);
+ }
+
+ if (region) {
+ ED_region_toggle_hidden(C, region);
+ }
+ ED_region_tag_redraw(region);
+
+ return OPERATOR_FINISHED;
+}
+
+static bool region_toggle_poll(bContext *C)
+{
+ ScrArea *area = CTX_wm_area(C);
+
+ /* don't flip anything around in topbar */
+ if (area && area->spacetype == SPACE_TOPBAR) {
+ CTX_wm_operator_poll_msg_set(C, "Toggling regions in the Top-bar is not allowed");
+ return 0;
+ }
+
+ return ED_operator_areaactive(C);
+}
+
+static void SCREEN_OT_region_toggle(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Toggle Region";
+ ot->idname = "SCREEN_OT_region_toggle";
+ ot->description = "Hide or unhide the region";
+
+ /* api callbacks */
+ ot->exec = region_toggle_exec;
+ ot->poll = region_toggle_poll;
+ ot->flag = 0;
+
+ RNA_def_enum(ot->srna,
+ "region_type",
+ rna_enum_region_type_items,
+ 0,
+ "Region Type",
+ "Type of the region to toggle");
+}
+
+/** \} */
+
+/* -------------------------------------------------------------------- */
/** \name Region Flip Operator
* \{ */
@@ -4298,7 +4354,7 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), const wmEv
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = WM_window_get_active_view_layer(win);
- Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer, false);
+ Depsgraph *depsgraph = BKE_scene_get_depsgraph(bmain, scene, view_layer, false);
Scene *scene_eval = (depsgraph != NULL) ? DEG_get_evaluated_scene(depsgraph) : NULL;
wmTimer *wt = screen->animtimer;
ScreenAnimData *sad = wt->customdata;
@@ -4772,7 +4828,9 @@ static int userpref_show_invoke(bContext *C, wmOperator *op, const wmEvent *even
int sizey = 520 * UI_DPI_FAC;
/* changes context! */
- if (WM_window_open_temp(C, event->x, event->y, sizex, sizey, WM_WINDOW_USERPREFS) != NULL) {
+ if (WM_window_open_temp(
+ C, IFACE_("Blender Preferences"), event->x, event->y, sizex, sizey, SPACE_USERPREF) !=
+ NULL) {
/* The header only contains the editor switcher and looks empty.
* So hiding in the temp window makes sense. */
ScrArea *area = CTX_wm_area(C);
@@ -4821,7 +4879,11 @@ static int drivers_editor_show_invoke(bContext *C, wmOperator *op, const wmEvent
but = UI_context_active_but_prop_get(C, &ptr, &prop, &index);
/* changes context! */
- if (WM_window_open_temp(C, event->x, event->y, sizex, sizey, WM_WINDOW_DRIVERS) != NULL) {
+ if (WM_window_open_temp(
+ C, IFACE_("Blender Drivers Editor"), event->x, event->y, sizex, sizey, SPACE_GRAPH) !=
+ NULL) {
+ ED_drivers_editor_init(C, CTX_wm_area(C));
+
/* activate driver F-Curve for the property under the cursor */
if (but) {
FCurve *fcu;
@@ -4877,7 +4939,9 @@ static int info_log_show_invoke(bContext *C, wmOperator *op, const wmEvent *even
int shift_y = 480;
/* changes context! */
- if (WM_window_open_temp(C, event->x, event->y + shift_y, sizex, sizey, WM_WINDOW_INFO) != NULL) {
+ if (WM_window_open_temp(
+ C, IFACE_("Blender Info Log"), event->x, event->y + shift_y, sizex, sizey, SPACE_INFO) !=
+ NULL) {
return OPERATOR_FINISHED;
}
else {
@@ -5359,6 +5423,7 @@ void ED_operatortypes_screen(void)
WM_operatortype_append(SCREEN_OT_area_swap);
WM_operatortype_append(SCREEN_OT_region_quadview);
WM_operatortype_append(SCREEN_OT_region_scale);
+ WM_operatortype_append(SCREEN_OT_region_toggle);
WM_operatortype_append(SCREEN_OT_region_flip);
WM_operatortype_append(SCREEN_OT_header_toggle_menus);
WM_operatortype_append(SCREEN_OT_region_context_menu);