19#include "../../../ui/ChannelView.h"
20#include "../../../../HitTestResult.h"
23#include "../../../../RefreshCode.h"
24#include "../../../../TrackArtist.h"
25#include "../../../../TrackPanelMouseEvent.h"
28#include "../../../../TrackPanelDrawingContext.h"
29#include "../../../../widgets/LinearUpdater.h"
30#include "../../../../widgets/RealFormat.h"
31#include "../../../../widgets/Ruler.h"
45 std::vector<UIHandlePtr> results;
53 results.push_back(result);
57 std::copy(more.begin(), more.end(), std::back_inserter(results));
64 return FindChannel<NoteTrack>();
71 const wxMouseEvent &
event = evt.
event;
73 if (!(event.ShiftDown() || event.CmdDown()))
78 evt.
event.Skip(
false);
84 auto steps = evt.
steps;
86 if (event.CmdDown() && !event.ShiftDown()) {
89 data.ZoomIn(evt.
event.m_y);
91 data.ZoomOut(evt.
event.m_y);
92 }
else if (!event.CmdDown() && event.ShiftDown()) {
94 static const int movement = 6;
107 const wxRect &rect_,
unsigned iPass )
124 bool highlight =
false;
125#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
126 highlight = rect.Contains(context.
lastState.GetPosition());
132 auto dc = &context.
dc;
135 dc->SetBrush(*wxWHITE_BRUSH);
139 dc->DrawRectangle(bev);
147 hilitePen.SetColour(120, 120, 120);
148 wxBrush blackKeyBrush;
149 blackKeyBrush.SetColour(70, 70, 70);
151 dc->SetBrush(blackKeyBrush);
158 wxFont labelFont(fontSize, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
159 dc->SetFont(labelFont);
162 int obottom = data.GetOctaveBottom(octave);
163 int marg = data.GetNoteMargin();
165 while (obottom >= rect.y) {
166 dc->SetPen(*wxBLACK_PEN);
167 for (
int white = 0; white < 7; white++) {
168 int pos = data.GetWhitePos(white);
169 if (obottom - pos > rect.y + marg + 1 &&
171 obottom - pos < rect.y + rect.height - marg - 3)
173 rect.x + rect.width, obottom - pos);
176 br.height = data.GetPitchHeight(1);
179 for (
int black = 0; black < 5; black++) {
180 br.y = obottom - data.GetBlackPos(black);
181 if (br.y > rect.y + marg - 2 && br.y + br.height < rect.y + rect.height - marg) {
182 dc->SetPen(hilitePen);
183 dc->DrawRectangle(br);
184 dc->SetPen(*wxBLACK_PEN);
186 br.x + 1, br.y + br.height - 1,
187 br.x + br.width - 1, br.y + br.height - 1);
189 br.x + br.width - 1, br.y + 1,
190 br.x + br.width - 1, br.y + br.height - 1);
194 if (octave >= 1 && octave <= 10) {
198 s.Printf(
wxT(
"C%d"), octave - 1);
199 wxCoord width, height;
200 dc->GetTextExtent(s, &width, &height);
201 if (obottom - height + 4 > rect.y &&
202 obottom + 4 < rect.y + rect.height) {
203 dc->SetTextForeground(wxColour(60, 60, 255));
204 dc->DrawText(s, rect.x + rect.width - width,
205 obottom - height + 2);
208 obottom = data.GetOctaveBottom(++octave);
211 dc->SetPen(*wxBLACK_PEN);
214 AColor::Line(*dc, rect.x, rect.y + marg - 1, rect.x + rect.width, rect.y + marg - 1);
217 AColor::Line(*dc, rect.x, rect.y + rect.height - marg - 1,
218 rect.x + rect.width, rect.y + rect.height - marg - 1);
235 const auto vruler = &
ruler;
237 vruler->
SetBounds(rect.x, rect.y, rect.x + 1, rect.y + rect.height - 1);
238 vruler->SetOrientation(wxVERTICAL);
241 vruler->GetMaxSize(&
size.first, &
size.second);
std::shared_ptr< UIHandle > UIHandlePtr
static void Line(wxDC &dc, wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
std::vector< UIHandlePtr > HitTest(const TrackPanelMouseState &state, const AudacityProject *pProject) override
static ChannelView & Get(Channel &channel)
std::pair< int, int > vrulerSize
static const LinearUpdater & Instance()
Temporary data used to display a note track.
static NoteTrackRange & Get(const NoteTrack &track)
Allow mutative access to attached data of a const track.
void ShiftNoteRange(int offset)
Shifts all notes vertically by the given pitch.
void Draw(TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass) override
std::weak_ptr< NoteTrackVZoomHandle > mVZoomHandle
~NoteTrackVRulerControls()
std::vector< UIHandlePtr > HitTest(const TrackPanelMouseState &state, const AudacityProject *pProject) override
std::shared_ptr< NoteTrack > FindNoteTrack()
void UpdateRuler(const wxRect &rect) override
unsigned HandleWheelRotation(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
static UIHandlePtr HitTest(std::weak_ptr< NoteTrackVZoomHandle > &holder, const wxMouseState &state, const std::shared_ptr< NoteTrack > &pTrack, const wxRect &rect)
void ModifyState(bool bWantsAutoSave)
static ProjectHistory & Get(AudacityProject &project)
void SetBounds(int left, int top, int right, int bottom)
static TrackArtist * Get(TrackPanelDrawingContext &)
virtual void Draw(TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass)
Namespace containing an enum 'what to do on a refresh?'.
void copy(const T *src, T *dst, int32_t n)