diff --git a/src/frontends/qt2/ChangeLog b/src/frontends/qt2/ChangeLog index ae87c22816..1a0232dae5 100644 --- a/src/frontends/qt2/ChangeLog +++ b/src/frontends/qt2/ChangeLog @@ -1,3 +1,14 @@ +2002-01-15 John Levon + + * Makefile.am: + * FileDialog_private.h: fix compile + + * QThesaurus.h: + * QThesaurus.C: + * QThesaurusDialog.h: + * QThesaurusDialog.C: + * ui/QThesaurusDialog.ui: new thesaurus code + 2002-01-14 Angus Leeming * QMinipage.C (apply, update_contents): MinipageParams::width renamed diff --git a/src/frontends/qt2/Dialogs.C b/src/frontends/qt2/Dialogs.C index ebd0e97b85..ec6f0b3fff 100644 --- a/src/frontends/qt2/Dialogs.C +++ b/src/frontends/qt2/Dialogs.C @@ -65,38 +65,7 @@ #include "buffer.h" #include "Qt2BC.h" -// the controllers -#include "controllers/ControlAboutlyx.h" -#include "controllers/ControlBibitem.h" -#include "controllers/ControlBibtex.h" -#include "controllers/ControlCharacter.h" -#include "controllers/ControlCitation.h" -#include "controllers/ControlError.h" -#include "controllers/ControlERT.h" -#include "controllers/ControlExternal.h" -#include "controllers/ControlGraphics.h" -#include "controllers/ControlInclude.h" -#include "controllers/ControlIndex.h" -#include "controllers/ControlLog.h" -#include "controllers/ControlMinipage.h" -#include "controllers/ControlPreamble.h" -#include "controllers/ControlPrint.h" -#include "controllers/ControlRef.h" -#include "controllers/ControlSearch.h" -#include "controllers/ControlSpellchecker.h" -#include "controllers/ControlTabularCreate.h" -#include "controllers/ControlThesaurus.h" -#include "controllers/ControlUrl.h" -#include "controllers/ControlVCLog.h" -#if 0 -#include "controllers/ControlToc.h" -#endif - // xforms stuff -#include "controllers/ControlERT.h" -#include "controllers/ControlFloat.h" -#include "controllers/ControlShowFile.h" -#include "controllers/ControlToc.h" #include "xforms/FormBrowser.h" #include "xforms/form_browser.h" #include "xforms/FormDocument.h" diff --git a/src/frontends/qt2/FileDialog_private.C b/src/frontends/qt2/FileDialog_private.C index 0745fb6a3a..553a20b1cd 100644 --- a/src/frontends/qt2/FileDialog_private.C +++ b/src/frontends/qt2/FileDialog_private.C @@ -33,7 +33,9 @@ void LyXFileDialog::done(int what) if (action_ == LFUN_SELECT_FILE_SYNC) { QDialog::done(what); return; - } else if (what == QDialog::Accepted) + } else if (what == QDialog::Accepted) { lv_->getLyXFunc()->dispatch(action_, selectedFile().data()); + } + delete this; } diff --git a/src/frontends/qt2/FileDialog_private.h b/src/frontends/qt2/FileDialog_private.h index 0f3fda5ee1..6463876336 100644 --- a/src/frontends/qt2/FileDialog_private.h +++ b/src/frontends/qt2/FileDialog_private.h @@ -11,7 +11,7 @@ #define FILEDIALOG_PRIVATE_H #include - + #include #include "LString.h" @@ -35,7 +35,7 @@ public slots: private: LyXView * lv_; - int action_; + kb_action action_; }; #endif // FILEDIALOG_PRIVATE_H diff --git a/src/frontends/qt2/Makefile.am b/src/frontends/qt2/Makefile.am index bd9e6b385c..a6f1ad4034 100644 --- a/src/frontends/qt2/Makefile.am +++ b/src/frontends/qt2/Makefile.am @@ -33,6 +33,7 @@ libqt2_la_LIBADD = \ ../xforms/FormMathsDelim.lo \ ../xforms/FormMathsMatrix.lo \ ../xforms/FormMathsPanel.lo \ + ../xforms/FormMathsStyle.lo \ ../xforms/FormMathsSpace.lo \ ../xforms/FormParagraph.lo \ ../xforms/FormPreferences.lo \ @@ -58,6 +59,7 @@ libqt2_la_LIBADD = \ ../xforms/form_maths_matrix.lo \ ../xforms/form_maths_panel.lo \ ../xforms/form_maths_space.lo \ + ../xforms/form_maths_style.lo \ ../xforms/form_paragraph.lo \ ../xforms/input_validators.lo \ ../xforms/xformsBC.lo \ diff --git a/src/frontends/qt2/QBibitemDialog.h b/src/frontends/qt2/QBibitemDialog.h index 282d325668..169b8d70b0 100644 --- a/src/frontends/qt2/QBibitemDialog.h +++ b/src/frontends/qt2/QBibitemDialog.h @@ -9,8 +9,6 @@ #ifndef QBIBITEMDIALOG_H #define QBIBITEMDIALOG_H -#include - #include "ui/QBibitemDialogBase.h" class QBibitem; diff --git a/src/frontends/qt2/QCharacter.C b/src/frontends/qt2/QCharacter.C index 5563535ef1..83afefacd7 100644 --- a/src/frontends/qt2/QCharacter.C +++ b/src/frontends/qt2/QCharacter.C @@ -9,6 +9,8 @@ #include +#include + #include "gettext.h" #include "support/lstrings.h" diff --git a/src/frontends/qt2/QExternal.C b/src/frontends/qt2/QExternal.C index 28c3c31584..28637a8bf5 100644 --- a/src/frontends/qt2/QExternal.C +++ b/src/frontends/qt2/QExternal.C @@ -9,7 +9,6 @@ #include #include -#include "LString.h" #include "QExternalDialog.h" #include "ControlExternal.h" #include "QExternal.h" diff --git a/src/frontends/qt2/QThesaurus.C b/src/frontends/qt2/QThesaurus.C index 9b8107bc1d..11cb78849c 100644 --- a/src/frontends/qt2/QThesaurus.C +++ b/src/frontends/qt2/QThesaurus.C @@ -53,8 +53,3 @@ void QThesaurus::replace() { controller().replace(dialog_->replaceED->text().latin1()); } - - -void QThesaurus::apply() -{ -} diff --git a/src/frontends/qt2/QThesaurus.h b/src/frontends/qt2/QThesaurus.h index c4e4b24136..79b8ecee63 100644 --- a/src/frontends/qt2/QThesaurus.h +++ b/src/frontends/qt2/QThesaurus.h @@ -30,7 +30,7 @@ public: QThesaurus(ControlThesaurus &); private: /// Apply changes - virtual void apply(); + virtual void apply() { }; /// update virtual void update_contents(); /// build the dialog diff --git a/src/frontends/qt2/QThesaurusDialog.C b/src/frontends/qt2/QThesaurusDialog.C index d9553845a5..580272ad5f 100644 --- a/src/frontends/qt2/QThesaurusDialog.C +++ b/src/frontends/qt2/QThesaurusDialog.C @@ -16,9 +16,8 @@ #include "Dialogs.h" #include "QThesaurus.h" -#include #include -#include +#include #include QThesaurusDialog::QThesaurusDialog(QThesaurus * form) @@ -55,57 +54,49 @@ void QThesaurusDialog::replaceClicked() } -void QThesaurusDialog::selectionChanged(const QString & str) +void QThesaurusDialog::selectionChanged(QListViewItem * item) { if (form_->readOnly()) return; - string const entry(str.latin1()); + string const entry(item->text(0).latin1()); replaceED->setText(entry.c_str()); replacePB->setEnabled(true); form_->changed(); } -void QThesaurusDialog::selectionClicked(const QString & str) +void QThesaurusDialog::selectionClicked(QListViewItem * item) { - selectionChanged(str); - entryED->setText(str); + entryED->setText(item->text(0)); + selectionChanged(item); updateLists(); } void QThesaurusDialog::updateLists() { - ControlThesaurus & control(form_->controller()); - string const entry(entryED->text().latin1()); - - nounsLB->clear(); - verbsLB->clear(); - adjectivesLB->clear(); - adverbsLB->clear(); - otherLB->clear(); + meaningsLV->clear(); std::vector matches; - matches = control.getNouns(entry); - for (std::vector::const_iterator cit = matches.begin(); - cit != matches.end(); ++cit) - nounsLB->insertItem(cit->c_str()); - matches = control.getVerbs(entry); - for (std::vector::const_iterator cit = matches.begin(); - cit != matches.end(); ++cit) - verbsLB->insertItem(cit->c_str()); - matches = control.getAdjectives(entry); - for (std::vector::const_iterator cit = matches.begin(); - cit != matches.end(); ++cit) - adjectivesLB->insertItem(cit->c_str()); - matches = control.getAdverbs(entry); - for (std::vector::const_iterator cit = matches.begin(); - cit != matches.end(); ++cit) - adverbsLB->insertItem(cit->c_str()); - matches = control.getOthers(entry); - for (std::vector::const_iterator cit = matches.begin(); - cit != matches.end(); ++cit) - otherLB->insertItem(cit->c_str()); + meaningsLV->setUpdatesEnabled(false); + + Thesaurus::Meanings meanings = form_->controller().getMeanings(entryED->text().latin1()); + + for (Thesaurus::Meanings::const_iterator cit = meanings.begin(); + cit != meanings.end(); ++cit) { + QListViewItem * i = new QListViewItem(meaningsLV); + i->setText(0, cit->first.c_str()); + i->setOpen(true); + for (std::vector::const_iterator cit2 = cit->second.begin(); + cit2 != cit->second.end(); ++cit2) { + QListViewItem * i2 = new QListViewItem(i); + i2->setText(0, cit2->c_str()); + i2->setOpen(true); + } + } + + meaningsLV->setUpdatesEnabled(true); + meaningsLV->update(); } diff --git a/src/frontends/qt2/QThesaurusDialog.h b/src/frontends/qt2/QThesaurusDialog.h index 42b3319428..36e9bb7102 100644 --- a/src/frontends/qt2/QThesaurusDialog.h +++ b/src/frontends/qt2/QThesaurusDialog.h @@ -14,6 +14,7 @@ #include "ui/QThesaurusDialogBase.h" class QThesaurus; +class QListViewItem; class QThesaurusDialog : public QThesaurusDialogBase { Q_OBJECT @@ -27,8 +28,8 @@ protected slots: virtual void change_adaptor(); virtual void entryChanged(); virtual void replaceClicked(); - virtual void selectionChanged(const QString &); - virtual void selectionClicked(const QString &); + virtual void selectionChanged(QListViewItem *); + virtual void selectionClicked(QListViewItem *); protected: virtual void closeEvent(QCloseEvent * e); diff --git a/src/frontends/qt2/Qt2BC.C b/src/frontends/qt2/Qt2BC.C index 485afdb6c9..befb038f9f 100644 --- a/src/frontends/qt2/Qt2BC.C +++ b/src/frontends/qt2/Qt2BC.C @@ -14,6 +14,7 @@ #endif #include "Qt2BC.h" +#include "ButtonController.tmpl" #include "debug.h" #include diff --git a/src/frontends/qt2/ui/QThesaurusDialog.ui b/src/frontends/qt2/ui/QThesaurusDialog.ui index 0f3b3e4cbc..1219e26b80 100644 --- a/src/frontends/qt2/ui/QThesaurusDialog.ui +++ b/src/frontends/qt2/ui/QThesaurusDialog.ui @@ -13,7 +13,7 @@ 0 0 - 478 + 466 442 @@ -80,13 +80,6 @@ name Spacer2 - - sizePolicy - - 7 - 1 - - orientation Horizontal @@ -106,175 +99,33 @@ - QTabWidget + QListView + + + text + Thesaurus entries + + + clickable + true + + + resizeable + true + + name - TabWidget2 + meaningsLV + + + allColumnsShowFocus + true + + + toolTip + Select a related word - - QWidget - - name - tab - - - title - &Nouns - - - - margin - 11 - - - spacing - 6 - - - QListBox - - name - nounsLB - - - columnMode - FitToHeight - - - toolTip - Matching nouns - - - - - - QWidget - - name - tab - - - title - &Verbs - - - - margin - 11 - - - spacing - 6 - - - QListBox - - name - verbsLB - - - columnMode - FitToHeight - - - - - - QWidget - - name - tab - - - title - &Adjectives - - - - margin - 11 - - - spacing - 6 - - - QListBox - - name - adjectivesLB - - - columnMode - FitToHeight - - - - - - QWidget - - name - tab - - - title - A&dverbs - - - - margin - 11 - - - spacing - 6 - - - QListBox - - name - adverbsLB - - - columnMode - FitToHeight - - - - - - QWidget - - name - tab - - - title - &Other - - - - margin - 11 - - - spacing - 6 - - - QListBox - - name - otherLB - - - columnMode - FitToHeight - - - - QLayoutWidget @@ -415,79 +266,25 @@ replaceClicked() - nounsLB - highlighted(const QString&) + meaningsLV + currentChanged(QListViewItem*) QThesaurusDialogBase - selectionChanged(const QString &) + selectionChanged(QListViewItem *) - nounsLB - selected(const QString&) + meaningsLV + doubleClicked(QListViewItem*) QThesaurusDialogBase - selectionClicked(const QString &) - - - verbsLB - selected(const QString&) - QThesaurusDialogBase - selectionClicked(const QString &) - - - verbsLB - highlighted(const QString&) - QThesaurusDialogBase - selectionChanged(const QString &) - - - adjectivesLB - selected(const QString&) - QThesaurusDialogBase - selectionClicked(const QString &) - - - adjectivesLB - highlighted(const QString&) - QThesaurusDialogBase - selectionChanged(const QString &) - - - adverbsLB - selected(const QString&) - QThesaurusDialogBase - selectionClicked(const QString &) - - - adverbsLB - highlighted(const QString&) - QThesaurusDialogBase - selectionChanged(const QString &) - - - otherLB - selected(const QString&) - QThesaurusDialogBase - selectionClicked(const QString &) - - - otherLB - highlighted(const QString&) - QThesaurusDialogBase - selectionChanged(const QString &) + selectionClicked(QListViewItem *) change_adaptor() entryChanged() - selectionClicked(const QString &) replaceClicked() - selectionChanged(const QString &) + selectionChanged(QListViewItem *) + selectionClicked(QListViewItem *) entryED - TabWidget2 - nounsLB - verbsLB - adjectivesLB - adverbsLB - otherLB replaceED replacePB closePB