mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-21 06:01:13 +02:00
Rearrange setting time & freq formats for numeric controls...
... Just one low-level function for each that simply sets; just one high-level function for each that also pushes notifications; and to make that work, toolbars need some rewriting to avoid recursion when the notifications they post come back to them.
This commit is contained in:
@@ -1051,17 +1051,23 @@ void NumericConverter::ControlsToValue()
|
||||
mValue = std::max(mMinValue, std::min(mMaxValue, t));
|
||||
}
|
||||
|
||||
void NumericConverter::SetFormatName(const NumericFormatSymbol & formatName)
|
||||
bool NumericConverter::SetFormatName(const NumericFormatSymbol & formatName)
|
||||
{
|
||||
SetFormatString(GetBuiltinFormat(formatName));
|
||||
return
|
||||
SetFormatString(GetBuiltinFormat(formatName));
|
||||
}
|
||||
|
||||
void NumericConverter::SetFormatString(const wxString & formatString)
|
||||
bool NumericConverter::SetFormatString(const wxString & formatString)
|
||||
{
|
||||
mFormatString = formatString;
|
||||
ParseFormatString(mFormatString);
|
||||
ValueToControls();
|
||||
ControlsToValue();
|
||||
if (mFormatString != formatString) {
|
||||
mFormatString = formatString;
|
||||
ParseFormatString(mFormatString);
|
||||
ValueToControls();
|
||||
ControlsToValue();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
void NumericConverter::SetSampleRate(double sampleRate)
|
||||
@@ -1366,19 +1372,24 @@ void NumericTextCtrl::UpdateAutoFocus()
|
||||
}
|
||||
}
|
||||
|
||||
void NumericTextCtrl::SetFormatName(const NumericFormatSymbol & formatName)
|
||||
bool NumericTextCtrl::SetFormatName(const NumericFormatSymbol & formatName)
|
||||
{
|
||||
SetFormatString(GetBuiltinFormat(formatName));
|
||||
return
|
||||
SetFormatString(GetBuiltinFormat(formatName));
|
||||
}
|
||||
|
||||
void NumericTextCtrl::SetFormatString(const wxString & formatString)
|
||||
bool NumericTextCtrl::SetFormatString(const wxString & formatString)
|
||||
{
|
||||
NumericConverter::SetFormatString(formatString);
|
||||
Layout();
|
||||
Fit();
|
||||
ValueToControls();
|
||||
ControlsToValue();
|
||||
UpdateAutoFocus();
|
||||
auto result =
|
||||
NumericConverter::SetFormatString(formatString);
|
||||
if (result) {
|
||||
Layout();
|
||||
Fit();
|
||||
ValueToControls();
|
||||
ControlsToValue();
|
||||
UpdateAutoFocus();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void NumericTextCtrl::SetSampleRate(double sampleRate)
|
||||
|
@@ -83,8 +83,13 @@ private:
|
||||
|
||||
public:
|
||||
void PrintDebugInfo();
|
||||
void SetFormatName(const NumericFormatSymbol & formatName);
|
||||
void SetFormatString(const wxString & formatString);
|
||||
|
||||
// returns true iff the format name really changed:
|
||||
bool SetFormatName(const NumericFormatSymbol & formatName);
|
||||
|
||||
// returns true iff the format string really changed:
|
||||
bool SetFormatString(const wxString & formatString);
|
||||
|
||||
void SetSampleRate(double sampleRate);
|
||||
void SetValue(double newValue);
|
||||
void SetMinValue(double minValue);
|
||||
@@ -187,8 +192,12 @@ class NumericTextCtrl final : public wxControl, public NumericConverter
|
||||
|
||||
void SetSampleRate(double sampleRate);
|
||||
void SetValue(double newValue);
|
||||
void SetFormatString(const wxString & formatString);
|
||||
void SetFormatName(const NumericFormatSymbol & formatName);
|
||||
|
||||
// returns true iff the format string really changed:
|
||||
bool SetFormatString(const wxString & formatString);
|
||||
|
||||
// returns true iff the format name really changed:
|
||||
bool SetFormatName(const NumericFormatSymbol & formatName);
|
||||
|
||||
void SetFieldFocus(int /* digit */);
|
||||
|
||||
|
Reference in New Issue
Block a user