Moved DejaVue fonts to contrib. They are only needed by applications
[AROS-Contrib.git] / bgui / Prefs / BGUIPrefs_iff.c
blobd45715e1867137ff809eeec8f3eddc2105f727d6
1 /*
2 * @(#) $Header$
4 * BGUI Prefs Editor
5 * BGUIPrefs_iff.c
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.
12 * $Log$
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 ];
32 // GROUP DEFAULTS
33 extern IPTR grp_frmtype,
34 grp_recessed,
35 grp_vspnarrow,
36 grp_hspnarrow,
37 grp_vspnormal,
38 grp_hspnormal,
39 grp_vspwide,
40 grp_hspwide,
42 // BUTTON DEFAULTS
43 but_frmtype,
44 but_recessed,
46 // STRING DEFAULTS
47 str_frmtype,
48 str_recessed,
50 // CHECKBOX DEFAULTS
51 chk_frmtype,
52 chk_recessed,
54 // CYCLE DEFAULTS
55 cyc_frmtype,
56 cyc_recessed,
57 cyc_popup,
58 cyc_popactive,
60 // INFO DEFAULTS
61 inf_frmtype,
62 inf_recessed,
64 // PROGRESS DEFAULTS
65 prg_frmtype,
66 prg_recessed,
68 // INDICATOR DEFAULTS
69 ind_frmtype,
70 ind_recessed;
73 struct TagItem *
74 CloneTagList( Tag t, ... )
76 AROS_SLOWSTACKTAGS_PRE_AS(t, struct TagItem *)
77 retval = CloneTagItems(AROS_SLOWSTACKTAGS_ARG(t));
78 AROS_SLOWSTACKTAGS_POST
82 void
83 SaveTagList( struct IFFHandle *iff, ULONG type, struct TagItem *tags )
85 struct TagItem *tag;
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 ) );
99 PopChunk( iff );
104 void
105 SaveBGUIPrefs( char *dirname, char *name )
107 BPTR dir,
108 olddir;
109 struct IFFHandle *iff;
110 struct TagItem *objecttags = NULL;
112 dir = Lock( dirname, ACCESS_READ );
114 if( !dir ) dir = CreateDir( dirname );
116 if( dir ) {
118 olddir = CurrentDir( dir );
120 if(( iff = AllocIFF() )) {
122 if(( iff->iff_Stream = (IPTR)Open( name, MODE_NEWFILE ) )) {
124 InitIFFasDOS( iff );
125 if( OpenIFF( iff, IFFF_WRITE ) == 0 ) {
127 PushChunk( iff, ID_BGUI, ID_FORM, IFFSIZE_UNKNOWN );
129 // GROUP
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,
139 TAG_DONE
141 SaveTagList( iff, BGUI_GROUP_GADGET, objecttags );
143 // BUTTON
144 objecttags = CloneTagList(
145 FRM_Type, but_frmtype,
146 FRM_Recessed, but_recessed,
147 TAG_DONE
149 SaveTagList( iff, BGUI_BUTTON_GADGET, objecttags );
151 // STRING
152 objecttags = CloneTagList(
153 FRM_Type, str_frmtype,
154 FRM_Recessed, str_recessed,
155 TAG_DONE
157 SaveTagList( iff, BGUI_STRING_GADGET, objecttags );
159 // CHECKBOX
160 objecttags = CloneTagList(
161 FRM_Type, chk_frmtype,
162 FRM_Recessed, chk_recessed,
163 TAG_DONE
165 SaveTagList( iff, BGUI_CHECKBOX_GADGET, objecttags );
167 // CYCLE
168 objecttags = CloneTagList(
169 FRM_Type, cyc_frmtype,
170 FRM_Recessed, cyc_recessed,
171 CYC_PopActive, cyc_popactive,
172 CYC_Popup, cyc_popup,
173 TAG_DONE
175 SaveTagList( iff, BGUI_CYCLE_GADGET, objecttags );
177 // INFO
178 objecttags = CloneTagList(
179 FRM_DefaultType, inf_frmtype,
180 FRM_Recessed, inf_recessed,
181 TAG_DONE
183 SaveTagList( iff, BGUI_INFO_GADGET, objecttags );
185 // PROGRESS
186 objecttags = CloneTagList(
187 FRM_Type, prg_frmtype,
188 FRM_Recessed, prg_recessed,
189 TAG_DONE
191 SaveTagList( iff, BGUI_PROGRESS_GADGET, objecttags );
193 // INDICATOR
194 objecttags = CloneTagList(
195 FRM_DefaultType, ind_frmtype,
196 FRM_Recessed, ind_recessed,
197 TAG_DONE
199 SaveTagList( iff, BGUI_INDICATOR_GADGET, objecttags );
201 PopChunk( iff );
202 CloseIFF( iff );
204 Close( (BPTR)iff->iff_Stream );
206 FreeIFF( iff );
208 CurrentDir( olddir );
209 UnLock( dir );