add bibtopic support (bug 870).

That's it for now.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8560 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2004-03-29 13:17:25 +00:00
parent aecf612d10
commit 7aadb167bf
30 changed files with 534 additions and 109 deletions

View File

@ -1,6 +1,27 @@
LyX file-format changes
-----------------------
2004-03-29 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* format incremented to 232.
* Support for bibtopic (sectioned bibliographies).
- bufferparam \use_bibtopic [1|0]
- the bibtex inset has a second argument for bibtopic's
btPrint{Cited|NotCited|All} command:
< 231:
\begin_inset LatexCommand \bibtex[<style>]{<database>}
now:
\begin_inset LatexCommand \bibtex[<style>][<btPrintX>]{<database>}
Forwards, there's nothing to be done. Backwards, \usepackage[dot]{bibtopic}
has to be inserted to the preamble. Instead of the bibtex inset, the LaTeX
\bibliographystyle{<style>}
\begin{btSect}{<database>}
\<btprintX>
\end{btSect}
has to be inserted.
2004-03-29 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* format incremented to 231.

View File

@ -1,3 +1,7 @@
2004-03-29 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* dco/LaTeXConfig.lyx.in: check for bibtopic.
2004-03-22 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* lyxrc.example: remove \ps_command

View File

@ -1,5 +1,5 @@
#LyX 1.4.0cvs created this file. For more info see http://www.lyx.org/
\lyxformat 230
\lyxformat 232
\textclass article
\language english
\inputencoding default
@ -14,6 +14,7 @@
\use_natbib 0
\use_numerical_citations 0
\use_jurabib 0
\use_bibtopic 0
\paperorientation portrait
\secnumdepth 2
\tocdepth 3
@ -2414,6 +2415,32 @@ index of algorithms
\begin_layout Subsection
bibtopic
\end_layout
\begin_layout Description
Found: @chk_bibtopic@
\end_layout
\begin_layout Description
CTAN:
\family typewriter
macros/latex/contrib/bibtopic/
\end_layout
\begin_layout Description
Notes: The package
\family sans
bibtopic
\family default
is used to split BibTeX created bibliographies into sections.
\end_layout
\begin_layout Subsection
fancyhdr
\end_layout
@ -2513,15 +2540,13 @@ jura
bib
\family default
\color None
\color none
(
\begin_inset LatexCommand \url{http://www.jurabib.org}
\end_inset
)
\color default
can be used as an alternative to
) can be used as an alternative to
\family sans
natbib
\family default

View File

@ -1,5 +1,7 @@
2004-03-29 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* lyx2lyx: up the format to 232.
* lyx2lyx: up the format to 231.
2004-03-26 Georg Baum <Georg.Baum@post.rwth-aachen.de>

View File

@ -41,7 +41,7 @@ opt.quiet = 0
format = re.compile(r"(\d)[\.,]?(\d\d)")
fileformat = re.compile(r"\\lyxformat\s*(\S*)")
lst_ft = [210, 215, 216, 217, 218, 220, 221, 223, 224, 225, 226, 227, 228, 229,
230, 231]
230, 231, 232]
def usage():
print """Usage: lyx2lyx [options] [file]

View File

@ -0,0 +1,29 @@
# This file is part of lyx2lyx
# -*- coding: iso-8859-1 -*-
# Copyright (C) 2003 José Matos <jamatos@fep.up.pt>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
import sys
from parser_tools import find_token
def convert(header, body):
pass
if __name__ == "__main__":
pass

View File

@ -0,0 +1,29 @@
# This file is part of lyx2lyx
# -*- coding: iso-8859-1 -*-
# Copyright (C) 2003 José Matos <jamatos@fep.up.pt>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
import sys
from parser_tools import find_token
def convert(header, body):
pass
if __name__ == "__main__":
pass

View File

@ -1,5 +1,9 @@
2004-03-29 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* buffer.C: increment file format to 232.
* LaTeXFeatures.C: add bibtopic package.
* bufferparams.[Ch]: param \use_bibtopic.
* lyxrc.[Ch]: add lyxrc bibtex_command
* LaTeX.C: use rc.bibtex_command instead of hardcoded string.

View File

@ -306,6 +306,12 @@ string const LaTeXFeatures::getPackages() const
}
packages << "]{natbib}\n";
}
// bibtopic -- the dot provides the aux file naming which
// LyX can detect.
if (isRequired("bibtopic")) {
packages << "\\usepackage[dot]{bibtopic}\n";
}
return packages.str();
}

View File

@ -130,7 +130,7 @@ extern BufferList bufferlist;
namespace {
const int LYX_FORMAT = 231;
const int LYX_FORMAT = 232;
} // namespace anon

View File

@ -116,6 +116,7 @@ BufferParams::BufferParams()
use_natbib = false;
use_numerical_citations = false;
use_jurabib = false;
use_bibtopic = false;
tracking_changes = false;
secnumdepth = 3;
tocdepth = 3;
@ -325,6 +326,9 @@ string const BufferParams::readToken(LyXLex & lex, string const & token)
} else if (token == "\\use_jurabib") {
lex.nextToken();
use_jurabib = lex.getInteger();
} else if (token == "\\use_bibtopic") {
lex.nextToken();
use_bibtopic = lex.getInteger();
} else if (token == "\\tracking_changes") {
lex.nextToken();
tracking_changes = lex.getInteger();
@ -543,6 +547,7 @@ void BufferParams::writeFile(ostream & os) const
<< "\n\\use_natbib " << use_natbib
<< "\n\\use_numerical_citations " << use_numerical_citations
<< "\n\\use_jurabib " << use_jurabib
<< "\n\\use_bibtopic " << use_bibtopic
<< "\n\\paperorientation " << string_orientation[orientation]
<< '\n';

View File

@ -184,6 +184,8 @@ public:
bool use_numerical_citations;
///
bool use_jurabib;
///
bool use_bibtopic;
/// revision tracking for this buffer ?
bool tracking_changes;
/// Time ago we agreed that this was a buffer property [ale990407]

View File

@ -1,3 +1,7 @@
2004-03-29 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* ControlBibtex.[Ch]: add member usingBibtopic().
2004-03-28 Alfredo Braunstein <abraunst@lyx.org>
* ControlDocument.C:

View File

@ -14,6 +14,9 @@
#include "ControlBibtex.h"
#include "buffer.h"
#include "bufferparams.h"
#include "lyxrc.h"
#include "helper_funcs.h"
#include "tex_helpers.h"
@ -86,3 +89,9 @@ void ControlBibtex::rescanBibStyles() const
{
rescanTexStyles();
}
bool ControlBibtex::usingBibtopic() const
{
return kernel().buffer().params().use_bibtopic;
}

View File

@ -45,6 +45,8 @@ public:
/// build filelists of all availabe bib/bst/cls/sty-files. done through
/// kpsewhich and an external script, saved in *Files.lst
void rescanBibStyles() const;
/// do we use bibtopic (for sectioned bibliography)?
bool usingBibtopic() const;
};

View File

@ -1,5 +1,10 @@
2004-03-29 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* QBibtex.C:
* QDocument.C:
* QDocumentDialog.C:
* ui/BiblioModuleBase.ui: bibtopic support.
* QPrefs.C:
* QPrefsDialog.C:
* ui/QPrefsLaTeXModule.ui: customize bibtex call.

View File

@ -5,6 +5,7 @@
*
* \author John Levon
* \author Herbert Voß
* \author Jürgen Spitzmüller
*
* Full author contact details are available in file CREDITS.
*/
@ -64,6 +65,8 @@ void QBibtex::build_dialog()
void QBibtex::update_contents()
{
bool bibtopic = controller().usingBibtopic();
dialog_->databaseLB->clear();
string bibs(controller().params().getContents());
@ -90,18 +93,31 @@ void QBibtex::update_contents()
string bibstyle(controller().params().getOptions());
// bibtotoc exists?
if (prefixIs(bibstyle, bibtotoc)) {
dialog_->bibtocCB->setChecked(true);
if (prefixIs(bibstyle, bibtotoc)){
// bibstyle exists?
if (contains(bibstyle,','))
bibstyle = split(bibstyle, bibtotoc, ',');
else
bibstyle.erase();
} else
}
if (prefixIs(bibstyle, bibtotoc) && !bibtopic)
dialog_->bibtocCB->setChecked(true);
else
dialog_->bibtocCB->setChecked(false);
dialog_->bibtocCB->setEnabled(!bibtopic);
string btprint(controller().params().getSecOptions());
int btp = 0;
if (btprint == "btPrintNotCited")
btp = 1;
else if (btprint == "btPrintAll")
btp = 2;
dialog_->btPrintCO->setCurrentItem(btp);
dialog_->btPrintCO->setEnabled(bibtopic);
dialog_->styleCB->clear();
int item_nr(-1);
@ -152,6 +168,27 @@ void QBibtex::apply()
// command!
controller().params().setOptions(bibstyle);
}
// bibtopic allows three kinds of sections:
// 1. sections that include all cited references of the database(s)
// 2. sections that include all uncited references of the database(s)
// 3. sections that include all references of the database(s), cited or not
int btp = dialog_->btPrintCO->currentItem();
switch (btp) {
case 0:
controller().params().setSecOptions("btPrintCited");
break;
case 1:
controller().params().setSecOptions("btPrintNotCited");
break;
case 2:
controller().params().setSecOptions("btPrintAll");
break;
}
if (!controller().usingBibtopic())
controller().params().setSecOptions("");
}

View File

@ -194,6 +194,8 @@ void QDocument::apply()
dialog_->biblioModule->citeStyleCO->currentItem();
params.use_jurabib =
dialog_->biblioModule->citeJurabibRB->isChecked();
params.use_bibtopic =
dialog_->biblioModule->bibtopicCB->isChecked();
// language & quotes
if (dialog_->langModule->defaultencodingCB->isChecked()) {
@ -440,7 +442,7 @@ void QDocument::update_contents()
dialog_->preambleModule->preambleMLE->setText(preamble);
// biblio
dialog_->biblioModule->citeNatbibRB->setChecked(
dialog_->biblioModule->citeDefaultRB->setChecked(
!params.use_natbib && !params.use_jurabib);
dialog_->biblioModule->citeNatbibRB->setChecked(
params.use_natbib);
@ -448,6 +450,8 @@ void QDocument::update_contents()
params.use_numerical_citations ? 1 : 0);
dialog_->biblioModule->citeJurabibRB->setChecked(
params.use_jurabib);
dialog_->biblioModule->bibtopicCB->setChecked(
params.use_bibtopic);
// language & quotes
int const pos = int(findPos(lang_,

View File

@ -89,6 +89,7 @@ QDocumentDialog::QDocumentDialog(QDocument * form)
connect(biblioModule->citeNatbibRB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
connect(biblioModule->citeStyleCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
connect(biblioModule->citeJurabibRB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
connect(biblioModule->bibtopicCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
// language & quote
connect(langModule->languageCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
connect(langModule->defaultencodingCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));

View File

@ -13,7 +13,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>426</width>
<width>418</width>
<height>376</height>
</rect>
</property>
@ -150,7 +150,7 @@
</widget>
</grid>
</widget>
<spacer row="1" column="0" >
<spacer row="2" column="0" >
<property>
<name>name</name>
<cstring>Spacer2</cstring>
@ -171,6 +171,21 @@
</size>
</property>
</spacer>
<widget row="1" column="0" >
<class>QCheckBox</class>
<property stdset="1">
<name>name</name>
<cstring>bibtopicCB</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>S&amp;ectioned bibliography</string>
</property>
<property>
<name>toolTip</name>
<string>Select this if you want to split your bibliography into sections</string>
</property>
</widget>
</grid>
</widget>
<connections>

View File

@ -13,8 +13,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>306</width>
<height>279</height>
<width>298</width>
<height>313</height>
</rect>
</property>
<property stdset="1">
@ -34,7 +34,7 @@
<name>spacing</name>
<number>6</number>
</property>
<widget row="4" column="0" >
<widget row="4" column="0" rowspan="1" colspan="2" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
@ -60,7 +60,7 @@
<string>The BibTeX style</string>
</property>
</widget>
<widget row="7" column="0" rowspan="1" colspan="2" >
<widget row="8" column="0" rowspan="1" colspan="3" >
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
@ -132,7 +132,7 @@
</widget>
</hbox>
</widget>
<widget row="0" column="0" rowspan="1" colspan="2" >
<widget row="0" column="0" rowspan="1" colspan="3" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
@ -165,7 +165,7 @@
<name>vAlign</name>
</property>
</widget>
<widget row="1" column="0" rowspan="3" colspan="1" >
<widget row="1" column="0" rowspan="3" colspan="2" >
<class>QListBox</class>
<property stdset="1">
<name>name</name>
@ -180,7 +180,7 @@
<string>Selected BibTeX databases</string>
</property>
</widget>
<widget row="1" column="1" >
<widget row="1" column="2" >
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
@ -195,7 +195,7 @@
<string>Add a BibTeX database file</string>
</property>
</widget>
<widget row="2" column="1" >
<widget row="2" column="2" >
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
@ -210,7 +210,7 @@
<string>Remove the selected database</string>
</property>
</widget>
<spacer row="3" column="1" >
<spacer row="3" column="2" rowspan="2" colspan="1" >
<property>
<name>name</name>
<cstring>Spacer5</cstring>
@ -231,7 +231,7 @@
</size>
</property>
</spacer>
<widget row="5" column="0" >
<widget row="5" column="0" rowspan="1" colspan="2" >
<class>QComboBox</class>
<property stdset="1">
<name>name</name>
@ -254,7 +254,7 @@
<string>Chose a style file</string>
</property>
</widget>
<widget row="5" column="1" >
<widget row="5" column="2" >
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
@ -273,22 +273,7 @@
<string>Choose a style file</string>
</property>
</widget>
<widget row="6" column="0" >
<class>QCheckBox</class>
<property stdset="1">
<name>name</name>
<cstring>bibtocCB</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Add bibliography to &amp;TOC</string>
</property>
<property>
<name>toolTip</name>
<string>Add bibliography to the table of contents</string>
</property>
</widget>
<spacer row="6" column="1" >
<spacer row="6" column="2" rowspan="2" colspan="1" >
<property>
<name>name</name>
<cstring>Spacer6</cstring>
@ -309,6 +294,76 @@
</size>
</property>
</spacer>
<widget row="6" column="1" >
<class>QComboBox</class>
<item>
<property>
<name>text</name>
<string>all cited references</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>all uncited references</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>all references</string>
</property>
</item>
<property stdset="1">
<name>name</name>
<cstring>btPrintCO</cstring>
</property>
<property>
<name>toolTip</name>
<string>This bibliography section contains...</string>
</property>
</widget>
<widget row="6" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>btPrintLA</cstring>
</property>
<property stdset="1">
<name>sizePolicy</name>
<sizepolicy>
<hsizetype>1</hsizetype>
<vsizetype>0</vsizetype>
</sizepolicy>
</property>
<property stdset="1">
<name>text</name>
<string>C&amp;ontent:</string>
</property>
<property>
<name>buddy</name>
<cstring>styleCB</cstring>
</property>
<property>
<name>toolTip</name>
<string>This bibliography section contains...</string>
</property>
</widget>
<widget row="7" column="0" rowspan="1" colspan="2" >
<class>QCheckBox</class>
<property stdset="1">
<name>name</name>
<cstring>bibtocCB</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Add bibliography to &amp;TOC</string>
</property>
<property>
<name>toolTip</name>
<string>Add bibliography to the table of contents</string>
</property>
</widget>
</grid>
</widget>
<connections>
@ -342,6 +397,12 @@
<receiver>QBibtexDialogBase</receiver>
<slot>change_adaptor()</slot>
</connection>
<connection>
<sender>btPrintCO</sender>
<signal>activated(int)</signal>
<receiver>QBibtexDialogBase</receiver>
<slot>change_adaptor()</slot>
</connection>
<connection>
<sender>addBibPB</sender>
<signal>clicked()</signal>
@ -361,6 +422,7 @@
<tabstop>styleCB</tabstop>
<tabstop>stylePB</tabstop>
<tabstop>bibtocCB</tabstop>
<tabstop>btPrintCO</tabstop>
<tabstop>okPB</tabstop>
<tabstop>closePB</tabstop>
</tabstops>

View File

@ -1,5 +1,10 @@
2004-03-29 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* FormBibtex.C:
* FormDocument.[Ch]:
* forms/form_bibtex.fd: bibtopic support.
* forms/form_document.fd: radio default/natbib/jurabib.
* FormPreferences.C:
* forms/form_preferences.fd: customize bibtex call.

View File

@ -66,6 +66,7 @@ void FormBibtex::build()
bcview().addReadOnly(dialog_->button_rescan);
bcview().addReadOnly(dialog_->input_style);
bcview().addReadOnly(dialog_->check_bibtotoc);
bcview().addReadOnly(dialog_->choice_btprint);
// trigger an input event for cut&paste with middle mouse button.
setPrehandler(dialog_->input_database);
@ -77,6 +78,11 @@ void FormBibtex::build()
// callback for double click in browser
fl_set_browser_dblclick_callback(dialog_->browser_styles,
C_FormDialogView_InputCB, 2);
fl_addto_choice(dialog_->choice_btprint,
_(" all cited references "
"| all uncited references "
"| all references ").c_str());
// set up the tooltips
string str = _("The database you want to cite from. Insert it "
@ -107,6 +113,9 @@ void FormBibtex::build()
"the styles which are in directories where TeX finds them "
"are listed!");
tooltips().init(dialog_->button_rescan, str);
str = _("The bibliography section contains...");
tooltips().init(dialog_->choice_btprint, str);
}
@ -177,8 +186,10 @@ void FormBibtex::update()
string bibtotoc = "bibtotoc";
string bibstyle = controller().params().getOptions();
bool const bibtopic = controller().usingBibtopic();
bool const bibtotoc_exists = prefixIs(bibstyle, bibtotoc);
fl_set_button(dialog_->check_bibtotoc, bibtotoc_exists);
fl_set_button(dialog_->check_bibtotoc, bibtotoc_exists && !bibtopic);
setEnabled(dialog_->check_bibtotoc, !bibtopic);
if (bibtotoc_exists) {
if (contains(bibstyle, ',')) { // bibstyle exists?
bibstyle = split(bibstyle, bibtotoc, ',');
@ -187,6 +198,16 @@ void FormBibtex::update()
}
}
fl_set_input(dialog_->input_style, bibstyle.c_str());
string btprint = controller().params().getSecOptions();
int btp = 1;
if (btprint == "btPrintNotCited")
btp = 2;
else if (btprint == "btPrintAll")
btp = 3;
fl_set_choice(dialog_->choice_btprint, btp);
setEnabled(dialog_->choice_btprint, bibtopic);
vector<string> styles;
controller().getBibStyles(styles);
@ -219,6 +240,7 @@ void FormBibtex::apply()
// no database -> no bibtex-command and no options!
controller().params().setContents("");
controller().params().setOptions("");
controller().params().setSecOptions("");
return;
}
@ -238,7 +260,30 @@ void FormBibtex::apply()
controller().params().setOptions(bibtotoc + ',' + bibstyle);
} else {
// At least one of addtotoc and bibstyle is empty. No harm to output both!
// At least one of addtotoc and bibstyle is empty.
// No harm to output both!
controller().params().setOptions(bibtotoc + bibstyle);
}
// bibtopic allows three kinds of sections:
// 1. sections that include all cited references of the database(s)
// 2. sec. that include all uncited references of the database(s)
// 3. sec. that include all references of the database(s), cited or not
if (controller().usingBibtopic()){
int btp = fl_get_choice(dialog_->choice_btprint);
switch (btp) {
case 1:
controller().params().setSecOptions("btPrintCited");
break;
case 2:
controller().params().setSecOptions("btPrintNotCited");
break;
case 3:
controller().params().setSecOptions("btPrintAll");
break;
}
}
else
controller().params().setSecOptions("");
}

View File

@ -70,6 +70,11 @@ bool const scalableTabfolders = false;
bool const scalableTabfolders = true;
#endif
enum {
DEFCITE,
NATBIB,
JURABIB
};
} // namespace anon
@ -298,17 +303,28 @@ void FormDocument::build()
bcview().addReadOnly(options_->counter_secnumdepth);
bcview().addReadOnly(options_->counter_tocdepth);
bcview().addReadOnly(options_->choice_ams_math);
bcview().addReadOnly(options_->check_use_natbib);
bcview().addReadOnly(options_->check_use_jurabib);
bcview().addReadOnly(options_->radio_use_defcite);
bcview().addReadOnly(options_->radio_use_jurabib);
bcview().addReadOnly(options_->radio_use_natbib);
bcview().addReadOnly(options_->check_bibtopic);
bcview().addReadOnly(options_->choice_citation_format);
bcview().addReadOnly(options_->input_float_placement);
bcview().addReadOnly(options_->choice_postscript_driver);
// add cite style radio buttons
citestyle_.init(options_->radio_use_defcite, DEFCITE);
citestyle_.init(options_->radio_use_natbib, NATBIB);
citestyle_.init(options_->radio_use_jurabib, JURABIB);
// set up the tooltips for optionss form
string str = _("Use the natbib styles for natural sciences and arts");
tooltips().init(options_->check_use_natbib, str);
string str = _("Use LaTeX's default citation style");
tooltips().init(options_->radio_use_defcite, str);
str = _("Use the natbib styles for natural sciences and arts");
tooltips().init(options_->radio_use_natbib, str);
str = _("Use the jurabib styles for law and humanities");
tooltips().init(options_->check_use_jurabib, str);
tooltips().init(options_->radio_use_jurabib, str);
str = _("Select this if you want to split your bibliography into sections");
tooltips().init(options_->check_bibtopic, str);
// trigger an input event for cut&paste with middle mouse button.
setPrehandler(options_->input_float_placement);
@ -514,17 +530,11 @@ ButtonPolicy::SMInput FormDocument::input(FL_OBJECT * ob, long)
fl_set_choice_text(class_->choice_skip_units,
default_unit.c_str());
} else if (ob == options_->check_use_natbib) {
} else if (ob == options_->radio_use_jurabib ||
ob == options_->radio_use_defcite ||
ob == options_->radio_use_natbib) {
setEnabled(options_->choice_citation_format,
fl_get_button(options_->check_use_natbib));
if (fl_get_button(options_->check_use_natbib))
fl_set_button(options_->check_use_jurabib, 0);
} else if (ob == options_->check_use_jurabib) {
if (fl_get_button(options_->check_use_jurabib))
fl_set_button(options_->check_use_natbib, 0);
setEnabled(options_->choice_citation_format,
fl_get_button(options_->check_use_natbib));
fl_get_button(options_->radio_use_natbib));
} else if (ob == branch_->browser_all_branches ||
ob == branch_->browser_selection ||
@ -1013,10 +1023,11 @@ bool FormDocument::options_apply(BufferParams & params)
params.graphicsDriver = getString(options_->choice_postscript_driver);
params.use_amsmath = static_cast<BufferParams::AMS>(
fl_get_choice(options_->choice_ams_math) - 1);
params.use_natbib = fl_get_button(options_->check_use_natbib);
params.use_natbib = fl_get_button(options_->radio_use_natbib);
params.use_numerical_citations =
fl_get_choice(options_->choice_citation_format) - 1;
params.use_jurabib = fl_get_button(options_->check_use_jurabib);
params.use_jurabib = fl_get_button(options_->radio_use_jurabib);
params.use_bibtopic = fl_get_button(options_->check_bibtopic);
int tmpchar = int(fl_get_counter_value(options_->counter_secnumdepth));
if (params.secnumdepth != tmpchar)
@ -1182,11 +1193,12 @@ void FormDocument::options_update(BufferParams const & params)
fl_set_choice_text(options_->choice_postscript_driver,
params.graphicsDriver.c_str());
fl_set_choice(options_->choice_ams_math, params.use_amsmath + 1);
fl_set_button(options_->check_use_natbib, params.use_natbib);
fl_set_button(options_->radio_use_natbib, params.use_natbib);
fl_set_choice(options_->choice_citation_format,
int(params.use_numerical_citations)+1);
setEnabled(options_->choice_citation_format, params.use_natbib);
fl_set_button(options_->check_use_jurabib, params.use_jurabib);
fl_set_button(options_->radio_use_jurabib, params.use_jurabib);
fl_set_button(options_->check_bibtopic, params.use_bibtopic);
fl_set_counter_value(options_->counter_secnumdepth, params.secnumdepth);
fl_set_counter_value(options_->counter_tocdepth, params.tocdepth);
if (!params.float_placement.empty())

View File

@ -14,6 +14,7 @@
#include "FormBase.h"
#include "BranchList.h"
#include "RadioButtonGroup.h"
#include <boost/scoped_ptr.hpp>
@ -141,6 +142,9 @@ private:
std::vector<std::string> lang_;
/// Contains all legal branches for this doc
BranchList branchlist_;
/// citation style buttons
RadioButtonGroup citestyle_;
};
#endif

View File

@ -10,13 +10,13 @@ SnapGrid: 5
=============== FORM ===============
Name: form_bibtex
Width: 395
Height: 235
Number of Objects: 12
Height: 255
Number of Objects: 13
--------------------
class: FL_BOX
type: FLAT_BOX
box: 0 0 395 235
box: 0 0 395 255
boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
@ -70,7 +70,7 @@ argument: 0
--------------------
class: FL_BUTTON
type: RETURN_BUTTON
box: 110 205 90 25
box: 110 225 90 25
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
@ -88,7 +88,7 @@ argument: 0
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 300 205 90 25
box: 300 225 90 25
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
@ -142,7 +142,7 @@ argument: 0
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
box: 5 165 180 25
box: 5 190 180 25
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_CENTER
@ -160,7 +160,7 @@ argument: 0
--------------------
class: FL_BROWSER
type: HOLD_BROWSER
box: 245 50 145 145
box: 245 50 145 165
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_TOP_LEFT
@ -196,7 +196,7 @@ argument: 0
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 205 205 90 25
box: 205 225 90 25
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
@ -214,7 +214,7 @@ argument: 0
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 5 205 90 25
box: 5 225 90 25
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
@ -229,5 +229,23 @@ name: button_restore
callback: C_FormDialogView_RestoreCB
argument: 0
--------------------
class: FL_CHOICE
type: NORMAL_CHOICE
box: 85 155 145 25
boxtype: FL_FRAME_BOX
colors: FL_COL1 FL_BLACK
alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label: Content:|#o
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: choice_btprint
callback: C_FormDialogView_InputCB
argument: 0
==============================
create_the_forms

View File

@ -1260,7 +1260,7 @@ argument: 0
Name: form_document_options
Width: 395
Height: 315
Number of Objects: 10
Number of Objects: 12
--------------------
class: FL_BOX
@ -1283,7 +1283,7 @@ argument:
--------------------
class: FL_INPUT
type: NORMAL_INPUT
box: 185 15 120 25
box: 185 10 120 25
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_LEFT
@ -1301,7 +1301,7 @@ argument: 0
--------------------
class: FL_COUNTER
type: SIMPLE_COUNTER
box: 185 55 80 25
box: 185 40 80 25
boxtype: FL_UP_BOX
colors: FL_COL1 FL_BLUE
alignment: FL_ALIGN_LEFT
@ -1323,7 +1323,7 @@ argument: 0
--------------------
class: FL_COUNTER
type: SIMPLE_COUNTER
box: 185 90 80 25
box: 185 70 80 25
boxtype: FL_UP_BOX
colors: FL_COL1 FL_BLUE
alignment: FL_ALIGN_LEFT
@ -1345,7 +1345,7 @@ argument: 0
--------------------
class: FL_CHOICE
type: NORMAL_CHOICE
box: 185 125 140 25
box: 185 100 140 25
boxtype: FL_FRAME_BOX
colors: FL_COL1 FL_BLACK
alignment: FL_ALIGN_LEFT
@ -1361,30 +1361,30 @@ callback: C_FormBaseInputCB
argument: 0
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
box: 35 205 140 25
class: FL_ROUND3DBUTTON
type: RADIO_BUTTON
box: 25 205 140 25
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: Use Natbib|#N
label: Natbib|#N
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: check_use_natbib
name: radio_use_natbib
callback: C_FormBaseInputCB
argument: 0
--------------------
class: FL_CHOICE
type: NORMAL_CHOICE
box: 185 235 140 25
box: 235 230 140 25
boxtype: FL_FRAME_BOX
colors: FL_COL1 FL_BLACK
alignment: FL_ALIGN_LEFT
alignment: FL_ALIGN_TOP_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
@ -1399,7 +1399,7 @@ argument: 0
--------------------
class: FL_CHOICE
type: NORMAL_CHOICE
box: 185 155 140 25
box: 185 130 140 25
boxtype: FL_FRAME_BOX
colors: FL_COL1 FL_BLACK
alignment: FL_ALIGN_LEFT
@ -1417,7 +1417,7 @@ argument: 0
--------------------
class: FL_LABELFRAME
type: ENGRAVED_FRAME
box: 15 190 370 110
box: 15 170 370 95
boxtype: FL_NO_BOX
colors: FL_BLACK FL_COL1
alignment: FL_ALIGN_TOP_LEFT
@ -1433,20 +1433,56 @@ callback:
argument:
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
box: 35 265 140 25
class: FL_ROUND3DBUTTON
type: RADIO_BUTTON
box: 25 230 140 25
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: Use Jurabib|#J
label: Jurabib|#J
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: check_use_jurabib
name: radio_use_jurabib
callback: C_FormBaseInputCB
argument: 0
--------------------
class: FL_ROUND3DBUTTON
type: RADIO_BUTTON
box: 25 180 155 25
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: Default (numerical)|#D
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: radio_use_defcite
callback: C_FormBaseInputCB
argument: 0
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
box: 15 270 255 25
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: Sectioned bibliography|#e
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: check_bibtopic
callback: C_FormBaseInputCB
argument: 0

View File

@ -1,5 +1,7 @@
2004-03-29 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* insetbibtex.[Ch]: bibtopic support.
* insetfloat.[Ch]: add param \sideways {true|false}
(support for sideways floats from rotating.sty).

View File

@ -17,6 +17,7 @@
#include "dispatchresult.h"
#include "debug.h"
#include "funcrequest.h"
#include "LaTeXFeatures.h"
#include "gettext.h"
#include "metricsinfo.h"
#include "outputparams.h"
@ -93,13 +94,34 @@ string const InsetBibtex::getScreenLabel(Buffer const &) const
int InsetBibtex::latex(Buffer const & buffer, ostream & os,
OutputParams const & runparams) const
{
// changing the sequence of the commands
// the sequence of the commands:
// 1. \bibliographystyle{style}
// 2. \addcontentsline{...} - if option bibtotoc set
// 3. \bibliography{database}
// and with bibtopic:
// 1. \bibliographystyle{style}
// 2. \begin{btSect}{database}
// 3. \btPrint{Cited|NotCited|All}
// 4. \end{btSect}
// the database string
string adb;
string db_in = getContents();
db_in = split(db_in, adb, ',');
// If we generate in a temp dir, we might need to give an
// absolute path there. This is a bit complicated since we can
// have a comma-separated list of bibliographies
string db_out;
while (!adb.empty()) {
if (!runparams.nice &&
IsFileReadable(MakeAbsPath(adb, buffer.filePath())+".bib"))
adb = os::external_path(MakeAbsPath(adb,
buffer.filePath()));
db_out += adb;
db_out += ',';
db_in = split(db_in, adb,',');
}
db_out = rtrim(db_out, ",");
// Style-Options
string style = getOptions(); // maybe empty! and with bibtotoc
@ -110,18 +132,33 @@ int InsetBibtex::latex(Buffer const & buffer, ostream & os,
style = split(style, bibtotoc, ',');
}
}
// line count
int i = 0;
if (!runparams.nice
&& IsFileReadable(MakeAbsPath(style, buffer.filePath()) + ".bst")) {
style = MakeAbsPath(style, buffer.filePath());
}
if (!style.empty()) { // we want no \biblio...{}
if (!style.empty()) {
os << "\\bibliographystyle{" << style << "}\n";
i += 1;
}
if (buffer.params().use_bibtopic){
os << "\\begin{btSect}{" << db_out << "}\n";
string btprint = getSecOptions();
if (btprint.empty())
// default
btprint = "btPrintCited";
os << "\\" << btprint << "\n"
<< "\\end{btSect}\n";
i += 3;
}
// bibtotoc-Option
if (!bibtotoc.empty()) {
if (!bibtotoc.empty() && !buffer.params().use_bibtopic) {
// maybe a problem when a textclass has no "art" as
// part of its name, because it's than book.
// For the "official" lyx-layouts it's no problem to support
@ -145,22 +182,12 @@ int InsetBibtex::latex(Buffer const & buffer, ostream & os,
}
}
// database
// If we generate in a temp dir, we might need to give an
// absolute path there. This is a bit complicated since we can
// have a comma-separated list of bibliographies
string db_out;
while (!adb.empty()) {
if (!runparams.nice &&
IsFileReadable(MakeAbsPath(adb, buffer.filePath())+".bib"))
adb = os::external_path(MakeAbsPath(adb, buffer.filePath()));
db_out += adb;
db_out += ',';
db_in = split(db_in, adb,',');
if (!buffer.params().use_bibtopic){
os << "\\bibliography{" << db_out << "}\n";
i += 1;
}
db_out = rtrim(db_out, ",");
os << "\\bibliography{" << db_out << "}\n";
return 2;
return i;
}
@ -256,3 +283,11 @@ bool InsetBibtex::delDatabase(string const & db)
}
return true;
}
void InsetBibtex::validate(LaTeXFeatures & features) const
{
if (features.bufferParams().use_bibtopic)
features.require("bibtopic");
}

View File

@ -44,6 +44,8 @@ public:
bool addDatabase(std::string const &);
///
bool delDatabase(std::string const &);
///
void validate(LaTeXFeatures &) const;
protected:
///
virtual void priv_dispatch(LCursor & cur, FuncRequest & cmd);