Audacity 3.2.0
Public Member Functions | Public Attributes | List of all members
SelectActions::Handler Struct Reference
Inheritance diagram for SelectActions::Handler:
[legend]
Collaboration diagram for SelectActions::Handler:
[legend]

Public Member Functions

void OnSelectAll (const CommandContext &context)
 
void OnSelectNone (const CommandContext &context)
 
void OnSelectAllTracks (const CommandContext &context)
 
void OnSelectSyncLockSel (const CommandContext &context)
 
void OnSetLeftSelection (const CommandContext &context)
 
void OnSetRightSelection (const CommandContext &context)
 
void OnSelectStartCursor (const CommandContext &context)
 
void OnSelectCursorEnd (const CommandContext &context)
 
void OnSelectTrackStartToEnd (const CommandContext &context)
 
void OnSelectionSave (const CommandContext &context)
 
void OnSelectionRestore (const CommandContext &context)
 
void OnSelectCursorStoredCursor (const CommandContext &context)
 
void OnCursorPositionStore (const CommandContext &context)
 
void OnZeroCrossing (const CommandContext &context)
 
void OnSnapToOff (const CommandContext &context)
 
void OnSnapToNearest (const CommandContext &context)
 
void OnSnapToPrior (const CommandContext &context)
 
void OnSelToStart (const CommandContext &context)
 
void OnSelToEnd (const CommandContext &context)
 
void OnSelExtendLeft (const CommandContext &context)
 
void OnSelExtendRight (const CommandContext &context)
 
void OnSelSetExtendLeft (const CommandContext &context)
 
void OnSelSetExtendRight (const CommandContext &context)
 
void OnSelContractLeft (const CommandContext &context)
 
void OnSelContractRight (const CommandContext &context)
 
void OnCursorSelStart (const CommandContext &context)
 
void OnCursorSelEnd (const CommandContext &context)
 
void OnCursorTrackStart (const CommandContext &context)
 
void OnCursorTrackEnd (const CommandContext &context)
 
void OnSkipStart (const CommandContext &context)
 
void OnSkipEnd (const CommandContext &context)
 
void OnCursorLeft (const CommandContext &context)
 
void OnCursorRight (const CommandContext &context)
 
void OnCursorShortJumpLeft (const CommandContext &context)
 
void OnCursorShortJumpRight (const CommandContext &context)
 
void OnCursorLongJumpLeft (const CommandContext &context)
 
void OnCursorLongJumpRight (const CommandContext &context)
 
void OnSeekLeftShort (const CommandContext &context)
 
void OnSeekRightShort (const CommandContext &context)
 
void OnSeekLeftLong (const CommandContext &context)
 
void OnSeekRightLong (const CommandContext &context)
 
void OnSelectAllTime (const CommandContext &context)
 
void UpdatePrefs () override
 
 Handler ()
 
 Handler (const Handler &)=delete
 
Handleroperator= (const Handler &)=delete
 
- Public Member Functions inherited from ClientData::Base
virtual ~Base ()
 
- Public Member Functions inherited from PrefsListener
 PrefsListener ()
 
virtual ~PrefsListener ()
 
virtual void UpdatePrefs ()=0
 

Public Attributes

SelectedRegion mRegionSave {}
 
bool mCursorPositionHasBeenStored { false }
 
double mCursorPositionStored { 0.0 }
 
SeekInfo mSeekInfo
 

Additional Inherited Members

- Static Public Member Functions inherited from PrefsListener
static void Broadcast (int id=0)
 Call this static function to notify all PrefsListener objects. More...
 
- Protected Member Functions inherited from PrefsListener
virtual void UpdateSelectedPrefs (int id)
 

Detailed Description

Definition at line 433 of file SelectMenus.cpp.

Constructor & Destructor Documentation

◆ Handler() [1/2]

SelectActions::Handler::Handler ( )
inline

Definition at line 927 of file SelectMenus.cpp.

928{
929 UpdatePrefs();
930}
void UpdatePrefs() override

References UpdatePrefs().

Here is the call graph for this function:

◆ Handler() [2/2]

SelectActions::Handler::Handler ( const Handler )
delete

Member Function Documentation

◆ OnCursorLeft()

void SelectActions::Handler::OnCursorLeft ( const CommandContext context)
inline

Definition at line 851 of file SelectMenus.cpp.

852{
853 if( !OnlyHandleKeyUp( context ) )
855 mSeekInfo );
856}
AudacityProject & project
bool OnlyHandleKeyUp(const CommandContext &context)
void SeekLeftOrRight(AudacityProject &project, double direction, SelectionOperation operation, SeekInfo &info)

