[LyX/master] Move getFont and getLabelFont from InsetCollapsible to Inset

Jean-Marc Lasgouttes lasgouttes at lyx.org
Wed Mar 24 18:58:00 UTC 2021


commit 56bd50ea6c6dff71349848dc7bb2dd4bcdcee446
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date:   Wed Mar 24 20:00:51 2021 +0100

    Move getFont and getLabelFont from InsetCollapsible to Inset
    
    Also move around getLayout and isPassThru.
    
    Part of investigation of bug #12204.
---
 src/insets/Inset.cpp            |   40 +++++++++++++++++++++++++-------------
 src/insets/Inset.h              |   16 +++++++++-----
 src/insets/InsetCollapsible.cpp |   12 -----------
 src/insets/InsetCollapsible.h   |    4 ---
 4 files changed, 36 insertions(+), 36 deletions(-)

diff --git a/src/insets/Inset.cpp b/src/insets/Inset.cpp
index cb10fa5..7d05c8e 100644
--- a/src/insets/Inset.cpp
+++ b/src/insets/Inset.cpp
@@ -237,6 +237,20 @@ docstring Inset::layoutName() const
 }
 
 
+InsetLayout const & Inset::getLayout() const
+{
+	if (!buffer_)
+		return DocumentClass::plainInsetLayout();
+	return buffer().params().documentClass().insetLayout(layoutName());
+}
+
+
+bool Inset::isPassThru() const
+{
+	return getLayout().isPassThru();
+}
+
+
 bool Inset::isFreeSpacing() const
 {
 	return getLayout().isFreeSpacing();
@@ -261,6 +275,18 @@ bool Inset::isInToc() const
 }
 
 
+FontInfo Inset::getFont() const
+{
+	return getLayout().font();
+}
+
+
+FontInfo Inset::getLabelfont() const
+{
+	return getLayout().labelfont();
+}
+
+
 docstring Inset::toolTip(BufferView const &, int, int) const
 {
 	return docstring();
@@ -580,20 +606,6 @@ bool Inset::covers(BufferView const & bv, int x, int y) const
 }
 
 
-InsetLayout const & Inset::getLayout() const
-{
-	if (!buffer_)
-		return DocumentClass::plainInsetLayout();
-	return buffer().params().documentClass().insetLayout(layoutName());
-}
-
-
-bool Inset::isPassThru() const
-{
-	return getLayout().isPassThru();
-}
-
-
 bool Inset::undefined() const
 {
 	docstring const & n = getLayout().name();
diff --git a/src/insets/Inset.h b/src/insets/Inset.h
index 824ba46..ad79d17 100644
--- a/src/insets/Inset.h
+++ b/src/insets/Inset.h
@@ -233,6 +233,12 @@ public:
 	virtual void cursorPos(BufferView const & bv,
 		CursorSlice const & sl, bool boundary, int & x, int & y) const;
 
+	///
+	virtual docstring layoutName() const;
+	///
+	virtual InsetLayout const & getLayout() const;
+	///
+	virtual bool isPassThru() const;
 	/// Allow multiple blanks
 	virtual bool isFreeSpacing() const;
 	/// Don't eliminate empty paragraphs
@@ -241,6 +247,10 @@ public:
 	virtual bool forceLTR(OutputParams const &) const;
 	/// whether to include this inset in the strings generated for the TOC
 	virtual bool isInToc() const;
+	/// Inset font
+	virtual FontInfo getFont() const;
+	/// Label font
+	virtual FontInfo getLabelfont() const;
 
 	/// Where should we go when we press the up or down cursor key?
 	virtual bool idxUpDown(Cursor & cur, bool up) const;
@@ -447,12 +457,6 @@ public:
 	/// This default implementation returns an empty string.
 	virtual std::string contextMenuName() const;
 
-
-	virtual docstring layoutName() const;
-	///
-	virtual InsetLayout const & getLayout() const;
-	///
-	virtual bool isPassThru() const;
 	/// Is this inset embedded in a title?
 	virtual bool isInTitle() const { return false; }
 	/// Is this inset's layout defined in the document's textclass?
diff --git a/src/insets/InsetCollapsible.cpp b/src/insets/InsetCollapsible.cpp
index ac42e1d..db67965 100644
--- a/src/insets/InsetCollapsible.cpp
+++ b/src/insets/InsetCollapsible.cpp
@@ -728,18 +728,6 @@ InsetDecoration InsetCollapsible::decoration() const
 }
 
 
-FontInfo InsetCollapsible::getFont() const
-{
-	return getLayout().font();
-}
-
-
-FontInfo InsetCollapsible::getLabelfont() const
-{
-	return getLayout().labelfont();
-}
-
-
 string InsetCollapsible::contextMenu(BufferView const & bv, int x,
 	int y) const
 {
diff --git a/src/insets/InsetCollapsible.h b/src/insets/InsetCollapsible.h
index e1405ac..0f2711a 100644
--- a/src/insets/InsetCollapsible.h
+++ b/src/insets/InsetCollapsible.h
@@ -125,10 +125,6 @@ public:
 
 	/// Default looks
 	virtual InsetDecoration decoration() const;
-	/// Inset font
-	virtual FontInfo getFont() const;
-	/// Label font
-	virtual FontInfo getLabelfont() const;
 	///
 	enum Geometry {
 		TopButton,


More information about the lyx-cvs mailing list