revert 213 commits (to 56092) from the last month. 10 still need work to resolve...
[AROS.git] / workbench / classes / zune / nlist / nbalance_mcc / NBalance-Test.c
blob78b28253a4fd3fb98639df21e1bb56989b912e31
1 /***************************************************************************
3 NBalance.mcc - New Balance MUI Custom Class
4 Copyright (C) 2008-2013 by NList Open Source Team
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 TextEditor class Support Site: http://www.sf.net/projects/texteditor-mcc
18 $Id$
20 ***************************************************************************/
22 #include <libraries/iffparse.h>
24 #include <proto/exec.h>
25 #include <proto/dos.h>
26 #include <proto/intuition.h>
27 #include <proto/muimaster.h>
28 #include <proto/utility.h>
29 #include <proto/graphics.h>
30 #include <proto/layers.h>
31 #include <proto/datatypes.h>
33 #include <mui/NBalance_mcc.h>
35 #include "private.h"
37 #if defined(__amigaos4__)
38 struct Library *IntuitionBase = NULL;
39 struct Library *UtilityBase = NULL;
40 struct Library *GfxBase = NULL;
41 struct Library *DataTypesBase = NULL;
42 struct Library *MUIMasterBase = NULL;
43 struct Library *LayersBase = NULL;
44 #else
45 struct IntuitionBase *IntuitionBase = NULL;
46 #if defined(__AROS__)
47 struct UtilityBase *UtilityBase = NULL;
48 #else
49 struct Library *UtilityBase = NULL;
50 #endif
51 struct GfxBase *GfxBase = NULL;
52 struct Library *DataTypesBase = NULL;
53 struct Library *MUIMasterBase = NULL;
54 struct Library *LayersBase = NULL;
55 #endif
57 #if defined(__amigaos4__)
58 struct IntuitionIFace *IIntuition = NULL;
59 struct UtilityIFace *IUtility = NULL;
60 struct GraphicsIFace *IGraphics = NULL;
61 struct DataTypesIFace *IDataTypes = NULL;
62 struct MUIMasterIFace *IMUIMaster = NULL;
63 struct LayersIFace *ILayers = NULL;
64 #endif
66 DISPATCHERPROTO(_Dispatcher);
68 int main(void)
70 if((IntuitionBase = (APTR)OpenLibrary("intuition.library", 36)) &&
71 GETINTERFACE(IIntuition, IntuitionBase))
73 #if defined(DEBUG)
74 SetupDebug();
75 #endif
77 if((UtilityBase = (APTR)OpenLibrary("utility.library", 36)) &&
78 GETINTERFACE(IUtility, UtilityBase))
80 if((GfxBase = (APTR)OpenLibrary("graphics.library", 36)) &&
81 GETINTERFACE(IGraphics, GfxBase))
83 if((LayersBase = OpenLibrary("layers.library", 37)) &&
84 GETINTERFACE(ILayers, LayersBase))
86 if((DataTypesBase = OpenLibrary("datatypes.library", 36)) &&
87 GETINTERFACE(IDataTypes, DataTypesBase))
89 if((MUIMasterBase = OpenLibrary("muimaster.library", 19)) &&
90 GETINTERFACE(IMUIMaster, MUIMasterBase))
92 struct MUI_CustomClass *mcc;
94 mcc = MUI_CreateCustomClass(NULL, MUIC_Balance, NULL, sizeof(struct InstData), ENTRY(_Dispatcher));
96 if(mcc != NULL)
98 Object *app, *window;
99 const char * const classes[] = { "NBalance.mcp", NULL };
101 app = MUI_NewObject("Application.mui",
102 MUIA_Application_Author, "NBalance.mcc Open Source Team",
103 MUIA_Application_Base, "NBalance-Test",
104 MUIA_Application_Copyright, "(c) 2008 NBalance.mcc Open Source Team",
105 MUIA_Application_Description, "NBalance.mcc test program",
106 MUIA_Application_Title, "NBalance-Test",
107 MUIA_Application_Version, "$VER: NBalance-Test (" __DATE__ ")",
108 MUIA_Application_UsedClasses, classes,
110 MUIA_Application_Window,
111 window = WindowObject,
112 MUIA_Window_Title, "NBalance-Test",
113 MUIA_Window_ID, MAKE_ID('M','A','I','N'),
114 MUIA_Window_RootObject, VGroup,
115 Child, HGroup,
116 Child, FloattextObject,
117 MUIA_Floattext_Text, "Left Top",
118 End,
119 Child, NewObject(mcc->mcc_Class, NULL,
120 //Child, BalanceObject,
121 MUIA_ObjectID, 1,
122 End,
123 Child, FloattextObject,
124 MUIA_Floattext_Text, "Right Top",
125 End,
126 End,
127 Child, NewObject(mcc->mcc_Class, NULL,
128 //Child, BalanceObject,
129 MUIA_ObjectID, 2,
130 //MUIA_NBalance_Pointer, MUIV_NBalance_Pointer_Off,
131 End,
132 Child, HGroup,
133 Child, FloattextObject,
134 MUIA_Floattext_Text, "Left Bottom",
135 End,
136 Child, NewObject(mcc->mcc_Class, NULL,
137 //Child, BalanceObject,
138 MUIA_ObjectID, 3,
139 End,
140 Child, FloattextObject,
141 MUIA_Floattext_Text, "Right Bottom",
142 End,
143 End,
144 End,
145 End,
146 End;
148 if(app != NULL)
150 ULONG sigs = 0;
152 DoMethod(window, MUIM_Notify, MUIA_Window_CloseRequest, TRUE, app, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);
154 //set(window, MUIA_Window_ActiveObject, editorgad);
155 set(window, MUIA_Window_Open, TRUE);
157 while((LONG)DoMethod(app, MUIM_Application_NewInput, &sigs) != (LONG)MUIV_Application_ReturnID_Quit)
159 if(sigs)
161 sigs = Wait(sigs | SIGBREAKF_CTRL_C);
163 if(sigs & SIGBREAKF_CTRL_C)
164 break;
168 MUI_DisposeObject(app);
170 else
171 PutStr("Failed to create application\n");
173 MUI_DeleteCustomClass(mcc);
176 DROPINTERFACE(IDataTypes);
177 CloseLibrary(DataTypesBase);
178 DataTypesBase = NULL;
181 DROPINTERFACE(ILayers);
182 CloseLibrary(LayersBase);
183 LayersBase = NULL;
186 DROPINTERFACE(IGraphics);
187 CloseLibrary((struct Library *)GfxBase);
188 GfxBase = NULL;
192 DROPINTERFACE(IMUIMaster);
193 CloseLibrary(MUIMasterBase);
194 MUIMasterBase = NULL;
197 DROPINTERFACE(IUtility);
198 CloseLibrary((struct Library *)UtilityBase);
199 UtilityBase = NULL;
203 if(IntuitionBase)
205 DROPINTERFACE(IIntuition);
206 CloseLibrary((struct Library *)IntuitionBase);
209 return 0;