diff --git a/plug-ins/pluck.ny b/plug-ins/pluck.ny index eb52daab7..831f83756 100644 --- a/plug-ins/pluck.ny +++ b/plug-ins/pluck.ny @@ -3,6 +3,7 @@ ;type generate ;categories "http://lv2plug.in/ns/lv2core#GeneratorPlugin" ;name "Pluck..." +;help "Pluck" ;preview linear ;action "Generating pluck sound..." ;info "MIDI values for C notes: 36, 48, 60 [middle C], 72, 84, 96." diff --git a/src/effects/Amplify.cpp b/src/effects/Amplify.cpp index 995b29c2a..eed486680 100644 --- a/src/effects/Amplify.cpp +++ b/src/effects/Amplify.cpp @@ -90,6 +90,11 @@ wxString EffectAmplify::GetDescription() return XO("Increases or decreases the volume of the audio you have selected"); } +wxString EffectAmplify::HelpPageName() +{ + return wxT("Amplify"); +} + // EffectIdentInterface implementation EffectType EffectAmplify::GetType() diff --git a/src/effects/Amplify.h b/src/effects/Amplify.h index 017b80e33..1f5d523ac 100644 --- a/src/effects/Amplify.h +++ b/src/effects/Amplify.h @@ -37,6 +37,7 @@ public: wxString GetSymbol() override; wxString GetDescription() override; + wxString HelpPageName() override; // EffectIdentInterface implementation diff --git a/src/effects/Effect.cpp b/src/effects/Effect.cpp index 328cfa466..10167ede6 100644 --- a/src/effects/Effect.cpp +++ b/src/effects/Effect.cpp @@ -53,6 +53,7 @@ greater use in future. #include "../ondemand/ODManager.h" #include "TimeWarper.h" #include "nyquist/Nyquist.h" +#include "../widgets/HelpSystem.h" #if defined(__WXMAC__) #include @@ -1098,6 +1099,11 @@ wxString Effect::GetPreset(wxWindow * parent, const wxString & parms) return wxEmptyString; } +wxString Effect::HelpPageName() +{ + return wxEmptyString; +} + bool Effect::IsBatchProcessing() { return mIsBatch; @@ -2767,6 +2773,7 @@ BEGIN_EVENT_TABLE(EffectUIHost, wxDialogWrapper) EVT_CLOSE(EffectUIHost::OnClose) EVT_BUTTON(wxID_APPLY, EffectUIHost::OnApply) EVT_BUTTON(wxID_CANCEL, EffectUIHost::OnCancel) + EVT_BUTTON(wxID_HELP, EffectUIHost::OnHelp) EVT_BUTTON(eDebugID, EffectUIHost::OnDebug) EVT_BUTTON(kMenuID, EffectUIHost::OnMenu) EVT_CHECKBOX(kEnableID, EffectUIHost::OnEnable) @@ -3039,13 +3046,23 @@ bool EffectUIHost::Initialize() bar->SetSizerAndFit(bs.release()); } - // TODO: Add Help button - // long buttons = eApplyButton + eCloseButton + eHelpButton; - long buttons = eApplyButton + eCloseButton; - if (mEffect->mUIDebug) - { - buttons += eDebugButton; + long buttons; + if ( !(mEffect->HelpPageName().IsEmpty())) { + buttons = eApplyButton + eCloseButton + eHelpButton; + wxAcceleratorEntry entries[1]; +#if defined(__WXMAC__) + entries[0].Set(wxACCEL_CTRL, (int) '?', wxID_HELP); +#else + entries[0].Set(wxACCEL_NORMAL, (int) WXK_F1, wxID_HELP); +#endif + wxAcceleratorTable accel(1, entries); + this->SetAcceleratorTable(accel); } + else { + buttons = eApplyButton + eCloseButton; + this->SetAcceleratorTable(wxNullAcceleratorTable); + } + buttonPanel->SetSizer(CreateStdButtonSizer(buttonPanel, buttons, bar).release()); vs->Add(buttonPanel, 0, wxEXPAND); @@ -3205,6 +3222,11 @@ void EffectUIHost::OnCancel(wxCommandEvent & evt) return; } +void EffectUIHost::OnHelp(wxCommandEvent & WXUNUSED(event)) +{ + HelpSystem::ShowHelpDialog(this, mEffect->HelpPageName(), true); +} + void EffectUIHost::OnDebug(wxCommandEvent & evt) { OnApply(evt); diff --git a/src/effects/Effect.h b/src/effects/Effect.h index df57c9dcb..c12bfbf5e 100644 --- a/src/effects/Effect.h +++ b/src/effects/Effect.h @@ -226,6 +226,8 @@ class AUDACITY_DLL_API Effect /* not final */ : public wxEvtHandler, virtual bool HasFactoryDefaults(); virtual wxString GetPreset(wxWindow * parent, const wxString & parms); + virtual wxString HelpPageName(); + virtual bool IsBatchProcessing(); virtual void SetBatchProcessing(bool start); @@ -593,6 +595,7 @@ private: void OnApply(wxCommandEvent & evt); void DoCancel(); void OnCancel(wxCommandEvent & evt); + void OnHelp(wxCommandEvent & evt); void OnDebug(wxCommandEvent & evt); void OnMenu(wxCommandEvent & evt); void OnEnable(wxCommandEvent & evt); diff --git a/src/effects/nyquist/Nyquist.cpp b/src/effects/nyquist/Nyquist.cpp index efe188045..146553286 100644 --- a/src/effects/nyquist/Nyquist.cpp +++ b/src/effects/nyquist/Nyquist.cpp @@ -212,6 +212,11 @@ wxString NyquistEffect::GetDescription() return mCopyright; } +wxString NyquistEffect::HelpPageName() +{ + return mHelpFile; +} + // EffectIdentInterface implementation EffectType NyquistEffect::GetType() @@ -1607,6 +1612,11 @@ void NyquistEffect::Parse(const wxString &line) return; } + if (len >= 2 && tokens[0] == wxT("help")) { + mHelpFile = UnQuote(tokens[1]); + return; + } + if (len >= 6 && tokens[0] == wxT("control")) { NyqControl ctrl; @@ -1719,6 +1729,7 @@ bool NyquistEffect::ParseProgram(wxInputStream & stream) mControls.Clear(); mCategories.Clear(); mIsSpectral = false; + mHelpFile = wxEmptyString; // If not wxEmptyString, must be a valid HTML help file. mFoundType = false; while (!stream.Eof() && stream.IsOk()) diff --git a/src/effects/nyquist/Nyquist.h b/src/effects/nyquist/Nyquist.h index 6db9e0b04..0e2e41386 100644 --- a/src/effects/nyquist/Nyquist.h +++ b/src/effects/nyquist/Nyquist.h @@ -79,6 +79,7 @@ public: wxString GetVendor() override; wxString GetVersion() override; wxString GetDescription() override; + wxString HelpPageName() override; // EffectIdentInterface implementation @@ -194,6 +195,7 @@ private: wxString mInfo; wxString mAuthor; wxString mCopyright; + wxString mHelpFile; EffectType mType; bool mEnablePreview; diff --git a/src/prefs/PrefsDialog.cpp b/src/prefs/PrefsDialog.cpp index 61db75d53..f874c39e7 100644 --- a/src/prefs/PrefsDialog.cpp +++ b/src/prefs/PrefsDialog.cpp @@ -118,19 +118,20 @@ int wxTreebookExt::SetSelection(size_t n) wxWindow *const applyButton = wxWindow::FindWindowById(wxID_APPLY, GetParent()); if (helpButton) { -#if defined(__WXMAC__) - // We don't appear to have accelerators on wxMac -#else if (showHelp) { wxAcceleratorEntry entries[1]; - entries[0].Set(wxACCEL_ALT, (int) 'H', wxID_HELP); +#if defined(__WXMAC__) + entries[0].Set(wxACCEL_CTRL, (int) '?', wxID_HELP); +#else + entries[0].Set(wxACCEL_NORMAL, (int) WXK_F1, wxID_HELP); +#endif wxAcceleratorTable accel(1, entries); this->SetAcceleratorTable(accel); } else { this->SetAcceleratorTable(wxNullAcceleratorTable); } -#endif + const bool changed = helpButton->Show(showHelp); if (changed) GetParent()->Layout();