revert 213 commits (to 56092) from the last month. 10 still need work to resolve...
[AROS.git] / workbench / classes / zune / texteditor / mcp / Preference.c
blob43860a36a096467b6b8fffb5ed0498c48474ba96
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
19 $Id$
21 ***************************************************************************/
23 #include <stdio.h>
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>
34 #include "locale.h"
35 #include "private.h"
37 #include "SDI_hook.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;
49 #else
50 struct IntuitionBase *IntuitionBase = NULL;
51 struct Library *MUIMasterBase = NULL;
52 struct LocaleBase *LocaleBase = NULL;
53 struct Library *UtilityBase = NULL;
54 #endif
56 #if defined(__amigaos4__)
57 struct IntuitionIFace *IIntuition = NULL;
58 struct MUIMasterIFace *IMUIMaster = NULL;
59 struct LocaleIFace *ILocale = NULL;
60 struct UtilityIFace *IUtility = NULL;
61 #endif
63 extern DISPATCHERPROTO(_DispatcherP);
65 int main(void)
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))
76 OpenCat();
78 #if defined(DEBUG)
79 SetupDebug();
80 #endif
82 if((MUIMasterBase = OpenLibrary(MUIMASTER_NAME, MUIMASTER_VMIN)) &&
83 GETINTERFACE(IMUIMaster, MUIMasterBase))
85 Object *app = NULL;
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));
92 if(mcc)
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,
110 MUIA_InnerLeft, 6,
111 MUIA_InnerRight, 6,
112 MUIA_InnerTop, 11,
114 // Child, RectangleObject, End,
115 Child, NewObject(mcc->mcc_Class, NULL, TAG_DONE),
117 TAG_DONE ),
118 TAG_DONE ),
119 TAG_DONE );
122 if(app)
124 unsigned long sigs;
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)
130 if(sigs)
132 sigs = Wait(sigs | SIGBREAKF_CTRL_C);
133 if(sigs & SIGBREAKF_CTRL_C)
134 break;
138 MUI_DisposeObject(app);
140 if(mcc)
141 MUI_DeleteCustomClass(mcc);
143 DeleteSubClasses();
146 DROPINTERFACE(IMUIMaster);
147 CloseLibrary(MUIMasterBase);
150 CloseCat();
152 DROPINTERFACE(ILocale);
153 CloseLibrary((struct Library *)LocaleBase);
156 DROPINTERFACE(IIntuition);
157 CloseLibrary((struct Library *)IntuitionBase);
160 DROPINTERFACE(IUtility);
161 CloseLibrary(UtilityBase);
164 return 0;