]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiTabularCreate.cpp
rename buffer parameter math_number_before to math_numbering_side
[lyx.git] / src / frontends / qt4 / GuiTabularCreate.cpp
1 /**
2  * \file GuiTabularCreate.cpp
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author John Levon
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "GuiTabularCreate.h"
14
15 #include "EmptyTable.h"
16 #include "FuncRequest.h"
17
18 #include "support/convert.h"
19
20 #include <QSpinBox>
21 #include <QPushButton>
22
23 using namespace std;
24
25 namespace lyx {
26 namespace frontend {
27
28 GuiTabularCreate::GuiTabularCreate(GuiView & lv)
29         : GuiDialog(lv, "tabularcreate", qt_("Insert Table"))
30 {
31         setupUi(this);
32
33         rowsSB->setValue(5);
34         columnsSB->setValue(5);
35         table->setMinimumSize(100, 100);
36
37         connect(table, SIGNAL(rowsChanged(int)),
38                 rowsSB, SLOT(setValue(int)));
39         connect(table, SIGNAL(colsChanged(int)),
40                 columnsSB, SLOT(setValue(int)));
41         connect(rowsSB, SIGNAL(valueChanged(int)),
42                 table, SLOT(setNumberRows(int)));
43         connect(columnsSB, SIGNAL(valueChanged(int)),
44                 table, SLOT(setNumberColumns(int)));
45
46         connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
47         connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
48
49         connect(rowsSB, SIGNAL(valueChanged(int)),
50                 this, SLOT(rowsChanged(int)));
51         connect(columnsSB, SIGNAL(valueChanged(int)),
52                 this, SLOT(columnsChanged(int)));
53
54         bc().setPolicy(ButtonPolicy::IgnorantPolicy);
55         bc().setOK(okPB);
56         bc().setCancel(closePB);
57 }
58
59
60 void GuiTabularCreate::columnsChanged(int)
61 {
62         changed();
63 }
64
65
66 void GuiTabularCreate::rowsChanged(int)
67 {
68         changed();
69 }
70
71
72 void GuiTabularCreate::applyView()
73 {
74         params_.first = rowsSB->value();
75         params_.second = columnsSB->value();
76 }
77
78
79 bool GuiTabularCreate::initialiseParams(string const &)
80 {
81         params_.first  = 5;
82         params_.second = 5;
83         return true;
84 }
85
86
87 void GuiTabularCreate::clearParams()
88 {
89         params_.first  = 0;
90         params_.second = 0;
91 }
92
93
94 void GuiTabularCreate::dispatchParams()
95 {
96         string const data = convert<string>(params().first) + ' ' + convert<string>(params().second);
97         dispatch(FuncRequest(getLfun(), data));
98 }
99
100
101 Dialog * createGuiTabularCreate(GuiView & lv)
102 {
103         return new GuiTabularCreate(lv);
104 }
105
106
107 } // namespace frontend
108 } // namespace lyx
109
110 #include "moc_GuiTabularCreate.cpp"