References anonymous_namespace{SelectMenus.cpp}::CURSOR_MOVE, anonymous_namespace{SelectMenus.cpp}::DIRECTION_LEFT, mSeekInfo, anonymous_namespace{SelectMenus.cpp}::OnlyHandleKeyUp(), CommandContext::project, and anonymous_namespace{SelectMenus.cpp}::SeekLeftOrRight().

Here is the call graph for this function:

◆ OnCursorLongJumpLeft()

void SelectActions::Handler::OnCursorLongJumpLeft ( const CommandContext context)
inline

Definition at line 877 of file SelectMenus.cpp.

878{
879 DoCursorMove( context.project,
880 -mSeekInfo.mSeekLong, mSeekInfo.mLastSelectionAdjustment );
881}
void DoCursorMove(AudacityProject &project, double seekStep, wxLongLong &lastSelectionAdjustment)

References anonymous_namespace{SelectMenus.cpp}::DoCursorMove(), mSeekInfo, and CommandContext::project.

Here is the call graph for this function:

◆ OnCursorLongJumpRight()

void SelectActions::Handler::OnCursorLongJumpRight ( const CommandContext context)
inline

Definition at line 883 of file SelectMenus.cpp.

884{
885 DoCursorMove( context.project,
886 mSeekInfo.mSeekLong, mSeekInfo.mLastSelectionAdjustment );
887}

References anonymous_namespace{SelectMenus.cpp}::DoCursorMove(), mSeekInfo, and CommandContext::project.

Here is the call graph for this function:

◆ OnCursorPositionStore()

void SelectActions::Handler::OnCursorPositionStore ( const CommandContext context)
inline

Definition at line 620 of file SelectMenus.cpp.

621{
622 auto &project = context.project;
623 auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
624 auto isAudioActive = ProjectAudioIO::Get( project ).IsAudioActive();
625
626 auto gAudioIO = AudioIO::Get();
628 isAudioActive ? gAudioIO->GetStreamTime() : selectedRegion.t0();
630}
const auto project
static AudioIO * Get()
Definition: AudioIO.cpp:126
bool IsAudioActive() const
static ProjectAudioIO & Get(AudacityProject &project)
NotifyingSelectedRegion selectedRegion
Definition: ViewInfo.h:216
static ViewInfo & Get(AudacityProject &project)
Definition: ViewInfo.cpp:235

References AudioIO::Get(), ProjectAudioIO::Get(), ViewInfo::Get(), ProjectAudioIO::IsAudioActive(), mCursorPositionHasBeenStored, mCursorPositionStored, CommandContext::project, project, and ViewInfo::selectedRegion.

Here is the call graph for this function:

◆ OnCursorRight()

void SelectActions::Handler::OnCursorRight ( const CommandContext context)
inline

Definition at line 858 of file SelectMenus.cpp.

References anonymous_namespace{SelectMenus.cpp}::CURSOR_MOVE, anonymous_namespace{SelectMenus.cpp}::DIRECTION_RIGHT, mSeekInfo, anonymous_namespace{SelectMenus.cpp}::OnlyHandleKeyUp(), CommandContext::project, and anonymous_namespace{SelectMenus.cpp}::SeekLeftOrRight().

Here is the call graph for this function:

◆ OnCursorSelEnd()

void SelectActions::Handler::OnCursorSelEnd ( const CommandContext context)
inline

Definition at line 768 of file SelectMenus.cpp.

769{
770 auto &project = context.project;
771 auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
772 auto &viewport = Viewport::Get(project);
773
774 selectedRegion.collapseToT1();
776 viewport.ScrollIntoView(selectedRegion.t1());
777}
void ModifyState(bool bWantsAutoSave)
static ProjectHistory & Get(AudacityProject &project)
static Viewport & Get(AudacityProject &project)
Definition: Viewport.cpp:33

References ProjectHistory::Get(), ViewInfo::Get(), Viewport::Get(), ProjectHistory::ModifyState(), CommandContext::project, project, and ViewInfo::selectedRegion.

Here is the call graph for this function:

◆ OnCursorSelStart()

void SelectActions::Handler::OnCursorSelStart ( const CommandContext context)
inline

Definition at line 757 of file SelectMenus.cpp.

758{
759 auto &project = context.project;
760 auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
761 auto &viewport = Viewport::Get(project);
762
763 selectedRegion.collapseToT0();
765 viewport.ScrollIntoView(selectedRegion.t0());
766}

References ProjectHistory::Get(), ViewInfo::Get(), Viewport::Get(), ProjectHistory::ModifyState(), CommandContext::project, project, and ViewInfo::selectedRegion.

Here is the call graph for this function:

◆ OnCursorShortJumpLeft()

void SelectActions::Handler::OnCursorShortJumpLeft ( const CommandContext context)
inline

Definition at line 865 of file SelectMenus.cpp.

866{
867 DoCursorMove( context.project,
868 -mSeekInfo.mSeekShort, mSeekInfo.mLastSelectionAdjustment );
869}

