Audacity 3.2.0
Functions
anonymous_namespace{PlayableTrackControls.cpp} Namespace Reference

Functions

void GetNarrowMuteHorizontalBounds (const wxRect &rect, wxRect &dest)
 
void GetNarrowSoloHorizontalBounds (const wxRect &rect, wxRect &dest)
 
void GetEffectsBounds (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)
 

Function Documentation

◆ EffectsDrawFunction() [1/2]

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

Definition at line 182 of file PlayableTrackControls.cpp.

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

References TrackPanelDrawingContext::dc, EffectsDrawFunction(), GetEffectsBounds(), 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 110 of file PlayableTrackControls.cpp.

113{
114 wxCoord textWidth, textHeight;
115
116 const auto str = _("Effects");
117
118 const auto selected = pTrack ? pTrack->GetSelected() : true;
119
120 AColor::ButtonStretch(*dc, !down, bev, selected, hit);
121
123 dc->GetTextExtent(str, &textWidth, &textHeight);
124 dc->DrawText(str, bev.x + (bev.width - textWidth) / 2, bev.y + (bev.height - textHeight) / 2);
125}
#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:285
bool GetSelected() const
Selectedness is always the same for all channels of a group.
Definition: Track.cpp:70
AUDACITY_DLL_API void SetTrackInfoFont(wxDC *dc)
Definition: TrackInfo.cpp:95

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

Here is the call graph for this function:

◆ GetEffectsBounds()

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

Definition at line 42 of file PlayableTrackControls.cpp.

43{
44 constexpr int padding = 2;
45 dest.x = rect.x + padding;
46 dest.y = rect.y + padding;
47 dest.width = rect.width - padding * 2;
48 dest.height = rect.height - padding * 2;
49}

Referenced by EffectsDrawFunction().

Here is the caller graph for this function:

◆ GetNarrowMuteHorizontalBounds()

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

Definition at line 28 of file PlayableTrackControls.cpp.

29{
30 dest.x = rect.x;
31 dest.width = rect.width / 2 + 1;
32}

Referenced by PlayableTrackControls::GetMuteSoloRect(), GetNarrowSoloHorizontalBounds(), 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 34 of file PlayableTrackControls.cpp.

35{
36 wxRect muteRect;
37 GetNarrowMuteHorizontalBounds( rect, muteRect );
38 dest.x = rect.x + muteRect.width;
39 dest.width = rect.width - muteRect.width + TitleSoloBorderOverlap;
40}
static const int TitleSoloBorderOverlap
void GetNarrowMuteHorizontalBounds(const wxRect &rect, wxRect &dest)

References GetNarrowMuteHorizontalBounds(), and TitleSoloBorderOverlap.

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

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

◆ GetWideMuteSoloHorizontalBounds()

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

Definition at line 51 of file PlayableTrackControls.cpp.

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

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 155 of file PlayableTrackControls.cpp.

158{
159 auto dc = &context.dc;
160
161 wxRect bev = rect;
162
164 {
165 auto target = dynamic_cast<MuteButtonHandle*>( context.target.get() );
166 bool hit = target && target->GetTrack().get() == pTrack;
167 bool captured = hit && target->IsDragging();
168 bool down = captured && bev.Contains( context.lastState.GetPosition());
169 MuteOrSoloDrawFunction( dc, bev, pTrack, down, captured, false, hit );
170 }
171
173 {
174 auto target = dynamic_cast<SoloButtonHandle*>( context.target.get() );
175 bool hit = target && target->GetTrack().get() == pTrack;
176 bool captured = hit && target->IsDragging();
177 bool down = captured && bev.Contains( context.lastState.GetPosition());
178 MuteOrSoloDrawFunction( dc, bev, pTrack, down, captured, true, hit );
179 }
180}
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)

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 59 of file PlayableTrackControls.cpp.

63{
64 //bev.Inflate(-1, -1);
65 bool selected = pTrack ? pTrack->GetSelected() : true;
66 auto pt = dynamic_cast<const PlayableTrack *>(pTrack);
67 bool value = pt ? (solo ? pt->GetSolo() : pt->GetMute()) : false;
68
69#if 0
70 AColor::MediumTrackInfo( dc, t->GetSelected());
71 if( solo )
72 {
73 if( pt && pt->GetSolo() )
74 {
75 AColor::Solo(dc, pt->GetSolo(), t->GetSelected());
76 }
77 }
78 else
79 {
80 if( pt && pt->GetMute() )
81 {
82 AColor::Mute(dc, pt->GetMute(), t->GetSelected(), pt->GetSolo());
83 }
84 }
85 //(solo) ? AColor::Solo(dc, t->GetSolo(), t->GetSelected()) :
86 // AColor::Mute(dc, t->GetMute(), t->GetSelected(), t->GetSolo());
87 dc->SetPen( *wxTRANSPARENT_PEN );//No border!
88 dc->DrawRectangle(bev);
89#endif
90
91 wxCoord textWidth, textHeight;
92 wxString str = (solo) ?
93 /* i18n-hint: This is on a button that will silence all the other tracks.*/
94 _("Solo") :
95 /* i18n-hint: This is on a button that will silence this track.*/
96 _("Mute");
97
99 *dc,
100 value == down,
101 bev,
102 selected, hit
103 );
104
106 dc->GetTextExtent(str, &textWidth, &textHeight);
107 dc->DrawText(str, bev.x + (bev.width - textWidth) / 2, bev.y + (bev.height - textHeight) / 2);
108}
static void Solo(wxDC *dc, bool on, bool selected)
Definition: AColor.cpp:510
static void Bevel2(wxDC &dc, bool up, const wxRect &r, bool bSel=false, bool bHighlight=false)
Definition: AColor.cpp:294
static void Mute(wxDC *dc, bool on, bool selected, bool soloing)
Definition: AColor.cpp:495
static void MediumTrackInfo(wxDC *dc, bool selected)
Definition: AColor.cpp:433
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 127 of file PlayableTrackControls.cpp.

130{
131 auto dc = &context.dc;
132 wxRect bev = rect;
134 auto target = dynamic_cast<MuteButtonHandle*>( context.target.get() );
135 bool hit = target && target->GetTrack().get() == pTrack;
136 bool captured = hit && target->IsDragging();
137 bool down = captured && bev.Contains( context.lastState.GetPosition());
138 MuteOrSoloDrawFunction( dc, bev, pTrack, down, captured, false, hit );
139}
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 141 of file PlayableTrackControls.cpp.

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

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

Here is the call graph for this function: