]> git.lyx.org Git - lyx.git/blob - src/frontends/kde/FormTabularCreate.C
try this for distinguishing inner and outer tabs
[lyx.git] / src / frontends / kde / FormTabularCreate.C
1 /**
2  * \file FormTabularCreate.C
3  * Copyright 2001 the LyX Team
4  * Read the file COPYING
5  *
6  * \author John Levon
7  */
8
9 #include <config.h>
10
11 #include "tabcreatedlg.h"
12 #include "Dialogs.h"
13 #include "FormTabularCreate.h"
14 #include "gettext.h"
15 #include "QtLyXView.h"
16 #include "BufferView.h"
17 #include "insets/insettabular.h"  
18 #include "support/lstrings.h"
19
20 FormTabularCreate::FormTabularCreate(LyXView *v, Dialogs *d)
21         : dialog_(0), lv_(v), d_(d), h_(0)
22 {
23         d->showTabularCreate.connect(slot(this, &FormTabularCreate::show));
24 }
25
26
27 FormTabularCreate::~FormTabularCreate()
28 {
29         delete dialog_;
30 }
31
32
33 void FormTabularCreate::apply(unsigned int rows, unsigned cols)
34 {
35         if (!lv_->view()->available())
36                 return;
37
38         string tmp = tostr(rows) + " " + tostr(cols);
39         lv_->getLyXFunc()->Dispatch(LFUN_INSET_TABULAR, tmp);
40 }
41
42
43 void FormTabularCreate::show()
44 {
45         if (!dialog_)
46                 dialog_ = new TabularCreateDialog(this, 0, _("LyX: Insert Table"));
47
48         if (!dialog_->isVisible()) {
49                 h_ = d_->hideBufferDependent.connect(slot(this, &FormTabularCreate::hide));
50         }
51
52         dialog_->raise();
53         dialog_->setActiveWindow();
54
55         update();
56         dialog_->show();
57 }
58
59
60 void FormTabularCreate::close()
61 {
62         h_.disconnect();
63 }
64
65
66 void FormTabularCreate::hide()
67 {
68         dialog_->hide();
69         close();
70 }