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
|
|
|
|
|
|
|
|
#include "math_iter.h"
|
|
|
|
#include "math_inset.h"
|
|
|
|
|
|
|
|
|
|
|
|
/// This is the external interface of Mathed's subkernel
|
|
|
|
class MathedCursor {
|
|
|
|
public:
|
|
|
|
///
|
2000-07-04 19:16:35 +00:00
|
|
|
explicit
|
1999-11-15 11:06:41 +00:00
|
|
|
MathedCursor(MathParInset * p);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-15 11:06:41 +00:00
|
|
|
void Insert(byte, MathedTextCodes t = LM_TC_MIN);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-02-10 17:53:36 +00:00
|
|
|
void Insert(MathedInset *, int t = LM_TC_INSET);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
void Home();
|
|
|
|
///
|
|
|
|
void End();
|
|
|
|
///
|
1999-11-15 11:06:41 +00:00
|
|
|
bool Right(bool sel = false);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-15 11:06:41 +00:00
|
|
|
bool Left(bool sel = false);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-15 11:06:41 +00:00
|
|
|
bool Up(bool sel = false);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-15 11:06:41 +00:00
|
|
|
bool Down(bool sel = false);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
bool Pop();
|
|
|
|
///
|
|
|
|
bool Push();
|
|
|
|
/// Pull out an argument from its container inset
|
|
|
|
bool pullArg();
|
2000-02-10 17:53:36 +00:00
|
|
|
///
|
|
|
|
void draw(Painter &, int x, int y);
|
|
|
|
///
|
|
|
|
void Redraw(Painter &);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
void Delete();
|
|
|
|
///
|
|
|
|
void DelLine();
|
|
|
|
///
|
|
|
|
void SetPos(int, int);
|
|
|
|
///
|
1999-11-15 11:06:41 +00:00
|
|
|
void GetPos(int & x, int & y) { cursor->GetPos(x, y); }
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
short GetFCode() { return cursor->FCode(); }
|
|
|
|
///
|
1999-11-15 11:06:41 +00:00
|
|
|
MathParInset * GetPar() { return par; }
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-15 11:06:41 +00:00
|
|
|
MathParInset * getCurrentPar() const { return cursor->p; }
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-15 11:06:41 +00:00
|
|
|
void SetPar(MathParInset *);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-09-14 17:53:12 +00:00
|
|
|
void Interpret(string const &);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
void SetSize(short);
|
|
|
|
///
|
|
|
|
void setNumbered();
|
2000-09-14 17:53:12 +00:00
|
|
|
///
|
|
|
|
void setLabel(string const &);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
bool Limits();
|
1999-11-15 11:06:41 +00:00
|
|
|
/// Set accent: if argument = 0 it's considered consumed
|
|
|
|
void setAccent(int ac = 0);
|
1999-09-27 18:44:28 +00:00
|
|
|
/// Returns last accent
|
|
|
|
int getAccent() const;
|
|
|
|
///
|
|
|
|
bool IsEnd() const { return !cursor->OK(); }
|
|
|
|
// Macro mode methods
|
|
|
|
///
|
|
|
|
void MacroModeOpen();
|
|
|
|
///
|
|
|
|
void MacroModeClose();
|
|
|
|
///
|
|
|
|
bool InMacroMode() { return macro_mode; }
|
|
|
|
|
|
|
|
// Local selection methods
|
|
|
|
///
|
|
|
|
bool Selection() { return selection; }
|
|
|
|
///
|
|
|
|
void SelCopy();
|
|
|
|
///
|
|
|
|
void SelCut();
|
|
|
|
///
|
|
|
|
void SelDel();
|
|
|
|
///
|
|
|
|
void SelPaste();
|
|
|
|
///
|
|
|
|
void SelStart();
|
|
|
|
///
|
|
|
|
void SelClear();
|
|
|
|
///
|
2000-02-10 17:53:36 +00:00
|
|
|
void SelBalance();
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-02-17 19:59:08 +00:00
|
|
|
void SelGetArea(int ** xp, int ** yp, int & n);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
void clearLastCode() { lastcode = LM_TC_MIN; }
|
|
|
|
///
|
|
|
|
void setLastCode(MathedTextCodes t) { lastcode = t; }
|
|
|
|
///
|
|
|
|
MathedTextCodes getLastCode() const { return lastcode; }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
///
|
|
|
|
bool macro_mode;
|
|
|
|
///
|
|
|
|
void MacroModeBack();
|
|
|
|
///
|
|
|
|
void MacroModeInsert(char);
|
|
|
|
|
|
|
|
// Selection stuff
|
|
|
|
///
|
|
|
|
bool selection;
|
|
|
|
///
|
|
|
|
int selpos;
|
|
|
|
///
|
1999-11-15 11:06:41 +00:00
|
|
|
MathedXIter cursel, * anchor;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
// LyxArrayBase *selarray;
|
|
|
|
///
|
2000-09-18 19:41:52 +00:00
|
|
|
bool is_visible;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
long unsigned win;
|
|
|
|
///
|
1999-11-15 11:06:41 +00:00
|
|
|
MathParInset * par;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-15 11:06:41 +00:00
|
|
|
MathedXIter * cursor;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
int xc, yc;
|
|
|
|
///
|
|
|
|
void doAccent(byte c, MathedTextCodes t);
|
|
|
|
///
|
1999-11-15 11:06:41 +00:00
|
|
|
void doAccent(MathedInset * p);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
int accent;
|
|
|
|
///
|
|
|
|
int nestaccent[8];
|
|
|
|
///
|
|
|
|
MathedTextCodes lastcode;
|
|
|
|
|
|
|
|
private:
|
2000-09-22 15:09:51 +00:00
|
|
|
///
|
1999-11-15 11:06:41 +00:00
|
|
|
MathFuncInset * imacro;
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
//-------------------- Inline Functions -------------------------//
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|