mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-17 08:30:06 +02:00
Sweep unnecessary wxString copies: widgets
This commit is contained in:
parent
4961006f1b
commit
2efa24bc10
@ -342,7 +342,7 @@ static const wxPoint2DDouble disabledRightEnd[] =
|
|||||||
|
|
||||||
// Construct customizable slider
|
// Construct customizable slider
|
||||||
LWSlider::LWSlider(wxWindow * parent,
|
LWSlider::LWSlider(wxWindow * parent,
|
||||||
wxString name,
|
const wxString &name,
|
||||||
const wxPoint &pos,
|
const wxPoint &pos,
|
||||||
const wxSize &size,
|
const wxSize &size,
|
||||||
float minValue,
|
float minValue,
|
||||||
@ -412,7 +412,7 @@ void LWSlider::SetStyle(int style)
|
|||||||
|
|
||||||
// Construct predefined slider
|
// Construct predefined slider
|
||||||
LWSlider::LWSlider(wxWindow *parent,
|
LWSlider::LWSlider(wxWindow *parent,
|
||||||
wxString name,
|
const wxString &name,
|
||||||
const wxPoint &pos,
|
const wxPoint &pos,
|
||||||
const wxSize &size,
|
const wxSize &size,
|
||||||
int style,
|
int style,
|
||||||
@ -475,7 +475,7 @@ LWSlider::LWSlider(wxWindow *parent,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LWSlider::Init(wxWindow * parent,
|
void LWSlider::Init(wxWindow * parent,
|
||||||
wxString name,
|
const wxString &name,
|
||||||
const wxPoint &pos,
|
const wxPoint &pos,
|
||||||
const wxSize &size,
|
const wxSize &size,
|
||||||
float minValue,
|
float minValue,
|
||||||
@ -1582,7 +1582,7 @@ END_EVENT_TABLE()
|
|||||||
|
|
||||||
ASlider::ASlider( wxWindow * parent,
|
ASlider::ASlider( wxWindow * parent,
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
wxString name,
|
const wxString &name,
|
||||||
const wxPoint & pos,
|
const wxPoint & pos,
|
||||||
const wxSize & size,
|
const wxSize & size,
|
||||||
int style,
|
int style,
|
||||||
|
@ -78,7 +78,7 @@ class LWSlider
|
|||||||
|
|
||||||
// MM: Construct customizable slider
|
// MM: Construct customizable slider
|
||||||
LWSlider(wxWindow * parent,
|
LWSlider(wxWindow * parent,
|
||||||
wxString name,
|
const wxString &name,
|
||||||
const wxPoint &pos,
|
const wxPoint &pos,
|
||||||
const wxSize &size,
|
const wxSize &size,
|
||||||
float minValue,
|
float minValue,
|
||||||
@ -92,7 +92,7 @@ class LWSlider
|
|||||||
|
|
||||||
// Construct predefined slider
|
// Construct predefined slider
|
||||||
LWSlider(wxWindow * parent,
|
LWSlider(wxWindow * parent,
|
||||||
wxString name,
|
const wxString &name,
|
||||||
const wxPoint &pos,
|
const wxPoint &pos,
|
||||||
const wxSize &size,
|
const wxSize &size,
|
||||||
int style,
|
int style,
|
||||||
@ -101,7 +101,7 @@ class LWSlider
|
|||||||
int orientation = wxHORIZONTAL); // wxHORIZONTAL or wxVERTICAL. wxVERTICAL is currently only for DB_SLIDER.
|
int orientation = wxHORIZONTAL); // wxHORIZONTAL or wxVERTICAL. wxVERTICAL is currently only for DB_SLIDER.
|
||||||
|
|
||||||
void Init(wxWindow * parent,
|
void Init(wxWindow * parent,
|
||||||
wxString name,
|
const wxString &name,
|
||||||
const wxPoint &pos,
|
const wxPoint &pos,
|
||||||
const wxSize &size,
|
const wxSize &size,
|
||||||
float minValue,
|
float minValue,
|
||||||
@ -255,7 +255,7 @@ class ASlider :public wxPanel
|
|||||||
public:
|
public:
|
||||||
ASlider( wxWindow * parent,
|
ASlider( wxWindow * parent,
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
wxString name,
|
const wxString &name,
|
||||||
const wxPoint & pos,
|
const wxPoint & pos,
|
||||||
const wxSize & size,
|
const wxSize & size,
|
||||||
int style = FRAC_SLIDER,
|
int style = FRAC_SLIDER,
|
||||||
|
@ -156,9 +156,9 @@ void MultiDialog::OnShowLog(wxCommandEvent & WXUNUSED(event))
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int ShowMultiDialog(wxString message,
|
int ShowMultiDialog(const wxString &message,
|
||||||
wxString title,
|
const wxString &title,
|
||||||
const wxChar **buttons, wxString boxMsg, bool log)
|
const wxChar **buttons, const wxString &boxMsg, bool log)
|
||||||
{
|
{
|
||||||
wxWindow * pParent = wxGetApp().GetTopWindow();
|
wxWindow * pParent = wxGetApp().GetTopWindow();
|
||||||
|
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
|
|
||||||
// Display a dialog with radio buttons.
|
// Display a dialog with radio buttons.
|
||||||
// Return the zero-based index of the chosen button.
|
// Return the zero-based index of the chosen button.
|
||||||
int ShowMultiDialog(wxString message,
|
int ShowMultiDialog(const wxString &message,
|
||||||
wxString title,
|
const wxString &title,
|
||||||
const wxChar **buttons, wxString boxMsg = _("Please select an action"), bool log = true);
|
const wxChar **buttons, const wxString &boxMsg = _("Please select an action"), bool log = true);
|
||||||
|
|
||||||
#endif // __AUDACITY_MULTIDIALOG__
|
#endif // __AUDACITY_MULTIDIALOG__
|
||||||
|
@ -1163,7 +1163,7 @@ IMPLEMENT_CLASS(NumericTextCtrl, wxControl)
|
|||||||
NumericTextCtrl::NumericTextCtrl(NumericConverter::Type type,
|
NumericTextCtrl::NumericTextCtrl(NumericConverter::Type type,
|
||||||
wxWindow *parent,
|
wxWindow *parent,
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
wxString formatName,
|
const wxString &formatName,
|
||||||
double timeValue,
|
double timeValue,
|
||||||
double sampleRate,
|
double sampleRate,
|
||||||
const wxPoint &pos,
|
const wxPoint &pos,
|
||||||
|
@ -136,7 +136,7 @@ class NumericTextCtrl: public wxControl, public NumericConverter
|
|||||||
NumericTextCtrl(NumericConverter::Type type,
|
NumericTextCtrl(NumericConverter::Type type,
|
||||||
wxWindow *parent,
|
wxWindow *parent,
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
wxString formatName = wxEmptyString,
|
const wxString &formatName = wxEmptyString,
|
||||||
double value = 0.0,
|
double value = 0.0,
|
||||||
double sampleRate = 44100,
|
double sampleRate = 44100,
|
||||||
const wxPoint &pos = wxDefaultPosition,
|
const wxPoint &pos = wxDefaultPosition,
|
||||||
|
@ -204,7 +204,7 @@ void Ruler::SetLog(bool log)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ruler::SetUnits(wxString units)
|
void Ruler::SetUnits(const wxString &units)
|
||||||
{
|
{
|
||||||
// Specify the name of the units (like "dB") if you
|
// Specify the name of the units (like "dB") if you
|
||||||
// want numbers like "1.6" formatted as "1.6 dB".
|
// want numbers like "1.6" formatted as "1.6 dB".
|
||||||
|
@ -79,7 +79,7 @@ class AUDACITY_DLL_API Ruler {
|
|||||||
|
|
||||||
// Specify the name of the units (like "dB") if you
|
// Specify the name of the units (like "dB") if you
|
||||||
// want numbers like "1.6" formatted as "1.6 dB".
|
// want numbers like "1.6" formatted as "1.6 dB".
|
||||||
void SetUnits(wxString units);
|
void SetUnits(const wxString &units);
|
||||||
|
|
||||||
// Logarithmic
|
// Logarithmic
|
||||||
void SetLog(bool log);
|
void SetLog(bool log);
|
||||||
|
@ -81,8 +81,8 @@ void WarningDialog::OnOK(wxCommandEvent& WXUNUSED(event))
|
|||||||
}
|
}
|
||||||
|
|
||||||
int ShowWarningDialog(wxWindow *parent,
|
int ShowWarningDialog(wxWindow *parent,
|
||||||
wxString internalDialogName,
|
const wxString &internalDialogName,
|
||||||
wxString message,
|
const wxString &message,
|
||||||
bool showCancelButton)
|
bool showCancelButton)
|
||||||
{
|
{
|
||||||
wxString key(wxT("/Warnings/") + internalDialogName);
|
wxString key(wxT("/Warnings/") + internalDialogName);
|
||||||
|
@ -21,8 +21,8 @@
|
|||||||
/// preferences. The internalDialogName is never seen by
|
/// preferences. The internalDialogName is never seen by
|
||||||
/// the user; it should be unique to each message.
|
/// the user; it should be unique to each message.
|
||||||
int ShowWarningDialog(wxWindow *parent,
|
int ShowWarningDialog(wxWindow *parent,
|
||||||
wxString internalDialogName,
|
const wxString &internalDialogName,
|
||||||
wxString message,
|
const wxString &message,
|
||||||
bool showCancelButton = false);
|
bool showCancelButton = false);
|
||||||
|
|
||||||
#endif // __AUDACITY_WARNING__
|
#endif // __AUDACITY_WARNING__
|
||||||
|
@ -88,8 +88,10 @@ bool NumberFormatter::GetThousandsSeparatorIfUsed(wxChar *sep)
|
|||||||
// Conversion to string and helpers
|
// Conversion to string and helpers
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
wxString NumberFormatter::PostProcessIntString(wxString s, int style)
|
wxString NumberFormatter::PostProcessIntString(const wxString &sArg, int style)
|
||||||
{
|
{
|
||||||
|
wxString s(sArg);
|
||||||
|
|
||||||
if ( style & Style_WithThousandsSep )
|
if ( style & Style_WithThousandsSep )
|
||||||
AddThousandsSeparators(s);
|
AddThousandsSeparators(s);
|
||||||
|
|
||||||
@ -226,24 +228,29 @@ void NumberFormatter::RemoveThousandsSeparators(wxString& s)
|
|||||||
s.Replace(wxString(thousandsSep), wxString());
|
s.Replace(wxString(thousandsSep), wxString());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NumberFormatter::FromString(wxString s, long *val)
|
bool NumberFormatter::FromString(const wxString &sArg, long *val)
|
||||||
{
|
{
|
||||||
RemoveThousandsSeparators(s);
|
wxString s(sArg);
|
||||||
return s.ToLong(val);
|
RemoveThousandsSeparators(s);
|
||||||
|
return s.ToLong(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAS_LONG_LONG_T_DIFFERENT_FROM_LONG
|
#ifdef HAS_LONG_LONG_T_DIFFERENT_FROM_LONG
|
||||||
|
|
||||||
bool NumberFormatter::FromString(wxString s, wxLongLong_t *val)
|
bool NumberFormatter::FromString(const wxString &sArg, wxLongLong_t *val)
|
||||||
{
|
{
|
||||||
RemoveThousandsSeparators(s);
|
wxString s(sArg);
|
||||||
return s.ToLongLong(val);
|
|
||||||
|
RemoveThousandsSeparators(s);
|
||||||
|
return s.ToLongLong(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // HAS_LONG_LONG_T_DIFFERENT_FROM_LONG
|
#endif // HAS_LONG_LONG_T_DIFFERENT_FROM_LONG
|
||||||
|
|
||||||
bool NumberFormatter::FromString(wxString s, double *val)
|
bool NumberFormatter::FromString(const wxString &sArg, double *val)
|
||||||
{
|
{
|
||||||
RemoveThousandsSeparators(s);
|
wxString s(sArg);
|
||||||
return s.ToDouble(val);
|
|
||||||
|
RemoveThousandsSeparators(s);
|
||||||
|
return s.ToDouble(val);
|
||||||
}
|
}
|
||||||
|
@ -51,11 +51,11 @@ public:
|
|||||||
//
|
//
|
||||||
// Return true on success and stores the result in the provided location
|
// Return true on success and stores the result in the provided location
|
||||||
// which must be a valid non-NULL pointer.
|
// which must be a valid non-NULL pointer.
|
||||||
static bool FromString(wxString s, long *val);
|
static bool FromString(const wxString &s, long *val);
|
||||||
#ifdef HAS_LONG_LONG_T_DIFFERENT_FROM_LONG
|
#ifdef HAS_LONG_LONG_T_DIFFERENT_FROM_LONG
|
||||||
static bool FromString(wxString s, wxLongLong_t *val);
|
static bool FromString(const wxString &s, wxLongLong_t *val);
|
||||||
#endif // HAS_LONG_LONG_T_DIFFERENT_FROM_LONG
|
#endif // HAS_LONG_LONG_T_DIFFERENT_FROM_LONG
|
||||||
static bool FromString(wxString s, double *val);
|
static bool FromString(const wxString &s, double *val);
|
||||||
|
|
||||||
|
|
||||||
// Get the decimal separator for the current locale. It is always defined
|
// Get the decimal separator for the current locale. It is always defined
|
||||||
@ -69,7 +69,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
// Post-process the string representing an integer.
|
// Post-process the string representing an integer.
|
||||||
static wxString PostProcessIntString(wxString s, int style);
|
static wxString PostProcessIntString(const wxString &s, int style);
|
||||||
|
|
||||||
// Add the thousands separators to a string representing a number without
|
// Add the thousands separators to a string representing a number without
|
||||||
// the separators. This is used by ToString(Style_WithThousandsSep).
|
// the separators. This is used by ToString(Style_WithThousandsSep).
|
||||||
|
@ -84,8 +84,9 @@ protected:
|
|||||||
|
|
||||||
// Return the string which would result from inserting the given character
|
// Return the string which would result from inserting the given character
|
||||||
// at the specified position.
|
// at the specified position.
|
||||||
wxString GetValueAfterInsertingChar(wxString val, int pos, wxChar ch) const
|
wxString GetValueAfterInsertingChar(const wxString &valArg, int pos, wxChar ch) const
|
||||||
{
|
{
|
||||||
|
wxString val(valArg);
|
||||||
val.insert(pos, ch);
|
val.insert(pos, ch);
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
@ -236,7 +237,7 @@ protected:
|
|||||||
{
|
{
|
||||||
LongestValueType value;
|
LongestValueType value;
|
||||||
return BaseValidator::FromString(s, &value) ? NormalizeValue(value)
|
return BaseValidator::FromString(s, &value) ? NormalizeValue(value)
|
||||||
: wxString();
|
: wxEmptyString;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user