EdCommon.icl 2.11 KB
Newer Older
Diederik van Arkel's avatar
Diederik van Arkel committed
1 2 3 4 5 6 7 8 9 10 11 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 72 73 74 75
implementation module EdCommon

from EdState import Editor, EditorState
import EdMonad

:: *PLocState :== MyEditorState
:: MyEditorState = MES EditorState

instance Editor MyEditorState
where
	getEditorState ps=:(MES es) = (es,ps)
	setEditorState es ps = MES es

mChangeSelectionTo :: Selection -> EditMonad (PSt *MyEditorState) nothing
mChangeSelectionTo newSelection = skip
/*	getText											>>>= \text ->
	getMenuSelection								>>>= \mselold ->
	accEnv (getMenuIds)								>>>= \mIds ->
	let (frag,_)	= getTextFragment (orderSelection newSelection) text
		mselnew		= dofrag frag
		fragaction
			| changed mselold mselnew = (handlefrag mselnew mIds	>>> setMenuSelection mselnew)
			= skip
	in
	fragaction
where
	changed Nothing Nothing = False
	changed (Just strl) (Just strr) = strl <> strr
	changed _ _ = True
	
	dofrag (SCons (str) SNil) 
		| CleanModId str
			= Just str
		= Nothing
	dofrag _ = Nothing

	handlefrag (Just str) mIds
		=	appEnv (appPIO (setMenuElementTitles
				[(mIds.mn_odm,"Open "+++(MakeDefPathname str))
				,(mIds.mn_oim,"Open "+++(MakeImpPathname str))
				]))
	handlefrag _ mIds =
		appEnv (appPIO (setMenuElementTitles
			[(mIds.mn_odm,"Open Definition...")
			,(mIds.mn_oim,"Open Implementation...")
			]))
*/
mRemoveSelection :: EditMonad (PSt *MyEditorState) nothing
mRemoveSelection = skip
/*	getMenuSelection								>>>= \mselold ->
	accEnv (getMenuIds)								>>>= \mIds ->
	let
		mselnew		= Nothing
		fragaction
			| changed mselold mselnew = (handlefrag mselnew mIds	>>> setMenuSelection mselnew)
			= skip
	in
	fragaction
where
	changed Nothing Nothing = False
	changed (Just strl) (Just strr) = strl <> strr
	changed _ _ = True
	
	handlefrag (Just str) mIds
		=	appEnv (appPIO (setMenuElementTitles
				[(mIds.mn_odm,"Open "+++(MakeDefPathname str))
				,(mIds.mn_oim,"Open "+++(MakeImpPathname str))
				]))
	handlefrag _ mIds =
		appEnv (appPIO (setMenuElementTitles
			[(mIds.mn_odm,"Open Definition...")
			,(mIds.mn_oim,"Open Implementation...")
			]))
*/

Diederik van Arkel's avatar
Diederik van Arkel committed
76
controlDoubleClick :: !.Bool !.Position -> .(!*(EditState,*PSt PLocState) -> *(a,*(EditState,*PSt PLocState)));
Diederik van Arkel's avatar
Diederik van Arkel committed
77 78
controlDoubleClick shiftDown position =
	skip