Rename a few internal utility functions (FloatToString, IntegerToString, StringToInt, StringToFix) to Aegi* so they do not conflict with identically named wxWidgets functions. Fixes bugtracker issue #819.

Originally committed to SVN as r2771.
This commit is contained in:
Karl Blomster 2009-04-06 20:01:42 +00:00
parent 6bb861c7ef
commit 72cc224f5b
9 changed files with 29 additions and 29 deletions

View file

@ -85,20 +85,20 @@ void AssTime::ParseASS (const wxString text) {
// Hours
if (colons == 2) {
while (text[end++] != _T(':'));
th = StringToInt(text,pos,end);
th = AegiStringToInt(text,pos,end);
pos = end;
}
// Minutes
if (colons >= 1) {
while (text[end++] != _T(':'));
tm = StringToInt(text,pos,end);
tm = AegiStringToInt(text,pos,end);
pos = end;
}
// Miliseconds (includes seconds)
end = text.Length();
tms = StringToFix(text,3,pos,end);
tms = AegiStringToFix(text,3,pos,end);
}
// Something went wrong, don't change anything

View file

@ -102,7 +102,7 @@ void BaseGrid::UpdateStyle() {
}
// Set column widths
for (int i=0;i<10;i++) showCol[i] = Options.AsBool(_T("Grid show column ") + IntegerToString(i));
for (int i=0;i<10;i++) showCol[i] = Options.AsBool(_T("Grid show column ") + AegiIntegerToString(i));
SetColumnWidths();
// Update

View file

