diff options
| author | Michael R Sweet <michael.r.sweet@gmail.com> | 2004-09-07 20:59:18 +0000 |
|---|---|---|
| committer | Michael R Sweet <michael.r.sweet@gmail.com> | 2004-09-07 20:59:18 +0000 |
| commit | a8b58dc223afc42c36a551ae6d6992e6bb02b2c7 (patch) | |
| tree | 020372d5a0e154851dec8a51618de232b81b228f | |
| parent | d7fe9245b4f976d220469f321b100ffc217ccc59 (diff) | |
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)
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
| -rw-r--r-- | CHANGES | 17 | ||||
| -rw-r--r-- | documentation/Fl_Group.html | 18 | ||||
| -rw-r--r-- | documentation/osissues.html | 7 | ||||
| -rw-r--r-- | fluid/fluid.cxx | 6 | ||||
| -rw-r--r-- | src/Fl_File_Chooser2.cxx | 8 | ||||
| -rw-r--r-- | src/Fl_Positioner.cxx | 22 | ||||
| -rw-r--r-- | src/Fl_Text_Display.cxx | 6 | ||||
| -rw-r--r-- | src/fl_font_mac.cxx | 10 | ||||
| -rw-r--r-- | src/fl_font_win32.cxx | 14 | ||||
| -rw-r--r-- | src/fl_font_x.cxx | 12 | ||||
| -rw-r--r-- | src/fl_font_xft.cxx | 16 | ||||
| -rw-r--r-- | src/fl_set_gray.cxx | 62 |
12 files changed, 100 insertions, 98 deletions
@@ -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 diff --git a/documentation/Fl_Group.html b/documentation/Fl_Group.html index f4509b303..21d912d72 100644 --- a/documentation/Fl_Group.html +++ b/documentation/Fl_Group.html @@ -81,7 +81,12 @@ to the end of this group. <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> @@ -104,8 +109,15 @@ This does <tt>insert(w, find(beforethis))</tt>. This will append the widget if <tt>beforethis</tt> is not in the group. <H4><A name=Fl_Group.remove>void Fl_Group::remove(Fl_Widget &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> diff --git a/documentation/osissues.html b/documentation/osissues.html index a140dc6b8..045921bbf 100644 --- a/documentation/osissues.html +++ b/documentation/osissues.html @@ -333,7 +333,7 @@ MyWindow::~MyWindow() { <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> @@ -358,6 +358,7 @@ window->icon((char *)p); should be used as follows: <UL><PRE> +#include <X11/xpm.h> #include "icon.xpm" fl_opendisplay(); // needed if display has not been previously opened @@ -370,6 +371,10 @@ XpmCreatePixmapFromData(fl_display, DefaultRootWindow(fl_display), window->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> diff --git a/fluid/fluid.cxx b/fluid/fluid.cxx index e1680f3da..d57d7fdf8 100644 --- a/fluid/fluid.cxx +++ b/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). // @@ -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; @@ -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 $". // diff --git a/src/Fl_File_Chooser2.cxx b/src/Fl_File_Chooser2.cxx index 3fa961a6b..045f04e6a 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.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. // @@ -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 ?... @@ -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 $". // diff --git a/src/Fl_Positioner.cxx b/src/Fl_Positioner.cxx index 1c356ee2d..9eba88d56 100644 --- a/src/Fl_Positioner.cxx +++ b/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). // @@ -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; @@ -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 $". // diff --git a/src/Fl_Text_Display.cxx b/src/Fl_Text_Display.cxx index 78a55acbe..5afe7f977 100644 --- a/src/Fl_Text_Display.cxx +++ b/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 @@ -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; @@ -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 $". // diff --git a/src/fl_font_mac.cxx b/src/fl_font_mac.cxx index 613df6ec4..0fc0f3a8e 100644 --- a/src/fl_font_mac.cxx +++ b/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). // @@ -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) { @@ -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 $". // diff --git a/src/fl_font_win32.cxx b/src/fl_font_win32.cxx index ef91a0574..a9b5dbcb7 100644 --- a/src/fl_font_win32.cxx +++ b/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). // @@ -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) { @@ -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 $". // diff --git a/src/fl_font_x.cxx b/src/fl_font_x.cxx index ce572d2bf..0c87ba536 100644 --- a/src/fl_font_x.cxx +++ b/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). // @@ -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; @@ -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; @@ -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 $". // diff --git a/src/fl_font_xft.cxx b/src/fl_font_xft.cxx index a37fa02df..227583546 100644 --- a/src/fl_font_xft.cxx +++ b/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). // @@ -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; @@ -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 $" // diff --git a/src/fl_set_gray.cxx b/src/fl_set_gray.cxx deleted file mode 100644 index 3da544103..000000000 --- a/src/fl_set_gray.cxx +++ /dev/null @@ -1,62 +0,0 @@ -// -// "$Id: fl_set_gray.cxx,v 1.5.2.3.2.4 2004/04/11 04:39:00 easysw Exp $" -// -// Background (gray) color routines for the Fast Light Tool Kit (FLTK). -// -// Copyright 1998-2004 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". -// - -// -fg, -bg, and -bg2 switches - -#include <FL/Fl.H> - -void Fl::background(uchar r, uchar g, uchar b) { - // replace the gray ramp so that color 47 is this color - int i; - for (i = 32; i <= 47; i++) { - int m = (i-32)*255/23; - Fl::set_color((Fl_Color)i,r*m/166,g*m/166,b*m/166); - } - for (; i < 56; i++) { - int m = 255-(i-32)*255/23; - Fl::set_color((Fl_Color)i,255-(255-r)*m/89,255-(255-g)*m/89,255-(255-b)*m/89); - } -} - -static void set_others() { - uchar r,g,b; Fl::get_color(FL_FOREGROUND_COLOR,r,g,b); - uchar r1,g1,b1; Fl::get_color(FL_BACKGROUND2_COLOR,r1,g1,b1); - Fl::set_color(FL_INACTIVE_COLOR,(2*r+r1)/3, (2*g+g1)/3, (2*b+b1)/3); - Fl::set_color(FL_SELECTION_COLOR,(2*r1+r)/3, (2*g1+g)/3, (2*b1+b)/3); -} - -void Fl::foreground(uchar r, uchar g, uchar b) { - Fl::set_color(FL_FOREGROUND_COLOR,r,g,b); - set_others(); -} - -void Fl::background2(uchar r, uchar g, uchar b) { - Fl::set_color(FL_BACKGROUND2_COLOR,r,g,b); - set_others(); -} - -// -// End of "$Id: fl_set_gray.cxx,v 1.5.2.3.2.4 2004/04/11 04:39:00 easysw Exp $". -// |
