dtcm: Coverity 88902
[oweals/cde.git] / cde / programs / dticon / constants.h
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these libraries and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /* $XConsortium: constants.h /main/3 1995/11/02 14:03:35 rswiston $ */
24 /*********************************************************************
25 *  (c) Copyright 1993, 1994 Hewlett-Packard Company     
26 *  (c) Copyright 1993, 1994 International Business Machines Corp.
27 *  (c) Copyright 1993, 1994 Sun Microsystems, Inc.
28 *  (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
29 *      Novell, Inc.
30 **********************************************************************/
31 #include <X11/Xlib.h>
32
33 /***
34 #define DEBUG         True
35 ***/
36
37 #define CLASS_NAME    "Dticon"
38
39 /*
40  * This is the linked list of Help dialogs, which
41  * will be created dynamically, as needed.
42  */
43
44 typedef struct _helpStruct {
45     struct _helpStruct *pNext;
46     struct _helpStruct *pPrev;
47     Widget dialog;
48     Boolean inUse;
49 } HelpStruct;
50
51 typedef struct {
52     Boolean useBMS;
53     String  session;
54     String  bmSuffix;
55     String  pmSuffix;
56     int     maxIconWidth;
57     int     maxIconHeight;
58     Boolean useFileFilter;
59     Boolean useFileLists;
60 } ApplicationData, *ApplicationDataPtr;
61
62 typedef struct {
63     Boolean   useSession;
64     int       iconicState;
65     Position  x, y;
66     Dimension width, height;
67 } SessionData, *SessionDataPtr;
68
69 typedef struct {
70     XColor       xcolor;                /* pixel #, red, blue, green, etc. */
71     Pixel        mono;                  /* black or white pixel for mono   */
72     Pixel        newCell;               /* new color cell for grab-screen  */
73 } PixelTableItem;
74
75 typedef struct {
76     int              pixelTableSize;    /* number of allocated table items */
77     int              numItems;          /* number of items in the table    */
78     int              lastFound;         /* last lookup result, check first */
79     PixelTableItem  *item;              /* array of actual table entries   */
80 } PixelTable;
81
82 #define PIXEL_TABLE_MONO(i)      pixelTable.item[i].mono
83 #define PIXEL_TABLE_NEW_CELL(i)  pixelTable.item[i].newCell
84 #define PIXEL_TABLE_INC 20          /* size to increase table by each time */
85
86 #ifndef NULL
87 #define NULL   0
88 #endif
89
90 /* Maximum icon demensions */
91 #define MAX_ICON_WIDTH   256
92 #define MAX_ICON_HEIGHT  256
93
94 /* Maximum icon demensions */
95 #define MAX_FNAME        256
96
97 #define min(a, b)       ((a < b) ? a : b)
98 #define max(a, b)       ((a > b) ? a : b)
99 #ifndef abs
100 #if !defined(__linux__)
101 #define abs(a)          (((a) < 0) ? -(a) : (a))
102 #endif
103 #endif
104 #define mag(a,b)        ((a-b) < 0 ? (b-a) : (a-b))
105
106 #define DARK            0
107 #define LIGHT           1
108
109 /* rotation direction */
110 #define ROTATE_L        1
111 #define ROTATE_R        2
112
113 /* File I/O flags */
114 #define READ_FLAGS (XpmColorSymbols)
115 #define WRITE_FLAGS (XpmSize|XpmHotspot|XpmCharsPerPixel|XpmInfos)
116
117 /* State flags for Init_Icons() */
118 #define DO_NOT_SAVE     0
119 #define DO_SAVE         1
120
121 /* Graphics Ops. tools */
122 #define POINT           1
123 #define FLOOD           2
124 #define LINE            3
125 #define POLYLINE        4
126 #define RECTANGLE       5
127 #define POLYGON         6
128 #define CIRCLE          7
129 #define ELLIPSE         8
130 #define ERASER          9
131 #define SELECT         10
132
133 /* Secondary Graphics Ops. */
134 #define S_WAIT_RELEASE 99
135 #define S_PASTE       100
136 #define S_ROTATE      101
137 #define S_SCALE_1     102
138 #define S_SCALE_2     103
139 #define S_HOTSPOT     104
140 #define S_GRAB        105
141
142 /* Interrupt flags for SELECT Ops. */
143 #define INITIAL         0
144 #define CONTINUE        1
145
146 #define NUM_GFX_OPS    11       /* number of Graphics Ops. tools + 1*/
147 #define DEFAULT_MAG     8       /* default magnification factor */
148 #define GAMMA_CUTOFF  150       /* x-over pt. for black/white fg color */
149 #define NUM_STATICS    16       /* number of static colors */
150 #define NUM_DYNAMICS    6       /* number of dynamic colors */
151 #define NUM_PENS      (NUM_STATICS+NUM_DYNAMICS)
152
153 /* max. points for polylines/polygons */
154 #define MAX_PTS       200
155
156 /* dialog state flag values */
157 #define NONE            0
158 #define NEW             1
159 #define OPEN            2
160 #define SAVE            3
161 #define SAVE_AS         4
162 #define GRAB            5
163 #define DROP            6
164 #define QUIT           99
165
166 /* Transfer_Back_Image() state flag values */
167 #define HOLLOW          0
168 #define FILL            1
169
170 /* File I/O state flag values */
171 #define FILE_READ       0
172 #define FILE_WRITE      1
173
174 /* output file format flags */
175 #define FORMAT_XPM      0
176 #define FORMAT_XBM      1
177 #define FORMAT_NONE     2
178
179 /* which color block? */
180 #define STATIC_COLOR    0
181 #define DYNAMIC_COLOR   1
182
183 /* static color flags */
184 #define COLOR1          0
185 #define COLOR2          1
186 #define COLOR3          2
187 #define COLOR4          3
188 #define COLOR5          4
189 #define COLOR6          5
190 #define COLOR7          6
191 #define COLOR8          7
192 #define GREY1           8
193 #define GREY2           9
194 #define GREY3          10
195 #define GREY4          11
196 #define GREY5          12
197 #define GREY6          13
198 #define GREY7          14
199 #define GREY8          15
200
201 /* dynamic color flags */
202 #define BG_COLOR      100
203 #define FG_COLOR      101
204 #define TS_COLOR      102
205 #define BS_COLOR      103
206 #define SELECT_COLOR  104
207 #define TRANS_COLOR   105
208
209 /* flip orientation flags */
210 #define HORIZONTAL      0
211 #define VERTICAL        1
212
213 /* magnification factor flags */
214 #define MAG_2X    2
215 #define MAG_3X    3
216 #define MAG_4X    4
217 #define MAG_5X    5
218 #define MAG_6X    6
219 #define MAG_8X    8
220 #define MAG_10X  10
221 #define MAG_12X  12
222
223 /* command-line parameter flags */
224 #define AUTO_FILE        0
225 #define AUTO_SIZE        1
226 #define NUM_PARAMS       2