revert between 56095 -> 55830 in arch
[AROS.git] / workbench / classes / zune / nlist / nlisttree_mcp / NListtree-Prefs.c
blob19f69614e1c2944a423a5ed34a17a6996baa9ca5
1 /***************************************************************************
3 NListtree.mcc - New Listtree MUI Custom Class
4 Copyright (C) 1999-2001 by Carsten Scholling
5 Copyright (C) 2001-2014 NList 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 NList classes Support Site: http://www.sf.net/projects/nlist-classes
19 $Id$
21 ***************************************************************************/
23 #include <stdio.h>
25 #include <exec/tasks.h>
26 #include <exec/memory.h>
27 #include <libraries/mui.h>
28 #include <proto/dos.h>
29 #include <proto/exec.h>
30 #include <proto/locale.h>
31 #include <proto/muimaster.h>
32 #include <proto/intuition.h>
34 #include "locale.h"
35 #include "private.h"
37 #include "SDI_hook.h"
39 #if defined(__amigaos4__)
40 struct Library *IntuitionBase = NULL;
41 struct Library *MUIMasterBase = NULL;
42 struct Library *LocaleBase = NULL;
43 struct Library *UtilityBase = NULL;
44 #elif defined(__MORPHOS__)
45 struct IntuitionBase *IntuitionBase = NULL;
46 struct Library *MUIMasterBase = NULL;
47 struct Library *LocaleBase = NULL;
48 struct Library *UtilityBase = NULL;
49 #else
50 struct IntuitionBase *IntuitionBase = NULL;
51 struct Library *MUIMasterBase = NULL;
52 struct LocaleBase *LocaleBase = NULL;
53 struct Library *UtilityBase = NULL;
54 #endif
56 struct Library *CxBase = NULL;
57 struct Device *ConsoleDevice = NULL;
59 #if defined(__amigaos4__)
60 struct CommoditiesIFace *ICommodities = NULL;
61 struct ConsoleIFace *IConsole = NULL;
62 struct IntuitionIFace *IIntuition = NULL;
63 struct MUIMasterIFace *IMUIMaster = NULL;
64 struct LocaleIFace *ILocale = NULL;
65 struct UtilityIFace *IUtility = NULL;
66 #endif
68 struct IOStdReq ioreq;
70 extern DISPATCHERPROTO(_DispatcherP);
72 int main(void)
74 ioreq.io_Message.mn_Length = sizeof(ioreq);
75 if((UtilityBase = OpenLibrary("utility.library", 38)) &&
76 GETINTERFACE(IUtility, UtilityBase))
77 if((IntuitionBase = (APTR)OpenLibrary("intuition.library", 38)) &&
78 GETINTERFACE(IIntuition, IntuitionBase))
79 if((CxBase = OpenLibrary("commodities.library", 37L)) &&
80 GETINTERFACE(ICommodities, CxBase))
81 if(!OpenDevice("console.device", -1L, (struct IORequest *)&ioreq, 0L))
83 ConsoleDevice = (struct Device *)ioreq.io_Device;
84 if(ConsoleDevice != NULL &&
85 GETINTERFACE(IConsole, ConsoleDevice))
86 if((LocaleBase = (APTR)OpenLibrary("locale.library", 38)) &&
87 GETINTERFACE(ILocale, LocaleBase))
89 OpenCat();
91 #if defined(DEBUG)
92 SetupDebug();
93 #endif
95 if((MUIMasterBase = OpenLibrary(MUIMASTER_NAME, MUIMASTER_VMIN)) &&
96 GETINTERFACE(IMUIMaster, MUIMasterBase))
98 Object *app = NULL;
99 Object *window = NULL;
100 struct MUI_CustomClass *mcc = NULL;
102 mcc = MUI_CreateCustomClass(NULL, (STRPTR)"Group.mui", NULL, sizeof(struct NListtreeP_Data), ENTRY(_DispatcherP));
103 if(mcc)
105 app = MUI_NewObject("Application.mui",
106 MUIA_Application_Author, "NList Open Source Team",
107 MUIA_Application_Base, "NListtree-Prefs",
108 MUIA_Application_Copyright, "(c) 2001-2011 NList Open Source Team",
109 MUIA_Application_Description, "Preference for NListtree classes",
110 MUIA_Application_Title, "NListtree-Prefs",
111 MUIA_Application_Version, "$VER: NListtree-Prefs V1.0 (05.07.2011)",
113 MUIA_Application_Window,
114 window = MUI_NewObject("Window.mui",
115 MUIA_Window_Title, "NListtree-Prefs",
116 MUIA_Window_RootObject,
117 MUI_NewObject("Group.mui",
118 MUIA_Background, MUII_PageBack,
119 MUIA_Frame, MUIV_Frame_Text,
120 MUIA_InnerBottom, 11,
121 MUIA_InnerLeft, 6,
122 MUIA_InnerRight, 6,
123 MUIA_InnerTop, 11,
125 // Child, RectangleObject, End,
126 Child, NewObject(mcc->mcc_Class, NULL, TAG_DONE),
128 TAG_DONE ),
129 TAG_DONE ),
130 TAG_DONE );
133 if(app)
135 unsigned long sigs;
137 DoMethod(window, MUIM_Notify, MUIA_Window_CloseRequest, TRUE, app, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);
138 set(window, MUIA_Window_Open, TRUE);
140 while((LONG)DoMethod(app, MUIM_Application_NewInput, &sigs) != (LONG)MUIV_Application_ReturnID_Quit)
142 if(sigs)
144 sigs = Wait(sigs | SIGBREAKF_CTRL_C);
145 if(sigs & SIGBREAKF_CTRL_C)
146 break;
150 MUI_DisposeObject(app);
152 if(mcc)
153 MUI_DeleteCustomClass(mcc);
156 DROPINTERFACE(IMUIMaster);
157 CloseLibrary(MUIMasterBase);
160 CloseCat();
162 DROPINTERFACE(ILocale);
163 CloseLibrary((struct Library *)LocaleBase);
166 if(ConsoleDevice)
168 DROPINTERFACE(IConsole);
169 CloseDevice((struct IORequest *)&ioreq);
170 ConsoleDevice = NULL;
174 if(CxBase)
176 DROPINTERFACE(ICommodities);
177 CloseLibrary(CxBase);
178 CxBase = NULL;
181 if(IntuitionBase)
183 DROPINTERFACE(IIntuition);
184 CloseLibrary((struct Library *)IntuitionBase);
187 if(UtilityBase)
189 DROPINTERFACE(IUtility);
190 CloseLibrary(UtilityBase);
193 return 0;