Back to index

texmacs  1.0.7.15
edit_replace.hpp
Go to the documentation of this file.
00001 
00002 /******************************************************************************
00003 * MODULE     : edit_replace.hpp
00004 * DESCRIPTION: the interface for 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_REPLACE_H
00013 #define EDIT_REPLACE_H
00014 #include "editor.hpp"
00015 
00016 class edit_replace_rep: virtual public editor_rep {
00017 protected:
00018   bool        forward;       // forward search or replace ?
00019   string      search_mode;   // only search matches in search_mode mode
00020   string      search_lan;    // only search matches in search_lan language
00021   path        search_at;     // current search position
00022   path        search_end;    // position of the end of a match
00023   tree        search_what;   // search tree
00024   list<path>  where_stack;   // last search positions
00025   tree        what_stack;    // last search trees
00026   tree        replace_by;    // replace tree
00027   int         nr_replaced;   // number of replaced occurrences
00028 
00029   path        spell_end_p;   // spell check until here
00030   string      spell_s;       // the word being checked
00031   tree        spell_t;       // response of ispell
00032   bool        spell_dicmod;  // insert new words in personal dictionary?
00033 
00034 protected:
00035   void spell_write (string s);
00036   tree spell_read ();
00037 
00038 public:
00039   edit_replace_rep ();
00040   ~edit_replace_rep ();
00041 
00042   /* structural searching */
00043   bool inside (string what);
00044   bool inside (tree_label l);
00045   bool inside_with (string var, string val);
00046   string inside_which (tree t);
00047   path search_upwards (string what);
00048   path search_upwards (tree_label l);
00049   path search_parent_upwards (tree_label l, int& last);
00050   path search_parent_upwards (tree_label l);
00051   path search_upwards_with (string var, string val);
00052   path search_upwards_in_set (tree t);
00053   path search_previous_compound (path init, string which);
00054   path search_next_compound (path init, string which);
00055 
00056   /* search and replace */
00057   path test_sub (path p, tree t);
00058   path test (path p, tree t);
00059   void step_ascend (bool forward);
00060   void step_descend (bool forward);
00061   void step_horizontal (bool forward);
00062   void next_match (bool forward);
00063   void search_start (bool forward= true);
00064   void search_next (bool forward);
00065   void search_next (tree what, bool forward, bool step);
00066   void search_stop ();
00067   void search_button_next ();
00068   bool search_keypress (string s);
00069   tree search_tree ();
00070   void replace_start (tree what, tree by, bool forward= true);
00071   void replace_next ();
00072   bool replace_keypress (string s);
00073 
00074   /* spell */
00075   path test_spellable (path p);
00076   void spell_next ();
00077   void spell_replace (string by);
00078   void spell_start ();
00079   void spell_end ();
00080   bool spell_keypress (string s);
00081 };
00082 
00083 #endif // defined EDIT_REPLACE_H