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