1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-11 09:03:36 +02:00

PrefsDialog can vary the title prefix string

This commit is contained in:
Paul Licameli
2015-06-13 18:33:01 -04:00
parent 8399effc45
commit 2361758316
2 changed files with 13 additions and 5 deletions

View File

@@ -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);

View File

@@ -44,7 +44,9 @@ class PrefsDialog:public wxDialog
typedef std::vector<PrefsNode> 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()
};