Back to index

texmacs  1.0.7.15
edit_cursor.hpp
Go to the documentation of this file.
00001 
00002 /******************************************************************************
00003 * MODULE     : cursor.hpp
00004 * DESCRIPTION: for cursor handling in TeXmacs
00005 * COPYRIGHT  : (C) 1999  Joris van der Hoeven
00006 *******************************************************************************
00007 * This software falls under the GNU general public license version 3 or later.
00008 * It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE
00009 * in the root directory or <http://www.gnu.org/licenses/gpl-3.0.html>.
00010 ******************************************************************************/
00011 
00012 #ifndef EDIT_CURSOR_H
00013 #define EDIT_CURSOR_H
00014 #include "editor.hpp"
00015 
00016 #define DIRECT 0
00017 #define CENTER 1
00018 #define HORIZONTAL 2
00019 #define VERTICAL 3
00020 
00021 class edit_cursor_rep: virtual public editor_rep {
00022 protected:
00023   cursor cu;         // the cursor
00024   cursor mv;         // "ghost cursor" position when moving cursor
00025   int    mv_status;  // cursor status during movements
00026 
00027 protected:
00028   cursor& the_cursor ();
00029   cursor& the_ghost_cursor ();
00030 
00031   path make_cursor_accessible (path p, bool forwards);
00032   path tree_path (path sp, SI x, SI y, SI delta);
00033   bool cursor_move_sub (SI& x0, SI& y0, SI& delta, SI dx, SI dy);
00034   void cursor_move (SI dx, SI dy);
00035   void adjust_ghost_cursor (int status);
00036   void notify_cursor_moved (int status);
00037   void show_cursor_if_hidden ();
00038 
00039 public:
00040   edit_cursor_rep ();
00041   ~edit_cursor_rep ();
00042 
00043   /* visual cursor movement */
00044   void go_to (SI x, SI y, bool absolute= true);
00045   void go_left_physical ();
00046   void go_right_physical ();
00047   void go_left ();
00048   void go_right ();
00049   void go_up ();
00050   void go_down ();
00051   void go_start_line ();
00052   void go_end_line ();
00053   void go_page_up ();
00054   void go_page_down ();
00055 
00056   /* logical cursor movement */
00057   void adjust_cursor ();
00058   void go_to_here ();
00059   void go_to (path p);
00060   void go_to_correct (path p);
00061   void go_to_start (path p);
00062   void go_to_end (path p);
00063   void go_to_border (path p, bool at_start);
00064   void go_start ();
00065   void go_end ();
00066   void go_start_paragraph ();
00067   void go_end_paragraph ();
00068   void go_start_of (tree_label what);
00069   void go_end_of (tree_label what);
00070   void go_start_with (string var, string val);
00071   void go_end_with (string var, string val);
00072 
00073   /* other cursor routines */
00074   void go_to_label (string s);
00075   tree get_labels ();
00076 };
00077 
00078 #endif // defined EDIT_CURSOR_H