Commit e1f4cd2d authored by Diederik van Arkel's avatar Diederik van Arkel

cleanup for Clean2 release

parent af9b4495
definition module EdAction
//*********************************************************************************
// Original Clean Library Software Module
// Written for Clean version : 1.3
// Written for I/O version : 1.2
// Author : Diederik van Arkel
// Date :
// Last Modified by :
// Date :
// Copyright : 1999 Hilt - High Level Software Tools B.V.
// : University of Nijmegen
// e-mail : clean@cs.kun.nl or rinus@hilt.nl
//*********************************************************************************
// It is allowed to modify this module for your own purposes but it is NOT allowed
// to (re)distribute the code or the modified code in ANY form without written
// permission.
//*********************************************************************************
/*
* EdAction.dcl: performing editor Actions
*/
// performing editor Actions
import EdMonad, EdMovement
import EdCommon
......
implementation module EdAction
//*********************************************************************************
// Original Clean Library Software Module
// Written for Clean version : 1.3
// Written for I/O version : 1.2
// Author : Diederik van Arkel
// Date :
// Last Modified by :
// Date :
// Copyright : 1999 Hilt - High Level Software Tools B.V.
// : University of Nijmegen
// e-mail : clean@cs.kun.nl or rinus@hilt.nl
//*********************************************************************************
// It is allowed to modify this module for your own purposes but it is NOT allowed
// to (re)distribute the code or the modified code in ANY form without written
// permission.
//*********************************************************************************
/*
* EdAction.icl: performing editor Actions
*/
import StdInt, StdArray, StdTuple, StdBool, StdChar, StdList, StdMisc
import StdIOCommon, StdPSt, StdWindow
import EdVisualCursor, EdVisualText, EdMovement, StrictList, EdMonad
......
definition module EdActionType
//*********************************************************************************
// Original Clean Library Software Module
// Written for Clean version : 1.3
// Written for I/O version : 1.2
// Author : Diederik van Arkel
// Date :
// Last Modified by :
// Date :
// Copyright : 1999 Hilt - High Level Software Tools B.V.
// : University of Nijmegen
// e-mail : clean@cs.kun.nl or rinus@hilt.nl
//*********************************************************************************
// It is allowed to modify this module for your own purposes but it is NOT allowed
// to (re)distribute the code or the modified code in ANY form without written
// permission.
//*********************************************************************************
import StdOverloaded
import EdMovement
from EdText import :: TextFragment
......
implementation module EdActionType
//*********************************************************************************
// Original Clean Library Software Module
// Written for Clean version : 1.3
// Written for I/O version : 1.2
// Author : Diederik van Arkel
// Date :
// Last Modified by :
// Date :
// Copyright : 1999 Hilt - High Level Software Tools B.V.
// : University of Nijmegen
// e-mail : clean@cs.kun.nl or rinus@hilt.nl
//*********************************************************************************
// It is allowed to modify this module for your own purposes but it is NOT allowed
// to (re)distribute the code or the modified code in ANY form without written
// permission.
//*********************************************************************************
import StdOverloaded, StdArray, StdInt, StdString, StdChar, StdList
import StrictList
import EdMovement
......
/*
* EdFile.dcl: reading and writing text files
*/
definition module EdFile
from StdFile import class FileSystem
from EdText import :: Text
import StdError, StdMaybe
from UtilNewlinesFile import :: NewlineConvention
// reading and writing text files
import StdError, StdMaybe
from StdFile import class FileSystem
from EdText import :: Text
from UtilNewlinesFile import :: NewlineConvention
readText :: !String !*env -> ((Error Text,NewlineConvention,Bool), !*env) | FileSystem env
writeText :: !String !NewlineConvention !Text !*env -> (Maybe String, !*env) | FileSystem env
......
/*
* EdFile.icl: reading and writing text files
*/
implementation module EdFile
// reading and writing text files
import StdBool, StdFile, StdArray, StdInt, StdString, StdChar, StdFunc
import UtilNewlinesFile
import EdText, StrictList
......
definition module EdFind
import StdMaybe
from StrictList import :: StrictList
import EdSelection
import StdMaybe
from StrictList import :: StrictList
import EdSelection
simpleLineSearch ::
// plain search
......
/*
* EdKeyMapping.dcl: configuring the key mapping of the editor
*/
definition module EdKeyMapping
// configuring the key mapping of the editor
from StdFile import :: Files
from StdPSt import :: PSt
from StdIOCommon import :: KeyboardState, :: SpecialKey
from StdMaybe import :: Maybe
from StdOverloaded import class ==, class toString, class fromString
from EdActionType import :: Action
//from EdMonad import EditMonad, EditState, StateM
:: KeyMapping
......@@ -19,6 +16,7 @@ from EdActionType import :: Action
// not allowed. The type should be:
// configureKeyMapping :: (PSt EditorState .p) -> (PSt EditorState .p)
// But then you have to import EdState which imports this module...
// => can be removed in Clean 2.0!
configureKeyMapping :: KeyMapping (KeyMapping (PSt .l) -> (PSt .l)) (PSt .l) -> (PSt .l)
......
/*
* EdKeyMapping.icl: configuring the key mapping of the editor
*/
implementation module EdKeyMapping
//import StdEnv, StdIO
// configuring the key mapping of the editor
import StdArray,StdEnum, StdFunc, StdMisc,StdOrdList,StdTuple
import StdFileSelect,StdPStClass,StdWindow
import EdState, Table, StdListBox
......
/*
* EdKeyboard.dcl: handling keyboard events
*/
definition module EdKeyboard
from StdIOCommon import :: KeyboardState
from StdPSt import :: PSt
//from EdState import EditorState
from EdKeyMapping import :: KeyMapping
import EdMonad, StdMaybe
import EdCommon
// handling keyboard events
import EdCommon, StdMaybe
from StdIOCommon import :: KeyboardState
from StdPSt import :: PSt
from EdKeyMapping import :: KeyMapping
editWindowKeyboard ::
KeyMapping KeyboardState !(!EditState, !PSt PLocState) -> (!EditState, !PSt PLocState)
......
/*
* EdKeyboard.icl: handling keyboard events
*/
implementation module EdKeyboard
// handling keyboard events
import StdClass, StdBool, StdArray, StdInt, StdChar, StdTuple, StdList, StdMisc
import StdIOCommon, StdWindow, StdPSt
import EdVisualText, EdVisualCursor, EdSelection,
EdAction, EdKeyMapping, EdState, StrictList
import EdVisualText, EdVisualCursor, EdSelection, EdAction, EdKeyMapping, EdState
import StrictList
import EdActionType
//from dodebug import trace_n`
......
/*
* EdLineText.dcl: a type for dealing with line-oriented operations on texts
*/
definition module EdLineText
// a type for dealing with line-oriented operations on texts
from StrictList import :: StrictList
from EdPosition import :: LineNr
......
/*
* EdLineText.icl: a type for dealing with line-oriented operations on texts
*/
implementation module EdLineText
import StdString, StdClass, StdInt, StdList, StdBool, StdFunc, StdArray, StdTuple
import StrictList
from EdPosition import :: LineNr
import syncol
import Platform
// a type for dealing with line-oriented operations on texts
import StdString, StdClass, StdInt, StdList, StdBool, StdFunc, StdArray, StdTuple
import StrictList
from EdPosition import :: LineNr
import syncol
import Platform
//-- stuff we want to parametrise...
/*
......
/*
* EdLook.dcl: the edit window update function
*/
definition module EdLook
from StdPicture import :: Picture
from StdIOCommon import :: SelectState, :: UpdateState
import EdMonad
// the edit window update function
from StdPicture import :: Picture
from StdIOCommon import :: SelectState, :: UpdateState
import EdMonad
editWindowLook :: EditState SelectState !UpdateState -> (!*Picture -> *Picture)
// editWindowLook: defines the look of the editor window. This function
......
/*
* EdLook.icl: the edit window update function
*/
implementation module EdLook
// the edit window update function
import StdInt, StdBool, StdClass
import StdIOCommon
import StdPicture
......@@ -30,15 +28,6 @@ where
(height,ds4) = getCursorHeight ds3
(selection=:{end},_) = getSelection ds4
/*
import StdDebug,dodebug
traceUpdate [] s = s
traceUpdate [h:t] s
#! s = trace_n h s
= traceUpdate t s
*/
cleanUpdate [] = []
cleanUpdate [h:t]
| h.corner1.x == h.corner2.x = cleanUpdate t
......
/*
* EdMessage.dcl: message passing with the editor
*/
definition module EdMessage
// message passing with the editor
from StdId import class Ids
from StdPSt import :: PSt
from StdReceiver import :: Receiver2
......
/*
* EdMessage.icl: message passing with the editor
*/
implementation module EdMessage
// message passing with the editor
import StdFunc, StdMisc
import StdReceiver, StdPSt, StdId
import EdMonad
......
/*
* EdMonad.dcl: the monad that keeps track of the local EditState and another state (mostly the program state)
*/
definition module EdMonad
// the monad that keeps track of the local EditState and another state (mostly the program state)
from StdPicture import :: Font, :: FontMetrics, :: Colour
from StdPSt import :: PSt, :: IOSt
from StdId import :: Id
......@@ -59,8 +57,6 @@ from EdSelection import :: Selection, :: Position, :: ColumnNr, :: LineNr
DefaultSyntaxColours :: !SyntaxColours
//:: CursorInfo
:: UndoInfo =
{ state :: !UndoState // undo or redo
, action :: !String // string describing action to be undone/redone
......
/*
* EdMonad.icl: the monad that keeps track of the local EditState and another state (mostly the program state)
*/
implementation module EdMonad
// the monad that keeps track of the local EditState and another state (mostly the program state)
import StdArray, StdBool, StdChar, StdClass, StdFunc, StdInt, StdMisc
import StdMenuElement, StdPSt, StdWindow, StdSystem
import UtilNewlinesFile, StateMonad
import StdId // P4
import StdId
import EdVisualText, EdSelection, EdLook
import EdAction
......@@ -522,7 +519,7 @@ getUndoInfo
setUndoInfo :: UndoInfo -> EditMonad (PSt .l) nothing
setUndoInfo undoInfo
= getEditState >>>= \{/*undomId,*/undoeId} ->
= getEditState >>>= \{undoeId} ->
appEnv (appPIO (mfun undoeId)) >>>
updateEditState update
where
......
definition module EdMouse
//*********************************************************************************
// Original Clean Library Software Module
// Written for Clean version : 1.3
// Written for I/O version : 1.2
// Author : Diederik van Arkel
// Date :
// Last Modified by :
// Date :
// Copyright : 1999 Hilt - High Level Software Tools B.V.
// : University of Nijmegen
// e-mail : clean@cs.kun.nl or rinus@hilt.nl
//*********************************************************************************
// It is allowed to modify this module for your own purposes but it is NOT allowed
// to (re)distribute the code or the modified code in ANY form without written
// permission.
//*********************************************************************************
// handling mouse events
/*
* EdMouse.dcl: handling mouse events
*/
from StdIOCommon import :: MouseState
from StdPSt import :: PSt
import EdMonad, EdCommon
from StdIOCommon import :: MouseState
from StdPSt import :: PSt
import EdMonad, EdCommon
editWindowMouse :: MouseState (!EditState, !PSt PLocState) -> (EditState, PSt PLocState)
// editWindowMouse: handles mouse events in the edit window
......
implementation module EdMouse
//*********************************************************************************
// Original Clean Library Software Module
// Written for Clean version : 1.3
// Written for I/O version : 1.2
// Author : Diederik van Arkel
// Date :
// Last Modified by :
// Date :
// Copyright : 1999 Hilt - High Level Software Tools B.V.
// : University of Nijmegen
// e-mail : clean@cs.kun.nl or rinus@hilt.nl
//*********************************************************************************
// It is allowed to modify this module for your own purposes but it is NOT allowed
// to (re)distribute the code or the modified code in ANY form without written
// permission.
//*********************************************************************************
/*
* EdMouse.icl: handling mouse events
*/
// handling mouse events
import StdClass, StdInt, StdBool, StdArray, StdChar, StdList, StdTuple
import StdIOCommon, StdPSt, StdWindow
......@@ -34,11 +15,6 @@ platformCommand mods
/* editWindowMouse wraps the monadic mouse function, so that the type
* conforms to that of a call-back function in the Object I/O library
*/
/*
editWindowMouse :: Tree MouseState (!EditState, !PSt PLocState) -> (EditState, PSt PLocState)
editWindowMouse tree mouseState state
# state = p4mouse tree mouseState state // P4
*/
editWindowMouse :: MouseState (!EditState, !PSt PLocState) -> (EditState, PSt PLocState)
editWindowMouse mouseState state
= noResult
......@@ -46,6 +22,11 @@ editWindowMouse mouseState state
setVirtualX 0 >>>
mouse mouseState
) state
/* P4 version
editWindowMouse :: Tree MouseState (!EditState, !PSt PLocState) -> (EditState, PSt PLocState)
editWindowMouse tree mouseState state
# state = p4mouse tree mouseState state
*/
mouse :: MouseState -> EditMonad (PSt PLocState) nothing
mouse (MouseDown point mods=:{shiftDown} nrDown)
......@@ -162,7 +143,7 @@ noMouseMoved :: !MouseState -> Bool
noMouseMoved (MouseMove _ _) = doP4
noMouseMoved _ = True
//-- P4 --- !!! ZITTEN OOK NOG WIJZIGINGEN IN EdMonad !!!
//-- P4 --- !!! Also involves modifications to EdMonad !!!
doP4 :== False
noP4 :== True
......@@ -171,15 +152,15 @@ import StdTimer,tooltip,PmParse,UtilStrictLists,EdFile,treeparse
p4mouse boom mouseState state
| noP4 = state
# (winId,state) = getWindowId state // P4
# (timId,state) = getTimerId state // P4
# pos = getMouseStatePos mouseState // P4
# (oldpos,state) = getToolPt state // P4
# state = case (pos == oldpos) of // P4
True -> state // P4
_ -> p4fun boom timId winId pos state // P4
# (_,state) = setToolPt pos state // P4
= state // P4
# (winId,state) = getWindowId state
# (timId,state) = getTimerId state
# pos = getMouseStatePos mouseState
# (oldpos,state) = getToolPt state
# state = case (pos == oldpos) of
True -> state
_ -> p4fun boom timId winId pos state
# (_,state) = setToolPt pos state
= state
p4fun boom timerId windowId pos state
# (text,state) = getText state
......
/*
* EdMovement.dcl: the Movement type and operations on it
*/
definition module EdMovement
from StdClass import class ==, class toString, class fromString
from EdSelection import :: Position, :: ColumnNr, :: LineNr
import EdMonad
from StdClass import class ==, class toString, class fromString
from EdSelection import :: Position, :: ColumnNr, :: LineNr
import EdMonad
:: Movement
= LineUp
......
/*
* EdMovement.icl: the Movement type and operations on it
*/
implementation module EdMovement
import StdMisc, StdInt, StdTuple, StdArray, StdChar, StdBool, StdList, StdFunc
......@@ -234,10 +230,10 @@ findWord isCorrectChar column line
= findRight (column+1)
= column
isWordChar c = isAlpha c || isDigit c || isMember c ['`_']
isFunnyChar c = isMember c ['~@#$%^?!+-*<>\\/|&=:.']
isWhiteSpace c = isMember c [' \t\r\n\f\b']
otherChar c = (==) c
isWordChar c = isAlpha c || isDigit c || isMember c ['`_']
isFunnyChar c = isMember c ['~@#$%^?!+-*<>\\/|&=:.']
isWhiteSpace c = isMember c [' \t\r\n\f\b']
otherChar c = (==) c
pageUp :: Position -> EditMonad (PSt .l) Position
pageUp position=:{col,row} =
......
/*
* EdPosition.dcl: the Position type represents positions within a text (sigh)
*/
definition module EdPosition
from StdClass import class <, class ==
......@@ -16,4 +12,3 @@ from StdClass import class <, class ==
instance < Position
instance == Position
/*
* EdPosition.icl: the Position type represents positions within a text (sigh)
*/
implementation module EdPosition
import StdClass, StdBool, StdInt
......
/*
* EdSelection.dcl: non-visual operations on selections
*/
definition module EdSelection
import EdPosition
from EdLineText import :: Text
// non-visual operations on selections
import EdPosition
from EdLineText import :: Text
:: Selection
= { start :: Position
......
/*
* EdSelection.icl: non-visual operations on selections
*/
implementation module EdSelection
// non-visual operations on selections
import StdList, StdFunc, StdBool, StdArray, StdTuple
import EdPosition, EdText
......
/*
* EdState.dcl: the global state of the editor process
*/
definition module EdState
// the global state of the editor process
from StdId import :: Id
from StdPSt import :: PSt
from StdMaybe import :: Maybe
from EdKeyMapping import :: KeyMapping
//from EdMonad import EditState
from EdMessage import :: EditId
class Editor env
......
/*
* EdState.icl: the global state of the editor process
*/
implementation module EdState
// the global state of the editor process
import StdList, StdFunc, StdTuple, StdBool, StdMisc
import StdId, StdMaybe, StdReceiver, StdPSt
import EdKeyMapping, EdMessage, Table
......
/*
* EdTab.dcl: functions that deal with those annoying tab characters
*/
definition module EdTab
// functions that deal with those annoying tab characters
from StdIOCommon import :: Point2
from StdPicture import :: Picture
from EdMonad import :: FontInfo
......
implementation module EdTab
/*
* EdTab.icl: functions that deal with those annoying tab characters
* functions that deal with those annoying tab characters
o Unfortunately doesn't work with proportional fonts...
Probably inevitable with an 'editor' view of tabs.
......
/*
* EdText.dcl: operations on text areas (extends EdLineText)
*/
definition module EdText
// operations on text areas (extends EdLineText)
import StdMaybe
from EdSelection import :: Selection, :: Position, :: ColumnNr, :: LineNr
......
/*
* EdText.icl: operations on text areas (extends EdLineText)
*/
implementation module EdText
// operations on text areas (extends EdLineText)
import StdClass, StdArray, StdMisc, StdInt, StdString, StdMaybe
import EdLineText, EdSelection
import StrictList
......@@ -67,7 +65,7 @@ insertText { col, row } strings text
= SCons
(left +++ slHead strings)
(appendToLastLine (slTail strings) right)
// deze volgorde om ruzie met removeLine in combinatie met newText te vermijden...
// use this order to avoid trouble with removeLine applied to newText...
# text = insertLines (inc row) fragment text
# text = removeLine row text
= (Nothing,text )
......@@ -99,7 +97,7 @@ replaceText sel=:{start={col=col1,row=row1},end={col=col2,row=row2}} strings tex
# fragment = SCons
(left +++ slHead strings)
(appendToLastLine (slTail strings) right)
// deze volgorde om ruzie met removeLine in combinatie met newText te vermijden...
// use this order to avoid trouble with removeLine applied to newText...
# text = insertLines (inc row1) fragment text
# text = removeLine row1 text
= text
......
definition module EdVisualCursor
//*********************************************************************************
// Original Clean Library Software Module
// Written for Clean version : 1.3
// Written for I/O version : 1.2
// Author : Diederik van Arkel
// Date :
// Last Modified by :
// Date :
// Copyright : 1999 Hilt - High Level Software Tools B.V.
// : University of Nijmegen
// e-mail : clean@cs.kun.nl or rinus@hilt.nl
//*********************************************************************************
// It is allowed to modify this module for your own purposes but it is NOT allowed
// to (re)distribute the code or the modified code in ANY form without written
// permission.
//*********************************************************************************
/*
* EdVisualCursor.dcl: visual operations on the cursor and selections
*/
from StdIOCommon import :: ViewFrame, :: Rectangle, :: Point2
import EdMonad, EdMovement
// visual operations on the cursor and selections
from StdIOCommon import :: ViewFrame, :: Rectangle, :: Point2
import EdMonad, EdMovement
vUpdateCursor :: !Bool !Position !Int !FontInfo !Text !ViewFrame ![Rectangle]
......@@ -51,7 +32,6 @@ vChangeSelectionTo :: Selection -> EditMonad (PSt .l) nothing
// to the given selection and redraws, so that the display
// reflects this change
//vUpdateSelection :: ViewFrame [Rectangle] -> EditMonad *Picture nothing
vUpdateSelection :: !Selection FontInfo Text ViewFrame [Rectangle]
-> (*Picture -> *Picture)
// vUpdateSelection: updates the selection in the frame
......
implementation module EdVisualCursor
//*********************************************************************************
// Original Clean Library Software Module
// Written for Clean version : 1.3
// Written for I/O version : 1.2
// Author : Diederik van Arkel
// Date :
// Last Modified by :
// Date :
// Copyright : 1999 Hilt - High Level Software Tools B.V.
// : University of Nijmegen
// e-mail : clean@cs.kun.nl or rinus@hilt.nl
//*********************************************************************************
// It is allowed to modify this module for your own purposes but it is NOT allowed
// to (re)distribute the code or the modified code in ANY form without written
// permission.
//*********************************************************************************
/*
* EdVisualCursor.icl: visual operations on the cursor
*/
// visual operations on the cursor
import StdInt, StdClass, StdBool, StdFunc
import StdPicture, StdWindow, StdPSt, StdList
...