]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetmarginal.C
Revert this change as it sneaked in and wasn't discussed yet.
[lyx.git] / src / insets / insetmarginal.C
index 9a592c972bf0433454772bd0b8875ba0548c7d9a..a62b85144cca2f21863d2392f79fbd45b339f7e2 100644 (file)
@@ -1,11 +1,12 @@
 /* This file is part of
  * ======================================================
- * 
+ *
  *           LyX, The Document Processor
- *      
+ *
  *          Copyright 1998 The LyX Team.
  *
- *======================================================*/
+ * ======================================================
+ */
 
 #include <config.h>
 
 #include "gettext.h"
 #include "lyxfont.h"
 #include "BufferView.h"
-#include "Painter.h"
 #include "lyxtext.h"
+#include "insets/insettext.h"
 #include "support/LOstream.h"
+#include "debug.h"
+
 
 using std::ostream;
-using std::endl;
 
-InsetMarginal::InsetMarginal() : InsetCollapsable()
+
+InsetMarginal::InsetMarginal(BufferParams const & bp)
+       : InsetFootlike(bp)
 {
        setLabel(_("margin"));
-       LyXFont font(LyXFont::ALL_SANE);
-       font.decSize();
-       font.decSize();
-       font.setColor(LColor::footnote);
-       setLabelFont(font);
-       setAutoCollapse(false);
        setInsetName("Marginal");
 }
 
 
-Inset * InsetMarginal::Clone() const
-{
-       InsetMarginal * result = new InsetMarginal;
-       result->init(this);
-
-       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{%" << endl;
-    
-    int i = InsetText::Latex(buf, os, fragile, fp);
-    os << "}%" << endl;
-    
-    return i + 2;
+       return new InsetMarginal(*const_cast<InsetMarginal *>(this), same_id);
 }
 
 
-bool InsetMarginal::InsertInset(BufferView * bv, Inset * inset)
+string const InsetMarginal::editMessage() const
 {
-    if (!InsertInsetAllowed(inset))
-       return false;
-
-    return InsetText::InsertInset(bv, inset);
+       return _("Opened Marginal Note Inset");
 }
 
 
-bool InsetMarginal::InsertInsetAllowed(Inset * inset) const
+int InsetMarginal::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 true;
-}
+       os << "%\n\\marginpar{";
 
+       int const i = inset.latex(buf, os, fragile, fp);
+       os << "%\n}";
 
-LyXFont InsetMarginal::GetDrawFont(BufferView * bv,
-                                  LyXParagraph * p, int pos) const
-{
-    LyXFont fn = getLyXText(bv)->GetFont(bv->buffer(), p, pos);
-    fn.decSize().decSize();
-    return fn;
+       return i + 2;
 }