home *** CD-ROM | disk | FTP | other *** search
/ Atari FTP / ATARI_FTP_0693.zip / ATARI_FTP_0693 / Tex / td187src.lzh / TEXTBOX.I < prev    next >
Text File  |  1991-12-14  |  51KB  |  1,628 lines

  1. IMPLEMENTATION MODULE TextBox ;
  2.  
  3. FROM SYSTEM   IMPORT ADDRESS , ADR;
  4. FROM Storage  IMPORT ALLOCATE , DEALLOCATE ;
  5. FROM OwnBoxes IMPORT MousePos, WaitForDepress;
  6.  
  7. IMPORT CommonData ;
  8. IMPORT Diverses;
  9. IMPORT Fill;
  10. IMPORT HelpModule ;
  11. IMPORT MagicAES ;
  12. IMPORT MagicBIOS ;
  13. IMPORT MagicStrings;
  14. IMPORT MagicSys;
  15. IMPORT MagicVDI ;
  16. IMPORT MathLib0;
  17. IMPORT mtAppl ;
  18. IMPORT Types;
  19. IMPORT Undo;
  20. IMPORT Variablen ;
  21. IMPORT VectorFont;
  22.  
  23. (**
  24. IMPORT RTD;
  25. **)
  26.  
  27. CONST UseXBIOS     = FALSE;
  28.  
  29. TYPE XYArray       = ARRAY [0..3] OF INTEGER;
  30.  
  31. VAR AlignMode      : INTEGER;
  32.     Internal       : BOOLEAN;
  33.     VectorFontMode : BOOLEAN;
  34.     storesize      : LONGREAL;
  35.     storeslant     : LONGREAL;
  36.     storeangle     : INTEGER;
  37.  
  38.  
  39. PROCEDURE SetVectorText(On : BOOLEAN);
  40. (*
  41.    Schaltet auf Vektor-Zeichensatz um;
  42.    standardmä₧ig jedoch ausgeschaltet.
  43. *)
  44. BEGIN
  45.   VectorFontMode := On;
  46.   IF VectorFontMode THEN
  47.     VectorFontMode := VectorFont.FontsLoaded()>0;
  48.   END;
  49. END SetVectorText;
  50.  
  51. PROCEDURE RoundedRect(pxy : ARRAY OF INTEGER);
  52. VAR maxradius    : INTEGER;
  53.     min          : INTEGER;
  54.     radius       : INTEGER;
  55.     MinX, MinY   : INTEGER;
  56.     distx, disty : INTEGER;
  57.     line         : ARRAY [0..3] OF INTEGER;
  58.  
  59. BEGIN
  60.   maxradius := Variablen.MaxCircle();
  61.   maxradius := Variablen.PicDistance(maxradius);
  62.   MinX := Diverses.min(pxy[0], pxy[2]);
  63.   MinY := Diverses.min(pxy[1], pxy[3]);
  64.   min  := Diverses.min(ABS(pxy[2] - pxy[0]), ABS(pxy[3] - pxy[1]));
  65.   radius := Variablen.PicDistance(min DIV 2);
  66.   IF radius>maxradius THEN radius := maxradius; END;
  67.   IF min>0 THEN
  68.     distx := ABS(pxy[2] - pxy[0]) - 2*radius;
  69.     disty := ABS(pxy[3] - pxy[1]) - 2*radius;
  70.     (* Zeichne die 4 Eckkreise *)
  71.     (* Links oben *)
  72.      MagicVDI.Arc (mtAppl.VDIHandle , MinX + radius, MinY + radius,
  73.                    radius , 900 , 1800) ;
  74.     (* Links unten *)
  75.      MagicVDI.Arc (mtAppl.VDIHandle , MinX + radius, MinY + radius + disty,
  76.                    radius , 1800 , 2700) ;
  77.     (* Rechts unten *)
  78.      MagicVDI.Arc (mtAppl.VDIHandle , MinX + radius + distx, MinY + radius + disty,
  79.                    radius , 2700 , 3600) ;
  80.     (* Rechts oben *)
  81.      MagicVDI.Arc (mtAppl.VDIHandle , MinX + radius + distx, MinY + radius,
  82.                    radius , 0 , 900) ;
  83.     (* Und dann die Zwischenlinien *)
  84.     IF distx>0 THEN
  85.       line[0] := MinX + radius;         line[1] := pxy[1];
  86.       line[2] := MinX + radius + distx; line[3] := pxy[1];
  87.       MagicVDI.Polyline (mtAppl.VDIHandle , 2 , line) ;
  88.       line[1] := pxy[3];
  89.       line[3] := pxy[3];
  90.       MagicVDI.Polyline (mtAppl.VDIHandle , 2 , line) ;
  91.     END;
  92.     IF disty>0 THEN
  93.       line[0] := pxy[0];
  94.       line[1] := MinY + radius;
  95.       line[2] := pxy[0];
  96.       line[3] := MinY + radius + disty;
  97.       MagicVDI.Polyline (mtAppl.VDIHandle , 2 , line) ;
  98.       line[0] := pxy[2];
  99.       line[2] := pxy[2];
  100.       MagicVDI.Polyline (mtAppl.VDIHandle , 2 , line) ;
  101.     END;
  102.   END;
  103. END RoundedRect;
  104.  
  105. PROCEDURE FillBox(x1, y1, x2, y2 : INTEGER);
  106. VAR pxy : XYArray;
  107.     i   : INTEGER;
  108. BEGIN
  109.   IF x1<x2 THEN
  110.     pxy[0] := x1; pxy[2] := x2;
  111.    ELSE
  112.     pxy[0] := x2; pxy[2] := x1;
  113.   END;
  114.   IF y1<y2 THEN
  115.     pxy[1] := y1; pxy[3] := y2;
  116.    ELSE
  117.     pxy[1] := y2; pxy[3] := y1;
  118.   END;
  119.   IF (x1<>x2) AND (y1<>y2) THEN
  120. (**
  121.     FOR i:=0 TO 3 DO
  122.       RTD.ShowVar('pxy', pxy[i]);
  123.     END;
  124. **)
  125.     MagicVDI.SetClipping (mtAppl.VDIHandle  , CommonData.ClipXY , TRUE) ;
  126.     MagicVDI.FillRectangle(mtAppl.VDIHandle, pxy);
  127.     MagicVDI.SetClipping (mtAppl.VDIHandle  , CommonData.ClipXY , FALSE) ;
  128.   END;
  129. END FillBox;
  130.  
  131. PROCEDURE MakeBox (Style, FillMode : INTEGER ;
  132.                     VAR XY : XYArray) : BOOLEAN ;
  133.  
  134.  
  135. VAR
  136.     dum, x, y,
  137.     xo, yo, i,
  138.     picx, picy : INTEGER ;
  139.     xy , xyo   : ARRAY [ 0..9 ] OF INTEGER ;
  140.     PxyArray   : XYArray;
  141.     result     : BOOLEAN;
  142.     delete     : BOOLEAN;
  143.     lbut, rbut : BOOLEAN;
  144.  
  145. (* Style = -1 => RoundedBox *)
  146. (* Style = -2 => FrameBox (wobei Box später gelöscht wird) *)
  147.  
  148. BEGIN
  149. (**
  150.   RTD.Into('MakeBox');
  151. **)
  152.   WaitForDepress(x, y);
  153. (**
  154.   RTD.Message('Buttons released');
  155. **)
  156.   MagicVDI.SetLineEndstyles (mtAppl.VDIHandle , MagicVDI.Cornerd , MagicVDI.Cornerd) ;
  157. (**
  158.   RTD.Message('EndStyle ready');
  159. **)
  160.  
  161.   IF Style=-2 THEN
  162.     Style  := 1;
  163.     delete := TRUE;
  164.    ELSE
  165.     delete := FALSE;
  166.   END;
  167.   IF Style <> -1 THEN
  168.     dum := MagicVDI.SetLinetype (mtAppl.VDIHandle ,  Style) ;
  169.    ELSE
  170.     dum := MagicVDI.SetLinetype (mtAppl.VDIHandle ,  MagicVDI.Line) ;
  171.   END;
  172. (**
  173.   RTD.Message('Linetype ready');
  174. **)
  175.  
  176.   IF (Style=1) AND delete THEN
  177.     dum := MagicVDI.SetLinewidth (mtAppl.VDIHandle , 1);
  178.    ELSE
  179.     dum := MagicVDI.SetLinewidth (mtAppl.VDIHandle ,
  180.                                      CommonData.LineWidth) ;
  181.   END;
  182. (**
  183.   RTD.Message('Linewidth ready');
  184. **)
  185.   dum := MagicVDI.SetLinecolor (mtAppl.VDIHandle , MagicAES.BLACK) ;
  186. (**
  187.   RTD.Message('Linecolor ready');
  188. **)
  189.  
  190.   FOR i := 0 TO 4 DO
  191.     xy  [ 2*i ] := x ;
  192.     xyo [ 2*i ] := x ;
  193.     xy  [ 2*i + 1 ] := y ;
  194.     xyo [ 2*i + 1 ] := y ;
  195.   END ;
  196.   xo := x ; yo:=y ;
  197.  
  198. (**
  199.   RTD.Message('Entering repeat...');
  200. **)
  201.   REPEAT
  202.     MousePos(x, y, picx, picy, lbut, rbut);
  203.     Variablen.Position (TRUE, x, y, xy[0], xy[1]) ;
  204.  
  205.     IF (x <> xo) OR (y <> yo) THEN
  206.  
  207.       IF Style<>-1 THEN
  208.         xy [ 2 ] := x ; xy [ 4 ] := x ;
  209.         xy [ 5 ] := y ; xy [ 7 ] := y ;
  210.       ELSE
  211.         xy [ 2 ] := x; xy [ 3 ] := y;
  212.       END;
  213.  
  214. (**
  215.       RTD.Message('Init. start');
  216. **)
  217.       dum := MagicVDI.SetWritemode (mtAppl.VDIHandle , MagicVDI.XOR) ;
  218.       MagicVDI.SetClipping (mtAppl.VDIHandle  , CommonData.ClipXY , TRUE) ;
  219.       Diverses.MouseOff;
  220. (**
  221.       RTD.Message('Init. end');
  222. **)
  223.       IF Style<>-1 THEN
  224.         dum := MagicVDI.SetWritemode (mtAppl.VDIHandle , MagicVDI.XOR) ;
  225.         MagicVDI.Polyline (mtAppl.VDIHandle , 5 , xyo) ;
  226.         MagicVDI.Polyline (mtAppl.VDIHandle , 5 , xy) ;
  227.         IF (FillMode>=0) THEN
  228.           Fill.SetFillMode(FillMode);
  229. (**
  230.           RTD.Message('Set Clip');
  231. **)
  232.           MagicVDI.SetClipping (mtAppl.VDIHandle  , CommonData.ClipXY , TRUE) ;
  233. (**
  234.           RTD.Message('Set WriteMode');
  235. **)
  236.           dum := MagicVDI.SetWritemode (mtAppl.VDIHandle , MagicVDI.XOR) ;
  237.  
  238.           FillBox(xyo[0], xyo[1], xyo[4], xyo[5]);
  239.           FillBox(xy[0], xy[1], xy[4], xy[5]);
  240. (*
  241.           MagicVDI.FilledArea(mtAppl.VDIHandle , 5, xyo);
  242.           MagicVDI.FilledArea(mtAppl.VDIHandle , 5, xy);
  243. *)
  244.           Fill.SetFillMode(-1);
  245.         END;
  246.        ELSE
  247.         FOR i := 0 TO 3 DO
  248.           PxyArray[i] := xyo[i];
  249.         END;
  250.         RoundedRect (PxyArray);
  251.         FOR i := 0 TO 3 DO
  252.           PxyArray[i] := xy[i];
  253.         END;
  254.         RoundedRect (PxyArray);
  255.       END;
  256.       Diverses.MouseOn;
  257.       MagicVDI.SetClipping (mtAppl.VDIHandle  , CommonData.ClipXY , FALSE) ;
  258.       dum := MagicVDI.SetWritemode (mtAppl.VDIHandle , MagicVDI.REPLACE) ;
  259.       IF Style<> -1 THEN
  260.         xyo [ 2 ] := x ; xyo [ 4 ] := x ;
  261.         xyo [ 5 ] := y ; xyo [ 7 ] := y ;
  262.        ELSE
  263.         xyo [ 2 ] := x ; xyo [ 3 ] := y ;
  264.       END;
  265.       xo := x ; yo := y ;
  266.  
  267.     END ;
  268.  
  269.   UNTIL lbut OR rbut;
  270.  
  271.   dum := MagicVDI.SetWritemode (mtAppl.VDIHandle , MagicVDI.XOR) ;
  272.   MagicVDI.SetClipping (mtAppl.VDIHandle  , CommonData.ClipXY , TRUE) ;
  273.   Diverses.MouseOff;
  274.   IF Style<>-1 THEN
  275.     IF (FillMode>=0) THEN
  276.       Fill.SetFillMode(FillMode);
  277.       dum := MagicVDI.SetWritemode (mtAppl.VDIHandle , MagicVDI.XOR) ;
  278.       FillBox(xy[0], xy[1], xy[4], xy[5]);
  279.       Fill.SetFillMode(-1);
  280.     END;
  281.     MagicVDI.Polyline (mtAppl.VDIHandle , 5 , xy) ;
  282.    ELSE
  283.     FOR i := 0 TO 3 DO
  284.       PxyArray[i] := xy[i];
  285.     END;
  286.     RoundedRect (PxyArray);
  287.   END;
  288.   Diverses.MouseOn;
  289.   MagicVDI.SetClipping (mtAppl.VDIHandle  , CommonData.ClipXY , FALSE) ;
  290.   dum := MagicVDI.SetWritemode (mtAppl.VDIHandle , MagicVDI.REPLACE) ;
  291.   IF lbut AND NOT rbut THEN
  292.     IF NOT delete THEN
  293.       dum := MagicVDI.SetWritemode (mtAppl.VDIHandle , MagicVDI.REPLACE) ;
  294.       MagicVDI.SetClipping (mtAppl.VDIHandle  , CommonData.ClipXY , TRUE) ;
  295.       Diverses.MouseOff;
  296.       IF Style<>-1 THEN
  297.         IF FillMode=0 THEN
  298.           Fill.SetFillMode(FillMode);
  299.           FillBox(xy[0], xy[1], xy[4], xy[5]);
  300.           Fill.SetFillMode(-1);
  301.          ELSE
  302.           MagicVDI.Polyline (mtAppl.VDIHandle , 5 , xy) ;
  303.         END;
  304.        ELSE
  305.         FOR i := 0 TO 3 DO
  306.           PxyArray[i] := xy[i];
  307.         END;
  308.         RoundedRect (PxyArray);
  309.       END;
  310.       Diverses.MouseOn;
  311.       MagicVDI.SetClipping (mtAppl.VDIHandle  , CommonData.ClipXY , FALSE) ;
  312.     END;
  313.  
  314.     (* Wir berechnen nun den linken UNTEREN Punkt *)
  315.     (* y-Achse ist umgekehrt bei GEM *)
  316.     IF Style <> -1 THEN
  317.       IF xy [ 0 ] < xy [ 4 ] THEN
  318.         XY [ 0 ] := xy [ 0 ] ;
  319.         XY [ 2 ] := xy [ 4 ] - xy [ 0 ] ;  (* + 1 enfällt wegen LaTeX *)
  320.       ELSE
  321.         XY [ 0 ] := xy [ 4 ] ;
  322.         XY [ 2 ] := xy [ 0 ] - xy [ 4 ] ;
  323.       END ;
  324.  
  325.       IF xy [ 1 ] > xy [ 5 ] THEN
  326.         XY [ 1 ] := xy [ 1 ] ;
  327.         XY [ 3 ] := xy [ 1 ] - xy [ 5 ] ;
  328.       ELSE
  329.         XY [ 1 ] := xy [ 5 ] ;
  330.         XY [ 3 ] := xy [ 5 ] - xy [ 1 ] ;
  331.       END ;
  332.     ELSE
  333.       FOR i:= 0 TO 3 DO
  334.         XY [ i ] := PxyArray [ i ] ;
  335.       END;
  336.     END ;
  337.     result := TRUE;
  338.   ELSE
  339.     result:= FALSE;
  340.   END ;
  341.   dum := MagicVDI.SetLinetype (mtAppl.VDIHandle ,  MagicVDI.Line) ;
  342. (**
  343.   RTD.Leaving('MakeBox');
  344. **)
  345.   RETURN result;
  346. END MakeBox ;
  347.  
  348. PROCEDURE NrOfSublines(REF txt : ARRAY OF CHAR;
  349.                        VAR maxsublinelen : INTEGER) : INTEGER;
  350. VAR i, j, len, res, max : INTEGER;
  351. BEGIN
  352.   i   := 0;
  353.   j   := 0;
  354.   res := 1;
  355.   max := 0;
  356.   len := LENGTH(txt);
  357.   WHILE (i<len) DO
  358.     IF txt[i]='\' THEN
  359.       IF txt[i+1]='\' THEN
  360.        (* Zeilenumbruch *)
  361.         INC(i, 1);
  362.         max := Diverses.max(max, j);
  363.         INC(res, 1);
  364.         j := 0;
  365.        ELSE
  366.         INC(j, 1);
  367.       END;
  368.      ELSE
  369.       INC(j, 1);
  370.     END;
  371.     INC(i, 1);
  372.   END;
  373.   max := Diverses.max(max, j);
  374.   maxsublinelen := max;
  375.   RETURN res;
  376. END NrOfSublines;
  377.  
  378.  
  379. PROCEDURE WriteText (VAR str : ARRAY OF CHAR ; len : INTEGER ;
  380.                       Mode : INTEGER; xy : ARRAY OF INTEGER) ;
  381.  
  382. CONST MaxSubLines = 16;
  383. TYPE  Subline     = ARRAY [0..Types.CharArraySize] OF CHAR;
  384. VAR x, y, xo, yo, d  : INTEGER ;
  385.     mode             : Types.TextPosTyp ;
  386.     Sublines         : ARRAY [0..MaxSubLines-1] OF Subline;
  387.     blank            : ARRAY [0..1] OF CHAR;
  388.     i, j, NrSubs     : INTEGER;
  389.     maxlen           : INTEGER;
  390.  
  391. BEGIN
  392.   blank := ' ';
  393.   mode := VAL(Types.TextPosTyp, ORD(Mode));
  394.   NrSubs := 0;
  395.   (* Jetzt spalte den String in Sublines auf: *)
  396.   FOR i:=0 TO MaxSubLines-1 DO
  397.     Sublines[i, 0] := 0C;
  398.   END;
  399.   i := 0;
  400.   j := 0;
  401.   WHILE (i<len) DO
  402.     IF str[i]='\' THEN
  403.       IF str[i+1]='\' THEN
  404.        (* Zeilenumbruch *)
  405.         INC(i, 1);
  406.         IF NrSubs<MaxSubLines-1 THEN
  407.           Sublines[NrSubs, j] := 0C;
  408.           INC(NrSubs, 1);
  409.           j := 0;
  410.           Sublines[NrSubs,0 ] := 0C;
  411.          ELSE
  412.           INC(j, 1);
  413.         END;
  414.        ELSE
  415.         Sublines[NrSubs, j] := str[i];
  416.         Sublines[NrSubs, j+1] := 0C;
  417.         INC(j, 1);
  418.       END;
  419.      ELSE
  420.       Sublines[NrSubs, j]   := str[i];
  421.       Sublines[NrSubs, j+1] := 0C;
  422.       INC(j, 1);
  423.     END;
  424.     INC(i, 1);
  425.   END;
  426.   maxlen := 0;
  427.   FOR i:=0 TO NrSubs DO
  428.     IF MagicSys.CastToInt(MagicStrings.Length(Sublines[i])) > maxlen THEN
  429.       maxlen := MagicSys.CastToInt(MagicStrings.Length(Sublines[i]));
  430.     END;
  431.   END;
  432.   IF (NrSubs>0) THEN
  433.     CASE AlignMode OF
  434.      0: (* center, vorn und hinten auffüllen *)
  435.         FOR i:=0 TO NrSubs DO
  436.           WHILE MagicSys.CastToInt(MagicStrings.Length(Sublines[i]))<maxlen DO
  437.             MagicStrings.Insert(blank, Sublines[i], 0);
  438.             IF MagicSys.CastToInt(MagicStrings.Length(Sublines[i]))<maxlen THEN
  439.               MagicStrings.Append(blank, Sublines[i]);
  440.             END;
  441.           END;
  442.         END; |
  443.      1: (* left, also Leerzeichen hinten auffüllen *)
  444.         FOR i:=0 TO NrSubs DO
  445.           WHILE MagicSys.CastToInt(MagicStrings.Length(Sublines[i]))<maxlen DO
  446.             MagicStrings.Append(blank, Sublines[i]);
  447.           END;
  448.         END; |
  449.      2: (* right, also vorne auffüllen             *)
  450.         FOR i:=0 TO NrSubs DO
  451.           WHILE MagicSys.CastToInt(MagicStrings.Length(Sublines[i]))<maxlen DO
  452.             MagicStrings.Insert(blank, Sublines[i], 0);
  453.           END;
  454.         END; |
  455.      ELSE
  456.     END;
  457.   END;
  458.  
  459.   CASE mode OF
  460.     Types.NoJust   : xo := xy [ 0 ] ;
  461.                      yo := xy [ 1 ] - NrSubs*16; |
  462.     Types.LeftTop  : xo := xy [ 0 ] + 2 ;
  463.                      yo := xy [ 1 ] + 16 ; |
  464.     Types.Left     : xo := xy [ 0 ] + 2 ;
  465.                      yo := xy [ 1 ] + (xy [ 3 ] DIV 2);
  466.                      IF (NrSubs+1) MOD 2 = 0 THEN
  467.                        (* gerade Anzahl *)
  468.                        yo := yo - (((NrSubs+1) DIV 2)-1) * 16;
  469.                       ELSE
  470.                        (* ungerade Anzahl *)
  471.                        yo := yo - (NrSubs DIV 2) * 16 + 8 ;
  472.                      END;                                       |
  473.     Types.LeftBot  : xo := xy[0] + 2 ;
  474.                      yo := xy[1] + xy[3] - 2 - NrSubs * 16;|
  475.     Types.Top      : xo := xy[0];
  476.                      yo := xy[1] + 16 ;                         |
  477.     Types.Bottom   : xo := xy[0];
  478.                      yo := xy[1] + xy[ 3 ] - 2 ;                |
  479.     Types.RightTop : xo := xy[0] + xy[ 2 ] - 1 ;
  480.                      yo := xy[1] + 16 ;                         |
  481.     Types.Right    : xo := xy[0] + xy[ 2 ] - 1 ;
  482.                      yo := xy[1] + (xy[3] DIV 2);
  483.                      IF (NrSubs+1) MOD 2 = 0 THEN
  484.                        (* gerade Anzahl *)
  485.                        yo := yo - (((NrSubs+1) DIV 2)-1) * 16;
  486.                       ELSE
  487.                        (* ungerade Anzahl *)
  488.                        yo := yo - (NrSubs DIV 2) * 16 + 8 ;
  489.                      END;                                       |
  490.     Types.RightBot : xo := xy [0] + xy [2] - 1 ;
  491.                      yo := xy [1] + xy [3] - 2 - NrSubs * 16 ;  |
  492.     Types.Center   : xo := xy [ 0 ];
  493.                      yo := xy [ 1 ] + (xy [ 3 ] DIV 2);
  494.                      IF (NrSubs+1) MOD 2 = 0 THEN
  495.                        (* gerade Anzahl *)
  496.                        yo := yo - (((NrSubs+1) DIV 2)-1) * 16;
  497.                       ELSE
  498.                        (* ungerade Anzahl *)
  499.                        yo := yo - (NrSubs DIV 2) * 16 + 8 ;
  500.                      END;                                       |
  501.    ELSE
  502.   END ;
  503.   IF NOT Internal THEN
  504.     Diverses.MouseOff;
  505.   END;
  506.   FOR i:=0 TO NrSubs DO
  507.     y := yo + i * 16;
  508.     j := MagicStrings.Length(Sublines[i]);
  509.     CASE mode OF
  510.       Types.LeftTop, Types.NoJust, Types.Left, Types.LeftBot  :
  511.          x := xo; |
  512.       Types.Top, Types.Bottom, Types.Center :
  513.          x := xo + ((xy[2] - j*8) DIV 2) ;   |
  514.       Types.Right,  Types.RightTop, Types.RightBot :
  515.          x := xo - (j*8); |
  516.      ELSE
  517.       x := xo; (* Sollte nie auftreten *)
  518.     END ;
  519.     d := MagicVDI.SetTextcolor (mtAppl.VDIHandle , MagicAES.BLACK) ;
  520.     MagicVDI.SetTextalignment (mtAppl.VDIHandle ,
  521.                                  MagicVDI.BaseJust , MagicVDI.BottomJust ,
  522.                                  d ,d) ;
  523.     IF NOT Internal THEN
  524.       MagicVDI.SetClipping (mtAppl.VDIHandle  , CommonData.ClipXY , TRUE) ;
  525.     END;
  526.     MagicVDI.Text (mtAppl.VDIHandle , x , y , Sublines[i]) ;
  527.     IF NOT Internal THEN
  528.       MagicVDI.SetClipping (mtAppl.VDIHandle  , CommonData.ClipXY , FALSE) ;
  529.     END;
  530.     MagicVDI.SetTextalignment (mtAppl.VDIHandle ,
  531.                                   MagicVDI.BaseJust , MagicVDI.BaseJust ,
  532.                                   d ,d) ;
  533.   END ;
  534.   IF NOT Internal THEN
  535.     Diverses.MouseOn;
  536.   END ;
  537. END WriteText ;
  538.  
  539.  
  540. PROCEDURE MakeDialog (VAR str        : ARRAY OF CHAR ;
  541.                       VAR len, align : INTEGER ;
  542.                           mode       : INTEGER ;
  543.                           xy         : ARRAY OF INTEGER) ;
  544.  
  545. VAR dum, i              : INTEGER ;
  546.     char, scan          : CHAR ;
  547.     shift, ok           : BOOLEAN;
  548.     emp                 : ARRAY [ 0..1 ] OF CHAR ;
  549.     helptxt             : ARRAY [0..39] OF CHAR;
  550.     long                : LONGCARD;
  551.     card                : CARDINAL;
  552.     hilo                : RECORD
  553.                             CASE : BOOLEAN OF
  554.                               TRUE : long   : LONGCARD; |
  555.                               FALSE: hi, lo : CARDINAL; |
  556.                             END;
  557.                           END;
  558.    fontsize, fontslant  : LONGREAL;
  559.    oldsize, oldslant    : LONGREAL;
  560.    fontnum, fontangle   : INTEGER;
  561.    oldnum, oldangle     : INTEGER;
  562.    newfont              : INTEGER;
  563.    xp, yp, xc, yc       : INTEGER;
  564.  
  565. CONST NUL = 0C ; LF = 12C; CR = 15C ; BS = 10C ; BL = 40C ;
  566.      (* Null , Return , Backspace und Blank *)
  567.  
  568.    PROCEDURE GetPos(xy : ARRAY OF INTEGER;
  569.                     VAR xp, yp : INTEGER;
  570.                     str : ARRAY OF CHAR);
  571.    VAR mypos  : ARRAY [0..3] OF INTEGER;
  572.        newpos : ARRAY [0..7] OF INTEGER;
  573.        i, xo, yo : INTEGER;
  574.        xmin, xmax, ymin, ymax : INTEGER;
  575.    BEGIN
  576.      mypos[0] := 0; (* x0 *)
  577.      mypos[1] := 0; (* y0 *)
  578.      mypos[2] := VectorFont.TextWidth(str);
  579.      mypos[3] := VectorFont.TextHeight(str);
  580.      (*  (6,7)  +---------------+ (4,5) *)
  581.      (*         |               |       *)
  582.      (*  (0,1)  +---------------+ (2,3) *)
  583.      VectorFont.TurnedVal(mypos[0], mypos[1], newpos[0], newpos[1]);
  584.      VectorFont.TurnedVal(mypos[2], mypos[1], newpos[2], newpos[3]);
  585.      VectorFont.TurnedVal(mypos[2], mypos[3], newpos[4], newpos[5]);
  586.      VectorFont.TurnedVal(mypos[0], mypos[3], newpos[6], newpos[7]);
  587.      xmin := newpos[0]; xmax := newpos[0];
  588.      ymin := newpos[1]; ymax := newpos[1];
  589.      FOR i:=1 TO 3 DO
  590.        IF newpos[i*2  ]<xmin THEN xmin := newpos[i*2  ]; END;
  591.        IF newpos[i*2  ]>xmax THEN xmax := newpos[i*2  ]; END;
  592.        IF newpos[i*2+1]<ymin THEN ymin := newpos[i*2+1]; END;
  593.        IF newpos[i*2+1]>ymax THEN ymax := newpos[i*2+1]; END;
  594.      END;
  595.    (**
  596.      RTD.ShowVar('Width', mypos[2]);
  597.      RTD.ShowVar('Height', mypos[3]);
  598.      RTD.ShowVar('xmin', xmin);
  599.      RTD.ShowVar('ymin', ymin);
  600.      RTD.ShowVar('xmax', xmax);
  601.      RTD.ShowVar('ymax', ymax);
  602.      FOR i:=0 TO 3 DO
  603.        RTD.ShowVar('xy[i]', xy[i]);
  604.      END;
  605.    **)
  606.     CASE VAL(Types.TextPosTyp, ORD(mode)) OF
  607.        Types.NoJust   : xo := xy [ 0 ] ;
  608.                         yo := xy [ 1 ] ; |
  609.        Types.LeftTop  : xo := xy [ 0 ] + 2;
  610.                         yo := xy [ 1 ] + (ymax-ymin); |
  611.        Types.Left     : xo := xy [ 0 ] + 2 ;
  612.                         yo := xy[1] + (xy[3]+ymax-ymin) DIV 2 ; |
  613.        Types.LeftBot  : xo := xy[0] + 2 ;
  614.                         yo := xy[1] + xy[3] - 2; |
  615.        Types.Top      : xo := xy[0] + (xy[2]-xmax+xmin) DIV 2 ;
  616.                         yo := xy[1] + (ymax-ymin) ;                         |
  617.        Types.Bottom   : xo := xy[0] + (xy[2]-xmax+xmin) DIV 2 ;
  618.                         yo := xy[1] + xy[3] - 2; |
  619.        Types.RightTop : xo := xy[0] + xy[2] - (xmax-xmin) ;
  620.                         yo := xy[1] + (ymax-ymin); |
  621.        Types.Right    : xo := xy[0] + xy[2] - (xmax-xmin) ;
  622.                         yo := xy[1] + (xy[3]+ymax-ymin) DIV 2 ; |
  623.        Types.RightBot : xo := xy[0] + xy[2] - (xmax-xmin) ;
  624.                         yo := xy[1] + xy[3] - 2; |
  625.        Types.Center   : xo := xy[0] + (xy[2]-xmax+xmin) DIV 2;
  626.                         yo := xy[1] + (xy[3]+ymax-ymin) DIV 2 ; |
  627.       ELSE
  628.      END ;
  629.      (**
  630.      RTD.ShowVar('xo', xo);
  631.      RTD.ShowVar('yo', yo);
  632.      **)
  633.      xp := xo;
  634.      yp := yo;
  635.    END GetPos;
  636.  
  637.    PROCEDURE AddFontSize(val : INTEGER);
  638.    BEGIN
  639.      fontsize := fontsize + MathLib0.real(val)/100.0;
  640.      IF fontsize<1.0 THEN
  641.        fontsize := 1.0;
  642.      END;
  643.    END AddFontSize;
  644.  
  645.    PROCEDURE AddAngle(val : INTEGER);
  646.    BEGIN
  647.      fontangle := fontangle + val;
  648.      IF fontangle<0 THEN
  649.        WHILE fontangle<0 DO
  650.          fontangle := fontangle + 360;
  651.        END;
  652.      END;
  653.      IF fontangle>=360 THEN
  654.        fontangle := fontangle MOD 360;
  655.      END;
  656.    END AddAngle;
  657.  
  658.    PROCEDURE AddSlant(val : LONGREAL);
  659.    BEGIN
  660.      fontslant := fontslant + val;
  661.      IF fontslant>3.5 THEN
  662.        fontslant := 3.5;
  663.      END;
  664.      IF fontslant<-3.5 THEN
  665.        fontslant := -3.5;
  666.      END;
  667.    END AddSlant;
  668.  
  669.    PROCEDURE LoescheQueue;
  670.    (* Schamlos aus dem GME geklaut ;-) *)
  671.    VAR   localEvents : BITSET;
  672.          MoX,MoY     : INTEGER ;
  673.          MoButton    : BITSET ;
  674.          MoKState    : BITSET ;
  675.          KBtaste     : INTEGER ;
  676.          KBscan      : INTEGER ;
  677.          KBascii     : CHAR ;
  678.          MoClicks    : INTEGER ;
  679.          MessagePipe : ARRAY [ 0..15 ] OF INTEGER ;
  680.          M1rect,
  681.          M2rect      : ARRAY [0..3] OF INTEGER;
  682.  
  683.  
  684.    BEGIN
  685.      (* UpdateWindow (FALSE); *)
  686.      REPEAT
  687.        (* KeyBoardEvent (key); *)
  688.        (* hm... wie soll das gehen, ehe ich nicht wei₧, ob noch
  689.           KeyBoardEvents anhängig sind??? *)
  690.        localEvents:=
  691.          MagicAES.EvntMulti (
  692.                    BITSET{MagicAES.MUKEYBD,
  693.                           MagicAES.MUTIMER}, 0,
  694.                    BITSET{}, BITSET{},
  695.                    MagicAES.EnterRect, M1rect,
  696.                    MagicAES.EnterRect, M2rect,
  697.                    MessagePipe,
  698.                    0, 0, (* MUSS NULL SEIN, sonst geht Autorepeat nicht!? *)
  699.                    MoX, MoY, MoButton, KBtaste,
  700.                    MoKState, KBscan, KBascii, MoClicks) ;
  701.  
  702.      UNTIL NOT (MagicAES.MUKEYBD IN localEvents);
  703.      (* UpdateWindow (TRUE); *)
  704.    END LoescheQueue;
  705.  
  706.    PROCEDURE GetGEMKey(VAR char, scan : CHAR;
  707.                        VAR shift      : BOOLEAN);
  708.    (* Schamlos aus dem GME geklaut ;-) *)
  709.    VAR   localEvents : BITSET;
  710.          MoX,MoY     : INTEGER ;
  711.          MoButton    : BITSET ;
  712.          MoKState    : BITSET ;
  713.          KBtaste     : INTEGER ;
  714.          KBscan      : INTEGER ;
  715.          KBascii     : CHAR ;
  716.          MoClicks    : INTEGER ;
  717.          MessagePipe : ARRAY [ 0..15 ] OF INTEGER ;
  718.          M1rect,
  719.          M2rect      : ARRAY [0..3] OF INTEGER;
  720.  
  721.    BEGIN
  722.        localEvents:=
  723.          MagicAES.EvntMulti (
  724.                    BITSET{MagicAES.MUKEYBD}, 0,
  725.                    BITSET{}, BITSET{},
  726.                    MagicAES.EnterRect, M1rect,
  727.                    MagicAES.EnterRect, M2rect,
  728.                    MessagePipe,
  729.                    0, 0, (* MUSS NULL SEIN, sonst geht Autorepeat nicht!? *)
  730.                    MoX, MoY, MoButton, KBtaste,
  731.                    MoKState, KBscan, KBascii, MoClicks) ;
  732.       char  := KBascii;
  733.       scan  := CHR(ORD(KBscan));
  734.       shift := (MagicAES.KLSHIFT IN MoKState) OR (MagicAES.KRSHIFT IN MoKState);
  735.    END GetGEMKey;
  736.  
  737. BEGIN
  738. (**
  739.   RTD.Into('MakeDialog');
  740. **)
  741.   fontsize  := 1.0; (* normal *)
  742.   fontangle := 0;   (* horizontal *)
  743.   fontslant := 0.0; (* keine Neigung *)
  744.   fontnum   := CommonData.CurrentVectorFont;   (* aktueller Font *)
  745.   oldnum    := fontnum;
  746.   oldslant  := fontslant;
  747.   oldsize   := fontsize;
  748.   oldangle  := fontangle;
  749.   AlignMode := 0;   (* center *)
  750.   Diverses.MouseOff;
  751.   IF VectorFontMode THEN
  752.     Diverses.GetHelpText(16, helptxt);
  753.     ok := VectorFont.SetFont(fontnum);
  754.     VectorFont.SetTextStyle (fontsize * Variablen.zoomfak,
  755.                              fontsize * Variablen.zoomfak,
  756.                              fontslant, fontangle);
  757.    ELSE
  758.     Diverses.GetHelpText(15, helptxt);
  759.   END;
  760.   FOR i:=0 TO MagicSys.CastToInt(MagicStrings.Length(helptxt)) DO
  761.     IF helptxt[i] ='<' THEN helptxt[i] := 4C; END;
  762.     IF helptxt[i] ='>' THEN helptxt[i] := 3C; END;
  763.     IF helptxt[i] ='^' THEN helptxt[i] := 1C; END;
  764.     IF helptxt[i] ='_' THEN helptxt[i] := 2C; END;
  765.   END;
  766.   HelpModule.HelpMessage(helptxt);
  767.   dum := MagicVDI.SetWritemode (mtAppl.VDIHandle , MagicVDI.XOR) ;
  768.  
  769.   FOR dum := 0 TO Types.CharArraySize-1 DO str [ dum ] := NUL END ;
  770. (**
  771.   RTD.Message('Set to zero, ready');
  772. **)
  773.   (* Simuliere Cursor *)
  774.   emp := "|";
  775.   len := 0 ;
  776.   IF VectorFontMode THEN
  777.     GetPos(xy, xp, yp, emp);
  778.     VectorFont.EnableCache(TRUE);
  779.     VectorFont.OutText(xp, yp, emp);
  780.    ELSE
  781.     Internal := FALSE;
  782.     WriteText (emp , 1 , mode , xy) ;
  783.   END;
  784.  
  785.   (* Tastaturpuffer leeren *)
  786. (*$? UseXBIOS:
  787.   WHILE MagicBIOS.Bconstat (MagicBIOS.CON) DO
  788.     long := MagicBIOS.Bconin (MagicBIOS.CON) ;
  789.   END ;
  790. *)
  791. (*$? NOT UseXBIOS:
  792.    LoescheQueue;
  793. *)
  794.  
  795.   REPEAT
  796. (*$? UseXBIOS:
  797.     long := MagicBIOS.Bconin (MagicBIOS.CON) ;
  798.     hilo.long := long;
  799.     char := CHR(hilo.lo);
  800.     scan := CHR(hilo.hi);
  801.     card := MagicSys.CastToCard(long MOD 10000H);
  802. *)
  803.  
  804. (*$? NOT UseXBIOS:
  805.     GetGEMKey(char, scan, shift);
  806.     LoescheQueue;
  807. *)
  808.     (* Alten String löschen *)
  809.     IF len = 0 THEN
  810.       IF VectorFontMode THEN
  811.         VectorFont.AgainText;
  812.        ELSE
  813.         Internal := FALSE;
  814.         WriteText (emp , 1 , mode , xy) ;
  815.       END;
  816.     ELSE
  817.       IF VectorFontMode THEN
  818.         VectorFont.AgainText;
  819. (**
  820.         GetPos(xy, xp, yp, str);
  821.         VectorFont.OutText(xp, yp, str);
  822. **)
  823.        ELSE
  824.         Internal := FALSE;
  825.         WriteText (str , len+1 , mode , xy) ;
  826.       END;
  827.     END ;
  828.     IF (char= NUL) THEN
  829.       CASE scan OF
  830.        73C..75C : (* F1..F3 *)
  831.            dum := ORD(scan) -ORD(73C);
  832.            IF VectorFontMode THEN
  833.              newfont := dum+1;
  834.             ELSE
  835.              AlignMode := dum; (* center, left, right *)
  836.            END; |
  837.        76C..104C : (* F4..F10 *)
  838.            dum := ORD(scan) - ORD(73C) + 1;
  839.            IF VectorFontMode THEN
  840.              newfont := dum;
  841.            END; |
  842.        113C : (* left arrow *)
  843.            IF VectorFontMode THEN
  844.              AddAngle(+5);
  845.            END; |
  846.        115C : (* right arrow *)
  847.            IF VectorFontMode THEN
  848.              AddAngle(-5);
  849.            END; |
  850.        163C : (* Ctrl left arrow *)
  851.            IF VectorFontMode THEN
  852.              AddAngle(45);
  853.            END; |
  854.        164C : (* Ctrl right arrow *)
  855.            IF VectorFontMode THEN
  856.              AddAngle(-45);
  857.            END; |
  858.        110C : (* Up arrow *)
  859.            IF VectorFontMode THEN
  860.              AddFontSize(10);
  861.            END; |
  862.        120C : (* Down arrow *)
  863.            IF VectorFontMode THEN
  864.              AddFontSize(-10);
  865.            END; |
  866.        141C : (* Undo *)
  867.            IF VectorFontMode THEN
  868.              fontsize  :=  storesize;
  869.              fontangle := storeangle;
  870.              fontslant := storeslant;
  871.            END; |
  872.        142C : (* Help *)
  873.            IF VectorFontMode THEN
  874.              storesize  := fontsize;
  875.              storeangle := fontangle;
  876.              storeslant := fontslant;
  877.            END; |
  878.        ELSE
  879.       END;
  880.      ELSIF char = LF THEN
  881.       str[len]   := '\';
  882.       str[len+1] := '\';
  883.       str[len+2] := '|';
  884.       INC(len, 2);
  885.      ELSIF char = BS THEN
  886.       IF len > 0 THEN
  887.         IF (len>1) AND (str [len-1]='\') AND (str[len-2]='\') THEN
  888.           (* CR löschen *)
  889.           len := len - 1 ;
  890.           str [ len ] := NUL ;
  891.         END;
  892.         len := len - 1 ;
  893.         str [ len ] := '|' ;
  894.         str [ len + 1 ] := NUL ;
  895.       END ;
  896.      ELSIF (char=33C) THEN (* ESC *)
  897.       (* gesamten String löschen *)
  898.       FOR dum := 0 TO len DO
  899.         str[dum] := NUL;
  900.       END;
  901.       len := 0;
  902.      ELSIF (scan='H') AND (char='8') THEN (* Shift-Cursor-Up-Taste *)
  903.       IF VectorFontMode THEN
  904.         AddFontSize(50);
  905.       END;
  906.      ELSIF (scan='M') AND (char='6') THEN (* Shift-Cursor-Right-Taste *)
  907.       IF VectorFontMode THEN
  908.         AddSlant(+0.1);
  909.       END;
  910.      ELSIF (scan='P') AND (char='2') THEN (* Shift-Cursor-Down-Taste *)
  911.       IF VectorFontMode THEN
  912.         AddFontSize(-50);
  913.       END;
  914.      ELSIF (scan='K') AND (char='4') THEN (* Shift-Cursor-Left-Taste *)
  915.       IF VectorFontMode THEN
  916.         AddSlant(-0.1);
  917.       END;
  918.      ELSE
  919.       IF ORD (char) >= 32 THEN
  920.         str [ len ] := char ;
  921.         str [ len + 1 ] := '|' ;
  922.         len := len + 1 ;
  923.       END ;
  924.     END ;
  925.  
  926.     (* Neuen String schreiben *)
  927.     IF VectorFontMode THEN
  928.       IF newfont>0 THEN
  929.         ok := VectorFont.FontsLoaded()>=newfont;
  930.         IF ok THEN
  931.           fontnum := newfont;
  932.         END;
  933.         newfont := -1;
  934.       END;
  935.     END;
  936.     IF VectorFontMode THEN
  937.       IF oldnum<>fontnum THEN
  938.         ok := VectorFont.SetFont(fontnum);
  939.         oldnum := fontnum;
  940.       END;
  941.       IF (oldangle<>fontangle) OR
  942.          (oldsize <>fontsize) OR
  943.          (oldslant<>fontslant) THEN
  944.         VectorFont.SetTextStyle (fontsize * Variablen.zoomfak,
  945.                                  fontsize * Variablen.zoomfak,
  946.                                  fontslant, fontangle);
  947.         oldsize  := fontsize;
  948.         oldslant := fontslant;
  949.         oldangle := fontangle;
  950.       END;
  951.     END;
  952.     IF len = 0 THEN
  953.       IF VectorFontMode THEN
  954.         GetPos(xy, xp, yp, emp);
  955.         VectorFont.OutText (xp, yp, emp);
  956.        ELSE
  957.         Internal := FALSE;
  958.         WriteText (emp , 1 , mode , xy) ;
  959.       END;
  960.     ELSE
  961.       IF VectorFontMode THEN
  962.         GetPos(xy, xp, yp, str);
  963.         VectorFont.OutText (xp, yp, str);
  964.        ELSE
  965.         Internal := FALSE;
  966.         WriteText (str , len+1 , mode , xy) ;
  967.       END;
  968.     END ;
  969.  
  970.   UNTIL (char = CR) OR (len = Types.CharArraySize-2) ;
  971.  
  972.   (* Zum Schlu₧ String löschen ... *)
  973.   IF len = 0 THEN
  974.     IF VectorFontMode THEN
  975. (**
  976.       GetPos(xy, xp, yp, emp);
  977.       VectorFont.OutText (xp, yp, emp);
  978. **)
  979.       VectorFont.AgainText;
  980.      ELSE
  981.       Internal := FALSE;
  982.       WriteText (emp , 1 , mode , xy) ;
  983.     END;
  984.   ELSE
  985.     IF VectorFontMode THEN
  986.       VectorFont.AgainText;
  987. (**
  988.       GetPos(xy, xp, yp, str);
  989.       VectorFont.OutText (xp, yp, str);
  990. **)
  991.      ELSE
  992.       Internal := FALSE;
  993.       WriteText (str , len+1 , mode , xy) ;
  994.     END;
  995.   END ;
  996.  
  997.   (* ... und String im neuen Modus schreiben. *)
  998.  
  999.   str [ len ] := NUL ;
  1000.  
  1001.   dum := MagicVDI.SetWritemode (mtAppl.VDIHandle , MagicVDI.TRANSPARENT) ;
  1002.  
  1003.   IF len > 0 THEN
  1004.     IF VectorFontMode THEN
  1005.       GetPos(xy, xp, yp, str);
  1006.       Variablen.PixToPic (xp, yp, xc, yc);
  1007.       VectorFont.OutText    (xp, yp, str);
  1008.       VectorFont.SetTextStyle (fontsize, fontsize, fontslant, fontangle);
  1009.       Undo.PrepareUndo(TRUE);
  1010.       VectorFont.CreateText (xc, yc, str);
  1011.       VectorFont.EnableCache(FALSE);
  1012.      ELSE
  1013.       Internal := FALSE;
  1014.       WriteText (str , len , mode , xy) ;
  1015.     END;
  1016.   END ;
  1017.  
  1018.   Diverses.MouseOn;
  1019.   align := AlignMode;
  1020. (**
  1021.   RTD.Leaving('MakeDialog');
  1022. **)
  1023. END MakeDialog ;
  1024.  
  1025.  
  1026. (*------------------------------------------------------------------------*)
  1027.  
  1028.  
  1029. PROCEDURE Text () ;
  1030.  
  1031. VAR xy : XYArray ; ptr : Types.CharPtrTyp ;
  1032.     but : BITSET;
  1033.     len , dum , x , y , i : INTEGER ;
  1034.     pxy : Types.CodeAryTyp ;
  1035.     Surround : XYArray;
  1036.  
  1037. BEGIN
  1038.  
  1039.   WaitForDepress(x, y);
  1040.  
  1041.   xy [ 0 ] := x ; xy [ 1 ]:= y ;
  1042.   xy [ 2 ] := 1 ; xy [ 3 ]:= 1 ;
  1043.  
  1044.   NEW (ptr) ;
  1045.   FOR i := 0 TO Types.CharArraySize-2 DO ptr^ [ i ] := CHR (0) END ;
  1046.   MakeDialog (ptr^ , len , i, ORD(Types.NoJust) , xy) ;
  1047.  
  1048.   IF (len > 0) AND NOT VectorFontMode THEN
  1049.     FOR i := 0 TO 9 DO pxy [ i ] := 0 END ;
  1050.     pxy [ 0 ] := ORD(Types.Text) ;
  1051.     Variablen.PixToPic (xy [ 0 ] , xy [ 1 ] , pxy [ 1 ] , pxy [ 2 ]);
  1052.     pxy [ 5 ] := MagicSys.CastToInt(ORD(Types.NoJust));
  1053.     pxy [ 7 ] := AlignMode ;
  1054.     pxy [ 8 ] := CommonData.LineWidth ;
  1055.     pxy [ 9 ] := len ;
  1056.     IF (len > 0) AND NOT VectorFontMode THEN
  1057.       (* reiner Test: *)
  1058.       y := 16 * NrOfSublines(ptr^, i);
  1059.       x := 8 * i;
  1060.       pxy [ 3 ] := x;
  1061.       pxy [ 4 ] := y;
  1062.  
  1063.       Surround[0] := pxy[1];  Surround[1] := pxy[2] -1 + y;
  1064.       Surround[2] := x; Surround[3] := y;
  1065.  
  1066.       Undo.PrepareUndo(TRUE);
  1067.       Variablen.NewObject (pxy , ptr, NIL, Surround) ;
  1068.     END ;
  1069.   END ;
  1070.   DISPOSE (ptr) ;
  1071.  
  1072. END Text ;
  1073.  
  1074.  
  1075. PROCEDURE BoxText () ;
  1076.  
  1077. VAR xy , xyo : XYArray ;
  1078.     ptr  : Types.CharPtrTyp ;
  1079.     RectSurr : ARRAY [0..59] OF CHAR;
  1080.     x, y, len, mode, i : INTEGER ;  but : BITSET;
  1081.     ok  : BOOLEAN;
  1082.     pxy : Types.CodeAryTyp ;
  1083.     Surround : XYArray;
  1084.  
  1085. BEGIN
  1086.   NEW (ptr) ;
  1087.   FOR i := 0 TO Types.CharArraySize-2 DO ptr^ [ i ] := CHR (0) END ;
  1088.   Diverses.GetHelpText(14, RectSurr);
  1089.   HelpModule.HelpMessage(RectSurr);
  1090.   ok := MakeBox (-2 , -1, xy);
  1091.   IF ok THEN
  1092.     (* Gibt linken unteren Punkt und Ausma₧e zurück *)
  1093.     (* WriteText arbeitet mit linkem oberen Punkt *)
  1094.     Surround [0] := xy[0]; Surround [1] := xy[1] - xy [3];
  1095.     Surround [2] := xy[2]; Surround [3] := xy[3];
  1096.     FOR i:= 0 TO 3 DO
  1097.       xyo[i] := Surround[i];
  1098.     END;
  1099.     Surround [2] := Variablen.PicDistance(xy[2]);
  1100.     Surround [3] := Variablen.PicDistance(xy[3]);
  1101.     Variablen.PixToPic (xyo[0], xyo[1], Surround[0], Surround[1]);
  1102.     MakeDialog (ptr^ , len , i, ORD(CommonData.TextPosition) , xyo) ;
  1103.  
  1104.     FOR i := 0 TO 9 DO pxy [ i ] := 0 END ;
  1105.     pxy [ 0 ] := ORD(Types.Framebox) ;
  1106.     Variablen.PixToPic (xy [ 0 ] , xy [ 1 ] , pxy [ 1 ] , pxy [ 2 ]) ;
  1107.     pxy [ 3 ] := Variablen.PicDistance(xy [ 2 ]);
  1108.     pxy [ 4 ] := Variablen.PicDistance(xy [ 3 ]);
  1109.     pxy [ 7 ] := AlignMode;
  1110.     pxy [ 8 ] := CommonData.LineWidth ;
  1111.     IF (len > 0) AND NOT VectorFontMode THEN
  1112.       pxy [ 5 ] := ORD(CommonData.TextPosition) ;
  1113.       pxy [ 6 ] := 1 ;  (* Flag für Makebox *)
  1114.       pxy [ 9 ] := len ;
  1115.       Undo.PrepareUndo(TRUE);
  1116.       Variablen.NewObject (pxy , ptr, NIL, Surround) ;
  1117.     END ;
  1118.   END;
  1119.   DISPOSE (ptr) ;
  1120. END BoxText ;
  1121.  
  1122.  
  1123. PROCEDURE FrameText () ;
  1124.  
  1125. VAR xy , xyo     : XYArray ;
  1126.     ptr          : Types.CharPtrTyp ;
  1127.     obj          : Types.ObjectPtrTyp ;
  1128.     len, mode, i : INTEGER ;
  1129.     pxy          : Types.CodeAryTyp ;
  1130.     Surround     : XYArray;
  1131.     RectSurr     : ARRAY [0..59] OF CHAR;
  1132.  
  1133. BEGIN
  1134.   obj := Variablen.LastObject;
  1135.   NEW (ptr) ;
  1136.   FOR i := 0 TO Types.CharArraySize-2 DO ptr^ [ i ] := CHR (0) END ;
  1137.   Diverses.GetHelpText(14, RectSurr);
  1138.   HelpModule.HelpMessage(RectSurr);
  1139.   IF MakeBox (1 , -1, xy) THEN
  1140.     (* Gibt linken unteren Punkt und Ausma₧e zurück *)
  1141.     (* WriteText arbeitet mit linkem oberen Punkt *)
  1142.     Surround [0] := xy[0]; Surround [1] := xy[1] - xy [3];
  1143.     Surround [2] := xy[2]; Surround [3] := xy[3];
  1144.     FOR i:= 0 TO 3 DO
  1145.       xyo[i] := Surround[i];
  1146.     END;
  1147.     Surround [2] := Variablen.PicDistance(xy[2]);
  1148.     Surround [3] := Variablen.PicDistance(xy[3]);
  1149.     Variablen.PixToPic (xyo[0], xyo[1], Surround[0], Surround[1]);
  1150.     MakeDialog (ptr^ , len , i, ORD(CommonData.TextPosition) , xyo) ;
  1151.  
  1152.     FOR i := 0 TO 9 DO pxy [ i ] := 0 END ;
  1153.     pxy [ 0 ] := ORD(Types.Framebox) ;
  1154.     Variablen.PixToPic (xy [ 0 ] , xy [ 1 ] , pxy [ 1 ] , pxy [ 2 ]) ;
  1155.     pxy [ 3 ] := Variablen.PicDistance(xy [ 2 ]);
  1156.     pxy [ 4 ] := Variablen.PicDistance(xy [ 3 ]);
  1157.     pxy [ 7 ] := AlignMode;
  1158.     pxy [ 8 ] := CommonData.LineWidth ;
  1159.     IF (len > 0) AND NOT VectorFontMode THEN
  1160.       pxy [ 5 ] := ORD(CommonData.TextPosition) ;
  1161.       pxy [ 9 ] := len ;
  1162.       Undo.PrepareUndo(TRUE);
  1163.       Variablen.NewObject (pxy , ptr, NIL, Surround) ;
  1164.      ELSE
  1165.       Variablen.NewObject (pxy , NIL, NIL, Surround) ;
  1166. (**
  1167.       Variablen.MergeToSubpic(obj, pxy[1], pxy[2], pxy[3], pxy[4]);
  1168. **)
  1169.     END ;
  1170.   END;
  1171.   DISPOSE (ptr) ;
  1172. END FrameText ;
  1173.  
  1174.  
  1175. PROCEDURE DashText () ;
  1176.  
  1177. VAR xy , xyo : XYArray ; ptr  : Types.CharPtrTyp ;
  1178.     len : INTEGER ; mode , i : INTEGER ;
  1179.     pxy : Types.CodeAryTyp ;
  1180.     Surround : XYArray;
  1181.     obj          : Types.ObjectPtrTyp ;
  1182.     RectSurr     : ARRAY [0..59] OF CHAR;
  1183.  
  1184. BEGIN
  1185.   obj := Variablen.LastObject;
  1186.   NEW (ptr) ;
  1187.   FOR i := 0 TO Types.CharArraySize-2 DO ptr^ [ i ] := CHR (0) END ;
  1188.   Diverses.GetHelpText(14, RectSurr);
  1189.   HelpModule.HelpMessage(RectSurr);
  1190.   IF MakeBox (5 , -1, xy) THEN
  1191.     (* Gibt linken unteren Punkt zurück *)
  1192.     (* WriteText arbeitet mit linkem oberen Punkt *)
  1193.     Surround [0] := xy[0]; Surround [1] := xy[1] - xy [3];
  1194.     Surround [2] := xy[2]; Surround [3] := xy[3];
  1195.     FOR i:= 0 TO 3 DO
  1196.       xyo[i] := Surround[i];
  1197.     END;
  1198.     Surround [2] := Variablen.PicDistance(xy[2]);
  1199.     Surround [3] := Variablen.PicDistance(xy[3]);
  1200.     Variablen.PixToPic (xyo[0], xyo[1], Surround[0], Surround[1]);
  1201.     MakeDialog (ptr^ , len , i, ORD(CommonData.TextPosition) , xyo) ;
  1202.     FOR i := 0 TO 9 DO pxy [ i ] := 0 END ;
  1203.     pxy [ 0 ] := ORD(Types.Dashbox) ;
  1204.     Variablen.PixToPic (xy [ 0 ] , xy [ 1 ] , pxy [ 1 ] , pxy [ 2 ]) ;
  1205.     pxy [ 3 ] := Variablen.PicDistance(xy [ 2 ]);
  1206.     pxy [ 4 ] := Variablen.PicDistance(xy [ 3 ]);
  1207.     pxy [ 7 ] := AlignMode;
  1208.     pxy [ 8 ] := CommonData.LineWidth ;
  1209.     IF (len > 0) AND NOT VectorFontMode THEN
  1210.       pxy [ 5 ] := ORD(CommonData.TextPosition) ;
  1211.       pxy [ 9 ] := len ;
  1212.       Undo.PrepareUndo(TRUE);
  1213.       Variablen.NewObject (pxy , ptr, NIL, Surround) ;
  1214.      ELSE
  1215.       Variablen.NewObject (pxy , NIL, NIL, Surround) ;
  1216. (**
  1217.       Variablen.MergeToSubpic(obj, pxy[1], pxy[2], pxy[3], pxy[4]);
  1218. **)
  1219.     END ;
  1220.   END ;
  1221.   DISPOSE (ptr) ;
  1222. END DashText ;
  1223.  
  1224.  
  1225. PROCEDURE FrameBox () ;
  1226.  
  1227. VAR xy : XYArray ;
  1228.     Surround : XYArray;
  1229.     pxy : Types.CodeAryTyp ;
  1230.     i, X, Y : INTEGER ;
  1231.     HelpRect : ARRAY [0..59] OF CHAR;
  1232.  
  1233. BEGIN
  1234.   Diverses.GetHelpText(12, HelpRect);
  1235.   HelpModule.HelpMessage(HelpRect);
  1236.   IF MakeBox (1 , -1, xy) THEN
  1237.     X            := xy[0]; Y            := xy[1] - xy [3];
  1238.     Surround [2] := Variablen.PicDistance(xy[2]);
  1239.     Surround [3] := Variablen.PicDistance(xy[3]);
  1240.     Variablen.PixToPic (X, Y, Surround[0], Surround[1]);
  1241.     FOR i := 0 TO 9 DO pxy [ i ] := 0 END ;
  1242.     pxy [ 0 ] := ORD(Types.Framebox) ;
  1243.     Variablen.PixToPic (xy [ 0 ] , xy [ 1 ] , pxy [ 1 ] , pxy [ 2 ]) ;
  1244.     pxy [ 3 ] := Variablen.PicDistance(xy [ 2 ]);
  1245.     pxy [ 4 ] := Variablen.PicDistance(xy [ 3 ]);
  1246.     pxy [ 8 ] := CommonData.LineWidth ;
  1247.     Undo.PrepareUndo(TRUE);
  1248.     Variablen.NewObject (pxy , NIL, NIL, Surround) ;
  1249.   END;
  1250. END FrameBox ;
  1251.  
  1252.  
  1253. PROCEDURE DashBox () ;
  1254.  
  1255. VAR xy : XYArray ;
  1256.     Surround : XYArray;
  1257.     pxy : Types.CodeAryTyp ;
  1258.     i, X, Y : INTEGER ;
  1259.     HelpRect : ARRAY [0..59] OF CHAR;
  1260.  
  1261. BEGIN
  1262.   Diverses.GetHelpText(12, HelpRect);
  1263.   HelpModule.HelpMessage(HelpRect);
  1264.   IF MakeBox (5 , -1 , xy) THEN
  1265.     X            := xy[0]; Y            := xy[1] - xy [3];
  1266.     Surround [2] := Variablen.PicDistance(xy[2]);
  1267.     Surround [3] := Variablen.PicDistance(xy[3]);
  1268.     Variablen.PixToPic (X, Y, Surround[0], Surround[1]);
  1269.     FOR i := 0 TO 9 DO pxy [ i ] := 0 END ;
  1270.     pxy [ 0 ] := ORD(Types.Dashbox) ;
  1271.     Variablen.PixToPic (xy [ 0 ] , xy [ 1 ] , pxy [ 1 ] , pxy [ 2 ]) ;
  1272.     pxy [ 3 ] := Variablen.PicDistance(xy [ 2 ]);
  1273.     pxy [ 4 ] := Variablen.PicDistance(xy [ 3 ]);
  1274.     pxy [ 8 ] := CommonData.LineWidth ;
  1275.     Undo.PrepareUndo(TRUE);
  1276.     Variablen.NewObject (pxy , NIL, NIL, Surround) ;
  1277.   END;
  1278.  
  1279. END DashBox ;
  1280.  
  1281. PROCEDURE OvalBox () ;
  1282.  
  1283. VAR xy : XYArray ;
  1284.     Surround : XYArray;
  1285.     pxy : Types.CodeAryTyp ;
  1286.     i, X, Y : INTEGER ;
  1287.     dum1, dum2 : INTEGER;
  1288.     HelpRect   : ARRAY [0..59] OF CHAR;
  1289.  
  1290. BEGIN
  1291.   Diverses.GetHelpText(12, HelpRect);
  1292.   HelpModule.HelpMessage(HelpRect);
  1293.   IF MakeBox (-1 , -1, xy) THEN
  1294.     (* es wird nicht wie üblich der linke untere Punkt und die Ausma₧e *)
  1295.     (* geliefert, sondern die beiden gegenüberliegenden Eckpunkte!     *)
  1296.  
  1297.     IF xy[0]<xy[2] THEN X := xy[0]; ELSE X := xy[2]; END;
  1298.     IF xy[1]<xy[3] THEN Y := xy[1]; ELSE Y := xy[3]; END;
  1299.     Variablen.PixToPic (X, Y, Surround[0], Surround[1]);
  1300.     FOR i := 0 TO 9 DO pxy [ i ] := 0 END ;
  1301.     pxy [ 0 ] := ORD(Types.Ovalbox) ;
  1302.     pxy [ 8 ] := CommonData.LineWidth ;
  1303.     dum1 := (xy [ 0 ] + xy [ 2 ]) DIV 2;
  1304.     dum2 := (xy [ 1 ] + xy [ 3 ]) DIV 2;
  1305.     Variablen.PixToPic (dum1, dum2 , pxy [ 1 ] , pxy [ 2 ]) ;
  1306.     Variablen.PixToPic (xy[0], xy[1] , pxy [ 3 ] , pxy [ 4 ]) ;
  1307.     pxy [ 3 ] := 2 * ABS(pxy[1]-pxy[3]);
  1308.     pxy [ 4 ] := 2 * ABS(pxy[2]-pxy[4]);
  1309.     Surround [2] := pxy[3];
  1310.     Surround [3] := pxy[4];
  1311. (**
  1312.     Surround [2] := ABS(xy[2]-xy[0]);
  1313.     Surround [3] := ABS(xy[3]-xy[1]);
  1314. **)
  1315.     Undo.PrepareUndo(TRUE);
  1316.     Variablen.NewObject (pxy , NIL, NIL, Surround) ;
  1317.  
  1318.   END;
  1319. END OvalBox ;
  1320.  
  1321. PROCEDURE FilledBox (FillMode : INTEGER);
  1322. (*
  1323.    0 : solid,
  1324.    1 : horfill,
  1325.    2 : verfill,
  1326.    3 : horverfill,
  1327.    4 : leftfill,
  1328.    5 : rightfill,
  1329.    6 : lftrghtfill
  1330. *)
  1331. VAR xy  : XYArray ;
  1332.     pxy : Types.CodeAryTyp ;
  1333.     i, X, Y : INTEGER ;
  1334.     dum : INTEGER;
  1335.     Surround : XYArray;
  1336.     PxyArray : XYArray;
  1337.     fillstyleindex, fillstyle : INTEGER;
  1338.     HelpRect : ARRAY [0..59] OF CHAR;
  1339.  
  1340. BEGIN
  1341. (**
  1342.   RTD.ShowVar('Fillmode', FillMode);
  1343. **)
  1344.   Diverses.GetHelpText(12, HelpRect);
  1345.   HelpModule.HelpMessage(HelpRect);
  1346.   IF FillMode=0 THEN
  1347.     i :=  1;
  1348.    ELSE
  1349.     i := -2;
  1350.   END;
  1351.   dum := FillMode;
  1352.  
  1353.   IF MakeBox (i , dum, xy) THEN
  1354.     X            := xy[0];
  1355.     Y            := xy[1] - xy[3];
  1356.     Surround [2] := Variablen.PicDistance(xy[2]);
  1357.     Surround [3] := Variablen.PicDistance(xy[3]);
  1358.     Variablen.PixToPic (X, Y, Surround[0], Surround[1]);
  1359.     FOR i := 0 TO 9 DO pxy [ i ] := 0 END ;
  1360.     IF FillMode=0 THEN
  1361.       pxy [ 0 ] := ORD(Types.Filledbox) ;
  1362.      ELSE
  1363.       pxy [ 0 ] := ORD(Types.Framebox) ;
  1364.     END;
  1365.     Variablen.PixToPic ( xy [ 0 ] ,  xy [ 1 ] ,
  1366.                                 pxy [ 1 ] , pxy [ 2 ]) ;
  1367.     pxy [ 3 ] := Variablen.PicDistance(xy [ 2 ]);
  1368.     pxy [ 4 ] := Variablen.PicDistance(xy [ 3 ]);
  1369.     pxy [ 8 ] := CommonData.LineWidth ;
  1370. (**
  1371.     FOR i := 0 TO 3 DO
  1372.       RTD.ShowVar('Sur', Surround[i]);
  1373.     END;
  1374.     FOR i := 0 TO 9 DO
  1375.       RTD.ShowVar('pxy', pxy[i]);
  1376.     END;
  1377. **)
  1378.     Variablen.NewObject (pxy , NIL, NIL, Surround) ;
  1379.   END;
  1380. (**
  1381.   RTD.Leaving('FilledBox');
  1382. **)
  1383. END FilledBox;
  1384.  
  1385. PROCEDURE Show (Object : Types.ObjectPtrTyp) ;
  1386.  
  1387. VAR xy : ARRAY [ 0..9 ] OF INTEGER ; dum , style : INTEGER ;
  1388.     xya : XYArray ;
  1389.     str : ARRAY [ 0..Types.CharArraySize ] OF CHAR ;
  1390.     X0, Y0, DX, DY : INTEGER;
  1391.     fillstyle, fillstyleindex : INTEGER;
  1392.     PxyArray : XYArray;
  1393.     nodraw : BOOLEAN;
  1394.     tmpstr : ARRAY [0..255] OF CHAR;
  1395.  
  1396. BEGIN
  1397.   Internal := TRUE;
  1398.  
  1399.   Variablen.PicToPix (xy [ 0 ] , xy [ 1 ] , 
  1400.                       Object^.Code [ 1 ] ,
  1401.                       Object^.Code [ 2 ]) ;
  1402. (**
  1403.   RTD.Message('Coord ready');
  1404. **)
  1405.   IF VAL(Types.DrawObjectTyp, Object^.Code [ 0 ]) <>
  1406.      Types.Ovalbox THEN
  1407. (**
  1408.     RTD.Message('Not Ovalbox');
  1409. **)
  1410.     (* wir haben linken UNTEREN Punkt gespeichert *)
  1411.  
  1412.     DX := Variablen.PixDistance(Object^.Code[3]);
  1413.     DY := Variablen.PixDistance(Object^.Code[4]);
  1414.     X0 := xy[0];
  1415.     Y0 := xy[1] - DY;
  1416.  
  1417.     xy [ 4 ] := xy [ 0 ] + DX ; (* -1 entfällt , LaTeX ! *)
  1418.     xy [ 5 ] := xy [ 1 ] - DY ; (* Diagonalpunkt *)
  1419.     xy [ 2 ] := xy [ 4 ] ; xy [ 3 ] := xy [ 1 ] ;
  1420.     xy [ 6 ] := xy [ 0 ] ; xy [ 7 ] := xy [ 5 ] ;
  1421.     xy [ 8 ] := xy [ 0 ] ; xy [ 9 ] := xy [ 1 ] ;
  1422.  
  1423.     (* WriteText arbeitet mit linkem oberen Punkt *)
  1424.     xya [ 0 ] := xy [ 0 ] ;
  1425.     xya [ 1 ] := xy [ 1 ] - DY ;
  1426.     IF ORD(Object^.Code[0]) = ORD (Types.Text) THEN
  1427.       xya [ 1 ] := xy [ 1 ];
  1428.       xya [ 2 ] := 1 ;
  1429.       xya [ 3 ] := 1 ;
  1430.      ELSE
  1431.       xya [ 2 ] := DX ;
  1432.       xya [ 3 ] := DY ;
  1433.     END;
  1434.     IF DX=0 THEN DX:=1; END;  IF DY=0 THEN DY:=1; END;
  1435.     Object^.Surround[0] := Object^.Code[1] + CommonData.FatherXOffset;
  1436.     Object^.Surround[1] := Object^.Code[2] + Object^.Code[4] + CommonData.FatherYOffset;
  1437.     Object^.Surround[2] := Object^.Code[3];
  1438.     Object^.Surround[3] := Object^.Code[4];
  1439.     Object^.SurrDirty := FALSE;
  1440. (**
  1441.     RTD.Message('Vis?');
  1442. **)
  1443.     IF Variablen.Visible(Object^.Surround) THEN
  1444. (**
  1445.       RTD.Message('Yes!');
  1446. **)
  1447.       dum := MagicVDI.SetLinewidth (mtAppl.VDIHandle ,
  1448.                                        Object^.Code [ 8 ]) ;
  1449.       dum := MagicVDI.SetLinetype (mtAppl.VDIHandle , MagicVDI.Line) ;
  1450.       dum := MagicVDI.SetLinecolor (mtAppl.VDIHandle , MagicAES.BLACK) ;
  1451.       dum := MagicVDI.SetMarkertype(mtAppl.VDIHandle, MagicVDI.Point);
  1452.       dum := MagicVDI.SetMarkercolor(mtAppl.VDIHandle, MagicAES.BLACK);
  1453.       MagicVDI.SetLineEndstyles (mtAppl.VDIHandle ,
  1454.                                   MagicVDI.Cornerd , MagicVDI.Cornerd) ;
  1455.       dum := MagicVDI.SetFillinterior (mtAppl.VDIHandle , MagicVDI.Full) ;
  1456.       dum := MagicVDI.SetFillcolor (mtAppl.VDIHandle , MagicAES.BLACK) ;
  1457.       IF VAL(Types.DrawObjectTyp, Object^.Code [ 0 ]) =
  1458.          Types.Dashbox THEN
  1459.         style := MagicVDI.Dash ;
  1460.        ELSE
  1461.         style := MagicVDI.Line ;
  1462.       END ;
  1463.       dum := MagicVDI.SetLinetype (mtAppl.VDIHandle , style) ;
  1464.  
  1465.       IF (VAL(Types.DrawObjectTyp, Object^.Code [ 0 ]) <>
  1466.          Types.Text)  THEN
  1467.         IF VAL(Types.DrawObjectTyp, Object^.Code [ 0 ]) =
  1468.            Types.Framebox THEN
  1469.           IF Object^.Code[6] = 1 THEN
  1470.             nodraw := TRUE;
  1471. (**
  1472.             RTD.Message('No Boxdraw');
  1473. **)
  1474.            ELSE
  1475.             nodraw := FALSE;
  1476.           END ;
  1477.          ELSE
  1478.           nodraw := FALSE;
  1479.         END ;
  1480.  
  1481.         IF NOT nodraw THEN
  1482. (**
  1483.           RTD.Message('Now Polyline');
  1484. **)
  1485.           MagicVDI.Polyline (mtAppl.VDIHandle , 5 , xy) ;
  1486.           IF VAL(Types.DrawObjectTyp, Object^.Code [ 0 ]) =
  1487.              Types.Filledbox THEN
  1488.             PxyArray[0] := xy[0]; PxyArray[1] := xy[1];
  1489.             PxyArray[2] := xy[4]; PxyArray[3] := xy[5];
  1490.  
  1491. (**
  1492.             RTD.Message('Now Fill');
  1493. **)
  1494.             Fill.SetFillMode(Fill.Solid);
  1495.             FillBox(xy[0], xy[1], xy[4], xy[5]);
  1496. (*
  1497.             MagicVDI.FilledArea(mtAppl.VDIHandle , 5, xy);
  1498. *)
  1499.             Fill.SetFillMode(-1);
  1500.             dum := MagicVDI.SetWritemode(mtAppl.VDIHandle, MagicVDI.REPLACE);
  1501.           END;
  1502.         END;
  1503.       END;
  1504.       dum := MagicVDI.SetLinetype (mtAppl.VDIHandle , MagicVDI.Line) ;
  1505.      ELSE
  1506.       (* reiner Text *)
  1507.       FOR dum:=1 TO Object^.Code[9] DO
  1508.         tmpstr[dum] := Object^.CPtr^[dum-1];
  1509.       END;
  1510.       tmpstr[Object^.Code[9]] := 0C;
  1511.       DY := 16 * NrOfSublines(tmpstr, dum);
  1512.       DX := 8 * dum;
  1513.       Variablen.PicToPix (X0, Y0, Object^.Code[1], Object^.Code[2]);
  1514.       Y0 := Y0 + 1 - DY;
  1515.       Variablen.PixToPic (X0, Y0, Object^.Surround[0], Object^.Surround[1]);
  1516.       IF DX=0 THEN DX:=1; END;  IF DY=0 THEN DY:=1; END;
  1517.       Object^.Surround[2] := DX;
  1518.       Object^.Surround[3] := DY;
  1519.       Object^.SurrDirty := FALSE;
  1520.     END ;
  1521.  
  1522.     IF (Object^.Code [ 9 ] <> 0) THEN
  1523.       IF Object^.CPtr<>NIL THEN
  1524. (**
  1525.         RTD.Message('Text');
  1526.         RTD.ShowVar('Object^.Code [ 9 ]', Object^.Code [ 9 ]);
  1527. **)
  1528.         IF Variablen.Visible(Object^.Surround) THEN
  1529.           FOR dum := 0 TO Object^.Code [ 9 ] - 1 DO
  1530.              str [ dum ] := Object^.CPtr^ [ dum ] ;
  1531.           END ;
  1532.           str [ Object^.Code [ 9 ] ] := CHR (0) ;
  1533. (*        dum := MagicVDI.SetWritemode(mtAppl.VDIHandle, MagicVDI.TRANSPARENT);
  1534. *)
  1535.           dum := MagicVDI.SetWritemode(mtAppl.VDIHandle, MagicVDI.XOR);
  1536.           AlignMode := Object^.Code[7];
  1537. (**
  1538.           RTD.Message('Now WriteText');
  1539. **)
  1540.           Internal := TRUE;
  1541.           WriteText (str , Object^.Code [ 9 ] ,
  1542.                      Object^.Code [ 5 ] , xya) ;
  1543.           Internal := FALSE;
  1544.           dum := MagicVDI.SetWritemode(mtAppl.VDIHandle, MagicVDI.REPLACE);
  1545.         END ;
  1546.        ELSE
  1547. (**
  1548.         RTD.Message('Oops, CPtr=NIL!');
  1549. **)
  1550.       END ;
  1551.     END ;
  1552.   ELSE
  1553.     (* Die Mitte ist gespeichert worden *)
  1554.     DX := Variablen.PixDistance(Object^.Code[3]);
  1555.     DY := Variablen.PixDistance(Object^.Code[4]);
  1556.     xy[0] := Object^.Code[1] + Object^.Code[3];
  1557.     xy[1] := Object^.Code[2] + Object^.Code[4];
  1558.     Variablen.PicToPix (PxyArray [ 0 ] , PxyArray [ 1 ] ,
  1559.                             Object^.Code [ 1 ] , Object^.Code [ 2 ]) ;
  1560.     Variablen.PicToPix (PxyArray [ 2 ] , PxyArray [ 3 ] ,
  1561.                                 xy [ 0 ] , xy [ 1 ]);
  1562.     dum := (PxyArray[2] - PxyArray[0]) DIV 2;
  1563.     PxyArray[ 0 ] := PxyArray[ 0 ] - dum;
  1564.     PxyArray[ 2 ] := PxyArray[ 2 ] - dum;
  1565.     dum := (PxyArray[3] - PxyArray[1]) DIV 2;
  1566.     PxyArray[ 1 ] := PxyArray[ 1 ] - dum;
  1567.     PxyArray[ 3 ] := PxyArray[ 3 ] - dum;
  1568.     IF PxyArray[0] < PxyArray[2] THEN
  1569.       X0 := PxyArray[0];
  1570.      ELSE
  1571.       X0 := PxyArray[2];
  1572.     END;
  1573.     IF PxyArray[1] < PxyArray[3] THEN
  1574.       Y0 := PxyArray[1];
  1575.      ELSE
  1576.       Y0 := PxyArray[3];
  1577.     END;
  1578.     Variablen.PixToPic (X0, Y0, Object^.Surround[0], Object^.Surround[1]);
  1579.     IF DX=0 THEN DX:=1; END;  IF DY=0 THEN DY:=1; END;
  1580.     Object^.Surround[2] := Variablen.PicDistance(DX);
  1581.     Object^.Surround[3] := Variablen.PicDistance(DY);
  1582.     Object^.SurrDirty := FALSE;
  1583.     IF Variablen.Visible(Object^.Surround) THEN
  1584.       dum := MagicVDI.SetLinewidth (mtAppl.VDIHandle ,
  1585.                                        Object^.Code [ 8 ]) ;
  1586.       RoundedRect (PxyArray);
  1587.     END;
  1588.     dum := MagicVDI.SetLinetype (mtAppl.VDIHandle , MagicVDI.Line) ;
  1589.     dum := MagicVDI.SetLinecolor (mtAppl.VDIHandle , MagicAES.BLACK) ;
  1590.     dum := MagicVDI.SetMarkertype(mtAppl.VDIHandle, MagicVDI.Point);
  1591.     dum := MagicVDI.SetMarkercolor(mtAppl.VDIHandle, MagicAES.BLACK);
  1592.     MagicVDI.SetLineEndstyles (mtAppl.VDIHandle ,
  1593.                                 MagicVDI.Cornerd , MagicVDI.Cornerd) ;
  1594.     dum := MagicVDI.SetFillinterior (mtAppl.VDIHandle , MagicVDI.Full) ;
  1595.     dum := MagicVDI.SetFillcolor (mtAppl.VDIHandle , MagicAES.BLACK) ;
  1596.   END;
  1597.   Internal := FALSE;
  1598. (**
  1599.   RTD.Message('Show ready');
  1600. **)
  1601. END Show ;
  1602.  
  1603. PROCEDURE Change (Object : Types.ObjectPtrTyp;
  1604.                   DX, DY : LONGREAL) ;
  1605.  
  1606. BEGIN
  1607.   IF ORD(Object^.Code[0]) <> ORD(Types.Text) THEN
  1608.     IF DX<>0.0 THEN
  1609.       Object^.Code[3] := Diverses.round(MathLib0.real(Object^.Code[3]) * DX);
  1610.     END;
  1611.     IF DY<>0.0 THEN
  1612.       Object^.Code[4] := Diverses.round(MathLib0.real(Object^.Code[4]) * DY);
  1613.     END;
  1614.     Object^.SurrDirty := TRUE;
  1615.   END;
  1616. END Change;
  1617.  
  1618. BEGIN
  1619.   Internal := FALSE;
  1620.   SetVectorText(FALSE);
  1621.   storeangle :=   0;
  1622.   storesize  := 1.0;
  1623.   storeslant := 0.0;
  1624. (**
  1625.   RTD.SetDevice(RTD.printer);
  1626. **)
  1627. END TextBox .
  1628.