Merging NList MCC 0.119 into the main branch.
[AROS.git] / workbench / classes / zune / nlist / nlistviews_mcp / NListviews-Prefs.c
blobdec39d1e82344715599d06f4ae2db2885b4086fe
1 /***************************************************************************
3 NListviews.mcp - New Listview MUI Custom Class Preferences
4 Registered MUI class, Serial Number: 1d51 (0x9d510001 to 0x9d51001F
5 and 0x9d510101 to 0x9d51013F)
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
22 $Id$
24 ***************************************************************************/
26 #include <stdio.h>
28 #include <exec/tasks.h>
29 #include <exec/memory.h>
30 #include <libraries/mui.h>
31 #include <proto/dos.h>
32 #include <proto/exec.h>
33 #include <proto/locale.h>
34 #include <proto/muimaster.h>
35 #include <proto/intuition.h>
37 #include "locale.h"
38 #include "private.h"
40 #include "SDI_hook.h"
42 #if defined(__amigaos4__)
43 struct Library *IntuitionBase = NULL;
44 struct Library *MUIMasterBase = NULL;
45 struct Library *LocaleBase = NULL;
46 struct Library *UtilityBase = NULL;
47 #elif defined(__MORPHOS__)
48 struct IntuitionBase *IntuitionBase = NULL;
49 struct Library *MUIMasterBase = NULL;
50 struct Library *LocaleBase = NULL;
51 struct Library *UtilityBase = NULL;
52 #else
53 struct IntuitionBase *IntuitionBase = NULL;
54 struct Library *MUIMasterBase = NULL;
55 struct LocaleBase *LocaleBase = NULL;
56 struct Library *UtilityBase = NULL;
57 #endif
59 struct Library *CxBase = NULL;
60 struct Device *ConsoleDevice = NULL;
62 #if defined(__amigaos4__)
63 struct CommoditiesIFace *ICommodities = NULL;
64 struct ConsoleIFace *IConsole = NULL;
65 struct IntuitionIFace *IIntuition = NULL;
66 struct MUIMasterIFace *IMUIMaster = NULL;
67 struct LocaleIFace *ILocale = NULL;
68 struct UtilityIFace *IUtility = NULL;
69 #endif
71 struct IOStdReq ioreq;
73 extern DISPATCHERPROTO(_DispatcherP);
75 int main(void)
77 ioreq.io_Message.mn_Length = sizeof(ioreq);
78 if((UtilityBase = OpenLibrary("utility.library", 38)) &&
79 GETINTERFACE(IUtility, UtilityBase))
80 if((IntuitionBase = (APTR)OpenLibrary("intuition.library", 38)) &&
81 GETINTERFACE(IIntuition, IntuitionBase))
82 if((CxBase = OpenLibrary("commodities.library", 37L)) &&
83 GETINTERFACE(ICommodities, CxBase))
84 if(!OpenDevice("console.device", -1L, (struct IORequest *)&ioreq, 0L))
86 ConsoleDevice = (struct Device *)ioreq.io_Device;
87 if(ConsoleDevice != NULL &&
88 GETINTERFACE(IConsole, ConsoleDevice))
89 if((LocaleBase = (APTR)OpenLibrary("locale.library", 38)) &&
90 GETINTERFACE(ILocale, LocaleBase))
92 OpenCat();
94 #if defined(DEBUG)
95 SetupDebug();
96 #endif
98 if((MUIMasterBase = OpenLibrary(MUIMASTER_NAME, MUIMASTER_VMIN)) &&
99 GETINTERFACE(IMUIMaster, MUIMasterBase))
101 Object *app = NULL;
102 Object *window = NULL;
103 struct MUI_CustomClass *mcc = NULL;
105 mcc = MUI_CreateCustomClass(NULL, (STRPTR)"Group.mui", NULL, sizeof(struct NListviews_MCP_Data), ENTRY(_DispatcherP));
106 if(mcc)
108 app = MUI_NewObject("Application.mui",
109 MUIA_Application_Author, "NList Open Source Team",
110 MUIA_Application_Base, "NListviews-Prefs",
111 MUIA_Application_Copyright, "(c) 2001-2007 NList Open Source Team",
112 MUIA_Application_Description, "Preference for NList classes",
113 MUIA_Application_Title, "NListviews-Prefs",
114 MUIA_Application_Version, "$VER: NListviews-Prefs V1.0 (15.09.2007)",
116 MUIA_Application_Window,
117 window = MUI_NewObject("Window.mui",
118 MUIA_Window_Title, "NListviews-Prefs",
119 MUIA_Window_RootObject,
120 MUI_NewObject("Group.mui",
121 MUIA_Background, MUII_PageBack,
122 MUIA_Frame, MUIV_Frame_Text,
123 MUIA_InnerBottom, 11,
124 MUIA_InnerLeft, 6,
125 MUIA_InnerRight, 6,
126 MUIA_InnerTop, 11,
128 // Child, RectangleObject, End,
129 Child, NewObject(mcc->mcc_Class, NULL, TAG_DONE),
131 TAG_DONE ),
132 TAG_DONE ),
133 TAG_DONE );
136 if(app)
138 unsigned long sigs;
140 DoMethod(window, MUIM_Notify, MUIA_Window_CloseRequest, TRUE, app, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);
141 set(window, MUIA_Window_Open, TRUE);
143 while((LONG)DoMethod(app, MUIM_Application_NewInput, &sigs) != (LONG)MUIV_Application_ReturnID_Quit)
145 if(sigs)
147 sigs = Wait(sigs | SIGBREAKF_CTRL_C);
148 if(sigs & SIGBREAKF_CTRL_C)
149 break;
153 MUI_DisposeObject(app);
155 if(mcc)
156 MUI_DeleteCustomClass(mcc);
159 DROPINTERFACE(IMUIMaster);
160 CloseLibrary(MUIMasterBase);
163 CloseCat();
165 DROPINTERFACE(ILocale);
166 CloseLibrary((struct Library *)LocaleBase);
169 if(ConsoleDevice)
171 DROPINTERFACE(IConsole);
172 CloseDevice((struct IORequest *)&ioreq);
173 ConsoleDevice = NULL;
177 if(CxBase)
179 DROPINTERFACE(ICommodities);
180 CloseLibrary(CxBase);
181 CxBase = NULL;
184 if(IntuitionBase)
186 DROPINTERFACE(IIntuition);
187 CloseLibrary((struct Library *)IntuitionBase);
190 if(UtilityBase)
192 DROPINTERFACE(IUtility);
193 CloseLibrary(UtilityBase);
196 return 0;