References anonymous_namespace{SelectMenus.cpp}::DoCursorMove(), mSeekInfo, and CommandContext::project.

Here is the call graph for this function:

◆ OnCursorShortJumpRight()

void SelectActions::Handler::OnCursorShortJumpRight ( const CommandContext context)
inline

Definition at line 871 of file SelectMenus.cpp.

872{
873 DoCursorMove( context.project,
874 mSeekInfo.mSeekShort, mSeekInfo.mLastSelectionAdjustment );
875}

References anonymous_namespace{SelectMenus.cpp}::DoCursorMove(), mSeekInfo, and CommandContext::project.

Here is the call graph for this function:

◆ OnCursorTrackEnd()

void SelectActions::Handler::OnCursorTrackEnd ( const CommandContext context)
inline

Definition at line 805 of file SelectMenus.cpp.

806{
807 auto &project = context.project;
809 auto &selectedRegion = ViewInfo::Get(project).selectedRegion;
810 auto &viewport = Viewport::Get(project);
811
812 double kWayOverToLeft = std::numeric_limits<double>::lowest();
813
814 auto trackRange = tracks.Selected() + &Track::SupportsBasicEditing;
815 if (trackRange.empty())
816 // This should have been prevented by command manager
817 return;
818
819 // Range is surely nonempty now
820 auto maxEndOffset = trackRange.max(&Track::GetEndTime);
821
822 if( maxEndOffset <
823 (kWayOverToLeft * (1 - std::numeric_limits<double>::epsilon()) ))
824 return;
825
826 selectedRegion.setTimes(maxEndOffset, maxEndOffset);
828 viewport.ScrollIntoView(selectedRegion.t1());
829}
const auto tracks
double GetEndTime() const
Get the maximum of End() values of intervals, or 0 when none.
Definition: Channel.cpp:61
virtual bool SupportsBasicEditing() const
Whether this track type implements cut-copy-paste; by default, true.
Definition: Track.cpp:797
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:314

References ProjectHistory::Get(), ViewInfo::Get(), TrackList::Get(), Viewport::Get(), ChannelGroup::GetEndTime(), ProjectHistory::ModifyState(), CommandContext::project, project, ViewInfo::selectedRegion, Track::SupportsBasicEditing(), and tracks.

Here is the call graph for this function:

◆ OnCursorTrackStart()

void SelectActions::Handler::OnCursorTrackStart ( const CommandContext context)
inline

Definition at line 779 of file SelectMenus.cpp.

780{
781 auto &project = context.project;
783 auto &selectedRegion = ViewInfo::Get(project).selectedRegion;
784 auto &viewport = Viewport::Get(project);
785
786 double kWayOverToRight = std::numeric_limits<double>::max();
787
788 auto trackRange = tracks.Selected() + &Track::SupportsBasicEditing;
789 if (trackRange.empty())
790 // This should have been prevented by command manager
791 return;
792
793 // Range is surely nonempty now
794 auto minOffset = std::max(0.0, trackRange.min(&Track::GetStartTime));
795
796 if( minOffset >=
797 (kWayOverToRight * (1 - std::numeric_limits<double>::epsilon()) ))
798 return;
799
800 selectedRegion.setTimes(minOffset, minOffset);
802 viewport.ScrollIntoView(selectedRegion.t0());
803}
double GetStartTime() const
Get the minimum of Start() values of intervals, or 0 when none.
Definition: Channel.cpp:50

References ProjectHistory::Get(), ViewInfo::Get(), TrackList::Get(), Viewport::Get(), ChannelGroup::GetStartTime(), ProjectHistory::ModifyState(), CommandContext::project, project, ViewInfo::selectedRegion, Track::SupportsBasicEditing(), and tracks.

Here is the call graph for this function:

◆ OnSeekLeftLong()

void SelectActions::Handler::OnSeekLeftLong ( const CommandContext context)
inline

Definition at line 901 of file SelectMenus.cpp.

References anonymous_namespace{SelectMenus.cpp}::DIRECTION_LEFT, mSeekInfo, CommandContext::project, project, anonymous_namespace{SelectMenus.cpp}::SeekLeftOrRight(), and anonymous_namespace{SelectMenus.cpp}::SELECTION_EXTEND.

Here is the call graph for this function:

◆ OnSeekLeftShort()

void SelectActions::Handler::OnSeekLeftShort ( const CommandContext context)
inline

Definition at line 889 of file SelectMenus.cpp.

890{
891 auto &project = context.project;
893}

References anonymous_namespace{SelectMenus.cpp}::CURSOR_MOVE, anonymous_namespace{SelectMenus.cpp}::DIRECTION_LEFT, mSeekInfo, CommandContext::project, project, and anonymous_namespace{SelectMenus.cpp}::SeekLeftOrRight().

