home *** CD-ROM | disk | FTP | other *** search
/ Dream 52 / Amiga_Dream_52.iso / Linux / Divers / lyx-0.13.2.tar.gz / lyx-0.13.2.tar / lyx-0.13.2 / src / math_cursor.h < prev    next >
C/C++ Source or Header  |  1998-04-23  |  3KB  |  180 lines

  1. // -*- C++ -*-
  2. /*
  3.  *  File:        math_cursor.h
  4.  *  Purpose:     Declaration of interaction classes for mathed
  5.  *  Author:      Alejandro Aguilar Sierra <asierra@servidor.unam.mx> 
  6.  *  Created:     January 1996
  7.  *  Description: MathCursor control all user interaction
  8.  *
  9.  *  Dependencies: Xlib, XForms
  10.  *
  11.  *  Copyright: (c) 1996, Alejandro Aguilar Sierra
  12.  *
  13.  *   Version: 0.8beta, Mathed & Lyx project.
  14.  *
  15.  *   You are free to use and modify this code under the terms of
  16.  *   the GNU General Public Licence version 2 or later.
  17.  */
  18.  
  19. #ifndef __MATH_CURSOR__
  20. #define __MATH_CURSOR__
  21.  
  22. #ifdef __GNUG__
  23. #pragma interface
  24. #endif
  25.  
  26. #include "math_iter.h" 
  27. #include "math_inset.h"
  28.  
  29.  
  30. /// This is the external interface of Mathed's subkernel
  31. class MathedCursor {
  32.  public:
  33.     ///
  34.     MathedCursor(MathParInset *p);
  35.     ///
  36.     ~MathedCursor() { };
  37.     ///
  38.     void Insert(byte, MathedTextCodes t=LM_TC_MIN);
  39.     ///
  40.     void Insert(MathedInset*, int t=LM_TC_INSET);
  41.     ///
  42.     void Home();
  43.     ///
  44.     void End();
  45.     ///
  46.     bool Right(bool sel=false);
  47.     ///
  48.     bool Left(bool sel=false);
  49.     ///
  50.     bool Up(bool sel=false);
  51.     ///
  52.     bool Down(bool sel=false);
  53.     ///
  54.     bool Pop();
  55.     ///
  56.     bool Push();
  57.     ///
  58.     void Draw(long unsigned pm, int x, int y);
  59.     ///
  60.     void Redraw();
  61.     ///
  62.     void Delete();
  63.     ///
  64.     void DelLine();
  65.     ///
  66.     void SetPos(int, int);
  67.     ///
  68.     void GetPos(int& x, int& y) { cursor->GetPos(x, y); }
  69.     ///
  70.     short GetFCode() { return cursor->FCode(); }
  71.     ///
  72.     MathParInset *GetPar() { return par; }
  73.     ///
  74.     MathParInset *getCurrentPar() const { return cursor->p; }
  75.     ///
  76.     void SetPar(MathParInset*);
  77.     ///
  78.     void Interpret(char const*);
  79.     ///
  80.     void SetSize(short);
  81.     ///
  82.     void setNumbered();
  83.     void setLabel(char const*);
  84.     ///
  85.     bool Limits();
  86.     /// Accent 
  87.     void setAccent(int ac=0);
  88.     ///
  89.     int getAccent() const { return accent; };   
  90.     ///
  91.     bool IsEnd() const { return !cursor->OK(); }
  92.     // Macro mode methods
  93.     ///
  94.     void MacroModeOpen();
  95.     ///
  96.     void MacroModeClose();
  97.     ///
  98.     bool InMacroMode() { return macro_mode; }
  99.     
  100.     // Local selection methods
  101.     ///
  102.     bool Selection() { return selection; }
  103.     ///
  104.     void SelCopy();
  105.     ///
  106.     void SelCut();
  107.     ///
  108.     void SelDel();
  109.     ///
  110.     void SelPaste();
  111.     ///
  112.     void SelStart();
  113.     ///
  114.     void SelClear();
  115.     ///
  116.     void SelBalance();  
  117.     ///
  118.     XPoint *SelGetArea(int&);
  119.     ///
  120.     void clearLastCode() { lastcode = LM_TC_MIN; }
  121.     ///
  122.     void setLastCode(MathedTextCodes t) { lastcode = t; }
  123.     ///
  124.     MathedTextCodes getLastCode() const { return lastcode; }
  125.     
  126.  protected:
  127.     ///
  128.     bool macro_mode;
  129.     ///
  130.     void MacroModeBack();
  131.     ///
  132.     void MacroModeInsert(char);
  133.     
  134.     // Selection stuff
  135.     ///
  136.     bool selection;
  137.     ///
  138.     int  selpos;
  139.     ///
  140.     MathedXIter cursel, *anchor;
  141.     ///
  142. //    LyxArrayBase *selarray; 
  143.     ///
  144.     Bool is_visible;
  145.     ///
  146.     long unsigned win;
  147.     ///
  148.     MathParInset *par;
  149.     ///
  150.     MathedXIter *cursor;
  151.     ///
  152.     int xc, yc;
  153.     ///
  154.     int accent;
  155.     ///
  156.     MathedTextCodes lastcode;
  157.  
  158.  private:
  159.     ///
  160.     char macrobf[80];
  161.     ///
  162.     int macroln;
  163.     ///
  164.     MathFuncInset* imacro;
  165. };
  166.  
  167.  
  168. //--------------------   Inline Functions  -------------------------// 
  169.  
  170.  
  171. inline
  172. void MathedCursor::setAccent(int ac)
  173. {
  174.     accent = ac;
  175. }
  176.  
  177.  
  178. #endif
  179.  
  180.