+2001-08-28 John Levon <moz@compsoc.man.ac.uk>
+
+ * Dialogs.C:
+ * QTabularCreate.[Ch]:
+ * QTabularCreate.h:
+ * QTabularCreateDialog.C:
+ * QTabularCreateDialog.h:
+ * ui/Makefile.am:
+ * ui/QTabularCreateDialog.ui: bring back
+ tabcreate
+
2001-08-28 John Levon <moz@compsoc.man.ac.uk>
* ui/QCharacterDialog.ui:
#include "QIncludeDialog.h"
#include "QIndexDialog.h"
#include "QRefDialog.h"
+#include "QTabularCreateDialog.h"
#include "QThesaurusDialog.h"
#include "QURLDialog.h"
#include "controllers/ControlIndex.h"
#include "controllers/ControlRef.h"
#include "controllers/ControlSplash.h"
+#include "controllers/ControlTabularCreate.h"
#include "controllers/ControlThesaurus.h"
#include "controllers/ControlUrl.h"
#if 0
#include "controllers/ControlRef.h"
#include "controllers/ControlSearch.h"
#include "controllers/ControlSpellchecker.h"
-#include "controllers/ControlTabularCreate.h"
#include "controllers/ControlToc.h"
#include "controllers/ControlVCLog.h"
#endif
add(new GUIInclude<QInclude, Qt2BC>(*lv, *this));
add(new GUIIndex<QIndex, Qt2BC>(*lv, *this));
add(new GUIRef<QRef, Qt2BC>(*lv, *this));
+ add(new GUITabularCreate<QTabularCreate, Qt2BC>(*lv, *this));
add(new GUIThesaurus<QThesaurus, Qt2BC>(*lv, *this));
add(new GUIUrl<QURL, Qt2BC>(*lv, *this));
#include <config.h>
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include "ControlTabularCreate.h"
#include "QTabularCreateDialog.h"
-#include "Dialogs.h"
#include "QTabularCreate.h"
+#include "Qt2BC.h"
#include "gettext.h"
-#include "QtLyXView.h"
-#include "lyxfunc.h"
-#include "BufferView.h"
-#include "insets/insettabular.h"
-#include "support/lstrings.h"
-
-using SigC::slot;
+#include "debug.h"
-QTabularCreate::QTabularCreate(LyXView *v, Dialogs *d)
- : dialog_(0), lv_(v), d_(d), h_(0)
-{
- d->showTabularCreate.connect(slot(this, &QTabularCreate::show));
-}
+#include <qspinbox.h>
+#include <qpushbutton.h>
+typedef Qt2CB<ControlTabularCreate, Qt2DB<QTabularCreateDialog> > base_class;
-QTabularCreate::~QTabularCreate()
+QTabularCreate::QTabularCreate(ControlTabularCreate & c)
+ : base_class(c, _("Insert table"))
{
- delete dialog_;
}
-
-void QTabularCreate::apply(int rows, int cols)
-{
- if (!lv_->view()->available())
- return;
- string tmp = tostr(rows) + " " + tostr(cols);
- lv_->getLyXFunc()->dispatch(LFUN_INSET_TABULAR, tmp);
-}
-
-
-void QTabularCreate::show()
+void QTabularCreate::build_dialog()
{
- if (!dialog_)
- dialog_ = new QTabularCreateDialog(this, 0, _("LyX: Insert Table"));
-
- if (!dialog_->isVisible()) {
- h_ = d_->hideBufferDependent.connect(slot(this, &QTabularCreate::hide));
- }
-
- dialog_->raise();
- dialog_->setActiveWindow();
+ dialog_.reset(new QTabularCreateDialog(this));
- update();
- dialog_->show();
+ bc().setOK(dialog_->okPB);
+ bc().setCancel(dialog_->closePB);
}
-
-void QTabularCreate::close()
-{
- h_.disconnect();
-}
-
-void QTabularCreate::hide()
+void QTabularCreate::apply()
{
- dialog_->hide();
- close();
+ controller().params().first = dialog_->rowsSB->value();
+ controller().params().second = dialog_->columnsSB->value();
}
#ifndef QTABULARCREATE_H
#define QTABULARCREATE_H
-#include "DialogBase.h"
-#include "LString.h"
-#include "boost/utility.hpp"
+#ifdef __GNUG__
+#pragma interface
+#endif
-class Dialogs;
-class LyXView;
+#include "Qt2Base.h"
+
+class ControlTabularCreate;
class QTabularCreateDialog;
-class QTabularCreate : public DialogBase {
-public:
- QTabularCreate(LyXView *, Dialogs *);
- ~QTabularCreate();
+///
+class QTabularCreate
+ : public Qt2CB<ControlTabularCreate, Qt2DB<QTabularCreateDialog> >
+{
+public:
+ ///
+ friend class QTabularCreateDialog;
+ ///
+ QTabularCreate(ControlTabularCreate &);
- /// create the table
- void apply(int rows, int cols);
- /// close the connections
- void close();
-
private:
- /// Create the dialog if necessary, update it and display it.
- void show();
- /// Hide the dialog.
- void hide();
-
- /// Real GUI implementation.
- QTabularCreateDialog * dialog_;
-
- /// the LyXView we belong to
- LyXView * lv_;
-
- /** Which Dialogs do we belong to?
- Used so we can get at the signals we have to connect to.
- */
- Dialogs * d_;
-
- /// Hide connection.
- SigC::Connection h_;
+ /// Apply changes
+ virtual void apply();
+ /// update
+ virtual void update_contents() {};
+ /// build the dialog
+ virtual void build_dialog();
};
#endif // QTABULARCREATE_H
#include <qpushbutton.h>
#include <qspinbox.h>
#include "emptytable.h"
-#include <qpainter.h>
-#include <qtableview.h>
-#include <qtooltip.h>
-QTabularCreateDialog::QTabularCreateDialog(QTabularCreate * form, QWidget * parent, const char * name, bool modal, WFlags fl)
- : QTabularCreateDialogBase(parent, name, modal, fl),
+QTabularCreateDialog::QTabularCreateDialog(QTabularCreate * form)
+ : QTabularCreateDialogBase(0, 0, false, 0),
form_(form)
{
- setCaption(name);
table->setMinimumSize(100,100);
- rows->setValue(5);
- columns->setValue(5);
- QToolTip::add(table, _("Drag with left mouse button to resize"));
-}
-
-
-QTabularCreateDialog::~QTabularCreateDialog()
-{
- // no need to delete child widgets, Qt does it all for us
-}
-
+ rowsSB->setValue(5);
+ columnsSB->setValue(5);
-void QTabularCreateDialog::insert_tabular()
-{
- form_->apply((rows->text()).toInt(), (columns->text()).toInt());
- form_->close();
- hide();
-}
-
-
-void QTabularCreateDialog::cancel_adaptor()
-{
- form_->close();
- hide();
+ connect(okPB, SIGNAL(clicked()),
+ form_, SLOT(slotOK()));
+ connect(closePB, SIGNAL(clicked()),
+ form_, SLOT(slotClose()));
}
-void QTabularCreateDialog::colsChanged(int nr_cols)
+void QTabularCreateDialog::columnsChanged(int nr_cols)
{
- if (nr_cols != (columns->text()).toInt())
- columns->setValue(nr_cols);
+ form_->changed();
}
void QTabularCreateDialog::rowsChanged(int nr_rows)
{
- if (nr_rows != (rows->text()).toInt())
- rows->setValue(nr_rows);
+ form_->changed();
}
#ifndef QTABULARCREATEDIALOG_H
#define QTABULARCREATEDIALOG_H
+
#include "ui/QTabularCreateDialogBase.h"
class QTabularCreate;
{ Q_OBJECT
public:
- QTabularCreateDialog(QTabularCreate * form, QWidget * parent = 0, const char * name = 0, bool modal = FALSE, WFlags fl = 0);
- ~QTabularCreateDialog();
+ QTabularCreateDialog(QTabularCreate * form);
protected slots:
- void insert_tabular();
- void cancel_adaptor();
- virtual void colsChanged(int);
+ virtual void columnsChanged(int);
virtual void rowsChanged(int);
private:
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
noinst_LTLIBRARIES = libqt2ui.la
BOOST_INCLUDES = -I$(top_srcdir)/boost
-INCLUDES = -I${top_srcdir}/src/ -I${top_srcdir}/src/frontends/ \
+INCLUDES = -I${top_srcdir}/src/ -I${top_srcdir}/src/frontends/ -I$(top_srcdir)/src/frontends/qt2/ \
${SIGC_CFLAGS} ${FRONTEND_INCLUDES} $(BOOST_INCLUDES) \
-I$(top_srcdir)/src/frontends/controllers
DEFINES += -DQT_CLEAN_NAMESPACE
<rect>
<x>0</x>
<y>0</y>
- <width>245</width>
- <height>235</height>
+ <width>281</width>
+ <height>311</height>
</rect>
</property>
<property stdset="1">
</property>
<property stdset="1">
<name>caption</name>
- <string>Form1</string>
+ <string>Insert table</string>
</property>
<vbox>
<property stdset="1">
</property>
<property stdset="1">
<name>text</name>
- <string>Rows:</string>
+ <string>&Rows:</string>
+ </property>
+ <property>
+ <name>buddy</name>
+ <cstring>rowsSB</cstring>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string>Number of rows</string>
</property>
</widget>
<widget>
<class>QSpinBox</class>
<property stdset="1">
<name>name</name>
- <cstring>rows</cstring>
+ <cstring>rowsSB</cstring>
</property>
<property stdset="1">
<name>minValue</name>
<name>maxValue</name>
<number>511</number>
</property>
+ <property stdset="1">
+ <name>buttonSymbols</name>
+ <enum>PlusMinus</enum>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string>Number of rows</string>
+ </property>
</widget>
<widget>
<class>QLabel</class>
</property>
<property stdset="1">
<name>text</name>
- <string>Columns:</string>
+ <string>&Columns:</string>
+ </property>
+ <property>
+ <name>buddy</name>
+ <cstring>columnsSB</cstring>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string>Number of columns</string>
</property>
</widget>
<widget>
<class>QSpinBox</class>
<property stdset="1">
<name>name</name>
- <cstring>columns</cstring>
+ <cstring>columnsSB</cstring>
</property>
<property stdset="1">
<name>minValue</name>
<name>maxValue</name>
<number>511</number>
</property>
+ <property stdset="1">
+ <name>buttonSymbols</name>
+ <enum>PlusMinus</enum>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string>Number of columns</string>
+ </property>
</widget>
<spacer>
<property>
<name>name</name>
<cstring>table</cstring>
</property>
+ <property>
+ <name>toolTip</name>
+ <string>Resize this to the correct table dimensions</string>
+ </property>
</widget>
<widget>
<class>QLayoutWidget</class>
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
- <cstring>insertPB</cstring>
+ <cstring>okPB</cstring>
</property>
<property stdset="1">
<name>text</name>
- <string>&Insert</string>
+ <string>&OK</string>
</property>
</widget>
<widget>
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
- <cstring>cancelPB</cstring>
+ <cstring>closePB</cstring>
</property>
<property stdset="1">
<name>text</name>
- <string>&Cancel</string>
+ <string>Close</string>
</property>
</widget>
</hbox>
<customwidgets>
<customwidget>
<class>EmptyTable</class>
- <header location="local">../emptytable.h</header>
+ <header location="local">emptytable.h</header>
<sizehint>
<width>-1</width>
<height>-1</height>
<connection>
<sender>table</sender>
<signal>rowsChanged(int)</signal>
- <receiver>rows</receiver>
+ <receiver>rowsSB</receiver>
<slot>setValue(int)</slot>
</connection>
<connection>
<sender>table</sender>
<signal>colsChanged(int)</signal>
- <receiver>columns</receiver>
+ <receiver>columnsSB</receiver>
<slot>setValue(int)</slot>
</connection>
<connection>
- <sender>rows</sender>
+ <sender>rowsSB</sender>
<signal>valueChanged(int)</signal>
<receiver>table</receiver>
<slot>setNumberRows(int)</slot>
</connection>
<connection>
- <sender>columns</sender>
+ <sender>columnsSB</sender>
<signal>valueChanged(int)</signal>
<receiver>table</receiver>
<slot>setNumberColumns(int)</slot>
</connection>
<connection>
- <sender>insertPB</sender>
- <signal>clicked()</signal>
+ <sender>rowsSB</sender>
+ <signal>valueChanged(int)</signal>
<receiver>QTabularCreateDialogBase</receiver>
- <slot>insert_tabular()</slot>
+ <slot>rowsChanged(int)</slot>
</connection>
<connection>
- <sender>cancelPB</sender>
- <signal>clicked()</signal>
+ <sender>columnsSB</sender>
+ <signal>valueChanged(int)</signal>
<receiver>QTabularCreateDialogBase</receiver>
- <slot>cancel_adaptor()</slot>
+ <slot>columnsChanged(int)</slot>
</connection>
- <slot access="protected">insert_tabular()</slot>
- <slot access="protected">cancel_adaptor()</slot>
+ <slot access="public">columnsChanged(int)</slot>
+ <slot access="public">rowsChanged(int)</slot>
</connections>
</UI>