DEFINITION FOR C MODULE Prefs ;

(*  CountryPrefs &  PrinterPSPrefs suffer from array bugs!!		*)
(*  also LocalePrefs depends on country prefs , so needs to be checked  *)

FROM SYSTEM	IMPORT ADDRESS, LONGSET, SHORTSET, MAKEID ;
FROM Timer	IMPORT TimeVal ;
FROM Graphics	IMPORT Point, TextAttr, Rectangle ;
FROM Intuition	IMPORT ColorSpec ;

TYPE
  FontPrefsPtr		= POINTER TO FontPrefs ;
  IControlPrefsPtr	= POINTER TO IControlPrefs ;
  InputPrefsPtr		= POINTER TO InputPrefs ;
  CountryPrefsPtr	= POINTER TO CountryPrefs ;
  LocalePrefsPtr	= POINTER TO LocalePrefs ;
  OverscanPrefsPtr	= POINTER TO OverscanPrefs ;
  PalettePrefsPtr	= POINTER TO PalettePrefs ;
  PointerPrefsPtr	= POINTER TO PointerPrefs ;
  RGBTablePtr		= POINTER TO RGBTable ;
  PrefHeaderPtr		= POINTER TO PrefHeader ;
  PrinterGfxPrefsPtr	= POINTER TO PrinterGfxPrefs ;
  PrinterPSPrefsPtr	= POINTER TO PrinterPSPrefs ;
  PrinterTxtPrefsPtr	= POINTER TO PrinterTxtPrefs ;
  PrinterUnitPrefsPtr	= POINTER TO PrinterUnitPrefs ;
  ScreenModePrefsPtr	= POINTER TO ScreenModePrefs ;
  SerialPrefsPtr	= POINTER TO SerialPrefs ;
  SoundPrefsPtr		= POINTER TO SoundPrefs ;
  WBPatternPrefsPtr	= POINTER TO WBPatternPrefs ;

(******************************************************************************)
(*									      *)
(* 			File format for font preferences 		      *)
(*									      *)
(******************************************************************************)

CONST
  ID_FONT = MAKEID("FONT") ;

  FONTNAMESIZE	= 128 ;

TYPE
  FontPrefs = RECORD
    fp_Reserved	 : ARRAY [0..2] OF LONGINT ;
    fp_Reserved2 : CARDINAL ;
    fp_Type	 : BITSET ;
    fp_FrontPen	 : SHORTCARD ;
    fp_BackPen	 : SHORTCARD ;
    fp_DrawMode  : SHORTSET ;
    fp_TextAttr  : TextAttr ;
    fp_Name	 : ARRAY [0..FONTNAMESIZE-1] OF CHAR ;
  END ;


(* constants for FontPrefs.fp_Type *)
CONST
  FP_WBFONT     = 0 ;
  FP_SYSFONT    = 1 ;
  FP_SCREENFONT = 2 ;

(* File format for intuition control preferences *)

CONST
  ID_ICTL = MAKEID("ICTL") ;

TYPE
  IControlPrefs = RECORD
    ic_Reserved	   : ARRAY [0..3] OF LONGINT ;
    				 (* System reserved		*)
    ic_TimeOut	   : CARDINAL  ; (* Verify timeout		*)
    ic_MetaDrag	   : INTEGER   ; (* Meta drag mouse event	*)
    ic_Flags	   : LONGSET   ; (* IControl flags (see below)	*)
    ic_WBtoFront   : SHORTCARD ; (* CKey: WB to front		*)
    ic_FrontToBack : SHORTCARD ; (* CKey: front screen to back	*)
    ic_ReqTrue	   : SHORTCARD ; (* CKey: Requester TRUE	*)
    ic_ReqFalse	   : SHORTCARD ; (* CKey: Requester FALSE	*)
  END ;

(* flags for IControlPrefs.ic_Flags *)
CONST
  ICB_COERCE_COLORS = 0 ;
  ICB_COERCE_LACE   = 1 ;
  ICB_STRGAD_FILTER = 2 ;
  ICB_MENUSNAP	    = 3 ;
  ICB_MODEPROMOTE   = 4 ;

  ICF_COERCE_COLORS = {0} ;
  ICF_COERCE_LACE   = {1} ;
  ICF_STRGAD_FILTER = {2} ;
  ICF_MENUSNAP	    = {3} ;
  ICF_MODEPROMOTE   = {4} ;


