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

Functions

void GetNarrowMuteHorizontalBounds (const wxRect &rect, wxRect &dest)
 
void GetNarrowSoloHorizontalBounds (const wxRect &rect, wxRect &dest)
 
void GetEffectsButtonBounds (const wxRect &rect, wxRect &dest)
 
void GetWideMuteSoloHorizontalBounds (const wxRect &rect, wxRect &dest)
 
void MuteOrSoloDrawFunction (wxDC *dc, const wxRect &bev, const Track *pTrack, bool down, bool WXUNUSED(captured), bool solo, bool hit)
 
void EffectsDrawFunction (wxDC *dc, const wxRect &bev, const Track *pTrack, bool down, bool sel, bool hit)
 
void WideMuteDrawFunction (TrackPanelDrawingContext &context, const wxRect &rect, const Track *pTrack)
 
void WideSoloDrawFunction (TrackPanelDrawingContext &context, const wxRect &rect, const Track *pTrack)
 
void MuteAndSoloDrawFunction (TrackPanelDrawingContext &context, const wxRect &rect, const Track *pTrack)
 
void EffectsDrawFunction (TrackPanelDrawingContext &context, const wxRect &rect, const Track *pTrack)
 

Variables

constexpr auto MuteSoloButtonHeight = 20
 
constexpr auto MuteSoloButtonExtra = 2
 
constexpr auto EffectsButtonHeight = 22
 

Function Documentation

◆ EffectsDrawFunction() [1/2]

void anonymous_namespace{PlayableTrackControls.cpp}::EffectsDrawFunction ( TrackPanelDrawingContext context,
const wxRect &  rect,
const Track pTrack 
)

Definition at line 180 of file PlayableTrackControls.cpp.

183{
184 auto dc = &context.dc;
185
186 wxRect bev = rect;
187
188 GetEffectsButtonBounds( rect, bev );
189 {
190 auto target = dynamic_cast<EffectsButtonHandle*>( context.target.get() );
191 bool hit = target && target->GetTrack().get() == pTrack;
192 bool captured = hit && target->IsDragging();
193 bool down = captured && bev.Contains( context.lastState.GetPosition());
194 EffectsDrawFunction( dc, bev, pTrack, down, captured, hit );
195 }
196}
std::shared_ptr< Track > GetTrack() const
Definition: ButtonHandle.h:30
void EffectsDrawFunction(TrackPanelDrawingContext &context, const wxRect &rect, const Track *pTrack)
void GetEffectsButtonBounds(const wxRect &rect, wxRect &dest)

References TrackPanelDrawingContext::dc, EffectsDrawFunction(), GetEffectsButtonBounds(), ButtonHandle::GetTrack(), TrackPanelDrawingContext::lastState, and TrackPanelDrawingContext::target.

Referenced by EffectsDrawFunction().

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

◆ EffectsDrawFunction() [2/2]

void anonymous_namespace{PlayableTrackControls.cpp}::EffectsDrawFunction ( wxDC *  dc,
const wxRect &  bev,
const Track pTrack,
bool  down,
bool  sel,
bool  hit 
)

Definition at line 108 of file PlayableTrackControls.cpp.

111{
112 wxCoord textWidth, textHeight;
113
114 const auto str = _("Effects");
115
116 const auto selected = pTrack ? pTrack->GetSelected() : true;
117
118 AColor::ButtonStretch(*dc, !down, bev, selected, hit);
119
121 dc->GetTextExtent(str, &textWidth, &textHeight);
122 dc->DrawText(str, bev.x + (bev.width - textWidth) / 2, bev.y + (bev.height - textHeight) / 2);
123}
#define str(a)
#define _(s)
Definition: Internat.h:73
static void ButtonStretch(wxDC &dc, bool up, const wxRect &r, bool selected=false, bool highlight=false)
Draw a button that fills a given rect.
Definition: AColor.cpp:289
bool GetSelected() const
Selectedness is always the same for all channels of a group.
Definition: Track.cpp:78
AUDACITY_DLL_API void SetTrackInfoFont(wxDC *dc)
Definition: TrackInfo.cpp:77

References _, AColor::ButtonStretch(), Track::GetSelected(), TrackInfo::SetTrackInfoFont(), and str.

Here is the call graph for this function:

◆ GetEffectsButtonBounds()

void anonymous_namespace{PlayableTrackControls.cpp}::GetEffectsButtonBounds ( const wxRect &  rect,
wxRect &  dest 
)

Definition at line 44 of file PlayableTrackControls.cpp.

45{
46 dest = rect;
47}

Referenced by EffectsDrawFunction(), and PlayableTrackControls::GetEffectsButtonRect().

Here is the caller graph for this function:

◆ GetNarrowMuteHorizontalBounds()

