X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetFootlike.cpp;h=739d89745e6673a5d52ee82f33b49a28ff994ab2;hb=88e5e5fd345c280b0927ad84785657cbc9e55f77;hp=eee2c8c69388e5aaedf30ce18a98c2a26212027c;hpb=5008ee540f84715cd10e87f3fa0cd5dc7b974784;p=lyx.git diff --git a/src/insets/InsetFootlike.cpp b/src/insets/InsetFootlike.cpp index eee2c8c693..739d89745e 100644 --- a/src/insets/InsetFootlike.cpp +++ b/src/insets/InsetFootlike.cpp @@ -3,7 +3,7 @@ * This file is part of LyX, the document processor. * Licence details can be found in the file COPYING. * - * \author Lars Gullik Bjønnes + * \author Lars Gullik Bjønnes * * Full author contact details are available in file CREDITS. */ @@ -15,69 +15,55 @@ #include "Buffer.h" #include "BufferView.h" #include "BufferParams.h" -#include "Color.h" +#include "Font.h" #include "MetricsInfo.h" -#include "Paragraph.h" +#include "support/lstrings.h" -namespace lyx { +#include -InsetFootlike::InsetFootlike(BufferParams const & bp) - : InsetCollapsable(bp) -{ - LyXFont font(LyXFont::ALL_SANE); - font.decSize(); - font.decSize(); - font.setColor(Color::collapsable); - setLabelFont(font); -} +using namespace std; +namespace lyx { -InsetFootlike::InsetFootlike(InsetFootlike const & in) - : InsetCollapsable(in) -{ - LyXFont font(LyXFont::ALL_SANE); - font.decSize(); - font.decSize(); - font.setColor(Color::collapsable); - setLabelFont(font); -} +using support::token; + +InsetFootlike::InsetFootlike(Buffer * buf) + : InsetCollapsible(buf) +{} -bool InsetFootlike::metrics(MetricsInfo & mi, Dimension & dim) const +void InsetFootlike::metrics(MetricsInfo & mi, Dimension & dim) const { - LyXFont tmpfont = mi.base.font; - mi.base.font = mi.base.bv->buffer()->params().getFont(); - InsetCollapsable::metrics(mi, dim); + FontInfo tmpfont = mi.base.font; + mi.base.font = mi.base.bv->buffer().params().getFont().fontInfo(); + InsetCollapsible::metrics(mi, dim); mi.base.font = tmpfont; - bool const changed = dim_ != dim; - dim_ = dim; - return changed; } void InsetFootlike::draw(PainterInfo & pi, int x, int y) const { - LyXFont tmpfont = pi.base.font; - pi.base.font = pi.base.bv->buffer()->params().getFont(); - InsetCollapsable::draw(pi, x, y); + FontInfo tmpfont = pi.base.font; + pi.base.font = pi.base.bv->buffer().params().getFont().fontInfo(); + InsetCollapsible::draw(pi, x, y); pi.base.font = tmpfont; } -void InsetFootlike::write(Buffer const & buf, std::ostream & os) const +void InsetFootlike::write(ostream & os) const { - os << to_utf8(getInsetName()) << "\n"; - InsetCollapsable::write(buf, os); + // The layoutName may contain a "InTitle" qualifier + os << to_utf8(token(layoutName(), char_type(':'), 0)) << "\n"; + InsetCollapsible::write(os); } -bool InsetFootlike::insetAllowed(InsetBase::Code code) const +bool InsetFootlike::insetAllowed(InsetCode code) const { - if (code == InsetBase::FOOT_CODE || code == InsetBase::MARGIN_CODE - || code == InsetBase::FLOAT_CODE) + if (code == FOOT_CODE || code == MARGIN_CODE || code == FLOAT_CODE) return false; - return InsetCollapsable::insetAllowed(code); + return InsetCollapsible::insetAllowed(code); }