From 68fb9f79108ef7f2e841f6cd8dc6fb58408d2e29 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Sat, 27 Oct 2001 03:29:25 +0000 Subject: [PATCH] Don't allow extra boxtypes to override user-defined boxtypes. Change the help link function to get both the widget and pathname. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1659 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- CHANGES | 10 ++++ FL/Fl_Help_View.H | 6 +- documentation/Fl_Help_View.html | 14 +++-- src/Fl_Help_View.cxx | 12 ++-- src/Makefile | 8 ++- src/fl_boxtype.cxx | 99 ++++++++++++++++++--------------- 6 files changed, 86 insertions(+), 63 deletions(-) diff --git a/CHANGES b/CHANGES index d962acf06..f96617608 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,13 @@ +CHANGES IN FLTK 1.1.0b5 + + - Fl::set_boxtype() and fl_internal_boxtype() now keep + track of when a boxtype is changed; this allows you to + override the "special" boxtypes without references to + those boxtypes causing them to be reset. + - Fl_Help_Func now takes a Fl_Widget pointer as well as + a pathname. + + CHANGES IN FLTK 1.1.0b4 **** NOTE: DUE TO CHANGES IN THE FL_WIDGET CLASS, **** diff --git a/FL/Fl_Help_View.H b/FL/Fl_Help_View.H index 9207a2a1d..3098535f2 100644 --- a/FL/Fl_Help_View.H +++ b/FL/Fl_Help_View.H @@ -1,5 +1,5 @@ // -// "$Id: Fl_Help_View.H,v 1.1.2.1 2001/09/29 14:38:58 easysw Exp $" +// "$Id: Fl_Help_View.H,v 1.1.2.2 2001/10/27 03:29:25 easysw Exp $" // // Help Viewer widget definitions. // @@ -43,7 +43,7 @@ // -typedef const char *(Fl_Help_Func)(const char *); +typedef const char *(Fl_Help_Func)(Fl_Widget *, const char *); // @@ -210,5 +210,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.1 2001/09/29 14:38:58 easysw Exp $". +// End of "$Id: Fl_Help_View.H,v 1.1.2.2 2001/10/27 03:29:25 easysw Exp $". // diff --git a/documentation/Fl_Help_View.html b/documentation/Fl_Help_View.html index fb7a88d75..1fb420505 100644 --- a/documentation/Fl_Help_View.html +++ b/documentation/Fl_Help_View.html @@ -66,12 +66,14 @@ in the buffer.

void link(Fl_Help_Func *fn)

This method assigns a callback function to use when a link is -followed or a file is loaded (via Fl_Help_View::load()) that -requires a different file or path. The callback function receives the -full pathname for the file in question and must return a pathname that -can be opened as a local file. This is used by the -Fl_Help_App widget to support WWW -addresses. +followed or a file is loaded (via +Fl_Help_View::load()) that requires a different +file or path. The callback function receives a pointer to the +Fl_Help_View widget and the full pathname for the +file in question and must return a pathname that can be opened +as a local file. This can also be used to retrieve remote or +virtual documents, returning the temporary file that contains +the actual data.

int load(const char *f)

