mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-12 16:50:39 +00:00
Get ProvidesNatbib working correctly, esp. for egs.layout.
* insetcite: call getEngine() * bufferparams: move getEngine() here, and let it sense the provides(natbib) flag * ControlBibtex, ControlCitation: correct getEngine() call * biblio: remove old getEngine() git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_4_X@17489 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
f138685953
commit
5f0a608379
@ -12,6 +12,7 @@ Format 2
|
||||
Columns 2
|
||||
Sides 1
|
||||
PageStyle Plain
|
||||
ProvidesNatbib 1
|
||||
|
||||
|
||||
Style Standard
|
||||
|
@ -1253,3 +1253,17 @@ string const BufferParams::babelCall(string const & lang_opts) const
|
||||
tmp = string("\\usepackage[") + lang_opts + "]{babel}";
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
biblio::CiteEngine_enum BufferParams::getEngine() const
|
||||
{
|
||||
// FIXME the class should provide the numerical/
|
||||
// authoryear choice
|
||||
if (getLyXTextClass().provides(LyXTextClass::natbib)
|
||||
&& cite_engine != biblio::ENGINE_NATBIB_NUMERICAL)
|
||||
return biblio::ENGINE_NATBIB_AUTHORYEAR;
|
||||
return cite_engine;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -230,6 +230,9 @@ public:
|
||||
std::string const paperSizeName() const;
|
||||
///
|
||||
std::string const babelCall(std::string const & lang_opts) const;
|
||||
/// get the appropriate cite engine (natbib handling)
|
||||
lyx::biblio::CiteEngine_enum getEngine() const;
|
||||
|
||||
|
||||
private:
|
||||
/** Use the Pimpl idiom to hide those member variables that would otherwise
|
||||
|
@ -133,7 +133,7 @@ string const ControlBibtex::getStylefile() const
|
||||
// the different bibtex packages have (and need) their
|
||||
// own "plain" stylefiles
|
||||
biblio::CiteEngine_enum const & engine =
|
||||
biblio::getEngine(kernel().buffer());
|
||||
kernel().buffer().params().getEngine();
|
||||
string defaultstyle;
|
||||
switch (engine) {
|
||||
case biblio::ENGINE_BASIC:
|
||||
|
@ -39,7 +39,7 @@ bool ControlCitation::initialiseParams(string const & data)
|
||||
vector<pair<string, string> > blist;
|
||||
kernel().buffer().fillWithBibKeys(blist);
|
||||
|
||||
biblio::CiteEngine const engine = biblio::getEngine(kernel().buffer());
|
||||
biblio::CiteEngine const engine = kernel().buffer().params().getEngine();
|
||||
|
||||
bool use_styles = engine != biblio::ENGINE_BASIC;
|
||||
|
||||
@ -79,7 +79,7 @@ biblio::InfoMap const & ControlCitation::bibkeysInfo() const
|
||||
|
||||
biblio::CiteEngine_enum ControlCitation::getEngine() const
|
||||
{
|
||||
return biblio::getEngine(kernel().buffer());
|
||||
return kernel().buffer().params().getEngine();
|
||||
}
|
||||
|
||||
|
||||
@ -87,7 +87,7 @@ vector<string> const ControlCitation::getCiteStrings(string const & key) const
|
||||
{
|
||||
vector<string> styles;
|
||||
|
||||
biblio::CiteEngine const engine = biblio::getEngine(kernel().buffer());
|
||||
biblio::CiteEngine const engine = kernel().buffer().params().getEngine();
|
||||
vector<biblio::CiteStyle> const cs = biblio::getCiteStyles(engine);
|
||||
|
||||
if (engine == biblio::ENGINE_NATBIB_NUMERICAL)
|
||||
|
@ -679,12 +679,6 @@ string const CitationStyle::asLatexStr() const
|
||||
}
|
||||
|
||||
|
||||
CiteEngine_enum getEngine(Buffer const & buffer)
|
||||
{
|
||||
return buffer.params().cite_engine;
|
||||
}
|
||||
|
||||
|
||||
vector<CiteStyle> const getCiteStyles(CiteEngine_enum const & engine)
|
||||
{
|
||||
unsigned int nStyles = 0;
|
||||
|
@ -24,8 +24,6 @@ namespace biblio {
|
||||
|
||||
class CiteEngine_enum;
|
||||
|
||||
CiteEngine_enum getEngine(Buffer const &);
|
||||
|
||||
|
||||
enum CiteStyle {
|
||||
CITE,
|
||||
|
@ -304,7 +304,7 @@ string const InsetCitation::generateLabel(Buffer const & buffer) const
|
||||
string const after = getOptions();
|
||||
|
||||
string label;
|
||||
biblio::CiteEngine const engine = buffer.params().cite_engine;
|
||||
biblio::CiteEngine const engine = buffer.params().getEngine();
|
||||
if (engine != biblio::ENGINE_BASIC) {
|
||||
label = getNatbibLabel(buffer, getCmdName(), getContents(),
|
||||
before, after, engine);
|
||||
@ -321,7 +321,7 @@ string const InsetCitation::generateLabel(Buffer const & buffer) const
|
||||
|
||||
string const InsetCitation::getScreenLabel(Buffer const & buffer) const
|
||||
{
|
||||
biblio::CiteEngine const engine = biblio::getEngine(buffer);
|
||||
biblio::CiteEngine const engine = buffer.params().getEngine();
|
||||
if (cache.params == params() && cache.engine == engine)
|
||||
return cache.screen_label;
|
||||
|
||||
@ -351,7 +351,7 @@ string const InsetCitation::getScreenLabel(Buffer const & buffer) const
|
||||
int InsetCitation::plaintext(Buffer const & buffer, ostream & os, OutputParams const &) const
|
||||
{
|
||||
if (cache.params == params() &&
|
||||
cache.engine == biblio::getEngine(buffer))
|
||||
cache.engine == buffer.params().getEngine())
|
||||
os << cache.generated_label;
|
||||
else
|
||||
os << generateLabel(buffer);
|
||||
|
Loading…
Reference in New Issue
Block a user