]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/FormBibtex.C
Yet more dialog tweaking from Rob.
[lyx.git] / src / frontends / xforms / FormBibtex.C
index 4e2bb28ac105a32a1afbbe8d7a69df552c830926..cf42a0742b9cb23f85f3e25a94bcf6741b04a45c 100644 (file)
@@ -1,11 +1,13 @@
 /**
  * \file FormBibtex.C
- * Copyright 2001 the LyX Team
- * Read the file COPYING
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
- * \author Angus Leeming, a.leeming@ic.ac.uk
- * \author John Levon, moz@compsoc.man.ac.uk
- * \author Herbert Voss, voss@lyx.org
+ * \author Angus Leeming 
+ * \author John Levon
+ * \author Herbert Voss
+ *
+ * Full author contact details are available in file CREDITS
  */
 
 #ifdef __GNUG__
@@ -36,8 +38,8 @@ using std::sort;
 
 typedef FormCB<ControlBibtex, FormDB<FD_bibtex> > base_class;
 
-FormBibtex::FormBibtex(ControlBibtex & c, Dialogs & d)
-       : base_class(c, d, _("BibTeX Database"))
+FormBibtex::FormBibtex()
+       : base_class(_("BibTeX Database"))
 {}
 
 
@@ -116,12 +118,20 @@ ButtonPolicy::SMInput FormBibtex::input(FL_OBJECT * ob, long)
                }
        } else if (ob == dialog_->button_style_choose) {
                unsigned int selection = fl_get_browser(dialog_->browser_styles);
-               string const out_name =
-                       fl_get_browser_line(dialog_->browser_styles, selection);
+               if (!selection)
+                       return ButtonPolicy::SMI_NOOP;
+               
+               string const out_name = fl_get_browser_line(dialog_->browser_styles,
+                                                               selection);
                fl_set_input(dialog_->input_style,
-                       ChangeExtension(out_name, string()).c_str());
-       } else if (ob == dialog_->button_rescan)
+                               ChangeExtension(out_name, string()).c_str());
+       } else if (ob == dialog_->button_rescan) {
+               fl_clear_browser(dialog_->browser_styles);
                controller().rescanBibStyles();
+               string const str =
+                       controller().getBibStyles();
+               fl_add_browser_line(dialog_->browser_styles, str.c_str());
+       }
 
        // with an empty database nothing makes sense ...
        if (!compare(fl_get_input(dialog_->input_database), "")) {
@@ -152,6 +162,7 @@ void FormBibtex::update()
                fl_set_button(dialog_->check_bibtotoc,0);
                fl_set_input(dialog_->input_style, bibstyle.c_str());
        }
+       fl_clear_browser(dialog_->browser_styles);
        string const str =
                controller().getBibStyles();
        fl_add_browser_line(dialog_->browser_styles, str.c_str());