grub2: bring back build of aros-side grub2 tools
[AROS.git] / workbench / classes / zune / betterstring / mcc / library.c
blob12b192c9ceefe25916531f5f866ec7f7cdc45284
1 /***************************************************************************
3 BetterString.mcc - A better String gadget MUI Custom Class
4 Copyright (C) 1997-2000 Allan Odgaard
5 Copyright (C) 2005-2013 by BetterString.mcc Open Source Team
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
17 BetterString class Support Site: http://www.sf.net/projects/bstring-mcc/
19 $Id$
21 ***************************************************************************/
23 #include <proto/exec.h>
24 #include <proto/intuition.h>
26 /******************************************************************************/
27 /* */
28 /* MCC/MCP name and version */
29 /* */
30 /* ATTENTION: The FIRST LETTER of NAME MUST be UPPERCASE */
31 /* */
32 /******************************************************************************/
34 #include "private.h"
35 #include "version.h"
37 /******************************************************************************/
38 /* include the minimal startup code to be able to start the class from a */
39 /* shell without crashing the system */
40 /******************************************************************************/
41 #include "shellstart.c"
43 #define VERSION LIB_VERSION
44 #define REVISION LIB_REVISION
46 #define CLASS MUIC_BetterString
47 #define SUPERCLASS MUIC_Area
49 #define INSTDATA InstData
51 #define USERLIBID CLASS " " LIB_REV_STRING " [" SYSTEMSHORT "/" CPU "] (" LIB_DATE ") " LIB_COPYRIGHT
52 #define MASTERVERSION 19
54 #define CLASSINIT
55 #define CLASSEXPUNGE
57 #define USEDCLASSESP used_mcps
58 static const char *used_mcps[] = { "BetterString.mcp", NULL };
60 #define MIN_STACKSIZE 8192
62 struct Library *DiskfontBase = NULL;
63 struct Library *KeymapBase = NULL;
64 struct Library *LayersBase = NULL;
65 struct Library *LocaleBase = NULL;
67 #if defined(__amigaos4__)
68 struct DiskfontIFace *IDiskfont = NULL;
69 struct KeymapIFace *IKeymap = NULL;
70 struct LayersIFace *ILayers = NULL;
71 struct LocaleIFace *ILocale = NULL;
72 #endif
74 /******************************************************************************/
75 /* define the functions used by the startup code ahead of including mccinit.c */
76 /******************************************************************************/
77 static BOOL ClassInit(UNUSED struct Library *base);
78 static VOID ClassExpunge(UNUSED struct Library *base);
80 /******************************************************************************/
81 /* include the lib startup code for the mcc/mcp (and muimaster inlines) */
82 /******************************************************************************/
83 #include "mccinit.c"
85 /******************************************************************************/
86 /* define all implementations of our user functions */
87 /******************************************************************************/
88 static BOOL ClassInit(UNUSED struct Library *base)
90 if((LocaleBase = OpenLibrary("locale.library", 38)) &&
91 GETINTERFACE(ILocale, struct LocaleIFace *, LocaleBase))
93 if((LayersBase = OpenLibrary("layers.library", 36)) &&
94 GETINTERFACE(ILayers, struct LayersIFace *, LayersBase))
96 if((KeymapBase = OpenLibrary("keymap.library", 37)) &&
97 GETINTERFACE(IKeymap, struct KeymapIFace *, KeymapBase))
99 if((DiskfontBase = OpenLibrary("diskfont.library", 38)) &&
100 GETINTERFACE(IDiskfont, struct DiskfontIFace *, DiskfontBase))
102 if(CreateSharedPool() == TRUE)
104 if(StartClipboardServer() == TRUE)
106 return(TRUE);
109 DeleteSharedPool();
112 DROPINTERFACE(IDiskfont);
113 CloseLibrary(DiskfontBase);
114 DiskfontBase = NULL;
117 DROPINTERFACE(IKeymap);
118 CloseLibrary(KeymapBase);
119 KeymapBase = NULL;
122 DROPINTERFACE(ILayers);
123 CloseLibrary(LayersBase);
124 LayersBase = NULL;
127 DROPINTERFACE(ILocale);
128 CloseLibrary(LocaleBase);
129 LocaleBase = NULL;
132 return(FALSE);
136 static VOID ClassExpunge(UNUSED struct Library *base)
138 ShutdownClipboardServer();
140 DeleteSharedPool();
142 if(DiskfontBase)
144 DROPINTERFACE(IDiskfont);
145 CloseLibrary(DiskfontBase);
146 DiskfontBase = NULL;
149 if(KeymapBase)
151 DROPINTERFACE(IKeymap);
152 CloseLibrary(KeymapBase);
153 KeymapBase = NULL;
156 if(LayersBase)
158 DROPINTERFACE(ILayers);
159 CloseLibrary(LayersBase);
160 LayersBase = NULL;
163 if(LocaleBase)
165 DROPINTERFACE(ILocale);
166 CloseLibrary(LocaleBase);
167 LocaleBase = NULL;