]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/FormTabularCreate.C
try this for distinguishing inner and outer tabs
[lyx.git] / src / frontends / qt2 / FormTabularCreate.C
1 /**
2  * \file FormTabularCreate.C
3  * Copyright 2001 LyX Team
4  * see the file COPYING
5  * 
6  * \author John Levon, moz@compsoc.man.ac.uk
7  */
8
9 #include <config.h>
10
11 #include "tabularcreatedlgimpl.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         // let the dialog be shown
24         // This is a permanent connection so we won't bother
25         // storing a copy because we won't be disconnecting.
26         d->showTabularCreate.connect(slot(this, &FormTabularCreate::show));
27 }
28
29 FormTabularCreate::~FormTabularCreate()
30 {
31    delete dialog_;
32 }
33
34 void FormTabularCreate::apply(int rows, int cols)
35 {
36    if (!lv_->view()->available())
37      return;
38    
39    string tmp = tostr(rows) + " " + tostr(cols);
40    lv_->getLyXFunc()->Dispatch(LFUN_INSET_TABULAR, tmp);
41 }
42
43 void FormTabularCreate::show()
44 {
45    if (!dialog_)
46      dialog_ = new TabularCreateDlgImpl(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 void FormTabularCreate::close()
60 {
61    h_.disconnect();
62 }
63
64 void FormTabularCreate::hide()
65 {
66    dialog_->hide();
67    close();
68 }