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:
authorCampbell Barton <ideasman42@gmail.com>2019-04-13 10:15:15 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-04-13 10:15:15 +0300
commit73c7aaba226349e93ca4966941f4eb051a94c097 (patch)
treea3883f8abae08ab019ebfded6591728dce2aab24 /source/blender/windowmanager/intern/wm_gesture.c
parent45b810e1f8b088f3dc5329cfb0fe01092a156a6c (diff)
Cleanup: style, use braces for the window manager
Diffstat (limited to 'source/blender/windowmanager/intern/wm_gesture.c')
-rw-r--r--source/blender/windowmanager/intern/wm_gesture.c52
1 files changed, 37 insertions, 15 deletions
diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c
index 013ee029200..7e95f36b2db 100644
--- a/source/blender/windowmanager/intern/wm_gesture.c
+++ b/source/blender/windowmanager/intern/wm_gesture.c
@@ -98,8 +98,9 @@ void WM_gesture_end(bContext *C, wmGesture *gesture)
{
wmWindow *win = CTX_wm_window(C);
- if (win->tweak == gesture)
+ if (win->tweak == gesture) {
win->tweak = NULL;
+ }
BLI_remlink(&win->gesture, gesture);
MEM_freeN(gesture->customdata);
if (gesture->userdata && gesture->userdata_free) {
@@ -112,8 +113,9 @@ void WM_gestures_remove(bContext *C)
{
wmWindow *win = CTX_wm_window(C);
- while (win->gesture.first)
+ while (win->gesture.first) {
WM_gesture_end(C, win->gesture.first);
+ }
}
bool WM_gesture_is_modal_first(const wmGesture *gesture)
@@ -136,13 +138,27 @@ int wm_gesture_evaluate(wmGesture *gesture)
int theta = round_fl_to_int(4.0f * atan2f((float)dy, (float)dx) / (float)M_PI);
int val = EVT_GESTURE_W;
- if (theta == 0) val = EVT_GESTURE_E;
- else if (theta == 1) val = EVT_GESTURE_NE;
- else if (theta == 2) val = EVT_GESTURE_N;
- else if (theta == 3) val = EVT_GESTURE_NW;
- else if (theta == -1) val = EVT_GESTURE_SE;
- else if (theta == -2) val = EVT_GESTURE_S;
- else if (theta == -3) val = EVT_GESTURE_SW;
+ if (theta == 0) {
+ val = EVT_GESTURE_E;
+ }
+ else if (theta == 1) {
+ val = EVT_GESTURE_NE;
+ }
+ else if (theta == 2) {
+ val = EVT_GESTURE_N;
+ }
+ else if (theta == 3) {
+ val = EVT_GESTURE_NW;
+ }
+ else if (theta == -1) {
+ val = EVT_GESTURE_SE;
+ }
+ else if (theta == -2) {
+ val = EVT_GESTURE_S;
+ }
+ else if (theta == -3) {
+ val = EVT_GESTURE_SW;
+ }
#if 0
/* debug */
@@ -424,12 +440,14 @@ void wm_gesture_draw(wmWindow *win)
/* all in subwindow space */
wmViewport(&gt->winrct);
- if (gt->type == WM_GESTURE_RECT)
+ if (gt->type == WM_GESTURE_RECT) {
wm_gesture_draw_rect(gt);
+ }
// else if (gt->type == WM_GESTURE_TWEAK)
// wm_gesture_draw_line(gt);
- else if (gt->type == WM_GESTURE_CIRCLE)
+ else if (gt->type == WM_GESTURE_CIRCLE) {
wm_gesture_draw_circle(gt);
+ }
else if (gt->type == WM_GESTURE_CROSS_RECT) {
if (gt->is_active) {
wm_gesture_draw_rect(gt);
@@ -438,12 +456,15 @@ void wm_gesture_draw(wmWindow *win)
wm_gesture_draw_cross(win, gt);
}
}
- else if (gt->type == WM_GESTURE_LINES)
+ else if (gt->type == WM_GESTURE_LINES) {
wm_gesture_draw_lasso(gt, false);
- else if (gt->type == WM_GESTURE_LASSO)
+ }
+ else if (gt->type == WM_GESTURE_LASSO) {
wm_gesture_draw_lasso(gt, true);
- else if (gt->type == WM_GESTURE_STRAIGHTLINE)
+ }
+ else if (gt->type == WM_GESTURE_STRAIGHTLINE) {
wm_gesture_draw_line(gt);
+ }
}
}
@@ -451,6 +472,7 @@ void wm_gesture_tag_redraw(bContext *C)
{
bScreen *screen = CTX_wm_screen(C);
- if (screen)
+ if (screen) {
screen->do_draw_gesture = true;
+ }
}