]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_inset.h
fix #1073
[lyx.git] / src / mathed / math_inset.h
index 823faf515fb265cdefe3bb7acce46b8f853eac39..2bd1a232330fc5fb0d8be22a503b3805e9b37116 100644 (file)
 #ifndef MATH_INSET_H
 #define MATH_INSET_H
 
-#ifdef __GNUG__
-#pragma interface
-#endif
 
 #include <config.h>
 
 #include "LString.h"
 #include "frontends/mouse_state.h"
+#include "insets/insetbase.h"
 #include "math_data.h"
 
 /**
@@ -64,7 +62,7 @@ class MathSpaceInset;
 class MathSymbolInset;
 class MathUnknownInset;
 
-class InsetRef;
+class RefInset;
 
 class NormalStream;
 class OctaveStream;
@@ -85,7 +83,7 @@ class Dimension;
 class FuncRequest;
 
 
-class MathInset {
+class MathInset : public InsetBase {
 public:
        /// short of anything else reasonable
        typedef MathArray::size_type        size_type;
@@ -102,8 +100,6 @@ public:
 
        /// our members behave nicely...
        MathInset() {}
-       /// the virtual base destructor
-       virtual ~MathInset() {}
 
        /// reproduce itself
        virtual MathInset * clone() const = 0;
@@ -111,11 +107,11 @@ public:
        virtual void substitute(MathMacro const & macro);
        /// compute the size of the object, sets ascend_, descend_ and width_
        // updates the (xo,yo)-caches of all contained cells
-       virtual void metrics(MathMetricsInfo & mi) const;
+       virtual void metrics(MetricsInfo & mi) const;
        /// draw the object
-       virtual void draw(MathPainterInfo & pi, int x, int y) const;
+       virtual void draw(PainterInfo & pi, int x, int y) const;
        /// draw selection between two positions
-       virtual void drawSelection(MathPainterInfo & pi,
+       virtual void drawSelection(PainterInfo & pi,
                idx_type idx1, pos_type pos1, idx_type idx2, pos_type pos2) const;
        /// the ascent of the inset above the baseline
        /// compute the size of the object for text based drawing
@@ -136,6 +132,9 @@ public:
        /// Where should we go when we press the up or down cursor key?
        virtual bool idxUpDown(idx_type & idx, pos_type & pos, bool up,
                int targetx) const;
+       /// Where should we go when we press the up or down cursor key?
+       virtual bool idxUpDown2(idx_type & idx, pos_type & pos, bool up,
+               int targetx) const;
        /// The left key
        virtual bool idxLeft(idx_type & idx, pos_type & pos) const;
        /// The right key
@@ -222,7 +221,7 @@ public:
        virtual MathSymbolInset const   * asSymbolInset() const   { return 0; }
        virtual MathUnknownInset        * asUnknownInset()        { return 0; }
        virtual MathUnknownInset const  * asUnknownInset() const  { return 0; }
-       virtual InsetRef                * asInsetRef()            { return 0; }
+       virtual RefInset                * asRefInset()            { return 0; }
 
        /// identifies things that can get scripts
        virtual bool isScriptable() const { return false; }
@@ -232,12 +231,6 @@ public:
        virtual bool isRelOp() const { return false; }
        /// -1: text mode, 1: math mode, 0 undecided
        enum mode_type {UNDECIDED_MODE, TEXT_MODE, MATH_MODE};
-       /// Dispatch result codes, see inset/inset.h
-       enum result_type {
-               UNDISPATCHED = 0, DISPATCHED, DISPATCHED_NOUPDATE,
-               FINISHED, FINISHED_RIGHT, FINISHED_UP, FINISHED_DOWN,
-               DISPATCHED_POP
-       };
 
        virtual mode_type currentMode() const { return UNDECIDED_MODE; }
        /// will this get written as a single block in {..}
@@ -273,17 +266,19 @@ public:
        /// write normalized content
        virtual void normalize(NormalStream &) const;
        /// write content as something readable by Maple
-       virtual void maplize(MapleStream &) const;
+       virtual void maple(MapleStream &) const;
        /// write content as something readable by Maxima
-       virtual void maximize(MaximaStream &) const;
+       virtual void maxima(MaximaStream &) const;
        /// write content as something readable by Mathematica
-       virtual void mathematicize(MathematicaStream &) const;
+       virtual void mathematica(MathematicaStream &) const;
        /// write content as something resembling MathML
        virtual void mathmlize(MathMLStream &) const;
        /// write content as something readable by Octave
-       virtual void octavize(OctaveStream &) const;
-       /// describe content
+       virtual void octave(OctaveStream &) const;
+       /// describe content if cursor inside
        virtual void infoize(std::ostream &) const {}
+       /// describe content if cursor behind
+       virtual void infoize2(std::ostream &) const {}
        /// plain ascii output
        virtual int ascii(std::ostream & os, int) const;
        /// linuxdoc output
@@ -293,9 +288,6 @@ public:
 
        /// dump content to stderr for debugging
        virtual void dump() const;
-       /// local dispatcher
-       virtual result_type dispatch
-               (FuncRequest const & cmd, idx_type & idx, pos_type & pos);
 
        /// LyXInset stuff
        /// write labels into a list
@@ -310,6 +302,10 @@ public:
        virtual string fileInsetLabel() const { return "Formula"; }
        /// usually the latex name
        virtual string name() const;
+
+protected:
+       /// a dirty hack
+       BufferView * view() const;
 };
 
 std::ostream & operator<<(std::ostream &, MathAtom const &);
@@ -322,8 +318,4 @@ MathArray asArray(string const & str);
 // initialize math
 void initMath();
 
-/// here to ssave a few includes in the insets
-class Dialogs;
-Dialogs & getDialogs();
-
 #endif