]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlCommand.C
prefs/tabular MVC work
[lyx.git] / src / frontends / controllers / ControlCommand.C
1 /**
2  * \file ControlCommand.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Angus Leeming
7  *
8  * Full author contact details are available in file CREDITS
9  */
10
11 #include <config.h>
12
13 #ifdef __GNUG__
14 #pragma implementation
15 #endif
16
17 #include "ControlCommand.h"
18
19 #include "BufferView.h"
20 #include "funcrequest.h"
21 #include "lyxfunc.h"
22
23
24 ControlCommand::ControlCommand(LyXView & lv, Dialogs & d, kb_action ac)
25         : ControlInset<InsetCommand, InsetCommandParams>(lv, d),
26           action_(ac)
27 {}
28
29
30 InsetCommandParams const ControlCommand::getParams(string const & arg)
31 {
32         InsetCommandParams params;
33         params.setFromString(arg);
34         return params;
35 }
36
37
38 InsetCommandParams const ControlCommand::getParams(InsetCommand const & inset)
39 {
40         return inset.params();
41 }
42
43
44 void ControlCommand::applyParamsToInset()
45 {
46         inset()->setParams(params());
47         bufferview()->updateInset(inset(), true);
48 }
49
50
51 void ControlCommand::applyParamsNoInset()
52 {
53         if (action_ == LFUN_NOACTION)
54                 return;
55         lyxfunc().dispatch(FuncRequest(action_, params().getAsString()));
56 }