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:
parent
daccac9672
commit
cf40467b5b
2
CHANGES
2
CHANGES
@ -1,5 +1,7 @@
|
||||
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
|
||||
selection when focus was shifted to another widget
|
||||
(STR #131)
|
||||
|
||||
@ -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.
|
||||
//
|
||||
@ -112,7 +112,6 @@ Fl_File_Chooser::count()
|
||||
int i; // Looping var
|
||||
int fcount; // Number of selected files
|
||||
const char *filename; // Filename in input field or list
|
||||
char pathname[1024]; // Full path to file
|
||||
|
||||
|
||||
if (!(type_ & MULTI))
|
||||
@ -134,12 +133,8 @@ Fl_File_Chooser::count()
|
||||
{
|
||||
// See if this file is a directory...
|
||||
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 ++;
|
||||
}
|
||||
|
||||
@ -1027,16 +1022,19 @@ Fl_File_Chooser::value(int f) // I - File number
|
||||
// See if this file is a directory...
|
||||
name = fileList->text(i);
|
||||
|
||||
if (directory_[0]) {
|
||||
snprintf(pathname, sizeof(pathname), "%s/%s", directory_, name);
|
||||
} else {
|
||||
strlcpy(pathname, name, sizeof(pathname));
|
||||
}
|
||||
|
||||
if (!fl_filename_isdir(pathname)) {
|
||||
// Nope, see if this this is "the one"...
|
||||
if (name[strlen(name) - 1] != '/') {
|
||||
// Not a directory, see if this this is "the one"...
|
||||
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 $".
|
||||
//
|
||||
|
||||
Loading…
Reference in New Issue
Block a user