From: Angus Leeming Date: Thu, 23 Aug 2001 09:04:42 +0000 (+0000) Subject: The BibTeX dialog asymptotes towards perfection! X-Git-Tag: 1.6.10~20772 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=9f672b28c4e414e4fa7aebb182ff4fc55851a2f5;p=features.git The BibTeX dialog asymptotes towards perfection! git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2573 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index 55018badf7..ac27371b98 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -2933,9 +2933,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) // The argument can be up to two tokens separated // by a space. The first one is the bibstyle. string const db = token(argument, ' ', 0); - string bibstyle = token(argument, ' ', 1); - if (bibstyle.empty()) - bibstyle = "plain"; + string const bibstyle = token(argument, ' ', 1); InsetCommandParams p( "BibTeX", db, bibstyle ); InsetBibtex * inset = new InsetBibtex(p); diff --git a/src/ChangeLog b/src/ChangeLog index 649198c97c..71422fe97f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2001-08-23 Herbert Voss + + * BufferView_pimpl.C: small fix for LFUN_INSERT_BIBTEX + 2001-08-20 Dekel Tsur * Spacing.h (Spacing): Set space to Default on in the default diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index 45b016dc96..571d20cf32 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,7 @@ +2001-08-23 Herbert Voss + + * FormBibtex.C (input): normalize database list + 2001-08-21 Angus Leeming * FormBibtex.C: make sure that any database is stored only once. diff --git a/src/frontends/xforms/FormBibtex.C b/src/frontends/xforms/FormBibtex.C index d8d800d36d..591a33068b 100644 --- a/src/frontends/xforms/FormBibtex.C +++ b/src/frontends/xforms/FormBibtex.C @@ -55,12 +55,8 @@ ButtonPolicy::SMInput FormBibtex::input(FL_OBJECT * ob, long) if (ob == dialog_->database_browse) { // When browsing, take the first file only string const in_name = fl_get_input(dialog_->database); - string first; - split(in_name, first, ','); - first = strip(first); - string out_name = - controller().Browse(first, + controller().Browse("", "Select Database", "*.bib| BibTeX Databases (*.bib)"); if (!out_name.empty()) { @@ -136,7 +132,7 @@ string const unique_and_no_extensions(string const & str_in) *it = ChangeExtension(*it, ""); } eliminate_duplicates(dbase); - return getStringFromVector(dbase); + return subst(getStringFromVector(dbase),",",", "); } } // namespace anon @@ -144,7 +140,14 @@ string const unique_and_no_extensions(string const & str_in) void FormBibtex::apply() { - string db = fl_get_input(dialog_->database); + string const db = fl_get_input(dialog_->database); + if (db.empty()) { + // no database -> no bibtex-command and no options! + controller().params().setContents(""); + controller().params().setOptions(""); + return; + } + controller().params().setContents(unique_and_no_extensions(db)); // empty is valid! @@ -154,17 +157,18 @@ void FormBibtex::apply() bibstyle = ChangeExtension(OnlyFilename(bibstyle), ""); } - if ((fl_get_button(dialog_->radio_bibtotoc) > 0) && - (!bibstyle.empty())) { + bool const bibtotoc = fl_get_button(dialog_->radio_bibtotoc); + + if (bibtotoc && (!bibstyle.empty())) { // both bibtotoc and style controller().params().setOptions("bibtotoc,"+bibstyle); - } else { - if (fl_get_button(dialog_->radio_bibtotoc) > 0) { - // bibtotoc and no style - controller().params().setOptions("bibtotoc"); - } else { - // only style - controller().params().setOptions(bibstyle); - } + + } else if (bibtotoc) { + // bibtotoc and no style + controller().params().setOptions("bibtotoc"); + + } else if (!bibstyle.empty()){ + // only style + controller().params().setOptions(bibstyle); } }