]> git.lyx.org Git - features.git/commitdiff
fix up build (also need patch sent to list), bring back doc/par dialogs,
authorJohn Levon <levon@movementarian.org>
Fri, 1 Mar 2002 18:47:56 +0000 (18:47 +0000)
committerJohn Levon <levon@movementarian.org>
Fri, 1 Mar 2002 18:47:56 +0000 (18:47 +0000)
add alert_pimpl

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3634 a592a061-630c-0410-9148-cb99ea01b6c8

12 files changed:
src/frontends/qt2/Alert_pimpl.C [new file with mode: 0644]
src/frontends/qt2/ChangeLog
src/frontends/qt2/Dialogs.C
src/frontends/qt2/Makefile.am
src/frontends/qt2/Makefile.dialogs
src/frontends/qt2/QPreambleDialog.C
src/frontends/qt2/Timeout_pimpl.C
src/frontends/qt2/Timeout_pimpl.h
src/frontends/qt2/ui/Makefile.am
src/frontends/qt2/ui/QAskForTextDialog.ui [new file with mode: 0644]
src/frontends/qt2/xforms/.cvsignore [new file with mode: 0644]
src/frontends/qt2/xforms/Makefile.am [new file with mode: 0644]

diff --git a/src/frontends/qt2/Alert_pimpl.C b/src/frontends/qt2/Alert_pimpl.C
new file mode 100644 (file)
index 0000000..4da68f2
--- /dev/null
@@ -0,0 +1,66 @@
+/**
+ * \file Alert_pimpl.C
+ * Copyright 2001 the LyX Team
+ * Read the file COPYING
+ *
+ * \author John Levon <moz@compsoc.man.ac.uk>
+ */
+
+#include <config.h>
+
+#include <qmessagebox.h>
+#include <qlabel.h>
+#include <qlineedit.h>
+#include "ui/QAskForTextDialog.h"
+#include FORMS_H_LOCATION
+#include <algorithm>
+#include <gettext.h>
+#include "Alert.h"
+#include "Alert_pimpl.h" 
+#include "xforms_helpers.h"
+using std::pair;
+using std::make_pair;
+
+void alert_pimpl(string const & s1, string const & s2, string const & s3)
+{
+       QMessageBox::warning(0, "LyX", (s1 + "\n" + "\n" + s2 + "\n" + s3).c_str());
+}
+
+
+bool askQuestion_pimpl(string const & s1, string const & s2, string const & s3)
+{
+       return !(QMessageBox::information(0, "LyX", (s1 + "\n" + s2 + "\n" + s3).c_str(),
+               _("&Yes"), _("&No"), 0, 1));
+}
+
+
+int askConfirmation_pimpl(string const & s1, string const & s2, string const & s3)
+{
+       return (QMessageBox::information(0, "LyX", (s1 + "\n" + s2 + "\n" + s3).c_str(),
+               _("&Yes"), _("&No"), _("&Cancel"), 0, 2)) + 1;
+}
+
+
+pair<bool, string> const askForText_pimpl(string const & msg, string const & dflt)
+{
+       string title = _("LyX: ");
+       title += msg;
+       QAskForTextDialog d(0, msg.c_str(), true); 
+       // less than ideal !
+       d.askLA->setText((string("&") + msg).c_str());
+       d.askLE->setText(dflt.c_str());
+       int ret = d.exec();
+
+       d.hide();
+       if (ret)
+               return make_pair<bool, string>(true, d.askLE->text().latin1());
+       else
+               return make_pair<bool, string>(false, string());
+}
index c94ee0051748a75c80d5b635cbd4c3b85c4711b3..76d059a7c827c7f40daa394be282d1be866facc5 100644 (file)
@@ -1,12 +1,19 @@
-2002-02-18  John Levon  <moz@compsoc.man.ac.uk>
+2002-03-01  John Levon  <moz@compsoc.man.ac.uk>
 
        * Makefile.am:
        * moc/Makefile.am:
        * ui/Makefile.am:
-       * ui/moc/Makefile.am: use .o for libs
+       * ui/moc/Makefile.am: fix compile
 
+       * xforms/: compile the necessary files via symlinks
        * QPreambleDialog.C: new systemcall interface
 
+       * Timeout_pimpl.h:
+       * Timeout_pimpl.C: add running()
+
+       * Dialogs.C: add init graphics, and doc/par xforms forms 
 2002-02-06  John Levon  <moz@compsoc.man.ac.uk>
 
        * QToc.C: fix crash
