1 #ifndef DISPLAYH 2 #define DISPLAYH 3 4 /* 5 * $Id: display.h,v 1.4 2000/08/10 21:02:50 danny Exp $ 6 * 7 * Copyright � 1992, 1993 Free Software Foundation, Inc. 8 * 9 * This program is free software; you can redistribute it and/or modify 10 * it under the terms of the GNU General Public License as published by 11 * the Free Software Foundation; either version 2, or (at your option) 12 * any later version. 13 * 14 * This program is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU General Public License for more details. 18 * 19 * You should have received a copy of the GNU General Public License 20 * along with this software; see the file COPYING. If not, write to 21 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 22 */ 23 #include "global.h" 24 #include "font.h" 25 #include "cell.h" 26 #include "ir.h" 27 28 union cell_numeric 29 { 30 int integer; 31 double dbl; 32 }; 33 34 struct cell_display 35 { 36 CELLREF r, c; 37 int cell_type; 38 int justification; 39 struct font_memo *font; 40 41 char *unclipped; 42 struct xx_sIntRectangle goal; 43 44 char *clipped; /* Box of clipped string, if known. */ 45 struct xx_sIntRectangle clip; 46 union cell_numeric numeric; /* Value from which to compute clipped str. */ 47 48 49 struct xx_sIntRectangle layout; /* Space available under current layout. */ 50 51 struct cell_display *used_by; 52 struct cell_display *was_used_by; 53 struct cell_display *next_damaged; 54 }; 55 56 struct display; 57 /* This should set the w_goal and h_goal fields of the cell_display. */ 58 typedef void (*cell_display_metric) (struct cell_display *, 59 struct display *); 60 61 struct display 62 { 63 struct rng range; 64 int *widths; 65 int *heights; 66 int *rowy; 67 int *colx; 68 void *vdata; 69 cell_display_metric metric; 70 struct cell_display *cells; 71 struct cell_display *damaged; /* This is a list, terminated by a pointer */ 72 /* to this structure rather than 0, */ 73 /* following the next_damage chain. */ 74 }; 75 76 extern void free_display (struct display *); 77 extern void build_display (struct display *, struct rng *, 78 cell_display_metric, void *); 79 extern void build_unscaled_display (struct display *, struct rng *, 80 cell_display_metric, void *); 81 extern void display_test_cmd (struct rng *); 82 extern struct cell_display *cell_display_of (struct display *dpy, 83 CELLREF r, CELLREF c); 84 extern void display_range (struct rng *, struct display *dpy, 85 int x, int y, int w, int h); 86 extern void record_display_damage (struct display *, 87 int x, int y, int w, int h); 88 extern void layout (struct display *); 89 extern int pr_display_cell (struct display *, CELLREF, CELLREF, CELL *); 90 91 #define display_width(DPY) \ 92 ((DPY)->colx[(DPY)->range.hc - (DPY)->range.lc] \ 93 + (DPY)->widths[(DPY)->range.hc - (DPY)->range.lc]) 94 #define display_height(DPY) \ 95 ((DPY)->rowy[(DPY)->range.hr - (DPY)->range.lr] \ 96 + (DPY)->heights[(DPY)->range.hr - (DPY)->range.lr]) 97 #define dpy_cols(DPY) ((DPY)->range.hc - (DPY)->range.lc) 98 #define dpy_aref(DPY,R,C) \ 99 ((DPY)->cells + (((R) - (DPY)->range.lr) * dpy_cols(DPY)) \ 100 + ((C) - (DPY)->range.lc)) 101 #endif 102