Here is the call graph for this function:

◆ OnSeekRightLong()

void SelectActions::Handler::OnSeekRightLong ( const CommandContext context)
inline

Definition at line 907 of file SelectMenus.cpp.

References anonymous_namespace{SelectMenus.cpp}::DIRECTION_RIGHT, mSeekInfo, CommandContext::project, project, anonymous_namespace{SelectMenus.cpp}::SeekLeftOrRight(), and anonymous_namespace{SelectMenus.cpp}::SELECTION_EXTEND.

Here is the call graph for this function:

◆ OnSeekRightShort()

void SelectActions::Handler::OnSeekRightShort ( const CommandContext context)
inline

Definition at line 895 of file SelectMenus.cpp.

896{
897 auto &project = context.project;
899}

References anonymous_namespace{SelectMenus.cpp}::CURSOR_MOVE, anonymous_namespace{SelectMenus.cpp}::DIRECTION_RIGHT, mSeekInfo, CommandContext::project, project, and anonymous_namespace{SelectMenus.cpp}::SeekLeftOrRight().

Here is the call graph for this function:

◆ OnSelContractLeft()

void SelectActions::Handler::OnSelContractLeft ( const CommandContext context)
inline

Definition at line 743 of file SelectMenus.cpp.

References anonymous_namespace{SelectMenus.cpp}::DIRECTION_RIGHT, mSeekInfo, anonymous_namespace{SelectMenus.cpp}::OnlyHandleKeyUp(), CommandContext::project, anonymous_namespace{SelectMenus.cpp}::SeekLeftOrRight(), and anonymous_namespace{SelectMenus.cpp}::SELECTION_CONTRACT.

Here is the call graph for this function:

◆ OnSelContractRight()

void SelectActions::Handler::OnSelContractRight ( const CommandContext context)
inline

Definition at line 750 of file SelectMenus.cpp.

751{
752 if( !OnlyHandleKeyUp( context ) )
754 mSeekInfo );
755}

References anonymous_namespace{SelectMenus.cpp}::DIRECTION_LEFT, mSeekInfo, anonymous_namespace{SelectMenus.cpp}::OnlyHandleKeyUp(), CommandContext::project, anonymous_namespace{SelectMenus.cpp}::SeekLeftOrRight(), and anonymous_namespace{SelectMenus.cpp}::SELECTION_CONTRACT.

Here is the call graph for this function:

◆ OnSelectAll()

void SelectActions::Handler::OnSelectAll ( const CommandContext context)
inline

Definition at line 439 of file SelectMenus.cpp.

440{
441 auto& trackPanel = TrackPanel::Get(context.project);
442 auto& tracks = TrackList::Get(context.project);
443
444 for (auto lt : tracks.Selected<LabelTrack>()) {
445 auto& view = LabelTrackView::Get(*lt);
446 if (view.SelectAllText(context.project)) {
447 trackPanel.Refresh(false);
448 return;
449 }
450 }
451
452 //Presumably, there might be not more than one track
453 //that expects text input
454 for (auto wt : tracks.Any<WaveTrack>()) {
455 auto& view = WaveChannelView::GetFirst(*wt);
456 if (view.SelectAllText(context.project)) {
457 trackPanel.Refresh(false);
458 return;
459 }
460 }
461
463}
A LabelTrack is a Track that holds labels (LabelStruct).
Definition: LabelTrack.h:98
static LabelTrackView & Get(LabelTrack &)
static TrackPanel & Get(AudacityProject &project)
Definition: TrackPanel.cpp:234
static WaveChannelView & GetFirst(WaveTrack &wt)
Get the view of the first channel.
A Track that contains audio waveform data.
Definition: WaveTrack.h:203
void DoSelectAll(AudacityProject &project)

References SelectUtilities::DoSelectAll(), TrackList::Get(), TrackPanel::Get(), LabelTrackView::Get(), WaveChannelView::GetFirst(), CommandContext::project, and tracks.

Here is the call graph for this function:

◆ OnSelectAllTime()

void SelectActions::Handler::OnSelectAllTime ( const CommandContext context)
inline

Definition at line 915 of file SelectMenus.cpp.

916{
917 auto &project = context.project;
919}
void DoSelectTimeAndTracks(AudacityProject &project, bool bAllTime, bool bAllTracks)

References SelectUtilities::DoSelectTimeAndTracks(), CommandContext::project, and project.

Here is the call graph for this function:

◆ OnSelectAllTracks()

void SelectActions::Handler::OnSelectAllTracks ( const CommandContext context)
inline

Definition at line 475 of file SelectMenus.cpp.

476{
477 auto &project = context.project;
479}

References SelectUtilities::DoSelectTimeAndTracks(), CommandContext::project, and project.

