18#include "../../../ui/ChannelView.h"
19#include "../../../../HitTestResult.h"
20#include "../../../../NoteTrack.h"
22#include "../../../../RefreshCode.h"
23#include "../../../../TrackArtist.h"
24#include "../../../../TrackPanelMouseEvent.h"
27#include "../../../../TrackPanelDrawingContext.h"
28#include "../../../../widgets/LinearUpdater.h"
29#include "../../../../widgets/RealFormat.h"
30#include "../../../../widgets/Ruler.h"
44 std::vector<UIHandlePtr> results;
48 auto track = std::static_pointer_cast<NoteTrack>(
FindTrack());
52 results.push_back(result);
56 std::copy(more.begin(), more.end(), std::back_inserter(results));
65 const wxMouseEvent &
event = evt.
event;
67 if (!(event.ShiftDown() || event.CmdDown()))
72 evt.
event.Skip(
false);
78 auto steps = evt.
steps;
79 const auto nt =
static_cast<NoteTrack*
>(pTrack.get());
81 if (event.CmdDown() && !
event.ShiftDown()) {
86 }
else if (!event.CmdDown() &&
event.ShiftDown()) {
88 static const int movement = 6;
89 nt->ShiftNoteRange((
int) (steps * movement));
101 const wxRect &rect_,
unsigned iPass )
110 auto track = std::static_pointer_cast<NoteTrack>(
FindTrack() );
118 bool highlight =
false;
119#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
120 highlight = rect.Contains(context.
lastState.GetPosition());
126 auto dc = &context.
dc;
129 dc->SetBrush(*wxWHITE_BRUSH);
133 dc->DrawRectangle(bev);
141 hilitePen.SetColour(120, 120, 120);
142 wxBrush blackKeyBrush;
143 blackKeyBrush.SetColour(70, 70, 70);
145 dc->SetBrush(blackKeyBrush);
152 wxFont labelFont(fontSize, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
153 dc->SetFont(labelFont);
156 int obottom = data.GetOctaveBottom(octave);
157 int marg = data.GetNoteMargin();
159 while (obottom >= rect.y) {
160 dc->SetPen(*wxBLACK_PEN);
161 for (
int white = 0; white < 7; white++) {
162 int pos = data.GetWhitePos(white);
163 if (obottom - pos > rect.y + marg + 1 &&
165 obottom - pos < rect.y + rect.height - marg - 3)
167 rect.x + rect.width, obottom - pos);
170 br.height = data.GetPitchHeight(1);
173 for (
int black = 0; black < 5; black++) {
174 br.y = obottom - data.GetBlackPos(black);
175 if (br.y > rect.y + marg - 2 && br.y + br.height < rect.y + rect.height - marg) {
176 dc->SetPen(hilitePen);
177 dc->DrawRectangle(br);
178 dc->SetPen(*wxBLACK_PEN);
180 br.x + 1, br.y + br.height - 1,
181 br.x + br.width - 1, br.y + br.height - 1);
183 br.x + br.width - 1, br.y + 1,
184 br.x + br.width - 1, br.y + br.height - 1);
188 if (octave >= 1 && octave <= 10) {
192 s.Printf(
wxT(
"C%d"), octave - 1);
193 wxCoord width, height;
194 dc->GetTextExtent(s, &width, &height);
195 if (obottom - height + 4 > rect.y &&
196 obottom + 4 < rect.y + rect.height) {
197 dc->SetTextForeground(wxColour(60, 60, 255));
198 dc->DrawText(s, rect.x + rect.width - width,
199 obottom - height + 2);
202 obottom = data.GetOctaveBottom(++octave);
205 dc->SetPen(*wxBLACK_PEN);
208 AColor::Line(*dc, rect.x, rect.y + marg - 1, rect.x + rect.width, rect.y + marg - 1);
211 AColor::Line(*dc, rect.x, rect.y + rect.height - marg - 1,
212 rect.x + rect.width, rect.y + rect.height - marg - 1);
223 const auto nt = std::static_pointer_cast<NoteTrack>(
FindTrack());
229 const auto vruler = &
ruler;
231 vruler->
SetBounds(rect.x, rect.y, rect.x + 1, rect.y + rect.height - 1);
232 vruler->SetOrientation(wxVERTICAL);
235 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
void Draw(TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass) override
static ChannelView & Get(Channel &channel)
std::pair< int, int > vrulerSize
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 &)
Namespace containing an enum 'what to do on a refresh?'.
void copy(const T *src, T *dst, int32_t n)