void anonymous_namespace{PlayableTrackControls.cpp}::GetNarrowMuteHorizontalBounds ( const wxRect &  rect,
wxRect &  dest 
)

Definition at line 32 of file PlayableTrackControls.cpp.

33{
34 dest.x = rect.x;
35 dest.width = (rect.width - CommonTrackInfo::Margin) / 2;
36}
static constexpr auto Margin

References CommonTrackInfo::Margin.

Referenced by PlayableTrackControls::GetMuteSoloRect(), and MuteAndSoloDrawFunction().

Here is the caller graph for this function:

◆ GetNarrowSoloHorizontalBounds()

void anonymous_namespace{PlayableTrackControls.cpp}::GetNarrowSoloHorizontalBounds ( const wxRect &  rect,
wxRect &  dest 
)

Definition at line 38 of file PlayableTrackControls.cpp.

39{
40 dest.width = (rect.width - CommonTrackInfo::Margin) / 2;
41 dest.x = rect.x + rect.width - dest.width;
42}

References CommonTrackInfo::Margin.

Referenced by PlayableTrackControls::GetMuteSoloRect(), and MuteAndSoloDrawFunction().

Here is the caller graph for this function:

◆ GetWideMuteSoloHorizontalBounds()

void anonymous_namespace{PlayableTrackControls.cpp}::GetWideMuteSoloHorizontalBounds ( const wxRect &  rect,
wxRect &  dest 
)

Definition at line 49 of file PlayableTrackControls.cpp.

50{
51 // Larger button, symmetrically placed intended.
52 // On windows this gives 15 pixels each side.
53 dest.width = rect.width - 2 * kTrackInfoBtnSize + 6;
54 dest.x = rect.x + kTrackInfoBtnSize -3;
55}
@ kTrackInfoBtnSize
Definition: ViewInfo.h:98

References kTrackInfoBtnSize.

Referenced by PlayableTrackControls::GetMuteSoloRect(), WideMuteDrawFunction(), and WideSoloDrawFunction().

Here is the caller graph for this function:

◆ MuteAndSoloDrawFunction()

void anonymous_namespace{PlayableTrackControls.cpp}::MuteAndSoloDrawFunction ( TrackPanelDrawingContext context,
const wxRect &  rect,
const Track pTrack 
)

Definition at line 153 of file PlayableTrackControls.cpp.

156{
157 auto dc = &context.dc;
158
159 wxRect bev = rect;
160
162 {
163 auto target = dynamic_cast<MuteButtonHandle*>( context.target.get() );
164 bool hit = target && target->GetTrack().get() == pTrack;
165 bool captured = hit && target->IsDragging();
166 bool down = captured && bev.Contains( context.lastState.GetPosition());
167 MuteOrSoloDrawFunction( dc, bev, pTrack, down, captured, false, hit );
168 }
169
171 {
172 auto target = dynamic_cast<SoloButtonHandle*>( context.target.get() );
173 bool hit = target && target->GetTrack().get() == pTrack;
174 bool captured = hit && target->IsDragging();
175 bool down = captured && bev.Contains( context.lastState.GetPosition());
176 MuteOrSoloDrawFunction( dc, bev, pTrack, down, captured, true, hit );
177 }
178}
void GetNarrowSoloHorizontalBounds(const wxRect &rect, wxRect &dest)
void MuteOrSoloDrawFunction(wxDC *dc, const wxRect &bev, const Track *pTrack, bool down, bool WXUNUSED(captured), bool solo, bool hit)
void GetNarrowMuteHorizontalBounds(const wxRect &rect, wxRect &dest)

References TrackPanelDrawingContext::dc, GetNarrowMuteHorizontalBounds(), GetNarrowSoloHorizontalBounds(), ButtonHandle::GetTrack(), TrackPanelDrawingContext::lastState, MuteOrSoloDrawFunction(), and TrackPanelDrawingContext::target.

Here is the call graph for this function:

◆ MuteOrSoloDrawFunction()

void anonymous_namespace{PlayableTrackControls.cpp}::MuteOrSoloDrawFunction ( wxDC *  dc,
const wxRect &  bev,
const Track pTrack,
bool  down,
bool   WXUNUSEDcaptured,
bool  solo,
bool  hit 
)

Definition at line 57 of file PlayableTrackControls.cpp.

