Audacity  3.0.3
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 66 of file TrackInfo.h.

Function Documentation

◆ CalcItemY()

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

Definition at line 145 of file TrackInfo.cpp.

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

Referenced by GetCloseBoxRect(), 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 299 of file TrackInfo.cpp.

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

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 565 of file TrackInfo.cpp.

566 {
567  int needed =
569  totalTCPLines( topLines, true ) +
571  return (unsigned) std::max( needed, (int) TrackView::DefaultHeight );
572 }

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 266 of file TrackInfo.cpp.

269 {
270  auto dc = &context.dc;
271  bool selected = pTrack ? pTrack->GetSelected() : true;
272  bool hit = target && target->GetTrack().get() == pTrack;
273  bool captured = hit && target->IsClicked();
274  bool down = captured && bev.Contains( context.lastState.GetPosition());
275  AColor::Bevel2(*dc, !down, bev, selected, hit );
276 
277 #ifdef EXPERIMENTAL_THEMING
278  wxPen pen( theTheme.Colour( clrTrackPanelText ));
279  dc->SetPen( pen );
280 #else
281  dc->SetPen(*wxBLACK_PEN);
282 #endif
283  bev.Inflate( -1, -1 );
284  // Draw the "X"
285  const int s = 6;
286 
287  int ls = bev.x + ((bev.width - s) / 2);
288  int ts = bev.y + ((bev.height - s) / 2);
289  int rs = ls + s;
290  int bs = ts + s;
291 
292  AColor::Line(*dc, ls, ts, rs, bs);
293  AColor::Line(*dc, ls + 1, ts, rs + 1, bs);
294  AColor::Line(*dc, rs, ts, ls, bs);
295  AColor::Line(*dc, rs + 1, ts, ls + 1, bs);
296  // bev.Inflate(-1, -1);
297 }

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

Referenced by CloseTitleDrawFunction(), and anonymous_namespace{WaveTrackView.cpp}::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 216 of file TrackInfo.cpp.

219 {
220  auto &trackControl = static_cast<const CommonTrackControls&>(
221  TrackControls::Get( track ) );
222  const auto &topLines = trackControl.GetTCPLines();
223  const auto &bottomLines = commonTrackTCPBottomLines;
224  DrawItems
225  ( context, rect, &track, topLines, bottomLines );
226 }

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

Referenced by CommonTrackControls::Draw().

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 228 of file TrackInfo.cpp.

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

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 456 of file TrackInfo.cpp.

457 {
458  dest.x = rect.x;
459  dest.width = kTrackInfoBtnSize;
460 }

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 462 of file TrackInfo.cpp.

463 {
464  GetCloseBoxHorizontalBounds( rect, dest );
466  dest.y = rect.y + results.first;
467  dest.height = results.second;
468 }

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 493 of file TrackInfo.cpp.

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

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 507 of file TrackInfo.cpp.

508 {
509  GetMinimizeHorizontalBounds( rect, dest );
510  auto results = CalcBottomItemY
512  dest.y = rect.y + results.first;
513  dest.height = results.second;
514 }

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 516 of file TrackInfo.cpp.

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

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 533 of file TrackInfo.cpp.

534 {
535  GetSelectButtonHorizontalBounds( rect, dest );
536  auto results = CalcBottomItemY
538  dest.y = rect.y + results.first;
539  dest.height = results.second;
540 }

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 487 of file TrackInfo.cpp.

488 {
489  dest.x = topleft.x + 6;
490  dest.width = kTrackInfoSliderWidth;
491 }

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 542 of file TrackInfo.cpp.

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

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 548 of file TrackInfo.cpp.

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

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 470 of file TrackInfo.cpp.

471 {
472  // to right of CloseBoxRect, plus a little more
473  wxRect closeRect;
474  GetCloseBoxHorizontalBounds( rect, closeRect );
475  dest.x = rect.x + closeRect.width + 1;
476  dest.width = rect.x + rect.width - dest.x + TitleSoloBorderOverlap;
477 }

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 479 of file TrackInfo.cpp.

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

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 94 of file TrackInfo.cpp.

95 {
96  return settings().gSoloPref != wxT("None");
97 }

References Settings::gSoloPref, and settings().

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 207 of file TrackInfo.cpp.

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

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

Referenced by DrawItems(), 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 373 of file TrackInfo.cpp.

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

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

Here is the call graph for this function:

◆ MinimumTrackHeight()

unsigned TrackInfo::MinimumTrackHeight ( )

Definition at line 195 of file TrackInfo.cpp.

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

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 558 of file TrackInfo.cpp.

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

References settings().

