16#include "../../../../HitTestResult.h"
20#include "../../../../RefreshCode.h"
21#include "../../../../TrackPanelMouseEvent.h"
23#include "../../../../prefs/WaveformSettings.h"
26 const std::shared_ptr<WaveChannel> &pChannel,
const wxRect &rect,
int y)
27 : mpChannel{ pChannel } , mZoomStart(y), mZoomEnd(y), mRect(rect)
40#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
80 evt, pProject, pParent, *pChannel,
mRect,
94 const wxRect &rect,
unsigned iPass )
105 const wxRect &rect,
const wxRect &panelRect,
unsigned iPass )
117 const wxRect &rect,
int zoomStart,
int zoomEnd,
118 bool fixedMousePoint)
121 static const float ZOOMLIMIT = 0.001f;
123 int height = rect.height;
127 if (zoomEnd < zoomStart)
130 float min, max, minBand = 0;
131 const double rate = wc.
GetRate();
132 const float halfrate = rate / 2;
133 float maxFreq = 8000.0;
141 cache.GetDisplayBounds(
min, max);
143 const bool linear = waveSettings.isLinear();
145 top = (
LINEAR_TO_DB(2.0) + waveSettings.dBRange) / waveSettings.dBRange;
146 half = (
LINEAR_TO_DB(0.5) + waveSettings.dBRange) / waveSettings.dBRange;
157 wxFAIL_MSG(
"Zooming Case not implemented by Audacity");
176 const float tmin =
min, tmax = max;
177 const float p1 = (zoomStart - ypos) / (
float)height;
178 const float p2 = (zoomEnd - ypos) / (
float)height;
179 max = (tmax * (1.0 - p1) + tmin * p1);
180 min = (tmax * (1.0 - p2) + tmin * p2);
183 if (max -
min < ZOOMLIMIT) {
184 float c = (
min + max) / 2;
185 min = c - ZOOMLIMIT / 2.0;
186 max = c + ZOOMLIMIT / 2.0;
192 const float zoomFactor = 0.5f;
193 const float currentRange = max -
min;
194 const float nextRange = std::max(zoomFactor * currentRange, ZOOMLIMIT);
196 const float center =
min + (currentRange / 2.0);
197 min = center - (nextRange / 2.0);
198 max = center + (nextRange / 2.0);
203 const float zoomFactor = 2.0f;
204 const float currentRange = max -
min;
205 const float nextRange = zoomFactor * currentRange;
207 const float center =
min + (currentRange / 2.0);
208 min = std::max(-top, center - (0.5f * nextRange));
209 max =
std::min(top, center + (0.5f * nextRange));
215 cache.SetDisplayBounds(
min, max);
217 zoomEnd = zoomStart = 0;
244 menu.Check(
id,
true);
274 if (scaleType != newScaleType) {
275 scaleType = newScaleType;
@ Internal
Indicates internal failure from Audacity.
XXO("&Cut/Copy/Paste Toolbar")
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
void ModifyState(bool bWantsAutoSave)
static ProjectHistory & Get(AudacityProject &project)
static std::shared_ptr< const Track > TrackFromChannel(const std::shared_ptr< const Channel > &pChannel)
A frequent convenience in the definition of UIHandles.
double GetRate() const override
Namespace containing an enum 'what to do on a refresh?'.
AUDACITY_DLL_API Result DoRelease(const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent, WaveChannel &wc, const wxRect &mRect, DoZoomFunction doZoom, PopupMenuTable &table, int zoomStart, int zoomEnd)
AUDACITY_DLL_API HitTestPreview HitPreview(const bool bVZoom)
AUDACITY_DLL_API void DoDraw(TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass, int zoomStart, int zoomEnd, bool hasDragZoom)
AUDACITY_DLL_API wxRect DoDrawingArea(const wxRect &rect, const wxRect &panelRect, unsigned iPass)
AUDACITY_DLL_API Result DoDrag(const TrackPanelMouseEvent &event, AudacityProject *pProject, int zoomStart, int &zoomEnd, bool hasDragZoom)
void swap(std::unique_ptr< Alg_seq > &a, std::unique_ptr< Alg_seq > &b)
AuthorizationHandler handler