]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/formulabase.h
architectural changes to tex2lyx
[lyx.git] / src / mathed / formulabase.h
index f40a261f4aef834f62b87248b5436358075d93b1..2699af0ffa2dc2f6eb519f6389b6410f51cc5acd 100644 (file)
 #ifndef INSET_FORMULABASE_H
 #define INSET_FORMULABASE_H
 
-#ifdef __GNUG__
-#pragma interface
-#endif
-
-#include "insets/inset.h"
-#include "frontends/mouse_state.h"
-#include "lyxfont.h"
+#include "insets/updatableinset.h"
+#include "dimension.h"
 
 #include <boost/weak_ptr.hpp>
 #include <iosfwd>
@@ -28,19 +23,12 @@ class Buffer;
 class BufferView;
 class MathAtom;
 
+
 /// An abstract base class for all math related LyX insets
 class InsetFormulaBase : public UpdatableInset {
 public:
        ///
        InsetFormulaBase();
-       ///
-       virtual int ascent(BufferView *, LyXFont const &) const = 0;
-       ///
-       virtual int descent(BufferView *, LyXFont const &) const = 0;
-       ///
-       virtual int width(BufferView *, LyXFont const &) const = 0;
-       ///
-       virtual void draw(BufferView *,LyXFont const &, int, float &, bool) const = 0;
        /// lowest x coordinate
        virtual int xlow() const;
        /// highest x coordinate
@@ -52,47 +40,36 @@ public:
 
 public:
        ///
+       // Don't use this for AMS validation as long as there is no
+       // user-accessible way to override "false positives"
        virtual void validate(LaTeXFeatures &) const;
        ///
-       virtual Inset * clone(Buffer const &, bool same_id = false) const = 0;
-       ///
-       virtual Inset::Code lyxCode() const;
+       virtual InsetOld::Code lyxCode() const;
        /// what appears in the minibuffer when opening
        virtual string const editMessage() const;
        ///
-       virtual void edit(BufferView *, int x, int y, mouse_button::state button);
-       ///
-       virtual void edit(BufferView *, bool front = true);
-       ///
-       virtual void toggleInsetCursor(BufferView *);
-       ///
-       virtual void showInsetCursor(BufferView *, bool show = true);
-       ///
-       virtual void hideInsetCursor(BufferView *);
-       ///
        virtual void fitInsetCursor(BufferView *) const;
-       ///
+       /// FIXME
        virtual void getCursorPos(BufferView *, int &, int &) const;
+       /// get the absolute document x,y of the cursor
+       virtual void getCursor(BufferView & bv, int & x, int & y) const;
        ///
        virtual void toggleInsetSelection(BufferView * bv);
        ///
        virtual void insetUnlock(BufferView *);
 
        /// To allow transparent use of math editing functions
-       virtual RESULT localDispatch(FuncRequest const &);
+       virtual dispatch_result localDispatch(FuncRequest const &);
        /// To allow transparent use of math editing functions
        //virtual void status(FuncRequest const &);
 
-       ///
-       virtual std::vector<string> const getLabelList() const;
        ///
        virtual MathAtom const & par() const = 0;
        ///
        virtual MathAtom & par() = 0;
        ///
-       virtual void updateLocal(BufferView * bv, bool mark_dirty);
-       ///
-       BufferView * view() const { return view_.get(); }
+       // And shouldn't this really return a shared_ptr<BufferView> instead?
+       BufferView * view() const;
 
        ///
        virtual bool searchForward(BufferView *, string const &,
@@ -119,23 +96,18 @@ private:
        /// common base for handling accents
        void handleAccent(BufferView * bv, string const & arg, string const & name);
        /// lfun handler
-       RESULT lfunMousePress(FuncRequest const &);
+       dispatch_result lfunMousePress(FuncRequest const &);
        ///
-       RESULT lfunMouseRelease(FuncRequest const &);
+       dispatch_result lfunMouseRelease(FuncRequest const &);
        ///
-       RESULT lfunMouseMotion(FuncRequest const &);
+       dispatch_result lfunMouseMotion(FuncRequest const &);
 
 protected:
        ///
-       mutable boost::weak_ptr<BufferView> view_;
-       ///
-       mutable LyXFont font_;
+       //mutable boost::weak_ptr<BufferView> view_;
+       mutable BufferView * view_;
 
 protected:
-       ///
-       void metrics(BufferView * bv, LyXFont const & font) const;
-       ///
-       void metrics(BufferView * bv = 0) const;
        ///
        void handleFont(BufferView * bv, string const & arg, string const & font);