mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-02 17:09:26 +02:00
Uniformity of signatures of all command handler functions
This commit is contained in:
commit
9a58ead5c8
@ -1570,7 +1570,7 @@ bool AudacityApp::OnInit()
|
|||||||
// Mainly this is to tell users of ALPHAS who don't know that they have an ALPHA.
|
// Mainly this is to tell users of ALPHAS who don't know that they have an ALPHA.
|
||||||
// Disabled for now, after discussion.
|
// Disabled for now, after discussion.
|
||||||
// project->MayCheckForUpdates();
|
// project->MayCheckForUpdates();
|
||||||
project->OnHelpWelcome();
|
project->OnHelpWelcome(*project);
|
||||||
}
|
}
|
||||||
|
|
||||||
// JKC 10-Sep-2007: Enable monitoring from the start.
|
// JKC 10-Sep-2007: Enable monitoring from the start.
|
||||||
@ -1663,7 +1663,7 @@ void AudacityApp::OnKeyDown(wxKeyEvent &event)
|
|||||||
gAudioIO->GetNumCaptureChannels() == 0) ||
|
gAudioIO->GetNumCaptureChannels() == 0) ||
|
||||||
scrubbing)
|
scrubbing)
|
||||||
// ESC out of other play (but not record)
|
// ESC out of other play (but not record)
|
||||||
project->OnStop();
|
project->OnStop(*project);
|
||||||
else
|
else
|
||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
@ -611,7 +611,7 @@ bool BatchCommands::ApplyEffectCommand(const PluginID & ID, const wxString & com
|
|||||||
if (EffectManager::Get().SetEffectParameters(ID, params))
|
if (EffectManager::Get().SetEffectParameters(ID, params))
|
||||||
{
|
{
|
||||||
// and apply the effect...
|
// and apply the effect...
|
||||||
res = project->OnEffect(ID, AudacityProject::OnEffectFlags::kConfigured |
|
res = project->DoEffect(ID, AudacityProject::OnEffectFlags::kConfigured |
|
||||||
AudacityProject::OnEffectFlags::kSkipState |
|
AudacityProject::OnEffectFlags::kSkipState |
|
||||||
AudacityProject::OnEffectFlags::kDontRepeatLast);
|
AudacityProject::OnEffectFlags::kDontRepeatLast);
|
||||||
}
|
}
|
||||||
|
@ -362,7 +362,7 @@ void BatchProcessDialog::OnApplyToFiles(wxCommandEvent & WXUNUSED(event))
|
|||||||
auto success = GuardedCall< bool >( [&] {
|
auto success = GuardedCall< bool >( [&] {
|
||||||
project->Import(files[i]);
|
project->Import(files[i]);
|
||||||
project->ZoomAfterImport(nullptr);
|
project->ZoomAfterImport(nullptr);
|
||||||
project->OnSelectAll();
|
project->OnSelectAll(*project);
|
||||||
if (!mBatchCommands.ApplyChain())
|
if (!mBatchCommands.ApplyChain())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -377,10 +377,10 @@ void BatchProcessDialog::OnApplyToFiles(wxCommandEvent & WXUNUSED(event))
|
|||||||
|
|
||||||
UndoManager *um = project->GetUndoManager();
|
UndoManager *um = project->GetUndoManager();
|
||||||
um->ClearStates();
|
um->ClearStates();
|
||||||
project->OnSelectAll();
|
project->OnSelectAll(*project);
|
||||||
project->OnRemoveTracks();
|
project->OnRemoveTracks(*project);
|
||||||
}
|
}
|
||||||
project->OnRemoveTracks();
|
project->OnRemoveTracks(*project);
|
||||||
|
|
||||||
// Under Linux an EndModal() here crashes (Bug #1221).
|
// Under Linux an EndModal() here crashes (Bug #1221).
|
||||||
// But sending a close message instead is OK.
|
// But sending a close message instead is OK.
|
||||||
|
562
src/Menus.cpp
562
src/Menus.cpp
File diff suppressed because it is too large
Load Diff
523
src/Menus.h
523
src/Menus.h
@ -53,115 +53,115 @@ double NearestZeroCrossing(double t0);
|
|||||||
// Selecting a tool from the keyboard
|
// Selecting a tool from the keyboard
|
||||||
|
|
||||||
void SetTool(int tool);
|
void SetTool(int tool);
|
||||||
void OnSelectTool();
|
void OnSelectTool(const CommandContext &);
|
||||||
void OnZoomTool();
|
void OnZoomTool(const CommandContext &);
|
||||||
void OnEnvelopeTool();
|
void OnEnvelopeTool(const CommandContext &);
|
||||||
void OnTimeShiftTool();
|
void OnTimeShiftTool(const CommandContext &);
|
||||||
void OnDrawTool();
|
void OnDrawTool(const CommandContext &);
|
||||||
void OnMultiTool();
|
void OnMultiTool(const CommandContext &);
|
||||||
|
|
||||||
void OnNextTool();
|
void OnNextTool(const CommandContext &);
|
||||||
void OnPrevTool();
|
void OnPrevTool(const CommandContext &);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Audio I/O Commands
|
// Audio I/O Commands
|
||||||
|
|
||||||
void OnStop();
|
void OnStop(const CommandContext &);
|
||||||
void OnPause();
|
void OnPause(const CommandContext &);
|
||||||
void OnRecord();
|
void OnRecord(const CommandContext &);
|
||||||
void OnRecord2ndChoice();
|
void OnRecord2ndChoice(const CommandContext &);
|
||||||
void OnStopSelect();
|
void OnStopSelect(const CommandContext &);
|
||||||
void OnSkipStart();
|
void OnSkipStart(const CommandContext &);
|
||||||
void OnSkipEnd();
|
void OnSkipEnd(const CommandContext &);
|
||||||
void OnSeekLeftShort();
|
void OnSeekLeftShort(const CommandContext &);
|
||||||
void OnSeekRightShort();
|
void OnSeekRightShort(const CommandContext &);
|
||||||
void OnSeekLeftLong();
|
void OnSeekLeftLong(const CommandContext &);
|
||||||
void OnSeekRightLong();
|
void OnSeekRightLong(const CommandContext &);
|
||||||
|
|
||||||
// Different posibilities for playing sound
|
// Different posibilities for playing sound
|
||||||
|
|
||||||
bool MakeReadyToPlay(bool loop = false, bool cutpreview = false); // Helper function that sets button states etc.
|
bool MakeReadyToPlay(bool loop = false, bool cutpreview = false); // Helper function that sets button states etc.
|
||||||
void OnPlayStop();
|
void OnPlayStop(const CommandContext &);
|
||||||
bool DoPlayStopSelect(bool click, bool shift);
|
bool DoPlayStopSelect(bool click, bool shift);
|
||||||
void OnPlayStopSelect();
|
void OnPlayStopSelect(const CommandContext &);
|
||||||
void OnPlayOneSecond();
|
void OnPlayOneSecond(const CommandContext &);
|
||||||
void OnPlayToSelection();
|
void OnPlayToSelection(const CommandContext &);
|
||||||
void OnPlayBeforeSelectionStart();
|
void OnPlayBeforeSelectionStart(const CommandContext &);
|
||||||
void OnPlayAfterSelectionStart();
|
void OnPlayAfterSelectionStart(const CommandContext &);
|
||||||
void OnPlayBeforeSelectionEnd();
|
void OnPlayBeforeSelectionEnd(const CommandContext &);
|
||||||
void OnPlayAfterSelectionEnd();
|
void OnPlayAfterSelectionEnd(const CommandContext &);
|
||||||
void OnPlayBeforeAndAfterSelectionStart();
|
void OnPlayBeforeAndAfterSelectionStart(const CommandContext &);
|
||||||
void OnPlayBeforeAndAfterSelectionEnd();
|
void OnPlayBeforeAndAfterSelectionEnd(const CommandContext &);
|
||||||
void OnPlayLooped();
|
void OnPlayLooped(const CommandContext &);
|
||||||
void OnPlayCutPreview();
|
void OnPlayCutPreview(const CommandContext &);
|
||||||
|
|
||||||
// Wave track control
|
// Wave track control
|
||||||
|
|
||||||
void OnTrackPan();
|
void OnTrackPan(const CommandContext &);
|
||||||
void OnTrackPanLeft();
|
void OnTrackPanLeft(const CommandContext &);
|
||||||
void OnTrackPanRight();
|
void OnTrackPanRight(const CommandContext &);
|
||||||
void OnTrackGain();
|
void OnTrackGain(const CommandContext &);
|
||||||
void OnTrackGainInc();
|
void OnTrackGainInc(const CommandContext &);
|
||||||
void OnTrackGainDec();
|
void OnTrackGainDec(const CommandContext &);
|
||||||
void OnTrackMenu();
|
void OnTrackMenu(const CommandContext &);
|
||||||
void OnTrackMute();
|
void OnTrackMute(const CommandContext &);
|
||||||
void OnTrackSolo();
|
void OnTrackSolo(const CommandContext &);
|
||||||
void OnTrackClose();
|
void OnTrackClose(const CommandContext &);
|
||||||
void OnTrackMoveUp();
|
void OnTrackMoveUp(const CommandContext &);
|
||||||
void OnTrackMoveDown();
|
void OnTrackMoveDown(const CommandContext &);
|
||||||
void OnTrackMoveTop();
|
void OnTrackMoveTop(const CommandContext &);
|
||||||
void OnTrackMoveBottom();
|
void OnTrackMoveBottom(const CommandContext &);
|
||||||
|
|
||||||
enum MoveChoice { OnMoveUpID, OnMoveDownID, OnMoveTopID, OnMoveBottomID };
|
enum MoveChoice { OnMoveUpID, OnMoveDownID, OnMoveTopID, OnMoveBottomID };
|
||||||
void MoveTrack(Track* target, MoveChoice choice);
|
void MoveTrack(Track* target, MoveChoice choice);
|
||||||
|
|
||||||
// Device control
|
// Device control
|
||||||
void OnInputDevice();
|
void OnInputDevice(const CommandContext &);
|
||||||
void OnOutputDevice();
|
void OnOutputDevice(const CommandContext &);
|
||||||
void OnAudioHost();
|
void OnAudioHost(const CommandContext &);
|
||||||
void OnInputChannels();
|
void OnInputChannels(const CommandContext &);
|
||||||
|
|
||||||
// Mixer control
|
// Mixer control
|
||||||
|
|
||||||
void OnOutputGain();
|
void OnOutputGain(const CommandContext &);
|
||||||
void OnInputGain();
|
void OnInputGain(const CommandContext &);
|
||||||
void OnOutputGainInc();
|
void OnOutputGainInc(const CommandContext &);
|
||||||
void OnOutputGainDec();
|
void OnOutputGainDec(const CommandContext &);
|
||||||
void OnInputGainInc();
|
void OnInputGainInc(const CommandContext &);
|
||||||
void OnInputGainDec();
|
void OnInputGainDec(const CommandContext &);
|
||||||
|
|
||||||
// Transcription control
|
// Transcription control
|
||||||
|
|
||||||
void OnPlayAtSpeed();
|
void OnPlayAtSpeed(const CommandContext &);
|
||||||
void OnPlayAtSpeedLooped();
|
void OnPlayAtSpeedLooped(const CommandContext &);
|
||||||
void OnPlayAtSpeedCutPreview();
|
void OnPlayAtSpeedCutPreview(const CommandContext &);
|
||||||
void OnSetPlaySpeed();
|
void OnSetPlaySpeed(const CommandContext &);
|
||||||
void OnPlaySpeedInc();
|
void OnPlaySpeedInc(const CommandContext &);
|
||||||
void OnPlaySpeedDec();
|
void OnPlaySpeedDec(const CommandContext &);
|
||||||
|
|
||||||
// Moving track focus commands
|
// Moving track focus commands
|
||||||
|
|
||||||
void OnPrevTrack( bool shift );
|
void OnPrevTrack( bool shift );
|
||||||
void OnNextTrack( bool shift );
|
void OnNextTrack( bool shift );
|
||||||
void OnCursorUp();
|
void OnCursorUp(const CommandContext &);
|
||||||
void OnCursorDown();
|
void OnCursorDown(const CommandContext &);
|
||||||
void OnFirstTrack();
|
void OnFirstTrack(const CommandContext &);
|
||||||
void OnLastTrack();
|
void OnLastTrack(const CommandContext &);
|
||||||
|
|
||||||
// Selection-Editing Commands
|
// Selection-Editing Commands
|
||||||
|
|
||||||
void OnShiftUp();
|
void OnShiftUp(const CommandContext &);
|
||||||
void OnShiftDown();
|
void OnShiftDown(const CommandContext &);
|
||||||
void OnToggle();
|
void OnToggle(const CommandContext &);
|
||||||
|
|
||||||
void HandleListSelection(Track *t, bool shift, bool ctrl, bool modifyState);
|
void HandleListSelection(Track *t, bool shift, bool ctrl, bool modifyState);
|
||||||
|
|
||||||
void OnCursorLeft(const wxEvent * evt);
|
void OnCursorLeft(const CommandContext &);
|
||||||
void OnCursorRight(const wxEvent * evt);
|
void OnCursorRight(const CommandContext &);
|
||||||
void OnSelExtendLeft(const wxEvent * evt);
|
void OnSelExtendLeft(const CommandContext &);
|
||||||
void OnSelExtendRight(const wxEvent * evt);
|
void OnSelExtendRight(const CommandContext &);
|
||||||
void OnSelContractLeft(const wxEvent * evt);
|
void OnSelContractLeft(const CommandContext &);
|
||||||
void OnSelContractRight(const wxEvent * evt);
|
void OnSelContractRight(const CommandContext &);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static double OnClipMove
|
static double OnClipMove
|
||||||
@ -169,127 +169,127 @@ static double OnClipMove
|
|||||||
TrackList &trackList, bool syncLocked, bool right);
|
TrackList &trackList, bool syncLocked, bool right);
|
||||||
|
|
||||||
void DoClipLeftOrRight(bool right, bool keyUp );
|
void DoClipLeftOrRight(bool right, bool keyUp );
|
||||||
void OnClipLeft(const wxEvent* evt);
|
void OnClipLeft(const CommandContext &);
|
||||||
void OnClipRight(const wxEvent* evt);
|
void OnClipRight(const CommandContext &);
|
||||||
|
|
||||||
void OnCursorShortJumpLeft();
|
void OnCursorShortJumpLeft(const CommandContext &);
|
||||||
void OnCursorShortJumpRight();
|
void OnCursorShortJumpRight(const CommandContext &);
|
||||||
void OnCursorLongJumpLeft();
|
void OnCursorLongJumpLeft(const CommandContext &);
|
||||||
void OnCursorLongJumpRight();
|
void OnCursorLongJumpRight(const CommandContext &);
|
||||||
void OnSelSetExtendLeft();
|
void OnSelSetExtendLeft(const CommandContext &);
|
||||||
void OnSelSetExtendRight();
|
void OnSelSetExtendRight(const CommandContext &);
|
||||||
|
|
||||||
void OnSetLeftSelection();
|
void OnSetLeftSelection(const CommandContext &);
|
||||||
void OnSetRightSelection();
|
void OnSetRightSelection(const CommandContext &);
|
||||||
|
|
||||||
void OnSelToStart();
|
void OnSelToStart(const CommandContext &);
|
||||||
void OnSelToEnd();
|
void OnSelToEnd(const CommandContext &);
|
||||||
|
|
||||||
void OnMoveToNextLabel();
|
void OnMoveToNextLabel(const CommandContext &);
|
||||||
void OnMoveToPrevLabel();
|
void OnMoveToPrevLabel(const CommandContext &);
|
||||||
void OnMoveToLabel(bool next);
|
void OnMoveToLabel(bool next);
|
||||||
|
|
||||||
void OnZeroCrossing();
|
void OnZeroCrossing(const CommandContext &);
|
||||||
|
|
||||||
void OnLockPlayRegion();
|
void OnLockPlayRegion(const CommandContext &);
|
||||||
void OnUnlockPlayRegion();
|
void OnUnlockPlayRegion(const CommandContext &);
|
||||||
|
|
||||||
double GetTime(const Track *t);
|
double GetTime(const Track *t);
|
||||||
void OnSortTime();
|
void OnSortTime(const CommandContext &);
|
||||||
void OnSortName();
|
void OnSortName(const CommandContext &);
|
||||||
|
|
||||||
void OnSnapToOff();
|
void OnSnapToOff(const CommandContext &);
|
||||||
void OnSnapToNearest();
|
void OnSnapToNearest(const CommandContext &);
|
||||||
void OnSnapToPrior();
|
void OnSnapToPrior(const CommandContext &);
|
||||||
void OnFullScreen();
|
void OnFullScreen(const CommandContext &);
|
||||||
|
|
||||||
static void DoMacMinimize(AudacityProject *project);
|
static void DoMacMinimize(AudacityProject *project);
|
||||||
void OnMacMinimize();
|
void OnMacMinimize(const CommandContext &);
|
||||||
void OnMacMinimizeAll();
|
void OnMacMinimizeAll(const CommandContext &);
|
||||||
void OnMacZoom();
|
void OnMacZoom(const CommandContext &);
|
||||||
void OnMacBringAllToFront();
|
void OnMacBringAllToFront(const CommandContext &);
|
||||||
|
|
||||||
// File Menu
|
// File Menu
|
||||||
|
|
||||||
void OnNew();
|
void OnNew(const CommandContext &);
|
||||||
void OnOpen();
|
void OnOpen(const CommandContext &);
|
||||||
void OnClose();
|
void OnClose(const CommandContext &);
|
||||||
void OnSave();
|
void OnSave(const CommandContext &);
|
||||||
void OnSaveAs();
|
void OnSaveAs(const CommandContext &);
|
||||||
#ifdef USE_LIBVORBIS
|
#ifdef USE_LIBVORBIS
|
||||||
void OnSaveCompressed();
|
void OnSaveCompressed(const CommandContext &);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void OnCheckDependencies();
|
void OnCheckDependencies(const CommandContext &);
|
||||||
|
|
||||||
void OnExport(const wxString & Format);
|
void OnExport(const wxString & Format);
|
||||||
void OnExportAudio();
|
void OnExportAudio(const CommandContext &);
|
||||||
void OnExportMp3();
|
void OnExportMp3(const CommandContext &);
|
||||||
void OnExportWav();
|
void OnExportWav(const CommandContext &);
|
||||||
void OnExportOgg();
|
void OnExportOgg(const CommandContext &);
|
||||||
void OnExportSelection();
|
void OnExportSelection(const CommandContext &);
|
||||||
void OnExportMultiple();
|
void OnExportMultiple(const CommandContext &);
|
||||||
void OnExportLabels();
|
void OnExportLabels(const CommandContext &);
|
||||||
void OnExportMIDI();
|
void OnExportMIDI(const CommandContext &);
|
||||||
|
|
||||||
void OnPreferences();
|
void OnPreferences(const CommandContext &);
|
||||||
|
|
||||||
void OnPageSetup();
|
void OnPageSetup(const CommandContext &);
|
||||||
void OnPrint();
|
void OnPrint(const CommandContext &);
|
||||||
|
|
||||||
void OnExit();
|
void OnExit(const CommandContext &);
|
||||||
|
|
||||||
// Edit Menu
|
// Edit Menu
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void OnUndo();
|
void OnUndo(const CommandContext &);
|
||||||
void OnRedo();
|
void OnRedo(const CommandContext &);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void FinishCopy(const Track *n, Track *dest);
|
static void FinishCopy(const Track *n, Track *dest);
|
||||||
static void FinishCopy(const Track *n, Track::Holder &&dest, TrackList &list);
|
static void FinishCopy(const Track *n, Track::Holder &&dest, TrackList &list);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void OnCut();
|
void OnCut(const CommandContext &);
|
||||||
void OnSplitCut();
|
void OnSplitCut(const CommandContext &);
|
||||||
void OnCopy();
|
void OnCopy(const CommandContext &);
|
||||||
|
|
||||||
void OnPaste();
|
void OnPaste(const CommandContext &);
|
||||||
private:
|
private:
|
||||||
bool HandlePasteText(); // Handle text paste (into active label), if any. Return true if pasted.
|
bool HandlePasteText(); // Handle text paste (into active label), if any. Return true if pasted.
|
||||||
bool HandlePasteNothingSelected(); // Return true if nothing selected, regardless of paste result.
|
bool HandlePasteNothingSelected(); // Return true if nothing selected, regardless of paste result.
|
||||||
public:
|
public:
|
||||||
|
|
||||||
void OnPasteNewLabel();
|
void OnPasteNewLabel(const CommandContext &);
|
||||||
void OnPasteOver();
|
void OnPasteOver(const CommandContext &);
|
||||||
void OnTrim();
|
void OnTrim(const CommandContext &);
|
||||||
|
|
||||||
void OnDelete();
|
void OnDelete(const CommandContext &);
|
||||||
void OnSplitDelete();
|
void OnSplitDelete(const CommandContext &);
|
||||||
void OnSilence();
|
void OnSilence(const CommandContext &);
|
||||||
|
|
||||||
void OnSplit();
|
void OnSplit(const CommandContext &);
|
||||||
void OnSplitNew();
|
void OnSplitNew(const CommandContext &);
|
||||||
void OnJoin();
|
void OnJoin(const CommandContext &);
|
||||||
void OnDisjoin();
|
void OnDisjoin(const CommandContext &);
|
||||||
void OnDuplicate();
|
void OnDuplicate(const CommandContext &);
|
||||||
|
|
||||||
void OnCutLabels();
|
void OnCutLabels(const CommandContext &);
|
||||||
void OnSplitCutLabels();
|
void OnSplitCutLabels(const CommandContext &);
|
||||||
void OnCopyLabels();
|
void OnCopyLabels(const CommandContext &);
|
||||||
void OnDeleteLabels();
|
void OnDeleteLabels(const CommandContext &);
|
||||||
void OnSplitDeleteLabels();
|
void OnSplitDeleteLabels(const CommandContext &);
|
||||||
void OnSilenceLabels();
|
void OnSilenceLabels(const CommandContext &);
|
||||||
void OnSplitLabels();
|
void OnSplitLabels(const CommandContext &);
|
||||||
void OnJoinLabels();
|
void OnJoinLabels(const CommandContext &);
|
||||||
void OnDisjoinLabels();
|
void OnDisjoinLabels(const CommandContext &);
|
||||||
|
|
||||||
void OnSelectTimeAndTracks(bool bAllTime, bool bAllTracks);
|
void OnSelectTimeAndTracks(bool bAllTime, bool bAllTracks);
|
||||||
void OnSelectAllTime();
|
void OnSelectAllTime(const CommandContext &);
|
||||||
void OnSelectAllTracks();
|
void OnSelectAllTracks(const CommandContext &);
|
||||||
void OnSelectAll();
|
void OnSelectAll(const CommandContext &);
|
||||||
void OnSelectSomething();
|
void OnSelectSomething(const CommandContext &);
|
||||||
void OnSelectNone();
|
void OnSelectNone(const CommandContext &);
|
||||||
private:
|
private:
|
||||||
int CountSelectedWaveTracks();
|
int CountSelectedWaveTracks();
|
||||||
int CountSelectedTracks();
|
int CountSelectedTracks();
|
||||||
@ -298,15 +298,15 @@ public:
|
|||||||
// For toggling of spectral seletion
|
// For toggling of spectral seletion
|
||||||
double mLastF0;
|
double mLastF0;
|
||||||
double mLastF1;
|
double mLastF1;
|
||||||
void OnToggleSpectralSelection();
|
void OnToggleSpectralSelection(const CommandContext &);
|
||||||
void DoNextPeakFrequency(bool up);
|
void DoNextPeakFrequency(bool up);
|
||||||
void OnNextHigherPeakFrequency();
|
void OnNextHigherPeakFrequency(const CommandContext &);
|
||||||
void OnNextLowerPeakFrequency();
|
void OnNextLowerPeakFrequency(const CommandContext &);
|
||||||
#endif
|
#endif
|
||||||
void OnSelectCursorEnd();
|
void OnSelectCursorEnd(const CommandContext &);
|
||||||
void OnSelectStartCursor();
|
void OnSelectStartCursor(const CommandContext &);
|
||||||
void OnSelectPrevClipBoundaryToCursor();
|
void OnSelectPrevClipBoundaryToCursor(const CommandContext &);
|
||||||
void OnSelectCursorToNextClipBoundary();
|
void OnSelectCursorToNextClipBoundary(const CommandContext &);
|
||||||
void OnSelectClipBoundary(bool next);
|
void OnSelectClipBoundary(bool next);
|
||||||
struct FoundTrack {
|
struct FoundTrack {
|
||||||
const WaveTrack* waveTrack;
|
const WaveTrack* waveTrack;
|
||||||
@ -325,92 +325,92 @@ FoundClip FindNextClip(const WaveTrack* wt, double t0, double t1);
|
|||||||
FoundClip FindPrevClip(const WaveTrack* wt, double t0, double t1);
|
FoundClip FindPrevClip(const WaveTrack* wt, double t0, double t1);
|
||||||
int FindClips(double t0, double t1, bool next, std::vector<FoundClip>& results);
|
int FindClips(double t0, double t1, bool next, std::vector<FoundClip>& results);
|
||||||
bool ChannelsHaveSameClipBoundaries(const WaveTrack* wt);
|
bool ChannelsHaveSameClipBoundaries(const WaveTrack* wt);
|
||||||
void OnSelectPrevClip();
|
void OnSelectPrevClip(const CommandContext &);
|
||||||
void OnSelectNextClip();
|
void OnSelectNextClip(const CommandContext &);
|
||||||
void OnSelectClip(bool next);
|
void OnSelectClip(bool next);
|
||||||
void OnSelectCursorStoredCursor();
|
void OnSelectCursorStoredCursor(const CommandContext &);
|
||||||
void OnSelectSyncLockSel();
|
void OnSelectSyncLockSel(const CommandContext &);
|
||||||
|
|
||||||
// View Menu
|
// View Menu
|
||||||
|
|
||||||
void OnZoomIn();
|
void OnZoomIn(const CommandContext &);
|
||||||
void OnZoomOut();
|
void OnZoomOut(const CommandContext &);
|
||||||
// void OnZoomToggle();
|
// void OnZoomToggle(const CommandContext &);
|
||||||
void OnZoomNormal();
|
void OnZoomNormal(const CommandContext &);
|
||||||
void OnZoomFit();
|
void OnZoomFit(const CommandContext &);
|
||||||
void OnZoomFitV();
|
void OnZoomFitV(const CommandContext &);
|
||||||
void DoZoomFitV();
|
void DoZoomFitV();
|
||||||
void OnZoomSel();
|
void OnZoomSel(const CommandContext &);
|
||||||
void OnGoSelStart();
|
void OnGoSelStart(const CommandContext &);
|
||||||
void OnGoSelEnd();
|
void OnGoSelEnd(const CommandContext &);
|
||||||
|
|
||||||
void OnExpandAllTracks();
|
void OnExpandAllTracks(const CommandContext &);
|
||||||
void OnCollapseAllTracks();
|
void OnCollapseAllTracks(const CommandContext &);
|
||||||
|
|
||||||
void OnPanTracks(float PanValue);
|
void OnPanTracks(float PanValue);
|
||||||
void OnPanLeft();
|
void OnPanLeft(const CommandContext &);
|
||||||
void OnPanRight();
|
void OnPanRight(const CommandContext &);
|
||||||
void OnPanCenter();
|
void OnPanCenter(const CommandContext &);
|
||||||
|
|
||||||
void OnMuteAllTracks();
|
void OnMuteAllTracks(const CommandContext &);
|
||||||
void OnUnMuteAllTracks();
|
void OnUnMuteAllTracks(const CommandContext &);
|
||||||
|
|
||||||
void OnShowClipping();
|
void OnShowClipping(const CommandContext &);
|
||||||
void OnShowExtraMenus();
|
void OnShowExtraMenus(const CommandContext &);
|
||||||
|
|
||||||
void OnHistory();
|
void OnHistory(const CommandContext &);
|
||||||
|
|
||||||
void OnKaraoke();
|
void OnKaraoke(const CommandContext &);
|
||||||
void OnMixerBoard();
|
void OnMixerBoard(const CommandContext &);
|
||||||
|
|
||||||
void OnPlotSpectrum();
|
void OnPlotSpectrum(const CommandContext &);
|
||||||
void OnContrast();
|
void OnContrast(const CommandContext &);
|
||||||
|
|
||||||
void OnShowTransportToolBar();
|
void OnShowTransportToolBar(const CommandContext &);
|
||||||
void OnShowDeviceToolBar();
|
void OnShowDeviceToolBar(const CommandContext &);
|
||||||
void OnShowEditToolBar();
|
void OnShowEditToolBar(const CommandContext &);
|
||||||
void OnShowMeterToolBar();
|
void OnShowMeterToolBar(const CommandContext &);
|
||||||
void OnShowRecordMeterToolBar();
|
void OnShowRecordMeterToolBar(const CommandContext &);
|
||||||
void OnShowPlayMeterToolBar();
|
void OnShowPlayMeterToolBar(const CommandContext &);
|
||||||
void OnShowMixerToolBar();
|
void OnShowMixerToolBar(const CommandContext &);
|
||||||
void OnShowSelectionToolBar();
|
void OnShowSelectionToolBar(const CommandContext &);
|
||||||
#ifdef EXPERIMENTAL_SPECTRAL_EDITING
|
#ifdef EXPERIMENTAL_SPECTRAL_EDITING
|
||||||
void OnShowSpectralSelectionToolBar();
|
void OnShowSpectralSelectionToolBar(const CommandContext &);
|
||||||
#endif
|
#endif
|
||||||
void OnShowScrubbingToolBar();
|
void OnShowScrubbingToolBar(const CommandContext &);
|
||||||
void OnShowToolsToolBar();
|
void OnShowToolsToolBar(const CommandContext &);
|
||||||
void OnShowTranscriptionToolBar();
|
void OnShowTranscriptionToolBar(const CommandContext &);
|
||||||
void OnResetToolBars();
|
void OnResetToolBars(const CommandContext &);
|
||||||
|
|
||||||
// Transport Menu
|
// Transport Menu
|
||||||
|
|
||||||
void OnSoundActivated();
|
void OnSoundActivated(const CommandContext &);
|
||||||
void OnToggleSoundActivated();
|
void OnToggleSoundActivated(const CommandContext &);
|
||||||
void OnTogglePinnedHead();
|
void OnTogglePinnedHead(const CommandContext &);
|
||||||
void OnTogglePlayRecording();
|
void OnTogglePlayRecording(const CommandContext &);
|
||||||
void OnToggleSWPlaythrough();
|
void OnToggleSWPlaythrough(const CommandContext &);
|
||||||
#ifdef EXPERIMENTAL_AUTOMATED_INPUT_LEVEL_ADJUSTMENT
|
#ifdef EXPERIMENTAL_AUTOMATED_INPUT_LEVEL_ADJUSTMENT
|
||||||
void OnToggleAutomatedInputLevelAdjustment();
|
void OnToggleAutomatedInputLevelAdjustment(const CommandContext &);
|
||||||
#endif
|
#endif
|
||||||
void OnRescanDevices();
|
void OnRescanDevices(const CommandContext &);
|
||||||
|
|
||||||
// Import Submenu
|
// Import Submenu
|
||||||
void OnImport();
|
void OnImport(const CommandContext &);
|
||||||
void OnImportLabels();
|
void OnImportLabels(const CommandContext &);
|
||||||
void OnImportMIDI();
|
void OnImportMIDI(const CommandContext &);
|
||||||
|
|
||||||
// return null on failure; if success, return the given project, or a NEW
|
// return null on failure; if success, return the given project, or a NEW
|
||||||
// one, if the given was null; create no NEW project if failure
|
// one, if the given was null; create no NEW project if failure
|
||||||
static AudacityProject *DoImportMIDI(
|
static AudacityProject *DoImportMIDI(
|
||||||
AudacityProject *pProject, const wxString &fileName);
|
AudacityProject *pProject, const wxString &fileName);
|
||||||
|
|
||||||
void OnImportRaw();
|
void OnImportRaw(const CommandContext &);
|
||||||
|
|
||||||
void OnEditMetadata();
|
void OnEditMetadata(const CommandContext &);
|
||||||
bool DoEditMetadata(const wxString &title, const wxString &shortUndoDescription, bool force);
|
bool DoEditMetadata(const wxString &title, const wxString &shortUndoDescription, bool force);
|
||||||
|
|
||||||
void OnMixAndRender();
|
void OnMixAndRender(const CommandContext &);
|
||||||
void OnMixAndRenderToNewTrack();
|
void OnMixAndRenderToNewTrack(const CommandContext &);
|
||||||
void HandleMixAndRender(bool toNewTrack);
|
void HandleMixAndRender(bool toNewTrack);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -418,14 +418,14 @@ private:
|
|||||||
bool mCursorPositionHasBeenStored{false};
|
bool mCursorPositionHasBeenStored{false};
|
||||||
double mCursorPositionStored;
|
double mCursorPositionStored;
|
||||||
public:
|
public:
|
||||||
void OnSelectionSave();
|
void OnSelectionSave(const CommandContext &);
|
||||||
void OnSelectionRestore();
|
void OnSelectionRestore(const CommandContext &);
|
||||||
void OnCursorPositionStore();
|
void OnCursorPositionStore(const CommandContext &);
|
||||||
|
|
||||||
void OnCursorTrackStart();
|
void OnCursorTrackStart(const CommandContext &);
|
||||||
void OnCursorTrackEnd();
|
void OnCursorTrackEnd(const CommandContext &);
|
||||||
void OnCursorSelStart();
|
void OnCursorSelStart(const CommandContext &);
|
||||||
void OnCursorSelEnd();
|
void OnCursorSelEnd(const CommandContext &);
|
||||||
struct FoundClipBoundary : FoundTrack {
|
struct FoundClipBoundary : FoundTrack {
|
||||||
int nFound; // 0, 1, or 2
|
int nFound; // 0, 1, or 2
|
||||||
double time;
|
double time;
|
||||||
@ -439,35 +439,35 @@ FoundClipBoundary FindPrevClipBoundary(const WaveTrack* wt, double time);
|
|||||||
double AdjustForFindingStartTimes(const std::vector<const WaveClip*>& clips, double time);
|
double AdjustForFindingStartTimes(const std::vector<const WaveClip*>& clips, double time);
|
||||||
double AdjustForFindingEndTimes(const std::vector<const WaveClip*>& clips, double time);
|
double AdjustForFindingEndTimes(const std::vector<const WaveClip*>& clips, double time);
|
||||||
int FindClipBoundaries(double time, bool next, std::vector<FoundClipBoundary>& results);
|
int FindClipBoundaries(double time, bool next, std::vector<FoundClipBoundary>& results);
|
||||||
void OnCursorNextClipBoundary();
|
void OnCursorNextClipBoundary(const CommandContext &);
|
||||||
void OnCursorPrevClipBoundary();
|
void OnCursorPrevClipBoundary(const CommandContext &);
|
||||||
void OnCursorClipBoundary(bool next);
|
void OnCursorClipBoundary(bool next);
|
||||||
static wxString ClipBoundaryMessage(const std::vector<FoundClipBoundary>& results);
|
static wxString ClipBoundaryMessage(const std::vector<FoundClipBoundary>& results);
|
||||||
|
|
||||||
void OnAlignNoSync(int index);
|
void OnAlignNoSync(const CommandContext &);
|
||||||
void OnAlign(int index);
|
void OnAlign(const CommandContext &);
|
||||||
//void OnAlignMoveSel(int index);
|
//void OnAlignMoveSel(int index);
|
||||||
void HandleAlign(int index, bool moveSel);
|
void HandleAlign(int index, bool moveSel);
|
||||||
size_t mAlignLabelsCount;
|
size_t mAlignLabelsCount;
|
||||||
|
|
||||||
#ifdef EXPERIMENTAL_SCOREALIGN
|
#ifdef EXPERIMENTAL_SCOREALIGN
|
||||||
void OnScoreAlign();
|
void OnScoreAlign(const CommandContext &);
|
||||||
#endif // EXPERIMENTAL_SCOREALIGN
|
#endif // EXPERIMENTAL_SCOREALIGN
|
||||||
|
|
||||||
// Tracks menu
|
// Tracks menu
|
||||||
void OnNewWaveTrack();
|
void OnNewWaveTrack(const CommandContext &);
|
||||||
void OnNewStereoTrack();
|
void OnNewStereoTrack(const CommandContext &);
|
||||||
void OnNewLabelTrack();
|
void OnNewLabelTrack(const CommandContext &);
|
||||||
void OnNewTimeTrack();
|
void OnNewTimeTrack(const CommandContext &);
|
||||||
void OnTimerRecord();
|
void OnTimerRecord(const CommandContext &);
|
||||||
void OnRemoveTracks();
|
void OnRemoveTracks(const CommandContext &);
|
||||||
void OnMoveSelectionWithTracks();
|
void OnMoveSelectionWithTracks(const CommandContext &);
|
||||||
void OnSyncLock();
|
void OnSyncLock(const CommandContext &);
|
||||||
void OnAddLabel();
|
void OnAddLabel(const CommandContext &);
|
||||||
void OnAddLabelPlaying();
|
void OnAddLabelPlaying(const CommandContext &);
|
||||||
void DoEditLabels(LabelTrack *lt = nullptr, int index = -1);
|
void DoEditLabels(LabelTrack *lt = nullptr, int index = -1);
|
||||||
void OnEditLabels();
|
void OnEditLabels(const CommandContext &);
|
||||||
void OnToggleTypeToCreateLabel();
|
void OnToggleTypeToCreateLabel(const CommandContext &);
|
||||||
|
|
||||||
// Effect Menu
|
// Effect Menu
|
||||||
|
|
||||||
@ -484,52 +484,53 @@ public:
|
|||||||
static const int kDontRepeatLast = 0x04;
|
static const int kDontRepeatLast = 0x04;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool OnEffect(const PluginID & ID, int flags = OnEffectFlags::kNone);
|
bool DoEffect(const PluginID & ID, int flags);
|
||||||
void OnRepeatLastEffect(int index);
|
void OnEffect(const CommandContext &);
|
||||||
void OnApplyChain();
|
void OnRepeatLastEffect(const CommandContext &);
|
||||||
void OnEditChains();
|
void OnApplyChain(const CommandContext &);
|
||||||
void OnStereoToMono(int index);
|
void OnEditChains(const CommandContext &);
|
||||||
|
void OnStereoToMono(const CommandContext &);
|
||||||
void OnManagePluginsMenu(EffectType Type);
|
void OnManagePluginsMenu(EffectType Type);
|
||||||
static void RebuildAllMenuBars();
|
static void RebuildAllMenuBars();
|
||||||
void OnManageGenerators();
|
void OnManageGenerators(const CommandContext &);
|
||||||
void OnManageEffects();
|
void OnManageEffects(const CommandContext &);
|
||||||
void OnManageAnalyzers();
|
void OnManageAnalyzers(const CommandContext &);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Help Menu
|
// Help Menu
|
||||||
|
|
||||||
void OnAbout();
|
void OnAbout(const CommandContext &);
|
||||||
void OnQuickHelp();
|
void OnQuickHelp(const CommandContext &);
|
||||||
void OnManual();
|
void OnManual(const CommandContext &);
|
||||||
void OnCheckForUpdates();
|
void OnCheckForUpdates(const CommandContext &);
|
||||||
void MayCheckForUpdates();
|
void MayCheckForUpdates();
|
||||||
void OnShowLog();
|
void OnShowLog(const CommandContext &);
|
||||||
void OnHelpWelcome();
|
void OnHelpWelcome(const CommandContext &);
|
||||||
void OnBenchmark();
|
void OnBenchmark(const CommandContext &);
|
||||||
#if defined(EXPERIMENTAL_CRASH_REPORT)
|
#if defined(EXPERIMENTAL_CRASH_REPORT)
|
||||||
void OnCrashReport();
|
void OnCrashReport(const CommandContext &);
|
||||||
#endif
|
#endif
|
||||||
void OnScreenshot();
|
void OnScreenshot(const CommandContext &);
|
||||||
void OnAudioDeviceInfo();
|
void OnAudioDeviceInfo(const CommandContext &);
|
||||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||||
void OnMidiDeviceInfo();
|
void OnMidiDeviceInfo(const CommandContext &);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
void OnSeparator();
|
void OnSeparator(const CommandContext &);
|
||||||
|
|
||||||
// Keyboard navigation
|
// Keyboard navigation
|
||||||
|
|
||||||
void NextOrPrevFrame(bool next);
|
void NextOrPrevFrame(bool next);
|
||||||
void PrevFrame();
|
void PrevFrame(const CommandContext &);
|
||||||
void NextFrame();
|
void NextFrame(const CommandContext &);
|
||||||
|
|
||||||
void PrevWindow();
|
void PrevWindow(const CommandContext &);
|
||||||
void NextWindow();
|
void NextWindow(const CommandContext &);
|
||||||
|
|
||||||
void OnResample();
|
void OnResample(const CommandContext &);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void OnCursorLeft(bool shift, bool ctrl, bool keyup = false);
|
void OnCursorLeft(bool shift, bool ctrl, bool keyup = false);
|
||||||
|
@ -45,19 +45,19 @@ void AudacityProject::DoMacMinimize(AudacityProject *project)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudacityProject::OnMacMinimize()
|
void AudacityProject::OnMacMinimize(const CommandContext &)
|
||||||
{
|
{
|
||||||
DoMacMinimize(this);
|
DoMacMinimize(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudacityProject::OnMacMinimizeAll()
|
void AudacityProject::OnMacMinimizeAll(const CommandContext &)
|
||||||
{
|
{
|
||||||
for (const auto project : gAudacityProjects) {
|
for (const auto project : gAudacityProjects) {
|
||||||
DoMacMinimize(project.get());
|
DoMacMinimize(project.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudacityProject::OnMacZoom()
|
void AudacityProject::OnMacZoom(const CommandContext &)
|
||||||
{
|
{
|
||||||
auto window = this;
|
auto window = this;
|
||||||
auto topWindow = static_cast<wxTopLevelWindow*>(window);
|
auto topWindow = static_cast<wxTopLevelWindow*>(window);
|
||||||
@ -77,7 +77,7 @@ void AudacityProject::OnMacZoom()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudacityProject::OnMacBringAllToFront()
|
void AudacityProject::OnMacBringAllToFront(const CommandContext &)
|
||||||
{
|
{
|
||||||
// Reall this de-miniaturizes all, which is not exactly the standard
|
// Reall this de-miniaturizes all, which is not exactly the standard
|
||||||
// behavior.
|
// behavior.
|
||||||
|
@ -2319,7 +2319,7 @@ bool AudacityProject::TryToMakeActionAllowed
|
|||||||
|
|
||||||
// This was 'OnSelectAll'. Changing it to OnSelectSomething means if
|
// This was 'OnSelectAll'. Changing it to OnSelectSomething means if
|
||||||
// selecting all tracks is enough, we just do that.
|
// selecting all tracks is enough, we just do that.
|
||||||
OnSelectSomething();
|
OnSelectSomething(*this);
|
||||||
flags = GetUpdateFlags();
|
flags = GetUpdateFlags();
|
||||||
bAllowed = ((flags & mask) == (flagsRqd & mask));
|
bAllowed = ((flags & mask) == (flagsRqd & mask));
|
||||||
return bAllowed;
|
return bAllowed;
|
||||||
@ -3235,7 +3235,7 @@ void AudacityProject::OpenFile(const wxString &fileNameArg, bool addtohistory)
|
|||||||
mTrackPanel->Refresh(true);
|
mTrackPanel->Refresh(true);
|
||||||
*/
|
*/
|
||||||
closed = true;
|
closed = true;
|
||||||
this->OnClose();
|
this->OnClose(*this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (status & FSCKstatus_CHANGED)
|
else if (status & FSCKstatus_CHANGED)
|
||||||
@ -4217,7 +4217,7 @@ void AudacityProject::AddImportedTracks(const wxString &fileName,
|
|||||||
|
|
||||||
void AudacityProject::ZoomAfterImport(Track *pTrack)
|
void AudacityProject::ZoomAfterImport(Track *pTrack)
|
||||||
{
|
{
|
||||||
OnZoomFit();
|
OnZoomFit(*this);
|
||||||
|
|
||||||
mTrackPanel->SetFocus();
|
mTrackPanel->SetFocus();
|
||||||
RedrawProject();
|
RedrawProject();
|
||||||
@ -4289,7 +4289,7 @@ bool AudacityProject::Import(const wxString &fileName, WaveTrackArray* pTrackArr
|
|||||||
//TODO: All we want is a SelectAll()
|
//TODO: All we want is a SelectAll()
|
||||||
SelectNone();
|
SelectNone();
|
||||||
SelectAllIfNone();
|
SelectAllIfNone();
|
||||||
OnEffect(EffectManager::Get().GetEffectByIdentifier(wxT("Normalize")),
|
DoEffect(EffectManager::Get().GetEffectByIdentifier(wxT("Normalize")),
|
||||||
OnEffectFlags::kConfigured);
|
OnEffectFlags::kConfigured);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5373,7 +5373,7 @@ void AudacityProject::OnAudioIOStopRecording()
|
|||||||
// Reset timer record
|
// Reset timer record
|
||||||
if (IsTimerRecordCancelled())
|
if (IsTimerRecordCancelled())
|
||||||
{
|
{
|
||||||
OnUndo();
|
OnUndo(*this);
|
||||||
ResetTimerRecordFlag();
|
ResetTimerRecordFlag();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -517,7 +517,7 @@ int TimerRecordDialog::RunWaitDialog()
|
|||||||
return POST_TIMER_RECORD_CANCEL_WAIT;
|
return POST_TIMER_RECORD_CANCEL_WAIT;
|
||||||
} else {
|
} else {
|
||||||
// Record for specified time.
|
// Record for specified time.
|
||||||
pProject->OnRecord();
|
pProject->OnRecord(*pProject);
|
||||||
bool bIsRecording = true;
|
bool bIsRecording = true;
|
||||||
|
|
||||||
wxString sPostAction = m_pTimerAfterCompleteChoiceCtrl->GetString(m_pTimerAfterCompleteChoiceCtrl->GetSelection());
|
wxString sPostAction = m_pTimerAfterCompleteChoiceCtrl->GetString(m_pTimerAfterCompleteChoiceCtrl->GetSelection());
|
||||||
@ -563,7 +563,7 @@ int TimerRecordDialog::RunWaitDialog()
|
|||||||
|
|
||||||
// Must do this AFTER the timer project dialog has been deleted to ensure the application
|
// Must do this AFTER the timer project dialog has been deleted to ensure the application
|
||||||
// responds to the AUDIOIO events...see not about bug #334 in the ProgressDialog constructor.
|
// responds to the AUDIOIO events...see not about bug #334 in the ProgressDialog constructor.
|
||||||
pProject->OnStop();
|
pProject->OnStop(*pProject);
|
||||||
|
|
||||||
// Let the caller handle cancellation or failure from recording progress.
|
// Let the caller handle cancellation or failure from recording progress.
|
||||||
if (updateResult == ProgressResult::Cancelled || updateResult == ProgressResult::Failed)
|
if (updateResult == ProgressResult::Cancelled || updateResult == ProgressResult::Failed)
|
||||||
|
@ -13,140 +13,52 @@
|
|||||||
#include <wx/event.h>
|
#include <wx/event.h>
|
||||||
#include "../MemoryX.h"
|
#include "../MemoryX.h"
|
||||||
|
|
||||||
|
class AudacityProject;
|
||||||
|
class wxEvtHandler;
|
||||||
|
|
||||||
|
// Base class for objects, to whose member functions, the CommandManager will
|
||||||
|
// dispatch.
|
||||||
|
//
|
||||||
|
// It, or a subclass of it, must be the first base class of the object, and the
|
||||||
|
// first base class of that base class, etc., for the same reason that
|
||||||
|
// wxEvtHandler must be first (that is, the downcast from a pointer to the base
|
||||||
|
// to a pointer to the object, must be a vacuous operation).
|
||||||
|
//
|
||||||
|
// In fact, then, we just make it an alias of wxEvtHandler, in case you really
|
||||||
|
// need to inherit from wxEvtHandler for other reasons, and otherwise you
|
||||||
|
// couldn't satisfy the requirement for both base classes at once.
|
||||||
|
using CommandHandlerObject = wxEvtHandler;
|
||||||
|
|
||||||
|
// First of two function pointers registered with each command: an extractor
|
||||||
|
// of the handler object from the AudacityProject
|
||||||
|
using CommandHandlerFinder = CommandHandlerObject &(*)(AudacityProject&);
|
||||||
|
|
||||||
class wxEvent;
|
class wxEvent;
|
||||||
typedef wxString PluginID;
|
|
||||||
|
|
||||||
class AUDACITY_DLL_API CommandFunctor /* not final */
|
using CommandParameter = wxString;
|
||||||
{
|
|
||||||
public:
|
struct CommandContext {
|
||||||
CommandFunctor(){};
|
CommandContext(
|
||||||
virtual ~CommandFunctor(){};
|
AudacityProject &p
|
||||||
virtual void operator()(int index, const wxEvent *e) = 0;
|
, const wxEvent *e = nullptr
|
||||||
|
, int ii = 0
|
||||||
|
, const CommandParameter ¶m = {}
|
||||||
|
)
|
||||||
|
: project{ p }
|
||||||
|
, pEvt{ e }
|
||||||
|
, index{ ii }
|
||||||
|
, parameter{ param }
|
||||||
|
{}
|
||||||
|
|
||||||
|
AudacityProject &project;
|
||||||
|
const wxEvent *pEvt;
|
||||||
|
int index;
|
||||||
|
CommandParameter parameter;
|
||||||
};
|
};
|
||||||
|
|
||||||
using CommandFunctorPointer = std::shared_ptr <CommandFunctor>;
|
// Second of two function pointers registered with each command: a pointer
|
||||||
|
// to a member function of the handler object
|
||||||
|
using CommandFunctorPointer =
|
||||||
// Define functor subclasses that dispatch to the correct call sequence on
|
void (CommandHandlerObject::*)(const CommandContext &);
|
||||||
// member functions of AudacityProject (or other class!)
|
|
||||||
|
|
||||||
template<typename OBJ>
|
|
||||||
using audCommandFunction = void (OBJ::*)();
|
|
||||||
|
|
||||||
template<typename OBJ>
|
|
||||||
class VoidFunctor final : public CommandFunctor
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
explicit VoidFunctor(OBJ *This, audCommandFunction<OBJ> pfn)
|
|
||||||
: mThis{ This }, mCommandFunction{ pfn } {}
|
|
||||||
void operator () (int, const wxEvent *) override
|
|
||||||
{ (mThis->*mCommandFunction) (); }
|
|
||||||
private:
|
|
||||||
OBJ *const mThis;
|
|
||||||
const audCommandFunction<OBJ> mCommandFunction;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename OBJ>
|
|
||||||
using audCommandKeyFunction = void (OBJ::*)(const wxEvent *);
|
|
||||||
|
|
||||||
template<typename OBJ>
|
|
||||||
class KeyFunctor final : public CommandFunctor
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
explicit KeyFunctor(OBJ *This, audCommandKeyFunction<OBJ> pfn)
|
|
||||||
: mThis{ This }, mCommandKeyFunction{ pfn } {}
|
|
||||||
void operator () (int, const wxEvent *evt) override
|
|
||||||
{ (mThis->*mCommandKeyFunction) (evt); }
|
|
||||||
private:
|
|
||||||
OBJ *const mThis;
|
|
||||||
const audCommandKeyFunction<OBJ> mCommandKeyFunction;
|
|
||||||
};
|
|
||||||
|
|
||||||
// This allows functions to be used either by command manager or by a wxMenu popup,
|
|
||||||
// but the functions MUST ignore the argument!
|
|
||||||
template<typename OBJ>
|
|
||||||
using audCommandPopupFunction = void (OBJ::*)(wxCommandEvent&);
|
|
||||||
|
|
||||||
template<typename OBJ>
|
|
||||||
class PopupFunctor final : public CommandFunctor
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
explicit PopupFunctor(OBJ *This, audCommandPopupFunction<OBJ> pfn)
|
|
||||||
: mThis{ This }, mCommandPopupFunction{ pfn } {}
|
|
||||||
void operator () (int, const wxEvent *) override
|
|
||||||
{ wxCommandEvent dummy; (mThis->*mCommandPopupFunction) (dummy); }
|
|
||||||
private:
|
|
||||||
OBJ *const mThis;
|
|
||||||
const audCommandPopupFunction<OBJ> mCommandPopupFunction;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename OBJ>
|
|
||||||
using audCommandListFunction = void (OBJ::*)(int);
|
|
||||||
|
|
||||||
template<typename OBJ>
|
|
||||||
class ListFunctor final : public CommandFunctor
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
explicit ListFunctor(OBJ *This, audCommandListFunction<OBJ> pfn)
|
|
||||||
: mThis{ This }, mCommandListFunction{ pfn } {}
|
|
||||||
void operator () (int index, const wxEvent *) override
|
|
||||||
{ (mThis->*mCommandListFunction)(index); }
|
|
||||||
private:
|
|
||||||
OBJ *const mThis;
|
|
||||||
const audCommandListFunction<OBJ> mCommandListFunction;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename OBJ>
|
|
||||||
using audCommandPluginFunction = bool (OBJ::*)(const PluginID &, int);
|
|
||||||
|
|
||||||
template<typename OBJ>
|
|
||||||
class PluginFunctor final : public CommandFunctor
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
explicit PluginFunctor(OBJ *This, const PluginID &id, audCommandPluginFunction<OBJ> pfn)
|
|
||||||
: mPluginID{ id }, mThis{ This }, mCommandPluginFunction{ pfn } {}
|
|
||||||
void operator () (int, const wxEvent *) override
|
|
||||||
{ (mThis->*mCommandPluginFunction)
|
|
||||||
(mPluginID,
|
|
||||||
0 // AudacityProject::OnEffectFlags::kNone
|
|
||||||
); }
|
|
||||||
private:
|
|
||||||
const PluginID mPluginID;
|
|
||||||
OBJ *const mThis;
|
|
||||||
const audCommandPluginFunction<OBJ> mCommandPluginFunction;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Now define an overloaded factory function
|
|
||||||
template<typename OBJ>
|
|
||||||
inline CommandFunctorPointer MakeFunctor(OBJ *This,
|
|
||||||
audCommandFunction<OBJ> pfn)
|
|
||||||
{ return CommandFunctorPointer{ safenew VoidFunctor<OBJ>{ This, pfn } }; }
|
|
||||||
|
|
||||||
template<typename OBJ>
|
|
||||||
inline CommandFunctorPointer MakeFunctor(OBJ *This,
|
|
||||||
audCommandKeyFunction<OBJ> pfn)
|
|
||||||
{ return CommandFunctorPointer{ safenew KeyFunctor<OBJ>{ This, pfn } }; }
|
|
||||||
|
|
||||||
template<typename OBJ>
|
|
||||||
inline CommandFunctorPointer MakeFunctor(OBJ *This,
|
|
||||||
audCommandPopupFunction<OBJ> pfn)
|
|
||||||
{ return CommandFunctorPointer{ safenew PopupFunctor<OBJ>{ This, pfn } }; }
|
|
||||||
|
|
||||||
template<typename OBJ>
|
|
||||||
inline CommandFunctorPointer MakeFunctor(OBJ *This,
|
|
||||||
audCommandListFunction<OBJ> pfn)
|
|
||||||
{ return CommandFunctorPointer{ safenew ListFunctor<OBJ>{ This, pfn } }; }
|
|
||||||
|
|
||||||
template<typename OBJ>
|
|
||||||
inline CommandFunctorPointer MakeFunctor(OBJ *This, const PluginID &id,
|
|
||||||
audCommandPluginFunction<OBJ> pfn)
|
|
||||||
{ return CommandFunctorPointer{ safenew PluginFunctor<OBJ>{ This, id, pfn } }; }
|
|
||||||
|
|
||||||
// Now define the macro abbreviations that call the factory
|
|
||||||
#define FNT(OBJ, This, X) (MakeFunctor<OBJ>(This, X ))
|
|
||||||
#define FNTS(OBJ, This, X, S) (MakeFunctor<OBJ>(This, (S), X ))
|
|
||||||
|
|
||||||
#define FN(X) FNT(AudacityProject, this, & AudacityProject :: X)
|
|
||||||
#define FNS(X, S) FNTS(AudacityProject, this, & AudacityProject :: X, S)
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -694,7 +694,8 @@ void CommandManager::ClearCurrentMenu()
|
|||||||
/// given functor will be called
|
/// given functor will be called
|
||||||
void CommandManager::InsertItem(const wxString & name,
|
void CommandManager::InsertItem(const wxString & name,
|
||||||
const wxString & label_in,
|
const wxString & label_in,
|
||||||
const CommandFunctorPointer &callback,
|
CommandHandlerFinder finder,
|
||||||
|
CommandFunctorPointer callback,
|
||||||
const wxString & after,
|
const wxString & after,
|
||||||
int checkmark)
|
int checkmark)
|
||||||
{
|
{
|
||||||
@ -744,7 +745,7 @@ void CommandManager::InsertItem(const wxString & name,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandListEntry *entry = NewIdentifier(name, label_in, menu, callback, false, 0, 0);
|
CommandListEntry *entry = NewIdentifier(name, label_in, menu, finder, callback, false, 0, 0);
|
||||||
int ID = entry->id;
|
int ID = entry->id;
|
||||||
wxString label = GetLabel(entry);
|
wxString label = GetLabel(entry);
|
||||||
|
|
||||||
@ -763,40 +764,49 @@ void CommandManager::InsertItem(const wxString & name,
|
|||||||
|
|
||||||
void CommandManager::AddCheck(const wxChar *name,
|
void CommandManager::AddCheck(const wxChar *name,
|
||||||
const wxChar *label,
|
const wxChar *label,
|
||||||
const CommandFunctorPointer &callback,
|
CommandHandlerFinder finder,
|
||||||
|
CommandFunctorPointer callback,
|
||||||
int checkmark)
|
int checkmark)
|
||||||
{
|
{
|
||||||
AddItem(name, label, callback, wxT(""), NoFlagsSpecifed, NoFlagsSpecifed, checkmark);
|
AddItem(name, label, finder, callback, wxT(""),
|
||||||
|
NoFlagsSpecifed, NoFlagsSpecifed, checkmark);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandManager::AddCheck(const wxChar *name,
|
void CommandManager::AddCheck(const wxChar *name,
|
||||||
const wxChar *label,
|
const wxChar *label,
|
||||||
const CommandFunctorPointer &callback,
|
CommandHandlerFinder finder,
|
||||||
|
CommandFunctorPointer callback,
|
||||||
int checkmark,
|
int checkmark,
|
||||||
CommandFlag flags,
|
CommandFlag flags,
|
||||||
CommandMask mask)
|
CommandMask mask)
|
||||||
{
|
{
|
||||||
AddItem(name, label, callback, wxT(""), flags, mask, checkmark);
|
AddItem(name, label, finder, callback, wxT(""), flags, mask, checkmark);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandManager::AddItem(const wxChar *name,
|
void CommandManager::AddItem(const wxChar *name,
|
||||||
const wxChar *label,
|
const wxChar *label,
|
||||||
const CommandFunctorPointer &callback,
|
CommandHandlerFinder finder,
|
||||||
|
CommandFunctorPointer callback,
|
||||||
CommandFlag flags,
|
CommandFlag flags,
|
||||||
CommandMask mask)
|
CommandMask mask,
|
||||||
|
const CommandParameter ¶meter)
|
||||||
{
|
{
|
||||||
AddItem(name, label, callback, wxT(""), flags, mask);
|
AddItem(name, label, finder, callback, wxT(""), flags, mask, -1, parameter);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandManager::AddItem(const wxChar *name,
|
void CommandManager::AddItem(const wxChar *name,
|
||||||
const wxChar *label_in,
|
const wxChar *label_in,
|
||||||
const CommandFunctorPointer &callback,
|
CommandHandlerFinder finder,
|
||||||
|
CommandFunctorPointer callback,
|
||||||
const wxChar *accel,
|
const wxChar *accel,
|
||||||
CommandFlag flags,
|
CommandFlag flags,
|
||||||
CommandMask mask,
|
CommandMask mask,
|
||||||
int checkmark)
|
int checkmark,
|
||||||
|
const CommandParameter ¶meter)
|
||||||
{
|
{
|
||||||
CommandListEntry *entry = NewIdentifier(name, label_in, accel, CurrentMenu(), callback, false, 0, 0);
|
CommandListEntry *entry =
|
||||||
|
NewIdentifier(name, label_in, accel, CurrentMenu(), finder, callback,
|
||||||
|
false, 0, 0, parameter);
|
||||||
int ID = entry->id;
|
int ID = entry->id;
|
||||||
wxString label = GetLabelWithDisabledAccel(entry);
|
wxString label = GetLabelWithDisabledAccel(entry);
|
||||||
|
|
||||||
@ -824,12 +834,14 @@ void CommandManager::AddItem(const wxChar *name,
|
|||||||
/// all of the items at once.
|
/// all of the items at once.
|
||||||
void CommandManager::AddItemList(const wxString & name,
|
void CommandManager::AddItemList(const wxString & name,
|
||||||
const wxArrayString & labels,
|
const wxArrayString & labels,
|
||||||
const CommandFunctorPointer &callback)
|
CommandHandlerFinder finder,
|
||||||
|
CommandFunctorPointer callback)
|
||||||
{
|
{
|
||||||
for (size_t i = 0, cnt = labels.GetCount(); i < cnt; i++) {
|
for (size_t i = 0, cnt = labels.GetCount(); i < cnt; i++) {
|
||||||
CommandListEntry *entry = NewIdentifier(name,
|
CommandListEntry *entry = NewIdentifier(name,
|
||||||
labels[i],
|
labels[i],
|
||||||
CurrentMenu(),
|
CurrentMenu(),
|
||||||
|
finder,
|
||||||
callback,
|
callback,
|
||||||
true,
|
true,
|
||||||
i,
|
i,
|
||||||
@ -844,21 +856,23 @@ void CommandManager::AddItemList(const wxString & name,
|
|||||||
/// given function pointer will be called (via the CommandManagerListener)
|
/// given function pointer will be called (via the CommandManagerListener)
|
||||||
void CommandManager::AddCommand(const wxChar *name,
|
void CommandManager::AddCommand(const wxChar *name,
|
||||||
const wxChar *label,
|
const wxChar *label,
|
||||||
const CommandFunctorPointer &callback,
|
CommandHandlerFinder finder,
|
||||||
|
CommandFunctorPointer callback,
|
||||||
CommandFlag flags,
|
CommandFlag flags,
|
||||||
CommandMask mask)
|
CommandMask mask)
|
||||||
{
|
{
|
||||||
AddCommand(name, label, callback, wxT(""), flags, mask);
|
AddCommand(name, label, finder, callback, wxT(""), flags, mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandManager::AddCommand(const wxChar *name,
|
void CommandManager::AddCommand(const wxChar *name,
|
||||||
const wxChar *label_in,
|
const wxChar *label_in,
|
||||||
const CommandFunctorPointer &callback,
|
CommandHandlerFinder finder,
|
||||||
|
CommandFunctorPointer callback,
|
||||||
const wxChar *accel,
|
const wxChar *accel,
|
||||||
CommandFlag flags,
|
CommandFlag flags,
|
||||||
CommandMask mask)
|
CommandMask mask)
|
||||||
{
|
{
|
||||||
NewIdentifier(name, label_in, accel, NULL, callback, false, 0, 0);
|
NewIdentifier(name, label_in, accel, NULL, finder, callback, false, 0, 0, {});
|
||||||
|
|
||||||
if (flags != NoFlagsSpecifed || mask != NoFlagsSpecifed) {
|
if (flags != NoFlagsSpecifed || mask != NoFlagsSpecifed) {
|
||||||
SetCommandFlags(name, flags, mask);
|
SetCommandFlags(name, flags, mask);
|
||||||
@ -867,10 +881,13 @@ void CommandManager::AddCommand(const wxChar *name,
|
|||||||
|
|
||||||
void CommandManager::AddGlobalCommand(const wxChar *name,
|
void CommandManager::AddGlobalCommand(const wxChar *name,
|
||||||
const wxChar *label_in,
|
const wxChar *label_in,
|
||||||
const CommandFunctorPointer &callback,
|
CommandHandlerFinder finder,
|
||||||
|
CommandFunctorPointer callback,
|
||||||
const wxChar *accel)
|
const wxChar *accel)
|
||||||
{
|
{
|
||||||
CommandListEntry *entry = NewIdentifier(name, label_in, accel, NULL, callback, false, 0, 0);
|
CommandListEntry *entry =
|
||||||
|
NewIdentifier(name, label_in, accel, NULL, finder, callback,
|
||||||
|
false, 0, 0, {});
|
||||||
|
|
||||||
entry->enabled = false;
|
entry->enabled = false;
|
||||||
entry->isGlobal = true;
|
entry->isGlobal = true;
|
||||||
@ -904,7 +921,8 @@ int CommandManager::NextIdentifier(int ID)
|
|||||||
CommandListEntry *CommandManager::NewIdentifier(const wxString & name,
|
CommandListEntry *CommandManager::NewIdentifier(const wxString & name,
|
||||||
const wxString & label,
|
const wxString & label,
|
||||||
wxMenu *menu,
|
wxMenu *menu,
|
||||||
const CommandFunctorPointer &callback,
|
CommandHandlerFinder finder,
|
||||||
|
CommandFunctorPointer callback,
|
||||||
bool multi,
|
bool multi,
|
||||||
int index,
|
int index,
|
||||||
int count)
|
int count)
|
||||||
@ -913,20 +931,23 @@ CommandListEntry *CommandManager::NewIdentifier(const wxString & name,
|
|||||||
label.BeforeFirst(wxT('\t')),
|
label.BeforeFirst(wxT('\t')),
|
||||||
label.AfterFirst(wxT('\t')),
|
label.AfterFirst(wxT('\t')),
|
||||||
menu,
|
menu,
|
||||||
|
finder,
|
||||||
callback,
|
callback,
|
||||||
multi,
|
multi,
|
||||||
index,
|
index,
|
||||||
count);
|
count, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandListEntry *CommandManager::NewIdentifier(const wxString & name,
|
CommandListEntry *CommandManager::NewIdentifier(const wxString & name,
|
||||||
const wxString & label,
|
const wxString & label,
|
||||||
const wxString & accel,
|
const wxString & accel,
|
||||||
wxMenu *menu,
|
wxMenu *menu,
|
||||||
const CommandFunctorPointer &callback,
|
CommandHandlerFinder finder,
|
||||||
|
CommandFunctorPointer callback,
|
||||||
bool multi,
|
bool multi,
|
||||||
int index,
|
int index,
|
||||||
int count)
|
int count,
|
||||||
|
const CommandParameter ¶meter)
|
||||||
{
|
{
|
||||||
// If we have the identifier already, reuse it.
|
// If we have the identifier already, reuse it.
|
||||||
CommandListEntry *prev = mCommandNameHash[name];
|
CommandListEntry *prev = mCommandNameHash[name];
|
||||||
@ -956,6 +977,7 @@ CommandListEntry *CommandManager::NewIdentifier(const wxString & name,
|
|||||||
|
|
||||||
mCurrentID = NextIdentifier(mCurrentID);
|
mCurrentID = NextIdentifier(mCurrentID);
|
||||||
entry->id = mCurrentID;
|
entry->id = mCurrentID;
|
||||||
|
entry->parameter = parameter;
|
||||||
|
|
||||||
#if defined(__WXMAC__)
|
#if defined(__WXMAC__)
|
||||||
if (name == wxT("Preferences"))
|
if (name == wxT("Preferences"))
|
||||||
@ -973,6 +995,7 @@ CommandListEntry *CommandManager::NewIdentifier(const wxString & name,
|
|||||||
entry->labelPrefix = labelPrefix;
|
entry->labelPrefix = labelPrefix;
|
||||||
entry->labelTop = wxMenuItem::GetLabelText(mCurrentMenuName);
|
entry->labelTop = wxMenuItem::GetLabelText(mCurrentMenuName);
|
||||||
entry->menu = menu;
|
entry->menu = menu;
|
||||||
|
entry->finder = finder;
|
||||||
entry->callback = callback;
|
entry->callback = callback;
|
||||||
entry->multi = multi;
|
entry->multi = multi;
|
||||||
entry->index = index;
|
entry->index = index;
|
||||||
@ -1447,11 +1470,11 @@ bool CommandManager::HandleCommandEntry(const CommandListEntry * entry,
|
|||||||
if (!entry || !entry->enabled)
|
if (!entry || !entry->enabled)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
auto proj = GetActiveProject();
|
||||||
|
|
||||||
auto combinedMask = (mask & entry->mask);
|
auto combinedMask = (mask & entry->mask);
|
||||||
if (combinedMask) {
|
if (combinedMask) {
|
||||||
|
|
||||||
AudacityProject * proj;
|
|
||||||
proj = GetActiveProject();
|
|
||||||
wxASSERT( proj );
|
wxASSERT( proj );
|
||||||
if( !proj )
|
if( !proj )
|
||||||
return false;
|
return false;
|
||||||
@ -1469,7 +1492,9 @@ bool CommandManager::HandleCommandEntry(const CommandListEntry * entry,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
(*(entry->callback))(entry->index, evt);
|
CommandContext context{ *proj, evt, entry->index, entry->parameter };
|
||||||
|
auto &handler = entry->finder(*proj);
|
||||||
|
(handler.*(entry->callback))(context);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1536,7 +1561,7 @@ bool CommandManager::HandleTextualCommand(const wxString & Str, CommandFlag flag
|
|||||||
{
|
{
|
||||||
if (em.GetEffectIdentifier(plug->GetID()).IsSameAs(Str))
|
if (em.GetEffectIdentifier(plug->GetID()).IsSameAs(Str))
|
||||||
{
|
{
|
||||||
return proj->OnEffect(plug->GetID(), AudacityProject::OnEffectFlags::kConfigured);
|
return proj->DoEffect(plug->GetID(), AudacityProject::OnEffectFlags::kConfigured);
|
||||||
}
|
}
|
||||||
plug = pm.GetNextPlugin(PluginTypeEffect);
|
plug = pm.GetNextPlugin(PluginTypeEffect);
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,9 @@ struct CommandListEntry
|
|||||||
wxString labelPrefix;
|
wxString labelPrefix;
|
||||||
wxString labelTop;
|
wxString labelTop;
|
||||||
wxMenu *menu;
|
wxMenu *menu;
|
||||||
|
CommandHandlerFinder finder;
|
||||||
CommandFunctorPointer callback;
|
CommandFunctorPointer callback;
|
||||||
|
CommandParameter parameter;
|
||||||
bool multi;
|
bool multi;
|
||||||
int index;
|
int index;
|
||||||
int count;
|
int count;
|
||||||
@ -124,39 +126,47 @@ class AUDACITY_DLL_API CommandManager final : public XMLTagHandler
|
|||||||
|
|
||||||
void InsertItem(const wxString & name,
|
void InsertItem(const wxString & name,
|
||||||
const wxString & label,
|
const wxString & label,
|
||||||
const CommandFunctorPointer &callback,
|
CommandHandlerFinder finder,
|
||||||
|
CommandFunctorPointer callback,
|
||||||
const wxString & after,
|
const wxString & after,
|
||||||
int checkmark = -1);
|
int checkmark = -1);
|
||||||
|
|
||||||
void AddItemList(const wxString & name,
|
void AddItemList(const wxString & name,
|
||||||
const wxArrayString & labels,
|
const wxArrayString & labels,
|
||||||
const CommandFunctorPointer &callback);
|
CommandHandlerFinder finder,
|
||||||
|
CommandFunctorPointer callback);
|
||||||
|
|
||||||
void AddCheck(const wxChar *name,
|
void AddCheck(const wxChar *name,
|
||||||
const wxChar *label,
|
const wxChar *label,
|
||||||
const CommandFunctorPointer &callback,
|
CommandHandlerFinder finder,
|
||||||
|
CommandFunctorPointer callback,
|
||||||
int checkmark = 0);
|
int checkmark = 0);
|
||||||
|
|
||||||
void AddCheck(const wxChar *name,
|
void AddCheck(const wxChar *name,
|
||||||
const wxChar *label,
|
const wxChar *label,
|
||||||
const CommandFunctorPointer &callback,
|
CommandHandlerFinder finder,
|
||||||
|
CommandFunctorPointer callback,
|
||||||
int checkmark,
|
int checkmark,
|
||||||
CommandFlag flags,
|
CommandFlag flags,
|
||||||
CommandMask mask);
|
CommandMask mask);
|
||||||
|
|
||||||
void AddItem(const wxChar *name,
|
void AddItem(const wxChar *name,
|
||||||
const wxChar *label,
|
const wxChar *label,
|
||||||
const CommandFunctorPointer &callback,
|
CommandHandlerFinder finder,
|
||||||
|
CommandFunctorPointer callback,
|
||||||
CommandFlag flags = NoFlagsSpecifed,
|
CommandFlag flags = NoFlagsSpecifed,
|
||||||
CommandMask mask = NoFlagsSpecifed);
|
CommandMask mask = NoFlagsSpecifed,
|
||||||
|
const CommandParameter ¶meter = {});
|
||||||
|
|
||||||
void AddItem(const wxChar *name,
|
void AddItem(const wxChar *name,
|
||||||
const wxChar *label_in,
|
const wxChar *label_in,
|
||||||
const CommandFunctorPointer &callback,
|
CommandHandlerFinder finder,
|
||||||
|
CommandFunctorPointer callback,
|
||||||
const wxChar *accel,
|
const wxChar *accel,
|
||||||
CommandFlag flags = NoFlagsSpecifed,
|
CommandFlag flags = NoFlagsSpecifed,
|
||||||
CommandMask mask = NoFlagsSpecifed,
|
CommandMask mask = NoFlagsSpecifed,
|
||||||
int checkmark = -1);
|
int checkmark = -1,
|
||||||
|
const CommandParameter ¶meter = {});
|
||||||
|
|
||||||
void AddSeparator();
|
void AddSeparator();
|
||||||
|
|
||||||
@ -164,20 +174,23 @@ class AUDACITY_DLL_API CommandManager final : public XMLTagHandler
|
|||||||
// keyboard shortcut.
|
// keyboard shortcut.
|
||||||
void AddCommand(const wxChar *name,
|
void AddCommand(const wxChar *name,
|
||||||
const wxChar *label,
|
const wxChar *label,
|
||||||
const CommandFunctorPointer &callback,
|
CommandHandlerFinder finder,
|
||||||
|
CommandFunctorPointer callback,
|
||||||
CommandFlag flags = NoFlagsSpecifed,
|
CommandFlag flags = NoFlagsSpecifed,
|
||||||
CommandMask mask = NoFlagsSpecifed);
|
CommandMask mask = NoFlagsSpecifed);
|
||||||
|
|
||||||
void AddCommand(const wxChar *name,
|
void AddCommand(const wxChar *name,
|
||||||
const wxChar *label,
|
const wxChar *label,
|
||||||
const CommandFunctorPointer &callback,
|
CommandHandlerFinder finder,
|
||||||
|
CommandFunctorPointer callback,
|
||||||
const wxChar *accel,
|
const wxChar *accel,
|
||||||
CommandFlag flags = NoFlagsSpecifed,
|
CommandFlag flags = NoFlagsSpecifed,
|
||||||
CommandMask mask = NoFlagsSpecifed);
|
CommandMask mask = NoFlagsSpecifed);
|
||||||
|
|
||||||
void AddGlobalCommand(const wxChar *name,
|
void AddGlobalCommand(const wxChar *name,
|
||||||
const wxChar *label,
|
const wxChar *label,
|
||||||
const CommandFunctorPointer &callback,
|
CommandHandlerFinder finder,
|
||||||
|
CommandFunctorPointer callback,
|
||||||
const wxChar *accel);
|
const wxChar *accel);
|
||||||
//
|
//
|
||||||
// Command masks
|
// Command masks
|
||||||
@ -282,7 +295,8 @@ protected:
|
|||||||
CommandListEntry *NewIdentifier(const wxString & name,
|
CommandListEntry *NewIdentifier(const wxString & name,
|
||||||
const wxString & label,
|
const wxString & label,
|
||||||
wxMenu *menu,
|
wxMenu *menu,
|
||||||
const CommandFunctorPointer &callback,
|
CommandHandlerFinder finder,
|
||||||
|
CommandFunctorPointer callback,
|
||||||
bool multi,
|
bool multi,
|
||||||
int index,
|
int index,
|
||||||
int count);
|
int count);
|
||||||
@ -290,10 +304,12 @@ protected:
|
|||||||
const wxString & label,
|
const wxString & label,
|
||||||
const wxString & accel,
|
const wxString & accel,
|
||||||
wxMenu *menu,
|
wxMenu *menu,
|
||||||
const CommandFunctorPointer &callback,
|
CommandHandlerFinder finder,
|
||||||
|
CommandFunctorPointer callback,
|
||||||
bool multi,
|
bool multi,
|
||||||
int index,
|
int index,
|
||||||
int count);
|
int count,
|
||||||
|
const CommandParameter ¶meter);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Executing commands
|
// Executing commands
|
||||||
|
@ -44,7 +44,8 @@ bool OpenProjectCommand::Apply(CommandExecutionContext context)
|
|||||||
wxString oldFileName = context.GetProject()->GetFileName();
|
wxString oldFileName = context.GetProject()->GetFileName();
|
||||||
if(fileName == wxEmptyString)
|
if(fileName == wxEmptyString)
|
||||||
{
|
{
|
||||||
context.GetProject()->OnOpen();
|
auto project = context.GetProject();
|
||||||
|
project->OnOpen(*project);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -61,12 +61,14 @@ bool SelectCommand::Apply(CommandExecutionContext context)
|
|||||||
if (mode.IsSameAs(wxT("None")))
|
if (mode.IsSameAs(wxT("None")))
|
||||||
{
|
{
|
||||||
// select none
|
// select none
|
||||||
context.GetProject()->OnSelectNone();
|
auto project = context.GetProject();
|
||||||
|
project->OnSelectNone(*project);
|
||||||
}
|
}
|
||||||
else if (mode.IsSameAs(wxT("All")))
|
else if (mode.IsSameAs(wxT("All")))
|
||||||
{
|
{
|
||||||
// select all
|
// select all
|
||||||
context.GetProject()->OnSelectAll();
|
auto project = context.GetProject();
|
||||||
|
project->OnSelectAll(*project);
|
||||||
}
|
}
|
||||||
else if (mode.IsSameAs(wxT("Range")))
|
else if (mode.IsSameAs(wxT("Range")))
|
||||||
{
|
{
|
||||||
|
@ -765,7 +765,7 @@ bool Effect::Apply()
|
|||||||
// This is absolute hackage...but easy and I can't think of another way just now.
|
// This is absolute hackage...but easy and I can't think of another way just now.
|
||||||
//
|
//
|
||||||
// It should callback to the EffectManager to kick off the processing
|
// It should callback to the EffectManager to kick off the processing
|
||||||
return GetActiveProject()->OnEffect(GetID(), AudacityProject::OnEffectFlags::kConfigured);
|
return GetActiveProject()->DoEffect(GetID(), AudacityProject::OnEffectFlags::kConfigured);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Effect::Preview()
|
void Effect::Preview()
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
#include "../Project.h"
|
#include "../Project.h"
|
||||||
#include "../BatchCommandDialog.h"
|
#include "../BatchCommandDialog.h"
|
||||||
#include "../ShuttleGui.h"
|
#include "../ShuttleGui.h"
|
||||||
#include "../Menus.h"
|
|
||||||
#include "../toolbars/ToolManager.h"
|
#include "../toolbars/ToolManager.h"
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(BatchPrefs, PrefsPanel)
|
BEGIN_EVENT_TABLE(BatchPrefs, PrefsPanel)
|
||||||
|
@ -193,13 +193,13 @@ void ScrubbingToolBar::OnButton(wxCommandEvent &event)
|
|||||||
|
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case STBScrubID:
|
case STBScrubID:
|
||||||
scrubber.OnScrub(event);
|
scrubber.OnScrub(*p);
|
||||||
break;
|
break;
|
||||||
case STBSeekID:
|
case STBSeekID:
|
||||||
scrubber.OnSeek(event);
|
scrubber.OnSeek(*p);
|
||||||
break;
|
break;
|
||||||
case STBRulerID:
|
case STBRulerID:
|
||||||
scrubber.OnToggleScrubRuler(event);
|
scrubber.OnToggleScrubRuler(*p);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
wxASSERT(false);
|
wxASSERT(false);
|
||||||
|
@ -224,7 +224,7 @@ namespace {
|
|||||||
wxString label;
|
wxString label;
|
||||||
wxString status;
|
wxString status;
|
||||||
CommandFlag flags;
|
CommandFlag flags;
|
||||||
void (Scrubber::*memFn)(wxCommandEvent&);
|
void (Scrubber::*memFn)(const CommandContext&);
|
||||||
bool seek;
|
bool seek;
|
||||||
bool (Scrubber::*StatusTest)() const;
|
bool (Scrubber::*StatusTest)() const;
|
||||||
|
|
||||||
@ -921,19 +921,19 @@ void Scrubber::OnScrubOrSeek(bool seek)
|
|||||||
scrubbingToolBar->RegenerateTooltips();
|
scrubbingToolBar->RegenerateTooltips();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scrubber::OnScrub(wxCommandEvent&)
|
void Scrubber::OnScrub(const CommandContext&)
|
||||||
{
|
{
|
||||||
OnScrubOrSeek(false);
|
OnScrubOrSeek(false);
|
||||||
CheckMenuItems();
|
CheckMenuItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scrubber::OnSeek(wxCommandEvent&)
|
void Scrubber::OnSeek(const CommandContext&)
|
||||||
{
|
{
|
||||||
OnScrubOrSeek(true);
|
OnScrubOrSeek(true);
|
||||||
CheckMenuItems();
|
CheckMenuItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scrubber::OnToggleScrubRuler(wxCommandEvent&)
|
void Scrubber::OnToggleScrubRuler(const CommandContext&)
|
||||||
{
|
{
|
||||||
mProject->GetRulerPanel()->OnToggleScrubRuler();
|
mProject->GetRulerPanel()->OnToggleScrubRuler();
|
||||||
const auto toolbar = mProject->GetToolManager()->GetToolBar(ScrubbingBarID);
|
const auto toolbar = mProject->GetToolManager()->GetToolBar(ScrubbingBarID);
|
||||||
@ -943,10 +943,12 @@ void Scrubber::OnToggleScrubRuler(wxCommandEvent&)
|
|||||||
|
|
||||||
enum { CMD_ID = 8000 };
|
enum { CMD_ID = 8000 };
|
||||||
|
|
||||||
|
#define THUNK(Name) Scrubber::Thunk<&Scrubber::Name>
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(Scrubber, wxEvtHandler)
|
BEGIN_EVENT_TABLE(Scrubber, wxEvtHandler)
|
||||||
EVT_MENU(CMD_ID, Scrubber::OnScrub)
|
EVT_MENU(CMD_ID, THUNK(OnScrub))
|
||||||
EVT_MENU(CMD_ID + 1, Scrubber::OnSeek)
|
EVT_MENU(CMD_ID + 1, THUNK(OnSeek))
|
||||||
EVT_MENU(CMD_ID + 2, Scrubber::OnToggleScrubRuler)
|
EVT_MENU(CMD_ID + 2, THUNK(OnToggleScrubRuler))
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(Scrubber::Forwarder, wxEvtHandler)
|
BEGIN_EVENT_TABLE(Scrubber::Forwarder, wxEvtHandler)
|
||||||
@ -1000,6 +1002,10 @@ bool Scrubber::CanScrub() const
|
|||||||
return cm->GetEnabled(menuItems[ 0 ].name);
|
return cm->GetEnabled(menuItems[ 0 ].name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// To supply the "finder" argument
|
||||||
|
static CommandHandlerObject &findme(AudacityProject &project)
|
||||||
|
{ return project.GetScrubber(); }
|
||||||
|
|
||||||
void Scrubber::AddMenuItems()
|
void Scrubber::AddMenuItems()
|
||||||
{
|
{
|
||||||
auto cm = mProject->GetCommandManager();
|
auto cm = mProject->GetCommandManager();
|
||||||
@ -1008,13 +1014,13 @@ void Scrubber::AddMenuItems()
|
|||||||
for (const auto &item : menuItems) {
|
for (const auto &item : menuItems) {
|
||||||
if (item.StatusTest)
|
if (item.StatusTest)
|
||||||
cm->AddCheck(item.name, wxGetTranslation(item.label),
|
cm->AddCheck(item.name, wxGetTranslation(item.label),
|
||||||
FNT(Scrubber, this, item.memFn),
|
findme, static_cast<CommandFunctorPointer>(item.memFn),
|
||||||
false,
|
false,
|
||||||
item.flags, item.flags);
|
item.flags, item.flags);
|
||||||
else
|
else
|
||||||
// The start item
|
// The start item
|
||||||
cm->AddItem(item.name, wxGetTranslation(item.label),
|
cm->AddItem(item.name, wxGetTranslation(item.label),
|
||||||
FNT(Scrubber, this, item.memFn),
|
findme, static_cast<CommandFunctorPointer>(item.memFn),
|
||||||
item.flags, item.flags);
|
item.flags, item.flags);
|
||||||
}
|
}
|
||||||
cm->EndSubMenu();
|
cm->EndSubMenu();
|
||||||
|
@ -18,9 +18,11 @@ Paul Licameli split from TrackPanel.cpp
|
|||||||
|
|
||||||
#include "../../Experimental.h"
|
#include "../../Experimental.h"
|
||||||
#include "../../widgets/Overlay.h"
|
#include "../../widgets/Overlay.h"
|
||||||
|
#include "../../commands/CommandFunctors.h"
|
||||||
#include "../../../include/audacity/Types.h"
|
#include "../../../include/audacity/Types.h"
|
||||||
|
|
||||||
class AudacityProject;
|
class AudacityProject;
|
||||||
|
extern AudacityProject *GetActiveProject();
|
||||||
|
|
||||||
// Conditionally compile either a separate thead, or else use a timer in the main
|
// Conditionally compile either a separate thead, or else use a timer in the main
|
||||||
// thread, to poll the mouse and update scrubbing speed and direction. The advantage of
|
// thread, to poll the mouse and update scrubbing speed and direction. The advantage of
|
||||||
@ -123,9 +125,14 @@ public:
|
|||||||
void PopulatePopupMenu(wxMenu &menu);
|
void PopulatePopupMenu(wxMenu &menu);
|
||||||
|
|
||||||
void OnScrubOrSeek(bool seek);
|
void OnScrubOrSeek(bool seek);
|
||||||
void OnScrub(wxCommandEvent&);
|
void OnScrub(const CommandContext&);
|
||||||
void OnSeek(wxCommandEvent&);
|
void OnSeek(const CommandContext&);
|
||||||
void OnToggleScrubRuler(wxCommandEvent&);
|
void OnToggleScrubRuler(const CommandContext&);
|
||||||
|
|
||||||
|
// Convenience wrapper for the above
|
||||||
|
template<void (Scrubber::*pfn)(const CommandContext&)>
|
||||||
|
void Thunk(wxCommandEvent &dummy)
|
||||||
|
{ (this->*pfn)(*GetActiveProject()); }
|
||||||
|
|
||||||
// A string to put in the leftmost part of the status bar
|
// A string to put in the leftmost part of the status bar
|
||||||
// when scrub or seek is in progress, or else empty.
|
// when scrub or seek is in progress, or else empty.
|
||||||
|
@ -150,7 +150,8 @@ void MultiDialog::OnOK(wxCommandEvent & WXUNUSED(event))
|
|||||||
|
|
||||||
void MultiDialog::OnShowLog(wxCommandEvent & WXUNUSED(event))
|
void MultiDialog::OnShowLog(wxCommandEvent & WXUNUSED(event))
|
||||||
{
|
{
|
||||||
GetActiveProject()->OnShowLog();
|
auto project = GetActiveProject();
|
||||||
|
project->OnShowLog(*project);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -89,7 +89,6 @@ array of Ruler::Label.
|
|||||||
#include "../TimeTrack.h"
|
#include "../TimeTrack.h"
|
||||||
#include "../TrackPanel.h"
|
#include "../TrackPanel.h"
|
||||||
#include "../TrackPanelCellIterator.h"
|
#include "../TrackPanelCellIterator.h"
|
||||||
#include "../Menus.h"
|
|
||||||
#include "../NumberScale.h"
|
#include "../NumberScale.h"
|
||||||
#include "../Prefs.h"
|
#include "../Prefs.h"
|
||||||
#include "../Snap.h"
|
#include "../Snap.h"
|
||||||
@ -2415,7 +2414,7 @@ void AdornedRulerPanel::OnMouseEvents(wxMouseEvent &evt)
|
|||||||
bool switchToQP = (zone == StatusChoice::EnteringQP && mQuickPlayEnabled);
|
bool switchToQP = (zone == StatusChoice::EnteringQP && mQuickPlayEnabled);
|
||||||
if (switchToQP && evt.LeftDown()) {
|
if (switchToQP && evt.LeftDown()) {
|
||||||
// We can't stop scrubbing yet (see comments in Bug 1391), but we can pause it.
|
// We can't stop scrubbing yet (see comments in Bug 1391), but we can pause it.
|
||||||
mProject->OnPause();
|
mProject->OnPause(*mProject);
|
||||||
// Don't return, fall through
|
// Don't return, fall through
|
||||||
}
|
}
|
||||||
else if (scrubber.IsPaused())
|
else if (scrubber.IsPaused())
|
||||||
@ -2554,7 +2553,7 @@ void AdornedRulerPanel::HandleQPClick(wxMouseEvent &evt, wxCoord mousePosX)
|
|||||||
// Temporarily unlock locked play region
|
// Temporarily unlock locked play region
|
||||||
if (mPlayRegionLock && evt.LeftDown()) {
|
if (mPlayRegionLock && evt.LeftDown()) {
|
||||||
//mPlayRegionLock = true;
|
//mPlayRegionLock = true;
|
||||||
mProject->OnUnlockPlayRegion();
|
mProject->OnUnlockPlayRegion(*mProject);
|
||||||
}
|
}
|
||||||
|
|
||||||
mLeftDownClickUnsnapped = mQuickPlayPosUnsnapped;
|
mLeftDownClickUnsnapped = mQuickPlayPosUnsnapped;
|
||||||
@ -2734,7 +2733,7 @@ void AdornedRulerPanel::HandleQPRelease(wxMouseEvent &evt)
|
|||||||
if (mPlayRegionLock) {
|
if (mPlayRegionLock) {
|
||||||
// Restore Locked Play region
|
// Restore Locked Play region
|
||||||
SetPlayRegion(mOldPlayRegionStart, mOldPlayRegionEnd);
|
SetPlayRegion(mOldPlayRegionStart, mOldPlayRegionEnd);
|
||||||
mProject->OnLockPlayRegion();
|
mProject->OnLockPlayRegion(*mProject);
|
||||||
// and release local lock
|
// and release local lock
|
||||||
mPlayRegionLock = false;
|
mPlayRegionLock = false;
|
||||||
}
|
}
|
||||||
@ -2845,10 +2844,10 @@ void AdornedRulerPanel::UpdateStatusBarAndTooltips(StatusChoice choice)
|
|||||||
// This version toggles ruler state indirectly via the scrubber
|
// This version toggles ruler state indirectly via the scrubber
|
||||||
// to ensure that all the places where the state is shown update.
|
// to ensure that all the places where the state is shown update.
|
||||||
// For example buttons and menus must update.
|
// For example buttons and menus must update.
|
||||||
void AdornedRulerPanel::OnToggleScrubRulerFromMenu(wxCommandEvent& Evt)
|
void AdornedRulerPanel::OnToggleScrubRulerFromMenu(wxCommandEvent&)
|
||||||
{
|
{
|
||||||
auto &scrubber = mProject->GetScrubber();
|
auto &scrubber = mProject->GetScrubber();
|
||||||
scrubber.OnToggleScrubRuler( Evt );
|
scrubber.OnToggleScrubRuler(*mProject);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AdornedRulerPanel::OnToggleScrubRuler(/*wxCommandEvent&*/)
|
void AdornedRulerPanel::OnToggleScrubRuler(/*wxCommandEvent&*/)
|
||||||
@ -2903,7 +2902,7 @@ void AdornedRulerPanel::UpdateButtonStates()
|
|||||||
|
|
||||||
void AdornedRulerPanel::OnTogglePinnedState(wxCommandEvent & /*event*/)
|
void AdornedRulerPanel::OnTogglePinnedState(wxCommandEvent & /*event*/)
|
||||||
{
|
{
|
||||||
mProject->OnTogglePinnedHead();
|
mProject->OnTogglePinnedHead(*mProject);
|
||||||
UpdateButtonStates();
|
UpdateButtonStates();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3042,9 +3041,9 @@ void AdornedRulerPanel::OnAutoScroll(wxCommandEvent&)
|
|||||||
void AdornedRulerPanel::OnLockPlayRegion(wxCommandEvent&)
|
void AdornedRulerPanel::OnLockPlayRegion(wxCommandEvent&)
|
||||||
{
|
{
|
||||||
if (mProject->IsPlayRegionLocked())
|
if (mProject->IsPlayRegionLocked())
|
||||||
mProject->OnUnlockPlayRegion();
|
mProject->OnUnlockPlayRegion(*mProject);
|
||||||
else
|
else
|
||||||
mProject->OnLockPlayRegion();
|
mProject->OnLockPlayRegion(*mProject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user