(**** * * Module StudentEdit defines the objects and operations related to generic editing * in the Student Application system * *) module StudentEdit; from StudentApp import Quarters; from StudentFile import UserID; export Clipboard, Selection, SelectionContext, UserWorkSpace; object Clipboard is components: string; description: (* The clipboard holds a selection of cut or copied text. *); end Clipboard; object Selection is components: start_position:integer and end_position:integer and context:string; description: (* The workspace text selection is the defined as the starting and ending character positions in current workspace text context. *); end Selection; object SelectionContext is components: string; description: (* SelectionContext is the text context in which the user makes a selection. *); end SelectionContext; operation EditUndo is inputs: uws:UserWorkSpace; outputs: uws':UserWorkSpace; description: (* Undo the most recent student plan operation. Only one level of undo/redo is specified here. Successive invocations of undo toggle between the current and previous states of the Student Application. *); end EditUndo; operation EditRedo is inputs: uws:UserWorkSpace; outputs: uws':UserWorkSpace; description: (* Redo the most recent student plan operation. Only one level of undo/redo is specified here. Successive invocations of undo toggle between the current and next states of the Student Application. *); end EditRedo; operation EditCut is inputs: uws:UserWorkSpace; outputs: uws':UserWorkSpace; description: (* The currently selected text segment is copied into the clipboard and removed from its context. The workspace selection in set to empty. *); end EditCut; operation EditCopy is inputs: uws:UserWorkSpace; outputs: uws':UserWorkSpace; description: (* The currently selected text segment is copied into the clipboard; *); end EditCopy; operation EditPaste is inputs: uws:UserWorkSpace; outputs: uws':UserWorkSpace; description: (* Paste the contents of the clipboard into the currently selected start position, replacing any selected text from start to end position. *); end EditPaste; object UserWorkSpace is components: uid:UserID and qtr:Quarters* and previous_state:PreviousState and clipboard:Clipboard and selection:Selection and next_state:NextState context:SelectionContext; description: (* The UserWorkSpace contains the active plan upon which the user is working. The first component is the UserId of the current user, which is used as necessary by operations that input the workspace to determine who the user is. The Quarters* component is the list of planned quarters. The previous_state component is used to support one level of command undo. The next_state component is used to support one level of command redo. The Clipboard is used with the Edit cut, copy, and paste operations. *); end UserWorkSpace; object PreviousState is components: Quarters*; description: (* PreviousState is the snapshot of planned items before the most recently performed planning operation used by EditUndo. *); end PreviousState; object NextState is components: Quarters*; description: (* NextState is the snapshot of planned items aftere the most recently performed planning operation used by EditRedo. *); end PreviousState; end StudentEdit;