X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2Finsetfoot.C;h=a2297b6cd9133aee05ea456eb6f32c6a1dc16b6e;hb=4a5b7a5952ad2381fcdf4830511293e184c7c5a1;hp=79fbcc83d02f3485640779f7017b38b08e711d9c;hpb=fa492d6bf09db7f1c278687e0000ad1c4833af3d;p=lyx.git diff --git a/src/insets/insetfoot.C b/src/insets/insetfoot.C index 79fbcc83d0..a2297b6cd9 100644 --- a/src/insets/insetfoot.C +++ b/src/insets/insetfoot.C @@ -5,7 +5,8 @@ * * Copyright 1998 The LyX Team. * - *======================================================*/ + * ====================================================== + */ #include @@ -17,80 +18,50 @@ #include "gettext.h" #include "lyxfont.h" #include "BufferView.h" -#include "lyxscreen.h" -#include "Painter.h" +#include "lyxtext.h" +#include "insets/insettext.h" +#include "support/LOstream.h" +#include "debug.h" -InsetFoot::InsetFoot(Buffer * bf): InsetCollapsable(bf) -{ - setLabel(_("foot")); - LyXFont font(LyXFont::ALL_SANE); - font.decSize(); - font.decSize(); - font.setColor(LColor::footnote); - setLabelFont(font); - setAutoCollapse(false); -} +using std::ostream; -Inset * InsetFoot::Clone() const +InsetFoot::InsetFoot() + : InsetFootlike() { - Inset * result = new InsetFoot(buffer); - return result; + setLabel(_("foot")); + setInsetName("Foot"); } -char const * InsetFoot::EditMessage() const +InsetFoot::InsetFoot(InsetFoot const & in, bool same_id) + : InsetFootlike(in, same_id) { - return _("Opened Footnote Inset"); + setLabel(_("foot")); + setInsetName("Foot"); } -int InsetFoot::Latex(ostream & os, signed char fragile, bool fp) const +Inset * InsetFoot::clone(Buffer const &, bool same_id) const { - if (fragile) - os << "\\footnotetext{"; - else - os << "\\footnote{"; - - int i = InsetText::Latex(os, fragile, fp); - os << "}"; - - return i; + return new InsetFoot(*const_cast(this), same_id); } -void InsetFoot::Write(ostream & os) const +string const InsetFoot::editMessage() const { - os << "Foot\n" - << "\ncollapsed "; - if (display()) - os << "false\n"; - else - os << "true\n"; - WriteParagraphData(os); + return _("Opened Footnote Inset"); } -void InsetFoot::Read(LyXLex & lex) +int InsetFoot::latex(Buffer const * buf, + ostream & os, bool fragile, bool fp) const { - if (lex.IsOK()) { - lex.next(); - string token = lex.GetString(); - if (token == "collapsed") { - lex.next(); - collapsed = lex.GetBool(); - } - } - InsetText::Read(lex); -} - - -bool InsetFoot::InsertInset(BufferView * bv, Inset * inset) -{ - if ((inset->LyxCode() == Inset::FOOT_CODE) || - (inset->LyxCode() == Inset::MARGIN_CODE)) { - return false; - } - return InsetText::InsertInset(bv, inset); + os << "%\n\\footnote{"; + + int const i = inset.latex(buf, os, fragile, fp); + os << "%\n}"; + + return i + 2; }