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 420 of file SelectMenus.cpp.

Constructor & Destructor Documentation

◆ Handler() [1/2]

SelectActions::Handler::Handler ( )
inline

Definition at line 914 of file SelectMenus.cpp.

915{
916 UpdatePrefs();
917}
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 838 of file SelectMenus.cpp.

839{
840 if( !OnlyHandleKeyUp( context ) )
842 mSeekInfo );
843}
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 864 of file SelectMenus.cpp.

865{
866 DoCursorMove( context.project,
867 -mSeekInfo.mSeekLong, mSeekInfo.mLastSelectionAdjustment );
868}
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 870 of file SelectMenus.cpp.

871{
872 DoCursorMove( context.project,
873 mSeekInfo.mSeekLong, mSeekInfo.mLastSelectionAdjustment );
874}

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 607 of file SelectMenus.cpp.

608{
609 auto &project = context.project;
610 auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
611 auto isAudioActive = ProjectAudioIO::Get( project ).IsAudioActive();
612
613 auto gAudioIO = AudioIO::Get();
615 isAudioActive ? gAudioIO->GetStreamTime() : selectedRegion.t0();
617}
const auto project
static AudioIO * Get()
Definition: AudioIO.cpp:126
bool IsAudioActive() const
static ProjectAudioIO & Get(AudacityProject &project)
NotifyingSelectedRegion selectedRegion
Definition: ViewInfo.h:215
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 845 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 755 of file SelectMenus.cpp.

756{
757 auto &project = context.project;
758 auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
759 auto &viewport = Viewport::Get(project);
760
761 selectedRegion.collapseToT1();
763 viewport.ScrollIntoView(selectedRegion.t1());
764}
void ModifyState(bool bWantsAutoSave)
static ProjectHistory & Get(AudacityProject &project)
static Viewport & Get(AudacityProject &project)
Definition: Viewport.cpp:32

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 744 of file SelectMenus.cpp.

745{
746 auto &project = context.project;
747 auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
748 auto &viewport = Viewport::Get(project);
749
750 selectedRegion.collapseToT0();
752 viewport.ScrollIntoView(selectedRegion.t0());
753}

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 852 of file SelectMenus.cpp.

853{
854 DoCursorMove( context.project,
855 -mSeekInfo.mSeekShort, mSeekInfo.mLastSelectionAdjustment );
856}

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 858 of file SelectMenus.cpp.

859{
860 DoCursorMove( context.project,
861 mSeekInfo.mSeekShort, mSeekInfo.mLastSelectionAdjustment );
862}

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 792 of file SelectMenus.cpp.

793{
794 auto &project = context.project;
796 auto &selectedRegion = ViewInfo::Get(project).selectedRegion;
797 auto &viewport = Viewport::Get(project);
798
799 double kWayOverToLeft = std::numeric_limits<double>::lowest();
800
801 auto trackRange = tracks.Selected() + &Track::SupportsBasicEditing;
802 if (trackRange.empty())
803 // This should have been prevented by command manager
804 return;
805
806 // Range is surely nonempty now
807 auto maxEndOffset = trackRange.max(&Track::GetEndTime);
808
809 if( maxEndOffset <
810 (kWayOverToLeft * (1 - std::numeric_limits<double>::epsilon()) ))
811 return;
812
813 selectedRegion.setTimes(maxEndOffset, maxEndOffset);
815 viewport.ScrollIntoView(selectedRegion.t1());
816}
const auto tracks
double GetEndTime() const
Get the maximum of End() values of intervals, or 0 when none.
Definition: Channel.cpp:135
virtual bool SupportsBasicEditing() const
Whether this track type implements cut-copy-paste; by default, true.
Definition: Track.cpp:1213
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:347

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 766 of file SelectMenus.cpp.

