From aa924b54a9dec991f6fe953c8fc2164e2f991d64 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Sun, 25 Jun 2017 10:54:06 -0400 Subject: [PATCH] Rename Apply in spectrum settings & prefs dialogs, reposition it too --- src/ShuttleGui.h | 5 ++++- src/prefs/PrefsDialog.cpp | 24 ++++++++++++------------ src/prefs/PrefsDialog.h | 2 +- src/prefs/PrefsPanel.h | 4 ++-- src/prefs/SpectrumPrefs.cpp | 2 +- src/prefs/SpectrumPrefs.h | 2 +- src/prefs/WaveformPrefs.cpp | 2 +- src/prefs/WaveformPrefs.h | 2 +- 8 files changed, 23 insertions(+), 20 deletions(-) diff --git a/src/ShuttleGui.h b/src/ShuttleGui.h index 47d2d9389..20d9aa653 100644 --- a/src/ShuttleGui.h +++ b/src/ShuttleGui.h @@ -351,7 +351,10 @@ enum enum { - ePreviewID = wxID_LOWEST - 1, + // ePreviewID = wxID_LOWEST - 1, + // But there is a wxID_PREVIEW + ePreviewID = wxID_PREVIEW, + eDebugID = wxID_LOWEST - 2, eSettingsID = wxID_LOWEST - 3, ePreviewDryID = wxID_LOWEST - 4, diff --git a/src/prefs/PrefsDialog.cpp b/src/prefs/PrefsDialog.cpp index 3bdcec946..8a69fe36d 100644 --- a/src/prefs/PrefsDialog.cpp +++ b/src/prefs/PrefsDialog.cpp @@ -75,7 +75,7 @@ BEGIN_EVENT_TABLE(PrefsDialog, wxDialogWrapper) EVT_BUTTON(wxID_OK, PrefsDialog::OnOK) EVT_BUTTON(wxID_CANCEL, PrefsDialog::OnCancel) - EVT_BUTTON(wxID_APPLY, PrefsDialog::OnApply) + EVT_BUTTON(wxID_PREVIEW, PrefsDialog::OnPreview) EVT_BUTTON(wxID_HELP, PrefsDialog::OnHelp) EVT_TREE_KEY_DOWN(wxID_ANY, PrefsDialog::OnTreeKeyDown) // Handles key events when tree has focus END_EVENT_TABLE() @@ -113,9 +113,9 @@ int wxTreebookExt::SetSelection(size_t n) PrefsPanel *const panel = static_cast(GetPage(n)); const bool showHelp = (panel->HelpPageName() != wxEmptyString); - const bool showApply = panel->ShowsApplyButton(); + const bool showPreview = panel->ShowsPreviewButton(); wxWindow *const helpButton = wxWindow::FindWindowById(wxID_HELP, GetParent()); - wxWindow *const applyButton = wxWindow::FindWindowById(wxID_APPLY, GetParent()); + wxWindow *const previewButton = wxWindow::FindWindowById(wxID_PREVIEW, GetParent()); if (helpButton) { if (showHelp) { @@ -137,8 +137,8 @@ int wxTreebookExt::SetSelection(size_t n) GetParent()->Layout(); } - if (applyButton) { // might still be NULL during population - const bool changed = applyButton->Show(showApply); + if (previewButton) { // might still be NULL during population + const bool changed = previewButton->Show(showPreview); if (changed) GetParent()->Layout(); } @@ -305,13 +305,13 @@ PrefsDialog::PrefsDialog } S.EndVerticalLay(); - S.AddStandardButtons(eOkButton | eCancelButton | eApplyButton | eHelpButton); + S.AddStandardButtons(eOkButton | eCancelButton | ePreviewButton | eHelpButton); static_cast(wxWindow::FindWindowById(wxID_OK, this))->SetDefault(); - if (mUniquePage && !mUniquePage->ShowsApplyButton()) { - wxWindow *const applyButton = - wxWindow::FindWindowById(wxID_APPLY, GetParent()); - applyButton->Show(false); + if (mUniquePage && !mUniquePage->ShowsPreviewButton()) { + wxWindow *const previewButton = + wxWindow::FindWindowById(wxID_PREVIEW, GetParent()); + previewButton->Show(false); } #if defined(__WXGTK__) @@ -413,7 +413,7 @@ PrefsPanel * PrefsDialog::GetCurrentPanel() } } -void PrefsDialog::OnApply(wxCommandEvent & WXUNUSED(event)) +void PrefsDialog::OnPreview(wxCommandEvent & WXUNUSED(event)) { GetCurrentPanel()->Apply(); } @@ -583,7 +583,7 @@ void PrefsPanel::Cancel() { } -bool PrefsPanel::ShowsApplyButton() +bool PrefsPanel::ShowsPreviewButton() { return false; } diff --git a/src/prefs/PrefsDialog.h b/src/prefs/PrefsDialog.h index 893e2d6d6..3124b1e4a 100644 --- a/src/prefs/PrefsDialog.h +++ b/src/prefs/PrefsDialog.h @@ -59,7 +59,7 @@ class PrefsDialog /* not final */ : public wxDialogWrapper void OnCategoryChange(wxCommandEvent & e); void OnOK(wxCommandEvent & e); void OnCancel(wxCommandEvent & e); - void OnApply(wxCommandEvent & e); + void OnPreview(wxCommandEvent & e); void OnHelp(wxCommandEvent & e); void OnTreeKeyDown(wxTreeEvent & e); // Used to dismiss the dialog when enter is pressed with focus on tree diff --git a/src/prefs/PrefsPanel.h b/src/prefs/PrefsPanel.h index eddd78cd4..97b3566a4 100644 --- a/src/prefs/PrefsPanel.h +++ b/src/prefs/PrefsPanel.h @@ -55,9 +55,9 @@ class PrefsPanel /* not final */ : public wxPanelWrapper // NEW virtuals virtual bool Apply() = 0; - // If it returns True, the Apply button is added below the panel + // If it returns True, the Preview button is added below the panel // Default returns false - virtual bool ShowsApplyButton(); + virtual bool ShowsPreviewButton(); // If not empty string, the Help button is added below the panel // Default returns empty string. diff --git a/src/prefs/SpectrumPrefs.cpp b/src/prefs/SpectrumPrefs.cpp index 38306b484..1b73e75a5 100644 --- a/src/prefs/SpectrumPrefs.cpp +++ b/src/prefs/SpectrumPrefs.cpp @@ -430,7 +430,7 @@ bool SpectrumPrefs::Apply() return true; } -bool SpectrumPrefs::ShowsApplyButton() +bool SpectrumPrefs::ShowsPreviewButton() { return true; } diff --git a/src/prefs/SpectrumPrefs.h b/src/prefs/SpectrumPrefs.h index d1a9e6255..b3b0d4264 100644 --- a/src/prefs/SpectrumPrefs.h +++ b/src/prefs/SpectrumPrefs.h @@ -44,7 +44,7 @@ class SpectrumPrefs final : public PrefsPanel SpectrumPrefs(wxWindow * parent, WaveTrack *wt); virtual ~SpectrumPrefs(); bool Apply() override; - bool ShowsApplyButton() override; + bool ShowsPreviewButton() override; bool Validate() override; wxString HelpPageName() override; diff --git a/src/prefs/WaveformPrefs.cpp b/src/prefs/WaveformPrefs.cpp index 6e52b8baf..82bb5aecb 100644 --- a/src/prefs/WaveformPrefs.cpp +++ b/src/prefs/WaveformPrefs.cpp @@ -191,7 +191,7 @@ bool WaveformPrefs::Apply() return true; } -bool WaveformPrefs::ShowsApplyButton() +bool WaveformPrefs::ShowsPreviewButton() { return true; } diff --git a/src/prefs/WaveformPrefs.h b/src/prefs/WaveformPrefs.h index 707d2889f..009ff64f8 100644 --- a/src/prefs/WaveformPrefs.h +++ b/src/prefs/WaveformPrefs.h @@ -26,7 +26,7 @@ public: WaveformPrefs(wxWindow * parent, WaveTrack *wt); virtual ~WaveformPrefs(); bool Apply() override; - bool ShowsApplyButton() override; + bool ShowsPreviewButton() override; bool Validate() override; private: