Audacity 3.2.0
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
TrackPanelResizerCell Class Reference

#include <TrackPanelResizerCell.h>

Inheritance diagram for TrackPanelResizerCell:
Collaboration diagram for TrackPanelResizerCell:

Public Member Functions

 TrackPanelResizerCell (Channel &channel)
std::vector< UIHandlePtrHitTest (const TrackPanelMouseState &, const AudacityProject *) override
- Public Member Functions inherited from CommonTrackCell
 CommonTrackCell (const std::shared_ptr< Track > &pTrack, size_t iChannel)
 Construct from a track and a channel index. More...
 CommonTrackCell (ChannelGroup &group, size_t iChannel)
 Construct from a channel group and a channel index. More...
 ~CommonTrackCell ()
std::shared_ptr< TrackDoFindTrack () override
void Reparent (const std::shared_ptr< Track > &parent) override
 Object may be shared among tracks but hold a special back-pointer to one of them; reassign it. More...
size_t GetChannelIndex () const
std::shared_ptr< ChannelFindChannel ()
 May return null. More...
std::shared_ptr< const ChannelFindChannel () const
 May return null. More...
- Public Member Functions inherited from CommonTrackPanelCell
 CommonTrackPanelCell ()
virtual ~CommonTrackPanelCell ()=0
HitTestPreview DefaultPreview (const TrackPanelMouseState &, const AudacityProject *) override
std::shared_ptr< TrackFindTrack ()
std::shared_ptr< const TrackFindTrack () const
virtual std::vector< MenuItemGetMenuItems (const wxRect &rect, const wxPoint *pPosition, AudacityProject *pProject)
 Return a list of items for DoContextMenu() (empties for separators) More...
- Public Member Functions inherited from TrackPanelCell
 TrackPanelCell ()=default
 TrackPanelCell (const TrackPanelCell &)=delete
TrackPanelCelloperator= (const TrackPanelCell &)=delete
virtual ~TrackPanelCell ()=0
virtual HitTestPreview DefaultPreview (const TrackPanelMouseState &state, const AudacityProject *pProject)
virtual std::vector< UIHandlePtrHitTest (const TrackPanelMouseState &state, const AudacityProject *pProject)=0
virtual unsigned HandleWheelRotation (const TrackPanelMouseEvent &event, AudacityProject *pProject)
virtual std::shared_ptr< TrackPanelCellContextMenuDelegate ()
virtual unsigned DoContextMenu (const wxRect &rect, wxWindow *pParent, const wxPoint *pPosition, AudacityProject *pProject)
virtual unsigned CaptureKey (wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent, AudacityProject *project)
virtual unsigned KeyDown (wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent, AudacityProject *project)
virtual unsigned KeyUp (wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent, AudacityProject *project)
virtual unsigned Char (wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent, AudacityProject *project)
virtual unsigned LoseFocus (AudacityProject *project)
- 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 Member Functions inherited from TrackAttachment
virtual ~TrackAttachment ()
virtual void CopyTo (Track &track) const
 Copy state, for undo/redo purposes. More...
virtual void Reparent (const std::shared_ptr< Track > &parent)
 Object may be shared among tracks but hold a special back-pointer to one of them; reassign it. More...
virtual void WriteXMLAttributes (XMLWriter &) const
 Serialize persistent attributes. More...
virtual bool HandleXMLAttribute (const std::string_view &attr, const XMLAttributeValueView &valueView)
 Deserialize an attribute, returning true if recognized. More...
- Public Member Functions inherited from ClientData::Base
virtual ~Base ()

Static Public Member Functions

static TrackPanelResizerCellGet (Channel &channel)
static const TrackPanelResizerCellGet (const Channel &channel)
- 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)

Private Member Functions

 TrackPanelResizerCell (const TrackPanelResizerCell &)=delete
TrackPanelResizerCelloperator= (const TrackPanelResizerCell &)=delete
void Draw (TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass) override

Private Attributes

std::weak_ptr< TrackPanelResizeHandlemResizeHandle

Additional Inherited Members

- Protected Member Functions inherited from CommonTrackPanelCell
virtual std::shared_ptr< TrackDoFindTrack ()=0
unsigned DoContextMenu (const wxRect &rect, wxWindow *pParent, const wxPoint *pPosition, AudacityProject *pProject) override
unsigned HandleWheelRotation (const TrackPanelMouseEvent &event, AudacityProject *pProject) override

Detailed Description

Definition at line 20 of file TrackPanelResizerCell.h.

Constructor & Destructor Documentation

◆ TrackPanelResizerCell() [1/2]

TrackPanelResizerCell::TrackPanelResizerCell ( const TrackPanelResizerCell )

◆ TrackPanelResizerCell() [2/2]

TrackPanelResizerCell::TrackPanelResizerCell ( Channel channel)
dynamic_cast<Track*>(&channel.GetChannelGroup()) != nullptr

Definition at line 27 of file TrackPanelResizerCell.cpp.

28 : CommonTrackCell{ channel.GetChannelGroup(), channel.GetChannelIndex() }
ChannelGroup & GetChannelGroup()
Channel object's lifetime is assumed to be nested in its Track's.
Definition: Channel.cpp:71
size_t GetChannelIndex() const
Definition: Channel.cpp:77

Member Function Documentation

◆ Draw()

