Initial revision
[ssr] / StraySrc / Glass / !Glass / h / gStruct
1 /*
2 * gStruct.h
3 *
4 * Data structure definitions (annotated)
5 *
6 * © 1994-1998 Straylight
7 */
8
9 /*----- Licensing note ----------------------------------------------------*
10 *
11 * This file is part of Straylight's Glass.
12 *
13 * Glass is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2, or (at your option)
16 * any later version.
17 *
18 * Glass is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with Glass. If not, write to the Free Software Foundation,
25 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 */
27
28 #ifndef __gStruct_h
29 #define __gStruct_h
30
31 #ifndef __gPrefs_h
32 #include "gPrefs.h"
33 #endif
34
35 #ifndef __wimp_h
36 #include "steel/wimp.h"
37 #endif
38
39 #ifndef __dbox_h
40 #include "steel/dbox.h"
41 #endif
42
43 #ifndef __viewer_h
44 #include "steel/viewer.h"
45 #endif
46
47 #ifndef __pane_h
48 #include "steel/pane.h"
49 #endif
50
51 typedef struct glass_tfile
52 /*
53 * Structure contains information about template file in general. Specifics
54 * are handled by viewer segment of Steel as handles for viewer icons.
55 */
56 {
57 viewer v; /* The viewer window displaying this file */
58 sprite_area *s; /* The sprite area for the template file */
59 viewer vs; /* The viewer for the sprite area */
60 int alts; /* Number of alterations since saving */
61 int autoTime; /* Time of first alteration */
62 int autoAlarm; /* Alarm time for next autosave */
63 char filename[256]; /* What is the file's name? */
64 dbox autod; /* Dialogue box for autosave */
65 gPrefs_iconSize isz; /* Icon size for displaying */
66 gPrefs_sortType sort; /* How to sort icons in the display */
67 BOOL loaded : 1; /* Does the file have a sensible name? */
68 BOOL autoSaved : 1; /* Has the file been autosaved? */
69 }
70 glass_tfile;
71
72 typedef struct glass_edit
73 /*
74 * Contains common edit information (dbox handles, panel number and so on)
75 */
76 {
77 dbox d; /* Dialogue box handle for the edit */
78 pane p; /* Pane holding current panel in place */
79 dbox pd; /* Dbox handle of the current panel */
80 dbox_field panel; /* The currently selcted panel */
81 }
82 glass_edit;
83
84 typedef struct glass_editWindow
85 /*
86 * Contains complete information about an edit window window
87 */
88 {
89 glass_edit e; /* Common edit information */
90 struct glass_windPointer *w; /* The window to edit */
91 wimp_wind wdef; /* The window definition in the dbox */
92 char data[256]; /* The title bar data text */
93 char valid[256]; /* The title bar validation string */
94 int indLen; /* Length of indirected data */
95 BOOL hasValid; /* Short cut to whether vstring exists */
96 char font[40]; /* Font name for the title */
97 int fontSize; /* Font size */
98 }
99 glass_editWindow;
100
101 typedef struct glass_editIcon
102 /*
103 * Contains complete information about an edit icon window
104 */
105 {
106 glass_edit e; /* Common edit information */
107 struct glass_windPointer *w; /* The window containing the icon to edit*/
108 int i; /* The icon number to edit */
109 wimp_icon idef; /* The icon definition in the dbox */
110 char data[256]; /* The icon data text */
111 char valid[256]; /* The icon validation string */
112 int indLen; /* Length of indirected data */
113 BOOL hasValid; /* Short cut to whether vstring exists */
114 char font[40]; /* Font name for the icon */
115 int fontSize; /* Font size */
116 }
117 glass_editIcon;
118
119 typedef struct glass_guide
120 /*
121 * Contains information on window guide lines.
122 */
123 {
124 int coord; /* The guide's position */
125 BOOL active : 1; /* Is it currently active? */
126 BOOL horiz : 1; /* TRUE == horizontal, FALSE == vertical */
127 BOOL selected : 1; /* Is the guideline selected? */
128 }
129 glass_guide;
130
131 #define glass_GUIDELIMIT 16 /* Allow 16 guides per window */
132
133 typedef struct glass_windPointer
134 /*
135 * Contains mainly status information about a window, and points to the flex
136 * block containing the actual window definition in internal form.
137 */
138 {
139 char id[15]; /* The window identifier */
140 glass_tfile *t; /* The template file */
141 viewer_icon i; /* The viewer icon handle */
142 struct glass_window *def; /* Flex anchor point for definiton block */
143 wimp_w h; /* Window handle if open (or 0) */
144 int selno; /* Number of icons selected */
145 int lastClicked; /* Last icon clicked (for depthwise sel) */
146 glass_editWindow *edit; /* Pointer to edit information, or 0 */
147 int gridx; /* Grid width */
148 int gridy; /* Grid height */
149 int size; /* Memory taken up by the definition */
150 int serial; /* Serial number of this window */
151 glass_guide guide[glass_GUIDELIMIT]; /* Array of guide defs */
152 wimp_box tex; /* Current temporary window extent */
153 char fonts[256]; /* Font usage array for this window */
154 BOOL ownPointer : 1; /* TRUE if this window contains the ptr */
155 BOOL renumber : 1; /* TRUE if we're reordering icons */
156 BOOL gridShow : 1; /* Display the grid onsceeen? */
157 BOOL gridLock : 1; /* Snap to the grid? */
158 BOOL antiAliased : 1; /* Quick check for fonts */
159 #ifndef glass_DEMO
160 BOOL testMode : 1; /* TRUE if the window is in test mode */
161 #endif
162 }
163 glass_windPointer;
164
165 typedef struct glass_windDescription
166 /*
167 * Defines how a window is laid out internally in Glass's workspace.
168 */
169 {
170 wimp_wind w; /* The window definition */
171 }
172 glass_windDescription;
173
174 typedef struct glass_iconDescription
175 /*
176 * Icon description (internal format) used in flex block.
177 */
178 {
179 glass_editIcon *edit; /* Is the icon being edited? */
180 wimp_icon i; /* The icon definition */
181 BOOL selected : 1; /* Is the icon selected (for manipulation */
182 /* in Glass, not in the WIMP sense) */
183 BOOL copied : 1; /* Is the icon a new copy (i.e. select it */
184 /* after a copy op) */
185 }
186 glass_iconDescription;
187
188 typedef struct glass_window
189 /*
190 * Contains a complete window definiton. This describes exactly what is
191 * contained in the window definiton flex block.
192 */
193 {
194 glass_windDescription desc; /* Description of window (not icons) */
195 glass_iconDescription i[1]; /* Description of icons */
196 }
197 glass_window;
198
199 /*
200 * Macros to allow indirection to a structure in a flex block
201 *
202 * flex == flex pointer (any pointer)
203 * offset == integer offset (in bytes)
204 *
205 * Example
206 * iconptr(w->def,off)->flags.indirect=TRUE;
207 */
208
209 #define intptr(flex,offset) \
210 ((int *)(((char *)(flex))+(offset)))
211 #define charptr(flex,offset) \
212 (((char *)(flex))+(offset))
213 #define winptr(flex,offset) \
214 ((glass_window *)(((char *)(flex))+(offset)))
215 #define iconptr(flex,offset) \
216 ((glass_iconDescription *)(((char *)(flex))+(offset)))
217 #define _ptr(type,flex,offset) \
218 ((type *)(((char *)(flex))+(offset)))
219
220 #endif