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/
21 ***************************************************************************/
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"
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
;
54 struct IntuitionBase
*IntuitionBase
= NULL
;
55 struct Library
*MUIMasterBase
= NULL
;
56 struct LocaleBase
*LocaleBase
= NULL
;
58 struct UtilityBase
*UtilityBase
= NULL
;
60 struct Library
*UtilityBase
= NULL
;
64 #if defined(__amigaos4__)
65 struct IntuitionIFace
*IIntuition
= NULL
;
66 struct MUIMasterIFace
*IMUIMaster
= NULL
;
67 struct LocaleIFace
*ILocale
= NULL
;
68 struct UtilityIFace
*IUtility
= NULL
;
71 extern DISPATCHERPROTO(_DispatcherP
);
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
;
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,
113 NewObject(mcc
->mcc_Class
, NULL
, TAG_DONE
),
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
)
131 sigs
= Wait(sigs
| SIGBREAKF_CTRL_C
);
132 if(sigs
& SIGBREAKF_CTRL_C
)
136 MUI_DisposeObject(app
);
138 MUI_DeleteCustomClass(mcc
);
143 DROPINTERFACE(IMUIMaster
);
144 CloseLibrary(MUIMasterBase
);
150 DROPINTERFACE(ILocale
);
151 CloseLibrary((struct Library
*)LocaleBase
);
156 DROPINTERFACE(IIntuition
);
157 CloseLibrary((struct Library
*)IntuitionBase
);
162 DROPINTERFACE(IUtility
);
163 CloseLibrary((struct Library
*)UtilityBase
);