Michael Schmitt wrote:
> 
> I have updated my bug list. Please find a couple of new bug reports
> (concerning find&replace, mathed, ...).

- File browsing in the "BibTeX Database" dialog does not work well if
you need to

fixed! 
you can now insert db->infinity databases separated by ','

>  include several bibtex files (which should happen quite often); IMHO
>  "browse" should be replaced by "add" and "delete" buttons and the
> bibtex files should be listed in separate lines 

let the users speak. I for myself never worked with different databases.
I prefer a big one. 
Is it a problem to delete a database with backspace or add a new
one with browse? if you have an add_button, you do the same: insert it
by hand or browse ... so you have one more button for the same thing.

Angus, can you apply, please?


Herbert


-- 
http://www.educat.hu-berlin.de/~voss/lyx/
Index: src/frontends/xforms/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/ChangeLog,v
retrieving revision 1.133
diff -u -p -r1.133 ChangeLog
--- src/frontends/xforms/ChangeLog      2001/08/21 13:33:25     1.133
+++ src/frontends/xforms/ChangeLog      2001/08/22 13:43:09
@@ -1,3 +1,7 @@
+2001-08-22  Herbert Voss  <[EMAIL PROTECTED]>
+
+       * FormBibtex.C (input): fix for multiple databases
+
 2001-08-21  Herbert Voss  <[EMAIL PROTECTED]>
 
        * FormBibtex.C (input): extension handling for ".bst"
Index: src/frontends/xforms/FormBibtex.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/FormBibtex.C,v
retrieving revision 1.16
diff -u -p -r1.16 FormBibtex.C
--- src/frontends/xforms/FormBibtex.C   2001/08/21 14:52:50     1.16
+++ src/frontends/xforms/FormBibtex.C   2001/08/22 13:43:09
@@ -29,7 +29,6 @@ FormBibtex::FormBibtex(ControlBibtex & c
        : base_class(c, _("BibTeX Database"))
 {}
 
-
 void FormBibtex::build()
 {
        dialog_.reset(build_bibtex());
@@ -48,13 +47,12 @@ void FormBibtex::build()
        bc().addReadOnly(dialog_->radio_bibtotoc);
 }
 
-
 ButtonPolicy::SMInput FormBibtex::input(FL_OBJECT * ob, long)
 {
        if (ob == dialog_->database_browse) {
-               string const in_name  = fl_get_input(dialog_->database);
+               string const in_name  = fl_get_input(dialog_->database);// save
                string out_name = 
-                       controller().Browse(in_name,
+                       controller().Browse("",         // start empty
                                            "Select Database",
                                            "*.bib| BibTeX Databases (*.bib)");
                if (!out_name.empty()) {
@@ -63,13 +61,13 @@ ButtonPolicy::SMInput FormBibtex::input(
                                // (because latex needs it without suffix)
                                out_name = ChangeExtension(out_name,"");
                        }
-
+                       if (!in_name.empty())
+                           out_name = in_name+", "+out_name;   // add database
                        fl_freeze_form(form()); 
                        fl_set_input(dialog_->database, out_name.c_str());
                        fl_unfreeze_form(form()); 
                }
        }
-
        if (ob == dialog_->style_browse) {
                string const in_name = fl_get_input(dialog_->style);
                string out_name = 
@@ -77,31 +75,27 @@ ButtonPolicy::SMInput FormBibtex::input(
                                            "Select BibTeX-Style",
                                            "*.bst| BibTeX Styles (*.bst)");
                if (!out_name.empty()) {
-                       out_name = OnlyFilename(out_name);
-                       if (suffixIs(out_name,".bst")) {
-                               // to prevent names like xxxbst.bst
-                               // (because bibtex needs it without the suffix)
-                               out_name = ChangeExtension(out_name,"");
-                       }
-
+                       out_name = OnlyFilename(out_name); 
+                       if (suffixIs(out_name,".bst"))  // to prevent names like 
+xxxbst.bst
+                               out_name = ChangeExtension(out_name,"");// no ".bst"
                        fl_freeze_form(form()); 
                        fl_set_input(dialog_->style, out_name.c_str());
                        fl_unfreeze_form(form()); 
                }
        }
-  
-       if (!compare(fl_get_input(dialog_->database),"")) {
+       if (!compare(fl_get_input(dialog_->database),"")) {
                return ButtonPolicy::SMI_NOOP;
        }
-
        return ButtonPolicy::SMI_VALID;
 }
 
-
 void FormBibtex::update()
 {
-       fl_set_input(dialog_->database,
-                    controller().params().getContents().c_str());
+// nothing to do here, because the structure of
+// getContents() should be ok, it's always gone 
+// through apply(). So multiple databases may be
+// no problem.
+       fl_set_input(dialog_->database,controller().params().getContents().c_str());   
+ // set dbNew
         string bibtotoc = "bibtotoc";
        string bibstyle (controller().params().getOptions().c_str());
        if (prefixIs(bibstyle,bibtotoc)) { // bibtotoc exists?
@@ -111,19 +105,25 @@ void FormBibtex::update()
                } else {
                        bibstyle = "";
                }
-
                fl_set_input(dialog_->style,bibstyle.c_str());
-
        } else {
                fl_set_button(dialog_->radio_bibtotoc,0);
                fl_set_input(dialog_->style,bibstyle.c_str());
        }
 }
 
-
 void FormBibtex::apply()
 {
-       controller().params().setContents(fl_get_input(dialog_->database));
+       string db, dbNew, dbAll = 
+           fl_get_input(dialog_->database);            //maybe more than one
+       dbAll = split (dbAll,db,',');                   // at least one db
+       dbNew = ChangeExtension(db,"");                 // without suffix
+       while(!dbAll.empty()) {                         // more db's?
+           dbAll = split (dbAll,db,',');
+           db = ChangeExtension(db,"");            
+           dbNew = dbNew + (", "+frontStrip(db,' '));  // no leading spaces
+       }
+       controller().params().setContents(dbNew);
        string const bibstyle = fl_get_input(dialog_->style); // may be empty!
 
        if ((fl_get_button(dialog_->radio_bibtotoc) > 0) &&

Reply via email to