767{
768 auto &project = context.project;
770 auto &selectedRegion = ViewInfo::Get(project).selectedRegion;
771 auto &viewport = Viewport::Get(project);
772
773 double kWayOverToRight = std::numeric_limits<double>::max();
774
775 auto trackRange = tracks.Selected() + &Track::SupportsBasicEditing;
776 if (trackRange.empty())
777 // This should have been prevented by command manager
778 return;
779
780 // Range is surely nonempty now
781 auto minOffset = std::max(0.0, trackRange.min(&Track::GetStartTime));
782
783 if( minOffset >=
784 (kWayOverToRight * (1 - std::numeric_limits<double>::epsilon()) ))
785 return;
786
787 selectedRegion.setTimes(minOffset, minOffset);
789 viewport.ScrollIntoView(selectedRegion.t0());
790}
double GetStartTime() const
Get the minimum of Start() values of intervals, or 0 when none.
Definition: Channel.cpp:124

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 888 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 876 of file SelectMenus.cpp.

877{
878 auto &project = context.project;
880}

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 894 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 882 of file SelectMenus.cpp.

883{
884 auto &project = context.project;
886}

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 730 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 737 of file SelectMenus.cpp.

738{
739 if( !OnlyHandleKeyUp( context ) )
741 mSeekInfo );
742}

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 426 of file SelectMenus.cpp.

427{
428 auto& trackPanel = TrackPanel::Get(context.project);
429 auto& tracks = TrackList::Get(context.project);
430
431 for (auto lt : tracks.Selected<LabelTrack>()) {
432 auto& view = LabelTrackView::Get(*lt);
433 if (view.SelectAllText(context.project)) {
434 trackPanel.Refresh(false);
435 return;
436 }
437 }
438
439 //Presumably, there might be not more than one track
440 //that expects text input
441 for (auto wt : tracks.Any<WaveTrack>()) {
442 auto& view = WaveChannelView::Get(*wt);
443 if (view.SelectAllText(context.project)) {
444 trackPanel.Refresh(false);
445 return;
446 }
447 }
448
450}
A LabelTrack is a Track that holds labels (LabelStruct).
Definition: LabelTrack.h:87
static LabelTrackView & Get(LabelTrack &)
static TrackPanel & Get(AudacityProject &project)
Definition: TrackPanel.cpp:233
static WaveChannelView & Get(WaveChannel &channel)
A Track that contains audio waveform data.
Definition: WaveTrack.h:222
void DoSelectAll(AudacityProject &project)

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

Here is the call graph for this function:

◆ OnSelectAllTime()

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

Definition at line 902 of file SelectMenus.cpp.

903{
904 auto &project = context.project;
906}
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 462 of file SelectMenus.cpp.

463{
464 auto &project = context.project;
466}

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 518 of file SelectMenus.cpp.

519{
520 auto &project = context.project;
522 auto &selectedRegion = ViewInfo::Get(project).selectedRegion;
523
524 double kWayOverToLeft = std::numeric_limits<double>::lowest();
525
526 auto range = tracks.Selected();
527 if (!range)
528 return;
529
530 double maxEndOffset = range.max(&Track::GetEndTime);
531
532 if( maxEndOffset <=
533 (kWayOverToLeft * (1 - std::numeric_limits<double>::epsilon()) ))
534 return;
535
536 selectedRegion.setT1(maxEndOffset);
538}

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 588 of file SelectMenus.cpp.

589{
590 auto &project = context.project;
591 auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
592 auto isAudioActive = ProjectAudioIO::Get( project ).IsAudioActive();
593
595 auto gAudioIO = AudioIO::Get();
596 double cursorPositionCurrent = isAudioActive
597 ? gAudioIO->GetStreamTime()
598 : selectedRegion.t0();
599 selectedRegion.setTimes(
600 std::min(cursorPositionCurrent, mCursorPositionStored),
601 std::max(cursorPositionCurrent, mCursorPositionStored));
602
604 }
605}
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 568 of file SelectMenus.cpp.

