]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_macro.h
Andreas' patch to prevent crash on click on previewd inset
[lyx.git] / src / mathed / math_macro.h
index a1637a7607de4447a88cadbccd060dfc72c12128..2a3637578f4bf3f26b8b86ea8080d0de97065441 100644 (file)
 
 #include "math_nestinset.h"
 #include "math_data.h"
+#include "math_nestinset.h"
+#include "math_macrotable.h"
 
 
 /// This class contains the data for a macro.
-class MathMacro : public MathDimInset {
+class MathMacro : public MathNestInset {
 public:
        /// A macro can be built from an existing template
-       explicit MathMacro(std::string const &);
-       ///
-       std::auto_ptr<InsetBase> clone() const;
-       ///
-       MathMacro * asMacro() { return this; }
-       ///
-       MathMacro const * asMacro() const { return this; }
+       MathMacro(std::string const & name, int numargs);
        ///
        void draw(PainterInfo & pi, int x, int y) const;
        ///
@@ -35,10 +31,6 @@ public:
        ///
        void metrics(MetricsInfo & mi, Dimension & dim) const;
        ///
-       void metricsExpanded(MetricsInfo & mi, Dimension & dim) const;
-       ///
-       int widthExpanded() const;
-       ///
        std::string name() const;
        ///
        void setExpansion(MathArray const & exp, MathArray const & args) const;
@@ -58,15 +50,18 @@ public:
        void infoize2(std::ostream &) const;
 
 private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
        ///
        void updateExpansion() const;
-
        ///
+       void expand() const;
+
+       /// name of macro
        std::string name_;
-       ///
+       /// the unexpanded macro defintition
+       mutable MathArray tmpl_;
+       /// the matcro substituted with our args
        mutable MathArray expanded_;
-       ///
-       mutable MathArray args_;
 };