14#include "../../ui/CommonTrackInfo.h"
15#include "../../../TrackPanelDrawingContext.h"
31 dest.width = rect.width / 2 + 1;
38 dest.x = rect.x + muteRect.width;
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;
60( wxDC *dc,
const wxRect &bev,
const Track *pTrack,
bool down,
61 bool WXUNUSED(captured),
65 bool selected = pTrack ? pTrack->
GetSelected() :
true;
67 bool value = pt ? (solo ? pt->GetSolo() : pt->GetMute()) :
false;
73 if( pt && pt->GetSolo() )
80 if( pt && pt->GetMute() )
82 AColor::Mute(dc, pt->GetMute(), t->GetSelected(), pt->GetSolo());
87 dc->SetPen( *wxTRANSPARENT_PEN );
88 dc->DrawRectangle(bev);
91 wxCoord textWidth, textHeight;
92 wxString
str = (solo) ?
106 dc->GetTextExtent(
str, &textWidth, &textHeight);
107 dc->DrawText(
str, bev.x + (bev.width - textWidth) / 2, bev.y + (bev.height - textHeight) / 2);
111( wxDC *dc,
const wxRect &bev,
const Track *pTrack,
bool down,
114 wxCoord textWidth, textHeight;
116 const auto str =
_(
"Effects");
118 const auto selected = pTrack ? pTrack->
GetSelected() :
true;
123 dc->GetTextExtent(
str, &textWidth, &textHeight);
124 dc->DrawText(
str, bev.x + (bev.width - textWidth) / 2, bev.y + (bev.height - textHeight) / 2);
129 const wxRect &rect,
const Track *pTrack )
131 auto dc = &context.
dc;
135 bool hit = target && target->
GetTrack().get() == pTrack;
136 bool captured = hit && target->IsDragging();
137 bool down = captured && bev.Contains( context.
lastState.GetPosition());
143 const wxRect &rect,
const Track *pTrack )
145 auto dc = &context.
dc;
149 bool hit = target && target->
GetTrack().get() == pTrack;
150 bool captured = hit && target->IsDragging();
151 bool down = captured && bev.Contains( context.
lastState.GetPosition());
157 const wxRect &rect,
const Track *pTrack )
159 auto dc = &context.
dc;
166 bool hit = target && target->
GetTrack().get() == pTrack;
167 bool captured = hit && target->IsDragging();
168 bool down = captured && bev.Contains( context.
lastState.GetPosition());
175 bool hit = target && target->
GetTrack().get() == pTrack;
176 bool captured = hit && target->IsDragging();
177 bool down = captured && bev.Contains( context.
lastState.GetPosition());
184 const wxRect &rect,
const Track *pTrack )
186 auto dc = &context.
dc;
193 bool hit = target && target->
GetTrack().get() == pTrack;
194 bool captured = hit && target->IsDragging();
195 bool down = captured && bev.Contains( context.
lastState.GetPosition());
202(
const wxRect & rect, wxRect & dest,
bool solo,
209 dest.height = resultsS.second;
211 int yMute = resultsM.first;
212 int ySolo = resultsS.first;
214 bool bSameRow = ( yMute == ySolo );
215 bool bNarrow = bSameRow;
227 if( bSameRow || !solo )
228 dest.y = rect.y + yMute;
230 dest.y = rect.y + ySolo;
235(
const wxRect & rect, wxRect & dest,
const Track *pTrack)
241 dest.y = rect.y + resultsE.first;
242 dest.width = rect.width;
243 dest.height = resultsE.second;
249 static TCPLines playableTrackTCPLines;
250 static std::once_flag
flag;
251 std::call_once(
flag, []{
253 playableTrackTCPLines.insert( playableTrackTCPLines.end(), {
254 { TCPLine::kItemMute | TCPLine::kItemSolo, kTrackInfoBtnSize + 1, 0,
255 MuteAndSoloDrawFunction },
258 return playableTrackTCPLines;
263 static TCPLines playableTrackTCPLines;
264 static std::once_flag
flag;
265 std::call_once(
flag, []{
267 playableTrackTCPLines.insert( playableTrackTCPLines.end(), {
268 { TCPLine::kItemMute | TCPLine::kItemSolo, kTrackInfoBtnSize + 1, 0,
269 MuteAndSoloDrawFunction },
271 playableTrackTCPLines.insert( playableTrackTCPLines.end(), {
272 { TCPLine::kItemEffects, kTrackEffectsBtnHeight + 1, 0,
273 EffectsDrawFunction },
276 return playableTrackTCPLines;
std::vector< TrackInfo::TCPLine > TCPLines
static const int TitleSoloBorderOverlap
Extends Track with notions of mute and solo setting.
TrackInfo::TCPLine TCPLine
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 void GetEffectsRect(const wxRect &rect, wxRect &dest, const Track *pTrack)
static void GetMuteSoloRect(const wxRect &rect, wxRect &dest, bool solo, 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 const TCPLines & StaticTCPLines()
AUDACITY_DLL_API void SetTrackInfoFont(wxDC *dc)
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)