mentor/derived/CPTranscriptView.m3


 Copyright (C) 1995, Digital Equipment Corporation.       
 All rights reserved.                                     
 See the file COPYRIGHT for a full description.           
                                                          
 Last modified on Thu Feb  9 08:56:02 PST 1995 by kalsow  
      modified on Mon Jun  6 03:18:55 PDT 1994 by mhb   
      modified on Tue Feb 16 16:31:40 PST 1993 by johnh 

********************************************************************

      *  NOTE: This file is generated automatically from the event
      *        definition file CP.evt.
      ********************************************************************


<* PRAGMA LL *>

MODULE CPTranscriptView;

<*NOWARN*> IMPORT TextPort, Rd, CPViewClass, ZeusClass, Filter, R2;
<*NOWARN*> IMPORT TextEditVBT, Fmt, ZFmt, Wr, ZeusPanel, FormsVBT;
<*NOWARN*> IMPORT VBT, View;

<* FATAL FormsVBT.Error, FormsVBT.Unimplemented *>

REVEAL
  T = Public BRANDED OBJECT
    fv: FormsVBT.T := NIL;
    te: TextEditVBT.T := NIL;
  OVERRIDES
    init       := TViewInit;
    install    := TViewInstall;
    delete     := TViewDelete;
    snapshot   := TViewSnapshot;
    restore    := TViewRestore;
    config     := TViewConfig;
    reactivity := TViewReactivity;
    startrun   := TViewStartrun;
    endrun     := TViewEndrun;
    oeSetup := Setup;
    oeAddPoint := AddPoint;
    oeNotProcessed := NotProcessed;
    oeRemoveNotProcessed := RemoveNotProcessed;
    oeActiveR := ActiveR;
    oeRemoveActiveR := RemoveActiveR;
    oeCloseR := CloseR;
    oeRemoveCloseR := RemoveCloseR;
    oeSplit := Split;
    oeSplitRemove := SplitRemove;
    oeNewMin := NewMin;
    oeNoChangeMin := NoChangeMin;
    oeSelectTrialPoint := SelectTrialPoint;
    oeDeselectTrialPoint := DeselectTrialPoint;
    oeSelectTargetPoint := SelectTargetPoint;
    oeDeselectTargetPoint := DeselectTargetPoint;
    oeDrawBar := DrawBar;
    oeRemoveBar := RemoveBar;
  END;

PROCEDURE TViewInit (view: T): T =
  <* LL = VBT.mu *>
  BEGIN
    TViewZTrace (view, "init");
    RETURN CPViewClass.T.init (view, NIL);
  END TViewInit;

PROCEDURE Clear (<* UNUSED *> fv  : FormsVBT.T;
                 <* UNUSED *> name: TEXT;
                              cl  : REFANY;
                 <* UNUSED *> time: VBT.TimeStamp) =
  BEGIN
    TextPort.SetText(NARROW(cl, T).te.tp, "")
  END Clear;

PROCEDURE TViewInstall (view: T) =
  <* LL = VBT.mu *>
  BEGIN
    view.fv := ZeusPanel.NewForm("CPTranscriptView.fv");
    view.te := FormsVBT.GetVBT(view.fv, "transcript");
    TViewZTrace (view, "install");
    FormsVBT.AttachProc(view.fv, "clear", Clear, view);
    EVAL Filter.Replace (view, view.fv);
    CPViewClass.T.install (view);
  END TViewInstall;

PROCEDURE TViewDelete (view: T) =
  <* LL = VBT.mu *>
  BEGIN
    TViewZTrace (view, "delete");
    CPViewClass.T.delete (view);
   END TViewDelete;

PROCEDURE TViewSnapshot (view: T; wr: Wr.T) RAISES {ZeusClass.Error} =
  <* LL = VBT.mu *>
  BEGIN
    TViewZTrace (view, "snapshot");
    CPViewClass.T.snapshot (view, wr);
   END TViewSnapshot;

PROCEDURE TViewRestore (view: T; rd: Rd.T) RAISES {ZeusClass.Error} =
  <* LL = VBT.mu *>
  BEGIN
    TViewZTrace (view, "restore");
    CPViewClass.T.restore (view, rd);
   END TViewRestore;

PROCEDURE TViewConfig (
    view: T;
    state: ZeusClass.StateChange;
    o: ZeusClass.T) =
  <* LL = VBT.mu *>
  BEGIN
    TViewZTrace (view, "config");
    CPViewClass.T.config (view, state, o);
   END TViewConfig;

