14#include "../../ui/CommonTrackInfo.h"
15#include "../../../TrackPanelDrawingContext.h"
41 dest.x = rect.x + rect.width - dest.width;
58( wxDC *dc,
const wxRect &bev,
const Track *pTrack,
bool down,
59 bool WXUNUSED(captured),
63 bool selected = pTrack ? pTrack->
GetSelected() :
true;
65 bool value = pt ? (solo ? pt->GetSolo() : pt->GetMute()) :
false;
71 if( pt && pt->GetSolo() )
78 if( pt && pt->GetMute() )
80 AColor::Mute(dc, pt->GetMute(), t->GetSelected(), pt->GetSolo());
85 dc->SetPen( *wxTRANSPARENT_PEN );
86 dc->DrawRectangle(bev);
89 wxCoord textWidth, textHeight;
90 wxString
str = (solo) ?
104 dc->GetTextExtent(
str, &textWidth, &textHeight);
105 dc->DrawText(
str, bev.x + (bev.width - textWidth) / 2, bev.y + (bev.height - textHeight) / 2);
109( wxDC *dc,
const wxRect &bev,
const Track *pTrack,
bool down,
112 wxCoord textWidth, textHeight;
114 const auto str =
_(
"Effects");
116 const auto selected = pTrack ? pTrack->
GetSelected() :
true;
121 dc->GetTextExtent(
str, &textWidth, &textHeight);
122 dc->DrawText(
str, bev.x + (bev.width - textWidth) / 2, bev.y + (bev.height - textHeight) / 2);
127 const wxRect &rect,
const Track *pTrack )
129 auto dc = &context.
dc;
133 bool hit = target && target->
GetTrack().get() == pTrack;
134 bool captured = hit && target->IsDragging();
135 bool down = captured && bev.Contains( context.
lastState.GetPosition());
141 const wxRect &rect,
const Track *pTrack )
143 auto dc = &context.
dc;
147 bool hit = target && target->
GetTrack().get() == pTrack;
148 bool captured = hit && target->IsDragging();
149 bool down = captured && bev.Contains( context.
lastState.GetPosition());
155 const wxRect &rect,
const Track *pTrack )
157 auto dc = &context.
dc;
164 bool hit = target && target->
GetTrack().get() == pTrack;
165 bool captured = hit && target->IsDragging();
166 bool down = captured && bev.Contains( context.
lastState.GetPosition());
173 bool hit = target && target->
GetTrack().get() == pTrack;
174 bool captured = hit && target->IsDragging();
175 bool down = captured && bev.Contains( context.
lastState.GetPosition());
182 const wxRect &rect,
const Track *pTrack )
184 auto dc = &context.
dc;
191 bool hit = target && target->
GetTrack().get() == pTrack;
192 bool captured = hit && target->IsDragging();
193 bool down = captured && bev.Contains( context.
lastState.GetPosition());
200(
const wxRect & rect_, wxRect & dest,
bool solo,
209 dest.height = sHeight;
211 const auto bSameRow = ( yMute == ySolo );
223 if( bSameRow || !solo )
224 dest.y = rect.y + yMute;
226 dest.y = rect.y + ySolo;
230(
const wxRect & rect_, wxRect & dest,
const Track *pTrack)
238 dest.y = rect.y + resultsE.first;
239 dest.height = resultsE.second;
244 static TCPLines playableTrackTCPLines;
245 static std::once_flag
flag;
246 std::call_once(
flag, []{
248 playableTrackTCPLines.insert( playableTrackTCPLines.end(), {
249 { TCPLine::kItemMute | TCPLine::kItemSolo, MuteSoloButtonHeight, MuteSoloButtonExtra,
250 MuteAndSoloDrawFunction },
253 return playableTrackTCPLines;
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, MuteSoloButtonHeight, MuteSoloButtonExtra,
264 MuteAndSoloDrawFunction },
266 playableTrackTCPLines.insert( playableTrackTCPLines.end(), {
267 { TCPLine::kItemEffects, EffectsButtonHeight, 0,
268 EffectsDrawFunction },
271 return playableTrackTCPLines;
std::vector< TrackInfo::TCPLine > TCPLines
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 GetMuteSoloRect(const wxRect &rect, wxRect &dest, bool solo, const Track *pTrack)
static const TCPLines & StaticWaveTCPLines()
static const TCPLines & StaticNoteTCPLines()
static void GetEffectsButtonRect(const wxRect &rect, wxRect &dest, const Track *pTrack)
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.
static constexpr auto Margin
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)
constexpr auto MuteSoloButtonHeight
void GetNarrowSoloHorizontalBounds(const wxRect &rect, wxRect &dest)
constexpr auto MuteSoloButtonExtra
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)
constexpr auto EffectsButtonHeight
void GetEffectsButtonBounds(const wxRect &rect, wxRect &dest)