home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / utility / 252 / gemsrc / dialog.mod < prev    next >
Encoding:
Modula Implementation  |  1988-02-13  |  6.0 KB  |  173 lines

  1. IMPLEMENTATION MODULE Dialog;
  2.  
  3.  
  4.    FROM SYSTEM IMPORT ADDRESS;
  5.    IMPORT GEMAESbase;
  6.    IMPORT AESResources;
  7.    IMPORT AESForms;
  8.    IMPORT AESObjects;
  9.    IMPORT Text;
  10.    IMPORT Screen;
  11.    IMPORT Icon;
  12.  
  13.  
  14.    (*------------------------------------------------------------------*)
  15.  
  16.    PROCEDURE Display ( DialogNumber : INTEGER;
  17.                        GrowFromBox  : Screen.Box;
  18.                        EditField    : INTEGER) : INTEGER;
  19.  
  20.    CONST DoNotRedraw = 0;
  21.  
  22.    VAR
  23.       DialogAddress   : ADDRESS;
  24.       DialogBorderBox : Screen.Box;
  25.       ObjectId        : INTEGER;
  26.       ObjectPtr       : Icon.ObjectPtr;
  27.  
  28.    BEGIN
  29.       AESResources.ResourceGetAddr ( GEMAESbase.RTree,
  30.                                      DialogNumber,
  31.                                      DialogAddress );
  32.       AESForms.FormCenter ( DialogAddress,
  33.                             DialogBorderBox.Origin.X,
  34.                             DialogBorderBox.Origin.Y,
  35.                             DialogBorderBox.Size.Width,
  36.                             DialogBorderBox.Size.Height );
  37.       AESForms.FormDialogue ( GEMAESbase.FormStart,
  38.                               GrowFromBox.Origin.X,
  39.                               GrowFromBox.Origin.Y,
  40.                               GrowFromBox.Size.Width,
  41.                               GrowFromBox.Size.Height,
  42.                               DialogBorderBox.Origin.X,
  43.                               DialogBorderBox.Origin.Y,
  44.                               DialogBorderBox.Size.Width,
  45.                               DialogBorderBox.Size.Height );
  46.       AESForms.FormDialogue ( GEMAESbase.FormGrow,
  47.                               GrowFromBox.Origin.X,
  48.                               GrowFromBox.Origin.Y,
  49.                               GrowFromBox.Size.Width,
  50.                               GrowFromBox.Size.Height,
  51.                               DialogBorderBox.Origin.X,
  52.                               DialogBorderBox.Origin.Y,
  53.                               DialogBorderBox.Size.Width,
  54.                               DialogBorderBox.Size.Height );
  55.       AESObjects.ObjectDraw ( DialogAddress,
  56.                               0, 10,
  57.                               DialogBorderBox.Origin.X,
  58.                               DialogBorderBox.Origin.Y,
  59.                               DialogBorderBox.Size.Width,
  60.                               DialogBorderBox.Size.Height );
  61.       ObjectId  := AESForms.FormDo ( DialogAddress, EditField );
  62.       ObjectPtr := Icon.GetAddress ( DialogNumber, ObjectId );
  63.       ObjectPtr^.State := ObjectPtr^.State - {Icon.Selected};
  64.       AESForms.FormDialogue ( GEMAESbase.FormFinish,
  65.                               GrowFromBox.Origin.X,
  66.                               GrowFromBox.Origin.Y,
  67.                               GrowFromBox.Size.Width,
  68.                               GrowFromBox.Size.Height,
  69.                               DialogBorderBox.Origin.X,
  70.                               DialogBorderBox.Origin.Y,
  71.                               DialogBorderBox.Size.Width,
  72.                               DialogBorderBox.Size.Height );
  73.       AESForms.FormDialogue ( GEMAESbase.FormShrink,
  74.                               GrowFromBox.Origin.X,
  75.                               GrowFromBox.Origin.Y,
  76.                               GrowFromBox.Size.Width,
  77.                               GrowFromBox.Size.Height,
  78.                               DialogBorderBox.Origin.X,
  79.                               DialogBorderBox.Origin.Y,
  80.                               DialogBorderBox.Size.Width,
  81.                               DialogBorderBox.Size.Height );
  82.       RETURN (ObjectId);
  83.    END Display;
  84.  
  85.    (*------------------------------------------------------------------*)
  86.  
  87.    PROCEDURE GetText ( DialogNumber : INTEGER;
  88.                        FieldNumber  : INTEGER;
  89.                        VAR Value    : ARRAY OF CHAR );
  90.  
  91.    TYPE TedinfoPtrType = POINTER TO Icon.Tedinfo;
  92.  
  93.    VAR
  94.      ObjectPtr  : Icon.ObjectPtr;
  95.      TedinfoPtr : TedinfoPtrType;
  96.      TextPtr    : Text.StringPtr;
  97.  
  98.    BEGIN
  99.      ObjectPtr  := Icon.GetAddress ( DialogNumber, FieldNumber );
  100.      TedinfoPtr := ObjectPtr^.Spec;
  101.      TextPtr    := TedinfoPtr^.Text;
  102.      Text.Assign ( TextPtr^, Value );
  103.    END GetText;
  104.  
  105.    (*------------------------------------------------------------------*)
  106.  
  107.    PROCEDURE PutText ( DialogNumber : INTEGER;
  108.                        FieldNumber  : INTEGER;
  109.                        Value        : ARRAY OF CHAR );
  110.  
  111.    TYPE TedinfoPtrType = POINTER TO Icon.Tedinfo;
  112.  
  113.    VAR
  114.      ObjectPtr  : Icon.ObjectPtr;
  115.      TedinfoPtr : TedinfoPtrType;
  116.      TextPtr    : Text.StringPtr;
  117.  
  118.    BEGIN
  119.      ObjectPtr := Icon.GetAddress ( DialogNumber, FieldNumber );
  120.      IF ObjectPtr = NIL THEN
  121.        RETURN;
  122.      END;
  123.      TedinfoPtr := ObjectPtr^.Spec;
  124.      IF TedinfoPtr = NIL THEN
  125.        RETURN;
  126.      END;
  127.      TextPtr := TedinfoPtr^.Text;
  128.      IF TextPtr = NIL THEN
  129.        RETURN;
  130.      END;
  131.      Text.Assign ( Value, TextPtr^ );
  132.    END PutText;
  133.  
  134.    (*------------------------------------------------------------------*)
  135.  
  136.    PROCEDURE Select ( DialogNumber : INTEGER;
  137.                       FieldNumber  : INTEGER );
  138.  
  139.    VAR ObjectPtr : Icon.ObjectPtr;
  140.  
  141.    BEGIN
  142.      ObjectPtr := Icon.GetAddress ( DialogNumber, FieldNumber );
  143.      ObjectPtr^.State := ObjectPtr^.State + {Icon.Selected};
  144.    END Select;
  145.  
  146.    (*------------------------------------------------------------------*)
  147.  
  148.    PROCEDURE Deselect ( DialogNumber : INTEGER;
  149.                         FieldNumber  : INTEGER );
  150.  
  151.    VAR ObjectPtr : Icon.ObjectPtr;
  152.  
  153.    BEGIN
  154.      ObjectPtr := Icon.GetAddress ( DialogNumber, FieldNumber );
  155.      ObjectPtr^.State := ObjectPtr^.State - {Icon.Selected};
  156.    END Deselect;
  157.  
  158.    (*------------------------------------------------------------------*)
  159.  
  160.    PROCEDURE IsSelected ( DialogNumber : INTEGER;
  161.                           FieldNumber  : INTEGER ) : BOOLEAN;
  162.  
  163.    VAR ObjectPtr : Icon.ObjectPtr;
  164.  
  165.    BEGIN
  166.      ObjectPtr := Icon.GetAddress ( DialogNumber, FieldNumber );
  167.      RETURN (Icon.Selected IN ObjectPtr^.State);
  168.    END IsSelected;
  169.  
  170.  
  171. END Dialog.
  172.  
  173.