summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>2001-11-25 16:38:11 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>2001-11-25 16:38:11 +0000
commitc147aca0541e9f45b1bd9c8eed4ec71cb1c650ec (patch)
tree3593beb32b551396fa369ce98e737f019a9193a9 /src
parentf6d88d27359cc24329ba728d00ede8a363640006 (diff)
Add flstring.h header file to include string functions, strcasecmp
definitions, and (v)snprintf function declarations... Fix Fl_File_Chooser so it always checks for an empty directory_ (so that is doesn't add the leading slash to drive letters and mount points) Make Fl_File_Icon use Fl_Shared_Image, and look in all KDE icon directories. Fl::error() no longer exits by default; only Fl::fatal() does... Wasn't doing callbacks in Fl_Tabs when the current tab was changed via the keyboard. FLUID wasn't writing the tooltips in message files, and didn't count tooltips when computing the message number for catgets. Update dependencies. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1729 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/Fl_File_Browser.cxx13
-rw-r--r--src/Fl_File_Chooser2.cxx45
-rw-r--r--src/Fl_File_Icon2.cxx670
-rw-r--r--src/Fl_Help_View.cxx15
-rw-r--r--src/Fl_Image.cxx23
-rw-r--r--src/Fl_Tabs.cxx6
-rw-r--r--src/Fl_abort.cxx62
-rw-r--r--src/fl_ask.cxx13
-rw-r--r--src/flstring.h63
-rw-r--r--src/makedepend42
10 files changed, 471 insertions, 481 deletions
diff --git a/src/Fl_File_Browser.cxx b/src/Fl_File_Browser.cxx
index f7ada7dae..5c44ba31d 100644
--- a/src/Fl_File_Browser.cxx
+++ b/src/Fl_File_Browser.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_File_Browser.cxx,v 1.1.2.4 2001/11/03 05:11:34 easysw Exp $"
+// "$Id: Fl_File_Browser.cxx,v 1.1.2.5 2001/11/25 16:38:11 easysw Exp $"
//
// Fl_File_Browser routines.
//
@@ -42,8 +42,7 @@
#include <FL/filename.H>
#include <stdio.h>
#include <stdlib.h>
-#include <string.h>
-#include <config.h>
+#include "flstring.h"
#if defined(WIN32) && ! defined(__CYGWIN__)
# include <windows.h>
@@ -56,12 +55,6 @@
#include <os2.h>
#endif /* __EMX__ */
-#if !HAVE_SNPRINTF
-extern "C" {
-extern int snprintf(char* str, size_t size, const char* fmt, ...);
-}
-#endif // !HAVE_SNPRINTF
-
//
// FL_BLINE definition from "Fl_Browser.cxx"...
@@ -566,5 +559,5 @@ Fl_File_Browser::filter(const char *pattern) // I - Pattern string
//
-// End of "$Id: Fl_File_Browser.cxx,v 1.1.2.4 2001/11/03 05:11:34 easysw Exp $".
+// End of "$Id: Fl_File_Browser.cxx,v 1.1.2.5 2001/11/25 16:38:11 easysw Exp $".
//
diff --git a/src/Fl_File_Chooser2.cxx b/src/Fl_File_Chooser2.cxx
index 3276db08b..62af75003 100644
--- a/src/Fl_File_Chooser2.cxx
+++ b/src/Fl_File_Chooser2.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_File_Chooser2.cxx,v 1.1.2.3 2001/10/29 21:59:14 easysw Exp $"
+// "$Id: Fl_File_Chooser2.cxx,v 1.1.2.4 2001/11/25 16:38:11 easysw Exp $"
//
// More Fl_File_Chooser routines.
//
@@ -46,12 +46,11 @@
#include <stdio.h>
#include <stdlib.h>
+#include "flstring.h"
#include <ctype.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
-#include <string.h>
-#include <ctype.h>
#if defined(WIN32) && ! defined (__CYGWIN__)
# include <direct.h>
@@ -169,7 +168,7 @@ Fl_File_Chooser::count()
// Is the file name a directory?
if (directory_[0] != '\0')
- sprintf(pathname, "%s/%s", directory_, filename);
+ snprintf(pathname, sizeof(pathname), "%s/%s", directory_, filename);
else
{
strncpy(pathname, filename, sizeof(pathname) - 1);
@@ -188,7 +187,7 @@ Fl_File_Chooser::count()
// See if this file is a directory...
filename = (char *)fileList->text(i);
if (directory_[0] != '\0')
- sprintf(pathname, "%s/%s", directory_, filename);
+ snprintf(pathname, sizeof(pathname), "%s/%s", directory_, filename);
else
{
strncpy(pathname, filename, sizeof(pathname) - 1);
@@ -222,7 +221,13 @@ Fl_File_Chooser::value(int f) // I - File number
if (name[0] == '\0')
return (NULL);
- sprintf(pathname, "%s/%s", directory_, name);
+ if (directory_[0]) {
+ snprintf(pathname, sizeof(pathname), "%s/%s", directory_, name);
+ } else {
+ strncpy(pathname, name, sizeof(pathname) - 1);
+ pathname[sizeof(pathname) - 1] = '\0';
+ }
+
return ((const char *)pathname);
}
@@ -231,7 +236,13 @@ Fl_File_Chooser::value(int f) // I - File number
{
// See if this file is a directory...
name = fileList->text(i);
- sprintf(pathname, "%s/%s", directory_, name);
+
+ if (directory_[0]) {
+ snprintf(pathname, sizeof(pathname), "%s/%s", directory_, name);
+ } else {
+ strncpy(pathname, name, sizeof(pathname) - 1);
+ pathname[sizeof(pathname) - 1] = '\0';
+ }
if (!filename_isdir(pathname))
{
@@ -358,7 +369,7 @@ Fl_File_Chooser::newdir()
#else
if (dir[0] != '/' && dir[0] != '\\')
#endif /* WIN32 || __EMX__ */
- sprintf(pathname, "%s/%s", directory_, dir);
+ snprintf(pathname, sizeof(pathname), "%s/%s", directory_, dir);
else
{
strncpy(pathname, dir, sizeof(pathname) - 1);
@@ -414,7 +425,7 @@ Fl_File_Chooser::fileListCB()
filename = (char *)fileList->text(fileList->value());
if (directory_[0] != '\0')
- sprintf(pathname, "%s/%s", directory_, filename);
+ snprintf(pathname, sizeof(pathname), "%s/%s", directory_, filename);
else
{
strncpy(pathname, filename, sizeof(pathname) - 1);
@@ -485,7 +496,7 @@ Fl_File_Chooser::fileNameCB()
filename[0] != '/' &&
filename[0] != '\\' &&
!(isalpha(filename[0]) && filename[1] == ':'))
- sprintf(pathname, "%s/%s", directory_, filename);
+ snprintf(pathname, sizeof(pathname), "%s/%s", directory_, filename);
else
{
strncpy(pathname, filename, sizeof(pathname) - 1);
@@ -520,13 +531,13 @@ Fl_File_Chooser::fileNameCB()
strncat(pathname, "/", sizeof(pathname) - 1);
}
else
- sprintf(pathname, "%s/%s", directory_, filename);
+ snprintf(pathname, sizeof(pathname), "%s/%s", directory_, filename);
endpwent();
}
else if (directory_[0] != '\0' &&
filename[0] != '/')
- sprintf(pathname, "%s/%s", directory_, filename);
+ snprintf(pathname, sizeof(pathname), "%s/%s", directory_, filename);
else
{
strncpy(pathname, filename, sizeof(pathname) - 1);
@@ -675,7 +686,13 @@ Fl_File_Chooser::fileNameCB()
}
// See if we need to enable the OK button...
- sprintf(pathname, "%s/%s", directory_, fileName->value());
+ if (directory_[0]) {
+ snprintf(pathname, sizeof(pathname), "%s/%s", directory_,
+ fileName->value());
+ } else {
+ strncpy(pathname, fileName->value(), sizeof(pathname) - 1);
+ pathname[sizeof(pathname) - 1] = '\0';
+ }
if ((type_ & CREATE || access(pathname, 0) == 0) &&
(!filename_isdir(pathname) || type_ & DIRECTORY))
@@ -687,5 +704,5 @@ Fl_File_Chooser::fileNameCB()
//
-// End of "$Id: Fl_File_Chooser2.cxx,v 1.1.2.3 2001/10/29 21:59:14 easysw Exp $".
+// End of "$Id: Fl_File_Chooser2.cxx,v 1.1.2.4 2001/11/25 16:38:11 easysw Exp $".
//
diff --git a/src/Fl_File_Icon2.cxx b/src/Fl_File_Icon2.cxx
index 7173ec1b5..7252ce9e6 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.3 2001/11/17 16:37:48 easysw Exp $"
+// "$Id: Fl_File_Icon2.cxx,v 1.1.2.4 2001/11/25 16:38:11 easysw Exp $"
//
// Fl_File_Icon system icon routines.
//
@@ -27,8 +27,7 @@
// Contents:
//
// Fl_File_Icon::load_fti() - Load an SGI-format FTI file...
-// Fl_File_Icon::load_png() - Load a PNG icon file...
-// Fl_File_Icon::load_xpm() - Load an XPM icon file...
+// Fl_File_Icon::load_image() - Load an image icon file...
// Fl_File_Icon::load_system_icons() - Load the standard system icons/filetypes.
//
@@ -36,39 +35,26 @@
// Include necessary header files...
//
-#include <config.h>
#include <stdio.h>
#include <stdlib.h>
-#include <string.h>
-#ifdef HAVE_STRINGS_H
-# include <strings.h>
-#endif // HAVE_STRINGS_H
+#include "flstring.h"
#include <ctype.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
-#if (defined(WIN32) && ! defined(__CYGWIN__)) || defined(__EMX__)
+#if defined(WIN32) && ! defined(__CYGWIN__)
# include <io.h>
# define F_OK 0
-# define strcasecmp stricmp
-# define strncasecmp strnicmp
#else
# include <unistd.h>
-#endif /* WIN32 || __EMX__ */
+#endif // WIN32
#include <FL/Fl_File_Icon.H>
+#include <FL/Fl_Shared_Image.H>
#include <FL/Fl_Widget.H>
#include <FL/fl_draw.H>
#include <FL/filename.H>
-extern "C"
-{
-#ifdef HAVE_LIBPNG
-# include <zlib.h>
-# include <png.h>
-#endif // HAVE_LIBPNG
-}
-
//
// Define missing POSIX/XPG4 macros as needed...
@@ -100,24 +86,20 @@ static char *get_kde_val(char *str, const char *key);
void
Fl_File_Icon::load(const char *f) // I - File to read from
{
+ int i; // Load status...
const char *ext; // File extension
- if ((ext = filename_ext(f)) == NULL)
- {
- fprintf(stderr, "Fl_File_Icon::load(): Unknown file type for \"%s\".\n", f);
- return;
- }
+ ext = filename_ext(f);
- if (strcmp(ext, ".fti") == 0)
- load_fti(f);
- else if (strcmp(ext, ".xpm") == 0)
- load_xpm(f);
- else if (strcmp(ext, ".png") == 0)
- load_png(f);
+ if (ext && strcmp(ext, ".fti") == 0)
+ i = load_fti(f);
else
+ i = load_image(f);
+
+ if (i)
{
- fprintf(stderr, "Fl_File_Icon::load(): Unknown file type for \"%s\".\n", f);
+ Fl::warning("Fl_File_Icon::load(): Unable to load icon file \"%s\".", f);
return;
}
}
@@ -127,7 +109,7 @@ Fl_File_Icon::load(const char *f) // I - File to read from
// 'Fl_File_Icon::load_fti()' - Load an SGI-format FTI file...
//
-void
+int // O - 0 on success, non-zero on error
Fl_File_Icon::load_fti(const char *fti) // I - File to read from
{
FILE *fp; // File pointer
@@ -141,9 +123,9 @@ Fl_File_Icon::load_fti(const char *fti) // I - File to read from
// Try to open the file...
if ((fp = fopen(fti, "rb")) == NULL)
{
- fprintf(stderr, "Fl_File_Icon::load_fti(): Unable to open \"%s\" - %s\n",
- fti, strerror(errno));
- return;
+ Fl::error("Fl_File_Icon::load_fti(): Unable to open \"%s\" - %s",
+ fti, strerror(errno));
+ return -1;
}
// Read the entire file, adding data as needed...
@@ -171,8 +153,8 @@ Fl_File_Icon::load_fti(const char *fti) // I - File to read from
// OK, this character better be a letter...
if (!isalpha(ch))
{
- fprintf(stderr, "Fl_File_Icon::load_fti(): Expected a letter at file position %ld (saw '%c')\n",
- ftell(fp) - 1, ch);
+ Fl::error("Fl_File_Icon::load_fti(): Expected a letter at file position %ld (saw '%c')",
+ ftell(fp) - 1, ch);
break;
}
@@ -193,8 +175,8 @@ Fl_File_Icon::load_fti(const char *fti) // I - File to read from
// Make sure we stopped on a parenthesis...
if (ch != '(')
{
- fprintf(stderr, "Fl_File_Icon::load_fti(): Expected a ( at file position %ld (saw '%c')\n",
- ftell(fp) - 1, ch);
+ Fl::error("Fl_File_Icon::load_fti(): Expected a ( at file position %ld (saw '%c')",
+ ftell(fp) - 1, ch);
break;
}
@@ -214,16 +196,16 @@ Fl_File_Icon::load_fti(const char *fti) // I - File to read from
// Make sure we stopped on a parenthesis...
if (ch != ')')
{
- fprintf(stderr, "Fl_File_Icon::load_fti(): Expected a ) at file position %ld (saw '%c')\n",
- ftell(fp) - 1, ch);
+ Fl::error("Fl_File_Icon::load_fti(): Expected a ) at file position %ld (saw '%c')",
+ ftell(fp) - 1, ch);
break;
}
// Make sure the next character is a semicolon...
if ((ch = getc(fp)) != ';')
{
- fprintf(stderr, "Fl_File_Icon::load_fti(): Expected a ; at file position %ld (saw '%c')\n",
- ftell(fp) - 1, ch);
+ Fl::error("Fl_File_Icon::load_fti(): Expected a ; at file position %ld (saw '%c')",
+ ftell(fp) - 1, ch);
break;
}
@@ -321,8 +303,8 @@ Fl_File_Icon::load_fti(const char *fti) // I - File to read from
}
else
{
- fprintf(stderr, "Fl_File_Icon::load_fti(): Unknown command \"%s\" at file position %ld.\n",
- command, ftell(fp) - 1);
+ Fl::error("Fl_File_Icon::load_fti(): Unknown command \"%s\" at file position %ld.",
+ command, ftell(fp) - 1);
break;
}
}
@@ -335,363 +317,252 @@ Fl_File_Icon::load_fti(const char *fti) // I - File to read from
for (int i = 0; i < num_data_; i ++)
printf(" %d,\n", data_[i]);
#endif /* DEBUG */
+
+ return 0;
}
//
-// 'Fl_File_Icon::load_png()' - Load a PNG icon file...
+// 'Fl_File_Icon::load_image()' - Load an image icon file...
//
-void
-Fl_File_Icon::load_png(const char *png) // I - File to read from
+int // O - 0 on success, non-0 on error
+Fl_File_Icon::load_image(const char *ifile) // I - File to read from
{
-#ifdef HAVE_LIBPNG
- FILE *fp; // File pointer
- int i; // Looping vars
- int x, y; // X & Y in image
- int startx; // Starting X coord
- int width, height; // Width and height of image
- int depth; // Depth of image
- png_structp pp; // PNG read pointer
- png_infop info; // PNG info pointers
- png_bytep pixels, // Pixel buffer
- row, // Current row
- *rows; // PNG row pointers
- Fl_Color c, // Current color
- temp; // Temporary color
-
-
- // Try to open the file...
- if ((fp = fopen(png, "rb")) == NULL)
- return;
-
- // Setup the PNG data structures...
- pp = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
- info = png_create_info_struct(pp);
-
- // Initialize the PNG read "engine"...
- png_init_io(pp, fp);
-
- // Get the image dimensions and convert to grayscale or RGB...
- png_read_info(pp, info);
-
- if (info->color_type == PNG_COLOR_TYPE_PALETTE)
- png_set_expand(pp);
-
- if (info->bit_depth < 8)
- {
- png_set_packing(pp);
- png_set_expand(pp);
- }
- else if (info->bit_depth == 16)
- png_set_strip_16(pp);
-
- if (info->color_type & PNG_COLOR_MASK_COLOR)
- depth = 3;
- else
- depth = 1;
-
- if ((info->color_type & PNG_COLOR_MASK_ALPHA) || info->num_trans)
- depth ++;
+ Fl_Shared_Image *img; // Image file
-#if defined(HAVE_PNG_GET_VALID) && defined(HAVE_SET_TRNS_TO_ALPHA)
- // Handle transparency...
- if (png_get_valid(pp, info, PNG_INFO_tRNS))
- png_set_tRNS_to_alpha(pp);
-#endif // HAVE_PNG_GET_VALID && HAVE_SET_TRNS_TO_ALPHA
- width = (int)info->width;
- height = (int)info->height;
- pixels = (unsigned char *)malloc(width * height * depth);
+ img = Fl_Shared_Image::get(ifile);
+ if (!img->w() && !img->h()) return -1;
- // Allocate pointers...
- rows = (png_bytep *)calloc(height, sizeof(png_bytep));
+ if (img->count() == 1) {
+ int x, y; // X & Y in image
+ int startx; // Starting X coord
+ Fl_Color c, // Current color
+ temp; // Temporary color
+ const uchar *row; // Pointer into image
- for (i = 0; i < height; i ++)
- rows[i] = pixels + i * width * depth;
- // Read the image, handling interlacing as needed...
- for (i = png_set_interlace_handling(pp); i > 0; i --)
- png_read_rows(pp, rows, NULL, height);
-
- // Now loop through the image, adding strips as needed...
- for (y = height - 1; y >= 0; y --)
- {
- for (x = 0, startx = 0, row = rows[height - 1 - y], c = (Fl_Color)-1;
- x < width;
- x ++, row += depth)
+ // Loop through grayscale or RGB image...
+ for (y = 0, row = (const uchar *)(*(img->data())); y < img->h(); y ++, row += img->ld())
{
- switch (depth)
+ for (x = 0, startx = 0, c = (Fl_Color)-1;
+ x < img->w();
+ x ++, row += img->d())
{
- case 1 :
- temp = fl_rgb_color(row[0], row[0], row[0]);
- break;
- case 2 :
- if (row[1] > 127)
+ switch (img->d())
+ {
+ case 1 :
temp = fl_rgb_color(row[0], row[0], row[0]);
- else
- temp = (Fl_Color)-1;
- break;
- case 3 :
- temp = fl_rgb_color(row[0], row[1], row[2]);
- break;
- default :
- if (row[3] > 127)
+ break;
+ case 2 :
+ if (row[1] > 127)
+ temp = fl_rgb_color(row[0], row[0], row[0]);
+ else
+ temp = (Fl_Color)-1;
+ break;
+ case 3 :
temp = fl_rgb_color(row[0], row[1], row[2]);
- else
- temp = (Fl_Color)-1;
- break;
- }
+ break;
+ default :
+ if (row[3] > 127)
+ temp = fl_rgb_color(row[0], row[1], row[2]);
+ else
+ temp = (Fl_Color)-1;
+ break;
+ }
- if (temp != c)
- {
- if (x > startx && c != (Fl_Color)-1)
+ if (temp != c)
{
- add_color(c);
- add(POLYGON);
- add_vertex(startx * 9000 / width + 1000, y * 9000 / height + 500);
- add_vertex(x * 9000 / width + 1000, y * 9000 / height + 500);
- add_vertex(x * 9000 / width + 1000, (y + 1) * 9000 / height + 500);
- add_vertex(startx * 9000 / width + 1000, (y + 1) * 9000 / height + 500);
- add(END);
+ if (x > startx && c != (Fl_Color)-1)
+ {
+ add_color(c);
+ add(POLYGON);
+ add_vertex(startx * 9000 / img->w() + 1000, 9500 - y * 9000 / img->h());
+ add_vertex(x * 9000 / img->w() + 1000, 9500 - y * 9000 / img->h());
+ add_vertex(x * 9000 / img->w() + 1000, 9500 - (y + 1) * 9000 / img->h());
+ add_vertex(startx * 9000 / img->w() + 1000, 9500 - (y + 1) * 9000 / img->h());
+ add(END);
+ }
+
+ c = temp;
+ startx = x;
}
+ }
- c = temp;
- startx = x;
+ if (x > startx && c != (Fl_Color)-1)
+ {
+ add_color(c);
+ add(POLYGON);
+ add_vertex(startx * 9000 / img->w() + 1000, 9500 - y * 9000 / img->h());
+ add_vertex(x * 9000 / img->w() + 1000, 9500 - y * 9000 / img->h());
+ add_vertex(x * 9000 / img->w() + 1000, 9500 - (y + 1) * 9000 / img->h());
+ add_vertex(startx * 9000 / img->w() + 1000, 9500 - (y + 1) * 9000 / img->h());
+ add(END);
}
}
-
- if (x > startx && c != (Fl_Color)-1)
- {
- add_color(c);
- add(POLYGON);
- add_vertex(startx * 9000 / width + 1000, y * 9000 / height + 500);
- add_vertex(x * 9000 / width + 1000, y * 9000 / height + 500);
- add_vertex(x * 9000 / width + 1000, (y + 1) * 9000 / height + 500);
- add_vertex(startx * 9000 / width + 1000, (y + 1) * 9000 / height + 500);
- add(END);
+ } else {
+ int i, j; // Looping vars
+ int ch; // Current character
+ int bg; // Background color
+ char val[16]; // Color value
+ const char *lineptr, // Pointer into line
+ *const*ptr; // Pointer into data array
+ int ncolors, // Number of colors
+ chars_per_color; // Characters per color
+ Fl_Color colors[256]; // Colors
+ int red, green, blue; // Red, green, and blue values
+ int x, y; // X & Y in image
+ int startx; // Starting X coord
+
+
+ // Get the pixmap data...
+ ptr = img->data();
+ sscanf(*ptr, "%*d%*d%d%d", &ncolors, &chars_per_color);
+ if (chars_per_color > 1) {
+ Fl::warning("Fl_Icon_File::load(): Unable to load 2-byte XPM file \"%s\"!",
+ ifile);
+ img->release();
+ return (-1);
}
- }
-
- // Free memory and return...
- free(rows);
- free(pixels);
-
- png_read_end(pp, info);
-# ifdef HAVE_PNG_READ_DESTROY
- png_read_destroy(pp, info, NULL);
-# else
- png_destroy_read_struct(&pp, &info, NULL);
-# endif // HAVE_PNG_READ_DESTROY
-
- // Close the file and return...
- fclose(fp);
-
-# ifdef DEBUG
- printf("Icon File \"%s\":\n", xpm);
- for (i = 0; i < num_data_; i ++)
- printf(" %d,\n", data_[i]);
-# endif // DEBUG
-#endif // HAVE_LIBPNG
-}
-
-
-//
-// 'Fl_File_Icon::load_xpm()' - Load an XPM icon file...
-//
-
-void
-Fl_File_Icon::load_xpm(const char *xpm) // I - File to read from
-{
- FILE *fp; // File pointer
- int i, j; // Looping vars
- int ch; // Current character
- int bg; // Background color
- char line[1024], // Line from file
- val[16], // Color value
- *ptr; // Pointer into line
- int x, y; // X & Y in image
- int startx; // Starting X coord
- int width, height; // Width and height of image
- int ncolors; // Number of colors
- Fl_Color colors[256]; // Colors
- int red, green, blue; // Red, green, and blue values
+ // Read the colormap...
+ memset(colors, 0, sizeof(colors));
+ bg = ' ';
- // Try to open the file...
- if ((fp = fopen(xpm, "rb")) == NULL)
- return;
-
- // Read the file header until we find the first string...
- ptr = NULL;
- while (fgets(line, sizeof(line), fp) != NULL)
- if ((ptr = strchr(line, '\"')) != NULL)
- break;
-
- if (ptr == NULL)
- {
- // Nothing to load...
- fclose(fp);
- return;
- }
-
- // Get the size of the image...
- sscanf(ptr + 1, "%d%d%d", &width, &height, &ncolors);
-
- // Now read the colormap...
- memset(colors, 0, sizeof(colors));
- bg = ' ';
-
- for (i = 0; i < ncolors; i ++)
- {
- while (fgets(line, sizeof(line), fp) != NULL)
- if ((ptr = strchr(line, '\"')) != NULL)
- break;
-
- if (ptr == NULL)
- {
- // Nothing to load...
- fclose(fp);
- return;
- }
-
- // Get the color's character
ptr ++;
- ch = *ptr++;
-
- // Get the color value...
- if ((ptr = strstr(ptr, "c ")) == NULL)
- {
- // No color; make this black...
- colors[ch] = FL_BLACK;
- }
- else if (ptr[2] == '#')
- {
- // Read the RGB triplet...
- ptr += 3;
- for (j = 0; j < 12; j ++)
- if (!isxdigit(ptr[j]))
- break;
- switch (j)
- {
- case 0 :
+ if (ncolors < 0) {
+ // Read compressed colormap...
+ const uchar *cmapptr;
+
+ ncolors = -ncolors;
+
+ for (i = 0, cmapptr = (const uchar *)*ptr; i < ncolors; i ++, cmapptr += 4)
+ colors[cmapptr[0]] = fl_rgb_color(cmapptr[1], cmapptr[2], cmapptr[3]);
+
+ ptr ++;
+ } else {
+ for (i = 0; i < ncolors; i ++, ptr ++) {
+ // Get the color's character
+ lineptr = *ptr;
+ ch = *lineptr++;
+
+ // Get the color value...
+ if ((lineptr = strstr(lineptr, "c ")) == NULL) {
+ // No color; make this black...
+ colors[ch] = FL_BLACK;
+ } else if (lineptr[2] == '#') {
+ // Read the RGB triplet...
+ lineptr += 3;
+ for (j = 0; j < 12; j ++)
+ if (!isxdigit(lineptr[j]))
+ break;
+
+ switch (j) {
+ case 0 :
+ bg = ch;
+ default :
+ red = green = blue = 0;
+ break;
+
+ case 3 :
+ val[0] = lineptr[0];
+ val[1] = '\0';
+ red = 255 * strtol(val, NULL, 16) / 15;
+
+ val[0] = lineptr[1];
+ val[1] = '\0';
+ green = 255 * strtol(val, NULL, 16) / 15;
+
+ val[0] = lineptr[2];
+ val[1] = '\0';
+ blue = 255 * strtol(val, NULL, 16) / 15;
+ break;
+
+ case 6 :
+ case 9 :
+ case 12 :
+ j /= 3;
+
+ val[0] = lineptr[0];
+ val[1] = lineptr[1];
+ val[2] = '\0';
+ red = strtol(val, NULL, 16);
+
+ val[0] = lineptr[j + 0];
+ val[1] = lineptr[j + 1];
+ val[2] = '\0';
+ green = strtol(val, NULL, 16);
+
+ val[0] = lineptr[2 * j + 0];
+ val[1] = lineptr[2 * j + 1];
+ val[2] = '\0';
+ blue = strtol(val, NULL, 16);
+ break;
+ }
+
+ colors[ch] = fl_rgb_color(red, green, blue);
+ } else {
+ // Read a color name...
+ if (strncasecmp(lineptr + 2, "white", 5) == 0) colors[ch] = FL_WHITE;
+ else if (strncasecmp(lineptr + 2, "black", 5) == 0) colors[ch] = FL_BLACK;
+ else if (strncasecmp(lineptr + 2, "none", 4) == 0) {
+ colors[ch] = FL_BLACK;
bg = ch;
- default :
- red = green = blue = 0;
- break;
-
- case 3 :
- val[0] = ptr[0];
- val[1] = '\0';
- red = 255 * strtol(val, NULL, 16) / 15;
-
- val[0] = ptr[1];
- val[1] = '\0';
- green = 255 * strtol(val, NULL, 16) / 15;
-
- val[0] = ptr[2];
- val[1] = '\0';
- blue = 255 * strtol(val, NULL, 16) / 15;
- break;
-
- case 6 :
- case 9 :
- case 12 :
- j /= 3;
-
- val[0] = ptr[0];
- val[1] = ptr[1];
- val[2] = '\0';
- red = strtol(val, NULL, 16);
-
- val[0] = ptr[j + 0];
- val[1] = ptr[j + 1];
- val[2] = '\0';
- green = strtol(val, NULL, 16);
-
- val[0] = ptr[2 * j + 0];
- val[1] = ptr[2 * j + 1];
- val[2] = '\0';
- blue = strtol(val, NULL, 16);
- break;
- }
-
- colors[ch] = fl_rgb_color(red, green, blue);
- }
- else
- {
- // Read a color name...
- if (strncasecmp(ptr + 2, "white", 5) == 0)
- colors[ch] = FL_WHITE;
- else if (strncasecmp(ptr + 2, "black", 5) == 0)
- colors[ch] = FL_BLACK;
- else if (strncasecmp(ptr + 2, "none", 4) == 0)
- {
- colors[ch] = FL_BLACK;
- bg = ch;
+ } else colors[ch] = FL_GRAY;
+ }
}
- else
- colors[ch] = FL_GRAY;
}
- }
- // Read the image data...
- for (y = height - 1; y >= 0; y --)
- {
- while (fgets(line, sizeof(line), fp) != NULL)
- if ((ptr = strchr(line, '\"')) != NULL)
- break;
-
- if (ptr == NULL)
+ // Read the image data...
+ for (y = 0; y < img->h(); y ++, ptr ++)
{
- // Nothing to load...
- fclose(fp);
- return;
- }
+ lineptr = *ptr;
+ startx = 0;
+ ch = bg;
+ ptr ++;
- startx = 0;
- ch = bg;
- ptr ++;
+ for (x = 0; x < img->w(); x ++, lineptr ++)
+ if (*lineptr != ch)
+ {
+ if (ch != bg)
+ {
+ add_color(colors[ch]);
+ add(POLYGON);
+ add_vertex(startx * 9000 / img->w() + 1000, 9500 - y * 9000 / img->h());
+ add_vertex(x * 9000 / img->w() + 1000, 9500 - y * 9000 / img->h());
+ add_vertex(x * 9000 / img->w() + 1000, 9500 - (y + 1) * 9000 / img->h());
+ add_vertex(startx * 9000 / img->w() + 1000, 9500 - (y + 1) * 9000 / img->h());
+ add(END);
+ }
+
+ ch = *lineptr;
+ startx = x;
+ }
- for (x = 0; x < width; x ++, ptr ++)
- if (*ptr != ch)
+ if (ch != bg)
{
- if (ch != bg)
- {
- add_color(colors[ch]);
- add(POLYGON);
- add_vertex(startx * 9000 / width + 1000, y * 9000 / height + 500);
- add_vertex(x * 9000 / width + 1000, y * 9000 / height + 500);
- add_vertex(x * 9000 / width + 1000, (y + 1) * 9000 / height + 500);
- add_vertex(startx * 9000 / width + 1000, (y + 1) * 9000 / height + 500);
- add(END);
- }
-
- ch = *ptr;
- startx = x;
+ add_color(colors[ch]);
+ add(POLYGON);
+ add_vertex(startx * 9000 / img->w() + 1000, 9500 - y * 9000 / img->h());
+ add_vertex(x * 9000 / img->w() + 1000, 9500 - y * 9000 / img->h());
+ add_vertex(x * 9000 / img->w() + 1000, 9500 - (y + 1) * 9000 / img->h());
+ add_vertex(startx * 9000 / img->w() + 1000, 9500 - (y + 1) * 9000 / img->h());
+ add(END);
}
-
- if (ch != bg)
- {
- add_color(colors[ch]);
- add(POLYGON);
- add_vertex(startx * 9000 / width + 1000, y * 9000 / height + 500);
- add_vertex(x * 9000 / width + 1000, y * 9000 / height + 500);
- add_vertex(x * 9000 / width + 1000, (y + 1) * 9000 / height + 500);
- add_vertex(startx * 9000 / width + 1000, (y + 1) * 9000 / height + 500);
- add(END);
}
}
- // Close the file and return...
- fclose(fp);
+ img->release();
#ifdef DEBUG
printf("Icon File \"%s\":\n", xpm);
for (i = 0; i < num_data_; i ++)
printf(" %d,\n", data_[i]);
-#endif /* DEBUG */
+#endif // DEBUG
+
+ return 0;
}
@@ -777,9 +648,9 @@ Fl_File_Icon::load_system_icons(void)
// Load KDE icons...
icon = new Fl_File_Icon("*", Fl_File_Icon::PLAIN);
if (!access("/usr/share/icons/hicolor/32x32/mimetypes/unknown.png", F_OK))
- icon->load_png("/usr/share/icons/hicolor/32x32/mimetypes/unknown.png");
+ icon->load_image("/usr/share/icons/hicolor/32x32/mimetypes/unknown.png");
else
- icon->load_xpm("/usr/share/icons/unknown.xpm");
+ icon->load_image("/usr/share/icons/unknown.xpm");
load_kde_icons("/usr/share/mimelnk");
}
@@ -787,31 +658,31 @@ Fl_File_Icon::load_system_icons(void)
{
// Load GNOME icons...
icon = new Fl_File_Icon("*", Fl_File_Icon::PLAIN);
- icon->load_xpm("/usr/share/icons/page.xpm");
+ icon->load_image("/usr/share/icons/page.xpm");
icon = new Fl_File_Icon("*", Fl_File_Icon::DIRECTORY);
- icon->load_xpm("/usr/share/icons/folder.xpm");
+ icon->load_image("/usr/share/icons/folder.xpm");
}
else if (!access("/usr/dt/appconfig/icons", F_OK))
{
// Load CDE icons...
icon = new Fl_File_Icon("*", Fl_File_Icon::PLAIN);
- icon->load_xpm("/usr/dt/appconfig/icons/C/Dtdata.m.pm");
+ icon->load_image("/usr/dt/appconfig/icons/C/Dtdata.m.pm");
icon = new Fl_File_Icon("*", Fl_File_Icon::DIRECTORY);
- icon->load_xpm("/usr/dt/appconfig/icons/C/DtdirB.m.pm");
+ icon->load_image("/usr/dt/appconfig/icons/C/DtdirB.m.pm");
icon = new Fl_File_Icon("core", Fl_File_Icon::PLAIN);
- icon->load_xpm("/usr/dt/appconfig/icons/C/Dtcore.m.pm");
+ icon->load_image("/usr/dt/appconfig/icons/C/Dtcore.m.pm");
icon = new Fl_File_Icon("*.{bmp|bw|gif|jpg|pbm|pcd|pgm|ppm|png|ras|rgb|tif|xbm|xpm}", Fl_File_Icon::PLAIN);
- icon->load_xpm("/usr/dt/appconfig/icons/C/Dtimage.m.pm");
+ icon->load_image("/usr/dt/appconfig/icons/C/Dtimage.m.pm");
icon = new Fl_File_Icon("*.{eps|pdf|ps}", Fl_File_Icon::PLAIN);
- icon->load_xpm("/usr/dt/appconfig/icons/C/Dtps.m.pm");
+ icon->load_image("/usr/dt/appconfig/icons/C/Dtps.m.pm");
icon = new Fl_File_Icon("*.ppd", Fl_File_Icon::PLAIN);
- icon->load_xpm("/usr/dt/appconfig/icons/C/DtPrtpr.m.pm");
+ icon->load_image("/usr/dt/appconfig/icons/C/DtPrtpr.m.pm");
}
else if (!access("/usr/lib/filetype", F_OK))
{
@@ -940,27 +811,60 @@ load_kde_mimelnk(const char *filename)
strcpy(pattern, val);
}
- if (iconfilename && pattern)
+ fclose(fp);
+
+ if (iconfilename[0] && (pattern[0] || strncmp(mimetype, "inode/", 6) == 0))
{
- if (!access("/usr/share/icons/locolor", F_OK))
+ if (!access("/usr/share/icons/hicolor", F_OK))
{
- if (strncmp(mimetype, "inode/", 6) != 0)
- sprintf(full_iconfilename, "/usr/share/icons/hicolor/32x32/mimetypes/%s.png", iconfilename);
- else
- sprintf(full_iconfilename, "/usr/share/icons/hicolor/32x32/filesystems/%s.png", iconfilename);
- }
- else
- sprintf(full_iconfilename, "/usr/share/icons/%s", iconfilename);
+ int i; // Looping var
+ static const char *paths[] = { // Subdirs to look in...
+ "32x32/actions",
+ "32x32/apps",
+ "32x32/devices",
+ "32x32/filesystems",
+ "32x32/mimetypes",
+
+ "22x22/actions",
+ "22x22/apps",
+ "22x22/devices",
+ "22x22/filesystems",
+ "22x22/mimetypes",
+
+ "16x16/actions",
+ "16x16/apps",
+ "16x16/devices",
+ "16x16/filesystems",
+ "16x16/mimetypes"
+ };
+
+ for (i = 0; i < (int)(sizeof(paths) / sizeof(paths[0])); i ++) {
+ snprintf(full_iconfilename, sizeof(full_iconfilename),
+ "/usr/share/icons/hicolor/%s/%s.png", paths[i],
+ iconfilename);
+
+ if (!access(full_iconfilename, F_OK)) break;
+ }
- if (strcmp(mimetype, "inode/directory") == 0)
- icon = new Fl_File_Icon("*", Fl_File_Icon::DIRECTORY);
+ if (i >= (int)(sizeof(paths) / sizeof(paths[0]))) return;
+ }
else
+ snprintf(full_iconfilename, sizeof(full_iconfilename),
+ "/usr/share/icons/%s", iconfilename);
+
+ if (strncmp(mimetype, "inode/", 6) == 0) {
+ if (strcmp(mimetype + 6, "directory") == 0)
+ icon = new Fl_File_Icon("*", Fl_File_Icon::DIRECTORY);
+ else if (strcmp(mimetype + 6, "blockdevice") == 0)
+ icon = new Fl_File_Icon("*", Fl_File_Icon::DEVICE);
+ else if (strcmp(mimetype + 6, "fifo") == 0)
+ icon = new Fl_File_Icon("*", Fl_File_Icon::FIFO);
+ else return;
+ } else
icon = new Fl_File_Icon(kde_to_fltk_pattern(pattern), Fl_File_Icon::PLAIN);
icon->load(full_iconfilename);
}
-
- fclose(fp);
}
}
@@ -1020,5 +924,5 @@ get_kde_val(char *str,
//
-// End of "$Id: Fl_File_Icon2.cxx,v 1.1.2.3 2001/11/17 16:37:48 easysw Exp $".
+// End of "$Id: Fl_File_Icon2.cxx,v 1.1.2.4 2001/11/25 16:38:11 easysw Exp $".
//
diff --git a/src/Fl_Help_View.cxx b/src/Fl_Help_View.cxx
index 2e19b834e..6d811e237 100644
--- a/src/Fl_Help_View.cxx
+++ b/src/Fl_Help_View.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Help_View.cxx,v 1.1.2.14 2001/11/24 04:12:56 easysw Exp $"
+// "$Id: Fl_Help_View.cxx,v 1.1.2.15 2001/11/25 16:38:11 easysw Exp $"
//
// Fl_Help_View widget routines.
//
@@ -54,24 +54,15 @@
//
#include <FL/Fl_Help_View.H>
-#include "config.h"
#include <stdio.h>
#include <stdlib.h>
+#include "flstring.h"
#include <ctype.h>
-#include <string.h>
-#ifdef HAVE_STRINGS_H
-# include <strings.h>
-#endif /* HAVE_STRINGS_H */
#include <errno.h>
#if defined(WIN32) && ! defined(__CYGWIN__)
# include <io.h>
# include <direct.h>
-# define strcasecmp(s,t) stricmp((s), (t))
-# define strncasecmp(s,t,n) strnicmp((s), (t), (n))
-#elif defined(__EMX__)
-# define strcasecmp(s,t) stricmp((s), (t))
-# define strncasecmp(s,t,n) strnicmp((s), (t), (n))
#else
# include <unistd.h>
#endif // WIN32
@@ -2506,5 +2497,5 @@ hscrollbar_callback(Fl_Widget *s, void *)
//
-// End of "$Id: Fl_Help_View.cxx,v 1.1.2.14 2001/11/24 04:12:56 easysw Exp $".
+// End of "$Id: Fl_Help_View.cxx,v 1.1.2.15 2001/11/25 16:38:11 easysw Exp $".
//
diff --git a/src/Fl_Image.cxx b/src/Fl_Image.cxx
index 9a82363d2..ef16ad802 100644
--- a/src/Fl_Image.cxx
+++ b/src/Fl_Image.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Image.cxx,v 1.5.2.3.2.8 2001/11/24 02:46:19 easysw Exp $"
+// "$Id: Fl_Image.cxx,v 1.5.2.3.2.9 2001/11/25 16:38:11 easysw Exp $"
//
// Image drawing code for the Fast Light Tool Kit (FLTK).
//
@@ -74,7 +74,7 @@ Fl_RGB_Image::~Fl_RGB_Image() {
Fl_Image *Fl_RGB_Image::copy(int W, int H) {
// Optimize the simple copy where the width and height are the same...
- if (W == w() && H == h()) return new Fl_RGB_Image(array, w(), h(), d(), ld);
+ if (W == w() && H == h()) return new Fl_RGB_Image(array, w(), h(), d(), ld());
// OK, need to resize the image data; allocate memory and
Fl_RGB_Image *new_image; // New RGB image
@@ -102,7 +102,7 @@ Fl_Image *Fl_RGB_Image::copy(int W, int H) {
// Scale the image using a nearest-neighbor algorithm...
for (dy = H, sy = 0, yerr = H / 2, new_ptr = new_array; dy > 0; dy --) {
- for (dx = W, xerr = W / 2, old_ptr = array + sy * (w() * d() + ld);
+ for (dx = W, xerr = W / 2, old_ptr = array + sy * (w() * d() + ld());
dx > 0;
dx --) {
for (c = 0; c < d(); c ++) *new_ptr++ = old_ptr[c];
@@ -166,13 +166,13 @@ void Fl_RGB_Image::color_average(Fl_Color c, float i) {
if (d() < 3) {
ig = (r * 31 + g * 61 + b * 8) / 100 * (256 - ia);
- for (new_ptr = new_array, old_ptr = array, y = 0; y < h(); y ++, old_ptr += ld)
+ for (new_ptr = new_array, old_ptr = array, y = 0; y < h(); y ++, old_ptr += ld())
for (x = 0; x < w(); x ++) {
*new_ptr++ = (*old_ptr++ * ia + ig) >> 8;
if (d() > 1) *new_ptr++ = *old_ptr++;
}
} else {
- for (new_ptr = new_array, old_ptr = array, y = 0; y < h(); y ++, old_ptr += ld)
+ for (new_ptr = new_array, old_ptr = array, y = 0; y < h(); y ++, old_ptr += ld())
for (x = 0; x < w(); x ++) {
*new_ptr++ = (*old_ptr++ * ia + ir) >> 8;
*new_ptr++ = (*old_ptr++ * ia + ig) >> 8;
@@ -185,7 +185,8 @@ void Fl_RGB_Image::color_average(Fl_Color c, float i) {
if (!alloc_array) {
array = new_array;
alloc_array = 1;
- ld = 0;
+
+ ld(0);
}
}
@@ -216,7 +217,7 @@ void Fl_RGB_Image::desaturate() {
const uchar *old_ptr;
int x, y;
- for (new_ptr = new_array, old_ptr = array, y = 0; y < h(); y ++, old_ptr += ld)
+ for (new_ptr = new_array, old_ptr = array, y = 0; y < h(); y ++, old_ptr += ld())
for (x = 0; x < w(); x ++, old_ptr += d()) {
*new_ptr++ = (31 * old_ptr[0] + 61 * old_ptr[1] + 8 * old_ptr[2]) / 100;
if (d() > 3) *new_ptr++ = old_ptr[3];
@@ -227,8 +228,8 @@ void Fl_RGB_Image::desaturate() {
array = new_array;
alloc_array = 1;
- ld = 0;
+ ld(0);
d(new_d);
}
@@ -251,7 +252,7 @@ void Fl_RGB_Image::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
if (!id) {
id = fl_create_offscreen(w(), h());
fl_begin_offscreen((Fl_Offscreen)id);
- fl_draw_image(array, 0, 0, w(), h(), d(), ld);
+ fl_draw_image(array, 0, 0, w(), h(), d(), ld());
fl_end_offscreen();
if (d() == 2 || d() == 4) {
@@ -300,7 +301,7 @@ void Fl_RGB_Image::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
// definitely fast...
memset(bitmap, 0, bmw * h());
- for (dataptr = array + d() - 1, y = 0; y < h(); y ++, dataptr += ld)
+ for (dataptr = array + d() - 1, y = 0; y < h(); y ++, dataptr += ld())
for (bitptr = bitmap + y * bmw, bit = 128, x = 0; x < w(); x ++, dataptr += d()) {
if (*dataptr > dither[x & 15][y & 15])
*bitptr |= bit;
@@ -357,5 +358,5 @@ void Fl_RGB_Image::label(Fl_Menu_Item* m) {
//
-// End of "$Id: Fl_Image.cxx,v 1.5.2.3.2.8 2001/11/24 02:46:19 easysw Exp $".
+// End of "$Id: Fl_Image.cxx,v 1.5.2.3.2.9 2001/11/25 16:38:11 easysw Exp $".
//
diff --git a/src/Fl_Tabs.cxx b/src/Fl_Tabs.cxx
index 3723a13da..6d7e12fbf 100644
--- a/src/Fl_Tabs.cxx
+++ b/src/Fl_Tabs.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Tabs.cxx,v 1.6.2.10.2.2 2001/11/03 19:24:22 easysw Exp $"
+// "$Id: Fl_Tabs.cxx,v 1.6.2.10.2.3 2001/11/25 16:38:11 easysw Exp $"
//
// Tab widget for the Fast Light Tool Kit (FLTK).
//
@@ -158,12 +158,14 @@ int Fl_Tabs::handle(int event) {
for (i = 1; i < children(); i ++)
if (child(i)->visible()) break;
value(child(i - 1));
+ do_callback();
return 1;
case FL_Right:
if (child(children() - 1)->visible()) return 0;
for (i = 0; i < children(); i ++)
if (child(i)->visible()) break;
value(child(i + 1));
+ do_callback();
return 1;
case FL_Down:
redraw();
@@ -311,5 +313,5 @@ Fl_Tabs::Fl_Tabs(int X,int Y,int W, int H, const char *l) :
}
//
-// End of "$Id: Fl_Tabs.cxx,v 1.6.2.10.2.2 2001/11/03 19:24:22 easysw Exp $".
+// End of "$Id: Fl_Tabs.cxx,v 1.6.2.10.2.3 2001/11/25 16:38:11 easysw Exp $".
//
diff --git a/src/Fl_abort.cxx b/src/Fl_abort.cxx
index 94b8560f6..d18b00d80 100644
--- a/src/Fl_abort.cxx
+++ b/src/Fl_abort.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_abort.cxx,v 1.8.2.3.2.1 2001/11/22 15:35:01 easysw Exp $"
+// "$Id: Fl_abort.cxx,v 1.8.2.3.2.2 2001/11/25 16:38:11 easysw Exp $"
//
// Warning/error message code for the Fast Light Tool Kit (FLTK).
//
@@ -28,57 +28,69 @@
// You can also override this by redefining all of these.
#include <FL/Fl.H>
-#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
-#include <config.h>
+#include <stdarg.h>
+#include "flstring.h"
-#ifndef WIN32
+#ifdef WIN32
+# include <windows.h>
static void warning(const char *format, ...) {
va_list args;
+ char buf[1024];
va_start(args, format);
- vfprintf(stderr, format, args);
+ vsnprintf(buf, 1024, format, args);
va_end(args);
- fputc('\n', stderr);
- fflush(stderr);
+ MessageBox(0,buf,"Warning",MB_ICONEXCLAMATION|MB_OK);
}
static void error(const char *format, ...) {
va_list args;
+ char buf[1024];
va_start(args, format);
- vfprintf(stderr, format, args);
+ vsnprintf(buf, 1024, format, args);
va_end(args);
- fputc('\n', stderr);
- fflush(stderr);
+ MessageBox(0,buf,"Error",MB_ICONSTOP|MB_SYSTEMMODAL);
+}
+
+static void fatal(const char *format, ...) {
+ va_list args;
+ char buf[1024];
+ va_start(args, format);
+ vsnprintf(buf, 1024, format, args);
+ va_end(args);
+ MessageBox(0,buf,"Error",MB_ICONSTOP|MB_SYSTEMMODAL);
::exit(1);
}
#else
-#include <windows.h>
-# if !HAVE_VSNPRINTF || defined(__hpux)
-extern "C" {
-int vsnprintf(char* str, size_t size, const char* fmt, va_list ap);
-}
-# endif /* !HAVE_VSNPRINTF */
-
static void warning(const char *format, ...) {
va_list args;
- char buf[1024];
va_start(args, format);
- vsnprintf(buf, 1024, format, args);
+ vfprintf(stderr, format, args);
va_end(args);
- MessageBox(0,buf,"Warning",MB_ICONEXCLAMATION|MB_OK);
+ fputc('\n', stderr);
+ fflush(stderr);
}
static void error(const char *format, ...) {
va_list args;
- char buf[1024];
va_start(args, format);
- vsnprintf(buf, 1024, format, args);
+ vfprintf(stderr, format, args);
va_end(args);
- MessageBox(0,buf,"Error",MB_ICONSTOP|MB_SYSTEMMODAL);
+ fputc('\n', stderr);
+ fflush(stderr);
+}
+
+static void fatal(const char *format, ...) {
+ va_list args;
+ va_start(args, format);
+ vfprintf(stderr, format, args);
+ va_end(args);
+ fputc('\n', stderr);
+ fflush(stderr);
::exit(1);
}
@@ -86,8 +98,8 @@ static void error(const char *format, ...) {
void (*Fl::warning)(const char* format, ...) = ::warning;
void (*Fl::error)(const char* format, ...) = ::error;
-void (*Fl::fatal)(const char* format, ...) = ::error;
+void (*Fl::fatal)(const char* format, ...) = ::fatal;
//
-// End of "$Id: Fl_abort.cxx,v 1.8.2.3.2.1 2001/11/22 15:35:01 easysw Exp $".
+// End of "$Id: Fl_abort.cxx,v 1.8.2.3.2.2 2001/11/25 16:38:11 easysw Exp $".
//
diff --git a/src/fl_ask.cxx b/src/fl_ask.cxx
index d6691a3fd..3107ba0f5 100644
--- a/src/fl_ask.cxx
+++ b/src/fl_ask.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: fl_ask.cxx,v 1.8.2.8.2.2 2001/11/18 12:48:38 easysw Exp $"
+// "$Id: fl_ask.cxx,v 1.8.2.8.2.3 2001/11/25 16:38:11 easysw Exp $"
//
// Standard dialog functions for the Fast Light Tool Kit (FLTK).
//
@@ -30,8 +30,7 @@
#include <stdio.h>
#include <stdarg.h>
-#include <string.h>
-#include <config.h>
+#include "flstring.h"
#include <FL/Fl.H>
@@ -81,12 +80,6 @@ static Fl_Window *makeform() {
return w;
}
-#if !HAVE_VSNPRINTF || defined(__hpux)
-extern "C" {
-int vsnprintf(char* str, size_t size, const char* fmt, va_list ap);
-}
-#endif
-
static int innards(const char* fmt, va_list ap,
const char *b0,
const char *b1,
@@ -256,5 +249,5 @@ const char *fl_password(const char *fmt, const char *defstr, ...) {
}
//
-// End of "$Id: fl_ask.cxx,v 1.8.2.8.2.2 2001/11/18 12:48:38 easysw Exp $".
+// End of "$Id: fl_ask.cxx,v 1.8.2.8.2.3 2001/11/25 16:38:11 easysw Exp $".
//
diff --git a/src/flstring.h b/src/flstring.h
new file mode 100644
index 000000000..1a404d10d
--- /dev/null
+++ b/src/flstring.h
@@ -0,0 +1,63 @@
+/*
+ * "$Id: flstring.h,v 1.1.2.1 2001/11/25 16:38:11 easysw Exp $"
+ *
+ * Common string header file for the Fast Light Tool Kit (FLTK).
+ *
+ * Copyright 1998-2001 by Bill Spitzak and others.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA.
+ *
+ * Please report all bugs and problems to "fltk-bugs@fltk.org".
+ */
+
+#ifndef flstring_h
+# define flstring_h
+
+# include <config.h>
+# include <stdarg.h>
+# include <string.h>
+# ifdef HAVE_STRINGS_H
+# include <strings.h>
+# endif /* HAVE_STRINGS_H */
+
+# if defined(WIN32) && !defined(__CYGWIN__)
+# define strcasecmp(s,t) stricmp((s), (t))
+# define strncasecmp(s,t,n) strnicmp((s), (t), (n))
+# elif defined(__EMX__)
+# define strcasecmp(s,t) stricmp((s), (t))
+# define strncasecmp(s,t,n) strnicmp((s), (t), (n))
+# endif /* WIN32 */
+
+# ifdef __cplusplus
+extern "C" {
+# endif /* __cplusplus */
+
+# if !HAVE_SNPRINTF
+extern int snprintf(char *, size_t, const char *, ...);
+# endif /* !HAVE_SNPRINTF */
+
+# if !HAVE_VSNPRINTF
+extern int vsnprintf(char *, size_t, const char *, va_list ap);
+# endif /* !HAVE_VSNPRINTF */
+
+# ifdef __cplusplus
+}
+# endif /* __cplusplus */
+#endif /* !flstring_h */
+
+/*
+ * End of "$Id: flstring.h,v 1.1.2.1 2001/11/25 16:38:11 easysw Exp $".
+ */
diff --git a/src/makedepend b/src/makedepend
index e3ce1c961..a5a25956a 100644
--- a/src/makedepend
+++ b/src/makedepend
@@ -62,7 +62,7 @@ Fl_File_Browser.o: ../FL/Fl_Browser_.H ../FL/Fl_Group.H ../FL/Fl_Widget.H
Fl_File_Browser.o: ../FL/Enumerations.H ../FL/Fl_Export.H
Fl_File_Browser.o: ../FL/Fl_Scrollbar.H ../FL/Fl_Slider.H ../FL/Fl_Valuator.H
Fl_File_Browser.o: ../FL/Fl_File_Icon.H ../FL/Fl.H ../FL/fl_draw.H
-Fl_File_Browser.o: ../FL/filename.H ../config.h
+Fl_File_Browser.o: ../FL/filename.H flstring.h ../config.h
Fl_File_Chooser.o: ../FL/Fl_File_Chooser.H ../FL/Fl.H ../FL/Enumerations.H
Fl_File_Chooser.o: ../FL/Fl_Export.H ../FL/Fl_Window.H ../FL/Fl_Group.H
Fl_File_Chooser.o: ../FL/Fl_Widget.H ../FL/Fl_File_Browser.H
@@ -83,13 +83,15 @@ Fl_File_Chooser2.o: ../FL/Fl_Button.H ../FL/Fl_Return_Button.H
Fl_File_Chooser2.o: ../FL/Fl_Button.H ../FL/fl_ask.H ../FL/Fl_Input.H
Fl_File_Chooser2.o: ../FL/Fl_Input_.H ../FL/Fl_Choice.H ../FL/Fl_Menu_.H
Fl_File_Chooser2.o: ../FL/Fl_Menu_Item.H ../FL/filename.H ../FL/x.H
-Fl_File_Chooser2.o: ../FL/Fl_Window.H
+Fl_File_Chooser2.o: ../FL/Fl_Window.H flstring.h ../config.h
Fl_File_Icon.o: ../config.h ../FL/Fl_File_Icon.H ../FL/Fl.H
Fl_File_Icon.o: ../FL/Enumerations.H ../FL/Fl_Export.H ../FL/Fl_Widget.H
Fl_File_Icon.o: ../FL/fl_draw.H ../FL/filename.H
-Fl_File_Icon2.o: ../config.h ../FL/Fl_File_Icon.H ../FL/Fl.H
-Fl_File_Icon2.o: ../FL/Enumerations.H ../FL/Fl_Export.H ../FL/Fl_Widget.H
-Fl_File_Icon2.o: ../FL/fl_draw.H ../FL/filename.H
+Fl_File_Icon2.o: flstring.h ../config.h ../FL/Fl_File_Icon.H ../FL/Fl.H
+Fl_File_Icon2.o: ../FL/Enumerations.H ../FL/Fl_Export.H
+Fl_File_Icon2.o: ../FL/Fl_Shared_Image.H ../FL/Fl_Image.H ../FL/x.H
+Fl_File_Icon2.o: ../FL/Fl_Window.H ../FL/Fl_Widget.H ../FL/fl_draw.H
+Fl_File_Icon2.o: ../FL/filename.H
Fl_GIF_Image.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H
Fl_GIF_Image.o: ../FL/Fl_GIF_Image.H ../FL/Fl_Pixmap.H ../FL/Fl_Image.H
Fl_GIF_Image.o: ../FL/x.H ../FL/Fl_Window.H ../config.h
@@ -108,7 +110,7 @@ Fl_Help_View.o: ../FL/Fl_Help_View.H ../FL/Fl.H ../FL/Enumerations.H
Fl_Help_View.o: ../FL/Fl_Export.H ../FL/Fl_Group.H ../FL/Fl_Widget.H
Fl_Help_View.o: ../FL/Fl_Scrollbar.H ../FL/Fl_Slider.H ../FL/Fl_Valuator.H
Fl_Help_View.o: ../FL/fl_draw.H ../FL/Fl_Shared_Image.H ../FL/Fl_Image.H
-Fl_Help_View.o: ../FL/x.H ../FL/Fl_Window.H ../config.h
+Fl_Help_View.o: ../FL/x.H ../FL/Fl_Window.H flstring.h ../config.h
Fl_Image.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H ../FL/fl_draw.H
Fl_Image.o: ../FL/x.H ../FL/Fl_Window.H ../FL/Fl_Widget.H
Fl_Image.o: ../FL/Fl_Menu_Item.H ../FL/Fl_Widget.H ../FL/Fl_Image.H ../FL/x.H
@@ -161,6 +163,9 @@ Fl_Pixmap.o: ../FL/Fl_Image.H ../FL/x.H
Fl_PNG_Image.o: ../FL/Fl_PNG_Image.H ../FL/Fl_Image.H ../FL/x.H
Fl_PNG_Image.o: ../FL/Enumerations.H ../FL/Fl_Export.H ../FL/Fl_Window.H
Fl_PNG_Image.o: ../config.h
+Fl_PNM_Image.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H
+Fl_PNM_Image.o: ../FL/Fl_PNM_Image.H ../FL/Fl_Image.H ../FL/x.H
+Fl_PNM_Image.o: ../FL/Fl_Window.H ../config.h
Fl_Positioner.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H
Fl_Positioner.o: ../FL/Fl_Positioner.H ../FL/Fl_Widget.H ../FL/fl_draw.H
Fl_Progress.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H
@@ -188,6 +193,8 @@ Fl_Shared_Image.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H
Fl_Shared_Image.o: ../FL/Fl_Shared_Image.H ../FL/Fl_Image.H ../FL/x.H
Fl_Shared_Image.o: ../FL/Fl_Window.H ../FL/Fl_GIF_Image.H ../FL/Fl_Pixmap.H
Fl_Shared_Image.o: ../FL/Fl_JPEG_Image.H ../FL/Fl_PNG_Image.H
+Fl_Shared_Image.o: ../FL/Fl_PNM_Image.H ../FL/Fl_XBM_Image.H
+Fl_Shared_Image.o: ../FL/Fl_Bitmap.H ../FL/Fl_XPM_Image.H
Fl_Single_Window.o: ../FL/Fl_Single_Window.H ../FL/Fl_Window.H
Fl_Slider.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H
Fl_Slider.o: ../FL/Fl_Slider.H ../FL/Fl_Valuator.H ../FL/Fl_Widget.H
@@ -209,7 +216,7 @@ Fl_Tile.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H ../FL/Fl_Tile.H
Fl_Tile.o: ../FL/Fl_Group.H ../FL/Fl_Widget.H ../FL/Fl_Window.H
Fl_Tiled_Image.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H
Fl_Tiled_Image.o: ../FL/Fl_Tiled_Image.H ../FL/Fl_Image.H ../FL/x.H
-Fl_Tiled_Image.o: ../FL/Fl_Window.H
+Fl_Tiled_Image.o: ../FL/Fl_Window.H ../FL/fl_draw.H
Fl_Tooltip.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H
Fl_Tooltip.o: ../FL/Fl_Menu_Window.H ../FL/Fl_Single_Window.H
Fl_Tooltip.o: ../FL/Fl_Window.H ../FL/Fl_Box.H ../FL/Fl_Widget.H
@@ -239,7 +246,14 @@ Fl_Window_iconize.o: ../FL/x.H ../FL/Enumerations.H ../FL/Fl_Export.H
Fl_Window_iconize.o: ../FL/Fl_Window.H
Fl_Wizard.o: ../FL/Fl_Wizard.H ../FL/Fl_Group.H ../FL/fl_draw.H
Fl_Wizard.o: ../FL/Enumerations.H ../FL/Fl_Export.H
-Fl_abort.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H ../config.h
+Fl_XBM_Image.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H
+Fl_XBM_Image.o: ../FL/Fl_XBM_Image.H ../FL/Fl_Bitmap.H ../FL/Fl_Image.H
+Fl_XBM_Image.o: ../FL/x.H ../FL/Fl_Window.H ../config.h
+Fl_XPM_Image.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H
+Fl_XPM_Image.o: ../FL/Fl_XPM_Image.H ../FL/Fl_Pixmap.H ../FL/Fl_Image.H
+Fl_XPM_Image.o: ../FL/x.H ../FL/Fl_Window.H ../config.h
+Fl_abort.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H flstring.h
+Fl_abort.o: ../config.h
Fl_add_idle.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H
Fl_arg.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H ../FL/x.H
Fl_arg.o: ../FL/Fl_Window.H ../FL/Fl_Window.H ../FL/Fl_Group.H
@@ -272,12 +286,12 @@ filename_setext.o: ../FL/filename.H ../FL/Fl_Export.H
fl_arc.o: ../FL/fl_draw.H ../FL/Enumerations.H ../FL/Fl_Export.H ../FL/math.h
fl_arci.o: ../FL/fl_draw.H ../FL/Enumerations.H ../FL/Fl_Export.H ../FL/x.H
fl_arci.o: ../FL/Fl_Window.H
-fl_ask.o: ../config.h ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H
-fl_ask.o: ../FL/fl_ask.H ../FL/Fl_Box.H ../FL/Fl_Widget.H ../FL/Fl_Button.H
-fl_ask.o: ../FL/Fl_Return_Button.H ../FL/Fl_Button.H ../FL/Fl_Window.H
-fl_ask.o: ../FL/Fl_Group.H ../FL/Fl_Input.H ../FL/Fl_Input_.H
-fl_ask.o: ../FL/Fl_Secret_Input.H ../FL/Fl_Input.H ../FL/x.H
-fl_ask.o: ../FL/Fl_Window.H
+fl_ask.o: flstring.h ../config.h ../FL/Fl.H ../FL/Enumerations.H
+fl_ask.o: ../FL/Fl_Export.H ../FL/fl_ask.H ../FL/Fl_Box.H ../FL/Fl_Widget.H
+fl_ask.o: ../FL/Fl_Button.H ../FL/Fl_Return_Button.H ../FL/Fl_Button.H
+fl_ask.o: ../FL/Fl_Window.H ../FL/Fl_Group.H ../FL/Fl_Input.H
+fl_ask.o: ../FL/Fl_Input_.H ../FL/Fl_Secret_Input.H ../FL/Fl_Input.H
+fl_ask.o: ../FL/x.H ../FL/Fl_Window.H
fl_boxtype.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H
fl_boxtype.o: ../FL/Fl_Widget.H ../FL/fl_draw.H ../config.h
fl_color.o: Fl_XColor.H ../config.h ../FL/Enumerations.H ../FL/Fl_Export.H