From 9456baab50e8937d9a843a362847d589958694f9 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Tue, 30 Jul 2002 18:33:49 +0000 Subject: Fix some problems with the filename field and handling selections in the root directory (Fl_File_Chooser). Add documentation for the fl_cursor() function. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2558 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- CHANGES | 4 ++++ documentation/functions.html | 27 +++++++++++++++++++++++++++ src/Fl_File_Chooser2.cxx | 23 ++++++++++++++--------- 3 files changed, 45 insertions(+), 9 deletions(-) diff --git a/CHANGES b/CHANGES index 5845ab913..3597994de 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,10 @@ CHANGES IN FLTK 1.1.0 - Documentation updates. + - Fixed filename problems with Fl_File_Chooser - + changing the filename field directly or choosing files + from the root directory could yield interesting + filenames. - Fl_Input_ could crash if it received an empty paste event. - The mouse pointer now changes to the I beam diff --git a/documentation/functions.html b/documentation/functions.html index cdd3f7666..ae502dffb 100644 --- a/documentation/functions.html +++ b/documentation/functions.html @@ -19,6 +19,7 @@ A.
  • fl_color_chooser
  • fl_color_cube
  • fl_contrast
  • +
  • fl_cursor
  • fl_darker
  • fl_dir_chooser
  • fl_file_chooser
  • @@ -74,6 +75,7 @@ A.
  • fl_average_color
  • fl_color_cube
  • fl_contrast
  • +
  • fl_cursor
  • fl_darker
  • fl_gray_ramp
  • fl_lighter
  • @@ -367,6 +369,31 @@ with the background color. Otherwise, returns which color provides the best contrast. + +

    fl_cursor

    + +
    + +

    Include Files

    + + + +

    Prototype

    + + + +

    Description

    + +

    Sets the cursor for the current window to the specified shape +and colors. The cursors are defined in the <FL/Enumerations.H> +header file. + +

    fl_darker

    diff --git a/src/Fl_File_Chooser2.cxx b/src/Fl_File_Chooser2.cxx index 6109544b5..20fcd5b05 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.20 2002/07/14 18:26:54 easysw Exp $" +// "$Id: Fl_File_Chooser2.cxx,v 1.1.2.21 2002/07/30 18:33:49 easysw Exp $" // // More Fl_File_Chooser routines. // @@ -382,10 +382,12 @@ Fl_File_Chooser::fileListCB() if (!filename) return; - if (directory_[0] != '\0') { - snprintf(pathname, sizeof(pathname), "%s/%s", directory_, filename); - } else { + if (!directory_[0]) { strlcpy(pathname, filename, sizeof(pathname)); + } else if (strcmp(directory_, "/") == 0) { + snprintf(pathname, sizeof(pathname), "/%s", filename); + } else { + snprintf(pathname, sizeof(pathname), "%s/%s", directory_, filename); } if (Fl::event_clicks()) { @@ -449,8 +451,7 @@ Fl_File_Chooser::fileNameCB() // Get the filename from the text field... filename = (char *)fileName->value(); - if (filename == NULL || filename[0] == '\0') - { + if (filename == NULL || filename[0] == '\0') { okButton->deactivate(); return; } @@ -538,8 +539,12 @@ Fl_File_Chooser::fileNameCB() directory(pathname); - snprintf(pathname, sizeof(pathname), "%s/%s", directory_, filename); - fileName->value(pathname); + if (filename[0]) { + char tempname[1024]; + + snprintf(tempname, sizeof(tempname), "%s/%s", directory_, filename); + fileName->value(tempname); + } fileName->position(p, m); } @@ -1138,5 +1143,5 @@ unquote_pathname(char *dst, // O - Destination string // -// End of "$Id: Fl_File_Chooser2.cxx,v 1.1.2.20 2002/07/14 18:26:54 easysw Exp $". +// End of "$Id: Fl_File_Chooser2.cxx,v 1.1.2.21 2002/07/30 18:33:49 easysw Exp $". // -- cgit v1.2.3