]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlCommand.C
Once again the user can use the Font button on the toolbar to get the current
[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
28 ControlCommand::ControlCommand(LyXView & lv, Dialogs & d, kb_action ac)
29         : ControlInset<InsetCommand, InsetCommandParams>(lv, d),
30           action_(ac)
31 {}
32
33
34 InsetCommandParams const ControlCommand::getParams(string const & arg)
35 {
36         InsetCommandParams params;
37         params.setFromString(arg);
38         return params;
39 }
40
41
42 InsetCommandParams const ControlCommand::getParams(InsetCommand const & inset)
43 {
44         return inset.params();
45 }
46
47
48 void ControlCommand::applyParamsToInset()
49 {
50         inset()->setParams(params());
51         lv_.view()->updateInset(inset(), true);
52 }
53
54
55 void ControlCommand::applyParamsNoInset()
56 {
57         if (action_ == LFUN_NOACTION) return;
58         lv_.getLyXFunc()->Dispatch(action_, params().getAsString());
59 }
60