WM: remove unnecessary context argument from WM_report, no good reason to have it.
authorBrecht Van Lommel <brechtvanlommel@gmail.com>
Sat, 16 Jan 2016 20:51:05 +0000 (21:51 +0100)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Sat, 16 Jan 2016 21:28:03 +0000 (22:28 +0100)
source/blender/editors/interface/interface.c
source/blender/editors/interface/interface_handlers.c
source/blender/windowmanager/WM_api.h
source/blender/windowmanager/intern/wm_event_system.c
source/blender/windowmanager/intern/wm_files.c

index 95187bbd0054fc372c14828a5ff8bf1d555bddb1..d4f9ab0f910d4d75a46ee814a709eb334b5bb87e 100644 (file)
@@ -2417,7 +2417,7 @@ bool ui_but_string_set(bContext *C, uiBut *but, const char *str)
                double value;
 
                if (ui_but_string_set_eval_num(C, but, str, &value) == false) {
                double value;
 
                if (ui_but_string_set_eval_num(C, but, str, &value) == false) {
-                       WM_report_banner_show(C);
+                       WM_report_banner_show();
                        return false;
                }
 
                        return false;
                }
 
index 029492598f8e725f20c541d09b60e719695c2f39..829fa6be44f8947967c2d2e9c1c85b977020f599 100644 (file)
@@ -2300,7 +2300,7 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data,
                                button_activate_state(C, but, BUTTON_STATE_EXIT);
                        }
                        else {
                                button_activate_state(C, but, BUTTON_STATE_EXIT);
                        }
                        else {
-                               WM_report(C, RPT_ERROR, "Paste expected 3 numbers, formatted: '[n, n, n]'");
+                               WM_report(RPT_ERROR, "Paste expected 3 numbers, formatted: '[n, n, n]'");
                                show_report = true;
                        }
                }
                                show_report = true;
                        }
                }
@@ -2345,7 +2345,7 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data,
                                button_activate_state(C, but, BUTTON_STATE_EXIT);
                        }
                        else {
                                button_activate_state(C, but, BUTTON_STATE_EXIT);
                        }
                        else {
-                               WM_report(C, RPT_ERROR, "Paste expected 4 numbers, formatted: '[n, n, n, n]'");
+                               WM_report(RPT_ERROR, "Paste expected 4 numbers, formatted: '[n, n, n, n]'");
                                show_report = true;
                        }
                }
                                show_report = true;
                        }
                }
@@ -2444,7 +2444,7 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data,
        }
 
        if (show_report) {
        }
 
        if (show_report) {
-               WM_report_banner_show(C);
+               WM_report_banner_show();
        }
 }
 
        }
 }
 
@@ -6993,7 +6993,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent *
                /* this should become disabled button .. */
                if (but->lock == true) {
                        if (but->lockstr) {
                /* this should become disabled button .. */
                if (but->lock == true) {
                        if (but->lockstr) {
-                               WM_report(C, RPT_INFO, but->lockstr);
+                               WM_report(RPT_INFO, but->lockstr);
                                button_activate_state(C, but, BUTTON_STATE_EXIT);
                                return WM_UI_HANDLER_BREAK;
                        }
                                button_activate_state(C, but, BUTTON_STATE_EXIT);
                                return WM_UI_HANDLER_BREAK;
                        }
@@ -7636,7 +7636,7 @@ static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState s
                         * No warnings should show for editing driver expressions though!
                         */
                        if (state != BUTTON_STATE_TEXT_EDITING) {
                         * No warnings should show for editing driver expressions though!
                         */
                        if (state != BUTTON_STATE_TEXT_EDITING) {
-                               WM_report(C, RPT_INFO, "Can't edit driven number value, see graph editor for the driver setup.");
+                               WM_report(RPT_INFO, "Can't edit driven number value, see graph editor for the driver setup.");
                        }
                }
 
                        }
                }
 
index 3f89140888be2192b60fcc64238ec1ddf6bfeb60..7100a46b622fbe4e0a99bed92cd3abfe4d76db19 100644 (file)
@@ -194,9 +194,9 @@ void                WM_main_remove_notifier_reference(const void *reference);
 void           WM_main_remove_editor_id_reference(const struct ID *id);
 
                        /* reports */
 void           WM_main_remove_editor_id_reference(const struct ID *id);
 
                        /* reports */
