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

Open the appropriate initial page in View Settings dialog

This commit is contained in:
Paul Licameli 2015-06-21 11:54:49 -04:00
parent 0c4418af22
commit 5b72b1f23b

View File

@ -8921,20 +8921,24 @@ class ViewSettingsDialog : public PrefsDialog
{ {
public: public:
ViewSettingsDialog ViewSettingsDialog
(wxWindow *parent, const wxString &title, PrefsDialog::Factories &factories) (wxWindow *parent, const wxString &title, PrefsDialog::Factories &factories,
int page)
: PrefsDialog(parent, title, factories) : PrefsDialog(parent, title, factories)
, mPage(page)
{ {
} }
virtual long GetPreferredPage() virtual long GetPreferredPage()
{ {
// Future: choose Spectrum or Waveform page return mPage;
return 0;
} }
virtual void SavePreferredPage() virtual void SavePreferredPage()
{ {
} }
private:
const int mPage;
}; };
void TrackPanel::OnViewSettings(wxCommandEvent &) void TrackPanel::OnViewSettings(wxCommandEvent &)
@ -8943,12 +8947,15 @@ void TrackPanel::OnViewSettings(wxCommandEvent &)
WaveformPrefsFactory waveformFactory(wt); WaveformPrefsFactory waveformFactory(wt);
SpectrumPrefsFactory spectrumFactory(wt); SpectrumPrefsFactory spectrumFactory(wt);
// Put Waveform page first
PrefsDialog::Factories factories; PrefsDialog::Factories factories;
factories.push_back(&waveformFactory); factories.push_back(&waveformFactory);
factories.push_back(&spectrumFactory); factories.push_back(&spectrumFactory);
const int page = (wt->GetDisplay() == WaveTrack::Spectrum)
? 1 : 0;
wxString title(wt->GetName() + wxT(": ")); wxString title(wt->GetName() + wxT(": "));
ViewSettingsDialog dialog(this, title, factories); ViewSettingsDialog dialog(this, title, factories, page);
if (0 != dialog.ShowModal()) if (0 != dialog.ShowModal())
// Redraw // Redraw