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 "PlotSpectrumBase.h"
15#include <vector>
16#include <wx/font.h> // member variable
17#include <wx/statusbr.h> // to inherit
18#include "wxPanelWrapper.h" // to inherit
19
20class wxMemoryDC;
21class wxScrollBar;
22class wxSlider;
23class wxTextCtrl;
24class wxButton;
25class wxCheckBox;
26class wxChoice;
27
28class AudacityProject;
30class FreqGauge;
31class RulerPanel;
32
33DECLARE_EXPORTED_EVENT_TYPE(AUDACITY_DLL_API, EVT_FREQWINDOW_RECALC, -1);
34
35class FreqPlot final : public wxWindow
36{
37public:
38 FreqPlot(wxWindow *parent, wxWindowID winid);
39
40 // We don't need or want to accept focus.
41 bool AcceptsFocus() const;
42
43private:
44 void OnPaint(wxPaintEvent & event);
45 void OnErase(wxEraseEvent & event);
46 void OnMouseEvent(wxMouseEvent & event);
47
48private:
50
51 DECLARE_EVENT_TABLE()
52};
53
55 public PlotSpectrumBase,
56 public wxDialogWrapper,
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 void PlotMouseEvent(wxMouseEvent & event);
71 void PlotPaint(wxPaintEvent & event);
72
73 void OnCloseWindow(wxCloseEvent & event);
74 void OnCloseButton(wxCommandEvent & event);
75 void OnGetURL(wxCommandEvent & event);
76 void OnSize(wxSizeEvent & event);
77 void OnPanScroller(wxScrollEvent & event);
78 void OnZoomSlider(wxCommandEvent & event);
79 void OnAlgChoice(wxCommandEvent & event);
80 void OnSizeChoice(wxCommandEvent & event);
81 void OnFuncChoice(wxCommandEvent & event);
82 void OnAxisChoice(wxCommandEvent & event);
83 void OnExport(wxCommandEvent & event);
84 void OnReplot(wxCommandEvent & event);
85 void OnGridOnOff(wxCommandEvent & event);
86 void OnRecalc(wxCommandEvent & event);
87
88 void SendRecalcEvent();
89 void Recalc();
90 void DrawPlot();
91 void DrawBackground(wxMemoryDC & dc);
92
93 // PrefsListener implementation
94 void UpdatePrefs() override;
95
96 private:
97#ifdef __WXMSW__
98 static const int fontSize = 8;
99#else
100 static const int fontSize = 10;
101#endif
102
107
108 wxRect mPlotRect;
109
110 wxFont mFreqFont;
111
112 std::unique_ptr<wxCursor> mArrowCursor;
113 std::unique_ptr<wxCursor> mCrossCursor;
114
115 wxButton *mCloseButton;
116 wxButton *mExportButton;
117 wxButton *mReplotButton;
118 wxCheckBox *mGridOnOff;
119 wxChoice *mAlgChoice;
120 wxChoice *mSizeChoice;
121 wxChoice *mFuncChoice;
122 wxChoice *mAxisChoice;
123 wxScrollBar *mPanScroller;
124 wxSlider *mZoomSlider;
125 wxTextCtrl *mCursorText;
126 wxTextCtrl *mPeakText;
127
129 float mYMin;
130 float mYMax;
131 float mYStep;
132
133 std::unique_ptr<wxBitmap> mBitmap;
134
137
138 DECLARE_EVENT_TABLE()
139
140 friend class FreqPlot;
141};
142
143#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:36
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:49
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:112
std::unique_ptr< wxBitmap > mBitmap
Definition: FreqWindow.h:133
void OnGetURL(wxCommandEvent &event)
Definition: FreqWindow.cpp:538
void OnAlgChoice(wxCommandEvent &event)
Definition: FreqWindow.cpp:780
void OnPanScroller(wxScrollEvent &event)
Definition: FreqWindow.cpp:770
wxChoice * mAlgChoice
Definition: FreqWindow.h:119
void OnZoomSlider(wxCommandEvent &event)
Definition: FreqWindow.cpp:775
wxChoice * mSizeChoice
Definition: FreqWindow.h:120
wxButton * mExportButton
Definition: FreqWindow.h:116
void OnAxisChoice(wxCommandEvent &event)
Definition: FreqWindow.cpp:811
RulerPanel * hRuler
Definition: FreqWindow.h:104
std::unique_ptr< wxCursor > mCrossCursor
Definition: FreqWindow.h:113
wxButton * mReplotButton
Definition: FreqWindow.h:117
FreqPlot * mFreqPlot
Definition: FreqWindow.h:105
wxSlider * mZoomSlider
Definition: FreqWindow.h:124
void OnRecalc(wxCommandEvent &event)
void OnFuncChoice(wxCommandEvent &event)
Definition: FreqWindow.cpp:806
FrequencyPlotDialog(wxWindow *parent, wxWindowID id, AudacityProject &project, const TranslatableString &title, const wxPoint &pos)
Definition: FreqWindow.cpp:187
void OnCloseButton(wxCommandEvent &event)
Definition: FreqWindow.cpp:925
void UpdatePrefs() override
wxChoice * mFuncChoice
Definition: FreqWindow.h:121
static const int fontSize
Definition: FreqWindow.h:98
void OnReplot(wxCommandEvent &event)
void OnCloseWindow(wxCloseEvent &event)
Definition: FreqWindow.cpp:920
void OnExport(wxCommandEvent &event)
Definition: FreqWindow.cpp:999
wxTextCtrl * mCursorText
Definition: FreqWindow.h:125
RulerPanel * vRuler
Definition: FreqWindow.h:103
void PlotPaint(wxPaintEvent &event)
Definition: FreqWindow.cpp:817
FreqGauge * mProgress
Definition: FreqWindow.h:106
wxTextCtrl * mPeakText
Definition: FreqWindow.h:126
void OnSize(wxSizeEvent &event)
Definition: FreqWindow.cpp:572
wxButton * mCloseButton
Definition: FreqWindow.h:115
void OnGridOnOff(wxCommandEvent &event)
bool Show(bool show=true) override
Definition: FreqWindow.cpp:545
void OnSizeChoice(wxCommandEvent &event)
Definition: FreqWindow.cpp:797
void DrawBackground(wxMemoryDC &dc)
Definition: FreqWindow.cpp:581
wxChoice * mAxisChoice
Definition: FreqWindow.h:122
wxScrollBar * mPanScroller
Definition: FreqWindow.h:123
void PlotMouseEvent(wxMouseEvent &event)
Definition: FreqWindow.cpp:755
wxCheckBox * mGridOnOff
Definition: FreqWindow.h:118
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.