Here is the call graph for this function:

◆ OnSelectCursorEnd()

void SelectActions::Handler::OnSelectCursorEnd ( const CommandContext context)
inline

Definition at line 531 of file SelectMenus.cpp.

532{
533 auto &project = context.project;
535 auto &selectedRegion = ViewInfo::Get(project).selectedRegion;
536
537 double kWayOverToLeft = std::numeric_limits<double>::lowest();
538
539 auto range = tracks.Selected();
540 if (!range)
541 return;
542
543 double maxEndOffset = range.max(&Track::GetEndTime);
544
545 if( maxEndOffset <=
546 (kWayOverToLeft * (1 - std::numeric_limits<double>::epsilon()) ))
547 return;
548
549 selectedRegion.setT1(maxEndOffset);
551}

References ProjectHistory::Get(), ViewInfo::Get(), TrackList::Get(), ChannelGroup::GetEndTime(), ProjectHistory::ModifyState(), CommandContext::project, project, ViewInfo::selectedRegion, and tracks.

Here is the call graph for this function:

◆ OnSelectCursorStoredCursor()

void SelectActions::Handler::OnSelectCursorStoredCursor ( const CommandContext context)
inline

Definition at line 601 of file SelectMenus.cpp.

602{
603 auto &project = context.project;
604 auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
605 auto isAudioActive = ProjectAudioIO::Get( project ).IsAudioActive();
606
608 auto gAudioIO = AudioIO::Get();
609 double cursorPositionCurrent = isAudioActive
610 ? gAudioIO->GetStreamTime()
611 : selectedRegion.t0();
612 selectedRegion.setTimes(
613 std::min(cursorPositionCurrent, mCursorPositionStored),
614 std::max(cursorPositionCurrent, mCursorPositionStored));
615
617 }
618}
int min(int a, int b)

References AudioIO::Get(), ProjectAudioIO::Get(), ProjectHistory::Get(), ViewInfo::Get(), ProjectAudioIO::IsAudioActive(), mCursorPositionHasBeenStored, mCursorPositionStored, min(), ProjectHistory::ModifyState(), CommandContext::project, project, and ViewInfo::selectedRegion.

Here is the call graph for this function:

◆ OnSelectionRestore()

void SelectActions::Handler::OnSelectionRestore ( const CommandContext context)
inline

Definition at line 581 of file SelectMenus.cpp.

582{
583 auto &project = context.project;
584 auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
585 auto &viewport = Viewport::Get(project);
586
587 if ((mRegionSave.t0() == 0.0) &&
588 (mRegionSave.t1() == 0.0))
589 return;
590
591 selectedRegion = mRegionSave;
592 viewport.ScrollIntoView(selectedRegion.t0());
593
595}
double t1() const
double t0() const
SelectedRegion mRegionSave

References ProjectHistory::Get(), ViewInfo::Get(), Viewport::Get(), ProjectHistory::ModifyState(), mRegionSave, CommandContext::project, project, ViewInfo::selectedRegion, SelectedRegion::t0(), and SelectedRegion::t1().

Here is the call graph for this function:

◆ OnSelectionSave()

void SelectActions::Handler::OnSelectionSave ( const CommandContext context)
inline

Definition at line 573 of file SelectMenus.cpp.

574{
575 auto &project = context.project;
576 auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
577
578 mRegionSave = selectedRegion;
579}

References ViewInfo::Get(), mRegionSave, CommandContext::project, project, and ViewInfo::selectedRegion.

Here is the call graph for this function:

◆ OnSelectNone()

void SelectActions::Handler::OnSelectNone ( const CommandContext context)
inline

Definition at line 465 of file SelectMenus.cpp.

466{
467 auto &project = context.project;
468 auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
469
470 selectedRegion.collapseToT0();
473}
void SelectNone(AudacityProject &project)

References NotifyingSelectedRegion::collapseToT0(), ProjectHistory::Get(), ViewInfo::Get(), ProjectHistory::ModifyState(), CommandContext::project, project, ViewInfo::selectedRegion, and SelectUtilities::SelectNone().

Here is the call graph for this function:

◆ OnSelectStartCursor()

void SelectActions::Handler::OnSelectStartCursor ( const CommandContext context)
inline

Definition at line 509 of file SelectMenus.cpp.

510{
511 auto &project = context.project;
513 auto &selectedRegion = ViewInfo::Get(project).selectedRegion;
514
515 double kWayOverToRight = std::numeric_limits<double>::max();
516
517 auto range = tracks.Selected();
518 if (!range)
519 return;
520
521 double minOffset = range.min(&Track::GetStartTime);
522
523 if( minOffset >=
524 (kWayOverToRight * (1 - std::numeric_limits<double>::epsilon()) ))
525 return;
526
527 selectedRegion.setT0(minOffset);
529}

