disable debug
[AROS.git] / workbench / libs / icon / icon_init.c
blob54a0c56583ec099689f1b7b2e2ad35b75d50f5eb
1 /*
2 Copyright © 1995-2017, 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 #ifndef __ICON_NOLIBBASE__
12 #define __ICON_NOLIBBASE__
13 #endif /* !__ICON_NOLIBBASE__ */
15 #include "icon_intern.h"
16 #include "identify.h"
18 #include LC_LIBDEFS_FILE
20 const LONG IFFParseBase_version = 39,
21 GfxBase_version = 39,
22 CyberGfxBase_version = 41,
23 DataTypesBase_version = 0;
25 /****************************************************************************************/
27 static int GM_UNIQUENAME(Init)(LIBBASETYPEPTR lh)
29 LONG i;
30 struct IconBase *IconBase;
32 LB(lh)->dsh.h_Entry = (void *)AROS_ASMSYMNAME(dosstreamhook);
33 LB(lh)->dsh.h_Data = lh;
35 InitSemaphore(&LB(lh)->iconlistlock);
36 for(i = 0; i < ICONLIST_HASHSIZE; i++)
38 NewList((struct List *)&LB(lh)->iconlists[i]);
41 /* Setup default global settings ---------------------------------------*/
42 LB(lh)->ib_Screen = NULL;
43 LB(lh)->ib_Precision = PRECISION_ICON;
44 LB(lh)->ib_EmbossRectangle.MinX = -4;
45 LB(lh)->ib_EmbossRectangle.MaxX = 4;
46 LB(lh)->ib_EmbossRectangle.MinY = -4;
47 LB(lh)->ib_EmbossRectangle.MaxY = 4;
48 LB(lh)->ib_Frameless = FALSE;
49 LB(lh)->ib_IdentifyHook = NULL;
50 LB(lh)->ib_MaxNameLength = 25;
51 LB(lh)->ib_NewIconsSupport = TRUE;
52 LB(lh)->ib_ColorIconSupport = TRUE;
54 IconBase = LB(lh);
56 UtilityBase = OpenLibrary("utility.library", 0);
57 if (UtilityBase != NULL) {
58 DOSBase = OpenLibrary("dos.library", 0);
59 if (DOSBase != NULL) {
60 GfxBase = OpenLibrary("graphics.library", GfxBase_version);
61 if (GfxBase != NULL) {
62 IntuitionBase = OpenLibrary("intuition.library", 0);
63 if (IntuitionBase != NULL) {
64 /* Optional libraries are loaded dynamically if needed */
65 return TRUE;
67 CloseLibrary(GfxBase);
69 CloseLibrary(DOSBase);
71 CloseLibrary(UtilityBase);
74 return FALSE;
77 static int GM_UNIQUENAME(Expunge)(LIBBASETYPEPTR LIBBASE)
79 /* Drop optional libraries */
80 if (LIBBASE->ib_CyberGfxBase) CloseLibrary(LIBBASE->ib_CyberGfxBase);
81 if (LIBBASE->ib_DataTypesBase) CloseLibrary(LIBBASE->ib_DataTypesBase);
82 if (LIBBASE->ib_IFFParseBase) CloseLibrary(LIBBASE->ib_IFFParseBase);
83 if (LIBBASE->ib_WorkbenchBase) CloseLibrary(LIBBASE->ib_WorkbenchBase);
85 /* Drop the rest */
86 if (IntuitionBase) CloseLibrary(IntuitionBase);
87 if (GfxBase) CloseLibrary(GfxBase);
88 if (DOSBase) CloseLibrary(DOSBase);
89 if (IntuitionBase) CloseLibrary(IntuitionBase);
91 return TRUE;
94 ADD2INITLIB(GM_UNIQUENAME(Init), 0);
95 ADD2EXPUNGELIB(GM_UNIQUENAME(Expunge), 0);