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
This commit is contained in:
Michael R Sweet
2004-09-07 20:59:18 +00:00
parent d7fe9245b4
commit a8b58dc223
12 changed files with 100 additions and 98 deletions
+17
View File
@@ -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
+15 -3
View File
@@ -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 &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>
+6 -1
View File
@@ -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-&gt;icon((char *)p);
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
@@ -370,6 +371,10 @@ XpmCreatePixmapFromData(fl_display, DefaultRootWindow(fl_display),
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>
+3 -3
View File
@@ -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 $".
//
+5 -3
View File
@@ -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 $".
//
+16 -6
View File
@@ -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 $".
//
+3 -3
View File
@@ -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 $".
//
+6 -4
View File
@@ -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 $".
//
+9 -5
View File
@@ -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 $".
//
+8 -4
View File
@@ -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 $".
//
+12 -4
View File
@@ -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 $"
//
-62
View File
@@ -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 $".
//