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

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 1478 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 1479 of file TrackPanel.cpp.

Member Function Documentation

◆ Children()

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

Implements TrackPanelGroup.

Definition at line 1482 of file TrackPanel.cpp.

1483 { return { Axis::X, Refinement{
1484 { rect.GetLeft(),
1485 TrackControls::Get( *mpTrack ).shared_from_this() },
1486 { rect.GetLeft() + kTrackInfoWidth,
1487 std::make_shared< ChannelGroup >( mpTrack, mLeftOffset ) }
1488 } }; }
@ kTrackInfoWidth
Definition: ZoomInfo.h:36
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 1491 of file TrackPanel.cpp.

1493 {
1494 if ( iPass == TrackArtist::PassBorders ) {
1495 auto &dc = context.dc;
1496 dc.SetBrush(*wxTRANSPARENT_BRUSH);
1497 dc.SetPen(*wxBLACK_PEN);
1498
1499 // border
1500 dc.DrawRectangle(
1501 rect.x, rect.y,
1502 rect.width - kShadowThickness, rect.height - kShadowThickness
1503 );
1504
1505 // shadow
1506 // Stroke lines along bottom and right, which are slightly short at
1507 // bottom-left and top-right
1508 const auto right = rect.GetRight();
1509 const auto bottom = rect.GetBottom();
1510
1511 // bottom
1512 AColor::Line(dc, rect.x + 2, bottom, right, bottom);
1513 // right
1514 AColor::Line(dc, right, rect.y + 2, right, bottom);
1515 }
1516 if ( iPass == TrackArtist::PassFocus ) {
1517 // Sometimes highlight is not drawn on backing bitmap. I thought
1518 // it was because FindFocus did not return the TrackPanel on Mac, but
1519 // when I removed that test, yielding this condition:
1520 // if (GetFocusedTrack() != NULL) {
1521 // the highlight was reportedly drawn even when something else
1522 // was the focus and no highlight should be drawn. -RBD
1523 const auto artist = TrackArtist::Get( context );
1524 auto &trackPanel = *artist->parent;
1525 auto &trackFocus = TrackFocus::Get( *trackPanel.GetProject() );
1526 if (trackFocus.Get() == mpTrack.get() &&
1527 wxWindow::FindFocus() == &trackPanel ) {
1529 wxRect theRect = rect;
1530 auto &dc = context.dc;
1531 dc.SetBrush(*wxTRANSPARENT_BRUSH);
1532
1533 AColor::TrackFocusPen( &dc, 2 );
1534 dc.DrawRectangle(theRect);
1535 theRect.Deflate(1);
1536
1537 AColor::TrackFocusPen( &dc, 1 );
1538 dc.DrawRectangle(theRect);
1539 theRect.Deflate(1);
1540
1541 AColor::TrackFocusPen( &dc, 0 );
1542 dc.DrawRectangle(theRect);
1543 }
1544 }
1545 }
@ kShadowThickness
Definition: ZoomInfo.h:29
static void Line(wxDC &dc, wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
Definition: AColor.cpp:187
static void TrackFocusPen(wxDC *dc, int level)
Definition: AColor.cpp:481
static TrackArtist * Get(TrackPanelDrawingContext &)
Definition: TrackArtist.cpp:69
Track * Get()

References TrackPanelDrawingContext::dc, 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 1547 of file TrackPanel.cpp.

1550 {
1551 if ( iPass == TrackArtist::PassBorders )
1552 return {
1553 rect.x - kBorderThickness,
1554 rect.y - kBorderThickness,
1555 rect.width + 2 * kBorderThickness + kShadowThickness,
1556 rect.height + 2 * kBorderThickness + kShadowThickness
1557 };
1558 else if ( iPass == TrackArtist::PassFocus ) {
1559 constexpr auto extra = kBorderThickness + 3;
1560 return {
1561 rect.x - extra,
1562 rect.y - extra,
1563 rect.width + 2 * extra + kShadowThickness,
1564 rect.height + 2 * extra + kShadowThickness
1565 };
1566 }
1567 else
1568 return rect;
1569 }
@ kBorderThickness
Definition: ZoomInfo.h:28

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

Member Data Documentation

◆ mLeftOffset

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

Definition at line 1572 of file TrackPanel.cpp.

◆ mpTrack

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

Definition at line 1571 of file TrackPanel.cpp.


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