Audacity  3.0.3
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 ()
 
- Public Member Functions inherited from TrackPanelNode
 TrackPanelNode ()
 
virtual ~TrackPanelNode ()=0
 
- Public Member Functions inherited from TrackPanelDrawable
virtual ~TrackPanelDrawable ()=0
 

Public Attributes

std::shared_ptr< TrackmpTrack
 
wxCoord mLeftOffset
 

Additional Inherited Members

- Public Types inherited from TrackPanelGroup
enum  Axis { Axis::X, Axis::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 1485 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 1486 of file TrackPanel.cpp.

1488  : mpTrack{ pTrack }, mLeftOffset{ leftOffset } {}

Member Function Documentation

◆ Children()

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

Implements TrackPanelGroup.

Definition at line 1489 of file TrackPanel.cpp.

1490  { return { Axis::X, Refinement{
1491  { rect.GetLeft(),
1492  TrackControls::Get( *mpTrack ).shared_from_this() },
1493  { rect.GetLeft() + kTrackInfoWidth,
1494  std::make_shared< ChannelGroup >( mpTrack, mLeftOffset ) }
1495  } }; }

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

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

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

1557  {
1558  if ( iPass == TrackArtist::PassBorders )
1559  return {
1560  rect.x - kBorderThickness,
1561  rect.y - kBorderThickness,
1562  rect.width + 2 * kBorderThickness + kShadowThickness,
1563  rect.height + 2 * kBorderThickness + kShadowThickness
1564  };
1565  else if ( iPass == TrackArtist::PassFocus ) {
1566  constexpr auto extra = kBorderThickness + 3;
1567  return {
1568  rect.x - extra,
1569  rect.y - extra,
1570  rect.width + 2 * extra + kShadowThickness,
1571  rect.height + 2 * extra + kShadowThickness
1572  };
1573  }
1574  else
1575  return rect;
1576  }

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

Member Data Documentation

◆ mLeftOffset

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

Definition at line 1579 of file TrackPanel.cpp.

◆ mpTrack

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

Definition at line 1578 of file TrackPanel.cpp.


The documentation for this struct was generated from the following file:
TrackPanelGroup::Refinement
std::vector< Child > Refinement
Definition: TrackPanelCell.h:64
TrackControls::Get
static TrackControls & Get(Track &track)
Definition: TrackControls.cpp:25
TrackArtist::PassBorders
@ PassBorders
Definition: TrackArtist.h:83
AColor::Line
static void Line(wxDC &dc, wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
Definition: AColor.cpp:109
kBorderThickness
@ kBorderThickness
Definition: ZoomInfo.h:28
AColor::TrackFocusPen
static void TrackFocusPen(wxDC *dc, int level)
Definition: AColor.cpp:389
kShadowThickness
@ kShadowThickness
Definition: ZoomInfo.h:29
TrackPanelDrawingContext::dc
wxDC & dc
Definition: TrackPanelDrawingContext.h:23
anonymous_namespace{TrackPanel.cpp}::LabeledChannelGroup::mpTrack
std::shared_ptr< Track > mpTrack
Definition: TrackPanel.cpp:1578
TrackPanelGroup::Axis::X
@ X
TrackArtist::Get
static TrackArtist * Get(TrackPanelDrawingContext &)
Definition: TrackArtist.cpp:79
TrackFocus::Get
Track * Get()
Definition: TrackPanelAx.cpp:755
kTrackInfoWidth
@ kTrackInfoWidth
Definition: ZoomInfo.h:36
TrackArtist::PassFocus
@ PassFocus
Definition: TrackArtist.h:87
anonymous_namespace{TrackPanel.cpp}::LabeledChannelGroup::mLeftOffset
wxCoord mLeftOffset
Definition: TrackPanel.cpp:1579