|
| SpectrumVRulerControls (const std::shared_ptr< ChannelView > &pChannelView) |
|
| ~SpectrumVRulerControls () override |
|
std::vector< UIHandlePtr > | HitTest (const TrackPanelMouseState &state, const AudacityProject *) override |
|
unsigned | HandleWheelRotation (const TrackPanelMouseEvent &event, AudacityProject *pProject) override |
|
std::shared_ptr< WaveChannel > | FindWaveChannel () |
|
| ChannelVRulerControls (const std::shared_ptr< ChannelView > &pChannelView) |
|
virtual | ~ChannelVRulerControls ()=0 |
|
std::vector< UIHandlePtr > | HitTest (const TrackPanelMouseState &state, const AudacityProject *pProject) override |
|
virtual void | UpdateRuler (const wxRect &rect)=0 |
|
std::shared_ptr< const ChannelView > | GetChannelView () const |
|
| CommonChannelCell (const std::shared_ptr< Channel > &pChannel) |
| Construct from a channel. More...
|
|
| ~CommonChannelCell () |
|
std::shared_ptr< Track > | DoFindTrack () override |
|
void | Reparent (const std::shared_ptr< Track > &parent, size_t iChannel) override |
| Object may be shared among tracks but hold a special back-pointer to one of them; reassign it. More...
|
|
template<typename Subtype = Channel> |
auto | FindChannel () -> std::shared_ptr< Subtype > |
| May return null. More...
|
|
template<typename Subtype = const Channel> |
auto | FindChannel () const -> std::enable_if_t< std::is_const_v< Subtype >, std::shared_ptr< Subtype > > |
| May return null. More...
|
|
| CommonTrackPanelCell () |
|
virtual | ~CommonTrackPanelCell ()=0 |
|
HitTestPreview | DefaultPreview (const TrackPanelMouseState &, const AudacityProject *) override |
|
std::shared_ptr< Track > | FindTrack () |
|
std::shared_ptr< const Track > | FindTrack () const |
|
virtual std::vector< MenuItem > | GetMenuItems (const wxRect &rect, const wxPoint *pPosition, AudacityProject *pProject) |
| Return a list of items for DoContextMenu() (empties for separators) More...
|
|
| TrackPanelCell ()=default |
|
| TrackPanelCell (const TrackPanelCell &)=delete |
|
TrackPanelCell & | operator= (const TrackPanelCell &)=delete |
|
virtual | ~TrackPanelCell ()=0 |
|
virtual HitTestPreview | DefaultPreview (const TrackPanelMouseState &state, const AudacityProject *pProject) |
|
virtual std::vector< UIHandlePtr > | HitTest (const TrackPanelMouseState &state, const AudacityProject *pProject)=0 |
|
virtual unsigned | HandleWheelRotation (const TrackPanelMouseEvent &event, AudacityProject *pProject) |
|
virtual std::shared_ptr< TrackPanelCell > | ContextMenuDelegate () |
|
virtual unsigned | DoContextMenu (const wxRect &rect, wxWindow *pParent, const wxPoint *pPosition, AudacityProject *pProject) |
|
virtual unsigned | CaptureKey (wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent, AudacityProject *project) |
|
virtual unsigned | KeyDown (wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent, AudacityProject *project) |
|
virtual unsigned | KeyUp (wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent, AudacityProject *project) |
|
virtual unsigned | Char (wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent, AudacityProject *project) |
|
virtual unsigned | LoseFocus (AudacityProject *project) |
|
| TrackPanelNode () |
|
virtual | ~TrackPanelNode ()=0 |
|
virtual | ~TrackPanelDrawable ()=0 |
|
virtual void | Draw (TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass) |
|
virtual wxRect | DrawingArea (TrackPanelDrawingContext &context, const wxRect &rect, const wxRect &panelRect, unsigned iPass) |
|
virtual | ~ChannelAttachment () |
|
virtual void | CopyTo (Track &track, size_t iChannel) const |
| Copy state, for undo/redo purposes. More...
|
|
virtual void | Reparent (const std::shared_ptr< Track > &parent, size_t iChannel) |
| Object may be shared among tracks but hold a special back-pointer to one of them; reassign it. More...
|
|
virtual void | WriteXMLAttributes (XMLWriter &writer, size_t iChannel) const |
| Serialize persistent attributes. More...
|
|
virtual bool | HandleXMLAttribute (const std::string_view &attr, const XMLAttributeValueView &valueView, size_t iChannel) |
| Deserialize an attribute, returning true if recognized. More...
|
|
Definition at line 19 of file SpectrumVRulerControls.h.
Definition at line 67 of file SpectrumVRulerControls.cpp.
69{
71 const wxMouseEvent &
event = evt.
event;
72
73 if (!(event.ShiftDown() || event.CmdDown()))
75
76
77
78 evt.
event.Skip(
false);
79
80 auto steps = evt.
steps;
81
83 if (event.CmdDown() && !event.ShiftDown()) {
84 const int yy = event.m_y;
86 pProject, wc,
87 (steps < 0)
90 evt.
rect, yy, yy,
true);
91 }
92 else if (!event.CmdDown() && event.ShiftDown()) {
93
94 static const float movement = 10.0f;
95 const int height = evt.
rect.GetHeight();
96 {
97 const float delta = steps * movement / height;
100 float bottom, top;
102 const double rate = wc.
GetRate();
103 const float bound = rate / 2;
105 float newTop =
106 std::min(bound, numberScale.PositionToValue(1.0f + delta));
107 const float newBottom =
108 std::max((isLinear ? 0.0f : 1.0f),
109 numberScale.PositionToValue(numberScale.ValueToPosition(newTop) - 1.0f));
110 newTop =
112 numberScale.PositionToValue(numberScale.ValueToPosition(newBottom) + 1.0f));
113
115 }
116 }
117 else
119
121
123}
static Settings & settings()
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 & Own(WaveChannel &wc)
static void DoZoom(AudacityProject *pProject, WaveChannel &wc, WaveChannelViewConstants::ZoomActions ZoomKind, const wxRect &rect, int zoomStart, int zoomEnd, bool fixedMousePoint)
double GetRate() const override
Namespace containing an enum 'what to do on a refresh?'.
References SpectrumVZoomHandle::DoZoom(), TrackPanelMouseEvent::event, ProjectHistory::Get(), SpectrogramBounds::Get(), SpectrogramBounds::GetBounds(), WaveChannel::GetRate(), WaveChannelViewConstants::kZoomIn, WaveChannelViewConstants::kZoomOut, min(), ProjectHistory::ModifyState(), SpectrogramSettings::Own(), NumberScale::PositionToValue(), TrackPanelMouseEvent::rect, RefreshCode::RefreshCell, RefreshCode::RefreshNone, SpectrogramBounds::SetBounds(), settings(), TrackPanelMouseEvent::steps, SpectrogramSettings::stLinear, RefreshCode::UpdateVRuler, and NumberScale::ValueToPosition().
Referenced by HandleWheelRotation().
void SpectrumVRulerControls::DoUpdateVRuler |
( |
const wxRect & |
rect, |
|
|
const WaveChannel & |
wc |
|
) |
| |
|
staticprivate |
Definition at line 141 of file SpectrumVRulerControls.cpp.
143{
146 float minFreq, maxFreq;
148 vruler->SetDbMirrorValue(0.0);
149
151 default:
152 wxASSERT(false);
154 {
155
156
157
158
159
160
161
162 vruler->SetBounds(
163 rect.x, rect.y, rect.x + rect.width, rect.y + rect.height - 1);
164 vruler->SetOrientation(wxVERTICAL);
166 vruler->SetLabelEdges(true);
167
168 if (maxFreq >= 2000) {
169 vruler->SetRange((maxFreq / 1000.), (minFreq / 1000.));
170
171 vruler->SetUnits(
XO(
"k"));
172 }
173 else {
174
175 vruler->SetRange((int)(maxFreq), (int)(minFreq));
176 vruler->SetUnits({});
177 }
179 }
180 break;
186 {
187
188
189
190
191
192
193
194 vruler->SetBounds(
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);
204 }
205 break;
206 }
208 vruler->GetMaxSize(&
size.first, &
size.second);
209}
static ChannelView & Get(Channel &channel)
std::pair< int, int > vrulerSize
static const LinearUpdater & Instance()
static const LogarithmicUpdater & Instance()
static SpectrogramSettings & Get(const WaveTrack &track)
AUDACITY_DLL_API Ruler & ScratchRuler()
References ChannelView::Get(), SpectrogramSettings::Get(), SpectrogramBounds::Get(), SpectrogramBounds::GetBounds(), IntFormat::Instance(), LinearUpdater::Instance(), LogarithmicUpdater::Instance(), RealFormat::LinearInstance(), WaveChannelVRulerControls::ScratchRuler(), settings(), size, SpectrogramSettings::stBark, SpectrogramSettings::stErb, SpectrogramSettings::stLinear, SpectrogramSettings::stLogarithmic, SpectrogramSettings::stMel, SpectrogramSettings::stPeriod, ChannelView::vrulerSize, and XO().
Referenced by UpdateRuler().