2019-03-22 15:09:22 +00:00
|
|
|
#include "../Audacity.h"
|
2018-11-11 17:27:44 +00:00
|
|
|
#include "../Experimental.h"
|
|
|
|
|
2019-05-11 12:23:07 +00:00
|
|
|
#include <wx/bmpbuttn.h>
|
2019-03-30 19:20:40 +00:00
|
|
|
#include <wx/textctrl.h>
|
2019-05-29 16:05:22 +00:00
|
|
|
#include <wx/frame.h>
|
2019-03-30 19:20:40 +00:00
|
|
|
|
2018-10-23 21:47:23 +00:00
|
|
|
#include "../AboutDialog.h"
|
2019-05-11 12:23:07 +00:00
|
|
|
#include "../AllThemeResources.h"
|
2018-10-23 21:47:23 +00:00
|
|
|
#include "../AudacityLogger.h"
|
2019-06-10 18:25:50 +00:00
|
|
|
#include "../AudioIOBase.h"
|
Command flag functions out of Menus.cpp, reducing its dependencies...
... Mostly into CommonCommandFlags.cpp, but some elsewhere, to avoid giving
that new file problematic dependencies on LabelTrack, ControlToolBar, and
EffectManager.
Note that CutCopyAvailableFlag is critically ordered, for message purposes,
only with AudioIONotAvailableFlag, the only flag with a message that it combines
with in menu item definitions.
The dependency on LabelTrack.cpp might not be a bad one later, if the track and
its view can be separated, and that would allow CutCopyAvailableFlag to be
put with the others. But much other work on LabelTrack must happen first.
2019-06-14 15:39:12 +00:00
|
|
|
#include "../CommonCommandFlags.h"
|
2019-05-17 20:29:31 +00:00
|
|
|
#include "../CrashReport.h"
|
2018-10-23 21:47:23 +00:00
|
|
|
#include "../FileNames.h"
|
2019-05-11 11:18:24 +00:00
|
|
|
#include "../HelpText.h"
|
2019-01-08 18:05:55 +00:00
|
|
|
#include "../Menus.h"
|
2019-05-11 12:23:07 +00:00
|
|
|
#include "../Prefs.h"
|
2018-10-23 21:47:23 +00:00
|
|
|
#include "../Project.h"
|
2019-06-09 11:42:40 +00:00
|
|
|
#include "../ProjectSelectionManager.h"
|
2018-10-23 21:47:23 +00:00
|
|
|
#include "../ShuttleGui.h"
|
|
|
|
#include "../SplashDialog.h"
|
2019-05-11 12:23:07 +00:00
|
|
|
#include "../Theme.h"
|
2018-10-23 21:47:23 +00:00
|
|
|
#include "../commands/CommandContext.h"
|
|
|
|
#include "../commands/CommandManager.h"
|
2019-06-22 02:54:34 +00:00
|
|
|
#include "../prefs/PrefsDialog.h"
|
2019-05-20 18:27:11 +00:00
|
|
|
#include "../widgets/AudacityMessageBox.h"
|
2018-10-23 21:47:23 +00:00
|
|
|
#include "../widgets/HelpSystem.h"
|
|
|
|
|
|
|
|
#if defined(EXPERIMENTAL_CRASH_REPORT)
|
|
|
|
#include <wx/debugrpt.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// private helper classes and functions
|
|
|
|
namespace {
|
2019-01-08 18:18:07 +00:00
|
|
|
|
|
|
|
void ShowDiagnostics(
|
|
|
|
AudacityProject &project, const wxString &info,
|
2019-01-08 18:05:55 +00:00
|
|
|
const TranslatableString &description, const wxString &defaultPath,
|
|
|
|
bool fixedWidth = false)
|
2019-01-08 18:18:07 +00:00
|
|
|
{
|
2019-05-28 17:12:56 +00:00
|
|
|
auto &window = GetProjectFrame( project );
|
|
|
|
wxDialogWrapper dlg( &window, wxID_ANY, description);
|
2019-12-08 05:25:47 +00:00
|
|
|
dlg.SetName();
|
2019-01-08 18:18:07 +00:00
|
|
|
ShuttleGui S(&dlg, eIsCreating);
|
|
|
|
|
|
|
|
wxTextCtrl *text;
|
|
|
|
S.StartVerticalLay();
|
|
|
|
{
|
2017-10-31 18:52:01 +00:00
|
|
|
text = S.Id(wxID_STATIC)
|
2019-01-08 18:05:55 +00:00
|
|
|
.Style(wxTE_MULTILINE | wxTE_READONLY | wxTE_RICH)
|
|
|
|
.AddTextWindow("");
|
|
|
|
|
2020-08-12 19:23:27 +00:00
|
|
|
wxButton *save = safenew wxButton(S.GetParent(), wxID_OK, _("&Save"));
|
|
|
|
S.AddStandardButtons(eCancelButton, save);
|
2019-01-08 18:18:07 +00:00
|
|
|
}
|
|
|
|
S.EndVerticalLay();
|
|
|
|
|
2019-01-08 18:05:55 +00:00
|
|
|
if (fixedWidth) {
|
|
|
|
auto style = text->GetDefaultStyle();
|
|
|
|
style.SetFontFamily( wxFONTFAMILY_TELETYPE );
|
|
|
|
text->SetDefaultStyle(style);
|
|
|
|
}
|
|
|
|
|
|
|
|
*text << info;
|
|
|
|
|
2019-01-08 18:18:07 +00:00
|
|
|
dlg.SetSize(350, 450);
|
|
|
|
|
|
|
|
if (dlg.ShowModal() == wxID_OK)
|
|
|
|
{
|
2019-12-18 21:32:21 +00:00
|
|
|
const auto fileDialogTitle = XO("Save %s").Format( description );
|
2019-01-08 18:18:07 +00:00
|
|
|
wxString fName = FileNames::SelectFile(FileNames::Operation::Export,
|
|
|
|
fileDialogTitle,
|
|
|
|
wxEmptyString,
|
|
|
|
defaultPath,
|
|
|
|
wxT("txt"),
|
2019-12-27 03:48:00 +00:00
|
|
|
{ FileNames::TextFiles },
|
2019-01-08 18:18:07 +00:00
|
|
|
wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER,
|
2019-05-28 17:12:56 +00:00
|
|
|
&window);
|
2019-01-08 18:18:07 +00:00
|
|
|
if (!fName.empty())
|
|
|
|
{
|
|
|
|
if (!text->SaveFile(fName))
|
|
|
|
{
|
|
|
|
AudacityMessageBox(
|
2019-12-07 19:30:07 +00:00
|
|
|
XO("Unable to save %s").Format( description ),
|
|
|
|
fileDialogTitle);
|
2019-01-08 18:18:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-11 12:23:07 +00:00
|
|
|
/** @brief Class which makes a dialog for displaying quick fixes to common issues.
|
|
|
|
*
|
|
|
|
* This class originated with the 'Stuck in a mode' problem, where far too many
|
|
|
|
* users get into a mode without realising, and don't know how to get out.
|
|
|
|
* It is a band-aid, and we should do more towards a full and proper solution
|
2021-01-12 11:56:09 +00:00
|
|
|
* where there are fewer special modes, and they don't persist.
|
2019-05-11 12:23:07 +00:00
|
|
|
*/
|
|
|
|
class QuickFixDialog : public wxDialogWrapper
|
|
|
|
{
|
2020-03-10 21:05:19 +00:00
|
|
|
public:
|
|
|
|
using PrefSetter = std::function< void() > ;
|
|
|
|
|
2020-01-04 18:52:24 +00:00
|
|
|
QuickFixDialog(wxWindow * pParent, AudacityProject &project);
|
2019-05-11 12:23:07 +00:00
|
|
|
void Populate();
|
|
|
|
void PopulateOrExchange(ShuttleGui & S);
|
2020-03-10 21:05:19 +00:00
|
|
|
void AddStuck( ShuttleGui & S, bool & bBool,
|
|
|
|
const PrefSetter &prefSetter,
|
2019-12-23 00:55:59 +00:00
|
|
|
const TranslatableString &Prompt, wxString Help );
|
2019-05-11 12:23:07 +00:00
|
|
|
|
|
|
|
void OnOk(wxCommandEvent &event);
|
|
|
|
void OnCancel(wxCommandEvent &event);
|
2020-03-10 21:05:19 +00:00
|
|
|
void OnHelp(const wxString &Str);
|
|
|
|
void OnFix(const PrefSetter &setter, wxWindowID id);
|
2019-05-11 12:23:07 +00:00
|
|
|
|
2020-01-04 18:52:24 +00:00
|
|
|
AudacityProject &mProject;
|
|
|
|
|
2019-05-11 12:23:07 +00:00
|
|
|
int mItem;
|
|
|
|
bool mbSyncLocked;
|
|
|
|
bool mbInSnapTo;
|
|
|
|
bool mbSoundActivated;
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
};
|
|
|
|
|
2020-03-10 21:05:19 +00:00
|
|
|
|
2019-05-11 12:23:07 +00:00
|
|
|
#define FixButtonID 7001
|
|
|
|
#define HelpButtonID 7011
|
|
|
|
|
|
|
|
BEGIN_EVENT_TABLE(QuickFixDialog, wxDialogWrapper)
|
|
|
|
EVT_BUTTON(wxID_OK, QuickFixDialog::OnOk)
|
|
|
|
EVT_BUTTON(wxID_CANCEL, QuickFixDialog::OnCancel)
|
|
|
|
END_EVENT_TABLE();
|
|
|
|
|
2020-01-04 18:52:24 +00:00
|
|
|
QuickFixDialog::QuickFixDialog(wxWindow * pParent, AudacityProject &project) :
|
2019-12-08 05:25:47 +00:00
|
|
|
wxDialogWrapper(pParent, wxID_ANY, XO("Do you have these problems?"),
|
2019-05-11 12:23:07 +00:00
|
|
|
wxDefaultPosition, wxDefaultSize,
|
|
|
|
wxDEFAULT_DIALOG_STYLE )
|
2020-01-04 18:52:24 +00:00
|
|
|
, mProject{ project }
|
2019-05-11 12:23:07 +00:00
|
|
|
{
|
|
|
|
const long SNAP_OFF = 0;
|
|
|
|
|
|
|
|
gPrefs->Read(wxT("/GUI/SyncLockTracks"), &mbSyncLocked, false);
|
|
|
|
mbInSnapTo = gPrefs->Read(wxT("/SnapTo"), SNAP_OFF) !=0;
|
|
|
|
gPrefs->Read(wxT("/AudioIO/SoundActivatedRecord"), &mbSoundActivated, false);
|
|
|
|
|
|
|
|
ShuttleGui S(this, eIsCreating);
|
|
|
|
PopulateOrExchange(S);
|
|
|
|
|
|
|
|
Fit();
|
|
|
|
auto sz = GetSize();
|
|
|
|
SetMinSize( sz );
|
|
|
|
SetMaxSize( sz );
|
|
|
|
|
|
|
|
// The close button has the cancel id and acts exactly the same as cancel.
|
|
|
|
wxButton * pWin = (wxButton*)FindWindowById( wxID_CANCEL );
|
|
|
|
if( pWin )
|
|
|
|
pWin->SetFocus( );
|
|
|
|
Center();
|
|
|
|
}
|
|
|
|
|
2020-03-10 21:05:19 +00:00
|
|
|
void QuickFixDialog::AddStuck( ShuttleGui & S, bool & bBool,
|
|
|
|
const PrefSetter &prefSetter,
|
2019-12-23 00:55:59 +00:00
|
|
|
const TranslatableString &Prompt, wxString Help )
|
2019-05-11 12:23:07 +00:00
|
|
|
{
|
|
|
|
mItem++;
|
2020-03-10 21:05:19 +00:00
|
|
|
wxWindowID id = FixButtonID + mItem;
|
2019-05-11 12:23:07 +00:00
|
|
|
if( !bBool)
|
|
|
|
return;
|
2020-03-10 21:05:19 +00:00
|
|
|
|
|
|
|
S
|
|
|
|
.AddFixedText( Prompt );
|
|
|
|
|
|
|
|
S
|
|
|
|
.Id( id )
|
|
|
|
.AddButton( XXO("Fix") )
|
|
|
|
->Bind( wxEVT_BUTTON, [this, prefSetter, id](wxCommandEvent&){
|
|
|
|
OnFix( prefSetter, id );
|
|
|
|
} );
|
2019-05-11 12:23:07 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
// Replace standard Help button with smaller icon button.
|
|
|
|
// bs->AddButton(safenew wxButton(parent, wxID_HELP));
|
|
|
|
auto b = safenew wxBitmapButton(S.GetParent(), HelpButtonID+mItem, theTheme.Bitmap( bmpHelpIcon ));
|
|
|
|
b->SetToolTip( _("Help") );
|
|
|
|
b->SetLabel(_("Help")); // for screen readers
|
2020-03-10 21:05:19 +00:00
|
|
|
b->Bind( wxEVT_BUTTON, [this, Help](const wxCommandEvent&){
|
|
|
|
OnHelp( Help );
|
|
|
|
} );
|
2019-05-11 12:23:07 +00:00
|
|
|
S.AddWindow( b );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void QuickFixDialog::PopulateOrExchange(ShuttleGui & S)
|
|
|
|
{
|
|
|
|
|
|
|
|
S.StartVerticalLay(1);
|
2019-12-22 19:58:36 +00:00
|
|
|
S.StartStatic( XO("Quick Fixes"));
|
2019-05-11 12:23:07 +00:00
|
|
|
|
|
|
|
// These aren't all possible modes one can be stuck in, but they are some of them.
|
|
|
|
bool bStuckInMode = mbSyncLocked || mbInSnapTo || mbSoundActivated;
|
|
|
|
|
|
|
|
if( !bStuckInMode ){
|
2019-12-08 05:25:47 +00:00
|
|
|
SetLabel(XO("Nothing to do"));
|
2019-12-23 00:55:59 +00:00
|
|
|
S.AddFixedText(XO("No quick, easily fixed problems were found"));
|
2019-05-11 12:23:07 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
S.StartMultiColumn(3, wxALIGN_CENTER);
|
|
|
|
{
|
|
|
|
mItem = -1;
|
|
|
|
|
2020-03-10 21:05:19 +00:00
|
|
|
auto defaultAction =
|
|
|
|
[](AudacityProject *pProject, const wxString &path){ return
|
|
|
|
[pProject, path]{
|
|
|
|
gPrefs->Write(path, 0);
|
|
|
|
gPrefs->Flush();
|
|
|
|
// This is overkill (aka slow), as all preferences are
|
|
|
|
// reloaded and all
|
|
|
|
// toolbars recreated.
|
|
|
|
// Overkill probably doesn't matter, as this command is
|
|
|
|
// infrequently used.
|
|
|
|
DoReloadPreferences( *pProject );
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2019-05-11 12:23:07 +00:00
|
|
|
// Use # in the URLs to ensure we go to the online version of help.
|
|
|
|
// Local help may well not be installed.
|
2020-03-10 21:05:19 +00:00
|
|
|
auto pProject = &mProject;
|
|
|
|
AddStuck( S, mbSyncLocked,
|
|
|
|
defaultAction( pProject, "/GUI/SyncLockTracks" ),
|
2019-12-23 00:55:59 +00:00
|
|
|
XO("Clocks on the Tracks"), "Quick_Fix#sync_lock" );
|
2020-03-10 21:05:19 +00:00
|
|
|
AddStuck( S, mbInSnapTo,
|
|
|
|
[pProject] {
|
|
|
|
gPrefs->Write( "/SnapTo", 0 );
|
|
|
|
gPrefs->Flush();
|
|
|
|
// Sadly SnapTo has to be handled specially,
|
|
|
|
// as it is not part of the standard
|
|
|
|
// preference dialogs.
|
|
|
|
ProjectSelectionManager::Get( *pProject ).AS_SetSnapTo( 0 );
|
|
|
|
},
|
2019-12-23 00:55:59 +00:00
|
|
|
XO("Can't select precisely"), "Quick_Fix#snap_to" );
|
2020-03-10 21:05:19 +00:00
|
|
|
AddStuck( S, mbSoundActivated,
|
|
|
|
defaultAction( pProject, "/AudioIO/SoundActivatedRecord" ),
|
2019-12-23 00:55:59 +00:00
|
|
|
XO("Recording stops and starts"),
|
|
|
|
"Quick_Fix#sound_activated_recording" );
|
2019-05-11 12:23:07 +00:00
|
|
|
}
|
|
|
|
S.EndMultiColumn();
|
|
|
|
}
|
|
|
|
S.EndStatic();
|
|
|
|
|
|
|
|
S.StartHorizontalLay(wxALIGN_CENTER_HORIZONTAL, 0);
|
|
|
|
S.AddStandardButtons(eCloseButton + (bStuckInMode ? 0 : eHelpButton));
|
|
|
|
S.EndHorizontalLay();
|
|
|
|
|
|
|
|
S.EndVerticalLay();
|
|
|
|
|
|
|
|
wxButton * pBtn = (wxButton*)FindWindowById( wxID_HELP );
|
|
|
|
if( pBtn )
|
2020-03-10 21:05:19 +00:00
|
|
|
pBtn->Bind( wxEVT_BUTTON, [this]( const wxCommandEvent & ){
|
|
|
|
OnHelp( "Quick_Fix#" );
|
|
|
|
} );
|
2019-05-11 12:23:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QuickFixDialog::OnOk(wxCommandEvent &event)
|
|
|
|
{
|
|
|
|
(void)event;// Compiler food
|
|
|
|
EndModal(wxID_OK);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QuickFixDialog::OnCancel(wxCommandEvent &event)
|
|
|
|
{
|
|
|
|
(void)event;// Compiler food
|
|
|
|
EndModal(wxID_CANCEL);
|
|
|
|
}
|
|
|
|
|
2020-03-10 21:05:19 +00:00
|
|
|
void QuickFixDialog::OnHelp(const wxString &Str)
|
2019-05-11 12:23:07 +00:00
|
|
|
{
|
2020-03-10 21:05:19 +00:00
|
|
|
HelpSystem::ShowHelp(this, Str, true);
|
2019-05-11 12:23:07 +00:00
|
|
|
}
|
|
|
|
|
2020-03-10 21:05:19 +00:00
|
|
|
void QuickFixDialog::OnFix(const PrefSetter &setter, wxWindowID id)
|
2019-05-11 12:23:07 +00:00
|
|
|
{
|
2020-03-10 21:05:19 +00:00
|
|
|
if ( setter )
|
|
|
|
setter();
|
2019-05-11 12:23:07 +00:00
|
|
|
|
|
|
|
// Change the label after doing the fix, as the fix may take a second or two.
|
2020-03-10 21:05:19 +00:00
|
|
|
auto pBtn = FindWindow(id);
|
2019-05-11 12:23:07 +00:00
|
|
|
if( pBtn )
|
|
|
|
pBtn->SetLabel( _("Fixed") );
|
|
|
|
|
|
|
|
// The close button has the cancel id and acts exactly the same as cancel.
|
|
|
|
wxButton * pWin = (wxButton*)FindWindowById( wxID_CANCEL );
|
|
|
|
if( pWin )
|
|
|
|
pWin->SetFocus( );
|
|
|
|
}
|
|
|
|
|
2018-10-23 21:47:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace HelpActions {
|
|
|
|
|
|
|
|
// exported helper functions
|
|
|
|
|
|
|
|
// Menu handler functions
|
|
|
|
|
|
|
|
struct Handler : CommandHandlerObject {
|
|
|
|
|
|
|
|
void OnQuickFix(const CommandContext &context)
|
|
|
|
{
|
|
|
|
auto &project = context.project;
|
2020-01-04 18:52:24 +00:00
|
|
|
QuickFixDialog dlg( &GetProjectFrame( project ), project );
|
2018-10-23 21:47:23 +00:00
|
|
|
dlg.ShowModal();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OnQuickHelp(const CommandContext &context)
|
|
|
|
{
|
|
|
|
auto &project = context.project;
|
|
|
|
HelpSystem::ShowHelp(
|
2019-05-28 17:12:56 +00:00
|
|
|
&GetProjectFrame( project ),
|
2018-10-23 21:47:23 +00:00
|
|
|
wxT("Quick_Help"));
|
|
|
|
}
|
|
|
|
|
|
|
|
void OnManual(const CommandContext &context)
|
|
|
|
{
|
|
|
|
auto &project = context.project;
|
|
|
|
HelpSystem::ShowHelp(
|
2019-05-28 17:12:56 +00:00
|
|
|
&GetProjectFrame( project ),
|
2018-10-23 21:47:23 +00:00
|
|
|
wxT("Main_Page"));
|
|
|
|
}
|
|
|
|
|
|
|
|
void OnAudioDeviceInfo(const CommandContext &context)
|
|
|
|
{
|
|
|
|
auto &project = context.project;
|
2019-06-10 18:25:50 +00:00
|
|
|
auto gAudioIO = AudioIOBase::Get();
|
2018-10-23 21:47:23 +00:00
|
|
|
wxString info = gAudioIO->GetDeviceInfo();
|
2019-01-08 18:18:07 +00:00
|
|
|
ShowDiagnostics( project, info,
|
2019-12-08 05:25:47 +00:00
|
|
|
XO("Audio Device Info"), wxT("deviceinfo.txt") );
|
2018-10-23 21:47:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef EXPERIMENTAL_MIDI_OUT
|
|
|
|
void OnMidiDeviceInfo(const CommandContext &context)
|
|
|
|
{
|
|
|
|
auto &project = context.project;
|
2019-06-10 18:25:50 +00:00
|
|
|
auto gAudioIO = AudioIOBase::Get();
|
2018-10-23 21:47:23 +00:00
|
|
|
wxString info = gAudioIO->GetMidiDeviceInfo();
|
2019-01-08 18:18:07 +00:00
|
|
|
ShowDiagnostics( project, info,
|
2019-12-08 05:25:47 +00:00
|
|
|
XO("MIDI Device Info"), wxT("midideviceinfo.txt") );
|
2018-10-23 21:47:23 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void OnShowLog( const CommandContext &context )
|
|
|
|
{
|
2019-04-26 14:20:49 +00:00
|
|
|
auto logger = AudacityLogger::Get();
|
|
|
|
if (logger) {
|
|
|
|
logger->Show();
|
|
|
|
}
|
2018-10-23 21:47:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#if defined(EXPERIMENTAL_CRASH_REPORT)
|
|
|
|
void OnCrashReport(const CommandContext &WXUNUSED(context) )
|
|
|
|
{
|
|
|
|
// Change to "1" to test a real crash
|
|
|
|
#if 0
|
|
|
|
char *p = 0;
|
|
|
|
*p = 1234;
|
|
|
|
#endif
|
2019-05-17 20:29:31 +00:00
|
|
|
CrashReport::Generate(wxDebugReport::Context_Current);
|
2018-10-23 21:47:23 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2019-01-08 18:05:55 +00:00
|
|
|
void OnMenuTree(const CommandContext &context)
|
|
|
|
{
|
|
|
|
auto &project = context.project;
|
|
|
|
|
|
|
|
using namespace MenuTable;
|
2020-02-04 17:10:17 +00:00
|
|
|
struct MyVisitor : ToolbarMenuVisitor
|
2019-01-08 18:05:55 +00:00
|
|
|
{
|
2020-02-04 17:10:17 +00:00
|
|
|
using ToolbarMenuVisitor::ToolbarMenuVisitor;
|
2020-01-26 21:10:26 +00:00
|
|
|
|
2019-01-08 18:05:55 +00:00
|
|
|
enum : unsigned { TAB = 3 };
|
2020-02-04 04:56:36 +00:00
|
|
|
void DoBeginGroup( GroupItem &item, const Path& ) override
|
2019-01-08 18:05:55 +00:00
|
|
|
{
|
2020-02-04 04:56:36 +00:00
|
|
|
if ( dynamic_cast<MenuItem*>( &item ) ) {
|
2020-01-29 21:31:35 +00:00
|
|
|
Indent();
|
|
|
|
// using GET for alpha only diagnostic tool
|
|
|
|
info += item.name.GET();
|
|
|
|
Return();
|
|
|
|
indentation = wxString{ ' ', TAB * ++level };
|
|
|
|
}
|
2019-01-08 18:05:55 +00:00
|
|
|
}
|
|
|
|
|
2020-02-04 04:56:36 +00:00
|
|
|
void DoEndGroup( GroupItem &item, const Path& ) override
|
2019-01-08 18:05:55 +00:00
|
|
|
{
|
2020-02-04 04:56:36 +00:00
|
|
|
if ( dynamic_cast<MenuItem*>( &item ) )
|
2020-01-29 21:31:35 +00:00
|
|
|
indentation = wxString{ ' ', TAB * --level };
|
2019-01-08 18:05:55 +00:00
|
|
|
}
|
|
|
|
|
2020-02-04 04:56:36 +00:00
|
|
|
void DoVisit( SingleItem &item, const Path& ) override
|
2020-01-29 21:43:53 +00:00
|
|
|
{
|
|
|
|
// using GET for alpha only diagnostic tool
|
|
|
|
Indent();
|
|
|
|
info += item.name.GET();
|
|
|
|
Return();
|
|
|
|
}
|
|
|
|
|
2020-02-04 04:56:36 +00:00
|
|
|
void DoSeparator() override
|
2019-01-08 18:05:55 +00:00
|
|
|
{
|
|
|
|
static const wxString separatorName{ '=', 20 };
|
2020-02-04 04:56:36 +00:00
|
|
|
Indent();
|
|
|
|
info += separatorName;
|
|
|
|
Return();
|
2019-01-08 18:05:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Indent() { info += indentation; }
|
|
|
|
void Return() { info += '\n'; }
|
|
|
|
|
|
|
|
unsigned level{};
|
|
|
|
wxString indentation;
|
|
|
|
wxString info;
|
2020-01-26 21:10:26 +00:00
|
|
|
} visitor{ project };
|
2019-01-08 18:05:55 +00:00
|
|
|
|
2020-01-26 21:10:26 +00:00
|
|
|
MenuManager::Visit( visitor );
|
2019-01-08 18:05:55 +00:00
|
|
|
|
|
|
|
ShowDiagnostics( project, visitor.info,
|
|
|
|
XO("Menu Tree"), wxT("menutree.txt"), true );
|
|
|
|
}
|
|
|
|
|
2018-10-23 21:47:23 +00:00
|
|
|
void OnCheckForUpdates(const CommandContext &WXUNUSED(context))
|
|
|
|
{
|
|
|
|
::OpenInDefaultBrowser( VerCheckUrl());
|
|
|
|
}
|
|
|
|
|
|
|
|
void OnAbout(const CommandContext &context)
|
|
|
|
{
|
|
|
|
#ifdef __WXMAC__
|
|
|
|
// Modeless dialog, consistent with other Mac applications
|
2019-04-26 04:59:16 +00:00
|
|
|
// Simulate the application Exit menu item
|
|
|
|
wxCommandEvent evt{ wxEVT_MENU, wxID_ABOUT };
|
|
|
|
wxTheApp->AddPendingEvent( evt );
|
2018-10-23 21:47:23 +00:00
|
|
|
#else
|
|
|
|
auto &project = context.project;
|
2019-05-28 17:12:56 +00:00
|
|
|
auto &window = GetProjectFrame( project );
|
2018-10-23 21:47:23 +00:00
|
|
|
|
|
|
|
// Windows and Linux still modal.
|
2019-05-28 17:12:56 +00:00
|
|
|
AboutDialog dlog( &window );
|
2018-10-23 21:47:23 +00:00
|
|
|
dlog.ShowModal();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
// Legacy handlers, not used as of version 2.3.0
|
|
|
|
|
|
|
|
// Only does the update checks if it's an ALPHA build and not disabled by
|
|
|
|
// preferences.
|
|
|
|
void MayCheckForUpdates(AudacityProject &project)
|
|
|
|
{
|
|
|
|
#ifdef IS_ALPHA
|
|
|
|
OnCheckForUpdates(project);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void OnHelpWelcome(const CommandContext &context)
|
|
|
|
{
|
2019-06-13 03:51:23 +00:00
|
|
|
SplashDialog::DoHelpWelcome( context.project );
|
2018-10-23 21:47:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}; // struct Handler
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
static CommandHandlerObject &findCommandHandler(AudacityProject &) {
|
|
|
|
// Handler is not stateful. Doesn't need a factory registered with
|
|
|
|
// AudacityProject.
|
|
|
|
static HelpActions::Handler instance;
|
|
|
|
return instance;
|
|
|
|
};
|
|
|
|
|
|
|
|
// Menu definitions
|
|
|
|
|
2019-01-06 16:31:52 +00:00
|
|
|
#define FN(X) (& HelpActions::Handler :: X)
|
2018-10-23 21:47:23 +00:00
|
|
|
|
2020-02-01 04:44:00 +00:00
|
|
|
namespace {
|
|
|
|
using namespace MenuTable;
|
|
|
|
BaseItemSharedPtr HelpMenu()
|
2018-10-23 21:47:23 +00:00
|
|
|
{
|
2019-01-09 16:27:32 +00:00
|
|
|
static BaseItemSharedPtr menu{
|
2020-01-29 18:37:02 +00:00
|
|
|
( FinderScope{ findCommandHandler },
|
2020-05-11 15:28:14 +00:00
|
|
|
Menu( wxT("Help"), XXO("&Help"),
|
2020-01-31 17:06:01 +00:00
|
|
|
Section( "Basic",
|
2020-01-30 16:01:07 +00:00
|
|
|
// QuickFix menu item not in Audacity 2.3.1 whilst we discuss further.
|
|
|
|
#ifdef EXPERIMENTAL_DA
|
|
|
|
// DA: Has QuickFix menu item.
|
|
|
|
Command( wxT("QuickFix"), XXO("&Quick Fix..."), FN(OnQuickFix),
|
|
|
|
AlwaysEnabledFlag ),
|
|
|
|
// DA: 'Getting Started' rather than 'Quick Help'.
|
2020-03-10 19:55:02 +00:00
|
|
|
Command( wxT("QuickHelp"), XXO("&Getting Started"), FN(OnQuickHelp),
|
|
|
|
AlwaysEnabledFlag ),
|
2020-01-30 16:01:07 +00:00
|
|
|
// DA: Emphasise it is the Audacity Manual (No separate DA manual).
|
2020-03-10 19:55:02 +00:00
|
|
|
Command( wxT("Manual"), XXO("Audacity &Manual"), FN(OnManual),
|
2020-06-02 17:01:18 +00:00
|
|
|
AlwaysEnabledFlag )
|
2020-03-10 19:55:02 +00:00
|
|
|
|
2020-01-30 16:01:07 +00:00
|
|
|
#else
|
|
|
|
Command( wxT("QuickHelp"), XXO("&Quick Help..."), FN(OnQuickHelp),
|
2018-10-23 21:47:23 +00:00
|
|
|
AlwaysEnabledFlag ),
|
2020-01-30 16:01:07 +00:00
|
|
|
Command( wxT("Manual"), XXO("&Manual..."), FN(OnManual),
|
2020-06-02 17:01:18 +00:00
|
|
|
AlwaysEnabledFlag )
|
2018-10-23 21:47:23 +00:00
|
|
|
#endif
|
2020-01-30 16:01:07 +00:00
|
|
|
),
|
2019-01-08 18:05:55 +00:00
|
|
|
|
2020-01-30 16:01:07 +00:00
|
|
|
#ifdef __WXMAC__
|
|
|
|
Items
|
|
|
|
#else
|
|
|
|
Section
|
|
|
|
#endif
|
2020-01-31 17:06:01 +00:00
|
|
|
( "Other",
|
2020-05-11 15:28:14 +00:00
|
|
|
Menu( wxT("Diagnostics"), XXO("&Diagnostics"),
|
2020-01-30 16:01:07 +00:00
|
|
|
Command( wxT("DeviceInfo"), XXO("Au&dio Device Info..."),
|
|
|
|
FN(OnAudioDeviceInfo),
|
|
|
|
AudioIONotBusyFlag() ),
|
|
|
|
#ifdef EXPERIMENTAL_MIDI_OUT
|
|
|
|
Command( wxT("MidiDeviceInfo"), XXO("&MIDI Device Info..."),
|
|
|
|
FN(OnMidiDeviceInfo),
|
|
|
|
AudioIONotBusyFlag() ),
|
|
|
|
#endif
|
|
|
|
Command( wxT("Log"), XXO("Show &Log..."), FN(OnShowLog),
|
|
|
|
AlwaysEnabledFlag ),
|
|
|
|
#if defined(EXPERIMENTAL_CRASH_REPORT)
|
|
|
|
Command( wxT("CrashReport"), XXO("&Generate Support Data..."),
|
2020-07-01 05:45:17 +00:00
|
|
|
FN(OnCrashReport), AlwaysEnabledFlag )
|
2020-01-30 16:01:07 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef IS_ALPHA
|
|
|
|
,
|
|
|
|
// Menu explorer. Perhaps this should become a macro command
|
|
|
|
Command( wxT("MenuTree"), XXO("Menu Tree..."),
|
|
|
|
FN(OnMenuTree),
|
|
|
|
AlwaysEnabledFlag )
|
|
|
|
#endif
|
|
|
|
)
|
|
|
|
#ifndef __WXMAC__
|
|
|
|
),
|
2020-01-29 21:43:53 +00:00
|
|
|
|
2020-01-30 16:01:07 +00:00
|
|
|
Section( "",
|
2020-01-29 21:43:53 +00:00
|
|
|
#else
|
2020-01-30 16:01:07 +00:00
|
|
|
,
|
2018-10-23 21:47:23 +00:00
|
|
|
#endif
|
|
|
|
|
2020-01-30 16:01:07 +00:00
|
|
|
// DA: Does not fully support update checking.
|
|
|
|
#ifndef EXPERIMENTAL_DA
|
|
|
|
Command( wxT("Updates"), XXO("&Check for Updates..."),
|
|
|
|
FN(OnCheckForUpdates),
|
|
|
|
AlwaysEnabledFlag ),
|
|
|
|
#endif
|
|
|
|
Command( wxT("About"), XXO("&About Audacity..."), FN(OnAbout),
|
|
|
|
AlwaysEnabledFlag )
|
|
|
|
)
|
2019-01-09 16:27:32 +00:00
|
|
|
) ) };
|
|
|
|
return menu;
|
2018-10-23 21:47:23 +00:00
|
|
|
}
|
|
|
|
|
2020-02-01 04:44:00 +00:00
|
|
|
AttachedItem sAttachment1{
|
|
|
|
wxT(""),
|
|
|
|
Shared( HelpMenu() )
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2018-10-23 21:47:23 +00:00
|
|
|
#undef FN
|