mirror of
https://github.com/fltk/fltk.git
synced 2025-12-16 01:26:37 +08:00
Bug fixes and doco updates care of Sebastian.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1799 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
18
CHANGES
18
CHANGES
@@ -21,6 +21,24 @@ CHANGES IN FLTK 1.1.0b7
|
||||
when compiled for debugging under WIN32.
|
||||
- Added plastic box types to forms demo.
|
||||
- Added mousewheel to keyboard demo.
|
||||
- The Fl_Text_Editor widget caused an infinite loop
|
||||
when it received keyboard focus.
|
||||
- filename_isdir() didn't properly handle drive letters
|
||||
properly; WIN32 needs a trailing slash for drive
|
||||
letters by themselves, but cannot have a trailing
|
||||
slash for directory names, go figure...
|
||||
- The Fl_Text_Buffer and Fl_Text_Display classes did not
|
||||
initialize all of their members.
|
||||
- fl_normal_label() had a totally redundant set of
|
||||
if/else tests, which the new code handles all from
|
||||
fl_draw().
|
||||
- The Fl_File_Chooser dialog contained two hotspots.
|
||||
- The fl_draw_pixmap() function didn't free the 2-byte
|
||||
color lookup table properly (delete instead of
|
||||
delete[]).
|
||||
- fl_draw() reset the text color under WIN32, causing
|
||||
bitmaps to draw incorrectly.
|
||||
- Fl::get_font_sizes() is now implemented under WIN32.
|
||||
|
||||
|
||||
CHANGES IN FLTK 1.1.0b6
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Text_Display.H,v 1.4.2.3 2001/10/29 03:44:31 easysw Exp $"
|
||||
// "$Id: Fl_Text_Display.H,v 1.4.2.4 2001/12/03 18:29:49 easysw Exp $"
|
||||
//
|
||||
// Header file for Fl_Text_Display class.
|
||||
//
|
||||
@@ -191,8 +191,6 @@ class Fl_Text_Display: public Fl_Group {
|
||||
int mTopLineNumHint; /* Line number of top displayed line
|
||||
of file (first line of file is 1) */
|
||||
int mHorizOffsetHint; /* Horizontal scroll pos. in pixels */
|
||||
int mVisibility; /* Window visibility (see XVisibility
|
||||
event) */
|
||||
int mNStyles; /* Number of entries in styleTable */
|
||||
Style_Table_Entry *mStyleTable; /* Table of fonts and colors for
|
||||
coloring/syntax-highlighting */
|
||||
@@ -225,5 +223,5 @@ class Fl_Text_Display: public Fl_Group {
|
||||
#endif
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Text_Display.H,v 1.4.2.3 2001/10/29 03:44:31 easysw Exp $".
|
||||
// End of "$Id: Fl_Text_Display.H,v 1.4.2.4 2001/12/03 18:29:49 easysw Exp $".
|
||||
//
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
<!-- NEW PAGE -->
|
||||
|
||||
<H2><A name=Fl_Bitmap>class Fl_Bitmap</A></H2>
|
||||
<H2><A name="Fl_Shared_Image">class Fl_Shared_Image</A></H2>
|
||||
<HR>
|
||||
|
||||
<H3>Class Hierarchy</H3>
|
||||
@@ -11,41 +11,79 @@
|
||||
<UL><PRE>
|
||||
<A href="Fl_Image.html">Fl_Image</A>
|
||||
|
|
||||
+----<B>Fl_Bitmap</B>
|
||||
|
|
||||
+----<A href="Fl_XBM_Image.html">Fl_XBM_Image</A>
|
||||
+----<B>Fl_Shared_Image</B>
|
||||
</PRE></UL>
|
||||
|
||||
<H3>Include Files</H3>
|
||||
|
||||
<UL><PRE>
|
||||
#include <FL/Fl_Bitmap.H>
|
||||
#include <FL/Fl_Shared_Image.H>
|
||||
</PRE></UL>
|
||||
|
||||
<H3>Description</H3>
|
||||
|
||||
<P>The <TT>Fl_Bitmap</TT> class supports caching and drawing of mono-color
|
||||
(bitmap) images. Images are drawn using the current color.</P>
|
||||
<P>The <TT>Fl_Shared_Image</TT> class supports caching, loading, and
|
||||
drawing of image files. </P>
|
||||
|
||||
<H3>Methods</H3>
|
||||
|
||||
<UL>
|
||||
|
||||
<LI><A href="#Fl_Bitmap.Fl_Bitmap">Fl_Bitmap</A></LI>
|
||||
<LI><A href="#Fl_Shared_Image.Fl_Shared_Image">Fl_Shared_Image</A></LI>
|
||||
|
||||
<LI><A href="#Fl_Bitmap.~Fl_Bitmap">~Fl_Bitmap</A></LI>
|
||||
<LI><A href="#Fl_Shared_Image.~Fl_Shared_Image">~Fl_Shared_Image</A></LI>
|
||||
|
||||
<LI><A href="#Fl_Shared_Image.find">find</A></LI>
|
||||
|
||||
<LI><A href="#Fl_Shared_Image.get">get</A></LI>
|
||||
|
||||
<LI><A href="#Fl_Shared_Image.images">images</A></LI>
|
||||
|
||||
<LI><A href="#Fl_Shared_Image.name">name</A></LI>
|
||||
|
||||
<LI><A href="#Fl_Shared_Image.num_images">num_images</A></LI>
|
||||
|
||||
<LI><A href="#Fl_Shared_Image.refcount">refcount</A></LI>
|
||||
|
||||
<LI><A href="#Fl_Shared_Image.release">release</A></LI>
|
||||
|
||||
<LI><A href="#Fl_Shared_Image.reload">reload</A></LI>
|
||||
|
||||
</UL>
|
||||
|
||||
<H4><A name="Fl_Bitmap.Fl_Bitmap">Fl_Bitmap::Fl_Bitmap(const char *array, int W, int H);<BR>
|
||||
Fl_Bitmap::Fl_Bitmap(const unsigned char *array, int W, int H);</A></H4>
|
||||
<H4><A name="Fl_Shared_Image.Fl_Shared_Image">protected Fl_Shared_Image::Fl_Shared_Image();<BR>
|
||||
protected Fl_Shared_Image::Fl_Shared_Image(const char *name, Fl_Image *img);</A></H4>
|
||||
|
||||
<P>The constructors create a new bitmap from the specified bitmap data.</P>
|
||||
<P>The constructors create a new shared image record in the
|
||||
image cache.
|
||||
|
||||
<H4><A name="Fl_Bitmap.~Fl_Bitmap">Fl_Bitmap::~Fl_Bitmap();</A></H4>
|
||||
<P>The constructors are protected and cannot be used directly
|
||||
from a program. Use the <A
|
||||
HREF="#Fl_Shared_Image.get"><TT>get()</TT></A> method instead.
|
||||
|
||||
<P>The destructor free all memory and server resources that are used by
|
||||
the bitmap.</P>
|
||||
<H4><A name="Fl_Shared_Image.~Fl_Shared_Image">protected Fl_Shared_Image::~Fl_Shared_Image();</A></H4>
|
||||
|
||||
<P>The destructor free all memory and server resources that are
|
||||
used by the image. The destructor is protected and cannot be
|
||||
used directly from a program. Use the <A
|
||||
HREF="#Fl_Shared_Image.release"><TT>release()</TT></A> method
|
||||
instead.
|
||||
|
||||
<H4><A NAME="Fl_Shared_Image.find">static Fl_Shared_Image *find(const char *n, int W = 0, int H = 0);</A></H4>
|
||||
|
||||
<H4><A NAME="Fl_Shared_Image.get">static Fl_Shared_Image *get(const char *n, int W = 0, int H = 0);</A></H4>
|
||||
|
||||
<H4><A NAME="Fl_Shared_Image.images">static Fl_Shared_Image **images();</A></H4>
|
||||
|
||||
<H4><A NAME="Fl_Shared_Image.name">const char *name();</A></H4>
|
||||
|
||||
<H4><A NAME="Fl_Shared_Image.num_images">static int num_images();</A></H4>
|
||||
|
||||
<H4><A NAME="Fl_Shared_Image.refcount">int refcount();</A></H4>
|
||||
|
||||
<H4><A NAME="Fl_Shared_Image.release">void release();</A></H4>
|
||||
|
||||
<H4><A NAME="Fl_Shared_Image.reload">void reload();</A></H4>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
<!-- NEW PAGE -->
|
||||
|
||||
<H2><A name=Fl_Input>class Fl_Input</A></H2>
|
||||
<H2><A name="Fl_Text_Display">class Fl_Text_Display</A></H2>
|
||||
|
||||
<HR>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
<!-- NEW PAGE -->
|
||||
|
||||
<H2><A name=Fl_Bitmap>class Fl_Bitmap</A></H2>
|
||||
<H2><A name=Fl_Tiled_Image>class Fl_Tiled_Image</A></H2>
|
||||
<HR>
|
||||
|
||||
<H3>Class Hierarchy</H3>
|
||||
@@ -11,41 +11,38 @@
|
||||
<UL><PRE>
|
||||
<A href="Fl_Image.html">Fl_Image</A>
|
||||
|
|
||||
+----<B>Fl_Bitmap</B>
|
||||
|
|
||||
+----<A href="Fl_XBM_Image.html">Fl_XBM_Image</A>
|
||||
+----<B>Fl_Tiled_Image</B>
|
||||
</PRE></UL>
|
||||
|
||||
<H3>Include Files</H3>
|
||||
|
||||
<UL><PRE>
|
||||
#include <FL/Fl_Bitmap.H>
|
||||
#include <FL/Fl_Tiled_Image.H>
|
||||
</PRE></UL>
|
||||
|
||||
<H3>Description</H3>
|
||||
|
||||
<P>The <TT>Fl_Bitmap</TT> class supports caching and drawing of mono-color
|
||||
(bitmap) images. Images are drawn using the current color.</P>
|
||||
<P>The <TT>Fl_Tiled_Image</TT> class supports tiling of images over a
|
||||
specified area.</P>
|
||||
|
||||
<H3>Methods</H3>
|
||||
|
||||
<UL>
|
||||
|
||||
<LI><A href="#Fl_Bitmap.Fl_Bitmap">Fl_Bitmap</A></LI>
|
||||
<LI><A href="#Fl_Tiled_Image.Fl_Tiled_Image">Fl_Tiled_Image</A></LI>
|
||||
|
||||
<LI><A href="#Fl_Bitmap.~Fl_Bitmap">~Fl_Bitmap</A></LI>
|
||||
<LI><A href="#Fl_Tiled_Image.~Fl_Tiled_Image">~Fl_Tiled_Image</A></LI>
|
||||
|
||||
</UL>
|
||||
|
||||
<H4><A name="Fl_Bitmap.Fl_Bitmap">Fl_Bitmap::Fl_Bitmap(const char *array, int W, int H);<BR>
|
||||
Fl_Bitmap::Fl_Bitmap(const unsigned char *array, int W, int H);</A></H4>
|
||||
<H4><A name="Fl_Tiled_Image.Fl_Tiled_Image">Fl_Tiled_Image::Fl_Tiled_Image(Fl_Image *img, int W, int H);</A></H4>
|
||||
|
||||
<P>The constructors create a new bitmap from the specified bitmap data.</P>
|
||||
<P>The constructors create a new tiled image containing the specified image.</P>
|
||||
|
||||
<H4><A name="Fl_Bitmap.~Fl_Bitmap">Fl_Bitmap::~Fl_Bitmap();</A></H4>
|
||||
<H4><A name="Fl_Tiled_Image.~Fl_Tiled_Image">Fl_Tiled_Image::~Fl_Tiled_Image();</A></H4>
|
||||
|
||||
<P>The destructor free all memory and server resources that are used by
|
||||
the bitmap.</P>
|
||||
the tiled image.</P>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
||||
@@ -105,7 +105,6 @@ Fl_File_Chooser::Fl_File_Chooser(const char *d, const char *p, int t, const char
|
||||
{ Fl_Window* o = window = new Fl_Window(375, 315, "Pick a File");
|
||||
w = o;
|
||||
o->callback((Fl_Callback*)cb_window, (void*)(this));
|
||||
w->hotspot(o);
|
||||
{ Fl_File_Browser* o = fileList = new Fl_File_Browser(10, 45, 355, 180);
|
||||
o->type(2);
|
||||
o->callback((Fl_Callback*)cb_fileList);
|
||||
|
||||
@@ -16,7 +16,7 @@ class Fl_File_Chooser {open
|
||||
callback {fileList->deselect();
|
||||
fileName->value("");
|
||||
window->hide();} open
|
||||
private xywh {99 225 375 315} resizable hotspot
|
||||
private xywh {99 225 375 315} resizable
|
||||
code0 {if (title) window->label(title);}
|
||||
code1 {\#include <stdio.h>}
|
||||
code2 {\#include <stdlib.h>}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Text_Buffer.cxx,v 1.9.2.1 2001/08/04 12:21:33 easysw Exp $"
|
||||
// "$Id: Fl_Text_Buffer.cxx,v 1.9.2.2 2001/12/03 18:29:49 easysw Exp $"
|
||||
//
|
||||
// Copyright Mark Edel. Permission to distribute under the LGPL for
|
||||
// the FLTK library granted by Mark Edel.
|
||||
@@ -92,6 +92,7 @@ Fl_Text_Buffer::Fl_Text_Buffer( int requestedSize ) {
|
||||
mNodifyProcs = NULL;
|
||||
mCbArgs = NULL;
|
||||
mNModifyProcs = 0;
|
||||
mCursorPosHint = 0;
|
||||
mNullSubsChar = '\0';
|
||||
#ifdef PURIFY
|
||||
{ int i; for (i = mGapStart; i < mGapEnd; i++) mBuf[ i ] = '.'; }
|
||||
@@ -2283,5 +2284,5 @@ Fl_Text_Buffer::outputfile(const char *file, int start, int end, int buflen) {
|
||||
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Text_Buffer.cxx,v 1.9.2.1 2001/08/04 12:21:33 easysw Exp $".
|
||||
// End of "$Id: Fl_Text_Buffer.cxx,v 1.9.2.2 2001/12/03 18:29:49 easysw Exp $".
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Text_Display.cxx,v 1.12.2.3 2001/10/29 03:44:32 easysw Exp $"
|
||||
// "$Id: Fl_Text_Display.cxx,v 1.12.2.4 2001/12/03 18:29:49 easysw Exp $"
|
||||
//
|
||||
// Copyright Mark Edel. Permission to distribute under the LGPL for
|
||||
// the FLTK library granted by Mark Edel.
|
||||
@@ -76,16 +76,18 @@ Fl_Text_Display::Fl_Text_Display(int X, int Y, int W, int H, const char* l)
|
||||
textcolor(FL_BLACK);
|
||||
textfont(FL_HELVETICA);
|
||||
|
||||
Fl_Group* current = Fl_Group::current();
|
||||
Fl_Group::current(this);
|
||||
text_area.x = 0;
|
||||
text_area.y = 0;
|
||||
text_area.w = 0;
|
||||
text_area.h = 0;
|
||||
|
||||
mVScrollBar = new Fl_Scrollbar(0,0,0,0);
|
||||
mVScrollBar = new Fl_Scrollbar(0,0,1,1);
|
||||
mVScrollBar->callback((Fl_Callback*)v_scrollbar_cb, this);
|
||||
mHScrollBar = new Fl_Scrollbar(0,0,0,0);
|
||||
mHScrollBar = new Fl_Scrollbar(0,0,1,1);
|
||||
mHScrollBar->callback((Fl_Callback*)h_scrollbar_cb, this);
|
||||
mHScrollBar->type(FL_HORIZONTAL);
|
||||
|
||||
Fl_Group::current(current);
|
||||
end();
|
||||
|
||||
scrollbar_width(16);
|
||||
scrollbar_align(FL_ALIGN_BOTTOM_RIGHT);
|
||||
@@ -112,6 +114,10 @@ Fl_Text_Display::Fl_Text_Display(int X, int Y, int W, int H, const char* l)
|
||||
mNVisibleLines = 1;
|
||||
mLineStarts = new int[mNVisibleLines];
|
||||
mLineStarts[0] = 0;
|
||||
|
||||
mUnfinishedStyle = 0;
|
||||
mUnfinishedHighlightCB = 0;
|
||||
mHighlightCBArg = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1950,5 +1956,5 @@ int Fl_Text_Display::handle(int event) {
|
||||
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Text_Display.cxx,v 1.12.2.3 2001/10/29 03:44:32 easysw Exp $".
|
||||
// End of "$Id: Fl_Text_Display.cxx,v 1.12.2.4 2001/12/03 18:29:49 easysw Exp $".
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Text_Editor.cxx,v 1.9.2.2 2001/11/27 17:44:06 easysw Exp $"
|
||||
// "$Id: Fl_Text_Editor.cxx,v 1.9.2.3 2001/12/03 18:29:49 easysw Exp $"
|
||||
//
|
||||
// Copyright Mark Edel. Permission to distribute under the LGPL for
|
||||
// the FLTK library granted by Mark Edel.
|
||||
@@ -409,7 +409,7 @@ int Fl_Text_Editor::handle(int event) {
|
||||
switch (event) {
|
||||
case FL_FOCUS:
|
||||
show_cursor(mCursorOn); // redraws the cursor
|
||||
take_focus();
|
||||
Fl::focus(this);
|
||||
return 1;
|
||||
|
||||
case FL_UNFOCUS:
|
||||
@@ -438,5 +438,5 @@ int Fl_Text_Editor::handle(int event) {
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Text_Editor.cxx,v 1.9.2.2 2001/11/27 17:44:06 easysw Exp $".
|
||||
// End of "$Id: Fl_Text_Editor.cxx,v 1.9.2.3 2001/12/03 18:29:49 easysw Exp $".
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: filename_isdir.cxx,v 1.4.2.5 2001/01/22 15:13:40 easysw Exp $"
|
||||
// "$Id: filename_isdir.cxx,v 1.4.2.5.2.1 2001/12/03 18:29:49 easysw Exp $"
|
||||
//
|
||||
// Directory detection routines for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@@ -25,28 +25,39 @@
|
||||
|
||||
// Used by fl_file_chooser
|
||||
|
||||
#include <config.h>
|
||||
#include <FL/filename.H>
|
||||
#include "flstring.h"
|
||||
#include <sys/stat.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <FL/filename.H>
|
||||
|
||||
|
||||
int filename_isdir(const char* n) {
|
||||
struct stat s;
|
||||
|
||||
#ifdef WIN32
|
||||
char fn[1024];
|
||||
int length;
|
||||
// This workaround brought to you by the fine folks at Microsoft!
|
||||
// (read lots of sarcasm in that...)
|
||||
strncpy(fn, n, sizeof(fn) - 1);
|
||||
fn[sizeof(fn) - 1] = '\0';
|
||||
length = strlen(fn);
|
||||
if (length > 0 && (fn[length - 1] == '/' || fn[length - 1] == '\\'))
|
||||
fn[length - 1] = '\0'; // Strip trailing slash...
|
||||
n = fn;
|
||||
length = strlen(n);
|
||||
if (length < (int)(sizeof(fn) - 1)) {
|
||||
if (length < 4 && isletter(n[0]) && n[1] == ':') {
|
||||
// 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] == '\\')) {
|
||||
// Strip trailing slash from name...
|
||||
strncpy(fn, n, sizeof(fn) - 1);
|
||||
fn[length - 1] = '\0';
|
||||
n = fn;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return !stat(n, &s) && (s.st_mode&0170000)==0040000;
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: filename_isdir.cxx,v 1.4.2.5 2001/01/22 15:13:40 easysw Exp $".
|
||||
// End of "$Id: filename_isdir.cxx,v 1.4.2.5.2.1 2001/12/03 18:29:49 easysw Exp $".
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: fl_draw_pixmap.cxx,v 1.4.2.8.2.4 2001/11/27 17:44:08 easysw Exp $"
|
||||
// "$Id: fl_draw_pixmap.cxx,v 1.4.2.8.2.5 2001/12/03 18:29:49 easysw Exp $"
|
||||
//
|
||||
// Pixmap drawing code for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@@ -268,10 +268,10 @@ int fl_draw_pixmap(const char*const* di, int x, int y, Fl_Color bg) {
|
||||
}
|
||||
|
||||
fl_draw_image(chars_per_pixel==1 ? cb1 : cb2, &d, x, y, d.w, d.h, 4);
|
||||
if (chars_per_pixel > 1) for (int i = 0; i < 256; i++) delete d.byte1[i];
|
||||
if (chars_per_pixel > 1) for (int i = 0; i < 256; i++) delete[] d.byte1[i];
|
||||
return 1;
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: fl_draw_pixmap.cxx,v 1.4.2.8.2.4 2001/11/27 17:44:08 easysw Exp $".
|
||||
// End of "$Id: fl_draw_pixmap.cxx,v 1.4.2.8.2.5 2001/12/03 18:29:49 easysw Exp $".
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: fl_font_win32.cxx,v 1.9.2.3 2001/01/22 15:13:41 easysw Exp $"
|
||||
// "$Id: fl_font_win32.cxx,v 1.9.2.3.2.1 2001/12/03 18:29:49 easysw Exp $"
|
||||
//
|
||||
// WIN32 font selection routines for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@@ -164,9 +164,10 @@ double fl_width(uchar c) {
|
||||
}
|
||||
|
||||
void fl_draw(const char* str, int n, int x, int y) {
|
||||
SetTextColor(fl_gc, fl_RGB());
|
||||
COLORREF oldColor = SetTextColor(fl_gc, fl_RGB());
|
||||
SelectObject(fl_gc, fl_fontsize->fid);
|
||||
TextOut(fl_gc, x, y, str, n);
|
||||
SetTextColor(fl_gc, oldColor);
|
||||
}
|
||||
|
||||
void fl_draw(const char* str, int x, int y) {
|
||||
@@ -174,5 +175,5 @@ void fl_draw(const char* str, int x, int y) {
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: fl_font_win32.cxx,v 1.9.2.3 2001/01/22 15:13:41 easysw Exp $".
|
||||
// End of "$Id: fl_font_win32.cxx,v 1.9.2.3.2.1 2001/12/03 18:29:49 easysw Exp $".
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: fl_labeltype.cxx,v 1.6.2.3.2.4 2001/10/29 03:44:33 easysw Exp $"
|
||||
// "$Id: fl_labeltype.cxx,v 1.6.2.3.2.5 2001/12/03 18:29:49 easysw Exp $"
|
||||
//
|
||||
// Label drawing routines for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@@ -41,16 +41,7 @@ fl_normal_label(const Fl_Label* o, int X, int Y, int W, int H, Fl_Align align)
|
||||
{
|
||||
fl_font(o->font, o->size);
|
||||
fl_color((Fl_Color)o->color);
|
||||
if (o->image) {
|
||||
if (align & FL_ALIGN_TEXT_OVER_IMAGE) {
|
||||
fl_draw(o->value, X, Y, W, H, align, o->image);
|
||||
} else {
|
||||
fl_draw(o->value, X, Y, W, H, align, o->image);
|
||||
}
|
||||
}
|
||||
else {
|
||||
fl_draw(o->value, X, Y, W, H, align, o->image);
|
||||
}
|
||||
fl_draw(o->value, X, Y, W, H, align, o->image);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -136,5 +127,5 @@ void Fl_Widget::draw_label(int X, int Y, int W, int H, Fl_Align a) const {
|
||||
#include <FL/Fl_Input_.H>
|
||||
|
||||
//
|
||||
// End of "$Id: fl_labeltype.cxx,v 1.6.2.3.2.4 2001/10/29 03:44:33 easysw Exp $".
|
||||
// End of "$Id: fl_labeltype.cxx,v 1.6.2.3.2.5 2001/12/03 18:29:49 easysw Exp $".
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: fl_set_fonts_win32.cxx,v 1.5.2.5.2.1 2001/11/26 20:13:29 easysw Exp $"
|
||||
// "$Id: fl_set_fonts_win32.cxx,v 1.5.2.5.2.2 2001/12/03 18:29:49 easysw Exp $"
|
||||
//
|
||||
// WIN32 font utilities for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@@ -23,7 +23,7 @@
|
||||
// Please report all bugs and problems to "fltk-bugs@fltk.org".
|
||||
//
|
||||
|
||||
// This function fills in the fltk font table with all the fonts that
|
||||
// This function fills in the FLTK font table with all the fonts that
|
||||
// are found on the X server. It tries to place the fonts into families
|
||||
// and to sort them so the first 4 in a family are normal, bold, italic,
|
||||
// and bold italic.
|
||||
@@ -57,19 +57,22 @@ const char* Fl::get_font_name(Fl_Font fnum, int* ap) {
|
||||
|
||||
static int fl_free_font = FL_FREE_FONT;
|
||||
|
||||
static int CALLBACK enumcb(ENUMLOGFONT FAR *lpelf,
|
||||
NEWTEXTMETRIC FAR *lpntm, int FontType, LPARAM p) {
|
||||
if (!p && lpelf->elfLogFont.lfCharSet != ANSI_CHARSET) return 1;
|
||||
char *n = (char*)(lpelf->elfFullName);
|
||||
static int CALLBACK
|
||||
enumcb(CONST LOGFONT *lpelf,
|
||||
CONST TEXTMETRIC *lpntm,
|
||||
int FontType,
|
||||
LPARAM p) {
|
||||
if (!p && lpelf->lfCharSet != ANSI_CHARSET) return 1;
|
||||
char *n = (char*)(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[128];
|
||||
char buffer[LF_FACESIZE + 1];
|
||||
strcpy(buffer+1, n);
|
||||
buffer[0] = ' '; Fl::set_font((Fl_Font)(fl_free_font++), strdup(buffer));
|
||||
if (lpelf->elfLogFont.lfWeight <= 400)
|
||||
if (lpelf->lfWeight <= 400)
|
||||
buffer[0] = 'B', Fl::set_font((Fl_Font)(fl_free_font++), strdup(buffer));
|
||||
buffer[0] = 'I'; Fl::set_font((Fl_Font)(fl_free_font++), strdup(buffer));
|
||||
if (lpelf->elfLogFont.lfWeight <= 400)
|
||||
if (lpelf->lfWeight <= 400)
|
||||
buffer[0] = 'P', Fl::set_font((Fl_Font)(fl_free_font++), strdup(buffer));
|
||||
return 1;
|
||||
}
|
||||
@@ -82,14 +85,62 @@ Fl_Font Fl::set_fonts(const char* xstarname) {
|
||||
return (Fl_Font)fl_free_font;
|
||||
}
|
||||
|
||||
int Fl::get_font_sizes(Fl_Font fnum, int*& sizep) {
|
||||
// pretend all fonts are scalable (most are and I don't know how
|
||||
// to tell anyways)
|
||||
static int array[1];
|
||||
sizep = array;
|
||||
return 1;
|
||||
|
||||
static int nbSize;
|
||||
static int cyPerInch;
|
||||
static int sizes[128];
|
||||
|
||||
static int CALLBACK
|
||||
EnumSizeCb(CONST LOGFONT *lpelf,
|
||||
CONST TEXTMETRIC *lpntm,
|
||||
DWORD fontType,
|
||||
LPARAM p) {
|
||||
if ((fontType & RASTER_FONTTYPE) == 0) {
|
||||
sizes[0] = 0;
|
||||
nbSize = 1;
|
||||
|
||||
// Scalable font
|
||||
return 0;
|
||||
}
|
||||
|
||||
int add = lpntm->tmHeight - lpntm->tmInternalLeading;
|
||||
add = MulDiv(add, 72, cyPerInch);
|
||||
|
||||
int start = 0;
|
||||
while ((start < nbSize) && (sizes[start] < add)) {
|
||||
start++;
|
||||
}
|
||||
|
||||
if ((start < nbSize) && (sizes[start] == add)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (int i=nbSize; i>start; i--) sizes[i] = sizes[i - 1];
|
||||
|
||||
sizes[start] = add;
|
||||
nbSize++;
|
||||
|
||||
// Stop enum if buffer overflow
|
||||
return nbSize < 128;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
Fl::get_font_sizes(Fl_Font fnum, int*& sizep) {
|
||||
nbSize = 0;
|
||||
Fl_Fontdesc *s = fl_fonts+fnum;
|
||||
if (!s->name) s = fl_fonts; // empty slot in table, use entry 0
|
||||
|
||||
if (!fl_gc) fl_GetDC(0);
|
||||
cyPerInch = GetDeviceCaps(fl_gc, LOGPIXELSY);
|
||||
if (cyPerInch < 1) cyPerInch = 1;
|
||||
EnumFontFamilies(fl_gc, s->name+1, EnumSizeCb, 0);
|
||||
|
||||
sizep = sizes;
|
||||
return nbSize;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// End of "$Id: fl_set_fonts_win32.cxx,v 1.5.2.5.2.1 2001/11/26 20:13:29 easysw Exp $".
|
||||
// End of "$Id: fl_set_fonts_win32.cxx,v 1.5.2.5.2.2 2001/12/03 18:29:49 easysw Exp $".
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user