Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / devs / diskimage / ra_gui / include / diskimagegui.h
blob20bae3e750b887df5576b027d3cb737db4fbb8a2
1 /* Copyright 2007-2012 Fredrik Wikstrom. All rights reserved.
2 **
3 ** Redistribution and use in source and binary forms, with or without
4 ** modification, are permitted provided that the following conditions
5 ** are met:
6 **
7 ** 1. Redistributions of source code must retain the above copyright
8 ** notice, this list of conditions and the following disclaimer.
9 **
10 ** 2. Redistributions in binary form must reproduce the above copyright
11 ** notice, this list of conditions and the following disclaimer in the
12 ** documentation and/or other materials provided with the distribution.
14 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
15 ** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 ** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
18 ** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19 ** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20 ** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21 ** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22 ** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23 ** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24 ** POSSIBILITY OF SUCH DAMAGE.
27 #ifndef DISKIMAGEGUI_H
28 #define DISKIMAGEGUI_H
30 #include <exec/exec.h>
31 #include <dos/dos.h>
32 #include <devices/diskimage.h>
33 #include <libraries/commodities.h>
34 #include <intuition/intuition.h>
35 #include <libraries/gadtools.h>
36 #include <libraries/asl.h>
37 #include <libraries/screennotify.h>
38 #include <reaction/reaction.h>
39 #include <classes/extwindow.h>
40 #include <gadgets/extscroller.h>
41 #include "support.h"
42 #include "prefs.h"
43 #include "locale.h"
45 #define PROGNAME "DiskImageGUI"
46 #define WORKBENCHNAME "Workbench"
47 #define GA(o) ((struct Gadget *)(o))
48 #define MENU_ID(id) ((APTR)(id))
50 #ifndef ACTION_GET_DISK_FSSM
51 #define ACTION_GET_DISK_FSSM 4201
52 #define ACTION_FREE_DISK_FSSM 4202
53 #endif
55 enum {
56 EVT_DUMMY,
57 EVT_POPKEY
60 enum {
61 WID_MAIN,
62 WID_PLUGINS,
63 WID_SETDEVICETYPE,
64 WID_MAX
67 enum {
68 MID_DUMMY,
69 MID_ABOUT,
70 MID_HIDE,
71 MID_ICONIFY,
72 MID_QUIT,
73 MID_SNAPSHOT,
74 MID_CHANGETEMPDIR,
75 MID_SAVESETTINGS,
76 MID_PLUGINS
79 enum {
80 IID_INSERT,
81 IID_EJECT,
82 IID_WRITEPROTECT,
83 IID_PREFS,
84 IID_REFRESH,
85 IID_LIST_WRITEPROTECTED,
86 IID_LIST_CHECKMARK,
87 IID_LIST_PLUGIN,
88 IID_LIST_DISK,
89 IID_LIST_CDROM,
90 IID_MAX
93 enum {
94 LID_SPEEDBAR,
95 LID_DRIVELIST,
96 LID_PLUGINCHOOSER,
97 LID_PLUGINLIST,
98 LID_DEVICETYPECHOOSER,
99 LID_MAX
102 enum {
103 GID_SPEEDBAR,
104 GID_DRIVELIST,
105 GID_DRIVELISTVPROP,
106 GID_PLUGINCHOOSER,
107 GID_PLUGINLIST,
108 GID_PLUGINLISTVPROP,
109 GID_DEVICETYPECHOOSER,
110 GID_SETDEVICETYPE_SAVE,
111 GID_SETDEVICETYPE_CANCEL,
112 GID_MAX
115 enum {
116 SBID_DUMMY,
117 SBID_INSERT,
118 SBID_EJECT,
119 SBID_WRITEPROTECT,
120 SBID_SETDEVICETYPE,
121 SBID_REFRESH
124 enum {
125 DRIVE_COL_ICON,
126 DRIVE_COL_UNIT,
127 DRIVE_COL_DEVICE,
128 DRIVE_COL_WP,
129 DRIVE_COL_DISKIMAGE,
130 DRIVE_COL_MAX
133 enum {
134 PLUG_COL_ICON,
135 PLUG_COL_PRI,
136 PLUG_COL_WRITE,
137 PLUG_COL_NAME,
138 PLUG_COL_MAX
141 struct GUIElements {
142 BOOL initialised;
143 APTR pool;
144 struct MsgPort *userport;
145 struct MsgPort *appport;
146 struct Screen *screen;
147 APTR visualinfo;
148 struct Menu *menustrip;
149 Object *windows[WID_MAX];
150 Object *images[IID_MAX];
151 Object *gadgets[GID_MAX];
152 struct List *lists[LID_MAX];
153 #ifdef FALLBACK_IMAGES
154 BOOL fallback_image[IID_MAX];
155 #endif
158 /* main.c */
159 extern struct LocaleInfo LocaleInfo;
160 extern struct DiskObject *Icon;
161 extern struct FileRequester *FileReq;
162 extern PrefsObject *ApplicationPrefs;
163 int main (int argc, STRPTR *argv);
164 struct DiskObject *GetProgramIcon (void);
165 void BeginScreenNotify (void);
166 void StopScreenNotify (void);
167 LONG GetUnitNumber (struct Node *node);
168 LONG GetSelectedUnit (void);
169 CONST_STRPTR GetSelectedPlugin (void);
170 void ScanUnits (void);
171 void ScanPlugins (void);
172 void UpdateSpeedBar (void);
173 void ChangeTempDir (void);
174 void SaveSettings (void);
176 /* cxbroker.c */
177 extern struct MsgPort *BrokerPort;
178 extern CxObj *Broker;
179 BOOL RegisterCxBroker (void);
180 void UnregisterCxBroker (void);
182 /* snapshot.c */
183 void RestoreWindowSize (Object *window, CONST_STRPTR name);
184 void SaveWindowSize (Object *window, CONST_STRPTR name, BOOL envarc);
186 /* gui.c */
187 extern struct GUIElements Gui;
188 BOOL SetupGUI (void);
189 void CleanupGUI (void);
190 APTR ShowWindow (ULONG window_id);
191 void HideWindow (ULONG window_id);
192 void IconifyWindow (ULONG window_id);
193 void SetWindowBusy (ULONG window_id, ULONG busy);
194 ULONG GetGUISignals (void);
195 void UpdateLBVertScroller (ULONG wnd_id, ULONG lb_id, ULONG sc_id);
197 /* images.c */
198 BOOL FindImage (CONST_STRPTR image, STRPTR path, LONG path_size);
199 Object *LoadImage (struct Screen *screen, CONST_STRPTR image, BOOL selected, BOOL disabled);
201 /* requesters.c */
202 LONG DoReq (Object *req);
203 #ifndef FALLBACK_IMAGES
204 void ImageNotFoundRequester (CONST_STRPTR image);
205 #endif
206 void AboutRequester (void);
207 void IoErrRequester (LONG error);
208 void ErrorStringRequester (CONST_STRPTR error_string);
209 void RequiredVersionRequester (CONST_STRPTR res_name, LONG version, LONG revision);
211 /* driveops.c */
212 void InsertOrEjectDisk (void);
213 void InsertDisk (void);
214 void EjectDisk (void);
215 void ToggleWriteProtect (void);
217 /* setdevicetype.c */
218 void SetDeviceType (void);
220 #endif