From: dooglus Date: Thu, 7 Feb 2008 11:45:52 +0000 (+0000) Subject: My recent fix for trailing spaces left out spaces when the fps is zero. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=41c73ed08565103a6004b768d9c198453d98cb62;p=synfig.git My recent fix for trailing spaces left out spaces when the fps is zero. git-svn-id: http://svn.voria.com/code@1617 1f10aa63-cdf2-0310-b900-c93c546f37ac --- diff --git a/synfig-core/trunk/src/synfig/time.cpp b/synfig-core/trunk/src/synfig/time.cpp index eb4dd50..e625278 100644 --- a/synfig-core/trunk/src/synfig/time.cpp +++ b/synfig-core/trunk/src/synfig/time.cpp @@ -215,7 +215,10 @@ Time::get_string(float fps, Time::Format format)const if(format<=FORMAT_FULL || minute) { - ret+=strprintf(format<=FORMAT_NOSPACES||!started?"%dm":" %dm",minute); + if (!(format<=FORMAT_NOSPACES) && started) + ret += " "; + + ret += strprintf("%dm", minute); started = true; } @@ -225,18 +228,25 @@ Time::get_string(float fps, Time::Format format)const float frame; second=time;time-=second; frame=time*fps; + if(format<=FORMAT_FULL || second) { - ret+=strprintf(format<=FORMAT_NOSPACES||!started?"%ds":" %ds",(int)second); + if (!(format<=FORMAT_NOSPACES) && started) + ret += " "; + + ret += strprintf("%ds", (int)second); started = true; } if(format<=FORMAT_FULL || frame || !started) { - if(abs(frame-floor(frame)>=epsilon_())) - ret+=strprintf(format<=FORMAT_NOSPACES||!started?"%0.3ff":" %0.3ff",frame); + if (!(format<=FORMAT_NOSPACES) && started) + ret += " "; + + if(abs(frame-floor(frame) >= epsilon_())) + ret += strprintf("%0.3ff", frame); else - ret+=strprintf(format<=FORMAT_NOSPACES||!started?"%0.0ff":" %0.0ff",frame); + ret += strprintf("%0.0ff", frame); } } else @@ -245,6 +255,9 @@ Time::get_string(float fps, Time::Format format)const second=time; if(format<=FORMAT_FULL || second || !started) { + if (!(format<=FORMAT_NOSPACES) && started) + ret += " "; + if(abs(second-floor(second))>=epsilon_()) { String seconds(strprintf("%0.8f",second));