1999-09-27 18:44:28 +00:00
|
|
|
// -*- 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.
|
|
|
|
*
|
|
|
|
* Copyright: (c) 1996, Alejandro Aguilar Sierra
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
1999-11-15 11:06:41 +00:00
|
|
|
#ifndef INSET_FORMULA_H
|
|
|
|
#define INSET_FORMULA_H
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "insets/lyxinset.h"
|
1999-12-07 00:44:53 +00:00
|
|
|
#include "support/LOstream.h"
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
class MathParInset;
|
|
|
|
class MathedCursor;
|
|
|
|
|
|
|
|
///
|
|
|
|
class InsetFormula: public UpdatableInset {
|
|
|
|
public:
|
|
|
|
///
|
1999-11-15 11:06:41 +00:00
|
|
|
InsetFormula(bool display = false);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-15 11:06:41 +00:00
|
|
|
InsetFormula(MathParInset *);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
~InsetFormula();
|
2000-02-10 17:53:36 +00:00
|
|
|
///
|
|
|
|
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;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-02-18 22:22:42 +00:00
|
|
|
void Write(ostream &) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-15 11:06:41 +00:00
|
|
|
void Read(LyXLex & lex);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-02-18 22:22:42 +00:00
|
|
|
int Latex(ostream &, signed char fragile) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-02-18 22:22:42 +00:00
|
|
|
int Latex(string & file, signed char fragile) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-02-18 22:22:42 +00:00
|
|
|
int Linuxdoc(string & file) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-02-18 22:22:42 +00:00
|
|
|
int DocBook(string & file) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
void Validate(LaTeXFeatures &) const;
|
|
|
|
///
|
1999-11-24 22:14:46 +00:00
|
|
|
Inset * Clone() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
Inset::Code LyxCode() const { return Inset::MATH_CODE; }
|
|
|
|
///
|
|
|
|
LyXFont ConvertFont(LyXFont font) {
|
|
|
|
// We have already discussed what was here
|
|
|
|
font.setLatex(LyXFont::OFF);
|
|
|
|
return font;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// what appears in the minibuffer when opening
|
1999-11-23 15:59:07 +00:00
|
|
|
char const * EditMessage() const {return _("Math editor mode");}
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
void Edit(int x, int y);
|
|
|
|
///
|
1999-11-22 16:19:48 +00:00
|
|
|
bool display() const { return (disp_flag) ? true: false; }
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-22 16:19:48 +00:00
|
|
|
void display(bool);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
void ToggleInsetCursor();
|
|
|
|
///
|
|
|
|
void ShowInsetCursor();
|
|
|
|
///
|
|
|
|
void HideInsetCursor();
|
|
|
|
///
|
1999-11-23 15:59:07 +00:00
|
|
|
void GetCursorPos(int &, int &) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
void ToggleInsetSelection();
|
|
|
|
///
|
|
|
|
void InsetButtonPress(int x, int y, int button);
|
|
|
|
///
|
|
|
|
void InsetButtonRelease(int x, int y, int button);
|
|
|
|
///
|
1999-11-15 11:06:41 +00:00
|
|
|
void InsetKeyPress(XKeyEvent * ev);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
void InsetMotionNotify(int x, int y, int state);
|
|
|
|
///
|
|
|
|
void InsetUnlock();
|
|
|
|
|
|
|
|
/// To allow transparent use of math editing functions
|
1999-11-15 11:06:41 +00:00
|
|
|
virtual bool LocalDispatch(int, char const *);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
///
|
1999-11-15 11:06:41 +00:00
|
|
|
void InsertSymbol(char const *);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
bool SetNumber(bool);
|
|
|
|
///
|
|
|
|
int GetNumberOfLabels() const;
|
|
|
|
///
|
1999-10-02 16:21:10 +00:00
|
|
|
string getLabel(int) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void UpdateLocal();
|
1999-11-15 11:06:41 +00:00
|
|
|
MathParInset * par;
|
1999-09-27 18:44:28 +00:00
|
|
|
static MathedCursor* mathcursor;
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool disp_flag;
|
1999-10-02 16:21:10 +00:00
|
|
|
string label;
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// If a mathinset exist at cursor pos, just lock it.
|
|
|
|
// Otherwise create a new one, and lock it.
|
|
|
|
bool OpenMathInset(Buffer *);
|
|
|
|
|
|
|
|
#endif
|