Audacity 3.2.0
SelectionBar.h
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 SelectionBar.h
6
7 Dominic Mazzoni
8
9**********************************************************************/
10
11#ifndef __AUDACITY_SELECTION_BAR__
12#define __AUDACITY_SELECTION_BAR__
13
14#include <wx/defs.h>
15
16#include "ToolBar.h"
18
19// Column for
20// Project rate
21// Snap To
22// Option Button
23// Vertical Line
24// Selection fields
25// Vertical Line
26// Cursor position
27
28#ifdef TIME_IN_SELECT_TOOLBAR
29#define SIZER_COLS 7
30#else
31#define SIZER_COLS 5
32#endif
33
34
35class wxChoice;
36class wxComboBox;
37class wxCommandEvent;
38class wxDC;
39class wxSizeEvent;
40class wxStaticText;
41
42class AudacityProject;
44class NumericTextCtrl;
45
46class AUDACITY_DLL_API SelectionBar final : public ToolBar {
47
48 public:
49 static Identifier ID();
50
51 SelectionBar( AudacityProject &project );
52 virtual ~SelectionBar();
53
54 bool ShownByDefault() const override;
55 DockID DefaultDockID() const override;
56
57 static SelectionBar &Get( AudacityProject &project );
58 static const SelectionBar &Get( const AudacityProject &project );
59
60 void Create(wxWindow *parent) override;
61
62 void Populate() override;
63 void Repaint(wxDC * WXUNUSED(dc)) override {};
64 void EnableDisableButtons() override {};
65 void UpdatePrefs() override;
66
67 void SetTimes(double start, double end, double audio);
68 void SetSnapTo(int);
69 void SetSelectionFormat(const NumericFormatSymbol & format);
70 void SetRate(double rate);
71 void SetListener(SelectionBarListener *l);
72 void RegenerateTooltips() override;
73
74 private:
75 auStaticText * AddTitle( const TranslatableString & Title,
76 wxSizer * pSizer );
77 NumericTextCtrl * AddTime( const TranslatableString &Name, int id, wxSizer * pSizer );
78 void AddVLine( wxSizer * pSizer );
79
80 void SetSelectionMode(int mode);
81 void ShowHideControls(int mode);
82 void SetDrivers( int driver1, int driver2 );
83 void ValuesToControls();
84 void OnUpdate(wxCommandEvent &evt);
85 void OnChangedTime(wxCommandEvent &evt);
86
87 void OnRate(wxCommandEvent & event);
88 void OnSnapTo(wxCommandEvent & event);
89 void OnChoice(wxCommandEvent & event);
90 void OnFocus(wxFocusEvent &event);
91 void OnCaptureKey(wxCommandEvent &event);
92 void OnSize(wxSizeEvent &evt);
93 void OnIdle( wxIdleEvent &evt );
94
95 void ModifySelection(int newDriver, bool done = false);
96 void UpdateRates();
97 void SelectionModeUpdated();
98
100 double mRate;
101 double mStart, mEnd, mLength, mCenter, mAudio;
102
103 // These two numbers say which two controls
104 // drive the other two.
107
108 int mSelectionMode{ 0 };
109 int mLastSelectionMode{ 0 };
110
116 wxChoice *mChoice;
117 wxStaticText *mProxy;
118 wxComboBox *mRateBox;
119 wxChoice *mSnapTo;
120 wxWindow *mRateText;
121
123
124 public:
125
126 DECLARE_CLASS(SelectionBar)
127 DECLARE_EVENT_TABLE()
128};
129
130#endif
131
int format
Definition: ExportPCM.cpp:53
static void OnSize(wxSizeEvent &evt)
Definition: VSTEffect.cpp:2546
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:90
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
An explicitly nonlocalized string, not meant for the user to see.
Definition: Identifier.h:22
(not quite a Toolbar) at foot of screen for setting and viewing the selection range.
Definition: SelectionBar.h:46
NumericTextCtrl * mStartTime
Definition: SelectionBar.h:111
NumericTextCtrl * mAudioTime
Definition: SelectionBar.h:115
wxString mLastValidText
Definition: SelectionBar.h:122
void EnableDisableButtons() override
Definition: SelectionBar.h:64
NumericTextCtrl * mLengthTime
Definition: SelectionBar.h:113
wxComboBox * mRateBox
Definition: SelectionBar.h:118
NumericTextCtrl * mEndTime
Definition: SelectionBar.h:114
wxChoice * mChoice
Definition: SelectionBar.h:116
void Repaint(wxDC *WXUNUSED(dc)) override
Definition: SelectionBar.h:63
NumericTextCtrl * mCenterTime
Definition: SelectionBar.h:112
wxChoice * mSnapTo
Definition: SelectionBar.h:119
wxWindow * mRateText
Definition: SelectionBar.h:120
SelectionBarListener * mListener
Definition: SelectionBar.h:99
wxStaticText * mProxy
Definition: SelectionBar.h:117
A parent class of SelectionBar, used to forward events to do with changes in the SelectionBar.
Works with ToolManager and ToolDock to provide a dockable window in which buttons can be placed.
Definition: ToolBar.h:74
virtual void Populate()=0
DockID
Identifies one of the docking areas for toolbars.
Definition: ToolBar.h:92
virtual void RegenerateTooltips()=0
void UpdatePrefs() override
Definition: ToolBar.cpp:622
virtual bool ShownByDefault() const
Whether the toolbar should be shown by default. Default implementation returns true.
Definition: ToolBar.cpp:365
virtual void Create(wxWindow *parent)
Definition: ToolBar.cpp:492
virtual DockID DefaultDockID() const
Which dock the toolbar defaults into. Default implementation chooses the top dock.
Definition: ToolBar.cpp:375
Holds a msgid for the translation catalog; may also bind format arguments.
is like wxStaticText, except it can be themed. wxStaticText can't be.
Definition: auStaticText.h:20
Services * Get()
Fetch the global instance, or nullptr if none is yet installed.
Definition: BasicUI.cpp:196
void OnFocus(wxWindow &window, wxFocusEvent &event)
a function useful to implement a focus event handler The window releases the keyboard if the event is...
auto end(const Ptr< Type, BaseDeleter > &p)
Enables range-for.
Definition: PackedArray.h:159