16#include "../../../ui/ChannelView.h"
19#include "../../../../RefreshCode.h"
20#include "../../../../TrackPanelMouseEvent.h"
23#include "../../../../widgets/Ruler.h"
24#include "../../../../widgets/LinearUpdater.h"
25#include "../../../../widgets/LogarithmicUpdater.h"
26#include "../../../../widgets/IntFormat.h"
27#include "../../../../widgets/RealFormat.h"
35 std::vector<UIHandlePtr> results;
39 auto result = std::make_shared<SpectrumVZoomHandle>(
42 results.push_back(result);
47 std::copy(more.begin(), more.end(), std::back_inserter(results));
64 return FindChannel<WaveChannel>();
71 const wxMouseEvent &
event = evt.
event;
73 if (!(event.ShiftDown() || event.CmdDown()))
78 evt.
event.Skip(
false);
80 auto steps = evt.
steps;
83 if (event.CmdDown() && !event.ShiftDown()) {
84 const int yy =
event.m_y;
90 evt.
rect, yy, yy,
true);
92 else if (!event.CmdDown() && event.ShiftDown()) {
94 static const float movement = 10.0f;
95 const int height = evt.
rect.GetHeight();
97 const float delta = steps * movement / height;
102 const double rate = wc.
GetRate();
103 const float bound = rate / 2;
107 const float newBottom =
108 std::max((isLinear ? 0.0f : 1.0f),
127 const wxRect &rect_,
unsigned iPass )
146 float minFreq, maxFreq;
148 vruler->SetDbMirrorValue(0.0);
163 rect.x, rect.y, rect.x + rect.width, rect.y + rect.height - 1);
164 vruler->SetOrientation(wxVERTICAL);
166 vruler->SetLabelEdges(
true);
168 if (maxFreq >= 2000) {
169 vruler->SetRange((maxFreq / 1000.), (minFreq / 1000.));
171 vruler->SetUnits(
XO(
"k"));
175 vruler->SetRange((
int)(maxFreq), (
int)(minFreq));
176 vruler->SetUnits({});
195 rect.x, rect.y, rect.x + rect.width, rect.y + rect.height - 1);
196 vruler->SetOrientation(wxVERTICAL);
198 vruler->SetLabelEdges(
true);
199 vruler->SetRange(maxFreq, minFreq);
200 vruler->SetUnits({});
203 vruler->SetNumberScale(scale);
208 vruler->GetMaxSize(&
size.first, &
size.second);
static Settings & settings()
std::shared_ptr< Subclass > AssignUIHandlePtr(std::weak_ptr< Subclass > &holder, const std::shared_ptr< Subclass > &pNew)
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()
static const LogarithmicUpdater & Instance()
float PositionToValue(float pp) const
float ValueToPosition(float val) const
void ModifyState(bool bWantsAutoSave)
static ProjectHistory & Get(AudacityProject &project)
void SetBounds(float min, float max)
void GetBounds(const WaveChannel &wc, float &min, float &max) const
static SpectrogramBounds & Get(WaveTrack &track)
Get either the global default settings, or the track's own if previously created.
Spectrogram settings, either for one track or as defaults.
static SpectrogramSettings & Get(const WaveTrack &track)
static SpectrogramSettings & Own(WaveChannel &wc)
std::weak_ptr< SpectrumVZoomHandle > mVZoomHandle
static unsigned DoHandleWheelRotation(const TrackPanelMouseEvent &evt, AudacityProject *pProject, WaveChannel &wc)
std::shared_ptr< WaveChannel > FindWaveChannel()
unsigned HandleWheelRotation(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
void UpdateRuler(const wxRect &rect) override
~SpectrumVRulerControls() override
std::vector< UIHandlePtr > HitTest(const TrackPanelMouseState &state, const AudacityProject *) override
void Draw(TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass) override
static void DoUpdateVRuler(const wxRect &rect, const WaveChannel &wc)
static void DoZoom(AudacityProject *pProject, WaveChannel &wc, WaveChannelViewConstants::ZoomActions ZoomKind, const wxRect &rect, int zoomStart, int zoomEnd, bool fixedMousePoint)
virtual void Draw(TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass)
double GetRate() const override
Namespace containing an enum 'what to do on a refresh?'.
AUDACITY_DLL_API Ruler & ScratchRuler()
AUDACITY_DLL_API void DoDraw(ChannelVRulerControls &controls, TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass)
void copy(const T *src, T *dst, int32_t n)