]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormFiledialog.C
John's spellchecker patch plus a new helper function getStringFromBrowser.
[lyx.git] / src / frontends / xforms / FormFiledialog.C
1 /**
2  * \file FormFiledialog.C
3  * Copyright 2001 the LyX Team
4  * Read the file COPYING
5  *
6  * \author unknown
7  * \author John Levon
8  */
9
10 #include <config.h>
11
12 #include <unistd.h>
13 #include <cstdlib>
14 #include <pwd.h>
15 #include <grp.h>
16 //#include <cstring>
17 #include <map>
18 #include <algorithm>
19
20 using std::map;
21 using std::max;
22 using std::sort;
23
24 #include "frontends/Alert.h"
25 #include "support/FileInfo.h"
26 #include "support/lyxlib.h"
27 #include "support/lstrings.h"
28 #include "gettext.h"
29 #include "frontends/Dialogs.h"
30
31 #ifdef HAVE_ERRNO_H
32 #include <cerrno>
33 #endif
34
35 #if HAVE_DIRENT_H
36 # include <dirent.h>
37 # define NAMLEN(dirent) strlen((dirent)->d_name)
38 #else
39 # define dirent direct
40 # define NAMLEN(dirent) (dirent)->d_namlen
41 # if HAVE_SYS_NDIR_H
42 #  include <sys/ndir.h>
43 # endif
44 # if HAVE_SYS_DIR_H
45 #  include <sys/dir.h>
46 # endif
47 # if HAVE_NDIR_H
48 #  include <ndir.h>
49 # endif
50 #endif
51
52 #if TIME_WITH_SYS_TIME
53 # include <sys/time.h>
54 # include <ctime>
55 #else
56 # if HAVE_SYS_TIME_H
57 #  include <sys/time.h>
58 # else
59 #  include <ctime>
60 # endif
61 #endif
62
63 // FIXME: should be autoconfiscated
64 #ifdef BROKEN_HEADERS
65 extern "C" int gettimeofday(struct timeval *, struct timezone *);
66 #endif
67
68 #ifdef __GNUG__
69 #pragma implementation
70 #endif
71
72 #include "support/filetools.h"
73 #include "FormFiledialog.h"
74
75 namespace {
76
77 // six months, in seconds
78 long const SIX_MONTH_SEC = 6L * 30L * 24L * 60L * 60L;
79 //static
80 long const ONE_HOUR_SEC = 60L * 60L;
81
82 extern "C" {
83         
84         static
85         int C_LyXFileDlg_CancelCB(FL_FORM *fl, void *xev)
86         {
87                 return FileDialog::Private::CancelCB(fl, xev);
88         }
89         
90         static
91         void C_LyXFileDlg_DoubleClickCB(FL_OBJECT * ob, long data)
92         {
93                 FileDialog::Private::DoubleClickCB(ob, data);
94         }
95
96         static
97         void C_LyXFileDlg_FileDlgCB(FL_OBJECT * ob, long data)
98         {
99                 FileDialog::Private::FileDlgCB(ob, data);
100         }
101
102 }
103
104 } // namespace anon
105
106
107 // *** User cache class implementation
108 /// User cache class definition
109 class UserCache {
110 public:
111         /// seeks user name from group ID
112         string const & find(uid_t ID) const {
113                 Users::const_iterator cit = users.find(ID);
114                 if (cit == users.end()) {
115                         add(ID);
116                         return users[ID];
117                 }
118                 return cit->second;
119         }
120 private:
121         ///
122         void add(uid_t ID) const;
123         ///
124         typedef map<uid_t, string> Users;
125         ///
126         mutable Users users;
127 };
128
129
130 void UserCache::add(uid_t ID) const
131 {
132         string pszNewName;
133         struct passwd * pEntry;
134         
135         // gets user name
136         if ((pEntry = getpwuid(ID)))
137                 pszNewName = pEntry->pw_name;
138         else {
139                 pszNewName = tostr(ID);
140         }
141         
142         // adds new node
143         users[ID] = pszNewName;
144 }       
145
146
147 /// Group cache class definition
148 class GroupCache {
149 public:
150         /// seeks group name from group ID
151         string const & find(gid_t ID) const ;
152 private:
153         ///
154         void add(gid_t ID) const;
155         ///
156         typedef map<gid_t, string> Groups;
157         ///
158         mutable Groups groups;
159 };
160
161
162 string const & GroupCache::find(gid_t ID) const
163 {
164         Groups::const_iterator cit = groups.find(ID);
165         if (cit == groups.end()) {
166                 add(ID);
167                 return groups[ID];
168         }
169         return cit->second;
170 }
171
172
173 void GroupCache::add(gid_t ID) const
174 {
175         string pszNewName;
176         struct group * pEntry;
177         
178         // gets user name
179         if ((pEntry = getgrgid(ID))) pszNewName = pEntry->gr_name;
180         else {
181                 pszNewName = tostr(ID);
182         }
183         // adds new node
184         groups[ID] = pszNewName;
185 }
186
187
188 namespace {
189
190 // local instances
191 UserCache lyxUserCache;
192 GroupCache lyxGroupCache;
193
194 } // namespace anon
195
196
197 // compares two LyXDirEntry objects content (used for sort)
198 class comp_direntry {
199 public:
200         int operator()(DirEntry const & r1,
201                        DirEntry const & r2) const ;
202 };
203         int comp_direntry::operator()(DirEntry const & r1,
204                        DirEntry const & r2) const {
205                 bool r1d = suffixIs(r1.pszName, '/');
206                 bool r2d = suffixIs(r2.pszName, '/');
207                 if (r1d && !r2d) return 1;
208                 if (!r1d && r2d) return 0;
209                 return r1.pszName < r2.pszName;
210         }
211
212
213 // *** FileDialog::Private class implementation
214
215 // static members
216 FD_form_filedialog * FileDialog::Private::pFileDlgForm = 0;
217 FileDialog::Private * FileDialog::Private::pCurrentDlg = 0;
218
219
220 // Reread: updates dialog list to match class directory
221 void FileDialog::Private::Reread()
222 {
223         // Opens directory
224         DIR * pDirectory = ::opendir(pszDirectory.c_str());
225         if (!pDirectory) {
226                 Alert::err_alert(_("Warning! Couldn't open directory."),
227                              pszDirectory);
228                 pszDirectory = lyx::getcwd();
229                 pDirectory = ::opendir(pszDirectory.c_str());
230         }
231
232         // Clear the present namelist
233         direntries.clear();
234
235         // Updates display
236         fl_hide_object(pFileDlgForm->List);
237         fl_clear_browser(pFileDlgForm->List);
238         fl_set_input(pFileDlgForm->DirBox, pszDirectory.c_str());
239
240         // Splits complete directory name into directories and compute depth
241         iDepth = 0;
242         string line, Temp;
243         char szMode[15];
244         string File = pszDirectory;
245         if (File != "/") {
246                 File = split(File, Temp, '/');
247         }
248         while (!File.empty() || !Temp.empty()) {
249                 string dline = "@b"+line + Temp + '/';          
250                 fl_add_browser_line(pFileDlgForm->List, dline.c_str());
251                 File = split(File, Temp, '/');
252                 line += ' ';
253                 ++iDepth;
254         }
255
256         // Parses all entries of the given subdirectory
257         time_t curTime = time(0);
258         rewinddir(pDirectory);
259         struct dirent * pDirEntry;
260         while ((pDirEntry = readdir(pDirectory))) {
261                 bool isLink = false, isDir = false;
262
263                 // If the pattern doesn't start with a dot, skip hidden files
264                 if (!pszMask.empty() && pszMask[0] != '.' &&
265                     pDirEntry->d_name[0] == '.')
266                         continue;
267
268                 // Gets filename
269                 string fname = pDirEntry->d_name;
270
271                 // Under all circumstances, "." and ".." are not wanted
272                 if (fname == "." || fname == "..")
273                         continue;
274
275                 // gets file status
276                 File = AddName(pszDirectory, fname);
277
278                 // FIXME: we don't get this file exists/stattable
279                 FileInfo fileInfo(File, true);
280                 fileInfo.modeString(szMode);
281                 unsigned int nlink = fileInfo.getNumberOfLinks();
282                 string user =   lyxUserCache.find(fileInfo.getUid());
283                 string group = lyxGroupCache.find(fileInfo.getGid());
284
285                 time_t modtime = fileInfo.getModificationTime();
286                 string Time = ctime(&modtime);
287                 
288                 if (curTime > modtime + SIX_MONTH_SEC
289                     || curTime < modtime + ONE_HOUR_SEC) {
290                         // The file is fairly old or in the future. POSIX says
291                         // the cutoff is 6 months old. Allow a 1 hour slop
292                         // factor for what is considered "the future", to
293                         // allow for NFS server/client clock disagreement.
294                         // Show the year instead of the time of day.
295                         Time.erase(10, 9);
296                         Time.erase(15, string::npos);
297                 } else {
298                         Time.erase(16, string::npos);
299                 }
300
301                 string Buffer = string(szMode) + ' ' +
302                         tostr(nlink) + ' ' +
303                         user + ' ' +
304                         group + ' ' +
305                         Time.substr(4, string::npos) + ' ';
306
307                 Buffer += pDirEntry->d_name;
308                 Buffer += fileInfo.typeIndicator();
309
310                 if ((isLink = fileInfo.isLink())) {
311                         string Link;
312
313                         if (LyXReadLink(File, Link)) {
314                                 Buffer += " -> ";
315                                 Buffer += Link;
316
317                                 // This gives the FileType of the file that
318                                 // is really pointed too after resolving all
319                                 // symlinks. This is not necessarily the same
320                                 // as the type of Link (which could again be a
321                                 // link). Is that intended?
322                                 //                              JV 199902
323                                 fileInfo.newFile(File);
324                                 Buffer += fileInfo.typeIndicator();
325                         }
326                 }
327
328                 // filters files according to pattern and type
329                 if (fileInfo.isRegular()
330                     || fileInfo.isChar()
331                     || fileInfo.isBlock()
332                     || fileInfo.isFifo()) {
333                         if (!regexMatch(fname, pszMask))
334                                 continue;
335                 } else if (!(isDir = fileInfo.isDir()))
336                         continue;
337
338                 DirEntry tmp;
339
340                 // Note pszLsEntry is an string!
341                 tmp.pszLsEntry = Buffer;
342                 // creates used name
343                 string temp = fname;
344                 if (isDir) temp += '/';
345
346                 tmp.pszName = temp;
347                 // creates displayed name
348                 temp = pDirEntry->d_name;
349                 if (isLink)
350                         temp += '@';
351                 else
352                         temp += fileInfo.typeIndicator();
353                 tmp.pszDisplayed = temp;
354
355                 direntries.push_back(tmp);
356         }
357
358         closedir(pDirectory);
359
360         // Sort the names
361         sort(direntries.begin(), direntries.end(), comp_direntry());
362         
363         // Add them to directory box
364         for (DirEntries::const_iterator cit = direntries.begin();
365              cit != direntries.end(); ++cit) {
366                 string const temp = line + cit->pszDisplayed;
367                 fl_add_browser_line(pFileDlgForm->List, temp.c_str());
368         }
369         fl_set_browser_topline(pFileDlgForm->List, iDepth);
370         fl_show_object(pFileDlgForm->List);
371         iLastSel = -1;
372 }
373
374
375 // SetDirectory: sets dialog current directory
376 void FileDialog::Private::SetDirectory(string const & Path)
377 {
378         string tmp;
379  
380         if (!pszDirectory.empty()) {
381                 string TempPath = ExpandPath(Path); // Expand ~/
382                 TempPath = MakeAbsPath(TempPath, pszDirectory);
383                 tmp = MakeAbsPath(TempPath);
384         } else {
385                 tmp = MakeAbsPath(Path);
386         }
387  
388         // must check the directory exists
389         DIR * pDirectory = ::opendir(tmp.c_str());
390         if (!pDirectory) {
391                 Alert::err_alert(_("Warning! Couldn't open directory."), tmp);
392         } else {
393                 ::closedir(pDirectory);
394                 pszDirectory = tmp;
395         }
396 }
397
398
399 // SetMask: sets dialog file mask
400 void FileDialog::Private::SetMask(string const & NewMask)
401 {
402         pszMask = NewMask;
403         fl_set_input(pFileDlgForm->PatBox, pszMask.c_str());
404 }
405
406
407 // SetInfoLine: sets dialog information line
408 void FileDialog::Private::SetInfoLine(string const & Line)
409 {
410         pszInfoLine = Line;
411         fl_set_object_label(pFileDlgForm->FileInfo, pszInfoLine.c_str());
412 }
413
414
415 FileDialog::Private::Private()
416 {
417         pszDirectory = MakeAbsPath(string("."));
418         pszMask = '*';
419
420         // Creates form if necessary.
421         if (!pFileDlgForm) {
422                 pFileDlgForm = build_filedialog();
423                 // Set callbacks. This means that we don't need a patch file
424                 fl_set_object_callback(pFileDlgForm->DirBox,
425                                        C_LyXFileDlg_FileDlgCB, 0);
426                 fl_set_object_callback(pFileDlgForm->PatBox,
427                                        C_LyXFileDlg_FileDlgCB, 1);
428                 fl_set_object_callback(pFileDlgForm->List,
429                                        C_LyXFileDlg_FileDlgCB, 2);
430                 fl_set_object_callback(pFileDlgForm->Filename,
431                                        C_LyXFileDlg_FileDlgCB, 3);
432                 fl_set_object_callback(pFileDlgForm->Rescan,
433                                        C_LyXFileDlg_FileDlgCB, 10);
434                 fl_set_object_callback(pFileDlgForm->Home,
435                                        C_LyXFileDlg_FileDlgCB, 11);
436                 fl_set_object_callback(pFileDlgForm->User1,
437                                        C_LyXFileDlg_FileDlgCB, 12);
438                 fl_set_object_callback(pFileDlgForm->User2,
439                                        C_LyXFileDlg_FileDlgCB, 13);
440                 
441                 // Make sure pressing the close box doesn't crash LyX. (RvdK)
442                 fl_set_form_atclose(pFileDlgForm->form,
443                                     C_LyXFileDlg_CancelCB, 0);
444                 // Register doubleclick callback
445                 fl_set_browser_dblclick_callback(pFileDlgForm->List,
446                                                  C_LyXFileDlg_DoubleClickCB,
447                                                  0);
448         }
449         fl_hide_object(pFileDlgForm->User1);
450         fl_hide_object(pFileDlgForm->User2);
451
452         r_ = Dialogs::redrawGUI.connect(SigC::slot(this, &FileDialog::Private::redraw));
453 }
454
455
456 FileDialog::Private::~Private()
457 {
458         r_.disconnect();
459 }
460
461
462 void FileDialog::Private::redraw()
463 {
464         if (pFileDlgForm->form && pFileDlgForm->form->visible)
465                 fl_redraw_form(pFileDlgForm->form);
466 }
467
468
469 // SetButton: sets file selector user button action
470 void FileDialog::Private::SetButton(int iIndex, string const & pszName,
471                            string const & pszPath)
472 {
473         FL_OBJECT * pObject;
474         string * pTemp;
475
476         if (iIndex == 0) {
477                 pObject = pFileDlgForm->User1;
478                 pTemp = &pszUserPath1;
479         } else if (iIndex == 1) {                       
480                 pObject = pFileDlgForm->User2;
481                 pTemp = &pszUserPath2;
482         } else return;
483
484         if (!pszName.empty() && !pszPath.empty()) {
485                 fl_set_object_label(pObject, pszName.c_str());
486                 fl_show_object(pObject);
487                 *pTemp = pszPath;
488         } else {
489                 fl_hide_object(pObject);
490                 pTemp->erase();
491         }
492 }
493
494
495 // GetDirectory: gets last dialog directory
496 string const FileDialog::Private::GetDirectory() const
497 {
498         if (!pszDirectory.empty())
499                 return pszDirectory;
500         else
501                 return string(".");
502 }
503
504
505 // RunDialog: handle dialog during file selection
506 bool FileDialog::Private::RunDialog()
507 {
508         force_cancel = false;
509         force_ok = false;
510         
511         // event loop
512         while (true) {
513                 FL_OBJECT * pObject = fl_do_forms();
514
515                 if (pObject == pFileDlgForm->Ready) {
516                         if (HandleOK())
517                                 return true;
518                 } else if (pObject == pFileDlgForm->Cancel
519                            || force_cancel)
520                         return false;
521                 else if (force_ok)
522                         return true;
523         }
524 }
525
526
527 // XForms objects callback (static)
528 void FileDialog::Private::FileDlgCB(FL_OBJECT *, long lArgument)
529 {
530         if (!pCurrentDlg) return;
531
532         switch (lArgument) {
533
534         case 0: // get directory
535                 pCurrentDlg->SetDirectory(fl_get_input(pFileDlgForm->DirBox));
536                 pCurrentDlg->Reread();
537                 break;
538
539         case 1: // get mask
540                 pCurrentDlg->SetMask(fl_get_input(pFileDlgForm->PatBox));
541                 pCurrentDlg->Reread();
542                 break;
543
544         case 2: // list
545                 pCurrentDlg->HandleListHit();
546                 break;  
547
548         case 10: // rescan
549                 pCurrentDlg->SetDirectory(fl_get_input(pFileDlgForm->DirBox));
550                 pCurrentDlg->SetMask(fl_get_input(pFileDlgForm->PatBox));
551                 pCurrentDlg->Reread();
552                 break;
553
554         case 11: // home
555                 pCurrentDlg->SetDirectory(GetEnvPath("HOME"));
556                 pCurrentDlg->SetMask(fl_get_input(pFileDlgForm->PatBox));
557                 pCurrentDlg->Reread();
558                 break;
559
560         case 12: // user button 1
561                 if (!pCurrentDlg->pszUserPath1.empty()) {
562                         pCurrentDlg->SetDirectory(pCurrentDlg->pszUserPath1);
563                         pCurrentDlg->SetMask(fl_get_input(pFileDlgForm
564                                                           ->PatBox));
565                         pCurrentDlg->Reread();
566                 }
567                 break;
568
569         case 13: // user button 2
570                 if (!pCurrentDlg->pszUserPath2.empty()) {
571                         pCurrentDlg->SetDirectory(pCurrentDlg->pszUserPath2);
572                         pCurrentDlg->SetMask(fl_get_input(pFileDlgForm
573                                                           ->PatBox));
574                         pCurrentDlg->Reread();
575                 }
576                 break;
577
578         }
579 }
580
581
582 // Handle callback from list
583 void FileDialog::Private::HandleListHit()
584 {
585         // set info line
586         int const iSelect = fl_get_browser(pFileDlgForm->List);
587         if (iSelect > iDepth)  {
588                 SetInfoLine(direntries[iSelect - iDepth - 1].pszLsEntry);
589         } else {
590                 SetInfoLine(string());
591         }
592 }
593
594
595 // Callback for double click in list
596 void FileDialog::Private::DoubleClickCB(FL_OBJECT *, long)
597 {
598         if (pCurrentDlg->HandleDoubleClick())
599                 // Simulate click on OK button
600                 pCurrentDlg->Force(false);
601 }
602
603
604 // Handle double click from list
605 bool FileDialog::Private::HandleDoubleClick()
606 {
607         string pszTemp;
608
609         // set info line
610         bool isDir = true;
611         int const iSelect = fl_get_browser(pFileDlgForm->List);
612         if (iSelect > iDepth)  {
613                 pszTemp = direntries[iSelect - iDepth - 1].pszName;
614                 SetInfoLine(direntries[iSelect - iDepth - 1].pszLsEntry);
615                 if (!suffixIs(pszTemp, '/')) {
616                         isDir = false;
617                         fl_set_input(pFileDlgForm->Filename, pszTemp.c_str());
618                 }
619         } else if (iSelect != 0) {
620                 SetInfoLine(string());
621         } else
622                 return true;
623
624         // executes action
625         if (isDir) {
626                 string Temp;
627
628                 // builds new directory name
629                 if (iSelect > iDepth) {
630                         // Directory deeper down
631                         // First, get directory with trailing /
632                         Temp = fl_get_input(pFileDlgForm->DirBox);
633                         if (!suffixIs(Temp, '/'))
634                                 Temp += '/';
635                         Temp += pszTemp;
636                 } else {
637                         // Directory higher up
638                         Temp.erase();
639                         for (int i = 0; i < iSelect; ++i) {
640                                 string piece = fl_get_browser_line(pFileDlgForm->List, i+1);
641                                 // The '+2' is here to count the '@b' (JMarc)
642                                 Temp += piece.substr(i + 2);
643                         }
644                 }
645
646                 // assigns it
647                 SetDirectory(Temp);
648                 Reread();
649                 return false;
650         }
651         return true;
652 }
653
654
655 // Handle OK button call
656 bool FileDialog::Private::HandleOK()
657 {
658         // mask was changed
659         string pszTemp = fl_get_input(pFileDlgForm->PatBox);
660         if (pszTemp != pszMask) {
661                 SetMask(pszTemp);
662                 Reread();
663                 return false;
664         }
665
666         // directory was changed
667         pszTemp = fl_get_input(pFileDlgForm->DirBox);
668         if (pszTemp!= pszDirectory) {
669                 SetDirectory(pszTemp);
670                 Reread();
671                 return false;
672         }
673         
674         // Handle return from list
675         int const select = fl_get_browser(pFileDlgForm->List);
676         if (select > iDepth) {
677                 string const temp = direntries[select - iDepth - 1].pszName;
678                 if (!suffixIs(temp, '/')) {
679                         // If user didn't type anything, use browser
680                         string const name =
681                                 fl_get_input(pFileDlgForm->Filename);
682                         if (name.empty()) {
683                                 fl_set_input(pFileDlgForm->Filename, temp.c_str());
684                         }
685                         return true;
686                 }
687         }
688
689         // Emulate a doubleclick
690         return HandleDoubleClick();
691 }
692
693
694 // Handle Cancel CB from WM close
695 int FileDialog::Private::CancelCB(FL_FORM *, void *)
696 {
697         // Simulate a click on the cancel button
698         pCurrentDlg->Force(true);
699         return FL_IGNORE;
700 }
701
702
703 // Simulates a click on OK/Cancel
704 void FileDialog::Private::Force(bool cancel)
705 {
706         if (cancel) {
707                 force_cancel = true;
708                 fl_set_button(pFileDlgForm->Cancel, 1);
709         } else {
710                 force_ok = true;
711                 fl_set_button(pFileDlgForm->Ready, 1);
712         }
713         // Start timer to break fl_do_forms loop soon
714         fl_set_timer(pFileDlgForm->timer, 0.1);
715 }
716
717
718 // Select: launches dialog and returns selected file
719 string const FileDialog::Private::Select(string const & title, string const & path,
720                                 string const & mask, string const & suggested)
721 {
722         // handles new mask and path
723         bool isOk = true;
724         if (!mask.empty()) {
725                 SetMask(mask);
726                 isOk = false;
727         }
728         if (!path.empty()) {
729                 SetDirectory(path);
730                 isOk = false;
731         }
732         if (!isOk) Reread();
733
734         // highlight the suggested file in the browser, if it exists.
735         int sel = 0;
736         string const filename = OnlyFilename(suggested);
737         if (!filename.empty()) {
738                 for (int i = 0;
739                      i < fl_get_browser_maxline(pFileDlgForm->List); ++i) {
740                         string s =
741                                 fl_get_browser_line(pFileDlgForm->List, i + 1);
742                         s = strip(frontStrip(s));
743                         if (s == filename) {
744                                 sel = i + 1;
745                                 break;
746                         }
747                 }
748         }
749         
750         if (sel != 0) fl_select_browser_line(pFileDlgForm->List, sel);
751         int const top = max(sel - 5, 1);
752         fl_set_browser_topline(pFileDlgForm->List, top);
753
754         // checks whether dialog can be started
755         if (pCurrentDlg) return string();
756         pCurrentDlg = this;
757
758         // runs dialog
759         SetInfoLine(string());
760         fl_set_input(pFileDlgForm->Filename, suggested.c_str());
761         fl_set_button(pFileDlgForm->Cancel, 0);
762         fl_set_button(pFileDlgForm->Ready, 0);
763         fl_set_focus_object(pFileDlgForm->form, pFileDlgForm->Filename);
764         fl_deactivate_all_forms();
765         fl_show_form(pFileDlgForm->form,
766                      FL_PLACE_MOUSE | FL_FREE_SIZE, 0,
767                      title.c_str());
768
769         isOk = RunDialog();
770         
771         fl_hide_form(pFileDlgForm->form);
772         fl_activate_all_forms();
773         pCurrentDlg = 0;
774
775         // Returns filename or string() if no valid selection was made
776         if (!isOk || !fl_get_input(pFileDlgForm->Filename)[0]) return string();
777
778         pszFileName = fl_get_input(pFileDlgForm->Filename);
779
780         if (!AbsolutePath(pszFileName)) {
781                 pszFileName = AddName(fl_get_input(pFileDlgForm->DirBox),
782                                       pszFileName);
783         }
784         return pszFileName;
785 }