PROCEDURE TViewReactivity (view: T; <*UNUSED*> on: BOOLEAN) =
  <* LL = VBT.mu *>
  BEGIN
    TViewZTrace(view, "reactivity");
    CPViewClass.T.reactivity (view, TRUE);
  END TViewReactivity;

PROCEDURE TViewStartrun (view: T) =
  <* LL = {} *>
  BEGIN
    TViewZTrace (view, "startrun");
    CPViewClass.T.startrun (view);
   END TViewStartrun;

PROCEDURE TViewEndrun (view: T) =
  <* LL = {} *>
  BEGIN
    TViewZTrace (view, "endrun");
    CPViewClass.T.endrun (view);
  END TViewEndrun;
event handling methods:

PROCEDURE Setup (view: T;  ) =
  <* LL = {} *>
  BEGIN
    LOCK VBT.mu DO
    IF FormsVBT.GetBoolean(view.fv, "alg") THEN
       IF NOT FormsVBT.GetBoolean(view.fv, "args") THEN
          TViewTrace (view, "Setup ...")
       ELSE
          TViewTrace (view, "Setup "
          )
       END
    END
    END
  END Setup;

PROCEDURE AddPoint (view: T;  p: R2.T; N: INTEGER; big: BOOLEAN) =
  <* LL = {} *>
  BEGIN
    LOCK VBT.mu DO
    IF FormsVBT.GetBoolean(view.fv, "alg") THEN
       IF NOT FormsVBT.GetBoolean(view.fv, "args") THEN
          TViewTrace (view, "AddPoint ...")
       ELSE
          TViewTrace (view, "AddPoint "
          & R2.ToText(p)
          & " "
          & Fmt.Int(N)
          & " "
          & Fmt.Bool(big)
          )
       END
    END
    END
  END AddPoint;

PROCEDURE NotProcessed (view: T;  x1, x2: REAL; big: BOOLEAN) =
  <* LL = {} *>
  BEGIN
    LOCK VBT.mu DO
    IF FormsVBT.GetBoolean(view.fv, "alg") THEN
       IF NOT FormsVBT.GetBoolean(view.fv, "args") THEN
          TViewTrace (view, "NotProcessed ...")
       ELSE
          TViewTrace (view, "NotProcessed "
          & Fmt.Real(x1)
          & " "
          & Fmt.Real(x2)
          & " "
          & Fmt.Bool(big)
          )
       END
    END
    END
  END NotProcessed;

PROCEDURE RemoveNotProcessed (view: T;  x1, x2: REAL; big: BOOLEAN) =
  <* LL = {} *>
  BEGIN
    LOCK VBT.mu DO
    IF FormsVBT.GetBoolean(view.fv, "alg") THEN
       IF NOT FormsVBT.GetBoolean(view.fv, "args") THEN
          TViewTrace (view, "RemoveNotProcessed ...")
       ELSE
          TViewTrace (view, "RemoveNotProcessed "
          & Fmt.Real(x1)
          & " "
          & Fmt.Real(x2)
          & " "
          & Fmt.Bool(big)
          )
       END
    END
    END
  END RemoveNotProcessed;

PROCEDURE ActiveR (view: T;  x1, x2: REAL; big: BOOLEAN) =
  <* LL = {} *>
  BEGIN
    LOCK VBT.mu DO
    IF FormsVBT.GetBoolean(view.fv, "alg") THEN
       IF NOT FormsVBT.GetBoolean(view.fv, "args") THEN
          TViewTrace (view, "ActiveR ...")
       ELSE
          TViewTrace (view, "ActiveR "
          & Fmt.Real(x1)
          & " "
          & Fmt.Real(x2)
          & " "
          & Fmt.Bool(big)
          )
       END
    END
    END
  END ActiveR;

PROCEDURE RemoveActiveR (view: T;  x1, x2: REAL; big: BOOLEAN) =
  <* LL = {} *>
  BEGIN
    LOCK VBT.mu DO
    IF FormsVBT.GetBoolean(view.fv, "alg") THEN
       IF NOT FormsVBT.GetBoolean(view.fv, "args") THEN
          TViewTrace (view, "RemoveActiveR ...")
       ELSE
          TViewTrace (view, "RemoveActiveR "
          & Fmt.Real(x1)
          & " "
          & Fmt.Real(x2)
          & " "
          & Fmt.Bool(big)
          )
       END
    END
    END
  END RemoveActiveR;

PROCEDURE CloseR (view: T;  x1, x2: REAL; big: BOOLEAN) =
  <* LL = {} *>
  BEGIN
    LOCK VBT.mu DO
    IF FormsVBT.GetBoolean(view.fv, "alg") THEN
       IF NOT FormsVBT.GetBoolean(view.fv, "args") THEN
          TViewTrace (view, "CloseR ...")
       ELSE
          TViewTrace (view, "CloseR "
          & Fmt.Real(x1)
          & " "
          & Fmt.Real(x2)
          & " "
          & Fmt.Bool(big)
          )
       END
    END
    END
  END CloseR;

PROCEDURE RemoveCloseR (view: T;  x1, x2: REAL; big: BOOLEAN) =
  <* LL = {} *>
  BEGIN
    LOCK VBT.mu DO
    IF FormsVBT.GetBoolean(view.fv, "alg") THEN
       IF NOT FormsVBT.GetBoolean(view.fv, "args") THEN
          TViewTrace (view, "RemoveCloseR ...")
       ELSE
          TViewTrace (view, "RemoveCloseR "
          & Fmt.Real(x1)
          & " "
          & Fmt.Real(x2)
          & " "
          & Fmt.Bool(big)
          )
       END
    END
    END
  END RemoveCloseR;

PROCEDURE Split (view: T;  x: REAL; big: BOOLEAN) =
  <* LL = {} *>
  BEGIN
    LOCK VBT.mu DO
    IF FormsVBT.GetBoolean(view.fv, "alg") THEN
       IF NOT FormsVBT.GetBoolean(view.fv, "args") THEN
          TViewTrace (view, "Split ...")
       ELSE
          TViewTrace (view, "Split "
          & Fmt.Real(x)
          & " "
          & Fmt.Bool(big)
          )
       END
    END
    END
  END Split;

PROCEDURE SplitRemove (view: T;  x: REAL; big: BOOLEAN) =
  <* LL = {} *>
  BEGIN
    LOCK VBT.mu DO
    IF FormsVBT.GetBoolean(view.fv, "alg") THEN
       IF NOT FormsVBT.GetBoolean(view.fv, "args") THEN
          TViewTrace (view, "SplitRemove ...")
       ELSE
          TViewTrace (view, "SplitRemove "
          & Fmt.Real(x)
          & " "
          & Fmt.Bool(big)
          )
       END
    END
    END
  END SplitRemove;

PROCEDURE NewMin (view: T;  p1, p2, c1, c2: R2.T; big: BOOLEAN) =
  <* LL = {} *>
  BEGIN
    LOCK VBT.mu DO
    IF FormsVBT.GetBoolean(view.fv, "alg") THEN
       IF NOT FormsVBT.GetBoolean(view.fv, "args") THEN
          TViewTrace (view, "NewMin ...")
       ELSE
          TViewTrace (view, "NewMin "
          & R2.ToText(p1)
          & " "
          & R2.ToText(p2)
          & " "
          & R2.ToText(c1)
          & " "
          & R2.ToText(c2)
          & " "
          & Fmt.Bool(big)
          )
       END
    END
    END
  END NewMin;

PROCEDURE NoChangeMin (view: T;  p1, p2, c1, c2: R2.T; big: BOOLEAN) =
  <* LL = {} *>
  BEGIN
    LOCK VBT.mu DO
    IF FormsVBT.GetBoolean(view.fv, "alg") THEN
       IF NOT FormsVBT.GetBoolean(view.fv, "args") THEN
          TViewTrace (view, "NoChangeMin ...")
       ELSE
          TViewTrace (view, "NoChangeMin "
          & R2.ToText(p1)
          & " "
          & R2.ToText(p2)
          & " "
          & R2.ToText(c1)
          & " "
          & R2.ToText(c2)
          & " "
          & Fmt.Bool(big)
          )
       END
    END
    END
  END NoChangeMin;

PROCEDURE SelectTrialPoint (view: T;  x: R2.T; big: BOOLEAN) =
  <* LL = {} *>
  BEGIN
    LOCK VBT.mu DO
    IF FormsVBT.GetBoolean(view.fv, "alg") THEN
       IF NOT FormsVBT.GetBoolean(view.fv, "args") THEN
          TViewTrace (view, "SelectTrialPoint ...")
       ELSE
          TViewTrace (view, "SelectTrialPoint "
          & R2.ToText(x)
          & " "
          & Fmt.Bool(big)
          )
       END
    END
    END
  END SelectTrialPoint;

