Audacity 3.2.0
Typedefs | Functions
CommonTrackInfo 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...

Typedefs

using TCPLine = TrackInfo::TCPLine
 
using TCPLines = TrackInfo::TCPLines
 

Functions

AUDACITY_DLL_API unsigned MinimumTrackHeight ()
 
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, UIHandle *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 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 const TCPLinesStaticTCPLines ()
 

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

◆ TCPLine

Definition at line 21 of file CommonTrackInfo.h.

◆ TCPLines

Definition at line 22 of file CommonTrackInfo.h.

Function Documentation

◆ CloseTitleDrawFunction()

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

Definition at line 208 of file CommonTrackInfo.cpp.

211{
212 auto dc = &context.dc;
213 bool selected = pTrack ? pTrack->GetSelected() : true;
214 {
215 wxRect bev = rect;
216 GetCloseBoxHorizontalBounds( rect, bev );
217 auto target = context.target.get();
218 DrawCloseButton( context, bev, pTrack, target );
219 }
220
221 {
222 wxRect bev = rect;
223 GetTitleBarHorizontalBounds( rect, bev );
224 auto target = context.target.get();
225 bool hit = target &&
226 target->FindChannel().get() == dynamic_cast<const Channel*>(pTrack);
227 bool captured = hit && target->IsDragging();
228 bool down = captured && bev.Contains( context.lastState.GetPosition());
229 wxString titleStr =
230 pTrack ? pTrack->GetName() : _("Name");
231
232 //bev.Inflate(-1, -1);
233 AColor::Bevel2(*dc, !down, bev, selected, hit);
234
235 // Draw title text
237
238 // Bug 1660 The 'k' of 'Audio Track' was being truncated.
239 // Constant of 32 found by counting pixels on a windows machine.
240 // I believe it's the size of the X close button + the size of the
241 // drop down arrow.
242 int allowableWidth = rect.width - 32;
243
244 wxCoord textWidth, textHeight;
245 dc->GetTextExtent(titleStr, &textWidth, &textHeight);
246 while (textWidth > allowableWidth) {
247 titleStr = titleStr.Left(titleStr.length() - 1);
248 dc->GetTextExtent(titleStr, &textWidth, &textHeight);
249 }
250
251 // Pop-up triangle
252 #ifdef EXPERIMENTAL_THEMING
253 wxColour c = theTheme.Colour( clrTrackPanelText );
254 #else
255 wxColour c = *wxBLACK;
256 #endif
257
258 // wxGTK leaves little scraps (antialiasing?) of the
259 // characters if they are repeatedly drawn. This
260 // happens when holding down mouse button and moving
261 // in and out of the title bar. So clear it first.
262 // AColor::MediumTrackInfo(dc, t->GetSelected());
263 // dc->DrawRectangle(bev);
264
265 dc->SetTextForeground( c );
266 dc->SetTextBackground( wxTRANSPARENT );
267 dc->DrawText(titleStr, bev.x + 2, bev.y + (bev.height - textHeight) / 2);
268
269
270
271 dc->SetPen(c);
272 dc->SetBrush(c);
273
274 int s = 10; // Width of dropdown arrow...height is half of width
275 AColor::Arrow(*dc,
276 bev.GetRight() - s - 3, // 3 to offset from right border
277 bev.y + ((bev.height - (s / 2)) / 2),
278 s);
279
280 }
281}
#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
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 GetCloseBoxHorizontalBounds(const wxRect &rect, wxRect &dest)
AUDACITY_DLL_API void GetTitleBarHorizontalBounds(const wxRect &rect, wxRect &dest)
AUDACITY_DLL_API void DrawCloseButton(TrackPanelDrawingContext &context, const wxRect &bev, const Track *pTrack, UIHandle *target)
AUDACITY_DLL_API void SetTrackInfoFont(wxDC *dc)
Definition: TrackInfo.cpp:95

References _, AColor::Arrow(), AColor::Bevel2(), ThemeBase::Colour(), TrackPanelDrawingContext::dc, DrawCloseButton(), GetCloseBoxHorizontalBounds(), Track::GetName(), Track::GetSelected(), GetTitleBarHorizontalBounds(), TrackPanelDrawingContext::lastState, TrackInfo::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 CommonTrackInfo::DefaultTrackHeight ( const TCPLines topLines)

Definition at line 469 of file CommonTrackInfo.cpp.

470{
471 int needed =
473 totalTCPLines( topLines, true ) +
475 return (unsigned) std::max(needed, (int) ChannelView::DefaultHeight);
476}
@ kVerticalPadding
Definition: ViewInfo.h:92
int totalTCPLines(const TCPLines &lines, bool omitLastExtra)

References anonymous_namespace{CommonTrackInfo.cpp}::commonTrackTCPBottomLines, ChannelView::DefaultHeight, kVerticalPadding, and anonymous_namespace{CommonTrackInfo.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 CommonTrackInfo::DrawCloseButton ( TrackPanelDrawingContext context,
const wxRect &  bev,
const Track pTrack,
UIHandle target 
)

Definition at line 174 of file CommonTrackInfo.cpp.

177{
178 auto dc = &context.dc;
179 bool selected = pTrack ? pTrack->GetSelected() : true;
180 bool hit = target &&
181 target->FindChannel().get() == dynamic_cast<const Channel*>(pTrack);
182 bool captured = hit && target->IsDragging();
183 bool down = captured && bev.Contains( context.lastState.GetPosition());
184 AColor::Bevel2(*dc, !down, bev, selected, hit );
185
186#ifdef EXPERIMENTAL_THEMING
187 wxPen pen( theTheme.Colour( clrTrackPanelText ));
188 dc->SetPen( pen );
189#else
190 dc->SetPen(*wxBLACK_PEN);
191#endif
192 bev.Inflate( -1, -1 );
193 // Draw the "X"
194 const int s = 6;
195
196 int ls = bev.x + ((bev.width - s) / 2);
197 int ts = bev.y + ((bev.height - s) / 2);
198 int rs = ls + s;
199 int bs = ts + s;
200
201 AColor::Line(*dc, ls, ts, rs, bs);
202 AColor::Line(*dc, ls + 1, ts, rs + 1, bs);
203 AColor::Line(*dc, rs, ts, ls, bs);
204 AColor::Line(*dc, rs + 1, ts, ls + 1, bs);
205 // bev.Inflate(-1, -1);
206}
static void Line(wxDC &dc, wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
Definition: AColor.cpp:187
virtual std::shared_ptr< const Channel > FindChannel() const =0
virtual bool IsDragging() const
Definition: UIHandle.cpp:58

References AColor::Bevel2(), ThemeBase::Colour(), TrackPanelDrawingContext::dc, UIHandle::FindChannel(), Track::GetSelected(), UIHandle::IsDragging(), 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 CommonTrackInfo::DrawItems ( TrackPanelDrawingContext context,
const wxRect &  rect,
const Track track 
)

Definition at line 126 of file CommonTrackInfo.cpp.

129{
130 auto &trackControl = TrackControls::Get(track);
131 const auto &topLines = trackControl.GetTCPLines();
132 const auto &bottomLines = commonTrackTCPBottomLines;
134 ( context, rect, &track, topLines, bottomLines );
135}
static TrackControls & Get(Track &track)
AUDACITY_DLL_API void DrawItems(TrackPanelDrawingContext &context, const wxRect &rect, const Track &track)

References anonymous_namespace{CommonTrackInfo.cpp}::commonTrackTCPBottomLines, DrawItems(), and TrackControls::Get().

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 CommonTrackInfo::DrawItems ( TrackPanelDrawingContext context,
const wxRect &  rect,
const Track pTrack,
const std::vector< TCPLine > &  topLines,
const std::vector< TCPLine > &  bottomLines 
)

Definition at line 137 of file CommonTrackInfo.cpp.

141{
142 auto dc = &context.dc;
144 dc->SetTextForeground(theTheme.Colour(clrTrackPanelText));
145
146 {
147 int yy = 0;
148 for ( const auto &line : topLines ) {
149 wxRect itemRect{
150 rect.x, rect.y + yy,
151 rect.width, line.height
152 };
153 if ( !CommonTrackInfo::HideTopItem( rect, itemRect ) &&
154 line.drawFunction )
155 line.drawFunction( context, itemRect, pTrack );
156 yy += line.height + line.extraSpace;
157 }
158 }
159 {
160 int yy = rect.height;
161 for ( const auto &line : bottomLines ) {
162 yy -= line.height + line.extraSpace;
163 if ( line.drawFunction ) {
164 wxRect itemRect{
165 rect.x, rect.y + yy,
166 rect.width, line.height
167 };
168 line.drawFunction( context, itemRect, pTrack );
169 }
170 }
171 }
172}
AUDACITY_DLL_API bool HideTopItem(const wxRect &rect, const wxRect &subRect, int allowance=0)

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

Here is the call graph for this function:

◆ GetCloseBoxHorizontalBounds()

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

Definition at line 368 of file CommonTrackInfo.cpp.

369{
370 dest.x = rect.x;
371 dest.width = kTrackInfoBtnSize;
372}
@ kTrackInfoBtnSize
Definition: ViewInfo.h:96

References kTrackInfoBtnSize.

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

Here is the caller graph for this function:

◆ GetCloseBoxRect()

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

Definition at line 374 of file CommonTrackInfo.cpp.

375{
376 GetCloseBoxHorizontalBounds( rect, dest );
378 dest.y = rect.y + results.first;
379 dest.height = results.second;
380}
static const TCPLines & commonTrackTCPLines()
AUDACITY_DLL_API std::pair< int, int > CalcItemY(const TCPLines &lines, unsigned iItem)
Definition: TrackInfo.cpp:79

References TrackInfo::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 CommonTrackInfo::GetMinimizeHorizontalBounds ( const wxRect &  rect,
wxRect &  dest 
)

Definition at line 405 of file CommonTrackInfo.cpp.

406{
407 const int space = 0;// was 3.
408 dest.x = rect.x + space;
409
410 wxRect syncLockRect;
411 GetSyncLockHorizontalBounds( rect, syncLockRect );
412
413 // Width is rect.width less space on left for track select
414 // and on right for sync-lock icon.
415 dest.width = kTrackInfoBtnSize;
416// rect.width - (space + syncLockRect.width);
417}
AUDACITY_DLL_API void GetSyncLockHorizontalBounds(const wxRect &rect, wxRect &dest)

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 CommonTrackInfo::GetMinimizeRect ( const wxRect &  rect,
wxRect &  dest 
)

Definition at line 419 of file CommonTrackInfo.cpp.

420{
421 GetMinimizeHorizontalBounds( rect, dest );
422 auto results = CalcBottomItemY
424 dest.y = rect.y + results.first;
425 dest.height = results.second;
426}
AUDACITY_DLL_API void GetMinimizeHorizontalBounds(const wxRect &rect, wxRect &dest)
std::pair< int, int > CalcBottomItemY(const TCPLines &lines, unsigned iItem, int height)

References anonymous_namespace{CommonTrackInfo.cpp}::CalcBottomItemY(), anonymous_namespace{CommonTrackInfo.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 CommonTrackInfo::GetSelectButtonHorizontalBounds ( const wxRect &  rect,
wxRect &  dest 
)

Definition at line 428 of file CommonTrackInfo.cpp.

429{
430 const int space = 0;// was 3.
431 dest.x = rect.x + space;
432
433 wxRect syncLockRect;
434 GetSyncLockHorizontalBounds( rect, syncLockRect );
435 wxRect minimizeRect;
436 GetMinimizeHorizontalBounds( rect, minimizeRect );
437
438 dest.x = dest.x + space + minimizeRect.width;
439 // Width is rect.width less space on left for track select
440 // and on right for sync-lock icon.
441 dest.width = rect.width - (space + syncLockRect.width) - (space + minimizeRect.width);
442}

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 CommonTrackInfo::GetSelectButtonRect ( const wxRect &  rect,
wxRect &  dest 
)

Definition at line 445 of file CommonTrackInfo.cpp.

446{
448 auto results = CalcBottomItemY
450 dest.y = rect.y + results.first;
451 dest.height = results.second;
452}
AUDACITY_DLL_API void GetSelectButtonHorizontalBounds(const wxRect &rect, wxRect &dest)

References anonymous_namespace{CommonTrackInfo.cpp}::CalcBottomItemY(), anonymous_namespace{CommonTrackInfo.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 CommonTrackInfo::GetSliderHorizontalBounds ( const wxPoint &  topleft,
wxRect &  dest 
)

Definition at line 399 of file CommonTrackInfo.cpp.

400{
401 dest.x = topleft.x + 6;
402 dest.width = kTrackInfoSliderWidth;
403}
@ 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 CommonTrackInfo::GetSyncLockHorizontalBounds ( const wxRect &  rect,
wxRect &  dest 
)

Definition at line 454 of file CommonTrackInfo.cpp.

455{
456 dest.width = kTrackInfoBtnSize;
457 dest.x = rect.x + rect.width - dest.width;
458}

References kTrackInfoBtnSize.

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

Here is the caller graph for this function:

◆ GetSyncLockIconRect()

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

Definition at line 460 of file CommonTrackInfo.cpp.

461{
462 GetSyncLockHorizontalBounds( rect, dest );
463 auto results = CalcBottomItemY
465 dest.y = rect.y + results.first;
466 dest.height = results.second;
467}

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

Here is the call graph for this function:

◆ GetTitleBarHorizontalBounds()

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

Definition at line 382 of file CommonTrackInfo.cpp.

383{
384 // to right of CloseBoxRect, plus a little more
385 wxRect closeRect;
386 GetCloseBoxHorizontalBounds( rect, closeRect );
387 dest.x = rect.x + closeRect.width + 1;
388 dest.width = rect.x + rect.width - dest.x + TitleSoloBorderOverlap;
389}
static const int TitleSoloBorderOverlap

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 CommonTrackInfo::GetTitleBarRect ( const wxRect &  rect,
wxRect &  dest 
)

Definition at line 391 of file CommonTrackInfo.cpp.

392{
393 GetTitleBarHorizontalBounds( rect, dest );
395 dest.y = rect.y + results.first;
396 dest.height = results.second;
397}

References TrackInfo::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:

◆ HideTopItem()

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

Definition at line 117 of file CommonTrackInfo.cpp.

118 {
119 auto limit = CalcBottomItemY
121 // Return true if the rectangle is even touching the limit
122 // without an overlap. That was the behavior as of 2.1.3.
123 return subRect.y + subRect.height - allowance >= rect.y + limit;
124}

References anonymous_namespace{CommonTrackInfo.cpp}::CalcBottomItemY(), anonymous_namespace{CommonTrackInfo.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 CommonTrackInfo::MinimizeSyncLockDrawFunction ( TrackPanelDrawingContext context,
const wxRect &  rect,
const Track pTrack 
)

Definition at line 283 of file CommonTrackInfo.cpp.

286{
287 auto dc = &context.dc;
288 bool selected = pTrack ? pTrack->GetSelected() : true;
289 bool syncLockSelected = pTrack ? SyncLock::IsSyncLockSelected(pTrack) : true;
290 bool minimized =
291 pTrack ? ChannelView::Get(*pTrack->GetChannel(0)).GetMinimized() : false;
292 {
293 wxRect bev = rect;
295 auto target = context.target.get();
296 bool hit = target &&
297 target->FindChannel().get() == dynamic_cast<const Channel*>(pTrack);
298 bool captured = hit && target->IsDragging();
299 bool down = captured && bev.Contains( context.lastState.GetPosition());
300
301 // Clear background to get rid of previous arrow
302 //AColor::MediumTrackInfo(dc, t->GetSelected());
303 //dc->DrawRectangle(bev);
304
305 AColor::Bevel2(*dc, !down, bev, selected, hit);
306
307#ifdef EXPERIMENTAL_THEMING
308 wxColour c = theTheme.Colour(clrTrackPanelText);
309 dc->SetBrush(c);
310 dc->SetPen(c);
311#else
312 AColor::Dark(dc, selected);
313#endif
314
315 AColor::Arrow(*dc,
316 bev.x - 5 + bev.width / 2,
317 bev.y - 2 + bev.height / 2,
318 10,
319 minimized);
320 }
321
322 {
323 wxRect bev = rect;
325 auto target = context.target.get();
326 bool hit = target &&
327 target->FindChannel().get() == dynamic_cast<const Channel*>(pTrack);
328 bool captured = hit && target->IsDragging();
329 bool down = captured && bev.Contains( context.lastState.GetPosition());
330
331 AColor::Bevel2(*dc, !down, bev, selected, hit);
332
333#ifdef EXPERIMENTAL_THEMING
334 wxColour c = theTheme.Colour(clrTrackPanelText);
335 dc->SetBrush(c);
336 dc->SetPen(c);
337#else
338 AColor::Dark(dc, selected);
339#endif
340
341 wxString str = _("Select");
342 wxCoord textWidth;
343 wxCoord textHeight;
345 dc->GetTextExtent(str, &textWidth, &textHeight);
346
347 dc->SetTextForeground( c );
348 dc->SetTextBackground( wxTRANSPARENT );
349 dc->DrawText(str, bev.x + 2 + (bev.width-textWidth)/2, bev.y + (bev.height - textHeight) / 2);
350 }
351
352
353 // Draw the sync-lock indicator if this track is in a sync-lock selected group.
354 if (syncLockSelected)
355 {
356 wxRect syncLockIconRect = rect;
357
358 GetSyncLockHorizontalBounds( rect, syncLockIconRect );
359 wxBitmap syncLockBitmap(theTheme.Image(bmpSyncLockIcon));
360 // Icon is 12x12 and syncLockIconRect is 16x16.
361 dc->DrawBitmap(syncLockBitmap,
362 syncLockIconRect.x + 3,
363 syncLockIconRect.y + 2,
364 true);
365 }
366}
#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(), ThemeBase::Image(), SyncLock::IsSyncLockSelected(), TrackPanelDrawingContext::lastState, TrackInfo::SetTrackInfoFont(), str, TrackPanelDrawingContext::target, and theTheme.

Here is the call graph for this function:

◆ MinimumTrackHeight()

unsigned CommonTrackInfo::MinimumTrackHeight ( )

Definition at line 105 of file CommonTrackInfo.cpp.

106{
107 unsigned height = 0;
108 if (!commonTrackTCPLines().empty())
109 height += commonTrackTCPLines().front().height;
110 if (!commonTrackTCPBottomLines.empty())
111 height += commonTrackTCPBottomLines.front().height;
112 // + 1 prevents the top item from disappearing for want of enough space,
113 // according to the rules in HideTopItem.
114 return height + kVerticalPadding + 1;
115}

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

Referenced by CommonChannelView::GetMinimizedHeight(), and ProjectWindow::MinimumTrackHeight().

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

◆ StaticTCPLines()

const TCPLines & CommonTrackInfo::StaticTCPLines ( )

Definition at line 54 of file CommonTrackInfo.cpp.

55{
56 return commonTrackTCPLines();
57}

References commonTrackTCPLines().

Referenced by CommonTrackControls::GetTCPLines(), PlayableTrackControls::StaticNoteTCPLines(), and PlayableTrackControls::StaticWaveTCPLines().

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