home *** CD-ROM | disk | FTP | other *** search
/ Power Programming / powerprogramming1994.iso / progtool / pibterm / pibt41s1.arc / DISPLYTT.MOD < prev    next >
Text File  |  1988-01-27  |  7KB  |  132 lines

  1. (*----------------------------------------------------------------------*)
  2. (*        Display_Transfer_Types --- Display transfer type menu         *)
  3. (*----------------------------------------------------------------------*)
  4.  
  5. PROCEDURE Display_Transfer_Types(     Menu_Title    : AnyStr;
  6.                                       Menu_Default  : Transfer_Type;
  7.                                       Allow_None    : BOOLEAN;
  8.                                       Row           : INTEGER;
  9.                                       Column        : INTEGER;
  10.                                       Width         : INTEGER;
  11.                                       Height        : INTEGER;
  12.                                       Menu_Depth    : INTEGER;
  13.                                       Menu_Erase    : BOOLEAN;
  14.                                   VAR Transfer_Kind : Transfer_Type );
  15.  
  16. (*----------------------------------------------------------------------*)
  17. (*                                                                      *)
  18. (*     Procedure:  Display_Transfer_Types                               *)
  19. (*                                                                      *)
  20. (*     Purpose:    Display transfer type menu.                          *)
  21. (*                                                                      *)
  22. (*     Calling Sequence:                                                *)
  23. (*                                                                      *)
  24. (*        Display_Transfer_Types(     Menu_Title    : AnyStr;           *)
  25. (*                                    Menu_Default  : Transfer_Type );  *)
  26. (*                                    Allow_None    : BOOLEAN;          *)
  27. (*                                    Row           : INTEGER;          *)
  28. (*                                    Column        : INTEGER;          *)
  29. (*                                    Width         : INTEGER;          *)
  30. (*                                    Height        : INTEGER;          *)
  31. (*                                    Menu_Depth    : INTEGER;          *)
  32. (*                                    Menu_Erase    : BOOLEAN;          *)
  33. (*                                VAR Transfer_Kind : Transfer_Type );  *)
  34. (*                                                                      *)
  35. (*           Menu_Title    --- Title for menu                           *)
  36. (*           Menu_Default  --- Default transfer protocol                *)
  37. (*           Allow_None    --- Allow "None" as transfer type            *)
  38. (*           Row           --- Starting row for menu                    *)
  39. (*           Column        --- Starting column for menu                 *)
  40. (*           Width         --- Width for menu                           *)
  41. (*           Height        --- Height for menu                          *)
  42. (*           Menu_Depth    --- Depth for last menu item                 *)
  43. (*           Menu_Erase    --- TRUE to erase menu when done             *)
  44. (*           Transfer_Kind --- Type of transfer protocol selected       *)
  45. (*                                                                      *)
  46. (*----------------------------------------------------------------------*)
  47.  
  48. VAR
  49.    Transfer_Menu      : Menu_Type;
  50.    Transfer_Menu_Size : INTEGER;
  51.    I                  : INTEGER;
  52.    J                  : INTEGER;
  53.    Default            : INTEGER;
  54.    T                  : Transfer_Type;
  55.    Transfer_Names     : AnyStr;
  56.    Trans_Prots        : ARRAY[1..Max_Transfer_Types] OF Transfer_Type;
  57.  
  58. BEGIN (* Display_Transfer_Types *)
  59.  
  60.                                    (* Figure number of transfer types *)
  61.                                    (* defined                         *)
  62.    Transfer_Menu_Size  := 11;
  63.    Transfer_Names      := 'Ascii;Xmodem (Checksum);Xmodem (CRC);Kermit;Telink;Modem7 (Checksum);' +
  64.                           'Modem7 (CRC);Xmodem 1K;Xmodem 1K G;Ymodem Batch;' +
  65.                           'Ymodem G Batch;';
  66.  
  67.                                    (* Copy in types of built-in protocols *)
  68.    Default := -1;
  69.  
  70.    FOR I := 1 TO 11 DO
  71.       BEGIN
  72.          Trans_Prots[I] := Transfers[I];
  73.          IF ( Menu_Default = Trans_Prots[I] ) THEN
  74.             Default := I;
  75.       END;
  76.                                    (* Add names of user-defined protocols *)
  77.                                    (* to list.                            *)
  78.    FOR T := PUser1 TO PUser10 DO
  79.       IF ( Trans_Type_Name[T] <> '  ' ) THEN
  80.          BEGIN
  81.             Transfer_Names                  := Transfer_Names +
  82.                                                LTrim( Transfer_Name_List[SUCC(ORD(T))] ) + ';';
  83.             INC( Transfer_Menu_Size );
  84.             Trans_Prots[Transfer_Menu_Size] := T;
  85.             IF ( Menu_Default = Trans_Prots[Transfer_Menu_Size] ) THEN
  86.                Default := Transfer_Menu_Size;
  87.          END;
  88.                                    (* Insert 'NONE' as last protocol *)
  89.    IF Allow_None THEN
  90.       BEGIN
  91.          INC( Transfer_Menu_Size );
  92.          Trans_Prots[Transfer_Menu_Size] := None;
  93.          Transfer_Names                  := Transfer_Names + 'None;';
  94.       END;
  95.                                    (* Assume Xmodem checksum if no protocol *)
  96.                                    (* selected, or None if possible.        *)
  97.    IF ( Default < 0 ) THEN
  98.       IF Allow_None THEN
  99.          Default := Transfer_Menu_Size
  100.       ELSE
  101.          Default := 2;
  102.                                    (* Get transfer menu *)
  103.  
  104.    Make_A_Menu( Transfer_Menu, Transfer_Menu_Size, Row, Column,
  105.                                Width, Height, Default,
  106.                                Menu_Title, Transfer_Names, TRUE );
  107.  
  108.                                    (* Alter item positions if necessary *)
  109.  
  110.    IF ( Transfer_Menu_Size > Menu_Depth ) THEN
  111.       FOR I := SUCC( Menu_Depth ) TO Transfer_Menu_Size DO
  112.          WITH Transfer_Menu.Menu_Entries[I] DO
  113.             BEGIN
  114.                Menu_Item_Row    :=
  115.                   Transfer_Menu.Menu_Entries[I - Menu_Depth].Menu_Item_Row;
  116.                Menu_Item_Column :=
  117.                   Transfer_Menu.Menu_Entries[I - Menu_Depth].Menu_Item_Column + 30;
  118.             END;
  119.                                    (* Get transfer type *)
  120.  
  121.    Menu_Display_Choices( Transfer_Menu );
  122.  
  123.    I := Menu_Get_Choice( Transfer_Menu , Menu_Erase );
  124.  
  125.                                    (* Get transfer protocol *)
  126.    IF ( I > 0 ) THEN
  127.       Transfer_Kind := Trans_Prots[ I ]
  128.    ELSE
  129.       Transfer_Kind := None;
  130.  
  131. END   (* Display_Transfer_Types *);
  132.