X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2Finsetfoot.C;h=a2297b6cd9133aee05ea456eb6f32c6a1dc16b6e;hb=4a5b7a5952ad2381fcdf4830511293e184c7c5a1;hp=2b01a0e82626eb71b277833e0d126d438704340b;hpb=b3e20a15e74bc3a419ed6d01e49dccc11192b205;p=lyx.git diff --git a/src/insets/insetfoot.C b/src/insets/insetfoot.C index 2b01a0e826..a2297b6cd9 100644 --- a/src/insets/insetfoot.C +++ b/src/insets/insetfoot.C @@ -3,9 +3,10 @@ * * LyX, The Document Processor * - * Copyright (C) 1998 The LyX Team. + * Copyright 1998 The LyX Team. * - *======================================================*/ + * ====================================================== + */ #include @@ -17,98 +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; -InsetFoot * InsetFoot::Clone() const +InsetFoot::InsetFoot() + : InsetFootlike() { - InsetFoot * result = new InsetFoot(buffer); - return result; + setLabel(_("foot")); + setInsetName("Foot"); } -const char * InsetFoot::EditMessage() const +InsetFoot::InsetFoot(InsetFoot const & in, bool same_id) + : InsetFootlike(in, same_id) { - return _("Opened Footnote Inset"); + setLabel(_("foot")); + setInsetName("Foot"); } -#ifndef USE_OSTREAM_ONLY -int InsetFoot::Latex(string & l, signed char fragile) const -{ - int i; - - if (fragile) - l += "\\footnotetext{"; - else - l += "\\footnote{"; - i = InsetText::Latex(l, fragile); - l += "}"; - - return i; -} -#endif - -int InsetFoot::Latex(ostream & os, signed char fragile) const +Inset * InsetFoot::clone(Buffer const &, bool same_id) const { - int i; - - if (fragile) - os << "\\footnotetext{"; - else - os << "\\footnote{"; - - i = InsetText::Latex(os, fragile); - os << "}"; - - return i; + return new InsetFoot(*const_cast(this), same_id); } -void InsetFoot::Write(ostream & os) const -{ - os << "Foot\n"; - os << "\ncollapsed "; - if (display()) - os << "false"; - else - os << "true"; - os << "\n"; - WriteParagraphData(os); -} -void InsetFoot::Read(LyXLex & lex) +string const InsetFoot::editMessage() const { - if (lex.IsOK()) { - string token, tmptok; - - lex.next(); - token = lex.GetString(); - if (token == "collapsed") { - lex.next(); - collapsed = lex.GetBool(); - } - } - InsetText::Read(lex); + return _("Opened Footnote Inset"); } -bool InsetFoot::InsertInset(BufferView *bv, Inset * inset) + +int InsetFoot::latex(Buffer const * buf, + ostream & os, bool fragile, bool fp) const { - 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; }