Referenced by CloseTitleDrawFunction(), DrawItems(), 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)
TrackView::DefaultHeight
@ DefaultHeight
Definition: TrackView.h:29
ButtonHandle::IsClicked
bool IsClicked() const
Definition: ButtonHandle.h:31
TitleSoloBorderOverlap
static const int TitleSoloBorderOverlap
Definition: TrackInfo.h:29
TrackView::Get
static TrackView & Get(Track &)
Definition: TrackView.cpp:63
TrackInfo::TCPLine::kItemBarButtons
@ kItemBarButtons
Definition: TrackInfo.h:39
TrackView::GetMinimized
bool GetMinimized() const
Definition: TrackView.h:49
Track::GetName
wxString GetName() const
Definition: Track.h:426
anonymous_namespace{TrackInfo.cpp}::totalTCPLines
int totalTCPLines(const TCPLines &lines, bool omitLastExtra)
Definition: TrackInfo.cpp:129
TrackControls::Get
static TrackControls & Get(Track &track)
Definition: TrackControls.cpp:25
AColor::Bevel2
static void Bevel2(wxDC &dc, bool up, const wxRect &r, bool bSel=false, bool bHighlight=false)
Definition: AColor.cpp:211
AColor::Line
static void Line(wxDC &dc, wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
Definition: AColor.cpp:112
CommonTrackControls
Definition: CommonTrackControls.h:27
TrackInfo::CalcItemY
AUDACITY_DLL_API std::pair< int, int > CalcItemY(const TCPLines &lines, unsigned iItem)
Definition: TrackInfo.cpp:145
anonymous_namespace{TrackInfo.cpp}::CalcBottomItemY
std::pair< int, int > CalcBottomItemY(const TCPLines &lines, unsigned iItem, int height)
Definition: TrackInfo.cpp:174
kTrackInfoBtnSize
@ kTrackInfoBtnSize
Definition: ViewInfo.h:108
TrackPanelDrawingContext::dc
wxDC & dc
Definition: TrackPanelDrawingContext.h:23
MenuButtonHandle
Definition: TrackButtonHandles.h:100
TrackInfo::TCPLine::kItemMinimize
@ kItemMinimize
Definition: TrackInfo.h:47
ButtonHandle::GetTrack
std::shared_ptr< Track > GetTrack() const
Definition: ButtonHandle.h:30
TrackInfo::DrawItems
AUDACITY_DLL_API void DrawItems(TrackPanelDrawingContext &context, const wxRect &rect, const Track &track)
Definition: TrackInfo.cpp:217
Track::IsSyncLockSelected
bool IsSyncLockSelected() const
Definition: Track.cpp:254
TrackInfo::GetCloseBoxHorizontalBounds
AUDACITY_DLL_API void GetCloseBoxHorizontalBounds(const wxRect &rect, wxRect &dest)
Definition: TrackInfo.cpp:456
TrackInfo::GetTitleBarHorizontalBounds
AUDACITY_DLL_API void GetTitleBarHorizontalBounds(const wxRect &rect, wxRect &dest)
Definition: TrackInfo.cpp:470
TrackInfo::SetTrackInfoFont
AUDACITY_DLL_API void SetTrackInfoFont(wxDC *dc)
Definition: TrackInfo.cpp:558
TrackInfo::DrawCloseButton
AUDACITY_DLL_API void DrawCloseButton(TrackPanelDrawingContext &context, const wxRect &bev, const Track *pTrack, ButtonHandle *target)
Definition: TrackInfo.cpp:266
TrackPanelDrawingContext::lastState
wxMouseState lastState
Definition: TrackPanelDrawingContext.h:25
kVerticalPadding
@ kVerticalPadding
Definition: ViewInfo.h:104
ThemeBase::Image
wxImage & Image(int iIndex)
Definition: Theme.cpp:1223
CloseButtonHandle
Definition: TrackButtonHandles.h:71
AColor::Arrow
static void Arrow(wxDC &dc, wxCoord x, wxCoord y, int width, bool down=true)
Definition: AColor.cpp:85
Track::GetSelected
bool GetSelected() const
Definition: Track.h:431
Settings::gSoloPref
wxString gSoloPref
Definition: TrackInfo.cpp:48
TrackInfo::HideTopItem
AUDACITY_DLL_API bool HideTopItem(const wxRect &rect, const wxRect &subRect, int allowance=0)
Definition: TrackInfo.cpp:207
TrackInfo::GetMinimizeHorizontalBounds
AUDACITY_DLL_API void GetMinimizeHorizontalBounds(const wxRect &rect, wxRect &dest)
Definition: TrackInfo.cpp:493
AColor::Dark
static void Dark(wxDC *dc, bool selected, bool highlight=false)
Definition: AColor.cpp:354
anonymous_namespace{TrackInfo.cpp}::commonTrackTCPBottomLines
TCPLines commonTrackTCPBottomLines
Definition: TrackInfo.cpp:170
_
#define _(s)
Definition: Internat.h:75
commonTrackTCPLines
static const TCPLines & commonTrackTCPLines()
Definition: TrackInfo.cpp:103
TrackInfo::GetSyncLockHorizontalBounds
AUDACITY_DLL_API void GetSyncLockHorizontalBounds(const wxRect &rect, wxRect &dest)
Definition: TrackInfo.cpp:542
SelectButtonHandle
Definition: TrackButtonHandles.h:45
TrackInfo::TCPLine::kHighestBottomItem
@ kHighestBottomItem
Definition: TrackInfo.h:51
TrackPanelDrawingContext::target
UIHandlePtr target
Definition: TrackPanelDrawingContext.h:24
ThemeBase::Colour
wxColour & Colour(int iIndex)
Definition: Theme.cpp:1197
theTheme
AUDACITY_DLL_API Theme theTheme
Definition: Theme.cpp:203
TrackInfo::TCPLine::kItemSyncLock
@ kItemSyncLock
Definition: TrackInfo.h:48
settings
static Settings & settings()
Definition: TrackInfo.cpp:86
CommonTrackControls::GetTCPLines
virtual const TCPLines & GetTCPLines() const
Definition: TrackInfo.cpp:190
TrackInfo::GetSelectButtonHorizontalBounds
AUDACITY_DLL_API void GetSelectButtonHorizontalBounds(const wxRect &rect, wxRect &dest)
Definition: TrackInfo.cpp:516
MinimizeButtonHandle
Definition: TrackButtonHandles.h:19
kTrackInfoSliderWidth
@ kTrackInfoSliderWidth
Definition: ViewInfo.h:110