From 98b1669e9386b9de437c8e73c9275e962d517196 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Sat, 10 Jul 2021 14:54:51 -0400 Subject: [PATCH] Some uses of ShowMessageBox, removing AudacityMessageBoxCaptionStr... ... but not yet removing all inclusions of AudacityMessageBox.h --- src/AudacityException.cpp | 8 ++++---- src/Theme.cpp | 12 ++++++++---- src/widgets/AudacityMessageBox.cpp | 5 ----- src/widgets/AudacityMessageBox.h | 2 +- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/AudacityException.cpp b/src/AudacityException.cpp index 3292eb97f..0fe8df7b7 100644 --- a/src/AudacityException.cpp +++ b/src/AudacityException.cpp @@ -14,7 +14,6 @@ #include -#include "widgets/AudacityMessageBox.h" #include "BasicUI.h" AudacityException::~AudacityException() @@ -80,10 +79,11 @@ void MessageBoxException::DelayedHandlerAction() if (exceptionType != ExceptionType::Internal && ErrorHelpUrl().IsEmpty()) { // We show BadEnvironment and BadUserAction in a similar way - ::AudacityMessageBox( + ShowMessageBox( ErrorMessage(), - (caption.empty() ? AudacityMessageBoxCaptionStr() : caption), - wxICON_ERROR); + MessageBoxOptions{} + .Caption(caption.empty() ? DefaultCaption() : caption) + .IconStyle(Icon::Error) ); } else { using namespace BasicUI; diff --git a/src/Theme.cpp b/src/Theme.cpp index ef8a694cf..d2555ffd9 100644 --- a/src/Theme.cpp +++ b/src/Theme.cpp @@ -73,6 +73,7 @@ can't be. #include #include "AllThemeResources.h" // can remove this later, only needed for 'XPMS_RETIRED'. +#include "BasicUI.h" #include "FileNames.h" #include "Prefs.h" #include "ImageManipulation.h" @@ -1144,16 +1145,19 @@ void ThemeBase::SaveComponents() } } + using namespace BasicUI; + if (n > 0) { auto result = - AudacityMessageBox( + ShowMessageBox( XO( "Some required files in:\n %s\nwere already present. Overwrite?") .Format( FileNames::ThemeComponentsDir() ), - AudacityMessageBoxCaptionStr(), - wxYES_NO | wxNO_DEFAULT); - if(result == wxNO) + MessageBoxOptions{} + .ButtonStyle(Button::YesNo) + .DefaultIsNo()); + if (result == MessageBoxResult::No) return; } diff --git a/src/widgets/AudacityMessageBox.cpp b/src/widgets/AudacityMessageBox.cpp index 11fb26772..a289419d0 100644 --- a/src/widgets/AudacityMessageBox.cpp +++ b/src/widgets/AudacityMessageBox.cpp @@ -10,8 +10,3 @@ #include "AudacityMessageBox.h" #include "Internat.h" - -TranslatableString AudacityMessageBoxCaptionStr() -{ - return XO("Message"); -} diff --git a/src/widgets/AudacityMessageBox.h b/src/widgets/AudacityMessageBox.h index 0d3ec7362..cc62494af 100644 --- a/src/widgets/AudacityMessageBox.h +++ b/src/widgets/AudacityMessageBox.h @@ -18,7 +18,7 @@ extern AUDACITY_DLL_API TranslatableString AudacityMessageBoxCaptionStr(); // Do not use wxMessageBox!! Its default window title does not translate! inline int AudacityMessageBox(const TranslatableString& message, - const TranslatableString& caption = AudacityMessageBoxCaptionStr(), + const TranslatableString& caption = XO("Message"), long style = wxOK | wxCENTRE, wxWindow *parent = NULL, int x = wxDefaultCoord, int y = wxDefaultCoord)