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

3 4 5 6 7 8 9 10 11 12 13
import	StdPSt, StdPrint
import	ExtListBox, FilteredListBox
import	fbi, clipboard, typewin
import	EdState
import	PmProject
import	PmPrefs
import	flextextcontrol
from	PmAbcMagic	import :: ABCCache
from	PmFileInfo	import :: FileInfoCache
import	PmEnvironment
import	conswin
14
from PmCleanSystem import ::CompilerProcessIds
Diederik van Arkel's avatar
Diederik van Arkel committed
15

16
from iostate import ioStGetWorld,ioStSetWorld
17 18 19 20 21 22 23 24 25

app_world_instead_of_ps f ps
	:== appPIO app_world_instead_of_io ps
where
	app_world_instead_of_io io
		# (w,io) = ioStGetWorld io
		# w = f w
		= ioStSetWorld w io

Camil Staps's avatar
Camil Staps committed
26 27 28 29 30 31 32 33
acc_world_instead_of_ps f ps
	:== accPIO acc_world_instead_of_io ps
where
	acc_world_instead_of_io io
		# (w,io) = ioStGetWorld io
		# (x,w) = f w
		= (x,ioStSetWorld w io)

Diederik van Arkel's avatar
Diederik van Arkel committed
34 35 36 37 38 39 40 41 42
:: *General

instance Editor		General		// Editor
instance Clipper	General		// Clipboard
instance Typer		General		// Types
instance Consoler	General		// Console

getProject :: !*(PSt *General) -> (Project,*PSt *General)
setProject :: !Project !*(PSt *General) -> *PSt *General
43
appProject :: (Project -> Project) !*(PSt *General) -> *PSt *General
44
getFromProject :: (Project -> .a) !*(PSt *General) -> (!.a,!*PSt *General)
Diederik van Arkel's avatar
Diederik van Arkel committed
45

46 47 48
getCompilerProcessIds :: !*(PSt *General) -> (!CompilerProcessIds,!*(PSt *General))
setCompilerProcessIds :: !CompilerProcessIds !*(PSt *General) -> *(PSt *General)

Diederik van Arkel's avatar
Diederik van Arkel committed
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
:: EditMenuLS l =	// local state for the Edit menu
	{ zfun :: (PSt l) -> PSt l	// undo-function
	, xfun :: (PSt l) -> PSt l	// cut-function
	, cfun :: (PSt l) -> PSt l	// copy-function
	, vfun :: (PSt l) -> PSt l	// paste-function
	}

:: MIn l = MGet | MSet (EditMenuLS l)	// message type for the Edit menu

:: ErrorInfo p =
	{ errorId		:: !Id
	, infoId		:: !FilteredListBoxId 	// id for w&e listbox
	, err_offset	:: !Vector2				// errwin offset
	, err_font		:: !Font				// errwin font
	, err_size		:: !Size				// errwin listbox size
	, err_forg		:: !Colour				// errwin listbox text colour
	, err_back		:: !Colour				// errwin listbox background colour
	, err_buttonId	:: !Id
	, err_countId	:: !Id
	, err_count		:: !Int
	, err			:: !Bool
	, wrn_buttonId	:: !Id
	, wrn_countId	:: !Id
	, wrn_count		:: !Int
	, wrn			:: !Bool
	, inf_buttonId	:: !Id
	, inf_countId	:: !Id
	, inf_count		:: !Int
	, inf			:: !Bool
	}

:: FindInfo =
	{ fi_find	:: ![String]		// find...
	, fi_repl	:: ![String]		// replace by
	, fi_ic		:: !Bool			// ignore case
	, fi_wa		:: !Bool			// wrap around
	, fi_bw		:: !Bool			// backward
	, fi_mw		:: !Bool			// match words
	, fi_re		:: !Bool			// temp: use regexp
	}

