16#include "../../../../HitTestResult.h"
20#include "../../../../RefreshCode.h"
21#include "../../../../TrackPanelMouseEvent.h"
26 const std::shared_ptr<WaveChannel> &pChannel,
const wxRect &rect,
int y
27) : mpChannel{ pChannel }, mZoomStart(y), mZoomEnd(y), mRect(rect)
45#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
84 evt, pProject, pParent, *pChannel,
mRect,
98 const wxRect &rect,
unsigned iPass )
109 const wxRect &rect,
const wxRect &panelRect,
unsigned iPass )
121 const wxRect &rect,
int zoomStart,
int zoomEnd,
122 bool fixedMousePoint)
125 static const float ZOOMLIMIT = 0.001f;
127 int height = rect.height;
131 if (zoomEnd < zoomStart)
134 float min, max, minBand = 0;
135 const double rate = wc.
GetRate();
136 const float halfrate = rate / 2;
137 float maxFreq = 8000.0;
140 const bool spectrumLinear =
146 const int kSpectral = 100;
156 bounds.GetBounds(wc,
min, max);
157 scale = (specSettings.GetScale(
min, max));
158 const auto fftLength = specSettings.GetFFTLength();
159 const float binSize = rate / fftLength;
165 const int minBins = 1;
166 minBand = minBins * binSize;
175 wxFAIL_MSG(
"Zooming Case not implemented by Audacity");
183 min = spectrumLinear ? 0.0f : 1.0f;
191 min = spectrumLinear ? 0.0f : 1.0f;
197 double xmin = 1 - (zoomEnd - ypos) / (
float)height;
198 double xmax = 1 - (zoomStart - ypos) / (
float)height;
199 const float middle = (xmin + xmax) / 2;
202 min = std::max(spectrumLinear ? 0.0f : 1.0f,
207 std::max(middleValue + minBand / 2,
215 const float p1 = (zoomStart - ypos) / (
float)height;
216 const float middle = 1.0f - p1;
219 if (fixedMousePoint) {
220 min = std::max(spectrumLinear ? 0.0f : 1.0f,
221 std::min(middleValue - minBand * middle,
225 std::max(middleValue + minBand * p1,
230 min = std::max(spectrumLinear ? 0.0f : 1.0f,
235 std::max(middleValue + minBand / 2,
244 const float p1 = (zoomStart - ypos) / (
float)height;
251 if (fixedMousePoint) {
264 bounds.SetBounds(
min, max);
266 zoomEnd = zoomStart = 0;
294 menu.Check(
id,
true);
311 auto &wc = mpData->wc;
@ Internal
Indicates internal failure from Audacity.
XXO("&Cut/Copy/Paste Toolbar")
IntSetting SpectrumMaxFreq
for(int ii=0, nn=names.size();ii< nn;++ii)
AppendItem("In", OnZoomInVerticalID, XXO("Zoom In"), POPUP_MENU_FN(OnZoomInVertical))
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
float PositionToValue(float pp) const
void ModifyState(bool bWantsAutoSave)
static ProjectHistory & Get(AudacityProject &project)
bool Read(T *pVar) const
overload of Read returning a boolean that is true if the value was previously defined */
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)
static void DoZoom(AudacityProject *pProject, WaveChannel &wc, WaveChannelViewConstants::ZoomActions ZoomKind, const wxRect &rect, int zoomStart, int zoomEnd, bool fixedMousePoint)
SpectrumVZoomHandle(const SpectrumVZoomHandle &)
Result Release(const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override
std::shared_ptr< WaveChannel > FindWaveChannel()
bool HandlesRightClick() override
Whether the handle has any special right-button handling.
void Draw(TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass) override
Result Drag(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
std::shared_ptr< const Track > FindTrack() const override
Result Click(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
std::weak_ptr< WaveChannel > mpChannel
void Enter(bool forward, AudacityProject *) override
wxRect DrawingArea(TrackPanelDrawingContext &, const wxRect &rect, const wxRect &panelRect, unsigned iPass) override
~SpectrumVZoomHandle() override
Result Cancel(AudacityProject *pProject) override
HitTestPreview Preview(const TrackPanelMouseState &state, AudacityProject *pProject) override
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 bool IsDragZooming(int zoomStart, int zoomEnd, bool hasDragZoom)
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