summaryrefslogtreecommitdiff
path: root/src/CurveEditor.cxx
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2008-09-09 18:55:37 +0200
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2008-09-09 18:55:37 +0200
commitf285f18f29335bd8f604a875cd4e091bde4bb6e8 (patch)
tree120b5241136830e7dbdb58989e61e853fead2ef8 /src/CurveEditor.cxx
parent3896ace46c70522300356c4ed8d45787b4ef10d4 (diff)
check for more than 3 control points
Diffstat (limited to 'src/CurveEditor.cxx')
-rw-r--r--src/CurveEditor.cxx10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/CurveEditor.cxx b/src/CurveEditor.cxx
index a9bb7a5..b095d3d 100644
--- a/src/CurveEditor.cxx
+++ b/src/CurveEditor.cxx
@@ -24,6 +24,9 @@ CurveEditor::CurveEditor(int my_x, int my_y, int my_w, int my_h) :
n = 0;
acc = gsl_interp_accel_alloc();
spline = NULL;
+ add_point(0.0, 0.0);
+ add_point(0.5, 0.5);
+ add_point(1.0, 1.0);
}
void
@@ -83,8 +86,9 @@ CurveEditor::handle(int event) {
case FL_DRAG:
if (marked_point < 0)
return 1;
- if (marked_point > 0 && mark_x <= X[marked_point - 1] ||
- marked_point < n - 1 && mark_x >= X[marked_point + 1]) {
+ if (n >= 3 &&
+ (marked_point > 0 && mark_x <= X[marked_point - 1] ||
+ marked_point < n - 1 && mark_x >= X[marked_point + 1])) {
remove_point(marked_point);
marked_point = -1;
if (cb)
@@ -94,7 +98,7 @@ CurveEditor::handle(int event) {
return 1;
case FL_RELEASE:
if (marked_point >= 0) {
- if (cb)
+ if (n >= 3 && cb)
cb(this, cb_data);
marked_point = -1;
}