Audacity 3.2.0
Functions | Variables
anonymous_namespace{WaveTrackAffordanceControls.cpp} Namespace Reference

Functions

auto FindAffordance (WaveTrack &track)
 
std::pair< WaveTrack *, ChannelGroup::IntervalIterator< WaveTrack::Interval > > SelectedIntervalOfFocusedTrack (AudacityProject &project)
 
const ReservedCommandFlagSomeClipIsSelectedFlag ()
 
const ReservedCommandFlagStretchedClipIsSelectedFlag ()
 
void SelectInterval (AudacityProject &project, const WaveTrack::Interval &interval)
 
void OnEditClipName (const CommandContext &context)
 
void OnChangeClipSpeed (const CommandContext &context)
 
void OnRenderClipStretching (const CommandContext &context)
 

Variables

AttachedItem sAttachment
 
AttachedItem sAttachment2
 
AttachedItem sAttachment3
 

Function Documentation

◆ FindAffordance()

auto anonymous_namespace{WaveTrackAffordanceControls.cpp}::FindAffordance ( WaveTrack track)

Definition at line 356 of file WaveTrackAffordanceControls.cpp.

357{
358 auto &view = ChannelView::Get(track);
359 auto pAffordance = view.GetAffordanceControls();
360 return std::dynamic_pointer_cast<WaveTrackAffordanceControls>(
361 pAffordance );
362}
static ChannelView & Get(Channel &channel)

References ChannelView::Get().

Referenced by OnChangeClipSpeed(), OnEditClipName(), OnRenderClipStretching(), and SelectedIntervalOfFocusedTrack().

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

◆ OnChangeClipSpeed()

void anonymous_namespace{WaveTrackAffordanceControls.cpp}::OnChangeClipSpeed ( const CommandContext context)

Definition at line 685 of file WaveTrackAffordanceControls.cpp.

686{
687 auto& project = context.project;
688
689 if (
690 auto pWaveTrack =
691 dynamic_cast<WaveTrack*>(TrackFocus::Get(project).Get()))
692 {
693 if (auto pAffordance = FindAffordance(*pWaveTrack))
694 pAffordance->StartEditSelectedClipSpeed(project);
695 }
696}
const auto project
AudacityProject & project
Track * Get()
Definition: TrackFocus.cpp:156
A Track that contains audio waveform data.
Definition: WaveTrack.h:222
Services * Get()
Fetch the global instance, or nullptr if none is yet installed.
Definition: BasicUI.cpp:196

References FindAffordance(), BasicUI::Get(), TrackFocus::Get(), CommandContext::project, and project.

Here is the call graph for this function:

◆ OnEditClipName()

void anonymous_namespace{WaveTrackAffordanceControls.cpp}::OnEditClipName ( const CommandContext context)

Definition at line 670 of file WaveTrackAffordanceControls.cpp.

671{
672 auto &project = context.project;
673
674 if(auto pWaveTrack = dynamic_cast<WaveTrack *>(TrackFocus::Get(project).Get()))
675 {
676 if(auto pAffordance = FindAffordance(*pWaveTrack))
677 {
678 pAffordance->StartEditSelectedClipName(project);
679 // Refresh so the cursor appears
681 }
682 }
683}
static TrackPanel & Get(AudacityProject &project)
Definition: TrackPanel.cpp:233
void RefreshTrack(Track *trk, bool refreshbacking=true)
Definition: TrackPanel.cpp:764

References FindAffordance(), BasicUI::Get(), TrackFocus::Get(), TrackPanel::Get(), CommandContext::project, project, and TrackPanel::RefreshTrack().

Here is the call graph for this function:

◆ OnRenderClipStretching()

void anonymous_namespace{WaveTrackAffordanceControls.cpp}::OnRenderClipStretching ( const CommandContext context)

Definition at line 698 of file WaveTrackAffordanceControls.cpp.

699{
700 auto& project = context.project;
701
702 if (
703 auto pWaveTrack =
704 dynamic_cast<WaveTrack*>(TrackFocus::Get(project).Get()))
705 {
706 if (auto pAffordance = FindAffordance(*pWaveTrack))
707 pAffordance->OnRenderClipStretching(project);
708 }
709}

References FindAffordance(), BasicUI::Get(), TrackFocus::Get(), CommandContext::project, and project.

Here is the call graph for this function:

◆ SelectedIntervalOfFocusedTrack()

std::pair< WaveTrack *, ChannelGroup::IntervalIterator< WaveTrack::Interval > > anonymous_namespace{WaveTrackAffordanceControls.cpp}::SelectedIntervalOfFocusedTrack ( AudacityProject project)

Definition at line 365 of file WaveTrackAffordanceControls.cpp.

366{
367 // Note that TrackFocus may change its state as a side effect, defining
368 // a track focus if there was none
369 if (auto pWaveTrack =
370 dynamic_cast<WaveTrack *>(TrackFocus::Get(project).Get())) {
371 if (FindAffordance(*pWaveTrack)) {
372 auto &viewInfo = ViewInfo::Get(project);
373 auto intervals = pWaveTrack->Intervals();
374
375 auto it = std::find_if(intervals.begin(), intervals.end(), [&](const auto& interval)
376 {
377 return interval->Start() == viewInfo.selectedRegion.t0() &&
378 interval->End() == viewInfo.selectedRegion.t1();
379 });
380
381 if(it != intervals.end())
382 return { pWaveTrack, it };
383 }
384 }
385 return {};
386}
static ViewInfo & Get(AudacityProject &project)
Definition: ViewInfo.cpp:235

References FindAffordance(), BasicUI::Get(), TrackFocus::Get(), ViewInfo::Get(), and project.

Referenced by WaveTrackAffordanceControls::OnRenderClipStretching(), SomeClipIsSelectedFlag(), WaveTrackAffordanceControls::StartEditSelectedClipName(), WaveTrackAffordanceControls::StartEditSelectedClipSpeed(), and StretchedClipIsSelectedFlag().

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

◆ SelectInterval()

void anonymous_namespace{WaveTrackAffordanceControls.cpp}::SelectInterval ( AudacityProject project,
const WaveTrack::Interval interval 
)

Definition at line 592 of file WaveTrackAffordanceControls.cpp.

593{
594 auto& viewInfo = ViewInfo::Get(project);
595 viewInfo.selectedRegion.setTimes(interval.GetPlayStartTime(), interval.GetPlayEndTime());
597}
void ModifyState(bool bWantsAutoSave)
static ProjectHistory & Get(AudacityProject &project)
double GetPlayStartTime() const
Definition: WaveTrack.cpp:393
double GetPlayEndTime() const
Definition: WaveTrack.cpp:399

References ProjectHistory::Get(), ViewInfo::Get(), WaveTrack::Interval::GetPlayEndTime(), WaveTrack::Interval::GetPlayStartTime(), ProjectHistory::ModifyState(), and project.

Referenced by WaveTrackAffordanceControls::OnRenderClipStretching(), and WaveTrackAffordanceControls::StartEditSelectedClipSpeed().

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

◆ SomeClipIsSelectedFlag()

const ReservedCommandFlag & anonymous_namespace{WaveTrackAffordanceControls.cpp}::SomeClipIsSelectedFlag ( )

Definition at line 389 of file WaveTrackAffordanceControls.cpp.

390{
392 [](const AudacityProject &project){
393 // const_cast isn't pretty but not harmful in this case
394 return SelectedIntervalOfFocusedTrack(const_cast<AudacityProject&>(project)).first != nullptr;
395 }
396 };
397 return flag;
398}
static std::once_flag flag
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:90
std::pair< WaveTrack *, ChannelGroup::IntervalIterator< WaveTrack::Interval > > SelectedIntervalOfFocusedTrack(AudacityProject &project)

References flag, project, and SelectedIntervalOfFocusedTrack().

Here is the call graph for this function:

◆ StretchedClipIsSelectedFlag()

const ReservedCommandFlag & anonymous_namespace{WaveTrackAffordanceControls.cpp}::StretchedClipIsSelectedFlag ( )

Definition at line 400 of file WaveTrackAffordanceControls.cpp.

401{
403 [](const AudacityProject &project){
404 // const_cast isn't pretty but not harmful in this case
405 auto result = SelectedIntervalOfFocusedTrack(
406 const_cast<AudacityProject&>(project));
407
408 auto interval = *result.second;
409 return interval != nullptr && !interval->StretchRatioEquals(1.0);
410 }
411 };
412 return flag;
413}

References flag, project, and SelectedIntervalOfFocusedTrack().

Here is the call graph for this function:

Variable Documentation

◆ sAttachment

AttachedItem anonymous_namespace{WaveTrackAffordanceControls.cpp}::sAttachment
Initial value:
{
Command( L"RenameClip", XXO("&Rename Clip..."),
wxT("Edit/Other/Clip")
}
wxT("CloseDown"))
XXO("&Cut/Copy/Paste Toolbar")
constexpr auto Command
Definition: MenuRegistry.h:456

Definition at line 715 of file WaveTrackAffordanceControls.cpp.

◆ sAttachment2

AttachedItem anonymous_namespace{WaveTrackAffordanceControls.cpp}::sAttachment2
Initial value:
{
Command( L"ChangeClipSpeed", XXO("Change &Speed..."),
wxT("Edit/Other/Clip")
}

Definition at line 721 of file WaveTrackAffordanceControls.cpp.

◆ sAttachment3

AttachedItem anonymous_namespace{WaveTrackAffordanceControls.cpp}::sAttachment3
Initial value:
{
Command( L"RenderClipStretching", XXO("Render Clip S&tretching"),
wxT("Edit/Other/Clip")
}

Definition at line 727 of file WaveTrackAffordanceControls.cpp.