Audacity  3.0.3
CommonTrackPanelCell.cpp
Go to the documentation of this file.
1 /**********************************************************************
2 
3 Audacity: A Digital Audio Editor
4 
5 CommonTrackPanelCell.cpp
6 
7 Paul Licameli split from TrackPanel.cpp
8 
9 **********************************************************************/
10 
11 #include "CommonTrackPanelCell.h"
12 
13 #include <wx/cursor.h>
14 
15 #include "../../HitTestResult.h"
16 #include "../../RefreshCode.h"
17 #include "../../TrackPanelMouseEvent.h"
18 
19 namespace {
21  {
22  static CommonTrackPanelCell::Hook theHook;
23  return theHook;
24  }
25 }
26 
28  -> Hook
29 {
30  auto &theHook = GetHook();
31  auto result = theHook;
32  theHook = hook;
33  return result;
34 }
35 
37 {
38 }
39 
41 (const TrackPanelMouseState &, const AudacityProject *)
42 {
43  static wxCursor defaultCursor{ wxCURSOR_ARROW };
44  return { {}, &defaultCursor, {} };
45 }
46 
48 (const TrackPanelMouseEvent &evt, AudacityProject *pProject)
49 {
50  auto hook = GetHook();
51  return hook ? hook( evt, pProject ) : RefreshCode::Cancelled;
52 }
53 
54 CommonTrackCell::CommonTrackCell( const std::shared_ptr< Track > &parent )
55  : mwTrack { parent }
56 {}
57 
59 
61 {
62 }
63 
64 void CommonTrackCell::Reparent( const std::shared_ptr<Track> &parent )
65 {
66  mwTrack = parent;
67 }
68 
69 std::shared_ptr<Track> CommonTrackCell::DoFindTrack()
70 {
71  return mwTrack.lock();
72 }
73 
75 {
76 }
77 
78 bool CommonTrackCell::HandleXMLAttribute( const wxChar *, const wxChar * )
79 {
80  return false;
81 }
XMLWriter
Base class for XMLFileWriter and XMLStringWriter that provides the general functionality for creating...
Definition: XMLWriter.h:23
CommonTrackCell::CopyTo
virtual void CopyTo(Track &track) const
Definition: CommonTrackPanelCell.cpp:60
CommonTrackPanelCell::Hook
std::function< unsigned(const TrackPanelMouseEvent &evt, AudacityProject *pProject) > Hook
Definition: CommonTrackPanelCell.h:31
CommonTrackPanelCell::~CommonTrackPanelCell
virtual ~CommonTrackPanelCell()=0
Definition: CommonTrackPanelCell.cpp:36
RefreshCode::Cancelled
@ Cancelled
Definition: RefreshCode.h:23
CommonTrackPanelCell::DefaultPreview
HitTestPreview DefaultPreview(const TrackPanelMouseState &, const AudacityProject *) override
Definition: CommonTrackPanelCell.cpp:41
CommonTrackPanelCell::InstallMouseWheelHook
static Hook InstallMouseWheelHook(const Hook &hook)
Definition: CommonTrackPanelCell.cpp:27
CommonTrackCell::mwTrack
std::weak_ptr< Track > mwTrack
Definition: CommonTrackPanelCell.h:80
CommonTrackCell::DoFindTrack
std::shared_ptr< Track > DoFindTrack() override
Definition: CommonTrackPanelCell.cpp:69
CommonTrackCell::WriteXMLAttributes
virtual void WriteXMLAttributes(XMLWriter &) const
Definition: CommonTrackPanelCell.cpp:74
CommonTrackPanelCell.h
CommonTrackCell::CommonTrackCell
CommonTrackCell(const std::shared_ptr< Track > &pTrack)
Definition: CommonTrackPanelCell.cpp:54
CommonTrackPanelCell::HandleWheelRotation
unsigned HandleWheelRotation(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
Definition: CommonTrackPanelCell.cpp:48
CommonTrackCell::~CommonTrackCell
~CommonTrackCell()
HitTestPreview
Definition: HitTestResult.h:20
Track
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:238
AudacityProject
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:112
TrackPanelMouseEvent
Definition: TrackPanelMouseEvent.h:46
TrackPanelMouseState
Definition: TrackPanelMouseEvent.h:28
CommonTrackCell::Reparent
virtual void Reparent(const std::shared_ptr< Track > &parent)
Definition: CommonTrackPanelCell.cpp:64
anonymous_namespace{CommonTrackPanelCell.cpp}::GetHook
CommonTrackPanelCell::Hook & GetHook()
Definition: CommonTrackPanelCell.cpp:20
CommonTrackCell::HandleXMLAttribute
virtual bool HandleXMLAttribute(const wxChar *attr, const wxChar *value)
Definition: CommonTrackPanelCell.cpp:78