projects
/
goodguy
/
history.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
vicon drag tweaks, proxy drag fix, vicon mouseover, binfolder around sort fix, draw_r...
[goodguy/history.git]
/
cinelerra-5.1
/
guicast
/
bcpot.C
diff --git
a/cinelerra-5.1/guicast/bcpot.C
b/cinelerra-5.1/guicast/bcpot.C
index 7417e79ed6a780a221aedc28058022eed0e7d15e..60807911b501ed6e628f6d3bb8a2046e40db43a6 100644
(file)
--- a/
cinelerra-5.1/guicast/bcpot.C
+++ b/
cinelerra-5.1/guicast/bcpot.C
@@
-21,7
+21,7
@@
#include "bcpot.h"
#include "bcresources.h"
#include "bcpot.h"
#include "bcresources.h"
-#include "colors.h"
+#include "
bc
colors.h"
#include "keys.h"
#include "units.h"
#include "vframe.h"
#include "keys.h"
#include "units.h"
#include "vframe.h"
@@
-460,7
+460,8
@@
const char* BC_FPot::get_caption()
float BC_FPot::get_percentage()
{
float BC_FPot::get_percentage()
{
- return (value - minvalue) / (maxvalue - minvalue);
+ float range = maxvalue - minvalue;
+ return range > 0 ? (value - minvalue) / range : minvalue;
}
int BC_FPot::percentage_to_value(float percentage)
}
int BC_FPot::percentage_to_value(float percentage)
@@
-549,7
+550,8
@@
const char* BC_IPot::get_caption()
float BC_IPot::get_percentage()
{
float BC_IPot::get_percentage()
{
- return ((float)value - minvalue) / (maxvalue - minvalue);
+ float range = maxvalue - minvalue;
+ return range > 0 ? ((float)value - minvalue) / range : minvalue;
}
int BC_IPot::percentage_to_value(float percentage)
}
int BC_IPot::percentage_to_value(float percentage)
@@
-633,7
+635,8
@@
const char* BC_QPot::get_caption()
float BC_QPot::get_percentage()
{
float BC_QPot::get_percentage()
{
- return ((float)value - minvalue) / (maxvalue - minvalue);
+ float range = maxvalue - minvalue;
+ return range > 0 ? ((float)value - minvalue) / range : 0;
}
int BC_QPot::percentage_to_value(float percentage)
}
int BC_QPot::percentage_to_value(float percentage)
@@
-709,7
+712,8
@@
const char* BC_PercentagePot::get_caption()
float BC_PercentagePot::get_percentage()
{
float BC_PercentagePot::get_percentage()
{
- return (value - minvalue) / (maxvalue - minvalue);
+ float range = maxvalue - minvalue;
+ return range > 0 ? (value - minvalue) / range : minvalue;
}
int BC_PercentagePot::percentage_to_value(float percentage)
}
int BC_PercentagePot::percentage_to_value(float percentage)