home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 1 / crawlyvol1.bin / program / compiler / stjo2122 / tutorial / tutor4.mod < prev    next >
Encoding:
Text File  |  1993-11-25  |  3.0 KB  |  116 lines

  1. MODULE Tutor4;
  2.  
  3. IMPORT S:=SYSTEM, GemApp, Menus, WinView, MVC, VC:=VDIControl, VO:=VDIOutput,
  4.        VA:=VDIAttributes, Form, Graf, Rsrc;
  5.  
  6. CONST
  7.     BOX        = 0; (* form/dialog *)
  8.     OK         = 4; (* BUTTON in tree BOX *)
  9.     INPUT1     = 5; (* BUTTON in tree BOX *)
  10.     OUTPUT1    = 6; (* BUTTON in tree BOX *)
  11.  
  12.     MENU       = 1; (* menu *)
  13.     DESK       = 3; (* TITLE in tree MENU *)
  14.     FILE       = 4; (* TITLE in tree MENU *)
  15.     WORK       = 5; (* TITLE in tree MENU *)
  16.     INFO       = 8; (* STRING in tree MENU *)
  17.     QUIT       = 17; (* STRING in tree MENU *)
  18.     INPUT2     = 19; (* STRING in tree MENU *)
  19.     OUTPUT2    = 20; (* STRING in tree MENU *)
  20.  
  21.     INPUTBOX   = 2; (* form/dialog *)
  22.     CIRCLE     = 2; (* BUTTON in tree INPUTBOX *)
  23.     RECT       = 3; (* BUTTON in tree INPUTBOX *)
  24.     XPOS       = 4; (* FTEXT in tree INPUTBOX *)
  25.     YPOS       = 5; (* FTEXT in tree INPUTBOX *)
  26.     RADIUS     = 6; (* FTEXT in tree INPUTBOX *)
  27.     WIDTH      = 7; (* FTEXT in tree INPUTBOX *)
  28.     HEIGHT     = 8; (* FTEXT in tree INPUTBOX *)
  29.     DRAW       = 9; (* BUTTON in tree INPUTBOX *)
  30.  
  31.  
  32. TYPE
  33.   Application = POINTER TO ApplDesc;
  34.   ApplDesc    = RECORD(GemApp.ApplDesc)
  35.                 END;
  36.   Viewer    = POINTER TO ViewDesc;
  37.   ViewDesc  = RECORD(WinView.ViewDesc)
  38.               END;
  39.   MyModel   = POINTER TO ModelDesc;
  40.   ModelDesc = RECORD(MVC.ModelDesc)
  41.               END;
  42.  
  43.  
  44. VAR
  45.   myApp : Application;
  46.   myModel : MyModel;
  47.   Station : INTEGER;
  48.   Workout : VC.workout;
  49.  
  50.  
  51. PROCEDURE(v : Viewer) Redraw(x,y,w,h : INTEGER);
  52.   VAR x2, y2 : INTEGER;
  53.  BEGIN
  54.   x2 := x+w-1; y2 := y+h-1;
  55.   VC.VsClip( Station, TRUE, x, y, x2, y2);
  56.   VO.VBar( Station, x, y, x2, y2 );
  57.  END Redraw;
  58.  
  59.  
  60. PROCEDURE OpenOutput;
  61.   VAR outWin  : Viewer;
  62.  BEGIN
  63.   NEW( outWin); outWin.Init;
  64.   outWin.model := myModel;
  65.   outWin.SetTitle("Objektfenster");
  66.   outWin.SetFullSize( 0, 19, Workout.MaxX - 1,
  67.                       Workout.MaxY - 20);
  68.   outWin.Open;
  69.  END OpenOutput;
  70.  
  71.  
  72. PROCEDURE ShowInfo;
  73.   VAR d : INTEGER;
  74.  BEGIN
  75.   d := Form.Alert(1, "[1][Tutor4 by Stephan Junker][Ok]");
  76.  END ShowInfo;
  77.  
  78.  
  79. PROCEDURE Exit;
  80.  BEGIN
  81.   GemApp.exit := TRUE;
  82.  END Exit;
  83.  
  84.  
  85. PROCEDURE (app : Application) Init;
  86.   VAR Workin : VC.workin;
  87.       menu : Menus.Menu;
  88.  BEGIN
  89.   app.Init^;
  90.   Graf.ChangeMouse( Graf.ARROW);
  91.   IF NOT Rsrc.Load("GEMDEMO.RSC") THEN
  92.     app.Exit
  93.   END;
  94.   NEW( menu); menu.Init( Rsrc.GetAddr(MENU) );
  95.   menu.Set( FILE, QUIT, Exit );
  96.   menu.Set( DESK, INFO, ShowInfo );
  97.   menu.Set( WORK, OUTPUT2, OpenOutput );
  98.   menu.Show;
  99.   Station := 1;
  100.   Workin.Id := 1; Workin.LineType := 1;
  101.   Workin.LineColor := 1; Workin.MarkType := 1;
  102.   Workin.MarkColor := 1; Workin.Font := 1;
  103.   Workin.TextColor := 1; Workin.FillStyle := 0;
  104.   Workin.FillPat := 0; Workin.FillColor := 1;
  105.   Workin.KoorType := 2;
  106.   VC.VOpnvwk(Workin,Station,Workout);
  107.   VA.VswrMode(Station,VA.REPLACE);
  108.   VA.VsfPerimeter(Station,FALSE);
  109.   NEW( myModel); myModel.Init;
  110.  END Init;
  111.  
  112. BEGIN
  113.   NEW( myApp);
  114.   myApp.Init; myApp.Run; myApp.Exit
  115. END Tutor4.
  116.