1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-01 08:29:27 +02:00

Enable Help button for Nyquist effects

This commit is contained in:
Steve Daulton 2017-05-19 18:20:05 +01:00
parent 469120cebd
commit 1dd6b848c2
12 changed files with 64 additions and 19 deletions

View File

@ -3,7 +3,7 @@
;type generate
;categories "http://lv2plug.in/ns/lv2core#GeneratorPlugin"
;name "Pluck..."
;help "Pluck"
;manpage "Pluck"
;preview linear
;action "Generating pluck sound..."
;info "MIDI values for C notes: 36, 48, 60 [middle C], 72, 84, 96."

View File

@ -53,7 +53,7 @@ public:
* This returns the string path to where the user may have put plug-ins
* if they don't have system admin rights. Under default settings, it's
* <DataDir>/Plug-Ins/ */
static wxString PlugInDir();
static wxString PlugInDir(); // Windows and Mac only
static wxString ThemeDir();
static wxString ThemeComponentsDir();
static wxString ThemeCachePng();

View File

@ -95,7 +95,9 @@ public:
// PluginManager use
bool DiscoverProviders();
// Seems we don't currently use FindAllPlugins
void FindAllPlugins(PluginIDList & providers, wxArrayString & paths);
wxArrayString FindPluginsForProvider(const PluginID & provider, const wxString & path);
bool RegisterPlugin(const PluginID & provider, const wxString & path);

View File

@ -1437,11 +1437,13 @@ void PluginManager::FindFilesInPathList(const wxString & pattern,
wxArrayString paths;
// Add the "per-user" plug-ins directory
// Add the "per-user" plug-ins directory Windows / Mac
#if defined(__WXMAC__) || defined(__WXMSW__)
{
const wxFileName &ff = FileNames::PlugInDir();
paths.Add(ff.GetFullPath());
}
#endif
// Add the "Audacity" plug-ins directory
wxFileName ff = PlatformCompatibility::GetExecutablePath();

View File

@ -90,7 +90,7 @@ wxString EffectAmplify::GetDescription()
return XO("Increases or decreases the volume of the audio you have selected");
}
wxString EffectAmplify::HelpPageName()
wxString EffectAmplify::ManualPage()
{
return wxT("Amplify");
}

View File

@ -37,7 +37,7 @@ public:
wxString GetSymbol() override;
wxString GetDescription() override;
wxString HelpPageName() override;
wxString ManualPage() override;
// EffectIdentInterface implementation

View File

@ -1099,7 +1099,12 @@ wxString Effect::GetPreset(wxWindow * parent, const wxString & parms)
return wxEmptyString;
}
wxString Effect::HelpPageName()
wxString Effect::ManualPage()
{
return wxEmptyString;
}
wxString Effect::HelpPage()
{
return wxEmptyString;
}
@ -3047,7 +3052,11 @@ bool EffectUIHost::Initialize()
}
long buttons;
if ( !(mEffect->HelpPageName().IsEmpty())) {
if ( mEffect->ManualPage().IsEmpty() && mEffect->HelpPage().IsEmpty()) {
buttons = eApplyButton + eCloseButton;
this->SetAcceleratorTable(wxNullAcceleratorTable);
}
else {
buttons = eApplyButton + eCloseButton + eHelpButton;
wxAcceleratorEntry entries[1];
#if defined(__WXMAC__)
@ -3058,10 +3067,6 @@ bool EffectUIHost::Initialize()
wxAcceleratorTable accel(1, entries);
this->SetAcceleratorTable(accel);
}
else {
buttons = eApplyButton + eCloseButton;
this->SetAcceleratorTable(wxNullAcceleratorTable);
}
buttonPanel->SetSizer(CreateStdButtonSizer(buttonPanel, buttons, bar).release());
@ -3224,7 +3229,16 @@ void EffectUIHost::OnCancel(wxCommandEvent & evt)
void EffectUIHost::OnHelp(wxCommandEvent & WXUNUSED(event))
{
HelpSystem::ShowHelpDialog(this, mEffect->HelpPageName(), true);
if (mEffect->GetFamily().IsSameAs(NYQUISTEFFECTS_FAMILY) && (mEffect->ManualPage().IsEmpty())) {
// Old ShowHelpDialog required when there is no on-line manual.
// Always use default web browser to allow full-featured HTML pages.
HelpSystem::ShowHelpDialog(FindWindow(wxID_HELP), mEffect->HelpPage(), wxEmptyString, true, true);
}
else {
// otherwise use the new ShowHelpDialog
wxLogDebug(mEffect->ManualPage());
HelpSystem::ShowHelpDialog(FindWindow(wxID_HELP), mEffect->ManualPage(), true);
}
}
void EffectUIHost::OnDebug(wxCommandEvent & evt)

View File

@ -226,7 +226,10 @@ class AUDACITY_DLL_API Effect /* not final */ : public wxEvtHandler,
virtual bool HasFactoryDefaults();
virtual wxString GetPreset(wxWindow * parent, const wxString & parms);
virtual wxString HelpPageName();
// Name of page in the Audacity alpha manual
virtual wxString ManualPage();
// Fully qualified local help file name
virtual wxString HelpPage();
virtual bool IsBatchProcessing();
virtual void SetBatchProcessing(bool start);

View File

@ -212,8 +212,15 @@ wxString NyquistEffect::GetDescription()
return mCopyright;
}
wxString NyquistEffect::HelpPageName()
wxString NyquistEffect::ManualPage()
{
return mManPage;
}
wxString NyquistEffect::HelpPage()
{
// TODO: Get the full path for the help page
// Return empty string and give debug info if it does not exist
return mHelpFile;
}
@ -1612,7 +1619,16 @@ void NyquistEffect::Parse(const wxString &line)
return;
}
if (len >= 2 && tokens[0] == wxT("help")) {
// TODO: Document.
// Page name in Audacity development manual
if (len >= 2 && tokens[0] == wxT("manpage")) {
mManPage = UnQuote(tokens[1]);
return;
}
// TODO: Document.
// Local Help file
if (len >= 2 && tokens[0] == wxT("helpfile")) {
mHelpFile = UnQuote(tokens[1]);
return;
}
@ -1729,6 +1745,7 @@ bool NyquistEffect::ParseProgram(wxInputStream & stream)
mControls.Clear();
mCategories.Clear();
mIsSpectral = false;
mManPage = wxEmptyString; // If not wxEmptyString, must be a page in the Audacity manual.
mHelpFile = wxEmptyString; // If not wxEmptyString, must be a valid HTML help file.
mFoundType = false;

View File

@ -79,7 +79,9 @@ public:
wxString GetVendor() override;
wxString GetVersion() override;
wxString GetDescription() override;
wxString HelpPageName() override;
wxString ManualPage() override;
wxString HelpPage() override;
// EffectIdentInterface implementation
@ -195,6 +197,7 @@ private:
wxString mInfo;
wxString mAuthor;
wxString mCopyright;
wxString mManPage; // ONLY use if a help page exists in the manual.
wxString mHelpFile;
EffectType mType;

View File

@ -200,7 +200,8 @@ void HelpSystem::ShowHtmlText(wxWindow *pParent,
void HelpSystem::ShowHelpDialog(wxWindow *parent,
const wxString &localFileName,
const wxString &remoteURL,
bool bModal)
bool bModal,
bool alwaysDefaultBrowser)
{
wxASSERT(parent); // to justify safenew
AudacityProject * pProj = GetActiveProject();
@ -250,7 +251,7 @@ void HelpSystem::ShowHelpDialog(wxWindow *parent,
Text.Replace( wxT("*URL*"), remoteURL );
ShowHtmlText( parent, _("Help on the Internet"), Text, false, bModal );
}
else if( HelpMode == wxT("Local") )
else if( HelpMode == wxT("Local") || alwaysDefaultBrowser)
{
// Local file, External browser
OpenInDefaultBrowser( wxString(wxT("file:"))+localFileName );

View File

@ -57,10 +57,13 @@ public:
/// file names containing a '#' are not (on any platform).
/// @param bModal Whether the resulting dialogue should be modal or not.
/// Default is modeless dialogue
/// @param alwaysDefaultBrowser Force use of default web browser.
/// Default allows built in browser for local files.
static void ShowHelpDialog(wxWindow *parent,
const wxString &localFileName,
const wxString &remoteURL,
bool bModal = false);
bool bModal = false,
bool alwaysDefaultBrowser = false);
/// Displays a page from the Audacity manual in your browser, if
/// it's available locally, OR else links to the internet.