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 extern Object
**ar
= BGUIPrefsObjs
;
30 extern Object
*BGUIPrefsObjs
[ BGP_NUMGADS
];
33 extern ULONG grp_frmtype
,
74 CloneTagList( ULONG t
, ... )
76 return CloneTagItems( ( struct TagItem
* )&t
);
81 SaveTagList( struct IFFHandle
*iff
, ULONG type
, struct TagItem
*tags
)
84 ULONG zero
= TAG_DONE
;
86 PushChunk( iff
, ID_BGUI
, ID_DTAG
, IFFSIZE_UNKNOWN
);
87 WriteChunkBytes( iff
, ( UBYTE
* )&type
, sizeof( ULONG
) );
89 while( tag
= NextTagItem( &tags
) ) {
91 WriteChunkBytes( iff
, ( UBYTE
* )tag
, sizeof( struct TagItem
) );
95 WriteChunkBytes( iff
, ( UBYTE
* )&zero
, sizeof( ULONG
) );
102 SaveBGUIPrefs( char *dirname
, char *name
)
106 struct IFFHandle
*iff
;
107 struct TagItem
*objecttags
= NULL
;
109 dir
= Lock( dirname
, ACCESS_READ
);
111 if( !dir
) dir
= CreateDir( dirname
);
115 olddir
= CurrentDir( dir
);
117 if( iff
= AllocIFF() ) {
119 if( iff
->iff_Stream
= Open( name
, MODE_NEWFILE
) ) {
122 if( OpenIFF( iff
, IFFF_WRITE
) == 0 ) {
124 PushChunk( iff
, ID_BGUI
, ID_FORM
, IFFSIZE_UNKNOWN
);
127 objecttags
= CloneTagList(
128 FRM_DefaultType
, grp_frmtype
,
129 FRM_Recessed
, grp_recessed
,
130 GROUP_DefVSpaceNarrow
, grp_vspnarrow
,
131 GROUP_DefHSpaceNarrow
, grp_hspnarrow
,
132 GROUP_DefVSpaceNormal
, grp_vspnormal
,
133 GROUP_DefHSpaceNormal
, grp_hspnormal
,
134 GROUP_DefVSpaceWide
, grp_vspwide
,
135 GROUP_DefHSpaceWide
, grp_hspwide
,
138 SaveTagList( iff
, BGUI_GROUP_GADGET
, objecttags
);
141 objecttags
= CloneTagList(
142 FRM_Type
, but_frmtype
,
143 FRM_Recessed
, but_recessed
,
146 SaveTagList( iff
, BGUI_BUTTON_GADGET
, objecttags
);
149 objecttags
= CloneTagList(
150 FRM_Type
, str_frmtype
,
151 FRM_Recessed
, str_recessed
,
154 SaveTagList( iff
, BGUI_STRING_GADGET
, objecttags
);
157 objecttags
= CloneTagList(
158 FRM_Type
, chk_frmtype
,
159 FRM_Recessed
, chk_recessed
,
162 SaveTagList( iff
, BGUI_CHECKBOX_GADGET
, objecttags
);
165 objecttags
= CloneTagList(
166 FRM_Type
, cyc_frmtype
,
167 FRM_Recessed
, cyc_recessed
,
168 CYC_PopActive
, cyc_popactive
,
169 CYC_Popup
, cyc_popup
,
172 SaveTagList( iff
, BGUI_CYCLE_GADGET
, objecttags
);
175 objecttags
= CloneTagList(
176 FRM_DefaultType
, inf_frmtype
,
177 FRM_Recessed
, inf_recessed
,
180 SaveTagList( iff
, BGUI_INFO_GADGET
, objecttags
);
183 objecttags
= CloneTagList(
184 FRM_Type
, prg_frmtype
,
185 FRM_Recessed
, prg_recessed
,
188 SaveTagList( iff
, BGUI_PROGRESS_GADGET
, objecttags
);
191 objecttags
= CloneTagList(
192 FRM_DefaultType
, ind_frmtype
,
193 FRM_Recessed
, ind_recessed
,
196 SaveTagList( iff
, BGUI_INDICATOR_GADGET
, objecttags
);
201 Close( iff
->iff_Stream
);
205 CurrentDir( olddir
);