Fixed writing of styles

Originally committed to SVN as r935.
This commit is contained in:
Rodrigo Braz Monteiro 2007-02-10 23:56:10 +00:00
parent 8d837d6a90
commit ccdd960982
3 changed files with 12 additions and 7 deletions

View File

@ -404,16 +404,16 @@ void AssStyle::UpdateData() {
font.Replace(_T(","),_T(";"));
final = wxString::Format(_T("Style: %s,%s,%.0f,%s,%s,%s,%s,%d,%d,%d,%d,%.0f,%.0f,%.0f,%.0f,%d,%.0f,%.0f,%i,%i,%i,%i,%i"),
name.c_str(), font.c_str(), fontsize,
final = wxString::Format(_T("Style: %s,%s,%s,%s,%s,%s,%s,%d,%d,%d,%d,%s,%s,%s,%s,%d,%s,%s,%i,%i,%i,%i,%i"),
name.c_str(), font.c_str(), PrettyFloatD(fontsize).c_str(),
primary.GetASSFormatted(true,false,true).c_str(),
secondary.GetASSFormatted(true,false,true).c_str(),
outline.GetASSFormatted(true,false,true).c_str(),
shadow.GetASSFormatted(true,false,true).c_str(),
(bold? -1 : 0), (italic ? -1 : 0),
(underline?-1:0),(strikeout?-1:0),
scalex,scaley,spacing,angle,
borderstyle,outline_w,shadow_w,alignment,
PrettyFloatD(scalex).c_str(),PrettyFloatD(scaley).c_str(),PrettyFloatD(spacing).c_str(),PrettyFloatD(angle).c_str(),
borderstyle,PrettyFloatD(outline_w).c_str(),PrettyFloatD(shadow_w).c_str(),alignment,
Margin[0],Margin[1],Margin[2],encoding);
SetEntryData(final);
@ -462,13 +462,13 @@ wxString AssStyle::GetSSAText() {
name.Replace(_T(","),_T(";"));
font.Replace(_T(","),_T(";"));
output = wxString::Format(_T("Style: %s,%s,%.0f,%s,%s,0,%s,%d,%d,%d,%.0f,%.0f,%d,%d,%d,%d,0,%i"),
name.c_str(), font.c_str(), fontsize,
output = wxString::Format(_T("Style: %s,%s,%s,%s,%s,0,%s,%d,%d,%d,%s,%s,%d,%d,%d,%d,0,%i"),
name.c_str(), font.c_str(), PrettyFloatD(fontsize).c_str(),
primary.GetSSAFormatted().c_str(),
secondary.GetSSAFormatted().c_str(),
shadow.GetSSAFormatted().c_str(),
(bold? -1 : 0), (italic ? -1 : 0),
borderstyle,outline_w,shadow_w,align,
borderstyle,PrettyFloatD(outline_w).c_str(),PrettyFloatD(shadow_w).c_str(),align,
Margin[0],Margin[1],Margin[2],encoding);
return output;

View File

@ -136,6 +136,9 @@ wxString PrettyFloat(wxString src) {
return src;
}
wxString PrettyFloatF(float src) { return PrettyFloat(wxString::Format(_T("%f"),src)); }
wxString PrettyFloatD(double src) { return PrettyFloat(wxString::Format(_T("%f"),src)); }
///////////////////
// Float to string

View File

@ -48,6 +48,8 @@ bool Backup(wxString src,wxString dst);
wxString MakeRelativePath(wxString path,wxString reference);
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 PrettySize(int bytes);