2 Copyright © 1995-2012, The AROS Development Team. All rights reserved.
9 /*********************************************************************************************/
14 #include <aros/debug.h>
15 #include <aros/macros.h>
16 #include <datatypes/pictureclass.h>
17 #include <prefs/prefhdr.h>
18 #include <prefs/printertxt.h>
19 #include <prefs/printergfx.h>
21 #include <intuition/iprefs.h>
22 #include <proto/datatypes.h>
24 /*********************************************************************************************/
26 static LONG stopchunks
[] =
32 void PrinterPrefs_Handler(STRPTR filename
)
34 struct IFFHandle
*iff
;
35 struct PrinterTxtPrefs
*ptp
;
36 struct PrinterGfxPrefs
*pgp
;
38 D(bug("[PrinterPrefs] filename=%s\n",filename
));
40 iff
= CreateIFF(filename
, stopchunks
, 2);
43 struct Preferences prefs
;
44 GetPrefs(&prefs
, sizeof(prefs
));
46 while(ParseIFF(iff
, IFFPARSE_SCAN
) == 0)
48 struct ContextNode
*cn
= CurrentChunk(iff
);
52 ptp
= LoadChunk(iff
, sizeof(struct PrinterTxtPrefs
), MEMF_ANY
);
55 strncpy(prefs
.PrtDevName
, ptp
->pt_Driver
, DRIVERNAMESIZE
);
56 prefs
.PrinterPort
= ptp
->pt_Port
;
57 prefs
.PaperType
= AROS_BE2WORD(ptp
->pt_PaperType
);
58 prefs
.PaperSize
= AROS_BE2WORD(ptp
->pt_PaperSize
);
59 prefs
.PaperLength
= AROS_BE2WORD(ptp
->pt_PaperLength
);
60 prefs
.PrintPitch
= AROS_BE2WORD(ptp
->pt_Pitch
);
61 prefs
.PrintSpacing
= AROS_BE2WORD(ptp
->pt_Spacing
);
62 prefs
.PrintLeftMargin
= AROS_BE2WORD(ptp
->pt_LeftMargin
);
63 prefs
.PrintRightMargin
= AROS_BE2WORD(ptp
->pt_RightMargin
);
64 prefs
.PrintQuality
= AROS_BE2WORD(ptp
->pt_Quality
);
70 pgp
= LoadChunk(iff
, sizeof(struct PrinterGfxPrefs
), MEMF_ANY
);
73 prefs
.PrintAspect
= AROS_BE2WORD(pgp
->pg_Aspect
);
74 prefs
.PrintShade
= AROS_BE2WORD(pgp
->pg_Shade
);
75 prefs
.PrintImage
= AROS_BE2WORD(pgp
->pg_Image
);
76 prefs
.PrintThreshold
= AROS_BE2WORD(pgp
->pg_Threshold
);
77 //prefs.ColorCorrect = pgp->pg_ColorCorrect;
78 //prefs.Dimensions = pgp->pg_Dimensions;
79 //prefs.Dithering = pgp->pg_Dithering;
80 //prefs.GraphicFlags = AROS_BE2WORD(pgp->pg_GraphicFlags);
81 prefs
.PrintDensity
= pgp
->pg_PrintDensity
;
82 prefs
.PrintMaxWidth
= AROS_BE2WORD(pgp
->pg_PrintMaxWidth
);
83 prefs
.PrintMaxHeight
= AROS_BE2WORD(pgp
->pg_PrintMaxHeight
);
84 prefs
.PrintXOffset
= pgp
->pg_PrintXOffset
;
85 //prefs.PrintYOffset = pgp->pg_PrintYOffset;
93 SetPrefs(&prefs
, sizeof(prefs
), TRUE
);