References ProjectHistory::Get(), ViewInfo::Get(), TrackList::Get(), ChannelGroup::GetStartTime(), ProjectHistory::ModifyState(), CommandContext::project, project, ViewInfo::selectedRegion, and tracks.

Here is the call graph for this function:

◆ OnSelectSyncLockSel()

void SelectActions::Handler::OnSelectSyncLockSel ( const CommandContext context)
inline

Definition at line 481 of file SelectMenus.cpp.

482{
483 auto &project = context.project;
484 auto &tracks = TrackList::Get( project );
485
486 bool selected = false;
487 for (auto t : tracks.Any() + &Track::SupportsBasicEditing
489 t->SetSelected(true);
490 selected = true;
491 }
492
493 if (selected)
495}
static bool IsSyncLockSelectedP(const Track *pTrack)
Definition: SyncLock.h:51
bool IsSelected() const
Definition: Track.cpp:258

References ProjectHistory::Get(), TrackList::Get(), Track::IsSelected(), SyncLock::IsSyncLockSelectedP(), ProjectHistory::ModifyState(), CommandContext::project, project, Track::SupportsBasicEditing(), and tracks.

Here is the call graph for this function:

◆ OnSelectTrackStartToEnd()

void SelectActions::Handler::OnSelectTrackStartToEnd ( const CommandContext context)
inline

Definition at line 553 of file SelectMenus.cpp.

554{
555 auto &project = context.project;
556 auto &viewInfo = ViewInfo::Get(project);
558
559 auto range = tracks.Selected();
560 double maxEndOffset = range.max(&Track::GetEndTime);
561 double minOffset = range.min(&Track::GetStartTime);
562
563 if( maxEndOffset < minOffset)
564 return;
565
566 viewInfo.selectedRegion.setTimes(minOffset, maxEndOffset);
568}

References ProjectHistory::Get(), ViewInfo::Get(), TrackList::Get(), ChannelGroup::GetEndTime(), ChannelGroup::GetStartTime(), ProjectHistory::ModifyState(), CommandContext::project, project, and tracks.

Here is the call graph for this function:

◆ OnSelExtendLeft()

void SelectActions::Handler::OnSelExtendLeft ( const CommandContext context)
inline

Definition at line 719 of file SelectMenus.cpp.

720{
721 if( !OnlyHandleKeyUp( context ) )
723 mSeekInfo );
724}

References anonymous_namespace{SelectMenus.cpp}::DIRECTION_LEFT, mSeekInfo, anonymous_namespace{SelectMenus.cpp}::OnlyHandleKeyUp(), CommandContext::project, anonymous_namespace{SelectMenus.cpp}::SeekLeftOrRight(), and anonymous_namespace{SelectMenus.cpp}::SELECTION_EXTEND.

Here is the call graph for this function:

◆ OnSelExtendRight()

void SelectActions::Handler::OnSelExtendRight ( const CommandContext context)
inline

Definition at line 726 of file SelectMenus.cpp.

727{
728 if( !OnlyHandleKeyUp( context ) )
730 mSeekInfo );
731}

References anonymous_namespace{SelectMenus.cpp}::DIRECTION_RIGHT, mSeekInfo, anonymous_namespace{SelectMenus.cpp}::OnlyHandleKeyUp(), CommandContext::project, anonymous_namespace{SelectMenus.cpp}::SeekLeftOrRight(), and anonymous_namespace{SelectMenus.cpp}::SELECTION_EXTEND.

Here is the call graph for this function:

◆ OnSelSetExtendLeft()

void SelectActions::Handler::OnSelSetExtendLeft ( const CommandContext context)
inline

Definition at line 733 of file SelectMenus.cpp.

734{
736}
void DoBoundaryMove(AudacityProject &project, int step, SeekInfo &info)

References anonymous_namespace{SelectMenus.cpp}::DIRECTION_LEFT, anonymous_namespace{SelectMenus.cpp}::DoBoundaryMove(), mSeekInfo, and CommandContext::project.

Here is the call graph for this function:

◆ OnSelSetExtendRight()

void SelectActions::Handler::OnSelSetExtendRight ( const CommandContext context)
inline

Definition at line 738 of file SelectMenus.cpp.

739{
741}

References anonymous_namespace{SelectMenus.cpp}::DIRECTION_RIGHT, anonymous_namespace{SelectMenus.cpp}::DoBoundaryMove(), mSeekInfo, and CommandContext::project.

Here is the call graph for this function:

◆ OnSelToEnd()

void SelectActions::Handler::OnSelToEnd ( const CommandContext context)
inline

Definition at line 708 of file SelectMenus.cpp.

709{
710 auto &project = context.project;
711 auto &viewport = Viewport::Get(project);
712 viewport.ScrollToEnd(true);
714}

