]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/input_validators.C
Bugfixes: checkboxes to radiobuttons (from J�rgen S) and remove a little
[lyx.git] / src / frontends / xforms / input_validators.C
index 0f45f8a3a8ba0b779a73b33779a6574412fe5707..cc237bf3de7e312d5ae97f86a7538f3cb579f439 100644 (file)
@@ -1,4 +1,3 @@
-// -*- C++ -*-
 /* input_validators.C
  * A collection of input filtering and validating functions for use in
  * XForms dialogs.  Mainly meant for filtering input boxes although may
@@ -15,10 +14,20 @@ extern "C"
 {
 #endif
 
+int fl_int_filter(FL_OBJECT * ob,
+                 char const *, char const *, int c)
+{
+       if (c == 0 /* final test before handing contents to app */
+           || strchr("0123456789+-", c)) {
+               if (isStrInt(fl_get_input(ob)))
+                       return FL_VALID;
+       }
+       return FL_INVALID|FL_RINGBELL;
+}
+
+
 int fl_unsigned_int_filter(FL_OBJECT * /*ob*/,
-                          char const * /*not_used*/,
-                          char const * /*unused*/,
-                          int c)
+                          char const *, char const *, int c)
 {
        if (c == 0 /* final test before handing contents to app */
            || strchr("0123456789", c)) {
@@ -29,6 +38,18 @@ int fl_unsigned_int_filter(FL_OBJECT * /*ob*/,
 }
 
 
+int fl_float_filter(FL_OBJECT * ob,
+                   char const *, char const *, int c)
+{
+       if (c == 0 /* final test before handing contents to app */
+           || strchr("0123456789.+-", c)) {
+               if (isStrDbl(fl_get_input(ob)))
+                       return FL_VALID;
+       }
+       return FL_INVALID|FL_RINGBELL;
+}
+
+
 int fl_unsigned_float_filter(FL_OBJECT * ob,
                             char const * /*not_used*/,
                             char const * /*unused*/,
@@ -38,8 +59,6 @@ int fl_unsigned_float_filter(FL_OBJECT * ob,
            || strchr("0123456789.", c)) {
                if (isStrDbl(fl_get_input(ob)))
                        return FL_VALID;
-               else
-                       return FL_INVALID|FL_RINGBELL;
        }
        return FL_INVALID|FL_RINGBELL;
 }
@@ -100,7 +119,7 @@ void fl_print_range_filter(FL_OBJECT * ob,
                piece = strip(piece) ;
                piece = frontStrip(piece) ;
                if (!stringOnlyContains (piece, "0123456789-")) {
-                       WriteAlert(_("ERROR!  Unable to print!"),
+                       Alert::alert(_("ERROR!  Unable to print!"),
                                   _("Check 'range of pages'!"));
                        return;
                }