This repository has been archived by the owner on Jun 16, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
xv.h
2209 lines (1801 loc) · 74.9 KB
/
xv.h
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* xv.h - header file for xv, but you probably guessed as much
*
* Author: John Bradley ([email protected])
*/
#include "copyright.h"
#include "config.h"
/* xv 3.10a: 19941229 */
/* PNG patch 1.2d: 19960731 */
/* GRR orig jumbo fixes patch: 20000213 */
/* GRR orig jumbo enhancements patch: 20000220 */
/* GRR 1st public jumbo F+E patches: 20040531 */
/* GRR 2nd public jumbo F+E patches: 20050410 */
/* GRR 3rd public jumbo F+E patches: 20050501 */
/* GRR 4th public jumbo F+E patch: 20070520 */
/* GRR 5th public jumbo F+E patch: 200xxxxx (probably mid-2009) */
#define REVDATE "version 3.10a-jumboFix+Enh of 20081216 (interim!)"
#define VERSTR "3.10a-20081216"
/*
* uncomment the following, and modify for your site, but only if you've
* actually registered your copy of XV...
*/
/* #define REGSTR "Registered for use at the University of Pennsylvania." */
#ifndef VMS
# define THUMBDIR ".xvpics" /* name of thumbnail file subdirectories */
# define THUMBDIRNAME ".xvpics" /* same as THUMBDIR, unlike VMS case... */
# define CLIPFILE ".xvclip" /* name of clipboard file in home directory */
#else
# define THUMBDIR "XVPICS" /* name to use in building paths... */
# define THUMBDIRNAME "XVPICS.DIR" /* name from readdir() & stat() */
# define CLIPFILE "xvclipbd.dat"
#endif
#undef PARM
#ifdef __STDC__
# define PARM(a) a
#else
# define PARM(a) ()
# define const
#endif
/*************************************************/
/* START OF MACHINE-DEPENDENT CONFIGURATION INFO */
/*************************************************/
#define ENABLE_FIXPIX_SMOOTH /* GRR 19980607 */
/* Things to make xv more likely to just build, without the user tweaking
the makefile */
#ifdef hpux /* HPUX machines (SVR3, (not SVR4) NO_RANDOM) */
# undef SVR4
# undef SYSV
# define SYSV
# undef NO_RANDOM
# define NO_RANDOM
# define USE_GETCWD
#endif
#ifdef sgi /* SGI machines (SVR4) */
# undef SVR4
# define SVR4
#endif
#if defined(__sony_news) && defined(bsd43) && !defined(__bsd43)
# define __bsd43
#elif defined(__sony_news) && (defined(SYSTYPE_BSD) || defined(__SYSTYPE_BSD)) && !defined(bsd43) && !defined(__bsd43)
# define bsd43
# define __bsd43
#endif
#include <signal.h> /* for interrupt handling */
/* at least on Linux, the following file (1) includes sys/types.h and
* (2) defines __USE_BSD (which was not defined before here), so __linux__
* block is now moved after this #include */
#include <X11/Xos.h> /* need type declarations immediately */
#ifdef __linux__
# ifndef _LINUX_LIMITS_H
# include <linux/limits.h>
# endif
# ifndef USLEEP
# define USLEEP
# endif
/* want only one or the other defined, not both: */
# if !defined(BSDTYPES) && !defined(__USE_BSD)
# define BSDTYPES
# endif
# if defined(BSDTYPES) && defined(__USE_BSD)
# undef BSDTYPES
# endif
#endif
/*********************************************************/
/* The BSD typedefs are used throughout.
* If your system doesn't have them in <sys/types.h>,
* then define BSDTYPES in your Makefile.
*/
#if defined(BSDTYPES) || defined(VMS)
typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned int u_int;
typedef unsigned long u_long;
#endif
#ifdef __UMAXV__ /* for Encore Computers UMAXV */
# include <sys/fs/b4param.h> /* Get bsd fast file system params*/
#endif
/* things that *DON'T* have dirent. Hopefully a very short list */
#if defined(__UMAXV__)
# ifndef NODIRENT
# define NODIRENT
# endif
#endif
#if defined(__sony_news) && defined(__bsd43)
# include <unistd.h>
#endif
#if defined(__FreeBSD__)
# include <sys/param.h>
#endif
/* include files */
#include <stdio.h>
#include <math.h>
#include <ctype.h>
#ifdef __STDC__
# include <stddef.h>
# include <stdlib.h>
#endif
/* note: 'string.h' or 'strings.h' is included by Xos.h, and it
guarantees index() and rindex() will be available */
#ifndef VMS
# include <errno.h>
# ifndef __NetBSD__
# if !(defined __GLIBC__ && __GLIBC__ >= 2)
extern int errno; /* SHOULD be in errno.h, but often isn't */
# ifndef __CYGWIN__
extern char *sys_errlist[]; /* this too... */
# endif
# endif
# endif
#endif
/* not everyone has the strerror() function, or so I'm told */
#ifdef VMS
# define ERRSTR(x) strerror(x, vaxc$errno)
#else
# if defined(__BEOS__) || defined(__linux__) /* or all modern/glibc systems? */
# define ERRSTR(x) strerror(x)
# else
# define ERRSTR(x) sys_errlist[x]
# endif
#endif
#ifdef VMS /* VMS config, hacks & kludges */
# define MAXPATHLEN 512
# define popUp xv_popup
# define qsort xv_qsort
# define random rand
# define srandom srand
# define cols xv_cols
# define gmap xv_gmap
# define index strchr
# define rindex strrchr
# include <errno.h>
# include <perror.h>
#endif
/* GRR 20070512: Very few modern systems even have a malloc.h anymore;
* stdlib.h is, well, the standard. (Former explicitly listed
* "don't include" systems: ibm032, __convex__, non-ultrix vax,
* mips, apollo, pyr, sequent, __UMAXV__, aux, bsd43, __bsd43,
* __bsdi__, __386BSD__, __FreeBSD__, __OpenBSD__, __NetBSD__,
* __DARWIN__, VMS.) Anyone who _does_ need it can explicitly
* define NEED_MALLOC_H in the makefile. */
#ifdef NEED_MALLOC_H
# if defined(hp300) || defined(hp800) || defined(NeXT)
# include <sys/malloc.h> /* it's in "sys" on HPs and NeXT */
# else
# include <malloc.h>
# endif
#endif
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/cursorfont.h>
#include <X11/keysym.h>
#include <X11/Intrinsic.h>
#include <X11/Xatom.h>
#include <X11/Xmd.h>
#ifdef HAVE_XRR
#include <X11/Xproto.h>
#include <X11/extensions/Xrandr.h>
#endif
#ifdef TV_L10N
# include <X11/Xlocale.h>
#endif
#include <sys/types.h>
#ifdef NEEDSTIME
# include <sys/time.h>
# ifdef _AIX
# include <sys/select.h> /* needed for select() call in Timer() */
# endif
# ifdef SVR4
# include <poll.h> /* used in SVR4 version of Timer() */
# endif
# ifdef sgi /* need 'CLK_TCK' value for sginap() call */
# include <limits.h>
# endif
# ifdef __BEOS__
# include <socket.h>
# endif
/*** for select() call ***/
# ifdef __hpux
# define XV_FDTYPE (int *)
# else
# define XV_FDTYPE (fd_set *)
# endif
#endif /* NEEDSTIME */
#ifdef NEEDSDIR
# ifdef VMS
# include <descrip.h>
# include <stat.h>
# include "dirent.h"
# else
# ifdef NODIRENT
# include <sys/dir.h>
# else
# include <dirent.h>
# endif
# if defined(SVR4) || defined(SYSV)
# include <fcntl.h>
# endif
# include <sys/param.h>
# include <sys/stat.h>
# if defined(__convex__) && defined (__STDC__)
# define S_IFMT _S_IFMT
# define S_IFDIR _S_IFDIR
# define S_IFCHR _S_IFCHR
# define S_IFBLK _S_IFBLK
# endif
# endif
#endif
#ifdef NEEDSARGS
# if defined(__STDC__) && !defined(NOSTDHDRS)
# include <stdarg.h>
# else
# include <varargs.h>
# endif
#endif
/* Use S_ISxxx macros in stat-related stuff
* make them if missing, along with a few fictitious ones
* Cameron Simpson ([email protected])
*/
#ifndef S_ISDIR /* missing POSIX-type macros */
# define S_ISDIR(mode) (((mode)&S_IFMT) == S_IFDIR)
# define S_ISBLK(mode) (((mode)&S_IFMT) == S_IFBLK)
# define S_ISCHR(mode) (((mode)&S_IFMT) == S_IFCHR)
# define S_ISREG(mode) (((mode)&S_IFMT) == S_IFREG)
#endif
#ifndef S_ISFIFO
# ifdef S_IFIFO
# define S_ISFIFO(mode) (((mode)&S_IFMT) == S_IFIFO)
# else
# define S_ISFIFO(mode) 0
# endif
#endif
#ifndef S_ISLINK
# ifdef S_IFLNK
# define S_ISLINK(mode) (((mode)&S_IFMT) == S_IFLNK)
# else
# define S_ISLINK(mode) 0
# endif
#endif
#ifndef S_ISSOCK
# ifdef S_IFSOCK
# define S_ISSOCK(mode) (((mode)&S_IFMT) == S_IFSOCK)
# else
# define S_ISSOCK(mode) 0
# endif
#endif
#ifndef S_IRWUSR
# define S_IRWUSR (S_IRUSR|S_IWUSR) /* or (S_IREAD|S_IWRITE) */
#endif
#ifndef MAXPATHLEN
# define MAXPATHLEN 256
#endif
#ifdef SVR4
# define random lrand48
# define srandom srand48
#else
# if defined(NO_RANDOM) || (defined(sun) && defined(SYSV))
# define random() rand()
# define srandom(x) srand(x)
# endif
#endif
#ifndef VMS /* VMS hates multi-line definitions */
# if defined(SVR4) || defined(SYSV) || defined(sco) || \
defined(XENIX) || defined(__osf__) || defined(__linux__)
# undef USE_GETCWD
# define USE_GETCWD /* use 'getcwd()' instead of 'getwd()' */
# endif /* >> SECURITY ISSUE << */
#endif
/* GRR 20040430: This is new and still not fully deployed. No doubt there
* are other systems that have mkstemp() (SUSv3); we can add
* them later. */
#ifndef VMS /* VMS hates multi-line definitions */
# if defined(__linux__) || defined(__OpenBSD__) || defined(__NetBSD__) || \
defined(__bsdi__)
# ifndef USE_MKSTEMP
# define USE_MKSTEMP /* use 'mkstemp()' instead of 'mktemp()' */
# endif /* >> SECURITY ISSUE << */
# endif
#endif
/* GRR 20040503: This is new and so far tested only under Linux. But it
* allows -wait to work with subsecond values as long as
* times() exists and clock_t is a long int (latter matters
* only if/when clocks wrap, which for Linux is multiples of
* 497.11 days since the last reboot). */
#if defined(__linux__)
# define USE_TICKS /* use times()/Timer(), not time()/sleep() */
# include <limits.h> /* LONG_MAX (really want CLOCK_T_MAX) */
# include <sys/times.h> /* times() */
# ifndef CLK_TCK /* can be undefined in strict-ANSI mode */
# define CLK_TCK CLOCKS_PER_SEC /* claimed to be same thing in time.h */
# endif
#endif
#if (defined(SYSV) || defined(SVR4) || defined(linux)) && !defined(USE_GETCWD)
# define USE_GETCWD
#endif
#ifndef SEEK_SET
# define SEEK_SET 0
# define SEEK_CUR 1
# define SEEK_END 2
#endif
#if defined(__mips) && defined(__SYSTYPE_BSD43)
# define strstr(A,B) pds_strstr((A),(B))
# undef S_IFIFO
#endif /* !mips_bsd */
/*****************************/
/* END OF CONFIGURATION INFO */
/*****************************/
#ifndef TRUE
# define TRUE 1
#endif
#ifndef FALSE
# define FALSE 0
#endif
#ifdef DOWEBP
# define HAVE_WEBP
#endif
#ifdef DOJPEG
# define HAVE_JPEG
#endif
#ifdef DOJP2K
# define HAVE_JP2K
#endif
#ifdef DOTIFF
# define HAVE_TIFF
#endif
#ifdef DOPNG
# define HAVE_PNG
#endif
#ifdef DOPDS
# define HAVE_PDS
#endif
#ifdef DOG3
# define HAVE_G3
#endif
#define DBLCLICKTIME 400 /* double-click speed in milliseconds */
#define PROGNAME "xv" /* used in resource database */
#define MAXNAMES 65536 /* max # of files in ctrlW list */
#define MAXBRWIN 16 /* max # of vis browser windows */
/* strings in the INFOBOX (used in SetISTR and GetISTR) */
#define NISTR 10 /* number of ISTRs */
#define ISTR_INFO 0
#define ISTR_WARNING 1
#define ISTR_FILENAME 2
#define ISTR_FORMAT 3
#define ISTR_RES 4
#define ISTR_CROP 5
#define ISTR_EXPAND 6
#define ISTR_SELECT 7
#define ISTR_COLOR 8
#define ISTR_COLOR2 9
/* potential values of 'infomode', used in info box drawing routines */
#define INF_NONE 0 /* empty box */
#define INF_STR 1 /* just ISTR_INFO */
#define INF_PART 2 /* filename, format, size and infostr */
#define INF_FULL 3 /* INF_PART + clipping, expansion, colorinfo */
/* buttons in the ctrl window */
#define BNEXT 0
#define BPREV 1
#define BLOAD 2
#define BSAVE 3
#define BDELETE 4
#define BPRINT 5
#define BCOPY 6
#define BCUT 7
#define BPASTE 8
#define BCLEAR 9
#define BGRAB 10
#define BUP10 11
#define BDN10 12
#define BROTL 13
#define BROTR 14
#define BFLIPH 15
#define BFLIPV 16
#define BPAD 17
#define BANNOT 18
#define BCROP 19
#define BUNCROP 20
#define BACROP 21
#define BABOUT 22
#define BQUIT 23
#define BXV 24
#define NBUTTS 25 /* # of butts */
/* buttons in the load/save window */
#define S_LOAD_NBUTTS 4
#define S_NBUTTS 5
#define S_BOK 0
#define S_BCANC 1
#define S_BRESCAN 2
#define S_BLOADALL 3
#define S_BOLDSET 3
#define S_BOLDNAM 4
/* buttons in the 'gamma' window */
#define G_NBUTTS 24
#define G_BAPPLY 0
#define G_BNOGAM 1
#define G_BRESET 2
#define G_BCLOSE 3
#define G_BUP_BR 4
#define G_BDN_BR 5
#define G_BUP_CN 6
#define G_BDN_CN 7
#define G_B1 8
#define G_B2 9
#define G_B3 10
#define G_B4 11
#define G_BSET 12
#define G_BUNDO 13
#define G_BREDO 14
#define G_BCOLREV 15
#define G_BRNDCOL 16
#define G_BHSVRGB 17
#define G_BCOLUNDO 18
#define G_BRV 19
#define G_BMONO 20
#define G_BMAXCONT 21
#define G_BGETRES 22
#define G_BHISTEQ 23
/* constants for setting default 'save mode' in dirW */
#define F_COLORS 0
#define F_FORMAT 1
/* the following list give indices into saveColors[] array in xvdir.c */
#define F_FULLCOLOR 0
#define F_GREYSCALE 1
#define F_BWDITHER 2
#define F_REDUCED 3
#define F_MAXCOLORS 4 /* length of saveColors[] array */
/* The following list gives indices into 'saveFormats[]' array in xvdir.c.
Note that JPEG, TIFF, and other entries may or may not exist, so the
following constants have to be adjusted accordingly. Also, don't worry
about duplicate cases if, e.g., JPGINC or TIFINC = 0. All code that
references F_JPEG, F_TIFF, etc., is #ifdef'd, so it won't be a problem. */
#ifdef HAVE_JPEG
# define F_JPGINC 1
#else
# define F_JPGINC 0
#endif
#ifdef HAVE_JP2K
# define F_JP2INC 1 /* provides both JPC and JP2 */
#else
# define F_JP2INC 0
#endif
#ifdef HAVE_TIFF
# define F_TIFINC 1
#else
# define F_TIFINC 0
#endif
#ifdef HAVE_WEBP
# define F_WEBPINC 1
#else
# define F_WEBPINC 0
#endif
#ifdef HAVE_PNG
# define F_PNGINC 1
#else
# define F_PNGINC 0
#endif
#ifdef HAVE_MAG
# define F_MAGINC 1
#else
# define F_MAGINC 0
#endif
#ifdef HAVE_PIC
# define F_PICINC 1
#else
# define F_PICINC 0
#endif
#ifdef HAVE_MAKI
# define F_MAKINC 1
#else
# define F_MAKINC 0
#endif
#ifdef HAVE_PI
# define F_PAIINC 1
#else
# define F_PAIINC 0
#endif
#ifdef HAVE_PIC2
# define F_PC2INC 1
#else
# define F_PC2INC 0
#endif
#ifdef HAVE_MGCSFX
# define F_MGCSFXINC 1
#else
# define F_MGCSFXINC 0
#endif
#ifdef MACBINARY
# define MACBSIZE 128
#endif
/* NOTE: order must match saveFormats[] in xvdir.c */
/* [this works best when first one is always present, but...we like PNG :-) ] */
#define F_PNG 0
#define F_JPEG ( 0 + F_PNGINC)
#define F_JPC ( 0 + F_PNGINC + F_JPGINC)
#define F_JP2 ( 0 + F_PNGINC + F_JPGINC + F_JP2INC)
#define F_GIF ( 0 + F_PNGINC + F_JPGINC + F_JP2INC + F_JP2INC) /* always avail; index varies */
#define F_WEBP ( 0 + F_PNGINC + F_JPGINC + F_JP2INC + F_JP2INC + F_WEBPINC)
#define F_TIFF ( 0 + F_PNGINC + F_JPGINC + F_JP2INC + F_JP2INC + F_WEBPINC + F_TIFINC)
#define F_PS ( 1 + F_TIFF)
#define F_PBMRAW ( 2 + F_TIFF)
#define F_PBMASCII ( 3 + F_TIFF)
#define F_XBM ( 4 + F_TIFF)
#define F_XPM ( 5 + F_TIFF)
#define F_BMP ( 6 + F_TIFF)
#define F_SUNRAS ( 7 + F_TIFF)
#define F_IRIS ( 8 + F_TIFF)
#define F_TARGA ( 9 + F_TIFF)
#define F_FITS (10 + F_TIFF)
#define F_PM (11 + F_TIFF)
#define F_ZX (12 + F_TIFF) /* [JCE] */
#define F_G3 (13 + F_TIFF) /* [JCE] */
#define F_WBMP (14 + F_TIFF)
#define JP_EXT_F (F_WBMP)
#define F_MAG (JP_EXT_F + F_MAGINC)
#define F_PIC (JP_EXT_F + F_MAGINC + F_PICINC)
#define F_MAKI (JP_EXT_F + F_MAGINC + F_PICINC + F_MAKINC)
#define F_PI (JP_EXT_F + F_MAGINC + F_PICINC + F_MAKINC + F_PAIINC)
#define F_PIC2 (JP_EXT_F + F_MAGINC + F_PICINC + F_MAKINC + F_PAIINC + F_PC2INC)
#define F_MGCSFX (JP_EXT_F + F_MAGINC + F_PICINC + F_MAKINC + F_PAIINC + F_PC2INC + F_MGCSFXINC)
#define JP_EXT_F_END (F_MGCSFX)
#define F_DELIM1 (JP_EXT_F_END + 1) /* ----- */
#define F_FILELIST (JP_EXT_F_END + 2)
#define F_MAXFMTS (JP_EXT_F_END + 3) /* 27, normally (with all formats) */
/* return values from ReadFileType()
* positive values are *definitely* readable formats (HAVE_*** is defined)
* negative values are random files that XV can't read, but display as
* different icons in the visual browser
*/
#define RFT_ERROR -1 /* couldn't open file, or whatever... */
#define RFT_UNKNOWN 0
#define RFT_GIF 1
#define RFT_PM 2
#define RFT_PBM 3
#define RFT_XBM 4
#define RFT_SUNRAS 5
#define RFT_BMP 6
#define RFT_UTAHRLE 7
#define RFT_IRIS 8
#define RFT_PCX 9
#define RFT_JFIF 10
#define RFT_TIFF 11
#define RFT_PDSVICAR 12
#define RFT_COMPRESS 13
#define RFT_PS 14
#define RFT_IFF 15
#define RFT_TARGA 16
#define RFT_XPM 17
#define RFT_XWD 18
#define RFT_FITS 19
#define RFT_PNG 20
#define RFT_ZX 21 /* [JCE] */
#define RFT_WBMP 22
#define RFT_PCD 23
#define RFT_HIPS 24
#define RFT_BZIP2 25
#define RFT_JPC 26
#define RFT_JP2 27
#define RFT_G3 28
#define JP_EXT_RFT (RFT_G3)
#define RFT_MAG (JP_EXT_RFT + 1)
#define RFT_MAKI (JP_EXT_RFT + 2)
#define RFT_PIC (JP_EXT_RFT + 3)
#define RFT_PI (JP_EXT_RFT + 4)
#define RFT_PIC2 (JP_EXT_RFT + 5)
#define RFT_MGCSFX (JP_EXT_RFT + 6)
#define RFT_WEBP (JP_EXT_RFT + 7)
/* definitions for page up/down, arrow up/down list control */
#define LS_PAGEUP 0
#define LS_PAGEDOWN 1
#define LS_LINEUP 2
#define LS_LINEDOWN 3
#define LS_HOME 4
#define LS_END 5
/* values returned by CursorKey() */
#define CK_NONE 0
#define CK_LEFT 1
#define CK_RIGHT 2
#define CK_UP 3
#define CK_DOWN 4
#define CK_PAGEUP 5
#define CK_PAGEDOWN 6
#define CK_HOME 7
#define CK_END 8
/* values 'epicMode' can take */
#define EM_RAW 0
#define EM_DITH 1
#define EM_SMOOTH 2
/* things EventLoop() can return (0 and above reserved for 'goto pic#') */
#define QUIT -1 /* exit immediately */
#define NEXTPIC -2 /* goto next picture */
#define PREVPIC -3 /* goto prev picture */
#define NEXTQUIT -4 /* goto next picture, quit if none (used by 'wait') */
#define LOADPIC -5 /* load 'named' pic (from directory box) */
#define NEXTLOOP -6 /* load next pic, loop if we're at end */
#define DFLTPIC -7 /* load the default image */
#define DELETE -8 /* just deleted pic. load 'right' thing */
#define GRABBED -9 /* just grabbed a pic. 'load' it up */
#define POLLED -10 /* polling, and image file has changed... */
#define RELOAD -11 /* 'reload' interrupt came. be happier about errors */
#define THISNEXT -12 /* load 'current' selection, Next until success */
#define OP_PAGEUP -13 /* load previous page of multi-page document */
#define OP_PAGEDN -14 /* load next page of multi-page document */
#define PADDED -15 /* just grabbed a pic. 'load' it up */
/* possible values of 'rootMode' */
#define RM_NORMAL 0 /* default X tiling */
#define RM_TILE 1 /* integer tiling */
#define RM_MIRROR 2 /* mirror tiling */
#define RM_IMIRROR 3 /* integer mirror tiling */
#define RM_CENTER 4 /* modes >= RM_CENTER centered on some sort of bg */
#define RM_CENTILE 4 /* centered and tiled. NOTE: equals RM_CENTER */
#define RM_CSOLID 5 /* centered on a solid bg */
#define RM_CWARP 6 /* centered on a 'warp-effect' bg */
#define RM_CBRICK 7 /* centered on a 'brick' bg */
#define RM_ECENTER 8 /* symmetrical tiled */
#define RM_ECMIRR 9 /* symmetrical mirror tiled */
#define RM_UPLEFT 10 /* just in upper left corner */
#define RM_MAX RM_UPLEFT
/* values of colorMapMode */
#define CM_NORMAL 0 /* normal RO or RW color allocation */
#define CM_PERFECT 1 /* install own cmap if necessary */
#define CM_OWNCMAP 2 /* install own cmap always */
#define CM_STDCMAP 3 /* use stdcmap */
/* values of haveStdCmap */
#define STD_NONE 0 /* no stdcmap currently defined */
#define STD_111 1 /* 1/1/1 stdcmap is available */
#define STD_222 2 /* 2/2/2 stdcmap is available */
#define STD_232 3 /* 2/3/2 stdcmap is available */
#define STD_666 4 /* 6x6x6 stdcmap is available */
#define STD_332 5 /* 3/3/2 stdcmap is available */
/* values of allocMode */
#define AM_READONLY 0
#define AM_READWRITE 1
/* selections in dispMB */
#define DMB_RAW 0
#define DMB_DITH 1
#define DMB_SMOOTH 2
#define DMB_SEP1 3 /* ---- separator */
#define DMB_COLRW 4
#define DMB_SEP2 5 /* ---- separator */
#define DMB_COLNORM 6
#define DMB_COLPERF 7
#define DMB_COLOWNC 8
#define DMB_COLSTDC 9
#define DMB_MAX 10
/* selections in rootMB */
#define RMB_WINDOW 0
#define RMB_ROOT 1
#define RMB_TILE 2
#define RMB_MIRROR 3
#define RMB_IMIRROR 4
#define RMB_CENTILE 5
#define RMB_CSOLID 6
#define RMB_CWARP 7
#define RMB_CBRICK 8
#define RMB_ECENTER 9
#define RMB_ECMIRR 10
#define RMB_UPLEFT 11
#define RMB_MAX 12
/* indices into conv24MB */
#define CONV24_8BIT 0
#define CONV24_24BIT 1
#define CONV24_SEP1 2
#define CONV24_LOCK 3
#define CONV24_SEP2 4
#define CONV24_FAST 5
#define CONV24_SLOW 6
#define CONV24_BEST 7
#define CONV24_MAX 8
/* values 'picType' can take */
#define PIC8 CONV24_8BIT
#define PIC24 CONV24_24BIT
/* indices into algMB */
#define ALG_NONE 0
#define ALG_SEP1 1 /* separator */
#define ALG_BLUR 2
#define ALG_SHARPEN 3
#define ALG_EDGE 4
#define ALG_TINF 5
#define ALG_OIL 6
#define ALG_BLEND 7
#define ALG_ROTATE 8
#define ALG_ROTATECLR 9
#define ALG_PIXEL 10
#define ALG_SPREAD 11
#define ALG_MEDIAN 12
#define ALG_MAX 13
/* indices into sizeMB */
#define SZMB_NORM 0
#define SZMB_MAXPIC 1
#define SZMB_MAXPECT 2
#define SZMB_DOUBLE 3
#define SZMB_HALF 4
#define SZMB_P10 5
#define SZMB_M10 6
#define SZMB_SEP 7 /* separator */
#define SZMB_SETSIZE 8
#define SZMB_ASPECT 9
#define SZMB_4BY3 10
#define SZMB_INTEXP 11
#define SZMB_MAX 12
/* indices into windowMB */
#define WMB_BROWSE 0
#define WMB_COLEDIT 1
#define WMB_INFO 2
#define WMB_COMMENT 3
#define WMB_TEXTVIEW 4
#define WMB_SEP 5 /* separator */
#define WMB_ABOUTXV 6
#define WMB_KEYHELP 7
#define WMB_MAX 8
/* definitions of first char of dirnames[i] (filetype) */
#define C_FIFO 'f' /* FIFO special file */
#define C_CHR 'c' /* character special file */
#define C_DIR 'd' /* directory */
#define C_BLK 'b' /* block special file */
#define C_LNK 'l' /* symbolic link */
#define C_SOCK 's' /* socket */
#define C_REG ' ' /* regular file */
#define C_EXE 'x' /* executable file */
/* values used in Draw3dRect() */
#define R3D_OUT 0 /* rect sticks 'out' from screen */
#define R3D_IN 1 /* rect goes 'in' screen */
/* values 'GetSelType()' (in xvcut.c) can return */
#define SEL_RECT 0
/* mode values for PadPopUp() */
#define PAD_SOLID 0
#define PAD_BGGEN 1
#define PAD_LOAD 2
#define PAD_ORGB 0
#define PAD_OINT 1
#define PAD_OHUE 2
#define PAD_OSAT 3
#define PAD_OMAX 4
/* byte offsets into a 'cimg' (clipboard image) array (SaveToClip()) */
#define CIMG_LEN 0 /* offset to 4-byte length of data */
#define CIMG_W 4 /* offset to 2-byte width of image */
#define CIMG_H 6 /* offset to 2-byte height of image */
#define CIMG_24 8 /* offset to 1-byte 'is24bit?' field */
#define CIMG_TRANS 9 /* offset to 1-byte 'has transparent?' */
#define CIMG_TRVAL 10 /* if trans && !24: trans. pixel val */
#define CIMG_TRR 11 /* if trans && 24: red val of trans */
#define CIMG_TRG 12
#define CIMG_TRB 13
#define CIMG_PIC24 14 /* offset to data(24-bit) */
#define CIMG_CMAP 14 /* offset to cmap (8-bit) */
#define CIMG_PIC8 (CIMG_CMAP + 3*256) /* offset to data (8-bit) */
#define MBSEP "\001" /* special string for a --- separator in MBUTT */
/* random string-placing definitions */
#define SPACING 3 /* vertical space between strings */
#define ASCENT (mfinfo->ascent)
#define DESCENT (mfinfo->descent)
#define CHIGH (ASCENT + DESCENT)
#define LINEHIGH (CHIGH + SPACING)
#define STDINSTR "<stdin>"
#ifndef MAIN
#define WHERE extern
#else
#define WHERE
#endif
typedef unsigned char byte;
typedef struct scrl {
Window win; /* window ID */
int x,y,w,h; /* window coords in parent */
int len; /* length of major axis */
int vert; /* true if vertical, else horizontal */
int active; /* true if scroll bar can do anything*/
double min,max; /* min/max values 'pos' can take */
double val; /* 'value' of scrollbar */
double page; /* amt val change on pageup/pagedown */
int tpos; /* thumb pos. (pixels from tmin) */
int tmin,tmax; /* min/max thumb offsets (from 0,0) */
int tsize; /* size of thumb (in pixels) */
u_long fg,bg,hi,lo; /* colors */
/* redraws obj controlled by scrl*/
void (*drawobj)PARM((int, struct scrl *));
int uplit, dnlit; /* true if up&down arrows are lit */
} SCRL;
typedef struct { Window win; /* window ID */
int x,y,w,h; /* window coords in parent */
int active; /* true if can do anything*/
double min,max; /* min/max values 'pos' can take */
double val; /* 'value' of dial */
double inc; /* amt val change on up/down */
double page; /* amt val change on pageup/pagedown */
const char *title; /* title for this gauge */
const char *units; /* string appended to value */
u_long fg,bg,hi,lo; /* colors */
int rad, cx, cy; /* internals */
int bx[4], by[4]; /* more internals */
/* redraws obj controlled by dial */
void (*drawobj)PARM((void));
} DIAL;
typedef struct { Window win; /* parent window */
int x,y; /* size of button rectangle */
unsigned int w,h;
int lit; /* if true, invert colors */