diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_File_Icon2.cxx | 6 | ||||
| -rw-r--r-- | src/Fl_Input.cxx | 11 | ||||
| -rw-r--r-- | src/Fl_Input_.cxx | 22 | ||||
| -rw-r--r-- | src/fl_ask.cxx | 60 |
4 files changed, 68 insertions, 31 deletions
diff --git a/src/Fl_File_Icon2.cxx b/src/Fl_File_Icon2.cxx index 1c916d2c5..7173ec1b5 100644 --- a/src/Fl_File_Icon2.cxx +++ b/src/Fl_File_Icon2.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_File_Icon2.cxx,v 1.1.2.2 2001/11/17 15:59:53 easysw Exp $" +// "$Id: Fl_File_Icon2.cxx,v 1.1.2.3 2001/11/17 16:37:48 easysw Exp $" // // Fl_File_Icon system icon routines. // @@ -435,7 +435,7 @@ Fl_File_Icon::load_png(const char *png) // I - File to read from case 3 : temp = fl_rgb_color(row[0], row[1], row[2]); break; - case 4 : + default : if (row[3] > 127) temp = fl_rgb_color(row[0], row[1], row[2]); else @@ -1020,5 +1020,5 @@ get_kde_val(char *str, // -// End of "$Id: Fl_File_Icon2.cxx,v 1.1.2.2 2001/11/17 15:59:53 easysw Exp $". +// End of "$Id: Fl_File_Icon2.cxx,v 1.1.2.3 2001/11/17 16:37:48 easysw Exp $". // diff --git a/src/Fl_Input.cxx b/src/Fl_Input.cxx index 5cc43f5e3..35817f5ff 100644 --- a/src/Fl_Input.cxx +++ b/src/Fl_Input.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Input.cxx,v 1.10.2.15.2.2 2001/09/29 22:59:45 easysw Exp $" +// "$Id: Fl_Input.cxx,v 1.10.2.15.2.3 2001/11/17 16:37:48 easysw Exp $" // // Input widget for the Fast Light Tool Kit (FLTK). // @@ -251,13 +251,6 @@ int Fl_Input::handle(int event) { if (Fl::focus() != this) { Fl::focus(this); handle(FL_FOCUS); -#if 0 // Misguided attempt to simulate Windoze select-all-on-first-click - // that it does for *some* (but not all) text fields: - if (type() != FL_MULTILINE_INPUT) { - position(size(), 0); // select everything - return 1; - } -#endif } break; @@ -283,5 +276,5 @@ Fl_Input::Fl_Input(int x, int y, int w, int h, const char *l) } // -// End of "$Id: Fl_Input.cxx,v 1.10.2.15.2.2 2001/09/29 22:59:45 easysw Exp $". +// End of "$Id: Fl_Input.cxx,v 1.10.2.15.2.3 2001/11/17 16:37:48 easysw Exp $". // diff --git a/src/Fl_Input_.cxx b/src/Fl_Input_.cxx index 25ba45a18..48c4c17e5 100644 --- a/src/Fl_Input_.cxx +++ b/src/Fl_Input_.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Input_.cxx,v 1.21.2.11.2.2 2001/10/29 03:44:32 easysw Exp $" +// "$Id: Fl_Input_.cxx,v 1.21.2.11.2.3 2001/11/17 16:37:48 easysw Exp $" // // Common input widget routines for the Fast Light Tool Kit (FLTK). // @@ -31,6 +31,7 @@ #include <FL/Fl.H> #include <FL/Fl_Input_.H> #include <FL/fl_draw.H> +#include <FL/fl_ask.H> #include <math.h> #include <string.h> #include <stdlib.h> @@ -713,6 +714,23 @@ int Fl_Input_::handletext(int event, int X, int Y, int W, int H) { const char* t = Fl::event_text(); const char* e = t+Fl::event_length(); if (type() != FL_MULTILINE_INPUT) while (e > t && isspace(*(e-1))) e--; + if (type() == FL_INT_INPUT) { + const char *p = t; + while ((isdigit(*p) || *p == '+' || *p == '-') && p < e) + p ++; + if (p < e) { + fl_beep(FL_BEEP_ERROR); + return 1; + } + } else if (type() == FL_FLOAT_INPUT) { + const char *p = t; + while ((isdigit(*p) || *p == '+' || *p == '-' || *p == '.') && p < e) + p ++; + if (p < e) { + fl_beep(FL_BEEP_ERROR); + return 1; + } + } return replace(position(), mark(), t, e-t);} default: @@ -821,5 +839,5 @@ Fl_Input_::~Fl_Input_() { } // -// End of "$Id: Fl_Input_.cxx,v 1.21.2.11.2.2 2001/10/29 03:44:32 easysw Exp $". +// End of "$Id: Fl_Input_.cxx,v 1.21.2.11.2.3 2001/11/17 16:37:48 easysw Exp $". // diff --git a/src/fl_ask.cxx b/src/fl_ask.cxx index 0676fec62..f08014a07 100644 --- a/src/fl_ask.cxx +++ b/src/fl_ask.cxx @@ -1,5 +1,5 @@ // -// "$Id: fl_ask.cxx,v 1.8.2.8 2001/01/22 15:13:40 easysw Exp $" +// "$Id: fl_ask.cxx,v 1.8.2.8.2.1 2001/11/17 16:37:48 easysw Exp $" // // Standard dialog functions for the Fast Light Tool Kit (FLTK). // @@ -134,13 +134,44 @@ const char* fl_ok = "OK"; const char* fl_cancel= "Cancel"; // fltk functions: +void fl_beep(int type) { +#ifdef WIN32 + switch (type) { + case FL_BEEP_QUESTION : + case FL_BEEP_PASSWORD : + MessageBeep(MD_ICONQUESTION); + break; + case FL_BEEP_MESSAGE : + MessageBeep(MD_ICONASTERISK); + break; + case FL_BEEP_NOTIFICATION : + MessageBeep(MD_ICONASTERISK); + break; + default : + MessageBeep(MD_ICONERROR); + break; + } +#else + switch (type) { + case FL_BEEP_DEFAULT : + case FL_BEEP_ERROR : + if (!fl_display) fl_open_display(); + + XBell(fl_display, 100); + break; + default : + if (!fl_display) fl_open_display(); + + XBell(fl_display, 50); + break; + } +#endif // WIN32 +} void fl_message(const char *fmt, ...) { va_list ap; -#ifdef WIN32 - MessageBeep(MB_ICONASTERISK); -#endif // WIN32 + fl_beep(FL_BEEP_MESSAGE); va_start(ap, fmt); iconlabel = "i"; @@ -152,12 +183,7 @@ void fl_message(const char *fmt, ...) { void fl_alert(const char *fmt, ...) { va_list ap; -#ifdef WIN32 - MessageBeep(MB_ICONERROR); -#else - if (!fl_display) fl_open_display(); - XBell(fl_display, 100); -#endif // WIN32 + fl_beep(FL_BEEP_ERROR); va_start(ap, fmt); iconlabel = "!"; @@ -169,9 +195,7 @@ void fl_alert(const char *fmt, ...) { int fl_ask(const char *fmt, ...) { va_list ap; -#ifdef WIN32 - MessageBeep(MB_ICONQUESTION); -#endif // WIN32 + fl_beep(FL_BEEP_QUESTION); va_start(ap, fmt); int r = innards(fmt, ap, fl_no, fl_yes, 0); @@ -183,9 +207,7 @@ int fl_ask(const char *fmt, ...) { int fl_choice(const char*fmt,const char *b0,const char *b1,const char *b2,...){ va_list ap; -#ifdef WIN32 - MessageBeep(MB_ICONQUESTION); -#endif // WIN32 + fl_beep(FL_BEEP_QUESTION); va_start(ap, b2); int r = innards(fmt, ap, b0, b1, b2); @@ -214,6 +236,8 @@ static const char* input_innards(const char* fmt, va_list ap, } const char* fl_input(const char *fmt, const char *defstr, ...) { + fl_beep(FL_BEEP_QUESTION); + va_list ap; va_start(ap, defstr); const char* r = input_innards(fmt, ap, defstr, FL_NORMAL_INPUT); @@ -222,6 +246,8 @@ const char* fl_input(const char *fmt, const char *defstr, ...) { } const char *fl_password(const char *fmt, const char *defstr, ...) { + fl_beep(FL_BEEP_PASSWORD); + va_list ap; va_start(ap, defstr); const char* r = input_innards(fmt, ap, defstr, FL_SECRET_INPUT); @@ -230,5 +256,5 @@ const char *fl_password(const char *fmt, const char *defstr, ...) { } // -// End of "$Id: fl_ask.cxx,v 1.8.2.8 2001/01/22 15:13:40 easysw Exp $". +// End of "$Id: fl_ask.cxx,v 1.8.2.8.2.1 2001/11/17 16:37:48 easysw Exp $". // |
