1999-09-27 18:44:28 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/*
|
|
|
|
* File: math_macro.h
|
|
|
|
* Purpose: Declaration of macro class for mathed
|
|
|
|
* Author: Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
|
|
|
|
* Created: November 1996
|
|
|
|
* Description: WYSIWYG math macros
|
|
|
|
*
|
|
|
|
* Dependencies: Mathed
|
|
|
|
*
|
2000-03-09 03:36:48 +00:00
|
|
|
* Copyright: 1996, 1997 Alejandro Aguilar Sierra
|
1999-09-27 18:44:28 +00:00
|
|
|
*
|
|
|
|
* Version: 0.2, Mathed & Lyx project.
|
|
|
|
*
|
|
|
|
* This code is under the GNU General Public Licence version 2 or later.
|
|
|
|
*/
|
1999-10-07 18:44:17 +00:00
|
|
|
#ifndef MATH_MACRO
|
|
|
|
#define MATH_MACRO
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
2001-02-13 13:28:32 +00:00
|
|
|
#include <vector>
|
|
|
|
#include "math_parinset.h"
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
class MathMacroTemplate;
|
|
|
|
|
|
|
|
|
2001-02-16 09:25:43 +00:00
|
|
|
/** This class contains the data for a macro
|
|
|
|
\author Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
|
|
|
|
\version November 1996
|
|
|
|
*/
|
1999-12-07 00:44:53 +00:00
|
|
|
class MathMacro : public MathParInset
|
1999-09-27 18:44:28 +00:00
|
|
|
{
|
2000-03-07 01:14:37 +00:00
|
|
|
public:
|
2001-02-13 17:08:51 +00:00
|
|
|
/// A macro can only be builded from an existing template
|
|
|
|
explicit
|
|
|
|
MathMacro(MathMacroTemplate *);
|
|
|
|
/// or from another macro.
|
|
|
|
explicit
|
|
|
|
MathMacro(MathMacro *);
|
|
|
|
///
|
|
|
|
~MathMacro();
|
|
|
|
///
|
|
|
|
void draw(Painter &, int, int);
|
|
|
|
///
|
|
|
|
void Metrics();
|
|
|
|
///
|
|
|
|
MathedInset * Clone();
|
|
|
|
///
|
|
|
|
void Write(std::ostream &, bool fragile);
|
|
|
|
///
|
|
|
|
bool setArgumentIdx(int);
|
|
|
|
///
|
|
|
|
int getArgumentIdx() const;
|
|
|
|
///
|
|
|
|
int getMaxArgumentIdx() const;
|
|
|
|
///
|
|
|
|
int GetColumns() const;
|
|
|
|
///
|
|
|
|
void GetXY(int &, int &) const;
|
|
|
|
///
|
|
|
|
void SetFocus(int, int);
|
|
|
|
///
|
|
|
|
MathedArray * GetData();
|
|
|
|
///
|
|
|
|
MathedRowSt * getRowSt() const;
|
|
|
|
///
|
2001-02-16 09:25:43 +00:00
|
|
|
void setData(MathedArray *);
|
2001-02-13 17:08:51 +00:00
|
|
|
///
|
|
|
|
MathedTextCodes getTCode() const;
|
|
|
|
///
|
|
|
|
bool Permit(short) const;
|
2000-03-07 01:14:37 +00:00
|
|
|
private:
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-02-15 12:22:01 +00:00
|
|
|
MathMacroTemplate * tmplate_;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-02-13 17:08:51 +00:00
|
|
|
struct MacroArgumentBase {
|
|
|
|
/// Position of the macro
|
2001-02-13 19:10:18 +00:00
|
|
|
int x;
|
|
|
|
///
|
|
|
|
int y;
|
2001-02-13 17:08:51 +00:00
|
|
|
///
|
|
|
|
MathedRowSt * row;
|
|
|
|
///
|
2001-02-20 10:49:48 +00:00
|
|
|
MathedArray array;
|
2001-02-13 17:08:51 +00:00
|
|
|
///
|
2001-02-15 12:22:01 +00:00
|
|
|
MacroArgumentBase()
|
2001-02-20 10:49:48 +00:00
|
|
|
: x(0), y(0), row(0)
|
2001-02-15 12:22:01 +00:00
|
|
|
{}
|
2001-02-13 17:08:51 +00:00
|
|
|
};
|
|
|
|
std::vector<MacroArgumentBase> args_;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-02-15 12:22:01 +00:00
|
|
|
int idx_;
|
2001-02-13 17:08:51 +00:00
|
|
|
///
|
2001-02-15 12:22:01 +00:00
|
|
|
int nargs_;
|
2001-02-13 17:08:51 +00:00
|
|
|
///
|
2001-02-15 12:22:01 +00:00
|
|
|
MathedTextCodes tcode_;
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
|
|
|
#endif
|