14#include "../../../TrackInfo.h"
15#include "../../../TrackPanelDrawingContext.h"
30 dest.width = rect.width / 2 + 1;
37 dest.x = rect.x + muteRect.width;
43 constexpr int padding = 2;
44 dest.x = rect.x + padding;
45 dest.y = rect.y + padding;
46 dest.width = rect.width - padding * 2;
47 dest.height = rect.height - padding * 2;
59( wxDC *dc,
const wxRect &bev,
const Track *pTrack,
bool down,
60 bool WXUNUSED(captured),
64 bool selected = pTrack ? pTrack->
GetSelected() :
true;
66 bool value = pt ? (solo ? pt->GetSolo() : pt->GetMute()) :
false;
72 if( pt && pt->GetSolo() )
79 if( pt && pt->GetMute() )
81 AColor::Mute(dc, pt->GetMute(), t->GetSelected(), pt->GetSolo());
86 dc->SetPen( *wxTRANSPARENT_PEN );
87 dc->DrawRectangle(bev);
90 wxCoord textWidth, textHeight;
91 wxString
str = (solo) ?
105 dc->GetTextExtent(
str, &textWidth, &textHeight);
106 dc->DrawText(
str, bev.x + (bev.width - textWidth) / 2, bev.y + (bev.height - textHeight) / 2);
110( wxDC *dc,
const wxRect &bev,
const Track *pTrack,
bool down,
113 wxCoord textWidth, textHeight;
115 const auto str =
_(
"Effects");
117 const auto selected = pTrack ? pTrack->
GetSelected() :
true;
122 dc->GetTextExtent(
str, &textWidth, &textHeight);
123 dc->DrawText(
str, bev.x + (bev.width - textWidth) / 2, bev.y + (bev.height - textHeight) / 2);
128 const wxRect &rect,
const Track *pTrack )
130 auto dc = &context.
dc;
134 bool hit = target && target->
GetTrack().get() == pTrack;
135 bool captured = hit && target->IsClicked();
136 bool down = captured && bev.Contains( context.
lastState.GetPosition());
142 const wxRect &rect,
const Track *pTrack )
144 auto dc = &context.
dc;
148 bool hit = target && target->
GetTrack().get() == pTrack;
149 bool captured = hit && target->IsClicked();
150 bool down = captured && bev.Contains( context.
lastState.GetPosition());
156 const wxRect &rect,
const Track *pTrack )
158 auto dc = &context.
dc;
162 if ( bHasSoloButton )
168 bool hit = target && target->
GetTrack().get() == pTrack;
169 bool captured = hit && target->IsClicked();
170 bool down = captured && bev.Contains( context.
lastState.GetPosition());
174 if( !bHasSoloButton )
180 bool hit = target && target->
GetTrack().get() == pTrack;
181 bool captured = hit && target->IsClicked();
182 bool down = captured && bev.Contains( context.
lastState.GetPosition());
189 const wxRect &rect,
const Track *pTrack )
191 auto dc = &context.
dc;
198 bool hit = target && target->
GetTrack().get() == pTrack;
199 bool captured = hit && target->IsClicked();
200 bool down = captured && bev.Contains( context.
lastState.GetPosition());
207(
const wxRect & rect, wxRect & dest,
bool solo,
bool bHasSoloButton,
214 dest.height = resultsS.second;
216 int yMute = resultsM.first;
217 int ySolo = resultsS.first;
219 bool bSameRow = ( yMute == ySolo );
220 bool bNarrow = bSameRow && bHasSoloButton;
232 if( bSameRow || !solo )
233 dest.y = rect.y + yMute;
235 dest.y = rect.y + ySolo;
240(
const wxRect & rect, wxRect & dest,
const Track *pTrack)
246 dest.y = rect.y + resultsE.first;
247 dest.width = rect.width;
248 dest.height = resultsE.second;
254 static TCPLines playableTrackTCPLines;
255 static std::once_flag
flag;
256 std::call_once(
flag, []{
258 playableTrackTCPLines.insert( playableTrackTCPLines.end(), {
259 { TCPLine::kItemMute | TCPLine::kItemSolo, kTrackInfoBtnSize + 1, 0,
260 MuteAndSoloDrawFunction },
263 return playableTrackTCPLines;
268 static TCPLines playableTrackTCPLines;
269 static std::once_flag
flag;
270 std::call_once(
flag, []{
272 playableTrackTCPLines.insert( playableTrackTCPLines.end(), {
273 { TCPLine::kItemMute | TCPLine::kItemSolo, kTrackInfoBtnSize + 1, 0,
274 MuteAndSoloDrawFunction },
276 playableTrackTCPLines.insert( playableTrackTCPLines.end(), {
277 { TCPLine::kItemEffects, kTrackEffectsBtnHeight + 1, 0,
278 EffectsDrawFunction },
281 return playableTrackTCPLines;
Extends Track with notions of mute and solo setting.
TrackInfo::TCPLine TCPLine
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.
bool GetSelected() const
Selectedness is always the same for all channels of a group.
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)