3 // ©1996-2002 Henrik Isaksson
5 // Menu creation/disposal & id list functions
10 void FreeIDList(struct PM_IDLst
*f
)
23 void PM_FreeTitle(struct PopupMenu
*p
)
27 if(p
->Title
&& GET_TXTMODE(p
)==0) PM_Mem_Free(p
->Title
);
32 void __saveds ASM
PM_FreePopupMenu(register __a1
struct PopupMenu
*p
GNUCREG(a1
))
39 if(p
->Sub
) PM_FreePopupMenu(p
->Sub
);
41 if(p
->UserData
&& (p
->Flags
&NPM_UDATASTRING
)) PM_Mem_Free(p
->UserData
);
42 if(p
->Exclude
&& !(p
->Flags
&NPM_EXCLUDE_SHARED
)) {
43 FreeIDList(p
->Exclude
);
51 void __saveds ASM
PM_FreeIDList(
52 register __a0
struct PM_IDLst
*f
GNUCREG(a0
))
57 struct PopupMenu
*__saveds ASM
PM_MakeItemA(register __a1
struct TagItem
*tags
GNUCREG(a1
))
61 p
=PM_Mem_Alloc(sizeof(struct PopupMenu
));
63 PM_SetItemAttrsA(p
, tags
);
71 struct PopupMenu
* __saveds ASM
PM_MakeMenuA(register __a1
struct TagItem
*tags
GNUCREG(a1
))
73 struct TagItem
*tag
, *tstate
;
74 struct PopupMenu
*first
=0L, *last
=0L;
78 while((tag
=NextTagItem(&tstate
))) {
83 last
->Next
=(struct PopupMenu
*)tag
->ti_Data
;
86 last
=first
=(struct PopupMenu
*)tag
->ti_Data
;
94 PM_FreePopupMenu(first
);
101 struct PM_IDLst
* __saveds ASM
PM_MakeIDListA(register __a1
struct TagItem
*tags
GNUCREG(a1
))
103 struct TagItem
*tag
, *tstate
;
104 struct PM_IDLst
*first
=0L, *last
=0L, *n
=0L;
108 while((tag
=NextTagItem(&tstate
))) {
109 switch(tag
->ti_Tag
) {
111 n
=PM_Mem_Alloc(sizeof(struct PM_IDLst
));
115 n
->Kind
=IDKND_EXCLUDE
;
127 n
=PM_Mem_Alloc(sizeof(struct PM_IDLst
));
131 n
->Kind
=IDKND_INCLUDE
;
143 n
=PM_Mem_Alloc(sizeof(struct PM_IDLst
));
147 n
->Kind
=IDKND_REFLECT
;
159 n
=PM_Mem_Alloc(sizeof(struct PM_IDLst
));
163 n
->Kind
=IDKND_INVERSE
;
178 PM_FreeIDList(first
);
185 struct PM_IDLst
* __saveds ASM
PM_ExLstA(register __a1 ULONG
*id
GNUCREG(a1
))
187 struct PM_IDLst
*first
=0L, *last
=0L, *n
=0L;
192 n
=PM_Mem_Alloc(sizeof(struct PM_IDLst
));
196 n
->Kind
=IDKND_EXCLUDE
;
210 PM_FreeIDList(first
);
218 // Allocate local variables to save stack
220 struct PM_Root
*PM_AllocPMRoot(struct Window
*w
)
224 p
=PM_Mem_Alloc(sizeof(struct PM_Root
));
226 p
->ShadowWidth
=p
->ShadowHeight
=4;
227 p
->ShadowAddX
=p
->ShadowAddY
=2;
229 p
->BorderWidth
=p
->BorderHeight
=1;
231 p
->DrawInfo
=GetScreenDrawInfo(w
->WScreen
);