home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 2 / RISC_DISC_2.iso / pd_share / program / fortran77_210 / library / docs / wimp < prev   
Encoding:
Text File  |  1994-01-30  |  28.8 KB  |  607 lines

  1.  
  2.      Wimp a FORTRAN subroutine library for Wimp handling   30 Jan 1992
  3.  
  4.   ************************************************************************
  5.  
  6.                     C O P Y R I G H T    N O T I C E
  7.  
  8.                      Copyright D.J & K.M. Crennell,          
  9.               P.O. Box 64, Didcot, Oxon, OX11 0TH.
  10.  
  11.  This software is in the Public Domain and may not be sold or included in
  12.  any program that will be sold, without written permission from the authors.
  13.  The authors must be given credit in any publications using this software.
  14.  
  15.  The software may be copied and distributed as long as no changes are made
  16.  and this copyright notice is included. Please send any suggested
  17.  improvements to the authors. 
  18.  
  19.  In no circumstances shall the authors be liable for any damage, loss of
  20.  profits, or any indirect or consequential loss arising out of the use of
  21.  this software or inability to use this software, even if they have been
  22.  advised of the possibility of such loss.
  23.  
  24.  The authors do their best to ensure that this library is distributed virus
  25.  free.
  26.   ************************************************************************
  27.  
  28.    The source of this library is assembler, and is not included.
  29.    The library is %.lib.Wimp
  30.  
  31.    **** Note the calling sequence to WMPI has changed on 26 Jan 1992 ****
  32.  
  33.        This writeup is a description of the routines available; it does not
  34.      show you how to write a Wimp program. For such a tutorial, try one of
  35.      the many Archimedes oriented magazines which have series of articles on
  36.      "programming the wimp". These are usually in the Basic language, but
  37.      the ideas are immediately applicable to Fortran using this wimp
  38.      library.
  39.  
  40.  Notes:
  41.   1) This library has a set of routines corresponding exactly to the Wimp
  42.      SWIs, and also some utilities to simplify their use.
  43.   2) All subroutine names begin WMP (unless the routine is a utility). 
  44.   3) the remaining characters are the capital letters of the corresponding
  45.      SWI. They are listed alphabetically except that the utilities are
  46.      listed at the end.
  47.   4) All arguments are of type INTEGER*4 except for a few CHARACTER
  48.      variables which are shown in lower case. In the descriptions CHARACTER
  49.      variables are enclosed in quotes. You may assume that they are input to
  50.      the routine unless otherwise stated.
  51.   5) Errors in the Wimp Library and normal fortran runtime errors are
  52.      displayed in the standard wimp error window. Clicking on 'Cancel' stops
  53.      the job; clicking on 'OK' returns control to the program at the point
  54.      where WMPP (Wimp_Poll) was called for the first time.
  55.      For this reason it is important that the polling loop is all in the
  56.      same routine which also calls WMPCD (Wimp_CloseDown). Subroutines may
  57.      be called from within the polling loop.
  58.      E.g.
  59.         ....
  60.      10 CALL WMPP(1,IBLOC,IREASN)
  61.         IF (IREASN.EQ.3) CALL WMPCW(IBLOC(1))
  62.         IF (IREASN.EQ.6) CALL BUTTON
  63.         etc.
  64.         ....
  65.         IF(.NOT.QUIT) GO TO 10
  66.         CALL WMPCD
  67.         ....
  68.  
  69.   6) Terminating a program with END or STOP will call WMPCD (Wimp_CloseDown)
  70.      implicitly, though it is not good practice to leave out the explicit
  71.      call. Terminating with STOP 'text' will do the same, but then display a
  72.      standard text window showing STOP: 'text' and the usual request to
  73.      press space or click the mouse to continue.
  74.   7) Communication with the WIMP is usually through the array IBLOC which
  75.      will often require individual bytes to be set up. The length of IBLOC
  76.      is specified in the writeup whenever it is used.
  77.   8) The first line for each description contains the subroutine name, with
  78.      arguments, the exact spelling of the SWI and the page reference in
  79.      Vol III of the PRM.
  80.   9) A Fortran utility, SAVEBX, for creating and using Drag Boxes is
  81.      included in the test file TWimp. It has 2 entry points, SAVEMN, to
  82.      create the menu window with its sprite, and SAVEBX to make the file and
  83.      save it to your chosen directory. See the comments in TWimp for further
  84.      details.
  85.  10) Standard OS units are always used for the graphics coordinates.
  86.  
  87.  
  88.    *******************   S W I   R o u t i n e s   *********************
  89.   
  90.  WMPBC(IWHAND,IX,IY,MX,MY,JX,JY) ; SWI Wimp_BlockCopy        1273
  91.     Copies the rectangular area within the window with handle IWHAND.
  92. IX,IY is the lower left corner of the area to be copied
  93. MX,MY is the upper right
  94. JX,JY is the lower left corner of the area to which it is copied.
  95.     The coordinates are relative to the window's work area.
  96.  
  97.  WMPBOS(IROM,IRMA)                     ; SWI Wimp_BaseOfSprites    1272
  98.     Returns the addresses of the two areas which make up the Wimp Sprite
  99. pool. 
  100. IROM is the address of the ROM based sprites 
  101. IRMA is the address of the RAM based sprites
  102.     It is possible to use these in Fortran! E.g.
  103.       DIMENSION KB(1)
  104.       CALL WMPBOS(IROM,IRMA)
  105. C            get the index to IROM in array KB
  106.       J=(IROM-LOC(KB))/4+1
  107. C            print the first two words of the Sprite block
  108.       PRINT *,'Size ',KB(J),',  # sprites ',KB(J+1)
  109.  
  110.  WMPCD                                 ; SWI Wimp_CloseDown        1241
  111.      This closes down the wimp task at the end of the job.
  112.  
  113.  WMPCFM                                ; SWI Wimp_ClaimFreeMemory  1279
  114.      Unfortunately the memory can only be accessed in "Supervisor mode"
  115. (SVC) and so can not be used by fortran programs. These run in "User mode"
  116. only. Hence this routine is not provided in the library.
  117.  
  118.  WMPCI(IBLOC,IHANDL)                   ; SWI Wimp_CreateIcon       1180
  119.     Creates an icon in a window from the information you supply in IBLOC;
  120. this is 36 bytes (9 words) long. The first word contains the window handle
  121. where the icon is to go, or -2 for left end of the icon bar, -1 for the
  122. right. The remaining 8 words are called the 'icon block' and contain
  123. information on the dimensions of the icon, its colours, its text and flags.
  124. IHANDL is the returned icon handle (unique within a window).
  125.  
  126.  WMPCLW(IHANDL)                        ; SWI Wimp_CloseWindow      1191
  127.      Closes the window IHANDL
  128.  
  129.  WMPCM(MBLOC,IX,IY)                    ; SWI Wimp_CreateMenu       1226
  130.      Displays a menu tree from:
  131. MBLOC: an array containing the menu; this is 7 words long plus 6 words for
  132.        each menu entry. MBLOC can be made most easily using the WMPMNU
  133.        utility below. If the first or only word of MBLOC is -1, all active
  134.        menus will be closed. 
  135. IX,IY: is the top left corner (in screen coordinates) of where you want to
  136.        put the menu.
  137.  
  138.  WMPCOW(IOPER)                         ; SWI Wimp_CommandWindow    1280
  139.     Opens a text window for normal VDU 4 type printing.
  140. IOPER = LOCC(...)    pointer to a null terminated CHARACTER string to be
  141.                      used as a title for the window
  142.       = 1 print wimp error reports textually;
  143.       = 0 close text window with 'Press SPACE or click mouse...' comment;
  144.       =-1 close text window immediately.
  145.  
  146.  WMPCRW(IBLOC,IHANDL)                  ; SWI Wimp_CreateWindow     1174
  147.      Creates a wimp window from the information in IBLOC; this is usually 
  148. 88 bytes (22 words) long and contains all the information on the dimensions
  149. of the window, its colours, its title and flags. It does not actually
  150. display the window, just sets it up.
  151. IHANDL is the returned handle for the window.
  152.  
  153.  WMPCSM(ISUBM,IX,IY)                   ; SWI Wimp_CreateSubMenu    1270
  154.     This allows a sub-menu to be created in other ways than the usual one of
  155. moving to the right over a menu arrow. (See also PRM 1253 on the menu
  156. warning message). 
  157. ISUBM is the address of the array containing the submenu information.
  158.       (Note, this is not the array itself, but a pointer to it).
  159. IX,IY are the coordinates of the top left of the menu. 
  160.    These 3 arguments are normally those returned in words 6, 7 & 8 of the
  161. WimpPoll block when issuing the message (type ?I0400C0) that the pointer is
  162. moving over the menu arrow.
  163.  
  164.  WMPCT                                 ; SWI Wimp_CloseTemplate    1237
  165.     Closes currently open template file (if any).
  166.  
  167.  WMPDB(IBLOC)                          ; SWI Wimp_DragBox          1216
  168.     Initiates a dragging operation. IBLOC is 14 words long.
  169.  IBLOC(1) usually contains the window handle, but if it is set negative,
  170. then the drag is cancelled. E.g. CALL WMPDB(-1)
  171.  IBLOC(2) contains the drag type (1 to 11) and controls what is needed in
  172. the other words, see PRM 1216.
  173.  
  174.  WMPDI(IBLOC)                         ; SWI Wimp_DeleteIcon       1189
  175.     Deletes an icon definition.
  176. IBLOC(1) : the window handle (-1 or -2  for icon bar)
  177. IBLOC(2) : the icon handle
  178.  
  179.  WMPDM(MBLOC,LIST,string,LEN)          ; SWI Wimp_DecodeMenu       1231
  180.     Textually describes the entries of a selected menu tree.
  181. MBLOC : the top level menu
  182. LIST  : the array of selections as returned by WimpPoll reason 9.
  183.    It returns:
  184. string: the information as a CHARACTER variable with the entries separated
  185.         by '.' ('string' must be defined sufficiently large)
  186. LEN   : the length of string
  187.  
  188.  WMPDW(IWHAND)                         ; SWI Wimp_DeleteWindow     1188
  189.     Closes the window with handle IWHAND, and removes its definition and all
  190. the icons belonging to it.
  191.  
  192.  WMPFR(IHANDL,IX,IY,MX,MY)             ; SWI Wimp_ForceRedraw      1221
  193.     Marks a rectangle as invalid so that the wimp will ask for it to be
  194. redrawn.
  195. IHANDL: the window handle, or -1 will force the whole screen to be redrawn.
  196. IX,IY : the bottom left corner
  197. MY,MY : the top right corner, (in window work area coordinates) 
  198.  
  199.  
  200.  WMPGCP(IBLOC)                        ; SWI Wimp_GetCaretPosition 1225
  201.     Returns details of the caret's state in IBLOC(1) to IBLOC(6).
  202.  
  203.  WMPGIS(IBLOC)                         ; SWI Wimp_GetIconState     1213
  204.    This returns the 'icon block' (see WMPCI) of an icon
  205. IBLOC(1) : the window handle 
  206. IBLOC(2) : the icon handle (they are not changed by WMPGIS)
  207.    It returns the icon block in IBLOC(3) to IBLOC(10), hence IBLOC is 10
  208. words long, 
  209.  
  210.  WMPGPI(IBLOC)                         ; SWI Wimp_GetPointerInfo   1214
  211.     Returns the following mouse information in IBLOC (5 words long)
  212. 1. Mouse X
  213. 2. Mouse Y
  214. 3. Which buttons are pressed
  215. 4. Window handle (=-1 for background, =-2 for Icon bar)
  216. 5. Icon handle (if negative it refers to one of the control icons around the
  217. periphery of the window; see PRM 1215)
  218.  
  219.  WMPGR(IBLOC,MORE)                     ; SWI Wimp_GetRectangle     1208
  220.     Used when the Wimp needs help drawing a part of a window. It has the
  221. same arguments as WMPRW. 
  222. IBLOC(1) : the window handle
  223.    It returns
  224. IBLOC(2) to IBLOC(11) defining the area to be redrawn
  225. MORE : =0 for no more to draw, <>0 requesting filling of the area
  226.  
  227.  WMPGWI(IBLOC)                         ; SWI Wimp_GetWindowInfo    1210
  228.     Gets the whole window block including any icons which have been included
  229. in it. Set DIMENSION IBLOC(0:N) where N = 22 + 8 * (Number of icons)
  230.  IBLOC(0) : Window handle
  231. It returns:
  232.  IBLOC( 1) to IBLOC(22) standard window information (defined in PRM p1174)
  233.  IBLOC(23) to IBLOC(30) first icon block (defined in PRM p1180)
  234.                         and similar blocks for other icons
  235.  
  236.  WMPGWO(IBLOC)                         ; SWI Wimp_GetWindowOutline 1245
  237.     Determines the bounding box of a window. DIMENSION IBLOC(5)
  238.  IBLOC(1) : the window handle
  239. It returns
  240.  IBLOC(2),IBLOC(3) : the bottom left corner of the window
  241.  IBLOC(4),IBLOC(5) : the top right corner of the window
  242.                      both in screen coordinates
  243.  
  244.  WMPGWS(IBLOC)                         ; SWI Wimp_GetWindowState   1209
  245.     Finds the current state of a window. DIMENSION IBLOC(9)
  246.  IBLOC(1) : the window handle
  247. It returns
  248.  IBLOC(2) to IBLOC(9) describing the window state. The first 8 words of
  249. IBLOC are then exactly in the format required to open the window using
  250. WMPOW(IBLOC).
  251.  
  252.  WMPI(title,ITHAND)                    ; SWI Wimp_Initialise       1173
  253.     Starts the Wimp task and turns on the pointer
  254.  title : CHARACTER string (the name used in the Application Task display)
  255. It returns:
  256.  ITHAND : the task handle
  257.  
  258.  WMPLT(IWB,ICONS,L,IFONT,name,IP)      ; SWI Wimp_LoadTemplate     1238
  259.     Loads a window definition from the template file which has been opened
  260. with WMPOT.
  261.  name : (CHARACTER*12), the window name to search for. It may have
  262. 'wildcards' and will be updated to the actual name found. It must therefore
  263. be a variable, and not be text between quotes. If it has less than 12
  264. significant characters, it should be null terminated, BUT the character
  265. variable MUST be 12 long because WMPLT always returns 12 characters of the
  266. new name.
  267.  IP   : the position in the file to start the search. Set this to 0
  268. initially to start at the beginning. It will be updated to point to the next
  269. entry after the one found, or will remain 0 if none are found.
  270.  IFONT: = -1 if no font reference information is required
  271.           or an array of 64 words, all initialised to zero, for font
  272.           reference information
  273. It returns:
  274.  IWB  : an array giving the window definition. It must be 22 words long, + 8
  275. for each icon.
  276.  ICONS: an array of length L for the indirected icons. The subroutine
  277. updates L to be the length of the unused space in ICONS after the icon text
  278. has been loaded. It should be long enough to contain the text of all the
  279. indirected icons in the window.
  280.  IFONT: is a 64 word font reference array.
  281.  
  282.  WMPOT(name)                           ; SWI Wimp_OpenTemplate     1236
  283.     Open the template file
  284.  name : (CHARACTER) the file path name
  285.  
  286.  WMPOW(IBLOC)                          ; SWI Wimp_OpenWindow       1190
  287.     Makes a window 'active' (displayed). 
  288. IBLOC : 8 word array describing the state of the window which are best set
  289. up using WMPGWS. The first word is the window handle, and the rest describe
  290. the current dimensions.
  291.  
  292.  WMPP(MASK,IBLOC,IRSN)                 ; SWI Wimp_Poll             1192
  293.     Steers the whole wimp operation after the creation of windows, icons and
  294. menus; it should be called at the start of an infinite loop.
  295.  MASK : set of bits which can stop the Wimp polling for some of the possible
  296.         'reasons'.
  297. It returns:
  298.  IRSN : the reason why it requires some help (e.g. drawing stuff in a
  299.         window)
  300.  IBLOC: an array of parameters for the task which needs doing. The longest
  301. arrays returned can be messages containing an indefinite length path name
  302. which starts in word 12. If you are not doing any data transfer message
  303. protocols, (file drags etc.), then an array of 10 words is sufficient.
  304.  
  305.  WMPPK(KEY)                            ; SWI Wimp_ProcessKey       1240
  306.     Passes the ASCII character KEY to the Wimp. This should be done if the
  307. task receives a Key_Press signal (8) in its WimpPoll, and does not want to
  308. process the key press itself.
  309.  
  310.  WMPPLI(IBLOC)                        ; SWI Wimp_PlotIcon         1248
  311.     Plots an icon in a window during a redraw or update.
  312.  IBLOC is an 8 word array containing the usual icon spatial information,
  313. flags and data (see PRM 1180 et seq.).
  314.  
  315.  WMPPOI(MASK,IBLOC,IRSN,ITIME)         ; SWI Wimp_PollIdle         1246
  316.     This is the same as WMPP, except that it does not return until ITIME
  317. centiseconds have passed for a null event. This is useful if you want to
  318. update some information infrequently without wasting Wimp time.
  319.  
  320.  WMPRE(IERR,errtxt,IFLAG,name,IREPT)   ; SWI Wimp_ReportError      1243
  321.     This produces the familiar red triangle warning window.
  322.  IERR  : is your error number;
  323.  errtxt: is your error description (CHARACTER <232 bytes);
  324.  IFLAG : is a 7-bit word which controls what icons are displayed. Set bit
  325.          0(1) to turn on the OK(Cancel) boxes. The rest of the bits are
  326.          explained in detail on page 1244 of the PRM;
  327.  name  : is a title for the application (CHARACTER <20 bytes)
  328.  IREPT : is returned: 0 if no click, 1 if 'OK' selected, and 2 if 'Cancel'.
  329.  
  330.  WMPRP(IRED,IGREEN,IBLUE)              ; SWI Wimp_ReadPalette      1251
  331.     Gets the Wimp palette colours.
  332. It returns:
  333.  IRED : an array of 20 words giving the red part of the palette. The colours
  334. have values between 0 and 255; normally only multiples of 16 are used.
  335.  IGREEN : a similar array of green colours
  336.  IBLUE  : a similar array of blue colours
  337. The first 16 words of each array are the normal wimp colour definitions (see
  338. WMPSC). The last four contain the border colour and the three pointer
  339. colours. 
  340.  
  341.  WMPRPT(ISTYP,ISB,name,ISCALE,ITRANS)  ; SWI Wimp_ReadPixTrans     1277
  342.     Reads the pixel translation table for a sprite.
  343.  ISTYP tells where the sprite is:
  344.        =-1: sprite is in system area, 'name' must be defined
  345.        =0 : sprite is in wimp area, 'name' must be defined
  346.        or it can be a user sprite array
  347.  ISB tells where the sprite is stored (only for user sprites)
  348.        =0 : sprite is defined by 'name'
  349.        >0 : byte displacement of the sprite in the user sprite array
  350.              ('name' is ignored)
  351.  name     : CHARACTER name of the sprite 
  352.             (ignored if ISB>0, but should be set to ' ')
  353. It returns:
  354.  ISCALE (array length 4) the scale factors:
  355.        (1), (2) = x,y multiplication factors
  356.        (3), (4) = x,y division factors
  357.  ITRANS (array of maximum size 4) the colour translations as up to 16 bytes.
  358.                                (Note that sprites can not have 256 colours).
  359.  
  360.  WMPRSI(ITEM,IVAL)                     ; SWI Wimp_ReadSysInfo      1284
  361.     Gets Wimp system information 
  362.  ITEM : =0 get the number of active tasks. No other items of information
  363.            have yet been defined by Acorn.
  364. It returns:
  365.  IVAL : value of the information required (the number of active tasks).
  366.  
  367.  WMPRW(IBLOC,MORE)                     ; SWI Wimp_RedrawWindow     1204
  368.     When WMPP returns reason code 1 (redraw window), call WMPRW first to
  369. find out what has to be done.
  370.  IBLOC(1) : the window handle
  371. It returns
  372.  IBLOC(2) to IBLOC(11) : information about the window, and which area is to
  373. be drawn. (A graphics window will have been set for the area, so you can
  374. draw your whole screen and it will do no harm.) 
  375.  MORE : = 0 if there is no more to draw
  376.       : <>0 requests that the area defined by IBLOC be filled.
  377. Having filled in the required area, find if there is any more to be filled
  378. by CALLing WMPGR with the same arguments; MORE =0 when there
  379. are none left and the redrawing is complete. 
  380.  
  381.  WMPSC(IACT,ICOL,IBAK)                 ; SWI Wimp_SetColour        1252
  382.     Sets the colour for drawing in a normal window. It uses the standard
  383. Wimp colours. 
  384.  IACT : the GCOL action (must be between 0 and 7) (PRM p247)
  385.  ICOL : the colour (must be between 0 and 15)
  386.  IBAK : 0 to define the foreground and 1 the background colour
  387. The GCOL actions are:
  388.    0: plot with the colour            1: OR the colour with the screen
  389.    2: AND the colour with the screen  3: EOR the colour with the screen
  390.    4: invert the current colour       5: no change to the screen
  391.    6: AND the screen with the complement of the colour
  392.    7: OR the screen with the complement of the colour
  393. The standard Wimp colours (PRM 1147) are:
  394.    0: White  - through grey scale to - 7: Black
  395.    8: Dark Blue   9: Yellow      10: Green       11: Red
  396.   12: Cream      13: Army green  14: Orange      15: Light Blue
  397.  
  398.     In 256 colour modes use standard graphics subroutine
  399. GCOLT(IACT,ICOL,ITNT64), but don't play with VDU19.
  400.  
  401.  WMPSCP(IWHAND,IIHAND,IX,IY,IH,INDEX)  ; SWI Wimp_SetCaretPosition 1223
  402.    Moves or removes the caret.
  403.  IWHAND: window handle (-1 turns off caret)
  404.  IIHAND: icon handle (-1 if none)
  405.  (IX,IY): offset of caret (relative to work area origin)
  406.  IH: height of caret (-1 means calculate IX,IY,IH from handles and INDEX)
  407.  INDEX: position in string (-1 means calculate IH & INDEX from handles, IX &
  408.                                                                          IY)
  409.  
  410.  WMPSE(IWHAND,IBLOC)                   ; SWI Wimp_SetExtent        1233
  411.     Resets the work area of window
  412.  IWHAND : window handle
  413.  IBLOC is an array of dimension 4
  414.  IBLOC(1),IBLOC(2) are the coordinates of the bottom left corner
  415.  IBLOC(3),IBLOC(4) are the coordinates of the top right corner
  416.    usually these will be (0, -ysize, xsize, 0)
  417.  
  418.  WMPSFC(ICFOR,ICBAC)                   ; SWI Wimp_SetFontColours   1285
  419.     Set the anti-aliased font colours
  420.  ICFOR : foreground logical colour
  421.  ICBAC : background logical colour
  422. The edges of the characters will be shaded with the range of logical colours
  423. from the background to the foreground.
  424.  
  425.  WMPSIS(IBLOC)                         ; SWI Wimp_SetIconState     1211
  426.     Changes an icon's flags (PRM 1181).
  427. The parameters are entered in an array IBLOC of dimension 4.
  428.  IBLOC(1) : window handle (-1 or -2 for icon bar)
  429.  IBLOC(2) : icon handle
  430.  IBLOC(3) : EOR word
  431.  IBLOC(4) : clear word
  432.    The bits in the icon flags word are changed in the following way:
  433. firstly, all bits in the flag word corresponding to the bits in the
  434. 'clear word' you supply are cleared; then all bits in the flag word
  435. corresponding to the bits in the 'EOR word' you supply have their state
  436. changed.
  437.  
  438.  WMPSMD(MODE)                          ; SWI Wimp_SetMode          1249
  439.     Sets the Wimp mode to MODE
  440.  
  441.  WMPSMG(IREASN,IBLOC,IHAND,IIHAND)     ; SWI Wimp_SendMessage      1253
  442.    Sends a message to another wimp user 
  443.  IREASN : the purpose of the message (see PRM 1253)
  444.  IBLOC  : an array of information being sent; the longest messages are about
  445. filenames, when the full filename starts in IBLOC(12)
  446.  IHAND defines where the message is to be sent and may be:
  447.   a)    a task handle
  448.   b)    a window handle 
  449.   c)  0 to send the message to all tasks
  450.   d) -2 for the icon bar, when IIHAND must contain the icon handle
  451.         (otherwise IIHAND is ignored)
  452.  
  453.  WMPSO(ITYP,name,IPAR)                 ; SWI Wimp_SpriteOp         1271
  454.     Does SpriteOps on Wimp sprites (see PRM 393 et seq. for OS_SpriteOp
  455. definitions).
  456.  ITYP is the SpriteOp type (currently allowed in the range 14 to 59);
  457.  name is the CHARACTER name of the sprite, it is not updated;
  458.  IPAR is an array of 5 words used as registers 3 to 7 which are the
  459. arguments used in the SpriteOp. You may find it less confusing to DIMENSION
  460. IPAR(3:7) when the index of IPAR is the same as the register number.
  461.  
  462.  WMPSP(IRED,IGREEN,IBLUE)              ; SWI Wimp_SetPalette       1250
  463.     Sets the Wimp palette colours.
  464.  IRED : an array of 20 words giving the red part of the palette. The colours
  465. have values between 0 and 255, and on the screen, only multiples of 16 are
  466. significant.
  467.  IGREEN : a similar array of green colours
  468.  IBLUE  : a similar array of blue colours
  469. The first 16 words of each array are the normal wimp colour definitions (see
  470. WMPSC). The last four contain the border colour and the three pointer
  471. colours. 
  472.  
  473.  WMPSPS(NSHAPE,IBPTR,IW,IH,IX,IY)      ; SWI Wimp_SetPointerShape  1234
  474.     Redefines the mouse pointer shape.
  475.  NSHAPE : shape number (=0: pointer off, =1: default arrow, =2: alternative)
  476.  IBPTR  : address of the array of pixels describing the pointer
  477.              (E.g. LOC(IBPIX) where the array IBPIX contains the pixels ),
  478.          or -1 for no change in pointer shape.
  479.  IW,IH  : width and height of the pointer in pixels
  480.  IX,IY  : offset in pixels of the active point to the top left of pointer
  481.  
  482.  WMPSS(NSCS,NSNS,ISCS,ISNS,ISFP)       ; SWI Wimp_SlotSize         1275
  483.     Used to change the current or next Wimp slot size (in bytes)
  484.  NSCS : new size required for current slot (-1 to read size only)
  485.  NSNS : new size required for next slot (-1 to read size only)
  486. It returns:
  487.  ISCS : the (new) current slot size
  488.  ISNS : the (new) next slot size size
  489.  ISFP : the (new) size of the free pool
  490.  
  491.  WMPST(commnd)                         ; SWI Wimp_StartTask        1242
  492.     commnd is a CHARACTER string containing a command which will cause a
  493. Wimp program to be executed, e.g. 'BASIC -quit MyProg' will run the Basic
  494. program "MyProg"
  495.  
  496.  WMPTB(IHS,KSB,IHD,KDB,L)              ; SWI Wimp_TransferBlock    1283
  497.     This transfers the contents of a block of memory from one task to
  498. another.
  499.  IHS : the task handle of the sending task
  500.  KSB : the byte address of the block to be sent
  501.  IHD : the task handle of the destination task
  502.  KDB : the byte address for receiving the block
  503.  L   : the length of the block in bytes
  504. Note that the KSB and KDB are byte addresses and not arrays or CHARACTER
  505. variables, so you may need to use LOC or LOCC to define them.
  506.  
  507.  WMPTC(ICOL)                           ; SWI Wimp_TextColour       1282
  508.     Sets text colour for VDU 4 type output in special text windows (see
  509. WMPCOW). ICOL should be in the range 0 to 15 for foreground colours, and
  510. have 128 added for background colours.
  511.  
  512.  WMPUW(IBLOC,MORE)                     ; SWI Wimp_UpdateWindow     1206
  513.     Similar to WMPRW, but can be called anytime to update any part of the
  514. window you like. Supply the window handle and the area to be updated in
  515.  IBLOC : the window handle and the area to be updated (11 words)
  516. It returns:
  517.  IBLOC : the area requested by the wimp     }    see WMPRW
  518.  MORE  : whether more updating is required  }     ..   ..
  519.  
  520.  WMPWI(IWHAND,IBLOC,MASK,IBITS)        ; SWI Wimp_WhichIcon        1232
  521.     This finds which icons in a window have flags with certain bits set
  522.  IWHAND : the window handle
  523.  MASK   : mask determining which bits in the icon flags are to be tested
  524.  IBITS  : the bit pattern (within the mask) to be satisfied by the icon
  525.           flags
  526. It returns which icons satisfy these requirements as:
  527.  IBLOC  : an array of icon handles terminated with -1
  528. Hence IBLOC should have a dimension greater than the number of icons in the
  529. window.     
  530.  
  531.      *******************   U T I L I T I E S   *********************
  532.  
  533.  FUNCTION IWMPCI(IWHAND,IX,IY,IW,IH,IFLAG,text,valid)
  534.     This function simplifies calling Wimp_CreateIcon and returns the icon
  535. handle.
  536.  IWHAND is the handle of the window to contain the icon.
  537.  (IX,IY) is the position of the bottom left corner of the icon in the window
  538. reference frame with origin at the top left. Hence IX should be >0 and IY
  539. should be <0.
  540.  (IW,IH) is the width and height of the icon. For text, IW is ~20 + 16 x
  541. number of letters in the icon and IH is usually +48.
  542.  IFLAG contains the icon flags which determine the colours, centering,
  543. borders, selection group etc. (See PRM page 1181.) Bit 8 will always be set
  544. because the names are always addressed indirectly. As an example, try
  545. IFLAG=?I0800B13D which gives a blue text sprite which responds to being
  546. clicked over. Bits 0 of IFLAG is set for a text icon and bit 1 for a sprite
  547. icon. Both can be set at the same time.
  548.  'text' is a CHARACTER variable with a dummy last character; it must not be
  549. a text string enclosed in quotes because the last character will be
  550. overwritten with a null. It contains the text of a 'text icon' if
  551. bit zero of IFLAG is set, or the sprite name if it is a 'sprite only' icon
  552. (bit 1 of IFLAG set, and bit 0 unset). N.B. for writeable text icons, the
  553. length of the character variable you give defines the maximum length of the
  554. icon.
  555.  'valid' is a CHARACTER variable with a dummy last character; it must not be
  556. a text string enclosed in quotes because the last character will be
  557. overwritten with a null character. It is the 'validation string' for a text
  558. icon, or the sprite name for a sprite + text icon; see PRM 1184.
  559.  
  560.  FUNCTION IWMPCW(IX,IY,IW,ID,MAXW,MAXD,title,IWF)
  561.     This function simplifies calling Wimp_CreateWindow and returns the
  562. window handle.
  563.  (IX,IY) is the top left hand corner of the window in screen coordinates
  564.  (IW,ID) is the width and depth of the displayed window
  565.  (MAXW,MAXD) is maximum size of window (if < IW,ID then IW,ID will be used).
  566.     Note, the depths are measured downwards and are positive, whereas the IY
  567.     is measured upwards from (0,0) at the bottom left of the screen.
  568.  'title' (CHARACTER variable) is the title text. Note, 'title' must be a
  569. CHARACTER variable (not a literal enclosed in quotes) because IWMPCW will
  570. overwrite the last character with a null control code. So put a spare
  571. character on the end!
  572.  IWF window flags. These control how the window looks, (see PRM page 1175),
  573. e.g. for a normal window into which you want to write or draw things try
  574. ?IFF00000F, and if the window only contains icons which the wimp will draw,
  575. use ?IFF00001F.
  576.  
  577.  SUBROUTINE WMPMNU(MBLOC,title,list,N)
  578.      Create a menu block in MBLOC from CHARACTER*12 'title' and 'list' of N
  579. menu entries. This block should then be used in WMPCM to open a menu window.
  580. Fancy effects like menu trees or underlined entries have to be done by
  581. correcting the MBLOC entries before opening the menu, (PRM 1226). MBLOC must
  582. be of length 6*N+7. Here is a trivial example:
  583.       PARAMETER (N=2)
  584.       DIMENSION MBLOC(7+6*N)
  585.       CHARACTER*12 TITLE,LIST(N)
  586.       DATA TITLE/'Menu'/,LIST/'Example','Quit'/
  587.       CALL WMPMNU(MBLOC,TITLE,LIST,N)
  588.  
  589.  SUBROUTINE WMPC2H(text,IHOLL)
  590.     Transfers CHARACTER*(*) text to INTEGER IHOLL(*), terminating with a
  591. 'null'.
  592.  
  593.  SUBROUTINE WMPH2C(IHOLL,text,LENGTH)
  594.     Transfers characters from INTEGER IHOLL(*) (control terminated) to
  595. CHARACTER*(*) text. Returns length of string in IHOLL in LENGTH. Control
  596. characters are in the range 0 - 31. Normally text(1:LENGTH) will contain the
  597. string and text(LENGTH+1:LENGTH+1) the control character. However if the
  598. length is too big for 'text', the excess characters will not be
  599. transferred.
  600.   *** N.B. check LENGTH against the size of 'text' to make sure all has been
  601. transferred. ***
  602.  
  603.  SUBROUTINE WMPTXT(IX,IY,text)
  604.      Prints text (CHARACTER variable) at graphics location IX,IY. This is
  605. like WOG in the graphics library, but should be used for printing in windows
  606. in the Wimp environment.
  607.