From 56bd50ea6c6dff71349848dc7bb2dd4bcdcee446 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Wed, 24 Mar 2021 20:00:51 +0100 Subject: [PATCH] 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 cb10fa52cc..7d05c8ef1f 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 824ba46172..ad79d17a5e 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 ac42e1d265..db679652ac 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 e1405ace32..0f2711afba 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, -- 2.39.5