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

194{
195 auto dc = &context.dc;
196
197 wxRect bev = rect;
198
199 GetEffectsBounds( rect, bev );
200 {
201 auto target = dynamic_cast<EffectsButtonHandle*>( context.target.get() );
202 bool hit = target && target->GetTrack().get() == pTrack;
203 bool captured = hit && target->IsClicked();
204 bool down = captured && bev.Contains( context.lastState.GetPosition());
205 EffectsDrawFunction( dc, bev, pTrack, down, captured, hit );
206 }
207}
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 113 of file PlayableTrackControls.cpp.

116{
117 wxCoord textWidth, textHeight;
118
119 const auto str = _("Effects");
120
121 const auto selected = pTrack ? pTrack->GetSelected() : true;
122
123 AColor::ButtonStretch(*dc, !down, bev, selected, hit);
124
126 dc->GetTextExtent(str, &textWidth, &textHeight);
127 dc->DrawText(str, bev.x + (bev.width - textWidth) / 2, bev.y + (bev.height - textHeight) / 2);
128}
#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
Definition: Track.h:470
AUDACITY_DLL_API void SetTrackInfoFont(wxDC *dc)
Definition: TrackInfo.cpp:559

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

46{
47 constexpr int padding = 2;
48 dest.x = rect.x + padding;
49 dest.y = rect.y + padding;
50 dest.width = rect.width - padding * 2;
51 dest.height = rect.height - padding * 2;
52}

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

32{
33 dest.x = rect.x;
34 dest.width = rect.width / 2 + 1;
35}

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

38{
39 wxRect muteRect;
40 GetNarrowMuteHorizontalBounds( rect, muteRect );
41 dest.x = rect.x + muteRect.width;
42 dest.width = rect.width - muteRect.width + TitleSoloBorderOverlap;
43}
static const int TitleSoloBorderOverlap
Definition: TrackInfo.h:29
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 54 of file PlayableTrackControls.cpp.

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

References kTrackInfoBtnSize.

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

161{
162 auto dc = &context.dc;
163 bool bHasSoloButton = TrackInfo::HasSoloButton();
164
165 wxRect bev = rect;
166 if ( bHasSoloButton )
168 else
170 {
171 auto target = dynamic_cast<MuteButtonHandle*>( context.target.get() );
172 bool hit = target && target->GetTrack().get() == pTrack;
173 bool captured = hit && target->IsClicked();
174 bool down = captured && bev.Contains( context.lastState.GetPosition());
175 MuteOrSoloDrawFunction( dc, bev, pTrack, down, captured, false, hit );
176 }
177
178 if( !bHasSoloButton )
179 return;
180
182 {
183 auto target = dynamic_cast<SoloButtonHandle*>( context.target.get() );
184 bool hit = target && target->GetTrack().get() == pTrack;
185 bool captured = hit && target->IsClicked();
186 bool down = captured && bev.Contains( context.lastState.GetPosition());
187 MuteOrSoloDrawFunction( dc, bev, pTrack, down, captured, true, hit );
188 }
189}
AUDACITY_DLL_API bool HasSoloButton()
Definition: TrackInfo.cpp:95
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 GetWideMuteSoloHorizontalBounds(const wxRect &rect, wxRect &dest)

References TrackPanelDrawingContext::dc, GetNarrowMuteHorizontalBounds(), GetNarrowSoloHorizontalBounds(), ButtonHandle::GetTrack(), GetWideMuteSoloHorizontalBounds(), TrackInfo::HasSoloButton(), 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 62 of file PlayableTrackControls.cpp.

66{
67 //bev.Inflate(-1, -1);
68 bool selected = pTrack ? pTrack->GetSelected() : true;
69 auto pt = dynamic_cast<const PlayableTrack *>(pTrack);
70 bool value = pt ? (solo ? pt->GetSolo() : pt->GetMute()) : false;
71
72#if 0
73 AColor::MediumTrackInfo( dc, t->GetSelected());
74 if( solo )
75 {
76 if( pt && pt->GetSolo() )
77 {
78 AColor::Solo(dc, pt->GetSolo(), t->GetSelected());
79 }
80 }
81 else
82 {
83 if( pt && pt->GetMute() )
84 {
85 AColor::Mute(dc, pt->GetMute(), t->GetSelected(), pt->GetSolo());
86 }
87 }
88 //(solo) ? AColor::Solo(dc, t->GetSolo(), t->GetSelected()) :
89 // AColor::Mute(dc, t->GetMute(), t->GetSelected(), t->GetSolo());
90 dc->SetPen( *wxTRANSPARENT_PEN );//No border!
91 dc->DrawRectangle(bev);
92#endif
93
94 wxCoord textWidth, textHeight;
95 wxString str = (solo) ?
96 /* i18n-hint: This is on a button that will silence all the other tracks.*/
97 _("Solo") :
98 /* i18n-hint: This is on a button that will silence this track.*/
99 _("Mute");
100
102 *dc,
103 value == down,
104 bev,
105 selected, hit
106 );
107
109 dc->GetTextExtent(str, &textWidth, &textHeight);
110 dc->DrawText(str, bev.x + (bev.width - textWidth) / 2, bev.y + (bev.height - textHeight) / 2);
111}
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: Track.h:917

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

133{
134 auto dc = &context.dc;
135 wxRect bev = rect;
137 auto target = dynamic_cast<MuteButtonHandle*>( context.target.get() );
138 bool hit = target && target->GetTrack().get() == pTrack;
139 bool captured = hit && target->IsClicked();
140 bool down = captured && bev.Contains( context.lastState.GetPosition());
141 MuteOrSoloDrawFunction( dc, bev, pTrack, down, captured, false, hit );
142}

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

147{
148 auto dc = &context.dc;
149 wxRect bev = rect;
151 auto target = dynamic_cast<SoloButtonHandle*>( context.target.get() );
152 bool hit = target && target->GetTrack().get() == pTrack;
153 bool captured = hit && target->IsClicked();
154 bool down = captured && bev.Contains( context.lastState.GetPosition());
155 MuteOrSoloDrawFunction( dc, bev, pTrack, down, captured, true, hit );
156}

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

Here is the call graph for this function: