Audacity 3.2.0
Classes | Typedefs | Functions
TrackInfo Namespace Reference

Functions for drawing the track control panel, which is shown to the side of a track It has the menus, pan and gain controls displayed in it. So "Info" is somewhat a misnomer. Should possibly be "TrackControls". More...

Classes

struct  TCPLine
 

Typedefs

using TCPLines = std::vector< TCPLine >
 

Functions

AUDACITY_DLL_API unsigned MinimumTrackHeight ()
 
AUDACITY_DLL_API std::pair< int, int > CalcItemY (const TCPLines &lines, unsigned iItem)
 
AUDACITY_DLL_API unsigned DefaultTrackHeight (const TCPLines &topLines)
 
AUDACITY_DLL_API void DrawItems (TrackPanelDrawingContext &context, const wxRect &rect, const Track &track)
 
AUDACITY_DLL_API void DrawItems (TrackPanelDrawingContext &context, const wxRect &rect, const Track *pTrack, const std::vector< TCPLine > &topLines, const std::vector< TCPLine > &bottomLines)
 
AUDACITY_DLL_API void DrawCloseButton (TrackPanelDrawingContext &context, const wxRect &bev, const Track *pTrack, ButtonHandle *target)
 
AUDACITY_DLL_API void CloseTitleDrawFunction (TrackPanelDrawingContext &context, const wxRect &rect, const Track *pTrack)
 
AUDACITY_DLL_API void MinimizeSyncLockDrawFunction (TrackPanelDrawingContext &context, const wxRect &rect, const Track *pTrack)
 
AUDACITY_DLL_API void SetTrackInfoFont (wxDC *dc)
 
AUDACITY_DLL_API void GetCloseBoxHorizontalBounds (const wxRect &rect, wxRect &dest)
 
AUDACITY_DLL_API void GetCloseBoxRect (const wxRect &rect, wxRect &dest)
 
AUDACITY_DLL_API void GetTitleBarHorizontalBounds (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 void GetMinimizeHorizontalBounds (const wxRect &rect, wxRect &dest)
 
AUDACITY_DLL_API void GetMinimizeRect (const wxRect &rect, wxRect &dest)
 
AUDACITY_DLL_API void GetSelectButtonHorizontalBounds (const wxRect &rect, wxRect &dest)
 
AUDACITY_DLL_API void GetSelectButtonRect (const wxRect &rect, wxRect &dest)
 
AUDACITY_DLL_API void GetSyncLockHorizontalBounds (const wxRect &rect, wxRect &dest)
 
AUDACITY_DLL_API void GetSyncLockIconRect (const wxRect &rect, wxRect &dest)
 
AUDACITY_DLL_API bool HideTopItem (const wxRect &rect, const wxRect &subRect, int allowance=0)
 
AUDACITY_DLL_API void UpdatePrefs (wxWindow *pParent)
 
AUDACITY_DLL_API bool HasSoloButton ()
 

Detailed Description

Functions for drawing the track control panel, which is shown to the side of a track It has the menus, pan and gain controls displayed in it. So "Info" is somewhat a misnomer. Should possibly be "TrackControls".

It maintains global slider widget instances that are reparented and repositioned as needed for drawing and interaction with the user, interoperating with the custom panel subdivision implemented in CellularPanel and avoiding wxWidgets sizers

If we'd instead coded it as a wxWindow, we would have an instance of this class for each track displayed.

Typedef Documentation

◆ TCPLines

using TrackInfo::TCPLines = typedef std::vector< TCPLine >

Definition at line 67 of file TrackInfo.h.

Function Documentation

◆ CalcItemY()

std::pair< int, int > TrackInfo::CalcItemY ( const TCPLines lines,
unsigned  iItem 
)

Definition at line 146 of file TrackInfo.cpp.

147{
148 int y = 0;
149 auto pLines = lines.begin();
150 while ( pLines != lines.end() &&
151 0 == (pLines->items & iItem) ) {
152 y += pLines->height + pLines->extraSpace;
153 ++pLines;
154 }
155 int height = 0;
156 if ( pLines != lines.end() )
157 height = pLines->height;
158 return { y, height };
159}

Referenced by GetCloseBoxRect(), PlayableTrackControls::GetEffectsRect(), WaveTrackControls::GetGainRect(), NoteTrackControls::GetMidiControlsRect(), PlayableTrackControls::GetMuteSoloRect(), WaveTrackControls::GetPanRect(), GetTitleBarRect(), and NoteTrackControls::GetVelocityRect().

Here is the caller graph for this function:

◆ CloseTitleDrawFunction()

void TrackInfo::CloseTitleDrawFunction ( TrackPanelDrawingContext context,
const wxRect &  rect,
const Track pTrack 
)

Definition at line 300 of file TrackInfo.cpp.

303{
304 auto dc = &context.dc;
305 bool selected = pTrack ? pTrack->GetSelected() : true;
306 {
307 wxRect bev = rect;
308 GetCloseBoxHorizontalBounds( rect, bev );
309 auto target = dynamic_cast<CloseButtonHandle*>( context.target.get() );
310 DrawCloseButton( context, bev, pTrack, target );
311 }
312
313 {
314 wxRect bev = rect;
315 GetTitleBarHorizontalBounds( rect, bev );
316 auto target = dynamic_cast<MenuButtonHandle*>( context.target.get() );
317 bool hit = target && target->GetTrack().get() == pTrack;
318 bool captured = hit && target->IsClicked();
319 bool down = captured && bev.Contains( context.lastState.GetPosition());
320 wxString titleStr =
321 pTrack ? pTrack->GetName() : _("Name");
322
323 //bev.Inflate(-1, -1);
324 AColor::Bevel2(*dc, !down, bev, selected, hit);
325
326 // Draw title text
328
329 // Bug 1660 The 'k' of 'Audio Track' was being truncated.
330 // Constant of 32 found by counting pixels on a windows machine.
331 // I believe it's the size of the X close button + the size of the
332 // drop down arrow.
333 int allowableWidth = rect.width - 32;
334
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);
340 }
341
342 // Pop-up triangle
343 #ifdef EXPERIMENTAL_THEMING
344 wxColour c = theTheme.Colour( clrTrackPanelText );
345 #else
346 wxColour c = *wxBLACK;
347 #endif
348
349 // wxGTK leaves little scraps (antialiasing?) of the
350 // characters if they are repeatedly drawn. This
351 // happens when holding down mouse button and moving
352 // in and out of the title bar. So clear it first.
353 // AColor::MediumTrackInfo(dc, t->GetSelected());
354 // dc->DrawRectangle(bev);
355
356 dc->SetTextForeground( c );
357 dc->SetTextBackground( wxTRANSPARENT );
358 dc->DrawText(titleStr, bev.x + 2, bev.y + (bev.height - textHeight) / 2);
359
360
361
362 dc->SetPen(c);
363 dc->SetBrush(c);
364
365 int s = 10; // Width of dropdown arrow...height is half of width
366 AColor::Arrow(*dc,
367 bev.GetRight() - s - 3, // 3 to offset from right border
368 bev.y + ((bev.height - (s / 2)) / 2),
369 s);
370
371 }
372}
#define _(s)
Definition: Internat.h:75
THEME_API Theme theTheme
Definition: Theme.cpp:82
static void Arrow(wxDC &dc, wxCoord x, wxCoord y, int width, bool down=true)
Definition: AColor.cpp:160
static void Bevel2(wxDC &dc, bool up, const wxRect &r, bool bSel=false, bool bHighlight=false)
Definition: AColor.cpp:294
std::shared_ptr< Track > GetTrack() const
Definition: ButtonHandle.h:30
wxColour & Colour(int iIndex)
bool GetSelected() const
Definition: Track.h:469
wxString GetName() const
Definition: Track.h:466
AUDACITY_DLL_API void SetTrackInfoFont(wxDC *dc)
Definition: TrackInfo.cpp:559
AUDACITY_DLL_API void GetCloseBoxHorizontalBounds(const wxRect &rect, wxRect &dest)
Definition: TrackInfo.cpp:457
AUDACITY_DLL_API void GetTitleBarHorizontalBounds(const wxRect &rect, wxRect &dest)
Definition: TrackInfo.cpp:471
AUDACITY_DLL_API void DrawCloseButton(TrackPanelDrawingContext &context, const wxRect &bev, const Track *pTrack, ButtonHandle *target)
Definition: TrackInfo.cpp:267

References _, AColor::Arrow(), AColor::Bevel2(), ThemeBase::Colour(), TrackPanelDrawingContext::dc, DrawCloseButton(), GetCloseBoxHorizontalBounds(), Track::GetName(), Track::GetSelected(), GetTitleBarHorizontalBounds(), ButtonHandle::GetTrack(), TrackPanelDrawingContext::lastState, SetTrackInfoFont(), TrackPanelDrawingContext::target, and theTheme.

Referenced by commonTrackTCPLines().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DefaultTrackHeight()

unsigned TrackInfo::DefaultTrackHeight ( const TCPLines topLines)

Definition at line 566 of file TrackInfo.cpp.

567{
568 int needed =
570 totalTCPLines( topLines, true ) +
572 return (unsigned) std::max( needed, (int) TrackView::DefaultHeight );
573}
@ kVerticalPadding
Definition: ViewInfo.h:91
@ DefaultHeight
Definition: TrackView.h:30
int totalTCPLines(const TCPLines &lines, bool omitLastExtra)
Definition: TrackInfo.cpp:130

References anonymous_namespace{TrackInfo.cpp}::commonTrackTCPBottomLines, TrackView::DefaultHeight, kVerticalPadding, and anonymous_namespace{TrackInfo.cpp}::totalTCPLines().

Referenced by NoteTrackControls::DefaultNoteTrackHeight(), and WaveTrackControls::DefaultWaveTrackHeight().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DrawCloseButton()

void TrackInfo::DrawCloseButton ( TrackPanelDrawingContext context,
const wxRect &  bev,
const Track pTrack,
ButtonHandle target 
)

Definition at line 267 of file TrackInfo.cpp.

270{
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());
276 AColor::Bevel2(*dc, !down, bev, selected, hit );
277
278#ifdef EXPERIMENTAL_THEMING
279 wxPen pen( theTheme.Colour( clrTrackPanelText ));
280 dc->SetPen( pen );
281#else
282 dc->SetPen(*wxBLACK_PEN);
283#endif
284 bev.Inflate( -1, -1 );
285 // Draw the "X"
286 const int s = 6;
287
288 int ls = bev.x + ((bev.width - s) / 2);
289 int ts = bev.y + ((bev.height - s) / 2);
290 int rs = ls + s;
291 int bs = ts + s;
292
293 AColor::Line(*dc, ls, ts, rs, bs);
294 AColor::Line(*dc, ls + 1, ts, rs + 1, bs);
295 AColor::Line(*dc, rs, ts, ls, bs);
296 AColor::Line(*dc, rs + 1, ts, ls + 1, bs);
297 // bev.Inflate(-1, -1);
298}
static void Line(wxDC &dc, wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
Definition: AColor.cpp:187
bool IsClicked() const
Definition: ButtonHandle.h:31

References AColor::Bevel2(), ThemeBase::Colour(), TrackPanelDrawingContext::dc, Track::GetSelected(), ButtonHandle::GetTrack(), ButtonHandle::IsClicked(), TrackPanelDrawingContext::lastState, AColor::Line(), and theTheme.

Referenced by CloseTitleDrawFunction(), and SubViewCloseHandle::Draw().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DrawItems() [1/2]

void TrackInfo::DrawItems ( TrackPanelDrawingContext context,
const wxRect &  rect,
const Track track 
)

Definition at line 217 of file TrackInfo.cpp.

220{
221 auto &trackControl = static_cast<const CommonTrackControls&>(
222 TrackControls::Get( track ) );
223 const auto &topLines = trackControl.GetTCPLines();
224 const auto &bottomLines = commonTrackTCPBottomLines;
226 ( context, rect, &track, topLines, bottomLines );
227}
virtual const TCPLines & GetTCPLines() const
Definition: TrackInfo.cpp:191
static TrackControls & Get(Track &track)
AUDACITY_DLL_API void DrawItems(TrackPanelDrawingContext &context, const wxRect &rect, const Track &track)
Definition: TrackInfo.cpp:218

References anonymous_namespace{TrackInfo.cpp}::commonTrackTCPBottomLines, DrawItems(), TrackControls::Get(), and CommonTrackControls::GetTCPLines().

Referenced by CommonTrackControls::Draw(), and DrawItems().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DrawItems() [2/2]

void TrackInfo::DrawItems ( TrackPanelDrawingContext context,
const wxRect &  rect,
const Track pTrack,
const std::vector< TCPLine > &  topLines,
const std::vector< TCPLine > &  bottomLines 
)

Definition at line 229 of file TrackInfo.cpp.

233{
234 auto dc = &context.dc;
236 dc->SetTextForeground(theTheme.Colour(clrTrackPanelText));
237
238 {
239 int yy = 0;
240 for ( const auto &line : topLines ) {
241 wxRect itemRect{
242 rect.x, rect.y + yy,
243 rect.width, line.height
244 };
245 if ( !TrackInfo::HideTopItem( rect, itemRect ) &&
246 line.drawFunction )
247 line.drawFunction( context, itemRect, pTrack );
248 yy += line.height + line.extraSpace;
249 }
250 }
251 {
252 int yy = rect.height;
253 for ( const auto &line : bottomLines ) {
254 yy -= line.height + line.extraSpace;
255 if ( line.drawFunction ) {
256 wxRect itemRect{
257 rect.x, rect.y + yy,
258 rect.width, line.height
259 };
260 line.drawFunction( context, itemRect, pTrack );
261 }
262 }
263 }
264}
AUDACITY_DLL_API bool HideTopItem(const wxRect &rect, const wxRect &subRect, int allowance=0)
Definition: TrackInfo.cpp:208

References ThemeBase::Colour(), TrackPanelDrawingContext::dc, HideTopItem(), SetTrackInfoFont(), and theTheme.

Here is the call graph for this function:

◆ GetCloseBoxHorizontalBounds()

void TrackInfo::GetCloseBoxHorizontalBounds ( const wxRect &  rect,
wxRect &  dest 
)

Definition at line 457 of file TrackInfo.cpp.

458{
459 dest.x = rect.x;
460 dest.width = kTrackInfoBtnSize;
461}
@ kTrackInfoBtnSize
Definition: ViewInfo.h:95

References kTrackInfoBtnSize.

Referenced by CloseTitleDrawFunction(), GetCloseBoxRect(), and GetTitleBarHorizontalBounds().

Here is the caller graph for this function:

◆ GetCloseBoxRect()

void TrackInfo::GetCloseBoxRect ( const wxRect &  rect,
wxRect &  dest 
)

Definition at line 463 of file TrackInfo.cpp.

464{
465 GetCloseBoxHorizontalBounds( rect, dest );
467 dest.y = rect.y + results.first;
468 dest.height = results.second;
469}
static const TCPLines & commonTrackTCPLines()
Definition: TrackInfo.cpp:104
AUDACITY_DLL_API std::pair< int, int > CalcItemY(const TCPLines &lines, unsigned iItem)
Definition: TrackInfo.cpp:146

References CalcItemY(), commonTrackTCPLines(), GetCloseBoxHorizontalBounds(), and TrackInfo::TCPLine::kItemBarButtons.

Referenced by CloseButtonHandle::HitTest().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetMinimizeHorizontalBounds()

void TrackInfo::GetMinimizeHorizontalBounds ( const wxRect &  rect,
wxRect &  dest 
)

Definition at line 494 of file TrackInfo.cpp.

495{
496 const int space = 0;// was 3.
497 dest.x = rect.x + space;
498
499 wxRect syncLockRect;
500 GetSyncLockHorizontalBounds( rect, syncLockRect );
501
502 // Width is rect.width less space on left for track select
503 // and on right for sync-lock icon.
504 dest.width = kTrackInfoBtnSize;
505// rect.width - (space + syncLockRect.width);
506}
AUDACITY_DLL_API void GetSyncLockHorizontalBounds(const wxRect &rect, wxRect &dest)
Definition: TrackInfo.cpp:543

References GetSyncLockHorizontalBounds(), and kTrackInfoBtnSize.

Referenced by GetMinimizeRect(), GetSelectButtonHorizontalBounds(), and MinimizeSyncLockDrawFunction().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetMinimizeRect()

void TrackInfo::GetMinimizeRect ( const wxRect &  rect,
wxRect &  dest 
)

Definition at line 508 of file TrackInfo.cpp.

509{
510 GetMinimizeHorizontalBounds( rect, dest );
511 auto results = CalcBottomItemY
513 dest.y = rect.y + results.first;
514 dest.height = results.second;
515}
AUDACITY_DLL_API void GetMinimizeHorizontalBounds(const wxRect &rect, wxRect &dest)
Definition: TrackInfo.cpp:494
std::pair< int, int > CalcBottomItemY(const TCPLines &lines, unsigned iItem, int height)
Definition: TrackInfo.cpp:175

References anonymous_namespace{TrackInfo.cpp}::CalcBottomItemY(), anonymous_namespace{TrackInfo.cpp}::commonTrackTCPBottomLines, GetMinimizeHorizontalBounds(), and TrackInfo::TCPLine::kItemMinimize.

Referenced by MinimizeButtonHandle::HitTest().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetSelectButtonHorizontalBounds()

void TrackInfo::GetSelectButtonHorizontalBounds ( const wxRect &  rect,
wxRect &  dest 
)

Definition at line 517 of file TrackInfo.cpp.

518{
519 const int space = 0;// was 3.
520 dest.x = rect.x + space;
521
522 wxRect syncLockRect;
523 GetSyncLockHorizontalBounds( rect, syncLockRect );
524 wxRect minimizeRect;
525 GetMinimizeHorizontalBounds( rect, minimizeRect );
526
527 dest.x = dest.x + space + minimizeRect.width;
528 // Width is rect.width less space on left for track select
529 // and on right for sync-lock icon.
530 dest.width = rect.width - (space + syncLockRect.width) - (space + minimizeRect.width);
531}

References GetMinimizeHorizontalBounds(), and GetSyncLockHorizontalBounds().

Referenced by GetSelectButtonRect(), and MinimizeSyncLockDrawFunction().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetSelectButtonRect()

void TrackInfo::GetSelectButtonRect ( const wxRect &  rect,
wxRect &  dest 
)

Definition at line 534 of file TrackInfo.cpp.

535{
537 auto results = CalcBottomItemY
539 dest.y = rect.y + results.first;
540 dest.height = results.second;
541}
AUDACITY_DLL_API void GetSelectButtonHorizontalBounds(const wxRect &rect, wxRect &dest)
Definition: TrackInfo.cpp:517

References anonymous_namespace{TrackInfo.cpp}::CalcBottomItemY(), anonymous_namespace{TrackInfo.cpp}::commonTrackTCPBottomLines, GetSelectButtonHorizontalBounds(), and TrackInfo::TCPLine::kItemMinimize.

Referenced by SelectButtonHandle::HitTest().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetSliderHorizontalBounds()

void TrackInfo::GetSliderHorizontalBounds ( const wxPoint &  topleft,
wxRect &  dest 
)

Definition at line 488 of file TrackInfo.cpp.

489{
490 dest.x = topleft.x + 6;
491 dest.width = kTrackInfoSliderWidth;
492}
@ kTrackInfoSliderWidth
Definition: ViewInfo.h:98

References kTrackInfoSliderWidth.

Referenced by WaveTrackControls::GetGainRect(), NoteTrackControls::GetVelocityRect(), anonymous_namespace{NoteTrackControls.cpp}::SliderDrawFunction(), and anonymous_namespace{WaveTrackControls.cpp}::SliderDrawFunction().

Here is the caller graph for this function:

◆ GetSyncLockHorizontalBounds()

void TrackInfo::GetSyncLockHorizontalBounds ( const wxRect &  rect,
wxRect &  dest 
)

Definition at line 543 of file TrackInfo.cpp.

544{
545 dest.width = kTrackInfoBtnSize;
546 dest.x = rect.x + rect.width - dest.width;
547}

References kTrackInfoBtnSize.

Referenced by GetMinimizeHorizontalBounds(), GetSelectButtonHorizontalBounds(), GetSyncLockIconRect(), and MinimizeSyncLockDrawFunction().

Here is the caller graph for this function:

◆ GetSyncLockIconRect()

void TrackInfo::GetSyncLockIconRect ( const wxRect &  rect,
wxRect &  dest 
)

Definition at line 549 of file TrackInfo.cpp.

550{
551 GetSyncLockHorizontalBounds( rect, dest );
552 auto results = CalcBottomItemY
554 dest.y = rect.y + results.first;
555 dest.height = results.second;
556}

References anonymous_namespace{TrackInfo.cpp}::CalcBottomItemY(), anonymous_namespace{TrackInfo.cpp}::commonTrackTCPBottomLines, GetSyncLockHorizontalBounds(), and TrackInfo::TCPLine::kItemSyncLock.

Here is the call graph for this function:

◆ GetTitleBarHorizontalBounds()

void TrackInfo::GetTitleBarHorizontalBounds ( const wxRect &  rect,
wxRect &  dest 
)

Definition at line 471 of file TrackInfo.cpp.

472{
473 // to right of CloseBoxRect, plus a little more
474 wxRect closeRect;
475 GetCloseBoxHorizontalBounds( rect, closeRect );
476 dest.x = rect.x + closeRect.width + 1;
477 dest.width = rect.x + rect.width - dest.x + TitleSoloBorderOverlap;
478}
static const int TitleSoloBorderOverlap
Definition: TrackInfo.h:29

References GetCloseBoxHorizontalBounds(), and TitleSoloBorderOverlap.

Referenced by CloseTitleDrawFunction(), and GetTitleBarRect().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetTitleBarRect()

void TrackInfo::GetTitleBarRect ( const wxRect &  rect,
wxRect &  dest 
)

Definition at line 480 of file TrackInfo.cpp.

481{
482 GetTitleBarHorizontalBounds( rect, dest );
484 dest.y = rect.y + results.first;
485 dest.height = results.second;
486}

References CalcItemY(), commonTrackTCPLines(), GetTitleBarHorizontalBounds(), and TrackInfo::TCPLine::kItemBarButtons.

Referenced by CommonTrackControls::DoContextMenu(), and MenuButtonHandle::HitTest().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ HasSoloButton()

bool TrackInfo::HasSoloButton ( )

Definition at line 95 of file TrackInfo.cpp.

96{
97 return settings().gSoloPref != wxT("None");
98}
wxT("CloseDown"))
static Settings & settings()
Definition: TrackInfo.cpp:87
wxString gSoloPref
Definition: TrackInfo.cpp:49

