Audacity 3.2.0
Public Member Functions | Public Attributes | List of all members
anonymous_namespace{TrackPanel.cpp}::LabeledChannelGroup Struct Referencefinal
Inheritance diagram for anonymous_namespace{TrackPanel.cpp}::LabeledChannelGroup:
[legend]
Collaboration diagram for anonymous_namespace{TrackPanel.cpp}::LabeledChannelGroup:
[legend]

Public Member Functions

 LabeledChannelGroup (const std::shared_ptr< Track > &pTrack, wxCoord leftOffset)
 
Subdivision Children (const wxRect &rect) override
 
void Draw (TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass) override
 
wxRect DrawingArea (TrackPanelDrawingContext &, const wxRect &rect, const wxRect &, unsigned iPass) override
 
- Public Member Functions inherited from TrackPanelGroup
 TrackPanelGroup ()
 
virtual ~TrackPanelGroup ()
 
virtual Subdivision Children (const wxRect &rect)=0
 
- Public Member Functions inherited from TrackPanelNode
 TrackPanelNode ()
 
virtual ~TrackPanelNode ()=0
 
- Public Member Functions inherited from TrackPanelDrawable
virtual ~TrackPanelDrawable ()=0
 
virtual void Draw (TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass)
 
virtual wxRect DrawingArea (TrackPanelDrawingContext &context, const wxRect &rect, const wxRect &panelRect, unsigned iPass)
 

Public Attributes

const std::shared_ptr< TrackmpTrack
 
wxCoord mLeftOffset
 

Additional Inherited Members

- Public Types inherited from TrackPanelGroup
enum class  Axis { X , Y }
 
using Child = std::pair< wxCoord, std::shared_ptr< TrackPanelNode > >
 
using Refinement = std::vector< Child >
 
using Subdivision = std::pair< Axis, Refinement >
 
- Static Public Member Functions inherited from TrackPanelDrawable
static wxRect MaximizeWidth (const wxRect &rect, const wxRect &panelRect)
 
static wxRect MaximizeHeight (const wxRect &rect, const wxRect &panelRect)
 

Detailed Description

Definition at line 1357 of file TrackPanel.cpp.

Constructor & Destructor Documentation

◆ LabeledChannelGroup()

anonymous_namespace{TrackPanel.cpp}::LabeledChannelGroup::LabeledChannelGroup ( const std::shared_ptr< Track > &  pTrack,
wxCoord  leftOffset 
)
inline

Definition at line 1358 of file TrackPanel.cpp.

Member Function Documentation

◆ Children()

Subdivision anonymous_namespace{TrackPanel.cpp}::LabeledChannelGroup::Children ( const wxRect &  rect)
inlineoverridevirtual

Implements TrackPanelGroup.

Definition at line 1361 of file TrackPanel.cpp.

1362 { return { Axis::X, Refinement{
1363 { rect.GetLeft(),
1364 TrackControls::Get(*mpTrack).shared_from_this() },
1365 { rect.GetLeft() + kTrackInfoWidth,
1366 std::make_shared<ChannelStack>(mpTrack, mLeftOffset) }
1367 } }; }
@ kTrackInfoWidth
Definition: ZoomInfo.h:30
static TrackControls & Get(Track &track)
std::vector< Child > Refinement

References TrackControls::Get(), and kTrackInfoWidth.

Here is the call graph for this function:

◆ Draw()

void anonymous_namespace{TrackPanel.cpp}::LabeledChannelGroup::Draw ( TrackPanelDrawingContext context,
const wxRect &  rect,
unsigned  iPass 
)
inlineoverridevirtual

Draw a three-level highlight gradient around the focused track.

Reimplemented from TrackPanelDrawable.

Definition at line 1370 of file TrackPanel.cpp.

