]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlCommand.C
dont use pragma impementation and interface anymore
[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
14 #include "ControlCommand.h"
15
16 #include "BufferView.h"
17 #include "funcrequest.h"
18 #include "lyxfunc.h"
19
20
21 ControlCommand::ControlCommand(LyXView & lv, Dialogs & d, kb_action ac)
22         : ControlInset<InsetCommand, InsetCommandParams>(lv, d),
23           action_(ac)
24 {}
25
26
27 InsetCommandParams const ControlCommand::getParams(string const & arg)
28 {
29         InsetCommandParams params;
30         params.setFromString(arg);
31         return params;
32 }
33
34
35 InsetCommandParams const ControlCommand::getParams(InsetCommand const & inset)
36 {
37         return inset.params();
38 }
39
40
41 void ControlCommand::applyParamsToInset()
42 {
43         inset()->setParams(params());
44         bufferview()->updateInset(inset(), true);
45 }
46
47
48 void ControlCommand::applyParamsNoInset()
49 {
50         if (action_ == LFUN_NOACTION)
51                 return;
52         lyxfunc().dispatch(FuncRequest(action_, params().getAsString()));
53 }