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 (const std::shared_ptr< Track > &pTrack)
std::vector< UIHandlePtrHitTest (const TrackPanelMouseState &, const AudacityProject *) override
- Public Member Functions inherited from CommonTrackCell
 CommonTrackCell (const std::shared_ptr< Track > &pTrack)
 ~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...
- 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 &) PROHIBITED
TrackPanelCelloperator= (const TrackPanelCell &) PROHIBITED
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 (Track &track)
static const TrackPanelResizerCellGet (const Track &track)
- 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 ( const std::shared_ptr< Track > &  pTrack)

Definition at line 27 of file TrackPanelResizerCell.cpp.

Member Function Documentation

◆ Draw()

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

Reimplemented from TrackPanelDrawable.

Definition at line 47 of file TrackPanelResizerCell.cpp.

51 if ( iPass == TrackArtist::PassMargins ) {
52 auto pTrack = FindTrack();
53 if ( pTrack ) {
54 auto dc = &context.dc;
55 const bool last =
56 pTrack.get() == *TrackList::Channels( pTrack.get() ).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: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:1544

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]

const TrackPanelResizerCell & TrackPanelResizerCell::Get ( const Track track)

Definition at line 119 of file TrackPanelResizerCell.cpp.

121 return Get( const_cast< Track & >( track ) );
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:226
static TrackPanelResizerCell & Get(Track &track)

References Get().

Here is the call graph for this function:

◆ Get() [2/2]

TrackPanelResizerCell & TrackPanelResizerCell::Get ( Track track)

Definition at line 114 of file TrackPanelResizerCell.cpp.

116 return track.AttachedObjects::Get< TrackPanelResizerCell >( key );
static const AttachedTrackObjects::RegisteredFactory key

References key.

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

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

35 (void)pProject;// Compiler food
36 std::vector<UIHandlePtr> results;
37 auto pTrack = FindTrack();
38 if (pTrack) {
39 auto result = std::make_shared<TrackPanelResizeHandle>(
40 pTrack, st.state.m_y );
41 result = AssignUIHandlePtr(mResizeHandle, result);
42 results.push_back(result);
43 }
44 return results;
std::shared_ptr< Subclass > AssignUIHandlePtr(std::weak_ptr< Subclass > &holder, const std::shared_ptr< Subclass > &pNew)
Definition: UIHandle.h:151
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 44 of file TrackPanelResizerCell.h.

Referenced by HitTest().

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