mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-29 14:48:39 +02:00
Add two new commands for selecting a time range using the keyboard
The new commands are "Save Cursor Position" and "(Select) Cursor to Saved Cursor Position"
This commit is contained in:
parent
4ec7044639
commit
cc24472d09
@ -558,6 +558,9 @@ void AudacityProject::CreateMenusAndCommands()
|
||||
|
||||
c->AddItem(wxT("SelStartCursor"), _("Track &Start to Cursor"), FN(OnSelectStartCursor), wxT("Shift+J"));
|
||||
c->AddItem(wxT("SelCursorEnd"), _("Cursor to Track &End"), FN(OnSelectCursorEnd), wxT("Shift+K"));
|
||||
c->AddItem(wxT("SelCursorSavedCursor"), _("Cursor to Saved &Cursor Position"), FN(OnSelectCursorSavedCursor),
|
||||
wxT(""), TracksExistFlag, TracksExistFlag);
|
||||
|
||||
|
||||
c->AddSeparator();
|
||||
|
||||
@ -600,6 +603,9 @@ void AudacityProject::CreateMenusAndCommands()
|
||||
c->AddItem(wxT("SelRestore"), _("Regio&n Restore"), FN(OnSelectionRestore),
|
||||
TracksExistFlag,
|
||||
TracksExistFlag);
|
||||
c->AddItem(wxT("SaveCursorPosition"), _("Save Cursor Pos&ition"), FN(OnCursorPositionSave),
|
||||
WaveTracksExistFlag,
|
||||
WaveTracksExistFlag);
|
||||
|
||||
c->AddSeparator();
|
||||
|
||||
@ -5170,6 +5176,14 @@ void AudacityProject::OnSelectStartCursor()
|
||||
mTrackPanel->Refresh(false);
|
||||
}
|
||||
|
||||
void AudacityProject::OnSelectCursorSavedCursor()
|
||||
{
|
||||
if (mCursorPositionHasBeenSaved) {
|
||||
mViewInfo.selectedRegion.setT0(std::min(mViewInfo.selectedRegion.t0(), mCursorPositionSaved));
|
||||
mViewInfo.selectedRegion.setT1(std::max(mViewInfo.selectedRegion.t1(), mCursorPositionSaved));
|
||||
}
|
||||
}
|
||||
|
||||
void AudacityProject::OnSelectSyncLockSel()
|
||||
{
|
||||
bool selected = false;
|
||||
@ -5886,6 +5900,12 @@ void AudacityProject::OnSelectionSave()
|
||||
mRegionSave = mViewInfo.selectedRegion;
|
||||
}
|
||||
|
||||
void AudacityProject::OnCursorPositionSave()
|
||||
{
|
||||
mCursorPositionSaved = mViewInfo.selectedRegion.t0();
|
||||
mCursorPositionHasBeenSaved = true;
|
||||
}
|
||||
|
||||
void AudacityProject::OnSelectionRestore()
|
||||
{
|
||||
if ((mRegionSave.t0() == 0.0) &&
|
||||
|
@ -270,6 +270,7 @@ void OnNextLowerPeakFrequency();
|
||||
#endif
|
||||
void OnSelectCursorEnd();
|
||||
void OnSelectStartCursor();
|
||||
void OnSelectCursorSavedCursor();
|
||||
void OnSelectSyncLockSel();
|
||||
void OnSelectAllTracks();
|
||||
|
||||
@ -346,9 +347,12 @@ void HandleMixAndRender(bool toNewTrack);
|
||||
|
||||
private:
|
||||
SelectedRegion mRegionSave{};
|
||||
bool mCursorPositionHasBeenSaved{false};
|
||||
double mCursorPositionSaved;
|
||||
public:
|
||||
void OnSelectionSave();
|
||||
void OnSelectionRestore();
|
||||
void OnCursorPositionSave();
|
||||
|
||||
void OnCursorTrackStart();
|
||||
void OnCursorTrackEnd();
|
||||
|
Loading…
x
Reference in New Issue
Block a user