]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/formula.h
redo undo
[lyx.git] / src / mathed / formula.h
index a0bd20b8c521643779c53fbff9976eab1e1af7be..2c79e230a378003b8abca08048ee73f729092c1d 100644 (file)
 // -*- 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: (c) 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 "insets/lyxinset.h"
-#include "support/LOstream.h"
+#include "math_hullinset.h"
 
-class MathParInset;
-class MathedCursor;
 
-///
-class InsetFormula: public UpdatableInset {
+/// The main LyX math inset
+class InsetFormula : public MathHullInset {
 public:
        ///
-       InsetFormula(bool display = false);
-       ///
-       InsetFormula(MathParInset *);
-       ///
-       ~InsetFormula();
-       ///
-       int ascent(Painter &, LyXFont const &) const;
-       ///
-       int descent(Painter &, LyXFont const &) const;
-       ///
-       int width(Painter &, LyXFont const &) const;
-       ///
-       void draw(Painter &, LyXFont const &, int baseline, float & x) const;
-       ///
-       void Write(ostream &);
-       ///
-       void Read(LyXLex & lex);
-       ///
-       int Latex(ostream &, signed char fragile);
-       ///
-       int Latex(string & file, signed char fragile);
-       ///
-       int Linuxdoc(string & file);
-       ///
-       int DocBook(string & file);
-       ///
-       void Validate(LaTeXFeatures &) const;
-       ///
-       Inset * Clone() const;
-       ///
-       Inset::Code LyxCode() const { return Inset::MATH_CODE; }
+       std::auto_ptr<InsetBase> clone() const;
        ///
-       LyXFont ConvertFont(LyXFont font) {
-               // We have already discussed what was here
-               font.setLatex(LyXFont::OFF);
-               return font;
-       }
-
-       /// what appears in the minibuffer when opening
-       char const * EditMessage() const {return _("Math editor mode");}
-       ///
-       void Edit(int x, int y);
-       ///
-       bool display() const { return (disp_flag) ? true: false; }
-       ///
-       void display(bool);
-       ///
-       void ToggleInsetCursor();
-       ///
-       void ShowInsetCursor();
-       ///
-       void HideInsetCursor();
-       ///
-       void GetCursorPos(int &, int &) const;
-       ///
-       void ToggleInsetSelection();
+       void write(Buffer const & buf, std::ostream & os) const;
        ///
-       void InsetButtonPress(int x, int y, int button);
-       ///
-       void InsetButtonRelease(int x, int y, int button);
-       ///
-       void InsetKeyPress(XKeyEvent * ev);
-       ///
-       void InsetMotionNotify(int x, int y, int state);
-       ///
-       void InsetUnlock();
-   
-       ///  To allow transparent use of math editing functions
-       virtual bool LocalDispatch(int, char const *);
-    
-       ///
-       void InsertSymbol(char const *);
-       ///
-       bool SetNumber(bool);
-       ///
-       int GetNumberOfLabels() const;
-       ///
-       string getLabel(int) const;
-   
-protected:
-       void UpdateLocal();
-       MathParInset * par;
-       static MathedCursor* mathcursor;
-    
-private:
-       bool disp_flag;
-       string label;
+       void read(Buffer const & buf, LyXLex & lex);
 };
 
-
-// If a mathinset exist at cursor pos, just lock it.
-// Otherwise create a new one, and lock it.
-bool OpenMathInset(Buffer *);
+// We don't really want to mess around with mathed stuff outside mathed.
+// So do it here.
+void mathDispatch(LCursor & cur, FuncRequest const & cmd);
 
 #endif