]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiTabularCreate.cpp
Move the buffer related part from GuiView::renameBuffer to Buffer::saveAs.
[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
36         connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
37         connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
38
39         connect(rowsSB, SIGNAL(valueChanged(int)),
40                 this, SLOT(rowsChanged(int)));
41         connect(columnsSB, SIGNAL(valueChanged(int)),
42                 this, SLOT(columnsChanged(int)));
43
44         bc().setPolicy(ButtonPolicy::IgnorantPolicy);
45         bc().setOK(okPB);
46         bc().setCancel(closePB);
47 }
48
49
50 void GuiTabularCreate::columnsChanged(int)
51 {
52         changed();
53 }
54
55
56 void GuiTabularCreate::rowsChanged(int)
57 {
58         changed();
59 }
60
61
62 void GuiTabularCreate::applyView()
63 {
64         params_.first = rowsSB->value();
65         params_.second = columnsSB->value();
66 }
67
68
69 bool GuiTabularCreate::initialiseParams(string const &)
70 {
71         params_.first  = 5;
72         params_.second = 5;
73         return true;
74 }
75
76
77 void GuiTabularCreate::clearParams()
78 {
79         params_.first  = 0;
80         params_.second = 0;
81 }
82
83
84 void GuiTabularCreate::dispatchParams()
85 {
86         string const data = convert<string>(params().first) + ' ' + convert<string>(params().second);
87         dispatch(FuncRequest(getLfun(), data));
88 }
89
90
91 Dialog * createGuiTabularCreate(GuiView & lv)
92 {
93         return new GuiTabularCreate(lv);
94 }
95
96
97 } // namespace frontend
98 } // namespace lyx
99
100 #include "moc_GuiTabularCreate.cpp"