(******************************************************************************)
(*									      *)
(*			File format for input preferences		      *)
(*									      *)
(******************************************************************************)

CONST
  ID_INPT = MAKEID("INPT") ;


TYPE
  InputPrefs = RECORD
    ip_Keymap	    : ARRAY [0..15] OF CHAR ;
    ip_PointerTicks : CARDINAL ;
    ip_DoubleClick  : TimeVal ;
    ip_KeyRptDelay  : TimeVal ;
    ip_KeyRptSpeed  : TimeVal ;
    ip_MouseAccel   : INTEGER ;
  END ;


(******************************************************************************)
(*									      *)
(*			File format for locale preferences		      *)
(*									      *)
(******************************************************************************)


CONST
  ID_LCLE = MAKEID("LCLE") ;
  ID_CTRY = MAKEID("CTRY") ;


TYPE
  CountryPrefs = RECORD
    cp_Reserved			: ARRAY [0..3] OF LONGINT ;
    cp_CountryCode		: LONGINT ;
    cp_TelephoneCode		: LONGINT ;
    cp_MeasuringSystem		: SHORTCARD ;

    cp_DateTimeFormat		: ARRAY [0..79] OF CHAR ;
    cp_DateFormat		: ARRAY [0..39] OF CHAR ;
    cp_TimeFormat		: ARRAY [0..39] OF CHAR ;

    cp_ShortDateTimeFormat 	: ARRAY [0..79] OF CHAR ;
    cp_ShortDateFormat		: ARRAY [0..39] OF CHAR ;
    cp_ShortTimeFormat		: ARRAY [0..39] OF CHAR ;

    (* for numeric values *)
    cp_DecimalPoint		: ARRAY [0..9] OF CHAR ;
    cp_GroupSeparator		: ARRAY [0..9] OF CHAR ;
    cp_FracGroupSeparator 	: ARRAY [0..9] OF CHAR ;
    cp_Grouping			: ARRAY [0..9] OF CHAR ;
    cp_FracGrouping 		: ARRAY [0..9] OF CHAR ;

    (* for monetary values *)
    cp_MonDecimalPoint		: ARRAY [0..9] OF CHAR ;
    cp_MonGroupSeparator 	: ARRAY [0..9] OF CHAR ;
    cp_MonFracGroupSeparator 	: ARRAY [0..9] OF CHAR ;
    cp_MonGrouping		: ARRAY [0..9] OF SHORTCARD ;
    cp_MonFracGrouping		: ARRAY [0..9] OF SHORTCARD ;
    cp_MonFracDigits		: SHORTCARD ;
    cp_MonIntFracDigits		: SHORTCARD ;

    (* for currency symbols *)
    cp_MonCS			: ARRAY [0..9] OF CHAR ;
    cp_MonSmallCS		: ARRAY [0..9] OF CHAR ;
    cp_MonIntCS			: ARRAY [0..9] OF CHAR ;

    (* for positive monetary values *)
    cp_MonPositiveSign		: ARRAY [0..9] OF CHAR ;
    cp_MonPositiveSpaceSep 	: SHORTCARD ;
    cp_MonPositiveSignPos 	: SHORTCARD ;
    cp_MonPositiveCSPos 	: SHORTCARD ;

    (* for negative monetary values *)
    cp_MonNegativeSign		: ARRAY [0..9] OF CHAR ;
    cp_MonNegativeSpaceSep 	: SHORTCARD ;
    cp_MonNegativeSignPos 	: SHORTCARD ;
    cp_MonNegativeCSPos 	: SHORTCARD ;

    cp_CalendarType 		: SHORTCARD ;
  END ;


TYPE
  LocalePrefs = RECORD
    lp_Reserved		  : ARRAY [0..03] OF LONGINT ;
    lp_CountryName	  : ARRAY [0..31] OF CHAR ;
    lp_PreferredLanguages : ARRAY [0..9],[0..29] OF CHAR ;
    lp_GMTOffset	  : LONGINT ;
    lp_Flags		  : LONGSET ;
    lp_CountryData	  : CountryPrefs ;
  END ;


