]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlPreamble.C
Overhaul the branches code.
[lyx.git] / src / frontends / controllers / ControlPreamble.C
1 /**
2  * \file ControlPreamble.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Edwin Leuven
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13
14 #include "ControlPreamble.h"
15
16 #include "ViewBase.h"
17
18 #include "buffer.h"
19 #include "bufferparams.h"
20 #include "gettext.h"
21
22 #include "frontends/LyXView.h"
23
24
25 using std::string;
26
27
28 ControlPreamble::ControlPreamble(LyXView & lv, Dialogs & d)
29         : ControlDialogBD(lv, d)
30 {}
31
32
33 void ControlPreamble::apply()
34 {
35         if (!bufferIsAvailable())
36                 return;
37
38         view().apply();
39
40         buffer()->params().preamble = params();
41         buffer()->markDirty();
42         lv_.message(_("LaTeX preamble set"));
43 }
44
45
46 string const & ControlPreamble::params() const
47 {
48         return params_;
49 }
50
51
52 void ControlPreamble::params(string const & newparams)
53 {
54         params_ = newparams;
55 }
56
57
58 void ControlPreamble::setParams()
59 {
60         params_ = buffer()->params().preamble;
61 }
62
63
64 void ControlPreamble::clearParams()
65 {
66         params_.erase();
67 }