X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetFootlike.cpp;h=739d89745e6673a5d52ee82f33b49a28ff994ab2;hb=87a7f728ca9b8b4d358cf06de980f61b67a927ac;hp=e64287550d89ce09e917f2abf3e98681683425de;hpb=fc6ce7cd08562fd7bab4427880b46390bb7d2f07;p=lyx.git diff --git a/src/insets/InsetFootlike.cpp b/src/insets/InsetFootlike.cpp index e64287550d..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) -{ - Font font(Font::ALL_SANE); - font.decSize(); - font.decSize(); - font.setColor(Color::collapsable); - setLabelFont(font); -} +using namespace std; +namespace lyx { -InsetFootlike::InsetFootlike(InsetFootlike const & in) - : InsetCollapsable(in) -{ - Font font(Font::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 { - Font 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 { - Font 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(insetName()) << "\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(Inset::Code code) const +bool InsetFootlike::insetAllowed(InsetCode code) const { - if (code == Inset::FOOT_CODE || code == Inset::MARGIN_CODE - || code == Inset::FLOAT_CODE) + if (code == FOOT_CODE || code == MARGIN_CODE || code == FLOAT_CODE) return false; - return InsetCollapsable::insetAllowed(code); + return InsetCollapsible::insetAllowed(code); }