-void        WM_report_banner_show(const struct bContext *C);
-void        WM_report(const struct bContext *C, ReportType type, const char *message);
-void        WM_reportf(const struct bContext *C, ReportType type, const char *format, ...) ATTR_PRINTF_FORMAT(3, 4);
+void        WM_report_banner_show(void);
+void        WM_report(ReportType type, const char *message);
+void        WM_reportf(ReportType type, const char *format, ...) ATTR_PRINTF_FORMAT(2, 3);
 
 void wm_event_add_ex(
         struct wmWindow *win, const struct wmEvent *event_to_add,
 
 void wm_event_add_ex(
         struct wmWindow *win, const struct wmEvent *event_to_add,
index d31c20f7eab16ed65c7d5777be8f4b47b7741714..4d6bc152bb7f3a31c38190ed31dda3222acd8f92 100644 (file)
@@ -598,17 +598,17 @@ void WM_event_print(const wmEvent *event)
 /**
  * Show the report in the info header.
  */
 /**
  * Show the report in the info header.
  */
-void WM_report_banner_show(const bContext *C)
+void WM_report_banner_show()
 {
 {
-       wmWindowManager *wm = CTX_wm_manager(C);
-       ReportList *wm_reports = CTX_wm_reports(C);
+       wmWindowManager *wm = G.main->wm.first;
+       ReportList *wm_reports = &wm->reports;
        ReportTimerInfo *rti;
 
        /* After adding reports to the global list, reset the report timer. */
        WM_event_remove_timer(wm, NULL, wm_reports->reporttimer);
 
        /* Records time since last report was added */
        ReportTimerInfo *rti;
 
        /* After adding reports to the global list, reset the report timer. */
        WM_event_remove_timer(wm, NULL, wm_reports->reporttimer);
 
        /* Records time since last report was added */
-       wm_reports->reporttimer = WM_event_add_timer(wm, CTX_wm_window(C), TIMERREPORT, 0.05);
+       wm_reports->reporttimer = WM_event_add_timer(wm, wm->winactive, TIMERREPORT, 0.05);
 
        rti = MEM_callocN(sizeof(ReportTimerInfo), "ReportTimerInfo");
        wm_reports->reporttimer->customdata = rti;
 
        rti = MEM_callocN(sizeof(ReportTimerInfo), "ReportTimerInfo");
        wm_reports->reporttimer->customdata = rti;
@@ -624,32 +624,32 @@ void WM_ndof_deadzone_set(float deadzone)
        GHOST_setNDOFDeadZone(deadzone);
 }
 
        GHOST_setNDOFDeadZone(deadzone);
 }
 
-static void wm_add_reports(const bContext *C, ReportList *reports)
+static void wm_add_reports(ReportList *reports)
 {
        /* if the caller owns them, handle this */
        if (reports->list.first && (reports->flag & RPT_OP_HOLD) == 0) {
 {
        /* if the caller owns them, handle this */
        if (reports->list.first && (reports->flag & RPT_OP_HOLD) == 0) {
-               ReportList *wm_reports = CTX_wm_reports(C);
+               wmWindowManager *wm = G.main->wm.first;
 
                /* add reports to the global list, otherwise they are not seen */
 
                /* add reports to the global list, otherwise they are not seen */
-               BLI_movelisttolist(&wm_reports->list, &reports->list);
+               BLI_movelisttolist(&wm->reports.list, &reports->list);
 
 
-               WM_report_banner_show(C);
+               WM_report_banner_show();
        }
 }
 
        }
 }
 
-void WM_report(const bContext *C, ReportType type, const char *message)
+void WM_report(ReportType type, const char *message)
 {
        ReportList reports;
 
        BKE_reports_init(&reports, RPT_STORE);
        BKE_report(&reports, type, message);
 
 {
        ReportList reports;
 
        BKE_reports_init(&reports, RPT_STORE);
        BKE_report(&reports, type, message);
 
-       wm_add_reports(C, &reports);
+       wm_add_reports(&reports);
 
        BKE_reports_clear(&reports);
 }
 
 
        BKE_reports_clear(&reports);
 }
 
-void WM_reportf(const bContext *C, ReportType type, const char *format, ...)
+void WM_reportf(ReportType type, const char *format, ...)
 {
        DynStr *ds;
        va_list args;
 {
        DynStr *ds;
        va_list args;
@@ -659,7 +659,7 @@ void WM_reportf(const bContext *C, ReportType type, const char *format, ...)
        BLI_dynstr_vappendf(ds, format, args);
        va_end(args);
 
        BLI_dynstr_vappendf(ds, format, args);
        va_end(args);
 
-       WM_report(C, type, BLI_dynstr_get_cstring(ds));
+       WM_report(type, BLI_dynstr_get_cstring(ds));
 
        BLI_dynstr_free(ds);
 }
 
        BLI_dynstr_free(ds);
 }
@@ -706,7 +706,7 @@ static void wm_operator_reports(bContext *C, wmOperator *op, int retval, bool ca
        }
 
        /* if the caller owns them, handle this */
        }
 
        /* if the caller owns them, handle this */
-       wm_add_reports(C, op->reports);
+       wm_add_reports(op->reports);
 }
 
 /**
 }
 
 /**
@@ -1867,7 +1867,7 @@ static int wm_handler_fileselect_do(bContext *C, ListBase *handlers, wmEventHand
                                        BLI_movelisttolist(&CTX_wm_reports(C)->list, &handler->op->reports->list);
 
                                        /* more hacks, since we meddle with reports, banner display doesn't happen automatic */
                                        BLI_movelisttolist(&CTX_wm_reports(C)->list, &handler->op->reports->list);
 
                                        /* more hacks, since we meddle with reports, banner display doesn't happen automatic */
-                                       WM_report_banner_show(C);
+                                       WM_report_banner_show();
 
                                        CTX_wm_window_set(C, win_prev);
                                        CTX_wm_area_set(C, area_prev);
 
                                        CTX_wm_window_set(C, win_prev);
                                        CTX_wm_area_set(C, area_prev);
index 4b7d50fce0298b18fd75335f2b951c3103cbb412..01699b2360b539035f65b152e2e5e873a93e13f3 100644 (file)
@@ -429,7 +429,7 @@ void wm_file_read_report(bContext *C)
 
        if (reports) {
                if (!G.background) {
 
        if (reports) {
                if (!G.background) {
-                       WM_report_banner_show(C);
+                       WM_report_banner_show();
                }
        }
 }
                }
        }
 }