]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetfoot.C
fix typo that put too many include paths for most people
[lyx.git] / src / insets / insetfoot.C
index 2b01a0e82626eb71b277833e0d126d438704340b..35e441c2793627084387fff3502b78431c52d5d7 100644 (file)
@@ -1,11 +1,12 @@
 /* This file is part of
  * ======================================================
- * 
+ *
  *           LyX, The Document Processor
- *      
- *          Copyright (C) 1998 The LyX Team.
  *
- *======================================================*/
+ *          Copyright 1998 The LyX Team.
+ *
+ * ======================================================
+ */
 
 #include <config.h>
 
 #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(BufferParams const & bp)
+       : InsetFootlike(bp)
 {
-    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<InsetFoot *>(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;
 }