(******************************************************************************)
(*									      *)
(*			File format for overscan preferences		      *)
(*									      *)
(******************************************************************************)

CONST
  ID_OSCN = MAKEID("OSCN") ;

  OSCAN_MAGIC  = 0FEDCBA89H ;


TYPE
  OverscanPrefs = RECORD
    os_Reserved  : LONGINT  ;
    os_Magic	 : LONGINT  ;
    os_HStart	 : CARDINAL ;
    os_HStop	 : CARDINAL ;
    os_VStart	 : CARDINAL ;
    os_VStop	 : CARDINAL ;
    os_DisplayID : LONGINT  ;
    os_ViewPos   : Point    ;
    os_Text	 : Point    ;
    os_Standard  : Rectangle;
  END ;

(* os_HStart, os_HStop, os_VStart, os_VStop can only be looked at if	*)
(* os_Magic equals OSCAN_MAGIC. If os_Magic is set to any other value,	*)
(* these four fields are undefined					*)



(******************************************************************************)
(*									      *)
(*			File format for palette preferences		      *)
(*									      *)
(******************************************************************************)

CONST
  ID_PALT = MAKEID("PALT") ;

TYPE
  PalettePrefs = RECORD
    pap_Reserved   : ARRAY [0..03] OF LONGINT   ; (* System reserved *)
    pap_4ColorPens : ARRAY [0..31] OF CARDINAL  ;
    pap_8ColorPens : ARRAY [0..31] OF CARDINAL  ;
    pap_Colors	   : ARRAY [0..31] OF ColorSpec ;
    			(* Used as full 16-bit RGB values *)
  END ;


(******************************************************************************)
(*									      *)
(*			File format for pointer preferences		      *)
(*									      *)
(******************************************************************************)

CONST
  ID_PNTR = MAKEID("PNTR") ;

TYPE
  PointerPrefs = RECORD
    pp_Reserved : ARRAY [0..3] OF LONGINT ;
    pp_Which    : CARDINAL ; (* 0=NORMAL, 1=BUSY		*)
    pp_Size     : CARDINAL ; (* see <intuition/pointerclass.h>  *)
    pp_Width    : CARDINAL ; (* Width in pixels			*)
    pp_Height   : CARDINAL ; (* Height in pixels		*)
    pp_Depth    : CARDINAL ; (* Depth				*)
    pp_YSize    : CARDINAL ; (* YSize				*)
    pp_X, pp_Y  : CARDINAL ; (* Hotspot				*)

    (* Color Table:  numEntries = (1 << pp_Depth) - 1 *)

    (* Data follows *)
  END ;

(* constants for PointerPrefs.pp_Which *)

CONST
  WBP_NORMAL	= 0 ;
  WBP_BUSY	= 1 ;

TYPE
  RGBTable = RECORD
    t_Red   : SHORTCARD ;
    t_Green : SHORTCARD ;
    t_Blue  : SHORTCARD ;
  END ;

(******************************************************************************)
(*									      *)
(*			File format for preferences header		      *)
(*									      *)
(******************************************************************************)

CONST
  ID_PREF = MAKEID("PREF") ;
  ID_PRHD = MAKEID("PRHD") ;


TYPE
  PrefHeader = RECORD
    ph_Version : SHORTCARD ; (* version of following data *)
    ph_Type    : SHORTCARD ; (* type of following data    *)
    ph_Flags   : LONGSET   ; (* always set to 0 for now   *)
  END ;


(******************************************************************************)
(*									      *)
(*		File format for graphics printer preferences		      *)
(*									      *)
(******************************************************************************)

CONST
  ID_PGFX = MAKEID("PGFX") ;


TYPE
  PrinterGfxPrefs = RECORD
    pg_Reserved		: ARRAY [0..3] OF LONGINT ;
    pg_Aspect		: CARDINAL ;
    pg_Shade		: CARDINAL ;
    pg_Image		: CARDINAL ;
    pg_Threshold	: INTEGER ;
    pg_ColorCorrect	: SHORTSET ;
    pg_Dimensions	: SHORTCARD  ;
    pg_Dithering	: SHORTCARD ;
    pg_GraphicFlags	: BITSET ;
    pg_PrintDensity	: SHORTCARD ;		(* Print density 1 - 7 *)
    pg_PrintMaxWidth	: CARDINAL ;
    pg_PrintMaxHeight	: CARDINAL ;
    pg_PrintXOffset	: SHORTCARD ;
    pg_PrintYOffset	: SHORTCARD ;
  END ;