:: MenuIds =
	{ mn_sav	:: !Id											// File:Save id
	, mn_sva	:: !Id											// File:Save As id
	, mn_rev	:: !Id											// File:Revert id
	, mn_clo	:: !Id											// File:Close id
	, mn_oth	:: !Id											// File:Open Other id
	, mn_odm	:: !Id											// File:Open Definition id
	, mn_oim	:: !Id											// File:Open Implementation id
	, mn_prt	:: !Id											// File:Print id
	, mn_prs	:: !Id											// File:PrintSetup id
	, mn_und	:: !Id											// Edit:Undo id
	, mn_cut	:: !Id											// Edit:Cut id
	, mn_cpy	:: !Id											// Edit:Copy id
	, mn_pst	:: !Id											// Edit:Paste id
	, mn_clr	:: !Id											// Edit:Clear id
	, mg_edt	:: ![Id]										// Edit:tools ids
	, searchIds	:: !SearchMenuIds								// Search: ids
	, pm_menuid	:: !Id											// id of project menu
	, projIds	:: ![Id]										// Project: ids for disabling when no project...
	, pm_listid	:: !Id											// id of project list (in project menu)
	, pm_mrecid :: !R2Id PLMMessage PLMReply					// id of project menu receiver
	, ed_mrecid :: !R2Id (MIn *General) (EditMenuLS *General)	// id of edit menu receiver
	, fh_rid	:: !R2Id String [String]						// file history id
	, ph_rid	:: !R2Id String [String]						// project history id
	, moduleIds	:: ![Id]										// ids in module menu
	, md_cmp	:: !Id											// Module:Compile
	, md_chk	:: !Id											// Module:Check syntax
	, md_gen	:: !Id											// Module:Generate assembly
	, md_cst	:: !Id											// Module:Compiler settings
	, md_est	:: !Id											// Module:Editor settings
	}

:: SearchMenuIds =
	{ srchIds	:: ![Id]
	, findIds	:: ![Id]
	, gotoIds	:: ![Id]
	, nextIds	:: ![Id]
	}

//---

131
iniGeneral :: !Prefs !.Pathname
132
				Bool *File
133 134
				!Id !Id !.(ExtListBoxId *(PSt *General)) !EditorState !.FindInfo 
				!.(FindBoxInfo *(PSt *General)) !Id !Id !TypeWinInfo !ConsWinInfo !.[.Target] !Id !Id !(R2Id PLMMessage PLMReply) !*World//*env
Diederik van Arkel's avatar
Diederik van Arkel committed
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177
				-> *(!ClipInfo,!*General,!*World)

//---

getEditRecId :: !*(PSt *General) -> *(R2Id (MIn *General) (EditMenuLS *General),*PSt *General)

getABCCache :: !*(PSt *General) -> (*ABCCache,*PSt *General)
setABCCache :: !*ABCCache !*(PSt *General) -> *PSt *General

getFICache :: !*(PSt *General) -> (FileInfoCache,*PSt *General)
setFICache :: !FileInfoCache !*(PSt *General) -> *PSt *General

getCallback :: !*(PSt *General) -> *(.Bool -> *(PSt *General) -> *(PSt *General),*PSt *General);
setCallback :: (Bool -> *(PSt *General) -> *(PSt *General)) !*(PSt *General) -> *PSt *General;

getFHI :: !*(PSt *General) -> (R2Id String [String],*PSt *General)
getPHI :: !*(PSt *General) -> (R2Id String [String],*PSt *General)

getMenuIds :: !*(PSt *General) -> (MenuIds,*PSt *General)
setModuleIds :: ![Id] !*(PSt *General) -> *PSt *General

setPrefs :: Prefs !*(PSt *General) -> *PSt *General
getPrefs :: !*(PSt *General) -> (Prefs,*PSt *General)

//-- project menu stuff

getPMI :: !*(PSt *General) -> ((Id,Id),*PSt *General)

