(**************************************************************************
UNDERGOING CONSTRUCTION
This section of the rsl defines the command bar menu. File, edit,
and other type of common pull down menus and there operations need
to be specified in this module. Due to the limitation in time,
some of the operations have been specified here. I will not go thru
any details of objects in this section. Here is a list of some of
the menu commands that are common to both demo and demmation and will
be part of the integrated menu.
***************************************************************************)
module CommandMenu;
operation New;
operation FileOpen;
operation FileSave;
operation FileSaveAs;
operation quit;
operation FilePrint; (*etc*)
end CommandMenu;
module BehaviorPanel;
object BehaviorModes = Draw or Resp or Stim or DefGestureMode or
DefRespMode or Run or ShowCode;
value Draw ="DrawMode" ;
value Stim="DemoStimMode" ;
value Resp="DemoRespMode" ;
value DefGestureMode="DefineStimGestureMode" ;
value DefRespMode="DefineResponseConds" ;
value run="RunMode";
value ShowCode="ShowCodeMode" ;
end BehaviorPanel;
(****************************************************************************
RSL for the Graphical pallete of demo.
All credit as far as ideas and names of objects have been taken out of
Hardy's Thesis. I have chosen a subset of objects from her and simply put
it in RSL format. MOST of the comments, especially those on defining
the objects has been copied out of Hardy's thesis. Must give credit
where credit is due!!!
******************************************************************************)
(*
*)
module GraphicPalette;
(*
OBJECTS
*)
import BehaviorPanel.BehaviorModes;
(* GESTURE
* is the various gestures that a user can
* make on the canvas.
*)
object Gesture = LU or LD or MU or MD or RU or RD or EG or LG or MG;
value LU = "LeftUpGesture" (* Left mouse button up *);
value LD= "LeftDownGesture" (* Left mouse button down *);
value MU= "MiddleUpGesture" (* Middle mouse button up *);
value MD= "MiddleDownGesture" (* Middle mouse button down *);
value RU= "RightUpGesture" (* Right mouse button up *);
value RD= "RightUpGesture" (* Right mouse button down *);
value EG= "EnterGesture" (* mouse enters a graphic *);
value LG= "LeaveGesture" (* mouse leaves a graphic *);
value MG= "MoveGesture" (* The mouse moves on the canvas*);
value NumOfGestures = 10;
object GesturePair
components:
onoff: boolean,
opname: string,
gname: Gesture;
description:
(* A GESTUREPAIR
* is a record that corresponds to one of the
* entries in the sensitize edit window. A gesture
* record contains a boolean flag that corresponds to
* an on/off checkbox for each gesture, and a string
* that identifies the operation.
*);
end GesturePair;
object GestureMap = GesturePair*;
(*GESTUREMAP
* is an array of Gesture records, one for each type
* of possible gesture.
*)
(*AXIOM: The total number of gesture pairs in a gesture map can not
exceed the cardinality of the total possible Gestures
*)
(* RSL??????????? *)
axiom A1 = forall (gm:GestureMap)
(#gm <= NumOfGestures) and
(forall (i,j:integer | (i>=1) and (j>=1) and (i <= #gm) and (j <= #gm)
(i != j))
gm[i].gname != gn[j].gname);
(* Alternatively for the second conjoin above:
(forall (gp1,gp2: GesturePair | (gp1 in gm) and (gp2 in gm))
gp1.gname != gp2.gname;
*)
object Graphic;
(*GRAPHIC
* A graphic is any item that can be drawn onto
* the canvas
*)
object Canvas
components:
name:string,
mode:BehaviorModes,
objs:Graphic*,
count:number, (*number of objects in the Canvas*)
srops:SRBehavior*; (*Stimulus / Response operation set *)
description:
(*CANVAS Drawing Canvas *) ;
end Canvas;
obj GraphicsOp;
object SRBehavior
components:
name: string,
stimop: GraphicsOp,
stimobj: Selection,
stimparms: GraphicOpParms,
respop: GraphicsOp*,
respobj: Selection*,
resparms: GraphicOpParms;
end;
object SROP; (* A valid stimulus response operation *)
object Selection
components:
pictre: Graphic*, (*Physical screen rendering of the selection*)
stype: string, (*General? type of selection *)
map: GestureMap, (*Sensitive gestures and corresponding ops *)
x:number, (* x coord of the position of the selection*)
y:number; (* y coord of the position of the selection*)
description:
(*SELECTION
* A selection is a grouping of graphics together
*);
end Selection;
(*
* OPERATIONS
*
* At this point, the operations that the graphic pallete provides
* to the user is defined. They are briefly commented. Due to the
* fact that the quarter is short, I will not attempt to write
* RSL for these unless I have absolutely nothin else to do!!!
* The reason I am defining these operations is that I will need
* to use them in other modules that make up the bulk of my thesis.
*)
operation Select(s:Selection,c:Canvas)->(s':Selection);
operation UnSelect(s:Selection,c:Canvas)->(s':Selection);
operation Move(s:Selection, x:number, y:number, c:Canvas) ->(c':Canvas);
operation Scale()->();
operation Stretch()->();
operation Rotate()->();
operation Magnify()->();
operation DrawLine()->();
operation DrawOpenSpline()->();
operation DrawEllipse()->();
operation DrawRect()->();
operation DrawPolygon()->();
operation DrawClosedSpline()->();
object ValidGraphicStimOps; (*is
operation Move(s:Selection, x:number, y:number, c:Canvas) ->(c':Canvas) or
operation Scale()->() or
operation Stretch()->() or
operation Rotate()->() or
operation Magnify()->() or
operation DrawLine()->() or
operation DrawOpenSpline()->() or
operation DrawEllipse()->() or
operation DrawRect()->() or
operation DrawPolygon()->() or
operation DrawClosedSpline()->(); *)
object ValidGraphicRespOps;
end GraphicPalette;
(**********************************************************************
Animation Tools
The tools defined here in this section has been derived from Sung's
thesis. This is my understanding of the project.
***********************************************************************)
module Animation; (*Demomation*)
(*Selection has the needed fileds to map gestures to operations *)
import graphicpalette.Selection;
object AnimateObj;
(* By making the Sprite have attributes of selection, we
can set the mapings in the selection part with the need
operators and gestures to get an animation going.
object Sprite < Selection
path: Path and ... ;
object Path < Selection
sprite: Sprite and keyframes:KeyFrameList and ... ;
object KeyFrameList = KeyFrame*;
object KeyFrame = pp:PathPoint and s:Selection
description: (*
object PathPoint = x:integer and y:integer;
(*
* The path points of all key frames associated with a path are on that path
*)
axiom A2 = forall (p:Path) (forall (kf in p.keyframes)
(Intersects(kf.pp, p) and CenteredOn(kf.s, kf.pp)));
function Intersects(s1: Selection, pp:PathPoint)->boolean;
(* See implemtation of selection.c:Selection::Interesects()
* The opacity of the Graphic that represent ths path preclues any
* meaningful detail in a postcond for this function.
*)
object Animation = Path;
(* Hmm, is this all there really is to it? I think so. *)
object AnimationWorld < DrawingWorld =
curanimation:Animation and state:AnimationState and ... ;
operation AnimationOp(aw:AminationWorld)->(aw':AnimationWorld);
(* Put Sung's animation operations here. To whit: *)
operation Run(a:Animation) -- < AnimationOp
description: (*
Starts and runs the selected animation
*);
end;
operation Stop();
object ValidAnimationStimOps;
object ValidAnimationRespOps;
end Animation;
(**********************************************************************
Integration
This is the main RSL for my Thesis. The concept of these operations
already exist in DEMO. The point of this is to write RSL in a manner
so that it is obvious that animations can be stimulus or response.
We may also have to introduce new classes so that we can show that
any point within an animation can work as an stim/response.
************************************************************************)
module Integration;
import GraphicPalette.ValidGraphicStimOps,
GraphicPalette.ValidGraphicsRespOps,
GraphicPalette.Canvas,
GraphicPalette.Selection;
import Animation.ValidAnimationStimOps,
Animation.ValidAnimationRespOps,
Animation.Sprite;
import BehaviorPanel.behaviorModes;
object StimObject = Selection or Animation;
object StimOperation = ValidGraphicStimOps or
ValidAnimationStimOps;
operation DemoStimulus(c:Canvas, so:StimObject,
sop:StimOperation,
g:Gesture) -> (c':Canvas)
pre: (* StimObject is in the Canvas, sop is a valid operation for so
and the canvas mode is Demo stimulus mode *);
post:(* there is a new stimulus recorded in the srops of c'*) ;
end;
operation DemoResponse(c:Canvas, ro:RespObject,
rop:RespOperaton) -> (c':Canvas)
pre: (* *);
post: (*so from the previous operation is completely
stimulatable:: srops in canvas are all filled *);
end DemoResponse;
end Integration;