diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-04-01 04:34:00 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-04-01 08:22:28 +0400 |
commit | 617557b08ea94e2b65a1697ddf0b79651204d92b (patch) | |
tree | 50b24bab075b42fa20456140c9a9681cfb01325b /source/blender/windowmanager/intern/wm_event_system.c | |
parent | 2c00ecc738c04dc5dc22d4a6b81a1e937526ba6d (diff) |
Code cleanup: remove TRUE/FALSE & WITH_BOOL_COMPAT define
Diffstat (limited to 'source/blender/windowmanager/intern/wm_event_system.c')
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 67 |
1 files changed, 35 insertions, 32 deletions
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index ecf56bcbc3a..9d04beac5ee 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -288,7 +288,7 @@ void wm_event_do_notifiers(bContext *C) { if (note->category == NC_SCENE) { if (note->data == ND_FRAME) - do_anim = TRUE; + do_anim = true; } } if (ELEM5(note->category, NC_SCENE, NC_OBJECT, NC_GEOM, NC_SCENE, NC_WM)) { @@ -301,7 +301,7 @@ void wm_event_do_notifiers(bContext *C) /* XXX, quick frame changes can cause a crash if framechange and rendering * collide (happens on slow scenes), BKE_scene_update_for_newframe can be called * twice which can depgraph update the same object at once */ - if (G.is_rendering == FALSE) { + if (G.is_rendering == false) { /* depsgraph gets called, might send more notifiers */ ED_update_for_newframe(CTX_data_main(C), win->screen->scene, 1); @@ -364,7 +364,7 @@ void wm_event_do_notifiers(bContext *C) } /* XXX make lock in future, or separated derivedmesh users in scene */ - if (G.is_rendering == FALSE) { + if (G.is_rendering == false) { /* depsgraph & animation: update tagged datablocks */ Main *bmain = CTX_data_main(C); @@ -489,7 +489,7 @@ int WM_operator_poll(bContext *C, wmOperatorType *ot) /* sets up the new context and calls 'wm_operator_invoke()' with poll_only */ int WM_operator_poll_context(bContext *C, wmOperatorType *ot, short context) { - return wm_operator_call_internal(C, ot, NULL, NULL, context, TRUE); + return wm_operator_call_internal(C, ot, NULL, NULL, context, true); } static void wm_operator_print(bContext *C, wmOperator *op) @@ -611,10 +611,10 @@ void WM_reportf(const bContext *C, ReportType type, const char *format, ...) BLI_dynstr_free(ds); } -/* (caller_owns_reports == TRUE) when called from python */ -static void wm_operator_reports(bContext *C, wmOperator *op, int retval, int caller_owns_reports) +/* (caller_owns_reports == true) when called from python */ +static void wm_operator_reports(bContext *C, wmOperator *op, int retval, bool caller_owns_reports) { - if (caller_owns_reports == FALSE) { /* popup */ + if (caller_owns_reports == false) { /* popup */ if (op->reports->list.first) { /* FIXME, temp setting window, see other call to uiPupMenuReports for why */ wmWindow *win_prev = CTX_wm_window(C); @@ -638,7 +638,7 @@ static void wm_operator_reports(bContext *C, wmOperator *op, int retval, int cal wm_operator_print(C, op); } - if (caller_owns_reports == FALSE) { + if (caller_owns_reports == false) { BKE_reports_print(op->reports, RPT_DEBUG); /* print out reports to console. */ } @@ -726,7 +726,7 @@ static int wm_operator_exec(bContext *C, wmOperator *op, const bool repeat, cons * Carefully checked all calls to wm_operator_exec and WM_operator_repeat, don't see any reason * why this was needed, but worth to note it in case something turns bad. (mont29) */ if (retval & (OPERATOR_FINISHED | OPERATOR_CANCELLED)/* && repeat == 0 */) - wm_operator_reports(C, op, retval, FALSE); + wm_operator_reports(C, op, retval, false); if (retval & OPERATOR_FINISHED) { if (store) { @@ -788,7 +788,7 @@ int WM_operator_repeat(bContext *C, wmOperator *op) { return wm_operator_exec(C, op, true, true); } -/* TRUE if WM_operator_repeat can run +/* true if WM_operator_repeat can run * simple check for now but may become more involved. * To be sure the operator can run call WM_operator_poll(C, op->type) also, since this call * checks if WM_operator_repeat() can run at all, not that it WILL run at any time. */ @@ -985,14 +985,14 @@ bool WM_operator_last_properties_store(wmOperator *op) #else -int WM_operator_last_properties_init(wmOperator *UNUSED(op)) +bool WM_operator_last_properties_init(wmOperator *UNUSED(op)) { - return FALSE; + return false; } -int WM_operator_last_properties_store(wmOperator *UNUSED(op)) +bool WM_operator_last_properties_store(wmOperator *UNUSED(op)) { - return FALSE; + return false; } #endif @@ -1075,7 +1075,7 @@ static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event, */ if (ot->flag & OPTYPE_BLOCKING || (op->opm && op->opm->type->flag & OPTYPE_BLOCKING)) { int bounds[4] = {-1, -1, -1, -1}; - int wrap; + bool wrap; if (op->opm) { wrap = (U.uiflag & USER_CONTINUOUS_MOUSE) && @@ -1090,7 +1090,7 @@ static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event, if (wrap) { ARegion *ar = CTX_wm_region(C); if (ar && ar->regiontype == RGN_TYPE_HEADER) { - wrap = FALSE; + wrap = false; } } @@ -1267,7 +1267,7 @@ int WM_operator_name_call(bContext *C, const char *opstring, short context, Poin { wmOperatorType *ot = WM_operatortype_find(opstring, 0); if (ot) - return wm_operator_call_internal(C, ot, properties, NULL, context, FALSE); + return wm_operator_call_internal(C, ot, properties, NULL, context, false); return 0; } @@ -1308,7 +1308,7 @@ int WM_operator_call_py(bContext *C, wmOperatorType *ot, short context, wmWindowManager *wm = CTX_wm_manager(C); if (!is_undo && wm) wm->op_undo_depth++; - retval = wm_operator_call_internal(C, ot, properties, reports, context, FALSE); + retval = wm_operator_call_internal(C, ot, properties, reports, context, false); if (!is_undo && wm && (wm == CTX_wm_manager(C))) wm->op_undo_depth--; @@ -1579,7 +1579,7 @@ static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHand wm->op_undo_depth--; if (retval & (OPERATOR_CANCELLED | OPERATOR_FINISHED)) - wm_operator_reports(C, op, retval, FALSE); + wm_operator_reports(C, op, retval, false); /* important to run 'wm_operator_finished' before NULLing the context members */ if (retval & OPERATOR_FINISHED) { @@ -1624,7 +1624,7 @@ static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHand if (ot) { if (wm_operator_check_locked_interface(C, ot)) { - retval = wm_operator_invoke(C, ot, event, properties, NULL, FALSE); + retval = wm_operator_invoke(C, ot, event, properties, NULL, false); } } } @@ -2017,12 +2017,15 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers) * wasn't handled, the KM_RELEASE will become a KM_CLICK */ if (win && event->val == KM_PRESS) { - win->eventstate->check_click = TRUE; + win->eventstate->check_click = true; } if (win && win->eventstate->prevtype == event->type) { - if (event->val == KM_RELEASE && win->eventstate->prevval == KM_PRESS && win->eventstate->check_click == TRUE) { + if ((event->val == KM_RELEASE) && + (win->eventstate->prevval == KM_PRESS) && + (win->eventstate->check_click == true)) + { event->val = KM_CLICK; if (G.debug & (G_DEBUG_HANDLERS)) { @@ -2141,10 +2144,10 @@ static void wm_event_drag_test(wmWindowManager *wm, wmWindow *win, wmEvent *even } if (event->type == MOUSEMOVE) - win->screen->do_draw_drag = TRUE; + win->screen->do_draw_drag = true; else if (event->type == ESCKEY) { BLI_freelistN(&wm->drags); - win->screen->do_draw_drag = TRUE; + win->screen->do_draw_drag = true; } else if (event->type == LEFTMOUSE && event->val == KM_RELEASE) { event->type = EVT_DROP; @@ -2160,7 +2163,7 @@ static void wm_event_drag_test(wmWindowManager *wm, wmWindow *win, wmEvent *even event->customdatafree = 1; /* clear drop icon */ - win->screen->do_draw_drag = TRUE; + win->screen->do_draw_drag = true; /* restore cursor (disabled, see wm_dragdrop.c) */ // WM_cursor_modal_restore(win); @@ -2169,7 +2172,7 @@ static void wm_event_drag_test(wmWindowManager *wm, wmWindow *win, wmEvent *even /* overlap fails otherwise */ if (win->screen->do_draw_drag) if (win->drawmethod == USER_DRAW_OVERLAP) - win->screen->do_draw = TRUE; + win->screen->do_draw = true; } @@ -2274,7 +2277,7 @@ void wm_event_do_handlers(bContext *C) wm_paintcursor_test(C, event); } else if (event->type == NDOF_MOTION) { - win->addmousemove = TRUE; + win->addmousemove = true; } for (sa = win->screen->areabase.first; sa; sa = sa->next) { @@ -3176,22 +3179,22 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U case LEFTSHIFTKEY: case RIGHTSHIFTKEY: evt->shift = (event.val == KM_PRESS) ? ((evt->ctrl || evt->alt || evt->oskey) ? (KM_MOD_FIRST | KM_MOD_SECOND) : KM_MOD_FIRST) : - FALSE; + false; break; case LEFTCTRLKEY: case RIGHTCTRLKEY: evt->ctrl = (event.val == KM_PRESS) ? ((evt->shift || evt->alt || evt->oskey) ? (KM_MOD_FIRST | KM_MOD_SECOND) : KM_MOD_FIRST) : - FALSE; + false; break; case LEFTALTKEY: case RIGHTALTKEY: evt->alt = (event.val == KM_PRESS) ? ((evt->ctrl || evt->shift || evt->oskey) ? (KM_MOD_FIRST | KM_MOD_SECOND) : KM_MOD_FIRST) : - FALSE; + false; break; case OSKEY: evt->oskey = (event.val == KM_PRESS) ? ((evt->ctrl || evt->alt || evt->shift) ? (KM_MOD_FIRST | KM_MOD_SECOND) : KM_MOD_FIRST) : - FALSE; + false; break; default: if (event.val == KM_PRESS && event.keymodifier == 0) @@ -3225,7 +3228,7 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U /* check other modifiers because ms-windows uses these to bring up the task manager */ (event.shift == 0 && event.ctrl == 0 && event.alt == 0)) { - G.is_break = TRUE; + G.is_break = true; } /* double click test - only for press */ |