:: PLMMessage
	= Add {#Char}
	| Rem {#Char}
	| Get

:: PLMReply
	:== [{#Char}]

getPMR :: !*(PSt *General) -> (R2Id PLMMessage PLMReply,*PSt *General)

//-- environment menu stuff

getTargetIds :: !*(PSt *General) -> ((!Id,!Id),!*PSt *General)

getTargets :: !*(PSt *General) -> (![Target],!*PSt *General)
178
setTargets :: ![Target] !*(PSt *General) -> *PSt *General
Diederik van Arkel's avatar
Diederik van Arkel committed
179 180

getCurrentTarget :: !*(PSt *General) -> (!Int,!*PSt *General)
181
setCurrentTarget :: !Int !*(PSt *General) -> *PSt *General
Diederik van Arkel's avatar
Diederik van Arkel committed
182 183 184 185 186 187 188 189

getCurrentPaths :: !*(PSt *General) -> (!(List Pathname),!*PSt *General)
getCurrentDlibs :: !*(PSt *General) -> (!(List String),!*PSt *General)
getCurrentSlibs :: !*(PSt *General) -> (!(List String),!*PSt *General)
getCurrentObjts :: !*(PSt *General) -> (!(List String),!*PSt *General)

getCurrentComp :: !*(PSt *General) -> (!String,!*PSt *General)
getCurrentCgen :: !*(PSt *General) -> (!String,!*PSt *General)
190 191 192
getCurrentAbcOpt :: !*(PSt *General) -> (!String,!*PSt *General)
getCurrentBCgen :: !*(PSt *General) -> (!String,!*PSt *General)
getCurrentBClink :: !*(PSt *General) -> (!String,!*PSt *General)
193
getCurrentBCstrip :: !*(PSt *General) -> (!String,!*PSt *General)
Diederik van Arkel's avatar
Diederik van Arkel committed
194 195 196 197
getCurrentLink :: !*(PSt *General) -> (!String,!*PSt *General)
getCurrentDynl :: !*(PSt *General) -> (!String,!*PSt *General)
getCurrentVers :: !*(PSt *General) -> (!Int,!*PSt *General)
getCurrentRedc :: !*(PSt *General) -> (!Bool,!*PSt *General)
198
getCurrent64BitProcessor :: !*(PSt *General) -> (!Bool,!*PSt *General)
199
getCurrentProc :: !*(PSt *General) -> (!Processor,!*PSt *General)
Diederik van Arkel's avatar
Diederik van Arkel committed
200 201 202 203
getCurrentMeth :: !*(PSt *General) -> (!CompileMethod,!*PSt *General)

//-- error window stuff

204
setErrInfo :: !(ErrorInfo (PSt *General)) !*(PSt *General) -> *PSt *General
Diederik van Arkel's avatar
Diederik van Arkel committed
205 206 207 208 209
getErrInfo :: !*(PSt *General) -> (!ErrorInfo (PSt *General),!*PSt *General)

//-- project window stuff

getPWI :: !*(PSt *General) -> (!ExtListBoxId (PSt General),!*PSt *General)
210
setPWI :: !(ExtListBoxId (PSt General)) !*(PSt *General) -> *PSt *General
Diederik van Arkel's avatar
Diederik van Arkel committed
211 212 213 214 215 216 217
getPWW :: !*(PSt *General) -> (!Id,!*PSt *General)
getPWX :: !*(PSt *General) -> (!FlexId,!*PSt *General)
getPWM :: !*(PSt *General) -> (!FlexId,!*PSt *General)

//-- search stuff

getFBI :: !*(PSt *General) -> (!FindBoxInfo *(PSt *General),!*PSt *General)
218
setFBI :: !(FindBoxInfo *(PSt *General)) !*(PSt *General) -> *PSt *General
Diederik van Arkel's avatar
Diederik van Arkel committed
219 220 221 222

//-- find stuff

getFI :: !*(PSt *General) -> (!FindInfo,!*PSt *General)
223
setFI :: !FindInfo !*(PSt *General) -> *PSt *General
Diederik van Arkel's avatar
Diederik van Arkel committed
224 225 226

//-- project path

227 228
getProjectFilePath :: !*(PSt *General) -> (!Pathname,!*PSt *General)
setProjectFilePath :: !Pathname !*(PSt *General) -> *PSt *General
Diederik van Arkel's avatar
Diederik van Arkel committed
229 230 231 232 233 234 235 236 237 238 239 240 241

//-- startup path

getStup :: !*(PSt *General) -> (!Pathname,!*PSt *General)

//--

getInterrupt :: !*(PSt *General) -> (!(Id,Id),!*PSt *General)
getInterText :: !*(PSt *General) -> (!(Id,Id,[Id]),!*PSt *General)

//-- print setup stuff

getPrintSetup  :: !*(PSt *General) -> (!PrintSetup,!*PSt *General)
242
setPrintSetup :: !PrintSetup !*(PSt *General) -> *PSt *General
Diederik van Arkel's avatar
Diederik van Arkel committed
243 244 245 246

//-- flexible prefixes

getPrefix  :: !*(PSt *General) -> (![String],!*PSt *General)
247
setPrefix :: !String !*(PSt *General) -> *PSt *General
Diederik van Arkel's avatar
Diederik van Arkel committed
248

249 250 251
//-- boolean that indicates if user interaction is allowed

getInteract  :: !*(PSt *General) -> (!Bool,!*PSt *General)
252
setInteract :: !Bool !*(PSt *General) -> *PSt *General
253 254 255

//-- log functions for batch build

256 257
writeLog :: !String !*(PSt *General) -> *PSt *General
abortLog :: !Bool !String !*(PSt *General) -> *PSt *General
Diederik van Arkel's avatar
Diederik van Arkel committed
258 259 260

getFstate :: !*(PSt *General) -> ([(!Bool,!String)],*(PSt *General))
setFstate :: ![(!Bool,!String)] !*(PSt *General) -> *(PSt *General)