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

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

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

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

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

563{
564 int needed =
566 totalTCPLines( topLines, true ) +
568 return (unsigned) std::max(needed, (int) ChannelView::DefaultHeight);
569}
@ kVerticalPadding
Definition: ViewInfo.h:92
int totalTCPLines(const TCPLines &lines, bool omitLastExtra)
Definition: TrackInfo.cpp:126

References anonymous_namespace{TrackInfo.cpp}::commonTrackTCPBottomLines, ChannelView::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 263 of file TrackInfo.cpp.

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

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

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

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

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

454{
455 dest.x = rect.x;
456 dest.width = kTrackInfoBtnSize;
457}
@ kTrackInfoBtnSize
Definition: ViewInfo.h:96

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

460{
461 GetCloseBoxHorizontalBounds( rect, dest );
463 dest.y = rect.y + results.first;
464 dest.height = results.second;
465}
static const TCPLines & commonTrackTCPLines()
Definition: TrackInfo.cpp:100
AUDACITY_DLL_API std::pair< int, int > CalcItemY(const TCPLines &lines, unsigned iItem)
Definition: TrackInfo.cpp:142

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

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

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

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

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

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

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

531{
533 auto results = CalcBottomItemY
535 dest.y = rect.y + results.first;
536 dest.height = results.second;
537}
AUDACITY_DLL_API void GetSelectButtonHorizontalBounds(const wxRect &rect, wxRect &dest)
Definition: TrackInfo.cpp:513

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

485{
486 dest.x = topleft.x + 6;
487 dest.width = kTrackInfoSliderWidth;
488}
@ kTrackInfoSliderWidth
Definition: ViewInfo.h:99

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

540{
541 dest.width = kTrackInfoBtnSize;
542 dest.x = rect.x + rect.width - dest.width;
543}

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

546{
547 GetSyncLockHorizontalBounds( rect, dest );
548 auto results = CalcBottomItemY
550 dest.y = rect.y + results.first;
551 dest.height = results.second;
552}

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

468{
469 // to right of CloseBoxRect, plus a little more
470 wxRect closeRect;
471 GetCloseBoxHorizontalBounds( rect, closeRect );
472 dest.x = rect.x + closeRect.width + 1;
473 dest.width = rect.x + rect.width - dest.x + TitleSoloBorderOverlap;
474}
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 476 of file TrackInfo.cpp.

477{
478 GetTitleBarHorizontalBounds( rect, dest );
480 dest.y = rect.y + results.first;
481 dest.height = results.second;
482}

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

92{
93 return TracksBehaviorsSolo.ReadEnum() != SoloBehaviorNone;
94}
EnumSetting< SoloBehavior > TracksBehaviorsSolo
@ SoloBehaviorNone
Definition: PlayableTrack.h:72

References SoloBehaviorNone, and TracksBehaviorsSolo.

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

Here is the caller graph for this function:

◆ HideTopItem()

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

Definition at line 204 of file TrackInfo.cpp.

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

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

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

References _, AColor::Arrow(), AColor::Bevel2(), ThemeBase::Colour(), AColor::Dark(), TrackPanelDrawingContext::dc, ChannelView::Get(), ChannelGroup::GetChannel(), ChannelView::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 192 of file TrackInfo.cpp.

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

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

Referenced by anonymous_namespace{ViewMenus.cpp}::DoZoomFitV(), and CommonChannelView::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 555 of file TrackInfo.cpp.

556{
557 dc->SetFont(settings().gFont);
558}
static Settings & settings()
Definition: TrackInfo.cpp:83

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)

Referenced by ThemedWindowWrapper< WindowBase >::UpdatePrefs().

Here is the caller graph for this function: