]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlInclude.C
Removed // -*- C++ -*- from all .C files!
[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 "ViewBase.h"
19 #include "ButtonControllerBase.h"
20 #include "ControlInclude.h"
21 #include "buffer.h"
22 #include "Dialogs.h"
23 #include "LyXView.h"
24 #include "gettext.h"
25
26 #include "helper_funcs.h"
27 #include "lyxrc.h"
28
29 using std::pair;
30 using std::make_pair;
31 using SigC::slot;
32
33 ControlInclude::ControlInclude(LyXView & lv, Dialogs & d)
34         : ControlInset<InsetInclude, InsetInclude::Params>(lv, d)
35 {
36         d_.showInclude.connect(slot(this, &ControlInclude::showInset));
37 }
38
39
40 void ControlInclude::applyParamsToInset()
41 {
42         inset()->set(params());
43         lv_.view()->updateInset(inset(), true);
44 }
45
46
47 string const ControlInclude::Browse(string const & in_name, Type in_type)
48 {
49         string const title = N_("Select document to include");
50
51         string pattern;
52                    
53         // input TeX, verbatim, or LyX file ?
54         switch (in_type) {
55         case INPUT:
56             pattern = _("*.tex| LaTeX Documents (*.tex)");
57             break;
58
59         case VERBATIM:
60             pattern = _("*| All files ");
61             break;
62
63         case INCLUDE:
64             pattern = _("*.lyx| LyX Documents (*.lyx)");
65             break;
66         }
67         
68         pair<string, string> dir1(N_("Documents"), string(lyxrc.document_path));
69
70         return browseFile(&lv_, in_name, title, pattern, dir1,
71                           make_pair(string(), string()));
72 }