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#include "Project.h"
24
25BEGIN_EVENT_TABLE(TimeDialog, wxDialogWrapper)
26 EVT_COMMAND(wxID_ANY, EVT_TIMETEXTCTRL_UPDATED, TimeDialog::OnUpdate)
28
29TimeDialog::TimeDialog(wxWindow *parent,
33 double time,
34 const TranslatableString &prompt)
35: wxDialogWrapper(parent, wxID_ANY, title),
36 mPrompt(prompt),
37 mFormat(format),
38 mProject(project),
39 mTime(time),
40 mTimeCtrl(NULL)
41{
42 SetName();
44 PopulateOrExchange(S);
45}
46
48{
49 S.SetBorder(5);
50 S.StartVerticalLay(true);
51 {
52 S.StartStatic(mPrompt, true);
53 {
57 S.GetParent(), wxID_ANY,
59 mFormat,
60 mTime,
62 .AutoPos(true));
63 S.AddWindow(mTimeCtrl);
64 }
65 S.EndStatic();
66 }
67 S.EndVerticalLay();
68 S.AddStandardButtons();
69
71
72 Layout();
73 Fit();
74 SetMinSize(GetSize());
75 Center();
76}
77
79{
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
105
106void TimeDialog::SetTimeValue(double newTime)
107{
108 mTime = newTime;
110}
111
112void TimeDialog::OnUpdate(wxCommandEvent &event)
113{
114 Layout();
115 Refresh();
116
117 event.Skip(false);
118}
END_EVENT_TABLE()
EVT_COMMAND(wxID_ANY, EVT_FREQUENCYTEXTCTRL_UPDATED, LabelDialog::OnFreqUpdate) LabelDialog
Definition: LabelDialog.cpp:89
#define safenew
Definition: MemoryX.h:10
static const auto title
const NumericConverterType & NumericConverterType_TIME()
@ eIsCreating
Definition: ShuttleGui.h:37
const auto project
#define S(N)
Definition: ToChars.cpp:64
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:90
static FormatterContext ProjectContext(const AudacityProject &project)
bool SetFormatName(const NumericFormatID &formatName)
void SetValue(double newValue)
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:640
Dialog used to request a time value.
Definition: TimeDialog.h:25
double mTime
Definition: TimeDialog.h:52
void PopulateOrExchange(ShuttleGui &S)
Definition: TimeDialog.cpp:47
void OnUpdate(wxCommandEvent &event)
Definition: TimeDialog.cpp:112
NumericTextCtrl * mTimeCtrl
Definition: TimeDialog.h:54
bool TransferDataToWindow() override
Definition: TimeDialog.cpp:78
void SetFormatString(const NumericFormatID &formatString)
Definition: TimeDialog.cpp:99
void SetTimeValue(double newTime)
Definition: TimeDialog.cpp:106
const double GetTimeValue()
Definition: TimeDialog.cpp:94
const AudacityProject & mProject
Definition: TimeDialog.h:51
bool TransferDataFromWindow() override
Definition: TimeDialog.cpp:87
TranslatableString mPrompt
Definition: TimeDialog.h:49
NumericFormatID mFormat
Definition: TimeDialog.h:50
Holds a msgid for the translation catalog; may also bind format arguments.
Options & AutoPos(bool enable)