References ProjectHistory::Get(), Viewport::Get(), ProjectHistory::ModifyState(), CommandContext::project, and project.

Here is the call graph for this function:

◆ OnSelToStart()

void SelectActions::Handler::OnSelToStart ( const CommandContext context)
inline

Definition at line 700 of file SelectMenus.cpp.

701{
702 auto &project = context.project;
703 auto &viewport = Viewport::Get(project);
704 viewport.ScrollToStart(true);
706}

References ProjectHistory::Get(), Viewport::Get(), ProjectHistory::ModifyState(), CommandContext::project, and project.

Here is the call graph for this function:

◆ OnSetLeftSelection()

void SelectActions::Handler::OnSetLeftSelection ( const CommandContext context)
inline

Definition at line 497 of file SelectMenus.cpp.

498{
500 true, true, XO("Set Left Selection Boundary"));
501}
XO("Cut/Copy/Paste")
void OnSetRegion(AudacityProject &project, bool left, bool selection, const TranslatableString &dialogTitle)
Adjust left or right of selection or play region.

References SelectUtilities::OnSetRegion(), CommandContext::project, and XO().

Here is the call graph for this function:

◆ OnSetRightSelection()

void SelectActions::Handler::OnSetRightSelection ( const CommandContext context)
inline

Definition at line 503 of file SelectMenus.cpp.

504{
506 false, true, XO("Set Right Selection Boundary"));
507}

References SelectUtilities::OnSetRegion(), CommandContext::project, and XO().

Here is the call graph for this function:

◆ OnSkipEnd()

void SelectActions::Handler::OnSkipEnd ( const CommandContext context)
inline

Definition at line 841 of file SelectMenus.cpp.

842{
843 auto &project = context.project;
844 wxCommandEvent evt;
845
846 auto &controlToolBar = ControlToolBar::Get( project );
847 controlToolBar.OnFF(evt);
849}
static ControlToolBar & Get(AudacityProject &project)

References ProjectHistory::Get(), ControlToolBar::Get(), ProjectHistory::ModifyState(), CommandContext::project, and project.

Here is the call graph for this function:

◆ OnSkipStart()

void SelectActions::Handler::OnSkipStart ( const CommandContext context)
inline

Definition at line 831 of file SelectMenus.cpp.

832{
833 auto &project = context.project;
834 wxCommandEvent evt;
835
836 auto &controlToolBar = ControlToolBar::Get( project );
837 controlToolBar.OnRewind(evt);
839}

References ProjectHistory::Get(), ControlToolBar::Get(), ProjectHistory::ModifyState(), CommandContext::project, and project.

Here is the call graph for this function:

◆ OnSnapToNearest()

void SelectActions::Handler::OnSnapToNearest ( const CommandContext context)
inline

Definition at line 688 of file SelectMenus.cpp.

689{
690 auto &project = context.project;
692}
void SetSnapMode(SnapMode mode)
Definition: ProjectSnap.cpp:41
static ProjectSnap & Get(AudacityProject &project)
Definition: ProjectSnap.cpp:27

References ProjectSnap::Get(), CommandContext::project, project, ProjectSnap::SetSnapMode(), and SNAP_NEAREST.

Here is the call graph for this function:

◆ OnSnapToOff()

void SelectActions::Handler::OnSnapToOff ( const CommandContext context)
inline

Definition at line 682 of file SelectMenus.cpp.

683{
684 auto &project = context.project;
686}

References ProjectSnap::Get(), CommandContext::project, project, ProjectSnap::SetSnapMode(), and SNAP_OFF.

Here is the call graph for this function:

◆ OnSnapToPrior()

void SelectActions::Handler::OnSnapToPrior ( const CommandContext context)
inline

Definition at line 694 of file SelectMenus.cpp.

References ProjectSnap::Get(), CommandContext::project, project, ProjectSnap::SetSnapMode(), and SNAP_PRIOR.

Here is the call graph for this function:

◆ OnZeroCrossing()

void SelectActions::Handler::OnZeroCrossing ( const CommandContext context)
inline

Definition at line 632 of file SelectMenus.cpp.

