From 036da35fe8d86e8bb24022ccf1a309510cacb6a8 Mon Sep 17 00:00:00 2001 From: Karl Blomster Date: Mon, 6 Apr 2009 20:01:42 +0000 Subject: [PATCH] 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. --- aegisub/src/ass_time.cpp | 6 +++--- aegisub/src/base_grid.cpp | 2 +- aegisub/src/dialog_style_editor.cpp | 26 +++++++++++++------------- aegisub/src/frame_main.cpp | 2 +- aegisub/src/frame_main_events.cpp | 2 +- aegisub/src/options.cpp | 2 +- aegisub/src/subs_grid.cpp | 2 +- aegisub/src/utils.cpp | 8 ++++---- aegisub/src/utils.h | 8 ++++---- 9 files changed, 29 insertions(+), 29 deletions(-) diff --git a/aegisub/src/ass_time.cpp b/aegisub/src/ass_time.cpp index 40b846e4b..c178e6112 100644 --- a/aegisub/src/ass_time.cpp +++ b/aegisub/src/ass_time.cpp @@ -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 diff --git a/aegisub/src/base_grid.cpp b/aegisub/src/base_grid.cpp index 933b31715..b78d3b444 100644 --- a/aegisub/src/base_grid.cpp +++ b/aegisub/src/base_grid.cpp @@ -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 diff --git a/aegisub/src/dialog_style_editor.cpp b/aegisub/src/dialog_style_editor.cpp index 923af4ae1..b71c7def6 100644 --- a/aegisub/src/dialog_style_editor.cpp +++ b/aegisub/src/dialog_style_editor.cpp @@ -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)); diff --git a/aegisub/src/frame_main.cpp b/aegisub/src/frame_main.cpp index 5dca08270..0ff5d187b 100644 --- a/aegisub/src/frame_main.cpp +++ b/aegisub/src/frame_main.cpp @@ -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); } diff --git a/aegisub/src/frame_main_events.cpp b/aegisub/src/frame_main_events.cpp index bea467db6..2049f4153 100644 --- a/aegisub/src/frame_main_events.cpp +++ b/aegisub/src/frame_main_events.cpp @@ -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(); diff --git a/aegisub/src/options.cpp b/aegisub/src/options.cpp index 6bdbe31b2..6d12570bf 100644 --- a/aegisub/src/options.cpp +++ b/aegisub/src/options.cpp @@ -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); diff --git a/aegisub/src/subs_grid.cpp b/aegisub/src/subs_grid.cpp index a3a8efde2..9997c96ff 100644 --- a/aegisub/src/subs_grid.cpp +++ b/aegisub/src/subs_grid.cpp @@ -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 diff --git a/aegisub/src/utils.cpp b/aegisub/src/utils.cpp index 98e1b1dc8..1e0be4d41 100644 --- a/aegisub/src/utils.cpp +++ b/aegisub/src/utils.cpp @@ -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; diff --git a/aegisub/src/utils.h b/aegisub/src/utils.h index 68ed756f2..2d8c1ba5b 100644 --- a/aegisub/src/utils.h +++ b/aegisub/src/utils.h @@ -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();