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:
authorJulian Eisel <eiseljulian@gmail.com>2018-01-30 00:53:32 +0300
committerJulian Eisel <eiseljulian@gmail.com>2018-01-30 01:24:11 +0300
commit3f0871dfcfbb1dda15c176dba92d36639305385a (patch)
treede7ffeeef7a99fc6103d413ebfa564596811087d /source/blender/editors/screen
parent53d94dafc474380651fc529f9c03f84ce7142b13 (diff)
parent1fe2b4bf608b22ae4513051e01cf45e5012c2409 (diff)
Merge branch 'blender2.8' into topbar
Diffstat (limited to 'source/blender/editors/screen')
-rw-r--r--source/blender/editors/screen/area.c4
-rw-r--r--source/blender/editors/screen/screen_draw.c138
-rw-r--r--source/blender/editors/screen/screen_edit.c3
-rw-r--r--source/blender/editors/screen/screen_intern.h4
-rw-r--r--source/blender/editors/screen/screen_ops.c632
5 files changed, 496 insertions, 285 deletions
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index dbeac782e10..f886a6ad613 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -769,6 +769,10 @@ static void area_azone_initialize(wmWindow *win, const bScreen *screen, ScrArea
return;
}
+ if (U.app_flag & USER_APP_LOCK_UI_LAYOUT) {
+ return;
+ }
+
/* can't click on bottom corners on OS X, already used for resizing */
#ifdef __APPLE__
if (!(sa->totrct.xmin == 0 && sa->totrct.ymin == 0) || WM_window_is_fullscreen(win))
diff --git a/source/blender/editors/screen/screen_draw.c b/source/blender/editors/screen/screen_draw.c
index 5690076fedb..2e4e9127ed6 100644
--- a/source/blender/editors/screen/screen_draw.c
+++ b/source/blender/editors/screen/screen_draw.c
@@ -33,7 +33,6 @@
#include "screen_intern.h"
-
/**
* Draw horizontal shape visualizing future joining (left as well right direction of future joining).
*/
@@ -289,18 +288,15 @@ static void drawscredge_area(ScrArea *sa, int sizex, int sizey, unsigned int pos
}
/**
- * Only for edge lines between areas, and the blended join arrows.
+ * Only for edge lines between areas.
*/
-void ED_screen_draw(wmWindow *win)
+void ED_screen_draw_edges(wmWindow *win)
{
bScreen *screen = WM_window_get_active_screen(win);
const int winsize_x = WM_window_pixels_x(win);
const int winsize_y = WM_window_pixels_y(win);
ScrArea *sa;
- ScrArea *sa1 = NULL;
- ScrArea *sa2 = NULL;
- ScrArea *sa3 = NULL;
wmSubWindowSet(win, screen->mainwin);
@@ -323,36 +319,47 @@ void ED_screen_draw(wmWindow *win)
for (sa = screen->areabase.first; sa; sa = sa->next) {
drawscredge_area(sa, winsize_x, winsize_y, pos);
-
- /* gather area split/join info */
- if (sa->flag & AREA_FLAG_DRAWJOINFROM) sa1 = sa;
- if (sa->flag & AREA_FLAG_DRAWJOINTO) sa2 = sa;
- if (sa->flag & (AREA_FLAG_DRAWSPLIT_H | AREA_FLAG_DRAWSPLIT_V)) sa3 = sa;
}
+ immUnbindProgram();
+
+ screen->do_draw = false;
+}
+
+/**
+ * The blended join arrows.
+ *
+ * \param sa1: Area from which the resultant originates.
+ * \param sa2: Target area that will be replaced.
+ */
+void ED_screen_draw_join_shape(ScrArea *sa1, ScrArea *sa2)
+{
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
+
+ glLineWidth(1);
+
/* blended join arrow */
- if (sa1 && sa2) {
- int dir = area_getorientation(sa1, sa2);
- int dira = -1;
- if (dir != -1) {
- switch (dir) {
- case 0: /* W */
- dir = 'r';
- dira = 'l';
- break;
- case 1: /* N */
- dir = 'd';
- dira = 'u';
- break;
- case 2: /* E */
- dir = 'l';
- dira = 'r';
- break;
- case 3: /* S */
- dir = 'u';
- dira = 'd';
- break;
- }
+ int dir = area_getorientation(sa1, sa2);
+ int dira = -1;
+ if (dir != -1) {
+ switch (dir) {
+ case 0: /* W */
+ dir = 'r';
+ dira = 'l';
+ break;
+ case 1: /* N */
+ dir = 'd';
+ dira = 'u';
+ break;
+ case 2: /* E */
+ dir = 'l';
+ dira = 'r';
+ break;
+ case 3: /* S */
+ dir = 'u';
+ dira = 'd';
+ break;
}
glEnable(GL_BLEND);
@@ -363,48 +370,59 @@ void ED_screen_draw(wmWindow *win)
glDisable(GL_BLEND);
}
- /* splitpoint */
- if (sa3) {
- glEnable(GL_BLEND);
- immUniformColor4ub(255, 255, 255, 100);
+ immUnbindProgram();
+}
- immBegin(GWN_PRIM_LINES, 2);
+void ED_screen_draw_split_preview(ScrArea *sa, const int dir, const float fac)
+{
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
- if (sa3->flag & AREA_FLAG_DRAWSPLIT_H) {
- immVertex2f(pos, sa3->totrct.xmin, win->eventstate->y);
- immVertex2f(pos, sa3->totrct.xmax, win->eventstate->y);
+ /* splitpoint */
+ glEnable(GL_BLEND);
+ immUniformColor4ub(255, 255, 255, 100);
- immEnd();
+ immBegin(GWN_PRIM_LINES, 2);
- immUniformColor4ub(0, 0, 0, 100);
+ if (dir == 'h') {
+ const float y = (1 - fac) * sa->totrct.ymin + fac * sa->totrct.ymax;
- immBegin(GWN_PRIM_LINES, 2);
+ immVertex2f(pos, sa->totrct.xmin, y);
+ immVertex2f(pos, sa->totrct.xmax, y);
- immVertex2f(pos, sa3->totrct.xmin, win->eventstate->y + 1);
- immVertex2f(pos, sa3->totrct.xmax, win->eventstate->y + 1);
- }
- else {
- immVertex2f(pos, win->eventstate->x, sa3->totrct.ymin);
- immVertex2f(pos, win->eventstate->x, sa3->totrct.ymax);
+ immEnd();
- immEnd();
+ immUniformColor4ub(0, 0, 0, 100);
- immUniformColor4ub(0, 0, 0, 100);
+ immBegin(GWN_PRIM_LINES, 2);
- immBegin(GWN_PRIM_LINES, 2);
+ immVertex2f(pos, sa->totrct.xmin, y + 1);
+ immVertex2f(pos, sa->totrct.xmax, y + 1);
- immVertex2f(pos, win->eventstate->x + 1, sa3->totrct.ymin);
- immVertex2f(pos, win->eventstate->x + 1, sa3->totrct.ymax);
- }
+ immEnd();
+ }
+ else {
+ BLI_assert(dir == 'v');
+ const float x = (1 - fac) * sa->totrct.xmin + fac * sa->totrct.xmax;
+
+ immVertex2f(pos, x, sa->totrct.ymin);
+ immVertex2f(pos, x, sa->totrct.ymax);
immEnd();
- glDisable(GL_BLEND);
+ immUniformColor4ub(0, 0, 0, 100);
+
+ immBegin(GWN_PRIM_LINES, 2);
+
+ immVertex2f(pos, x + 1, sa->totrct.ymin);
+ immVertex2f(pos, x + 1, sa->totrct.ymax);
+
+ immEnd();
}
- immUnbindProgram();
+ glDisable(GL_BLEND);
- screen->do_draw = false;
+ immUnbindProgram();
}
@@ -481,7 +499,7 @@ static void screen_preview_draw(const bScreen *screen, int size_x, int size_y)
void ED_screen_preview_render(const bScreen *screen, int size_x, int size_y, unsigned int *r_rect)
{
char err_out[256] = "unknown";
- GPUOffScreen *offscreen = GPU_offscreen_create(size_x, size_y, 0, err_out);
+ GPUOffScreen *offscreen = GPU_offscreen_create(size_x, size_y, 0, false, err_out);
GPU_offscreen_bind(offscreen, true);
glClearColor(0.0, 0.0, 0.0, 0.0);
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c
index 4b5ce2f4b81..57f45bf95ce 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -426,8 +426,6 @@ int screen_area_join(bContext *C, bScreen *scr, ScrArea *sa1, ScrArea *sa2)
/*printf("dir is : %i\n", dir);*/
if (dir == -1) {
- if (sa1) sa1->flag &= ~AREA_FLAG_DRAWJOINFROM;
- if (sa2) sa2->flag &= ~AREA_FLAG_DRAWJOINTO;
return 0;
}
@@ -458,7 +456,6 @@ int screen_area_join(bContext *C, bScreen *scr, ScrArea *sa1, ScrArea *sa2)
screen_delarea(C, scr, sa2);
BKE_screen_remove_double_scrverts(scr);
- sa1->flag &= ~AREA_FLAG_DRAWJOINFROM;
/* Update preview thumbnail */
BKE_icon_changed(scr->id.icon_id);
diff --git a/source/blender/editors/screen/screen_intern.h b/source/blender/editors/screen/screen_intern.h
index 39c3d72af6a..9214b4b7a68 100644
--- a/source/blender/editors/screen/screen_intern.h
+++ b/source/blender/editors/screen/screen_intern.h
@@ -31,6 +31,7 @@
#ifndef __SCREEN_INTERN_H__
#define __SCREEN_INTERN_H__
+struct bContext;
struct bContextDataResult;
struct Main;
@@ -65,7 +66,8 @@ ScrEdge *screen_find_active_scredge(const bScreen *sc,
struct AZone *is_in_area_actionzone(ScrArea *sa, const int xy[2]);
/* screen_context.c */
-int ed_screen_context(const struct bContext *C, const char *member, struct bContextDataResult *result);
+int ed_screen_context(
+ const struct bContext *C, const char *member, struct bContextDataResult *result);
extern const char *screen_context_dir[]; /* doc access */
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index 4e8bf6ea769..09af0d86f84 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -90,10 +90,12 @@
#define KM_MODAL_CANCEL 1
#define KM_MODAL_APPLY 2
-#define KM_MODAL_STEP10 3
-#define KM_MODAL_STEP10_OFF 4
+#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
@@ -807,8 +818,7 @@ static int actionzone_modal(bContext *C, wmOperator *op, const wmEvent *event)
/* once we drag outside the actionzone, register a gesture
* check we're not on an edge so join finds the other area */
is_gesture = ((is_in_area_actionzone(sad->sa1, &event->x) != sad->az) &&
- (screen_find_active_scredge(sc, screen_size_x, screen_size_y,
- event->x, event->y) == NULL));
+ (screen_find_active_scredge(sc, screen_size_x, screen_size_y, event->x, event->y) == NULL));
}
else {
const int delta_min = 1;
@@ -1098,6 +1108,7 @@ static void SCREEN_OT_area_dupli(wmOperatorType *ot)
typedef struct sAreaMoveData {
int bigger, smaller, origval, step;
char dir;
+ bool do_snap;
} sAreaMoveData;
/* helper call to move area-edge, sets limits
@@ -1189,55 +1200,98 @@ static int area_move_init(bContext *C, wmOperator *op)
return 1;
}
+static int area_snap_calc_location(
+ const bScreen *sc, const int delta,
+ const int origval, const int dir,
+ const int bigger, const int smaller)
+{
+ int final_loc = -1;
+
+ const int m_loc = origval + delta;
+ const int axis = (dir == 'v') ? 0 : 1;
+ int snap_dist;
+ int dist;
+ {
+ /* Test the snap to middle. */
+ int middle = origval + (bigger - smaller) / 2;
+ middle -= (middle % AREAGRID);
+
+ snap_dist = abs(m_loc - middle);
+ final_loc = middle;
+ }
+
+ for (const ScrVert *v1 = sc->vertbase.first; v1; v1 = v1->next) {
+ if (v1->editflag) {
+ const int v_loc = (&v1->vec.x)[!axis];
+
+ for (const ScrVert *v2 = sc->vertbase.first; v2; v2 = v2->next) {
+ if (!v2->editflag) {
+ if (v_loc == (&v2->vec.x)[!axis]) {
+ const int v_loc2 = (&v2->vec.x)[axis];
+ /* Do not snap to the vertices at the ends. */
+ if ((origval - smaller) < v_loc2 && v_loc2 < (origval + bigger)) {
+ dist = abs(m_loc - v_loc2);
+ if (dist <= snap_dist) {
+ snap_dist = dist;
+ final_loc = v_loc2;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return final_loc;
+}
+
/* moves selected screen edge amount of delta, used by split & move */
-static void area_move_apply_do(bContext *C, int origval, int delta, int dir, int bigger, int smaller)
+static void area_move_apply_do(
+ const bContext *C, int delta,
+ const int origval, const int dir,
+ const int bigger, const int smaller,
+ const bool do_snap)
{
- wmWindow *win = CTX_wm_window(C);
- const int screen_size_x = WM_window_screen_pixels_x(win);
- const int screen_size_y = WM_window_screen_pixels_y(win);
bScreen *sc = CTX_wm_screen(C);
ScrVert *v1;
- ScrArea *sa;
- int doredraw = 0;
- int oldval;
-
- delta = CLAMPIS(delta, -smaller, bigger);
-
+ bool doredraw = false;
+ CLAMP(delta, -smaller, bigger);
+
+ short final_loc = -1;
+
+ if (do_snap) {
+ final_loc = area_snap_calc_location(sc, delta, origval, dir, bigger, smaller);
+ }
+ else {
+ final_loc = origval + delta;
+ if (delta != bigger && delta != -smaller) {
+ final_loc -= (final_loc % AREAGRID);
+ }
+ }
+
+ BLI_assert(final_loc != -1);
+ short axis = (dir == 'v') ? 0 : 1;
+
for (v1 = sc->vertbase.first; v1; v1 = v1->next) {
if (v1->editflag) {
- /* that way a nice AREAGRID */
- if ((dir == 'v') && v1->vec.x > 0 && v1->vec.x < screen_size_x - 1) {
- oldval = v1->vec.x;
- v1->vec.x = origval + delta;
-
- if (delta != bigger && delta != -smaller) {
- v1->vec.x -= (v1->vec.x % AREAGRID);
- v1->vec.x = CLAMPIS(v1->vec.x, origval - smaller, origval + bigger);
- }
- if (oldval != v1->vec.x)
- doredraw = 1;
- }
- if ((dir == 'h') && v1->vec.y > 0 && v1->vec.y < screen_size_y - 1) {
- oldval = v1->vec.y;
- v1->vec.y = origval + delta;
-
- if (delta != bigger && delta != smaller) {
- v1->vec.y -= (v1->vec.y % AREAGRID);
- v1->vec.y = CLAMPIS(v1->vec.y, origval - smaller, origval + bigger);
- }
- if (oldval != v1->vec.y)
- doredraw = 1;
+ short oldval = (&v1->vec.x)[axis];
+ (&v1->vec.x)[axis] = final_loc;
+
+ if (oldval == final_loc) {
+ /* nothing will change to the other vertices either. */
+ break;
}
+ doredraw = true;
}
}
/* only redraw if we actually moved a screen vert, for AREAGRID */
if (doredraw) {
- for (sa = sc->areabase.first; sa; sa = sa->next) {
- if (sa->v1->editflag || sa->v2->editflag || sa->v3->editflag || sa->v4->editflag)
+ for (ScrArea *sa = sc->areabase.first; sa; sa = sa->next) {
+ if (sa->v1->editflag || sa->v2->editflag || sa->v3->editflag || sa->v4->editflag) {
ED_area_tag_redraw(sa);
+ }
}
-
WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL); /* redraw everything */
/* Update preview thumbnail */
BKE_icon_changed(sc->id.icon_id);
@@ -1247,10 +1301,9 @@ static void area_move_apply_do(bContext *C, int origval, int delta, int dir, int
static void area_move_apply(bContext *C, wmOperator *op)
{
sAreaMoveData *md = op->customdata;
- int delta;
-
- delta = RNA_int_get(op->ptr, "delta");
- area_move_apply_do(C, md->origval, delta, md->dir, md->bigger, md->smaller);
+ int delta = RNA_int_get(op->ptr, "delta");
+
+ area_move_apply_do(C, delta, md->origval, md->dir, md->bigger, md->smaller, md->do_snap);
}
static void area_move_exit(bContext *C, wmOperator *op)
@@ -1312,7 +1365,6 @@ static int area_move_modal(bContext *C, wmOperator *op, const wmEvent *event)
y = RNA_int_get(op->ptr, "y");
delta = (md->dir == 'v') ? event->x - x : event->y - y;
- if (md->step) delta = delta - (delta % md->step);
RNA_int_set(op->ptr, "delta", delta);
area_move_apply(C, op);
@@ -1328,12 +1380,12 @@ static int area_move_modal(bContext *C, wmOperator *op, const wmEvent *event)
case KM_MODAL_CANCEL:
area_move_cancel(C, op);
return OPERATOR_CANCELLED;
-
- case KM_MODAL_STEP10:
- md->step = 10;
+
+ case KM_MODAL_SNAP_ON:
+ md->do_snap = true;
break;
- case KM_MODAL_STEP10_OFF:
- md->step = 0;
+ case KM_MODAL_SNAP_OFF:
+ md->do_snap = false;
break;
}
break;
@@ -1365,7 +1417,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:
@@ -1402,13 +1458,13 @@ static void SCREEN_OT_area_move(wmOperatorType *ot)
*/
typedef struct sAreaSplitData {
- int x, y; /* last used mouse position */
-
int origval; /* for move areas */
int bigger, smaller; /* constraints for moving new edge */
int delta; /* delta move edge */
int origmin, origsize; /* to calculate fac, for property storage */
int previewmode; /* draw previewline, then split */
+ void *draw_callback; /* call `ED_screen_draw_split_preview` */
+ bool do_snap;
ScrEdge *nedge; /* new edge */
ScrArea *sarea; /* start area */
@@ -1416,6 +1472,19 @@ typedef struct sAreaSplitData {
} sAreaSplitData;
+static void area_split_draw_cb(const struct wmWindow *UNUSED(win), void *userdata)
+{
+ const wmOperator *op = userdata;
+
+ sAreaSplitData *sd = op->customdata;
+ if (sd->sarea) {
+ int dir = RNA_enum_get(op->ptr, "direction");
+ float fac = RNA_float_get(op->ptr, "factor");
+
+ ED_screen_draw_split_preview(sd->sarea, dir, fac);
+ }
+}
+
/* generic init, menu case, doesn't need active area */
static int area_split_menu_init(bContext *C, wmOperator *op)
{
@@ -1426,15 +1495,7 @@ static int area_split_menu_init(bContext *C, wmOperator *op)
op->customdata = sd;
sd->sarea = CTX_wm_area(C);
-
- if (sd->sarea) {
- int dir = RNA_enum_get(op->ptr, "direction");
- if (dir == 'h')
- sd->sarea->flag |= AREA_FLAG_DRAWSPLIT_H;
- else
- sd->sarea->flag |= AREA_FLAG_DRAWSPLIT_V;
- }
return 1;
}
@@ -1545,9 +1606,9 @@ static void area_split_exit(bContext *C, wmOperator *op)
if (sd->sarea) ED_area_tag_redraw(sd->sarea);
if (sd->narea) ED_area_tag_redraw(sd->narea);
- if (sd->sarea)
- sd->sarea->flag &= ~(AREA_FLAG_DRAWSPLIT_H | AREA_FLAG_DRAWSPLIT_V);
-
+ if (sd->draw_callback)
+ WM_draw_cb_exit(CTX_wm_window(C), sd->draw_callback);
+
MEM_freeN(op->customdata);
op->customdata = NULL;
}
@@ -1560,6 +1621,12 @@ static void area_split_exit(bContext *C, wmOperator *op)
BKE_screen_remove_double_scredges(CTX_wm_screen(C));
}
+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 == 'v') ? CURSOR_X_MOVE : CURSOR_Y_MOVE);
+}
/* UI callback, adds new handler */
static int area_split_invoke(bContext *C, wmOperator *op, const wmEvent *event)
@@ -1637,9 +1704,6 @@ static int area_split_invoke(bContext *C, wmOperator *op, const wmEvent *event)
sd = (sAreaSplitData *)op->customdata;
- sd->x = event->x;
- sd->y = event->y;
-
if (event->type == EVT_ACTIONZONE_AREA) {
/* do the split */
@@ -1654,9 +1718,11 @@ static int area_split_invoke(bContext *C, wmOperator *op, const wmEvent *event)
}
else {
sd->previewmode = 1;
+ sd->draw_callback = WM_draw_cb_activate(win, area_split_draw_cb, op);
/* add temp handler for edge move or cancel */
WM_event_add_modal_handler(C, op);
-
+ area_split_preview_update_cursor(C, op);
+
return OPERATOR_RUNNING_MODAL;
}
@@ -1699,48 +1765,15 @@ static void area_split_cancel(bContext *C, wmOperator *op)
static int area_split_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
sAreaSplitData *sd = (sAreaSplitData *)op->customdata;
- float fac;
- int dir;
-
+ PropertyRNA *prop_dir = RNA_struct_find_property(op->ptr, "direction");
+ bool update_factor = false;
+
/* execute the events */
switch (event->type) {
case MOUSEMOVE:
- dir = RNA_enum_get(op->ptr, "direction");
-
- sd->delta = (dir == 'v') ? event->x - sd->origval : event->y - sd->origval;
- if (sd->previewmode == 0)
- area_move_apply_do(C, sd->origval, sd->delta, dir, sd->bigger, sd->smaller);
- else {
- if (sd->sarea) {
- sd->sarea->flag &= ~(AREA_FLAG_DRAWSPLIT_H | AREA_FLAG_DRAWSPLIT_V);
- ED_area_tag_redraw(sd->sarea);
- }
- /* area context not set */
- sd->sarea = BKE_screen_find_area_xy(CTX_wm_screen(C), SPACE_TYPE_ANY, event->x, event->y);
-
- if (sd->sarea) {
- ED_area_tag_redraw(sd->sarea);
- if (dir == 'v') {
- sd->origsize = sd->sarea->winx;
- sd->origmin = sd->sarea->totrct.xmin;
- sd->sarea->flag |= AREA_FLAG_DRAWSPLIT_V;
- }
- else {
- sd->origsize = sd->sarea->winy;
- sd->origmin = sd->sarea->totrct.ymin;
- sd->sarea->flag |= AREA_FLAG_DRAWSPLIT_H;
- }
- }
-
- CTX_wm_screen(C)->do_draw = true;
-
- }
-
- fac = (dir == 'v') ? event->x - sd->origmin : event->y - sd->origmin;
- RNA_float_set(op->ptr, "factor", fac / (float)sd->origsize);
-
+ update_factor = true;
break;
-
+
case LEFTMOUSE:
if (sd->previewmode) {
area_split_apply(C, op);
@@ -1758,27 +1791,15 @@ static int area_split_modal(bContext *C, wmOperator *op, const wmEvent *event)
case MIDDLEMOUSE:
case TABKEY:
if (sd->previewmode == 0) {
+ /* pass */
}
else {
- dir = RNA_enum_get(op->ptr, "direction");
-
if (event->val == KM_PRESS) {
if (sd->sarea) {
- sd->sarea->flag &= ~(AREA_FLAG_DRAWSPLIT_H | AREA_FLAG_DRAWSPLIT_V);
- ED_area_tag_redraw(sd->sarea);
-
- if (dir == 'v') {
- RNA_enum_set(op->ptr, "direction", 'h');
- sd->sarea->flag |= AREA_FLAG_DRAWSPLIT_H;
-
- WM_cursor_set(CTX_wm_window(C), CURSOR_X_MOVE);
- }
- else {
- RNA_enum_set(op->ptr, "direction", 'v');
- sd->sarea->flag |= AREA_FLAG_DRAWSPLIT_V;
-
- WM_cursor_set(CTX_wm_window(C), CURSOR_Y_MOVE);
- }
+ int dir = RNA_property_enum_get(op->ptr, prop_dir);
+ RNA_property_enum_set(op->ptr, prop_dir, (dir == 'v') ? 'h' : 'v');
+ area_split_preview_update_cursor(C, op);
+ update_factor = true;
}
}
}
@@ -1789,8 +1810,64 @@ static int area_split_modal(bContext *C, wmOperator *op, const wmEvent *event)
case ESCKEY:
area_split_cancel(C, op);
return OPERATOR_CANCELLED;
+
+ case LEFTCTRLKEY:
+ sd->do_snap = event->val == KM_PRESS;
+ update_factor = true;
+ break;
}
-
+
+ if (update_factor) {
+ const int dir = RNA_property_enum_get(op->ptr, prop_dir);
+
+ sd->delta = (dir == 'v') ? event->x - sd->origval : event->y - sd->origval;
+
+ if (sd->previewmode == 0) {
+ if (sd->do_snap) {
+ const int snap_loc = area_snap_calc_location(
+ CTX_wm_screen(C), sd->delta, sd->origval, dir, sd->bigger, sd->smaller);
+ sd->delta = snap_loc - sd->origval;
+ }
+ area_move_apply_do(C, sd->delta, sd->origval, dir, sd->bigger, sd->smaller, false);
+ }
+ else {
+ if (sd->sarea) {
+ ED_area_tag_redraw(sd->sarea);
+ }
+ /* area context not set */
+ sd->sarea = BKE_screen_find_area_xy(CTX_wm_screen(C), SPACE_TYPE_ANY, event->x, event->y);
+
+ if (sd->sarea) {
+ ScrArea *sa = sd->sarea;
+ if (dir == 'v') {
+ sd->origsize = sa->winx;
+ sd->origmin = sa->totrct.xmin;
+ }
+ else {
+ sd->origsize = sa->winy;
+ sd->origmin = sa->totrct.ymin;
+ }
+
+ if (sd->do_snap) {
+ sa->v1->editflag = sa->v2->editflag = sa->v3->editflag = sa->v4->editflag = 1;
+
+ const int snap_loc = area_snap_calc_location(
+ CTX_wm_screen(C), sd->delta, sd->origval, dir, sd->origmin + sd->origsize, -sd->origmin);
+
+ sa->v1->editflag = sa->v2->editflag = sa->v3->editflag = sa->v4->editflag = 0;
+ sd->delta = snap_loc - sd->origval;
+ }
+
+ ED_area_tag_redraw(sd->sarea);
+ }
+
+ CTX_wm_screen(C)->do_draw = true;
+ }
+
+ float fac = (float)(sd->delta + sd->origval - sd->origmin) / sd->origsize;
+ RNA_float_set(op->ptr, "factor", fac);
+ }
+
return OPERATOR_RUNNING_MODAL;
}
@@ -1823,9 +1900,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;
@@ -2094,8 +2173,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)
{
@@ -2176,6 +2258,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)
@@ -2230,8 +2317,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)
@@ -2340,7 +2430,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)
@@ -2403,7 +2497,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)
@@ -2431,8 +2529,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)
@@ -2491,7 +2592,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
@@ -2521,13 +2626,23 @@ static void SCREEN_OT_screen_full_area(wmOperatorType *ot)
*/
typedef struct sAreaJoinData {
- ScrArea *sa1; /* first area to be considered */
- ScrArea *sa2; /* second area to be considered */
- ScrArea *scr; /* designed for removal */
+ ScrArea *sa1; /* first area to be considered */
+ ScrArea *sa2; /* second area to be considered */
+ void *draw_callback; /* call `ED_screen_draw_join_shape` */
} sAreaJoinData;
+static void area_join_draw_cb(const struct wmWindow *UNUSED(win), void *userdata)
+{
+ const wmOperator *op = userdata;
+
+ sAreaJoinData *sd = op->customdata;
+ if (sd->sa1 && sd->sa2) {
+ ED_screen_draw_join_shape(sd->sa1, sd->sa2);
+ }
+}
+
/* validate selection inside screen, set variables OK */
/* return 0: init failed */
/* XXX todo: find edge based on (x,y) and set other area? */
@@ -2561,14 +2676,14 @@ static int area_join_init(bContext *C, wmOperator *op)
}
jd = (sAreaJoinData *)MEM_callocN(sizeof(sAreaJoinData), "op_area_join");
-
+
jd->sa1 = sa1;
- jd->sa1->flag |= AREA_FLAG_DRAWJOINFROM;
jd->sa2 = sa2;
- jd->sa2->flag |= AREA_FLAG_DRAWJOINTO;
-
+
op->customdata = jd;
-
+
+ jd->draw_callback = WM_draw_cb_activate(CTX_wm_window(C), area_join_draw_cb, op);
+
return 1;
}
@@ -2592,8 +2707,13 @@ static int area_join_apply(bContext *C, wmOperator *op)
/* finish operation */
static void area_join_exit(bContext *C, wmOperator *op)
{
- if (op->customdata) {
- MEM_freeN(op->customdata);
+ sAreaJoinData *jd = (sAreaJoinData *)op->customdata;
+
+ if (jd) {
+ if (jd->draw_callback)
+ WM_draw_cb_exit(CTX_wm_window(C), jd->draw_callback);
+
+ MEM_freeN(jd);
op->customdata = NULL;
}
@@ -2652,17 +2772,6 @@ static int area_join_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static void area_join_cancel(bContext *C, wmOperator *op)
{
- sAreaJoinData *jd = (sAreaJoinData *)op->customdata;
-
- if (jd->sa1) {
- jd->sa1->flag &= ~AREA_FLAG_DRAWJOINFROM;
- jd->sa1->flag &= ~AREA_FLAG_DRAWJOINTO;
- }
- if (jd->sa2) {
- jd->sa2->flag &= ~AREA_FLAG_DRAWJOINFROM;
- jd->sa2->flag &= ~AREA_FLAG_DRAWJOINTO;
- }
-
WM_event_add_notifier(C, NC_WINDOW, NULL);
area_join_exit(C, op);
@@ -2686,9 +2795,7 @@ static int area_join_modal(bContext *C, wmOperator *op, const wmEvent *event)
if (jd->sa1 != sa) {
dir = area_getorientation(jd->sa1, sa);
if (dir != -1) {
- if (jd->sa2) jd->sa2->flag &= ~AREA_FLAG_DRAWJOINTO;
jd->sa2 = sa;
- jd->sa2->flag |= AREA_FLAG_DRAWJOINTO;
}
else {
/* we are not bordering on the previously selected area
@@ -2697,15 +2804,10 @@ static int area_join_modal(bContext *C, wmOperator *op, const wmEvent *event)
*/
dir = area_getorientation(sa, jd->sa2);
if (dir != -1) {
- if (jd->sa1) jd->sa1->flag &= ~AREA_FLAG_DRAWJOINFROM;
- if (jd->sa2) jd->sa2->flag &= ~AREA_FLAG_DRAWJOINTO;
jd->sa1 = jd->sa2;
jd->sa2 = sa;
- if (jd->sa1) jd->sa1->flag |= AREA_FLAG_DRAWJOINFROM;
- if (jd->sa2) jd->sa2->flag |= AREA_FLAG_DRAWJOINTO;
}
else {
- if (jd->sa2) jd->sa2->flag &= ~AREA_FLAG_DRAWJOINTO;
jd->sa2 = NULL;
}
}
@@ -2715,12 +2817,8 @@ static int area_join_modal(bContext *C, wmOperator *op, const wmEvent *event)
/* we are back in the area previously selected for keeping
* we swap the areas if possible to allow user to choose */
if (jd->sa2 != NULL) {
- if (jd->sa1) jd->sa1->flag &= ~AREA_FLAG_DRAWJOINFROM;
- if (jd->sa2) jd->sa2->flag &= ~AREA_FLAG_DRAWJOINTO;
jd->sa1 = jd->sa2;
jd->sa2 = sa;
- if (jd->sa1) jd->sa1->flag |= AREA_FLAG_DRAWJOINFROM;
- if (jd->sa2) jd->sa2->flag |= AREA_FLAG_DRAWJOINTO;
dir = area_getorientation(jd->sa1, jd->sa2);
if (dir == -1) {
printf("oops, didn't expect that!\n");
@@ -2729,9 +2827,7 @@ static int area_join_modal(bContext *C, wmOperator *op, const wmEvent *event)
else {
dir = area_getorientation(jd->sa1, sa);
if (dir != -1) {
- if (jd->sa2) jd->sa2->flag &= ~AREA_FLAG_DRAWJOINTO;
jd->sa2 = sa;
- jd->sa2->flag |= AREA_FLAG_DRAWJOINTO;
}
}
WM_event_add_notifier(C, NC_WINDOW, NULL);
@@ -2785,7 +2881,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)
{
@@ -2838,9 +2938,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)
{
@@ -2879,7 +2981,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))
{
@@ -2918,6 +3024,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);
@@ -2975,7 +3087,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))
{
@@ -3000,7 +3116,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)
{
@@ -3153,8 +3273,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))
@@ -3205,7 +3328,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))
{
@@ -3235,8 +3362,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))
@@ -3265,8 +3395,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))
{
@@ -3318,7 +3451,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)
{
@@ -3615,7 +3754,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)
@@ -3708,6 +3853,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));
@@ -3747,7 +3898,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
@@ -3802,6 +3957,12 @@ static void SCREEN_OT_border_select(wmOperatorType *ot)
}
#endif
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Full Screen Back Operator
+ * \{ */
+
/* *********************** generic fullscreen 'back' button *************** */
@@ -3836,7 +3997,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)
{
@@ -3866,7 +4031,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))
{
@@ -3893,7 +4062,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))
{
@@ -3917,7 +4090,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.
@@ -4059,7 +4236,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 {
@@ -4142,9 +4323,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)
@@ -4203,13 +4386,19 @@ void ED_operatortypes_screen(void)
}
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Operator Key Map
+ * \{ */
+
static void keymap_modal_set(wmKeyConfig *keyconf)
{
static const EnumPropertyItem modal_items[] = {
{KM_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""},
{KM_MODAL_APPLY, "APPLY", 0, "Apply", ""},
- {KM_MODAL_STEP10, "STEP10", 0, "Steps on", ""},
- {KM_MODAL_STEP10_OFF, "STEP10_OFF", 0, "Steps off", ""},
+ {KM_MODAL_SNAP_ON, "SNAP", 0, "Snap on", ""},
+ {KM_MODAL_SNAP_OFF, "SNAP_OFF", 0, "Snap off", ""},
{0, NULL, 0, NULL, NULL}};
wmKeyMap *keymap;
@@ -4221,8 +4410,8 @@ static void keymap_modal_set(wmKeyConfig *keyconf)
WM_modalkeymap_add_item(keymap, RETKEY, KM_PRESS, KM_ANY, 0, KM_MODAL_APPLY);
WM_modalkeymap_add_item(keymap, PADENTER, KM_PRESS, KM_ANY, 0, KM_MODAL_APPLY);
- WM_modalkeymap_add_item(keymap, LEFTCTRLKEY, KM_PRESS, KM_ANY, 0, KM_MODAL_STEP10);
- WM_modalkeymap_add_item(keymap, LEFTCTRLKEY, KM_RELEASE, KM_ANY, 0, KM_MODAL_STEP10_OFF);
+ WM_modalkeymap_add_item(keymap, LEFTCTRLKEY, KM_PRESS, KM_ANY, 0, KM_MODAL_SNAP_ON);
+ WM_modalkeymap_add_item(keymap, LEFTCTRLKEY, KM_RELEASE, KM_ANY, 0, KM_MODAL_SNAP_OFF);
WM_modalkeymap_assign(keymap, "SCREEN_OT_area_move");
@@ -4404,3 +4593,4 @@ void ED_keymap_screen(wmKeyConfig *keyconf)
keymap_modal_set(keyconf);
}
+/** \} */