cleanup debug
[AROS.git] / workbench / libs / icon / icon_init.c
blob135021fdfe9fafb7f9bea390ffb22fe5811ca356
1 /*
2 Copyright © 1995-2006, The AROS Development Team. All rights reserved.
3 $Id$
5 */
7 #include <utility/utility.h> /* this must be before icon_intern.h */
9 #include <aros/symbolsets.h>
11 #define __ICON_NOLIBBASE__
13 #include "icon_intern.h"
14 #include "identify.h"
16 #include LC_LIBDEFS_FILE
18 const LONG IFFParseBase_version = 39,
19 GfxBase_version = 39,
20 CyberGfxBase_version = 41,
21 DataTypesBase_version = 0;
23 /****************************************************************************************/
25 static int GM_UNIQUENAME(Init)(LIBBASETYPEPTR lh)
27 LONG i;
28 struct IconBase *IconBase;
30 LB(lh)->dsh.h_Entry = (void *)AROS_ASMSYMNAME(dosstreamhook);
31 LB(lh)->dsh.h_Data = lh;
33 InitSemaphore(&LB(lh)->iconlistlock);
34 for(i = 0; i < ICONLIST_HASHSIZE; i++)
36 NewList((struct List *)&LB(lh)->iconlists[i]);
39 /* Setup default global settings ---------------------------------------*/
40 LB(lh)->ib_Screen = NULL;
41 LB(lh)->ib_Precision = PRECISION_ICON;
42 LB(lh)->ib_EmbossRectangle.MinX = -4;
43 LB(lh)->ib_EmbossRectangle.MaxX = 4;
44 LB(lh)->ib_EmbossRectangle.MinY = -4;
45 LB(lh)->ib_EmbossRectangle.MaxY = 4;
46 LB(lh)->ib_Frameless = FALSE;
47 LB(lh)->ib_IdentifyHook = NULL;
48 LB(lh)->ib_MaxNameLength = 25;
49 LB(lh)->ib_NewIconsSupport = TRUE;
50 LB(lh)->ib_ColorIconSupport = TRUE;
52 IconBase = LB(lh);
54 UtilityBase = OpenLibrary("utility.library", 0);
55 if (UtilityBase != NULL) {
56 DOSBase = OpenLibrary("dos.library", 0);
57 if (DOSBase != NULL) {
58 GfxBase = OpenLibrary("graphics.library", GfxBase_version);
59 if (GfxBase != NULL) {
60 IntuitionBase = OpenLibrary("intuition.library", 0);
61 if (IntuitionBase != NULL) {
62 /* Optional libraries are loaded dynamically if needed */
63 return TRUE;
65 CloseLibrary(GfxBase);
67 CloseLibrary(DOSBase);
69 CloseLibrary(UtilityBase);
72 return FALSE;
75 static int GM_UNIQUENAME(Expunge)(LIBBASETYPEPTR LIBBASE)
77 /* Drop optional libraries */
78 if (LIBBASE->ib_CyberGfxBase) CloseLibrary(LIBBASE->ib_CyberGfxBase);
79 if (LIBBASE->ib_DataTypesBase) CloseLibrary(LIBBASE->ib_DataTypesBase);
80 if (LIBBASE->ib_IFFParseBase) CloseLibrary(LIBBASE->ib_IFFParseBase);
81 if (LIBBASE->ib_WorkbenchBase) CloseLibrary(LIBBASE->ib_WorkbenchBase);
83 /* Drop the rest */
84 if (IntuitionBase) CloseLibrary(IntuitionBase);
85 if (GfxBase) CloseLibrary(GfxBase);
86 if (DOSBase) CloseLibrary(DOSBase);
87 if (IntuitionBase) CloseLibrary(IntuitionBase);
89 return TRUE;
92 ADD2INITLIB(GM_UNIQUENAME(Init), 0);
93 ADD2EXPUNGELIB(GM_UNIQUENAME(Expunge), 0);