Can draw xpm pixmaps with spaces in the color names (such as the ones in

/usr/X11/include/X11/icons).
Esc closes the modal window, not the window the cursor is in, if a modal
window is up.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@632 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Bill Spitzak
1999-07-27 17:24:14 +00:00
parent df045b0e36
commit f7e0e7627f
3 changed files with 14 additions and 15 deletions
+4 -3
View File
@@ -1,5 +1,5 @@
// //
// "$Id: Fl.cxx,v 1.24.2.10 1999/07/22 21:37:03 bill Exp $" // "$Id: Fl.cxx,v 1.24.2.11 1999/07/27 17:24:13 bill Exp $"
// //
// Main event handling code for the Fast Light Tool Kit (FLTK). // Main event handling code for the Fast Light Tool Kit (FLTK).
// //
@@ -508,7 +508,8 @@ int Fl::handle(int event, Fl_Window* window)
// make Escape key close windows: // make Escape key close windows:
if (event_key()==FL_Escape) { if (event_key()==FL_Escape) {
window->do_callback(); w = modal(); if (!w) w = window;
w->do_callback();
return 1; return 1;
} }
@@ -694,5 +695,5 @@ int fl_old_shortcut(const char* s) {
} }
// //
// End of "$Id: Fl.cxx,v 1.24.2.10 1999/07/22 21:37:03 bill Exp $". // End of "$Id: Fl.cxx,v 1.24.2.11 1999/07/27 17:24:13 bill Exp $".
// //
+4 -7
View File
@@ -1,5 +1,5 @@
// //
// "$Id: fl_draw_pixmap.cxx,v 1.4 1999/01/07 19:17:38 mike Exp $" // "$Id: fl_draw_pixmap.cxx,v 1.4.2.1 1999/07/27 17:24:13 bill Exp $"
// //
// Pixmap drawing code for the Fast Light Tool Kit (FLTK). // Pixmap drawing code for the Fast Light Tool Kit (FLTK).
// //
@@ -181,9 +181,6 @@ int fl_draw_pixmap(/*const*/char*const* data, int x, int y, Fl_Color bg) {
previous_word = p; previous_word = p;
while (*p && !isspace(*p)) p++; while (*p && !isspace(*p)) p++;
} }
// copy the color name and look it up:
char name[256];
char *q; for (q = name; *p && !isspace(*p); *q++ = *p++); *q++ = 0;
uchar *c = (uchar *)&d.colors[index&255]; uchar *c = (uchar *)&d.colors[index&255];
#ifdef U64 #ifdef U64
*(U64*)c = 0; *(U64*)c = 0;
@@ -192,10 +189,10 @@ int fl_draw_pixmap(/*const*/char*const* data, int x, int y, Fl_Color bg) {
#endif #endif
#endif #endif
#ifdef WIN32 #ifdef WIN32
if (fl_parse_color(name, c[0], c[1], c[2])) {; if (fl_parse_color(p, c[0], c[1], c[2])) {;
#else #else
XColor x; XColor x;
if (XParseColor(fl_display, fl_colormap, name, &x)) { if (XParseColor(fl_display, fl_colormap, p, &x)) {
c[0] = x.red>>8; c[1] = x.green>>8; c[2] = x.blue>>8; c[0] = x.red>>8; c[1] = x.green>>8; c[2] = x.blue>>8;
#endif #endif
} else { // assumme "None" or "#transparent" for any errors } else { // assumme "None" or "#transparent" for any errors
@@ -244,5 +241,5 @@ int fl_draw_pixmap(/*const*/char*const* data, int x, int y, Fl_Color bg) {
} }
// //
// End of "$Id: fl_draw_pixmap.cxx,v 1.4 1999/01/07 19:17:38 mike Exp $". // End of "$Id: fl_draw_pixmap.cxx,v 1.4.2.1 1999/07/27 17:24:13 bill Exp $".
// //
+6 -5
View File
@@ -1,5 +1,5 @@
// //
// "$Id: pixmap_browser.cxx,v 1.5 1999/01/07 19:18:00 mike Exp $" // "$Id: pixmap_browser.cxx,v 1.5.2.1 1999/07/27 17:24:14 bill Exp $"
// //
// Another pixmap test program for the Fast Light Tool Kit (FLTK). // Another pixmap test program for the Fast Light Tool Kit (FLTK).
// //
@@ -61,16 +61,17 @@ int load_file(const char *name) {
if (data) { if (data) {
for (int i=numlines; i--;) delete[] data[i]; for (int i=numlines; i--;) delete[] data[i];
} }
char buffer[1024]; #define BUFSIZE 2048
char buffer[BUFSIZE];
int i = 0; int i = 0;
while (fgets(buffer,1024,f)) { while (fgets(buffer, BUFSIZE, f)) {
if (buffer[0] != '\"') continue; if (buffer[0] != '\"') continue;
char *p = buffer; char *p = buffer;
char *q = buffer+1; char *q = buffer+1;
while (*q != '\"') { while (*q != '\"') {
if (*q == '\\') switch (*++q) { if (*q == '\\') switch (*++q) {
case '\n': case '\n':
fgets(q,(buffer+1024)-q,f); break; fgets(q,(buffer+BUFSIZE)-q,f); break;
case 0: case 0:
break; break;
case 'x': { case 'x': {
@@ -164,5 +165,5 @@ int main(int argc, char **argv) {
} }
// //
// End of "$Id: pixmap_browser.cxx,v 1.5 1999/01/07 19:18:00 mike Exp $". // End of "$Id: pixmap_browser.cxx,v 1.5.2.1 1999/07/27 17:24:14 bill Exp $".
// //