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/
21 ***************************************************************************/
23 #include <proto/exec.h>
24 #include <proto/intuition.h>
26 /******************************************************************************/
28 /* MCC/MCP name and version */
30 /* ATTENTION: The FIRST LETTER of NAME MUST be UPPERCASE */
32 /******************************************************************************/
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
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
;
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 /******************************************************************************/
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
)
112 DROPINTERFACE(IDiskfont
);
113 CloseLibrary(DiskfontBase
);
117 DROPINTERFACE(IKeymap
);
118 CloseLibrary(KeymapBase
);
122 DROPINTERFACE(ILayers
);
123 CloseLibrary(LayersBase
);
127 DROPINTERFACE(ILocale
);
128 CloseLibrary(LocaleBase
);
136 static VOID
ClassExpunge(UNUSED
struct Library
*base
)
138 ShutdownClipboardServer();
144 DROPINTERFACE(IDiskfont
);
145 CloseLibrary(DiskfontBase
);
151 DROPINTERFACE(IKeymap
);
152 CloseLibrary(KeymapBase
);
158 DROPINTERFACE(ILayers
);
159 CloseLibrary(LayersBase
);
165 DROPINTERFACE(ILocale
);
166 CloseLibrary(LocaleBase
);