Audacity  2.3.1
Public Member Functions | Private Member Functions | Private Attributes | List of all members
NoteTrackVRulerControls Class Referencefinal

#include <NoteTrackVRulerControls.h>

Inheritance diagram for NoteTrackVRulerControls:
TrackVRulerControls CommonTrackPanelCell TrackPanelCell TrackPanelNode

Public Member Functions

 NoteTrackVRulerControls (std::shared_ptr< Track > pTrack)
 
 ~NoteTrackVRulerControls ()
 
std::vector< UIHandlePtrHitTest (const TrackPanelMouseState &state, const AudacityProject *pProject) override
 
unsigned HandleWheelRotation (const TrackPanelMouseEvent &event, AudacityProject *pProject) override
 
- Public Member Functions inherited from TrackVRulerControls
 TrackVRulerControls (std::shared_ptr< Track > pTrack)
 
virtual ~TrackVRulerControls ()=0
 
std::shared_ptr< TrackFindTrack () override
 
std::vector< UIHandlePtrHitTest (const TrackPanelMouseState &state, const AudacityProject *pProject) override
 
- Public Member Functions inherited from CommonTrackPanelCell
 CommonTrackPanelCell ()
 
virtual ~CommonTrackPanelCell ()=0
 
HitTestPreview DefaultPreview (const TrackPanelMouseState &, const AudacityProject *) override
 
- Public Member Functions inherited from TrackPanelCell
virtual ~TrackPanelCell ()=0
 
virtual std::shared_ptr
< TrackPanelCell
ContextMenuDelegate ()
 
virtual unsigned DoContextMenu (const wxRect &rect, wxWindow *pParent, wxPoint *pPosition)
 
virtual unsigned CaptureKey (wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent)
 
virtual unsigned KeyDown (wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent)
 
virtual unsigned KeyUp (wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent)
 
virtual unsigned Char (wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent)
 
- Public Member Functions inherited from TrackPanelNode
 TrackPanelNode ()
 
virtual ~TrackPanelNode ()=0
 

Private Member Functions

 NoteTrackVRulerControls (const NoteTrackVRulerControls &)=delete
 
NoteTrackVRulerControlsoperator= (const NoteTrackVRulerControls &)=delete
 

Private Attributes

std::weak_ptr
< NoteTrackVZoomHandle
mVZoomHandle
 

Additional Inherited Members

- Static Public Member Functions inherited from TrackVRulerControls
static void DrawZooming (wxDC *dc, const wxRect &cellRect, const wxRect &panelRect, int zoomStart, int zoomEnd)
 
- Protected Member Functions inherited from TrackVRulerControls
TrackGetTrack () const
 
- Protected Member Functions inherited from CommonTrackPanelCell
unsigned HandleWheelRotation (const TrackPanelMouseEvent &event, AudacityProject *pProject) override
 
- Protected Attributes inherited from TrackVRulerControls
std::weak_ptr< TrackmwTrack
 

Detailed Description

Definition at line 18 of file NoteTrackVRulerControls.h.

Constructor & Destructor Documentation

NoteTrackVRulerControls::NoteTrackVRulerControls ( const NoteTrackVRulerControls )
privatedelete
NoteTrackVRulerControls::NoteTrackVRulerControls ( std::shared_ptr< Track pTrack)
inlineexplicit

Definition at line 25 of file NoteTrackVRulerControls.h.

26  : TrackVRulerControls( pTrack ) {}
TrackVRulerControls(std::shared_ptr< Track > pTrack)
NoteTrackVRulerControls::~NoteTrackVRulerControls ( )

Definition at line 26 of file NoteTrackVRulerControls.cpp.

27 {
28 }

Member Function Documentation

unsigned NoteTrackVRulerControls::HandleWheelRotation ( const TrackPanelMouseEvent event,
AudacityProject pProject 
)
overridevirtual

Reimplemented from TrackPanelCell.

Definition at line 52 of file NoteTrackVRulerControls.cpp.

References TrackPanelMouseEvent::event, AudacityProject::ModifyState(), TrackPanelMouseEvent::rect, RefreshCode::RefreshCell, RefreshCode::RefreshNone, TrackPanelMouseEvent::steps, RefreshCode::UpdateVRuler, and NoteTrack::ZoomIn().

53 {
54  using namespace RefreshCode;
55  const wxMouseEvent &event = evt.event;
56 
57  if (!(event.ShiftDown() || event.CmdDown()))
58  return RefreshNone;
59 
60  // Always stop propagation even if the ruler didn't change. The ruler
61  // is a narrow enough target.
62  evt.event.Skip(false);
63 
64  const auto pTrack = FindTrack();
65  if (!pTrack)
66  return RefreshNone;
67 
68  auto steps = evt.steps;
69  const auto nt = static_cast<NoteTrack*>(pTrack.get());
70 
71  if (event.CmdDown() && !event.ShiftDown()) {
72  if (steps > 0)
73  nt->ZoomIn(evt.rect, evt.event.m_y);
74  else
75  nt->ZoomOut(evt.rect, evt.event.m_y);
76  } else if (!event.CmdDown() && event.ShiftDown()) {
77  // Scroll some fixed number of notes, independent of zoom level or track height:
78  static const int movement = 6; // 6 semitones is half an octave
79  nt->SetBottomNote(nt->GetBottomNote() + (int) (steps * movement));
80  } else {
81  return RefreshNone;
82  }
83 
84  pProject->ModifyState(true);
85 
86  return RefreshCell | UpdateVRuler;
87 }
void ModifyState(bool bWantsAutoSave)
Definition: Project.cpp:4660
std::shared_ptr< Track > FindTrack() override
void ZoomIn(const wxRect &rect, int y)
Zooms in a contant factor (subject to zoom limits)
Definition: NoteTrack.h:142
A Track that is used for Midi notes. (Somewhat old code).
Definition: NoteTrack.h:66
std::vector< UIHandlePtr > NoteTrackVRulerControls::HitTest ( const TrackPanelMouseState state,
const AudacityProject pProject 
)
overridevirtual

Implements TrackPanelCell.

Definition at line 31 of file NoteTrackVRulerControls.cpp.

References NoteTrackVZoomHandle::HitTest(), TrackVRulerControls::HitTest(), kGuard, TrackPanelMouseState::rect, and TrackPanelMouseState::state.

33 {
34  std::vector<UIHandlePtr> results;
35  UIHandlePtr result;
36 
37  if ( st.state.GetX() <= st.rect.GetRight() - kGuard ) {
38  auto track = std::static_pointer_cast<NoteTrack>(FindTrack());
40  mVZoomHandle, st.state, track, st.rect);
41  if (result)
42  results.push_back(result);
43  }
44 
45  auto more = TrackVRulerControls::HitTest(st, pProject);
46  std::copy(more.begin(), more.end(), std::back_inserter(results));
47 
48  return results;
49 }
std::shared_ptr< UIHandle > UIHandlePtr
Definition: CellularPanel.h:27
static UIHandlePtr HitTest(std::weak_ptr< NoteTrackVZoomHandle > &holder, const wxMouseState &state, const std::shared_ptr< NoteTrack > &pTrack, const wxRect &rect)
std::vector< UIHandlePtr > HitTest(const TrackPanelMouseState &state, const AudacityProject *pProject) override
const int kGuard
std::shared_ptr< Track > FindTrack() override
std::weak_ptr< NoteTrackVZoomHandle > mVZoomHandle
A Track that is used for Midi notes. (Somewhat old code).
Definition: NoteTrack.h:66
NoteTrackVRulerControls& NoteTrackVRulerControls::operator= ( const NoteTrackVRulerControls )
privatedelete

Member Data Documentation

std::weak_ptr<NoteTrackVZoomHandle> NoteTrackVRulerControls::mVZoomHandle
private

Definition at line 38 of file NoteTrackVRulerControls.h.


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