home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / OSK / EFFO / forum8.lzh / PROGRAMME / MODULA / WINDOW / area2.mod < prev    next >
Text File  |  1989-01-19  |  10KB  |  266 lines

  1. (*
  2. -------------------------------------------------------------------------------
  3. @@@@@@@@@@@@@@@@@@@*)  IMPLEMENTATION  MODULE  Area2;  (*@@@@@@@@@@@@@@@@@@@@@@
  4. -------------------------------------------------------------------------------
  5. -------------------------------------------------------------------------------
  6. | Kurzbeschreibung   | Verwaltung von Doppelfenstern: oben ein separates      |
  7. |                    | Fenster fuer Titel etc.                                |
  8. ---------------------+---------------------------------------------------------
  9. | Programm - Version |  1.1   |   Text - Version        |   V#005             |
  10. ---------------------+--------+-------------------------+----------------------
  11. | Modulholder        |  WS    |   Urversion     |  WS   |   Januar 89         |
  12. ---------------------+---------------------------------------------------------
  13. | System - Version   | OS-9, Miele-Modula-2 3.5                               |
  14. ---------------------+---------------------------------------------------------
  15. | Copyright          | Freigegeben fuer nichtkommerzielle Nutzung             |
  16. |                    |  durch Teilnehmer am EFFO                              |
  17. ---------------------+---------------------------------------------------------
  18. | Hardware           | GEPARD 68010, 1 MByte RAM, 80Zeichen-Textkarte         |
  19. ---------------------+---------------------------------------------------------
  20. | besondere Importe  |                                                        |
  21. -------------------------------------------------------------------------------
  22. | Autoren            |  WS    | Werner Stehling, Seilerwis 3,                 |
  23. |                    |        | CH-8606 Greifensee, Tel. 01/256 42 21         |
  24. ---------------------+---------------------------------------------------------
  25. |   U P D A T E S    |                                                        |
  26. ----------------------                                                        |
  27. |   Datum   Version  Autor  Bemerkungen                                       |
  28. | --------  -------  -----  -----------                                       |
  29. |  6. 2.89    1.0      WS   Beruecksichtigung, dass kein Fenster offen ist    |
  30. |  7. 2.89    1.1      WS   SetTemp2 neu                                      |
  31. |  9. 2.89    1.1      WS   ResetAktiv2 definiert zum Beschleunigen           |
  32. |                                                                             |
  33. -------------------------------------------------------------------------------
  34. | Modul-Beschreibung |         siehe  Definition Module, area.def, areaio.def |
  35. ----------------------                                                        |
  36. | Verwaltung von zwei Fenstern gemeinsam, wobei das obere Fenster als Titel-  |
  37. | bereich angesehen wird.                                                     |
  38. |                                                                             |
  39. | Programmtechnisch wird ausgenutzt, dass alle geoeffneten Fenster in einer   |
  40. | linearen Liste verkettet sind. Wenn das Titelfenster immer direkt hinter    |
  41. | dem eigentlichen IO-Bereich liegt, ist ein schneller Zugriff ohne grosse    |
  42. | Verwaltung moeglich.                                                        |
  43. |                                                                             |
  44. | W A R N U N G :                                                             |
  45. | ===============                                                             |
  46. | Die Prozeduren dieses Moduls und darauf aufbauender Module duerfen nicht    |
  47. | gemeinsam mit anderen I/O-Prozeduren (z.B. aus InOut) verwendet werden, da  |
  48. | ueber den Bildschirm-Inhalt und die Cursorpositionen separat Buch gefuehrt  |
  49. | wird.                                                                       |
  50. -------------------------------------------------------------------------------
  51. *)
  52.  
  53. FROM  Area      IMPORT  MakeArea, SetAktiv, GetAktiv, GetAreaPar, PositArea,
  54.                         DimArea, ReturnArea, WriteLn, Area, ClearArea,
  55.                         SaveScreen, ResetAktiv;
  56. FROM  AreaIO    IMPORT  WriteStr;
  57.  
  58. (*==========================================================================*)
  59. (****   Prozeduren zur Fensterverwaltung                                 ****)
  60. (*==========================================================================*)
  61.     PROCEDURE  MakeArea2 (x0, y0, dx, dy, dw : CARDINAL) : Area;
  62. (*--------------------------------------------------------------------------*)
  63.  
  64. VAR     a1, a2      : Area;
  65.  
  66. BEGIN
  67.   a1 := MakeArea (x0, y0+dw+1, dx, dy);
  68.   a2 := MakeArea (x0, a1^.ymin-dw-1, dx, dw);
  69.   RETURN  a1
  70. END  MakeArea2;
  71.  
  72. (*--------------------------------------------------------------------------*)
  73.         PROCEDURE  SetAktivt (bereich : Area);
  74. (*--------------------------------------------------------------------------*)
  75.  
  76. BEGIN
  77.   IF  (bereich <> NIL) AND (bereich^.nextarea <> NIL)  THEN
  78.     SetAktiv (bereich^.nextarea)
  79.   END
  80. END  SetAktivt;
  81.  
  82. (*--------------------------------------------------------------------------*)
  83.         PROCEDURE  ResetAktiv2 (bereich : Area);
  84. (*--------------------------------------------------------------------------*)
  85.  
  86. BEGIN
  87.   IF  (bereich <> NIL) AND (bereich^.nextarea <> NIL)  THEN
  88.     ResetAktiv (bereich^.nextarea);
  89.     ResetAktiv (bereich)
  90.   END
  91. END  ResetAktiv2;
  92.  
  93. (*--------------------------------------------------------------------------*)
  94.         PROCEDURE  SetAktiv2 (bereich : Area);
  95. (*--------------------------------------------------------------------------*)
  96.  
  97. BEGIN
  98.   IF  (bereich <> NIL) AND (bereich^.nextarea <> NIL)  THEN
  99.     SetAktiv (bereich^.nextarea);
  100.     SetAktiv (bereich)
  101.   END
  102. END  SetAktiv2;
  103.  
  104. (*--------------------------------------------------------------------------*)
  105.         PROCEDURE  SetTemp2 (bereich : Area);
  106. (*--------------------------------------------------------------------------*)
  107. (* Rettet den absoluten Bildschirmbereich auf den Stack, bevor der neue     *)
  108. (* Bereich angezeigt wird. Restaurieren durch EndTemp aus Area              *)
  109.  
  110. BEGIN
  111.   IF  (bereich <> NIL) AND (bereich^.nextarea <> NIL)  THEN
  112.     WITH  bereich^  DO
  113.       SaveScreen (nextarea^.xmin-1, nextarea^.ymin-1,
  114.                   breite+2, hoehe+nextarea^.hoehe+3)
  115.     END
  116.   END;
  117.   SetAktiv2 (bereich)
  118. END  SetTemp2;
  119.  
  120. (*--------------------------------------------------------------------------*)
  121.     PROCEDURE  GetAreaPar2 (bereich : Area;
  122.                             VAR x0, y0, dx, dy, dw : CARDINAL);
  123. (*--------------------------------------------------------------------------*)
  124.  
  125. BEGIN
  126.   IF  bereich <> NIL  THEN
  127.     WITH  bereich^  DO
  128.       dx := breite;
  129.       dy := hoehe;
  130.       dw := bereich^.nextarea^.hoehe;
  131.       x0 := bereich^.nextarea^.xmin;
  132.       y0 := bereich^.nextarea^.ymin
  133.     END
  134.   ELSE
  135.     GetAreaPar (bereich, x0, y0, dx, dy);
  136.     dw := 0
  137.   END
  138. END  GetAreaPar2;
  139.  
  140. (*--------------------------------------------------------------------------*)
  141.         PROCEDURE  PositArea2 (VAR bereich : Area; x0, y0 : CARDINAL);
  142. (*--------------------------------------------------------------------------*)
  143.  
  144. VAR     a1      : Area;
  145.  
  146. BEGIN
  147.   IF  bereich <> NIL  THEN
  148.     GetAktiv (a1);
  149.     SetAktiv (NIL);
  150.     PositArea (bereich, x0, y0+bereich^.nextarea^.hoehe+1);
  151.     PositArea (bereich^.nextarea, x0, bereich^.ymin-bereich^.nextarea^.hoehe-1);
  152.     IF  a1 = bereich  THEN
  153.       SetAktiv (bereich^.nextarea);
  154.       SetAktiv (bereich)
  155.     ELSE
  156.       SetAktiv (a1)
  157.     END
  158.   END
  159. END  PositArea2;
  160.  
  161. (*--------------------------------------------------------------------------*)
  162.         PROCEDURE  DimArea2 (VAR bereich : Area; dx, dy, dw : CARDINAL);
  163. (*--------------------------------------------------------------------------*)
  164.  
  165. VAR     i, k    : CARDINAL;
  166.         a1, a2  : Area;
  167.         flag    : BOOLEAN;
  168.  
  169. BEGIN
  170.   IF  (bereich <> NIL) AND (bereich^.nextarea <> NIL)  THEN
  171.     GetAktiv (a1);
  172.     IF  a1 = bereich  THEN
  173.       flag := TRUE
  174.     ELSE
  175.       flag := FALSE
  176.     END;
  177.     a2 := bereich^.nextarea;
  178.     SetAktiv (NIL);
  179.     i := bereich^.nextarea^.hoehe;
  180.     k := bereich^.ymin;
  181.     IF  dw <> i  THEN
  182.       PositArea (bereich, bereich^.xmin, k+dw-i)
  183.     END;
  184.     DimArea (bereich, dx, dy);
  185.     i := bereich^.ymin - dw - 1;
  186.     k := a2^.ymin;
  187.     IF  i <> k  THEN
  188.       PositArea (a2, bereich^.xmin, i)
  189.     END;
  190.     DimArea (a2, dx, dw);
  191.     IF  flag  THEN
  192.       SetAktiv (bereich^.nextarea);
  193.       SetAktiv (bereich)
  194.     ELSE
  195.       SetAktiv (a1)
  196.     END
  197.   END
  198. END  DimArea2;
  199.  
  200. (*--------------------------------------------------------------------------*)
  201.         PROCEDURE  ReturnArea2 (bereich : Area);
  202. (*--------------------------------------------------------------------------*)
  203.  
  204. BEGIN
  205.   ReturnArea (bereich^.nextarea);
  206.   ReturnArea (bereich)
  207. END  ReturnArea2;
  208.  
  209. (*--------------------------------------------------------------------------*)
  210.         PROCEDURE  ClearArea2;
  211. (*--------------------------------------------------------------------------*)
  212.  
  213. VAR     a1      : Area;
  214.  
  215. BEGIN
  216.   GetAktiv (a1);
  217.   IF  (a1 <> NIL) AND (a1^.nextarea <> NIL)  THEN
  218.     SetAktiv (a1^.nextarea);
  219.     ClearArea;
  220.     SetAktiv (a1)
  221.   END;
  222.   ClearArea
  223. END  ClearArea2;
  224.  
  225. (*==========================================================================*)
  226. (****   Prozeduren zur Titelverwaltung                                   ****)
  227. (*==========================================================================*)
  228.         PROCEDURE  WriteLnt;
  229. (*--------------------------------------------------------------------------*)
  230.  
  231. VAR     a1          : Area;
  232.  
  233. BEGIN
  234.   GetAktiv (a1);
  235.   IF  (a1 <> NIL) AND (a1^.nextarea <> NIL)  THEN
  236.     SetAktiv (a1^.nextarea);
  237.     WriteLn;
  238.     SetAktiv (a1)
  239.   ELSE
  240.     WriteLn
  241.   END;
  242. END  WriteLnt;
  243.  
  244. (*--------------------------------------------------------------------------*)
  245.         PROCEDURE  WriteTitel (VAR s : ARRAY OF CHAR; space : INTEGER);
  246. (*--------------------------------------------------------------------------*)
  247.  
  248. VAR     a1          : Area;
  249.  
  250. BEGIN
  251.   GetAktiv (a1);
  252.   IF  (a1 <> NIL) AND (a1^.nextarea <> NIL)  THEN
  253.     SetAktiv (a1^.nextarea);
  254.     WriteStr (s, space);
  255.     SetAktiv (a1)
  256.   ELSE
  257.     WriteStr (s, space)
  258.   END
  259. END  WriteTitel;
  260. (*--------------------------------------------------------------------------*)
  261.  
  262. BEGIN
  263. END  Area2.
  264.  
  265.  
  266.