PROCEDURE DeselectTrialPoint (view: T;  x: R2.T; big: BOOLEAN) =
  <* LL = {} *>
  BEGIN
    LOCK VBT.mu DO
    IF FormsVBT.GetBoolean(view.fv, "alg") THEN
       IF NOT FormsVBT.GetBoolean(view.fv, "args") THEN
          TViewTrace (view, "DeselectTrialPoint ...")
       ELSE
          TViewTrace (view, "DeselectTrialPoint "
          & R2.ToText(x)
          & " "
          & Fmt.Bool(big)
          )
       END
    END
    END
  END DeselectTrialPoint;

PROCEDURE SelectTargetPoint (view: T;  trialp, targp: R2.T; big: BOOLEAN) =
  <* LL = {} *>
  BEGIN
    LOCK VBT.mu DO
    IF FormsVBT.GetBoolean(view.fv, "alg") THEN
       IF NOT FormsVBT.GetBoolean(view.fv, "args") THEN
          TViewTrace (view, "SelectTargetPoint ...")
       ELSE
          TViewTrace (view, "SelectTargetPoint "
          & R2.ToText(trialp)
          & " "
          & R2.ToText(targp)
          & " "
          & Fmt.Bool(big)
          )
       END
    END
    END
  END SelectTargetPoint;

PROCEDURE DeselectTargetPoint (view: T;  trialp, targp: R2.T; big: BOOLEAN) =
  <* LL = {} *>
  BEGIN
    LOCK VBT.mu DO
    IF FormsVBT.GetBoolean(view.fv, "alg") THEN
       IF NOT FormsVBT.GetBoolean(view.fv, "args") THEN
          TViewTrace (view, "DeselectTargetPoint ...")
       ELSE
          TViewTrace (view, "DeselectTargetPoint "
          & R2.ToText(trialp)
          & " "
          & R2.ToText(targp)
          & " "
          & Fmt.Bool(big)
          )
       END
    END
    END
  END DeselectTargetPoint;

PROCEDURE DrawBar (view: T;  y, x1, x2: REAL; big: BOOLEAN) =
  <* LL = {} *>
  BEGIN
    LOCK VBT.mu DO
    IF FormsVBT.GetBoolean(view.fv, "alg") THEN
       IF NOT FormsVBT.GetBoolean(view.fv, "args") THEN
          TViewTrace (view, "DrawBar ...")
       ELSE
          TViewTrace (view, "DrawBar "
          & Fmt.Real(y)
          & " "
          & Fmt.Real(x1)
          & " "
          & Fmt.Real(x2)
          & " "
          & Fmt.Bool(big)
          )
       END
    END
    END
  END DrawBar;

PROCEDURE RemoveBar (view: T;  y, x1, x2: REAL; big: BOOLEAN) =
  <* LL = {} *>
  BEGIN
    LOCK VBT.mu DO
    IF FormsVBT.GetBoolean(view.fv, "alg") THEN
       IF NOT FormsVBT.GetBoolean(view.fv, "args") THEN
          TViewTrace (view, "RemoveBar ...")
       ELSE
          TViewTrace (view, "RemoveBar "
          & Fmt.Real(y)
          & " "
          & Fmt.Real(x1)
          & " "
          & Fmt.Real(x2)
          & " "
          & Fmt.Bool(big)
          )
       END
    END
    END
  END RemoveBar;

PROCEDURE TViewZTrace (view: T; t: TEXT) =
  BEGIN
    IF view.fv # NIL THEN
      IF FormsVBT.GetBoolean(view.fv, "zeus") THEN
        TextPort.PutText(view.te.tp, "**zeus:  " & t & "\n");
        TextPort.Normalize(view.te.tp, LAST(INTEGER))
      END
    END
  END TViewZTrace;

PROCEDURE TViewTrace (view: T; t: TEXT) =
  BEGIN
    TextPort.PutText(view.te.tp, "--event: " & t & "\n");
    TextPort.Normalize(view.te.tp, LAST(INTEGER))
  END TViewTrace;

PROCEDURE TViewNew (): View.T =
  BEGIN
    RETURN NEW(T).init()
  END TViewNew;

BEGIN
  ZeusPanel.RegisterView
      (TViewNew, "CP Transcript View", "CP");
END CPTranscriptView.

interface View is in: