1 /***************************************************************************
3 NList.mcc - New List MUI Custom Class
4 Registered MUI class, Serial Number: 1d51 0x9d510030 to 0x9d5100A0
5 0x9d5100C0 to 0x9d5100FF
7 Copyright (C) 1996-2001 by Gilles Masson
8 Copyright (C) 2001-2014 NList Open Source Team
10 This library is free software; you can redistribute it and/or
11 modify it under the terms of the GNU Lesser General Public
12 License as published by the Free Software Foundation; either
13 version 2.1 of the License, or (at your option) any later version.
15 This library is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
20 NList classes Support Site: http://www.sf.net/projects/nlist-classes
24 ***************************************************************************/
26 /******************************************************************************/
30 /******************************************************************************/
32 #include <proto/exec.h>
33 #include <proto/intuition.h>
35 /******************************************************************************/
37 /* MCC/MCP name and version */
39 /* ATTENTION: The FIRST LETTER of NAME MUST be UPPERCASE */
41 /******************************************************************************/
45 #include "NList_grp.h"
47 /******************************************************************************/
48 /* include the minimal startup code to be able to start the class from a */
49 /* shell without crashing the system */
50 /******************************************************************************/
51 #include "shellstart.c"
53 #define VERSION LIB_VERSION
54 #define REVISION LIB_REVISION
56 #define CLASS MUIC_NList
57 #define SUPERCLASS MUIC_Group
59 #define INSTDATA NLData
61 #define USERLIBID CLASS " " LIB_REV_STRING " [" SYSTEMSHORT "/" CPU "] (" LIB_DATE ") " LIB_COPYRIGHT
62 #define MASTERVERSION 19
67 #define USEDCLASSESP used_mcps
68 static const char *used_mcps
[] = { "NListviews.mcp", NULL
};
70 #define MIN_STACKSIZE 16384
72 #if defined(__MORPHOS__)
73 struct Library
*LayersBase
= NULL
;
74 struct Library
*DiskfontBase
= NULL
;
75 struct Library
*ConsoleDevice
= NULL
;
77 struct Library
*LayersBase
= NULL
;
78 struct Library
*DiskfontBase
= NULL
;
79 struct Device
*ConsoleDevice
= NULL
;
82 #if defined(__amigaos4__)
83 struct LayersIFace
*ILayers
= NULL
;
84 struct DiskfontIFace
*IDiskfont
= NULL
;
85 struct ConsoleIFace
*IConsole
= NULL
;
88 static struct IOStdReq ioreq
;
92 static struct TimeRequest timereq
;
93 #if defined(__MORPHOS__)
94 struct Library
*TimerBase
= NULL
;
96 struct Device
*TimerBase
= NULL
;
98 #if defined(__amigaos4__)
99 struct TimerIFace
*ITimer
= NULL
;
103 /******************************************************************************/
104 /* define the functions used by the startup code ahead of including mccinit.c */
105 /******************************************************************************/
106 static BOOL
ClassInit(UNUSED
struct Library
*base
);
107 static VOID
ClassExpunge(UNUSED
struct Library
*base
);
109 /******************************************************************************/
110 /* include the lib startup code for the mcc/mcp (and muimaster inlines) */
111 /******************************************************************************/
114 /******************************************************************************/
115 /* define all implementations of our user functions */
116 /******************************************************************************/
117 static BOOL
ClassInit(UNUSED
struct Library
*base
)
119 if((LayersBase
= OpenLibrary("layers.library", 39L)) &&
120 GETINTERFACE(ILayers
, struct LayersIFace
*, LayersBase
))
122 if((DiskfontBase
= OpenLibrary("diskfont.library", 39L)) &&
123 GETINTERFACE(IDiskfont
, struct DiskfontIFace
*, DiskfontBase
))
125 memset(&ioreq
, 0, sizeof(ioreq
));
126 ioreq
.io_Message
.mn_Length
= sizeof(ioreq
);
127 if(OpenDevice("console.device", -1L, (struct IORequest
*)&ioreq
, 0L) == 0)
129 ConsoleDevice
= (APTR
)ioreq
.io_Device
;
130 if(GETINTERFACE(IConsole
, struct ConsoleIFace
*, ConsoleDevice
))
133 memset(&timereq
, 0, sizeof(timereq
));
134 timereq
.Request
.io_Message
.mn_Length
= sizeof(timereq
);
135 if(OpenDevice("timer.device", 0, (struct IORequest
*)&timereq
, 0L) == 0)
137 TimerBase
= timereq
.Request
.io_Device
;
138 if(GETINTERFACE(ITimer
, struct TimerIFace
*, TimerBase
))
143 if(StartClipboardServer() == TRUE
)
150 DROPINTERFACE(ITimer
);
155 DROPINTERFACE(IConsole
);
158 CloseDevice((struct IORequest
*)&ioreq
);
159 ConsoleDevice
= NULL
;
162 DROPINTERFACE(IDiskfont
);
163 CloseLibrary(DiskfontBase
);
167 DROPINTERFACE(ILayers
);
168 CloseLibrary(LayersBase
);
176 static VOID
ClassExpunge(UNUSED
struct Library
*base
)
178 ShutdownClipboardServer();
185 DROPINTERFACE(ITimer
);
186 CloseDevice((struct IORequest
*)&timereq
);
193 DROPINTERFACE(IConsole
);
194 CloseDevice((struct IORequest
*)&ioreq
);
195 ConsoleDevice
= NULL
;
200 DROPINTERFACE(IDiskfont
);
201 CloseLibrary(DiskfontBase
);
207 DROPINTERFACE(ILayers
);
208 CloseLibrary(LayersBase
);