-- file: GFtoPressImpl3.mesa
-- Pascal-to-Mesa translator output, translated at October 25, 1985 5:07:13 pm PDT


DIRECTORY
  PascalBasic,
  PascalWizardFiles,
  GFtoPressPrivate,
  GFtoPressVars1,
  GFtoPressVars2,
  GFtoPressVars3;

GFtoPressImpl3: PROGRAM IMPORTS PascalBasic, GFtoPressPrivate, GFtoPressVars2, GFtoPressVars3 EXPORTS GFtoPressPrivate = PUBLIC
BEGIN OPEN PascalBasic, PascalWizardFiles, GFtoPressPrivate, GFtoPressVars1, GFtoPressVars2, GFtoPressVars3;

 NLDot: PROCEDURE[P: TreePointer] = 
BEGIN XDot←Xx↑[P];YDot←Yy↑[P];
DDot←536870912;EvenNLDot[Root]; END;--:150----152:
 
--150:-- EvenNLDot: PROCEDURE[P: TreePointer] = 
BEGIN IF P#0  THEN BEGIN IF Info↑[P]<0  THEN IF DlTie↑[P]=0  THEN IF ABS[Xx
↑[P]-XDot]<DDot  THEN IF ABS[Yy↑[P]-YDot]<DDot  THEN BEGIN QDot←P;
DDot←ABS[Xx↑[P]-XDot];
IF DDot<ABS[Yy↑[P]-YDot] THEN DDot←ABS[Yy↑[P]-YDot]; END;
OddNLDot[Mid↑[P]];
IF Xl↑[P]-DotWidth>XDot-DDot  THEN OddNLDot[Left↑[P]];
IF Xr↑[P]+DotWidth<XDot+DDot  THEN OddNLDot[Right↑[P]]; END; END;
 

 OddNLDot: PROCEDURE[P: TreePointer] = 
BEGIN IF P#0  THEN BEGIN IF Info↑[P]<0  THEN IF DlTie↑[P]=0  THEN IF ABS[Xx
↑[P]-XDot]<DDot  THEN IF ABS[Yy↑[P]-YDot]<DDot  THEN BEGIN QDot←P;
DDot←ABS[Xx↑[P]-XDot];
IF DDot<ABS[Yy↑[P]-YDot] THEN DDot←ABS[Yy↑[P]-YDot]; END;
EvenNLDot[Mid↑[P]];
IF Yt↑[P]-DotHeight>YDot-DDot  THEN EvenNLDot[Left↑[P]];
IF Yb↑[P]+DotHeight<YDot+DDot  THEN EvenNLDot[Right↑[P]]; END; END;
--:152----168:-- Convert: PROCEDURE[X,Y: Scaled] = 
BEGIN X←X+XOffset;
Y←Y+YOffset;DviY←-PascalROUND[YRatio*PascalFLOAT[Y]]+DeltaY;
DviX←PascalROUND[XRatio*PascalFLOAT[X]+SlantRatio*PascalFLOAT[Y]]+DeltaX; END;--:168----186:
 TopCoords: PROCEDURE[P: TreePointer]
 = 
BEGIN Xx↑[P]←DviX-( PascalDIVPower2[BoxWidth ,1]);Xl↑[P]←Xx↑[P]-Delta;
Xr↑[P]←Xx↑[P]+BoxWidth+Delta;Yb↑[P]←DviY-DotHeight;
Yy↑[P]←Yb↑[P]-BoxDepth;Yt↑[P]←Yy↑[P]-BoxHeight-Delta; END;--:186----187:
 BotCoords: PROCEDURE[P: TreePointer]
 = 
BEGIN Xx↑[P]←DviX-( PascalDIVPower2[BoxWidth ,1]);Xl↑[P]←Xx↑[P]-Delta;
Xr↑[P]←Xx↑[P]+BoxWidth+Delta;Yt↑[P]←DviY+DotHeight;
Yy↑[P]←Yt↑[P]+BoxHeight;Yb↑[P]←Yy↑[P]+BoxDepth+Delta; END;
 RightCoords: PROCEDURE[P: TreePointer] = 
BEGIN Xl↑[P]←DviX+DotWidth;
Xx↑[P]←Xl↑[P];Xr↑[P]←Xx↑[P]+BoxWidth+Delta;Yy↑[P]←DviY+HalfXHeight;
Yb↑[P]←Yy↑[P]+BoxDepth+Delta;Yt↑[P]←Yy↑[P]-BoxHeight-Delta; END;
 LeftCoords: PROCEDURE[P: TreePointer] = 
BEGIN Xr↑[P]←DviX-DotWidth;
Xx↑[P]←Xr↑[P]-BoxWidth;Xl↑[P]←Xx↑[P]-Delta;Yy↑[P]←DviY+HalfXHeight;
Yb↑[P]←Yy↑[P]+BoxDepth+Delta;Yt↑[P]←Yy↑[P]-BoxHeight-Delta; END;--:187
--192:-- DoALabel: PROCEDURE[P: TreePointer] = 
BEGIN Q:TreePointer;
 Hbox[Info↑[P],2,FALSE];DviX←Xx↑[P];DviY←Yy↑[P];
SELECT Left↑[P]FROM 49,53 =>TopCoords[P];50,54 =>LeftCoords[P];
51,55 =>RightCoords[P];52,56 =>BotCoords[P]; ENDCASE;Q←DlTie↑[P];DlTie↑[Q]←0;
TreeIns[P];PressGoto[Xx↑[P],Yy↑[P]];Hbox[Info↑[P],2,TRUE]; END;--:192
--193:-- DoBLabel: PROCEDURE[P: TreePointer] = 
BEGIN 
 Q:TreePointer; Hbox[Info↑[P],2,FALSE];DviX←Xx↑[P];
DviY←Yy↑[P];--195:--OvFlag←FALSE;Q←DlTie↑[P];--196:
SELECT DlTie↑[Q]FROM 1,8,10,15 =>LeftCoords[P];2,3,9,12 =>BotCoords[P];
4,5,11,14 =>RightCoords[P];6,7,13,16 =>TopCoords[P]; ENDCASE;
{{IF  NOT Overlap[P] THEN  GOTO Label40--:196--;--197:
SELECT DlTie↑[Q]FROM 1,4,13,16 =>BotCoords[P];2,7,11,14 =>LeftCoords[P];
3,6,10,15 =>RightCoords[P];5,8,9,12 =>TopCoords[P]; ENDCASE;
IF  NOT Overlap[P] THEN  GOTO Label40--:197--;--198:
SELECT DlTie↑[Q]FROM 1,4,14,15 =>TopCoords[P];2,7,12,13 =>RightCoords[P];
3,6,9,16 =>LeftCoords[P];5,8,10,11 =>BotCoords[P]; ENDCASE;
IF  NOT Overlap[P] THEN  GOTO Label40--:198--;--199:
SELECT DlTie↑[Q]FROM 1,8,9,16 =>RightCoords[P];2,3,10,11 =>TopCoords[P];
4,5,12,13 =>LeftCoords[P];6,7,14,15 =>BotCoords[P]; ENDCASE;
IF  NOT Overlap[P] THEN  GOTO Label40--:199--;Xx↑[P]←DviX;Yy↑[P]←DviY;
IF Left↑[P]=48  THEN OvFlag←TRUE; GOTO Label10--:195--;EXITS Label40 => NULL};TreeIns[P];
Q←DlTie↑[P];DlTie↑[Q]←0;PressGoto[Xx↑[P],Yy↑[P]];Hbox[Info↑[P],2,TRUE];
EXITS Label10 => NULL}; END;--:193----194:-- DoDot: PROCEDURE[P: TreePointer] = 
BEGIN Q:TreePointer;
 Q←GetAvail[];IF FirstDot=0  THEN FirstDot←Q;LastDot←Q;
DlTie↑[P]←Q;DlTie↑[Q]←P;Info↑[Q]←-Info↑[P];Convert[Xx↑[P],Yy↑[P]];
Xx↑[Q]←DviX;Yy↑[Q]←DviY;Xx↑[P]←Xx↑[Q];Yy↑[P]←Yy↑[Q];
Xl↑[Q]←DviX-DotWidth;Xr↑[Q]←DviX+DotWidth;Yt↑[Q]←DviY-DotHeight;
Yb↑[Q]←DviY+DotHeight;TreeIns[Q];PressGoto[Xx↑[Q],Yy↑[Q]];
PressSetChar[0]; END;--:194----216:--
END.