index c4a0c7dea99a1fe7089118937da935a1587deb77..80d667fe59f93b5cb7dc12effddb86d7e59d6e0b 100644 (file)
 #include "Qt2BC.h"
 
 // xforms stuff
-//#include "xforms/FormDocument.h"
+#include "xforms/FormDocument.h"
 #include "xforms/FormMathsPanel.h"
-//#include "xforms/FormParagraph.h"
+#include "xforms/FormParagraph.h"
 #include "xforms/FormPreferences.h"
 #include "xforms/FormShowFile.h"
 #include "xforms/FormTabular.h"
  
+#include "graphics/GraphicsImageXPM.h"
 #include "GUI.h"
 
 // this makes no real sense for Qt2
@@ -117,9 +119,9 @@ Dialogs::Dialogs(LyXView * lv)
        add(new GUIVCLog<QVCLog, Qt2BC>(*lv, *this));
 
        // dialogs not yet MVCd
-//     add(new FormDocument(lv, this));
+       add(new FormDocument(lv, this));
        add(new FormMathsPanel(lv, this));
-//     add(new FormParagraph(lv, this));
+       add(new FormParagraph(lv, this));
        add(new FormPreferences(lv, this));
        add(new FormTabular(lv, this));
  
@@ -127,3 +129,16 @@ Dialogs::Dialogs(LyXView * lv)
        // dialogs by a simple connection here.
        hideAll.connect(hideBufferDependent.slot());
 }
+// Called bu the graphics cache to connect the approriate frontend
+// image loading routines to the LyX kernel.
+void Dialogs::initialiseGraphics()
+{
+       using namespace grfx;
+       using SigC::slot;
+    
+       // connect the image loader based on the XPM library
+       GImage::newImage.connect(slot(&GImageXPM::newImage));
+       GImage::loadableFormats.connect(slot(&GImageXPM::loadableFormats));
+}
index 77d39d2705dd4bdb2d2760e71f0d8eeb79238afc..f0e34e3e49cce5a38f7340d76fda4c3c42532a91 100644 (file)
@@ -2,9 +2,9 @@ AUTOMAKE_OPTIONS = foreign 1.4
 MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
 noinst_LTLIBRARIES = libqt2.la
 BOOST_INCLUDES = -I$(top_srcdir)/boost
-SUBDIRS=ui moc
+SUBDIRS=xforms ui moc
 INCLUDES = -I${top_srcdir}/src/ -I${top_srcdir}/src/frontends/ \
-       ${SIGC_CFLAGS} ${FRONTEND_INCLUDES} $(BOOST_INCLUDES) \
+       ${SIGC_CFLAGS} -I$(top_srcdir)/images ${FRONTEND_INCLUDES} $(BOOST_INCLUDES) \
        -I$(top_srcdir)/src/frontends/controllers
 AM_CXXFLAGS = -DQT_CLEAN_NAMESPACE -DQT_GENUINE_STR
 
@@ -15,14 +15,18 @@ ETAGS_ARGS = --lang=c++
 
 include Makefile.dialogs
 
+ETAGS_ARGS = --lang=c++
+
 libqt2_la_LIBADD = \
-       ui/libqt2ui.o \
-       moc/libqt2moc.o \
-       ui/moc/libqt2uimoc.o \
+       xforms/libqt2xforms.la \
+       ui/libqt2ui.la \
+       moc/libqt2moc.la \
+       ui/moc/libqt2uimoc.la \
        @LYX_LIBS@ @FRONTEND_LDFLAGS@ @FRONTEND_LIBS@
 
 libqt2_la_SOURCES = \
        $(DIALOGSOURCES) \
+       Alert_pimpl.C \
        Dialogs.C \
        GUIRunTime.C \
        FileDialog.C \
@@ -40,41 +44,4 @@ libqt2_la_SOURCES = \
        qttableview.h \
        qttableview.C
 
-xforms_objects = \
-       ../xforms/combox.o \
-       ../xforms/Alert_pimpl.o \
-       ../xforms/Color.o \
-       ../xforms/DropDown.o \
-       ../xforms/FormBase.o \
-       ../xforms/FormBaseDeprecated.o  \
-       ../xforms/FormMathsBitmap.o \
-       ../xforms/FormMathsDeco.o \
-       ../xforms/FormMathsDelim.o \
-       ../xforms/FormMathsMatrix.o \
-       ../xforms/FormMathsPanel.o \
-       ../xforms/FormMathsStyle.o \
-       ../xforms/FormMathsSpace.o \
-       ../xforms/FormPreferences.o \
-       ../xforms/FormTabular.o \
-       ../xforms/FormInset.o \
-       ../xforms/MathsSymbols.o \
-       ../xforms/Menubar_pimpl.o \
-       ../xforms/RadioButtonGroup.o \
-       ../xforms/Toolbar_pimpl.o \
-       ../xforms/bmtable.o \
-       ../xforms/form_preferences.o \
-       ../xforms/form_tabular.o \
-       ../xforms/form_maths_deco.o \
-       ../xforms/form_maths_delim.o \
-       ../xforms/form_maths_matrix.o \
-       ../xforms/form_maths_panel.o \
-       ../xforms/form_maths_space.o \
-       ../xforms/form_maths_style.o \
-       ../xforms/input_validators.o \
-       ../xforms/xformsBC.o \
-       ../xforms/xforms_helpers.o
-
-libqt2.la: xforms.lo $(libqt2_la_OBJECTS) $(libqt2_la_DEPENDENCIES)
-
-xforms.lo: $(xforms_objects)
-       $(CXXLINK) $(xforms_objects)
\ No newline at end of file
+libqt2.la: $(libqt2_la_OBJECTS) $(libqt2_la_DEPENDENCIES)
index bedd976d50af90acd5757deb8b5261f93102ae3b..2568f64ac62bdaf32309c47ddba20ac8dadd693a 100644 (file)
@@ -2,6 +2,7 @@
 
 DIALOGS = \
        QAbout \
+       QAskForText \
        QBibitem \
        QBibtex \
        QCharacter \
@@ -113,6 +114,8 @@ MOCDIALOGS = \
 UIDIALOGS = \
        QAboutDialogBase.h \
        QAboutDialogBase.C \
+       QAskForTextDialog.h \
+       QAskForTextDialog.C \
        QBibitemDialogBase.h \
        QBibitemDialogBase.C \
        QBibtexDialogBase.h \
@@ -166,6 +169,7 @@ UIDIALOGS = \
  
 UIMOCDIALOGS = \
        QAboutDialogBase_moc.C \
+       QAskForTextDialog_moc.C \
        QBibitemDialogBase_moc.C \
        QBibtexDialogBase_moc.C \
        QCharacterDialogBase_moc.C \
@@ -191,9 +195,3 @@ UIMOCDIALOGS = \
        QTocDialogBase_moc.C \
        QURLDialogBase_moc.C \
        QVCLogDialogBase_moc.C
-
-
-
-
-
-
index c4cf5e86ed544ea36feb0a00bc71273028e558d6..50be09ac382e31407fedaa35e5360f8847e047cf 100644 (file)
@@ -18,7 +18,7 @@
 #include "QPreamble.h"
 
 #include "support/lyxlib.h"
-#include "support/syscall.h"
+#include "support/forkedcall.h"
 #include "support/filetools.h"
 #include "gettext.h" 
  
@@ -81,10 +81,10 @@ void QPreambleDialog::editClicked()
 
        editor += " " + filename;
  
-       Systemcalls sys;
+       Forkedcall call;
 
-       // FIXME: synchronous, ugh. Make async when moved to controllers ?
-       if (sys.startscript(Systemcalls::Wait, editor)) {
+       // FIXME: make async
+       if (call.startscript(Forkedcall::Wait, editor)) {
                lyx::unlink(filename);
                return;
        }
index d3a7de51143ce7d11f35b760fa04e9140785e41f..cd538ff5c6843758f2ba86568d09cd97d56be9bc 100644 (file)
@@ -36,9 +36,15 @@ void Timeout::Pimpl::reset()
 }
 
 
+bool Timeout::Pimpl::running() const
+{
+       return timeout_id != -1;
+}
+
 void Timeout::Pimpl::start()
 {
-       if (timeout_id != -1)
+       if (running())
                lyxerr << "Timeout::start: already running!" << endl;
        timeout_id = startTimer(owner_->timeout_ms);
 }
@@ -46,6 +52,6 @@ void Timeout::Pimpl::start()
 
 void Timeout::Pimpl::stop()
 {
-       if (timeout_id != -1)
+       if (running())
                reset();
 }
index 612f2ad4bde45d5f6954d388955e5212e8eddfc0..5d94ff9b33ab781953b88348fe49a39124f038b1 100644 (file)
@@ -36,6 +36,8 @@ public:
        void stop();
        /// reset
        void reset();
+       /// is the timer running ?
+       bool running() const; 
 
 protected:
        /// slot
index d3f96348faeb2ce23c4dca2a4a3e49eb4425ba71..06d4fd3dcfbb72baf264375ff0f0f4bc8c0eb000 100644 (file)
@@ -22,6 +22,12 @@ libqt2ui.la: $(libqt2ui_la_OBJECTS) $(libqt2ui_la_DEPENDENCIES)
 SED=sed
 SEDREPLACETR=s,[^A-Za-z]tr[ ]*(,_(,g
 SEDREMOVEEMPTY=s,_[ ]*([ ]*""[ ]*),"",g
+QAskForTextDialog.h: QAskForTextDialog.ui
+       $(UIC) $< -o $@
+QAskForTextDialog.C: QAskForTextDialog.h QAskForTextDialog.ui
+       $(UIC) -impl $^ | $(SED) '$(SEDREPLACETR);$(SEDREMOVEEMPTY)' > $@
 %Base.h: %.ui
        $(UIC) $< -o $@
 %Base.C: %Base.h %.ui
diff --git a/src/frontends/qt2/ui/QAskForTextDialog.ui b/src/frontends/qt2/ui/QAskForTextDialog.ui
new file mode 100644 (file)
index 0000000..6bcd897
--- /dev/null
@@ -0,0 +1,160 @@
+<!DOCTYPE UI><UI>
+<class>QAskForTextDialog</class>
+<include location="global">config.h</include>
+<include location="local">gettext.h</include>
+<widget>
+    <class>QDialog</class>
+    <property stdset="1">
+        <name>name</name>
+        <cstring>QAskForTextDialog</cstring>
+    </property>
+    <property stdset="1">
+        <name>geometry</name>
+        <rect>
+            <x>0</x>
+            <y>0</y>
+            <width>277</width>
+            <height>116</height>
+        </rect>
+    </property>
+    <property stdset="1">
+        <name>caption</name>
+        <string>LyX: Enter text</string>
+    </property>
+    <vbox>
+        <property stdset="1">
+            <name>margin</name>
+            <number>11</number>
+        </property>
+        <property stdset="1">
+            <name>spacing</name>
+            <number>6</number>
+        </property>
+        <spacer>
+            <property>
+                <name>name</name>
+                <cstring>Spacer5</cstring>
+            </property>
+            <property stdset="1">
+                <name>orientation</name>
+                <enum>Vertical</enum>
+            </property>
+            <property stdset="1">
+                <name>sizeType</name>
+                <enum>Expanding</enum>
+            </property>
+            <property>
+                <name>sizeHint</name>
+                <size>
+                    <width>20</width>
+                    <height>20</height>
+                </size>
+            </property>
+        </spacer>
+        <widget>
+            <class>QLabel</class>
+            <property stdset="1">
+                <name>name</name>
+                <cstring>askLA</cstring>
+            </property>
+            <property stdset="1">
+                <name>text</name>
+                <string>&amp;Dummy</string>
+            </property>
+            <property>
+                <name>buddy</name>
+                <cstring>askLE</cstring>
+            </property>
+        </widget>
+        <widget>
+            <class>QLineEdit</class>
+            <property stdset="1">
+                <name>name</name>
+                <cstring>askLE</cstring>
+            </property>
+        </widget>
+        <spacer>
+            <property>
+                <name>name</name>
+                <cstring>Spacer6</cstring>
+            </property>
+            <property stdset="1">
+                <name>orientation</name>
+                <enum>Vertical</enum>
+            </property>
+            <property stdset="1">
+                <name>sizeType</name>
+                <enum>Expanding</enum>
+            </property>
+            <property>
+                <name>sizeHint</name>
+                <size>
+                    <width>20</width>
+                    <height>20</height>
+                </size>
+            </property>
+        </spacer>
+        <widget>
+            <class>QLayoutWidget</class>
+            <property stdset="1">
+                <name>name</name>
+                <cstring>Layout2</cstring>
+            </property>
+            <hbox>
+                <property stdset="1">
+                    <name>margin</name>
+                    <number>0</number>
+                </property>
+                <property stdset="1">
+                    <name>spacing</name>
+                    <number>6</number>
+                </property>
+                <widget>
+                    <class>QPushButton</class>
+                    <property stdset="1">
+                        <name>name</name>
+                        <cstring>okPB</cstring>
+                    </property>
+                    <property stdset="1">
+                        <name>text</name>
+                        <string>OK</string>
+                    </property>
+                    <property stdset="1">
+                        <name>default</name>
+                        <bool>true</bool>
+                    </property>
+                </widget>
+                <widget>
+                    <class>QPushButton</class>
+                    <property stdset="1">
+                        <name>name</name>
+                        <cstring>cancelPB</cstring>
+                    </property>
+                    <property stdset="1">
+                        <name>text</name>
+                        <string>&amp;Cancel</string>
+                    </property>
+                    <property stdset="1">
+                        <name>default</name>
+                        <bool>false</bool>
+                    </property>
+                </widget>
+            </hbox>
+        </widget>
+    </vbox>
+</widget>
+<connections>
+    <connection>
+        <sender>okPB</sender>
+        <signal>clicked()</signal>
+        <receiver>QAskForTextDialog</receiver>
+        <slot>accept()</slot>
+    </connection>
+    <connection>
+        <sender>cancelPB</sender>
+        <signal>clicked()</signal>
+        <receiver>QAskForTextDialog</receiver>
+        <slot>reject()</slot>
+    </connection>
+</connections>
+</UI>
diff --git a/src/frontends/qt2/xforms/.cvsignore b/src/frontends/qt2/xforms/.cvsignore
new file mode 100644 (file)
index 0000000..820ab9c
--- /dev/null
@@ -0,0 +1,8 @@
+Makefile.in
+Makefile
+*.deps
+*.lo
+.libs
+libqt2.la
+moc_*.C
+*_moc.C
diff --git a/src/frontends/qt2/xforms/Makefile.am b/src/frontends/qt2/xforms/Makefile.am
new file mode 100644 (file)
index 0000000..f4a2b26
--- /dev/null
@@ -0,0 +1,94 @@
+AUTOMAKE_OPTIONS = foreign 1.4
+MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
+noinst_LTLIBRARIES = libqt2xforms.la
+BOOST_INCLUDES = -I$(top_srcdir)/boost
+INCLUDES = -I${top_srcdir}/src/ -I${top_srcdir}/src/frontends/ \
+       ${SIGC_CFLAGS} -I$(top_srcdir)/images ${FRONTEND_INCLUDES} $(BOOST_INCLUDES) \
+       -I$(top_srcdir)/src/frontends/controllers
+
+DISTCLEANFILES = $(XFORMS_SOURCES) $(BUILTSOURCES) *.orig *.rej *~ *.bak core
+
+LIBS=
+ETAGS_ARGS = --lang=c++
+
+XFORMS_SOURCES = \
+       bmtable.h \
+       bmtable.c \
+       combox.h \
+       combox.C \
+       Color.h \
+       Color.C \
+       DropDown.h \
+       DropDown.C \
+       FormBase.h \
+       FormBase.C \
+       FormBaseDeprecated.h \
+       FormBaseDeprecated.C \
+       FormDocument.h \
+       FormDocument.C \
+       FormParagraph.h \
+       FormParagraph.C \
+       FormMathsBitmap.h \
+       FormMathsBitmap.C \
+       FormMathsDeco.h \
+       FormMathsDeco.C \
+       FormMathsDelim.h \
+       FormMathsDelim.C \
+       FormMathsMatrix.h \
+       FormMathsMatrix.C \
+       FormMathsPanel.h \
+       FormMathsPanel.C \
+       FormMathsStyle.h \
+       FormMathsStyle.C \
+       FormMathsSpace.h \
+       FormMathsSpace.C \
+       FormPreferences.h \
+       FormPreferences.C \
+       FormTabular.h \
+       FormTabular.C \
+       FormInset.h \
+       FormInset.C \
+       MathsSymbols.h \
+       MathsSymbols.C \
+       Menubar_pimpl.h \
+       Menubar_pimpl.C \
+       RadioButtonGroup.h \
+       RadioButtonGroup.C \
+       Toolbar_pimpl.h \
+       Toolbar_pimpl.C \
+       Tooltips.h \
+       Tooltips.C \
+       form_document.h \
+       form_document.C \
+       form_paragraph.h \
+       form_paragraph.C \
+       form_preferences.h \
+       form_preferences.C \
+       form_tabular.h \
+       form_tabular.C \
+       form_maths_deco.h \
+       form_maths_deco.C \
+       form_maths_delim.h \
+       form_maths_delim.C \
+       form_maths_matrix.h \
+       form_maths_matrix.C \
+       form_maths_panel.h \
+       form_maths_panel.C \
+       form_maths_space.h \
+       form_maths_space.C \
+       form_maths_style.h \
+       form_maths_style.C \
+       input_validators.h \
+       input_validators.C \
+       xformsBC.h \
+       xformsBC.C \
+       xforms_helpers.h \
+       xforms_helpers.C
+$(XFORMS_SOURCES):
+       for i in $(XFORMS_SOURCES); do ln -sf "${top_srcdir}/src/frontends/xforms/$$i" . ; done
+ETAGS_ARGS = --lang=c++
+
+libqt2xforms_la_SOURCES = \
+       $(XFORMS_SOURCES)