diff --git a/libraries/lib-strings/Identifier.h b/libraries/lib-strings/Identifier.h index e8293de16..30f2de251 100644 --- a/libraries/lib-strings/Identifier.h +++ b/libraries/lib-strings/Identifier.h @@ -232,7 +232,8 @@ struct CommandIdTag; using CommandID = TaggedIdentifier< CommandIdTag, false >; using CommandIDs = std::vector; -using ManualPageID = wxString; +struct ManualPageIDTag; +using ManualPageID = TaggedIdentifier< ManualPageIDTag >; #endif diff --git a/src/FFmpeg.cpp b/src/FFmpeg.cpp index 78493992b..e849f94d3 100644 --- a/src/FFmpeg.cpp +++ b/src/FFmpeg.cpp @@ -538,7 +538,7 @@ public: void OnDownload(wxCommandEvent & WXUNUSED(event)) { - HelpSystem::ShowHelp(this, wxT("FAQ:Installing_the_FFmpeg_Import_Export_Library")); + HelpSystem::ShowHelp(this, L"FAQ:Installing_the_FFmpeg_Import_Export_Library"); } wxString GetLibPath() diff --git a/src/FreqWindow.cpp b/src/FreqWindow.cpp index 3c81b1292..766db7634 100644 --- a/src/FreqWindow.cpp +++ b/src/FreqWindow.cpp @@ -550,7 +550,7 @@ void FrequencyPlotDialog::OnGetURL(wxCommandEvent & WXUNUSED(event)) { // Original help page is back on-line (March 2016), but the manual should be more reliable. // http://www.eramp.com/WCAG_2_audio_contrast_tool_help.htm - HelpSystem::ShowHelp(this, wxT("Plot Spectrum")); + HelpSystem::ShowHelp(this, L"Plot Spectrum"); } bool FrequencyPlotDialog::Show(bool show) diff --git a/src/HistoryWindow.cpp b/src/HistoryWindow.cpp index 461aec39d..ac85edd53 100644 --- a/src/HistoryWindow.cpp +++ b/src/HistoryWindow.cpp @@ -313,7 +313,7 @@ void HistoryDialog::OnCompact(wxCommandEvent & WXUNUSED(event)) void HistoryDialog::OnGetURL(wxCommandEvent & WXUNUSED(event)) { - HelpSystem::ShowHelp(this, wxT("Undo,_Redo_and_History")); + HelpSystem::ShowHelp(this, L"Undo,_Redo_and_History"); } void HistoryDialog::OnItemSelected(wxListEvent &event) diff --git a/src/ProjectFileManager.cpp b/src/ProjectFileManager.cpp index 6c339ea5f..3d90ac14a 100644 --- a/src/ProjectFileManager.cpp +++ b/src/ProjectFileManager.cpp @@ -1362,7 +1362,7 @@ public: void OnGetURL(wxCommandEvent &WXUNUSED(evt)) { - HelpSystem::ShowHelp(this, wxT("File_Menu:_Compact_Project"), true); + HelpSystem::ShowHelp(this, L"File_Menu:_Compact_Project", true); } }; } diff --git a/src/Screenshot.cpp b/src/Screenshot.cpp index d063ee346..26948a8d0 100644 --- a/src/Screenshot.cpp +++ b/src/Screenshot.cpp @@ -559,7 +559,7 @@ void ScreenshotBigDialog::OnClose(wxCommandEvent & WXUNUSED(event)) void ScreenshotBigDialog::OnGetURL(wxCommandEvent & WXUNUSED(event)) { - HelpSystem::ShowHelp(this, wxT("Screenshot")); + HelpSystem::ShowHelp(this, L"Screenshot"); } void ScreenshotBigDialog::OnUIUpdate(wxUpdateUIEvent & WXUNUSED(event)) diff --git a/src/Tags.cpp b/src/Tags.cpp index e7ee73eca..9c96095e2 100644 --- a/src/Tags.cpp +++ b/src/Tags.cpp @@ -972,7 +972,7 @@ void TagsEditorDialog::OnDontShow( wxCommandEvent & Evt ) void TagsEditorDialog::OnHelp(wxCommandEvent& WXUNUSED(event)) { - HelpSystem::ShowHelp(this, wxT("Metadata_Editor"), true); + HelpSystem::ShowHelp(this, L"Metadata_Editor", true); } bool TagsEditorDialog::TransferDataFromWindow() diff --git a/src/TimerRecordDialog.cpp b/src/TimerRecordDialog.cpp index 5da326810..e95a309e2 100644 --- a/src/TimerRecordDialog.cpp +++ b/src/TimerRecordDialog.cpp @@ -363,7 +363,7 @@ void TimerRecordDialog::OnAutoExportCheckBox_Change(wxCommandEvent& WXUNUSED(eve void TimerRecordDialog::OnHelpButtonClick(wxCommandEvent& WXUNUSED(event)) { - HelpSystem::ShowHelp(this, wxT("Timer_Record"), true); + HelpSystem::ShowHelp(this, L"Timer_Record", true); } void TimerRecordDialog::OnOK(wxCommandEvent& WXUNUSED(event)) diff --git a/src/effects/Contrast.cpp b/src/effects/Contrast.cpp index a32a46c7b..dd26a803e 100644 --- a/src/effects/Contrast.cpp +++ b/src/effects/Contrast.cpp @@ -361,7 +361,7 @@ void ContrastDialog::OnGetURL(wxCommandEvent & WXUNUSED(event)) { // Original help page is back on-line (March 2016), but the manual should be more reliable. // http://www.eramp.com/WCAG_2_audio_contrast_tool_help.htm - HelpSystem::ShowHelp(this, wxT("Contrast")); + HelpSystem::ShowHelp(this, L"Contrast"); } void ContrastDialog::OnClose(wxCommandEvent & WXUNUSED(event)) diff --git a/src/effects/EffectManager.cpp b/src/effects/EffectManager.cpp index 0b6f9e8b4..5d97948fd 100644 --- a/src/effects/EffectManager.cpp +++ b/src/effects/EffectManager.cpp @@ -190,7 +190,8 @@ void EffectManager::GetCommandDefinition(const PluginID & ID, const CommandConte S.EndArray(); S.EndField(); } - S.AddItem( GetCommandUrl( ID ), "url" ); + // use GET() to expose some details to macro programming users + S.AddItem( GetCommandUrl( ID ).GET(), "url" ); // The tip is a translated string! S.AddItem( GetCommandTip( ID ).Translation(), "tip" ); S.EndStruct(); diff --git a/src/export/Export.cpp b/src/export/Export.cpp index af883f093..d62f8385d 100644 --- a/src/export/Export.cpp +++ b/src/export/Export.cpp @@ -367,7 +367,7 @@ void Exporter::OnExtensionChanged(wxCommandEvent &evt) void Exporter::OnHelp(wxCommandEvent& WXUNUSED(evt)) { wxWindow * pWin = FindProjectFrame( mProject ); - HelpSystem::ShowHelp(pWin, wxT("File_Export_Dialog"), true); + HelpSystem::ShowHelp(pWin, L"File_Export_Dialog", true); } void Exporter::SetFileDialogTitle( const TranslatableString & DialogTitle ) @@ -1494,7 +1494,7 @@ void ExportMixerDialog::OnCancel(wxCommandEvent & WXUNUSED(event)) void ExportMixerDialog::OnMixerPanelHelp(wxCommandEvent & WXUNUSED(event)) { - HelpSystem::ShowHelp(this, wxT("Advanced_Mixing_Options"), true); + HelpSystem::ShowHelp(this, L"Advanced_Mixing_Options", true); } diff --git a/src/export/ExportFFmpegDialogs.cpp b/src/export/ExportFFmpegDialogs.cpp index 1f861be2f..a7b9cbe92 100644 --- a/src/export/ExportFFmpegDialogs.cpp +++ b/src/export/ExportFFmpegDialogs.cpp @@ -2562,7 +2562,7 @@ void ExportFFmpegOptions::OnOK(wxCommandEvent& WXUNUSED(event)) void ExportFFmpegOptions::OnGetURL(wxCommandEvent & WXUNUSED(event)) { - HelpSystem::ShowHelp(this, wxT("Custom_FFmpeg_Export_Options")); + HelpSystem::ShowHelp(this, L"Custom_FFmpeg_Export_Options"); } diff --git a/src/export/ExportMP3.cpp b/src/export/ExportMP3.cpp index ce9f11ea8..3278c6668 100644 --- a/src/export/ExportMP3.cpp +++ b/src/export/ExportMP3.cpp @@ -674,7 +674,7 @@ public: void OnDownload(wxCommandEvent & WXUNUSED(event)) { - HelpSystem::ShowHelp(this, wxT("FAQ:Installing_the_LAME_MP3_Encoder")); + HelpSystem::ShowHelp(this, L"FAQ:Installing_the_LAME_MP3_Encoder"); } wxString GetLibPath() diff --git a/src/export/ExportMultiple.cpp b/src/export/ExportMultiple.cpp index d70250dab..8f316f3ca 100644 --- a/src/export/ExportMultiple.cpp +++ b/src/export/ExportMultiple.cpp @@ -574,7 +574,7 @@ void ExportMultipleDialog::OnCancel(wxCommandEvent& WXUNUSED(event)) void ExportMultipleDialog::OnHelp(wxCommandEvent& WXUNUSED(event)) { - HelpSystem::ShowHelp(this, wxT("Export_Multiple"), true); + HelpSystem::ShowHelp(this, L"Export_Multiple", true); } void ExportMultipleDialog::OnExport(wxCommandEvent& WXUNUSED(event)) diff --git a/src/menus/HelpMenus.cpp b/src/menus/HelpMenus.cpp index 48be098de..c4680c4a7 100644 --- a/src/menus/HelpMenus.cpp +++ b/src/menus/HelpMenus.cpp @@ -309,7 +309,7 @@ void OnQuickHelp(const CommandContext &context) auto &project = context.project; HelpSystem::ShowHelp( &GetProjectFrame( project ), - wxT("Quick_Help")); + L"Quick_Help"); } void OnManual(const CommandContext &context) @@ -317,7 +317,7 @@ void OnManual(const CommandContext &context) auto &project = context.project; HelpSystem::ShowHelp( &GetProjectFrame( project ), - wxT("Main_Page")); + L"Main_Page"); } void OnAudioDeviceInfo(const CommandContext &context) diff --git a/src/prefs/LibraryPrefs.cpp b/src/prefs/LibraryPrefs.cpp index f3cc899db..0eb475cae 100644 --- a/src/prefs/LibraryPrefs.cpp +++ b/src/prefs/LibraryPrefs.cpp @@ -168,7 +168,7 @@ void LibraryPrefs::OnMP3FindButton(wxCommandEvent & WXUNUSED(event)) void LibraryPrefs::OnMP3DownButton(wxCommandEvent & WXUNUSED(event)) { // Modal help dialogue required here - HelpSystem::ShowHelp(this, wxT("FAQ:Installing_the_LAME_MP3_Encoder"), true); + HelpSystem::ShowHelp(this, L"FAQ:Installing_the_LAME_MP3_Encoder", true); } void LibraryPrefs::SetFFmpegVersionText() @@ -217,7 +217,7 @@ void LibraryPrefs::OnFFmpegFindButton(wxCommandEvent & WXUNUSED(event)) void LibraryPrefs::OnFFmpegDownButton(wxCommandEvent & WXUNUSED(event)) { - HelpSystem::ShowHelp(this, wxT("FAQ:Installing_the_FFmpeg_Import_Export_Library"), true); + HelpSystem::ShowHelp(this, L"FAQ:Installing_the_FFmpeg_Import_Export_Library", true); } bool LibraryPrefs::Commit() diff --git a/src/widgets/ErrorDialog.cpp b/src/widgets/ErrorDialog.cpp index b0ba0a1cc..3458922ba 100644 --- a/src/widgets/ErrorDialog.cpp +++ b/src/widgets/ErrorDialog.cpp @@ -133,12 +133,13 @@ void ErrorDialog::OnOk(wxCommandEvent & WXUNUSED(event)) void ErrorDialog::OnHelp(wxCommandEvent & WXUNUSED(event)) { - if( dhelpPage.StartsWith(wxT("innerlink:")) ) + const auto &str = dhelpPage.GET(); + if( str.StartsWith(wxT("innerlink:")) ) { HelpSystem::ShowHtmlText( this, - TitleText(dhelpPage.Mid( 10 ) ), - HelpText( dhelpPage.Mid( 10 )), + TitleText(str.Mid( 10 ) ), + HelpText( str.Mid( 10 )), false, true ); return; diff --git a/src/widgets/HelpSystem.cpp b/src/widgets/HelpSystem.cpp index a7fe2db65..315e1c521 100644 --- a/src/widgets/HelpSystem.cpp +++ b/src/widgets/HelpSystem.cpp @@ -57,7 +57,6 @@ const wxString HelpSystem::HelpServerHomeDir = wxT("/"); const wxString HelpSystem::HelpServerManDir = wxT("/man/"); #endif const wxString HelpSystem::LocalHelpManDir = wxT("/man/"); -const wxString HelpSystem::ReleaseSuffix = wxT(".html"); namespace { @@ -310,19 +309,24 @@ void HelpSystem::ShowHelp(wxWindow *parent, const ManualPageID &PageName, bool bModal) { + /// The string which is appended to the development manual page name in order + /// obtain the file name in the local and release web copies of the manual + const wxString ReleaseSuffix = L".html"; + FilePath localHelpPage; wxString webHelpPath; wxString webHelpPage; wxString releasePageName; wxString anchor; // optional part of URL after (and including) the '#' - if (PageName.Find('#', true) != wxNOT_FOUND) + const auto &PageNameStr = PageName.GET(); + if (PageNameStr.Find('#', true) != wxNOT_FOUND) { // need to split anchor off into separate variable - releasePageName= PageName.BeforeLast('#'); - anchor = wxT("#") + PageName.AfterLast('#'); + releasePageName = PageNameStr.BeforeLast('#'); + anchor = wxT("#") + PageNameStr.AfterLast('#'); } else { - releasePageName = PageName; + releasePageName = PageName.GET(); anchor = wxT(""); } // The wiki pages are transformed to static HTML by @@ -338,23 +342,23 @@ void HelpSystem::ShowHelp(wxWindow *parent, // // The front page and 'quick_help' are treated as special cases and placed in // the root of the help directory rather than the "/man/" sub-directory. - if (releasePageName == wxT("Main_Page")) + if (releasePageName == L"Main_Page") { - releasePageName = wxT("index") + HelpSystem::ReleaseSuffix + anchor; + releasePageName = L"index" + ReleaseSuffix + anchor; localHelpPage = wxFileName(FileNames::HtmlHelpDir(), releasePageName).GetFullPath(); - webHelpPath = wxT("https://")+HelpSystem::HelpHostname+HelpSystem::HelpServerHomeDir; + webHelpPath = L"https://" + HelpSystem::HelpHostname + HelpSystem::HelpServerHomeDir; } - else if (releasePageName == wxT("Quick_Help")) + else if (releasePageName == L"Quick_Help") { // DA: No bundled help, by default, and different quick-help URL. #ifdef EXPERIMENTAL_DA - releasePageName = wxT("video") + HelpSystem::ReleaseSuffix + anchor; + releasePageName = L"video" + ReleaseSuffix + anchor; localHelpPage = wxFileName(FileNames::HtmlHelpDir(), releasePageName).GetFullPath(); - webHelpPath = wxT("http://www.darkaudacity.com/"); + webHelpPath = L"http://www.darkaudacity.com/"; #else - releasePageName = wxT("quick_help") + HelpSystem::ReleaseSuffix + anchor; + releasePageName = L"quick_help" + ReleaseSuffix + anchor; localHelpPage = wxFileName(FileNames::HtmlHelpDir(), releasePageName).GetFullPath(); - webHelpPath = wxT("https://")+HelpSystem::HelpHostname+HelpSystem::HelpServerHomeDir; + webHelpPath = L"https://" + HelpSystem::HelpHostname + HelpSystem::HelpServerHomeDir; #endif } // not a page name, but rather a full path (e.g. to wiki) @@ -390,21 +394,21 @@ void HelpSystem::ShowHelp(wxWindow *parent, // Replace "_." with "." releasePageName.Replace(wxT("_."), wxT("."), true); // Concatenate file name with file extension and anchor. - releasePageName = releasePageName + HelpSystem::ReleaseSuffix + anchor; + releasePageName = releasePageName + ReleaseSuffix + anchor; // Other than index and quick_help, all local pages are in subdirectory 'LocalHelpManDir'. localHelpPage = wxFileName(FileNames::HtmlHelpDir() + LocalHelpManDir, releasePageName).GetFullPath(); // Other than index and quick_help, all on-line pages are in subdirectory 'HelpServerManDir'. - webHelpPath = wxT("https://")+HelpSystem::HelpHostname+HelpSystem::HelpServerManDir; + webHelpPath = L"https://" + HelpSystem::HelpHostname + HelpSystem::HelpServerManDir; } #ifdef USE_ALPHA_MANUAL - webHelpPage = webHelpPath + PageName; + webHelpPage = webHelpPath + PageName.GET(); #else webHelpPage = webHelpPath + releasePageName; #endif wxLogMessage(wxT("Help button pressed: PageName %s, releasePageName %s"), - PageName, releasePageName); + PageName.GET(), releasePageName); wxLogMessage(wxT("webHelpPage %s, localHelpPage %s"), webHelpPage, localHelpPage); @@ -535,7 +539,7 @@ void LinkingHtmlWindow::OnLinkClicked(const wxHtmlLinkInfo& link) if( href.StartsWith( wxT("innerlink:help:"))) { - HelpSystem::ShowHelp(this, href.Mid( 15 ), true ); + HelpSystem::ShowHelp(this, ManualPageID{ href.Mid( 15 ) }, true ); return; } else if( href.StartsWith(wxT("innerlink:")) ) diff --git a/src/widgets/HelpSystem.h b/src/widgets/HelpSystem.h index d22db38fb..3731fd101 100644 --- a/src/widgets/HelpSystem.h +++ b/src/widgets/HelpSystem.h @@ -110,10 +110,6 @@ public: /// Must both start and end with '/' characters. static const wxString LocalHelpManDir; - /// The string which is appended to the development manual page name in order - /// obtain the file name in the local and release web copies of the manual - static const wxString ReleaseSuffix; - }; class ShuttleGui; diff --git a/src/widgets/MultiDialog.cpp b/src/widgets/MultiDialog.cpp index 1cd2923c5..be270052c 100644 --- a/src/widgets/MultiDialog.cpp +++ b/src/widgets/MultiDialog.cpp @@ -145,7 +145,7 @@ MultiDialog::MultiDialog(wxWindow * pParent, auto pButton = S.Id(wxID_OK) .AddButton(XXO("OK"), wxALIGN_CENTER, !log); - if (!mHelpPage.IsEmpty()) { + if (!mHelpPage.empty()) { auto pHelpBtn = S.Id(wxID_HELP) .AddBitmapButton(theTheme.Bitmap(bmpHelpIcon), wxALIGN_CENTER, false); pHelpBtn->SetToolTip(XO("Help").Translation());