]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetmarginal.C
Translate labels for float:algorithm, float:figure and float:table.
[lyx.git] / src / insets / insetmarginal.C
index ce0fe40f81304dd810aed6dfb0c5a45a1b9ea914..a62b85144cca2f21863d2392f79fbd45b339f7e2 100644 (file)
@@ -1,8 +1,8 @@
 /* This file is part of
  * ======================================================
- * 
+ *
  *           LyX, The Document Processor
- *      
+ *
  *          Copyright 1998 The LyX Team.
  *
  * ======================================================
 #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");
+       setLabel(_("margin"));
+       setInsetName("Marginal");
 }
 
 
-void InsetMarginal::Write(Buffer const * buf, ostream & os) const
+InsetMarginal::InsetMarginal(InsetMarginal const & in, bool same_id)
+       : InsetFootlike(in, same_id)
 {
-    os << getInsetName() << "\n";
-    InsetCollapsable::Write(buf, os);
+       setLabel(_("margin"));
+       setInsetName("Marginal");
 }
 
 
-Inset * InsetMarginal::Clone() const
+Inset * InsetMarginal::clone(Buffer const &, bool same_id) const
 {
-    InsetMarginal * result = new InsetMarginal;
-    result->inset->init(inset);
-    
-    result->collapsed = collapsed;
-    return result;
+       return new InsetMarginal(*const_cast<InsetMarginal *>(this), same_id);
 }
 
 
-char const * InsetMarginal::EditMessage() const
+string const InsetMarginal::editMessage() const
 {
-    return _("Opened Marginal Note Inset");
+       return _("Opened Marginal Note Inset");
 }
 
 
-int InsetMarginal::Latex(Buffer const * buf,
+int InsetMarginal::latex(Buffer const * buf,
                         ostream & os, bool fragile, bool fp) const
 {
-    os << "\\marginpar{%\n";
-    
-    int i = inset->Latex(buf, os, fragile, fp);
-    os << "}%\n";
-    
-    return i + 2;
-}
-
+       os << "%\n\\marginpar{";
 
-bool InsetMarginal::InsertInset(BufferView * bv, Inset * in)
-{
-    if (!InsertInsetAllowed(in))
-       return false;
+       int const i = inset.latex(buf, os, fragile, fp);
+       os << "%\n}";
 
-    return inset->InsertInset(bv, in);
+       return i + 2;
 }
-
-
-bool InsetMarginal::InsertInsetAllowed(Inset * in) const
-{
-    if ((in->LyxCode() == Inset::FOOT_CODE) ||
-       (in->LyxCode() == Inset::MARGIN_CODE)) {
-       return false;
-    }
-    return true;
-}
-
-#if 0
-LyXFont InsetMarginal::GetDrawFont(BufferView * bv,
-                                  LyXParagraph * p, int pos) const
-{
-    LyXFont fn = getLyXText(bv)->GetFont(bv->buffer(), p, pos);
-    fn.decSize().decSize();
-    return fn;
-}
-#endif