41#define RANGE(array) std::begin(array), std::end(array)
65 for (
const auto line : lines ) {
66 lastExtra = line.extraSpace;
67 total += line.height + lastExtra;
89 (
const TCPLines &lines,
unsigned iItem,
int height )
92 auto pLines = lines.begin();
93 while ( pLines != lines.end() &&
94 0 == (pLines->items & iItem) ) {
95 y -= pLines->height + pLines->extraSpace;
98 if (pLines != lines.end())
99 y -= (pLines->height + pLines->extraSpace );
100 return { y, pLines->height };
123 return subRect.y + subRect.height - allowance >= rect.y + limit;
128 const wxRect &rect,
const Track &track )
131 const auto &topLines = trackControl.GetTCPLines();
134 ( context, rect, &track, topLines, bottomLines );
139 const wxRect &rect,
const Track *pTrack,
140 const std::vector<TCPLine> &topLines,
const std::vector<TCPLine> &bottomLines )
142 auto dc = &context.
dc;
148 for (
const auto &line : topLines ) {
151 rect.width, line.height
155 line.drawFunction( context, itemRect, pTrack );
156 yy += line.height + line.extraSpace;
160 int yy = rect.height;
161 for (
const auto &line : bottomLines ) {
162 yy -= line.height + line.extraSpace;
163 if ( line.drawFunction ) {
166 rect.width, line.height
168 line.drawFunction( context, itemRect, pTrack );
178 auto dc = &context.
dc;
179 auto pTrack = pChannel
182 bool selected = pTrack ? pTrack->
GetSelected() :
true;
183 bool hit = target && target->
FindTrack().get() == pTrack;
185 bool down = captured && bev.Contains( context.
lastState.GetPosition());
190 bev.Inflate( -1, -1 );
194 int ls = bev.x + ((bev.width - s) / 2);
195 int ts = bev.y + ((bev.height - s) / 2);
208 const wxRect &rect,
const Track *pTrack )
210 auto dc = &context.
dc;
211 bool selected = pTrack ? pTrack->
GetSelected() :
true;
215 auto target = context.
target.get();
217 (*pTrack->
Channels().begin()).get(), target);
223 auto target = context.
target.get();
225 target->FindTrack().get() == pTrack;
226 bool captured = hit && target->IsDragging();
227 bool down = captured && bev.Contains( context.
lastState.GetPosition());
229 pTrack ? pTrack->
GetName() :
_(
"Name");
241 int allowableWidth = rect.width - 32;
243 wxCoord textWidth, textHeight;
244 dc->GetTextExtent(titleStr, &textWidth, &textHeight);
245 while (textWidth > allowableWidth) {
246 titleStr = titleStr.Left(titleStr.length() - 1);
247 dc->GetTextExtent(titleStr, &textWidth, &textHeight);
260 dc->SetTextForeground( c );
261 dc->SetTextBackground( wxTRANSPARENT );
262 dc->DrawText(titleStr, bev.x + 2, bev.y + (bev.height - textHeight) / 2);
271 bev.GetRight() - s - 3,
272 bev.y + ((bev.height - (s / 2)) / 2),
280 const wxRect &rect,
const Track *pTrack )
282 auto dc = &context.
dc;
283 bool selected = pTrack ? pTrack->
GetSelected() :
true;
284 bool syncLockSelected =
291 auto target = context.
target.get();
292 bool hit = target && target->FindTrack().get() == pTrack;
293 bool captured = hit && target->IsDragging();
294 bool down = captured && bev.Contains( context.
lastState.GetPosition());
307 bev.x - 5 + bev.width / 2,
308 bev.y - 2 + bev.height / 2,
315 if (syncLockSelected)
317 wxRect syncLockIconRect = rect;
322 dc->DrawBitmap(syncLockBitmap,
323 syncLockIconRect.x + 3,
324 syncLockIconRect.y + 2,
339 dest.y = rect.y + results.first;
340 dest.height = results.second;
348 dest.x = rect.x + closeRect.width + 1;
356 dest.y = rect.y + results.first;
357 dest.height = results.second;
362 dest.x = topleft.x + 6;
369 dest.x = rect.x + space;
385 dest.y = rect.y + results.first;
386 dest.height = results.second;
392 dest.x = rect.x + rect.width - dest.width;
400 dest.y = rect.y + results.first;
401 dest.height = results.second;
std::vector< TrackInfo::TCPLine > TCPLines
TrackInfo::TCPLine TCPLine
static const TCPLines & commonTrackTCPLines()
static const int TitleSoloBorderOverlap
declares abstract base class Track, TrackList, and iterators over TrackList
static void Arrow(wxDC &dc, wxCoord x, wxCoord y, int width, bool down=true)
static void Bevel2(wxDC &dc, bool up, const wxRect &r, bool bSel=false, bool bHighlight=false)
static void Line(wxDC &dc, wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
IteratorRange< ChannelIterator< ChannelType > > Channels()
Get range of channels with mutative access.
std::shared_ptr< ChannelType > GetChannel(size_t iChannel)
Retrieve a channel, cast to the given type.
ChannelGroup & GetChannelGroup()
Channel object's lifetime is assumed to be nested in its Track's.
static ChannelView & Get(Channel &channel)
bool GetMinimized() const
static bool IsSyncLockSelected(const Track &track)
wxColour & Colour(int iIndex)
wxImage & Image(int iIndex)
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.
const wxString & GetName() const
Name is always the same for all channels of a group.
Short-lived drawing and event-handling object associated with a TrackPanelCell.
virtual std::shared_ptr< const Track > FindTrack() const =0
virtual bool IsDragging() const
AUDACITY_DLL_API void GetSyncLockIconRect(const wxRect &rect, wxRect &dest)
AUDACITY_DLL_API void GetCloseBoxHorizontalBounds(const wxRect &rect, wxRect &dest)
AUDACITY_DLL_API void CloseTitleDrawFunction(TrackPanelDrawingContext &context, const wxRect &rect, const Track *pTrack)
AUDACITY_DLL_API void GetTitleBarHorizontalBounds(const wxRect &rect, wxRect &dest)
AUDACITY_DLL_API void GetSyncLockHorizontalBounds(const wxRect &rect, wxRect &dest)
AUDACITY_DLL_API void DrawItems(TrackPanelDrawingContext &context, const wxRect &rect, const Track &track)
AUDACITY_DLL_API void GetCloseBoxRect(const wxRect &rect, wxRect &dest)
TrackInfo::TCPLines TCPLines
AUDACITY_DLL_API unsigned DefaultTrackHeight(const TCPLines &topLines)
AUDACITY_DLL_API void DrawCloseButton(TrackPanelDrawingContext &context, const wxRect &bev, const Channel *pChannel, UIHandle *target)
AUDACITY_DLL_API void GetMinimizeRect(const wxRect &rect, wxRect &dest)
AUDACITY_DLL_API void MinimizeSyncLockDrawFunction(TrackPanelDrawingContext &context, const wxRect &rect, const Track *pTrack)
AUDACITY_DLL_API void GetMinimizeHorizontalBounds(const wxRect &rect, wxRect &dest)
AUDACITY_DLL_API void GetTitleBarRect(const wxRect &rect, wxRect &dest)
AUDACITY_DLL_API void GetSliderHorizontalBounds(const wxPoint &topleft, wxRect &dest)
AUDACITY_DLL_API const TCPLines & StaticTCPLines()
AUDACITY_DLL_API unsigned MinimumTrackHeight()
AUDACITY_DLL_API bool HideTopItem(const wxRect &rect, const wxRect &subRect, int allowance=0)
AUDACITY_DLL_API void SetTrackInfoFont(wxDC *dc)
std::vector< TCPLine > TCPLines
AUDACITY_DLL_API std::pair< int, int > CalcItemY(const TCPLines &lines, unsigned iItem)
const TrackInfo::TCPLine defaultCommonTrackTCPBottomLines[]
std::pair< int, int > CalcBottomItemY(const TCPLines &lines, unsigned iItem, int height)
TCPLines commonTrackTCPBottomLines
int totalTCPLines(const TCPLines &lines, bool omitLastExtra)