mirror of
https://github.com/cookiengineer/audacity
synced 2025-04-30 07:39:42 +02:00
Add small help button to Prefs pages
This commit is contained in:
parent
b196c7de8d
commit
e16f6f9221
55
images/Help.xpm
Normal file
55
images/Help.xpm
Normal file
@ -0,0 +1,55 @@
|
||||
/* XPM */
|
||||
static const char * Help_xpm[] = {
|
||||
"21 21 31 1",
|
||||
" c None",
|
||||
". c #6699FF",
|
||||
"+ c #8CB2FE",
|
||||
"@ c #CDDDFE",
|
||||
"# c #F0F5FE",
|
||||
"$ c #F9FAFE",
|
||||
"% c #E4ECFE",
|
||||
"& c #A4C2FE",
|
||||
"* c #6698FE",
|
||||
"= c #FFFFFF",
|
||||
"- c #A9C5FE",
|
||||
"; c #DAE6FE",
|
||||
"> c #95B8FE",
|
||||
", c #6D9DFE",
|
||||
"' c #71A0FE",
|
||||
") c #BFD4FE",
|
||||
"! c #E9F0FE",
|
||||
"~ c #F7F9FE",
|
||||
"{ c #90B4FE",
|
||||
"] c #C8DAFE",
|
||||
"^ c #78A5FE",
|
||||
"/ c #EEF3FE",
|
||||
"( c #E3ECFE",
|
||||
"_ c #6F9FFE",
|
||||
": c #7CA7FE",
|
||||
"< c #EDF2FE",
|
||||
"[ c #E6EEFE",
|
||||
"} c #DBE7FE",
|
||||
"| c #87AEFE",
|
||||
"1 c #FBFCFE",
|
||||
"2 c #6799FE",
|
||||
" ..... ",
|
||||
" ......... ",
|
||||
" ............. ",
|
||||
" ............... ",
|
||||
" .....+@#$%&*..... ",
|
||||
" .....======-..... ",
|
||||
" ......;>,')=!...... ",
|
||||
" ..........,=~...... ",
|
||||
"...........{=].......",
|
||||
"..........^/(_.......",
|
||||
".........:<['........",
|
||||
".........}=|.........",
|
||||
".........1=2.........",
|
||||
" ........==......... ",
|
||||
" ................... ",
|
||||
" .......==........ ",
|
||||
" .......==........ ",
|
||||
" ............... ",
|
||||
" ............. ",
|
||||
" ......... ",
|
||||
" ..... "};
|
@ -103,14 +103,20 @@ for registering for changes.
|
||||
#include <wx/notebook.h>
|
||||
#include <wx/treectrl.h>
|
||||
#include <wx/spinctrl.h>
|
||||
#include <wx/bmpbuttn.h>
|
||||
#include "Internat.h"
|
||||
#include "Experimental.h"
|
||||
#include "Shuttle.h"
|
||||
#include "WrappedType.h"
|
||||
#include "widgets/wxPanelWrapper.h"
|
||||
|
||||
#include "../images/Help.xpm"
|
||||
|
||||
ShuttleGuiBase::ShuttleGuiBase(wxWindow * pParent, teShuttleMode ShuttleMode )
|
||||
{
|
||||
// Suppress warnings about the header file
|
||||
wxUnusedVar(Help_xpm);
|
||||
|
||||
wxASSERT( (pParent != NULL ) || ( ShuttleMode != eIsCreating));
|
||||
|
||||
mpParent = pParent;
|
||||
@ -2168,7 +2174,10 @@ std::unique_ptr<wxSizer> CreateStdButtonSizer(wxWindow *parent, long buttons, wx
|
||||
|
||||
if( buttons & eHelpButton )
|
||||
{
|
||||
bs->AddButton(safenew wxButton(parent, wxID_HELP));
|
||||
// Replace standard Help button with smaller icon button.
|
||||
// bs->AddButton(safenew wxButton(parent, wxID_HELP));
|
||||
b = new wxBitmapButton(parent, wxID_HELP, Help_xpm);
|
||||
bs->AddButton( b );
|
||||
}
|
||||
|
||||
if (buttons & ePreviewButton)
|
||||
|
@ -3039,6 +3039,8 @@ bool EffectUIHost::Initialize()
|
||||
bar->SetSizerAndFit(bs.release());
|
||||
}
|
||||
|
||||
// TODO: Add Help button
|
||||
// long buttons = eApplyButton + eCloseButton + eHelpButton;
|
||||
long buttons = eApplyButton + eCloseButton;
|
||||
if (mEffect->mUIDebug)
|
||||
{
|
||||
|
@ -407,6 +407,11 @@ bool DevicePrefs::Apply()
|
||||
return true;
|
||||
}
|
||||
|
||||
wxString DevicePrefs::HelpPageName()
|
||||
{
|
||||
return "Devices_Preferences";
|
||||
}
|
||||
|
||||
PrefsPanel *DevicePrefsFactory::Create(wxWindow *parent)
|
||||
{
|
||||
wxASSERT(parent); // to justify safenew
|
||||
|
@ -29,6 +29,7 @@ class DevicePrefs final : public PrefsPanel
|
||||
DevicePrefs(wxWindow * parent);
|
||||
virtual ~DevicePrefs();
|
||||
bool Apply() override;
|
||||
wxString HelpPageName() override;
|
||||
|
||||
private:
|
||||
void Populate();
|
||||
|
@ -264,6 +264,11 @@ bool DirectoriesPrefs::Apply()
|
||||
return true;
|
||||
}
|
||||
|
||||
wxString DirectoriesPrefs::HelpPageName()
|
||||
{
|
||||
return "Directories_Preferences";
|
||||
}
|
||||
|
||||
PrefsPanel *DirectoriesPrefsFactory::Create(wxWindow *parent)
|
||||
{
|
||||
wxASSERT(parent); // to justify safenew
|
||||
|
@ -25,6 +25,7 @@ class DirectoriesPrefs final : public PrefsPanel
|
||||
~DirectoriesPrefs();
|
||||
bool Apply() override;
|
||||
bool Validate() override;
|
||||
wxString HelpPageName() override;
|
||||
|
||||
private:
|
||||
void Populate();
|
||||
|
@ -168,6 +168,11 @@ bool EffectsPrefs::Apply()
|
||||
return true;
|
||||
}
|
||||
|
||||
wxString EffectsPrefs::HelpPageName()
|
||||
{
|
||||
return "Effects_Preferences";
|
||||
}
|
||||
|
||||
PrefsPanel *EffectsPrefsFactory::Create(wxWindow *parent)
|
||||
{
|
||||
wxASSERT(parent); // to justify safenew
|
||||
|
@ -28,6 +28,7 @@ class EffectsPrefs final : public PrefsPanel
|
||||
EffectsPrefs(wxWindow * parent);
|
||||
~EffectsPrefs();
|
||||
bool Apply() override;
|
||||
wxString HelpPageName() override;
|
||||
|
||||
private:
|
||||
void Populate();
|
||||
|
@ -668,6 +668,11 @@ void ExtImportPrefs::OnRuleTableCellClick (wxGridEvent& event)
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
wxString ExtImportPrefs::HelpPageName()
|
||||
{
|
||||
return "Extended_Import_Preferences";
|
||||
}
|
||||
|
||||
ExtImportPrefsDropTarget::ExtImportPrefsDropTarget(wxDataObject *dataObject)
|
||||
: wxDropTarget(dataObject)
|
||||
{
|
||||
|
@ -49,6 +49,7 @@ class ExtImportPrefs final : public PrefsPanel
|
||||
ExtImportPrefs(wxWindow * parent);
|
||||
~ExtImportPrefs();
|
||||
bool Apply() override;
|
||||
wxString HelpPageName() override;
|
||||
|
||||
void OnPluginKeyDown(wxListEvent& event);
|
||||
void OnPluginBeginDrag(wxListEvent& event);
|
||||
|
@ -225,6 +225,11 @@ bool GUIPrefs::Apply()
|
||||
return true;
|
||||
}
|
||||
|
||||
wxString GUIPrefs::HelpPageName()
|
||||
{
|
||||
return "Interface_Preferences";
|
||||
}
|
||||
|
||||
PrefsPanel *GUIPrefsFactory::Create(wxWindow *parent)
|
||||
{
|
||||
wxASSERT(parent); // to justify safenew
|
||||
|
@ -28,6 +28,7 @@ class GUIPrefs final : public PrefsPanel
|
||||
GUIPrefs(wxWindow * parent);
|
||||
~GUIPrefs();
|
||||
bool Apply() override;
|
||||
wxString HelpPageName() override;
|
||||
|
||||
static void GetRangeChoices(wxArrayString *pChoices, wxArrayString *pCodes);
|
||||
|
||||
|
@ -110,6 +110,11 @@ bool ImportExportPrefs::Apply()
|
||||
return true;
|
||||
}
|
||||
|
||||
wxString ImportExportPrefs::HelpPageName()
|
||||
{
|
||||
return "Import_-_Export_Preferences";
|
||||
}
|
||||
|
||||
PrefsPanel *ImportExportPrefsFactory::Create(wxWindow *parent)
|
||||
{
|
||||
wxASSERT(parent); // to justify safenew
|
||||
|
@ -27,6 +27,7 @@ class ImportExportPrefs final : public PrefsPanel
|
||||
ImportExportPrefs(wxWindow * parent);
|
||||
~ImportExportPrefs();
|
||||
bool Apply() override;
|
||||
wxString HelpPageName() override;
|
||||
|
||||
private:
|
||||
void Populate();
|
||||
|
@ -656,6 +656,11 @@ void KeyConfigPrefs::Cancel()
|
||||
return;
|
||||
}
|
||||
|
||||
wxString KeyConfigPrefs::HelpPageName()
|
||||
{
|
||||
return "Keyboard_Preferences";
|
||||
}
|
||||
|
||||
#else
|
||||
//
|
||||
// KeyConfigPrefs
|
||||
@ -1187,6 +1192,11 @@ void KeyConfigPrefs::Cancel()
|
||||
return;
|
||||
}
|
||||
|
||||
wxString KeyConfigPrefs::HelpPageName()
|
||||
{
|
||||
return "Keyboard_Preferences";
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
PrefsPanel *KeyConfigPrefsFactory::Create(wxWindow *parent)
|
||||
|
@ -41,6 +41,7 @@ public:
|
||||
~KeyConfigPrefs();
|
||||
bool Apply() override;
|
||||
void Cancel() override;
|
||||
wxString HelpPageName() override;
|
||||
|
||||
private:
|
||||
void Populate();
|
||||
@ -109,6 +110,7 @@ class KeyConfigPrefs final : public PrefsPanel
|
||||
~KeyConfigPrefs();
|
||||
bool Apply() override;
|
||||
void Cancel() override;
|
||||
wxString HelpPageName() override;
|
||||
|
||||
private:
|
||||
void Populate();
|
||||
|
@ -161,6 +161,11 @@ void ModulePrefs::SetModuleStatus(const wxString &fname, int iStatus){
|
||||
gPrefs->Flush();
|
||||
}
|
||||
|
||||
wxString ModulePrefs::HelpPageName()
|
||||
{
|
||||
return "Modules_Preferences";
|
||||
}
|
||||
|
||||
PrefsPanel *ModulePrefsFactory::Create(wxWindow *parent)
|
||||
{
|
||||
wxASSERT(parent); // to justify safenew
|
||||
|
@ -37,6 +37,7 @@ class ModulePrefs final : public PrefsPanel
|
||||
ModulePrefs(wxWindow * parent);
|
||||
~ModulePrefs();
|
||||
bool Apply() override;
|
||||
wxString HelpPageName() override;
|
||||
|
||||
static int GetModuleStatus( const wxString &fname );
|
||||
static void SetModuleStatus( const wxString &fname, int iStatus );
|
||||
|
@ -197,6 +197,11 @@ bool MousePrefs::Apply()
|
||||
return true;
|
||||
}
|
||||
|
||||
wxString MousePrefs::HelpPageName()
|
||||
{
|
||||
return "Mouse_Preferences";
|
||||
}
|
||||
|
||||
PrefsPanel *MousePrefsFactory::Create(wxWindow *parent)
|
||||
{
|
||||
wxASSERT(parent); // to justify safenew
|
||||
|
@ -25,6 +25,7 @@ class MousePrefs final : public PrefsPanel
|
||||
MousePrefs(wxWindow * parent);
|
||||
~MousePrefs();
|
||||
bool Apply() override;
|
||||
wxString HelpPageName() override;
|
||||
|
||||
private:
|
||||
void Populate();
|
||||
|
@ -123,6 +123,11 @@ bool PlaybackPrefs::Apply()
|
||||
return true;
|
||||
}
|
||||
|
||||
wxString PlaybackPrefs::HelpPageName()
|
||||
{
|
||||
return "Playback_Preferences";
|
||||
}
|
||||
|
||||
PrefsPanel *PlaybackPrefsFactory::Create(wxWindow *parent)
|
||||
{
|
||||
wxASSERT(parent); // to justify safenew
|
||||
|
@ -26,6 +26,7 @@ class PlaybackPrefs final : public PrefsPanel
|
||||
PlaybackPrefs(wxWindow * parent);
|
||||
virtual ~PlaybackPrefs();
|
||||
bool Apply() override;
|
||||
wxString HelpPageName() override;
|
||||
|
||||
private:
|
||||
void Populate();
|
||||
|
@ -70,11 +70,13 @@
|
||||
#endif
|
||||
|
||||
#include "../Theme.h"
|
||||
#include "../widgets/HelpSystem.h"
|
||||
|
||||
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_HELP, PrefsDialog::OnHelp)
|
||||
EVT_TREE_KEY_DOWN(wxID_ANY, PrefsDialog::OnTreeKeyDown) // Handles key events when tree has focus
|
||||
END_EVENT_TABLE()
|
||||
|
||||
@ -110,8 +112,30 @@ int wxTreebookExt::SetSelection(size_t n)
|
||||
static_cast<wxDialog*>(GetParent())->SetName( Temp );
|
||||
|
||||
PrefsPanel *const panel = static_cast<PrefsPanel *>(GetPage(n));
|
||||
const bool showHelp = (panel->HelpPageName() != wxEmptyString);
|
||||
const bool showApply = panel->ShowsApplyButton();
|
||||
wxWindow *const helpButton = wxWindow::FindWindowById(wxID_HELP, GetParent());
|
||||
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);
|
||||
wxAcceleratorTable accel(1, entries);
|
||||
this->SetAcceleratorTable(accel);
|
||||
}
|
||||
else {
|
||||
this->SetAcceleratorTable(wxNullAcceleratorTable);
|
||||
}
|
||||
#endif
|
||||
const bool changed = helpButton->Show(showHelp);
|
||||
if (changed)
|
||||
GetParent()->Layout();
|
||||
}
|
||||
|
||||
if (applyButton) { // might still be NULL during population
|
||||
const bool changed = applyButton->Show(showApply);
|
||||
if (changed)
|
||||
@ -265,7 +289,7 @@ PrefsDialog::PrefsDialog
|
||||
}
|
||||
S.EndVerticalLay();
|
||||
|
||||
S.AddStandardButtons(eOkButton | eCancelButton | eApplyButton);
|
||||
S.AddStandardButtons(eOkButton | eCancelButton | eApplyButton | eHelpButton);
|
||||
static_cast<wxButton*>(wxWindow::FindWindowById(wxID_OK, this))->SetDefault();
|
||||
|
||||
if (mUniquePage && !mUniquePage->ShowsApplyButton()) {
|
||||
@ -370,6 +394,12 @@ void PrefsDialog::OnApply(wxCommandEvent & WXUNUSED(event))
|
||||
mUniquePage->Apply();
|
||||
}
|
||||
|
||||
void PrefsDialog::OnHelp(wxCommandEvent & WXUNUSED(event))
|
||||
{
|
||||
PrefsPanel* panel = static_cast<PrefsPanel*>(mCategories->GetCurrentPage());
|
||||
HelpSystem::ShowHelpDialog(this, panel->HelpPageName(), true);
|
||||
}
|
||||
|
||||
void PrefsDialog::OnTreeKeyDown(wxTreeEvent & event)
|
||||
{
|
||||
if(event.GetKeyCode() == WXK_RETURN)
|
||||
@ -526,3 +556,8 @@ bool PrefsPanel::ShowsApplyButton()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
wxString PrefsPanel::HelpPageName()
|
||||
{
|
||||
return wxEmptyString;
|
||||
}
|
||||
|
@ -60,6 +60,7 @@ class PrefsDialog /* not final */ : public wxDialogWrapper
|
||||
void OnOK(wxCommandEvent & e);
|
||||
void OnCancel(wxCommandEvent & e);
|
||||
void OnApply(wxCommandEvent & e);
|
||||
void OnHelp(wxCommandEvent & e);
|
||||
void OnTreeKeyDown(wxTreeEvent & e); // Used to dismiss the dialog when enter is pressed with focus on tree
|
||||
|
||||
void SelectPageByName(const wxString &pageName);
|
||||
|
@ -59,6 +59,10 @@ class PrefsPanel /* not final */ : public wxPanelWrapper
|
||||
// Default returns false
|
||||
virtual bool ShowsApplyButton();
|
||||
|
||||
// If not empty string, the Help button is added below the panel
|
||||
// Default returns empty string.
|
||||
virtual wxString HelpPageName();
|
||||
|
||||
virtual void Cancel();
|
||||
};
|
||||
|
||||
|
@ -80,6 +80,11 @@ bool ProjectsPrefs::Apply()
|
||||
return true;
|
||||
}
|
||||
|
||||
wxString ProjectsPrefs::HelpPageName()
|
||||
{
|
||||
return "Projects_Preferences";
|
||||
}
|
||||
|
||||
PrefsPanel *ProjectsPrefsFactory::Create(wxWindow *parent)
|
||||
{
|
||||
wxASSERT(parent); // to justify safenew
|
||||
|
@ -27,6 +27,7 @@ class ProjectsPrefs final : public PrefsPanel
|
||||
ProjectsPrefs(wxWindow * parent);
|
||||
~ProjectsPrefs();
|
||||
bool Apply() override;
|
||||
wxString HelpPageName() override;
|
||||
|
||||
private:
|
||||
void Populate();
|
||||
|
@ -228,6 +228,11 @@ bool QualityPrefs::Apply()
|
||||
return true;
|
||||
}
|
||||
|
||||
wxString QualityPrefs::HelpPageName()
|
||||
{
|
||||
return "Quality_Preferences";
|
||||
}
|
||||
|
||||
PrefsPanel *QualityPrefsFactory::Create(wxWindow *parent)
|
||||
{
|
||||
wxASSERT(parent); // to justify safenew
|
||||
|
@ -30,6 +30,7 @@ class QualityPrefs final : public PrefsPanel
|
||||
virtual ~QualityPrefs();
|
||||
|
||||
bool Apply() override;
|
||||
wxString HelpPageName() override;
|
||||
|
||||
private:
|
||||
void Populate();
|
||||
|
@ -245,6 +245,11 @@ void RecordingPrefs::OnToggleCustomName(wxCommandEvent & /* Evt */)
|
||||
mToggleCustomName->Enable(mUseCustomTrackName);
|
||||
}
|
||||
|
||||
wxString RecordingPrefs::HelpPageName()
|
||||
{
|
||||
return "Recording_Preferences";
|
||||
}
|
||||
|
||||
PrefsPanel *RecordingPrefsFactory::Create(wxWindow *parent)
|
||||
{
|
||||
wxASSERT(parent); // to justify safenew
|
||||
|
@ -27,6 +27,7 @@ class RecordingPrefs final : public PrefsPanel
|
||||
RecordingPrefs(wxWindow * parent);
|
||||
virtual ~RecordingPrefs();
|
||||
bool Apply() override;
|
||||
wxString HelpPageName() override;
|
||||
|
||||
private:
|
||||
void Populate();
|
||||
|
@ -490,6 +490,11 @@ void SpectrumPrefs::EnableDisableSTFTOnlyControls()
|
||||
#endif
|
||||
}
|
||||
|
||||
wxString SpectrumPrefs::HelpPageName()
|
||||
{
|
||||
return "Spectrograms_Preferences";
|
||||
}
|
||||
|
||||
BEGIN_EVENT_TABLE(SpectrumPrefs, PrefsPanel)
|
||||
EVT_CHOICE(ID_WINDOW_SIZE, SpectrumPrefs::OnWindowSize)
|
||||
EVT_CHECKBOX(ID_DEFAULTS, SpectrumPrefs::OnDefaults)
|
||||
|
@ -46,6 +46,7 @@ class SpectrumPrefs final : public PrefsPanel
|
||||
bool Apply() override;
|
||||
bool ShowsApplyButton() override;
|
||||
bool Validate() override;
|
||||
wxString HelpPageName() override;
|
||||
|
||||
private:
|
||||
void Populate(size_t windowSize);
|
||||
|
@ -109,6 +109,11 @@ bool TracksBehaviorsPrefs::Apply()
|
||||
return true;
|
||||
}
|
||||
|
||||
wxString TracksBehaviorsPrefs::HelpPageName()
|
||||
{
|
||||
return "Tracks_Behaviors_Preferences";
|
||||
}
|
||||
|
||||
TracksBehaviorsPrefsFactory::TracksBehaviorsPrefsFactory()
|
||||
{
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ class TracksBehaviorsPrefs final : public PrefsPanel
|
||||
TracksBehaviorsPrefs(wxWindow * parent);
|
||||
~TracksBehaviorsPrefs();
|
||||
bool Apply() override;
|
||||
wxString HelpPageName() override;
|
||||
|
||||
static const wxChar *ScrollingPreferenceKey();
|
||||
static inline bool ScrollingPreferenceDefault() { return false; }
|
||||
|
@ -166,6 +166,11 @@ bool TracksPrefs::Apply()
|
||||
return true;
|
||||
}
|
||||
|
||||
wxString TracksPrefs::HelpPageName()
|
||||
{
|
||||
return "Tracks_Preferences";
|
||||
}
|
||||
|
||||
PrefsPanel *TracksPrefsFactory::Create(wxWindow *parent)
|
||||
{
|
||||
wxASSERT(parent); // to justify safenew
|
||||
|
@ -28,6 +28,7 @@ class TracksPrefs final : public PrefsPanel
|
||||
TracksPrefs(wxWindow * parent);
|
||||
~TracksPrefs();
|
||||
bool Apply() override;
|
||||
wxString HelpPageName() override;
|
||||
|
||||
static bool GetPinnedHeadPreference();
|
||||
static void SetPinnedHeadPreference(bool value, bool flush = false);
|
||||
|
@ -87,6 +87,11 @@ bool WarningsPrefs::Apply()
|
||||
return true;
|
||||
}
|
||||
|
||||
wxString WarningsPrefs::HelpPageName()
|
||||
{
|
||||
return "Warnings_Preferences";
|
||||
}
|
||||
|
||||
PrefsPanel *WarningsPrefsFactory::Create(wxWindow *parent)
|
||||
{
|
||||
wxASSERT(parent); // to justify safenew
|
||||
|
@ -27,6 +27,7 @@ class WarningsPrefs final : public PrefsPanel
|
||||
WarningsPrefs(wxWindow * parent);
|
||||
~WarningsPrefs();
|
||||
bool Apply() override;
|
||||
wxString HelpPageName() override;
|
||||
|
||||
private:
|
||||
void Populate();
|
||||
|
Loading…
x
Reference in New Issue
Block a user