1999-09-27 18:44:28 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/*
|
|
|
|
* File: math_cursor.h
|
|
|
|
* Purpose: Declaration of interaction classes for mathed
|
|
|
|
* Author: Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
|
|
|
|
* Created: January 1996
|
|
|
|
* Description: MathCursor control all user interaction
|
|
|
|
*
|
|
|
|
* Dependencies: Xlib, XForms
|
|
|
|
*
|
2000-03-09 03:36:48 +00:00
|
|
|
* Copyright: 1996, Alejandro Aguilar Sierra
|
1999-09-27 18:44:28 +00:00
|
|
|
*
|
|
|
|
* Version: 0.8beta, Mathed & 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 MATH_CURSOR
|
|
|
|
#define MATH_CURSOR
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
2001-02-13 13:28:32 +00:00
|
|
|
#include "math_xiter.h"
|
|
|
|
|
|
|
|
class MathFuncInset;
|
2001-02-13 19:10:18 +00:00
|
|
|
class MathParInset;
|
|
|
|
class Painter;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
/// This is the external interface of Mathed's subkernel
|
|
|
|
class MathedCursor {
|
2001-02-13 13:28:32 +00:00
|
|
|
public:
|
|
|
|
///
|
|
|
|
explicit
|
|
|
|
MathedCursor(MathParInset * p);
|
|
|
|
///
|
|
|
|
void Insert(byte, MathedTextCodes t = LM_TC_MIN);
|
|
|
|
///
|
|
|
|
void Insert(MathedInset *, int t = LM_TC_INSET);
|
|
|
|
///
|
|
|
|
void Home();
|
|
|
|
///
|
|
|
|
void End();
|
|
|
|
///
|
|
|
|
bool Right(bool sel = false);
|
|
|
|
///
|
|
|
|
bool Left(bool sel = false);
|
|
|
|
///
|
|
|
|
bool Up(bool sel = false);
|
|
|
|
///
|
|
|
|
bool Down(bool sel = false);
|
|
|
|
///
|
|
|
|
bool Pop();
|
|
|
|
///
|
|
|
|
bool Push();
|
|
|
|
/// Pull out an argument from its container inset
|
|
|
|
bool pullArg();
|
|
|
|
///
|
|
|
|
void draw(Painter &, int x, int y);
|
|
|
|
///
|
|
|
|
void Redraw(Painter &);
|
|
|
|
///
|
|
|
|
void Delete();
|
|
|
|
///
|
|
|
|
void DelLine();
|
|
|
|
///
|
|
|
|
void SetPos(int, int);
|
|
|
|
///
|
2001-02-13 19:10:18 +00:00
|
|
|
void GetPos(int & x, int & y);
|
2001-02-13 13:28:32 +00:00
|
|
|
///
|
2001-02-13 19:10:18 +00:00
|
|
|
short GetFCode();
|
2001-02-13 13:28:32 +00:00
|
|
|
///
|
2001-02-13 19:10:18 +00:00
|
|
|
MathParInset * GetPar();
|
2001-02-13 13:28:32 +00:00
|
|
|
///
|
2001-02-13 19:10:18 +00:00
|
|
|
MathParInset * getCurrentPar() const;
|
2001-02-13 13:28:32 +00:00
|
|
|
///
|
|
|
|
void SetPar(MathParInset *);
|
|
|
|
///
|
|
|
|
void Interpret(string const &);
|
|
|
|
///
|
|
|
|
void SetSize(short);
|
|
|
|
///
|
|
|
|
void setNumbered();
|
|
|
|
///
|
|
|
|
void setLabel(string const &);
|
|
|
|
///
|
2001-02-13 19:10:18 +00:00
|
|
|
string const & getLabel() const;
|
2001-02-13 13:28:32 +00:00
|
|
|
///
|
|
|
|
bool Limits();
|
|
|
|
/// Set accent: if argument = 0 it's considered consumed
|
|
|
|
void setAccent(int ac = 0);
|
|
|
|
/// Returns last accent
|
|
|
|
int getAccent() const;
|
|
|
|
///
|
2001-02-13 19:10:18 +00:00
|
|
|
bool IsEnd() const;
|
2001-02-13 13:28:32 +00:00
|
|
|
// Macro mode methods
|
|
|
|
///
|
|
|
|
void MacroModeOpen();
|
|
|
|
///
|
|
|
|
void MacroModeClose();
|
|
|
|
///
|
2001-02-13 19:10:18 +00:00
|
|
|
bool InMacroMode();
|
2001-02-13 13:28:32 +00:00
|
|
|
|
|
|
|
// Local selection methods
|
|
|
|
///
|
2001-02-13 19:10:18 +00:00
|
|
|
bool Selection();
|
2001-02-13 13:28:32 +00:00
|
|
|
///
|
|
|
|
void SelCopy();
|
|
|
|
///
|
|
|
|
void SelCut();
|
|
|
|
///
|
|
|
|
void SelDel();
|
|
|
|
///
|
|
|
|
void SelPaste();
|
|
|
|
///
|
|
|
|
void SelStart();
|
|
|
|
///
|
|
|
|
void SelClear();
|
|
|
|
///
|
|
|
|
void SelBalance();
|
|
|
|
///
|
|
|
|
void SelGetArea(int ** xp, int ** yp, int & n);
|
|
|
|
///
|
2001-02-13 19:10:18 +00:00
|
|
|
void clearLastCode();
|
2001-02-13 13:28:32 +00:00
|
|
|
///
|
2001-02-13 19:10:18 +00:00
|
|
|
void setLastCode(MathedTextCodes t);
|
2001-02-13 13:28:32 +00:00
|
|
|
///
|
|
|
|
void toggleLastCode(MathedTextCodes t);
|
|
|
|
///
|
2001-02-13 19:10:18 +00:00
|
|
|
MathedTextCodes getLastCode() const;
|
2001-02-13 13:28:32 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
///
|
|
|
|
bool macro_mode;
|
|
|
|
|
|
|
|
// Selection stuff
|
|
|
|
///
|
|
|
|
bool selection;
|
|
|
|
///
|
|
|
|
int selpos;
|
|
|
|
///
|
|
|
|
MathedXIter cursel;
|
|
|
|
///
|
|
|
|
MathedXIter * anchor;
|
|
|
|
///
|
|
|
|
MathParInset * par;
|
|
|
|
///
|
|
|
|
MathedXIter * cursor;
|
|
|
|
///
|
|
|
|
void doAccent(byte c, MathedTextCodes t);
|
|
|
|
///
|
|
|
|
void doAccent(MathedInset * p);
|
|
|
|
///
|
|
|
|
int accent;
|
|
|
|
///
|
|
|
|
int nestaccent[8];
|
|
|
|
///
|
|
|
|
MathedTextCodes lastcode;
|
|
|
|
|
|
|
|
private:
|
|
|
|
///
|
|
|
|
MathFuncInset * imacro;
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|