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/trunk@17505 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Martin Vermeer 2007-03-22 07:22:16 +00:00
parent f7ca768468
commit 88542bc2ee
8 changed files with 21 additions and 15 deletions

View File

@ -12,6 +12,7 @@ Format 3
Columns 2
Sides 1
PageStyle Plain
ProvidesNatbib 1
Style Standard

View File

@ -1482,4 +1482,15 @@ Encoding const & BufferParams::encoding() const
return *(language->encoding());
}
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;
}
} // namespace lyx

View File

@ -277,6 +277,8 @@ public:
int const & sfscale, int const & ttscale) const;
/// path of the current buffer
std::string filepath;
/// get the appropriate cite engine (natbib handling)
biblio::CiteEngine_enum getEngine() const;
private:
/** Use the Pimpl idiom to hide those member variables that would otherwise

View File

@ -134,7 +134,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();
docstring defaultstyle;
switch (engine) {
case biblio::ENGINE_BASIC:

View File

@ -39,7 +39,7 @@ bool ControlCitation::initialiseParams(string const & data)
vector<pair<string, docstring> > 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,13 +79,13 @@ biblio::InfoMap const & ControlCitation::bibkeysInfo() const
biblio::CiteEngine_enum ControlCitation::getEngine() const
{
return biblio::getEngine(kernel().buffer());
return kernel().buffer().params().getEngine();
}
vector<docstring> const ControlCitation::getCiteStrings(string const & key) const
{
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)

View File

@ -688,12 +688,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;

View File

@ -25,8 +25,6 @@ namespace biblio {
class CiteEngine_enum;
CiteEngine_enum getEngine(Buffer const &);
enum CiteStyle {
CITE,

View File

@ -335,7 +335,7 @@ docstring const InsetCitation::generateLabel(Buffer const & buffer) const
docstring 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;
@ -368,7 +368,7 @@ int InsetCitation::plaintext(Buffer const & buffer, odocstream & os,
docstring str;
if (cache.params == params() &&
cache.engine == biblio::getEngine(buffer))
cache.engine == buffer.params().getEngine())
str = cache.generated_label;
else
str = generateLabel(buffer);
@ -424,7 +424,7 @@ int InsetCitation::textString(Buffer const & buf, odocstream & os,
int InsetCitation::latex(Buffer const & buffer, odocstream & os,
OutputParams const &) const
{
biblio::CiteEngine const cite_engine = buffer.params().cite_engine;
biblio::CiteEngine cite_engine = buffer.params().getEngine();
// FIXME UNICODE
docstring const cite_str = from_utf8(
biblio::asValidLatexCommand(getCmdName(), cite_engine));