Multiple bug fixes from Sebastien:

- Fl_GIF_Image and Fl_PNG_Image didn't close the file before
      calling Fl::error().
    - Fl_Help_View didn't clear the line array in Fl_Help_Block,
      and Fl_Help_Block::font and ::size were not used.
    - Fl_Shared_Image::get() didn't return NULL if the image
      could not be loaded.
    - Switched to more efficient code for
      Fl_Tiled_Image::color_average() and ::desaturate().
    - Don't delete children in Fl_Text_Display since the group
      will do it.
    - Fixes to filename_isdir(), filename_absolute(), and
      filename_relative().
    - Was using numbers instead of define constants for some
      OpenGL stuff under WIN32.
    - Wasn't exporting threading functions under WIN32.
    - The Fl_Widget destructor now removes from the parent to
      avoid a Purify error since the old widget would be
      referenced by the parent when it was destroyed; this has
      no apparent performance impact since Fl_Group::clear()
      sets children_ to 0, making Fl_Group::remove() very
      fast...
    - WIN32 font enumeration datatype fixes...


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1878 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Michael R Sweet
2001-12-19 18:15:34 +00:00
parent 9f601ccb73
commit 329b4127f6
17 changed files with 115 additions and 82 deletions
+24
View File
@@ -1,5 +1,29 @@
CHANGES IN FLTK 1.1.0b8
- Fl_JPEG_Image and friends didn't set the depth if the
image file couldn't be loaded; since Fl_RGB_Image
didn't check for this, it could fail when displaying
or copying these images.
- filename_absolute() did not always free its temporary
buffer.
- filename_relative() did not do a case-insensitive
comparison under MacOS, OS/2, and Windows.
- filename_isdir() didn't properly handle "D:L" under
WIN32.
- Fl_Shared_Image::get() did not check to see if the
image could not be loaded.
- Fixed Fl_Widget::~Fl_Widget() so that "delete widget"
will remove the widget from the parent. Otherwise
the Fl_Group destructor will try to access freed memory...
- Fl_Help_View didn't clear the line array in the
Fl_Help_Block structure; this causes erratic
formatting for some pages.
- The font and size members of Fl_Help_Block were never
used.
- The threading functions (Fl::lock() and friends) were
not exported under WIN32.
- The Fl_Text_Display destructor deleted the scrollbars
twice...
- Fl_Help_View didn't reset the horizontal scroll
position when showing a new page.
- Fl_Pack now allows any child widget to be the
+6 -6
View File
@@ -1,5 +1,5 @@
//
// "$Id: Fl.H,v 1.8.2.11.2.9 2001/12/14 16:48:13 easysw Exp $"
// "$Id: Fl.H,v 1.8.2.11.2.10 2001/12/19 18:15:33 easysw Exp $"
//
// Main header file for the Fast Light Tool Kit (FLTK).
//
@@ -225,14 +225,14 @@ public:
static int visible_focus() { return visible_focus_; }
// Multithreading support:
static void lock();
static void unlock();
static void awake(void* message = 0);
static void* thread_message();
static FL_EXPORT void lock();
static FL_EXPORT void unlock();
static FL_EXPORT void awake(void* message = 0);
static FL_EXPORT void* thread_message();
};
#endif // !Fl_H
//
// End of "$Id: Fl.H,v 1.8.2.11.2.9 2001/12/14 16:48:13 easysw Exp $".
// End of "$Id: Fl.H,v 1.8.2.11.2.10 2001/12/19 18:15:33 easysw Exp $".
//
+3 -5
View File
@@ -1,5 +1,5 @@
//
// "$Id: Fl_Help_View.H,v 1.1.2.5 2001/11/24 04:12:56 easysw Exp $"
// "$Id: Fl_Help_View.H,v 1.1.2.6 2001/12/19 18:15:33 easysw Exp $"
//
// Help Viewer widget definitions.
//
@@ -55,9 +55,7 @@ struct Fl_Help_Block
{
const char *start, // Start of text
*end; // End of text
uchar font, // Text font
size, // Text size
border; // Draw border?
uchar border; // Draw border?
int x, // Indentation/starting X coordinate
y, // Starting Y coordinate
w, // Width
@@ -189,5 +187,5 @@ class Fl_Help_View : public Fl_Group //// Help viewer widget
#endif // !Fl_Help_View_H
//
// End of "$Id: Fl_Help_View.H,v 1.1.2.5 2001/11/24 04:12:56 easysw Exp $".
// End of "$Id: Fl_Help_View.H,v 1.1.2.6 2001/12/19 18:15:33 easysw Exp $".
//
+3 -3
View File
@@ -1,5 +1,5 @@
//
// "$Id: Fl_Widget.H,v 1.6.2.4.2.11 2001/11/28 20:43:44 easysw Exp $"
// "$Id: Fl_Widget.H,v 1.6.2.4.2.12 2001/12/19 18:15:33 easysw Exp $"
//
// Widget header file for the Fast Light Tool Kit (FLTK).
//
@@ -102,7 +102,7 @@ public:
FL_EXPORT virtual void draw() = 0;
FL_EXPORT virtual int handle(int);
Fl_Group* parent() const {return parent_;}
void parent(Fl_Group* w) {parent_ = w;} // for hacks only
void parent(Fl_Group* w) {parent_ = w;} // for hacks only, Fl_Group::add()
uchar type() const {return type_;}
void type(uchar t) {type_ = t;}
@@ -207,5 +207,5 @@ public:
#endif
//
// End of "$Id: Fl_Widget.H,v 1.6.2.4.2.11 2001/11/28 20:43:44 easysw Exp $".
// End of "$Id: Fl_Widget.H,v 1.6.2.4.2.12 2001/12/19 18:15:33 easysw Exp $".
//
+4 -9
View File
@@ -1,5 +1,5 @@
//
// "$Id: Fl_GIF_Image.cxx,v 1.1.2.6 2001/12/11 16:03:12 easysw Exp $"
// "$Id: Fl_GIF_Image.cxx,v 1.1.2.7 2001/12/19 18:15:33 easysw Exp $"
//
// Fl_GIF_Image routines.
//
@@ -92,8 +92,8 @@ Fl_GIF_Image::Fl_GIF_Image(const char *infname) : Fl_Pixmap((char *const*)0) {
return; /* quit on eof */
}
if (b[0]!='G' || b[1]!='I' || b[2] != 'F') {
Fl::error("%s is not a GIF file.\n", infname);
fclose(GifFile);
Fl::error("%s is not a GIF file.\n", infname);
return;
}
if (b[3]!='8' || b[4]>'9' || b[5]!= 'a')
@@ -135,8 +135,8 @@ Fl_GIF_Image::Fl_GIF_Image(const char *infname) : Fl_Pixmap((char *const*)0) {
int i = NEXTBYTE;
if (i<0) {
Fl::error("%s: unexpected EOF",infname);
fclose(GifFile);
Fl::error("%s: unexpected EOF",infname);
return;
}
int blocklen;
@@ -193,11 +193,6 @@ Fl_GIF_Image::Fl_GIF_Image(const char *infname) : Fl_Pixmap((char *const*)0) {
}
uchar *Image = new uchar[Width*Height];
if (!Image) {
Fl::fatal("Insufficient memory for %s.", infname);
fclose(GifFile);
return;
}
int YC = 0, Pass = 0; /* Used to de-interlace the picture */
uchar *p = Image;
@@ -378,5 +373,5 @@ Fl_GIF_Image::Fl_GIF_Image(const char *infname) : Fl_Pixmap((char *const*)0) {
//
// End of "$Id: Fl_GIF_Image.cxx,v 1.1.2.6 2001/12/11 16:03:12 easysw Exp $".
// End of "$Id: Fl_GIF_Image.cxx,v 1.1.2.7 2001/12/19 18:15:33 easysw Exp $".
//
+5 -5
View File
@@ -1,5 +1,5 @@
//
// "$Id: Fl_Gl_Choice.cxx,v 1.5.2.7.2.5 2001/12/18 11:00:09 matthiaswm Exp $"
// "$Id: Fl_Gl_Choice.cxx,v 1.5.2.7.2.6 2001/12/19 18:15:34 easysw Exp $"
//
// OpenGL visual selection code for the Fast Light Tool Kit (FLTK).
//
@@ -160,7 +160,7 @@ Fl_Gl_Choice *Fl_Gl_Choice::find(int mode, const int *alist) {
if (!DescribePixelFormat(fl_gc, i, sizeof(pfd), &pfd)) break;
// continue if it does not satisfy our requirements:
if (~pfd.dwFlags & (PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL)) continue;
if (pfd.iPixelType != ((mode&FL_INDEX)?1:0)) continue;
if (pfd.iPixelType != ((mode&FL_INDEX)?PFD_TYPE_COLORINDEX:PFD_TYPE_RGBA)) continue;
if ((mode & FL_ALPHA) && !pfd.cAlphaBits) continue;
if ((mode & FL_ACCUM) && !pfd.cAccumBits) continue;
if ((!(mode & FL_DOUBLE)) != (!(pfd.dwFlags & PFD_DOUBLEBUFFER))) continue;
@@ -217,9 +217,9 @@ GLContext fl_create_gl_context(Fl_Window* window, const Fl_Gl_Choice* g, int lay
HDC hdc = i->private_dc;
if (!hdc) {
hdc = i->private_dc = GetDCEx(i->xid, 0, DCX_CACHE);
SetPixelFormat(i->private_dc, g->pixelformat, (PIXELFORMATDESCRIPTOR*)(&g->pfd));
SetPixelFormat(hdc, g->pixelformat, (PIXELFORMATDESCRIPTOR*)(&g->pfd));
#if USE_COLORMAP
if (fl_palette) SelectPalette(i->private_dc, fl_palette, FALSE);
if (fl_palette) SelectPalette(hdc, fl_palette, FALSE);
#endif
}
GLContext context =
@@ -309,5 +309,5 @@ void fl_delete_gl_context(GLContext context) {
#endif
//
// End of "$Id: Fl_Gl_Choice.cxx,v 1.5.2.7.2.5 2001/12/18 11:00:09 matthiaswm Exp $".
// End of "$Id: Fl_Gl_Choice.cxx,v 1.5.2.7.2.6 2001/12/19 18:15:34 easysw Exp $".
//
+3 -4
View File
@@ -1,5 +1,5 @@
//
// "$Id: Fl_Group.cxx,v 1.8.2.8.2.5 2001/08/04 12:21:33 easysw Exp $"
// "$Id: Fl_Group.cxx,v 1.8.2.8.2.6 2001/12/19 18:15:34 easysw Exp $"
//
// Group widget for the Fast Light Tool Kit (FLTK).
//
@@ -306,8 +306,7 @@ void Fl_Group::clear() {
Fl_Widget*const* a = old_array;
for (int i=old_children; i--;) {
Fl_Widget* o = *a++;
// test the parent to see if child already destructed:
if (o->parent() == this) delete o;
delete o;
}
if (old_children > 1) free((void*)old_array);
}
@@ -552,5 +551,5 @@ void Fl_Group::draw_outside_label(const Fl_Widget& w) const {
}
//
// End of "$Id: Fl_Group.cxx,v 1.8.2.8.2.5 2001/08/04 12:21:33 easysw Exp $".
// End of "$Id: Fl_Group.cxx,v 1.8.2.8.2.6 2001/12/19 18:15:34 easysw Exp $".
//
+5 -3
View File
@@ -1,5 +1,5 @@
//
// "$Id: Fl_Help_View.cxx,v 1.1.2.22 2001/12/19 15:59:51 easysw Exp $"
// "$Id: Fl_Help_View.cxx,v 1.1.2.23 2001/12/19 18:15:34 easysw Exp $"
//
// Fl_Help_View widget routines.
//
@@ -94,7 +94,7 @@ static void hscrollbar_callback(Fl_Widget *s, void *);
//
Fl_Help_Block * // O - Pointer to new block
Fl_Help_View::add_block(const char *s, // I - Pointer to start of block text
Fl_Help_View::add_block(const char *s, // I - Pointer to start of block text
int xx, // I - X position of block
int yy, // I - Y position of block
int ww, // I - Right margin of block
@@ -118,7 +118,9 @@ Fl_Help_View::add_block(const char *s, // I - Pointer to start of block text
}
temp = blocks_ + nblocks_;
memset(temp, 0, sizeof(Fl_Help_Block));
temp->start = s;
temp->end = s;
temp->x = xx;
temp->y = yy;
temp->w = ww;
@@ -2567,5 +2569,5 @@ hscrollbar_callback(Fl_Widget *s, void *)
//
// End of "$Id: Fl_Help_View.cxx,v 1.1.2.22 2001/12/19 15:59:51 easysw Exp $".
// End of "$Id: Fl_Help_View.cxx,v 1.1.2.23 2001/12/19 18:15:34 easysw Exp $".
//
+16 -5
View File
@@ -1,5 +1,5 @@
//
// "$Id: Fl_Image.cxx,v 1.5.2.3.2.11 2001/11/27 17:44:06 easysw Exp $"
// "$Id: Fl_Image.cxx,v 1.5.2.3.2.12 2001/12/19 18:15:34 easysw Exp $"
//
// Image drawing code for the Fast Light Tool Kit (FLTK).
//
@@ -73,8 +73,12 @@ 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());
// Optimize the simple copy where the width and height are the same,
// or when we are copying an empty image...
if ((W == w() && H == h()) ||
!w() || !h() || !d() || !array) {
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
@@ -128,6 +132,9 @@ Fl_Image *Fl_RGB_Image::copy(int W, int H) {
}
void Fl_RGB_Image::color_average(Fl_Color c, float i) {
// Don't average an empty image...
if (!w() || !h() || !d() || !array) return;
// Delete any existing pixmap/mask objects...
if (id) {
fl_delete_offscreen(id);
@@ -191,6 +198,9 @@ void Fl_RGB_Image::color_average(Fl_Color c, float i) {
}
void Fl_RGB_Image::desaturate() {
// Don't desaturate an empty image...
if (!w() || !h() || !d() || !array) return;
// Can only desaturate color images...
if (d() < 3) return;
@@ -234,7 +244,8 @@ void Fl_RGB_Image::desaturate() {
}
void Fl_RGB_Image::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
if (!array) {
// Don't draw an empty image...
if (!d() || !array) {
draw_empty(XP, YP);
return;
}
@@ -367,5 +378,5 @@ void Fl_RGB_Image::label(Fl_Menu_Item* m) {
//
// End of "$Id: Fl_Image.cxx,v 1.5.2.3.2.11 2001/11/27 17:44:06 easysw Exp $".
// End of "$Id: Fl_Image.cxx,v 1.5.2.3.2.12 2001/12/19 18:15:34 easysw Exp $".
//
+3 -3
View File
@@ -1,5 +1,5 @@
//
// "$Id: Fl_PNM_Image.cxx,v 1.1.2.3 2001/12/11 16:03:12 easysw Exp $"
// "$Id: Fl_PNM_Image.cxx,v 1.1.2.4 2001/12/19 18:15:34 easysw Exp $"
//
// Fl_PNM_Image routines.
//
@@ -75,8 +75,8 @@ Fl_PNM_Image::Fl_PNM_Image(const char *name) // I - File to read
lineptr = fgets(line, sizeof(line), fp);
if (!lineptr) {
Fl::error("Early end-of-file in PNM file \"%s\"!", name);
fclose(fp);
Fl::error("Early end-of-file in PNM file \"%s\"!", name);
return;
}
@@ -166,5 +166,5 @@ Fl_PNM_Image::Fl_PNM_Image(const char *name) // I - File to read
//
// End of "$Id: Fl_PNM_Image.cxx,v 1.1.2.3 2001/12/11 16:03:12 easysw Exp $".
// End of "$Id: Fl_PNM_Image.cxx,v 1.1.2.4 2001/12/19 18:15:34 easysw Exp $".
//
+8 -2
View File
@@ -1,5 +1,5 @@
//
// "$Id: Fl_Shared_Image.cxx,v 1.23.2.4 2001/12/11 16:03:12 easysw Exp $"
// "$Id: Fl_Shared_Image.cxx,v 1.23.2.5 2001/12/19 18:15:34 easysw Exp $"
//
// Shared image code for the Fast Light Tool Kit (FLTK).
//
@@ -363,6 +363,12 @@ Fl_Shared_Image::get(const char *n, int W, int H) {
if ((temp = find(n)) == NULL) {
temp = new Fl_Shared_Image(n);
if (!temp->image_) {
delete temp;
return NULL;
}
temp->add();
}
@@ -376,5 +382,5 @@ Fl_Shared_Image::get(const char *n, int W, int H) {
//
// End of "$Id: Fl_Shared_Image.cxx,v 1.23.2.4 2001/12/11 16:03:12 easysw Exp $".
// End of "$Id: Fl_Shared_Image.cxx,v 1.23.2.5 2001/12/19 18:15:34 easysw Exp $".
//
+2 -5
View File
@@ -1,5 +1,5 @@
//
// "$Id: Fl_Text_Display.cxx,v 1.12.2.8 2001/12/17 15:01:38 easysw Exp $"
// "$Id: Fl_Text_Display.cxx,v 1.12.2.9 2001/12/19 18:15:34 easysw Exp $"
//
// Copyright Mark Edel. Permission to distribute under the LGPL for
// the FLTK library granted by Mark Edel.
@@ -127,9 +127,6 @@ Fl_Text_Display::Fl_Text_Display(int X, int Y, int W, int H, const char* l)
** freed, nor are the style buffer or style table.
*/
Fl_Text_Display::~Fl_Text_Display() {
delete mVScrollBar;
delete mHScrollBar;
if (mBuffer) mBuffer->remove_modify_callback(buffer_modified_cb, this);
delete[] mLineStarts;
}
@@ -1960,5 +1957,5 @@ int Fl_Text_Display::handle(int event) {
//
// End of "$Id: Fl_Text_Display.cxx,v 1.12.2.8 2001/12/17 15:01:38 easysw Exp $".
// End of "$Id: Fl_Text_Display.cxx,v 1.12.2.9 2001/12/19 18:15:34 easysw Exp $".
//
+10 -16
View File
@@ -1,5 +1,5 @@
//
// "$Id: Fl_Tiled_Image.cxx,v 1.1.2.3 2001/12/11 16:03:12 easysw Exp $"
// "$Id: Fl_Tiled_Image.cxx,v 1.1.2.4 2001/12/19 18:15:34 easysw Exp $"
//
// Tiled image code for the Fast Light Tool Kit (FLTK).
//
@@ -74,15 +74,12 @@ Fl_Tiled_Image::copy(int W, // I - New width
void
Fl_Tiled_Image::color_average(Fl_Color c, // I - Color to blend with
float i) { // I - Blend fraction
if (alloc_image_) image_->color_average(c, i);
else {
Fl_Image *temp = image_->copy();
temp->color_average(c, i);
image_ = temp;
if (!alloc_image_) {
image_ = image_->copy();
alloc_image_ = 1;
}
image_->color_average(c, i);
}
@@ -92,15 +89,12 @@ Fl_Tiled_Image::color_average(Fl_Color c, // I - Color to blend with
void
Fl_Tiled_Image::desaturate() {
if (alloc_image_) image_->desaturate();
else {
Fl_Image *temp = image_->copy();
temp->desaturate();
image_ = temp;
if (!alloc_image_) {
image_ = image_->copy();
alloc_image_ = 1;
}
image_->desaturate();
}
@@ -139,5 +133,5 @@ Fl_Tiled_Image::draw(int X, // I - Starting X position
//
// End of "$Id: Fl_Tiled_Image.cxx,v 1.1.2.3 2001/12/11 16:03:12 easysw Exp $".
// End of "$Id: Fl_Tiled_Image.cxx,v 1.1.2.4 2001/12/19 18:15:34 easysw Exp $".
//
+3 -3
View File
@@ -1,5 +1,5 @@
//
// "$Id: Fl_Widget.cxx,v 1.5.2.4.2.10 2001/12/14 16:48:13 easysw Exp $"
// "$Id: Fl_Widget.cxx,v 1.5.2.4.2.11 2001/12/19 18:15:34 easysw Exp $"
//
// Base widget class for the Fast Light Tool Kit (FLTK).
//
@@ -126,7 +126,7 @@ extern void fl_throw_focus(Fl_Widget*); // in Fl_x.cxx
// However, it is only legal to destroy a "root" such as an Fl_Window,
// and automatic destructors may be called.
Fl_Widget::~Fl_Widget() {
parent_ = 0; // kludge to prevent ~Fl_Group from destroying again
if (parent_) parent_->remove(this);
fl_throw_focus(this);
}
@@ -248,5 +248,5 @@ int Fl_Widget::contains(const Fl_Widget *o) const {
}
//
// End of "$Id: Fl_Widget.cxx,v 1.5.2.4.2.10 2001/12/14 16:48:13 easysw Exp $".
// End of "$Id: Fl_Widget.cxx,v 1.5.2.4.2.11 2001/12/19 18:15:34 easysw Exp $".
//
+7 -2
View File
@@ -1,5 +1,5 @@
//
// "$Id: filename_absolute.cxx,v 1.5.2.4.2.3 2001/12/11 16:03:12 easysw Exp $"
// "$Id: filename_absolute.cxx,v 1.5.2.4.2.4 2001/12/19 18:15:34 easysw Exp $"
//
// Filename expansion routines for the Fast Light Tool Kit (FLTK).
//
@@ -68,6 +68,7 @@ int filename_absolute(char *to, int tolen, const char *from) {
if (!a) {
strncpy(to, from, tolen - 1);
to[tolen - 1] = '\0';
delete[] temp;
return 0;
}
#if defined(WIN32) || defined(__EMX__) && !defined(__CYGWIN__)
@@ -134,7 +135,11 @@ filename_relative(char *to, // O - Relative filename
*slash != '\0' && *newslash != '\0';
slash ++, newslash ++)
if (isdirsep(*slash) && isdirsep(*newslash)) continue;
#if defined(WIN32) || defined(__EMX__) || defined(__APPLE__)
else if (tolower(*slash) != tolower(*newslash)) break;
#else
else if (*slash != *newslash) break;
#endif // WIN32 || __EMX__ || __APPLE__
while (!isdirsep(*slash) && slash > from) slash --;
@@ -167,5 +172,5 @@ filename_relative(char *to, // O - Relative filename
//
// End of "$Id: filename_absolute.cxx,v 1.5.2.4.2.3 2001/12/11 16:03:12 easysw Exp $".
// End of "$Id: filename_absolute.cxx,v 1.5.2.4.2.4 2001/12/19 18:15:34 easysw Exp $".
//
+8 -6
View File
@@ -1,5 +1,5 @@
//
// "$Id: filename_isdir.cxx,v 1.4.2.5.2.2 2001/12/04 19:04:15 easysw Exp $"
// "$Id: filename_isdir.cxx,v 1.4.2.5.2.3 2001/12/19 18:15:34 easysw Exp $"
//
// Directory detection routines for the Fast Light Tool Kit (FLTK).
//
@@ -41,15 +41,17 @@ int filename_isdir(const char* n) {
// (read lots of sarcasm in that...)
length = strlen(n);
if (length < (int)(sizeof(fn) - 1)) {
if (length < 4 && isalpha(n[0]) && n[1] == ':') {
if (length < 4 && isalpha(n[0]) && n[1] == ':' &&
(isdirsep(n[2]) || !n[2])) {
// Always use D:/ for drive letters
fn[0] = n[0];
strcpy(fn + 1, ":/");
n = fn;
} else if (length > 0 && (n[length - 1] == '/' || n[length - 1] == '\\')) {
} else if (length > 0 && isdirsep(n[length - 1])) {
// Strip trailing slash from name...
strncpy(fn, n, sizeof(fn) - 1);
fn[length - 1] = '\0';
length --;
memcpy(fn, n, length);
fn[length] = '\0';
n = fn;
}
}
@@ -59,5 +61,5 @@ int filename_isdir(const char* n) {
}
//
// End of "$Id: filename_isdir.cxx,v 1.4.2.5.2.2 2001/12/04 19:04:15 easysw Exp $".
// End of "$Id: filename_isdir.cxx,v 1.4.2.5.2.3 2001/12/19 18:15:34 easysw Exp $".
//
+5 -5
View File
@@ -1,5 +1,5 @@
//
// "$Id: fl_set_fonts_win32.cxx,v 1.5.2.5.2.2 2001/12/03 18:29:49 easysw Exp $"
// "$Id: fl_set_fonts_win32.cxx,v 1.5.2.5.2.3 2001/12/19 18:15:34 easysw Exp $"
//
// WIN32 font utilities for the Fast Light Tool Kit (FLTK).
//
@@ -60,10 +60,10 @@ static int fl_free_font = FL_FREE_FONT;
static int CALLBACK
enumcb(CONST LOGFONT *lpelf,
CONST TEXTMETRIC *lpntm,
int FontType,
DWORD FontType,
LPARAM p) {
if (!p && lpelf->lfCharSet != ANSI_CHARSET) return 1;
char *n = (char*)(lpelf->lfFaceName);
const char *n = lpelf->lfFaceName;
for (int i=0; i<FL_FREE_FONT; i++) // skip if one of our built-in fonts
if (!strcmp(Fl::get_font_name((Fl_Font)i),n)) return 1;
char buffer[LF_FACESIZE + 1];
@@ -80,7 +80,7 @@ enumcb(CONST LOGFONT *lpelf,
Fl_Font Fl::set_fonts(const char* xstarname) {
if (fl_free_font == FL_FREE_FONT) {// if not already been called
if (!fl_gc) fl_GetDC(0);
EnumFontFamilies(fl_gc, NULL, (FONTENUMPROC)enumcb, xstarname != 0);
EnumFontFamilies(fl_gc, NULL, enumcb, xstarname != 0);
}
return (Fl_Font)fl_free_font;
}
@@ -142,5 +142,5 @@ Fl::get_font_sizes(Fl_Font fnum, int*& sizep) {
//
// End of "$Id: fl_set_fonts_win32.cxx,v 1.5.2.5.2.2 2001/12/03 18:29:49 easysw Exp $".
// End of "$Id: fl_set_fonts_win32.cxx,v 1.5.2.5.2.3 2001/12/19 18:15:34 easysw Exp $".
//