Back to index

texmacs  1.0.7.15
server.hpp
Go to the documentation of this file.
00001 
00002 /******************************************************************************
00003 * MODULE     : server.hpp
00004 * DESCRIPTION: Main current graphical interface for user applications
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 SERVER_H
00013 #define SERVER_H
00014 #include "editor.hpp"
00015 #include "url.hpp"
00016 #include "scheme.hpp"
00017 
00018 class tm_buffer_rep;
00019 class tm_view_rep;
00020 class tm_window_rep;
00021 typedef tm_buffer_rep* tm_buffer;
00022 typedef tm_view_rep*   tm_view;
00023 typedef tm_window_rep* tm_window;
00024 class editor;
00025 
00026 class server_rep: public abstract_struct {
00027 public:
00028   server_rep ();
00029   virtual ~server_rep ();
00030 
00031   /* Get and set objects associated to server */
00032   virtual server_rep* get_server () = 0;
00033   virtual bool        has_view () = 0;
00034   virtual bool        has_window () = 0;
00035   virtual tm_view     get_view (bool must_be_valid= true) = 0;
00036   virtual void        set_view (tm_view vw) = 0;
00037   virtual tm_buffer   get_buffer () = 0;
00038   virtual editor      get_editor () = 0;
00039   virtual tm_window   get_window () = 0;
00040   virtual int         get_nr_windows () = 0;
00041 
00042   /* Control global server parameters */
00043   virtual void   set_font_rules (scheme_tree rules) = 0;
00044   virtual bool   kbd_get_command (string s, string& help, command& cmd) = 0;
00045   virtual void   insert_kbd_wildcard (string key, string im,
00046                                   bool post, bool l, bool r) = 0;
00047   virtual string kbd_pre_rewrite (string l) = 0;
00048   virtual string kbd_post_rewrite (string l, bool var_flag= true) = 0;
00049   virtual tree   kbd_system_rewrite (string l) = 0;
00050   virtual void   set_variant_keys (string var, string unvar) = 0;
00051   virtual void   get_keycomb (string& s, int& status,
00052                            command& cmd, string& sh, string& help) = 0;
00053 
00054   /* TeXmacs frames */
00055   virtual int  get_window_id () = 0;
00056   virtual void set_window_property (scheme_tree what, scheme_tree val) = 0;
00057   virtual void set_bool_window_property (string what, bool val) = 0;
00058   virtual void set_int_window_property (string what, int val) = 0;
00059   virtual void set_string_window_property (string what, string val) = 0;
00060   virtual scheme_tree get_window_property (scheme_tree what) = 0;
00061   virtual bool get_bool_window_property (string what) = 0;
00062   virtual int get_int_window_property (string what) = 0;
00063   virtual string get_string_window_property (string what) = 0;
00064 
00065   virtual void show_header (bool flag) = 0;
00066   virtual void show_icon_bar (int which, bool flag) = 0;
00067   virtual void show_side_tools (int which, bool flag) = 0;
00068   virtual bool visible_header () = 0;
00069   virtual bool visible_icon_bar (int which) = 0;
00070   virtual bool visible_side_tools (int which) = 0;
00071   virtual void menu_widget (string menu, widget& w) = 0;
00072   virtual void menu_main (string menu) = 0;
00073   virtual void menu_icons (int which, string menu) = 0;
00074   virtual void side_tools (int which, string menu) = 0;
00075 
00076   virtual void set_shrinking_factor (int sf) = 0;
00077   virtual int  get_shrinking_factor () = 0;
00078   virtual void set_scrollbars (int sb) = 0;
00079   virtual void get_visible (SI& x1, SI& y1, SI& x2, SI& y2) = 0;
00080   virtual void scroll_where (SI& x, SI& y) = 0;
00081   virtual void scroll_to (SI x, SI y) = 0;
00082   virtual void set_extents (SI x1, SI y1, SI x2, SI y2) = 0;
00083   virtual void get_extents (SI& x1, SI& y1, SI& x2, SI& y2) = 0;
00084   virtual void full_screen_mode (bool on, bool edit) = 0;
00085   virtual bool in_full_screen_mode () = 0;
00086   virtual bool in_full_screen_edit_mode () = 0;
00087 
00088   virtual void show_footer   (bool flag) = 0;
00089   virtual bool visible_footer () = 0;
00090   virtual void set_left_footer (string s) = 0;
00091   virtual void set_right_footer (string s) = 0;
00092   virtual void set_message (tree left, tree right, bool temp= false) = 0;
00093   virtual void recall_message () = 0;
00094   virtual void dialogue_start (string name, widget wid) = 0;
00095   virtual void dialogue_inquire (int i, string& arg) = 0;
00096   virtual void dialogue_end () = 0;
00097   virtual void choose_file (object fun, string title, string type) = 0;
00098   virtual void interactive (object fun, scheme_tree p) = 0;
00099 
00100   /* Miscellaneous routines */
00101   virtual void   style_clear_cache () = 0;
00102   virtual void   refresh () = 0;
00103   virtual void   interpose_handler () = 0;
00104   virtual void   wait_handler (string message, string arg) = 0;
00105   virtual void   set_script_status (int i) = 0;
00106   virtual void   focus_on_editor (editor ed) = 0;
00107   virtual void   set_printing_command (string s) = 0;
00108   virtual void   set_printer_page_type (string s) = 0;
00109   virtual string get_printer_page_type () = 0;
00110   virtual void   set_printer_dpi (string dpi) = 0;
00111   virtual void   set_default_shrinking_factor (int sf) = 0;
00112   virtual int    get_default_shrinking_factor () = 0;
00113   virtual void   image_gc (string which= "*") = 0;
00114   virtual void   inclusions_gc (string which= "*") = 0;
00115   virtual void   typeset_update (path p) = 0;
00116   virtual void   typeset_update_all () = 0;
00117   virtual bool   is_yes (string s) = 0;
00118   virtual void   quit () = 0;
00119   virtual void   shell (string s) = 0;
00120 };
00121 
00122 class server {
00123   ABSTRACT(server);
00124   server ();
00125 };
00126 ABSTRACT_CODE(server);
00127 
00128 extern bool rescue_mode;
00129 scheme_tree menu_merge (scheme_tree m1, scheme_tree m2);
00130 server get_server ();
00131 void gui_set_output_language (string lan);
00132 
00133 /* low level */
00134 tm_buffer create_buffer (url name);
00135 tm_buffer create_buffer (url name, tree doc);
00136 int find_buffer (path p);
00137 int find_buffer (url name);
00138 void attach_view (tm_window win, tm_view vw);
00139 void detach_view (tm_view vw);
00140 tm_view get_passive_view (tm_buffer buf);
00141 void delete_buffer (tm_buffer buf);
00142 void delete_view (tm_view vw);
00143 void new_buffer_in_this_window (url name, tree t);
00144 tm_window new_window (bool map_flag= true, tree geom= "");
00145 tm_buffer load_passive_buffer (url name);
00146 tree make_document (tm_view vw, string fm= "texmacs");
00147 
00148 /* Buffer management */
00149 url  get_all_buffers ();
00150 bool buffer_in_menu (url name);
00151 url  get_this_buffer ();
00152 void set_name_buffer (url name);
00153 url  get_name_buffer ();
00154 url  get_name_buffer (path p);
00155 void set_abbr_buffer (url name, string abbr);
00156 string get_abbr_buffer (url name);
00157 void revert_buffer (url name, tree doc);
00158 void new_buffer_in_new_window (url name, tree t, tree geom= "");
00159 double last_visited (url name);
00160 bool buffer_modified (url name);
00161 
00162 /* Buffer management */
00163 int  nr_bufs ();
00164 url  create_buffer ();
00165 void switch_to_buffer (int nr);
00166 bool switch_to_buffer (path p);
00167 void switch_to_buffer (url name);
00168 void switch_to_active_buffer (url name);
00169 void revert_buffer ();
00170 void kill_buffer ();
00171 url  open_window (tree geom= "");
00172 void clone_window ();
00173 void kill_window ();
00174 void kill_window_and_buffer ();
00175 bool no_bufs ();
00176 bool no_name ();
00177 bool help_buffer ();
00178 bool is_aux_buffer (url name);
00179 void set_aux (string aux, url name);
00180 void set_aux_buffer (string aux, url name, tree doc);
00181 void set_help_buffer (url name, tree doc);
00182 void browse_help (int delta);
00183 void set_buffer_tree (url name, tree doc);
00184 tree get_buffer_tree (url name);
00185 
00186 /* Project management */
00187 void project_attach (string prj_name= "");
00188 bool project_attached ();
00189 url  project_get ();
00190 
00191 /* Window management */
00192 int  window_current ();
00193 path windows_list ();
00194 path buffer_to_windows (url name);
00195 url  window_to_buffer (int id);
00196 tm_view window_find_view (int id);
00197 void window_set_buffer (int id, url name);
00198 void window_focus (int id);
00199 
00200 /* File management */
00201 tree load_tree (url name, string fm);
00202 void load_buffer (url name, string fm, int where= 0, bool asf= false);
00203 void save_buffer (url name, string fm);
00204 void auto_save ();
00205 bool buffer_unsaved ();
00206 bool exists_unsaved_buffer ();
00207 void pretend_save_buffer ();
00208 
00209 #endif // defined SERVER_H