64 auto window = wxTheApp->GetTopWindow();
69 gFont.Create(fontSize, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
77 gFont.SetPointSize(fontSize);
78 window->GetTextExtent(
_(
"Stereo, 999999Hz"),
79 &textWidth,
nullptr,
nullptr,
nullptr, &
gFont);
81 }
while (textWidth >= allowableWidth);
100#define RANGE(array) (array), (array) + sizeof(array)/sizeof(*(array))
107#ifdef EXPERIMENTAL_DA
134 for (
const auto line : lines ) {
135 lastExtra = line.extraSpace;
136 total += line.height + lastExtra;
149 auto pLines = lines.begin();
150 while ( pLines != lines.end() &&
151 0 == (pLines->items & iItem) ) {
152 y += pLines->height + pLines->extraSpace;
156 if ( pLines != lines.end() )
157 height = pLines->height;
158 return { y, height };
175 (
const TCPLines &lines,
unsigned iItem,
int height )
178 auto pLines = lines.begin();
179 while ( pLines != lines.end() &&
180 0 == (pLines->items & iItem) ) {
181 y -= pLines->height + pLines->extraSpace;
184 if (pLines != lines.end())
185 y -= (pLines->height + pLines->extraSpace );
186 return { y, pLines->height };
214 return subRect.y + subRect.height - allowance >= rect.y + limit;
219 const wxRect &rect,
const Track &track )
226 ( context, rect, &track, topLines, bottomLines );
231 const wxRect &rect,
const Track *pTrack,
232 const std::vector<TCPLine> &topLines,
const std::vector<TCPLine> &bottomLines )
234 auto dc = &context.
dc;
240 for (
const auto &line : topLines ) {
243 rect.width, line.height
247 line.drawFunction( context, itemRect, pTrack );
248 yy += line.height + line.extraSpace;
252 int yy = rect.height;
253 for (
const auto &line : bottomLines ) {
254 yy -= line.height + line.extraSpace;
255 if ( line.drawFunction ) {
258 rect.width, line.height
260 line.drawFunction( context, itemRect, pTrack );
271 auto dc = &context.
dc;
272 bool selected = pTrack ? pTrack->
GetSelected() :
true;
273 bool hit = target && target->
GetTrack().get() == pTrack;
274 bool captured = hit && target->
IsClicked();
275 bool down = captured && bev.Contains( context.
lastState.GetPosition());
278#ifdef EXPERIMENTAL_THEMING
282 dc->SetPen(*wxBLACK_PEN);
284 bev.Inflate( -1, -1 );
288 int ls = bev.x + ((bev.width - s) / 2);
289 int ts = bev.y + ((bev.height - s) / 2);
302 const wxRect &rect,
const Track *pTrack )
304 auto dc = &context.
dc;
305 bool selected = pTrack ? pTrack->
GetSelected() :
true;
317 bool hit = target && target->
GetTrack().get() == pTrack;
318 bool captured = hit && target->IsClicked();
319 bool down = captured && bev.Contains( context.
lastState.GetPosition());
321 pTrack ? pTrack->
GetName() :
_(
"Name");
333 int allowableWidth = rect.width - 32;
335 wxCoord textWidth, textHeight;
336 dc->GetTextExtent(titleStr, &textWidth, &textHeight);
337 while (textWidth > allowableWidth) {
338 titleStr = titleStr.Left(titleStr.length() - 1);
339 dc->GetTextExtent(titleStr, &textWidth, &textHeight);
343 #ifdef EXPERIMENTAL_THEMING
346 wxColour c = *wxBLACK;
356 dc->SetTextForeground( c );
357 dc->SetTextBackground( wxTRANSPARENT );
358 dc->DrawText(titleStr, bev.x + 2, bev.y + (bev.height - textHeight) / 2);
367 bev.GetRight() - s - 3,
368 bev.y + ((bev.height - (s / 2)) / 2),
376 const wxRect &rect,
const Track *pTrack )
378 auto dc = &context.
dc;
379 bool selected = pTrack ? pTrack->
GetSelected() :
true;
387 bool hit = target && target->
GetTrack().get() == pTrack;
388 bool captured = hit && target->IsClicked();
389 bool down = captured && bev.Contains( context.
lastState.GetPosition());
397#ifdef EXPERIMENTAL_THEMING
406 bev.x - 5 + bev.width / 2,
407 bev.y - 2 + bev.height / 2,
416 bool hit = target && target->
GetTrack().get() == pTrack;
417 bool captured = hit && target->IsClicked();
418 bool down = captured && bev.Contains( context.
lastState.GetPosition());
422#ifdef EXPERIMENTAL_THEMING
430 wxString
str =
_(
"Select");
434 dc->GetTextExtent(
str, &textWidth, &textHeight);
436 dc->SetTextForeground( c );
437 dc->SetTextBackground( wxTRANSPARENT );
438 dc->DrawText(
str, bev.x + 2 + (bev.width-textWidth)/2, bev.y + (bev.height - textHeight) / 2);
443 if (syncLockSelected)
445 wxRect syncLockIconRect = rect;
450 dc->DrawBitmap(syncLockBitmap,
451 syncLockIconRect.x + 3,
452 syncLockIconRect.y + 2,
467 dest.y = rect.y + results.first;
468 dest.height = results.second;
476 dest.x = rect.x + closeRect.width + 1;
484 dest.y = rect.y + results.first;
485 dest.height = results.second;
490 dest.x = topleft.x + 6;
497 dest.x = rect.x + space;
513 dest.y = rect.y + results.first;
514 dest.height = results.second;
520 dest.x = rect.x + space;
527 dest.x = dest.x + space + minimizeRect.width;
530 dest.width = rect.width - (space + syncLockRect.width) - (space + minimizeRect.width);
539 dest.y = rect.y + results.first;
540 dest.height = results.second;
546 dest.x = rect.x + rect.width - dest.width;
554 dest.y = rect.y + results.first;
555 dest.height = results.second;
declares abstract base class Track, TrackList, and iterators over TrackList
TrackInfo::TCPLines TCPLines
TrackInfo::TCPLine TCPLine
static Settings & settings()
static const TCPLines & commonTrackTCPLines()
static const int TitleSoloBorderOverlap
ChoiceSetting TracksBehaviorsSolo
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)
static void Dark(wxDC *dc, bool selected, bool highlight=false)
virtual const TCPLines & GetTCPLines() const
static const TCPLines & StaticTCPLines()
A listener notified of changes in preferences.
static bool IsSyncLockSelected(const Track *pTrack)
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 GetMinimized() const
static TrackView & Get(Track &)
AUDACITY_DLL_API void GetSliderHorizontalBounds(const wxPoint &topleft, wxRect &dest)
AUDACITY_DLL_API bool HideTopItem(const wxRect &rect, const wxRect &subRect, int allowance=0)
AUDACITY_DLL_API void GetCloseBoxRect(const wxRect &rect, wxRect &dest)
AUDACITY_DLL_API void GetTitleBarRect(const wxRect &rect, wxRect &dest)
AUDACITY_DLL_API void GetSyncLockHorizontalBounds(const wxRect &rect, wxRect &dest)
AUDACITY_DLL_API void SetTrackInfoFont(wxDC *dc)
AUDACITY_DLL_API void GetCloseBoxHorizontalBounds(const wxRect &rect, wxRect &dest)
std::vector< TCPLine > TCPLines
AUDACITY_DLL_API void GetMinimizeHorizontalBounds(const wxRect &rect, wxRect &dest)
AUDACITY_DLL_API void GetMinimizeRect(const wxRect &rect, wxRect &dest)
AUDACITY_DLL_API void GetSelectButtonRect(const wxRect &rect, wxRect &dest)
AUDACITY_DLL_API bool HasSoloButton()
AUDACITY_DLL_API void GetTitleBarHorizontalBounds(const wxRect &rect, wxRect &dest)
AUDACITY_DLL_API void GetSyncLockIconRect(const wxRect &rect, wxRect &dest)
AUDACITY_DLL_API unsigned DefaultTrackHeight(const TCPLines &topLines)
AUDACITY_DLL_API void DrawCloseButton(TrackPanelDrawingContext &context, const wxRect &bev, const Track *pTrack, ButtonHandle *target)
AUDACITY_DLL_API void MinimizeSyncLockDrawFunction(TrackPanelDrawingContext &context, const wxRect &rect, const Track *pTrack)
AUDACITY_DLL_API void DrawItems(TrackPanelDrawingContext &context, const wxRect &rect, const Track &track)
AUDACITY_DLL_API std::pair< int, int > CalcItemY(const TCPLines &lines, unsigned iItem)
AUDACITY_DLL_API void GetSelectButtonHorizontalBounds(const wxRect &rect, wxRect &dest)
AUDACITY_DLL_API void CloseTitleDrawFunction(TrackPanelDrawingContext &context, const wxRect &rect, const Track *pTrack)
AUDACITY_DLL_API unsigned MinimumTrackHeight()
const TrackInfo::TCPLine defaultCommonTrackTCPBottomLines[]
TCPLines commonTrackTCPBottomLines
int totalTCPLines(const TCPLines &lines, bool omitLastExtra)
std::pair< int, int > CalcBottomItemY(const TCPLines &lines, unsigned iItem, int height)
void UpdatePrefs() override