(* constants for PrinterGfxPrefs.pg_Aspect *)
CONST
  PA_HORIZONTAL = 0 ;
  PA_VERTICAL   = 1 ;

(* constants for PrinterGfxPrefs.pg_Shade *)
  PS_BW		 = 0 ;
  PS_GREYSCALE	 = 1 ;
  PS_COLOR	 = 2 ;
  PS_GREY_SCALE2 = 3 ;

(* constants for PrinterGfxPrefs.pg_Image *)
  PI_POSITIVE = 0 ;
  PI_NEGATIVE = 1 ;

(* flags for PrinterGfxPrefs.pg_ColorCorrect *)
  PCCB_RED   = 1 ;	(* color correct red shades   *)
  PCCB_GREEN = 2 ;	(* color correct green shades *)
  PCCB_BLUE  = 3 ;	(* color correct blue shades  *)

  PCCF_RED   = {0} ;
  PCCF_GREEN = {1} ;
  PCCF_BLUE  = {2} ;

(* constants for PrinterGfxPrefs.pg_Dimensions *)
  PD_IGNORE   = 0 ;  (* ignore max width/height settings   *)
  PD_BOUNDED  = 1 ;  (* use max w/h as boundaries	   *)
  PD_ABSOLUTE = 2 ;  (* use max w/h as absolutes	   *)
  PD_PIXEL    = 3 ;  (* use max w/h as prt pixels	   *)
  PD_MULTIPLY = 4 ;  (* use max w/h as multipliers	   *)

(* constants for PrinterGfxPrefs.pg_Dithering *)
  PD_ORDERED	= 0 ;  (* ordered dithering		*)
  PD_HALFTONE	= 1 ;  (* halftone dithering		*)
  PD_FLOYD	= 2 ;  (* Floyd-Steinberg dithering	*)

(* flags for PrinterGfxPrefs.pg_GraphicsFlags *)
  PGFB_CENTER_IMAGE	= 0 ; (* center image on paper		*)
  PGFB_INTEGER_SCALING	= 1 ; (* force integer scaling		*)
  PGFB_ANTI_ALIAS	= 2 ; (* anti-alias image		*)

  PGFF_CENTER_IMAGE	= {0} ;
  PGFF_INTEGER_SCALING	= {1} ;
  PGFF_ANTI_ALIAS	= {2} ;


(******************************************************************************)
(*									      *)
(*		File format for PostScript printer preferences		      *)
(*									      *)
(******************************************************************************)

CONST
  ID_PSPD = MAKEID("PSPD") ;

TYPE
  PrinterPSPrefs = RECORD
    ps_Reserved		: ARRAY [0..3] OF LONGINT ;	(* System reserved *)

    (* Global printing attributes *)
    ps_DriverMode	: SHORTCARD ;
    ps_PaperFormat	: SHORTCARD ;
    ps_Reserved1	: ARRAY [0..1] OF SHORTCARD ;
    ps_Copies		: LONGINT ;
    ps_PaperWidth	: LONGINT ;
    ps_PaperHeight	: LONGINT ;
    ps_HorizontalDPI	: LONGINT ;
    ps_VerticalDPI	: LONGINT ;

    (* Text Options *)
    ps_Font		: SHORTCARD ;
    ps_Pitch		: SHORTCARD ;
    ps_Orientation	: SHORTCARD ;
    ps_Tab		: SHORTCARD ;
    ps_Reserved2	: ARRAY [0..7] OF SHORTCARD ;

    (* Text Dimensions *)
    ps_LeftMargin	: LONGINT ;
    ps_RightMargin	: LONGINT ;
    ps_TopMargin	: LONGINT ;
    ps_BottomMargin	: LONGINT ;
    ps_FontPointSize	: LONGINT ;
    ps_Leading		: LONGINT ;
    ps_Reserved3	: ARRAY [0..7] OF SHORTCARD ;

    (* Graphics Options *)
    ps_LeftEdge		: LONGINT ;
    ps_TopEdge		: LONGINT ;
    ps_Width		: LONGINT ;
    ps_Height		: LONGINT ;
    ps_Image		: SHORTCARD ;
    ps_Shading		: SHORTCARD ;
    ps_Dithering	: SHORTCARD ;
    ps_Reserved4	: ARRAY [0..8] OF SHORTCARD ;

    (* Graphics Scaling *)
    ps_Aspect		: SHORTCARD ;
    ps_ScalingType	: SHORTCARD ;
    ps_Reserved5	: SHORTCARD ;
    ps_Centering	: SHORTCARD ;
    ps_Reserved6	: ARRAY [0..7] OF SHORTCARD ;
  END ;

(* All measurements are in Millipoints which is 1/1000 of a point, or	*)
(* in other words 1/72000 of an inch					*)

(* constants for PrinterPSPrefs.ps_DriverMode *)
CONST
  DM_POSTSCRIPT    = 0 ;
  DM_PASSTHROUGH   = 1 ;

(* constants for PrinterPSPrefs.ps_PaperFormat *)
  PF_USLETTER	   = 0 ;
  PF_USLEGAL	   = 1 ;
  PF_A4		   = 2 ;
  PF_CUSTOM	   = 3 ;

(* constants for PrinterPSPrefs.ps_Font *)
  FONT_COURIER	   = 0 ;
  FONT_TIMES	   = 1 ;
  FONT_HELVETICA   = 2 ;
  FONT_HELV_NARROW = 3 ;
  FONT_AVANTGARDE  = 4 ;
  FONT_BOOKMAN	   = 5 ;
  FONT_NEWCENT	   = 6 ;
  FONT_PALATINO	   = 7 ;
  FONT_ZAPFCHANCERY= 8 ;

(* constants for PrinterPSPrefs.ps_Pitch *)
  PITCH_NORMAL	   = 0 ;
  PITCH_COMPRESSED = 1 ;
  PITCH_EXPANDED   = 2 ;

(* constants for PrinterPSPrefs.ps_Orientation *)
  ORIENT_PORTRAIT  = 0 ;
  ORIENT_LANDSCAPE = 1 ;

(* constants for PrinterPSPrefs.ps_Tab *)
  TAB_4		   = 0 ;
  TAB_8		   = 1 ;
  TAB_QUART	   = 2 ;
  TAB_HALF	   = 3 ;
  TAB_INCH	   = 4 ;

(* constants for PrinterPSPrefs.ps_Image *)
  IM_POSITIVE	   = 0 ;
  IM_NEGATIVE	   = 1 ;

(* constants for PrinterPSPrefs.ps_Shading *)
  SHAD_BW          = 0 ;
  SHAD_GREYSCALE   = 1 ;
  SHAD_COLOR       = 2 ;

(* constants for PrinterPSPrefs.ps_Dithering *)
  DITH_DEFAULT	   = 0 ;
  DITH_DOTTY	   = 1 ;
  DITH_VERT	   = 2 ;
  DITH_HORIZ	   = 3 ;
  DITH_DIAG	   = 4 ;

(* constants for PrinterPSPrefs.ps_Aspect *)
  ASP_HORIZ	   = 0 ;
  ASP_VERT	   = 1 ;

(* constants for PrinterPSPrefs.ps_ScalingType *)
  ST_ASPECT_ASIS   = 0 ;
  ST_ASPECT_WIDE   = 1 ;
  ST_ASPECT_TALL   = 2 ;
  ST_ASPECT_BOTH   = 3 ;
  ST_FITS_WIDE	   = 4 ;
  ST_FITS_TALL	   = 5 ;
  ST_FITS_BOTH	   = 6 ;

(* constants for PrinterPSPrefs.ps_Centering *)
  CENT_NONE	   = 0 ;
  CENT_HORIZ	   = 1 ;
  CENT_VERT	   = 2 ;
  CENT_BOTH	   = 3 ;


(*****************************************************************************)
(*									     *)
(*			File format for text printer preferences	     *)
(*									     *)
(*****************************************************************************)

CONST
  ID_PTXT = MAKEID("PTXT") ;
  ID_PUNT = MAKEID("PUNT") ;


  DRIVERNAMESIZE = 30 ;	(* Filename size     *)
  DEVICENAMESIZE = 32 ;	(* .device name size *)


