Audacity 3.2.0
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
NotifyingSelectedRegion Class Reference

#include <ViewInfo.h>

Inheritance diagram for NotifyingSelectedRegion:
[legend]
Collaboration diagram for NotifyingSelectedRegion:
[legend]

Public Member Functions

double t0 () const
 
double t1 () const
 
double f0 () const
 
double f1 () const
 
double fc () const
 
bool isPoint () const
 
double duration () const
 
void WriteXMLAttributes (XMLWriter &xmlFile, const char *legacyT0Name, const char *legacyT1Name) const
 
 operator const SelectedRegion & () const
 
NotifyingSelectedRegionoperator= (const SelectedRegion &other)
 
bool setTimes (double t0, double t1)
 
bool setT0 (double t, bool maySwap=true)
 
bool setT1 (double t, bool maySwap=true)
 
void collapseToT0 ()
 
void collapseToT1 ()
 
void move (double delta)
 
bool setFrequencies (double f0, double f1)
 
bool setF0 (double f, bool maySwap=true)
 
bool setF1 (double f, bool maySwap=true)
 
- Public Member Functions inherited from Observer::Publisher< NotifyingSelectedRegionMessage >
 Publisher (ExceptionPolicy *pPolicy=nullptr, Alloc a={})
 Constructor supporting type-erased custom allocation/deletion. More...
 
 Publisher (Publisher &&)=default
 
Publisheroperator= (Publisher &&)=default
 
Subscription Subscribe (Callback callback)
 Connect a callback to the Publisher; later-connected are called earlier. More...
 
Subscription Subscribe (Object &obj, Return(Object::*callback)(Args...))
 Overload of Subscribe takes an object and pointer-to-member-function. More...
 

Static Public Member Functions

static XMLMethodRegistryBase::Mutators< NotifyingSelectedRegionMutators (const char *legacyT0Name, const char *legacyT1Name)
 Return some information used for deserialization purposes by ViewInfo. More...
 

Private Member Functions

void Notify (bool delayed=false)
 

Private Attributes

SelectedRegion mRegion
 

Additional Inherited Members

- Public Types inherited from Observer::Publisher< NotifyingSelectedRegionMessage >
using message_type = NotifyingSelectedRegionMessage
 
using CallbackReturn = std::conditional_t< true, void, bool >
 
using Callback = std::function< CallbackReturn(const NotifyingSelectedRegionMessage &) >
 Type of functions that can be connected to the Publisher. More...
 
- Static Public Attributes inherited from Observer::Publisher< NotifyingSelectedRegionMessage >
static constexpr bool notifies_all
 
- Protected Member Functions inherited from Observer::Publisher< NotifyingSelectedRegionMessage >
CallbackReturn Publish (const NotifyingSelectedRegionMessage &message)
 Send a message to connected callbacks. More...
 

Detailed Description

Definition at line 28 of file ViewInfo.h.

Member Function Documentation

◆ collapseToT0()

void NotifyingSelectedRegion::collapseToT0 ( )

Definition at line 81 of file ViewInfo.cpp.

82{
83 if ( mRegion.t0() != mRegion.t1() ) {
85 Notify();
86 }
87}
SelectedRegion mRegion
Definition: ViewInfo.h:87
void Notify(bool delayed=false)
Definition: ViewInfo.cpp:135
double t1() const
double t0() const

References SelectedRegion::collapseToT0(), mRegion, Notify(), SelectedRegion::t0(), and SelectedRegion::t1().

Referenced by SelectActions::Handler::OnSelectNone().

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

◆ collapseToT1()

void NotifyingSelectedRegion::collapseToT1 ( )

Definition at line 89 of file ViewInfo.cpp.

90{
91 if ( mRegion.t0() != mRegion.t1() ) {
93 Notify();
94 }
95}

References SelectedRegion::collapseToT1(), mRegion, Notify(), SelectedRegion::t0(), and SelectedRegion::t1().

Here is the call graph for this function:

◆ duration()

double NotifyingSelectedRegion::duration ( ) const
inline

Definition at line 40 of file ViewInfo.h.

40{ return mRegion.duration(); }
double duration() const

Referenced by EffectBase::DoEffect().

Here is the caller graph for this function:

◆ f0()

double NotifyingSelectedRegion::f0 ( ) const
inline

Definition at line 36 of file ViewInfo.h.

36{ return mRegion.f0(); }

Referenced by anonymous_namespace{SelectHandle.cpp}::ChooseBoundary(), EffectBase::DoEffect(), SelectHandle::MoveSnappingFreqSelection(), and setFrequencies().

Here is the caller graph for this function:

◆ f1()

double NotifyingSelectedRegion::f1 ( ) const
inline

Definition at line 37 of file ViewInfo.h.

37{ return mRegion.f1(); }

Referenced by anonymous_namespace{SelectHandle.cpp}::ChooseBoundary(), EffectBase::DoEffect(), SelectHandle::MoveSnappingFreqSelection(), setFrequencies(), and SelectHandle::SnapCenterOnce().

Here is the caller graph for this function:

◆ fc()

double NotifyingSelectedRegion::fc ( ) const
inline

Definition at line 38 of file ViewInfo.h.

38{ return mRegion.fc(); }

Referenced by anonymous_namespace{SelectHandle.cpp}::ChooseBoundary(), and SelectHandle::SnapCenterOnce().

Here is the caller graph for this function:

◆ isPoint()

bool NotifyingSelectedRegion::isPoint ( ) const
inline

Definition at line 39 of file ViewInfo.h.

39{ return mRegion.isPoint(); }
bool isPoint() const

Referenced by anonymous_namespace{SelectHandle.cpp}::ChooseBoundary(), SelectUtilities::DoSelectSomething(), TranscriptionToolBar::EnableDisableButtons(), EffectUIHost::OnApply(), and TimeSelectedPred().

Here is the caller graph for this function:

◆ move()

void NotifyingSelectedRegion::move ( double  delta)

Definition at line 97 of file ViewInfo.cpp.

98{
99 if (delta != 0) {
100 mRegion.move( delta );
101 Notify();
102 }
103}
void move(double delta)

References SelectedRegion::move(), mRegion, and Notify().

Here is the call graph for this function:

◆ Mutators()

XMLMethodRegistryBase::Mutators< NotifyingSelectedRegion > NotifyingSelectedRegion::Mutators ( const char *  legacyT0Name,
const char *  legacyT1Name 
)
static

Return some information used for deserialization purposes by ViewInfo.

Definition at line 24 of file ViewInfo.cpp.

26{
28 // Get serialization methods of contained SelectedRegion, and wrap each
29 for (auto &delegate: SelectedRegion::Mutators(legacyT0Name, legacyT1Name)) {
30 results.emplace_back(
31 delegate.first,
32 [fn = std::move(delegate.second)](auto &region, auto value) {
33 fn( region.mRegion, value );
34 region.Notify( true );
35 }
36 );
37 }
38 return results;
39}
static const auto fn
static XMLMethodRegistryBase::Mutators< SelectedRegion > Mutators(const char *legacyT0Name, const char *legacyT1Name)
std::vector< std::pair< std::string, Mutator< Substructure > > > Mutators
A helper type alias for a list of mutators, associated with tag strings.

References fn, and SelectedRegion::Mutators().

Here is the call graph for this function:

◆ Notify()

void NotifyingSelectedRegion::Notify ( bool  delayed = false)
private

Definition at line 135 of file ViewInfo.cpp.

136{
137 if (delayed)
138 BasicUI::CallAfter([This = wxWeakRef(this)]{
139 if (This)
140 This->Publish({});
141 });
142 else
143 Publish({});
144}
CallbackReturn Publish(const NotifyingSelectedRegionMessage &message)
Send a message to connected callbacks.
Definition: Observer.h:207
void CallAfter(Action action)
Schedule an action to be done later, and in the main thread.
Definition: BasicUI.cpp:206

References BasicUI::CallAfter(), and Observer::Publisher< NotifyingSelectedRegionMessage >::Publish().

Referenced by collapseToT0(), collapseToT1(), move(), setF0(), setF1(), setFrequencies(), setT0(), setT1(), and setTimes().

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

◆ operator const SelectedRegion &()

NotifyingSelectedRegion::operator const SelectedRegion & ( ) const
inline

Definition at line 55 of file ViewInfo.h.

55{ return mRegion; }

◆ operator=()

NotifyingSelectedRegion & NotifyingSelectedRegion::operator= ( const SelectedRegion other)

Definition at line 41 of file ViewInfo.cpp.

43{
44 if ( mRegion != other ) {
45 mRegion = other;
46 Notify();
47 }
48 return *this;
49}

References anonymous_namespace{ProjectSettings.cpp}::Notify().

Here is the call graph for this function:

◆ setF0()

bool NotifyingSelectedRegion::setF0 ( double  f,
bool  maySwap = true 
)

Definition at line 115 of file ViewInfo.cpp.

116{
117 bool result = false;
118 if ( mRegion.f0() != f ) {
119 result = mRegion.setF0( f, maySwap );
120 Notify();
121 }
122 return result;
123}

