Debian Codegraph @

libsrc/idi/cidi/x11/iiz.c

raw
1 /* @(#)iiz.c 19.1 (ESO-DMD) 02/25/03 13:54:49 */
2 /*===========================================================================
3 Copyright (C) 1995 European Southern Observatory (ESO)
4
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License as
7 published by the Free Software Foundation; either version 2 of
8 the License, or (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public
16 License along with this program; if not, write to the Free
17 Software Foundation, Inc., 675 Massachusetts Ave, Cambridge,
18 MA 02139, USA.
19
20 Correspondence concerning ESO-MIDAS should be addressed as follows:
21 Internet e-mail: [email protected]
22 Postal address: European Southern Observatory
23 Data Management Division
24 Karl-Schwarzschild-Strasse 2
25 D 85748 Garching bei Muenchen
26 GERMANY
27 ===========================================================================*/
28
29 /* ----------------------------------------------------------------- */
30 /* --------- IIZ -------------------------------------------------- */
31 /* ----------------------------------------------------------------- */
32
33 /* file iiz.c : contains the following routines
34 *
35 * IIZWSC_C : Write Memory Scroll;
36 * IIZWZM_C : Write Memory Zoom;
37 * IIZRSZ_C : Read Memory Scroll and Zoom;
38 * IIZWSZ_C : Write Memory Scroll and Zoom;
39 *
40 * IIZWZP_C : Write Display Zoom and Pan; not supported
41 * IIZRZP_C : Read Display Zoom and Pan; not supported
42 * *
43 **********************************************************************
44 * V 1.1 871201: P. Santin - Trieste Astronomical Observatory *
45 * V 2.0 881202: K. Banse - ESO *
46
47 010514 last modif
48
49 **********************************************************************
50 */
51
52 # include <idi.h>
53 # include <idistruct.h>
54 # include <proto_idi.h>
55
56
57 static CONF_DATA *conf;
58 static MEM_DATA *mem;
59
60
61 /*
62
63 */
64
65 /************************************************************************
66 * IIZWSC_C routine : write memory scroll *
67 * *
68 * synopsis IIZWSC_C (display , memlist , nmem , xscr , yscr); *
69 * *
70 * int display; input display identifier *
71 * int memlist[]; input memory list *
72 * int nmem; input number of memories *
73 * int xscr; input x scroll *
74 * int yscr; input y scroll *
75 ************************************************************************/
76
77 int IIZWSC_C (display, memlist, nmem, xscr, yscr)
78
79 int display , nmem , xscr , yscr;
80 int memlist[];
81
82 {
83 int i, curmem;
84
85
86 if (ididev[display].opened == 0) return(DEVNOTOP);
87 conf = ididev[display].confptr;
88
89 for (i=0; i<nmem; i++)
90 {
91 curmem = memlist[i];
92 if (conf->RGBmode == 1)
93 {
94 if (curmem == 3)
95 curmem = conf->overlay;
96 else
97 curmem = 0; /* single memory for 3 channels */
98 }
99 else
100 {
101 if ((curmem < 0) || (curmem >= conf->nmem)) return(ILLMEMID);
102 }
103
104 mem = conf->memory[curmem];
105 mem->xscroll = xscr;
106 mem->yscroll = yscr;
107 allrefr(display,mem,curmem,0);
108 }
109
110 return(II_SUCCESS);
111 }
112
113 /*
114
115 */
116
117 /************************************************************************
118 * IIZWZM_C routine : write memory zoom *
119 * *
120 * synopsis IIZWZM_C (display , memlist , nmem , zoom); *
121 * *
122 * int display; input display identifier *
123 * int memlist[]; input memory list *
124 * int nmem; input number of memories *
125 * int zoom; input zoom factor *
126 ************************************************************************/
127
128 int IIZWZM_C (display , memlist , nmem , zoom)
129
130 int display , nmem , zoom;
131 int memlist[];
132
133 {
134 int i, curmem;
135
136
137 if (ididev[display].opened == 0) return(DEVNOTOP);
138
139 if (zoom < 1) zoom = 1;
140 if (zoom > MAX_ZOOM) zoom = MAX_ZOOM;
141
142 conf = ididev [display].confptr;
143
144 for (i=0; i<nmem; i++)
145 {
146 curmem = memlist[i];
147
148 curmem = memlist[i];
149 if (conf->RGBmode == 1)
150 {
151 if (curmem == 3)
152 curmem = conf->overlay;
153 else
154 curmem = 0; /* single memory for 3 channels */
155 }
156 else
157 {
158 if ((curmem < 0) || (curmem >= conf->nmem)) return(ILLMEMID);
159 }
160
161 mem = conf->memory[curmem];
162 if (zoom != mem->zoom)
163 {
164 mem->zoom = zoom;
165 if (zoom != 1)
166 {
167 if (mem->zmbm == (char*) 0)
168 allo_zmem(display,mem,curmem);
169 copy_zmem(display,mem);
170 }
171 allrefr(display,mem,curmem,2);
172 }
173 }
174
175 return(II_SUCCESS);
176 }
177
178 /*
179
180 */
181
182 /************************************************************************
183 * IIZRSZ_C routine : read memory scroll and zoom *
184 * *
185 * synopsis IIZRSZ_C (display , memid , xscr , yscr , zoom); *
186 * *
187 * int display; input display identifier *
188 * int memid; input memory identifier *
189 * int *xscr; output X scroll *
190 * int *yscr; output Y scroll *
191 * int *zoom; output zoom factor *
192 ************************************************************************/
193
194 int IIZRSZ_C (display , memid , xscr , yscr , zoom)
195
196 int display , memid , *xscr , *yscr , *zoom;
197
198 {
199
200 if (ididev[display].opened == 0) return(DEVNOTOP);
201
202 conf = ididev [display].confptr;
203 if (conf->RGBmode == 1)
204 {
205 if (memid == 3)
206 memid = conf->overlay;
207 else
208 memid = 0; /* single memory for 3 channels */
209 }
210 else
211 {
212 if ((memid < 0) || (memid >= conf->nmem)) return(ILLMEMID);
213 }
214
215 mem = conf->memory[memid];
216 *xscr = mem->xscroll; /* read scroll & zoom parameters */
217 *yscr = mem->yscroll;
218 *zoom = mem->zoom;
219
220 return(II_SUCCESS);
221 }
222
223 /*
224
225 */
226
227 /************************************************************************
228 * IIZWSZ_C routine : write memory scroll and zoom *
229 * *
230 * synopsis IIZWSZ_C (display , memid , xscr , yscr , zoom); *
231 * *
232 * int display; input display identifier *
233 * int memid; input memory identifier *
234 * int xscr; input X scroll *
235 * int yscr; input Y scroll *
236 * int zoom; input zoom factor *
237 ************************************************************************/
238
239 int IIZWSZ_C (display , memid , xscr , yscr , zoom)
240
241 int display , memid , xscr , yscr , zoom;
242
243 {
244 int old_zoom;
245
246 if (ididev[display].opened == 0) return(DEVNOTOP);
247
248 conf = ididev [display].confptr;
249 if (conf->RGBmode == 1)
250 {
251 if (memid == 3)
252 memid = conf->overlay;
253 else
254 memid = 0; /* single memory for 3 channels */
255 }
256 else
257 {
258 if ((memid < 0) || (memid >= conf->nmem)) return(ILLMEMID);
259 }
260
261 mem = conf->memory[memid];
262
263 mem->xscroll = xscr;
264 mem->yscroll = yscr;
265
266 if (zoom < 1) zoom = 1;
267 if (zoom > MAX_ZOOM) zoom = MAX_ZOOM;
268
269 old_zoom = mem->zoom; /* save previous zoom factor */
270 mem->zoom = zoom;
271 if (zoom != 1)
272 {
273 if (mem->zmbm == (char*) 0)
274 allo_zmem(display,mem,memid);
275 copy_zmem(display,mem); /* fill zoom memory */
276 }
277
278 if (zoom != old_zoom) /* zoom factor changed? */
279 allrefr(display,mem,memid,2);
280 else
281 allrefr(display,mem,memid,0);
282
283 return(II_SUCCESS);
284 }
285