]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlCommand.C
John's character.C patch (bug fix).
[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 "buffer.h"
24 #include "Dialogs.h"
25 #include "LyXView.h"
26 #include "lyxfunc.h"
27 #include "BufferView.h"
28
29 ControlCommand::ControlCommand(LyXView & lv, Dialogs & d, kb_action ac)
30         : ControlInset<InsetCommand, InsetCommandParams>(lv, d),
31           action_(ac)
32 {}
33
34
35 InsetCommandParams const ControlCommand::getParams(string const & arg)
36 {
37         InsetCommandParams params;
38         params.setFromString(arg);
39         return params;
40 }
41
42
43 InsetCommandParams const ControlCommand::getParams(InsetCommand const & inset)
44 {
45         return inset.params();
46 }
47
48
49 void ControlCommand::applyParamsToInset()
50 {
51         inset()->setParams(params());
52         lv_.view()->updateInset(inset(), true);
53 }
54
55
56 void ControlCommand::applyParamsNoInset()
57 {
58         if (action_ == LFUN_NOACTION) return;
59         lv_.getLyXFunc()->dispatch(action_, params().getAsString());
60 }
61