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

Rename Apply in spectrum settings & prefs dialogs, reposition it too

This commit is contained in:
Paul Licameli 2017-06-25 10:54:06 -04:00
parent 6cea9822c3
commit aa924b54a9
8 changed files with 23 additions and 20 deletions

View File

@ -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,

View File

@ -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<PrefsPanel *>(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<wxButton*>(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;
}

View File

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

View File

@ -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.

View File

@ -430,7 +430,7 @@ bool SpectrumPrefs::Apply()
return true;
}
bool SpectrumPrefs::ShowsApplyButton()
bool SpectrumPrefs::ShowsPreviewButton()
{
return true;
}

View File

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

View File

@ -191,7 +191,7 @@ bool WaveformPrefs::Apply()
return true;
}
bool WaveformPrefs::ShowsApplyButton()
bool WaveformPrefs::ShowsPreviewButton()
{
return true;
}

View File

@ -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: