1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-01 16:19:43 +02:00

Adding convenience method SetFormatName().

This commit is contained in:
lllucius 2013-10-27 01:26:04 +00:00
parent f642e6562e
commit ded45eb85e
2 changed files with 17 additions and 5 deletions

View File

@ -403,7 +403,7 @@ TimeConverter::TimeConverter(const wxString & formatName,
mFocusedDigit = 0;
SetFormatString(GetBuiltinFormat(formatName));
SetFormatName(formatName);
SetTimeValue(timeValue);
SetSampleRate(sampleRate);
}
@ -717,6 +717,11 @@ void TimeConverter::ControlsToValue()
mTimeValue = t;
}
void TimeConverter::SetFormatName(const wxString & formatName)
{
SetFormatString(GetBuiltinFormat(formatName));
}
void TimeConverter::SetFormatString(const wxString & formatString)
{
mFormatString = formatString;
@ -916,14 +921,14 @@ IMPLEMENT_CLASS(TimeTextCtrl, wxControl)
TimeTextCtrl::TimeTextCtrl(wxWindow *parent,
wxWindowID id,
wxString formatString,
wxString formatName,
double timeValue,
double sampleRate,
const wxPoint &pos,
const wxSize &size,
bool autoPos):
wxControl(parent, id, pos, size, wxSUNKEN_BORDER | wxWANTS_CHARS),
TimeConverter(formatString, timeValue, sampleRate),
TimeConverter(formatName, timeValue, sampleRate),
mBackgroundBitmap(NULL),
mDigitFont(NULL),
mLabelFont(NULL),
@ -983,6 +988,11 @@ void TimeTextCtrl::UpdateAutoFocus()
}
}
void TimeTextCtrl::SetFormatName(const wxString & formatName)
{
SetFormatString(GetBuiltinFormat(formatName));
}
void TimeTextCtrl::SetFormatString(const wxString & formatString)
{
TimeConverter::SetFormatString(formatString);

View File

@ -57,7 +57,8 @@ public:
virtual void ParseFormatString(const wxString & format);
void PrintDebugInfo();
void SetFormatString(const wxString & formatName);
void SetFormatName(const wxString & formatName);
void SetFormatString(const wxString & formatString);
void SetSampleRate(double sampleRate);
void SetTimeValue(double newTime);
double GetTimeValue();
@ -113,7 +114,7 @@ class TimeTextCtrl: public wxControl, public TimeConverter
TimeTextCtrl(wxWindow *parent,
wxWindowID id,
wxString formatName = wxT(""),
wxString formatName = wxEmptyString,
double timeValue = 0.0,
double sampleRate = 44100,
const wxPoint &pos = wxDefaultPosition,
@ -128,6 +129,7 @@ class TimeTextCtrl: public wxControl, public TimeConverter
void SetSampleRate(double sampleRate);
void SetTimeValue(double newTime);
void SetFormatString(const wxString & formatString);
void SetFormatName(const wxString & formatName);
void SetFieldFocus(int digit);