1 /* Copyright (c) 2008, 2009
2  *      Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
3  *      Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
4  *      Micah Cowan (micah@cowan.name)
5  *      Sadrul Habib Chowdhury (sadrul@users.sourceforge.net)
6  * Copyright (c) 1993-2002, 2003, 2005, 2006, 2007
7  *      Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
8  *      Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
9  * Copyright (c) 1987 Oliver Laumann
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 3, or (at your option)
14  * any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program (see the file COPYING); if not, see
23  * https://www.gnu.org/licenses/, or contact Free Software Foundation, Inc.,
24  * 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
25  *
26  ****************************************************************
27  * $Id$ GNU
28  */
29 
30 #ifndef SCREEN_CANVAS_H
31 #define SCREEN_CANVAS_H
32 
33 #define SLICE_UNKN 0
34 #define SLICE_VERT (1 << 0)
35 #define SLICE_HORI (1 << 1)
36 
37 #define SLICE_THIS (1 << 2)	/* used in equal test */
38 #define SLICE_GLOBAL (1 << 3)
39 
40 struct canvas
41 {
42   struct canvas   *c_next;	/* next canvas on display */
43   struct display  *c_display;	/* back pointer to display */
44 
45   struct canvas   *c_slnext;	/* next canvas in display slice */
46   struct canvas   *c_slprev;	/* prev canvas in display slice */
47   struct canvas   *c_slperp;	/* perpendicular slice */
48   struct canvas   *c_slback;	/* perpendicular slice back pointer */
49   int              c_slorient;  /* our slice orientation */
50   int              c_slweight;	/* size ratio */
51 
52   struct viewport *c_vplist;
53   struct layer    *c_layer;	/* layer on this canvas */
54   struct canvas   *c_lnext;	/* next canvas that displays layer */
55   struct layer     c_blank;	/* bottom layer, always blank */
56   int              c_xoff;	/* canvas x offset on display */
57   int              c_yoff;	/* canvas y offset on display */
58   int              c_xs;
59   int              c_xe;
60   int              c_ys;
61   int              c_ye;
62   struct event     c_captev;	/* caption changed event */
63 };
64 
65 struct win;			/* forward declaration */
66 
67 extern void  SetCanvasWindow __P((struct canvas *, struct win *));
68 extern void  SetForeCanvas __P((struct display *, struct canvas *));
69 extern struct canvas *FindCanvas __P((int, int));
70 extern int   MakeDefaultCanvas __P((void));
71 extern int   AddCanvas __P((int));
72 extern void  RemCanvas __P((void));
73 extern void  OneCanvas __P((void));
74 extern void  FreeCanvas __P((struct canvas *));
75 extern void  ResizeCanvas __P((struct canvas *));
76 extern void  RecreateCanvasChain __P((void));
77 extern void  RethinkViewportOffsets __P((struct canvas *));
78 extern int   CountCanvasPerp __P((struct canvas *));
79 extern void  EqualizeCanvas __P((struct canvas *, int));
80 extern void  DupLayoutCv __P((struct canvas *, struct canvas *, int));
81 extern void  PutWindowCv __P((struct canvas *));
82 
83 #define CV_CALL(cv, cmd)			\
84 {						\
85   struct display *olddisplay = display;		\
86   struct layer *oldflayer = flayer;		\
87   struct layer *l = cv->c_layer;		\
88   struct canvas *cvlist = l->l_cvlist;		\
89   struct canvas *cvlnext = cv->c_lnext;		\
90   flayer = l;					\
91   l->l_cvlist = cv;				\
92   cv->c_lnext = 0;				\
93   cmd;						\
94   flayer = oldflayer;				\
95   l->l_cvlist = cvlist;				\
96   cv->c_lnext = cvlnext;			\
97   display = olddisplay;				\
98 }
99 
100 #endif /* SCREEN_CANVAS_H */
101 
102