X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2Finsetmarginal.C;h=1a0eb1b5bece05e73a06a2be8b4033ca650be9d9;hb=4a5b7a5952ad2381fcdf4830511293e184c7c5a1;hp=86bba7f28efcd51249a71be4cac387699f115792;hpb=946895278050e4a464c9591e99232a72f5f4dec9;p=lyx.git diff --git a/src/insets/insetmarginal.C b/src/insets/insetmarginal.C index 86bba7f28e..1a0eb1b5be 100644 --- a/src/insets/insetmarginal.C +++ b/src/insets/insetmarginal.C @@ -23,8 +23,8 @@ #include "support/LOstream.h" #include "debug.h" + using std::ostream; -using std::endl; InsetMarginal::InsetMarginal() @@ -35,50 +35,33 @@ InsetMarginal::InsetMarginal() } -Inset * InsetMarginal::Clone() const -{ - InsetMarginal * result = new InsetMarginal; - result->inset->init(inset); - - result->collapsed = collapsed; - return result; -} - - -char const * InsetMarginal::EditMessage() const +InsetMarginal::InsetMarginal(InsetMarginal const & in, bool same_id) + : InsetFootlike(in, same_id) { - return _("Opened Marginal Note Inset"); + setLabel(_("margin")); + setInsetName("Marginal"); } -int InsetMarginal::Latex(Buffer const * buf, - ostream & os, bool fragile, bool fp) const +Inset * InsetMarginal::clone(Buffer const &, bool same_id) const { - os << "\\marginpar{%\n"; - - int i = inset->Latex(buf, os, fragile, fp); - os << "}%\n"; - - return i + 2; + return new InsetMarginal(*const_cast(this), same_id); } -bool InsetMarginal::InsertInsetAllowed(Inset * in) const +string const InsetMarginal::editMessage() const { - if ((in->LyxCode() == Inset::FOOT_CODE) || - (in->LyxCode() == Inset::MARGIN_CODE)) { - return false; - } - return true; + return _("Opened Marginal Note Inset"); } -#if 0 -LyXFont InsetMarginal::GetDrawFont(BufferView * bv, - LyXParagraph * p, int pos) const +int InsetMarginal::latex(Buffer const * buf, + ostream & os, bool fragile, bool fp) const { - LyXFont fn = getLyXText(bv)->GetFont(bv->buffer(), p, pos); - fn.decSize().decSize(); - return fn; + os << "%\n\\marginpar{"; + + int const i = inset.latex(buf, os, fragile, fp); + os << "%\n}"; + + return i + 2; } -#endif