include "$EDWIN:.INC"
begin

   ! EDWIN test program 2
   ! This tests some of the attribute commands, for altering colour,
   ! line style, and character size.
   ! The picture is designed to show how windowing in EDWIN operates. 
   ! It is best run on a 4014 or VT15 to get the correct attributes set,
   ! because the other devices can't support the attributes.

   const integer BLACK = 1, BLUE = 2, RED = 4
   const integer NORMAL = 0, DOTTED = 1, SDASH = 3, LDASH = 4
   integer TYPE

   routine PRINT TEXT (string(255) S, integer X,Y)
      MOVE ABS (X,Y)
      TEXT (S)
   end

   routine JOIN (integer X1, Y1, X2, Y2)
      MOVE ABS (X1,Y1)
      LINE ABS (X2,Y2)
   end
 
   routine RECT (integer X, Y, H, V)
      MOVE ABS (X,Y)
      LINE REL (H,0); LINE REL (0,-V)
      LINE REL (-H,0); LINE REL (0,V)
   end

   PROMPT ("Device Type:")
   READ (TYPE)
   INITIALISE FOR (TYPE)

   NEW FRAME

   STORE ON (2)
   ! A copy of the picture will be made on stream 2.

   ! Now that everything is set up the picture can be drawn.


   RECT (0,1023,1023,1023)

   SET CHAR SIZE (14)
   SET LINE STYLE (LDASH)
   RECT (300,900,600,400)
   PRINT TEXT ("VIEW PLANE", 700, 920)
   
   SET CHAR SIZE (12)
   RECT (200,400,500,300)
   PRINT TEXT ("VIEW SURFACE", 720, 250)

   SET COLOUR (BLUE)
   SET LINE STYLE (SDASH)
   RECT (500,800,300,200)
   PRINT TEXT ("WINDOW", 620,810)
  
   RECT (300,350,200,200)
   SET CHAR SIZE (9)
   PRINT TEXT ("VIEW PORT", 350,170)
   
   SET LINE STYLE (DOTTED)
   SET COLOUR (RED)
   JOIN (500, 800, 300, 350)
   JOIN (800, 800, 500, 350)
   JOIN (500, 600, 300, 150)
   JOIN (800, 600, 500, 150)

   SET CHAR SIZE (7)
   PRINT TEXT ("VIEWING TRANSFORMATION", 720,450)

   TERMINATE EDWIN

end of program