19#include "../../ui/PlayableTrackButtonHandles.h"
22#include "../../../../HitTestResult.h"
23#include "../../../../TrackArtist.h"
24#include "../../../../TrackPanel.h"
25#include "../../../../TrackPanelMouseEvent.h"
26#include "../../../../NoteTrack.h"
27#include "../../../../widgets/PopupMenuTable.h"
30#include "../../../../ProjectWindows.h"
31#include "../../../../RefreshCode.h"
32#include "../../../../prefs/ThemePrefs.h"
48 std::vector<UIHandlePtr> results;
49 const wxMouseState &state = st.
state;
50 const wxRect &rect = st.
rect;
51 if (state.ButtonIsDown(wxMOUSE_BTN_ANY)) {
52 auto track = std::static_pointer_cast<NoteTrack>(
FindTrack());
62#ifdef EXPERIMENTAL_MIDI_OUT
63 if (NULL != (result = VelocitySliderHandle::HitTest(
73 results.push_back(result);
147#include "../../../../widgets/ASlider.h"
148#include "../../../../TrackInfo.h"
149#include "../../../../TrackPanelDrawingContext.h"
177 (
const wxRect &sliderRect,
const NoteTrack *t,
bool captured, wxWindow*),
178 wxDC *dc,
const wxRect &rect,
const Track *pTrack,
180 bool captured,
bool highlight )
182 wxRect sliderRect = rect;
184 auto nt =
static_cast<const NoteTrack*
>( pTrack );
185 Selector( sliderRect, nt, captured, pParent )->OnPaint(*dc, highlight);
188#ifdef EXPERIMENTAL_MIDI_OUT
189void VelocitySliderDrawFunction
191 const wxRect &rect,
const Track *pTrack )
193 auto dc = &context.
dc;
194 auto target =
dynamic_cast<VelocitySliderHandle*
>( context.
target.get() );
195 bool hit = target && target->GetTrack().get() == pTrack;
196 bool captured = hit && target->IsClicked();
203 pParent, captured, hit);
209 const wxRect &rect,
const Track *pTrack )
212 bool hit = target && target->
GetTrack().get() == pTrack;
213 auto channel = hit ? target->
GetChannel() : -1;
214 auto &dc = context.
dc;
215 wxRect midiRect = rect;
218 (
static_cast<const NoteTrack *
>(pTrack), dc, midiRect, channel );
225 NoteTrackControlsBase::StaticNoteTCPLines();
229#ifdef EXPERIMENTAL_MIDI_OUT
231 VelocitySliderDrawFunction },
240 dest.y = topleft.y + results.first;
241 dest.height = results.second;
249 dest.y = rect.y + results.first;
250 dest.height = results.second;
265#ifdef EXPERIMENTAL_MIDI_OUT
266 std::unique_ptr<LWSlider>
274#ifdef EXPERIMENTAL_MIDI_OUT
276(
const wxRect &sliderRect,
const NoteTrack *t,
bool captured, wxWindow *pParent)
278 static std::once_flag
flag;
282 wxPoint pos = sliderRect.GetPosition();
283 float velocity = t ? t->GetVelocity() : 0.0;
285 gVelocity->Move(pos);
286 gVelocity->Set(velocity);
287 gVelocityCaptured->Move(pos);
288 gVelocityCaptured->Set(velocity);
290 auto slider = (captured ? gVelocityCaptured : gVelocity).get();
291 slider->SetParent( pParent );
300#ifdef EXPERIMENTAL_MIDI_OUT
301 wxPoint point{ 0, 0 };
306 gVelocity = std::make_unique<LWSlider>(
nullptr,
XO(
"Velocity"),
307 wxPoint(sliderRect.x, sliderRect.y),
308 wxSize(sliderRect.width, sliderRect.height),
310 gVelocity->SetDefaultValue(0.0);
311 gVelocityCaptured = std::make_unique<LWSlider>(
nullptr,
XO(
"Velocity"),
312 wxPoint(sliderRect.x, sliderRect.y),
313 wxSize(sliderRect.width, sliderRect.height),
315 gVelocityCaptured->SetDefaultValue(0.0);
322 return std::make_shared<NoteTrackControls>( track.SharedPointer() );
326#include "../../../ui/TrackView.h"
std::shared_ptr< UIHandle > UIHandlePtr
XXO("&Cut/Copy/Paste Toolbar")
DEFINE_ATTACHED_VIRTUAL_OVERRIDE(DoGetNoteTrackControls)
NoteTrackTCPLines noteTrackTCPLines
TrackInfo::TCPLine TCPLine
AppendItem("Up", OnUpOctaveID, XXO("Up &Octave"), POPUP_MENU_FN(OnChangeOctave))
wxFrame * FindProjectFrame(AudacityProject *project)
Get a pointer to the window associated with a project, or null if the given pointer is null,...
TrackInfo::TCPLines TCPLines
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
virtual std::vector< UIHandlePtr > HitTest(const TrackPanelMouseState &state, const AudacityProject *) override=0
std::shared_ptr< Track > FindTrack()
Lightweight version of ASlider. In other words it does not have a window permanently associated with ...
static void ReCreateVelocitySlider(struct ThemeChangeMessage)
static void GetMidiControlsRect(const wxRect &rect, wxRect &dest)
std::weak_ptr< NoteTrackButtonHandle > mClickHandle
std::weak_ptr< SoloButtonHandle > mSoloHandle
std::weak_ptr< VelocitySliderHandle > mVelocityHandle
static unsigned DefaultNoteTrackHeight()
const TCPLines & GetTCPLines() const override
static void GetVelocityRect(const wxPoint &topleft, wxRect &dest)
static LWSlider * VelocitySlider(const wxRect &sliderRect, const NoteTrack *t, bool captured, wxWindow *pParent)
std::weak_ptr< MuteButtonHandle > mMuteHandle
std::vector< UIHandlePtr > HitTest(const TrackPanelMouseState &state, const AudacityProject *pProject) override
A Track that is used for Midi notes. (Somewhat old code).
static void DrawLabelControls(const NoteTrack *pTrack, wxDC &dc, const wxRect &rect, int highlightedChannel=-1)
void ShiftNoteRange(int offset)
Shifts all notes vertically by the given pitch.
Subscription Subscribe(Callback callback)
Connect a callback to the Publisher; later-connected are called earlier.
void ModifyState(bool bWantsAutoSave)
static ProjectHistory & Get(AudacityProject &project)
static TrackArtist * Get(TrackPanelDrawingContext &)
Abstract base class for an object holding data associated with points on a time axis.
virtual ChannelType GetChannel() const
auto end(const Ptr< Type, BaseDeleter > &p)
Enables range-for.
AUDACITY_DLL_API void GetSliderHorizontalBounds(const wxPoint &topleft, wxRect &dest)
AUDACITY_DLL_API unsigned DefaultTrackHeight(const TCPLines &topLines)
AUDACITY_DLL_API std::pair< int, int > CalcItemY(const TCPLines &lines, unsigned iItem)
void MidiControlsDrawFunction(TrackPanelDrawingContext &context, const wxRect &rect, const Track *pTrack)
void GetMidiControlsHorizontalBounds(const wxRect &rect, wxRect &dest)
void SliderDrawFunction(LWSlider *(*Selector)(const wxRect &sliderRect, const NoteTrack *t, bool captured, wxWindow *), wxDC *dc, const wxRect &rect, const Track *pTrack, wxWindow *pParent, bool captured, bool highlight)
For defining overrides of the method.
std::optional< PreferredSystemAppearance > appearance