Skip to content

Commit

Permalink
Documentation updates (STR #505, STR #513)
Browse files Browse the repository at this point in the history
The old source file "fl_set_gray.cxx" is not needed (STR #516)

Fl_Text_Display still called delete[] instead of free() in one
place (STR #503)

Fl_File_Chooser didn't correctly call isprint() and isspace()
when checking to see if the current file was text that can be
previewed (STR #517)

FLUID didn't compile with Borland C++ due to a compiler bug (STR
#496)

Fl_Positioner did not handle reversed min and max values (STR
#510)

fl_descent(), fl_height(), and fl_width() would crash a program
if you didn't call fl_font() first; they now return -1 if no
font is set (STR #500)


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@3805 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
  • Loading branch information
michaelrsweet committed Sep 7, 2004
1 parent d7fe924 commit a8b58dc
Show file tree
Hide file tree
Showing 12 changed files with 100 additions and 98 deletions.
17 changes: 17 additions & 0 deletions CHANGES
@@ -1,5 +1,22 @@
CHANGES IN FLTK 1.1.5rc3

- Documentation updates (STR #505, STR #513)
- The old source file "fl_set_gray.cxx" is not needed
(STR #516)
- Fl_Text_Display still called delete[] instead of
free() in one place (STR #503)
- The symbol test program did not handle the @+ symbol
properly (STR #490)
- Fl_File_Chooser didn't correctly call isprint() and
isspace() when checking to see if the current file was
text that can be previewed (STR #517)
- FLUID didn't compile with Borland C++ due to a
compiler bug (STR #496)
- Fl_Positioner did not handle reversed min and max
values (STR #510)
- fl_descent(), fl_height(), and fl_width() would crash
a program if you didn't call fl_font() first; they now
return -1 if no font is set (STR #500)
- Added test/unittests to verify pixel drawing and
alignment across platforms
- Fl_Menu_::find_item() didn't determine the menu path
Expand Down
18 changes: 15 additions & 3 deletions documentation/Fl_Group.html
Expand Up @@ -81,7 +81,12 @@ <H4><A name=Fl_Group.add>void Fl_Group::add(Fl_Widget &amp;w)

<H4><A name="Fl_Group.clear">void Fl_Group::clear()</A></H4>

<P>The <TT>clear()</TT> method deletes all child widgets recursively.
<p>The <tt>clear()</tt> method deletes all child widgets from
memory recursively.</p>

<p>This method differs from the <a
href='#Fl_Group.remove'><tt>remove()</tt></a> method in that it
affects all child widgets and deletes them from memory.</p>

<H4><A name="Fl_Group.init_sizes">void Fl_Group::init_sizes()</A></H4>

Expand All @@ -104,8 +109,15 @@ <H4>void Fl_Group::insert(Fl_Widget &amp;w, Fl_Widget* beforethis)</H4>
widget if <tt>beforethis</tt> is not in the group.

<H4><A name=Fl_Group.remove>void Fl_Group::remove(Fl_Widget &amp;w)</A></H4>
Removes a widget from the group. This does nothing if the widget is
not currently a child of this group.

<p>Removes a widget from the group but does not delete it. This
method does nothing if the widget is not a child of the
group.</p>

<p>This method differs from the <a
href='#Fl_Group.clear'><tt>clear()</tt></a> method in that it
only affects a single widget and does not delete it from
memory.</p>

<H4><A name=Fl_Group.current>static Fl_Group *Fl_Group::current()
<BR> static void Fl_Group::current(Fl_Group *w)</A></H4>
Expand Down
7 changes: 6 additions & 1 deletion documentation/osissues.html
Expand Up @@ -333,7 +333,7 @@ <H4>virtual void Fl_Window::~Fl_Window()</H4>

<H3>Setting the Icon of a Window</H3>

<P>FLTK currently supports setting a window's icon *before* it
<P>FLTK currently supports setting a window's icon <b>before</b> it
is shown using the <TT>Fl_Window::icon()</TT> method.

<H4>void Fl_Window::icon(char *)</H4>
Expand All @@ -358,6 +358,7 @@ <H4>void Fl_Window::icon(char *)</H4>
should be used as follows:

<UL><PRE>
#include &lt;X11/xpm.h&gt;
#include &quot;icon.xpm&quot;

fl_opendisplay(); // needed if display has not been previously opened
Expand All @@ -370,6 +371,10 @@ <H4>void Fl_Window::icon(char *)</H4>
window-&gt;icon((char *)p);
</PRE></UL>

<p>When using the Xpm library, be sure to include it in the list
of libraries that are used to link the application (usually
"-lXpm").</p>

<CENTER><TABLE WIDTH="90%" BORDER="1" CELLPADDING="5" CELLSPACING="0" BGCOLOR="#cccccc">
<TR>
<TD><B>NOTE:</B>
Expand Down
6 changes: 3 additions & 3 deletions fluid/fluid.cxx
@@ -1,5 +1,5 @@
//
// "$Id: fluid.cxx,v 1.15.2.13.2.44 2004/04/11 04:38:56 easysw Exp $"
// "$Id: fluid.cxx,v 1.15.2.13.2.45 2004/09/07 20:59:16 easysw Exp $"
//
// FLUID main entry for the Fast Light Tool Kit (FLTK).
//
Expand Down Expand Up @@ -135,7 +135,7 @@ void save_position(Fl_Window *w, const char *prefsName) {
pos.set("y", w->y());
pos.set("w", w->w());
pos.set("h", w->h());
pos.set("visible", w->shown() && w->visible() );
pos.set("visible", (int)(w->shown() && w->visible()));
}

Fl_Window *main_window;
Expand Down Expand Up @@ -886,5 +886,5 @@ int main(int argc,char **argv) {
}

//
// End of "$Id: fluid.cxx,v 1.15.2.13.2.44 2004/04/11 04:38:56 easysw Exp $".
// End of "$Id: fluid.cxx,v 1.15.2.13.2.45 2004/09/07 20:59:16 easysw Exp $".
//
8 changes: 5 additions & 3 deletions src/Fl_File_Chooser2.cxx
@@ -1,5 +1,5 @@
//
// "$Id: Fl_File_Chooser2.cxx,v 1.1.2.37 2004/07/26 20:52:51 easysw Exp $"
// "$Id: Fl_File_Chooser2.cxx,v 1.1.2.38 2004/09/07 20:59:16 easysw Exp $"
//
// More Fl_File_Chooser routines.
//
Expand Down Expand Up @@ -935,7 +935,9 @@ Fl_File_Chooser::update_preview()
Fl::check();

// Scan the buffer for printable chars...
for (ptr = preview_text_; *ptr && (isprint(*ptr) || isspace(*ptr)); ptr ++);
for (ptr = preview_text_;
*ptr && (isprint(*ptr & 255) || isspace(*ptr & 255));
ptr ++);

if (*ptr || ptr == preview_text_) {
// Non-printable file, just show a big ?...
Expand Down Expand Up @@ -1158,5 +1160,5 @@ unquote_pathname(char *dst, // O - Destination string


//
// End of "$Id: Fl_File_Chooser2.cxx,v 1.1.2.37 2004/07/26 20:52:51 easysw Exp $".
// End of "$Id: Fl_File_Chooser2.cxx,v 1.1.2.38 2004/09/07 20:59:16 easysw Exp $".
//
22 changes: 16 additions & 6 deletions src/Fl_Positioner.cxx
@@ -1,5 +1,5 @@
//
// "$Id: Fl_Positioner.cxx,v 1.4.2.3.2.5 2004/07/27 16:02:21 easysw Exp $"
// "$Id: Fl_Positioner.cxx,v 1.4.2.3.2.6 2004/09/07 20:59:17 easysw Exp $"
//
// Positioner widget for the Fast Light Tool Kit (FLTK).
//
Expand Down Expand Up @@ -81,12 +81,22 @@ int Fl_Positioner::handle(int event, int X, int Y, int W, int H) {
double h1 = H - 2 * 4;
double xx = flinear(Fl::event_x(), x1, x1+w1-1.0, xmin, xmax);
if (xstep_) xx = int(xx/xstep_+0.5) * xstep_;
if (xx < xmin) xx = xmin;
if (xx > xmax) xx = xmax;
if (xmin < xmax) {
if (xx < xmin) xx = xmin;
if (xx > xmax) xx = xmax;
} else {
if (xx > xmin) xx = xmin;
if (xx < xmax) xx = xmax;
}
double yy = flinear(Fl::event_y(), y1, y1+h1-1.0, ymin, ymax);
if (ystep_) yy = int(yy/ystep_+0.5) * ystep_;
if (yy < ymin) yy = ymin;
if (yy > ymax) yy = ymax;
if (ymin < ymax) {
if (yy < ymin) yy = ymin;
if (yy > ymax) yy = ymax;
} else {
if (yy > ymin) yy = ymin;
if (yy < ymax) yy = ymax;
}
if (value(xx, yy)) set_changed();}
if (!(when() & FL_WHEN_CHANGED ||
(when() & FL_WHEN_RELEASE && event == FL_RELEASE))) return 1;
Expand Down Expand Up @@ -131,5 +141,5 @@ void Fl_Positioner::ybounds(double a, double b) {
}

//
// End of "$Id: Fl_Positioner.cxx,v 1.4.2.3.2.5 2004/07/27 16:02:21 easysw Exp $".
// End of "$Id: Fl_Positioner.cxx,v 1.4.2.3.2.6 2004/09/07 20:59:17 easysw Exp $".
//
6 changes: 3 additions & 3 deletions src/Fl_Text_Display.cxx
@@ -1,5 +1,5 @@
//
// "$Id: Fl_Text_Display.cxx,v 1.12.2.56 2004/07/27 18:40:29 easysw Exp $"
// "$Id: Fl_Text_Display.cxx,v 1.12.2.57 2004/09/07 20:59:17 easysw Exp $"
//
// Copyright 2001-2004 by Bill Spitzak and others.
// Original code Copyright Mark Edel. Permission to distribute under
Expand Down Expand Up @@ -1888,7 +1888,7 @@ int Fl_Text_Display::xy_to_position( int X, int Y, int posType ) {
charStyle = position_style( lineStart, lineLen, charIndex, outIndex );
charWidth = string_width( expandedChar, charLen, charStyle );
if ( X < xStep + ( posType == CURSOR_POS ? charWidth / 2 : charWidth ) ) {
delete [] (char *)lineStr;
free((char *)lineStr);
return lineStart + charIndex;
}
xStep += charWidth;
Expand Down Expand Up @@ -3131,5 +3131,5 @@ int Fl_Text_Display::handle(int event) {


//
// End of "$Id: Fl_Text_Display.cxx,v 1.12.2.56 2004/07/27 18:40:29 easysw Exp $".
// End of "$Id: Fl_Text_Display.cxx,v 1.12.2.57 2004/09/07 20:59:17 easysw Exp $".
//
10 changes: 6 additions & 4 deletions src/fl_font_mac.cxx
@@ -1,5 +1,5 @@
//
// "$Id: fl_font_mac.cxx,v 1.1.2.19 2004/08/27 20:02:45 matthiaswm Exp $"
// "$Id: fl_font_mac.cxx,v 1.1.2.20 2004/09/07 20:59:17 easysw Exp $"
//
// MacOS font selection routines for the Fast Light Tool Kit (FLTK).
//
Expand Down Expand Up @@ -163,11 +163,13 @@ void fl_font(int fnum, int size) {
}

int fl_height() {
return fl_fontsize->ascent+fl_fontsize->descent;
if (fl_fontsize) return fl_fontsize->ascent+fl_fontsize->descent;
else return -1;
}

int fl_descent() {
return fl_fontsize->descent;
if (fl_fontsize) return fl_fontsize->descent;
else return -1;
}

double fl_width(const char* c, int n) {
Expand Down Expand Up @@ -226,5 +228,5 @@ void fl_draw(const char* str, int n, int x, int y) {


//
// End of "$Id: fl_font_mac.cxx,v 1.1.2.19 2004/08/27 20:02:45 matthiaswm Exp $".
// End of "$Id: fl_font_mac.cxx,v 1.1.2.20 2004/09/07 20:59:17 easysw Exp $".
//
14 changes: 9 additions & 5 deletions src/fl_font_win32.cxx
@@ -1,5 +1,5 @@
//
// "$Id: fl_font_win32.cxx,v 1.9.2.3.2.6 2004/04/11 04:39:00 easysw Exp $"
// "$Id: fl_font_win32.cxx,v 1.9.2.3.2.7 2004/09/07 20:59:17 easysw Exp $"
//
// WIN32 font selection routines for the Fast Light Tool Kit (FLTK).
//
Expand Down Expand Up @@ -130,21 +130,25 @@ void fl_font(int fnum, int size) {
}

int fl_height() {
return (fl_fontsize->metr.tmAscent + fl_fontsize->metr.tmDescent);
if (fl_fontsize) return (fl_fontsize->metr.tmAscent + fl_fontsize->metr.tmDescent);
else return -1;
}

int fl_descent() {
return fl_fontsize->metr.tmDescent;
if (fl_fontsize) return fl_fontsize->metr.tmDescent;
else return -1;
}

double fl_width(const char* c, int n) {
if (!fl_fontsize) return -1.0;
double w = 0.0;
while (n--) w += fl_fontsize->width[uchar(*c++)];
return w;
}

double fl_width(uchar c) {
return fl_fontsize->width[c];
if (fl_fontsize) return fl_fontsize->width[c];
else return -1.0;
}

void fl_draw(const char* str, int n, int x, int y) {
Expand All @@ -156,5 +160,5 @@ void fl_draw(const char* str, int n, int x, int y) {


//
// End of "$Id: fl_font_win32.cxx,v 1.9.2.3.2.6 2004/04/11 04:39:00 easysw Exp $".
// End of "$Id: fl_font_win32.cxx,v 1.9.2.3.2.7 2004/09/07 20:59:17 easysw Exp $".
//
12 changes: 8 additions & 4 deletions src/fl_font_x.cxx
@@ -1,5 +1,5 @@
//
// "$Id: fl_font_x.cxx,v 1.10.2.5 2004/04/11 04:39:00 easysw Exp $"
// "$Id: fl_font_x.cxx,v 1.10.2.6 2004/09/07 20:59:17 easysw Exp $"
//
// Standard X11 font selection code for the Fast Light Tool Kit (FLTK).
//
Expand Down Expand Up @@ -208,14 +208,17 @@ void fl_font(int fnum, int size) {
}

int fl_height() {
return (fl_xfont->ascent + fl_xfont->descent);
if (fl_xfont) return (fl_xfont->ascent + fl_xfont->descent);
else return -1;
}

int fl_descent() {
return fl_xfont->descent;
if (fl_xfont) return fl_xfont->descent;
else return -1;
}

double fl_width(const char* c, int n) {
if (!fl_xfont) return -1.0;
XCharStruct* p = fl_xfont->per_char;
if (!p) return n*fl_xfont->min_bounds.width;
int a = fl_xfont->min_char_or_byte2;
Expand All @@ -230,6 +233,7 @@ double fl_width(const char* c, int n) {
}

double fl_width(uchar c) {
if (!fl_xfont) return -1;
XCharStruct* p = fl_xfont->per_char;
if (p) {
int a = fl_xfont->min_char_or_byte2;
Expand All @@ -250,5 +254,5 @@ void fl_draw(const char* str, int n, int x, int y) {
}

//
// End of "$Id: fl_font_x.cxx,v 1.10.2.5 2004/04/11 04:39:00 easysw Exp $".
// End of "$Id: fl_font_x.cxx,v 1.10.2.6 2004/09/07 20:59:17 easysw Exp $".
//
16 changes: 12 additions & 4 deletions src/fl_font_xft.cxx
@@ -1,5 +1,5 @@
//
// "$Id: fl_font_xft.cxx,v 1.4.2.13 2004/04/11 04:39:00 easysw Exp $"
// "$Id: fl_font_xft.cxx,v 1.4.2.14 2004/09/07 20:59:18 easysw Exp $"
//
// Xft font code for the Fast Light Tool Kit (FLTK).
//
Expand Down Expand Up @@ -153,10 +153,18 @@ Fl_FontSize::~Fl_FontSize() {
// XftFontClose(fl_display, font);
}

int fl_height() { return current_font->ascent + current_font->descent; }
int fl_descent() { return current_font->descent; }
int fl_height() {
if (current_font) return current_font->ascent + current_font->descent;
else return -1;
}

int fl_descent() {
if (current_font) return current_font->descent;
else return -1;
}

double fl_width(const char *str, int n) {
if (!current_font) return -1.0;
XGlyphInfo i;
XftTextExtents8(fl_display, current_font, (XftChar8 *)str, n, &i);
return i.xOff;
Expand Down Expand Up @@ -247,5 +255,5 @@ void fl_draw(const char *str, int n, int x, int y) {
}

//
// End of "$Id: fl_font_xft.cxx,v 1.4.2.13 2004/04/11 04:39:00 easysw Exp $"
// End of "$Id: fl_font_xft.cxx,v 1.4.2.14 2004/09/07 20:59:18 easysw Exp $"
//

0 comments on commit a8b58dc

Please sign in to comment.