18#include "../../../TrackInfo.h"
19#include "../../../TrackPanelDrawingContext.h"
34 dest.width = rect.width / 2 + 1;
41 dest.x = rect.x + muteRect.width;
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;
63( wxDC *dc,
const wxRect &bev,
const Track *pTrack,
bool down,
64 bool WXUNUSED(captured),
68 bool selected = pTrack ? pTrack->
GetSelected() :
true;
70 bool value = pt ? (solo ? pt->GetSolo() : pt->GetMute()) :
false;
76 if( pt && pt->GetSolo() )
83 if( pt && pt->GetMute() )
85 AColor::Mute(dc, pt->GetMute(), t->GetSelected(), pt->GetSolo());
90 dc->SetPen( *wxTRANSPARENT_PEN );
91 dc->DrawRectangle(bev);
94 wxCoord textWidth, textHeight;
95 wxString
str = (solo) ?
109 dc->GetTextExtent(
str, &textWidth, &textHeight);
110 dc->DrawText(
str, bev.x + (bev.width - textWidth) / 2, bev.y + (bev.height - textHeight) / 2);
114( wxDC *dc,
const wxRect &bev,
const Track *pTrack,
bool down,
117 wxCoord textWidth, textHeight;
119 const auto str =
_(
"Effects");
121 const auto selected = pTrack ? pTrack->
GetSelected() :
true;
126 dc->GetTextExtent(
str, &textWidth, &textHeight);
127 dc->DrawText(
str, bev.x + (bev.width - textWidth) / 2, bev.y + (bev.height - textHeight) / 2);
132 const wxRect &rect,
const Track *pTrack )
134 auto dc = &context.
dc;
138 bool hit = target && target->
GetTrack().get() == pTrack;
139 bool captured = hit && target->IsClicked();
140 bool down = captured && bev.Contains( context.
lastState.GetPosition());
146 const wxRect &rect,
const Track *pTrack )
148 auto dc = &context.
dc;
152 bool hit = target && target->
GetTrack().get() == pTrack;
153 bool captured = hit && target->IsClicked();
154 bool down = captured && bev.Contains( context.
lastState.GetPosition());
160 const wxRect &rect,
const Track *pTrack )
162 auto dc = &context.
dc;
166 if ( bHasSoloButton )
172 bool hit = target && target->
GetTrack().get() == pTrack;
173 bool captured = hit && target->IsClicked();
174 bool down = captured && bev.Contains( context.
lastState.GetPosition());
178 if( !bHasSoloButton )
184 bool hit = target && target->
GetTrack().get() == pTrack;
185 bool captured = hit && target->IsClicked();
186 bool down = captured && bev.Contains( context.
lastState.GetPosition());
193 const wxRect &rect,
const Track *pTrack )
195 auto dc = &context.
dc;
202 bool hit = target && target->
GetTrack().get() == pTrack;
203 bool captured = hit && target->IsClicked();
204 bool down = captured && bev.Contains( context.
lastState.GetPosition());
211(
const wxRect & rect, wxRect & dest,
bool solo,
bool bHasSoloButton,
218 dest.height = resultsS.second;
220 int yMute = resultsM.first;
221 int ySolo = resultsS.first;
223 bool bSameRow = ( yMute == ySolo );
224 bool bNarrow = bSameRow && bHasSoloButton;
236 if( bSameRow || !solo )
237 dest.y = rect.y + yMute;
239 dest.y = rect.y + ySolo;
244(
const wxRect & rect, wxRect & dest,
const Track *pTrack)
250 dest.y = rect.y + resultsE.first;
251 dest.width = rect.width;
252 dest.height = resultsE.second;
258 static TCPLines playableTrackTCPLines;
259 static std::once_flag
flag;
260 std::call_once(
flag, []{
262 playableTrackTCPLines.insert( playableTrackTCPLines.end(), {
263 { TCPLine::kItemMute | TCPLine::kItemSolo, kTrackInfoBtnSize + 1, 0,
264 MuteAndSoloDrawFunction },
267 return playableTrackTCPLines;
272 static TCPLines playableTrackTCPLines;
273 static std::once_flag
flag;
274 std::call_once(
flag, []{
276 playableTrackTCPLines.insert( playableTrackTCPLines.end(), {
277 { TCPLine::kItemMute | TCPLine::kItemSolo, kTrackInfoBtnSize + 1, 0,
278 MuteAndSoloDrawFunction },
280 playableTrackTCPLines.insert( playableTrackTCPLines.end(), {
281 { TCPLine::kItemEffects, kTrackEffectsBtnHeight + 1, 0,
282 EffectsDrawFunction },
285 return playableTrackTCPLines;
TrackInfo::TCPLine TCPLine
declares abstract base class Track, TrackList, and iterators over TrackList
TrackInfo::TCPLines TCPLines
static const int TitleSoloBorderOverlap
static void Solo(wxDC *dc, bool on, bool selected)
static void Bevel2(wxDC &dc, bool up, const wxRect &r, bool bSel=false, bool bHighlight=false)
static void Mute(wxDC *dc, bool on, bool selected, bool soloing)
static void MediumTrackInfo(wxDC *dc, bool selected)
static void ButtonStretch(wxDC &dc, bool up, const wxRect &r, bool selected=false, bool highlight=false)
Draw a button that fills a given rect.
static const TCPLines & StaticTCPLines()
static void GetEffectsRect(const wxRect &rect, wxRect &dest, const Track *pTrack)
static void GetMuteSoloRect(const wxRect &rect, wxRect &dest, bool solo, bool bHasSoloButton, const Track *pTrack)
static const TCPLines & StaticWaveTCPLines()
static const TCPLines & StaticNoteTCPLines()
AudioTrack subclass that can also be audibly replayed by the program.
static TrackControls & Get(Track &track)
Abstract base class for an object holding data associated with points on a time axis.
AUDACITY_DLL_API void SetTrackInfoFont(wxDC *dc)
AUDACITY_DLL_API bool HasSoloButton()
AUDACITY_DLL_API std::pair< int, int > CalcItemY(const TCPLines &lines, unsigned iItem)
void GetEffectsBounds(const wxRect &rect, wxRect &dest)
void GetNarrowSoloHorizontalBounds(const wxRect &rect, wxRect &dest)
void WideMuteDrawFunction(TrackPanelDrawingContext &context, const wxRect &rect, const Track *pTrack)
void EffectsDrawFunction(TrackPanelDrawingContext &context, const wxRect &rect, const Track *pTrack)
void MuteAndSoloDrawFunction(TrackPanelDrawingContext &context, const wxRect &rect, const Track *pTrack)
void WideSoloDrawFunction(TrackPanelDrawingContext &context, const wxRect &rect, const Track *pTrack)
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)
void GetWideMuteSoloHorizontalBounds(const wxRect &rect, wxRect &dest)