]> 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 8e968d38d11b9a3cb714f6ad60b2d13622b0398e..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)
-       : base_class(c, _("BibTeX Database"))
+FormBibtex::FormBibtex()
+       : base_class(_("BibTeX Database"))
 {}
 
 
@@ -75,13 +77,13 @@ void FormBibtex::build()
 
        str = _("Activate this option if you want the bibliography to appear in the Table of Contents (which doesn't happen by default)");
        tooltips().init(dialog_->check_bibtotoc, str);
-       
+
        str = _("Choose a BibTeX style from the browsers list");
        tooltips().init(dialog_->button_style_choose, str);
-       
+
        str = _("Updates your TeX system for a new bibstyle list. Only the styles which are in directories where TeX finds them are listed!");
        tooltips().init(dialog_->button_rescan, str);
-       
+
 }
 
 
@@ -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);
-               fl_set_input(dialog_->input_style, 
-                       ChangeExtension(out_name, string()).c_str());
-       } else if (ob == dialog_->button_rescan)
+               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) {
+               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());