]> git.lyx.org Git - lyx.git/blob - src/frontends/kde/FormTabularCreate.C
Move LaTeX and VC logs to GUI-I on xforms
[lyx.git] / src / frontends / kde / FormTabularCreate.C
1 /*
2  * FormTabularCreate.C
3  * (C) 2000 LyX Team
4  * John Levon, moz@compsoc.man.ac.uk
5  */
6
7 /***************************************************************************
8  *                                                                         *
9  *   This program is free software; you can redistribute it and/or modify  *
10  *   it under the terms of the GNU General Public License as published by  *
11  *   the Free Software Foundation; either version 2 of the License, or     *
12  *   (at your option) any later version.                                   *
13  *                                                                         *
14  ***************************************************************************/
15
16 #include <config.h>
17
18 #include "tabcreatedlg.h"
19 #include "Dialogs.h"
20 #include "FormTabularCreate.h"
21 #include "gettext.h"
22 #include "QtLyXView.h"
23 #include "BufferView.h"
24 #include "insets/insettabular.h"  
25 #include "support/lstrings.h"
26
27 FormTabularCreate::FormTabularCreate(LyXView *v, Dialogs *d)
28         : dialog_(0), lv_(v), d_(d), h_(0)
29 {
30         // let the dialog be shown
31         // This is a permanent connection so we won't bother
32         // storing a copy because we won't be disconnecting.
33         d->showTabularCreate.connect(slot(this, &FormTabularCreate::show));
34 }
35
36 FormTabularCreate::~FormTabularCreate()
37 {
38         delete dialog_;
39 }
40
41 void FormTabularCreate::apply(unsigned int rows, unsigned cols)
42 {
43         if (!lv_->view()->available())
44                 return;
45
46         string tmp = tostr(rows) + " " + tostr(cols);
47         lv_->getLyXFunc()->Dispatch(LFUN_INSET_TABULAR, tmp);
48 }
49
50 void FormTabularCreate::show()
51 {
52         if (!dialog_)
53                 dialog_ = new TabularCreateDialog(this, 0, _("LyX: Insert Table"));
54
55         if (!dialog_->isVisible()) {
56                 h_ = d_->hideBufferDependent.connect(slot(this, &FormTabularCreate::hide));
57         }
58
59         dialog_->raise();
60         dialog_->setActiveWindow();
61
62         update();
63         dialog_->show();
64 }
65
66 void FormTabularCreate::close()
67 {
68         h_.disconnect();
69 }
70
71 void FormTabularCreate::hide()
72 {
73         dialog_->hide();
74         close();
75 }