References Settings::gSoloPref, settings(), and wxT().

Referenced by anonymous_namespace{PlayableTrackControls.cpp}::MuteAndSoloDrawFunction().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ HideTopItem()

bool TrackInfo::HideTopItem ( const wxRect &  rect,
const wxRect &  subRect,
int  allowance = 0 
)

Definition at line 208 of file TrackInfo.cpp.

209 {
210 auto limit = CalcBottomItemY
212 // Return true if the rectangle is even touching the limit
213 // without an overlap. That was the behavior as of 2.1.3.
214 return subRect.y + subRect.height - allowance >= rect.y + limit;
215}

References anonymous_namespace{TrackInfo.cpp}::CalcBottomItemY(), anonymous_namespace{TrackInfo.cpp}::commonTrackTCPBottomLines, and TrackInfo::TCPLine::kHighestBottomItem.

Referenced by DrawItems(), EffectsButtonHandle::HitTest(), GainSliderHandle::HitTest(), MuteButtonHandle::HitTest(), NoteTrackButtonHandle::HitTest(), PanSliderHandle::HitTest(), and SoloButtonHandle::HitTest().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MinimizeSyncLockDrawFunction()

void TrackInfo::MinimizeSyncLockDrawFunction ( TrackPanelDrawingContext context,
const wxRect &  rect,
const Track pTrack 
)

