Back to index

texmacs  1.0.7.15
editor.hpp
Go to the documentation of this file.
00001 
00002 /******************************************************************************
00003 * MODULE     : editor.hpp
00004 * DESCRIPTION: abstract TeXmacs editors
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 EDITOR_H
00013 #define EDITOR_H
00014 #include "typesetter.hpp"
00015 #ifdef AQUATEXMACS
00016 #include "Cocoa/aqua_simple_widget.h"
00017 #else
00018 #ifdef QTTEXMACS
00019 #include "Qt/qt_simple_widget.hpp"
00020 #else
00021 #include "Widkit/simple_wk_widget.hpp"
00022 #endif
00023 #endif
00024 #include "server.hpp"
00025 #include "drd_info.hpp"
00026 #ifdef EXPERIMENTAL
00027 #include "../Style/Environment/environment.hpp"
00028 #include "../Style/Memorizer/memorizer.hpp"
00029 #endif
00030 #include "new_data.hpp"
00031 #define TEXMACS_COPYRIGHT (string("(c) 1999-2006 by Joris van der Hoeven"))
00032 
00033 #define THE_CURSOR 1
00034 #define THE_FOCUS 2
00035 #define THE_TREE 4
00036 #define THE_ENVIRONMENT 8
00037 #define THE_SELECTION 16
00038 #define THE_DECORATIONS 32
00039 #define THE_EXTENTS 64
00040 #define THE_LOCUS 128
00041 
00042 class tm_buffer_rep;
00043 typedef tm_buffer_rep* tm_buffer;
00044 class tm_view_rep;
00045 class server_rep;
00046 class modification;
00047 extern bool enable_fastenv;
00048 
00049 class editor_rep: public simple_widget_rep {
00050 public:
00051   server_rep*  sv;   // the underlying texmacs server
00052   widget_rep*  cvw;  // non reference counted canvas widget
00053   tm_view_rep* mvw;  // master view
00054 
00055 protected:
00056   tm_buffer    buf;  // the underlying buffer
00057   drd_info     drd;  // the drd for the buffer
00058   tree&        et;   // all TeXmacs trees
00059   box          eb;   // box translation of tree
00060   path         rp;   // path to the root of the document in et
00061   path         tp;   // path of cursor in tree
00062 #ifdef EXPERIMENTAL
00063   environment  ste;  // environment for style rewriting
00064   tree         cct;  // clean copy of the document tree
00065   memorizer    mem;  // style converted document tree
00066 #endif
00067 
00068   /* exchanging information with the interface */
00069   virtual SI        get_window_height () = 0;
00070   virtual void      get_selection (path& start, path& end) = 0;
00071   virtual void      set_selection (path start, path end) = 0;
00072   virtual cursor&   the_cursor () = 0;
00073   virtual cursor&   the_ghost_cursor () = 0;
00074 
00075   /* exchanging information with the typesetter */
00076   virtual typesetter           get_typesetter () = 0;
00077   virtual hashmap<string,tree> get_init () = 0;
00078   virtual hashmap<string,tree> get_fin () = 0;
00079   virtual void                 set_init (hashmap<string,tree> H= tree ("?"))=0;
00080   virtual void                 add_init (hashmap<string,tree> H) = 0;
00081   virtual void                 set_fin (hashmap<string,tree> H) = 0;
00082   virtual void                 set_base_name (url name) = 0;
00083 
00084   /* exchanging property information */
00085   virtual void   set_bool_property (string what, bool val) = 0;
00086   virtual void   set_int_property (string what, int val) = 0;
00087   virtual void   set_string_property (string what, string val) = 0;
00088   virtual bool   get_bool_property (string what) = 0;
00089   virtual int    get_int_property (string what) = 0;
00090   virtual string get_string_property (string what) = 0;
00091 
00092 protected:
00093   /* protected routines from edit_typeset */
00094   virtual void   typeset_preamble () = 0;
00095   virtual void   typeset_invalidate_env () = 0;
00096   virtual void   typeset (SI& x1, SI& y1, SI& x2, SI& y2) = 0;
00097 
00098   /* protected subroutines for deletion of content */
00099   virtual void back_around (tree t, path p, bool forward) = 0;
00100   virtual void back_prime (tree t, path p, bool forward) = 0;
00101   virtual void back_in_around (tree t, path p, bool forward) = 0;
00102   virtual void back_in_long_arrow (tree t, path p, bool forward) = 0;
00103   virtual void back_in_wide (tree t, path p, bool forward) = 0;
00104   virtual void back_in_tree (tree t, path p, bool forward) = 0;
00105   virtual void pre_remove_around (path p) = 0;
00106   virtual void back_table (path p, bool forward) = 0;
00107   virtual void back_in_table (tree t, path p, bool forward) = 0;
00108   virtual void back_monolithic (path p) = 0;
00109   virtual void back_general (path p, bool forward) = 0;
00110   virtual void back_in_with (tree t, path p, bool forward) = 0;
00111   virtual void back_in_general (tree t, path p, bool forward) = 0;
00112   virtual void back_in_text_at (tree t, path p, bool forward) = 0;
00113 
00114   /* other protected subroutines */
00115   virtual tree kbd (string s) = 0;
00116   virtual tree kbd_shortcut (string s) = 0;
00117   virtual path tree_path (path sp, SI x, SI y, SI delta) = 0;
00118   virtual void apply_changes () = 0;
00119   virtual void animate () = 0;
00120   virtual path search_format () = 0;
00121   virtual path search_format (int& row, int& col) = 0;
00122   virtual void table_bound (path fp, int& i1, int& j1, int& i2, int& j2) = 0;
00123   virtual tree table_get_subtable (path p, int i1, int j1, int i2, int j2) = 0;
00124   virtual void table_write_subtable (path fp, int row, int col, tree subt) = 0;
00125   virtual void table_del_format (path fp, int I1, int J1,
00126                              int I2, int J2, string var) = 0;
00127 
00128 public:
00129   editor_rep ();
00130   editor_rep (server_rep* sv, tm_buffer buf);
00131   inline virtual ~editor_rep () {}
00132 
00133   /* public routines from edit_interface */
00134   virtual void suspend () = 0;
00135   virtual void resume () = 0;
00136   virtual int  get_pixel_size () = 0;
00137   virtual void invalidate (SI x1, SI y1, SI x2, SI y2) = 0;
00138   virtual void invalidate (rectangles rs) = 0;
00139   virtual void notify_change (int changed) = 0;
00140   virtual bool has_changed (int question) = 0;
00141   virtual int  idle_time (int event_type= ANY_EVENT) = 0;
00142   virtual int  change_time () = 0;
00143   virtual void full_screen_mode (bool flag) = 0;
00144   virtual void before_menu_action () = 0;
00145   virtual void after_menu_action () = 0;
00146   virtual rectangle get_window_extents () = 0;
00147   virtual cursor search_cursor (path p) = 0;
00148   virtual selection search_selection (path start, path end) = 0;
00149   virtual int  get_input_mode () = 0;
00150   virtual void set_input_mode (int mode) = 0;
00151   virtual void set_input_normal () = 0;
00152   virtual bool in_normal_mode () = 0;
00153   virtual bool in_search_mode () = 0;
00154   virtual bool in_replace_mode () = 0;
00155   virtual bool in_spell_mode () = 0;
00156   virtual void interrupt_shortcut () = 0;
00157   virtual bool kbd_get_command (string cmd_s, string& help, command& cmd) = 0;
00158   virtual void key_press (string key) = 0;
00159   virtual void emulate_keyboard (string keys, string action= "") = 0;
00160   virtual bool complete_try () = 0;
00161   virtual void complete_start (string prefix, array<string> compls) = 0;
00162   virtual bool complete_keypress (string key) = 0;
00163   virtual string session_complete_command (tree t) = 0;
00164   virtual void custom_complete (tree t) = 0;
00165   virtual void mouse_any (string s, SI x, SI y, int mods, time_t t) = 0;
00166   virtual void mouse_click (SI x, SI y) = 0;
00167   virtual bool mouse_extra_click (SI x, SI y) = 0;
00168   virtual void mouse_drag (SI x, SI y) = 0;
00169   virtual void mouse_select (SI x, SI y, int mods, bool drag) = 0;
00170   virtual void mouse_paste (SI x, SI y) = 0;
00171   virtual void mouse_adjust (SI x, SI y) = 0;
00172   virtual void mouse_scroll (SI x, SI y, bool up) = 0;
00173   virtual cursor get_cursor () = 0;
00174   virtual void set_pointer (string name) = 0;
00175   virtual void set_pointer (string curs_name, string mask_name) = 0;
00176   virtual void set_message (tree l, tree r= "", bool temp= false) = 0;
00177   virtual void recall_message () = 0;
00178 
00179   /* public routines from edit_cursor */
00180   virtual path make_cursor_accessible (path p, bool forwards) = 0;
00181   virtual void show_cursor_if_hidden () = 0;
00182   virtual void go_to (SI x, SI y, bool absolute= true) = 0;
00183   virtual void go_left_physical () = 0;
00184   virtual void go_right_physical () = 0;
00185   virtual void go_left () = 0;
00186   virtual void go_right () = 0;
00187   virtual void go_up () = 0;
00188   virtual void go_down () = 0;
00189   virtual void go_start_line () = 0;
00190   virtual void go_end_line () = 0;
00191   virtual void go_page_up () = 0;
00192   virtual void go_page_down () = 0;
00193   virtual void go_to (path p) = 0;
00194   virtual void go_to_correct (path p) = 0;
00195   virtual void go_to_start (path p) = 0;
00196   virtual void go_to_end (path p) = 0;
00197   virtual void go_to_border (path p, bool at_start) = 0;
00198   virtual void go_to_here () = 0;
00199   virtual void go_start () = 0;
00200   virtual void go_end () = 0;
00201   virtual void go_start_of (tree_label what) = 0;
00202   virtual void go_end_of (tree_label what) = 0;
00203   virtual void go_start_with (string var, string val) = 0;
00204   virtual void go_end_with (string var, string val) = 0;
00205   virtual void go_start_paragraph () = 0;
00206   virtual void go_end_paragraph () = 0;
00207   virtual void go_to_label (string s) = 0;
00208   virtual tree get_labels () = 0;
00209 
00210   /* public routines from edit_graphics */
00211   virtual bool   inside_graphics (bool b=true) = 0;
00212   virtual bool   inside_active_graphics (bool b=true) = 0;
00213   virtual bool   over_graphics (SI x, SI y) = 0;
00214   virtual tree   get_graphics () = 0;
00215   virtual double get_x () = 0;
00216   virtual double get_y () = 0;
00217   virtual frame  find_frame (bool last= false) = 0;
00218   virtual grid   find_grid () = 0;
00219   virtual void   find_limits (point& lim1, point& lim2) = 0;
00220   virtual bool   find_graphical_region (SI& x1, SI& y1, SI& x2, SI& y2) = 0;
00221   virtual point  adjust (point p) = 0;
00222   virtual tree   find_point (point p) = 0;
00223   virtual tree   graphical_select (double x, double y) = 0;
00224   virtual tree   graphical_select (double x1, double y1,
00225                                double x2, double y2) = 0;
00226   virtual tree   get_graphical_object () = 0;
00227   virtual void   set_graphical_object (tree t) = 0;
00228   virtual void   invalidate_graphical_object () = 0;
00229   virtual void   draw_graphical_object (renderer ren) = 0;
00230   virtual bool   mouse_graphics (string s, SI x, SI y, int mods, time_t t) = 0;
00231 
00232   /* public routines from edit_typeset */
00233   virtual void     clear_local_info () = 0;
00234   virtual void     set_data (new_data data) = 0;
00235   virtual void     get_data (new_data& data) = 0;
00236   virtual SI       as_length (string l) = 0;
00237   virtual string   add_lengths (string l1, string l2) = 0;
00238   virtual string   multiply_length (double x, string l) = 0;
00239   virtual bool     is_length (string s) = 0;
00240   virtual double   divide_lengths (string l1, string l2) = 0;
00241   virtual void     drd_update () = 0;
00242 #ifdef EXPERIMENTAL
00243   virtual void     environment_update () = 0;
00244 #endif
00245   virtual bool     defined_at_cursor (string var_name) = 0;
00246   virtual bool     defined_at_init (string var_name) = 0;
00247   virtual bool     defined_in_init (string var_name) = 0;
00248   virtual tree     get_env_value (string var_name, path p) = 0;
00249   virtual tree     get_env_value (string var_name) = 0;
00250   virtual tree     get_init_value (string var_name) = 0;
00251   virtual string   get_env_string (string var_name) = 0;
00252   virtual string   get_init_string (string var_name) = 0;
00253   virtual int      get_env_int (string var_name) = 0;
00254   virtual int      get_init_int (string var_name) = 0;
00255   virtual double   get_env_double (string var_name) = 0;
00256   virtual double   get_init_double (string var_name) = 0;
00257   virtual language get_env_language () = 0;
00258   virtual tree     exec_texmacs (tree t, path p) = 0;
00259   virtual tree     exec_texmacs (tree t) = 0;
00260   virtual tree     exec_verbatim (tree t, path p) = 0;
00261   virtual tree     exec_verbatim (tree t) = 0;
00262   virtual tree     exec_html (tree t, path p) = 0;
00263   virtual tree     exec_html (tree t) = 0;
00264   virtual tree     exec_latex (tree t, path p) = 0;
00265   virtual tree     exec_latex (tree t) = 0;
00266   virtual tree     texmacs_exec (tree t) = 0;
00267   virtual tree     get_style () = 0;
00268   virtual void     set_style (tree t) = 0;
00269   virtual void     init_style () = 0;
00270   virtual void     init_style (string style) = 0;
00271   virtual void     init_add_package (string package) = 0;
00272   virtual void     init_remove_package (string package) = 0;
00273   virtual void     init_env (string var, tree by) = 0;
00274   virtual void     init_default (string var) = 0;
00275   virtual void     typeset_invalidate (path p) = 0;
00276   virtual void     typeset_invalidate_all () = 0;
00277 
00278   /* public routines from edit_modify */
00279   virtual void notify_assign (path p, tree u) = 0;
00280   virtual void notify_insert (path p, tree u) = 0;
00281   virtual void notify_remove (path p, int nr) = 0;
00282   virtual void notify_split (path p) = 0;
00283   virtual void notify_join (path p) = 0;
00284   virtual void notify_assign_node (path p, tree_label op) = 0;
00285   virtual void notify_insert_node (path p, tree t) = 0;
00286   virtual void notify_remove_node (path p) = 0;
00287   virtual void notify_set_cursor (path p, tree data) = 0;
00288   virtual void post_notify (path p) = 0;
00289   virtual void clear_undo_history () = 0;
00290   virtual double this_author () = 0;
00291   virtual void archive_state () = 0;
00292   virtual void start_editing () = 0;
00293   virtual void end_editing () = 0;
00294   virtual void start_slave (double a) = 0;
00295   virtual void mark_start (double a) = 0;
00296   virtual bool mark_cancel (double a) = 0;
00297   virtual void mark_end (double a) = 0;
00298   virtual void add_undo_mark () = 0;
00299   virtual void remove_undo_mark () = 0;
00300   virtual int  undo_possibilities () = 0;
00301   virtual void unredoable_undo () = 0;
00302   virtual void undo (int i=0) = 0;
00303   virtual int  redo_possibilities () = 0;
00304   virtual void redo (int i=0) = 0;
00305   virtual void require_save () = 0;
00306   virtual void notify_save (bool real_save= true) = 0;
00307   virtual bool need_save (bool real_save= true) = 0;
00308   virtual void show_history () = 0;
00309   virtual observer position_new (path p) = 0;
00310   virtual void position_delete (observer o) = 0;
00311   virtual void position_set (observer o, path p) = 0;
00312   virtual path position_get (observer o) = 0;
00313 
00314   /* public routines from edit_text */
00315   virtual void correct (path p) = 0;
00316   virtual void correct_concat (path p, int done=0) = 0;
00317   virtual bool insert_return () = 0;
00318   virtual void remove_return (path p) = 0;
00319   virtual void insert_tree (tree t, path p_in_t) = 0;
00320   virtual void var_insert_tree (tree t, path p_in_t) = 0;
00321   virtual void insert_tree (tree t) = 0;
00322   virtual void remove_text (bool forward) = 0;
00323   virtual void remove_structure (bool forward) = 0;
00324   virtual void remove_structure_upwards () = 0;
00325 
00326   virtual void make_space (tree t) = 0;
00327   virtual void make_space (string w) = 0;
00328   virtual void make_space (string w, string y1, string y2) = 0;
00329   virtual void make_hspace (string s) = 0;
00330   virtual void make_hspace (string smin, string sdef, string smax) = 0;
00331   virtual void make_vspace_before (string s) = 0;
00332   virtual void make_vspace_before (string smin, string sdef, string smax) = 0;
00333   virtual void make_vspace_after (string s) = 0;
00334   virtual void make_vspace_after (string smin, string sdef, string smax) = 0;
00335   virtual void make_htab (string spc) = 0;
00336   virtual void make_image (string file_name, bool link,
00337                         string w, string h, string x, string y) = 0;
00338 
00339   /* public routines from edit_math */
00340   virtual void make_rigid () = 0;
00341   virtual void make_lprime (string s) = 0;
00342   virtual void make_rprime (string s) = 0;
00343   virtual void make_below () = 0;
00344   virtual void make_above () = 0;
00345   virtual void make_script (bool sup, bool right) = 0;
00346   virtual void make_fraction () = 0;
00347   virtual void make_sqrt () = 0;
00348   virtual void make_var_sqrt () = 0;
00349   virtual void make_wide (string wide) = 0;
00350   virtual void make_wide_under (string wide) = 0;
00351   virtual void make_neg () = 0;
00352   virtual void make_tree () = 0;
00353 
00354   /* public routines from edit_table */
00355   virtual void   make_table (int nr_rows=1, int nr_cols=1) = 0;
00356   virtual void   make_subtable (int nr_rows=1, int nr_cols=1) = 0;
00357   virtual void   table_disactivate () = 0;
00358   virtual void   table_extract_format () = 0;
00359   virtual void   table_insert_row (bool forward) = 0;
00360   virtual void   table_insert_column (bool forward) = 0;
00361   virtual void   table_remove_row (bool forward, bool flag= false) = 0;
00362   virtual void   table_remove_column (bool forward, bool flag= false) = 0;
00363   virtual int    table_nr_rows () = 0;
00364   virtual int    table_nr_columns () = 0;
00365   virtual void   table_set_extents (int rows, int cols) = 0;
00366   virtual int    table_which_row () = 0;
00367   virtual int    table_which_column () = 0;
00368   virtual path   table_search_cell (int row, int col) = 0;
00369   virtual void   table_go_to (int row, int col) = 0;
00370   virtual void   table_set_format (string var, tree val) = 0;
00371   virtual string table_get_format (string var) = 0;
00372   virtual void   table_del_format (string var= "") = 0;
00373   virtual void   table_format_center () = 0;
00374   virtual void   table_row_decoration (bool forward) = 0;
00375   virtual void   table_column_decoration (bool forward) = 0;
00376   virtual void   table_correct_block_content () = 0;
00377   virtual void   table_resize_notify () = 0;
00378   virtual void   set_cell_mode (string mode) = 0;
00379   virtual string get_cell_mode () = 0;
00380   virtual void   cell_set_format (string var, tree val) = 0;
00381   virtual string cell_get_format (string var) = 0;
00382   virtual void   cell_del_format (string var= "") = 0;
00383   virtual void   table_test () = 0;
00384 
00385   /* public routines from edit_dynamic */
00386   virtual bool in_source () = 0;
00387   virtual path find_dynamic (path p) = 0;
00388   virtual void make_compound (tree_label l, int n=-1) = 0;
00389   virtual void activate () = 0;
00390   virtual void go_to_argument (path p, bool start_flag) = 0;
00391   virtual void insert_argument (path p, bool forward) = 0;
00392   virtual void insert_argument (bool forward) = 0;
00393   virtual void remove_empty_argument (path p, bool forward) = 0;
00394   virtual void remove_argument (path p, bool forward) = 0;
00395   virtual void remove_argument (bool forward) = 0;
00396   virtual void make_with (string var, string val) = 0;
00397   virtual void insert_with (path p, string var, tree val) = 0;
00398   virtual void remove_with (path p, string var) = 0;
00399   virtual void make_mod_active (tree_label l) = 0;
00400   virtual void make_style_with (string var, string val) = 0;
00401   virtual void make_hybrid () = 0;
00402   virtual bool activate_latex () = 0;
00403   virtual void activate_hybrid (bool with_args_hint) = 0;
00404   virtual void activate_symbol () = 0;
00405   virtual bool make_return_before () = 0;
00406   virtual bool make_return_after () = 0;
00407   virtual void temp_proof_fix () = 0;
00408 
00409   /* public routines from edit_process */
00410   virtual void generate_bibliography (string bib, string sty, string fname)= 0;
00411   virtual void generate_table_of_contents (string toc) = 0;
00412   virtual void generate_index (string idx) = 0;
00413   virtual void generate_glossary (string glo) = 0;
00414   virtual void generate_aux (string which= "") = 0;
00415   virtual bool get_save_aux () = 0;
00416 
00417   /* public routines from edit_select */
00418   virtual path semantic_root (path p) = 0;
00419   virtual bool semantic_active (path p) = 0;
00420   virtual bool semantic_select (path p, path& q1, path& q2, int mode) = 0;
00421 
00422   virtual void select (path p) = 0;
00423   virtual void select (path start, path end) = 0;
00424   virtual void select_all () = 0;
00425   virtual void select_line () = 0;
00426   virtual void select_from_cursor () = 0;
00427   virtual void select_from_cursor_if_active () = 0;
00428   virtual void select_from_keyboard (bool flag) = 0;
00429   virtual void select_from_shift_keyboard () = 0;
00430   virtual void select_enlarge_text () = 0;
00431   virtual void select_enlarge () = 0;
00432   virtual void select_enlarge_environmental () = 0;
00433 
00434   virtual bool selection_active_any () = 0;
00435   virtual bool selection_active_normal () = 0;
00436   virtual bool selection_active_table (bool strict= true) = 0;
00437   virtual bool selection_active_small () = 0;
00438   virtual bool selection_active_enlarging () = 0;
00439 
00440   virtual void selection_raw_set (string key, tree t) = 0;
00441   virtual tree selection_raw_get (string key) = 0;
00442   virtual void selection_correct (path i1, path i2, path& o1, path& o2) = 0;
00443   virtual path selection_get_subtable (int& i1, int& j1, int& i2, int& j2) = 0;
00444   virtual void selection_get (selection& sel) = 0;
00445   virtual void selection_get (path& start, path& end) = 0;
00446   virtual path selection_get_start () = 0;
00447   virtual path selection_get_end () = 0;
00448   virtual path selection_get_path () = 0;
00449   virtual path selection_get_cursor_path () = 0;
00450   virtual tree selection_get_env_value (string var) = 0;
00451   virtual void selection_set (string key, tree t, bool persistant= false) = 0;
00452   virtual void selection_set (tree t) = 0;
00453   virtual void selection_set_start (path p= path()) = 0;
00454   virtual void selection_set_end (path p= path()) = 0;
00455   virtual void selection_set_paths (path start, path end) = 0;
00456   virtual void selection_copy (string key= "primary") = 0;
00457   virtual void selection_paste (string key= "primary") = 0;
00458   virtual void selection_clear (string key= "primary") = 0;
00459   virtual void selection_cancel () = 0;
00460   virtual void selection_set_import (string fm) = 0;
00461   virtual void selection_set_export (string fm) = 0;
00462   virtual string selection_get_import () = 0;
00463   virtual string selection_get_export () = 0;
00464 
00465   virtual tree selection_get () = 0;
00466   virtual void selection_cut (string key= "primary") = 0;
00467   virtual tree selection_get_cut () = 0;
00468   virtual void selection_move () = 0;
00469   virtual void cut (path p) = 0;
00470   virtual void cut (path start, path end) = 0;
00471   virtual path manual_focus_get () = 0;
00472   virtual void manual_focus_set (path p, bool force= true) = 0;
00473   virtual void manual_focus_release () = 0;
00474   virtual path focus_get (bool skip_flag= true) = 0;
00475 
00476   /* public routines from edit_replace */
00477   virtual bool inside (string what) = 0;
00478   virtual bool inside (tree_label l) = 0;
00479   virtual bool inside_with (string var, string val) = 0;
00480   virtual string inside_which (tree t) = 0;
00481   virtual path search_upwards (string what) = 0;
00482   virtual path search_upwards (tree_label l) = 0;
00483   virtual path search_parent_upwards (tree_label l) = 0;
00484   virtual path search_parent_upwards (tree_label l, int& last) = 0;
00485   virtual path search_upwards_with (string var, string val) = 0;
00486   virtual path search_upwards_in_set (tree t) = 0;
00487   virtual path search_previous_compound (path init, string which) = 0;
00488   virtual path search_next_compound (path init, string which) = 0;
00489   virtual void search_start (bool forward= true) = 0;
00490   virtual void search_button_next () = 0;
00491   virtual bool search_keypress (string s) = 0;
00492   virtual tree search_tree () = 0;
00493   virtual void replace_start (tree what, tree by, bool forward= true) = 0;
00494   virtual bool replace_keypress (string s) = 0;
00495   virtual void spell_start () = 0;
00496   virtual void spell_replace (string by) = 0;
00497   virtual bool spell_keypress (string s) = 0;
00498 
00499   /* public routines from edit_main */
00500   virtual void set_property (scheme_tree what, scheme_tree val) = 0;
00501   virtual scheme_tree get_property (scheme_tree what) = 0;
00502   virtual void clear_buffer () = 0;
00503   virtual void new_window () = 0;
00504   virtual void clone_window () = 0;
00505   virtual void tex_buffer () = 0;
00506   virtual url  get_name () = 0;
00507   virtual void focus_on_this_editor () = 0;
00508   virtual void notify_page_change () = 0;
00509   virtual void print (url ps_name, bool to_file, int first, int last) = 0;
00510   virtual void print_to_file (url ps_name,
00511                            string first="1", string last="1000000") = 0;
00512   virtual void print_buffer (string first="1", string last="1000000") = 0;
00513   virtual void export_ps (url ps_name,
00514                        string first="1", string last="1000000") = 0;
00515   virtual array<int> print_snippet (url u, tree t) = 0;
00516   virtual void footer_eval (string s) = 0;
00517   virtual tree the_line () = 0;
00518   virtual tree the_root () = 0;
00519   virtual tree the_buffer () = 0;
00520   virtual tree the_subtree (path p) = 0;
00521   virtual path the_path () = 0;
00522   virtual path the_shifted_path () = 0;
00523   virtual path the_buffer_path () = 0;
00524   virtual void show_tree () = 0;
00525   virtual void show_env () = 0;
00526   virtual void show_path () = 0;
00527   virtual void show_cursor () = 0;
00528   virtual void show_selection () = 0;
00529   virtual void show_meminfo () = 0;
00530   virtual void edit_special () = 0;
00531   virtual void edit_test () = 0;
00532 
00533   friend class tm_window_rep;
00534   friend class tm_server_rep;
00535   friend class server_command_rep;
00536   friend void   edit_announce (editor_rep* ed, modification mod);
00537   friend void   edit_done (editor_rep* ed, modification mod);
00538   friend string get_editor_status_report ();
00539   friend void   tm_failure (const char* msg);
00540   friend void   revert_buffer (url name, tree doc);
00541   friend void   set_aux (string aux, url name);
00542 };
00543 
00544 class editor {
00545 EXTEND_NULL(widget,editor);
00546 public:
00547   inline bool operator == (editor w) { return rep == w.rep; }
00548   inline bool operator != (editor w) { return rep != w.rep; }
00549 };
00550 EXTEND_NULL_CODE(widget,editor);
00551 
00552 editor new_editor (server_rep* sv, tm_buffer buf);
00553 
00554 #define SERVER(cmd) {                    \
00555   tm_view temp_vw= sv->get_view (false); \
00556   focus_on_this_editor ();               \
00557   sv->cmd;                               \
00558   sv->set_view (temp_vw);                \
00559 }
00560 
00561 #endif // defined EDITOR_H