Audacity 3.2.0
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
BackgroundCell Class Referencefinal

Class representing the background of a Track. It provides the hit test function that tells us what was hit. More...

#include <BackgroundCell.h>

Inheritance diagram for BackgroundCell:
[legend]
Collaboration diagram for BackgroundCell:
[legend]

Public Member Functions

 BackgroundCell (AudacityProject *pProject)
 
virtual ~BackgroundCell ()
 
- 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 ClientData::Base
virtual ~Base ()
 

Static Public Member Functions

static BackgroundCellGet (AudacityProject &project)
 
static const BackgroundCellGet (const AudacityProject &project)
 
- 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)
 

Public Attributes

std::weak_ptr< ZoomHandlemZoomHandle
 

Protected Member Functions

std::vector< UIHandlePtrHitTest (const TrackPanelMouseState &state, const AudacityProject *) override
 
std::shared_ptr< TrackDoFindTrack () override
 
- 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
 

Private Member Functions

void Draw (TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass) override
 
wxRect DrawingArea (TrackPanelDrawingContext &, const wxRect &rect, const wxRect &panelRect, unsigned iPass) override
 
std::vector< MenuItemGetMenuItems (const wxRect &rect, const wxPoint *pPosition, AudacityProject *pProject) override
 Return a list of items for DoContextMenu() (empties for separators) More...
 

Private Attributes

AudacityProjectmpProject
 
std::weak_ptr< BackgroundHandlemHandle
 

Detailed Description

Class representing the background of a Track. It provides the hit test function that tells us what was hit.

Definition at line 25 of file BackgroundCell.h.

Constructor & Destructor Documentation

◆ BackgroundCell()

BackgroundCell::BackgroundCell ( AudacityProject pProject)
inlineexplicit

Definition at line 34 of file BackgroundCell.h.

35 : mpProject(pProject)
36 {}
AudacityProject * mpProject

◆ ~BackgroundCell()

BackgroundCell::~BackgroundCell ( )
virtual

Definition at line 109 of file BackgroundCell.cpp.

110{
111}

Member Function Documentation

◆ DoFindTrack()

std::shared_ptr< Track > BackgroundCell::DoFindTrack ( )
overrideprotectedvirtual

Implements CommonTrackPanelCell.

Definition at line 121 of file BackgroundCell.cpp.

122{
123 return {};
124}

◆ Draw()

void BackgroundCell::Draw ( TrackPanelDrawingContext context,
const wxRect &  rect,
unsigned  iPass 
)
overrideprivatevirtual

Reimplemented from TrackPanelDrawable.

Definition at line 126 of file BackgroundCell.cpp.

129{
130 if ( iPass == TrackArtist::PassBackground ) {
131 auto &dc = context.dc;
132 // Paint over the part below the tracks
133 AColor::TrackPanelBackground( &dc, false );
134 dc.DrawRectangle( rect );
135 }
136}
static void TrackPanelBackground(wxDC *dc, bool selected)
Definition: AColor.cpp:444

References TrackPanelDrawingContext::dc, TrackArtist::PassBackground, and AColor::TrackPanelBackground().

Here is the call graph for this function:

◆ DrawingArea()

wxRect BackgroundCell::DrawingArea ( TrackPanelDrawingContext ,
const wxRect &  rect,
const wxRect &  panelRect,
unsigned  iPass 
)
overrideprivatevirtual

Reimplemented from TrackPanelDrawable.

Definition at line 138 of file BackgroundCell.cpp.

141{
142 if ( iPass == TrackArtist::PassBackground )
143 // If there are any tracks, extend the drawing area up, to cover the
144 // bottom ends of any zooming guide lines.
145 return {
146 rect.x,
147 rect.y - kTopMargin,
148 rect.width,
149 rect.height + kTopMargin
150 };
151 else
152 return rect;
153}
@ kTopMargin

References kTopMargin, and TrackArtist::PassBackground.

◆ Get() [1/2]

BackgroundCell & BackgroundCell::Get ( AudacityProject project)
static

Definition at line 99 of file BackgroundCell.cpp.

100{
101 return project.AttachedObjects::Get< BackgroundCell >( key );
102}
static const AudacityProject::AttachedObjects::RegisteredFactory key
const auto project
Class representing the background of a Track. It provides the hit test function that tells us what wa...

References key, and project.

Referenced by Get(), and CommonChannelView::HitTest().

Here is the caller graph for this function:

◆ Get() [2/2]

const BackgroundCell & BackgroundCell::Get ( const AudacityProject project)
static

Definition at line 104 of file BackgroundCell.cpp.

105{
106 return Get( const_cast< AudacityProject & >( project ) );
107}
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:90
static BackgroundCell & Get(AudacityProject &project)

References Get(), and project.

Here is the call graph for this function:

◆ GetMenuItems()

auto BackgroundCell::GetMenuItems ( const wxRect &  rect,
const wxPoint *  pPosition,
AudacityProject pProject 
)
overrideprivatevirtual

Return a list of items for DoContextMenu() (empties for separators)

If the vector is empty (as in the default), there is no context menu.

Commands are invoked with temporary selection fields of CommandContext set to a point selected region at the mouse pick, and the cell's track.

A function may be given, but if it is null, then the command can be found by name in the CommandManager.

An item in the list with no command name marks a menu separator.

The menu item is enabled only if it contains a true flag, but if looked up in the command manager, it must also satisfy the command manager's conditions.

Reimplemented from CommonTrackPanelCell.

Definition at line 155 of file BackgroundCell.cpp.

158{
159 // These commands exist in toolbar menus too, but maybe with other labels
160 // TODO: devise a system of registration so that BackgroundCell has no
161 // special knowledge about track sub-types
162 return {
163 { L"NewMonoTrack", XO("Add Mono Track")},
164 { L"NewStereoTrack", XO("Add Stereo Track") },
165 { L"NewLabelTrack", XO("Add Label Track"), },
166 {},
167 { L"Export", XO("Export Audio..."), },
168 {},
169 { L"SelectAll", XO("Select All") },
170 };
171}
XO("Cut/Copy/Paste")

References XO().

Here is the call graph for this function:

◆ HitTest()

std::vector< UIHandlePtr > BackgroundCell::HitTest ( const TrackPanelMouseState state,
const AudacityProject  
)
overrideprotectedvirtual

Implements TrackPanelCell.

Definition at line 113 of file BackgroundCell.cpp.

116{
117 auto result = AssignUIHandlePtr(mHandle, std::make_shared<BackgroundHandle>());
118 return { result };
119}
std::shared_ptr< Subclass > AssignUIHandlePtr(std::weak_ptr< Subclass > &holder, const std::shared_ptr< Subclass > &pNew)
Definition: UIHandle.h:164
std::weak_ptr< BackgroundHandle > mHandle

References AssignUIHandlePtr(), and mHandle.

Here is the call graph for this function:

Member Data Documentation

◆ mHandle

std::weak_ptr<BackgroundHandle> BackgroundCell::mHandle
private

Definition at line 63 of file BackgroundCell.h.

Referenced by HitTest().

◆ mpProject

AudacityProject* BackgroundCell::mpProject
private

Definition at line 61 of file BackgroundCell.h.

◆ mZoomHandle

std::weak_ptr<ZoomHandle> BackgroundCell::mZoomHandle
mutable

Definition at line 67 of file BackgroundCell.h.

Referenced by CommonChannelView::HitTest().


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