]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetfoot.C
Don't remove cell selections after fontchange.
[lyx.git] / src / insets / insetfoot.C
index 170dc4ffd4825e9e3e5dc4de7967876cc3bb2ac6..a2297b6cd9133aee05ea456eb6f32c6a1dc16b6e 100644 (file)
@@ -5,7 +5,8 @@
  *      
  *          Copyright 1998 The LyX Team.
  *
- *======================================================*/
+ * ======================================================
+ */
 
 #include <config.h>
 
 #include "gettext.h"
 #include "lyxfont.h"
 #include "BufferView.h"
-#include "lyxscreen.h"
-#include "Painter.h"
-
-using std::ostream;
-
-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);
-}
-
+#include "lyxtext.h"
+#include "insets/insettext.h"
+#include "support/LOstream.h"
+#include "debug.h"
 
-Inset * InsetFoot::Clone() const
-{
-    InsetFoot * result = new InsetFoot(buffer);
-    result->init(buffer, par);
 
-    result->collapsed = collapsed;
-    return result;
-}
+using std::ostream;
 
 
-char const * InsetFoot::EditMessage() const
+InsetFoot::InsetFoot()
+       : InsetFootlike()
 {
-    return _("Opened Footnote Inset");
+       setLabel(_("foot"));
+       setInsetName("Foot");
 }
 
 
-int InsetFoot::Latex(ostream & os, signed char fragile, bool fp) const
+InsetFoot::InsetFoot(InsetFoot const & in, bool same_id)
+       : InsetFootlike(in, same_id)
 {
-       if (fragile) 
-               os << "\\footnotetext{";
-       else 
-               os << "\\footnote{";
-       
-       int i = InsetText::Latex(os, fragile, fp);
-       os << "}";
-       
-       return i;
+       setLabel(_("foot"));
+       setInsetName("Foot");
 }
 
 
-void InsetFoot::Write(ostream & os) const
+Inset * InsetFoot::clone(Buffer const &, bool same_id) const
 {
-       os << "Foot\n"
-          << "\ncollapsed ";
-       if (display())
-               os << "false\n";
-       else
-               os << "true\n";
-       WriteParagraphData(os);
+       return new InsetFoot(*const_cast<InsetFoot *>(this), same_id);
 }
 
 
-void InsetFoot::Read(LyXLex & lex)
+string const InsetFoot::editMessage() const
 {
-    if (lex.IsOK()) {
-       lex.next();
-        string 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;
 }