TYPE
  PrinterTxtPrefs = RECORD
    pt_Reserved		: ARRAY [0..3] OF LONGINT ;
					(* System reserved		*)
    pt_Driver		: ARRAY [0..DRIVERNAMESIZE-1] OF CHAR ;
					(* printer driver filename      *)
    pt_Port		: SHORTCARD ;	(* printer port connection	*)

    pt_PaperType	: CARDINAL ;
    pt_PaperSize	: CARDINAL ;
    pt_PaperLength	: CARDINAL ;	(* Paper length in # of lines	*)

    pt_Pitch		: CARDINAL ;
    pt_Spacing		: CARDINAL ;
    pt_LeftMargin	: CARDINAL ;	(* Left margin			*)
    pt_RightMargin	: CARDINAL ;	(* Right margin			*)
    pt_Quality		: CARDINAL ;
  END ;

(* constants for PrinterTxtPrefs.pt_Port *)
CONST
  PP_PARALLEL	= 0 ;
  PP_SERIAL	= 1 ;

(* constants for PrinterTxtPrefs.pt_PaperType *)
  PT_FANFOLD	= 0 ;
  PT_SINGLE	= 1 ;

(* constants for PrinterTxtPrefs.pt_PaperSize *)
  PS_US_LETTER	=  0 ;
  PS_US_LEGAL	=  1 ;
  PS_N_TRACTOR	=  2 ;
  PS_W_TRACTOR	=  3 ;
  PS_CUSTOM	=  4 ;
  PS_EURO_A0	=  5 ;	(* European size A0: 841 x 1189 *)
  PS_EURO_A1	=  6 ;	(* European size A1: 594 x 841	*)
  PS_EURO_A2	=  7 ;	(* European size A2: 420 x 594	*)
  PS_EURO_A3	=  8 ;	(* European size A3: 297 x 420	*)
  PS_EURO_A4	=  9 ;	(* European size A4: 210 x 297	*)
  PS_EURO_A5	= 10 ;	(* European size A5: 148 x 210	*)
  PS_EURO_A6	= 11 ;	(* European size A6: 105 x 148	*)
  PS_EURO_A7	= 12 ;	(* European size A7: 74 x 105	*)
  PS_EURO_A8	= 13 ;	(* European size A8: 52 x 74	*)

(* constants for PrinterTxtPrefs.pt_PrintPitch *)
  PP_PICA	= 0 ;
  PP_ELITE	= 1 ;
  PP_FINE	= 2 ;

(* constants for PrinterTxtPrefs.pt_PrintSpacing *)
  PS_SIX_LPI  	= 0 ;
  PS_EIGHT_LPI	= 1 ;

(* constants for PrinterTxtPrefs.pt_PrintQuality *)
  PQ_DRAFT	= 0 ;
  PQ_LETTER	= 1 ;


TYPE
  PrinterUnitPrefs = RECORD
    pu_Reserved		: ARRAY [0..3] OF LONGINT ;
    				    (* System reserved		    *)
    pu_UnitNum		: LONGINT ; (* Unit number for OpenDevice() *)
    pu_OpenDeviceFlags	: LONGSET ; (* Flags for OpenDevice()	    *)
    pu_DeviceName	: ARRAY [0..DEVICENAMESIZE-1] OF CHAR ;
				    (* Name for OpenDevice()	    *)
  END ;


(******************************************************************************)
(*									      *)
(*		File format for screen mode preferences			      *)
(*									      *)
(******************************************************************************)

CONST
  ID_SCRM = MAKEID("SCRM") ;

TYPE
  ScreenModePrefs = RECORD
    smp_Reserved  : ARRAY [0..3] OF LONGINT ;
    smp_DisplayID : LONGINT  ;
    smp_Width	  : CARDINAL ;
    smp_Height	  : CARDINAL ;
    smp_Depth	  : CARDINAL ;
    smp_Control	  : BITSET   ;
  END ;

(* flags for ScreenModePrefs.smp_Control *)
CONST
  SMB_AUTOSCROLL =  1  ;
  SMF_AUTOSCROLL = {0} ;


(******************************************************************************)
(*									      *)
(*			File format for serial preferences		      *)
(*									      *)
(******************************************************************************)

CONST
  ID_SERL = MAKEID("SERL") ;

TYPE
  SerialPrefs = RECORD
    sp_Reserved		: ARRAY [0..2] OF LONGINT ;
    					(* System reserved		    *)
    sp_Unit0Map		: LONGINT ;	(* What unit 0 really refers to     *)
    sp_BaudRate		: LONGINT ;	(* Baud rate			    *)

    sp_InputBuffer	: LONGINT ;	(* Input buffer: 0 - 65536	    *)
    sp_OutputBuffer	: LONGINT ;	(* Future: Output: 0 - 65536	    *)

    sp_InputHandshake	: SHORTCARD ;	(* Input handshaking		    *)
    sp_OutputHandshake	: SHORTCARD ;	(* Future: Output handshaking	    *)

    sp_Parity		: SHORTCARD ;	(* Parity			    *)
    sp_BitsPerChar	: SHORTCARD ;	(* I/O bits per character	    *)
    sp_StopBits		: SHORTSET  ;	(* Stop bits			    *)
  END ;

(* constants for SerialPrefs.sp_Parity *)
CONST
  PARITY_NONE	= 0 ;
  PARITY_EVEN	= 1 ;
  PARITY_ODD	= 2 ;
  PARITY_MARK	= 3 ;		(* Future enhancement *)
  PARITY_SPACE	= 4 ;		(* Future enhancement *)

(* constants for SerialPrefs.sp_Input/OutputHandshaking *)
  HSHAKE_XON	= 0 ;
  HSHAKE_RTS	= 1 ;
  HSHAKE_NONE	= 2 ;


(******************************************************************************)
(*									      *)
(*			File format for sound preferences		      *)
(*									      *)
(******************************************************************************)

CONST
  ID_SOND = MAKEID("SOND") ;


TYPE
  SoundPrefs = RECORD
    sop_Reserved	: ARRAY [0..3] OF LONGINT ;
    					(* System reserved	      *)
    sop_DisplayQueue	: INTEGER ;	(* Flash the display?	      *)
    sop_AudioQueue	: INTEGER ;	(* Make some sound?	      *)
    sop_AudioType	: CARDINAL ;	(* Type of sound, see below   *)
    sop_AudioVolume	: CARDINAL ;	(* Volume of sound, 0..64     *)
    sop_AudioPeriod	: CARDINAL ;	(* Period of sound, 127..2500 *)
    sop_AudioDuration	: CARDINAL ;	(* Length of simple beep      *)
    sop_AudioFileName	: ARRAY [0..255] OF CHAR ;
    					(* Filename of 8SVX file      *)
  END ;


(* constants for SoundPrefs.sop_AudioType *)
CONST
  SPTYPE_BEEP	= 0 ;	(* simple beep sound *)
  SPTYPE_SAMPLE	= 1 ;	(* sampled sound     *)


(*****************************************************************************)
(*									     *)
(*			File format for wbpattern preferences		     *)
(*									     *)
(*****************************************************************************)

CONST
  ID_PTRN = MAKEID("PTRN") ;

TYPE
  WBPatternPrefs = RECORD
    wbp_Reserved	: ARRAY [0..3] OF LONGINT ;
    wbp_Which		: CARDINAL ; (* Which pattern is it	 *)
    wbp_Flags		: BITSET   ;
    wbp_Revision	: SHORTINT ; (* Must be set to zero	 *)
    wbp_Depth		: SHORTINT ; (* Depth of pattern	 *)
    wbp_DataLength	: CARDINAL ; (* Length of following data *)
  END ;

CONST
(* constants for WBPatternPrefs.wbp_Which *)
  WBP_ROOT	= 0 ;
  WBP_DRAWER	= 1 ;
  WBP_SCREEN	= 2 ;

(* wbp_Flags values *)

  WBPF_PATTERN	= {0} ;

(* Data contains a pattern *)

  WBPF_NOREMAP	= {4} ;
(* Don't remap the pattern *)

  MAXDEPTH	= 3 ;	(*  Max depth supported (8 colors) *)
  DEFPATDEPTH	= 2 ;	(*  Depth of default patterns	   *)

(*  Pattern width & height: *)
  PAT_WIDTH	= 16 ;
  PAT_HEIGHT	= 16 ;

END Prefs.
