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

  1. MODULE Tutor5;
  2.  
  3. IMPORT S:=SYSTEM, GemApp, Menus, WinView, MVC, VC:=VDIControl, VO:=VDIOutput,
  4.        VA:=VDIAttributes, Form, Graf, Rsrc, WDial:=WindowDialog;
  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.   infoDial : WDial.Dialog;
  50.  
  51.  
  52. PROCEDURE(v : Viewer) Redraw(x,y,w,h : INTEGER);
  53.   VAR x2, y2 : INTEGER;
  54.  BEGIN
  55.   x2 := x+w-1; y2 := y+h-1;
  56.   VC.VsClip( Station, TRUE, x, y, x2, y2);
  57.   VO.VBar( Station, x, y, x2, y2 );
  58.  END Redraw;
  59.  
  60.  
  61. PROCEDURE OpenOutput;
  62.   VAR outWin  : Viewer;
  63.  BEGIN
  64.   NEW( outWin); outWin.Init;
  65.   outWin.model := myModel;
  66.   outWin.SetTitle("Objektfenster");
  67.   outWin.SetFullSize( 0, 19, Workout.MaxX - 1,
  68.                       Workout.MaxY - 20);
  69.   outWin.Open;
  70.  END OpenOutput;
  71.  
  72.  
  73. PROCEDURE ShowInfo;
  74.  BEGIN
  75.   infoDial.Open;
  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 menu : Menus.Menu;
  87.       Workin : VC.workin;
  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.   NEW( infoDial);
  111.   infoDial.InitDialog( Rsrc.GetAddr(BOX) , 0, TRUE);
  112.   infoDial.SetWork(OK, NIL, { WDial.DESELECT,
  113.                               WDial.EXITONLY } );
  114.   infoDial.SetWork(OUTPUT1, OpenOutput,
  115.              { WDial.DESELECT, WDial.REDRAWOBJ } );
  116.   infoDial.SetTitle("Information");
  117.  END Init;
  118.  
  119. BEGIN
  120.   NEW( myApp);
  121.   myApp.Init; myApp.Run; myApp.Exit
  122. END Tutor5.
  123.