Definition at line 374 of file TrackInfo.cpp.

377{
378 auto dc = &context.dc;
379 bool selected = pTrack ? pTrack->GetSelected() : true;
380 bool syncLockSelected = pTrack ? SyncLock::IsSyncLockSelected(pTrack) : true;
381 bool minimized =
382 pTrack ? TrackView::Get( *pTrack ).GetMinimized() : false;
383 {
384 wxRect bev = rect;
386 auto target = dynamic_cast<MinimizeButtonHandle*>( context.target.get() );
387 bool hit = target && target->GetTrack().get() == pTrack;
388 bool captured = hit && target->IsClicked();
389 bool down = captured && bev.Contains( context.lastState.GetPosition());
390
391 // Clear background to get rid of previous arrow
392 //AColor::MediumTrackInfo(dc, t->GetSelected());
393 //dc->DrawRectangle(bev);
394
395 AColor::Bevel2(*dc, !down, bev, selected, hit);
396
397#ifdef EXPERIMENTAL_THEMING
398 wxColour c = theTheme.Colour(clrTrackPanelText);
399 dc->SetBrush(c);
400 dc->SetPen(c);
401#else
402 AColor::Dark(dc, selected);
403#endif
404
405 AColor::Arrow(*dc,
406 bev.x - 5 + bev.width / 2,
407 bev.y - 2 + bev.height / 2,
408 10,
409 minimized);
410 }
411
412 {
413 wxRect bev = rect;
415 auto target = dynamic_cast<SelectButtonHandle*>( context.target.get() );
416 bool hit = target && target->GetTrack().get() == pTrack;
417 bool captured = hit && target->IsClicked();
418 bool down = captured && bev.Contains( context.lastState.GetPosition());
419
420 AColor::Bevel2(*dc, !down, bev, selected, hit);
421
422#ifdef EXPERIMENTAL_THEMING
423 wxColour c = theTheme.Colour(clrTrackPanelText);
424 dc->SetBrush(c);
425 dc->SetPen(c);
426#else
427 AColor::Dark(dc, selected);
428#endif
429
430 wxString str = _("Select");
431 wxCoord textWidth;
432 wxCoord textHeight;
434 dc->GetTextExtent(str, &textWidth, &textHeight);
435
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);
439 }
440
441
442 // Draw the sync-lock indicator if this track is in a sync-lock selected group.
443 if (syncLockSelected)
444 {
445 wxRect syncLockIconRect = rect;
446
447 GetSyncLockHorizontalBounds( rect, syncLockIconRect );
448 wxBitmap syncLockBitmap(theTheme.Image(bmpSyncLockIcon));
449 // Icon is 12x12 and syncLockIconRect is 16x16.
450 dc->DrawBitmap(syncLockBitmap,
451 syncLockIconRect.x + 3,
452 syncLockIconRect.y + 2,
453 true);
454 }
455}
#define str(a)
static void Dark(wxDC *dc, bool selected, bool highlight=false)
Definition: AColor.cpp:443
static bool IsSyncLockSelected(const Track *pTrack)
Definition: SyncLock.cpp:43
wxImage & Image(int iIndex)
bool GetMinimized() const
Definition: TrackView.h:52
static TrackView & Get(Track &)
Definition: TrackView.cpp:69

