]> git.lyx.org Git - features.git/commitdiff
Add texinfo dialog to qt2 frontend
authorEdwin Leuven <e.leuven@gmail.com>
Sat, 19 Jan 2002 13:48:05 +0000 (13:48 +0000)
committerEdwin Leuven <e.leuven@gmail.com>
Sat, 19 Jan 2002 13:48:05 +0000 (13:48 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3419 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt2/ChangeLog
src/frontends/qt2/Dialogs.C
src/frontends/qt2/Makefile.dialogs
src/frontends/qt2/QTexinfo.C [new file with mode: 0644]
src/frontends/qt2/QTexinfo.h [new file with mode: 0644]
src/frontends/qt2/QTexinfoDialog.C [new file with mode: 0644]
src/frontends/qt2/QTexinfoDialog.h [new file with mode: 0644]
src/frontends/qt2/ui/QTexinfoDialog.ui [new file with mode: 0644]

index 54a42d2d964560f2ff8efe5c5266554004089808..2141f6c0672eabe4f054293fb12c721dd8d5ad82 100644 (file)
@@ -1,3 +1,11 @@
+2002-01-19  Edwin Leuven  <leuven@fee.uva.nl>
+
+       * QTexinfo.[Ch]: added
+       * QTexinfoDialog.[Ch]: added
+       * ui/QTexinfoDialog.ui: added
+       * Dialogs.C: add dialog
+       * Makefile.dialogs: idem
+
 2002-01-18  Edwin Leuven  <leuven@fee.uva.nl>
 
        * QMinipage.C: compiles fixes (lyxlength related)
index ec6f0b3fff478bacbde5edb4c1e934717bdc6dce..50baf9a9184419ee22e1302924b67903ecfa0d27 100644 (file)
@@ -31,6 +31,7 @@
 #include "QSearchDialog.h"
 #include "QSpellcheckerDialog.h"
 #include "QTabularCreateDialog.h"
+#include "QTexinfoDialog.h"
 #include "QThesaurusDialog.h"
 #include "QURLDialog.h"
 #include "QVCLogDialog.h"
@@ -55,6 +56,7 @@
 #include "QSearch.h"
 #include "QSpellchecker.h"
 #include "QTabularCreate.h"
+#include "QTexinfo.h"
 #include "QThesaurus.h"
 #include "QURL.h"
 #include "QVCLog.h"
@@ -109,6 +111,7 @@ Dialogs::Dialogs(LyXView * lv)
        add(new GUISearch<QSearch, Qt2BC>(*lv, *this)); 
        add(new GUISpellchecker<QSpellchecker, Qt2BC>(*lv, *this));
        add(new GUITabularCreate<QTabularCreate, Qt2BC>(*lv, *this));
+       add(new GUITexinfo<QTexinfo, Qt2BC>(*lv, *this));
        add(new GUIThesaurus<QThesaurus, Qt2BC>(*lv, *this));
        add(new GUIUrl<QURL, Qt2BC>(*lv, *this));
        add(new GUIVCLog<QVCLog, Qt2BC>(*lv, *this));
index 8054649092d49df1f062157383ed5bd42ecc83da..2c992122ef40118eef8f13d207189820c7b60d9a 100644 (file)
@@ -22,6 +22,7 @@ DIALOGS = \
        QSearch \
        QSpellchecker \
        QTabularCreate \
+       QTexinfo \
        QThesaurus \
        QToc \
        QURL \
@@ -70,6 +71,8 @@ DIALOGSOURCES = \
        QSpellchecker.C QSpellcheckerDialog.C \
        QTabularCreate.h QTabularCreateDialog.h \
        QTabularCreate.C QTabularCreateDialog.C \
+       QTexinfo.h QTexinfoDialog.h \
+       QTexinfo.C QTexinfoDialog.C \
        QThesaurus.h QThesaurusDialog.h \
        QThesaurus.C QThesaurusDialog.C \
        QToc.h QTocDialog.h \
@@ -101,6 +104,7 @@ MOCDIALOGS = \
        QSearchDialog_moc.C \
        QSpellcheckerDialog_moc.C \
        QTabularCreateDialog_moc.C \
+       QTexinfoDialog_moc.C \
        QThesaurusDialog_moc.C \
        QTocDialog_moc.C \
        QURLDialog_moc.C \
@@ -149,6 +153,8 @@ UIDIALOGS = \
        QSpellcheckerDialogBase.C \
        QTabularCreateDialogBase.h \
        QTabularCreateDialogBase.C \
+       QTexinfoDialogBase.h \
+       QTexinfoDialogBase.C \
        QThesaurusDialogBase.h \
        QThesaurusDialogBase.C \
        QTocDialogBase.h \
@@ -180,7 +186,12 @@ UIMOCDIALOGS = \
        QSearchDialogBase_moc.C \
        QSpellcheckerDialogBase_moc.C \
        QTabularCreateDialogBase_moc.C \
+       QTexinfoDialogBase_moc.C \
        QThesaurusDialogBase_moc.C \
        QTocDialogBase_moc.C \
        QURLDialogBase_moc.C \
        QVCLogDialogBase_moc.C
+
+
+
+
diff --git a/src/frontends/qt2/QTexinfo.C b/src/frontends/qt2/QTexinfo.C
new file mode 100644 (file)
index 0000000..7b76eee
--- /dev/null
@@ -0,0 +1,67 @@
+/**
+ * \file QTexinfo.C
+ * Copyright 2002 the LyX Team
+ * Read the file COPYING
+ *
+ * \author Edwin Leuven <leuven@fee.uva.nl>
+ */
+
+#include <config.h>
+
+#include <vector>
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include "ControlTexinfo.h"
+#include "QTexinfoDialog.h"
+#include "QTexinfo.h"
+#include "Qt2BC.h"
+#include "gettext.h"
+#include "helper_funcs.h"
+
+#include <qlistbox.h>
+#include <qpushbutton.h>
+#include <qcheckbox.h>
+
+typedef Qt2CB<ControlTexinfo, Qt2DB<QTexinfoDialog> > base_class;
+QTexinfo::QTexinfo(ControlTexinfo & c)
+       : base_class(c, _("LaTeX Information")), warningPosted(false), activeStyle(ControlTexinfo::cls)
+
+{
+}
+
+
+void QTexinfo::build_dialog()
+{
+       dialog_.reset(new QTexinfoDialog(this));
+
+       updateStyles(ControlTexinfo::cls);
+
+       bc().setCancel(dialog_->closePB);
+}
+
+void QTexinfo::updateStyles(ControlTexinfo::texFileSuffix whichStyle)
+{
+       bool const withFullPath = dialog_->path->isChecked();
+       
+       string const str =  controller().getContents(whichStyle, withFullPath);
+       std::vector<string> flist = getVectorFromString(str,"\n");
+       
+       dialog_->fileList->clear();
+       
+       for (vector<string>::const_iterator fitem = flist.begin();
+               fitem != flist.end(); ++fitem) {
+               dialog_->fileList->insertItem((*fitem).c_str());
+       }
+       
+       activeStyle = whichStyle;
+}
+
+void QTexinfo::updateStyles()
+{
+       updateStyles(activeStyle);
+}
diff --git a/src/frontends/qt2/QTexinfo.h b/src/frontends/qt2/QTexinfo.h
new file mode 100644 (file)
index 0000000..276941c
--- /dev/null
@@ -0,0 +1,50 @@
+// -*- C++ -*-
+/**
+ * \file QTexinfo.h
+ * Copyright 2002 the LyX Team
+ * Read the file COPYING
+ *
+ * \author Edwin Leuven <leuven@fee.uva.nl>
+ */
+
+#ifndef QTEXINFO_H
+#define QTEXINFO_H
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+#include "Qt2Base.h"
+
+#include "ControlTexinfo.h"
+
+class QTexinfoDialog;
+
+///
+class QTexinfo
+       : public Qt2CB<ControlTexinfo, Qt2DB<QTexinfoDialog> > 
+{
+public:
+       ///
+       friend class QTexinfoDialog;
+       ///
+       QTexinfo(ControlTexinfo &);
+private:
+       /// Apply changes
+       virtual void apply() { };
+       /// update (do we need this?)
+       virtual void update_contents() {};
+       /// build the dialog
+       virtual void build_dialog();
+       ///
+       void updateStyles(ControlTexinfo::texFileSuffix);
+       ///
+       void updateStyles();
+       ///
+       bool warningPosted;
+       ///
+       ControlTexinfo::texFileSuffix activeStyle;
+
+};
+
+#endif // QTEXINFO_H
diff --git a/src/frontends/qt2/QTexinfoDialog.C b/src/frontends/qt2/QTexinfoDialog.C
new file mode 100644 (file)
index 0000000..8b0096a
--- /dev/null
@@ -0,0 +1,83 @@
+/**
+ * \file QTexinfoDialog.C
+ * Copyright 2002 the LyX Team
+ * Read the file COPYING
+ *
+ * \author Edwin Leuven <leuven@fee.uva.nl>
+ */
+
+#include <config.h>
+#include <vector>
+
+#include "LString.h" 
+#include "ControlTexinfo.h" 
+#include "QTexinfoDialog.h"
+#include "Dialogs.h"
+#include "QTexinfo.h"
+
+#include <qlistbox.h>
+#include <qpushbutton.h>
+#include <qcombobox.h>
+
+QTexinfoDialog::QTexinfoDialog(QTexinfo * form)
+       : QTexinfoDialogBase(0, 0, false, 0),
+       form_(form)
+{
+       connect(closePB, SIGNAL(clicked()),
+               form, SLOT(slotClose()));
+}
+
+void QTexinfoDialog::change_adaptor()
+{
+       form_->changed();
+}
+
+void QTexinfoDialog::closeEvent(QCloseEvent * e)
+{
+       form_->slotWMHide();
+       e->accept();
+}
+
+void QTexinfoDialog::helpClicked()
+{
+       form_->controller().help();
+}
+
+void QTexinfoDialog::rescanClicked()
+{
+       // build new *Files.lst
+       form_->controller().rescanStyles();
+       form_->updateStyles();
+}
+
+void QTexinfoDialog::viewClicked()
+{
+       string const sel(fileList->currentText());
+       // a valid entry?
+       if (!sel.empty()) {
+               form_->controller().viewFile(sel.c_str());
+       }
+}
+
+void QTexinfoDialog::update()
+{
+       int item = whatStyle->currentItem();
+
+       switch (item) {
+       case 0:
+               form_->updateStyles(ControlTexinfo::cls);
+               break;
+       case 1:
+               form_->updateStyles(ControlTexinfo::sty);
+               break;
+       case 2:
+               form_->updateStyles(ControlTexinfo::bst);
+               break;
+       default:
+               break;
+       }
+       
+}
diff --git a/src/frontends/qt2/QTexinfoDialog.h b/src/frontends/qt2/QTexinfoDialog.h
new file mode 100644 (file)
index 0000000..e5b17d8
--- /dev/null
@@ -0,0 +1,38 @@
+/**
+ * \file QTexinfoDialog.h
+ * Copyright 2002 the LyX Team
+ * Read the file COPYING
+ *
+ * \author Edwin Leuven <leuven@fee.uva.nl>
+ */
+
+#ifndef QTEXINFODIALOG_H
+#define QTEXINFODIALOG_H
+#include <config.h>
+#include "ui/QTexinfoDialogBase.h"
+
+class QTexinfo;
+
+class QTexinfoDialog : public QTexinfoDialogBase
+{ Q_OBJECT
+
+public:
+       QTexinfoDialog(QTexinfo * form);
+
+protected slots:
+       virtual void change_adaptor();
+       virtual void helpClicked();
+       virtual void rescanClicked();
+       virtual void viewClicked();
+       virtual void update();
+
+protected:
+       virtual void closeEvent(QCloseEvent * e);
+
+private:
+       QTexinfo * form_;
+};
+
+#endif // QTEXINFODIALOG_H
diff --git a/src/frontends/qt2/ui/QTexinfoDialog.ui b/src/frontends/qt2/ui/QTexinfoDialog.ui
new file mode 100644 (file)
index 0000000..0f8dbe7
--- /dev/null
@@ -0,0 +1,314 @@
+<!DOCTYPE UI><UI>
+<class>QTexinfoDialogBase</class>
+<include location="global">config.h</include>
+<include location="local">gettext.h</include>
+<widget>
+    <class>QDialog</class>
+    <property stdset="1">
+        <name>name</name>
+        <cstring>QTexinfoDialogBase</cstring>
+    </property>
+    <property stdset="1">
+        <name>geometry</name>
+        <rect>
+            <x>0</x>
+            <y>0</y>
+            <width>299</width>
+            <height>290</height>
+        </rect>
+    </property>
+    <property stdset="1">
+        <name>caption</name>
+        <string>Form1</string>
+    </property>
+    <vbox>
+        <property stdset="1">
+            <name>margin</name>
+            <number>11</number>
+        </property>
+        <property stdset="1">
+            <name>spacing</name>
+            <number>6</number>
+        </property>
+        <widget>
+            <class>QLayoutWidget</class>
+            <property stdset="1">
+                <name>name</name>
+                <cstring>Layout1</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>QComboBox</class>
+                    <item>
+                        <property>
+                            <name>text</name>
+                            <string>LaTeX classes</string>
+                        </property>
+                    </item>
+                    <item>
+                        <property>
+                            <name>text</name>
+                            <string>LaTeX styles</string>
+                        </property>
+                    </item>
+                    <item>
+                        <property>
+                            <name>text</name>
+                            <string>BibTeX styles</string>
+                        </property>
+                    </item>
+                    <property stdset="1">
+                        <name>name</name>
+                        <cstring>whatStyle</cstring>
+                    </property>
+                    <property>
+                        <name>toolTip</name>
+                        <string>Selected classes or styles</string>
+                    </property>
+                </widget>
+                <spacer>
+                    <property>
+                        <name>name</name>
+                        <cstring>Spacer1</cstring>
+                    </property>
+                    <property stdset="1">
+                        <name>orientation</name>
+                        <enum>Horizontal</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>QCheckBox</class>
+                    <property stdset="1">
+                        <name>name</name>
+                        <cstring>path</cstring>
+                    </property>
+                    <property stdset="1">
+                        <name>text</name>
+                        <string>Show &amp;path</string>
+                    </property>
+                    <property>
+                        <name>toolTip</name>
+                        <string>Toggles view of the file list</string>
+                    </property>
+                </widget>
+            </hbox>
+        </widget>
+        <widget>
+            <class>QListBox</class>
+            <item>
+                <property>
+                    <name>text</name>
+                    <string>New Item</string>
+                </property>
+            </item>
+            <property stdset="1">
+                <name>name</name>
+                <cstring>fileList</cstring>
+            </property>
+            <property>
+                <name>toolTip</name>
+                <string>Installed files</string>
+            </property>
+        </widget>
+        <widget>
+            <class>QLayoutWidget</class>
+            <property stdset="1">
+                <name>name</name>
+                <cstring>Layout3</cstring>
+            </property>
+            <hbox>
+                <property stdset="1">
+                    <name>margin</name>
+                    <number>0</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>Horizontal</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>QPushButton</class>
+                    <property stdset="1">
+                        <name>name</name>
+                        <cstring>rescanPB</cstring>
+                    </property>
+                    <property stdset="1">
+                        <name>text</name>
+                        <string>&amp;Rescan</string>
+                    </property>
+                    <property>
+                        <name>toolTip</name>
+                        <string>Built new file list</string>
+                    </property>
+                </widget>
+                <widget>
+                    <class>QPushButton</class>
+                    <property stdset="1">
+                        <name>name</name>
+                        <cstring>viewPB</cstring>
+                    </property>
+                    <property stdset="1">
+                        <name>text</name>
+                        <string>&amp;View</string>
+                    </property>
+                    <property>
+                        <name>toolTip</name>
+                        <string>Show contents of marked file. Only possible when files are shown with path</string>
+                    </property>
+                </widget>
+            </hbox>
+        </widget>
+        <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>helpPB</cstring>
+                    </property>
+                    <property stdset="1">
+                        <name>text</name>
+                        <string>&amp;Help</string>
+                    </property>
+                    <property>
+                        <name>toolTip</name>
+                        <string>Bring up help file</string>
+                    </property>
+                </widget>
+                <spacer>
+                    <property>
+                        <name>name</name>
+                        <cstring>Spacer4</cstring>
+                    </property>
+                    <property stdset="1">
+                        <name>orientation</name>
+                        <enum>Horizontal</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>QPushButton</class>
+                    <property stdset="1">
+                        <name>name</name>
+                        <cstring>closePB</cstring>
+                    </property>
+                    <property stdset="1">
+                        <name>text</name>
+                        <string>&amp;Close</string>
+                    </property>
+                    <property>
+                        <name>toolTip</name>
+                        <string>Close this dialog</string>
+                    </property>
+                </widget>
+            </hbox>
+        </widget>
+    </vbox>
+</widget>
+<connections>
+    <connection>
+        <sender>viewPB</sender>
+        <signal>clicked()</signal>
+        <receiver>QTexinfoDialogBase</receiver>
+        <slot>viewClicked()</slot>
+    </connection>
+    <connection>
+        <sender>helpPB</sender>
+        <signal>clicked()</signal>
+        <receiver>QTexinfoDialogBase</receiver>
+        <slot>helpClicked()</slot>
+    </connection>
+    <connection>
+        <sender>rescanPB</sender>
+        <signal>clicked()</signal>
+        <receiver>QTexinfoDialogBase</receiver>
+        <slot>rescanClicked()</slot>
+    </connection>
+    <connection>
+        <sender>path</sender>
+        <signal>stateChanged(int)</signal>
+        <receiver>QTexinfoDialogBase</receiver>
+        <slot>update()</slot>
+    </connection>
+    <connection>
+        <sender>whatStyle</sender>
+        <signal>activated(int)</signal>
+        <receiver>QTexinfoDialogBase</receiver>
+        <slot>update()</slot>
+    </connection>
+    <slot access="protected">helpClicked()</slot>
+    <slot access="protected">rescanClicked()</slot>
+    <slot access="protected">update()</slot>
+    <slot access="protected">viewClicked()</slot>
+</connections>
+<tabstops>
+    <tabstop>whatStyle</tabstop>
+    <tabstop>path</tabstop>
+    <tabstop>viewPB</tabstop>
+    <tabstop>rescanPB</tabstop>
+    <tabstop>helpPB</tabstop>
+    <tabstop>closePB</tabstop>
+</tabstops>
+</UI>