more bib stuff from Juergen

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6158 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2003-02-14 17:23:50 +00:00
parent 79c6a1b810
commit d993c534e9
9 changed files with 101 additions and 42 deletions

View File

@ -1,3 +1,8 @@
2003-02-14 Juergen Spitzmueller <j.spitzmueller@gmx.de>
* scripts/TeXFiles.sh: Add search for *.bib-files (>bibFiles.lst)
changed version to 0.3.
2003-02-11 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
* templates/elsart.lyx:

View File

@ -4,27 +4,31 @@
# TeX class files -> option cls
# TeX style files -> option sty
# bibtex style files -> option bst
# bibtex database files -> option bib
#
# with the help
# of kpsewhich and creates a
# bstFiles.lst, clsFiles.lst, styFiles.lst
# bstFiles.lst, clsFiles.lst, styFiles.lst, bibFiles.lst
# without any parameter all files are created.
#
# Herbert Voss <voss@perce.org>
#
# Updates from Jean-Marc Lasgouttes.
#
# bib support added by Juergen Spitzmueller (v0.3)
#
CLS_STYLEFILE=clsFiles.lst
STY_STYLEFILE=styFiles.lst
BST_STYLEFILE=bstFiles.lst
version='$Id: TeXFiles.sh,v 0.2 2001-10-15'
BIB_FILES=bibFiles.lst
version='$Id: TeXFiles.sh,v 0.3 2003-02-14'
progname=`echo $0 | sed 's%.*/%%'`
usage="Usage: TeXFiles.sh [-version | cls | sty | bst]
usage="Usage: TeXFiles.sh [-version | cls | sty | bst | bib ]
Default is without any Parameters,
so that all files will be created"
types=$1
test -z "$types" && types="cls sty bst"
test -z "$types" && types="cls sty bst bib"
#
# MS-DOS and MS-Windows define $COMSPEC or $ComSpec and use ';' to separate
@ -59,6 +63,8 @@ for type in $types ; do
kpsetype=.tex;;
bst) outfile=$BST_STYLEFILE
kpsetype=.bst;;
bib) outfile=$BIB_FILES
kpsetype=.bib;;
*) echo "ERROR: unknown type $type"
exit 1;;
esac

View File

@ -1,4 +1,7 @@
2003-02-09 Juergen Spitzmueller <j.spitzmueller@gmx.de>
2003-02-14 Juergen Spitzmueller <j.spitzmueller@gmx.de>
* ControlBibtex.[Ch]: new function getBibFiles() (provides list
of available *.bib-files from bibFiles.lst).
* tex_helpers.C (getTexFileList): sort and dis-duplicate
listWithoutPath correctly.

View File

@ -76,6 +76,18 @@ string const ControlBibtex::getBibStyles() const
}
string const ControlBibtex::getBibFiles() const
{
string list = getTexFileList("bibFiles.lst", false);
// test, if we have a valid list, otherwise run rescan
if (list.empty()) {
rescanBibStyles();
list = getTexFileList("bibFiles.lst", false);
}
return list;
}
void ControlBibtex::rescanBibStyles() const
{
rescanTexStyles();

View File

@ -26,7 +26,9 @@ public:
string const Browse(string const &, string const &, string const &);
/// get the list of bst files
string const getBibStyles() const;
/// build filelists of all availabe bst/cls/sty-files. done through
/// get the list of bib files
string const getBibFiles() const;
/// build filelists of all availabe bib/bst/cls/sty-files. done through
/// kpsewhich and an external script, saved in *Files.lst
void rescanBibStyles() const;
private:

View File

@ -9,6 +9,9 @@
* QBibtexDialog.C: Fix browsing mechanism of *.sty files (bug 773).
* ui/QBibtexDialogBase.ui: Remove unused Update button (bug 773).
Replace addBib LineEdit with ComboBox.
* QBibtex.C: Insert available .bib-files into addBibCB.
2003-02-13 John Levon <levon@movementarian.org>

View File

@ -72,6 +72,18 @@ void QBibtex::update_contents()
dialog_->databaseLB->insertItem(toqstr(bib));
}
dialog_->addBibCB->clear();
vector<string> const bib_str = getVectorFromString(
controller().getBibFiles(), "\n");
for (vector<string>::const_iterator it = bib_str.begin();
it != bib_str.end(); ++it) {
string bibItem(ChangeExtension(*it, ""));
dialog_->addBibCB->insertItem(toqstr(bibItem));
}
dialog_->addBibCB->clearEdit();
string bibtotoc = "bibtotoc";
string bibstyle(controller().params().getOptions());

View File

@ -60,7 +60,7 @@ void QBibtexDialog::browsePressed()
if (!file.isNull()) {
string const filen = ChangeExtension(fromqstr(file), "");
bool present = false;
int pres = 0;
unsigned int pres = 0;
for (unsigned int i = 0; i != styleCB->count(); i++) {
if (fromqstr(styleCB->text(i)) == filen) {
@ -100,7 +100,7 @@ void QBibtexDialog::browseBibPressed()
void QBibtexDialog::addPressed()
{
QString const file = addBibED->text();
QString const file = addBibCB->currentText();
if (!file.isNull()) {
string const f = ChangeExtension(file.latin1(), "");
bool present = false;

View File

@ -13,7 +13,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>281</width>
<width>265</width>
<height>315</height>
</rect>
</property>
@ -72,7 +72,7 @@
</property>
<property>
<name>toolTip</name>
<string>Available BibTeX databases</string>
<string>Selected BibTeX databases</string>
</property>
</widget>
<widget row="1" column="1" >
@ -90,17 +90,6 @@
<string>Add a BibTeX database file</string>
</property>
</widget>
<widget row="1" column="0" >
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>addBibED</cstring>
</property>
<property>
<name>toolTip</name>
<string>Add a BibTeX file manually</string>
</property>
</widget>
<widget row="2" column="1" >
<class>QPushButton</class>
<property stdset="1">
@ -156,25 +145,6 @@
</size>
</property>
</spacer>
<widget row="6" column="0" >
<class>QComboBox</class>
<property stdset="1">
<name>name</name>
<cstring>styleCB</cstring>
</property>
<property stdset="1">
<name>editable</name>
<bool>true</bool>
</property>
<property stdset="1">
<name>autoCompletion</name>
<bool>true</bool>
</property>
<property stdset="1">
<name>duplicatesEnabled</name>
<bool>false</bool>
</property>
</widget>
<widget row="5" column="0" >
<class>QLabel</class>
<property stdset="1">
@ -213,7 +183,7 @@
<string>Choose a style file</string>
</property>
</widget>
<widget row="9" column="0" rowspan="1" colspan="2" >
<widget row="8" column="0" rowspan="1" colspan="2" >
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
@ -277,7 +247,7 @@
</widget>
</hbox>
</widget>
<widget row="8" column="0" >
<widget row="7" column="0" >
<class>QCheckBox</class>
<property stdset="1">
<name>name</name>
@ -292,6 +262,52 @@
<string>Add bibliography to the table of contents</string>
</property>
</widget>
<widget row="6" column="0" >
<class>QComboBox</class>
<property stdset="1">
<name>name</name>
<cstring>styleCB</cstring>
</property>
<property stdset="1">
<name>editable</name>
<bool>true</bool>
</property>
<property stdset="1">
<name>autoCompletion</name>
<bool>true</bool>
</property>
<property stdset="1">
<name>duplicatesEnabled</name>
<bool>false</bool>
</property>
<property>
<name>toolTip</name>
<string>Chose a style file</string>
</property>
</widget>
<widget row="1" column="0" >
<class>QComboBox</class>
<property stdset="1">
<name>name</name>
<cstring>addBibCB</cstring>
</property>
<property stdset="1">
<name>editable</name>
<bool>true</bool>
</property>
<property stdset="1">
<name>autoCompletion</name>
<bool>true</bool>
</property>
<property stdset="1">
<name>duplicatesEnabled</name>
<bool>false</bool>
</property>
<property>
<name>toolTip</name>
<string>Select a database</string>
</property>
</widget>
</grid>
</widget>
<connections>