diff --git a/src/Fl_Help_View.cxx b/src/Fl_Help_View.cxx index e863169c4..64d625d6a 100644 --- a/src/Fl_Help_View.cxx +++ b/src/Fl_Help_View.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Help_View.cxx,v 1.1.2.7 2001/10/26 21:18:30 easysw Exp $" +// "$Id: Fl_Help_View.cxx,v 1.1.2.8 2001/10/27 03:29:25 easysw Exp $" // // Fl_Help_View widget routines. // @@ -547,7 +547,7 @@ Fl_Help_View::add_image(const char *name, // I - Path of image sprintf(temp, "%s/%s", directory_, name); if (link_) - localname = (*link_)(temp); + localname = (*link_)(this, temp); else localname = temp; } @@ -562,12 +562,12 @@ Fl_Help_View::add_image(const char *name, // I - Path of image } if (link_) - localname = (*link_)(temp); + localname = (*link_)(this, temp); else localname = temp; } else if (link_) - localname = (*link_)(name); + localname = (*link_)(this, name); else localname = name; @@ -2840,7 +2840,7 @@ Fl_Help_View::load(const char *f)// I - Filename to load (may also have target) *target++ = '\0'; if (link_) - localname = (*link_)(filename_); + localname = (*link_)(this, filename_); else localname = filename_; @@ -3584,5 +3584,5 @@ scrollbar_callback(Fl_Widget *s, void *) // -// End of "$Id: Fl_Help_View.cxx,v 1.1.2.7 2001/10/26 21:18:30 easysw Exp $". +// End of "$Id: Fl_Help_View.cxx,v 1.1.2.8 2001/10/27 03:29:25 easysw Exp $". // diff --git a/src/Makefile b/src/Makefile index db2b92a02..d1d10fac3 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,5 +1,5 @@ # -# "$Id: Makefile,v 1.18.2.14.2.13 2001/09/30 17:54:45 easysw Exp $" +# "$Id: Makefile,v 1.18.2.14.2.14 2001/10/27 03:29:25 easysw Exp $" # # Library makefile for the Fast Light Tool Kit (FLTK). # @@ -170,6 +170,7 @@ all: $(LIBNAME) $(DSONAME) $(GLLIBNAME) $(GLDSONAME) $(LIBNAME): $(OBJECTS) echo $(LIBCOMMAND) $@ ... + rm -f $@ $(LIBCOMMAND) $@ $(OBJECTS) $(RANLIB) $@ @@ -181,11 +182,13 @@ libfltk_s.a: $(OBJECTS) echo $(DSOCOMMAND) libfltk_s.o ... $(DSOCOMMAND) libfltk_s.o $(OBJECTS) $(IMAGELIBS) echo $(LIBCOMMAND) libfltk_s.a libfltk_s.o + rm -f $@ $(LIBCOMMAND) libfltk_s.a libfltk_s.o chmod +x libfltk_s.a $(GLLIBNAME): $(GLOBJECTS) echo $(LIBCOMMAND) $@ ... + rm -f $@ $(LIBCOMMAND) $@ $(GLOBJECTS) $(RANLIB) $@ @@ -197,6 +200,7 @@ libfltk_gl_s.a: $(GLOBJECTS) echo $(DSOCOMMAND) libfltk_gl_s.o ... $(DSOCOMMAND) libfltk_gl_s.o $(GLOBJECTS) echo $(LIBCOMMAND) libfltk_gl_s.a libfltk_gl_s.o + rm -f $@ $(LIBCOMMAND) libfltk_gl_s.a libfltk_gl_s.o chmod +x libfltk_gl_s.a @@ -263,5 +267,5 @@ install: $(LIBNAME) $(DSONAME) $(GLLIBNAME) $(GLDSONAME) ln -s FL $(includedir)/Fl # -# End of "$Id: Makefile,v 1.18.2.14.2.13 2001/09/30 17:54:45 easysw Exp $". +# End of "$Id: Makefile,v 1.18.2.14.2.14 2001/10/27 03:29:25 easysw Exp $". # diff --git a/src/fl_boxtype.cxx b/src/fl_boxtype.cxx index 8b9b9eb13..55bc9d472 100644 --- a/src/fl_boxtype.cxx +++ b/src/fl_boxtype.cxx @@ -1,5 +1,5 @@ // -// "$Id: fl_boxtype.cxx,v 1.8.2.4.2.1 2001/08/04 12:21:33 easysw Exp $" +// "$Id: fl_boxtype.cxx,v 1.8.2.4.2.2 2001/10/27 03:29:25 easysw Exp $" // // Box drawing code for the Fast Light Tool Kit (FLTK). // @@ -186,46 +186,47 @@ void fl_border_frame(int x, int y, int w, int h, Fl_Color c) { static struct { Fl_Box_Draw_F *f; uchar dx, dy, dw, dh; + int set; } fl_box_table[] = { // must match list in Enumerations.H!!! - {fl_no_box, 0,0,0,0}, - {fl_rectf, 0,0,0,0}, // FL_FLAT_BOX - {fl_up_box, D1,D1,D2,D2}, - {fl_down_box, D1,D1,D2,D2}, - {fl_up_frame, D1,D1,D2,D2}, - {fl_down_frame, D1,D1,D2,D2}, - {fl_thin_up_box, 1,1,2,2}, - {fl_thin_down_box, 1,1,2,2}, - {fl_thin_up_frame, 1,1,2,2}, - {fl_thin_down_frame, 1,1,2,2}, - {fl_engraved_box, 2,2,4,4}, - {fl_embossed_box, 2,2,4,4}, - {fl_engraved_frame, 2,2,4,4}, - {fl_embossed_frame, 2,2,4,4}, - {fl_border_box, 1,1,2,2}, - {fl_border_box, 1,1,2,2}, // _FL_SHADOW_BOX, - {fl_border_frame, 1,1,2,2}, - {fl_border_frame, 1,1,2,2}, // _FL_SHADOW_FRAME, - {fl_border_box, 1,1,2,2}, // _FL_ROUNDED_BOX, - {fl_border_box, 1,1,2,2}, // _FL_RSHADOW_BOX, - {fl_border_frame, 1,1,2,2}, // _FL_ROUNDED_FRAME - {fl_rectf, 0,0,0,0}, // _FL_RFLAT_BOX, - {fl_up_box, 3,3,6,6}, // _FL_ROUND_UP_BOX - {fl_down_box, 3,3,6,6}, // _FL_ROUND_DOWN_BOX, - {fl_up_box, 0,0,0,0}, // _FL_DIAMOND_UP_BOX - {fl_down_box, 0,0,0,0}, // _FL_DIAMOND_DOWN_BOX - {fl_border_box, 1,1,2,2}, // _FL_OVAL_BOX, - {fl_border_box, 1,1,2,2}, // _FL_OVAL_SHADOW_BOX, - {fl_border_frame, 1,1,2,2}, // _FL_OVAL_FRAME - {fl_rectf, 0,0,0,0}, // _FL_OVAL_FLAT_BOX, - {fl_up_box, 3,3,6,6}, // FL_FREE_BOX+0 - {fl_down_box, 3,3,6,6}, // FL_FREE_BOX+1 - {fl_up_box, 3,3,6,6}, // FL_FREE_BOX+2 - {fl_down_box, 3,3,6,6}, // FL_FREE_BOX+3 - {fl_up_box, 3,3,6,6}, // FL_FREE_BOX+4 - {fl_down_box, 3,3,6,6}, // FL_FREE_BOX+5 - {fl_up_box, 3,3,6,6}, // FL_FREE_BOX+6 - {fl_down_box, 3,3,6,6}, // FL_FREE_BOX+7 + {fl_no_box, 0,0,0,0,1}, + {fl_rectf, 0,0,0,0,1}, // FL_FLAT_BOX + {fl_up_box, D1,D1,D2,D2,1}, + {fl_down_box, D1,D1,D2,D2,1}, + {fl_up_frame, D1,D1,D2,D2,1}, + {fl_down_frame, D1,D1,D2,D2,1}, + {fl_thin_up_box, 1,1,2,2,1}, + {fl_thin_down_box, 1,1,2,2,1}, + {fl_thin_up_frame, 1,1,2,2,1}, + {fl_thin_down_frame, 1,1,2,2,1}, + {fl_engraved_box, 2,2,4,4,1}, + {fl_embossed_box, 2,2,4,4,1}, + {fl_engraved_frame, 2,2,4,4,1}, + {fl_embossed_frame, 2,2,4,4,1}, + {fl_border_box, 1,1,2,2,1}, + {fl_border_box, 1,1,2,2,0}, // _FL_SHADOW_BOX, + {fl_border_frame, 1,1,2,2,1}, + {fl_border_frame, 1,1,2,2,0}, // _FL_SHADOW_FRAME, + {fl_border_box, 1,1,2,2,0}, // _FL_ROUNDED_BOX, + {fl_border_box, 1,1,2,2,0}, // _FL_RSHADOW_BOX, + {fl_border_frame, 1,1,2,2,0}, // _FL_ROUNDED_FRAME + {fl_rectf, 0,0,0,0,0}, // _FL_RFLAT_BOX, + {fl_up_box, 3,3,6,6,0}, // _FL_ROUND_UP_BOX + {fl_down_box, 3,3,6,6,0}, // _FL_ROUND_DOWN_BOX, + {fl_up_box, 0,0,0,0,0}, // _FL_DIAMOND_UP_BOX + {fl_down_box, 0,0,0,0,0}, // _FL_DIAMOND_DOWN_BOX + {fl_border_box, 1,1,2,2,0}, // _FL_OVAL_BOX, + {fl_border_box, 1,1,2,2,0}, // _FL_OVAL_SHADOW_BOX, + {fl_border_frame, 1,1,2,2,0}, // _FL_OVAL_FRAME + {fl_rectf, 0,0,0,0,0}, // _FL_OVAL_FLAT_BOX, + {fl_up_box, 3,3,6,6,0}, // FL_FREE_BOX+0 + {fl_down_box, 3,3,6,6,0}, // FL_FREE_BOX+1 + {fl_up_box, 3,3,6,6,0}, // FL_FREE_BOX+2 + {fl_down_box, 3,3,6,6,0}, // FL_FREE_BOX+3 + {fl_up_box, 3,3,6,6,0}, // FL_FREE_BOX+4 + {fl_down_box, 3,3,6,6,0}, // FL_FREE_BOX+5 + {fl_up_box, 3,3,6,6,0}, // FL_FREE_BOX+6 + {fl_down_box, 3,3,6,6,0}, // FL_FREE_BOX+7 }; int Fl::box_dx(Fl_Boxtype t) {return fl_box_table[t].dx;} @@ -233,15 +234,21 @@ int Fl::box_dy(Fl_Boxtype t) {return fl_box_table[t].dy;} int Fl::box_dw(Fl_Boxtype t) {return fl_box_table[t].dw;} int Fl::box_dh(Fl_Boxtype t) {return fl_box_table[t].dh;} -void fl_internal_boxtype(Fl_Boxtype t, Fl_Box_Draw_F* f) {fl_box_table[t].f=f;} +void fl_internal_boxtype(Fl_Boxtype t, Fl_Box_Draw_F* f) { + if (!fl_box_table[t].set) { + fl_box_table[t].f = f; + fl_box_table[t].set = 1; + } +} void Fl::set_boxtype(Fl_Boxtype t, Fl_Box_Draw_F* f, uchar a, uchar b, uchar c, uchar d) { - fl_box_table[t].f=f; - fl_box_table[t].dx = a; - fl_box_table[t].dy = b; - fl_box_table[t].dw = c; - fl_box_table[t].dh = d; + fl_box_table[t].f = f; + fl_box_table[t].set = 1; + fl_box_table[t].dx = a; + fl_box_table[t].dy = b; + fl_box_table[t].dw = c; + fl_box_table[t].dh = d; } void Fl::set_boxtype(Fl_Boxtype t, Fl_Boxtype f) { @@ -277,5 +284,5 @@ const { } // -// End of "$Id: fl_boxtype.cxx,v 1.8.2.4.2.1 2001/08/04 12:21:33 easysw Exp $". +// End of "$Id: fl_boxtype.cxx,v 1.8.2.4.2.2 2001/10/27 03:29:25 easysw Exp $". //