home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 337.lha / Helper_v.07 / Gads.def < prev    next >
Encoding:
Modula Definition  |  1990-01-26  |  6.8 KB  |  142 lines

  1. DEFINITION MODULE Gads;
  2.  
  3. (*======================================================================*)
  4. (*                        Helper version v0.07                          *)
  5. (*======================================================================*)
  6. (*           Copyright © 1989 Mike Cargal, All Rights Reserved          *)
  7. (*======================================================================*)
  8. (*      Version: 0.07           Author : Mike Cargal                    *)
  9. (*      Date   : 20-Jun-89      Changes: Original                       *)
  10. (*======================================================================*)
  11.  
  12. FROM SYSTEM    IMPORT STRPTR;
  13. FROM Intuition IMPORT GadgetPtr, WindowPtr, IntuiMessage;
  14.                    
  15. TYPE
  16.  
  17.   Gad = RECORD
  18.           Command    : ARRAY [0..99] OF CHAR; (* Command TO execute
  19.                                                  when Helper button
  20.                                                  clicked *) 
  21.           Label      : ARRAY [0..8] OF CHAR;  (* Label TO place on
  22.                                                  Helper button *)
  23.           AppendFile : BOOLEAN;               (* Append File TO 
  24.                                                  command TRUE/FALSE *)
  25.         END;
  26.         
  27.   GadArray = ARRAY [0..11] OF Gad;  (* ARRAY OF 12 Helper buttons *)
  28.   GadPtr = POINTER TO GadArray;
  29.  
  30. CONST 
  31.   Version = "Helper v0.07";
  32.  
  33. VAR 
  34.   DefConfig : STRPTR;
  35.   
  36. (*******************************************************************)
  37.  
  38. PROCEDURE ChangeGads(Helperwp : WindowPtr);
  39.  
  40.   (*-------------------------------------------------------------\
  41.    |                                                             |
  42.    |  Open Window with Helper button definition gadgets.         |
  43.    |                                                             |
  44.    |  Use EasyIDCMP to respond to user gadget selection and      |
  45.    |    modify user configuration.                               |
  46.    |                                                             |
  47.    \-------------------------------------------------------------*)
  48.  
  49. PROCEDURE LoadGads(wp : WindowPtr);
  50.  
  51.   (*-------------------------------------------------------------\
  52.    |                                                             |
  53.    |  Present user with File requester to select configuration   |
  54.    |   file, and then load user configuration from selected      |
  55.    |   file.  Configuration file is verified against version     |
  56.    |   number of Helper so that non-configuration files and      |
  57.    |   incompatible configuration files will be rejected.        |
  58.    |                                                             |
  59.    |  Return success or failure of Configuration load.           |
  60.    |                                                             |
  61.    |  NOTE: file requester goes initially to S: since            |
  62.    |   requesting configuration file.                            |
  63.    |                                                             |
  64.    \-------------------------------------------------------------*)
  65.  
  66. PROCEDURE SaveGads(wp : WindowPtr);
  67.  
  68.   (*-------------------------------------------------------------\
  69.    |                                                             |
  70.    |  Present user with File requester (inititially in S:) to    |
  71.    |   select configuration file. Save current configuration     |
  72.    |   to selected file.                                         |
  73.    |                                                             |
  74.    \-------------------------------------------------------------*)
  75.  
  76. PROCEDURE SaveDefaults(wp : WindowPtr);
  77.  
  78.   (*-------------------------------------------------------------\
  79.    |                                                             |
  80.    |  Save current configuration to default configuration file   |
  81.    |   (S:Helper.cnf).  This file will be read automatically     |
  82.    |   when Helper is started up to obtain users default         |
  83.    |   configuration.                                            |
  84.    |                                                             |
  85.    \-------------------------------------------------------------*)
  86.  
  87. PROCEDURE InitGads() : GadPtr;
  88.  
  89.   (*-------------------------------------------------------------\
  90.    |                                                             |
  91.    |  Attempt to open S:Helper.cnf to read in user's default     |
  92.    |    configuration.                                           |
  93.    |                                                             |
  94.    |  If default configuration file is not located, then         |
  95.    |    assign "default default" values to Helper buttons        |
  96.    |                                                             |
  97.    \-------------------------------------------------------------*)
  98.  
  99. PROCEDURE GetFile(text, Dir : STRPTR) : STRPTR;
  100.  
  101.   (*-------------------------------------------------------------\
  102.    |                                                             |
  103.    |  Use Arp File requester to get file name.                   |
  104.    |       text - Title to appear at top of requester            |
  105.    |       Dir  - Directory in which requester should initiate.  |
  106.    |              NIL = Use Current Directory of Process.        |
  107.    |                                                             |
  108.    |    Returns - STRPTR to full path name of requested file.    |
  109.    |                                                             |
  110.    \-------------------------------------------------------------*)
  111.  
  112. PROCEDURE HandleCloseWindow(VAR im : IntuiMessage) : INTEGER;
  113.  
  114.   (*-------------------------------------------------------------\
  115.    |                                                             |
  116.    |  Handle Close Window IDCMP message for EasyIDCMP.           |
  117.    |                                                             |
  118.    |    I have nothing special to do, so just return non 0       |
  119.    |      to let EasyIDCMP know I'm through.                     |
  120.    |                                                             |
  121.    \-------------------------------------------------------------*)
  122.  
  123. PROCEDURE OpenHelperWindow() : WindowPtr;
  124.  
  125.   (*-------------------------------------------------------------\
  126.    |                                                             |
  127.    |  Open up Helper window according to configuration file      |
  128.    |    or established defaults.                                 |
  129.    |                                                             |
  130.    \-------------------------------------------------------------*)
  131.  
  132. PROCEDURE CloseHelperWindow(wp : WindowPtr);
  133.  
  134.   (*-------------------------------------------------------------\
  135.    |                                                             |
  136.    |  Close Helper Window, freeing Gadget List etc.              |
  137.    |                                                             |
  138.    \-------------------------------------------------------------*)
  139.  
  140.  
  141. END Gads.
  142.