(** * This file defines objects of the main lecture *) module Lecture; from DeskDrawer import DeskDrawer, Sticky; from Editor import Editor; export Lecture, Presentation, Topic, Content, Text, Enumerator; obj Lecture components: pres:Presentation and deskDrawer:DeskDrawer; description: (* The lecture contains a presentation and desk drawer for containing unlinked snapshots. *); end; obj Presentation components: contMode:ContinuousMode or slideMode:SlideMode; description: (* Presentation can be in Continuous Mode or in Slide Mode. *); end; obj ContinuousMode components: topics:Topic* and index:Index and parent:ParentIndex and level:Level; description: (* Continuous Mode contains zero or more topics and a single integer for the current topic position. Continuous Mode is for dynamic navigation of the lecture, navigation by topic. *); end; obj SlideMode components: slides:Slide* and current:Current; description: (* Slide Mode contains zero or more slides and a single integer for the current slide position. Slide Mode is for static navigation of a fully-expanded lecture, navigation by slide. *); end; obj Current is integer description: (* The current slide in Slide Mode. *); end; obj Index is integer description: (* The current topic in Continuous Mode, with each index based on current level and same parent. *); end; obj ParentIndex is Index description: (* Same functionality as Index. *); end; obj Level is integer description: (* The current level of the topic in Continuous mode, ascending with a top level of 0. *); end; obj Slide components: topics:Topic* and title:Title; description: (* A slide contains zero or more topics and slide title. *); end; obj Topic components: enum:Enumerator and content:Content and expFlag:ExpansionFlag and stickies:Sticky* and subTopics:SubTopic*; description: (* A topic contains an enumeration, some content, an expansion flag, zero or more stickies and zero or more subtopics. *); end; obj SubTopic is Topic description: (* Each subtopic can also be the parent topic of other subtopics, so same as a topic. *); end; obj Title is string description: (* A single title can be added to a slide as a global heading for all slides. *); end; obj Enumerator is string description: (* The enumerator is the number before a topic content. This can change depending on the the different preferences in the application. *); end; obj Content is contentList: (Text or Graphic)* description: (* A content can be a text or a graphic. *); end; obj Text is string description: (* Text is the actual textual content of a topic. *); end; obj Graphic description: (* A graphic is an embedded image in the lecture. *); end; obj ExpansionFlag is boolean description: (* The expansion flag describes whether or not the current topics' subtopics are expanded and visible. *); end; op ChangeMode in: pres:SlideMode; out: pres':ContinuousMode; description: (* Switch from Slide Mode to Continuous Mode *); end; op ChangeMode in: pres:ContinuousMode; out: pres':SlideMode; description: (* Switch from Continuous Mode to Slide Mode *); end; op OpenLecture in: editor:Editor; out: lec:Lecture; description: (* Open a lecture from the HTML parsed version. Refer to w3.org for details about parsing. *); end; op NavigateFirst in: cm:ContinuousMode; out: cm':ContinuousMode; pre: cm.index > 0; post: (cm'.index = 0) and (cm'.level = 0); description: (* Navigate to the first topic of the current level with same parent topic. *); end; op NavigateBack in: cm:ContinuousMode; out: cm':ContinuousMode; pre: (cm.index > 0); post: (cm'.index = cm.index - 1) and (cm'.topics[cm'.index].expFlag); description: (* Navigate back to the last topic. *); end; op NavigateNext in: cm:ContinuousMode; out: cm':ContinuousMode; pre: (cm.index < #cm.topics + 1); post: (cm'.index = cm.index + 1) and (cm'.topics[cm'.index].expFlag); description: (* Navigate to the next topic. *); end; op NavigateLast in: cm:ContinuousMode; out: cm':ContinuousMode; pre: (cm.index < #cm.topics + 1); post: (cm.index = #cm.topics + 1) and (cm'.topics[cm'.index].expFlag); description: (* Navigate to the last topic of the current level with the same parent topic. *); end; op NavigateIn in: cm:ContinuousMode; out: cm':ContinuousMode; pre: #cm.topics[cm.index].subTopics > 0; post: (cm'.index = 0) and (cm'.parent = cm.index) and (cm'.level = cm.level + 1); description: (* Navigate in a level and to the next topic. *); end; op NavigateOut in: cm:ContinuousMode; out: cm':ContinuousMode; pre: cm.level > 0; post: (cm'.level = cm.level - 1) and (cm.index = cm'.parent); description: (* Navigate up a level and to the next topic. *); end; (* Following navigation are Slide Mode overloaded *) op NavigateFirst in: sm:SlideMode; out: sm':SlideMode; pre: sm.current > 0; post: sm'.current = 0; description: (* Navigate to the first slide. *); end; op NavigateBack in: sm:SlideMode; out: sm':SlideMode; pre: sm.current > 0; post: sm'.current = sm.current - 1; description: (* Navigate back to the previous slide. *); end; op NavigateNext in: sm:SlideMode; out: sm':SlideMode; pre: sm.current < #sm.slides; post: sm'.current = sm.current + 1; description: (* Navigate to the next slide. *); end; op NavigateLast in: sm:SlideMode; out: sm':SlideMode; pre: sm.current < #sm.slides; post: sm'.current = #sm.slides; description: (* Navigate to the last slide. *); end; op NavigateIn in: sm:SlideMode; out: sm':SlideMode; pre: false; post: false; description: (* Navigation step in is not available or allowed for Slide Mode. *); end; op NavigateOut in: sm:SlideMode; out: sm':SlideMode; pre: false; post: false; description: (* Navigation step out is not available or allowed for Slide Mode. *); end; end Lecture;