home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / lucid / lemacs-19.6 / src / screen.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-03-24  |  9.4 KB  |  295 lines

  1. /* Define screen-object for GNU Emacs.
  2.    Copyright (C) 1988, 1992, 1993 Free Software Foundation, Inc.
  3.  
  4. This file is part of GNU Emacs.
  5.  
  6. GNU Emacs is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2, or (at your option)
  9. any later version.
  10.  
  11. GNU Emacs is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with GNU Emacs; see the file COPYING.  If not, write to
  18. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20. #ifndef _EMACS_SCREEN_H_
  21. #define _EMACS_SCREEN_H_
  22.  
  23. #ifdef MULTI_SCREEN
  24.  
  25. enum output_method
  26. { output_termcap, output_x_window };
  27.  
  28. #include "dispextern.h"
  29.  
  30. struct screen
  31. {
  32.   int size;
  33.   struct Lisp_Vector *next;
  34.  
  35.   /* glyphs as they appear on the screen */
  36.   struct screen_glyphs *current_glyphs;
  37.  
  38.   /* glyphs we'd like to appear on the screen */
  39.   struct screen_glyphs *desired_glyphs;
  40.  
  41.   /* Cost of inserting 1 line on this screen */
  42.   int *insert_line_cost;
  43.  
  44.   /* Cost of deleting 1 line on this screen */
  45.   int *delete_line_cost;
  46.  
  47.   /* Cost of inserting n lines on this screen */
  48.   int *insert_n_lines_cost;
  49.  
  50.   /* Cost of deleting n lines on this screen */
  51.   int *delete_n_lines_cost;
  52.  
  53.   /* glyphs for the mode line */
  54.   struct screen_glyphs *temp_glyphs;
  55.  
  56.   /* Intended cursor position of this screen.
  57.      Measured in characters, counting from upper left corner
  58.      within the screen.  */
  59.   int cursor_x;
  60.   int cursor_y;
  61.  
  62.   /* Is the cursor turned off? */
  63.   int cursor_erased;
  64.  
  65.   /* Actual cursor position of this screen.
  66.      (Not used for terminal screens.)  */
  67.   int phys_cursor_x;
  68.   int phys_cursor_y;
  69.  
  70.   /* Size of this screen, in units of characters.  */
  71.   int height;
  72.   int width;
  73.  
  74.   /* New height and width for pending size change.  0 if no change pending.  */
  75.   int new_height, new_width;
  76.  
  77.   /* Name of this screen: a Lisp string.  */
  78.   Lisp_Object name;
  79.  
  80.   /* This screen's root window.  Every screen has one.
  81.      If the screen has only a minibuffer window, this is it.
  82.      Otherwise, if the screen has a minibuffer window, this is its sibling.  */
  83.   Lisp_Object root_window;
  84.  
  85.   /* This screen's selected window.
  86.      Each screen has its own window hierarchy
  87.      and one of the windows in it is selected within the screen.
  88.      The selected window of the selected screen is Emacs's selected window.  */
  89.   Lisp_Object selected_window;
  90.  
  91.   /* This screen's minibuffer window.
  92.      Most screens have their own minibuffer windows,
  93.      but only the selected screen's minibuffer window
  94.      can actually appear to exist.  */
  95.   Lisp_Object minibuffer_window;
  96.  
  97.   /* A copy of the global Vbuffer_list, to maintain a per-screen buffer
  98.      ordering.  The Vbuffer_list variable and the buffer_list slot of each
  99.      screen contain exactly the same data, just in different orders.  */
  100.   Lisp_Object buffer_alist;
  101.  
  102.   /* Parameter alist of this screen.
  103.      These are the parameters specified when creating the screen
  104.      or modified with modify-screen-parameters.  */
  105.   Lisp_Object param_alist;
  106.  
  107.   /* Vector representing the menubar currently displayed.  See menubar.c. */
  108.   Lisp_Object menubar_data;
  109.  
  110.   /* The output method says how the contents of this screen
  111.      are displayed.  It could be using termcap, or using an X window.  */
  112.   enum output_method output_method;
  113.  
  114.   /* A structure of auxiliary data used for displaying the contents.
  115.      struct x_display is used for X window screens;
  116.      it is defined in xterm.h.  */
  117.   union display { struct x_display *x; int nothing; } display;
  118.  
  119.   /* Nonzero if last attempt at redisplay on this screen was preempted.  */
  120.   char display_preempted;
  121.  
  122.   /* Nonzero if screen is currently displayed.  */
  123.   char visible;
  124.  
  125.   /* Nonzero if window is currently iconified.
  126.      This and visible are mutually exclusive.  */
  127.   char iconified;
  128.  
  129.   /* Nonzero if this screen should be redrawn.  */
  130.   char garbaged;
  131.  
  132.   /* True if screen actually has a  minibuffer window on it.
  133.      0 if using a minibuffer window that isn't on this screen.  */
  134.   char has_minibuffer;
  135.      
  136.   /* 0 means, if this screen has just one window,
  137.      show no modeline for that window.  */
  138.   char wants_modeline;
  139.  
  140.   /* True if screen's root window can't be split.  */
  141.   char no_split;
  142.  
  143.   /* Storage for messages to this screen. */
  144.   char *message_buf;
  145.  
  146.   /* list of faces */
  147.   struct face**    faces;
  148.   int n_faces;
  149.  
  150.   /* the lisp data (shadowing the C data) */
  151.   Lisp_Object face_alist;
  152. };
  153.  
  154. typedef struct screen *SCREEN_PTR;
  155.  
  156. #ifdef emacs
  157.  
  158. #define XSCREEN(p) ((struct screen *) XPNTR (p))
  159. #define XSETSCREEN(p, v) ((struct screen *) XSETPNTR (p, v))
  160.  
  161. #define WINDOW_SCREEN(w) (w)->screen
  162.  
  163. #define SET_SCREEN_GARBAGED(s) (screen_garbaged = 1, s->garbaged = 1)
  164. #define SCREEN_IS_TERMCAP(s) ((s)->output_method == output_termcap)
  165. #define SCREEN_IS_X(s) ((s)->output_method == output_x_window)
  166. #define SCREEN_CURRENT_GLYPHS(s) (s)->current_glyphs
  167. #define SCREEN_DESIRED_GLYPHS(s) (s)->desired_glyphs
  168. #define SCREEN_TEMP_GLYPHS(s) (s)->temp_glyphs
  169. #define SCREEN_HEIGHT(s) (s)->height
  170. #define SCREEN_WIDTH(s) (s)->width
  171. #define SCREEN_NEW_HEIGHT(s) (s)->new_height
  172. #define SCREEN_NEW_WIDTH(s) (s)->new_width
  173. #define SCREEN_CURSOR_X(s) (s)->cursor_x
  174. #define SCREEN_CURSOR_Y(s) (s)->cursor_y
  175. #define SCREEN_VISIBLE_P(s) (s)->visible
  176. #define SCREEN_GARBAGED_P(s) (s)->garbaged
  177. #define SCREEN_NO_SPLIT_P(s) (s)->no_split
  178. #define SCREEN_WANTS_MODELINE_P(s) (s)->wants_modeline
  179. #define SCREEN_ICONIFIED_P(s) (s)->iconified
  180. #define SCREEN_MINIBUF_WINDOW(s) (s)->minibuffer_window
  181. #define SCREEN_ROOT_WINDOW(s) (s)->root_window
  182. #define SCREEN_SELECTED_WINDOW(s) (s)->selected_window
  183. #define SET_GLYPHS_SCREEN(glyphs,screen) ((glyphs)->screen = (screen))
  184. #define SCREEN_INSERT_COST(s) (s)->insert_line_cost    
  185. #define SCREEN_DELETE_COST(s) (s)->delete_line_cost    
  186. #define SCREEN_INSERTN_COST(s) (s)->insert_n_lines_cost
  187. #define SCREEN_DELETEN_COST(s) (s)->delete_n_lines_cost
  188. #define SCREEN_MESSAGE_BUF(s) (s)->message_buf
  189.  
  190. #define SCREEN_NORMAL_FACE(s) (*(s)->faces [0])
  191. #define SCREEN_MODELINE_FACE(s) (*(s)->faces [1])
  192. #define SCREEN_HIGHLIGHT_FACE(s) (*(s)->faces [2])
  193.  
  194. #define CHECK_SCREEN(x, i) \
  195.   { if (!SCREENP ((x))) x = wrong_type_argument (Qscreenp, (x)); }
  196. extern Lisp_Object Qscreenp;
  197.  
  198. extern struct screen *selected_screen;
  199.  
  200. extern struct screen *make_terminal_screen ();
  201. extern struct screen *make_screen ();
  202. /*extern struct screen *make_minibuffer_screen ();*/
  203. /*extern struct screen *make_screen_without_minibuffer ();*/
  204.  
  205. extern Lisp_Object Vscreen_list;
  206. extern Lisp_Object Vglobal_minibuffer_screen;
  207.  
  208. extern Lisp_Object Vterminal_screen;
  209.  
  210. #endif /* emacs */
  211.  
  212.  
  213. #else /* not MULTI_SCREEN */
  214.  
  215. #ifdef emacs
  216.  
  217. /* These definitions are used in a single-screen version of Emacs.  */
  218.  
  219. #define SCREEN_PTR int
  220.  
  221. extern int selected_screen;
  222.  
  223. #define XSCREEN(s) selected_screen
  224. #define WINDOW_SCREEN(w) selected_screen
  225.  
  226. #define SET_SCREEN_GARBAGED(s) (screen_garbaged = 1)
  227. #define SCREEN_IS_TERMCAP(s) 1
  228. #define SCREEN_CURRENT_GLYPHS(s) current_glyphs
  229. #define SCREEN_DESIRED_GLYPHS(s) desired_glyphs
  230. #define SCREEN_TEMP_GLYPHS(s) temp_glyphs
  231. #define SCREEN_HEIGHT(s) screen_height
  232. #define SCREEN_WIDTH(s) screen_width
  233. #define SCREEN_NEW_HEIGHT(s) delayed_screen_height
  234. #define SCREEN_NEW_WIDTH(s) delayed_screen_width
  235. #define SCREEN_CURSOR_X(s) cursX
  236. #define SCREEN_CURSOR_Y(s) cursY
  237. #define SCREEN_VISIBLE_P(s) 1
  238. #define SCREEN_GARBAGED_P(s) screen_garbaged
  239. #define SCREEN_NO_SPLIT_P(s) 0
  240. #define SCREEN_WANTS_MODELINE_P(s) 1
  241. #define SCREEN_ICONIFIED_P(s) 0
  242. #define SCREEN_MINIBUF_WINDOW(s) minibuf_window
  243. #define SCREEN_ROOT_WINDOW(s) root_window
  244. #define SCREEN_SELECTED_WINDOW(s) selected_window
  245. #define SCREENP(s) 0
  246. #define SET_GLYPHS_SCREEN(glyphs,screen)
  247. #define SCREEN_INSERT_COST(screen)  insert_line_cost    
  248. #define SCREEN_DELETE_COST(screen)  delete_line_cost    
  249. #define SCREEN_INSERTN_COST(screen) insert_n_lines_cost
  250. #define SCREEN_DELETEN_COST(screen) delete_n_lines_cost
  251. #define SCREEN_MESSAGE_BUF(s) message_buf
  252.  
  253. #define SCREEN_NORMAL_FACE(s) normal_face
  254. #define SCREEN_HIGHLIGHT_FACE(s) highlight_face
  255. #define SCREEN_MODELINE_FACE(s) modeline_face
  256. #define SCREEN_SELECTION_FACE(s) selection_face
  257. #define SCREEN_SECONDARY_SELECTION_FACE(s) secondary_selection_face
  258. #define SCREEN_OVERLAP_SELECTION_FACE(s) overlap_selection_face
  259.  
  260. extern int screen_width, screen_height;
  261. extern int cursX, cursY;
  262.  
  263. #endif /* emacs */
  264.  
  265. #endif /* not MULTI_SCREEN */
  266.  
  267. #ifdef emacs
  268.  
  269. extern SCREEN_PTR choose_minibuf_screen ();
  270.  
  271. extern int scroll_screen_lines (SCREEN_PTR, int, int, int);
  272. extern int update_screen (SCREEN_PTR, int, int);
  273. extern int scroll_cost (SCREEN_PTR, int, int, int);
  274. extern void do_line_insertion_deletion_costs (SCREEN_PTR, 
  275.                           char *, char *,
  276.                           char *, char *,
  277.                           char *, char *,
  278.                           int);
  279. extern void get_screen_size (int *, int *);
  280.  
  281. /* select_screen() and Fselect_screen() should only be called in response to
  282.    user action, since we use the mouse_timestamp as the timestamp for a
  283.    call to XSetInputFocus.  select_screen_internal() changes selected_screen
  284.    and runs some hooks, but does not set focus.  It is appropriate to call
  285.    in response to a FocusIn event.
  286.  
  287.    Fselect_screen() and select_screen() are the same (different typed args.)
  288.  */
  289. extern void select_screen (struct screen *);
  290. extern void select_screen_internal (struct screen *);
  291.  
  292. #endif /* emacs */
  293.  
  294. #endif /* _EMACS_SCREEN_H_ */
  295.