References _, AColor::Arrow(), AColor::Bevel2(), ThemeBase::Colour(), AColor::Dark(), TrackPanelDrawingContext::dc, TrackView::Get(), TrackView::GetMinimized(), GetMinimizeHorizontalBounds(), GetSelectButtonHorizontalBounds(), Track::GetSelected(), GetSyncLockHorizontalBounds(), ButtonHandle::GetTrack(), ThemeBase::Image(), SyncLock::IsSyncLockSelected(), TrackPanelDrawingContext::lastState, SetTrackInfoFont(), str, TrackPanelDrawingContext::target, and theTheme.

Here is the call graph for this function:

◆ MinimumTrackHeight()

unsigned TrackInfo::MinimumTrackHeight ( )

Definition at line 196 of file TrackInfo.cpp.

197{
198 unsigned height = 0;
199 if (!commonTrackTCPLines().empty())
200 height += commonTrackTCPLines().front().height;
201 if (!commonTrackTCPBottomLines.empty())
202 height += commonTrackTCPBottomLines.front().height;
203 // + 1 prevents the top item from disappearing for want of enough space,
204 // according to the rules in HideTopItem.
205 return height + kVerticalPadding + 1;
206}

References anonymous_namespace{TrackInfo.cpp}::commonTrackTCPBottomLines, commonTrackTCPLines(), and kVerticalPadding.

Referenced by anonymous_namespace{ViewMenus.cpp}::DoZoomFitV(), and CommonTrackView::GetMinimizedHeight().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetTrackInfoFont()

void TrackInfo::SetTrackInfoFont ( wxDC *  dc)
Todo:
Probably should move to 'Utils.cpp'.

Definition at line 559 of file TrackInfo.cpp.

560{
561 dc->SetFont(settings().gFont);
562}

References settings().

Referenced by CloseTitleDrawFunction(), DrawItems(), anonymous_namespace{PlayableTrackControls.cpp}::EffectsDrawFunction(), MinimizeSyncLockDrawFunction(), and anonymous_namespace{PlayableTrackControls.cpp}::MuteOrSoloDrawFunction().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ UpdatePrefs()

AUDACITY_DLL_API void TrackInfo::UpdatePrefs ( wxWindow *  pParent)