]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FileDialog.C
doxygen fixes
[lyx.git] / src / frontends / xforms / FileDialog.C
1 /**
2  * \file xforms/FileDialog.C
3  * Copyright 2001 the LyX Team
4  * Read the file COPYING
5  *
6  * \author John Levon, moz@compsoc.man.ac.uk
7  */
8
9 #include <config.h>
10
11 #ifdef __GNUG__
12 #pragma implementation
13 #endif
14
15 #include "FormFiledialog.h"
16 #include "frontends/FileDialog.h"
17 // temp. hack until Allow/prohibitInput is not
18 // needed any more in src/ - for now it's simplest
19 // to leave it there 
20 #include "LyXView.h" 
21 #include "bufferview_funcs.h"
22 #include "gettext.h"
23 #include "commandtags.h"
24 #include "debug.h"
25 #include "support/lstrings.h" 
26 #include <utility>
27
28
29 using std::make_pair;
30 using std::pair;
31 using std::endl;
32
33 FileDialog::FileDialog(LyXView *lv, string const &t, kb_action s, Button b1, Button b2)
34         : private_(0), lv_(lv), title_(t), success_(s)
35 {
36         private_ = new FileDialog::Private();
37
38         private_->SetButton(0, b1.first, b1.second); 
39         private_->SetButton(1, b2.first, b2.second);
40 }
41
42
43 FileDialog::~FileDialog()
44 {
45         delete private_;
46         private_ = 0;
47 }
48
49
50 FileDialog::Result const FileDialog::Select(string const & path, string const & mask, string const & suggested)
51 {
52         string filter = mask;
53
54         if (mask.empty())
55                 filter = _("*");
56         else {
57                 rsplit(mask, filter, '|');
58                 if (filter.empty())
59                         filter = mask;
60         }
61
62         lyxerr[Debug::GUI] << "Select with path \"" << path << "\", mask \"" << filter << "\", suggested \"" << suggested << "\"" << endl;
63
64         // no support for asynchronous selection yet
65
66         lv_->prohibitInput();
67
68         FileDialog::Result result;
69
70         result.first = FileDialog::Chosen;
71         result.second = private_->Select(title_, path, filter, suggested);
72  
73         lv_->allowInput();
74  
75         return result;
76 }