]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormTabularCreate.C
Change the semantics of 'none' and 'auto' viewers/editors: 'none' means now
[lyx.git] / src / frontends / xforms / FormTabularCreate.C
1 /**
2  * \file FormTabularCreate.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Jürgen Vigna
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "FormTabularCreate.h"
14 #include "controllers/ControlTabularCreate.h"
15 #include "forms/form_tabular_create.h"
16
17 #include "Tooltips.h"
18 #include "xformsBC.h"
19
20 #include "lyx_forms.h"
21
22 using std::make_pair;
23 using std::string;
24
25 namespace lyx {
26 namespace frontend {
27
28 typedef FormController<ControlTabularCreate, FormView<FD_tabular_create> > base_class;
29
30 FormTabularCreate::FormTabularCreate(Dialog & parent)
31         : base_class(parent, _("Insert Table"))
32 {}
33
34
35 void FormTabularCreate::build()
36 {
37         dialog_.reset(build_tabular_create(this));
38
39         // Manage the ok, apply and cancel/close buttons
40         bcview().setOK(dialog_->button_ok);
41         bcview().setApply(dialog_->button_apply);
42         bcview().setCancel(dialog_->button_close);
43
44         // set up the tooltips
45         string str = _("Number of columns in the tabular.");
46         tooltips().init(dialog_->slider_columns, str);
47         str = _("Number of rows in the tabular.");
48         tooltips().init(dialog_->slider_rows, str);
49 }
50
51
52 void FormTabularCreate::apply()
53 {
54         size_t ysize = static_cast<size_t>(
55                         fl_get_slider_value(dialog_->slider_columns) + 0.5);
56         size_t xsize = static_cast<size_t>(
57                         fl_get_slider_value(dialog_->slider_rows) + 0.5);
58
59         controller().params() = make_pair(xsize, ysize);
60 }
61
62 } // namespace frontend
63 } // namespace lyx