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
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)
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.
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 * http://www.gnu.org/licenses/, or contact Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
26 ****************************************************************
34 extern struct display
*display
;
37 RethinkDisplayViewports()
40 struct viewport
*vp
, *vpn
;
42 /* free old viewports */
43 for (cv
= display
->d_cvlist
; cv
; cv
= cv
->c_next
)
45 for (vp
= cv
->c_vplist
; vp
; vp
= vpn
)
49 bzero((char *)vp
, sizeof(*vp
));
54 display
->d_vpxmin
= -1;
55 display
->d_vpxmax
= -1;
57 for (cv
= display
->d_cvlist
; cv
; cv
= cv
->c_next
)
59 if ((vp
= (struct viewport
*)malloc(sizeof *vp
)) == 0)
64 vp
->v_ys
= (cv
->c_ys
+ cv
->c_ye
) / 2;
67 vp
->v_xoff
= cv
->c_xoff
;
68 vp
->v_yoff
= cv
->c_yoff
;
69 vp
->v_next
= cv
->c_vplist
;
72 if ((vp
= (struct viewport
*)malloc(sizeof *vp
)) == 0)
75 vp
->v_xs
= (cv
->c_xs
+ cv
->c_xe
) / 2;
76 vp
->v_ys
= (3 * cv
->c_ys
+ cv
->c_ye
) / 4;
78 vp
->v_ye
= (cv
->c_ys
+ cv
->c_ye
) / 2 - 1;
79 vp
->v_xoff
= cv
->c_xoff
;
80 vp
->v_yoff
= cv
->c_yoff
;
81 vp
->v_next
= cv
->c_vplist
;
84 if ((vp
= (struct viewport
*)malloc(sizeof *vp
)) == 0)
88 vp
->v_ys
= (3 * cv
->c_ys
+ cv
->c_ye
) / 4;
89 vp
->v_xe
= (3 * cv
->c_xs
+ cv
->c_xe
) / 4 - 1;
90 vp
->v_ye
= (cv
->c_ys
+ cv
->c_ye
) / 2 - 1;
91 vp
->v_xoff
= cv
->c_xoff
;
92 vp
->v_yoff
= cv
->c_yoff
;
93 vp
->v_next
= cv
->c_vplist
;
96 if ((vp
= (struct viewport
*)malloc(sizeof *vp
)) == 0)
102 vp
->v_ye
= (3 * cv
->c_ys
+ cv
->c_ye
) / 4 - 1;
103 vp
->v_xoff
= cv
->c_xoff
;
104 vp
->v_yoff
= cv
->c_yoff
;
105 vp
->v_next
= cv
->c_vplist
;
113 vp
->v_xoff
= cv
->c_xoff
;
114 vp
->v_yoff
= cv
->c_yoff
;
115 vp
->v_next
= cv
->c_vplist
;
119 if (cv
->c_xs
< display
->d_vpxmin
|| display
->d_vpxmin
== -1)
120 display
->d_vpxmin
= cv
->c_xs
;
121 if (cv
->c_xe
> display
->d_vpxmax
|| display
->d_vpxmax
== -1)
122 display
->d_vpxmax
= cv
->c_xe
;
128 RethinkViewportOffsets(cv
)
133 for (vp
= cv
->c_vplist
; vp
; vp
= vp
->v_next
)
135 vp
->v_xoff
= cv
->c_xoff
;
136 vp
->v_yoff
= cv
->c_yoff
;