projects
/
synfig.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use <= when comparing distances to give priority to the uppermost duck in the event...
[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
ea59b8e
..
f9fae68
100644
(file)
--- a/
synfig-core/trunk/src/synfig/time.cpp
+++ b/
synfig-core/trunk/src/synfig/time.cpp
@@
-7,6
+7,8
@@
** \legal
** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
** Copyright (c) 2007, 2008 Chris Moore
** \legal
** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
** 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
@@
-37,6
+39,7
@@
#include <cmath>
#include <cassert>
#include <algorithm>
#include <cmath>
#include <cassert>
#include <algorithm>
+#include <cstdio>
#include <ctype.h>
#include <math.h>
#include <ctype.h>
#include <math.h>
@@
-182,11
+185,12
@@
Time::get_string(float fps, Time::Format format)const
if(ceil(time.value_)-time.value_<epsilon_())
time.value_=ceil(time.value_);
if(ceil(time.value_)-time.value_<epsilon_())
time.value_=ceil(time.value_);
- int hour,minute;
-
- hour=time/3600;time-=hour*3600;
- minute=time/60;time-=minute*60;
-
+ int hour = 0, minute = 0;
+ 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,6
+208,14
@@
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;
String ret;
bool started = false;
@@
-238,7
+250,7
@@
Time::get_string(float fps, Time::Format format)const
started = true;
}
started = true;
}
- if(format<=FORMAT_FULL ||
frame
|| !started)
+ if(format<=FORMAT_FULL ||
abs(frame) > epsilon_()
|| !started)
{
if (!(format<=FORMAT_NOSPACES) && started)
ret += " ";
{
if (!(format<=FORMAT_NOSPACES) && started)
ret += " ";