Updated PCI IDs to latest snapshot.
[tangerine.git] / workbench / c / iprefs / icontrolprefs.c
blob621c89c56903e94391fe2a9246019a3fd3adab34
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: English
7 */
9 /*********************************************************************************************/
11 #include "global.h"
13 #include <prefs/prefhdr.h>
14 #include <prefs/icontrol.h>
15 #include <intuition/iprefs.h>
17 #include <string.h>
19 #define DEBUG 0
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];
30 UBYTE ic_TimeOut[2];
31 UBYTE ic_MetaDrag[2];
32 UBYTE ic_Flags[4];
33 UBYTE ic_WBtoFront;
34 UBYTE ic_FrontToBack;
35 UBYTE ic_ReqTrue;
36 UBYTE ic_ReqFalse;
39 /*********************************************************************************************/
41 static LONG stopchunks[] =
43 ID_PREF, ID_ICTL
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) + \
57 prefs->ic_ ## x[3])
59 GETWORD(TimeOut);
60 GETWORD(MetaDrag);
61 GETLONG(Flags);
62 GETBYTE(WBtoFront);
63 GETBYTE(FrontToBack);
64 GETBYTE(ReqTrue);
65 GETBYTE(ReqFalse);
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",
88 cn->cn_Type >> 24,
89 cn->cn_Type >> 16,
90 cn->cn_Type >> 8,
91 cn->cn_Type,
92 cn->cn_ID >> 24,
93 cn->cn_ID >> 16,
94 cn->cn_ID >> 8,
95 cn->cn_ID));
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) */
111 KillIFF(iff);
113 } /* if ((iff = CreateIFF(filename))) */
116 D(bug("In IPrefs:IControlPrefs_Handler. Done.\n", filename));
119 /*********************************************************************************************/