]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlCommand.C
The reducing file dependencies in the frontends patch.
[lyx.git] / src / frontends / controllers / ControlCommand.C
1 /* This file is part of
2  * ====================================================== 
3  *
4  *           LyX, The Document Processor
5  *
6  *           Copyright 2001 The LyX Team.
7  *
8  * ======================================================
9  *
10  * \file ControlCommand.C
11  * \author Angus Leeming <a.leeming@ic.ac.uk>
12  */
13
14 #ifdef __GNUG__
15 #pragma implementation
16 #endif
17
18 #include <config.h>
19
20 #include "ViewBase.h"
21 #include "ButtonControllerBase.h"
22 #include "ControlCommand.h"
23 #include "ControlInset.tmpl"
24 #include "buffer.h"
25 #include "Dialogs.h"
26 #include "LyXView.h"
27 #include "lyxfunc.h"
28 #include "BufferView.h"
29
30 ControlCommand::ControlCommand(LyXView & lv, Dialogs & d, kb_action ac)
31         : ControlInset<InsetCommand, InsetCommandParams>(lv, d),
32           action_(ac)
33 {}
34
35
36 InsetCommandParams const ControlCommand::getParams(string const & arg)
37 {
38         InsetCommandParams params;
39         params.setFromString(arg);
40         return params;
41 }
42
43
44 InsetCommandParams const ControlCommand::getParams(InsetCommand const & inset)
45 {
46         return inset.params();
47 }
48
49
50 void ControlCommand::applyParamsToInset()
51 {
52         inset()->setParams(params());
53         lv_.view()->updateInset(inset(), true);
54 }
55
56
57 void ControlCommand::applyParamsNoInset()
58 {
59         if (action_ == LFUN_NOACTION) return;
60         lv_.getLyXFunc()->dispatch(action_, params().getAsString());
61 }
62