From c82f4ff6f822cc57188625119dec7fa21bc0f21a Mon Sep 17 00:00:00 2001 From: Harley Acheson Date: Thu, 25 Jan 2024 09:44:41 -0800 Subject: [PATCH] UI: Remove Unnecessary Confirmation Options Remove red_alert (not needed), confirm_default (redundant), and cancel_button (not wanted). Rename confirm_button to confirm_text. --- source/blender/windowmanager/WM_types.hh | 5 +--- .../blender/windowmanager/intern/wm_files.cc | 2 +- .../windowmanager/intern/wm_operators.cc | 24 ++++--------------- 3 files changed, 7 insertions(+), 24 deletions(-) diff --git a/source/blender/windowmanager/WM_types.hh b/source/blender/windowmanager/WM_types.hh index 6d485ce5cb4..612821bb89c 100644 --- a/source/blender/windowmanager/WM_types.hh +++ b/source/blender/windowmanager/WM_types.hh @@ -933,15 +933,12 @@ struct wmConfirmDetails { char title[1024]; char message[1024]; char message2[1024]; - char confirm_button[256]; - char cancel_button[256]; + char confirm_text[256]; int icon; wmConfirmSize size; wmConfirmPosition position; - bool confirm_default; bool cancel_default; bool mouse_move_quit; - bool red_alert; }; /** diff --git a/source/blender/windowmanager/intern/wm_files.cc b/source/blender/windowmanager/intern/wm_files.cc index e21c6d043c6..a084115bb0e 100644 --- a/source/blender/windowmanager/intern/wm_files.cc +++ b/source/blender/windowmanager/intern/wm_files.cc @@ -3585,7 +3585,7 @@ static void wm_clear_recent_files_confirm(bContext * /*C*/, wmConfirmDetails *confirm) { STRNCPY(confirm->message, IFACE_("Remove all items from the recent files list")); - STRNCPY(confirm->confirm_button, IFACE_("Remove All")); + STRNCPY(confirm->confirm_text, IFACE_("Remove All")); confirm->position = WM_WARNING_POSITION_CENTER; confirm->size = WM_WARNING_SIZE_LARGE; confirm->cancel_default = true; diff --git a/source/blender/windowmanager/intern/wm_operators.cc b/source/blender/windowmanager/intern/wm_operators.cc index 6173b0d8137..ad26cf7501e 100644 --- a/source/blender/windowmanager/intern/wm_operators.cc +++ b/source/blender/windowmanager/intern/wm_operators.cc @@ -1218,15 +1218,12 @@ static uiBlock *wm_block_confirm_create(bContext *C, ARegion *region, void *arg_ wmConfirmDetails confirm = {{0}}; STRNCPY(confirm.title, WM_operatortype_description(C, op->type, op->ptr).c_str()); - STRNCPY(confirm.confirm_button, WM_operatortype_name(op->type, op->ptr).c_str()); - STRNCPY(confirm.cancel_button, IFACE_("Cancel")); + STRNCPY(confirm.confirm_text, WM_operatortype_name(op->type, op->ptr).c_str()); confirm.icon = ALERT_ICON_WARNING; confirm.size = WM_WARNING_SIZE_SMALL; confirm.position = WM_WARNING_POSITION_MOUSE; - confirm.confirm_default = true; confirm.cancel_default = false; confirm.mouse_move_quit = false; - confirm.red_alert = false; /* uiBlock.flag */ int block_flags = UI_BLOCK_KEEP_OPEN | UI_BLOCK_NO_WIN_CLIP | UI_BLOCK_NUMSELECT; @@ -1315,7 +1312,7 @@ static uiBlock *wm_block_confirm_create(bContext *C, ARegion *region, void *arg_ UI_BTYPE_BUT, 0, 0, - confirm.confirm_button, + confirm.confirm_text, 0, 0, 0, @@ -1333,7 +1330,7 @@ static uiBlock *wm_block_confirm_create(bContext *C, ARegion *region, void *arg_ UI_BTYPE_BUT, 0, 0, - confirm.cancel_button, + IFACE_("Cancel"), 0, 0, 0, @@ -1351,7 +1348,7 @@ static uiBlock *wm_block_confirm_create(bContext *C, ARegion *region, void *arg_ UI_BTYPE_BUT, 0, 0, - confirm.confirm_button, + confirm.confirm_text, 0, 0, 0, @@ -1369,18 +1366,7 @@ static uiBlock *wm_block_confirm_create(bContext *C, ARegion *region, void *arg_ UI_but_func_set(cancel_but, wm_operator_block_cancel, op, block); UI_but_drawflag_disable(confirm_but, UI_BUT_TEXT_LEFT); UI_but_drawflag_disable(cancel_but, UI_BUT_TEXT_LEFT); - - if (confirm.red_alert) { - UI_but_flag_enable(confirm_but, UI_BUT_REDALERT); - } - else { - if (confirm.cancel_default) { - UI_but_flag_enable(cancel_but, UI_BUT_ACTIVE_DEFAULT); - } - else if (confirm.confirm_default) { - UI_but_flag_enable(confirm_but, UI_BUT_ACTIVE_DEFAULT); - } - } + UI_but_flag_enable(confirm.cancel_default ? cancel_but : confirm_but, UI_BUT_ACTIVE_DEFAULT); if (confirm.position == WM_WARNING_POSITION_MOUSE) { int bounds_offset[2]; -- 2.30.2