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"
|
2001-04-24 16:13:38 +00:00
|
|
|
#include <boost/smart_ptr.hpp>
|
2000-03-28 02:18:55 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
class MathParInset;
|
2000-05-15 14:49:36 +00:00
|
|
|
class Buffer;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
///
|
|
|
|
class InsetFormula: public UpdatableInset {
|
|
|
|
public:
|
|
|
|
///
|
2000-04-08 17:02:02 +00:00
|
|
|
explicit
|
1999-11-15 11:06:41 +00:00
|
|
|
InsetFormula(bool display = false);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-04-08 17:02:02 +00:00
|
|
|
explicit
|
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
|
|
|
///
|
2000-07-05 14:57:48 +00:00
|
|
|
int ascent(BufferView *, LyXFont const &) const;
|
2000-02-10 17:53:36 +00:00
|
|
|
///
|
2000-07-05 14:57:48 +00:00
|
|
|
int descent(BufferView *, LyXFont const &) const;
|
2000-02-10 17:53:36 +00:00
|
|
|
///
|
2000-07-05 14:57:48 +00:00
|
|
|
int width(BufferView *, LyXFont const &) const;
|
2000-02-10 17:53:36 +00:00
|
|
|
///
|
2000-06-23 15:02:46 +00:00
|
|
|
void draw(BufferView *,LyXFont const &, int, float &, bool) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-06-12 11:27:15 +00:00
|
|
|
void Write(Buffer const *, std::ostream &) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-06-12 11:27:15 +00:00
|
|
|
void Read(Buffer const *, LyXLex & lex);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-07-15 23:51:46 +00:00
|
|
|
int Latex(Buffer const *, std::ostream &,
|
|
|
|
bool fragile, bool free_spc) const;
|
2000-03-06 02:42:40 +00:00
|
|
|
///
|
2000-09-26 15:25:14 +00:00
|
|
|
int Ascii(Buffer const *, std::ostream &, int linelen) const;
|
2000-04-24 20:58:23 +00:00
|
|
|
///
|
2000-06-12 11:27:15 +00:00
|
|
|
int Linuxdoc(Buffer const *, std::ostream &) const;
|
2000-03-06 02:42:40 +00:00
|
|
|
///
|
2000-06-12 11:27:15 +00:00
|
|
|
int DocBook(Buffer const *, std::ostream &) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
void Validate(LaTeXFeatures &) const;
|
|
|
|
///
|
2000-10-10 11:50:43 +00:00
|
|
|
Inset * Clone(Buffer const &) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-02-28 17:21:16 +00:00
|
|
|
Inset::Code LyxCode() const;
|
|
|
|
///
|
|
|
|
LyXFont const ConvertFont(LyXFont const & f) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
/// what appears in the minibuffer when opening
|
2000-09-14 17:53:12 +00:00
|
|
|
string 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
|
|
|
///
|
2001-02-28 17:21:16 +00:00
|
|
|
bool display() const;
|
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
|
|
|
///
|
2001-02-28 17:21:16 +00:00
|
|
|
void ShowInsetCursor(BufferView *, bool show = true);
|
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
|
|
|
///
|
2000-06-22 09:30:43 +00:00
|
|
|
void GetCursorPos(BufferView *, 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
|
2001-02-23 16:10:03 +00:00
|
|
|
virtual RESULT LocalDispatch(BufferView *, kb_action, string const &);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
///
|
2000-09-14 17:53:12 +00:00
|
|
|
void InsertSymbol(BufferView *, string const &);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
bool SetNumber(bool);
|
|
|
|
///
|
2000-09-14 17:53:12 +00:00
|
|
|
std::vector<string> const getLabelList() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
protected:
|
2000-07-15 23:51:46 +00:00
|
|
|
///
|
2000-02-22 00:36:17 +00:00
|
|
|
void UpdateLocal(BufferView * bv);
|
2000-07-15 23:51:46 +00:00
|
|
|
///
|
2001-04-24 16:13:38 +00:00
|
|
|
//boost::shared_ptr<MathParInset> par;
|
|
|
|
MathParInset * par;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
private:
|
2000-07-15 23:51:46 +00:00
|
|
|
///
|
2001-02-28 17:21:16 +00:00
|
|
|
bool disp_flag_;
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
2001-02-28 17:21:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
inline
|
|
|
|
Inset::Code InsetFormula::LyxCode() const
|
|
|
|
{
|
|
|
|
return Inset::MATH_CODE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline
|
|
|
|
LyXFont const InsetFormula::ConvertFont(LyXFont const & f) const
|
|
|
|
{
|
|
|
|
// We have already discussed what was here
|
|
|
|
LyXFont font(f);
|
|
|
|
font.setLatex(LyXFont::OFF);
|
|
|
|
return font;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline
|
|
|
|
bool InsetFormula::display() const
|
|
|
|
{
|
2001-04-24 16:13:38 +00:00
|
|
|
return disp_flag_;
|
2001-02-28 17:21:16 +00:00
|
|
|
}
|
1999-09-27 18:44:28 +00:00
|
|
|
#endif
|