From d7055f4c368185a0d49d78ef5b4c6af8bf84c43d Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Thu, 18 Jul 2002 15:27:21 +0000 Subject: [PATCH] Fl_Help_View fixes from Szasz Pal. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2539 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- CHANGES | 5 +++++ src/Fl_Help_View.cxx | 35 +++++++++++++++++++---------------- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/CHANGES b/CHANGES index 2542e6039..d003b0ca4 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,10 @@ CHANGES IN FLTK 1.1.0 + - Fl_Help_View didn't properly handle NULL from the link + callback (the original filename/directory name were + not preserved...) + - Fl_Help_View didn't use the boxtype border values when + clipping the page that was displayed. - Added first steps to CodeWarrior/OS_X support (see fltk-1.1.x/CodeWarrior/OS_X.sit) - Cleaned up the WIN32 export definitions for some of diff --git a/src/Fl_Help_View.cxx b/src/Fl_Help_View.cxx index 34955de89..cd37331ea 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.36 2002/06/10 17:21:53 easysw Exp $" +// "$Id: Fl_Help_View.cxx,v 1.1.2.37 2002/07/18 15:27:21 easysw Exp $" // // Fl_Help_View widget routines. // @@ -355,7 +355,8 @@ Fl_Help_View::draw() return; // Clip the drawing to the inside of the box... - fl_push_clip(x() + 4, y() + 4, ww - 8, hh - 8); + fl_push_clip(x() + Fl::box_dx(b), y() + Fl::box_dy(b), + ww - Fl::box_dw(b), hh - Fl::box_dh(b)); fl_color(textcolor_); // Draw all visible blocks... @@ -2291,10 +2292,23 @@ Fl_Help_View::load(const char *f)// I - Filename to load (may also have target) char *slash; // Directory separator const char *localname; // Local filename char error[1024]; // Error buffer + char newname[1024]; // New filename buffer - strcpy(filename_, f); - strcpy(directory_, filename_); + strlcpy(newname, f, sizeof(newname)); + if ((target = strrchr(newname, '#')) != NULL) + *target++ = '\0'; + + if (link_) + localname = (*link_)(this, newname); + else + localname = filename_; + + if (!localname) + return (0); + + strlcpy(filename_, newname, sizeof(filename_)); + strlcpy(directory_, newname, sizeof(directory_)); // Note: We do not support Windows backslashes, since they are illegal // in URLs... @@ -2303,17 +2317,6 @@ Fl_Help_View::load(const char *f)// I - Filename to load (may also have target) else if (slash > directory_ && slash[-1] != '/') *slash = '\0'; - if ((target = strrchr(filename_, '#')) != NULL) - *target++ = '\0'; - - if (link_) - localname = (*link_)(this, filename_); - else - localname = filename_; - - if (!localname) - return (0); - if (value_ != NULL) { free((void *)value_); @@ -2638,5 +2641,5 @@ hscrollbar_callback(Fl_Widget *s, void *) // -// End of "$Id: Fl_Help_View.cxx,v 1.1.2.36 2002/06/10 17:21:53 easysw Exp $". +// End of "$Id: Fl_Help_View.cxx,v 1.1.2.37 2002/07/18 15:27:21 easysw Exp $". //