[LyX/master] Track whether we have warned about mixing layouts across e.g. branches.

Richard Kimberly Heck rikiheck at lyx.org
Tue Mar 17 05:35:49 UTC 2020


commit 861c6167ca5f1329e16dd788489a7c03772e2332
Author: Richard Kimberly Heck <rikiheck at lyx.org>
Date:   Tue Mar 17 01:54:47 2020 -0400

    Track whether we have warned about mixing layouts across e.g. branches.
---
 src/OutputParams.cpp |    2 +-
 src/OutputParams.h   |    3 +++
 src/output_latex.cpp |    6 ++----
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/OutputParams.cpp b/src/OutputParams.cpp
index 8b1d60e..7913758 100644
--- a/src/OutputParams.cpp
+++ b/src/OutputParams.cpp
@@ -34,7 +34,7 @@ OutputParams::OutputParams(Encoding const * enc)
 	  html_disable_captions(false), html_in_par(false),
 	  html_make_pars(true), for_toc(false), for_tooltip(false),
 	  for_search(false), for_preview(false), includeall(false),
-	  already_title(false), issued_title_cmd(false)
+	  already_title(false), issued_title_cmd(false), gave_layout_warning(false)
 {
 	// Note: in PreviewLoader::Impl::dumpPreamble
 	// OutputParams runparams(0);
diff --git a/src/OutputParams.h b/src/OutputParams.h
index 7e578c3..9a9577f 100644
--- a/src/OutputParams.h
+++ b/src/OutputParams.h
@@ -363,6 +363,9 @@ public:
 	/// Used to signal we need to output \end{TITLEBLOCK} when title
 	/// environment is used.
 	mutable bool issued_title_cmd;
+	/// Did we already issue the warning about mixing title and
+	/// non-title layouts?
+	mutable bool gave_layout_warning;
 };
 
 
diff --git a/src/output_latex.cpp b/src/output_latex.cpp
index 07490e5..04d1e17 100644
--- a/src/output_latex.cpp
+++ b/src/output_latex.cpp
@@ -1595,8 +1595,6 @@ void latexParagraphs(Buffer const & buf,
 	// variables used in the loop:
 	DocumentClass const & tclass = bparams.documentClass();
 
-	// Did we already warn about inTitle layout mixing? (we only warn once)
-	bool gave_layout_warning = false;
 	for (; pit < runparams.par_end; ++pit) {
 		lastpit = pit;
 		ParagraphList::const_iterator par = paragraphs.constIterator(pit);
@@ -1608,8 +1606,8 @@ void latexParagraphs(Buffer const & buf,
 
 		if (layout.intitle) {
 			if (runparams.already_title) {
-				if (!gave_layout_warning && !runparams.dryrun) {
-					gave_layout_warning = true;
+				if (!runparams.gave_layout_warning && !runparams.dryrun) {
+					runparams.gave_layout_warning = true;
 					frontend::Alert::warning(_("Error in latexParagraphs"),
 							bformat(_("You are using at least one "
 							  "layout (%1$s) intended for the title, "


More information about the lyx-cvs mailing list