]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/formula.h
mathed uglyfication
[lyx.git] / src / mathed / formula.h
index 388d770432db7adcb3c1f8f91863f27ab719157b..19acb55cea660525d64b3a5d227ca580b292cd26 100644 (file)
@@ -1,76 +1,93 @@
 // -*- C++ -*-
-/*
- *  File:        formula.h
- *  Purpose:     Declaration of formula inset
- *  Author:      Alejandro Aguilar Sierra <asierra@servidor.unam.mx> 
- *  Created:     January 1996
- *  Description: Allows the edition of math paragraphs inside Lyx. 
+/**
+ * \file formula.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
- *  Copyright: 1996, Alejandro Aguilar Sierra
+ * \author Alejandro Aguilar Sierra
+ * \author André Pönitz
  *
- *  Version: 0.4, Lyx project.
- *
- *   You are free to use and modify this code under the terms of
- *   the GNU General Public Licence version 2 or later.
+ * Full author contact details are available in file CREDITS.
  */
 
-#ifndef INSET_FORMULA_H 
+#ifndef INSET_FORMULA_H
 #define INSET_FORMULA_H
 
-#ifdef __GNUG__
-#pragma interface
-#endif
+#include "formulabase.h"
+#include "math_atom.h"
+
+#include <boost/scoped_ptr.hpp>
 
-#include "mathed/formulabase.h"
-#include "math_defs.h"
+class RenderPreview;
 
-class MathMatrixInset;
 
-///
+/// The main LyX math inset
 class InsetFormula : public InsetFormulaBase {
 public:
        ///
-       InsetFormula();
+       InsetFormula(bool chemistry = false);
        ///
-       explicit InsetFormula(MathInsetTypes);
+       explicit InsetFormula(BufferView *);
        ///
-       int ascent(BufferView *, LyXFont const &) const;
+       explicit InsetFormula(std::string const & data);
        ///
-       int descent(BufferView *, LyXFont const &) const;
+       InsetFormula(InsetFormula const &);
        ///
-       int width(BufferView *, LyXFont const &) const;
+       ~InsetFormula();
        ///
-       void draw(BufferView *, LyXFont const &, int, float &, bool) const;
+       void metrics(MetricsInfo & mi, Dimension & dim) const;
        ///
-       void write(Buffer const *, std::ostream &) const;
+       void draw(PainterInfo & pi, int x, int y) const;
+
        ///
-       void read(Buffer const *, LyXLex & lex);
+       void write(Buffer const &, std::ostream &) const;
        ///
-       int latex(Buffer const *, std::ostream &,
-                 bool fragile, bool free_spc) const;
+       void read(Buffer const &, LyXLex & lex);
        ///
-       int ascii(Buffer const *, std::ostream &, int linelen) const;
+       int latex(Buffer const &, std::ostream &,
+                 OutputParams const &) const;
        ///
-       int linuxdoc(Buffer const *, std::ostream &) const;
+       int plaintext(Buffer const &, std::ostream &,
+                 OutputParams const &) const;
        ///
-       int docBook(Buffer const *, std::ostream &) const;
+       int linuxdoc(Buffer const &, std::ostream &,
+                    OutputParams const &) const;
        ///
-       Inset * clone(Buffer const &) const;
+       int docbook(Buffer const &, std::ostream &,
+                   OutputParams const &) const;
+
+       ///
+       virtual std::auto_ptr<InsetBase> clone() const;
        ///
        void validate(LaTeXFeatures & features) const;
        ///
-       Inset::Code lyxCode() const;
+       InsetOld::Code lyxCode() const;
        ///
-       virtual RESULT localDispatch(BufferView *, kb_action, string const &);
+       bool insetAllowed(InsetOld::Code code) const;
+       /// Appends \c list with all labels found within this inset.
+       void getLabelList(Buffer const &,
+                         std::vector<std::string> & list) const;
        ///
-       std::vector<string> const getLabelList() const;
+       MathAtom const & par() const { return par_; }
        ///
-       void handleExtern(string const & arg, BufferView * bv);
+       MathAtom & par() { return par_; }
        ///
-       MathMatrixInset * par() const;
+       void generatePreview(Buffer const &) const;
        ///
-       bool display() const;
+       void addPreview(lyx::graphics::PreviewLoader &) const;
        ///
+       void mutate(std::string const & type);
+
+private:
+       /// Slot receiving a signal that the preview is ready to display.
+       void statusChanged() const;
+       /// available in AMS only?
        bool ams() const;
+
+       /// contents
+       MathAtom par_;
+
+       /// The pointer never changes although *preview_'s contents may.
+       boost::scoped_ptr<RenderPreview> const preview_;
 };
 #endif