Updates to includes for scsi & usbhardware.
[cake.git] / rom / graphics / gfxnew.c
blob23233a0f1e786b685214145944007c3376a15847
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: english
7 */
9 #include <exec/types.h>
10 #include <exec/memory.h>
11 #include <graphics/gfxbase.h>
12 #include <graphics/monitor.h>
13 #include <graphics/view.h>
14 #include <graphics/gfxnodes.h>
15 #include <proto/exec.h>
16 #include <proto/graphics.h>
17 #include "graphics_intern.h"
19 /*****************************************************************************
21 NAME */
23 AROS_LH1(struct ExtendedNode *, GfxNew,
25 /* SYNOPSIS */
27 AROS_LHA( ULONG, node_type, D0),
29 /* LOCATION */
31 struct GfxBase *, GfxBase, 110, Graphics)
33 /* FUNCTION
34 Allocate a special graphics extended data structure. The type of
35 structure to be allocated is passed in the node_type identifier.
37 INPUTS
38 node_type = the type of graphics extended data structure to allocate.
39 (see gfxnodes.h for identifier definitions.)
41 RESULT
42 A pointer to the allocated graphics node or NULL if the allocation
43 failed
45 NOTES
47 EXAMPLE
49 BUGS
51 SEE ALSO
52 graphics/gfxnodes.h, GfxFree(), GfxAssociate(), GfxLookUp()
54 INTERNALS
56 HISTORY
58 ******************************************************************************/
60 AROS_LIBFUNC_INIT
62 struct ExtendedNode * Result;
63 const ULONG GfxNew_memsizes[] = { 0,
64 sizeof(struct ViewExtra),
65 sizeof(struct ViewPortExtra),
66 sizeof(struct SpecialMonitor),
67 sizeof(struct MonitorSpec)
71 if (node_type >= VIEW_EXTRA_TYPE && node_type <= MONITOR_SPEC_TYPE)
73 Result = (struct ExtendedNode *) AllocMem(GfxNew_memsizes[node_type],
74 MEMF_CLEAR | MEMF_PUBLIC);
75 if (Result)
77 /* do some initialisation they all have in common */
78 Result->xln_Type = NT_GRAPHICS;
79 Result->xln_Subsystem = SS_GRAPHICS;
80 Result->xln_Subtype = (BYTE)node_type;
81 /* Result->xln_Library = (APTR)GfxBase; */
83 /* the following pointer has to point to some unknown routine */
84 /* Result->xln_Init = ???; */
86 /* lets get more specific now !*/
87 switch(node_type)
89 case VIEW_EXTRA_TYPE:
90 ((struct ViewExtra *)Result)->Monitor = (struct MonitorSpec *)
91 FindName((struct List *)(&(GfxBase -> MonitorList)), DEFAULT_MONITOR_NAME);
92 break;
93 case VIEWPORT_EXTRA_TYPE:
94 break;
95 case SPECIAL_MONITOR_TYPE:
96 /* ((struct SpecialMonitor *)Result).do_monitor = */
97 break;
98 case MONITOR_SPEC_TYPE:
99 /* ((struct MonitorSpec *)Result)->ms_transform = */
100 /* ((struct MonitorSpec *)Result)->ms_translate = */
101 /* ((struct MonitorSpec *)Result)->ms_scale = */
102 /* ((struct MonitorSpec *)Result)->ms_xoffset = */
103 /* ((struct MonitorSpec *)Result)->ms_yoffset = */
104 /* ((struct MonitorSpec *)Result)->ms_maxoscan = */
105 /* ((struct MonitorSpec *)Result)->ms_videoscan = */
106 /* ((struct MonitorSpec *)Result)->ms_reserved00 = */
107 /* ((struct MonitorSpec *)Result)->ms_reserved01 = */
108 break;
110 return Result;
111 } /* could allocate requested memory */
112 } /* node_type is valid */
113 return NULL;
115 AROS_LIBFUNC_EXIT
116 } /* GfxNew */