From 2361758316cbf2c849cfe533dd9220d9650a12f3 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Sat, 13 Jun 2015 18:33:01 -0400 Subject: [PATCH] PrefsDialog can vary the title prefix string --- src/prefs/PrefsDialog.cpp | 13 +++++++++---- src/prefs/PrefsDialog.h | 5 ++++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/prefs/PrefsDialog.cpp b/src/prefs/PrefsDialog.cpp index dc94a705c..9852d2f95 100644 --- a/src/prefs/PrefsDialog.cpp +++ b/src/prefs/PrefsDialog.cpp @@ -81,11 +81,14 @@ class wxTreebookExt : public wxTreebook { public: wxTreebookExt( wxWindow *parent, - wxWindowID id) : wxTreebook( parent, id ) + wxWindowID id, const wxString &titlePrefix) + : wxTreebook( parent, id ) + , mTitlePrefix(titlePrefix) {;}; ~wxTreebookExt(){;}; virtual int ChangeSelection(size_t n); virtual int SetSelection(size_t n); + const wxString mTitlePrefix; }; @@ -100,7 +103,7 @@ int wxTreebookExt::ChangeSelection(size_t n) { int wxTreebookExt::SetSelection(size_t n) { int i = wxTreebook::SetSelection(n); - wxString Temp = wxString(_("Preferences: ")) + GetPageText( n ); + wxString Temp = wxString(mTitlePrefix) + GetPageText( n ); ((wxDialog*)GetParent())->SetTitle( Temp ); ((wxDialog*)GetParent())->SetName( Temp ); return i; @@ -178,12 +181,14 @@ PrefsDialog::Factories } -PrefsDialog::PrefsDialog(wxWindow * parent, Factories &factories) +PrefsDialog::PrefsDialog + (wxWindow * parent, const wxString &titlePrefix, Factories &factories) : wxDialog(parent, wxID_ANY, wxString(_("Audacity Preferences")), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) , mFactories(factories) +, mTitlePrefix(titlePrefix) { ShuttleGui S(this, eIsCreating); @@ -191,7 +196,7 @@ PrefsDialog::PrefsDialog(wxWindow * parent, Factories &factories) { S.StartHorizontalLay(wxALIGN_LEFT | wxEXPAND, true); { - mCategories = new wxTreebookExt(this, wxID_ANY); + mCategories = new wxTreebookExt(this, wxID_ANY, mTitlePrefix); S.Prop(1); S.AddWindow(mCategories, wxEXPAND); diff --git a/src/prefs/PrefsDialog.h b/src/prefs/PrefsDialog.h index 294826815..190207030 100644 --- a/src/prefs/PrefsDialog.h +++ b/src/prefs/PrefsDialog.h @@ -44,7 +44,9 @@ class PrefsDialog:public wxDialog typedef std::vector Factories; static Factories &DefaultFactories(); - PrefsDialog(wxWindow * parent, Factories &factories = DefaultFactories()); + PrefsDialog(wxWindow * parent, + const wxString &titlePrefix = _("Preferences: "), + Factories &factories = DefaultFactories()); virtual ~PrefsDialog(); void OnCategoryChange(wxCommandEvent & e); @@ -60,6 +62,7 @@ class PrefsDialog:public wxDialog wxTreebook *mCategories; Factories &mFactories; + const wxString mTitlePrefix; DECLARE_EVENT_TABLE() };