1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-23 17:30:17 +01: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:
Paul Licameli
2019-05-27 07:45:13 -04:00
parent 441763cabd
commit 35892fc869
6 changed files with 87 additions and 57 deletions

View File

@@ -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)