7 * (C) Copyright 1998 Manuel Lemos.
8 * (C) Copyright 1996-1997 Respect Software
9 * (C) Copyright 1996-1997 Ian J. Einman.
10 * All Rights Reserved.
13 * Revision 42.0 2000/05/09 22:17:05 mlemos
14 * Bumped to revision 42.0 before handing BGUI to AROS team
16 * Revision 41.11 2000/05/09 20:29:54 mlemos
17 * Bumped to revision 41.11
19 * Revision 1.2 2000/05/09 19:56:54 mlemos
20 * Merged with the branch Manuel_Lemos_fixes.
22 * Revision 1.1.2.1 1998/09/20 17:28:48 mlemos
23 * Peter Bornhall sources.
29 Object
**ar
= BGUIPrefsObjs
;
30 Object
*BGUIPrefsObjs
[ BGP_NUMGADS
];
33 extern IPTR grp_frmtype
,
74 CloneTagList( Tag t
, ... )
76 AROS_SLOWSTACKTAGS_PRE_AS(t
, struct TagItem
*)
77 retval
= CloneTagItems(AROS_SLOWSTACKTAGS_ARG(t
));
78 AROS_SLOWSTACKTAGS_POST
83 SaveTagList( struct IFFHandle
*iff
, ULONG type
, struct TagItem
*tags
)
86 struct TagItem
*tstate
= tags
;
87 ULONG zero
= TAG_DONE
;
89 PushChunk( iff
, ID_BGUI
, ID_DTAG
, IFFSIZE_UNKNOWN
);
90 WriteChunkBytes( iff
, ( UBYTE
* )&type
, sizeof( ULONG
) );
92 while(( tag
= NextTagItem( &tstate
) )) {
94 WriteChunkBytes( iff
, ( UBYTE
* )tag
, sizeof( struct TagItem
) );
98 WriteChunkBytes( iff
, ( UBYTE
* )&zero
, sizeof( ULONG
) );
105 SaveBGUIPrefs( char *dirname
, char *name
)
109 struct IFFHandle
*iff
;
110 struct TagItem
*objecttags
= NULL
;
112 dir
= Lock( dirname
, ACCESS_READ
);
114 if( !dir
) dir
= CreateDir( dirname
);
118 olddir
= CurrentDir( dir
);
120 if(( iff
= AllocIFF() )) {
122 if(( iff
->iff_Stream
= (IPTR
)Open( name
, MODE_NEWFILE
) )) {
125 if( OpenIFF( iff
, IFFF_WRITE
) == 0 ) {
127 PushChunk( iff
, ID_BGUI
, ID_FORM
, IFFSIZE_UNKNOWN
);
130 objecttags
= CloneTagList(
131 FRM_DefaultType
, grp_frmtype
,
132 FRM_Recessed
, grp_recessed
,
133 GROUP_DefVSpaceNarrow
, grp_vspnarrow
,
134 GROUP_DefHSpaceNarrow
, grp_hspnarrow
,
135 GROUP_DefVSpaceNormal
, grp_vspnormal
,
136 GROUP_DefHSpaceNormal
, grp_hspnormal
,
137 GROUP_DefVSpaceWide
, grp_vspwide
,
138 GROUP_DefHSpaceWide
, grp_hspwide
,
141 SaveTagList( iff
, BGUI_GROUP_GADGET
, objecttags
);
144 objecttags
= CloneTagList(
145 FRM_Type
, but_frmtype
,
146 FRM_Recessed
, but_recessed
,
149 SaveTagList( iff
, BGUI_BUTTON_GADGET
, objecttags
);
152 objecttags
= CloneTagList(
153 FRM_Type
, str_frmtype
,
154 FRM_Recessed
, str_recessed
,
157 SaveTagList( iff
, BGUI_STRING_GADGET
, objecttags
);
160 objecttags
= CloneTagList(
161 FRM_Type
, chk_frmtype
,
162 FRM_Recessed
, chk_recessed
,
165 SaveTagList( iff
, BGUI_CHECKBOX_GADGET
, objecttags
);
168 objecttags
= CloneTagList(
169 FRM_Type
, cyc_frmtype
,
170 FRM_Recessed
, cyc_recessed
,
171 CYC_PopActive
, cyc_popactive
,
172 CYC_Popup
, cyc_popup
,
175 SaveTagList( iff
, BGUI_CYCLE_GADGET
, objecttags
);
178 objecttags
= CloneTagList(
179 FRM_DefaultType
, inf_frmtype
,
180 FRM_Recessed
, inf_recessed
,
183 SaveTagList( iff
, BGUI_INFO_GADGET
, objecttags
);
186 objecttags
= CloneTagList(
187 FRM_Type
, prg_frmtype
,
188 FRM_Recessed
, prg_recessed
,
191 SaveTagList( iff
, BGUI_PROGRESS_GADGET
, objecttags
);
194 objecttags
= CloneTagList(
195 FRM_DefaultType
, ind_frmtype
,
196 FRM_Recessed
, ind_recessed
,
199 SaveTagList( iff
, BGUI_INDICATOR_GADGET
, objecttags
);
204 Close( (BPTR
)iff
->iff_Stream
);
208 CurrentDir( olddir
);