Help button for dialogs

This read-only archive contains discussions from the Adding Feature forum.
New feature request may be posted to the Adding Feature forum.
Technical support is available via the Help forum.
Locked
Edgar
Forum Crew
Posts: 2043
Joined: Thu Sep 03, 2009 9:13 pm
Operating System: Windows 10 / 11

Help button for dialogs

Post by Edgar » Tue May 14, 2013 6:19 am

Over the years we have discussed adding an "Help" button to some of the dialogues - most recently the Effects dialogs. At first I lobbied for a Windows-centric "round blue button with a white question mark" in the top right-hand corner of the window. I even floated a proof of concept patch which referenced the local hard drive-based manual if available and otherwise use the online manual. Having gotten no traction with that lead balloon I thought I would explore Martyn's suggestion on – devel. To try this at home change one line in srceffectsEffect.cpp at (or near) line number 569:

Code: Select all

long buttons = eOkButton;
becomes:

Code: Select all

long buttons = eHelpButton | eOkButton;
Recompile, start Audacity, exercise any Effect with a dialog (e.g. the Noise generator).
help.png
help.png (23.94 KiB) Viewed 2788 times
Obviously, there is no handler for the Help button but it should not be too hard to write and I would be glad to help out.

steve
Site Admin
Posts: 85703
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Help button for dialogs

Post by steve » Tue May 14, 2013 1:42 pm

Edgar wrote:Obviously, there is no handler for the Help button but it should not be too hard to write and I would be glad to help out.
I'll take you up on that offer Edgar :)

Yesterday I added a Help button to the Nyquist Prompt effect. I think this would be a good place to start as it does not interfere with other effects. If/when it is agreed that it is working correctly, the same method could be rolled out for other built-in effects.

If we don't want a help button for all built-in effects (but perhaps we do), a help button can be added to individual effects like this:

Code: Select all

Index: src/effects/BassTreble.cpp
===================================================================
--- src/effects/BassTreble.cpp	(revision 12324)
+++ src/effects/BassTreble.cpp	(working copy)
@@ -281,7 +281,7 @@
 
 BassTrebleDialog::BassTrebleDialog(EffectBassTreble *effect,
                                  wxWindow * parent):
-   EffectDialog(parent, _("Bass and Treble"), PROCESS_EFFECT),
+   EffectDialog(parent, _("Bass and Treble"), PROCESS_EFFECT, wxDEFAULT_DIALOG_STYLE, eHelpButton), // stf
    mEffect(effect)
 {
    Init();

Here is where I've got to so far with adding a help button to the Nyquist Prompt:
HelpButton-01a.patch
(2.75 KiB) Downloaded 120 times
Learn more about Nyquist programming at audionyq.com

steve
Site Admin
Posts: 85703
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Help button for dialogs

Post by steve » Tue May 14, 2013 3:37 pm

OK, got a bit further.
Does this work on Windows?
HelpButton-01b.patch
(4.74 KiB) Downloaded 121 times
Learn more about Nyquist programming at audionyq.com

steve
Site Admin
Posts: 85703
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Help button for dialogs

Post by steve » Tue May 14, 2013 4:31 pm

And a bit more:

Code: Select all

void BassTrebleDialog::OnHelp(wxCommandEvent & /* event */)
{
   AudacityProject * pProj = GetActiveProject();
   wxString HelpMode = pProj->mHelpPref;
   
   wxString page = FileNames::HtmlHelpDir() + wxT("man/bass_and_treble.html");
   if ((wxFileExists(page)) && (HelpMode == wxT("Local"))) {
      page = wxT("file://") + page;
   } else {
      page = wxT("http://manual.audacityteam.org/o/man/bass_and_treble.html");
   }
   OpenInDefaultBrowser(page);
}
Would it be better to move this to ErrorDialog.cpp along with void ShowHelpDialog ?
Learn more about Nyquist programming at audionyq.com

steve
Site Admin
Posts: 85703
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Help button for dialogs

Post by steve » Tue May 14, 2013 4:39 pm

And a patch for adding Help buttons to "Nyquist Prompt" and "Bass & Treble".
HelpButton-02a.patch
(5.35 KiB) Downloaded 119 times
Learn more about Nyquist programming at audionyq.com

Edgar
Forum Crew
Posts: 2043
Joined: Thu Sep 03, 2009 9:13 pm
Operating System: Windows 10 / 11

Re: Help button for dialogs

Post by Edgar » Tue May 14, 2013 7:59 pm

I skipped right to 02a; grabbed a fresh copy of SVN HEAD, before patching compiled both Release and Unicode Release (to ensure no recent commit broke the compile); applied the patch and compiled both Release and Unicode Release successfully.
steve wrote: Would it be better to move this to ErrorDialog.cpp along with void ShowHelpDialog ?
I don't think so. Each help button (dialog) will require a custom (non-translated) HTML string.

I am going to switch to private email for the fiddly bits…

Edgar
Forum Crew
Posts: 2043
Joined: Thu Sep 03, 2009 9:13 pm
Operating System: Windows 10 / 11

Re: Help button for dialogs

Post by Edgar » Wed May 15, 2013 2:39 pm

Steve,

We had a major storm here and the power was out for a long time. I still have no internet at home and only an iPad with a poor cell contection for the web but no e-mail access. I'm not ignoring y'all <grin>!

Locked