569{
570 auto &project = context.project;
571 auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
572 auto &viewport = Viewport::Get(project);
573
574 if ((mRegionSave.t0() == 0.0) &&
575 (mRegionSave.t1() == 0.0))
576 return;
577
578 selectedRegion = mRegionSave;
579 viewport.ScrollIntoView(selectedRegion.t0());
580
582}
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 560 of file SelectMenus.cpp.

561{
562 auto &project = context.project;
563 auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
564
565 mRegionSave = selectedRegion;
566}

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 452 of file SelectMenus.cpp.

453{
454 auto &project = context.project;
455 auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
456
457 selectedRegion.collapseToT0();
460}
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 496 of file SelectMenus.cpp.

497{
498 auto &project = context.project;
500 auto &selectedRegion = ViewInfo::Get(project).selectedRegion;
501
502 double kWayOverToRight = std::numeric_limits<double>::max();
503
504 auto range = tracks.Selected();
505 if (!range)
506 return;
507
508 double minOffset = range.min(&Track::GetStartTime);
509
510 if( minOffset >=
511 (kWayOverToRight * (1 - std::numeric_limits<double>::epsilon()) ))
512 return;
513
514 selectedRegion.setT0(minOffset);
516}

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 468 of file SelectMenus.cpp.

469{
470 auto &project = context.project;
471 auto &tracks = TrackList::Get( project );
472
473 bool selected = false;
474 for (auto t : tracks.Any() + &Track::SupportsBasicEditing
476 t->SetSelected(true);
477 selected = true;
478 }
479
480 if (selected)
482}
static bool IsSyncLockSelected(const Track *pTrack)
Definition: SyncLock.cpp:82
bool IsSelected() const
Definition: Track.cpp:288

References ProjectHistory::Get(), TrackList::Get(), Track::IsSelected(), SyncLock::IsSyncLockSelected(), 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 540 of file SelectMenus.cpp.

541{
542 auto &project = context.project;
543 auto &viewInfo = ViewInfo::Get(project);
545
546 auto range = tracks.Selected();
547 double maxEndOffset = range.max(&Track::GetEndTime);
548 double minOffset = range.min(&Track::GetStartTime);
549
550 if( maxEndOffset < minOffset)
551 return;
552
553 viewInfo.selectedRegion.setTimes(minOffset, maxEndOffset);
555}

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 706 of file SelectMenus.cpp.

707{
708 if( !OnlyHandleKeyUp( context ) )
710 mSeekInfo );
711}

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 713 of file SelectMenus.cpp.

714{
715 if( !OnlyHandleKeyUp( context ) )
717 mSeekInfo );
718}

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 720 of file SelectMenus.cpp.

721{
723}
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 725 of file SelectMenus.cpp.

726{
728}

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 695 of file SelectMenus.cpp.

696{
697 auto &project = context.project;
698 auto &viewport = Viewport::Get(project);
699 viewport.ScrollToEnd(true);
701}

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 687 of file SelectMenus.cpp.

688{
689 auto &project = context.project;
690 auto &viewport = Viewport::Get(project);
691 viewport.ScrollToStart(true);
693}

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 484 of file SelectMenus.cpp.

485{
487 true, true, XO("Set Left Selection Boundary"));
488}
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 490 of file SelectMenus.cpp.

491{
493 false, true, XO("Set Right Selection Boundary"));
494}

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 828 of file SelectMenus.cpp.

829{
830 auto &project = context.project;
831 wxCommandEvent evt;
832
833 auto &controlToolBar = ControlToolBar::Get( project );
834 controlToolBar.OnFF(evt);
836}
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 818 of file SelectMenus.cpp.

819{
820 auto &project = context.project;
821 wxCommandEvent evt;
822
823 auto &controlToolBar = ControlToolBar::Get( project );
824 controlToolBar.OnRewind(evt);
826}

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 675 of file SelectMenus.cpp.

676{
677 auto &project = context.project;
679}
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 669 of file SelectMenus.cpp.

