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
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>
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
;
45 struct IntuitionBase
*IntuitionBase
= NULL
;
47 struct UtilityBase
*UtilityBase
= NULL
;
49 struct Library
*UtilityBase
= NULL
;
51 struct GfxBase
*GfxBase
= NULL
;
52 struct Library
*DataTypesBase
= NULL
;
53 struct Library
*MUIMasterBase
= NULL
;
54 struct Library
*LayersBase
= NULL
;
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
;
66 DISPATCHERPROTO(_Dispatcher
);
70 if((IntuitionBase
= (APTR
)OpenLibrary("intuition.library", 36)) &&
71 GETINTERFACE(IIntuition
, IntuitionBase
))
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
));
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
,
116 Child
, FloattextObject
,
117 MUIA_Floattext_Text
, "Left Top",
119 Child
, NewObject(mcc
->mcc_Class
, NULL
,
120 //Child, BalanceObject,
123 Child
, FloattextObject
,
124 MUIA_Floattext_Text
, "Right Top",
127 Child
, NewObject(mcc
->mcc_Class
, NULL
,
128 //Child, BalanceObject,
130 //MUIA_NBalance_Pointer, MUIV_NBalance_Pointer_Off,
133 Child
, FloattextObject
,
134 MUIA_Floattext_Text
, "Left Bottom",
136 Child
, NewObject(mcc
->mcc_Class
, NULL
,
137 //Child, BalanceObject,
140 Child
, FloattextObject
,
141 MUIA_Floattext_Text
, "Right Bottom",
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
)
161 sigs
= Wait(sigs
| SIGBREAKF_CTRL_C
);
163 if(sigs
& SIGBREAKF_CTRL_C
)
168 MUI_DisposeObject(app
);
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
);
186 DROPINTERFACE(IGraphics
);
187 CloseLibrary((struct Library
*)GfxBase
);
192 DROPINTERFACE(IMUIMaster
);
193 CloseLibrary(MUIMasterBase
);
194 MUIMasterBase
= NULL
;
197 DROPINTERFACE(IUtility
);
198 CloseLibrary((struct Library
*)UtilityBase
);
205 DROPINTERFACE(IIntuition
);
206 CloseLibrary((struct Library
*)IntuitionBase
);