summaryrefslogtreecommitdiff
path: root/src/canvas.h
blob: 124ceada334f0dd0190c818504b8023ec59b38d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/* Copyright (c) 2008, 2009
 *      Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
 *      Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
 *      Micah Cowan (micah@cowan.name)
 *      Sadrul Habib Chowdhury (sadrul@users.sourceforge.net)
 * Copyright (c) 1993-2002, 2003, 2005, 2006, 2007
 *      Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
 *      Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
 * Copyright (c) 1987 Oliver Laumann
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program (see the file COPYING); if not, see
 * http://www.gnu.org/licenses/, or contact Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
 *
 ****************************************************************
 * $Id$ GNU
 */

#ifndef SCREEN_CANVAS_H
#define SCREEN_CANVAS_H

#define SLICE_UNKN 0
#define SLICE_VERT (1 << 0)
#define SLICE_HORI (1 << 1)

#define SLICE_THIS (1 << 2)	/* used in equal test */
#define SLICE_GLOBAL (1 << 3)

typedef struct Display Display;
typedef struct Viewport Viewport;
typedef struct Window Window;

typedef struct Canvas Canvas;
struct Canvas {
	Canvas   *c_next;		/* next canvas on display */
	Display  *c_display;		/* back pointer to display */

	Canvas   *c_slnext;		/* next canvas in display slice */
	Canvas   *c_slprev;		/* prev canvas in display slice */
	Canvas   *c_slperp;		/* perpendicular slice */
	Canvas   *c_slback;		/* perpendicular slice back pointer */
	int              c_slorient;	/* our slice orientation */
	int              c_slweight;	/* size ratio */

	Viewport	*c_vplist;
	Layer    *c_layer;		/* layer on this canvas */
	Canvas   *c_lnext;		/* next canvas that displays layer */
	Layer     c_blank;		/* bottom layer, always blank */
	int              c_xoff;	/* canvas x offset on display */
	int              c_yoff;	/* canvas y offset on display */
	int              c_xs;
	int              c_xe;
	int              c_ys;
	int              c_ye;
	Event     c_captev;		/* caption changed event */
};

void  SetCanvasWindow (Canvas *, Window *);
void  SetForeCanvas (Display *, Canvas *);
Canvas *FindCanvas (int, int);
int   MakeDefaultCanvas (void);
int   AddCanvas (int);
void  RemCanvas (void);
void  OneCanvas (void);
void  FreeCanvas (Canvas *);
int   CountCanvas (Canvas *);
void  ResizeCanvas (Canvas *);
void  RecreateCanvasChain (void);
void  RethinkViewportOffsets (Canvas *);
int   CountCanvasPerp (Canvas *);
void  EqualizeCanvas (Canvas *, int);
void  DupLayoutCv (Canvas *, Canvas *, int);
void  PutWindowCv (Canvas *);

#define CV_CALL(cv, cmd)		\
{					\
  Display *olddisplay = display;	\
  Layer *oldflayer = flayer;		\
  Layer *l = cv->c_layer;		\
  Canvas *cvlist = l->l_cvlist;		\
  Canvas *cvlnext = cv->c_lnext;	\
  flayer = l;				\
  l->l_cvlist = cv;			\
  cv->c_lnext = 0;			\
  cmd;					\
  flayer = oldflayer;			\
  l->l_cvlist = cvlist;			\
  cv->c_lnext = cvlnext;		\
  display = olddisplay;			\
}

#endif /* SCREEN_CANVAS_H */