mirror of https://github.com/odrling/Aegisub
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:
parent
6bb861c7ef
commit
72cc224f5b
|
@ -85,20 +85,20 @@ void AssTime::ParseASS (const wxString text) {
|
||||||
// Hours
|
// Hours
|
||||||
if (colons == 2) {
|
if (colons == 2) {
|
||||||
while (text[end++] != _T(':'));
|
while (text[end++] != _T(':'));
|
||||||
th = StringToInt(text,pos,end);
|
th = AegiStringToInt(text,pos,end);
|
||||||
pos = end;
|
pos = end;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Minutes
|
// Minutes
|
||||||
if (colons >= 1) {
|
if (colons >= 1) {
|
||||||
while (text[end++] != _T(':'));
|
while (text[end++] != _T(':'));
|
||||||
tm = StringToInt(text,pos,end);
|
tm = AegiStringToInt(text,pos,end);
|
||||||
pos = end;
|
pos = end;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Miliseconds (includes seconds)
|
// Miliseconds (includes seconds)
|
||||||
end = text.Length();
|
end = text.Length();
|
||||||
tms = StringToFix(text,3,pos,end);
|
tms = AegiStringToFix(text,3,pos,end);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Something went wrong, don't change anything
|
// Something went wrong, don't change anything
|
||||||
|
|
|
@ -102,7 +102,7 @@ void BaseGrid::UpdateStyle() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set column widths
|
// 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();
|
SetColumnWidths();
|
||||||
|
|
||||||
// Update
|
// Update
|
||||||
|
|
|
@ -113,14 +113,14 @@ DialogStyleEditor::DialogStyleEditor (wxWindow *parent, AssStyle *_style, Subtit
|
||||||
*work = *style;
|
*work = *style;
|
||||||
|
|
||||||
// Prepare control values
|
// Prepare control values
|
||||||
FontSizeValue = FloatToString(style->fontsize);
|
FontSizeValue = AegiFloatToString(style->fontsize);
|
||||||
OutlineValue = FloatToString(style->outline_w);
|
OutlineValue = AegiFloatToString(style->outline_w);
|
||||||
ShadowValue = FloatToString(style->shadow_w);
|
ShadowValue = AegiFloatToString(style->shadow_w);
|
||||||
ScaleXValue = FloatToString(style->scalex);
|
ScaleXValue = AegiFloatToString(style->scalex);
|
||||||
ScaleYValue = FloatToString(style->scaley);
|
ScaleYValue = AegiFloatToString(style->scaley);
|
||||||
AngleValue = FloatToString(style->angle);
|
AngleValue = AegiFloatToString(style->angle);
|
||||||
EncodingValue = IntegerToString(style->encoding);
|
EncodingValue = AegiIntegerToString(style->encoding);
|
||||||
SpacingValue = FloatToString(style->spacing);
|
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") };
|
wxString alignValues[9] = { _T("7"),_T("8"),_T("9"),_T("4"),_T("5"),_T("6"),_T("1"),_T("2"),_T("3") };
|
||||||
performance_timer.Start();
|
performance_timer.Start();
|
||||||
wxArrayString fontList = wxFontEnumerator::GetFacenames();
|
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[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[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());
|
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[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,FloatToString(style->secondary.a),wxDefaultPosition,wxSize(60,-1),wxSP_ARROW_KEYS,0,255,style->secondary.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,FloatToString(style->outline.a),wxDefaultPosition,wxSize(60,-1),wxSP_ARROW_KEYS,0,255,style->outline.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,FloatToString(style->shadow.a),wxDefaultPosition,wxSize(60,-1),wxSP_ARROW_KEYS,0,255,style->shadow.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,FloatToString(style->Margin[i]),wxDefaultPosition,wxSize(60,-1),wxSP_ARROW_KEYS,0,9999,style->Margin[i]);
|
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;
|
margin[3] = 0;
|
||||||
Alignment = new wxRadioBox(this, RADIO_ALIGNMENT, _("Alignment"), wxDefaultPosition, wxDefaultSize, 9, alignValues, 3, wxRA_SPECIFY_COLS);
|
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));
|
Outline = new wxTextCtrl(this,TEXT_OUTLINE,_T(""),wxDefaultPosition,wxSize(40,20),0,NumValidator(&OutlineValue,true,false));
|
||||||
|
|
|
@ -983,7 +983,7 @@ void FrameMain::SynchronizeProject(bool fromSubs) {
|
||||||
zoom = wxString::Format(_T("%i"),videoBox->videoDisplay->zoomBox->GetSelection()+1);
|
zoom = wxString::Format(_T("%i"),videoBox->videoDisplay->zoomBox->GetSelection()+1);
|
||||||
|
|
||||||
int arType = VideoContext::Get()->GetAspectRatioType();
|
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);
|
else ar = wxString::Format(_T("%i"),arType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1345,7 +1345,7 @@ void FrameMain::OnSetARCustom (wxCommandEvent &event) {
|
||||||
// Get text
|
// Get text
|
||||||
VideoContext::Get()->Stop();
|
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;
|
if (value.IsEmpty()) return;
|
||||||
|
|
||||||
value.MakeLower();
|
value.MakeLower();
|
||||||
|
|
|
@ -349,7 +349,7 @@ void OptionsManager::LoadDefaults(bool onlyDefaults,bool doOverride) {
|
||||||
SetInt(_T("Find Field"),0);
|
SetInt(_T("Find Field"),0);
|
||||||
|
|
||||||
SetInt(_T("Grid hide overrides"),1);
|
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);
|
for (int i=0;i<9;i++) SetBool(wxString::Format(_T("Paste Over #%i"),i),false);
|
||||||
SetBool(_T("Paste Over #9"),true);
|
SetBool(_T("Paste Over #9"),true);
|
||||||
|
|
|
@ -215,7 +215,7 @@ void SubtitlesGrid::OnShowColMenu(wxCommandEvent &event) {
|
||||||
showCol[item] = !showCol[item];
|
showCol[item] = !showCol[item];
|
||||||
|
|
||||||
// Save options
|
// Save options
|
||||||
Options.SetBool(_T("Grid show column ") + IntegerToString(item),showCol[item]);
|
Options.SetBool(_T("Grid show column ") + AegiIntegerToString(item),showCol[item]);
|
||||||
Options.Save();
|
Options.Save();
|
||||||
|
|
||||||
// Update
|
// Update
|
||||||
|
|
|
@ -144,14 +144,14 @@ wxString PrettyFloatD(double src) { return PrettyFloat(wxString::Format(_T("%f")
|
||||||
|
|
||||||
///////////////////
|
///////////////////
|
||||||
// Float to string
|
// Float to string
|
||||||
wxString FloatToString(double value) {
|
wxString AegiFloatToString(double value) {
|
||||||
return PrettyFloat(wxString::Format(_T("%f"),value));
|
return PrettyFloat(wxString::Format(_T("%f"),value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/////////////////
|
/////////////////
|
||||||
// Int to string
|
// Int to string
|
||||||
wxString IntegerToString(int value) {
|
wxString AegiIntegerToString(int value) {
|
||||||
return wxString::Format(_T("%i"),value);
|
return wxString::Format(_T("%i"),value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -293,7 +293,7 @@ void GetWordBoundaries(const wxString text,IntPairVector &results,int start,int
|
||||||
/////////////////////
|
/////////////////////
|
||||||
// String to integer
|
// String to integer
|
||||||
// wxString::ToLong() is slow and not as flexible
|
// 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
|
// Initialize to zero and get length if end set to -1
|
||||||
int sign = 1;
|
int sign = 1;
|
||||||
int value = 0;
|
int value = 0;
|
||||||
|
@ -317,7 +317,7 @@ int StringToInt(const wxString &str,int start,int end) {
|
||||||
|
|
||||||
/////////////////////////
|
/////////////////////////
|
||||||
// String to fixed point
|
// 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
|
// Parts of the number
|
||||||
int sign = 1;
|
int sign = 1;
|
||||||
int major = 0;
|
int major = 0;
|
||||||
|
|
|
@ -62,14 +62,14 @@ wxString DecodeRelativePath(wxString path,wxString reference);
|
||||||
wxString PrettyFloat(wxString src);
|
wxString PrettyFloat(wxString src);
|
||||||
wxString PrettyFloatF(float src);
|
wxString PrettyFloatF(float src);
|
||||||
wxString PrettyFloatD(double src);
|
wxString PrettyFloatD(double src);
|
||||||
wxString FloatToString(double value);
|
wxString AegiFloatToString(double value);
|
||||||
wxString IntegerToString(int value);
|
wxString AegiIntegerToString(int value);
|
||||||
wxString PrettySize(int bytes);
|
wxString PrettySize(int bytes);
|
||||||
wxMenuItem *AppendBitmapMenuItem (wxMenu* parentMenu,int id,wxString text,wxString help,wxBitmap bmp,int pos=-1);
|
wxMenuItem *AppendBitmapMenuItem (wxMenu* parentMenu,int id,wxString text,wxString help,wxBitmap bmp,int pos=-1);
|
||||||
int SmallestPowerOf2(int x);
|
int SmallestPowerOf2(int x);
|
||||||
void GetWordBoundaries(const wxString text,IntPairVector &results,int start=0,int end=-1);
|
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 AegiStringToInt(const wxString &str,int start=0,int end=-1);
|
||||||
int StringToFix(const wxString &str,size_t decimalPlaces,int start=0,int end=-1);
|
int AegiStringToFix(const wxString &str,size_t decimalPlaces,int start=0,int end=-1);
|
||||||
wxIcon BitmapToIcon(wxBitmap bmp);
|
wxIcon BitmapToIcon(wxBitmap bmp);
|
||||||
void RestartAegisub();
|
void RestartAegisub();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue