The BibTeX dialog asymptotes towards perfection!

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2573 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2001-08-23 09:04:42 +00:00
parent ebc9d76206
commit 9f672b28c4
4 changed files with 30 additions and 20 deletions

View 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);

View 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

View 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.

View 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);
}
}