use m4_normalize on the output strings to remove trailing spaces/tabs and consolidate...
[AROS.git] / workbench / c / iprefs / icontrolprefs.c
blob7949440a04ac3145ed464cda001d7eb99ef14776
1 /*
2 Copyright © 1995-2016, 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 LONG ic_Reserved[4];
27 UBYTE ic_TimeOut[2];
28 UBYTE ic_MetaDrag[2];
29 UBYTE ic_Flags[4];
30 UBYTE ic_WBtoFront;
31 UBYTE ic_FrontToBack;
32 UBYTE ic_ReqTrue;
33 UBYTE ic_ReqFalse;
34 UWORD ic_Reserved2;
35 UBYTE ic_VDragModes[2][2];
38 /*********************************************************************************************/
40 static LONG stopchunks[] =
42 ID_PREF, ID_ICTL
45 /*********************************************************************************************/
47 static void SetIControlPrefs(struct FileIControlPrefs *prefs)
49 struct IIControlPrefs i;
51 D(bug("[IcontrolPrefs_Handler: VDragModes: 0x%04X\n", prefs->ic_VDragModes[0][1]));
53 #define GETBYTE(x) i.ic_ ## x = prefs->ic_ ## x
54 #define GETWORD(x) i.ic_ ## x = ((prefs->ic_ ## x[0] << 8) + prefs->ic_ ## x[1])
55 #define GETLONG(x) i.ic_ ## x = ((prefs->ic_ ## x[0] << 24) + \
56 (prefs->ic_ ## x[1] << 16) + \
57 (prefs->ic_ ## x[2] << 8) + \
58 prefs->ic_ ## x[3])
60 GETWORD(TimeOut);
61 GETWORD(MetaDrag);
62 GETLONG(Flags);
63 GETBYTE(WBtoFront);
64 GETBYTE(FrontToBack);
65 GETBYTE(ReqTrue);
66 GETBYTE(ReqFalse);
67 GETWORD(VDragModes[0]);
69 SetIPrefs(&i, sizeof(i), IPREFS_TYPE_ICONTROL);
72 /*********************************************************************************************/
74 void IControlPrefs_Handler(STRPTR filename)
76 struct IFFHandle *iff;
78 D(bug("In IPrefs:IControlPrefs_Handler\n"));
80 if ((iff = CreateIFF(filename, stopchunks, 1)))
82 while(ParseIFF(iff, IFFPARSE_SCAN) == 0)
84 struct FileIControlPrefs *icontrolprefs;
86 icontrolprefs = LoadChunk(iff, 0, MEMF_ANY);
87 if (icontrolprefs) {
88 D(bug("IControlPrefs_Handler: ID_ICTL chunk successfully loaded.\n"));
89 SetIControlPrefs(icontrolprefs);
90 FreeVec(icontrolprefs);
93 } /* while(ParseIFF(iff, IFFPARSE_SCAN) == 0) */
95 KillIFF(iff);
97 } /* if ((iff = CreateIFF(filename))) */
100 D(bug("In IPrefs:IControlPrefs_Handler. Done.\n", filename));
103 /*********************************************************************************************/