61{
62 //bev.Inflate(-1, -1);
63 bool selected = pTrack ? pTrack->GetSelected() : true;
64 auto pt = dynamic_cast<const PlayableTrack *>(pTrack);
65 bool value = pt ? (solo ? pt->GetSolo() : pt->GetMute()) : false;
66
67#if 0
68 AColor::MediumTrackInfo( dc, t->GetSelected());
69 if( solo )
70 {
71 if( pt && pt->GetSolo() )
72 {
73 AColor::Solo(dc, pt->GetSolo(), t->GetSelected());
74 }
75 }
76 else
77 {
78 if( pt && pt->GetMute() )
79 {
80 AColor::Mute(dc, pt->GetMute(), t->GetSelected(), pt->GetSolo());
81 }
82 }
83 //(solo) ? AColor::Solo(dc, t->GetSolo(), t->GetSelected()) :
84 // AColor::Mute(dc, t->GetMute(), t->GetSelected(), t->GetSolo());
85 dc->SetPen( *wxTRANSPARENT_PEN );//No border!
86 dc->DrawRectangle(bev);
87#endif
88
89 wxCoord textWidth, textHeight;
90 wxString str = (solo) ?
91 /* i18n-hint: This is on a button that will silence all the other tracks.*/
92 _("Solo") :
93 /* i18n-hint: This is on a button that will silence this track.*/
94 _("Mute");
95
97 *dc,
98 value == down,
99 bev,
100 selected, hit
101 );
102
104 dc->GetTextExtent(str, &textWidth, &textHeight);
105 dc->DrawText(str, bev.x + (bev.width - textWidth) / 2, bev.y + (bev.height - textHeight) / 2);
106}
static void Solo(wxDC *dc, bool on, bool selected)
Definition: AColor.cpp:484
static void Bevel2(wxDC &dc, bool up, const wxRect &r, bool bSel=false, bool bHighlight=false)
Definition: AColor.cpp:298
static void Mute(wxDC *dc, bool on, bool selected, bool soloing)
Definition: AColor.cpp:469
static void MediumTrackInfo(wxDC *dc, bool selected)
Definition: AColor.cpp:415
AudioTrack subclass that can also be audibly replayed by the program.
Definition: PlayableTrack.h:40

References _, AColor::Bevel2(), Track::GetSelected(), AColor::MediumTrackInfo(), AColor::Mute(), TrackInfo::SetTrackInfoFont(), AColor::Solo(), and str.

Referenced by MuteAndSoloDrawFunction(), WideMuteDrawFunction(), and WideSoloDrawFunction().

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

◆ WideMuteDrawFunction()

void anonymous_namespace{PlayableTrackControls.cpp}::WideMuteDrawFunction ( TrackPanelDrawingContext context,
const wxRect &  rect,
const Track pTrack 
)

Definition at line 125 of file PlayableTrackControls.cpp.

128{
129 auto dc = &context.dc;
130 wxRect bev = rect;
132 auto target = dynamic_cast<MuteButtonHandle*>( context.target.get() );
133 bool hit = target && target->GetTrack().get() == pTrack;
134 bool captured = hit && target->IsDragging();
135 bool down = captured && bev.Contains( context.lastState.GetPosition());
136 MuteOrSoloDrawFunction( dc, bev, pTrack, down, captured, false, hit );
137}
void GetWideMuteSoloHorizontalBounds(const wxRect &rect, wxRect &dest)

References TrackPanelDrawingContext::dc, ButtonHandle::GetTrack(), GetWideMuteSoloHorizontalBounds(), TrackPanelDrawingContext::lastState, MuteOrSoloDrawFunction(), and TrackPanelDrawingContext::target.

Here is the call graph for this function:

◆ WideSoloDrawFunction()

void anonymous_namespace{PlayableTrackControls.cpp}::WideSoloDrawFunction ( TrackPanelDrawingContext context,
const wxRect &  rect,
const Track pTrack 
)

Definition at line 139 of file PlayableTrackControls.cpp.

142{
143 auto dc = &context.dc;
144 wxRect bev = rect;
146 auto target = dynamic_cast<SoloButtonHandle*>( context.target.get() );
147 bool hit = target && target->GetTrack().get() == pTrack;
148 bool captured = hit && target->IsDragging();
149 bool down = captured && bev.Contains( context.lastState.GetPosition());
150 MuteOrSoloDrawFunction( dc, bev, pTrack, down, captured, true, hit );
151}

References TrackPanelDrawingContext::dc, ButtonHandle::GetTrack(), GetWideMuteSoloHorizontalBounds(), TrackPanelDrawingContext::lastState, MuteOrSoloDrawFunction(), and TrackPanelDrawingContext::target.

Here is the call graph for this function:

Variable Documentation

◆ EffectsButtonHeight

constexpr auto anonymous_namespace{PlayableTrackControls.cpp}::EffectsButtonHeight = 22
constexpr

Definition at line 30 of file PlayableTrackControls.cpp.

◆ MuteSoloButtonExtra

constexpr auto anonymous_namespace{PlayableTrackControls.cpp}::MuteSoloButtonExtra = 2
constexpr

Definition at line 29 of file PlayableTrackControls.cpp.

◆ MuteSoloButtonHeight

constexpr auto anonymous_namespace{PlayableTrackControls.cpp}::MuteSoloButtonHeight = 20
constexpr

Definition at line 28 of file PlayableTrackControls.cpp.