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
))
104 struct TagItem
*tstate
;
105 struct PM_IDLst
*first
=0L, *last
=0L, *n
=0L;
109 while((tag
=NextTagItem(&tstate
))) {
110 switch(tag
->ti_Tag
) {
112 n
=PM_Mem_Alloc(sizeof(struct PM_IDLst
));
116 n
->Kind
=IDKND_EXCLUDE
;
128 n
=PM_Mem_Alloc(sizeof(struct PM_IDLst
));
132 n
->Kind
=IDKND_INCLUDE
;
144 n
=PM_Mem_Alloc(sizeof(struct PM_IDLst
));
148 n
->Kind
=IDKND_REFLECT
;
160 n
=PM_Mem_Alloc(sizeof(struct PM_IDLst
));
164 n
->Kind
=IDKND_INVERSE
;
179 PM_FreeIDList(first
);
186 struct PM_IDLst
* __saveds ASM
PM_ExLstA(register __a1 ULONG
*id
GNUCREG(a1
))
188 struct PM_IDLst
*first
=0L, *last
=0L, *n
=0L;
193 n
=PM_Mem_Alloc(sizeof(struct PM_IDLst
));
197 n
->Kind
=IDKND_EXCLUDE
;
211 PM_FreeIDList(first
);
219 // Allocate local variables to save stack
221 struct PM_Root
*PM_AllocPMRoot(struct Window
*w
)
225 p
=PM_Mem_Alloc(sizeof(struct PM_Root
));
227 p
->ShadowWidth
=p
->ShadowHeight
=4;
228 p
->ShadowAddX
=p
->ShadowAddY
=2;
230 p
->BorderWidth
=p
->BorderHeight
=1;
232 p
->DrawInfo
=GetScreenDrawInfo(w
->WScreen
);