diff options
Diffstat (limited to 'src/flcurve.cxx')
| -rw-r--r-- | src/flcurve.cxx | 89 |
1 files changed, 0 insertions, 89 deletions
diff --git a/src/flcurve.cxx b/src/flcurve.cxx deleted file mode 100644 index 94908bc..0000000 --- a/src/flcurve.cxx +++ /dev/null @@ -1,89 +0,0 @@ -// -// Copyright 2008 Johannes Hofmann <Johannes.Hofmann@gmx.de> -// -// This software may be used and distributed according to the terms -// of the GNU General Public License, incorporated herein by reference. - -#include <string.h> -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> - -#include <FL/Fl.H> -#include <FL/Fl_Window.H> -#include <FL/fl_draw.H> - -#include <../config.h> - -#include "CurveEditor.H" - -static void -parse_curve(CurveEditor *ce, const char *ctrl_points); - -void -usage() { - fprintf(stderr, - "flcurve %s\n" - VERSION); -} - -int -main(int argc, char **argv) { - int c, n, i, err; - char *curve = NULL; - - while ((c = getopt(argc, argv, "?hs:g:d:f:i:C:")) != EOF) { - switch (c) { - case '?': - case 'h': - usage(); - exit(0); - case 'C': - curve = optarg; - break; - default: - i = optind - 1; - n = Fl::arg(argc, argv, i); - if (n == 0) { - err++; - } else { - optind = i; - } - break; - } - } - - Fl_Window window(800, 800); - CurveEditor ce(10, 10, 780, 780); - window.end(); - window.resizable(ce); - - if (curve) { - parse_curve(&ce, curve); - } - - window.show(1, argv); - - return Fl::run(); -} - -static void -parse_curve(CurveEditor *ce, const char *ctrl_points) { - char *pstr, *buf = strdup(ctrl_points); - int i, n = 0; - double X, Y; - - while (pstr = strsep(&buf, ";")) { - if (sscanf(pstr, "%lf,%lf", &X, &Y) != 2 || - X < 0.0 || X > 1.0 || Y < 0.0 || Y > 1.0) { - fprintf(stderr, "Could not parse control point %s.\n", pstr); - continue; - } - - ce->add_point(X, Y); - } - - free(buf); - - ce->init(); -} |
