mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-11 09:31:13 +02:00
Enable help button for effects
This commit is contained in:
parent
429fad6f88
commit
469120cebd
@ -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."
|
||||
|
@ -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()
|
||||
|
@ -37,6 +37,7 @@ public:
|
||||
|
||||
wxString GetSymbol() override;
|
||||
wxString GetDescription() override;
|
||||
wxString HelpPageName() override;
|
||||
|
||||
// EffectIdentInterface implementation
|
||||
|
||||
|
@ -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 <Cocoa/Cocoa.h>
|
||||
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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())
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user