void TrackPanelResizerCell::Draw ( TrackPanelDrawingContext context,
const wxRect &  rect,
unsigned  iPass 

Reimplemented from TrackPanelDrawable.

Definition at line 46 of file TrackPanelResizerCell.cpp.

50 if ( iPass == TrackArtist::PassMargins ) {
51 auto pTrack = FindTrack();
52 if ( pTrack ) {
53 auto dc = &context.dc;
54 const bool last =
55 pTrack.get() == *TrackList::Channels( pTrack.get() ).rbegin();
56 if ( last ) {
57 // Fill in separator area below a track
59 dc->DrawRectangle( rect );
60 }
61 else {
62 // Area between channels of a group
63 // Paint the channel separator over (what would be) the lower border
64 // of this channel, down to and including the upper border of the
65 // next channel
67 ADCChanger cleanup{ dc };
69 // Paint the left part of the background
70 const auto artist = TrackArtist::Get( context );
71 auto labelw = artist->pZoomInfo->GetLeftOffset() - 1;
72 AColor::MediumTrackInfo( dc, pTrack->GetSelected() );
73 dc->DrawRectangle(
74 rect.GetX(), rect.GetY(), labelw, rect.GetHeight() );
76 // Stroke the left border
77 dc->SetPen(*wxBLACK_PEN);
78 {
79 const auto left = rect.GetLeft();
80 AColor::Line( *dc, left, rect.GetTop(), left, rect.GetBottom() );
81 }
85 wxRect rec{ rect };
86 rec.width -= labelw - rec.x;
87 rec.x = labelw;
89 dc->DrawRectangle( wxRect( rec ).Inflate( 0, -kBorderThickness ) );
91 // These lines stroke over what is otherwise "border" of each
92 // channel
93 dc->SetBrush(*wxTRANSPARENT_BRUSH);
94 dc->SetPen(*wxBLACK_PEN);
95 const auto left = rec.GetLeft();
96 const auto right = rec.GetRight();
97 const auto top = rec.GetTop();
98 const auto bottom = rec.GetBottom();
99 AColor::Line( *dc, left, top, right, top );
100 AColor::Line( *dc, left, bottom, right, bottom );
101 }
102 }
103 }
@ kBorderThickness
Definition: ZoomInfo.h:22
static void Line(wxDC &dc, wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
Definition: AColor.cpp:187
static void MediumTrackInfo(wxDC *dc, bool selected)
Definition: AColor.cpp:433
static void TrackPanelBackground(wxDC *dc, bool selected)
Definition: AColor.cpp:454
Makes temporary drawing context changes that you back out of, RAII style.
Definition: OverlayPanel.h:72
std::shared_ptr< Track > FindTrack()
static TrackArtist * Get(TrackPanelDrawingContext &)
Definition: TrackArtist.cpp:69
static auto Channels(TrackType *pTrack) -> TrackIterRange< TrackType >
Definition: Track.h:1146

References TrackList::Channels(), TrackPanelDrawingContext::dc, CommonTrackPanelCell::FindTrack(), TrackArtist::Get(), kBorderThickness, AColor::Line(), AColor::MediumTrackInfo(), TrackArtist::PassMargins, and AColor::TrackPanelBackground().

Here is the call graph for this function:

◆ Get() [1/2]

TrackPanelResizerCell & TrackPanelResizerCell::Get ( Channel channel)

Definition at line 121 of file TrackPanelResizerCell.cpp.

124 static_cast<Track &>(channel.GetChannelGroup()),
125 channel.GetChannelIndex());
static const AttachedTrackObjects::RegisteredFactory key
static Attachment & Get(const AttachedTrackObjects::RegisteredFactory &key, Track &track, size_t iChannel)
Definition: Track.h:558
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:122

References ChannelAttachments< Attachment >::Get(), Channel::GetChannelGroup(), Channel::GetChannelIndex(), and key.

Referenced by anonymous_namespace{TrackPanel.cpp}::ResizingChannelGroup::Children(), anonymous_namespace{TrackPanel.cpp}::ChannelStack::Children(), and Get().

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

◆ Get() [2/2]

const TrackPanelResizerCell & TrackPanelResizerCell::Get ( const Channel channel)

Definition at line 128 of file TrackPanelResizerCell.cpp.

130 return Get(const_cast<Channel &>(channel));
static TrackPanelResizerCell & Get(Channel &channel)

References Get().

Here is the call graph for this function:

◆ HitTest()

std::vector< UIHandlePtr > TrackPanelResizerCell::HitTest ( const TrackPanelMouseState st,
const AudacityProject pProject 

Implements TrackPanelCell.

Definition at line 31 of file TrackPanelResizerCell.cpp.

34 (void)pProject;// Compiler food
35 std::vector<UIHandlePtr> results;
36 auto pTrack = FindTrack();
37 if (pTrack) {
38 auto result = std::make_shared<TrackPanelResizeHandle>(
39 pTrack->GetChannel(0), st.state.m_y );
40 result = AssignUIHandlePtr(mResizeHandle, result);
41 results.push_back(result);
42 }
43 return results;
std::shared_ptr< Subclass > AssignUIHandlePtr(std::weak_ptr< Subclass > &holder, const std::shared_ptr< Subclass > &pNew)
Definition: UIHandle.h:159
std::weak_ptr< TrackPanelResizeHandle > mResizeHandle

References AssignUIHandlePtr(), CommonTrackPanelCell::FindTrack(), mResizeHandle, and TrackPanelMouseState::state.

Here is the call graph for this function:

◆ operator=()

TrackPanelResizerCell & TrackPanelResizerCell::operator= ( const TrackPanelResizerCell )

Member Data Documentation

◆ mResizeHandle

std::weak_ptr<TrackPanelResizeHandle> TrackPanelResizerCell::mResizeHandle

Definition at line 46 of file TrackPanelResizerCell.h.

Referenced by HitTest().

The documentation for this class was generated from the following files: