From 7c1fc6ea752e8c13ed9381cf37509119c7694f9c Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Thu, 13 Mar 2014 06:43:38 +0100 Subject: [PATCH] Include child's own authors when using BufferParams from master. --- src/Buffer.cpp | 15 +++++++++++++++ src/Buffer.h | 2 ++ src/Paragraph.cpp | 2 +- src/output_latex.cpp | 2 +- 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 7205f69278..ab2164b82b 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -636,6 +636,21 @@ BufferParams const & Buffer::params() const } +BufferParams const & Buffer::masterParams() const +{ + if (masterBuffer() == this) + return params(); + + BufferParams & mparams = const_cast(masterBuffer())->params(); + // Copy child authors to the params. We need those pointers. + AuthorList const & child_authors = params().authors(); + AuthorList::Authors::const_iterator it = child_authors.begin(); + for (; it != child_authors.end(); it++) + mparams.authors().record(*it); + return mparams; +} + + ParagraphList & Buffer::paragraphs() { return text().paragraphs(); diff --git a/src/Buffer.h b/src/Buffer.h index 5fdf020e4c..fe0294bf1f 100644 --- a/src/Buffer.h +++ b/src/Buffer.h @@ -510,6 +510,8 @@ public: /// BufferParams & params(); BufferParams const & params() const; + /// + BufferParams const & masterParams() const; /** The list of paragraphs. This is a linked list of paragraph, this list holds the diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp index 7118ff6962..d32c0be2f0 100644 --- a/src/Paragraph.cpp +++ b/src/Paragraph.cpp @@ -1451,7 +1451,7 @@ void Paragraph::Private::validate(LaTeXFeatures & features) const bool const is_command = layout_->latextype == LATEX_COMMAND; Buffer const & buf = inset_owner_->buffer(); BufferParams const & bp = features.runparams().is_child - ? buf.masterBuffer()->params() : buf.params(); + ? buf.masterParams() : buf.params(); Font f; TexRow texrow; // Using a string stream here circumvents the encoding diff --git a/src/output_latex.cpp b/src/output_latex.cpp index a07b538c1c..31211d1c85 100644 --- a/src/output_latex.cpp +++ b/src/output_latex.cpp @@ -524,7 +524,7 @@ void TeXOnePar(Buffer const & buf, int start_pos, int end_pos) { BufferParams const & bparams = runparams_in.is_child - ? buf.masterBuffer()->params() : buf.params(); + ? buf.masterParams() : buf.params(); ParagraphList const & paragraphs = text.paragraphs(); Paragraph const & par = paragraphs.at(pit); // FIXME This check should not really be needed.