mirror of
https://github.com/fltk/fltk.git
synced 2026-06-06 00:22:42 +08:00
Fix performance issues with large file chooser selections. (STR #140)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@3087 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
CHANGES IN FLTK 1.1.4
|
CHANGES IN FLTK 1.1.4
|
||||||
|
|
||||||
|
- Fl_File_Chooser was very close for multiple file
|
||||||
|
selection in large directories (STR #140)
|
||||||
- Fl_Text_Display/Editor did not disable the current
|
- Fl_Text_Display/Editor did not disable the current
|
||||||
selection when focus was shifted to another widget
|
selection when focus was shifted to another widget
|
||||||
(STR #131)
|
(STR #131)
|
||||||
|
|||||||
+15
-17
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// "$Id: Fl_File_Chooser2.cxx,v 1.1.2.31 2003/05/26 01:39:53 easysw Exp $"
|
// "$Id: Fl_File_Chooser2.cxx,v 1.1.2.32 2003/09/03 19:38:01 easysw Exp $"
|
||||||
//
|
//
|
||||||
// More Fl_File_Chooser routines.
|
// More Fl_File_Chooser routines.
|
||||||
//
|
//
|
||||||
@@ -112,7 +112,6 @@ Fl_File_Chooser::count()
|
|||||||
int i; // Looping var
|
int i; // Looping var
|
||||||
int fcount; // Number of selected files
|
int fcount; // Number of selected files
|
||||||
const char *filename; // Filename in input field or list
|
const char *filename; // Filename in input field or list
|
||||||
char pathname[1024]; // Full path to file
|
|
||||||
|
|
||||||
|
|
||||||
if (!(type_ & MULTI))
|
if (!(type_ & MULTI))
|
||||||
@@ -134,12 +133,8 @@ Fl_File_Chooser::count()
|
|||||||
{
|
{
|
||||||
// See if this file is a directory...
|
// See if this file is a directory...
|
||||||
filename = (char *)fileList->text(i);
|
filename = (char *)fileList->text(i);
|
||||||
if (directory_[0] != '\0')
|
|
||||||
snprintf(pathname, sizeof(pathname), "%s/%s", directory_, filename);
|
|
||||||
else
|
|
||||||
strlcpy(pathname, filename, sizeof(pathname));
|
|
||||||
|
|
||||||
if (!fl_filename_isdir(pathname))
|
if (filename[strlen(filename) - 1] != '/')
|
||||||
fcount ++;
|
fcount ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1027,16 +1022,19 @@ Fl_File_Chooser::value(int f) // I - File number
|
|||||||
// See if this file is a directory...
|
// See if this file is a directory...
|
||||||
name = fileList->text(i);
|
name = fileList->text(i);
|
||||||
|
|
||||||
if (directory_[0]) {
|
if (name[strlen(name) - 1] != '/') {
|
||||||
snprintf(pathname, sizeof(pathname), "%s/%s", directory_, name);
|
// Not a directory, see if this this is "the one"...
|
||||||
} else {
|
|
||||||
strlcpy(pathname, name, sizeof(pathname));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!fl_filename_isdir(pathname)) {
|
|
||||||
// Nope, see if this this is "the one"...
|
|
||||||
fcount ++;
|
fcount ++;
|
||||||
if (fcount == f) return (pathname);
|
|
||||||
|
if (fcount == f) {
|
||||||
|
if (directory_[0]) {
|
||||||
|
snprintf(pathname, sizeof(pathname), "%s/%s", directory_, name);
|
||||||
|
} else {
|
||||||
|
strlcpy(pathname, name, sizeof(pathname));
|
||||||
|
}
|
||||||
|
|
||||||
|
return (pathname);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1165,5 +1163,5 @@ unquote_pathname(char *dst, // O - Destination string
|
|||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// End of "$Id: Fl_File_Chooser2.cxx,v 1.1.2.31 2003/05/26 01:39:53 easysw Exp $".
|
// End of "$Id: Fl_File_Chooser2.cxx,v 1.1.2.32 2003/09/03 19:38:01 easysw Exp $".
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user