PmPrefs.dcl 3.38 KB
Newer Older
Diederik van Arkel's avatar
Diederik van Arkel committed
1 2
definition module PmPrefs

3
// The IDE Preferences
Diederik van Arkel's avatar
Diederik van Arkel committed
4

5 6 7 8 9 10 11
from	StdPictureDef		import :: FontDef
import	StdFile, StdIOBasic
import	StdPathname
import	PmTypes
from	UtilStrictLists		import :: List
from	PmCompilerOptions	import :: CompilerOptions, :: ListTypes
from	EdMonad				import :: SyntaxColours, :: Colour
Diederik van Arkel's avatar
Diederik van Arkel committed
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71

PrefsFileName :== "IDEPrefs"

:: ErrPrefs =									// Error window preferences
	{ err_pos		:: !Vector2
	, err_siz		:: !Size
	, err_fname		:: !String
	, err_fsize		:: !Int
	, err_forc		:: !Colour
	, err_bacc		:: !Colour
	, err_err		:: !Bool
	, err_wrn		:: !Bool
	, err_inf		:: !Bool
	}

:: SrcPrefs =									// Search window preferences
	{ src_pos		:: !Vector2
	, src_siz		:: !Size
	, src_fname		:: !String
	, src_fsize		:: !Int
	, src_forc		:: !Colour
	, src_bacc		:: !Colour
	}	

:: TypPrefs =									// Types window preferences
	{ typewinfont	:: !FontDef
	, typewinpos	:: !Vector2
	, typewinsiz	:: !Size
	, typewinsync	:: !SyntaxColours
	}

:: ConPrefs =									// Console window preferences
	{ conswinfont	:: !FontDef
	, conswinpos	:: !Vector2
	, conswinsiz	:: !Size
	, conswinsync	:: !SyntaxColours
	}

:: PrjPrefs =									// Project preferences
	{ proj_pos		:: !Vector2					// Project window position
	, proj_siz		:: !Size					// Project window size
	, proj_topc		:: !Colour					// Colour settings for project window
	, proj_forc		:: !Colour
	, proj_bacc		:: !Colour
	, proj_font		:: !FontDef					// Font for project window
	, proj_shft		:: !Bool					// True: open dcl default; False: open icl default;
	}

:: Prefs =
	{ pmp_pth		:: !List Pathname
	, pmp_lnk		:: !List Pathname
	, pmp_obj		:: !List Pathname
	, typ_prefs		:: !TypPrefs
	, con_prefs		:: !ConPrefs
	, err_prefs		:: !ErrPrefs
	, src_prefs		:: !SrcPrefs
	, prj_prefs		:: !PrjPrefs

// want to set these per filetype...
	, edwinfont		:: !FontDef
72
	// FIXME use a record for these options
Diederik van Arkel's avatar
Diederik van Arkel committed
73
	, edwintabs		:: !(Int,Bool,Bool,Bool,Bool)	// tabsize, autotab, showtabs, showlinenos, showsyncol
74
	, edwinmargin	:: !Int							// right margin (in #characters), 0: no margin
Diederik van Arkel's avatar
Diederik van Arkel committed
75 76 77 78 79 80 81 82 83 84 85 86 87 88

	, compopts		:: !CompilerOptions
	, cgenopts		:: !CodeGenOptions
	, linkopts		:: !LinkOptions
	, applopts		:: !ApplicationOptions

	, syncols		:: !SyntaxColours				// default syntax colours
	, defcols		:: !SyntaxColours				// .dcl syntax colours
	, impcols		:: !SyntaxColours				// .icl syntax colours

	, proj_hist		:: !List Pathname				// project history
	, file_hist		:: !List Pathname				// file history
	, switch_close	:: !Bool						// close associated editor windows on project switch
	, show_toolbar	:: !Bool						// enable toolbar
Diederik van Arkel's avatar
Diederik van Arkel committed
89
//	, enable_prover	:: !Bool						// enable theorem prover
Diederik van Arkel's avatar
Diederik van Arkel committed
90 91 92
	, be_verbose	:: !Bool						// give extended diagnostics
	, altgr_workaround	:: !Bool					// temp fix to workaround french azerty keyboard menu shortcuts...
	, newline_handling	:: !NewlinePrefs
93 94 95 96 97
	
	, reg_prefs		:: !RegPrefs
	}

:: RegPrefs =
98
	{ rp_flags		:: ![(String,String)]
99 100 101 102 103 104 105 106 107
	// should use registry entries for the following instead of Prefs file...
	, tp_name		:: !String
	, tp_path		:: !String
	, hp_name		:: !String
	, hp_path		:: !String
	, pr_name		:: !String
	, pr_path		:: !String
	, ve_name		:: !String
	, ve_path		:: !String
Diederik van Arkel's avatar
Diederik van Arkel committed
108 109 110 111 112 113 114 115
	}

:: NewlinePrefs
	= LeaveAlone NewlineConvention	// leave alone existing files, use given convention for new files
	| AlwaysUse NewlineConvention	// always save with given newline convention

openPrefs :: !String !*a -> *(!Prefs,!*a) | FileEnv a
savePrefs :: !String Prefs *a -> *a | FileEnv a