1 /***************************************************************************
3 TextEditor.mcc - Textediting MUI Custom Class
4 Copyright (C) 1997-2000 Allan Odgaard
5 Copyright (C) 2005-2014 TextEditor.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 TextEditor class Support Site: http://www.sf.net/projects/texteditor-mcc
21 ***************************************************************************/
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>
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
;
50 struct IntuitionBase
*IntuitionBase
= NULL
;
51 struct Library
*MUIMasterBase
= NULL
;
52 struct LocaleBase
*LocaleBase
= NULL
;
53 struct Library
*UtilityBase
= NULL
;
56 #if defined(__amigaos4__)
57 struct IntuitionIFace
*IIntuition
= NULL
;
58 struct MUIMasterIFace
*IMUIMaster
= NULL
;
59 struct LocaleIFace
*ILocale
= NULL
;
60 struct UtilityIFace
*IUtility
= NULL
;
63 extern DISPATCHERPROTO(_DispatcherP
);
67 if((UtilityBase
= OpenLibrary("utility.library", 38)) &&
68 GETINTERFACE(IUtility
, UtilityBase
))
70 if((IntuitionBase
= (APTR
)OpenLibrary("intuition.library", 38)) &&
71 GETINTERFACE(IIntuition
, IntuitionBase
))
73 if((LocaleBase
= (APTR
)OpenLibrary("locale.library", 38)) &&
74 GETINTERFACE(ILocale
, LocaleBase
))
82 if((MUIMasterBase
= OpenLibrary(MUIMASTER_NAME
, MUIMASTER_VMIN
)) &&
83 GETINTERFACE(IMUIMaster
, MUIMasterBase
))
86 Object
*window
= NULL
;
87 struct MUI_CustomClass
*mcc
= NULL
;
89 if(CreateSubClasses())
90 mcc
= MUI_CreateCustomClass(NULL
, "Group.mui", NULL
, sizeof(struct InstData_MCP
), ENTRY(_DispatcherP
));
94 app
= MUI_NewObject("Application.mui",
95 MUIA_Application_Author
, "Allan Odgaard",
96 MUIA_Application_Base
, "TextEditor-Prefs",
97 MUIA_Application_Copyright
, "(C)1997 Allan Odgaard",
98 MUIA_Application_Description
, "Preference for TextEditor.mcc",
99 MUIA_Application_Title
, "TextEditor-Prefs",
100 MUIA_Application_Version
, "$VER: TextEditor-Prefs V1.0 (18-Feb-97)",
102 MUIA_Application_Window
,
103 window
= MUI_NewObject("Window.mui",
104 MUIA_Window_Title
, "TextEditor-Prefs",
105 MUIA_Window_RootObject
,
106 MUI_NewObject("Group.mui",
107 MUIA_Background
, MUII_PageBack
,
108 MUIA_Frame
, MUIV_Frame_Text
,
109 MUIA_InnerBottom
, 11,
114 // Child, RectangleObject, End,
115 Child
, NewObject(mcc
->mcc_Class
, NULL
, TAG_DONE
),
126 DoMethod(window
, MUIM_Notify
, MUIA_Window_CloseRequest
, TRUE
, 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
)
132 sigs
= Wait(sigs
| SIGBREAKF_CTRL_C
);
133 if(sigs
& SIGBREAKF_CTRL_C
)
138 MUI_DisposeObject(app
);
141 MUI_DeleteCustomClass(mcc
);
146 DROPINTERFACE(IMUIMaster
);
147 CloseLibrary(MUIMasterBase
);
152 DROPINTERFACE(ILocale
);
153 CloseLibrary((struct Library
*)LocaleBase
);
156 DROPINTERFACE(IIntuition
);
157 CloseLibrary((struct Library
*)IntuitionBase
);
160 DROPINTERFACE(IUtility
);
161 CloseLibrary(UtilityBase
);