SFS moved to core
[AROS-Contrib.git] / ScalosV2 / MainTask.c
bloba50a598dd1c7452a899446f095fab89180850457
1 // :ts=4 (Tabsize)
2 /* Scalos - MainTask */
4 /*
5 ** Amiga Workbench® Replacement
6 **
7 ** (C) Copyright 1999,2000 Aliendesign
8 ** Stefan Sommerfeld, Jörg Rebenstorf
9 **
10 ** Redistribution and use in source and binary forms are permitted provided that
11 ** the above copyright notice and this paragraph are duplicated in all such
12 ** forms and that any documentation, advertising materials, and other
13 ** materials related to such distribution and use acknowledge that the
14 ** software was developed by Aliendesign.
15 ** THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
16 ** WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
17 ** MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21 #include <proto/alib.h>
22 #include <proto/exec.h>
23 #include <proto/intuition.h>
24 #include <proto/dos.h>
25 #include <intuition/classusr.h>
26 #include <intuition/classes.h>
27 #include <exec/semaphores.h>
29 #include <stdio.h>
30 #include <stdlib.h>
31 #include <string.h>
33 #include "scalos_protos.h"
35 #include "SubRoutines.h"
36 #include "MainTask.h"
37 #include "ScalosIntern.h"
38 #include "WindowClass.h"
39 #include "ScreenClass.h"
40 #include "AreaClass.h"
41 #include "WindowTaskClass.h"
42 #include "Scalos.h"
43 #include "PlanarTestClass.h"
44 #include "Chunky8TestClass.h"
45 #include "BitmapClass.h"
46 #include "GroupClass.h"
47 #include "RectFillClass.h"
48 #include "PanelClass.h"
49 #include "PanelViewClass.h"
50 #include "IconPanelClass.h"
51 #include "GraphicClass.h"
52 #include "IconClass.h"
53 #include "TextClass.h"
54 #include "GFXTestClass.h"
55 #include "AmigaIconClass.h"
56 #include "DOSIconClass.h"
57 #include "DOSListIconClass.h"
58 #include "DOSDeviceIconClass.h"
59 #include "DOSDirIconClass.h"
60 #include "DOSFileIconClass.h"
61 #include "TableClass.h"
62 #include "NodeListClass.h"
64 #include "Debug.h"
65 #include "CompilerSupport.h"
67 #ifndef __STORM__
68 static const char Version[] = VERSTAG" "CPU" "__AMIGADATE__;
69 #else
70 static const char Version[] = VERSTAG" "__DATE__;
71 #endif
73 /* ------------------------ Main Ptrs ----------------------------------*/
75 struct IntuitionBase *IntuitionBase = NULL;
76 struct GfxBase *GfxBase = NULL;
77 struct Library *UtilityBase = NULL;
78 struct Library *GuiGFXBase = NULL;
79 struct Library *LayersBase = NULL;
81 struct MinList ScreenList; // used in ScreenClass
82 struct SignalSemaphore ScreenListSem;
84 /* -------------------------- Lists ------------------------------------*/
86 extern ULONG ScalosMasterInit(void);
87 extern ScalosMasterExit(void);
89 extern struct SC_MethodData WindowMethods[];
90 extern struct SC_MethodData ScreenMethods[];
91 extern struct SC_MethodData AreaMethods[];
92 extern struct SC_MethodData WindowTaskMethods[];
93 extern struct SC_MethodData BitmapMethods[];
94 extern struct SC_MethodData GroupMethods[];
95 extern struct SC_MethodData PlanarTestMethods[];
96 extern struct SC_MethodData Chunky8TestMethods[];
97 extern struct SC_MethodData RectFillMethods[];
98 extern struct SC_MethodData PanelMethods[];
99 extern struct SC_MethodData PanelViewMethods[];
100 extern struct SC_MethodData IconPanelMethods[];
101 extern struct SC_MethodData GraphicMethods[];
102 extern struct SC_MethodData IconMethods[];
103 extern struct SC_MethodData TextMethods[];
104 extern struct SC_MethodData GFXTestMethods[];
105 extern struct SC_MethodData AmigaIconMethods[];
106 extern struct SC_MethodData DOSIconMethods[];
107 extern struct SC_MethodData DOSListIconMethods[];
108 extern struct SC_MethodData DOSDirIconMethods[];
109 extern struct SC_MethodData DOSFileIconMethods[];
110 extern struct SC_MethodData DOSDeviceIconMethods[];
111 extern struct SC_MethodData TableMethods[];
112 extern struct SC_MethodData NodeListMethods[];
114 extern ULONG MethodSenderDispatcher(struct IClass *cl, Msg msg, Object *obj);
116 struct LibraryList
118 char *LibName;
119 struct Library **LibBase;
120 int Version;
121 } liblist[] =
123 { "intuition.library",(struct Library **) &IntuitionBase,0 }, /* version 0 to use EasyRequest() */
124 { "graphics.library",(struct Library **) &GfxBase,39 },
125 { "utility.library", &UtilityBase,39 },
126 { "layers.library", &LayersBase,39 },
127 { "guigfx.library", &GuiGFXBase,8 },
128 { NULL,NULL,0 }
131 struct ClassList
133 char *ClassName;
134 char *SuperClassName;
135 ULONG InstSize;
136 struct SC_MethodData *methodlist;
137 struct SC_Class *Class;
139 } classlist[] =
141 {SCC_WINDOW_NAME,SCC_THREADROOT_NAME,sizeof(struct WindowInst),(struct SC_MethodData *) &WindowMethods,NULL},
142 {SCC_SCREEN_NAME,SCC_ROOT_NAME,sizeof(struct ScreenInst),(struct SC_MethodData *) &ScreenMethods,NULL},
143 {SCC_AREA_NAME,SCC_ROOT_NAME,sizeof(struct AreaInst),(struct SC_MethodData *) &AreaMethods,NULL},
144 {SCC_THREADAREA_NAME,SCC_THREADROOT_NAME,sizeof(struct AreaInst),(struct SC_MethodData *) &AreaMethods,NULL},
145 {SCC_WINDOWTASK_NAME,SCC_ROOT_NAME,sizeof(struct WindowTaskInst),(struct SC_MethodData *) &WindowTaskMethods,NULL},
146 {SCC_GRAPHIC_NAME,SCC_ROOT_NAME,sizeof(struct GraphicInst),(struct SC_MethodData *) &GraphicMethods,NULL},
147 {SCC_BITMAP_NAME,SCC_GRAPHIC_NAME,sizeof(struct BitmapInst),(struct SC_MethodData *) &BitmapMethods,NULL},
148 {SCC_GROUP_NAME,SCC_AREA_NAME,sizeof(struct GroupInst),(struct SC_MethodData *) &GroupMethods,NULL},
149 {SCC_PANEL_NAME,SCC_AREA_NAME,sizeof(struct PanelInst),(struct SC_MethodData *) &PanelMethods,NULL},
150 {SCC_PANELVIEW_NAME,SCC_GROUP_NAME,sizeof(struct PanelViewInst),(struct SC_MethodData *) &PanelViewMethods,NULL},
151 {SCC_ICONPANEL_NAME,SCC_PANEL_NAME,sizeof(struct IconPanelInst),(struct SC_MethodData *) &IconPanelMethods,NULL},
152 {SCC_ICON_NAME,SCC_GRAPHIC_NAME,sizeof(struct IconInst),(struct SC_MethodData *) &IconMethods,NULL},
153 {SCC_TEXT_NAME,SCC_GRAPHIC_NAME,sizeof(struct TextInst),(struct SC_MethodData *) &TextMethods,NULL},
154 {SCC_AMIGAICON_NAME,SCC_ICON_NAME,sizeof(struct AmigaIconInst),(struct SC_MethodData *) &AmigaIconMethods,NULL},
155 {SCC_DOSICON_NAME,SCC_ICON_NAME,sizeof(struct DOSIconInst),(struct SC_MethodData *) &DOSIconMethods,NULL},
156 {SCC_DOSLISTICON_NAME,SCC_ICON_NAME,sizeof(struct DOSListIconInst),(struct SC_MethodData *) &DOSListIconMethods,NULL},
157 {SCC_DOSDIRICON_NAME,SCC_DOSICON_NAME,sizeof(struct DOSDirIconInst),(struct SC_MethodData *) &DOSDirIconMethods,NULL},
158 {SCC_DOSFILEICON_NAME,SCC_DOSICON_NAME,sizeof(struct DOSFileIconInst),(struct SC_MethodData *) &DOSFileIconMethods,NULL},
159 {SCC_DOSDEVICEICON_NAME,SCC_DOSDIRICON_NAME,sizeof(struct DOSDeviceIconInst),(struct SC_MethodData *) &DOSDeviceIconMethods,NULL},
160 {SCC_TABLE_NAME,SCC_ROOT_NAME,sizeof(struct TableInst),(struct SC_MethodData *) &TableMethods,NULL},
161 {SCC_NODELIST_NAME,SCC_ROOT_NAME,sizeof(struct NodeListInst),(struct SC_MethodData *) &NodeListMethods,NULL},
163 // {"PlanarTest.scalos",SCC_AREA_NAME,sizeof(struct PlanarTestInst),(struct SC_MethodData *) &PlanarTestMethods,NULL},
164 {"PlanarTest.scalos",SCC_THREADAREA_NAME,sizeof(struct PlanarTestInst),(struct SC_MethodData *) &PlanarTestMethods,NULL},
165 // {"Chunky8Test.scalos",SCC_AREA_NAME,sizeof(struct Chunky8TestInst),(struct SC_MethodData *) &Chunky8TestMethods,NULL},
166 {"Chunky8Test.scalos",SCC_THREADAREA_NAME,sizeof(struct Chunky8TestInst),(struct SC_MethodData *) &Chunky8TestMethods,NULL},
167 // {"RectFill.scalos",SCC_AREA_NAME,sizeof(struct RectFillInst),(struct SC_MethodData *) &RectFillMethods,NULL},
168 {"RectFill.scalos",SCC_THREADAREA_NAME,sizeof(struct RectFillInst),(struct SC_MethodData *) &RectFillMethods,NULL},
169 {"GFXTest.scalos",SCC_AREA_NAME,sizeof(struct GFXTestInst),(struct SC_MethodData *) &GFXTestMethods,NULL},
171 {NULL,NULL,0,NULL}
174 /*------------------------ Functions -----------------------------------*/
177 BOOL OpenLibs(void)
179 int i;
180 struct EasyStruct easystruct =
182 sizeof (struct EasyStruct),
183 NULL,
184 "Scalos Error",
185 "Error opening '%s' version %ld !",
186 "Ok"
189 for (i=0;(liblist[i].LibName);i++)
191 if (!(*(liblist[i].LibBase) = (struct Library *) OpenLibrary(liblist[i].LibName,(ULONG) liblist[i].Version)))
193 if (IntuitionBase) EasyRequest(NULL,&easystruct,NULL,liblist[i].LibName,(ULONG) liblist[i].Version);
194 return FALSE;
197 return TRUE;
200 void CloseLibs(void)
202 int i;
204 for (i=0;liblist[i].LibName;i++)
206 if (*liblist[i].LibBase)
207 CloseLibrary(*liblist[i].LibBase);
211 BOOL InitClasses(void)
213 int i;
214 struct EasyStruct easystruct =
216 sizeof (struct EasyStruct),
217 NULL,
218 "Scalos Error",
219 "Error making '%s' class!",
220 "Ok"
223 for (i=0;classlist[i].ClassName;i++)
225 if(!(classlist[i].Class = SC_MakeSimpleClass( classlist[i].ClassName,classlist[i].SuperClassName,NULL,classlist[i].methodlist,classlist[i].InstSize,0 )))
227 EasyRequest(NULL,&easystruct,NULL,classlist[i].ClassName);
228 return FALSE;
232 return TRUE;
235 void RemClasses(void)
237 int i;
239 for (i=0;classlist[i].ClassName;i++);
241 while (i-- != 0)
243 if (classlist[i].Class)
245 if (SC_FreeClass(classlist[i].Class))
246 classlist[i].Class = NULL;
252 BOOL Init(void)
254 if(OpenLibs() && ScalosMasterInit())
257 if(InitClasses())
259 NewList((struct List *) &ScreenList);
260 memset(&ScreenListSem,0,sizeof(struct SignalSemaphore));
261 InitSemaphore(&ScreenListSem);
262 return TRUE;
264 CloseLibs();
266 return FALSE;
270 void fail(Object *app, char *errortxt)
272 if(errortxt) puts(errortxt);
273 SC_DisposeObject( app );
274 RemClasses();
275 CloseLibs();
276 ScalosMasterExit();
277 if(errortxt) exit(EXIT_FAILURE);
278 else exit(EXIT_SUCCESS);
282 /* -------------------------- Main ----------------------------------- */
284 void main(void)
286 Object *app;
287 ULONG signal = 0;
289 if (Init())
293 Object *o1;
294 Object *o2;
295 Object *o3;
297 o1 = SC_NewObject(NULL,SCC_DOSDIRICON_NAME,SCCA_Icon_Name,"dh0:WBStartup",TAG_DONE);
300 SC_DoMethod(o1,SCCM_Icon_GetIcon,SCCV_Icon_GetIcon_Disk);
302 o1 = SC_NewObject(NULL,SCC_DOSLISTICON_NAME,TAG_DONE);
304 SC_DoMethod(o1,SCCM_Icon_Entry,SCCV_Icon_Entry_First);
305 o3 = (Object *) SC_DoMethod(o1,SCCM_Icon_GetObject,TAG_DONE);
309 char *str;
310 if (o2 = (Object *) SC_DoMethod(o1,SCCM_Icon_GetObject,TAG_DONE))
312 printf("%s - %s Type: %s\n",get(o2,SCCA_Icon_Name),get(o2,SCCA_DOSDeviceIcon_DeviceName),str = (char *) SC_DoMethod(o2,SCCM_Icon_GetString,SCCA_DOSDeviceIcon_AssignType));
313 FreeVec(str);
314 SC_DisposeObject(o2);
316 else
317 printf("Object error\n");
319 while (SC_DoMethod(o1,SCCM_Icon_Entry,SCCV_Icon_Entry_Next));
321 printf("List end\n\n");
323 SC_DoMethod(o3,SCCM_Icon_Entry,SCCV_Icon_Entry_First);
326 if (o2 = (Object *) SC_DoMethod(o3,SCCM_Icon_GetObject,TAG_DONE))
328 printf("%s\n",get(o2,SCCA_Icon_Name));
329 SC_DisposeObject(o2);
331 else
332 printf("Object error\n");
334 while (SC_DoMethod(o3,SCCM_Icon_Entry,SCCV_Icon_Entry_Next));
336 SC_DoMethod(o3,SCCM_Icon_Entry,SCCV_Icon_Entry_None);
337 SC_DoMethod(o1,SCCM_Icon_Entry,SCCV_Icon_Entry_None);
339 SC_DisposeObject(o3);
340 SC_DisposeObject(o1);
343 /*********************************************************************************************************************/
345 Object *winobject1;
346 Object *rectobj;
347 Object *screenobj;
349 rectobj = SC_NewObject(NULL,"RectFill.scalos",TAG_DONE);
351 screenobj = SC_NewObject(NULL,SCC_SCREEN_NAME,SCCA_Screen_PubName,"Workbench",TAG_DONE);
353 winobject1 = SC_NewObject(NULL,SCC_WINDOW_NAME,SCCA_Window_Root,rectobj,SCCA_Window_ScreenObj,screenobj,TAG_DONE);
354 app = SC_NewObject(NULL,SCC_WINDOWTASK_NAME,SCCA_WindowTask_Window, winobject1,TAG_DONE);
356 if(!app) fail(app, "Error: Failed to create application.\n");
358 if(!(SC_DoMethod(winobject1,SCCM_Window_Open,TRUE)))
359 fail(app, "Error: Failed to open window #1.\n");
361 SC_DoMethod(winobject1,SCCM_Notify,SCCA_Window_CloseRequest,TRUE,app,1,SCCM_WindowTask_Return);
363 /*********************************************************************************************************************/
365 Object *winobject1;
366 Object *btmobj1;
367 Object *screenobj;
369 btmobj1 = SC_NewObject(NULL,"Chunky8Test.scalos",TAG_DONE);
371 screenobj = SC_NewObject(NULL,SCC_SCREEN_NAME,SCCA_Screen_PubName,"Workbench",TAG_DONE);
373 winobject1 = SC_NewObject(NULL,SCC_WINDOW_NAME,SCCA_Window_Root,btmobj1,SCCA_Window_ScreenObj,screenobj,TAG_DONE);
374 app = SC_NewObject(NULL,SCC_WINDOWTASK_NAME,SCCA_WindowTask_Window, winobject1,TAG_DONE);
376 if(!app) fail(app, "Error: Failed to create application.\n");
378 if(!(SC_DoMethod(winobject1,SCCM_Window_Open,TRUE)))
379 fail(app, "Error: Failed to open window #1.\n");
381 SC_DoMethod(winobject1,SCCM_Notify,SCCA_Window_CloseRequest,TRUE,app,1,SCCM_WindowTask_Return);
383 /*********************************************************************************************************************/
385 Object *btmobj1,*btmobj2;
386 Object *rectobj;
387 Object *screenobj;
388 Object *winobject1,*winobject2,*winobject3;
390 btmobj1 = SC_NewObject(NULL,"Chunky8Test.scalos",TAG_DONE);
391 btmobj2 = SC_NewObject(NULL,"PlanarTest.scalos",TAG_DONE);
392 rectobj = SC_NewObject(NULL,"RectFill.scalos",TAG_DONE);
394 screenobj = SC_NewObject(NULL,SCC_SCREEN_NAME,SCCA_Screen_PubName,"Workbench",TAG_DONE);
397 app = SC_NewObject(NULL,SCC_WINDOWTASK_NAME,SCCA_WindowTask_Window,
398 winobject1 = SC_NewObject(NULL,SCC_WINDOW_NAME,SCCA_Window_Root,btmobj1,
399 SCCA_Window_ScreenObj,screenobj,TAG_DONE),
400 SCCA_WindowTask_Window, winobject3 = SC_NewObject(NULL,SCC_WINDOW_NAME,SCCA_Window_Root,rectobj,
401 SCCA_Window_ScreenObj,screenobj,TAG_DONE),
402 SCCA_WindowTask_Window, winobject2 = SC_NewObject(NULL,SCC_WINDOW_NAME,SCCA_Window_Root,btmobj2,
403 SCCA_Window_ScreenObj,screenobj,TAG_DONE),
404 TAG_DONE);
406 if(!app) fail(app, "Error: Failed to create application.\n");
408 if(!(SC_DoMethod(winobject3,SCCM_Window_Open,TRUE)))
409 fail(app, "Error: Failed to open window #3.\n");
411 if(!(SC_DoMethod(winobject2,SCCM_Window_Open,TRUE)))
412 fail(app, "Error: Failed to open window #2.\n");
414 if(!(SC_DoMethod(winobject1,SCCM_Window_Open,TRUE)))
415 fail(app, "Error: Failed to open window #1.\n");
418 SC_DoMethod(winobject1,SCCM_Notify,SCCA_Window_CloseRequest,TRUE,app,1,SCCM_WindowTask_Return);
419 SC_DoMethod(winobject2,SCCM_Notify,SCCA_Window_CloseRequest,TRUE,app,1,SCCM_WindowTask_Return);
420 SC_DoMethod(winobject3,SCCM_Notify,SCCA_Window_CloseRequest,TRUE,app,1,SCCM_WindowTask_Return);
423 /*********************************************************************************************************************/
425 Object *btmobj1,*btmobj2,*btmobj3,*btmobj4;
426 Object *panelobj;
427 Object *grobj2,*grobj1;
428 Object *screenobj;
429 Object *winobject4;
431 btmobj1 = SC_NewObject(NULL,"Chunky8Test.scalos",TAG_DONE);
432 btmobj2 = SC_NewObject(NULL,"Chunky8Test.scalos",TAG_DONE);
433 btmobj3 = SC_NewObject(NULL,"Chunky8Test.scalos",TAG_DONE);
434 btmobj4 = SC_NewObject(NULL,"Chunky8Test.scalos",TAG_DONE);
436 panelobj = SC_NewObject(NULL,SCC_PANELVIEW_NAME,SCCA_PanelView_Panel,
437 SC_NewObject(NULL,SCC_ICONPANEL_NAME,TAG_DONE),
438 TAG_DONE);
440 grobj2 = SC_NewObject(NULL,SCC_GROUP_NAME,
441 SCCA_Group_Child,btmobj1,
442 SCCA_Group_Child,panelobj,
443 SCCA_Group_Child,btmobj2,
444 SCCA_Group_Type,SCCV_Group_VGroup,
445 TAG_DONE);
447 grobj1 = SC_NewObject(NULL,SCC_GROUP_NAME,
448 SCCA_Group_Child,btmobj3,
449 SCCA_Group_Child,grobj2,
450 SCCA_Group_Child,btmobj4,
451 SCCA_Group_Type,SCCV_Group_HGroup,
452 TAG_DONE
455 screenobj = SC_NewObject(NULL,SCC_SCREEN_NAME,SCCA_Screen_PubName,"Workbench",TAG_DONE);
458 app = SC_NewObject(NULL,SCC_WINDOWTASK_NAME,SCCA_WindowTask_Window, winobject4 = SC_NewObject(NULL,SCC_WINDOW_NAME,
459 SCCA_Window_Root,grobj1,
460 SCCA_Window_ScreenObj,screenobj,
461 TAG_DONE),
462 TAG_DONE);
464 if(!app) fail(app, "Error: Failed to create application.\n");
466 if(!(SC_DoMethod(winobject4,SCCM_Window_Open,TRUE)))
467 fail(app, "Error: Failed to open window #4.\n");
469 SC_DoMethod(winobject4,SCCM_Notify,SCCA_Window_CloseRequest,TRUE,app,1,SCCM_WindowTask_Return);
471 /*********************************************************************************************************************/
473 Object *btmobj1,*btmobj2,*btmobj3,*btmobj4,*btmobj5;
474 Object *rectobj1,*rectobj2,*rectobj3;
475 Object *grobj1,*grobj2,*grobj3;
476 Object *screenobj;
477 Object *winobject1;
479 btmobj1 = SC_NewObject(NULL,"Chunky8Test.scalos",TAG_DONE);
480 btmobj2 = SC_NewObject(NULL,"PlanarTest.scalos",TAG_DONE);
481 btmobj3 = SC_NewObject(NULL,"Chunky8Test.scalos",TAG_DONE);
482 btmobj4 = SC_NewObject(NULL,"PlanarTest.scalos",TAG_DONE);
483 btmobj5 = SC_NewObject(NULL,"Chunky8Test.scalos",TAG_DONE);
484 rectobj1 = SC_NewObject(NULL,"RectFill.scalos",TAG_DONE);
485 rectobj2 = SC_NewObject(NULL,"RectFill.scalos",TAG_DONE);
486 rectobj3 = SC_NewObject(NULL,"RectFill.scalos",TAG_DONE);
487 grobj3 = SC_NewObject(NULL,SCC_GROUP_NAME,
488 SCCA_Group_Child,rectobj3,
489 SCCA_Group_Child,btmobj5,
490 SCCA_Group_Child,btmobj2,
491 SCCA_Group_Type,SCCV_Group_VGroup,
492 TAG_DONE
494 grobj2 = SC_NewObject(NULL,SCC_GROUP_NAME,
495 SCCA_Group_Child,btmobj3,
496 SCCA_Group_Child,btmobj4,
497 SCCA_Group_Child,grobj3,
498 SCCA_Group_Child,rectobj1,
499 SCCA_Group_Type,SCCV_Group_HGroup,
500 TAG_DONE
502 grobj1 = SC_NewObject(NULL,SCC_GROUP_NAME,
503 SCCA_Group_Child,btmobj1,
504 SCCA_Group_Child,grobj2,
505 SCCA_Group_Child,rectobj2,
506 SCCA_Group_Type,SCCV_Group_VGroup,
507 TAG_DONE
510 screenobj = SC_NewObject(NULL,SCC_SCREEN_NAME,SCCA_Screen_PubName,"Workbench",TAG_DONE);
513 app = SC_NewObject(NULL,SCC_WINDOWTASK_NAME,
514 SCCA_WindowTask_Window,winobject1 = SC_NewObject(NULL,SCC_WINDOW_NAME,
515 SCCA_Window_Root,grobj1,
516 SCCA_Window_ScreenObj,screenobj,
517 TAG_DONE
519 TAG_DONE
522 if(!app) fail(app, "Error: Failed to create application.\n");
524 if(!(SC_DoMethod(winobject1,SCCM_Window_Open,TRUE)))
525 fail(app, "Error: Failed to open window #1.\n");
527 SC_DoMethod(winobject1,SCCM_Notify,SCCA_Window_CloseRequest,TRUE,app,1,SCCM_WindowTask_Return);
529 /*********************************************************************************************************************/
531 Object *btmobj1;
532 Object *grobj;
533 Object *screenobj;
534 Object *winobject4;
536 btmobj1 = SC_NewObject(NULL,"Chunky8Test.scalos",TAG_DONE);
537 grobj = SC_NewObject(NULL,SCC_GROUP_NAME,SCCA_Group_Child,btmobj1,TAG_DONE);
539 screenobj = SC_NewObject(NULL,SCC_SCREEN_NAME,SCCA_Screen_PubName,"Workbench",TAG_DONE);
542 app = SC_NewObject(NULL,SCC_WINDOWTASK_NAME,SCCA_WindowTask_Window, winobject4 = SC_NewObject(NULL,SCC_WINDOW_NAME,
543 SCCA_Window_Root,grobj,
544 SCCA_Window_ScreenObj,screenobj,
545 TAG_DONE),
546 TAG_DONE);
548 if(!app) fail(app, "Error: Failed to create application.\n");
550 if(!(SC_DoMethod(winobject4,SCCM_Window_Open,TRUE)))
551 fail(app, "Error: Failed to open window #4.\n");
553 SC_DoMethod(winobject4,SCCM_Notify,SCCA_Window_CloseRequest,TRUE,app,1,SCCM_WindowTask_Return);
555 /*********************************************************************************************************************/
557 extern Object *chunky_8_makebitmap(void);
559 Object *winobject1;
560 Object *panelobj;
561 Object *iconpanelobj;
562 Object *screenobj;
563 Object *bitmap;
564 Object *icon;
565 Object *icon2;
567 bitmap = chunky_8_makebitmap();
569 icon = SC_NewObject(NULL,SCC_DOSDIRICON_NAME,SCCA_Icon_Path,"sys:Prefs",TAG_DONE);
570 SC_DoMethod(icon,SCCM_Icon_GetIcon,SCCV_Icon_GetIcon_Disk);
572 icon2 = SC_NewObject(NULL,SCC_DOSDIRICON_NAME,SCCA_Icon_Path,"sys:Devs",TAG_DONE);
573 SC_DoMethod(icon2,SCCM_Icon_GetIcon,SCCV_Icon_GetIcon_Disk);
575 panelobj = SC_NewObject(NULL,SCC_PANELVIEW_NAME,SCCA_PanelView_Panel,
576 iconpanelobj = SC_NewObject(NULL,SCC_ICONPANEL_NAME,SCCA_Panel_Background,bitmap,TAG_DONE),
577 TAG_DONE);
580 SC_DoMethod(iconpanelobj,SCCM_IconPanel_Add,icon);
581 SC_DoMethod(iconpanelobj,SCCM_IconPanel_Add,icon2);
583 screenobj = SC_NewObject(NULL,SCC_SCREEN_NAME,SCCA_Screen_PubName,"Workbench",TAG_DONE);
585 winobject1 = SC_NewObject(NULL,SCC_WINDOW_NAME,SCCA_Window_Root,panelobj,SCCA_Window_ScreenObj,screenobj,TAG_DONE);
586 app = SC_NewObject(NULL,SCC_WINDOWTASK_NAME,SCCA_WindowTask_Window, winobject1,TAG_DONE);
588 if(!app) fail(app, "Error: Failed to create application.\n");
590 if(!(SC_DoMethod(winobject1,SCCM_Window_Open,TRUE)))
591 fail(app, "Error: Failed to open window #1.\n");
593 SC_DoMethod(winobject1,SCCM_Notify,SCCA_Window_CloseRequest,TRUE,app,1,SCCM_WindowTask_Return);
595 /*********************************************************************************************************************/
597 Object *winobject1;
598 Object *rectobj;
599 Object *screenobj;
601 rectobj = SC_NewObject(NULL,"GFXTest.scalos",TAG_DONE);
603 screenobj = SC_NewObject(NULL,SCC_SCREEN_NAME,SCCA_Screen_PubName,"Workbench",TAG_DONE);
605 winobject1 = SC_NewObject(NULL,SCC_WINDOW_NAME,SCCA_Window_Root,rectobj,SCCA_Window_ScreenObj,screenobj,TAG_DONE);
606 app = SC_NewObject(NULL,SCC_WINDOWTASK_NAME,SCCA_WindowTask_Window, winobject1,TAG_DONE);
608 if(!app) fail(app, "Error: Failed to create application.\n");
610 if(!(SC_DoMethod(winobject1,SCCM_Window_Open,TRUE)))
611 fail(app, "Error: Failed to open window #1.\n");
613 SC_DoMethod(winobject1,SCCM_Notify,SCCA_Window_CloseRequest,TRUE,app,1,SCCM_WindowTask_Return);
615 /*********************************************************************************************************************/
618 while (SC_DoMethod(app, SCCM_WindowTask_Input, &signal) == FALSE)
620 signal = Wait(signal);
623 SC_DisposeObject( app );
625 SC_DisposeObject(screenobj);
629 RemClasses();
630 ScalosMasterExit();
631 CloseLibs();
635 /* -------------------------- Inits ------------------------------------*/