633{
634 auto &project = context.project;
635 auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
636 const auto& tracks = TrackList::Get(project);
637
638 // Selecting precise sample indices across tracks that may have clips with
639 // various stretch ratios in itself is not possible. Even in single-track
640 // mode, we cannot know what the final waveform will look like until
641 // stretching is applied, making this operation futile. Hence we disallow
642 // it if any stretched clip is involved.
643 const auto projectRate = ProjectRate(project).GetRate();
644 const auto searchWindowDuration = GetWindowSize(projectRate) / projectRate;
645 const auto wouldSearchClipWithPitchOrSpeed =
646 [searchWindowDuration](const WaveTrack& track, double t) {
647 const auto clips = WaveTrackUtilities::GetClipsIntersecting(track,
648 t - searchWindowDuration / 2, t + searchWindowDuration / 2);
649 return any_of(
650 clips.begin(), clips.end(),
651 [](const auto& clip) { return clip->HasPitchOrSpeed(); });
652 };
653 const auto selected = tracks.Selected<const WaveTrack>();
654 if (std::any_of(
655 selected.begin(), selected.end(), [&](const WaveTrack* track) {
656 return wouldSearchClipWithPitchOrSpeed(
657 *track, selectedRegion.t0()) ||
658 wouldSearchClipWithPitchOrSpeed(
659 *track, selectedRegion.t1());
660 }))
661 {
662 using namespace BasicUI;
664 XO("Zero-crossing search regions intersect stretched clip(s)."),
665 MessageBoxOptions {}.Caption(XO("Error")).IconStyle(Icon::Error));
666 return;
667 }
668
669 const double t0 = NearestZeroCrossing(project, selectedRegion.t0());
670 if (selectedRegion.isPoint())
671 selectedRegion.setTimes(t0, t0);
672 else {
673 const double t1 = NearestZeroCrossing(project, selectedRegion.t1());
674 // Empty selection is generally not much use, so do not make it if empty.
675 if( fabs( t1 - t0 ) * ProjectRate::Get(project).GetRate() > 1.5 )
676 selectedRegion.setTimes(t0, t1);
677 }
678
680}
Holds project sample rate.
Definition: ProjectRate.h:24
static ProjectRate & Get(AudacityProject &project)
Definition: ProjectRate.cpp:28
double GetRate() const
Definition: ProjectRate.cpp:53
MessageBoxResult ShowMessageBox(const TranslatableString &message, MessageBoxOptions options={})
Show a modal message box with either Ok or Yes and No, and optionally Cancel.
Definition: BasicUI.h:287
WAVE_TRACK_API WaveTrack::IntervalConstHolders GetClipsIntersecting(const WaveTrack &track, double t0, double t1)
double NearestZeroCrossing(AudacityProject &project, double t0)
Definition: SelectMenus.cpp:36
constexpr auto GetWindowSize(double projectRate)
Definition: SelectMenus.cpp:31
double GetRate(const Track &track)
Definition: TimeTrack.cpp:182
MessageBoxOptions && Caption(TranslatableString caption_) &&
Definition: BasicUI.h:101

References BasicUI::MessageBoxOptions::Caption(), ProjectHistory::Get(), ProjectRate::Get(), ViewInfo::Get(), TrackList::Get(), WaveTrackUtilities::GetClipsIntersecting(), ProjectRate::GetRate(), anonymous_namespace{TimeTrack.cpp}::GetRate(), anonymous_namespace{SelectMenus.cpp}::GetWindowSize(), ProjectHistory::ModifyState(), anonymous_namespace{SelectMenus.cpp}::NearestZeroCrossing(), CommandContext::project, project, ViewInfo::selectedRegion, BasicUI::ShowMessageBox(), tracks, and XO().

Here is the call graph for this function:

◆ operator=()

Handler & SelectActions::Handler::operator= ( const Handler )
delete

◆ UpdatePrefs()

void SelectActions::Handler::UpdatePrefs ( )
inlineoverridevirtual

Implements PrefsListener.

Definition at line 922 of file SelectMenus.cpp.

923{
924 gPrefs->Read(wxT("/AudioIO/SeekShortPeriod"), &mSeekInfo.mSeekShort, 1.0);
925 gPrefs->Read(wxT("/AudioIO/SeekLongPeriod"), &mSeekInfo.mSeekLong, 15.0);
926}
wxT("CloseDown"))
audacity::BasicSettings * gPrefs
Definition: Prefs.cpp:68
virtual bool Read(const wxString &key, bool *value) const =0

References gPrefs, mSeekInfo, audacity::BasicSettings::Read(), and wxT().

Referenced by Handler().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ mCursorPositionHasBeenStored

bool SelectActions::Handler::mCursorPositionHasBeenStored { false }

Definition at line 598 of file SelectMenus.cpp.

Referenced by OnCursorPositionStore(), and OnSelectCursorStoredCursor().

◆ mCursorPositionStored

double SelectActions::Handler::mCursorPositionStored { 0.0 }

Definition at line 599 of file SelectMenus.cpp.

Referenced by OnCursorPositionStore(), and OnSelectCursorStoredCursor().

◆ mRegionSave

SelectedRegion SelectActions::Handler::mRegionSave {}

Definition at line 571 of file SelectMenus.cpp.

Referenced by OnSelectionRestore(), and OnSelectionSave().

◆ mSeekInfo

SeekInfo SelectActions::Handler::mSeekInfo

The documentation for this struct was generated from the following file: