]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlInclude.C
Fixed bugs in getStringFromVector, getVectorFromString
[lyx.git] / src / frontends / controllers / ControlInclude.C
1 /**
2  * \file ControlInclude.C
3  * Copyright 2001 the LyX Team
4  * Read the file COPYING
5  *
6  * \author Alejandro Aguilar Sierra
7  * \author John Levon, moz@compsoc.man.ac.uk
8  * \author Angus Leeming, a.leeming@.ac.uk
9  */
10
11 #include <config.h>
12 #include <utility>
13
14 #ifdef __GNUG__
15 #pragma implementation
16 #endif
17
18 #include "ControlInclude.h"
19 #include "buffer.h"
20 #include "Dialogs.h"
21 #include "lyxfunc.h"
22 #include "LyXView.h"
23 #include "gettext.h"
24
25 #include "helper_funcs.h"
26 #include "lyxrc.h"
27
28 using std::pair;
29 using std::make_pair;
30 using SigC::slot;
31
32 ControlInclude::ControlInclude(LyXView & lv, Dialogs & d)
33         : ControlInset<InsetInclude, InsetInclude::Params>(lv, d)
34 {
35         d_.showInclude.connect(slot(this, &ControlInclude::showInset));
36 }
37
38
39 void ControlInclude::applyParamsToInset()
40 {
41         inset()->set(params());
42         lv_.view()->updateInset(inset(), true);
43 }
44
45
46 string const ControlInclude::Browse(string const & in_name, Type in_type)
47 {
48         string const title = N_("Select document to include");
49
50         string pattern;
51                    
52         // input TeX, verbatim, or LyX file ?
53         switch (in_type) {
54         case INPUT:
55             pattern = _("*.tex| LaTeX Documents (*.tex)");
56             break;
57
58         case VERBATIM:
59             pattern = _("*| All files ");
60             break;
61
62         case INCLUDE:
63             pattern = _("*.lyx| LyX Documents (*.lyx)");
64             break;
65         }
66         
67         pair<string, string> dir1(N_("Documents"), string(lyxrc.document_path));
68
69         return browseFile(&lv_, in_name, title, pattern, dir1,
70                           make_pair(string(), string()));
71 }