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>
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2001-02-13 13:28:32 +00:00
|
|
|
#include "math_parinset.h"
|
|
|
|
#include "debug.h"
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
class MathMacroTemplate;
|
|
|
|
|
|
|
|
|
|
|
|
/// This class contains the data for a macro
|
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;
|
|
|
|
///
|
|
|
|
void SetData(MathedArray *);
|
|
|
|
///
|
|
|
|
MathedTextCodes getTCode() const;
|
|
|
|
///
|
|
|
|
bool Permit(short) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2000-03-07 01:14:37 +00:00
|
|
|
private:
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-02-13 17:08:51 +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
|
|
|
|
int x, y;
|
|
|
|
///
|
|
|
|
MathedRowSt * row;
|
|
|
|
///
|
|
|
|
MathedArray * array;
|
|
|
|
///
|
|
|
|
MacroArgumentBase() { x = y = 0; array = 0; row = 0; }
|
|
|
|
};
|
|
|
|
std::vector<MacroArgumentBase> args_;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-02-13 17:08:51 +00:00
|
|
|
int idx;
|
|
|
|
///
|
|
|
|
int nargs;
|
|
|
|
///
|
|
|
|
MathedTextCodes tcode;
|
|
|
|
///
|
|
|
|
friend class MathMacroTemplate;
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
///
|
2001-02-13 17:08:51 +00:00
|
|
|
//typedef MathMacro * MathMacroP;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-02-13 17:08:51 +00:00
|
|
|
//typedef MathMacroTemplate * MathMacroTemplateP;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
#endif
|