summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>2002-07-30 18:33:49 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>2002-07-30 18:33:49 +0000
commit9456baab50e8937d9a843a362847d589958694f9 (patch)
tree6d79a87d703b84840f57a5b9c5c67729012b7ba7
parent1cea00ad00e75262cedd3a96f2e7ac39a7b640c8 (diff)
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
-rw-r--r--CHANGES4
-rw-r--r--documentation/functions.html27
-rw-r--r--src/Fl_File_Chooser2.cxx23
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</A>.
<LI><A HREF="#fl_color_chooser_func"><TT>fl_color_chooser</TT></A></LI>
<LI><A HREF="#fl_color_cube"><TT>fl_color_cube</TT></A></LI>
<LI><A HREF="#fl_contrast"><TT>fl_contrast</TT></A></LI>
+ <LI><A HREF="#fl_cursor"><TT>fl_cursor</TT></A></LI>
<LI><A HREF="#fl_darker"><TT>fl_darker</TT></A></LI>
<LI><A HREF="#fl_dir_chooser"><TT>fl_dir_chooser</TT></A></LI>
<LI><A HREF="#fl_file_chooser2"><TT>fl_file_chooser</TT></A></LI>
@@ -74,6 +75,7 @@ A</A>.
<LI><A HREF="#fl_average_color"><TT>fl_average_color</TT></A></LI>
<LI><A HREF="#fl_color_cube"><TT>fl_color_cube</TT></A></LI>
<LI><A HREF="#fl_contrast"><TT>fl_contrast</TT></A></LI>
+ <LI><A HREF="#fl_cursor"><TT>fl_cursor</TT></A></LI>
<LI><A HREF="#fl_darker"><TT>fl_darker</TT></A></LI>
<LI><A HREF="#fl_gray_ramp"><TT>fl_gray_ramp</TT></A></LI>
<LI><A HREF="#fl_lighter"><TT>fl_lighter</TT></A></LI>
@@ -368,6 +370,31 @@ which color provides the best contrast.
<!-- NEED 4in -->
+<H2><A NAME="fl_cursor">fl_cursor</A></H2>
+
+<HR>
+
+<H3>Include Files</H3>
+
+<UL><PRE>
+#include &lt;FL/fl_draw.H&gt;
+</PRE></UL>
+
+<H3>Prototype</H3>
+
+<UL><PRE>
+Fl_Color fl_cursor(Fl_Cursor cursor, Fl_Color fg, Fl_Color bg);
+</PRE></UL>
+
+<H3>Description</H3>
+
+<P>Sets the cursor for the current window to the specified shape
+and colors. The cursors are defined in the <A
+HREF="enumerations.html#cursor"><CODE>&lt;FL/Enumerations.H></CODE>
+header file</A>.
+
+
+<!-- NEED 4in -->
<H2><A NAME="fl_darker">fl_darker</A></H2>
<HR>
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 $".
//