References mRegion, and Notify().

Referenced by SelectHandle::AdjustFreqSelection().

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

◆ setF1()

bool NotifyingSelectedRegion::setF1 ( double  f,
bool  maySwap = true 
)

Definition at line 125 of file ViewInfo.cpp.

126{
127 bool result = false;
128 if ( mRegion.f1() != f ) {
129 result = mRegion.setF1( f, maySwap );
130 Notify();
131 }
132 return result;
133}

References mRegion, and Notify().

Referenced by SelectHandle::AdjustFreqSelection().

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

◆ setFrequencies()

bool NotifyingSelectedRegion::setFrequencies ( double  f0,
double  f1 
)

Definition at line 105 of file ViewInfo.cpp.

106{
107 bool result = false;
108 if ( mRegion.f0() != f0 || mRegion.f1() != f1 ) {
109 result = mRegion.setFrequencies( f0, f1 );
110 Notify();
111 }
112 return result;
113}
double f1() const
Definition: ViewInfo.h:37
double f0() const
Definition: ViewInfo.h:36

References f0(), f1(), mRegion, and Notify().

Referenced by SelectHandle::AdjustFreqSelection(), SelectHandle::MoveSnappingFreqSelection(), SelectHandle::SnapCenterOnce(), and SelectHandle::StartFreqSelection().

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

◆ setT0()

bool NotifyingSelectedRegion::setT0 ( double  t,
bool  maySwap = true 
)

Definition at line 61 of file ViewInfo.cpp.

62{
63 bool result = false;
64 if ( mRegion.t0() != t ) {
65 result = mRegion.setT0( t, maySwap );
66 Notify();
67 }
68 return result;
69}
bool setT0(double t, bool maySwap=true)

References mRegion, Notify(), SelectedRegion::setT0(), and SelectedRegion::t0().

Referenced by HighlightTextCtrl::OnMouseEvent().

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

◆ setT1()

bool NotifyingSelectedRegion::setT1 ( double  t,
bool  maySwap = true 
)

Definition at line 71 of file ViewInfo.cpp.

72{
73 bool result = false;
74 if ( mRegion.t1() != t ) {
75 result = mRegion.setT1( t, maySwap );
76 Notify();
77 }
78 return result;
79}
bool setT1(double t, bool maySwap=true)

References mRegion, Notify(), SelectedRegion::setT1(), and SelectedRegion::t1().

Here is the call graph for this function:

◆ setTimes()

bool NotifyingSelectedRegion::setTimes ( double  t0,
double  t1 
)

Definition at line 51 of file ViewInfo.cpp.

52{
53 bool result = false;
54 if ( mRegion.t0() != t0 || mRegion.t1() != t1 ) {
55 result = mRegion.setTimes( t0, t1 );
56 Notify();
57 }
58 return result;
59}
double t1() const
Definition: ViewInfo.h:35
double t0() const
Definition: ViewInfo.h:34
bool setTimes(double t0, double t1)

References mRegion, Notify(), SelectedRegion::setTimes(), SelectedRegion::t0(), t0(), SelectedRegion::t1(), and t1().

Referenced by SelectHandle::AssignSelection(), CutlineHandle::Cancel(), Effect::Delegate(), EffectBase::DoEffect(), anonymous_namespace{SelectUtilities.cpp}::DoSelectTimeAndAudioTracks(), SelectUtilities::DoSelectTimeAndTracks(), WaveTrackView::SelectNextClip(), and SelectionState::SelectTrackLength().

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

◆ t0()

double NotifyingSelectedRegion::t0 ( ) const
inline

◆ t1()

double NotifyingSelectedRegion::t1 ( ) const
inline

◆ WriteXMLAttributes()

void NotifyingSelectedRegion::WriteXMLAttributes ( XMLWriter xmlFile,
const char *  legacyT0Name,
const char *  legacyT1Name 
) const
inline

Definition at line 44 of file ViewInfo.h.

47 { mRegion.WriteXMLAttributes(xmlFile, legacyT0Name, legacyT1Name); }
void WriteXMLAttributes(XMLWriter &xmlFile, const char *legacyT0Name=sDefaultT0Name, const char *legacyT1Name=sDefaultT1Name) const

Member Data Documentation

◆ mRegion

SelectedRegion NotifyingSelectedRegion::mRegion
private

Definition at line 87 of file ViewInfo.h.

Referenced by collapseToT0(), collapseToT1(), move(), setF0(), setF1(), setFrequencies(), setT0(), setT1(), and setTimes().


The documentation for this class was generated from the following files: