This patch contains the qcitation fix (bug 1146) plus: - a fix for bug 1037 (disable the goto button in the qref dialog if there is no reference at all) - a fix for bug 1511 (restore the settings of the buffer combo in the qref dialog) - and an enhancement for natbib users: restore the settings of the citation style combo. Normally, you have a default style (e.g. \citep), and it is very annoying to chose that any all time again.
If there are no objections, I'll apply this. Jürgen.
Index: src/frontends/qt2/ChangeLog =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/ChangeLog,v retrieving revision 1.641 diff -u -r1.641 ChangeLog --- src/frontends/qt2/ChangeLog 1 Feb 2004 12:46:11 -0000 1.641 +++ src/frontends/qt2/ChangeLog 18 Feb 2004 10:27:37 -0000 @@ -1,3 +1,14 @@ +2004-02-18 Jürgen Spitzmüller <[EMAIL PROTECTED]> + + * QCitation.[Ch]: + * QCitationDialog.[Ch]: open the find dialog if an inset is + new (new method openFind()). Fixes bug 1146. + + * QCitation.C: restore the chosen natbib style. + + * QRef.C: Disable goto button if there is no ref (bug 1037) + Restore setting of the buffer combo (bug 1511) + 2004-02-01 Lars Gullik Bjonnes <[EMAIL PROTECTED]> * floatplacement.C (set): "c" -> 'c' in calls to contains Index: src/frontends/qt2/QCitation.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/QCitation.C,v retrieving revision 1.28 diff -u -r1.28 QCitation.C --- src/frontends/qt2/QCitation.C 6 Oct 2003 15:42:50 -0000 1.28 +++ src/frontends/qt2/QCitation.C 18 Feb 2004 10:27:38 -0000 @@ -62,6 +62,9 @@ string const after = fromqstr(dialog_->textAfterED->text()); controller().params().setOptions(after); + + style_ = choice; + open_find_ = false; } @@ -69,6 +72,7 @@ { citekeys.clear(); bibkeys.clear(); + open_find_ = true; QDialogView::hide(); } @@ -94,6 +98,8 @@ // add when enabled ! //bcview().addReadOnly(dialog_->textBeforeED); bcview().addReadOnly(dialog_->textAfterED); + + open_find_ = true; } @@ -147,8 +153,12 @@ vector<biblio::CiteStyle>::const_iterator cit = find(styles.begin(), styles.end(), cs.style); - - dialog_->citationStyleCO->setCurrentItem(0); + + // restore the latest natbib style + if (style_ >= 0) + dialog_->citationStyleCO->setCurrentItem(style_); + else + dialog_->citationStyleCO->setCurrentItem(0); dialog_->fulllistCB->setChecked(false); dialog_->forceuppercaseCB->setChecked(false); @@ -179,6 +189,11 @@ fillStyles(); updateStyle(); + + // open the find dialog if nothing has been selected (yet) + // the bool prevents that this is also done after "apply" + if (open_find_) + dialog_->openFind(); } Index: src/frontends/qt2/QCitation.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/QCitation.h,v retrieving revision 1.16 diff -u -r1.16 QCitation.h --- src/frontends/qt2/QCitation.h 6 Oct 2003 15:42:50 -0000 1.16 +++ src/frontends/qt2/QCitation.h 18 Feb 2004 10:27:38 -0000 @@ -47,11 +47,15 @@ void updateStyle(); void updateBrowser(QListBox *, std::vector<std::string> const &) const; + /// check if apply has been pressed + bool open_find_; /// selected keys std::vector<std::string> citekeys; /// available bib keys std::vector<std::string> bibkeys; + /// selected natbib style + int style_; }; #endif // QCITATION_H Index: src/frontends/qt2/QCitationDialog.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/QCitationDialog.C,v retrieving revision 1.27 diff -u -r1.27 QCitationDialog.C --- src/frontends/qt2/QCitationDialog.C 11 Dec 2003 14:42:39 -0000 1.27 +++ src/frontends/qt2/QCitationDialog.C 18 Feb 2004 10:27:38 -0000 @@ -4,6 +4,8 @@ * Licence details can be found in the file COPYING. * * \author Kalle Dalheimer + * \author John Levon + * \author Jürgen Spitzmüller * * Full author contact details are available in file CREDITS. */ @@ -12,6 +14,7 @@ #include "qt_helpers.h" #include "controllers/ControlCitation.h" +#include "ButtonController.h" #include <qcheckbox.h> #include <qlineedit.h> @@ -68,6 +71,21 @@ deletePB->setEnabled(sel_nr >= 0); upPB->setEnabled(sel_nr > 0); downPB->setEnabled(sel_nr >= 0 && sel_nr < int(selectedLB->count() - 1)); +} + + +void QCitationDialog::openFind() +{ + if (form_->readOnly()) + return; + + if (selectedLB->count() == 0 && add_->availableLB->count() != 0){ + // open the find dialog + add(); + // and let the user press ok after a selection + if (selectedLB->count() != 0) + form_->bc().valid(); + } } Index: src/frontends/qt2/QCitationDialog.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/QCitationDialog.h,v retrieving revision 1.10 diff -u -r1.10 QCitationDialog.h --- src/frontends/qt2/QCitationDialog.h 23 Aug 2003 00:16:38 -0000 1.10 +++ src/frontends/qt2/QCitationDialog.h 18 Feb 2004 10:27:38 -0000 @@ -28,6 +28,8 @@ ~QCitationDialog(); void setButtons(); + /// open the find dialog if nothing selected + void openFind(); QCitationFindDialogBase * add_; Index: src/frontends/qt2/QRef.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/QRef.C,v retrieving revision 1.31 diff -u -r1.31 QRef.C --- src/frontends/qt2/QRef.C 6 Oct 2003 15:42:51 -0000 1.31 +++ src/frontends/qt2/QRef.C 18 Feb 2004 10:27:39 -0000 @@ -73,6 +73,7 @@ dialog_->sortCB->setChecked(sort_); + int const orig = dialog_->bufferCO->currentItem(); // insert buffer list dialog_->bufferCO->clear(); vector<string> const buffers = controller().getBufferList(); @@ -80,7 +81,10 @@ it != buffers.end(); ++it) { dialog_->bufferCO->insertItem(toqstr(*it)); } - dialog_->bufferCO->setCurrentItem(controller().getBufferNum()); + if (orig != -1 && orig < dialog_->bufferCO->count()) + dialog_->bufferCO->setCurrentItem(orig); + else + dialog_->bufferCO->setCurrentItem(controller().getBufferNum()); updateRefs(); } @@ -183,5 +187,6 @@ refs_ = controller().getLabelList(name); dialog_->sortCB->setEnabled(!refs_.empty()); dialog_->refsLB->setEnabled(!refs_.empty()); + dialog_->gotoPB->setEnabled(!refs_.empty()); redoRefs(); }