~maddevelopers/mg5amcnlo/2.9.4

« back to all changes in this revision

Viewing changes to vendor/StdHEP/src/display/pixmaps.c

pass to v2.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*******************************************************************************
 
2
*                                                                              *
 
3
* pixmaps.c -- Register bitmaps for rotation buttons                           *
 
4
*                                                                              *
 
5
* Copyright (c) 1991 Universities Research Association, Inc.                   *
 
6
* All rights reserved.                                                         *
 
7
*                                                                              *
 
8
* This material resulted from work developed under a Government Contract and   *
 
9
* is subject to the following license:  The Government retains a paid-up,      *
 
10
* nonexclusive, irrevocable worldwide license to reproduce, prepare derivative *
 
11
* works, perform publicly and display publicly by or for the Government,       *
 
12
* including the right to distribute to other Government contractors.  Neither  *
 
13
* the United States nor the United States Department of Energy, nor any of     *
 
14
* their employees, makes any warrenty, express or implied, or assumes any      *
 
15
* legal liability or responsibility for the accuracy, completeness, or         *
 
16
* usefulness of any information, apparatus, product, or process disclosed, or  *
 
17
* represents that its use would not infringe privately owned rights.           *
 
18
*                                                                              *
 
19
* Fermilab Nirvana GUI Library                                                 *
 
20
* August 15, 1991                                                              *
 
21
*                                                                              *
 
22
* Written by Mark Edel                                                         *
 
23
*                                                                              *
 
24
*******************************************************************************/
 
25
static char SCCSID[] = "@(#)pixmaps.c   1.1     4/6/92";
 
26
#include <X11/Intrinsic.h>
 
27
#include <Xm/Xm.h>
 
28
#include "pixmaps.h"
 
29
 
 
30
static unsigned char viewRotXPosBM[] = {
 
31
    0x00, 0x00, 0x00,
 
32
    0x00, 0x00, 0x00,
 
33
    0x00, 0x3c, 0x00,
 
34
    0x00, 0xc3, 0x00,
 
35
    0x01, 0x00, 0x80,
 
36
    0x01, 0x00, 0x80,
 
37
    0x00, 0x00, 0x40,
 
38
    0x00, 0x00, 0x40,
 
39
    0x00, 0x00, 0x40,
 
40
    0x07, 0xff, 0x5c,
 
41
    0x00, 0x00, 0x40,
 
42
    0x00, 0x00, 0x40,
 
43
    0x00, 0x00, 0x40,
 
44
    0x01, 0xe0, 0x80,
 
45
    0x01, 0x80, 0x80,
 
46
    0x01, 0x43, 0x00,
 
47
    0x01, 0x3c, 0x00,
 
48
    0x00, 0x00, 0x00,
 
49
    0x00, 0x00, 0x00};
 
50
 
 
51
static unsigned char viewRotXNegBM[] = {
 
52
    0x00, 0x00, 0x00,
 
53
    0x00, 0x00, 0x00,
 
54
    0x01, 0x3c, 0x00,
 
55
    0x01, 0x43, 0x00,
 
56
    0x01, 0x80, 0x80,
 
57
    0x01, 0xe0, 0x80,
 
58
    0x00, 0x00, 0x40,
 
59
    0x00, 0x00, 0x40,
 
60
    0x00, 0x00, 0x40,
 
61
    0x07, 0xff, 0x5c,
 
62
    0x00, 0x00, 0x40,
 
63
    0x00, 0x00, 0x40,
 
64
    0x00, 0x00, 0x40,
 
65
    0x01, 0x00, 0x80,
 
66
    0x01, 0x00, 0x80,
 
67
    0x00, 0xc3, 0x00,
 
68
    0x00, 0x3c, 0x00,
 
69
    0x00, 0x00, 0x00,
 
70
    0x00, 0x00, 0x00};
 
71
 
 
72
static unsigned char viewRotYPosBM[] = {
 
73
    0x00, 0x00, 0x00,
 
74
    0x00, 0x00, 0x00,
 
75
    0x00, 0x01, 0x00,
 
76
    0x01, 0x88, 0xf0,
 
77
    0x02, 0x08, 0xc0,
 
78
    0x02, 0x08, 0xa0,
 
79
    0x04, 0x08, 0x90,
 
80
    0x04, 0x08, 0x10,
 
81
    0x04, 0x08, 0x10,
 
82
    0x04, 0x08, 0x10,
 
83
    0x02, 0x08, 0x20,
 
84
    0x02, 0x08, 0x20,
 
85
    0x01, 0x80, 0xc0,
 
86
    0x00, 0x7f, 0x00,
 
87
    0x00, 0x00, 0x00,
 
88
    0x00, 0x08, 0x00,
 
89
    0x00, 0x00, 0x00,
 
90
    0x00, 0x00, 0x00};
 
91
 
 
92
static unsigned char viewRotYNegBM[] = {
 
93
    0x00, 0x00, 0x00,
 
94
    0x00, 0x00, 0x00,
 
95
    0x00, 0x08, 0x00,
 
96
    0x07, 0x88, 0xc0,
 
97
    0x01, 0x88, 0x20,
 
98
    0x02, 0x88, 0x20,
 
99
    0x04, 0x08, 0x10,
 
100
    0x04, 0x08, 0x10,
 
101
    0x04, 0x08, 0x10,
 
102
    0x04, 0x08, 0x10,
 
103
    0x02, 0x08, 0x20,
 
104
    0x02, 0x08, 0x20,
 
105
    0x01, 0x80, 0xc0,
 
106
    0x00, 0x7f, 0x00,
 
107
    0x00, 0x00, 0x00,
 
108
    0x00, 0x08, 0x00,
 
109
    0x00, 0x00, 0x00,
 
110
    0x00, 0x00, 0x00};
 
111
    
 
112
static unsigned char viewRotZPosBM[] = {
 
113
    0x00, 0x00, 0x00,
 
114
    0x00, 0x00, 0x00,
 
115
    0x00, 0x00, 0x00,
 
116
    0x00, 0x3c, 0x00,
 
117
    0x00, 0xc3, 0x00,
 
118
    0x01, 0x00, 0x80,
 
119
    0x00, 0x00, 0x40,
 
120
    0x00, 0x00, 0x40,
 
121
    0x04, 0x00, 0x20,
 
122
    0x0e, 0x18, 0x20,
 
123
    0x15, 0x18, 0x20,
 
124
    0x04, 0x00, 0x20,
 
125
    0x02, 0x00, 0x40,
 
126
    0x02, 0x00, 0x40,
 
127
    0x01, 0x00, 0x80,
 
128
    0x00, 0xc3, 0x00,
 
129
    0x00, 0x3c, 0x00,
 
130
    0x00, 0x00, 0x00,
 
131
    0x00, 0x00, 0x00};
 
132
    
 
133
static unsigned char viewRotZNegBM[] = {
 
134
    0x00, 0x00, 0x00,
 
135
    0x00, 0x00, 0x00,
 
136
    0x00, 0x00, 0x00,
 
137
    0x00, 0x3c, 0x00,
 
138
    0x00, 0xc3, 0x00,
 
139
    0x01, 0x00, 0x80,
 
140
    0x02, 0x00, 0x00,
 
141
    0x02, 0x00, 0x00,
 
142
    0x04, 0x00, 0x20,
 
143
    0x04, 0x18, 0x70,
 
144
    0x04, 0x18, 0xa8,
 
145
    0x04, 0x00, 0x20,
 
146
    0x02, 0x00, 0x40,
 
147
    0x02, 0x00, 0x40,
 
148
    0x01, 0x00, 0x80,
 
149
    0x00, 0xc3, 0x00,
 
150
    0x00, 0x3c, 0x00,
 
151
    0x00, 0x00, 0x00,
 
152
    0x00, 0x00, 0x00};
 
153
    
 
154
static unsigned char coordRotXPosBM[] = {
 
155
    0x00, 0x00, 0x00,
 
156
    0x00, 0x00, 0x00,
 
157
    0x00, 0x80, 0x00,
 
158
    0x00, 0x83, 0x80,
 
159
    0x00, 0x84, 0x40,
 
160
    0x00, 0x88, 0x20,
 
161
    0x00, 0x88, 0x00,
 
162
    0x00, 0x88, 0x00,
 
163
    0x00, 0xeb, 0x20,
 
164
    0x01, 0x08, 0x70,
 
165
    0x02, 0x08, 0xa8,
 
166
    0x04, 0x08, 0x20,
 
167
    0x08, 0x04, 0x40,
 
168
    0x10, 0x04, 0x40,
 
169
    0x00, 0x03, 0x80,
 
170
    0x00, 0x00, 0x00,
 
171
    0x00, 0x00, 0x00,
 
172
    0x00, 0x00, 0x00};
 
173
 
 
174
static unsigned char coordRotXNegBM[] = {
 
175
    0x00, 0x00, 0x00,
 
176
    0x00, 0x00, 0x00,
 
177
    0x00, 0x80, 0x00,
 
178
    0x00, 0x83, 0x80,
 
179
    0x00, 0x84, 0x40,
 
180
    0x00, 0x88, 0x20,
 
181
    0x00, 0x88, 0xa8,
 
182
    0x00, 0x88, 0x70,
 
183
    0x00, 0xeb, 0x20,
 
184
    0x01, 0x08, 0x00,
 
185
    0x02, 0x08, 0x00,
 
186
    0x04, 0x08, 0x20,
 
187
    0x08, 0x04, 0x40,
 
188
    0x10, 0x04, 0x40,
 
189
    0x00, 0x03, 0x80,
 
190
    0x00, 0x00, 0x00,
 
191
    0x00, 0x00, 0x00,
 
192
    0x00, 0x00, 0x00};
 
193
 
 
194
static unsigned char coordRotYPosBM[] = {
 
195
    0x00, 0x00, 0x00,
 
196
    0x00, 0x02, 0x00,
 
197
    0x00, 0x04, 0x00,
 
198
    0x00, 0x4f, 0x00,
 
199
    0x01, 0x84, 0xc0,
 
200
    0x02, 0x02, 0x20,
 
201
    0x02, 0x08, 0x20,
 
202
    0x02, 0x08, 0x20,
 
203
    0x01, 0x80, 0xc0,
 
204
    0x00, 0x7f, 0x00,
 
205
    0x00, 0x00, 0x00,
 
206
    0x00, 0x08, 0x00,
 
207
    0x00, 0x08, 0x00,
 
208
    0x07, 0xf8, 0x00,
 
209
    0x00, 0x04, 0x00,
 
210
    0x00, 0x02, 0x00,
 
211
    0x00, 0x01, 0x00,
 
212
    0x00, 0x00, 0x80,
 
213
    0x00, 0x00, 0x00};
 
214
    
 
215
static unsigned char coordRotYNegBM[] = {
 
216
    0x00, 0x00, 0x00,
 
217
    0x00, 0x40, 0x00,
 
218
    0x00, 0x20, 0x00,
 
219
    0x00, 0xf2, 0x00,
 
220
    0x01, 0x21, 0xc0,
 
221
    0x02, 0x40, 0x20,
 
222
    0x02, 0x08, 0x20,
 
223
    0x02, 0x08, 0x20,
 
224
    0x01, 0x80, 0xc0,
 
225
    0x00, 0x7f, 0x00,
 
226
    0x00, 0x00, 0x00,
 
227
    0x00, 0x08, 0x00,
 
228
    0x00, 0x08, 0x00,
 
229
    0x07, 0xf8, 0x00,
 
230
    0x00, 0x04, 0x00,
 
231
    0x00, 0x02, 0x00,
 
232
    0x00, 0x01, 0x00,
 
233
    0x00, 0x00, 0x80,
 
234
    0x00, 0x00, 0x00};
 
235
 
 
236
static unsigned char coordRotZPosBM[] = {
 
237
    0x00, 0x00, 0x00,
 
238
    0x00, 0x02, 0x00,
 
239
    0x00, 0x02, 0x00,
 
240
    0x00, 0x02, 0x00,
 
241
    0x00, 0x02, 0x00,
 
242
    0x00, 0x02, 0x00,
 
243
    0x00, 0x7a, 0x00,
 
244
    0x01, 0x86, 0x00,
 
245
    0x02, 0x03, 0xfc,
 
246
    0x02, 0x05, 0x00,
 
247
    0x04, 0x08, 0x80,
 
248
    0x04, 0x11, 0xc0,
 
249
    0x04, 0x22, 0xa0,
 
250
    0x04, 0x00, 0x80,
 
251
    0x02, 0x01, 0x00,
 
252
    0x02, 0x01, 0x00,
 
253
    0x01, 0x86, 0x00,
 
254
    0x00, 0x78, 0x00,
 
255
    0x00, 0x00, 0x00};
 
256
 
 
257
static unsigned char coordRotZNegBM[] = {
 
258
    0x00, 0x00, 0x00,
 
259
    0x00, 0x02, 0x00,
 
260
    0x00, 0x02, 0x00,
 
261
    0x00, 0x02, 0x00,
 
262
    0x00, 0x02, 0x00,
 
263
    0x00, 0x02, 0x00,
 
264
    0x00, 0x7a, 0x00,
 
265
    0x01, 0x86, 0x00,
 
266
    0x00, 0x03, 0xfc,
 
267
    0x00, 0x05, 0x00,
 
268
    0x04, 0x08, 0x80,
 
269
    0x0e, 0x10, 0x80,
 
270
    0x15, 0x20, 0x80,
 
271
    0x04, 0x00, 0x80,
 
272
    0x02, 0x01, 0x00,
 
273
    0x02, 0x01, 0x00,
 
274
    0x01, 0x86, 0x00,
 
275
    0x00, 0x78, 0x00,
 
276
    0x00, 0x00, 0x00};
 
277
 
 
278
static unsigned char scaleDownBM[] = {
 
279
    0x00, 0x00, 0x00,
 
280
    0x00, 0x00, 0x00,
 
281
    0x00, 0x00, 0x00,
 
282
    0x0c, 0x00, 0x18,
 
283
    0x03, 0x00, 0x60,
 
284
    0x00, 0xc1, 0x80,
 
285
    0x00, 0x36, 0x00,
 
286
    0x00, 0x08, 0x00,
 
287
    0x00, 0x80, 0x80,
 
288
    0x00, 0x41, 0x00,
 
289
    0x00, 0x22, 0x00,
 
290
    0x00, 0x14, 0x00,
 
291
    0x00, 0x08, 0x00,
 
292
    0x00, 0x00, 0x00,
 
293
    0x00, 0x14, 0x00,
 
294
    0x00, 0x08, 0x00,
 
295
    0x00, 0x08, 0x00,
 
296
    0x00, 0x00, 0x00,
 
297
    0x00, 0x00, 0x00};
 
298
    
 
299
static unsigned char scaleUpBM[] = {
 
300
    0x00, 0x00, 0x00,
 
301
    0x00, 0x00, 0x00,
 
302
    0x00, 0x00, 0x00,
 
303
    0x00, 0x08, 0x00,
 
304
    0x00, 0x36, 0x00,
 
305
    0x00, 0xc1, 0x80,
 
306
    0x03, 0x00, 0x60,
 
307
    0x0c, 0x00, 0x18,
 
308
    0x00, 0x08, 0x00,
 
309
    0x00, 0x14, 0x00,
 
310
    0x00, 0x22, 0x00,
 
311
    0x00, 0x41, 0x00,
 
312
    0x00, 0x80, 0x80,
 
313
    0x00, 0x08, 0x00,
 
314
    0x00, 0x08, 0x00,
 
315
    0x00, 0x14, 0x00,
 
316
    0x00, 0x00, 0x00,
 
317
    0x00, 0x00, 0x00,
 
318
    0x00, 0x00, 0x00};
 
319
 
 
320
static unsigned char resetRotationBM[] = {
 
321
    0x00, 0x00, 0x00,
 
322
    0x00, 0x00, 0x00,
 
323
    0x00, 0x08, 0x00,
 
324
    0x00, 0x08, 0x00,
 
325
    0x00, 0x08, 0x00,
 
326
    0x00, 0x08, 0x00,
 
327
    0x00, 0x08, 0x00,
 
328
    0x00, 0x08, 0x00,
 
329
    0x00, 0x08, 0x00,
 
330
    0x00, 0x08, 0x00,
 
331
    0x00, 0x0f, 0xf8,
 
332
    0x00, 0x00, 0x00,
 
333
    0x00, 0x00, 0x00,
 
334
    0x00, 0x00, 0x00,
 
335
    0x00, 0x00, 0x00,
 
336
    0x00, 0x00, 0x00,
 
337
    0x00, 0x00, 0x00,
 
338
    0x00, 0x00, 0x00,
 
339
    0x00, 0x00, 0x00};
 
340
 
 
341
static void registerBM(Screen *screen, char *name, unsigned char *bits,
 
342
                       int width, int height);
 
343
 
 
344
void RegisterPhaseBitmaps(Screen *screen)
 
345
{
 
346
    registerBM(screen, "viewRotXPos", viewRotXPosBM, 24, 19);
 
347
    registerBM(screen, "viewRotXNeg", viewRotXNegBM, 24, 19);
 
348
    registerBM(screen, "viewRotYPos", viewRotYPosBM, 24, 19);
 
349
    registerBM(screen, "viewRotYNeg", viewRotYNegBM, 24, 19);
 
350
    registerBM(screen, "viewRotZPos", viewRotZPosBM, 24, 19);
 
351
    registerBM(screen, "viewRotZNeg", viewRotZNegBM, 24, 19);
 
352
 
 
353
    registerBM(screen, "coordRotXPos", coordRotXPosBM, 24, 19);
 
354
    registerBM(screen, "coordRotXNeg", coordRotXNegBM, 24, 19);
 
355
    registerBM(screen, "coordRotYPos", coordRotYPosBM, 24, 19);
 
356
    registerBM(screen, "coordRotYNeg", coordRotYNegBM, 24, 19);
 
357
    registerBM(screen, "coordRotZPos", coordRotZPosBM, 24, 19);
 
358
    registerBM(screen, "coordRotZNeg", coordRotZNegBM, 24, 19);
 
359
 
 
360
    registerBM(screen, "scaleUp", scaleUpBM, 24, 19);
 
361
    registerBM(screen, "scaleDown", scaleDownBM, 24, 19);
 
362
    registerBM(screen, "resetRotation", resetRotationBM, 24, 19);
 
363
}
 
364
 
 
365
static void registerBM(Screen *screen, char *name, unsigned char *bits,
 
366
                       int width, int height)
 
367
{
 
368
    XImage *image;
 
369
    
 
370
    /* There is something very wrong with XCreateImage.  It does seem rather
 
371
       stupid to use server information to fill in client dependent information.
 
372
       Motif does not use XCreateImage internally, rather it just fills in the
 
373
       image data structure itself and hopes for pity in future Xlib versions.
 
374
       The X recommended code results in byte-swapped pixmaps on many machines:
 
375
       
 
376
       image=XCreateImage(DisplayOfScreen(screen), DefaultVisualOfScreen(screen),
 
377
                          1, XYBitmap, 0, bits, width, height, 8, 0);
 
378
        
 
379
       The following code, copied from the motif source, just initializes the
 
380
       structure to all zeros and fills in the data we know about.            */
 
381
    
 
382
    image = (XImage *)XtCalloc(1, sizeof(XImage)) ;
 
383
    image->width = width ;
 
384
    image->height = height ;
 
385
    image->data = (char *)bits ;
 
386
    image->depth = 1 ;
 
387
    image->xoffset = 0 ;
 
388
    image->format = XYBitmap ;
 
389
    image->byte_order = LSBFirst ;
 
390
    image->bitmap_unit = 8 ;
 
391
    image->bitmap_bit_order = MSBFirst ;
 
392
    image->bitmap_pad = 8 ;
 
393
    image->bytes_per_line = (width + 7) >> 3 ;
 
394
 
 
395
    
 
396
    XmInstallImage(image, name);
 
397
}