Move getFont and getLabelFont from InsetCollapsible to Inset

Also move around getLayout and isPassThru.

Part of investigation of bug #12204.
This commit is contained in:
Jean-Marc Lasgouttes 2021-03-24 20:00:51 +01:00
parent 7f2d488e45
commit 56bd50ea6c
4 changed files with 36 additions and 36 deletions

View File

@ -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();

View File

@ -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?

View File

@ -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
{

View File

@ -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,