]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetmarginal.C
Enable the external inset to handle unknown templates gracefully.
[lyx.git] / src / insets / insetmarginal.C
index 86bba7f28efcd51249a71be4cac387699f115792..b5d140741af1abf2b6bfd7af04ee775abfd21045 100644 (file)
@@ -1,18 +1,16 @@
-/* This file is part of
- * ======================================================
- * 
- *           LyX, The Document Processor
- *      
- *          Copyright 1998 The LyX Team.
+/**
+ * \file insetmarginal.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
- * ======================================================
+ * \author Jürgen Vigna
+ * \author Lars Gullik Bjønnes
+ *
+ * Full author contact details are available in file CREDITS
  */
 
 #include <config.h>
 
-#ifdef __GNUG__
-#pragma implementation
-#endif
 
 #include "insetmarginal.h"
 #include "gettext.h"
 #include "support/LOstream.h"
 #include "debug.h"
 
+
 using std::ostream;
-using std::endl;
 
 
-InsetMarginal::InsetMarginal()
-       : InsetFootlike()
+InsetMarginal::InsetMarginal(BufferParams const & bp)
+       : InsetFootlike(bp)
 {
        setLabel(_("margin"));
        setInsetName("Marginal");
 }
 
 
-Inset * InsetMarginal::Clone() const
+InsetMarginal::InsetMarginal(InsetMarginal const & in)
+       : InsetFootlike(in)
 {
-    InsetMarginal * result = new InsetMarginal;
-    result->inset->init(inset);
-    
-    result->collapsed = collapsed;
-    return result;
+       setLabel(_("margin"));
+       setInsetName("Marginal");
 }
 
 
-char const * InsetMarginal::EditMessage() const
+Inset * InsetMarginal::clone() const
 {
-       return _("Opened Marginal Note Inset");
+       return new InsetMarginal(*this);
 }
 
 
-int InsetMarginal::Latex(Buffer const * buf,
-                        ostream & os, bool fragile, bool fp) const
+string const InsetMarginal::editMessage() const
 {
-    os << "\\marginpar{%\n";
-    
-    int i = inset->Latex(buf, os, fragile, fp);
-    os << "}%\n";
-    
-    return i + 2;
+       return _("Opened Marginal Note Inset");
 }
 
 
-bool InsetMarginal::InsertInsetAllowed(Inset * in) const
+int InsetMarginal::latex(Buffer const * buf, ostream & os,
+                        LatexRunParams const & runparams) const
 {
-    if ((in->LyxCode() == Inset::FOOT_CODE) ||
-       (in->LyxCode() == Inset::MARGIN_CODE)) {
-       return false;
-    }
-    return true;
-}
+       os << "%\n\\marginpar{";
 
+       int const i = inset.latex(buf, os, runparams);
+       os << "%\n}";
 
-#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;
+       return i + 2;
 }
-#endif