added concrete implementations of putc(), getc(), getchar() and gets()
[tangerine.git] / workbench / classes / gadgets / texteditor / mcp / Preference.c
blob4f957d9811e3d65530091bdb4fa5447bcae5032f
1 /***************************************************************************
3 TextEditor.mcc - Textediting MUI Custom Class
4 Copyright (C) 1997-2000 Allan Odgaard
5 Copyright (C) 2005 by 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 = OpenLibrary("intuition.library", 38)) &&
71 GETINTERFACE(IIntuition, IntuitionBase))
73 if((LocaleBase = OpenLibrary("locale.library", 38)) &&
74 GETINTERFACE(ILocale, LocaleBase))
76 OpenCat();
78 if((MUIMasterBase = OpenLibrary("muimaster.library", MUIMASTER_VMIN)) &&
79 GETINTERFACE(IMUIMaster, MUIMasterBase))
81 Object *app = NULL;
82 Object *window;
83 struct MUI_CustomClass *mcc = NULL;
85 if(CreateSubClasses())
86 mcc = MUI_CreateCustomClass(NULL, "Group.mui", NULL, sizeof(struct InstData_MCP), ENTRY(_DispatcherP));
88 if(mcc)
90 app = MUI_NewObject("Application.mui",
91 MUIA_Application_Author, "Allan Odgaard",
92 MUIA_Application_Base, "TextEditor-Prefs",
93 MUIA_Application_Copyright, "®1997 Allan Odgaard",
94 MUIA_Application_Description, "Preference for TextEditor.mcc",
95 MUIA_Application_Title, "TextEditor-Prefs",
96 MUIA_Application_Version, "$VER: TextEditor-Prefs V1.0 (18-Feb-97)",
98 MUIA_Application_Window,
99 window = MUI_NewObject("Window.mui",
100 MUIA_Window_Title, "TextEditor-Prefs",
101 MUIA_Window_RootObject,
102 MUI_NewObject("Group.mui",
103 MUIA_Background, MUII_PageBack,
104 MUIA_Frame, MUIV_Frame_Text,
105 MUIA_InnerBottom, 11,
106 MUIA_InnerLeft, 6,
107 MUIA_InnerRight, 6,
108 MUIA_InnerTop, 11,
110 // Child, RectangleObject, End,
111 Child, NewObject(mcc->mcc_Class, NULL, TAG_DONE),
113 TAG_DONE ),
114 TAG_DONE ),
115 TAG_DONE );
118 if(app)
120 unsigned long sigs;
122 DoMethod(window, MUIM_Notify, MUIA_Window_CloseRequest, TRUE, app, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);
123 set(window, MUIA_Window_Open, TRUE);
124 while((LONG)DoMethod(app, MUIM_Application_NewInput, &sigs) != MUIV_Application_ReturnID_Quit)
126 if(sigs)
128 sigs = Wait(sigs | SIGBREAKF_CTRL_C);
129 if(sigs & SIGBREAKF_CTRL_C)
130 break;
134 MUI_DisposeObject(app);
136 if(mcc)
137 MUI_DeleteCustomClass(mcc);
139 DeleteSubClasses();
142 DROPINTERFACE(IMUIMaster);
143 CloseLibrary(MUIMasterBase);
146 CloseCat();
148 DROPINTERFACE(ILocale);
149 CloseLibrary(LocaleBase);
152 DROPINTERFACE(IIntuition);
153 CloseLibrary(IntuitionBase);
156 DROPINTERFACE(IUtility);
157 CloseLibrary(UtilityBase);
160 return 0;