projects
/
synfig.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Update SVN_REPOSITORY variable to the new svn in sourceforge
[synfig.git]
/
synfig-core
/
trunk
/
src
/
synfig
/
time.cpp
diff --git
a/synfig-core/trunk/src/synfig/time.cpp
b/synfig-core/trunk/src/synfig/time.cpp
index
6755b80
..
c639775
100644
(file)
--- a/
synfig-core/trunk/src/synfig/time.cpp
+++ b/
synfig-core/trunk/src/synfig/time.cpp
@@
-6,7
+6,9
@@
**
** \legal
** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
**
** \legal
** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
-** Copyright (c) 2007 Chris Moore
+** Copyright (c) 2007, 2008 Chris Moore
+** Copyright (c) 2008 Gerco Ballintijn
+** Copyright (c) 2008 Carlos López
**
** This package is free software; you can redistribute it and/or
** modify it under the terms of the GNU General Public License as
**
** This package is free software; you can redistribute it and/or
** modify it under the terms of the GNU General Public License as
@@
-183,10
+185,11
@@
Time::get_string(float fps, Time::Format format)const
time.value_=ceil(time.value_);
int hour,minute;
time.value_=ceil(time.value_);
int hour,minute;
-
- hour=time/3600;time-=hour*3600;
- minute=time/60;time-=minute*60;
-
+ if(!(format<=FORMAT_FRAMES))
+ {
+ hour=time/3600;time-=hour*3600;
+ minute=time/60;time-=minute*60;
+ }
// <= is redefined, so this means "is the FORMAT_VIDEO bit set in the format?"
if(format<=FORMAT_VIDEO)
{
// <= is redefined, so this means "is the FORMAT_VIDEO bit set in the format?"
if(format<=FORMAT_VIDEO)
{
@@
-204,18
+207,29
@@
Time::get_string(float fps, Time::Format format)const
return strprintf("%02d:%02d:%02d",hour,minute,second);
}
return strprintf("%02d:%02d:%02d",hour,minute,second);
}
+ if (format <= FORMAT_FRAMES)
+ {
+ if (fps && fps>0)
+ return strprintf("%df", round_to_int(time * fps));
+ else
+ return strprintf("%ds", round_to_int(time * 1));
+ }
+
String ret;
bool started = false;
if(format<=FORMAT_FULL || hour)
{
String ret;
bool started = false;
if(format<=FORMAT_FULL || hour)
{
- ret+=strprintf(
format<=FORMAT_NOSPACES?"%dh":"%dh
",hour);
+ ret+=strprintf(
"%dh
",hour);
started = true;
}
if(format<=FORMAT_FULL || minute)
{
started = true;
}
if(format<=FORMAT_FULL || minute)
{
- ret+=strprintf(format<=FORMAT_NOSPACES?"%dm":"%dm ",minute);
+ if (!(format<=FORMAT_NOSPACES) && started)
+ ret += " ";
+
+ ret += strprintf("%dm", minute);
started = true;
}
started = true;
}
@@
-225,18
+239,25
@@
Time::get_string(float fps, Time::Format format)const
float frame;
second=time;time-=second;
frame=time*fps;
float frame;
second=time;time-=second;
frame=time*fps;
+
if(format<=FORMAT_FULL || second)
{
if(format<=FORMAT_FULL || second)
{
- ret+=strprintf(format<=FORMAT_NOSPACES?"%ds":"%ds ",(int)second);
+ if (!(format<=FORMAT_NOSPACES) && started)
+ ret += " ";
+
+ ret += strprintf("%ds", (int)second);
started = true;
}
started = true;
}
- if(format<=FORMAT_FULL ||
frame
|| !started)
+ if(format<=FORMAT_FULL ||
abs(frame) > epsilon_()
|| !started)
{
{
- if(abs(frame-floor(frame)>=epsilon_()))
- ret+=strprintf("%0.3ff",frame);
+ if (!(format<=FORMAT_NOSPACES) && started)
+ ret += " ";
+
+ if(abs(frame-floor(frame) >= epsilon_()))
+ ret += strprintf("%0.3ff", frame);
else
else
- ret
+=strprintf("%0.0ff",
frame);
+ ret
+= strprintf("%0.0ff",
frame);
}
}
else
}
}
else
@@
-245,6
+266,9
@@
Time::get_string(float fps, Time::Format format)const
second=time;
if(format<=FORMAT_FULL || second || !started)
{
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));
if(abs(second-floor(second))>=epsilon_())
{
String seconds(strprintf("%0.8f",second));