From ccdd960982e40a6927c1d988d19edfcb025f248e Mon Sep 17 00:00:00 2001 From: Rodrigo Braz Monteiro Date: Sat, 10 Feb 2007 23:56:10 +0000 Subject: [PATCH] Fixed writing of styles Originally committed to SVN as r935. --- aegisub/ass_style.cpp | 14 +++++++------- aegisub/utils.cpp | 3 +++ aegisub/utils.h | 2 ++ 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/aegisub/ass_style.cpp b/aegisub/ass_style.cpp index 0a45b3dc7..118132dbb 100644 --- a/aegisub/ass_style.cpp +++ b/aegisub/ass_style.cpp @@ -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; diff --git a/aegisub/utils.cpp b/aegisub/utils.cpp index a6786e83b..9cacd87c6 100644 --- a/aegisub/utils.cpp +++ b/aegisub/utils.cpp @@ -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 diff --git a/aegisub/utils.h b/aegisub/utils.h index 2150c45d0..799c5bc13 100644 --- a/aegisub/utils.h +++ b/aegisub/utils.h @@ -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);