]> git.lyx.org Git - features.git/commitdiff
re-add tab create dialog
authorJohn Levon <levon@movementarian.org>
Tue, 28 Aug 2001 04:17:49 +0000 (04:17 +0000)
committerJohn Levon <levon@movementarian.org>
Tue, 28 Aug 2001 04:17:49 +0000 (04:17 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2603 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt2/ChangeLog
src/frontends/qt2/Dialogs.C
src/frontends/qt2/QTabularCreate.C
src/frontends/qt2/QTabularCreate.h
src/frontends/qt2/QTabularCreateDialog.C
src/frontends/qt2/QTabularCreateDialog.h
src/frontends/qt2/ui/Makefile.am
src/frontends/qt2/ui/QTabularCreateDialog.ui

index ed2caa3e2c43960215d4133202ccda2496aebbd9..6e5b236536b902c8b54f2db088426e64befe4c06 100644 (file)
@@ -1,3 +1,14 @@
+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:
index 3c313d843da076ed3300c0c5cf3cf24446283f15..bc43d2d9b63703fd0c97135f5ff3c35c95260d7d 100644 (file)
@@ -24,6 +24,7 @@
 #include "QIncludeDialog.h" 
 #include "QIndexDialog.h"
 #include "QRefDialog.h"
+#include "QTabularCreateDialog.h"
 #include "QThesaurusDialog.h"
 #include "QURLDialog.h"
  
@@ -67,6 +68,7 @@
 #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
@@ -81,7 +83,6 @@
 #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
@@ -109,6 +110,7 @@ Dialogs::Dialogs(LyXView * lv)
        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));
 
index fe85d879c03f61136bcdf0012a4cc43d73fb48de..bb989feff6c2b2aa071d54bc44c8c2836ceac117 100644 (file)
@@ -8,66 +8,39 @@
 
 #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();
 }
index c6406ce16381dc038cae1b23b8db89ecba8918c8..b24226761429f6027b3ccdfc43bb8aa5f9e17681 100644 (file)
 #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
index 19dc39a458493fdab3829a5bd4a4a1437963303a..46e7b573b7232ea1b31dcb7a563c63cb32c1c3ea 100644 (file)
 #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();
 }
index 015b2341579506fd2ccebc87b8bbfb7bffa0bbff..43ab65138e2e8f7f73bfdac06101852c5b1e8fc0 100644 (file)
@@ -9,6 +9,7 @@
 
 #ifndef QTABULARCREATEDIALOG_H
 #define QTABULARCREATEDIALOG_H
 #include "ui/QTabularCreateDialogBase.h"
 
 class QTabularCreate;
@@ -17,13 +18,10 @@ class QTabularCreateDialog : public QTabularCreateDialogBase
 { 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:
index 3586fcef8e5f13d495b42ffe7b63aad984b8b8ce..69c9afaff2318cd1aaa3decce0d9dca8326b1989 100644 (file)
@@ -3,7 +3,7 @@ DISTCLEANFILES= *.orig *.rej *~ *.bak core
 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
index 088f8f95a03016c156a33a808f72b5f46538cf3f..35c850cf6447f4c425e07b674aa3d4643aa6db1c 100644 (file)
@@ -13,8 +13,8 @@
         <rect>
             <x>0</x>
             <y>0</y>
-            <width>245</width>
-            <height>235</height>
+            <width>281</width>
+            <height>311</height>
         </rect>
     </property>
     <property stdset="1">
@@ -23,7 +23,7 @@
     </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>&amp;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>&amp;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>&amp;Insert</string>
+                        <string>&amp;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>&amp;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>