[LyX/master] Mark deleted graphics in output

Juergen Spitzmueller spitz at lyx.org
Thu Dec 26 05:59:53 UTC 2019


commit e5a9d0987043f6f053933d0ae63203a6a0cde4d3
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Thu Dec 26 07:15:37 2019 +0100

    Mark deleted graphics in output
    
    Fixes #11687
---
 src/LaTeXFeatures.cpp        |   16 ++++++++--------
 src/insets/InsetGraphics.cpp |    7 +++++++
 src/mathed/InsetMathHull.cpp |    6 +++---
 3 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/src/LaTeXFeatures.cpp b/src/LaTeXFeatures.cpp
index dd3f25c..084552e 100644
--- a/src/LaTeXFeatures.cpp
+++ b/src/LaTeXFeatures.cpp
@@ -294,14 +294,14 @@ static docstring const changetracking_xcolor_ulem_hyperref_cb_def = from_ascii(
 	"}}\n"
 	"\\DeclareRobustCommand{\\lyxsout}[1]{\\ifx\\\\#1\\else\\sout{#1}\\fi}\n");
 
-static docstring const changetracking_tikz_math_sout_def = from_ascii(
-	"%% Strike out display math with tikz\n"
+static docstring const changetracking_tikz_object_sout_def = from_ascii(
+	"%% Strike out display math and text objects with tikz\n"
 	"\\usepackage{tikz}\n"
 	"\\usetikzlibrary{calc}\n"
-	"\\newcommand{\\lyxmathsout}[1]{%\n"
-	"  \\tikz[baseline=(math.base)]{\n"
-	"    \\node[inner sep=0pt,outer sep=0pt](math){#1};\n"
-	"    \\draw($(math.south west)+(2em,.5em)$)--($(math.north east)-(2em,.5em)$);\n"
+	"\\newcommand{\\lyxobjectsout}[1]{%\n"
+	"  \\tikz[baseline=(obj.base)]{\n"
+	"    \\node[inner sep=0pt,outer sep=0pt](obj){#1};\n"
+	"    \\draw($(obj.south west)+(2em,.5em)$)--($(obj.north east)-(2em,.5em)$);\n"
 	"  }\n"
 	"}\n");
 
@@ -1688,8 +1688,8 @@ TexString LaTeXFeatures::getMacros() const
 		}
 	}
 
-	if (mustProvide("ct-tikz-math-sout"))
-		macros << changetracking_tikz_math_sout_def;
+	if (mustProvide("ct-tikz-object-sout"))
+		macros << changetracking_tikz_object_sout_def;
 
 	if (mustProvide("ct-none"))
 		macros << changetracking_none_def;
diff --git a/src/insets/InsetGraphics.cpp b/src/insets/InsetGraphics.cpp
index 2a291aa..27df512 100644
--- a/src/insets/InsetGraphics.cpp
+++ b/src/insets/InsetGraphics.cpp
@@ -858,6 +858,11 @@ void InsetGraphics::latex(otexstream & os,
 	if (runparams.moving_arg)
 		before += "\\protect";
 
+	if (runparams.inDeletedInset) {
+		before += "\\lyxobjectsout{";
+		after += "}";
+	}
+
 	// We never use the starred form, we use the "clip" option instead.
 	before += "\\includegraphics";
 
@@ -1136,6 +1141,8 @@ void InsetGraphics::validate(LaTeXFeatures & features) const
 		if (contains(rel_file, "."))
 			features.require("lyxdot");
 	}
+	if (features.inDeletedInset())
+		features.require("ct-tikz-object-sout");
 }
 
 
diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp
index 7da3319..8546a02 100644
--- a/src/mathed/InsetMathHull.cpp
+++ b/src/mathed/InsetMathHull.cpp
@@ -126,9 +126,9 @@ namespace {
 		if (os.strikeoutMath()) {
 			if (os.ulemCmd() == WriteStream::UNDERLINE)
 				os << "\\raisebox{-\\belowdisplayshortskip}{"
-				      "\\lyxmathsout{\\parbox[b]{\\linewidth}{";
+				      "\\lyxobjectsout{\\parbox[b]{\\linewidth}{";
 			else
-				os << "\\lyxmathsout{\\parbox{\\linewidth}{";
+				os << "\\lyxobjectsout{\\parbox{\\linewidth}{";
 		} else if (os.ulemCmd() == WriteStream::UNDERLINE)
 			os << "\\raisebox{-\\belowdisplayshortskip}{"
 			      "\\parbox[b]{\\linewidth}{";
@@ -1104,7 +1104,7 @@ void InsetMathHull::validate(LaTeXFeatures & features) const
 				from_ascii("\\newcommand{\\endregexp}{}"));
 		} else if (outerDisplay() && features.inDeletedInset()
 			   && !features.mustProvide("ct-dvipost")) {
-				features.require("ct-tikz-math-sout");
+				features.require("ct-tikz-object-sout");
 		}
 
 		// Validation is necessary only if not using AMS math.


More information about the lyx-cvs mailing list