]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlCommand.C
implement getLabelList
[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 "lyxfunc.h"
24 #include "LyXView.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 InsetCommandParams const ControlCommand::getParams(InsetCommand const & inset)
40 {
41         return inset.params();
42 }
43
44 void ControlCommand::applyParamsToInset()
45 {
46         inset()->setParams(params());
47         lv_.view()->updateInset(inset(), true);
48 }
49
50 void ControlCommand::applyParamsNoInset()
51 {
52         if (action_ == LFUN_NOACTION) return;
53         lv_.getLyXFunc()->Dispatch(action_, params().getAsString());
54 }
55