670{
671 auto &project = context.project;
673}

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 681 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 619 of file SelectMenus.cpp.

620{
621 auto &project = context.project;
622 auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
623 const auto& tracks = TrackList::Get(project);
624
625 // Selecting precise sample indices across tracks that may have clips with
626 // various stretch ratios in itself is not possible. Even in single-track
627 // mode, we cannot know what the final waveform will look like until
628 // stretching is applied, making this operation futile. Hence we disallow
629 // it if any stretched clip is involved.
630 const auto projectRate = ProjectRate(project).GetRate();
631 const auto searchWindowDuration = GetWindowSize(projectRate) / projectRate;
632 const auto wouldSearchStretchedClip =
633 [searchWindowDuration](const WaveTrack& track, double t) {
634 const auto clips = track.GetClipsIntersecting(
635 t - searchWindowDuration / 2, t + searchWindowDuration / 2);
636 return std::any_of(
637 clips.begin(), clips.end(),
638 [](const std::shared_ptr<const WaveClip>& clip) {
639 return !clip->StretchRatioEquals(1);
640 });
641 };
642 const auto selected = tracks.Selected<const WaveTrack>();
643 if (std::any_of(
644 selected.begin(), selected.end(), [&](const WaveTrack* track) {
645 return wouldSearchStretchedClip(*track, selectedRegion.t0()) ||
646 wouldSearchStretchedClip(*track, selectedRegion.t1());
647 }))
648 {
649 using namespace BasicUI;
651 XO("Zero-crossing search regions intersect stretched clip(s)."),
652 MessageBoxOptions {}.Caption(XO("Error")).IconStyle(Icon::Error));
653 return;
654 }
655
656 const double t0 = NearestZeroCrossing(project, selectedRegion.t0());
657 if (selectedRegion.isPoint())
658 selectedRegion.setTimes(t0, t0);
659 else {
660 const double t1 = NearestZeroCrossing(project, selectedRegion.t1());
661 // Empty selection is generally not much use, so do not make it if empty.
662 if( fabs( t1 - t0 ) * ProjectRate::Get(project).GetRate() > 1.5 )
663 selectedRegion.setTimes(t0, t1);
664 }
665
667}
Holds project sample rate.
Definition: ProjectRate.h:24
static ProjectRate & Get(AudacityProject &project)
Definition: ProjectRate.cpp:28
double GetRate() const
Definition: ProjectRate.cpp:53
WaveClipConstHolders GetClipsIntersecting(double t0, double t1) const
Definition: WaveTrack.cpp:3701
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:277
double NearestZeroCrossing(AudacityProject &project, double t0)
Definition: SelectMenus.cpp:35
constexpr auto GetWindowSize(double projectRate)
Definition: SelectMenus.cpp:30
double GetRate(const Track &track)
Definition: TimeTrack.cpp:196
MessageBoxOptions && Caption(TranslatableString caption_) &&
Definition: BasicUI.h:101

References BasicUI::MessageBoxOptions::Caption(), ProjectHistory::Get(), ProjectRate::Get(), ViewInfo::Get(), TrackList::Get(), WaveTrack::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 909 of file SelectMenus.cpp.

910{
911 gPrefs->Read(wxT("/AudioIO/SeekShortPeriod"), &mSeekInfo.mSeekShort, 1.0);
912 gPrefs->Read(wxT("/AudioIO/SeekLongPeriod"), &mSeekInfo.mSeekLong, 15.0);
913}
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 585 of file SelectMenus.cpp.

Referenced by OnCursorPositionStore(), and OnSelectCursorStoredCursor().

◆ mCursorPositionStored

double SelectActions::Handler::mCursorPositionStored { 0.0 }

Definition at line 586 of file SelectMenus.cpp.

Referenced by OnCursorPositionStore(), and OnSelectCursorStoredCursor().

◆ mRegionSave

SelectedRegion SelectActions::Handler::mRegionSave {}

Definition at line 558 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: