2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
9 /*********************************************************************************************/
13 #include <prefs/prefhdr.h>
14 #include <prefs/icontrol.h>
15 #include <intuition/iprefs.h>
20 #include <aros/debug.h>
22 /*********************************************************************************************/
24 struct FileIControlPrefs
26 UBYTE ic_Reserved0
[4];
27 UBYTE ic_Reserved1
[4];
28 UBYTE ic_Reserved2
[4];
29 UBYTE ic_Reserved3
[4];
39 /*********************************************************************************************/
41 static LONG stopchunks
[] =
46 /*********************************************************************************************/
48 static void SetIControlPrefs(struct FileIControlPrefs
*prefs
)
50 struct IIControlPrefs i
;
52 #define GETBYTE(x) i.ic_ ## x = prefs->ic_ ## x
53 #define GETWORD(x) i.ic_ ## x = ((prefs->ic_ ## x[0] << 8) + prefs->ic_ ## x[1])
54 #define GETLONG(x) i.ic_ ## x = ((prefs->ic_ ## x[0] << 24) + \
55 (prefs->ic_ ## x[1] << 16) + \
56 (prefs->ic_ ## x[2] << 8) + \
67 SetIPrefs(&i
, sizeof(i
), IPREFS_TYPE_ICONTROL
);
70 /*********************************************************************************************/
72 void IControlPrefs_Handler(STRPTR filename
)
74 struct IFFHandle
*iff
;
76 D(bug("In IPrefs:IControlPrefs_Handler\n"));
78 if ((iff
= CreateIFF(filename
, stopchunks
, 1)))
80 while(ParseIFF(iff
, IFFPARSE_SCAN
) == 0)
82 struct ContextNode
*cn
;
83 struct FileIControlPrefs icontrolprefs
;
85 cn
= CurrentChunk(iff
);
87 D(bug("IControlPrefs_Handler: ParseIFF okay. Chunk Type = %c%c%c%c ChunkID = %c%c%c%c\n",
97 if ((cn
->cn_ID
== ID_ICTL
) && (cn
->cn_Size
== sizeof(icontrolprefs
)))
99 D(bug("IControlPrefs_Handler: ID_ICTL chunk with correct size found.\n"));
101 if (ReadChunkBytes(iff
, &icontrolprefs
, sizeof(icontrolprefs
)) == sizeof(icontrolprefs
))
103 SetIControlPrefs(&icontrolprefs
);
105 } /* if (ReadChunkBytes(iff, &icontrolprefs, sizeof(icontrolprefs)) == sizeof(icontrolprefs)) */
107 } /* if ((cn->cn_ID == ID_INPT) && (cn->cn_Size == sizeof(icontrolprefs))) */
109 } /* while(ParseIFF(iff, IFFPARSE_SCAN) == 0) */
113 } /* if ((iff = CreateIFF(filename))) */
116 D(bug("In IPrefs:IControlPrefs_Handler. Done.\n", filename
));
119 /*********************************************************************************************/