1 /***************************************************************************
3 TextEditor.mcc - Textediting MUI Custom Class
4 Copyright (C) 1997-2000 Allan Odgaard
5 Copyright (C) 2005-2014 TextEditor.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 TextEditor class Support Site: http://www.sf.net/projects/texteditor-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 /******************************************************************************/
36 #define DEBUG_USE_MALLOC_REDEFINE 1
40 /******************************************************************************/
41 /* include the minimal startup code to be able to start the class from a */
42 /* shell without crashing the system */
43 /******************************************************************************/
44 #include "shellstart.c"
46 #define VERSION LIB_VERSION
47 #define REVISION LIB_REVISION
49 #define CLASS MUIC_TextEditor
50 #define SUPERCLASS MUIC_Area
52 #define INSTDATA InstData
54 #define USERLIBID CLASS " " LIB_REV_STRING " [" SYSTEMSHORT "/" CPU "] (" LIB_DATE ") " LIB_COPYRIGHT
55 #define MASTERVERSION 19
60 #define USEDCLASSESP used_mcps
61 static const char *used_mcps
[] = { "TextEditor.mcp", NULL
};
63 #define MIN_STACKSIZE 8192
65 struct Library
*DiskfontBase
= NULL
;
66 struct Library
*KeymapBase
= NULL
;
67 struct Library
*LayersBase
= NULL
;
68 struct Library
*LocaleBase
= NULL
;
69 struct Library
*RexxSysBase
= NULL
;
70 struct Library
*WorkbenchBase
= NULL
;
72 #if defined(__amigaos4__)
73 struct DiskfontIFace
*IDiskfont
= NULL
;
74 struct KeymapIFace
*IKeymap
= NULL
;
75 struct LayersIFace
*ILayers
= NULL
;
76 struct LocaleIFace
*ILocale
= NULL
;
77 struct RexxSysIFace
*IRexxSys
= NULL
;
78 struct Interface
*IWorkbench
= NULL
;
81 /******************************************************************************/
82 /* define the functions used by the startup code ahead of including mccinit.c */
83 /******************************************************************************/
84 static BOOL
ClassInit(UNUSED
struct Library
*base
);
85 static VOID
ClassExpunge(UNUSED
struct Library
*base
);
87 /******************************************************************************/
88 /* include the lib startup code for the mcc/mcp (and muimaster inlines) */
89 /******************************************************************************/
92 /******************************************************************************/
93 /* define all implementations of our user functions */
94 /******************************************************************************/
95 static BOOL
ClassInit(UNUSED
struct Library
*base
)
99 if((LocaleBase
= OpenLibrary("locale.library", 38)) &&
100 GETINTERFACE(ILocale
, struct LocaleIFace
*, LocaleBase
))
102 if((LayersBase
= OpenLibrary("layers.library", 36)) &&
103 GETINTERFACE(ILayers
, struct LayersIFace
*, LayersBase
))
105 if((KeymapBase
= OpenLibrary("keymap.library", 36)) &&
106 GETINTERFACE(IKeymap
, struct KeymapIFace
*, KeymapBase
))
108 if((RexxSysBase
= OpenLibrary("rexxsyslib.library", 36)) &&
109 GETINTERFACE(IRexxSys
, struct RexxSysIFace
*, RexxSysBase
))
111 if((DiskfontBase
= OpenLibrary("diskfont.library", 36)) &&
112 GETINTERFACE(IDiskfont
, struct DiskfontIFace
*, DiskfontBase
))
114 if(StartClipboardServer() == TRUE
)
116 /* workbench.library is optional */
117 if ((WorkbenchBase
= OpenLibrary("workbench.library", 44)))
119 if (!(GETINTERFACE(IWorkbench
, struct Interface
*, WorkbenchBase
)))
121 CloseLibrary(WorkbenchBase
);
122 WorkbenchBase
= NULL
;
130 DROPINTERFACE(IDiskfont
);
131 CloseLibrary(DiskfontBase
);
135 DROPINTERFACE(IRexxSys
);
136 CloseLibrary(RexxSysBase
);
140 DROPINTERFACE(IKeymap
);
141 CloseLibrary(KeymapBase
);
145 DROPINTERFACE(ILayers
);
146 CloseLibrary(LayersBase
);
150 DROPINTERFACE(ILocale
);
151 CloseLibrary(LocaleBase
);
160 static VOID
ClassExpunge(UNUSED
struct Library
*base
)
164 ShutdownClipboardServer();
168 DROPINTERFACE(IWorkbench
);
169 CloseLibrary(WorkbenchBase
);
170 WorkbenchBase
= NULL
;
175 DROPINTERFACE(IDiskfont
);
176 CloseLibrary(DiskfontBase
);
182 DROPINTERFACE(IRexxSys
);
183 CloseLibrary(RexxSysBase
);
189 DROPINTERFACE(IKeymap
);
190 CloseLibrary(KeymapBase
);
196 DROPINTERFACE(ILayers
);
197 CloseLibrary(LayersBase
);
203 DROPINTERFACE(ILocale
);
204 CloseLibrary(LocaleBase
);