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.
|
|
|
|
*
|
2000-03-09 03:36:48 +00:00
|
|
|
* Copyright: 1996, Alejandro Aguilar Sierra
|
1999-09-27 18:44:28 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
|
2000-03-28 02:18:55 +00:00
|
|
|
#include <iosfwd>
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
#include "insets/lyxinset.h"
|
2000-03-28 02:18:55 +00:00
|
|
|
|
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-04-04 00:19:15 +00:00
|
|
|
void Write(std::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-04-04 00:19:15 +00:00
|
|
|
int Latex(std::ostream &, signed char fragile, bool free_spc) const;
|
2000-03-06 02:42:40 +00:00
|
|
|
///
|
2000-04-04 00:19:15 +00:00
|
|
|
int Linuxdoc(std::ostream &) const;
|
2000-03-06 02:42:40 +00:00
|
|
|
///
|
2000-04-04 00:19:15 +00:00
|
|
|
int DocBook(std::ostream &) 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
|
2000-04-04 00:19:15 +00:00
|
|
|
char const * EditMessage() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-02-25 12:06:15 +00:00
|
|
|
void Edit(BufferView *, int x, int y, unsigned int button);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
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
|
|
|
///
|
2000-02-22 00:36:17 +00:00
|
|
|
void ToggleInsetCursor(BufferView *);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-02-22 00:36:17 +00:00
|
|
|
void ShowInsetCursor(BufferView *);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-02-22 00:36:17 +00:00
|
|
|
void HideInsetCursor(BufferView *);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-23 15:59:07 +00:00
|
|
|
void GetCursorPos(int &, int &) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-02-22 00:36:17 +00:00
|
|
|
void ToggleInsetSelection(BufferView * bv);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-02-22 00:36:17 +00:00
|
|
|
void InsetButtonPress(BufferView *, int x, int y, int button);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-02-22 00:36:17 +00:00
|
|
|
void InsetButtonRelease(BufferView *, int x, int y, int button);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-15 11:06:41 +00:00
|
|
|
void InsetKeyPress(XKeyEvent * ev);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-02-22 00:36:17 +00:00
|
|
|
void InsetMotionNotify(BufferView *, int x, int y, int state);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-02-22 00:36:17 +00:00
|
|
|
void InsetUnlock(BufferView *);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/// To allow transparent use of math editing functions
|
2000-02-25 13:35:38 +00:00
|
|
|
virtual RESULT LocalDispatch(BufferView *, int, string const &);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
///
|
2000-02-22 00:36:17 +00:00
|
|
|
void InsertSymbol(BufferView *, 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:
|
2000-02-22 00:36:17 +00:00
|
|
|
void UpdateLocal(BufferView * bv);
|
1999-11-15 11:06:41 +00:00
|
|
|
MathParInset * par;
|
2000-02-22 00:36:17 +00:00
|
|
|
static MathedCursor * mathcursor;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
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
|