Audacity 3.2.0
Public Member Functions | Static Public Member Functions | Private Member Functions | Static 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

std::vector< UIHandlePtrHitTest (const TrackPanelMouseState &, const AudacityProject *) override
 TrackPanelResizerCell (const std::shared_ptr< Channel > &channel)
- Public Member Functions inherited from CommonChannelCell
 CommonChannelCell (const std::shared_ptr< Channel > &pChannel)
 Construct from a channel. More...
 ~CommonChannelCell ()
std::shared_ptr< TrackDoFindTrack () override
void Reparent (const std::shared_ptr< Track > &parent, size_t iChannel) override
 Object may be shared among tracks but hold a special back-pointer to one of them; reassign it. More...
template<typename Subtype = Channel>
auto FindChannel () -> std::shared_ptr< Subtype >
 May return null. More...
template<typename Subtype = const Channel>
auto FindChannel () const -> std::enable_if_t< std::is_const_v< Subtype >, std::shared_ptr< Subtype > >
 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 ChannelAttachment
virtual ~ChannelAttachment ()
virtual void CopyTo (Track &track, size_t iChannel) const
 Copy state, for undo/redo purposes. More...
virtual void Reparent (const std::shared_ptr< Track > &parent, size_t iChannel)
 Object may be shared among tracks but hold a special back-pointer to one of them; reassign it. More...
virtual void WriteXMLAttributes (XMLWriter &writer, size_t iChannel) const
 Serialize persistent attributes. More...
virtual bool HandleXMLAttribute (const std::string_view &attr, const XMLAttributeValueView &valueView, size_t iChannel)
 Deserialize an attribute, returning true if recognized. More...

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

Static Private Member Functions

static TrackPanelResizerCellGetFromChannelGroup (ChannelGroup &group, size_t iChannel)

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 ( const std::shared_ptr< Channel > &  channel)

Definition at line 25 of file TrackPanelResizerCell.cpp.

Member Function Documentation

◆ Draw()

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

Reimplemented from TrackPanelDrawable.

Definition at line 44 of file TrackPanelResizerCell.cpp.

48 if (iPass == TrackArtist::PassMargins) {
49 if (const auto pChannel = FindChannel()) {
50 const auto pTrack =
51 dynamic_cast<Track *>(&pChannel->GetChannelGroup());
52 if (!pTrack)
53 return;
54 auto dc = &context.dc;
55 const auto &channels = pTrack->Channels();
56 const bool last = (pChannel == *channels.rbegin());
57 if (last) {
58 // Fill in separator area below a track
60 dc->DrawRectangle( rect );
61 }
62 else {
63 // Area between channels of a group
64 // Paint the channel separator over (what would be) the lower border
65 // of this channel, down to and including the upper border of the
66 // next channel
68 ADCChanger cleanup{ dc };
70 // Paint the left part of the background
71 const auto artist = TrackArtist::Get(context);
72 auto labelw = artist->pZoomInfo->GetLeftOffset() - 1;
73 AColor::MediumTrackInfo( dc, pTrack->GetSelected() );
74 dc->DrawRectangle(
75 rect.GetX(), rect.GetY(), labelw, rect.GetHeight() );
77 // Stroke the left border
78 dc->SetPen(*wxBLACK_PEN);
79 {
80 const auto left = rect.GetLeft();
81 AColor::Line( *dc, left, rect.GetTop(), left, rect.GetBottom() );
82 }
86 wxRect rec{ rect };
87 rec.width -= labelw - rec.x;
88 rec.x = labelw;
90 dc->DrawRectangle( wxRect( rec ).Inflate( 0, -kBorderThickness ) );
92 // These lines stroke over what is otherwise "border" of each
93 // channel
94 dc->SetBrush(*wxTRANSPARENT_BRUSH);
95 dc->SetPen(*wxBLACK_PEN);
96 const auto left = rec.GetLeft();
97 const auto right = rec.GetRight();
98 const auto top = rec.GetTop();
99 const auto bottom = rec.GetBottom();
100 AColor::Line( *dc, left, top, right, top );
101 AColor::Line( *dc, left, bottom, right, bottom );
102 }
103 }
104 }
@ kBorderThickness
Definition: ZoomInfo.h:22
static void Line(wxDC &dc, wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
Definition: AColor.cpp:185
static void MediumTrackInfo(wxDC *dc, bool selected)
Definition: AColor.cpp:427
static void TrackPanelBackground(wxDC *dc, bool selected)
Definition: AColor.cpp:444
Makes temporary drawing context changes that you back out of, RAII style.
Definition: OverlayPanel.h:72
auto FindChannel() -> std::shared_ptr< Subtype >
May return null.
static TrackArtist * Get(TrackPanelDrawingContext &)
Definition: TrackArtist.cpp:69
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:110

References TrackPanelDrawingContext::dc, CommonChannelCell::FindChannel(), 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)
dynamic_cast<Track*>(&channel.GetChannelGroup()) != nullptr

Definition at line 129 of file TrackPanelResizerCell.cpp.

131 return GetFromChannelGroup(channel.GetChannelGroup(),
132 channel.GetChannelIndex());
ChannelGroup & GetChannelGroup()
Channel object's lifetime is assumed to be nested in its Track's.
Definition: Channel.cpp:43
size_t GetChannelIndex() const
Definition: Channel.cpp:25
static TrackPanelResizerCell & GetFromChannelGroup(ChannelGroup &group, size_t iChannel)

References Channel::GetChannelGroup(), Channel::GetChannelIndex(), and GetFromChannelGroup().

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 135 of file TrackPanelResizerCell.cpp.

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

References Get().

Here is the call graph for this function:

◆ GetFromChannelGroup()

TrackPanelResizerCell & TrackPanelResizerCell::GetFromChannelGroup ( ChannelGroup group,
size_t  iChannel 
iChannel < group.NChannels()

Definition at line 122 of file TrackPanelResizerCell.cpp.

125 auto &track = static_cast<Track&>(group);
static const AttachedTrackObjects::RegisteredFactory key
static Attachment & Get(const AttachedTrackObjects::RegisteredFactory &key, Track &track, size_t iChannel)

References ChannelAttachments< Attachment >::Get(), anonymous_namespace{StretchingSequenceIntegrationTest.cpp}::iChannel, and key.

Referenced by Get().

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

◆ HitTest()

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

Implements TrackPanelCell.

Definition at line 30 of file TrackPanelResizerCell.cpp.

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

References AssignUIHandlePtr(), CommonChannelCell::FindChannel(), 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 51 of file TrackPanelResizerCell.h.

Referenced by HitTest().

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