Audacity 3.2.0
FreqWindow.h
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 FreqWindow.h
6
7 Dominic Mazzoni
8
9**********************************************************************/
10
11#ifndef __AUDACITY_FREQ_WINDOW__
12#define __AUDACITY_FREQ_WINDOW__
13
14#include <vector>
15#include <wx/font.h> // member variable
16#include <wx/statusbr.h> // to inherit
17#include "Prefs.h"
18#include "SampleFormat.h"
19#include "SpectrumAnalyst.h"
20#include "wxPanelWrapper.h" // to inherit
21
22class wxMemoryDC;
23class wxScrollBar;
24class wxSlider;
25class wxTextCtrl;
26class wxButton;
27class wxCheckBox;
28class wxChoice;
29
30class AudacityProject;
32class FreqGauge;
33class RulerPanel;
34
35DECLARE_EXPORTED_EVENT_TYPE(AUDACITY_DLL_API, EVT_FREQWINDOW_RECALC, -1);
36
37class FreqPlot final : public wxWindow
38{
39public:
40 FreqPlot(wxWindow *parent, wxWindowID winid);
41
42 // We don't need or want to accept focus.
43 bool AcceptsFocus() const;
44
45private:
46 void OnPaint(wxPaintEvent & event);
47 void OnErase(wxEraseEvent & event);
48 void OnMouseEvent(wxMouseEvent & event);
49
50private:
52
53 DECLARE_EVENT_TABLE()
54};
55
57 public PrefsListener
58{
59public:
60 FrequencyPlotDialog(wxWindow *parent, wxWindowID id,
62 const TranslatableString & title, const wxPoint & pos);
63 virtual ~ FrequencyPlotDialog();
64
65 bool Show( bool show = true ) override;
66
67private:
68 void Populate();
69
70 bool GetAudio();
71
72 void PlotMouseEvent(wxMouseEvent & event);
73 void PlotPaint(wxPaintEvent & event);
74
75 void OnCloseWindow(wxCloseEvent & event);
76 void OnCloseButton(wxCommandEvent & event);
77 void OnGetURL(wxCommandEvent & event);
78 void OnSize(wxSizeEvent & event);
79 void OnPanScroller(wxScrollEvent & event);
80 void OnZoomSlider(wxCommandEvent & event);
81 void OnAlgChoice(wxCommandEvent & event);
82 void OnSizeChoice(wxCommandEvent & event);
83 void OnFuncChoice(wxCommandEvent & event);
84 void OnAxisChoice(wxCommandEvent & event);
85 void OnExport(wxCommandEvent & event);
86 void OnReplot(wxCommandEvent & event);
87 void OnGridOnOff(wxCommandEvent & event);
88 void OnRecalc(wxCommandEvent & event);
89
90 void SendRecalcEvent();
91 void Recalc();
92 void DrawPlot();
93 void DrawBackground(wxMemoryDC & dc);
94
95 // PrefsListener implementation
96 void UpdatePrefs() override;
97
98 private:
100 int mSize;
102 int mFunc;
103 int mAxis;
106
107#ifdef __WXMSW__
108 static const int fontSize = 8;
109#else
110 static const int fontSize = 10;
111#endif
112
117
118 wxRect mPlotRect;
119
120 wxFont mFreqFont;
121
122 std::unique_ptr<wxCursor> mArrowCursor;
123 std::unique_ptr<wxCursor> mCrossCursor;
124
125 wxButton *mCloseButton;
126 wxButton *mExportButton;
127 wxButton *mReplotButton;
128 wxCheckBox *mGridOnOff;
129 wxChoice *mAlgChoice;
130 wxChoice *mSizeChoice;
131 wxChoice *mFuncChoice;
132 wxChoice *mAxisChoice;
133 wxScrollBar *mPanScroller;
134 wxSlider *mZoomSlider;
135 wxTextCtrl *mCursorText;
136 wxTextCtrl *mPeakText;
137
138
139 double mRate;
140 size_t mDataLen;
143
145 float mYMin;
146 float mYMax;
147 float mYStep;
148
149 std::unique_ptr<wxBitmap> mBitmap;
150
153
154 std::unique_ptr<SpectrumAnalyst> mAnalyst;
155
156 DECLARE_EVENT_TABLE()
157
158 friend class FreqPlot;
159};
160
161#endif
DECLARE_EXPORTED_EVENT_TYPE(AUDACITY_DLL_API, EVT_FREQWINDOW_RECALC, -1)
static const auto title
const auto project
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:90
Works with FrequencyPlotDialog to display a spectrum plot of the waveform. This class actually does t...
Definition: FreqWindow.h:38
void OnErase(wxEraseEvent &event)
bool AcceptsFocus() const
void OnMouseEvent(wxMouseEvent &event)
FreqPlot(wxWindow *parent, wxWindowID winid)
void OnPaint(wxPaintEvent &event)
FrequencyPlotDialog * freqWindow
Definition: FreqWindow.h:51
Displays a spectrum plot of the waveform. Has options for selecting parameters of the plot.
Definition: FreqWindow.h:58
std::unique_ptr< wxCursor > mArrowCursor
Definition: FreqWindow.h:122
std::unique_ptr< wxBitmap > mBitmap
Definition: FreqWindow.h:149
void OnGetURL(wxCommandEvent &event)
Definition: FreqWindow.cpp:550
void OnAlgChoice(wxCommandEvent &event)
Definition: FreqWindow.cpp:873
void OnPanScroller(wxScrollEvent &event)
Definition: FreqWindow.cpp:863
wxChoice * mAlgChoice
Definition: FreqWindow.h:129
void OnZoomSlider(wxCommandEvent &event)
Definition: FreqWindow.cpp:868
wxChoice * mSizeChoice
Definition: FreqWindow.h:130
wxButton * mExportButton
Definition: FreqWindow.h:126
void OnAxisChoice(wxCommandEvent &event)
Definition: FreqWindow.cpp:904
RulerPanel * hRuler
Definition: FreqWindow.h:114
std::unique_ptr< wxCursor > mCrossCursor
Definition: FreqWindow.h:123
wxButton * mReplotButton
Definition: FreqWindow.h:127
FreqPlot * mFreqPlot
Definition: FreqWindow.h:115
wxSlider * mZoomSlider
Definition: FreqWindow.h:134
void OnRecalc(wxCommandEvent &event)
SpectrumAnalyst::Algorithm mAlg
Definition: FreqWindow.h:101
std::unique_ptr< SpectrumAnalyst > mAnalyst
Definition: FreqWindow.h:154
void OnFuncChoice(wxCommandEvent &event)
Definition: FreqWindow.cpp:899
FrequencyPlotDialog(wxWindow *parent, wxWindowID id, AudacityProject &project, const TranslatableString &title, const wxPoint &pos)
Definition: FreqWindow.cpp:186
void OnCloseButton(wxCommandEvent &event)
void UpdatePrefs() override
wxChoice * mFuncChoice
Definition: FreqWindow.h:131
AudacityProject * mProject
Definition: FreqWindow.h:105
static const int fontSize
Definition: FreqWindow.h:108
void OnReplot(wxCommandEvent &event)
void OnCloseWindow(wxCloseEvent &event)
void OnExport(wxCommandEvent &event)
wxTextCtrl * mCursorText
Definition: FreqWindow.h:135
RulerPanel * vRuler
Definition: FreqWindow.h:113
void PlotPaint(wxPaintEvent &event)
Definition: FreqWindow.cpp:910
FreqGauge * mProgress
Definition: FreqWindow.h:116
wxTextCtrl * mPeakText
Definition: FreqWindow.h:136
void OnSize(wxSizeEvent &event)
Definition: FreqWindow.cpp:665
wxButton * mCloseButton
Definition: FreqWindow.h:125
void OnGridOnOff(wxCommandEvent &event)
bool Show(bool show=true) override
Definition: FreqWindow.cpp:557
void OnSizeChoice(wxCommandEvent &event)
Definition: FreqWindow.cpp:890
void DrawBackground(wxMemoryDC &dc)
Definition: FreqWindow.cpp:674
wxChoice * mAxisChoice
Definition: FreqWindow.h:132
wxScrollBar * mPanScroller
Definition: FreqWindow.h:133
void PlotMouseEvent(wxMouseEvent &event)
Definition: FreqWindow.cpp:848
wxCheckBox * mGridOnOff
Definition: FreqWindow.h:128
A listener notified of changes in preferences.
Definition: Prefs.h:652
RulerPanel class allows you to work with a Ruler like any other wxWindow.
Definition: RulerPanel.h:19
Holds a msgid for the translation catalog; may also bind format arguments.