1372 {
1373 if (iPass == TrackArtist::PassBorders) {
1374 auto &dc = context.dc;
1375 dc.SetBrush(*wxTRANSPARENT_BRUSH);
1376 dc.SetPen(*wxBLACK_PEN);
1377
1378 // border
1379 dc.DrawRectangle(
1380 rect.x, rect.y,
1381 rect.width - kShadowThickness, rect.height - kShadowThickness
1382 );
1383
1384 // shadow
1385 // Stroke lines along bottom and right, which are slightly short at
1386 // bottom-left and top-right
1387 const auto right = rect.GetRight();
1388 const auto bottom = rect.GetBottom();
1389
1390 // bottom
1391 AColor::Line(dc, rect.x + 2, bottom, right, bottom);
1392 // right
1393 AColor::Line(dc, right, rect.y + 2, right, bottom);
1394 }
1395 if (iPass == TrackArtist::PassFocus) {
1396 // Sometimes highlight is not drawn on backing bitmap. I thought
1397 // it was because FindFocus did not return the TrackPanel on Mac, but
1398 // when I removed that test, yielding this condition:
1399 // if (GetFocusedTrack() != NULL) {
1400 // the highlight was reportedly drawn even when something else
1401 // was the focus and no highlight should be drawn. -RBD
1402 const auto artist = TrackArtist::Get(context);
1403 auto &trackPanel = *artist->parent;
1404 auto &trackFocus = TrackFocus::Get( *trackPanel.GetProject() );
1405 if (trackFocus.Get() == mpTrack.get() &&
1406 wxWindow::FindFocus() == &trackPanel) {
1408 wxRect theRect = rect;
1409 auto &dc = context.dc;
1410 dc.SetBrush(*wxTRANSPARENT_BRUSH);
1411
1412 AColor::TrackFocusPen(&dc, 2);
1413 dc.DrawRectangle(theRect);
1414 theRect.Deflate(1);
1415
1416 AColor::TrackFocusPen(&dc, 1);
1417 dc.DrawRectangle(theRect);
1418 theRect.Deflate(1);
1419
1420 AColor::TrackFocusPen(&dc, 0);
1421 dc.DrawRectangle(theRect);
1422 }
1423 }
1424 }
@ kShadowThickness
Definition: ZoomInfo.h:23
static void Line(wxDC &dc, wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
Definition: AColor.cpp:185
static void TrackFocusPen(wxDC *dc, int level)
Definition: AColor.cpp:467
static TrackArtist * Get(TrackPanelDrawingContext &)
Definition: TrackArtist.cpp:69
Track * Get()
Definition: TrackFocus.cpp:156
std::unique_ptr< WindowPlacement > FindFocus()
Find the window that is accepting keyboard input, if any.
Definition: BasicUI.h:375

References TrackPanelDrawingContext::dc, BasicUI::FindFocus(), TrackFocus::Get(), TrackArtist::Get(), kShadowThickness, AColor::Line(), TrackArtist::PassBorders, TrackArtist::PassFocus, and AColor::TrackFocusPen().

Here is the call graph for this function:

◆ DrawingArea()

wxRect anonymous_namespace{TrackPanel.cpp}::LabeledChannelGroup::DrawingArea ( TrackPanelDrawingContext ,
const wxRect &  rect,
const wxRect &  ,
unsigned  iPass 
)
inlineoverridevirtual

Reimplemented from TrackPanelDrawable.

Definition at line 1426 of file TrackPanel.cpp.

1428 {
1429 if (iPass == TrackArtist::PassBorders)
1430 return {
1431 rect.x - kBorderThickness,
1432 rect.y - kBorderThickness,
1433 rect.width + 2 * kBorderThickness + kShadowThickness,
1434 rect.height + 2 * kBorderThickness + kShadowThickness
1435 };
1436 else if (iPass == TrackArtist::PassFocus) {
1437 constexpr auto extra = kBorderThickness + 3;
1438 return {
1439 rect.x - extra,
1440 rect.y - extra,
1441 rect.width + 2 * extra + kShadowThickness,
1442 rect.height + 2 * extra + kShadowThickness
1443 };
1444 }
1445 else
1446 return rect;
1447 }
@ kBorderThickness
Definition: ZoomInfo.h:22

References kBorderThickness, kShadowThickness, TrackArtist::PassBorders, and TrackArtist::PassFocus.

Member Data Documentation

◆ mLeftOffset

wxCoord anonymous_namespace{TrackPanel.cpp}::LabeledChannelGroup::mLeftOffset

Definition at line 1450 of file TrackPanel.cpp.

◆ mpTrack

const std::shared_ptr<Track> anonymous_namespace{TrackPanel.cpp}::LabeledChannelGroup::mpTrack

Definition at line 1449 of file TrackPanel.cpp.


The documentation for this struct was generated from the following file: