]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlBox.C
fix crash due to invalidated iterator
[lyx.git] / src / frontends / controllers / ControlBox.C
1 /**
2  * \file ControlBox.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Martin Vermeer (with useful hints from Angus Leeming)
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "ControlBox.h"
14 #include "funcrequest.h"
15 #include "insets/insetbox.h"
16 #include "gettext.h"
17
18
19 using std::string;
20 using std::vector;
21
22 namespace lyx {
23 namespace frontend {
24
25 ControlBox::ControlBox(Dialog & parent)
26         : Dialog::Controller(parent)
27 {}
28
29
30 bool ControlBox::initialiseParams(string const & data)
31 {
32         InsetBoxParams params("");
33         InsetBoxMailer::string2params(data, params);
34         params_.reset(new InsetBoxParams(params));
35
36         return true;
37
38 }
39
40
41 void ControlBox::clearParams()
42 {
43         params_.reset();
44 }
45
46
47 void ControlBox::dispatchParams()
48 {
49         string const lfun = InsetBoxMailer::params2string(params());
50         kernel().dispatch(FuncRequest(getLfun(), lfun));
51 }
52
53
54 void box_gui_tokens(vector<string> & ids, vector<string> & gui_names)
55 {
56         char const * const ids_[] = {
57                 "Frameless", "Boxed", "ovalbox",
58                 "Ovalbox", "Shadowbox", "Doublebox"};
59         size_t const ids_size = sizeof(ids_) / sizeof(char *);
60         ids = vector<string>(ids_, ids_ + ids_size);
61         gui_names.clear();
62         gui_names.push_back(_("No frame drawn"));
63         gui_names.push_back(_("Rectangular box"));
64         gui_names.push_back(_("Oval box, thin"));
65         gui_names.push_back(_("Oval box, thick"));
66         gui_names.push_back(_("Shadow box"));
67         gui_names.push_back(_("Double box"));
68 }
69
70 void box_gui_tokens_special_length(vector<string> & ids,
71         vector<string> & gui_names)
72 {
73         char const * const ids_[] = {
74                 "none", "height", "depth",
75                 "totalheight", "width"};
76         size_t const ids_size = sizeof(ids_) / sizeof(char *);
77         ids = vector<string>(ids_, ids_ + ids_size);
78         gui_names.clear();
79         gui_names.push_back(_("None"));
80         gui_names.push_back(_("Height"));
81         gui_names.push_back(_("Depth"));
82         gui_names.push_back(_("Total Height"));
83         gui_names.push_back(_("Width"));
84 }
85
86 } // namespace frontend
87 } // namespace lyx