home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / e20313sr.zip / emacs / 20.3.1 / src / pmterm.h < prev    next >
C/C++ Source or Header  |  1999-07-31  |  6KB  |  181 lines

  1. /* pmterm.h
  2.    Copyright (C) 1993-1996 Eberhard Mattes.
  3.    Copyright (C) 1995 Patrick Nadeau (scroll bar code)
  4.    Copyright (C) 1989-1995 Free Software Foundation, Inc. (code from xterm.h)
  5.  
  6. This file is part of GNU Emacs.
  7.  
  8. GNU Emacs is free software; you can redistribute it and/or modify
  9. it under the terms of the GNU General Public License as published by
  10. the Free Software Foundation; either version 2, or (at your option)
  11. any later version.
  12.  
  13. GNU Emacs is distributed in the hope that it will be useful,
  14. but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16. GNU General Public License for more details.
  17.  
  18. You should have received a copy of the GNU General Public License
  19. along with GNU Emacs; see the file COPYING.  If not, write to
  20. the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  21. Boston, MA 02111-1307, USA.  */
  22.  
  23.  
  24. #include "pmlib.h"
  25.  
  26. struct frame;
  27.  
  28. void pm_send (const void *src, unsigned size);
  29. void pm_send_collect (const void *src, unsigned size);
  30. void pm_send_flush (void);
  31. void *pm_receive (int serial, void *dst, int *size, int may_paint);
  32. void pm_menubar_selection (struct frame *f, int sel);
  33.  
  34. #define XDISPLAY
  35. #define ROOT_WINDOW        ((Window *)0)
  36. #define FRAME_X_WINDOW(f)    ((unsigned long)f)
  37.  
  38. struct x_output
  39. {
  40.   XFontStruct *font;
  41.   int internal_border_width;
  42.   int pixel_height;
  43.   int pixel_width;
  44.   int line_height;
  45.  
  46.   /* If a fontset is specified for this frame instead of font, this
  47.      value contains an ID of the fontset, else -1.  */
  48.   int fontset;
  49.  
  50.   unsigned background_color;
  51.   unsigned foreground_color;
  52.  
  53.   /* Table of parameter faces for this frame.  */
  54.   struct face **param_faces;
  55.   int n_param_faces;
  56.  
  57.   /* Table of computed faces for this frame. */
  58.   struct face **computed_faces;
  59.   int n_computed_faces;        /* How many are valid */
  60.   int size_computed_faces;    /* How many are allocated */
  61.  
  62.   /* This is the Emacs structure for the X display this frame is on.  */
  63.   struct x_display_info *display_info;
  64.  
  65.   int left_pos;
  66.   int top_pos;
  67.  
  68.   /* Mouse position.  Valid only if mouse_moved is non-zero.  */
  69.   int mouse_x;
  70.   int mouse_y;
  71. };
  72.  
  73. /* Borrowed from xterm.h.  */
  74.  
  75. struct x_display_info
  76. {
  77.   /* Number of frames that are on this display.  */
  78.   int reference_count;
  79.  
  80.   /* Mask of things that cause the mouse to be grabbed.  */
  81.   int grabbed;
  82.  
  83.   /* These variables describe the range of text currently shown
  84.      in its mouse-face, together with the window they apply to.
  85.      As long as the mouse stays within this range, we need not
  86.      redraw anything on its account.  */
  87.   int mouse_face_beg_row, mouse_face_beg_col;
  88.   int mouse_face_end_row, mouse_face_end_col;
  89.   int mouse_face_past_end;
  90.   Lisp_Object mouse_face_window;
  91.   int mouse_face_face_id;
  92.  
  93.   /* 1 if a mouse motion event came and we didn't handle it right away because
  94.      gc was in progress.  */
  95.   int mouse_face_deferred_gc;
  96.  
  97.   /* FRAME and X, Y position of mouse when last checked for
  98.      highlighting.  X and Y can be negative or out of range for the frame.  */
  99.   struct frame *mouse_face_mouse_frame;
  100.   int mouse_face_mouse_x, mouse_face_mouse_y;
  101.  
  102.   /* Nonzero means defer mouse-motion highlighting.  */
  103.   int mouse_face_defer;
  104. };
  105.  
  106.  
  107. #define x_destroy_bitmap(f,id)
  108.  
  109. extern Display *x_current_display;
  110. extern int pm_serial;
  111.  
  112. extern struct x_display_info *pm_display;
  113.  
  114. #define PIXEL_WIDTH(f)  ((f)->output_data.x->pixel_width)
  115. #define PIXEL_HEIGHT(f) ((f)->output_data.x->pixel_height)
  116.  
  117. #define FONT_WIDTH(f)   ((f)->max_bounds.width)
  118. #define FONT_HEIGHT(f)  ((f)->ascent + (f)->descent)
  119. #define FONT_BASE(f)    ((f)->ascent)
  120.  
  121. #define FRAME_PARAM_FACES(f) ((f)->output_data.x->param_faces)
  122. #define FRAME_N_PARAM_FACES(f) ((f)->output_data.x->n_param_faces)
  123. #define FRAME_DEFAULT_PARAM_FACE(f) (FRAME_PARAM_FACES (f)[0])
  124. #define FRAME_MODE_LINE_PARAM_FACE(f) (FRAME_PARAM_FACES (f)[1])
  125.  
  126. #define FRAME_COMPUTED_FACES(f) ((f)->output_data.x->computed_faces)
  127. #define FRAME_N_COMPUTED_FACES(f) ((f)->output_data.x->n_computed_faces)
  128. #define FRAME_SIZE_COMPUTED_FACES(f) ((f)->output_data.x->size_computed_faces)
  129. #define FRAME_DEFAULT_FACE(f) ((f)->output_data.x->computed_faces[0])
  130. #define FRAME_MODE_LINE_FACE(f) ((f)->output_data.x->computed_faces[1])
  131.  
  132. #define FRAME_X_DISPLAY(f) 0
  133.  
  134. /* This gives the x_display_info structure for the display F is on.  */
  135. #define FRAME_X_DISPLAY_INFO(f) ((f)->output_data.x->display_info)
  136.  
  137. #define FRAME_FOREGROUND_PIXEL(f) ((f)->output_data.x->foreground_color)
  138. #define FRAME_BACKGROUND_PIXEL(f) ((f)->output_data.x->background_color)
  139. #define FRAME_FONT(f) ((f)->output_data.x->font)
  140. #define FRAME_INTERNAL_BORDER_WIDTH(f) ((f)->output_data.x->internal_border_width)
  141. #define FRAME_LINE_HEIGHT(f) ((f)->output_data.x->line_height)
  142.  
  143. /* We represent scroll bars as lisp vectors.  This allows us to place
  144.    references to them in windows without worrying about whether we'll
  145.    end up with windows referring to dead scroll bars; the garbage
  146.    collector will free it when its time comes.
  147.  
  148.    We use struct scroll_bar as a template for accessing fields of the
  149.    vector.  */
  150.  
  151. struct scroll_bar {
  152.  
  153.   /* These fields are shared by all vectors.  */
  154.   EMACS_INT size_from_Lisp_Vector_struct;
  155.   struct Lisp_Vector *next_from_Lisp_Vector_struct;
  156.  
  157.   /* The window we're a scroll bar for.  */
  158.   Lisp_Object window;
  159.  
  160.   /* The next and previous in the chain of scroll bars in this frame.  */
  161.   Lisp_Object next, prev;
  162.  
  163.   /* The ID of this scroll bar.  */
  164.   Lisp_Object id;
  165.  
  166.   /* Speed hack: the following fields cache the status of the
  167.      scrollbar.  */
  168.   Lisp_Object top, left, width, height;
  169.   Lisp_Object whole, portion, position;
  170.   Lisp_Object scaled_whole, scaled_portion, scaled_position;
  171. };
  172.  
  173. /* The number of elements a vector holding a struct scroll_bar needs.  */
  174. #define SCROLL_BAR_VEC_SIZE                    \
  175.   ((sizeof (struct scroll_bar)                    \
  176.     - sizeof (EMACS_INT) - sizeof (struct Lisp_Vector *))    \
  177.    / sizeof (Lisp_Object))
  178.  
  179. /* Turning a lisp vector value into a pointer to a struct scroll_bar.  */
  180. #define XSCROLL_BAR(vec) ((struct scroll_bar *) XVECTOR (vec))
  181.