[LyX/master] Make inset info icons tight again!

Jean-Marc Lasgouttes lasgouttes at lyx.org
Tue May 2 13:37:40 UTC 2023


commit 97ccb8c8c9d3af96f82c128ad65d2582f0063628
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date:   Tue May 2 14:49:47 2023 +0200

    Make inset info icons tight again!
    
    This is a follow-up to 5be391b2, which increased the space on
    left/right of graphics inset. This extra space makes sense in normal
    graphics editing, but is weird in the case of InsetInfo, which has its
    own spacing.
    
    Create a special tight graphics inset class, and use that for icons.
---
 src/insets/InsetInfo.cpp |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/src/insets/InsetInfo.cpp b/src/insets/InsetInfo.cpp
index 123b1ee..06851bb 100644
--- a/src/insets/InsetInfo.cpp
+++ b/src/insets/InsetInfo.cpp
@@ -465,6 +465,22 @@ string InsetInfoParams::infoType() const
 /////////////////////////////////////////////////////////////////////////
 
 
+namespace {
+
+class InsetGraphicsTight : public InsetGraphics
+{
+public:
+	///
+	explicit InsetGraphicsTight(Buffer * buf) : InsetGraphics(buf) {}
+
+	///
+	int leftOffset(BufferView const *) const override { return 0; }
+	///
+	int rightOffset(BufferView const *) const override { return 0; }
+};
+
+}
+
 
 InsetInfo::InsetInfo(Buffer * buf, string const & info)
 	: InsetCollapsible(buf), initialized_(false)
@@ -1127,7 +1143,7 @@ void InsetInfo::build()
 				percent_scale = (100 * iconsize + imgsize / 2)/imgsize;
 			}
 		}
-		InsetGraphics * inset = new InsetGraphics(buffer_);
+		InsetGraphicsTight * inset = new InsetGraphicsTight(buffer_);
 		InsetGraphicsParams igp;
 		igp.filename = file;
 		igp.lyxscale = percent_scale;


More information about the lyx-cvs mailing list