]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormTabularCreate.C
Yet more dialog tweaking from Rob.
[lyx.git] / src / frontends / xforms / FormTabularCreate.C
1 /**
2  * \file xforms/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 #include <utility>
13
14 #ifdef __GNUG__
15 #pragma implementation
16 #endif
17
18 #include "xformsBC.h"
19 #include "ControlTabularCreate.h"
20 #include "FormTabularCreate.h"
21 #include "forms/form_tabular_create.h"
22 #include "support/lstrings.h"
23 #include FORMS_H_LOCATION
24
25
26 using std::make_pair;
27
28
29 typedef FormCB<ControlTabularCreate, FormDB<FD_tabular_create> > base_class;
30
31 FormTabularCreate::FormTabularCreate()
32         : base_class(_("Insert Tabular"))
33 {}
34
35
36 void FormTabularCreate::build()
37 {
38         dialog_.reset(build_tabular_create(this));
39
40         fl_set_slider_bounds(dialog_->slider_rows, 1, 50);
41         fl_set_slider_bounds(dialog_->slider_columns, 1, 50);
42         fl_set_slider_value(dialog_->slider_rows, 5);
43         fl_set_slider_value(dialog_->slider_columns, 5);
44         fl_set_slider_precision(dialog_->slider_rows, 0);
45         fl_set_slider_precision(dialog_->slider_columns, 0);
46
47         // Manage the ok, apply and cancel/close buttons
48         bc().setOK(dialog_->button_ok);
49         bc().setApply(dialog_->button_apply);
50         bc().setCancel(dialog_->button_close);
51 }
52
53
54 void FormTabularCreate::apply()
55 {
56         unsigned int ysize = (unsigned int)(fl_get_slider_value(dialog_->slider_columns) + 0.5);
57         unsigned int xsize = (unsigned int)(fl_get_slider_value(dialog_->slider_rows) + 0.5);
58
59         controller().params() = make_pair(xsize, ysize);
60 }