]> git.lyx.org Git - features.git/commitdiff
The BibTeX dialog asymptotes towards perfection!
authorAngus Leeming <leeming@lyx.org>
Thu, 23 Aug 2001 09:04:42 +0000 (09:04 +0000)
committerAngus Leeming <leeming@lyx.org>
Thu, 23 Aug 2001 09:04:42 +0000 (09:04 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2573 a592a061-630c-0410-9148-cb99ea01b6c8

src/BufferView_pimpl.C
src/ChangeLog
src/frontends/xforms/ChangeLog
src/frontends/xforms/FormBibtex.C

index 55018badf723cced18f4a37f9671f6358dbe267c..ac27371b98df6b37e21c98c5a18d38fc1f7b474a 100644 (file)
@@ -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);
index 649198c97cdc5c534a2a0c7e6927788b51918e95..71422fe97f94730da5bb9007302880323460f1ca 100644 (file)
@@ -1,3 +1,7 @@
+2001-08-23  Herbert Voss  <voss@perce>
+
+       * BufferView_pimpl.C: small fix for LFUN_INSERT_BIBTEX
+
 2001-08-20  Dekel Tsur  <dekelts@tau.ac.il>
 
        * Spacing.h (Spacing): Set space to Default on in the default
index 45b016dc96b6db0507224e524e197a23e831b230..571d20cf32894296e4931398a7dc5e41699a2d80 100644 (file)
@@ -1,3 +1,7 @@
+2001-08-23  Herbert Voss  <voss@perce.de>
+
+       * FormBibtex.C (input): normalize database list
+
 2001-08-21  Angus Leeming  <a.leeming@ic.ac.uk>
 
        * FormBibtex.C: make sure that any database is stored only once.
index d8d800d36d306e50bc74c798467a01f6294d4d6a..591a33068b89bca91a40eb80eaeb8dc4c678b60d 100644 (file)
@@ -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);
        }
 }