]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormTabularCreate.C
sourcedoc-friendly files.
[lyx.git] / src / frontends / xforms / FormTabularCreate.C
1 /**
2  * \file FormTabularCreate.C
3  * Copyright 2000-2001 The LyX Team.
4  * See the file COPYING.
5  *
6  * \author \author Jürgen Vigna, jug@sad.it
7  */
8
9 #include <config.h>
10 #include <utility>
11
12 #ifdef __GNUG__
13 #pragma implementation
14 #endif
15
16 #include "xformsBC.h"
17 #include "ControlTabularCreate.h"
18 #include "FormTabularCreate.h"
19 #include "form_tabular_create.h"
20 #include "support/lstrings.h"
21
22
23 using std::make_pair;
24
25
26 typedef FormCB<ControlTabularCreate, FormDB<FD_form_tabular_create> > base_class;
27
28 FormTabularCreate::FormTabularCreate(ControlTabularCreate & c)
29         : base_class(c, _("Insert Tabular"))
30 {}
31
32
33 void FormTabularCreate::build()
34 {
35         dialog_.reset(build_tabular_create());
36
37         fl_set_slider_bounds(dialog_->slider_rows, 1, 50);
38         fl_set_slider_bounds(dialog_->slider_columns, 1, 50);
39         fl_set_slider_value(dialog_->slider_rows, 5);
40         fl_set_slider_value(dialog_->slider_columns, 5);
41         fl_set_slider_precision(dialog_->slider_rows, 0);
42         fl_set_slider_precision(dialog_->slider_columns, 0);
43
44         // Manage the ok, apply and cancel/close buttons
45         bc().setOK(dialog_->button_ok);
46         bc().setApply(dialog_->button_apply);
47         bc().setCancel(dialog_->button_cancel);
48 }
49
50
51 void FormTabularCreate::apply()
52 {
53         unsigned int ysize = (unsigned int)(fl_get_slider_value(dialog_->slider_columns) + 0.5);
54         unsigned int xsize = (unsigned int)(fl_get_slider_value(dialog_->slider_rows) + 0.5);
55
56         controller().params() = make_pair(xsize, ysize);
57 }