1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-16 08:09:32 +02:00

Try my hand at using XO()

Did I do it right Paul?
This commit is contained in:
Leland Lucius 2020-05-26 20:51:10 -05:00
parent af26d0438c
commit 49c95973cd
2 changed files with 22 additions and 36 deletions

View File

@ -11,11 +11,10 @@
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include "Internat.h"
#include "widgets/AudacityMessageBox.h"
#include "../FileDialog.h" #include "../FileDialog.h"
#include "wx/intl.h"
#include "wx/msgdlg.h"
#ifdef __UNIX__ #ifdef __UNIX__
#include <unistd.h> // chdir #include <unistd.h> // chdir
#endif #endif
@ -26,8 +25,6 @@
#include <wx/modalhook.h> #include <wx/modalhook.h>
#include <wx/sizer.h> #include <wx/sizer.h>
#include "../../../Internat.h" // For macro _
#define wxGTK_CONV(s) (s).utf8_str() #define wxGTK_CONV(s) (s).utf8_str()
#define wxGTK_CONV_FN(s) (s).fn_str() #define wxGTK_CONV_FN(s) (s).fn_str()
@ -71,16 +68,15 @@ static void gtk_filedialog_ok_callback(GtkWidget *widget, FileDialog *dialog)
{ {
if ( g_file_test(filename, G_FILE_TEST_EXISTS) ) if ( g_file_test(filename, G_FILE_TEST_EXISTS) )
{ {
wxString msg; int result = AudacityMessageBox(
XO("File '%s' already exists, do you really want to overwrite it?")
msg.Printf( .Format(wxString::FromUTF8(filename)),
_("File '%s' already exists, do you really want to overwrite it?"), XO("Confirm"),
wxString::FromUTF8(filename)); wxYES_NO | wxICON_QUESTION);
if (result != wxID_YES)
wxMessageDialog dlg(dialog, msg, _("Confirm"), {
wxYES_NO | wxICON_QUESTION);
if (dlg.ShowModal() != wxID_YES)
return; return;
}
} }
} }
} }
@ -90,9 +86,9 @@ static void gtk_filedialog_ok_callback(GtkWidget *widget, FileDialog *dialog)
{ {
if ( !g_file_test(filename, G_FILE_TEST_EXISTS) ) if ( !g_file_test(filename, G_FILE_TEST_EXISTS) )
{ {
wxMessageDialog dlg( dialog, _("Please choose an existing file."), AudacityMessageBox(XO("Please choose an existing file."),
_("Error"), wxOK| wxICON_ERROR); XO("Error"),
dlg.ShowModal(); wxOK | wxICON_ERROR);
return; return;
} }
} }

View File

@ -19,35 +19,25 @@
// headers // headers
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
#undef WXINTL_NO_GETTEXT_MACRO #include "Internat.h"
// For compilers that support precompilation, includes "wx.h".
#include <wx/wxprec.h>
#include "../FileDialog.h" #include "../FileDialog.h"
#ifndef WX_PRECOMP #include <wx/app.h>
#include <wx/msgdlg.h> #include <wx/choice.h>
#include <wx/app.h>
#include <wx/sizer.h>
#include <wx/stattext.h>
#include <wx/choice.h>
#endif
#include <wx/clipbrd.h> #include <wx/clipbrd.h>
#include <wx/evtloop.h>
#include <wx/filectrl.h> #include <wx/filectrl.h>
#include <wx/filename.h> #include <wx/filename.h>
#include <wx/modalhook.h>
#include <wx/sizer.h>
#include <wx/sysopt.h>
#include <wx/stattext.h>
#include <wx/tokenzr.h> #include <wx/tokenzr.h>
#include <wx/evtloop.h>
#include <wx/osx/core/private.h> #include <wx/osx/core/private.h>
#include <wx/sysopt.h>
#include <wx/modalhook.h>
#include <AppKit/AppKit.h> #include <AppKit/AppKit.h>
#include "../../../Internat.h" // For macro _
// ============================================================================ // ============================================================================
// implementation // implementation
// ============================================================================ // ============================================================================
@ -390,7 +380,7 @@ void FileDialog::SetupExtraControls(WXWindow nativeWindow)
{ {
wxBoxSizer *horizontalSizer = new wxBoxSizer( wxHORIZONTAL ); wxBoxSizer *horizontalSizer = new wxBoxSizer( wxHORIZONTAL );
wxStaticText *stattext = new wxStaticText( m_filterPanel, wxID_ANY, _("File type:") ); wxStaticText *stattext = new wxStaticText( m_filterPanel, wxID_ANY, XO("File type:") .Translation());
horizontalSizer->Add( stattext, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); horizontalSizer->Add( stattext, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_filterChoice = new wxChoice( m_filterPanel, wxID_ANY ); m_filterChoice = new wxChoice( m_filterPanel, wxID_ANY );