16#include "../../../../HitTestResult.h"
20#include "../../../../RefreshCode.h"
21#include "../../../../TrackPanelMouseEvent.h"
27 const std::shared_ptr<WaveChannel> &pChannel,
const wxRect &rect,
int y)
28 : mpChannel{ pChannel } , mZoomStart(y), mZoomEnd(y), mRect(rect)
41#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
81 evt, pProject, pParent, *pChannel,
mRect,
95 const wxRect &rect,
unsigned iPass )
106 const wxRect &rect,
const wxRect &panelRect,
unsigned iPass )
118 const wxRect &rect,
int zoomStart,
int zoomEnd,
119 bool fixedMousePoint)
122 static const float ZOOMLIMIT = 0.001f;
124 int height = rect.height;
128 if (zoomEnd < zoomStart)
131 float min, max, minBand = 0;
132 const double rate = wc.
GetRate();
133 const float halfrate = rate / 2;
134 float maxFreq = 8000.0;
142 cache.GetDisplayBounds(
min, max);
144 const bool linear = waveSettings.isLinear();
146 top = (
LINEAR_TO_DB(2.0) + waveSettings.dBRange) / waveSettings.dBRange;
147 half = (
LINEAR_TO_DB(0.5) + waveSettings.dBRange) / waveSettings.dBRange;
158 wxFAIL_MSG(
"Zooming Case not implemented by Audacity");
177 const float tmin =
min, tmax = max;
178 const float p1 = (zoomStart - ypos) / (
float)height;
179 const float p2 = (zoomEnd - ypos) / (
float)height;
180 max = (tmax * (1.0 - p1) + tmin * p1);
181 min = (tmax * (1.0 - p2) + tmin * p2);
184 if (max -
min < ZOOMLIMIT) {
185 float c = (
min + max) / 2;
186 min = c - ZOOMLIMIT / 2.0;
187 max = c + ZOOMLIMIT / 2.0;
193 const float zoomFactor = 0.5f;
194 const float currentRange = max -
min;
195 const float nextRange = std::max(zoomFactor * currentRange, ZOOMLIMIT);
197 const float center =
min + (currentRange / 2.0);
198 min = center - (nextRange / 2.0);
199 max = center + (nextRange / 2.0);
204 const float zoomFactor = 2.0f;
205 const float currentRange = max -
min;
206 const float nextRange = zoomFactor * currentRange;
208 const float center =
min + (currentRange / 2.0);
209 min = std::max(-top, center - (0.5f * nextRange));
210 max =
std::min(top, center + (0.5f * nextRange));
216 cache.SetDisplayBounds(
min, max);
218 zoomEnd = zoomStart = 0;
245 menu.Check(
id,
true);
275 if (scaleType != newScaleType) {
276 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