From c4c506908dca998b8d7c3c2a8b071a1472f6e189 Mon Sep 17 00:00:00 2001 From: Edwin Leuven Date: Tue, 23 Jul 2002 13:12:55 +0000 Subject: [PATCH] Texinfo path issue repaired, Bibtex style combo, Citation, External re-layout. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4762 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt2/ChangeLog | 14 + src/frontends/qt2/QBibtex.C | 13 +- src/frontends/qt2/QBibtexDialog.C | 14 +- src/frontends/qt2/QTexinfo.C | 26 +- src/frontends/qt2/QTexinfo.h | 7 +- src/frontends/qt2/QTexinfoDialog.C | 34 +- src/frontends/qt2/QTexinfoDialog.h | 2 +- src/frontends/qt2/TODO | 4 - src/frontends/qt2/ui/QBibtexDialog.ui | 190 ++--- src/frontends/qt2/ui/QCitationDialog.ui | 932 +++++++++++------------- src/frontends/qt2/ui/QExternalDialog.ui | 231 +++--- src/frontends/qt2/ui/QTexinfoDialog.ui | 38 +- 12 files changed, 728 insertions(+), 777 deletions(-) diff --git a/src/frontends/qt2/ChangeLog b/src/frontends/qt2/ChangeLog index e8aff78b46..eb9ab0574a 100644 --- a/src/frontends/qt2/ChangeLog +++ b/src/frontends/qt2/ChangeLog @@ -1,3 +1,17 @@ +2002-07-23 Edwin Leuven + + * QBibtex.C: syle combobox instead of listbox + * QBibtexDialog.C: + * ui/QBibtexDialog.ui + * QTexinfo.C: Repair view without path/selection + * QTexinfo.h + * QTexinfoDialog.C + * QTexinfoDialog.h + * ui/QTexinfoDialog.ui + * ui/QCitationDialog.ui: layout fix + * ui/QExternalDialog.ui: idem + * TODO: update + 2002-07-23 John Levon * QCommandBuffer.C: real compile fix diff --git a/src/frontends/qt2/QBibtex.C b/src/frontends/qt2/QBibtex.C index 884e10a0f5..44cfe20231 100644 --- a/src/frontends/qt2/QBibtex.C +++ b/src/frontends/qt2/QBibtex.C @@ -41,10 +41,8 @@ void QBibtex::build_dialog() bc().setCancel(dialog_->closePB); bc().addReadOnly(dialog_->databaseLB); bc().addReadOnly(dialog_->databasePB); - bc().addReadOnly(dialog_->styleED); bc().addReadOnly(dialog_->stylePB); - bc().addReadOnly(dialog_->styleListLB); - bc().addReadOnly(dialog_->styleListPB); + bc().addReadOnly(dialog_->styleCB); bc().addReadOnly(dialog_->bibtocCB); bc().addReadOnly(dialog_->databasePB); bc().addReadOnly(dialog_->deletePB); @@ -80,15 +78,14 @@ void QBibtex::update_contents() } else dialog_->bibtocCB->setChecked(false); - dialog_->styleED->setText(bibstyle.c_str()); vector const str = getVectorFromString( controller().getBibStyles(),"\n"); for (vector::const_iterator it = str.begin(); it != str.end(); ++it) { - dialog_->styleListLB->insertItem(ChangeExtension(*it,"").c_str()); + dialog_->styleCB->insertItem(ChangeExtension(*it,"").c_str()); } - + dialog_->styleCB->insertItem(bibstyle.c_str(),0); } @@ -103,7 +100,7 @@ void QBibtex::apply() } controller().params().setContents(dbs); - string bibstyle(dialog_->styleED->text().latin1()); + string bibstyle(dialog_->styleCB->text(0).latin1()); bool const bibtotoc(dialog_->bibtocCB->isChecked()); @@ -123,5 +120,5 @@ void QBibtex::apply() bool QBibtex::isValid() { return dialog_->databaseLB->count() != 0 && - !string(dialog_->styleED->text()).empty(); + !string(dialog_->styleCB->text(0)).empty(); } diff --git a/src/frontends/qt2/QBibtexDialog.C b/src/frontends/qt2/QBibtexDialog.C index b201c34c7c..191140863b 100644 --- a/src/frontends/qt2/QBibtexDialog.C +++ b/src/frontends/qt2/QBibtexDialog.C @@ -19,7 +19,6 @@ #include #include #include -#include #include #include @@ -45,10 +44,15 @@ void QBibtexDialog::change_adaptor() void QBibtexDialog::browsePressed() { - QString file = QFileDialog::getOpenFileName(QString::null, - _("BibTeX style files (*.bst)"), this, 0, _("Select a BibTeX style")); + QString file = + QFileDialog::getOpenFileName(QString::null, + _("BibTeX style files (*.bst)"), + this, + 0, + _("Select a BibTeX style")); if (!file.isNull()) { - styleED->setText(ChangeExtension(OnlyFilename(file.latin1()), "").c_str()); + string const filen = ChangeExtension(OnlyFilename(file.latin1()), ""); + styleCB->insertItem(filen.c_str(),0); form_->changed(); } } @@ -81,7 +85,7 @@ void QBibtexDialog::deletePressed() void QBibtexDialog::styleChanged(const QString & sel) { - styleED->setText(sel); + styleCB->insertItem(sel,0); } diff --git a/src/frontends/qt2/QTexinfo.C b/src/frontends/qt2/QTexinfo.C index 51491c8e5f..2d356dd1f7 100644 --- a/src/frontends/qt2/QTexinfo.C +++ b/src/frontends/qt2/QTexinfo.C @@ -50,13 +50,25 @@ void QTexinfo::build_dialog() void QTexinfo::updateStyles(ControlTexinfo::texFileSuffix whichStyle) { - bool const withFullPath = dialog_->path->isChecked(); - - string const str = controller().getContents(whichStyle, withFullPath); - std::vector flist = getVectorFromString(str, "\n"); + string const fstr = controller().getContents(whichStyle, true); + + switch (whichStyle) { + case ControlTexinfo::bst: + bst_ = getVectorFromString(fstr, "\n"); + break; + case ControlTexinfo::cls: + cls_ = getVectorFromString(fstr, "\n"); + break; + case ControlTexinfo::sty: + sty_ = getVectorFromString(fstr, "\n"); + break; + } dialog_->fileList->clear(); + bool const withFullPath = dialog_->path->isChecked(); + string const str = controller().getContents(whichStyle, withFullPath); + vector flist = getVectorFromString(str, "\n"); for (vector::const_iterator fitem = flist.begin(); fitem != flist.end(); ++fitem) { dialog_->fileList->insertItem((*fitem).c_str()); @@ -70,3 +82,9 @@ void QTexinfo::updateStyles() { updateStyles(activeStyle); } + + + + + + diff --git a/src/frontends/qt2/QTexinfo.h b/src/frontends/qt2/QTexinfo.h index c8c4415951..68a1169c59 100644 --- a/src/frontends/qt2/QTexinfo.h +++ b/src/frontends/qt2/QTexinfo.h @@ -44,7 +44,12 @@ private: bool warningPosted; /// ControlTexinfo::texFileSuffix activeStyle; - + /// + vector cls_; + /// + vector sty_; + /// + vector bst_; }; #endif // QTEXINFO_H diff --git a/src/frontends/qt2/QTexinfoDialog.C b/src/frontends/qt2/QTexinfoDialog.C index 1ea58e81ce..c8264eb7a4 100644 --- a/src/frontends/qt2/QTexinfoDialog.C +++ b/src/frontends/qt2/QTexinfoDialog.C @@ -45,11 +45,28 @@ void QTexinfoDialog::rescanClicked() // build new *Files.lst form_->controller().rescanStyles(); form_->updateStyles(); + enableViewPB(); } void QTexinfoDialog::viewClicked() { - string const sel(fileList->currentText()); + int const fitem = fileList->currentItem(); + + string sel; + switch (whatStyle->currentItem()) { + case 0: + sel = form_->cls_[fitem]; + break; + case 1: + sel = form_->sty_[fitem]; + break; + case 2: + sel = form_->bst_[fitem]; + break; + default: + break; + } + // a valid entry? if (!sel.empty()) { form_->controller().viewFile(sel.c_str()); @@ -58,9 +75,7 @@ void QTexinfoDialog::viewClicked() void QTexinfoDialog::update() { - int item = whatStyle->currentItem(); - - switch (item) { + switch (whatStyle->currentItem()) { case 0: form_->updateStyles(ControlTexinfo::cls); break; @@ -73,5 +88,14 @@ void QTexinfoDialog::update() default: break; } - + + enableViewPB(); } + +void QTexinfoDialog::enableViewPB() +{ + viewPB->setEnabled(fileList->currentItem()>-1); +} + + + diff --git a/src/frontends/qt2/QTexinfoDialog.h b/src/frontends/qt2/QTexinfoDialog.h index 0be6a39d48..8d17518f0e 100644 --- a/src/frontends/qt2/QTexinfoDialog.h +++ b/src/frontends/qt2/QTexinfoDialog.h @@ -26,10 +26,10 @@ protected slots: virtual void rescanClicked(); virtual void viewClicked(); virtual void update(); + virtual void enableViewPB(); protected: virtual void closeEvent(QCloseEvent * e); - private: QTexinfo * form_; }; diff --git a/src/frontends/qt2/TODO b/src/frontends/qt2/TODO index 42d3257c21..428f543cbe 100644 --- a/src/frontends/qt2/TODO +++ b/src/frontends/qt2/TODO @@ -98,10 +98,6 @@ QTabular - implement me (need MVC) (*) -QTexinfo - - - fix "View" when path not shown - QtView - decide what to do about prohibit/allowInput diff --git a/src/frontends/qt2/ui/QBibtexDialog.ui b/src/frontends/qt2/ui/QBibtexDialog.ui index 92d773768c..6a237b2aaa 100644 --- a/src/frontends/qt2/ui/QBibtexDialog.ui +++ b/src/frontends/qt2/ui/QBibtexDialog.ui @@ -14,7 +14,7 @@ 0 0 301 - 435 + 318 @@ -34,7 +34,7 @@ spacing 6 - + QLayoutWidget name @@ -124,21 +124,6 @@ vAlign - - QListBox - - name - databaseLB - - - enabled - true - - - toolTip - Available BibTeX databases - - QPushButton @@ -158,41 +143,7 @@ Add a BibTeX database file - - QPushButton - - name - deletePB - - - text - &Delete - - - toolTip - Remove the selected database - - - - QLabel - - name - styleLA - - - text - St&yle - - - buddy - styleED - - - toolTip - The BibTeX style - - - + QPushButton name @@ -211,22 +162,7 @@ Choose a style file - - QCheckBox - - name - bibtocCB - - - text - Add bibliography to &TOC - - - toolTip - Add bibliography to the table of contents - - - + QPushButton name @@ -245,54 +181,74 @@ Update style list - - QLineEdit + + QComboBox name - styleED + styleCB - sizePolicy - - 7 - 0 - + editable + true - - toolTip - The name of the style to use + + autoCompletion + true + + + duplicatesEnabled + false - - QLabel + + QCheckBox name - styleListL + bibtocCB text - A&vailable styles - - - buddy - styleListLB - - - - QListBox - - name - styleListLB + Add bibliography to &TOC toolTip - List of available styles + Add bibliography to the table of contents - + + QPushButton + + name + deletePB + + + text + &Delete + + + toolTip + Remove the selected database + + + + QListBox + + name + databaseLB + + + enabled + true + + + toolTip + Available BibTeX databases + + + name - Spacer5 + Spacer4 orientation @@ -310,6 +266,25 @@ + + QLabel + + name + styleLA + + + text + St&yle + + + buddy + styleCB + + + toolTip + The BibTeX style + + @@ -343,24 +318,6 @@ QBibtexDialogBase databaseChanged() - - styleED - returnPressed() - QBibtexDialogBase - change_adaptor() - - - styleED - textChanged(const QString&) - QBibtexDialogBase - change_adaptor() - - - styleListLB - highlighted(const QString&) - QBibtexDialogBase - styleChanged(const QString &) - addPressed() browsePressed() change_adaptor() @@ -372,9 +329,8 @@ databaseLB databasePB deletePB - styleED stylePB - styleListLB + styleCB styleListPB bibtocCB okPB diff --git a/src/frontends/qt2/ui/QCitationDialog.ui b/src/frontends/qt2/ui/QCitationDialog.ui index b4429b5e4d..a1a2fc5738 100644 --- a/src/frontends/qt2/ui/QCitationDialog.ui +++ b/src/frontends/qt2/ui/QCitationDialog.ui @@ -13,8 +13,8 @@ 0 0 - 577 - 427 + 613 + 416 @@ -34,226 +34,7 @@ spacing 6 - - QLayoutWidget - - name - Layout15 - - - - margin - 0 - - - spacing - 6 - - - QLabel - - name - insetKeysLA - - - text - Selected - - - - QListBox - - - text - New Item - - - - name - citeLB - - - selectionMode - Single - - - toolTip - Citations currently selected - - - - QListBox - - - text - New Item - - - - name - bibLB - - - toolTip - Available citation keys - - - - - name - Spacer5 - - - orientation - Vertical - - - sizeType - Expanding - - - sizeHint - - 20 - 20 - - - - - QLabel - - name - bibliographyKeysLA - - - text - Available - - - - QLayoutWidget - - name - Layout1 - - - - margin - 0 - - - spacing - 6 - - - QPushButton - - name - addPB - - - sizePolicy - - 0 - 0 - - - - text - - - - pixmap - image0 - - - toolTip - Add the selected citation - - - - QPushButton - - name - delPB - - - sizePolicy - - 0 - 0 - - - - text - - - - pixmap - image1 - - - toolTip - Remove the selected citation - - - - QPushButton - - name - upPB - - - sizePolicy - - 0 - 0 - - - - text - - - - pixmap - image2 - - - toolTip - Move the selected citation up - - - - QPushButton - - name - downPB - - - sizePolicy - - 0 - 0 - - - - text - - - - pixmap - image3 - - - toolTip - Move the selected citation down - - - - - - - + QLayoutWidget name @@ -343,11 +124,109 @@ - + + QLineEdit + + name + searchED + + + sizePolicy + + 1 + 0 + + + + toolTip + Search the available citations + + + + QCheckBox + + name + searchTypeCB + + + text + Regular E&xpression + + + toolTip + Interpret search entry as a regular expression + + + + QCheckBox + + name + searchCaseCB + + + text + &Case sensitive + + + toolTip + Make the search case-sensitive + + + + QPushButton + + name + nextPB + + + text + &Next + + + + QPushButton + + name + previousPB + + + text + &Previous + + + + QLabel + + name + TextLabel1 + + + text + Search + + + + QListBox + + + text + New Item + + + + name + bibLB + + + toolTip + Available citation keys + + + QLayoutWidget name - Layout16 + Layout1 @@ -359,127 +238,236 @@ 6 - QLabel + QPushButton name - infoLA + addPB + + + sizePolicy + + 0 + 0 + text - Info - - - - QMultiLineEdit - - name - infoML + - focusPolicy - NoFocus - - - wordWrap - WidgetWidth - - - readOnly - true + pixmap + image0 toolTip - Citation entry + Add the selected citation + + + + QPushButton + + name + delPB + + + sizePolicy + + 0 + 0 + + + + text + + + + pixmap + image1 + + + toolTip + Remove the selected citation + + + + QPushButton + + name + upPB + + + sizePolicy + + 0 + 0 + + + + text + + + + pixmap + image2 + + + toolTip + Move the selected citation up + + + + QPushButton + + name + downPB + + + sizePolicy + + 0 + 0 + + + + text + + + + pixmap + image3 + + + toolTip + Move the selected citation down - - QGroupBox + + QLabel name - GroupBox22 + bibliographyKeysLA - title - Search + text + Available - + + + QListBox + + + text + New Item + + + + name + citeLB + + + selectionMode + Single + + + toolTip + Citations currently selected + + + + QLabel + + name + insetKeysLA + + + text + Selected + + + + + name + Spacer5 + + + orientation + Vertical + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + QLabel + + name + infoLA + + + text + Info + + + + QMultiLineEdit + + name + infoML + + + focusPolicy + NoFocus + + + wordWrap + WidgetWidth + + + readOnly + true + + + toolTip + Citation entry + + + + QLayoutWidget + + name + Layout15 + + margin - 11 + 0 spacing 6 - - QCheckBox - - name - searchCaseCB - - - sizePolicy - - 3 - 0 - - - - text - &Case sensitive - - - toolTip - Make the search case-sensitive - - - - QCheckBox - - name - searchTypeCB - - - sizePolicy - - 3 - 0 - - - - text - Regular E&xpression - - - toolTip - Interpret search entry as a regular expression - - - - QLineEdit - - name - searchED - - - toolTip - Search the available citations - - - + name - Spacer48 + Spacer8 orientation - Vertical + Horizontal sizeType - Expanding + MinimumExpanding sizeHint @@ -489,218 +477,158 @@ - - QPushButton + + QCheckBox name - previousPB + fulllistCB text - &Previous + &Full author list + + + toolTip + List all authors - - QPushButton + + QCheckBox name - nextPB + forceuppercaseCB text - &Next + Force &upper case + + + toolTip + Force upper case in citation - + - - QGroupBox + + QLineEdit name - GroupBox21 + textAfterED - title - Format + sizePolicy + + 5 + 0 + + + + toolTip + Text to place after citation - - - margin - 11 - - - spacing - 6 - - - QLineEdit - - name - textBeforeED - - - enabled - false - - - sizePolicy - - 7 - 0 - - - - text - Not yet supported - - - toolTip - Text to place before citation - - - - QLineEdit - - name - textAfterED - - - sizePolicy - - 7 - 0 - - - - toolTip - Text to place after citation - - - - QLabel - - name - textBeforeLA - - - enabled - false - - - text - Text before: - - - - QLabel - - name - textAfterLA - - - text - Text after: - - - - QComboBox - - name - citationStyleCO - - - sizePolicy - - 3 - 0 - - - - toolTip - Natbib citation style to use - - - - QLayoutWidget - - name - Layout15 - - - - margin - 0 - - - spacing - 6 - - - - name - Spacer8 - - - orientation - Horizontal - - - sizeType - Expanding - - - sizeHint - - 20 - 20 - - - - - QCheckBox - - name - fulllistCB - - - text - &Full author list - - - toolTip - List all authors - - - - QCheckBox - - name - forceuppercaseCB - - - text - Force &upper case - - - toolTip - Force upper case in citation - - - - - - QLabel - - name - citationStyleLA - - - text - Citation style: - - - + + QLabel + + name + textAfterLA + + + text + Text after: + + + + QLineEdit + + name + textBeforeED + + + enabled + false + + + sizePolicy + + 5 + 0 + + + + text + Not yet supported + + + toolTip + Text to place before citation + + + + QLabel + + name + textBeforeLA + + + enabled + false + + + text + Text before: + + + + QComboBox + + name + citationStyleCO + + + sizePolicy + + 3 + 0 + + + + toolTip + Natbib citation style to use + + + + QLabel + + name + citationStyleLA + + + text + Citation style: + + + + + name + Spacer5_2 + + + orientation + Vertical + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + diff --git a/src/frontends/qt2/ui/QExternalDialog.ui b/src/frontends/qt2/ui/QExternalDialog.ui index 67433d93c5..517e9234f8 100644 --- a/src/frontends/qt2/ui/QExternalDialog.ui +++ b/src/frontends/qt2/ui/QExternalDialog.ui @@ -13,8 +13,8 @@ 0 0 - 392 - 340 + 369 + 378 @@ -30,86 +30,34 @@ spacing 6 - + QLabel name - templateLA + fileLA text - &Template: + &File: buddy - externalCO + fileED toolTip - Available templates + Filename - - QTextView - - name - externalTV - - - toolTip - LaTeX error messages - - - - QLabel - - name - paramsLA - - - text - &Parameters: - - - buddy - paramsED - - - toolTip - Parameters - - - - QPushButton - - name - browsePB - - - text - &Browse... - - - + QLineEdit name - paramsED + fileED toolTip - Parameters - - - - QComboBox - - name - externalCO - - - toolTip - Available templates + Filename @@ -195,36 +143,6 @@ - - QLabel - - name - fileLA - - - text - &File: - - - buddy - fileED - - - toolTip - Filename - - - - QLineEdit - - name - fileED - - - toolTip - Filename - - QLayoutWidget @@ -240,28 +158,6 @@ spacing 6 - - QPushButton - - name - editPB - - - sizePolicy - - 7 - 0 - - - - text - &Edit file - - - toolTip - Edit the file externally - - QPushButton @@ -277,7 +173,7 @@ text - &View file + &View Result toolTip @@ -299,7 +195,7 @@ text - &Update + &Update Result toolTip @@ -308,6 +204,103 @@ + + QTextView + + name + externalTV + + + toolTip + LaTeX error messages + + + + QComboBox + + name + externalCO + + + toolTip + Available templates + + + + QLabel + + name + templateLA + + + text + &Template: + + + buddy + externalCO + + + toolTip + Available templates + + + + QLineEdit + + name + paramsED + + + toolTip + Parameters + + + + QLabel + + name + paramsLA + + + text + &Parameters: + + + buddy + paramsED + + + toolTip + Parameters + + + + QPushButton + + name + browsePB + + + text + &Browse... + + + + QPushButton + + name + editPB + + + text + &Edit file + + + toolTip + Edit the file externally + + @@ -323,12 +316,6 @@ QExternalDialogBase viewClicked() - - editPB - clicked() - QExternalDialogBase - editClicked() - externalCO activated(const QString&) diff --git a/src/frontends/qt2/ui/QTexinfoDialog.ui b/src/frontends/qt2/ui/QTexinfoDialog.ui index 9e6c148671..8d8b0bc289 100644 --- a/src/frontends/qt2/ui/QTexinfoDialog.ui +++ b/src/frontends/qt2/ui/QTexinfoDialog.ui @@ -13,7 +13,7 @@ 0 0 - 295 + 279 290 @@ -186,6 +186,10 @@ name viewPB + + enabled + false + text &View @@ -260,10 +264,22 @@ viewClicked() - rescanPB - clicked() + whatStyle + activated(const QString&) QTexinfoDialogBase - rescanClicked() + enableViewPB() + + + whatStyle + activated(int) + QTexinfoDialogBase + update() + + + fileList + clicked(QListBoxItem*) + QTexinfoDialogBase + enableViewPB() path @@ -272,12 +288,18 @@ update() - whatStyle - activated(int) + rescanPB + clicked() QTexinfoDialogBase - update() + enableViewPB() - helpClicked() + + rescanPB + clicked() + QTexinfoDialogBase + rescanClicked() + + enableViewPB() rescanClicked() update() viewClicked()