2 Copyright © 2002-2011, The AROS Development Team. All rights reserved.
5 #include "portable_macros.h"
8 #define MUIMASTER_YES_INLINE_STDARG
11 #include <aros/debug.h>
15 #include <libraries/mui.h>
17 #if defined(__AMIGA__) && !defined(__PPC__)
18 #define NO_INLINE_STDARG
21 #include <proto/alib.h>
22 #include <proto/intuition.h>
23 #include <proto/muimaster.h>
25 #include <proto/dos.h>
34 #define D(x) if (DEBUG) x
36 #define bug DebugPrintF
48 struct Library
*LocaleBase
= NULL
;
49 struct Library
*UtilityBase
= NULL
;
51 struct Library
*LocaleBase
=NULL
;
52 struct UtilityBase
*UtilityBase
;
54 struct LocaleBase
*LocaleBase
= NULL
;
55 struct UtilityBase
*UtilityBase
= NULL
;
58 struct GfxBase
*GfxBase
= NULL
;
59 struct IntuitionBase
*IntuitionBase
= NULL
;
60 struct Library
*IFFParseBase
= NULL
;
61 struct LayersBase
*LayersBase
= NULL
;
62 struct Library
*WorkbenchBase
= NULL
;
63 struct IconBase
*IconBase
= NULL
;
64 struct DataTypesBase
*DataTypesBase
= NULL
;
65 struct DiskfontBase
*DiskfontBase
= NULL
;
67 struct Library
*MUIMasterBase
= NULL
;
68 struct Library
*CyberGfxBase
= NULL
;
72 struct UtilityIFace
*IUtility
;
73 struct GraphicsIFace
*IGraphics
;
74 struct LayersIFace
*ILayers
;
75 struct DataTypesIFace
*IDataTypes
;
76 struct IconIFace
*IIcon
;
77 struct WorkbenchIFace
*IWorkbench
;
78 struct DiskfontIFace
*IDiskfont
;
79 struct IntuitionIFace
*IIntuition
;
80 struct IFFParseIFace
*IIFFParse
;
81 struct LocaleIFace
*ILocale
;
82 struct MUIMasterIFace
*IMUIMaster
;
83 struct CyberGfxIFace
*ICyberGfx
;
87 /* global variables */
88 Object
*_WandererIntern_AppObj
= NULL
;
89 Class
*_WandererIntern_CLASS
= NULL
;
91 /* Don't output errors to the console, open requesters instead */
92 int __forceerrorrequester
= 1;
96 //struct MUI_CustomClass *IconWindow_Class = NULL;
98 struct MUI_CustomClass
*IconList_Class
= NULL
;
99 struct MUI_CustomClass
*IconDrawerList_Class
= NULL
;
100 struct MUI_CustomClass
*IconListview_Class
= NULL
;
101 struct MUI_CustomClass
*IconVolumeList_Class
= NULL
;
104 void deInitLibs(void)
110 if (IconWindowIconNetworkBrowserList_CLASS)
111 IconWindowIconNetworkBrowserList_Deinitialize();
113 if (WandererPrefs_CLASS
)
114 WandererPrefs_Deinitialize();
117 Wanderer_Deinitialize();
119 if (IconWindowIconVolumeList_CLASS
)
120 IconWindowIconVolumeList_Deinitialize();
122 if (IconWindowIconDrawerList_CLASS
)
123 IconWindowIconDrawerList_Deinitialize();
126 if (IconVolumeList_Class
)
127 MUI_DeleteCustomClass(IconVolumeList_Class
);
129 if (IconListview_Class
)
130 MUI_DeleteCustomClass(IconListview_Class
);
132 if (IconDrawerList_Class
)
133 MUI_DeleteCustomClass(IconDrawerList_Class
);
136 MUI_DeleteCustomClass(IconList_Class
);
138 if (IconWindow_CLASS
)
139 IconWindow_Deinitialize();
144 DropInterface((struct Interface
*)IMUIMaster
);
147 CloseLibrary(MUIMasterBase
);
152 Locale_Deinitialize();
155 DropInterface((struct Interface
*)ILocale
);
157 CloseLibrary((struct Library
*)LocaleBase
);
162 DropInterface((struct Interface
*)IIFFParse
);
165 DropInterface((struct Interface
*)ICyberGfx
);
168 DropInterface((struct Interface
*)IWorkbench
);
171 DropInterface((struct Interface
*)IIcon
);
175 DropInterface((struct Interface
*)IDataTypes
);
178 DropInterface((struct Interface
*)IDiskfont
);
181 DropInterface((struct Interface
*)IIntuition
);
184 DropInterface((struct Interface
*)IUtility
);
187 DropInterface((struct Interface
*)ILayers
);
190 DropInterface((struct Interface
*)IGraphics
);
193 if (IFFParseBase
) CloseLibrary(IFFParseBase
);
197 if (WorkbenchBase
) CloseLibrary((struct Library
*)WorkbenchBase
);
199 if (IconBase
) CloseLibrary((struct Library
*)IconBase
);
201 if (DiskfontBase
) CloseLibrary((struct Library
*)DiskfontBase
);
203 if (DataTypesBase
) CloseLibrary((struct Library
*)DataTypesBase
);
205 if (CyberGfxBase
) CloseLibrary(CyberGfxBase
);
207 if (IntuitionBase
) CloseLibrary((struct Library
*)IntuitionBase
);
209 if (UtilityBase
) CloseLibrary((struct Library
*)UtilityBase
);
211 if (LayersBase
) CloseLibrary((struct Library
*)LayersBase
);
213 if (GfxBase
) CloseLibrary((struct Library
*)GfxBase
);
222 if (!(GfxBase
=(struct GfxBase
*) OpenLibrary("graphics.library",40))
224 || !(IGraphics
= (struct GraphicsIFace
*) GetInterface((struct Library
*)GfxBase
,
232 if(!(LayersBase
=(struct LayersBase
*) OpenLibrary((CONST_STRPTR
)"layers.library",40))
234 || !(ILayers
= (struct LayersIFace
*) GetInterface((struct Library
*)LayersBase
,
245 if (!(UtilityBase
= (struct Library
*)OpenLibrary("utility.library",40))
247 if (!(UtilityBase
= (struct UtilityBase
*)OpenLibrary("utility.library",40))
250 || !(IUtility
= (struct UtilityIFace
*) GetInterface((struct Library
*)UtilityBase
,
260 if (!(IntuitionBase
= (struct IntuitionBase
*)OpenLibrary((CONST_STRPTR
)"intuition.library",40))
262 || !(IIntuition
= (struct IntuitionIFace
*) GetInterface((struct Library
*)IntuitionBase
,
271 if (!(MUIMasterBase
= OpenLibrary((CONST_STRPTR
)"muimaster.library",19))
273 || !(IMUIMaster
= (struct MUIMasterIFace
*) GetInterface((struct Library
*)MUIMasterBase
,
283 if (!(LocaleBase
= OpenLibrary((CONST_STRPTR
)"locale.library",39))
285 if (!(LocaleBase
=(struct Library
*) OpenLibrary("locale.library",39))
287 if (!(LocaleBase
=(struct LocaleBase
*) OpenLibrary("locale.library",39))
290 || !(ILocale
= (struct LocaleIFace
*) GetInterface((struct Library
*)LocaleBase
,
302 if (!(IFFParseBase
= OpenLibrary((CONST_STRPTR
)"iffparse.library",40))
304 || !(IIFFParse
= (struct IFFParseIFace
*) GetInterface((struct Library
*)IFFParseBase
,
314 if(!(CyberGfxBase
= OpenLibrary("cybergraphics.library",41))
316 || !(ICyberGfx
= (struct CyberGfxIFace
*) GetInterface((struct Library
*)CyberGfxBase
,
324 if(!(WorkbenchBase
= OpenLibrary("workbench.library",40))
326 || !(IWorkbench
= (struct WorkbenchIFace
*) GetInterface((struct Library
*)WorkbenchBase
,
334 if(!(DiskfontBase
= (struct DiskfontBase
*)OpenLibrary((CONST_STRPTR
)"diskfont.library",40))
336 || !(IDiskfont
= (struct DiskfontIFace
*) GetInterface((struct Library
*)DiskfontBase
,
344 if(!(IconBase
= (struct IconBase
*)OpenLibrary((CONST_STRPTR
)"icon.library",41))
346 || !(IIcon
= (struct IconIFace
*) GetInterface((struct Library
*)IconBase
,
354 if(!(DataTypesBase
= (struct DataTypesBase
*)OpenLibrary((CONST_STRPTR
)"datatypes.library",40))
356 || !(IDataTypes
= (struct DataTypesIFace
*) GetInterface((struct Library
*)DataTypesBase
,
366 if (!initIconWindowClass())
369 // if (!(IconWindow_Class = (struct MUI_CustomClass *) initIconWindowClass()))
372 if (!(IconList_Class
= (struct MUI_CustomClass
*) initIconListClass()))
375 if (!(IconDrawerList_Class
= (struct MUI_CustomClass
*) initIconDrawerListClass()))
378 if (!(IconListview_Class
= (struct MUI_CustomClass
*) initIconListviewClass()))
381 if (!(IconVolumeList_Class
= (struct MUI_CustomClass
*) initIconVolumeListClass()))
385 IconWindowIconDrawerList_Initialize();
387 IconWindowIconVolumeList_Initialize();
389 // IconWindowIconNetworkBrowserList_Initialize();
392 Wanderer_Initialize();
394 WandererPrefs_Initialize();
405 LONG retval
= RETURN_ERROR
;
407 /* WB programs have NULL pr_ConsoleTask */
408 SetConsoleTask(NULL
);
416 struct Task
*me
= (struct Task
*)FindTask(NULL
);
418 bug("[Wanderer] %s: This Task @ %p \n", __PRETTY_FUNCTION__
, me
);
419 bug("[Wanderer] %s: SPLower @ %p \n", __PRETTY_FUNCTION__
, me
->tc_SPLower
);
420 bug("[Wanderer] %s: SPUpper @ %p \n", __PRETTY_FUNCTION__
, me
->tc_SPUpper
);
423 D(bug("[Wanderer] %s: Wanderer Initialising .. \n", __PRETTY_FUNCTION__
));
424 if ((_WandererIntern_AppObj
= NewObject(Wanderer_CLASS
->mcc_Class
, NULL
, TAG_DONE
)) != NULL
)
426 D(bug("[Wanderer] %s: Launching WBStartup items .. \n", __PRETTY_FUNCTION__
));
427 OpenWorkbenchObject("Wanderer:Tools/ExecuteStartup", TAG_DONE
);
429 D(bug("[Wanderer] %s: Handing control over to Zune .. \n", __PRETTY_FUNCTION__
));
430 retval
= DoMethod(_WandererIntern_AppObj
, MUIM_Application_Execute
);
432 D(bug("[Wanderer] %s: Returned from Zune's control .. \n", __PRETTY_FUNCTION__
));
433 MUI_DisposeObject(_WandererIntern_AppObj
);
436 D(bug("[Wanderer] %s: Exiting .. \n", __PRETTY_FUNCTION__
));