Test initialisation of MUIA_List_AdjustWidth and MUIA_List_AdjustHeight, and
[AROS.git] / arch / .unmaintained / m68k-pp-native / boot / exec.c
blob01ad78b3e853a084abbc7793b764a5c9b7e6d660
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Main code for LCD test
6 */
8 #include <Pilot.h>
9 #include "callback.h"
11 #include "execRsc.h"
13 #define __PILOT_CODE__
14 #include "gfx.h"
16 extern void main_init(void * memory, Long size);
19 static Boolean MainFormHandleEvent (EventPtr e)
21 Boolean handled = false;
22 FormPtr frm;
23 void * mem;
24 Long MEMSIZE = 0x9500;
25 CALLBACK_PROLOGUE
27 switch (e->eType) {
28 case frmOpenEvent:
29 frm = FrmGetActiveForm();
30 FrmDrawForm(frm);
32 mem = MemPtrNew(MEMSIZE);
34 * Memory must be properly aligned!
36 (Long)mem = ((Long)mem + 7) & ~7;
37 if (0 != mem && 0 == ((Long)mem & 7)) {
38 clearscreen(0);
39 main_init(mem,MEMSIZE);
42 handled = true;
43 break;
45 case menuEvent:
46 MenuEraseStatus(NULL);
48 switch(e->data.menu.itemID) {
51 handled = true;
52 break;
54 case ctlSelectEvent:
55 switch(e->data.ctlSelect.controlID) {
57 break;
59 default:
60 break;
63 CALLBACK_EPILOGUE
65 return handled;
68 static Boolean ApplicationHandleEvent(EventPtr e)
70 FormPtr frm;
71 Word formId;
72 Boolean handled = false;
74 if (e->eType == frmLoadEvent) {
75 formId = e->data.frmLoad.formID;
76 frm = FrmInitForm(formId);
77 FrmSetActiveForm(frm);
79 switch(formId) {
80 case MainForm:
81 FrmSetEventHandler(frm, MainFormHandleEvent);
82 break;
84 handled = true;
87 return handled;
90 /* Get preferences, open (or create) app database */
91 static Word StartApplication(void)
93 FrmGotoForm(MainForm);
94 return 0;
97 /* Save preferences, close forms, close app database */
98 static void StopApplication(void)
100 FrmSaveAllForms();
101 FrmCloseAllForms();
104 /* The main event loop */
105 static void EventLoop(void)
107 Word err;
108 EventType e;
110 do {
111 EvtGetEvent(&e, evtWaitForever);
112 if (! SysHandleEvent (&e))
113 if (! MenuHandleEvent (NULL, &e, &err))
114 if (! ApplicationHandleEvent (&e))
115 FrmDispatchEvent (&e);
116 } while (e.eType != appStopEvent);
121 /* Main entry point; it is unlikely you will need to change this except to
122 handle other launch command codes */
123 DWord PilotMain(Word cmd, Ptr cmdPBP, Word launchFlags)
125 Word err;
128 if (cmd == sysAppLaunchCmdNormalLaunch) {
130 err = StartApplication();
131 if (err) return err;
133 EventLoop();
134 StopApplication();
136 } else {
137 return sysErrParamErr;
140 return 0;