]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormTabularCreate.C
No longer pass Controller & or Dialogs & to the View c-tors.
[lyx.git] / src / frontends / xforms / FormTabularCreate.C
1 /**
2  * \file xforms/FormTabularCreate.C
3  * Copyright 2000-2001 The LyX Team.
4  * See the file COPYING.
5  *
6  * \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 "forms/form_tabular_create.h"
20 #include "support/lstrings.h"
21 #include FORMS_H_LOCATION
22
23
24 using std::make_pair;
25
26
27 typedef FormCB<ControlTabularCreate, FormDB<FD_tabular_create> > base_class;
28
29 FormTabularCreate::FormTabularCreate()
30         : base_class(_("Insert Tabular"))
31 {}
32
33
34 void FormTabularCreate::build()
35 {
36         dialog_.reset(build_tabular_create(this));
37
38         fl_set_slider_bounds(dialog_->slider_rows, 1, 50);
39         fl_set_slider_bounds(dialog_->slider_columns, 1, 50);
40         fl_set_slider_value(dialog_->slider_rows, 5);
41         fl_set_slider_value(dialog_->slider_columns, 5);
42         fl_set_slider_precision(dialog_->slider_rows, 0);
43         fl_set_slider_precision(dialog_->slider_columns, 0);
44
45         // Manage the ok, apply and cancel/close buttons
46         bc().setOK(dialog_->button_ok);
47         bc().setApply(dialog_->button_apply);
48         bc().setCancel(dialog_->button_close);
49 }
50
51
52 void FormTabularCreate::apply()
53 {
54         unsigned int ysize = (unsigned int)(fl_get_slider_value(dialog_->slider_columns) + 0.5);
55         unsigned int xsize = (unsigned int)(fl_get_slider_value(dialog_->slider_rows) + 0.5);
56
57         controller().params() = make_pair(xsize, ysize);
58 }