]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlBox.C
Overhaul the branches code.
[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
23 ControlBox::ControlBox(Dialog & parent)
24         : Dialog::Controller(parent)
25 {}
26
27
28 bool ControlBox::initialiseParams(string const & data)
29 {
30         InsetBoxParams params("");
31         InsetBoxMailer::string2params(data, params);
32         params_.reset(new InsetBoxParams(params));
33
34         return true;
35
36 }
37
38
39 void ControlBox::clearParams()
40 {
41         params_.reset();
42 }
43
44
45 void ControlBox::dispatchParams()
46 {
47         string const lfun = InsetBoxMailer::params2string(params());
48         kernel().dispatch(FuncRequest(LFUN_INSET_APPLY, lfun));
49 }
50
51
52 void box_gui_tokens(vector<string> & ids, vector<string> & gui_names)
53 {
54         char const * const ids_[] = {
55                 "Frameless", "Boxed", "ovalbox",
56                 "Ovalbox", "Shadowbox", "Doublebox"};
57         size_t const ids_size = sizeof(ids_) / sizeof(char *);
58         ids = vector<string>(ids_, ids_ + ids_size);
59         gui_names.clear();
60         gui_names.push_back(_("No frame drawn"));
61         gui_names.push_back(_("Rectangular box"));
62         gui_names.push_back(_("Oval box, thin"));
63         gui_names.push_back(_("Oval box, thick"));
64         gui_names.push_back(_("Shadow box"));
65         gui_names.push_back(_("Double box"));
66 }
67
68 void box_gui_tokens_special_length(vector<string> & ids,
69         vector<string> & gui_names)
70 {
71         char const * const ids_[] = {
72                 "none", "height", "depth",
73                 "totalheight", "width"};
74         size_t const ids_size = sizeof(ids_) / sizeof(char *);
75         ids = vector<string>(ids_, ids_ + ids_size);
76         gui_names.clear();
77         gui_names.push_back(_("None"));
78         gui_names.push_back(_("Height"));
79         gui_names.push_back(_("Depth"));
80         gui_names.push_back(_("Total Height"));
81         gui_names.push_back(_("Width"));
82 }