Audacity 3.2.0
TimeDialog.cpp
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 TimeDialog.cpp
6
7 Dominic Mazzoni
8
9*******************************************************************//*******************************************************************/
15
16
17#include "TimeDialog.h"
18
19#include <wx/defs.h>
20
21#include "ShuttleGui.h"
23
24BEGIN_EVENT_TABLE(TimeDialog, wxDialogWrapper)
25 EVT_COMMAND(wxID_ANY, EVT_TIMETEXTCTRL_UPDATED, TimeDialog::OnUpdate)
27
28TimeDialog::TimeDialog(wxWindow *parent,
31 double rate,
32 double time,
33 const TranslatableString &prompt)
34: wxDialogWrapper(parent, wxID_ANY, title),
35 mPrompt(prompt),
36 mFormat(format),
37 mRate(rate),
38 mTime(time),
39 mTimeCtrl(NULL)
40{
41 SetName();
43 PopulateOrExchange(S);
44}
45
47{
48 S.SetBorder(5);
49 S.StartVerticalLay(true);
50 {
51 S.StartStatic(mPrompt, true);
52 {
55 S.GetParent(), wxID_ANY,
57 mFormat,
58 mTime,
59 mRate,
61 .AutoPos(true));
62 S.AddWindow(mTimeCtrl);
63 }
64 S.EndStatic();
65 }
66 S.EndVerticalLay();
67 S.AddStandardButtons();
68
70
71 Layout();
72 Fit();
73 SetMinSize(GetSize());
74 Center();
75}
76
78{
82 mTimeCtrl->SetFocus();
83
84 return true;
85}
86
88{
90
91 return true;
92}
93
95{
96 return mTime;
97}
98
100{
101 mFormat = formatString;
103}
104
105void TimeDialog::SetSampleRate(double sampleRate)
106{
107 mRate = sampleRate;
109}
110
111void TimeDialog::SetTimeValue(double newTime)
112{
113 mTime = newTime;
115}
116
117void TimeDialog::OnUpdate(wxCommandEvent &event)
118{
119 Layout();
120 Refresh();
121
122 event.Skip(false);
123}
END_EVENT_TABLE()
int format
Definition: ExportPCM.cpp:53
EVT_COMMAND(wxID_ANY, EVT_FREQUENCYTEXTCTRL_UPDATED, LabelDialog::OnFreqUpdate) LabelDialog
Definition: LabelDialog.cpp:88
#define safenew
Definition: MemoryX.h:10
static const auto title
@ eIsCreating
Definition: ShuttleGui.h:39
#define S(N)
Definition: ToChars.cpp:64
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
FormatStrings GetBuiltinFormat(const int index)
bool SetFormatString(const FormatStrings &formatString)
void SetSampleRate(double sampleRate)
void SetValue(double newValue)
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:628
Dialog used to request a time value.
Definition: TimeDialog.h:24
double mTime
Definition: TimeDialog.h:52
NumericFormatSymbol mFormat
Definition: TimeDialog.h:50
void PopulateOrExchange(ShuttleGui &S)
Definition: TimeDialog.cpp:46
void OnUpdate(wxCommandEvent &event)
Definition: TimeDialog.cpp:117
NumericTextCtrl * mTimeCtrl
Definition: TimeDialog.h:54
bool TransferDataToWindow() override
Definition: TimeDialog.cpp:77
void SetSampleRate(double sampleRate)
Definition: TimeDialog.cpp:105
void SetTimeValue(double newTime)
Definition: TimeDialog.cpp:111
const double GetTimeValue()
Definition: TimeDialog.cpp:94
bool TransferDataFromWindow() override
Definition: TimeDialog.cpp:87
TranslatableString mPrompt
Definition: TimeDialog.h:49
double mRate
Definition: TimeDialog.h:51
void SetFormatString(const NumericFormatSymbol &formatString)
Definition: TimeDialog.cpp:99
Holds a msgid for the translation catalog; may also bind format arguments.
Options & AutoPos(bool enable)