|
|
1.1 root 1: /****************************************************************************/
2: /* */
3: /* Microsoft Confidential */
4: /* */
5: /* Copyright (c) Microsoft Corp. 1987, 1990 */
6: /* All Rights Reserved */
7: /* */
8: /****************************************************************************/
9: /****************************** Module Header *******************************
10: * Module Name: imagedit.h
11: *
12: * Main header file for the Image Editor.
13: *
14: * History:
15: *
16: ****************************************************************************/
17:
18: #define WIN31
19: #define _WINDOWS
20: #define NOMINMAX
21: #include <windows.h>
22:
23:
24: #ifdef DBG
25: #define STATICFN
26: #else
27: #define STATICFN static
28: #endif
29:
30: #define WINDOWPROC LONG APIENTRY
31: #define DIALOGPROC BOOL APIENTRY
32:
33: /*
34: * Typedef for a drawing proc (a tool).
35: */
36: typedef VOID (*DRAWPROC)(HWND, UINT, POINT);
37:
38: #define CCHTEXTMAX 256
39:
40: /*
41: * Maximum size of a file name plus path specification.
42: */
43: #define CCHMAXPATH 260
44:
45:
46: /*
47: * Defines for the different tools. These are indexes into
48: * the gaTools table.
49: */
50: #define TOOL_FIRST 0
51: #define TOOL_PENCIL 0
52: #define TOOL_BRUSH 1
53: #define TOOL_SELECT 2
54: #define TOOL_LINE 3
55: #define TOOL_RECT 4
56: #define TOOL_SOLIDRECT 5
57: #define TOOL_CIRCLE 6
58: #define TOOL_SOLIDCIRCLE 7
59: #define TOOL_FLOODFILL 8
60: #define TOOL_HOTSPOT 9
61:
62: #define CTOOLS 10 /* Number of tools. */
63:
64:
65: /*
66: * Macros to simplify working with menus. */
67: #define MyEnableMenuItem(hMenu, wIDEnableItem, fEnable) \
68: EnableMenuItem((hMenu),(wIDEnableItem),(fEnable)?MF_ENABLED:MF_GRAYED)
69:
70: #define MyCheckMenuItem(hMenu, wIDCheckItem, fCheck) \
71: CheckMenuItem((hMenu),(wIDCheckItem),(fCheck)?MF_CHECKED:MF_UNCHECKED)
72:
73:
74: /*
75: * Defines for strings.
76: */
77: #define IDS_NULL 0
78: #define IDS_VERSION 1
79: #define IDS_VERSIONMINOR 2
80: #define IDS_OUTOFMEMORY 3
81: #define IDS_MEMERROR 4
82: #define IDS_BADBMPFILE 5
83: #define IDS_BADICOCURFILE 6
84: #define IDS_BADPALFILE 7
85: #define IDS_CANTOPEN 8
86: #define IDS_READERROR 9
87: #define IDS_WRITEERROR 10
88: #define IDS_CANTCREATE 11
89: #define IDS_NOCLIPBOARDFORMAT 12
90: #define IDS_NOCLIPBOARD 13
91: #define IDS_CANTEDITIMAGE 14
92: #define IDS_SAVEFILE 15
93: #define IDS_ENTERANUMBER 16
94: #define IDS_BADDEVICESIZE 17
95: #define IDS_BADDEVICECOLORS 18
96: #define IDS_NOTSUPPORT 19
97: #define IDS_NOIMAGES 20
98: #define IDS_BADBMPSIZE 21
99:
100: #define IDS_APPNAME 22
101: #define IDS_PGMTITLE 23
102: #define IDS_UNTITLED 24
103: #define IDS_DOTBMP 25
104: #define IDS_HELPFILE 26
105: #define IDS_IMAGEDITINI 27
106: #define IDS_ICONIMAGELABEL 28
107: #define IDS_BITMAPIMAGELABEL 29
108: #define IDS_CURSORIMAGELABEL 30
109: #define IDS_ICONDEVNAMEEGAVGA 31
110: #define IDS_ICONDEVNAMEMONO 32
111: #define IDS_ICONDEVNAMECGA 33
112: #define IDS_CURDEVNAMEVGAMONO 34
113: #define IDS_CURDEVNAMEVGACOLOR 35
114: #define IDS_ICONINISECTION 36
115: #define IDS_CURSORINISECTION 37
116: #define IDS_BMPFILTER 38
117: #define IDS_BMPFILTEREXT 39
118: #define IDS_ICOFILTER 40
119: #define IDS_ICOFILTEREXT 41
120: #define IDS_CURFILTER 42
121: #define IDS_CURFILTEREXT 43
122: #define IDS_PALFILTER 44
123: #define IDS_PALFILTEREXT 45
124: #define IDS_ALLFILTER 46
125: #define IDS_ALLFILTEREXT 47
126: #define IDS_DEFEXTBMP 48
127: #define IDS_DEFEXTICO 49
128: #define IDS_DEFEXTCUR 50
129: #define IDS_DEFEXTPAL 51
130: #define IDS_UNKNOWNIMAGEFORMAT 52
131:
132: /*
133: * The total number of strings. This MUST be updated if strings are
134: * added or removed.
135: */
136: #define CSTRINGS 53
137:
138:
139: /*
140: * Defines for messages. These are indexes into the gamdMessage table.
141: */
142: #define MSG_OUTOFMEMORY 0
143: #define MSG_MEMERROR 1
144: #define MSG_BADBMPFILE 2
145: #define MSG_BADICOCURFILE 3
146: #define MSG_BADPALFILE 4
147: #define MSG_CANTOPEN 5
148: #define MSG_READERROR 6
149: #define MSG_WRITEERROR 7
150: #define MSG_CANTCREATE 8
151: #define MSG_NOCLIPBOARDFORMAT 9
152: #define MSG_NOCLIPBOARD 10
153: #define MSG_CANTEDITIMAGE 11
154: #define MSG_SAVEFILE 12
155: #define MSG_ENTERANUMBER 13
156: #define MSG_BADDEVICESIZE 14
157: #define MSG_BADDEVICECOLORS 15
158: #define MSG_NOTSUPPORT 16
159: #define MSG_NOIMAGES 17
160: #define MSG_BADBMPSIZE 18
161:
162:
163: /*
164: * Defines for the different file types.
165: */
166: #define FT_BITMAP 0
167: #define FT_ICON 1
168: #define FT_CURSOR 2
169: #define FT_PALETTE 3
170:
171:
172: /*
173: * Macro to properly cast a FAR pointer to a near pointer.
174: * Casts a FAR pointer to void, then to an unsigned long integral
175: * value, then truncate it to a short integral value, then cast
176: * to a near pointer.
177: */
178: #ifdef WIN32
179: #define FAR2NEAR(lpstr) (lpstr)
180: #else
181: #define FAR2NEAR(lpstr) ((PSTR)(WORD)(DWORD)(LPVOID)(lpstr))
182: #endif
183:
184: /*
185: * RGB color values.
186: */
187: #define RGB_BLACK RGB( 0, 0, 0)
188: #define RGB_WHITE RGB(255, 255, 255)
189: #define RGB_LIGHTGRAY RGB(192, 192, 192)
190: #define RGB_DARKGRAY RGB(128, 128, 128)
191:
192:
193: /*
194: * Maximum rows and columns in the color box. This includes room for
195: * screen/inverse and a separating blank column.
196: */
197: #define COLORCOLS 16
198: #define COLORROWS 2
199:
200: /*
201: * Maximum colors in the palette (not including screen/inverse).
202: */
203: #define COLORSMAX 28
204:
205: /*
206: * Defines for the different color modes that the left and right
207: * mouse buttons can have.
208: */
209: #define MODE_COLOR 0 // A standard color.
210: #define MODE_SCREEN 1 // The screen color.
211: #define MODE_INVERSE 2 // The inverse screen color.
212:
213:
214: /*
215: * Margin (in pixels) within each of the palette and toolbox windows.
216: */
217: #define PALETTEMARGIN 2
218:
219: /* raster op combination modes */
220: #define ROP_DSna 0x00220326L
221: #define ROP_DSPao 0x00EA02E9L
222:
223: #define DEFAULTBITMAPWIDTH 32 // Default bitmap width.
224: #define DEFAULTBITMAPHEIGHT 32 // Default bitmap height.
225: #define DEFAULTBITMAPCOLORS 16 // Default bitmap colors.
226:
227: #define MAXIMAGEDIM 256 // Max image width/height (dimension).
228: #define MAXIMAGES 64 // Maximum images in an ico/cur file.
229:
230: #define CCHDESCRIPTOR 80 /* length of image descriptor string */
231: #define CCHDEVICENAMEMAX 20 /* maximum length of a device name */
232:
233: /*
234: * Maximum sizes of the app window when running ImagEdit for the first time.
235: * This makes it so that the editor does not default to a huge size when
236: * run on a super-vga resolution monitor.
237: */
238: #define MAXDEFAULTAPPCX 640
239: #define MAXDEFAULTAPPCY 480
240:
241:
242: /*************************************************************************/
243:
244: /* 3.0 icon/cursor header */
245: typedef struct {
246: WORD iReserved; /* always 0 */
247: WORD iResourceType;
248: WORD iResourceCount; /* number of resources in file */
249: } ICOCURSORHDR;
250:
251: /* 3.0 icon/cursor descriptor */
252: typedef struct {
253: BYTE iWidth; /* width of image (icons only ) */
254: BYTE iHeight; /* height of image(icons only) */
255: BYTE iColorCount; /* number of colors in image */
256: BYTE iUnused; /* */
257: WORD iHotspotX; /* hotspot x coordinate (CURSORS only) */
258: WORD iHotspotY; /* hotspot y coordinate (CURSORS only) */
259: DWORD DIBSize; /* size of DIB for this image */
260: DWORD DIBOffset; /* offset to DIB for this image */
261: } ICOCURSORDESC, *PICOCURSORDESC;
262:
263: typedef struct DeviceNode {
264: struct DeviceNode *pDeviceNext; // Pointer to next device node.
265: INT iType; // Type of image (FT_*).
266: INT nColors; // Number of colors.
267: INT cx; // Width of image.
268: INT cy; // Height of image.
269: CHAR szName[CCHDEVICENAMEMAX]; // Device name.
270: CHAR szDesc[CCHDESCRIPTOR]; // Full description string.
271: } DEVICE;
272: typedef DEVICE *PDEVICE;
273:
274: /*
275: * Structure that describes a link in the image list.
276: */
277: typedef struct ImageNode {
278: struct ImageNode *pImageNext; // Pointer to next image.
279: PDEVICE pDevice; // Pointer to device structure.
280: INT cx; // Image width.
281: INT cy; // Image height.
282: INT iHotspotX; // Hotspot x coordinate (cursors only).
283: INT iHotspotY; // Hotspot y coordinate (cursors only).
284: INT nColors; // Number of colors.
285: DWORD DIBSize; // Size of DIB for this image.
286: HANDLE DIBhandle; // Handle to DIB bits.
287: LPSTR DIBPtr; // Pointer to DIB bits.
288: } IMAGEINFO, *PIMAGEINFO;
289:
290: /*
291: * Defines an entry in the gamdMessages table of error and warning messages.
292: */
293: typedef struct {
294: UINT ids; /* String id for the message text. */
295: UINT fMessageBox; /* Flags for the MessageBox function. */
296: } MESSAGEDATA;
297:
298: /*
299: * This structure defines each tool used in the editor.
300: */
301: typedef struct {
302: DRAWPROC pfnDrawProc; /* Drawing procedure for this tool type. */
303: HCURSOR hcur; /* Handle to the cursor for this tool. */
304: INT idbmToolBtnUp; /* ID of "up" bmp res. for the Toolbox button. */
305: HBITMAP hbmToolBtnUp; /* hbm of "up" bitmap for the Toolbox button. */
306: INT idbmToolBtnDown; /* ID of "down" bmp res. for the Toolbox button.*/
307: HBITMAP hbmToolBtnDown; /* hbm of "down" bitmap for the Toolbox button. */
308: UINT fDrawOnDown:1; /* TRUE if tool draws on down click. */
309: UINT fDrawOnUp:1; /* TRUE if tool draws on up click. */
310: } TOOLS;
311:
312: /*
313: * One single entry for an environment setting saved in the
314: * profile file. Used by ReadEnv and WriteEnv.
315: */
316: typedef struct _INIENTRY {
317: PSTR pstrKeyName;
318: PINT pnVar;
319: INT nDefault;
320: INT nSave;
321: } INIENTRY;
322:
323: /*
324: * Structure that maps a subject (like a menu id or a dialog id) with
325: * a help context to pass in to WinHelp.
326: */
327: typedef struct {
328: INT idSubject; // Subject, usually a menu or dialog id.
329: INT HelpContext; // The matching help context.
330: } HELPMAP;
331: typedef HELPMAP *PHELPMAP;
332:
333:
334: #include "iefuncs.h"
335:
336: #include "globals.h"
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.