Initial revision
[ssr] / StraySrc / Glass / !Glass / h / tfile
1 /*
2 * tfile.c
3 *
4 * Control of template files
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 __tfile_h
29 #define __tfile_h
30
31 /*----- Required headers --------------------------------------------------*/
32
33 #ifndef __gStruct_h
34 #include "gStruct.h"
35 #endif
36
37 /*----- External routines -------------------------------------------------*/
38
39 /*
40 * BOOL tfile_okToQuit(BOOL ask)
41 *
42 * Use
43 * Ensures that it is 'safe' for Glass to quit.
44 *
45 * Parameters
46 * BOOL ask == should I open a dialogue to ask the user?
47 *
48 * Returns
49 * TRUE if it is safe to quit, or FALSE if not.
50 */
51
52 BOOL tfile_okToQuit(BOOL ask);
53
54 /*
55 * void tfile_markAsAltered(glass_tfile *t)
56 *
57 * Use
58 * Marks down another alteration for the template file, changing the window
59 * title if required etc. Also handles stuff for autosave etc.
60 *
61 * Parameters
62 * glass_tfile *t == the template file to alter
63 */
64
65 void tfile_markAsAltered(glass_tfile *t);
66
67 /*
68 * void tfile_markAsSaved(glass_tfile *t,char *newName)
69 *
70 * Use
71 * Marks a template file as having been saved. Turns off autosave and
72 * things.
73 *
74 * Parameters
75 * glass_tfile *t == the file to mark
76 * char *newName == the new name to give to the file
77 */
78
79 void tfile_markAsSaved(glass_tfile *t,char *newName);
80
81 /*
82 * void tfile_windowInfo(glass_windPointer *w)
83 *
84 * Use
85 * Displays an info box for a single window
86 *
87 * Parameters
88 * glass_windPointer *w == the window to display info on
89 */
90
91 void tfile_windowInfo(glass_windPointer *w);
92
93 /*
94 * void tfile_deleteWindow(glass_windPointer *w)
95 *
96 * Use
97 * Deletes a single window.
98 *
99 * Parameters
100 * viewer_icon i == the icon to get
101 * void *handle == the window to eliminate (as a glass_windPointer *)
102 */
103
104 void tfile_deleteWindow(viewer_icon i,void *handle);
105
106 /*
107 * BOOL tfile_rename(char *newName,void *handle)
108 *
109 * Use
110 * Renames the specified window
111 *
112 * Parameters
113 * char *newName == the new name of the window
114 * void *handle == pointer to the window structure
115 */
116
117 BOOL tfile_rename(char *newName,void *handle);
118
119 /*
120 * void tfile_saveTemplates(glass_tfile *t)
121 *
122 * Use
123 * Saves a template file using a standard dialogue box
124 *
125 * Parameters
126 * glass_tfile *t == the template file to save
127 */
128
129 void tfile_saveTemplates(glass_tfile *t);
130
131 /*
132 * void tfile_saveWindow(glass_windPointer *w)
133 *
134 * Use
135 * Saves a single window using a standard dialogue box
136 *
137 * Parameters
138 * glass_windPointer *w == pointer to the window to save
139 */
140
141 void tfile_saveWindow(glass_windPointer *w);
142
143 /*
144 * void tfile_mergeFromMemory(void **p,glass_tfile *t)
145 *
146 * Use
147 * Actually does a merge operation. The target file is a glass_tfile in
148 * memory (internal format) and the source file is a memory image of a
149 * normal template file.
150 *
151 * Parameters
152 * void **p == a flex anchor pointer to the source file
153 * glass_tfile *t == a pointer to the destination file
154 */
155
156 BOOL tfile_mergeFromMemory(void **p,glass_tfile *t);
157
158 /*
159 * void tfile_mergeFromFile(char *file,glass_tfile *t)
160 *
161 * Use
162 * Merges the template file given into the given template file structure.
163 *
164 * Parameters
165 * char *file == the file to load
166 * glass_tfile *t == the template file structure to merge with
167 */
168
169 BOOL tfile_mergeFromFile(char *file,glass_tfile *t);
170
171 /*
172 * glass_tfile *tfile_createTemplateFile(char *name)
173 *
174 * Use
175 * Creates a template file with the given name, but doesn't open its viewer.
176 *
177 * Returns
178 * A pointer to the file structure, or zero as failure.
179 */
180
181 glass_tfile *tfile_createTemplateFile(char *name);
182
183 /*
184 * glass_tfile *tfile_loadFromMemory(void **p,char *name)
185 *
186 * Use
187 * Loads a file from memory, i.e. from another application via RAM
188 * transfer.
189 *
190 * Parameters
191 * void **p == the memory block that contains the file to load.
192 * char *name == the name to give to the file.
193 *
194 * Returns
195 * A pointer to the template file, or 0
196 */
197
198 glass_tfile *tfile_loadFromMemory(void **p,char *name);
199
200 /*
201 * glass_tfile *tfile_loadFromFile(char *file,char *name)
202 *
203 * Use
204 * Loads a template file into memory, translating the file into Glass's
205 * internal format. It does not create any windows, although it does
206 * allocate font handles.
207 *
208 * Parameters
209 * char *file == the name of the file to load
210 * char *name == the name to insert in the title bar
211 *
212 * Returns
213 * A pointer to the structure definition, or 0 for failure. Note that this
214 * will only occur if no windows could be loaded.
215 */
216
217 glass_tfile *tfile_loadFromFile(char *file,char *name);
218
219 /*
220 * void tfile_dragSelected(viewer_icon i,wimp_bbits b,char *package)
221 *
222 * Use
223 * As for viewer_dragSelected, but uses the specified sprite as the
224 * 'package' sprite is solid sprite drags are enabled.
225 *
226 * Parameters
227 * viewer_icon i == the icon to drag
228 * wimp_bbits b == the button status that started it off
229 * char *package == the sprite to use for a package drag
230 */
231
232 void tfile_dragSelected(viewer_icon i,wimp_bbits b,char *package);
233
234 #endif