arch/cpu.resource: remove dead code
[AROS.git] / workbench / classes / zune / betterstring / mcp / Preference.c
blobbf2f4d8d26612c02f98b46c891152da10cdee01b
1 /***************************************************************************
3 BetterString.mcc - A better String gadget MUI Custom Class
4 Copyright (C) 1997-2000 Allan Odgaard
5 Copyright (C) 2005-2013 by BetterString.mcc 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 BetterString class Support Site: http://www.sf.net/projects/bstring-mcc/
19 $Id$
21 ***************************************************************************/
23 #include <stdio.h>
25 #include <clib/alib_protos.h>
26 #include <exec/tasks.h>
27 #include <exec/memory.h>
28 #include <libraries/mui.h>
29 #include <libraries/iffparse.h>
30 #include <proto/dos.h>
31 #include <proto/exec.h>
32 #include <proto/muimaster.h>
33 #include <proto/intuition.h>
34 #include <proto/iffparse.h>
35 #include <proto/utility.h>
37 #include "BetterString_mcp.h"
38 #include "locale.h"
39 #include "private.h"
41 #include "SDI_hook.h"
43 #if defined(__amigaos4__)
44 struct Library *IntuitionBase = NULL;
45 struct Library *MUIMasterBase = NULL;
46 struct Library *LocaleBase = NULL;
47 struct Library *UtilityBase = NULL;
48 #elif defined(__MORPHOS__)
49 struct IntuitionBase *IntuitionBase = NULL;
50 struct Library *MUIMasterBase = NULL;
51 struct Library *LocaleBase = NULL;
52 struct Library *UtilityBase = NULL;
53 #else
54 struct IntuitionBase *IntuitionBase = NULL;
55 struct Library *MUIMasterBase = NULL;
56 struct LocaleBase *LocaleBase = NULL;
57 #if defined(__AROS__)
58 struct UtilityBase *UtilityBase = NULL;
59 #else
60 struct Library *UtilityBase = NULL;
61 #endif
62 #endif
64 #if defined(__amigaos4__)
65 struct IntuitionIFace *IIntuition = NULL;
66 struct MUIMasterIFace *IMUIMaster = NULL;
67 struct LocaleIFace *ILocale = NULL;
68 struct UtilityIFace *IUtility = NULL;
69 #endif
71 extern DISPATCHERPROTO(_DispatcherP);
73 int main(void)
75 if((UtilityBase = (APTR)OpenLibrary("utility.library", 38)) &&
76 GETINTERFACE(IUtility, UtilityBase))
77 if((IntuitionBase = (APTR)OpenLibrary("intuition.library", 38)) &&
78 GETINTERFACE(IIntuition, IntuitionBase))
79 if((LocaleBase = (APTR)OpenLibrary("locale.library", 38)) &&
80 GETINTERFACE(ILocale, LocaleBase))
81 if((MUIMasterBase = OpenLibrary("muimaster.library", MUIMASTER_VMIN)) &&
82 GETINTERFACE(IMUIMaster, MUIMasterBase))
84 Object *app = NULL, *window;
85 struct MUI_CustomClass *mcc;
87 OpenCat();
89 if((mcc = MUI_CreateCustomClass(NULL, "Group.mui", NULL, sizeof(struct InstData_MCP), ENTRY(_DispatcherP))))
91 app = MUI_NewObject("Application.mui",
92 MUIA_Application_Author, "Allan Odgaard",
93 MUIA_Application_Base, "BetterString-Prefs",
94 MUIA_Application_Copyright, "®1997 Allan Odgaard",
95 MUIA_Application_Description, "Preference for BetterString.mcc",
96 MUIA_Application_Title, "BetterString-Prefs",
97 MUIA_Application_Version, "$VER: BetterString-Prefs V1.0 (18-Feb-97)",
99 MUIA_Application_Window,
100 window = MUI_NewObject("Window.mui",
101 MUIA_Window_Title, "BetterString-Prefs",
102 MUIA_Window_ID, MAKE_ID('M','A','I','N'),
103 MUIA_Window_RootObject,
104 MUI_NewObject("Group.mui",
105 MUIA_Background, MUII_PageBack,
106 MUIA_Frame, MUIV_Frame_Text,
107 MUIA_InnerBottom, 11,
108 MUIA_InnerLeft, 6,
109 MUIA_InnerRight, 6,
110 MUIA_InnerTop, 11,
112 MUIA_Group_Child,
113 NewObject(mcc->mcc_Class, NULL, TAG_DONE),
115 TAG_DONE ),
116 TAG_DONE ),
117 TAG_DONE );
119 if(app)
121 unsigned long sigs;
123 DoMethod(window, MUIM_Notify,
124 MUIA_Window_CloseRequest, TRUE,
125 app, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);
127 set(window, MUIA_Window_Open, TRUE);
128 while((LONG)DoMethod(app, MUIM_Application_NewInput, &sigs) != (LONG)MUIV_Application_ReturnID_Quit)
129 if(sigs)
131 sigs = Wait(sigs | SIGBREAKF_CTRL_C);
132 if(sigs & SIGBREAKF_CTRL_C)
133 break;
136 MUI_DisposeObject(app);
138 MUI_DeleteCustomClass(mcc);
141 CloseCat();
143 DROPINTERFACE(IMUIMaster);
144 CloseLibrary(MUIMasterBase);
148 if(LocaleBase)
150 DROPINTERFACE(ILocale);
151 CloseLibrary((struct Library *)LocaleBase);
154 if(IntuitionBase)
156 DROPINTERFACE(IIntuition);
157 CloseLibrary((struct Library *)IntuitionBase);
160 if(UtilityBase)
162 DROPINTERFACE(IUtility);
163 CloseLibrary((struct Library *)UtilityBase);
166 return 0;