@ -113,14 +113,14 @@ DialogStyleEditor::DialogStyleEditor (wxWindow *parent, AssStyle *_style, Subtit
*work = *style;
// Prepare control values
FontSizeValue = FloatToString(style->fontsize);
OutlineValue = FloatToString(style->outline_w);
ShadowValue = FloatToString(style->shadow_w);
ScaleXValue = FloatToString(style->scalex);
ScaleYValue = FloatToString(style->scaley);
AngleValue = FloatToString(style->angle);
EncodingValue = IntegerToString(style->encoding);
SpacingValue = FloatToString(style->spacing);
FontSizeValue = AegiFloatToString(style->fontsize);
OutlineValue = AegiFloatToString(style->outline_w);
ShadowValue = AegiFloatToString(style->shadow_w);
ScaleXValue = AegiFloatToString(style->scalex);
ScaleYValue = AegiFloatToString(style->scaley);
AngleValue = AegiFloatToString(style->angle);
EncodingValue = AegiIntegerToString(style->encoding);
SpacingValue = AegiFloatToString(style->spacing);
wxString alignValues[9] = { _T("7"),_T("8"),_T("9"),_T("4"),_T("5"),_T("6"),_T("1"),_T("2"),_T("3") };
performance_timer.Start();
wxArrayString fontList = wxFontEnumerator::GetFacenames();
@ -156,11 +156,11 @@ DialogStyleEditor::DialogStyleEditor (wxWindow *parent, AssStyle *_style, Subtit
colorButton[1] = new ColourButton(this,BUTTON_COLOR_2,wxSize(55,16),style->secondary.GetWXColor());
colorButton[2] = new ColourButton(this,BUTTON_COLOR_3,wxSize(55,16),style->outline.GetWXColor());
colorButton[3] = new ColourButton(this,BUTTON_COLOR_4,wxSize(55,16),style->shadow.GetWXColor());
colorAlpha[0] = new wxSpinCtrl(this,TEXT_ALPHA_1,FloatToString(style->primary.a),wxDefaultPosition,wxSize(60,-1),wxSP_ARROW_KEYS,0,255,style->primary.a);
colorAlpha[1] = new wxSpinCtrl(this,TEXT_ALPHA_2,FloatToString(style->secondary.a),wxDefaultPosition,wxSize(60,-1),wxSP_ARROW_KEYS,0,255,style->secondary.a);
colorAlpha[2] = new wxSpinCtrl(this,TEXT_ALPHA_3,FloatToString(style->outline.a),wxDefaultPosition,wxSize(60,-1),wxSP_ARROW_KEYS,0,255,style->outline.a);
colorAlpha[3] = new wxSpinCtrl(this,TEXT_ALPHA_4,FloatToString(style->shadow.a),wxDefaultPosition,wxSize(60,-1),wxSP_ARROW_KEYS,0,255,style->shadow.a);
for (int i=0;i<3;i++) margin[i] = new wxSpinCtrl(this,TEXT_MARGIN_L+i,FloatToString(style->Margin[i]),wxDefaultPosition,wxSize(60,-1),wxSP_ARROW_KEYS,0,9999,style->Margin[i]);
colorAlpha[0] = new wxSpinCtrl(this,TEXT_ALPHA_1,AegiFloatToString(style->primary.a),wxDefaultPosition,wxSize(60,-1),wxSP_ARROW_KEYS,0,255,style->primary.a);
colorAlpha[1] = new wxSpinCtrl(this,TEXT_ALPHA_2,AegiFloatToString(style->secondary.a),wxDefaultPosition,wxSize(60,-1),wxSP_ARROW_KEYS,0,255,style->secondary.a);
colorAlpha[2] = new wxSpinCtrl(this,TEXT_ALPHA_3,AegiFloatToString(style->outline.a),wxDefaultPosition,wxSize(60,-1),wxSP_ARROW_KEYS,0,255,style->outline.a);
colorAlpha[3] = new wxSpinCtrl(this,TEXT_ALPHA_4,AegiFloatToString(style->shadow.a),wxDefaultPosition,wxSize(60,-1),wxSP_ARROW_KEYS,0,255,style->shadow.a);
for (int i=0;i<3;i++) margin[i] = new wxSpinCtrl(this,TEXT_MARGIN_L+i,AegiFloatToString(style->Margin[i]),wxDefaultPosition,wxSize(60,-1),wxSP_ARROW_KEYS,0,9999,style->Margin[i]);
margin[3] = 0;
Alignment = new wxRadioBox(this, RADIO_ALIGNMENT, _("Alignment"), wxDefaultPosition, wxDefaultSize, 9, alignValues, 3, wxRA_SPECIFY_COLS);
Outline = new wxTextCtrl(this,TEXT_OUTLINE,_T(""),wxDefaultPosition,wxSize(40,20),0,NumValidator(&OutlineValue,true,false));

View file

@ -983,7 +983,7 @@ void FrameMain::SynchronizeProject(bool fromSubs) {
zoom = wxString::Format(_T("%i"),videoBox->videoDisplay->zoomBox->GetSelection()+1);
int arType = VideoContext::Get()->GetAspectRatioType();
if (arType == 4) ar = wxString(_T("c")) + FloatToString(VideoContext::Get()->GetAspectRatioValue());
if (arType == 4) ar = wxString(_T("c")) + AegiFloatToString(VideoContext::Get()->GetAspectRatioValue());
else ar = wxString::Format(_T("%i"),arType);
}

View file

@ -1345,7 +1345,7 @@ void FrameMain::OnSetARCustom (wxCommandEvent &event) {
// Get text
VideoContext::Get()->Stop();
wxString value = wxGetTextFromUser(_("Enter aspect ratio in either decimal (e.g. 2.35) or fractional (e.g. 16:9) form. Enter a value like 853x480 to set a specific resolution."),_("Enter aspect ratio"),FloatToString(VideoContext::Get()->GetAspectRatioValue()));
wxString value = wxGetTextFromUser(_("Enter aspect ratio in either decimal (e.g. 2.35) or fractional (e.g. 16:9) form. Enter a value like 853x480 to set a specific resolution."),_("Enter aspect ratio"),AegiFloatToString(VideoContext::Get()->GetAspectRatioValue()));
if (value.IsEmpty()) return;
value.MakeLower();

View file

@ -349,7 +349,7 @@ void OptionsManager::LoadDefaults(bool onlyDefaults,bool doOverride) {
SetInt(_T("Find Field"),0);
SetInt(_T("Grid hide overrides"),1);
for (int i=0;i<10;i++) SetBool(_T("Grid show column ") + IntegerToString(i),true);
for (int i=0;i<10;i++) SetBool(_T("Grid show column ") + AegiIntegerToString(i),true);
for (int i=0;i<9;i++) SetBool(wxString::Format(_T("Paste Over #%i"),i),false);
SetBool(_T("Paste Over #9"),true);

View file

@ -215,7 +215,7 @@ void SubtitlesGrid::OnShowColMenu(wxCommandEvent &event) {
showCol[item] = !showCol[item];
// Save options
Options.SetBool(_T("Grid show column ") + IntegerToString(item),showCol[item]);
Options.SetBool(_T("Grid show column ") + AegiIntegerToString(item),showCol[item]);
Options.Save();
// Update

View file

@ -144,14 +144,14 @@ wxString PrettyFloatD(double src) { return PrettyFloat(wxString::Format(_T("%f")
///////////////////
// Float to string
wxString FloatToString(double value) {
wxString AegiFloatToString(double value) {
return PrettyFloat(wxString::Format(_T("%f"),value));
}
/////////////////
// Int to string
wxString IntegerToString(int value) {
wxString AegiIntegerToString(int value) {
return wxString::Format(_T("%i"),value);
}
@ -293,7 +293,7 @@ void GetWordBoundaries(const wxString text,IntPairVector &results,int start,int
/////////////////////
// String to integer
// wxString::ToLong() is slow and not as flexible
int StringToInt(const wxString &str,int start,int end) {
int AegiStringToInt(const wxString &str,int start,int end) {
// Initialize to zero and get length if end set to -1
int sign = 1;
int value = 0;
@ -317,7 +317,7 @@ int StringToInt(const wxString &str,int start,int end) {
/////////////////////////
// String to fixed point
int StringToFix(const wxString &str,size_t decimalPlaces,int start,int end) {
int AegiStringToFix(const wxString &str,size_t decimalPlaces,int start,int end) {
// Parts of the number
int sign = 1;
int major = 0;

View file

@ -62,14 +62,14 @@ wxString DecodeRelativePath(wxString path,wxString reference);
wxString PrettyFloat(wxString src);
wxString PrettyFloatF(float src);
wxString PrettyFloatD(double src);
wxString FloatToString(double value);
wxString IntegerToString(int value);
wxString AegiFloatToString(double value);
wxString AegiIntegerToString(int value);
wxString PrettySize(int bytes);
wxMenuItem *AppendBitmapMenuItem (wxMenu* parentMenu,int id,wxString text,wxString help,wxBitmap bmp,int pos=-1);
int SmallestPowerOf2(int x);
void GetWordBoundaries(const wxString text,IntPairVector &results,int start=0,int end=-1);
int StringToInt(const wxString &str,int start=0,int end=-1);
int StringToFix(const wxString &str,size_t decimalPlaces,int start=0,int end=-1);
int AegiStringToInt(const wxString &str,int start=0,int end=-1);
int AegiStringToFix(const wxString &str,size_t decimalPlaces,int start=0,int end=-1);
wxIcon BitmapToIcon(wxBitmap bmp);
void RestartAegisub();