mirror of
https://github.com/cookiengineer/audacity
synced 2025-05-01 16:19:43 +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
|
||||
LWSlider::LWSlider(wxWindow * parent,
|
||||
wxString name,
|
||||
const wxString &name,
|
||||
const wxPoint &pos,
|
||||
const wxSize &size,
|
||||
float minValue,
|
||||
@ -412,7 +412,7 @@ void LWSlider::SetStyle(int style)
|
||||
|
||||
// Construct predefined slider
|
||||
LWSlider::LWSlider(wxWindow *parent,
|
||||
wxString name,
|
||||
const wxString &name,
|
||||
const wxPoint &pos,
|
||||
const wxSize &size,
|
||||
int style,
|
||||
@ -475,7 +475,7 @@ LWSlider::LWSlider(wxWindow *parent,
|
||||
}
|
||||
|
||||
void LWSlider::Init(wxWindow * parent,
|
||||
wxString name,
|
||||
const wxString &name,
|
||||
const wxPoint &pos,
|
||||
const wxSize &size,
|
||||
float minValue,
|
||||
@ -1582,7 +1582,7 @@ END_EVENT_TABLE()
|
||||
|
||||
ASlider::ASlider( wxWindow * parent,
|
||||
wxWindowID id,
|
||||
wxString name,
|
||||
const wxString &name,
|
||||
const wxPoint & pos,
|
||||
const wxSize & size,
|
||||
int style,
|
||||
|
@ -78,7 +78,7 @@ class LWSlider
|
||||
|
||||
// MM: Construct customizable slider
|
||||
LWSlider(wxWindow * parent,
|
||||
wxString name,
|
||||
const wxString &name,
|
||||
const wxPoint &pos,
|
||||
const wxSize &size,
|
||||
float minValue,
|
||||
@ -92,7 +92,7 @@ class LWSlider
|
||||
|
||||
// Construct predefined slider
|
||||
LWSlider(wxWindow * parent,
|
||||
wxString name,
|
||||
const wxString &name,
|
||||
const wxPoint &pos,
|
||||
const wxSize &size,
|
||||
int style,
|
||||
@ -101,7 +101,7 @@ class LWSlider
|
||||
int orientation = wxHORIZONTAL); // wxHORIZONTAL or wxVERTICAL. wxVERTICAL is currently only for DB_SLIDER.
|
||||
|
||||
void Init(wxWindow * parent,
|
||||
wxString name,
|
||||
const wxString &name,
|
||||
const wxPoint &pos,
|
||||
const wxSize &size,
|
||||
float minValue,
|
||||
@ -255,7 +255,7 @@ class ASlider :public wxPanel
|
||||
public:
|
||||
ASlider( wxWindow * parent,
|
||||
wxWindowID id,
|
||||
wxString name,
|
||||
const wxString &name,
|
||||
const wxPoint & pos,
|
||||
const wxSize & size,
|
||||
int style = FRAC_SLIDER,
|
||||
|
@ -156,9 +156,9 @@ void MultiDialog::OnShowLog(wxCommandEvent & WXUNUSED(event))
|
||||
}
|
||||
|
||||
|
||||
int ShowMultiDialog(wxString message,
|
||||
wxString title,
|
||||
const wxChar **buttons, wxString boxMsg, bool log)
|
||||
int ShowMultiDialog(const wxString &message,
|
||||
const wxString &title,
|
||||
const wxChar **buttons, const wxString &boxMsg, bool log)
|
||||
{
|
||||
wxWindow * pParent = wxGetApp().GetTopWindow();
|
||||
|
||||
|
@ -19,8 +19,8 @@
|
||||
|
||||
// Display a dialog with radio buttons.
|
||||
// Return the zero-based index of the chosen button.
|
||||
int ShowMultiDialog(wxString message,
|
||||
wxString title,
|
||||
const wxChar **buttons, wxString boxMsg = _("Please select an action"), bool log = true);
|
||||
int ShowMultiDialog(const wxString &message,
|
||||
const wxString &title,
|
||||
const wxChar **buttons, const wxString &boxMsg = _("Please select an action"), bool log = true);
|
||||
|
||||
#endif // __AUDACITY_MULTIDIALOG__
|
||||
|
@ -1163,7 +1163,7 @@ IMPLEMENT_CLASS(NumericTextCtrl, wxControl)
|
||||
NumericTextCtrl::NumericTextCtrl(NumericConverter::Type type,
|
||||
wxWindow *parent,
|
||||
wxWindowID id,
|
||||
wxString formatName,
|
||||
const wxString &formatName,
|
||||
double timeValue,
|
||||
double sampleRate,
|
||||
const wxPoint &pos,
|
||||
|
@ -136,7 +136,7 @@ class NumericTextCtrl: public wxControl, public NumericConverter
|
||||
NumericTextCtrl(NumericConverter::Type type,
|
||||
wxWindow *parent,
|
||||
wxWindowID id,
|
||||
wxString formatName = wxEmptyString,
|
||||
const wxString &formatName = wxEmptyString,
|
||||
double value = 0.0,
|
||||
double sampleRate = 44100,
|
||||
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
|
||||
// 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
|
||||
// want numbers like "1.6" formatted as "1.6 dB".
|
||||
void SetUnits(wxString units);
|
||||
void SetUnits(const wxString &units);
|
||||
|
||||
// Logarithmic
|
||||
void SetLog(bool log);
|
||||
|
@ -81,8 +81,8 @@ void WarningDialog::OnOK(wxCommandEvent& WXUNUSED(event))
|
||||
}
|
||||
|
||||
int ShowWarningDialog(wxWindow *parent,
|
||||
wxString internalDialogName,
|
||||
wxString message,
|
||||
const wxString &internalDialogName,
|
||||
const wxString &message,
|
||||
bool showCancelButton)
|
||||
{
|
||||
wxString key(wxT("/Warnings/") + internalDialogName);
|
||||
|
@ -21,8 +21,8 @@
|
||||
/// preferences. The internalDialogName is never seen by
|
||||
/// the user; it should be unique to each message.
|
||||
int ShowWarningDialog(wxWindow *parent,
|
||||
wxString internalDialogName,
|
||||
wxString message,
|
||||
const wxString &internalDialogName,
|
||||
const wxString &message,
|
||||
bool showCancelButton = false);
|
||||
|
||||
#endif // __AUDACITY_WARNING__
|
||||
|
@ -88,8 +88,10 @@ bool NumberFormatter::GetThousandsSeparatorIfUsed(wxChar *sep)
|
||||
// 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 )
|
||||
AddThousandsSeparators(s);
|
||||
|
||||
@ -226,24 +228,29 @@ void NumberFormatter::RemoveThousandsSeparators(wxString& s)
|
||||
s.Replace(wxString(thousandsSep), wxString());
|
||||
}
|
||||
|
||||
bool NumberFormatter::FromString(wxString s, long *val)
|
||||
bool NumberFormatter::FromString(const wxString &sArg, long *val)
|
||||
{
|
||||
RemoveThousandsSeparators(s);
|
||||
return s.ToLong(val);
|
||||
wxString s(sArg);
|
||||
RemoveThousandsSeparators(s);
|
||||
return s.ToLong(val);
|
||||
}
|
||||
|
||||
#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);
|
||||
return s.ToLongLong(val);
|
||||
wxString s(sArg);
|
||||
|
||||
RemoveThousandsSeparators(s);
|
||||
return s.ToLongLong(val);
|
||||
}
|
||||
|
||||
#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);
|
||||
return s.ToDouble(val);
|
||||
wxString s(sArg);
|
||||
|
||||
RemoveThousandsSeparators(s);
|
||||
return s.ToDouble(val);
|
||||
}
|
||||
|
@ -51,11 +51,11 @@ public:
|
||||
//
|
||||
// Return true on success and stores the result in the provided location
|
||||
// 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
|
||||
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
|
||||
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
|
||||
@ -69,7 +69,7 @@ public:
|
||||
|
||||
private:
|
||||
// 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
|
||||
// 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
|
||||
// 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);
|
||||
return val;
|
||||
}
|
||||
@ -236,7 +237,7 @@ protected:
|
||||
{
|
||||
LongestValueType value;
|
||||
return BaseValidator::FromString(s, &value) ? NormalizeValue(value)
|
||||
: wxString();
|
||||
: wxEmptyString;
|
||||
}
|
||||
|
||||
private:
|
||||
|
Loading…
x
Reference in New Issue
Block a user