18#include "../../../../HitTestResult.h"
19#include "../../../../NoteTrack.h"
21#include "../../../../RefreshCode.h"
22#include "../../../../TrackArtist.h"
23#include "../../../../TrackPanelMouseEvent.h"
26#include "../../../../TrackPanelDrawingContext.h"
27#include "../../../../widgets/LinearUpdater.h"
28#include "../../../../widgets/RealFormat.h"
29#include "../../../../widgets/Ruler.h"
43 std::vector<UIHandlePtr> results;
47 auto track = std::static_pointer_cast<NoteTrack>(
FindTrack());
51 results.push_back(result);
55 std::copy(more.begin(), more.end(), std::back_inserter(results));
64 const wxMouseEvent &
event = evt.
event;
66 if (!(event.ShiftDown() || event.CmdDown()))
71 evt.
event.Skip(
false);
77 auto steps = evt.
steps;
78 const auto nt =
static_cast<NoteTrack*
>(pTrack.get());
80 if (event.CmdDown() && !
event.ShiftDown()) {
85 }
else if (!event.CmdDown() &&
event.ShiftDown()) {
87 static const int movement = 6;
88 nt->ShiftNoteRange((
int) (steps * movement));
100 const wxRect &rect_,
unsigned iPass )
109 auto track = std::static_pointer_cast<NoteTrack>(
FindTrack() );
117 bool highlight =
false;
118#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
119 highlight = rect.Contains(context.
lastState.GetPosition());
125 auto dc = &context.
dc;
128 dc->SetBrush(*wxWHITE_BRUSH);
132 dc->DrawRectangle(bev);
140 hilitePen.SetColour(120, 120, 120);
141 wxBrush blackKeyBrush;
142 blackKeyBrush.SetColour(70, 70, 70);
144 dc->SetBrush(blackKeyBrush);
151 wxFont labelFont(fontSize, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
152 dc->SetFont(labelFont);
155 int obottom = data.GetOctaveBottom(octave);
156 int marg = data.GetNoteMargin();
158 while (obottom >= rect.y) {
159 dc->SetPen(*wxBLACK_PEN);
160 for (
int white = 0; white < 7; white++) {
161 int pos = data.GetWhitePos(white);
162 if (obottom - pos > rect.y + marg + 1 &&
164 obottom - pos < rect.y + rect.height - marg - 3)
166 rect.x + rect.width, obottom - pos);
169 br.height = data.GetPitchHeight(1);
172 for (
int black = 0; black < 5; black++) {
173 br.y = obottom - data.GetBlackPos(black);
174 if (br.y > rect.y + marg - 2 && br.y + br.height < rect.y + rect.height - marg) {
175 dc->SetPen(hilitePen);
176 dc->DrawRectangle(br);
177 dc->SetPen(*wxBLACK_PEN);
179 br.x + 1, br.y + br.height - 1,
180 br.x + br.width - 1, br.y + br.height - 1);
182 br.x + br.width - 1, br.y + 1,
183 br.x + br.width - 1, br.y + br.height - 1);
187 if (octave >= 1 && octave <= 10) {
191 s.Printf(
wxT(
"C%d"), octave - 1);
192 wxCoord width, height;
193 dc->GetTextExtent(s, &width, &height);
194 if (obottom - height + 4 > rect.y &&
195 obottom + 4 < rect.y + rect.height) {
196 dc->SetTextForeground(wxColour(60, 60, 255));
197 dc->DrawText(s, rect.x + rect.width - width,
198 obottom - height + 2);
201 obottom = data.GetOctaveBottom(++octave);
204 dc->SetPen(*wxBLACK_PEN);
207 AColor::Line(*dc, rect.x, rect.y + marg - 1, rect.x + rect.width, rect.y + marg - 1);
210 AColor::Line(*dc, rect.x, rect.y + rect.height - marg - 1,
211 rect.x + rect.width, rect.y + rect.height - marg - 1);
222 const auto nt = std::static_pointer_cast< NoteTrack >(
FindTrack() );
228 const auto vruler = &
ruler;
230 vruler->
SetBounds(rect.x, rect.y, rect.x + 1, rect.y + rect.height-1);
231 vruler->SetOrientation(wxVERTICAL);
233 vruler->GetMaxSize( &nt->vrulerSize.first, &nt->vrulerSize.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::shared_ptr< Track > FindTrack()
static const LinearUpdater & Instance()
Data used to display a note track.
A Track that is used for Midi notes. (Somewhat old code).
void ZoomIn(const wxRect &rect, int y)
Zooms in a constant factor (subject to zoom limits)
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
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 &)
void Draw(TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass) override
std::vector< UIHandlePtr > HitTest(const TrackPanelMouseState &state, const AudacityProject *pProject) override
Namespace containing an enum 'what to do on a refresh?'.