home *** CD-ROM | disk | FTP | other *** search
/ APDL Public Domain 1 / APDL_PD1A.iso / program / interface / !Interface / !help < prev    next >
Encoding:
Text File  |  1992-12-23  |  22.4 KB  |  641 lines

  1. interface manager vsn 2.00
  2. ----------------------------------------------
  3. (c) 1990-1992, software interrupt developments
  4.         simon huntington
  5.         all rights reserved
  6.         copyright belongs to software interrupt at all times.
  7.  
  8. You are free to use interface in any commercial products free of charge.
  9. If you feel the need to send any money to me (thanks in advance).
  10.  
  11. --------------------------------------------------------------------------------
  12.  
  13. Changes from version 1.32
  14.  
  15. This version has been fully re-written using the acorn aof assembler.
  16.  
  17. Border type has changed to z to avoid conflicts with risc-os 3
  18.  
  19. Interface_Plot3dIcon has been changed so the first parameter is a window
  20. state block instead of a window handle
  21.  
  22. Names have changed to interface_...., old names are still supported
  23.  
  24. Better redraw code to correct problems with multi-sync modes where the icons
  25. were not alligned correctly.
  26.  
  27. Interface_BoundingBox now returns the state of the button 
  28.  
  29. New border types
  30.  
  31. *command to allow changes in the slabbing colours.
  32.  
  33. --------------------------------------------------------------------------------
  34. This manual and software is public domain.  It may be copied and distributed
  35. freely as long as:
  36.  
  37.        It is not separated from the documentation (except for commercial use)
  38.        The module is not tampered with
  39.        You do not claim that you have written the module
  40.        Do not use any of the code contained in this module in your own code
  41.  
  42. If you wish to use this in a commercial product please contact me so that I
  43. can make  sure you have the latest release, please send a disk.
  44.  
  45. In no circumstances shall the author be liable for any damage, loss of
  46. profits, time or  data or any indirect or consequential loss rising out of
  47. the use of this software or  inability to use this software.
  48.  
  49. Contacts:
  50.        Arcade BBS          (081 654 2212)                   
  51.  
  52.        All mail on the above Bulletin Bords should be mailed to JICK
  53.  
  54. **************** Introduction ***********************************************
  55.  
  56. Interface is a small module that allows application programmers to implement
  57. a colourful and pleasant graphical user interface.  Interface provides many
  58. more  functions that allows you to change the pointer shape easily and to
  59. interface with the  !Help or !Spy application.
  60.  
  61. The Interface module provides functions to improve the friendliness and
  62. appearance  of the application. The application should still operate as
  63. stated in  the Acorn  guidelines in the Programmers Reference Manuals.
  64.  
  65. The module implements a number of SWIs which are described further in this 
  66. manual, these SWI calls can be called from any language. Most of the
  67. functions provided are specified in the icons validation string, and so no
  68. complex programming is needed to make the application look good.
  69.  
  70. This guide tells you how to fully implement the features of Interface. It is
  71. split into  the follow sections:
  72.  
  73.         The first section explains the validation strings options provided
  74.         by Interface.
  75.  
  76.         The next section gives details of the SWI calls provided.
  77.  
  78.         The remaining section covers hints and tips on programming.
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85. **************** Technical details ***********************************************
  86.  
  87. An indirected text icon can have a validation string which is used to pass
  88. further  information to the WIMP, such as what border type the icon has and
  89. also what  pointer, if any should be displayed whilst over this icon.  The
  90. syntax of a validation  string is:
  91.  
  92.   validation string ::- command {;command}*
  93.   command           ::- (b | z) border-type {border-spec} | 
  94.                         r on/off-type {,icon-number}* |
  95.                         u on/off-type {,icon-number}* |
  96.                         p text-string {,x} {,y} |
  97.                         i text-string |
  98.                         k key-code
  99.   border-spec       ::- {,button-slabbing-mask} {,slabbing-time} {,colour}*
  100.  
  101. The parameters above are described under the relevant validation command. In
  102. simple terms, a validation string consists of a series of 'commands', each
  103. starting  with a single letter and seperated from the following command by a
  104. semi-colon.  {}* means zero or more of the thing inside the {}. The
  105. following commands are available with the Interface module.
  106.  
  107. These commands are provided in addition to the standard Wimp validation
  108. strings. I suggest that you edit the !FormEd program to allow you to enter
  109. larger validation strings, otherwise when entering a help command you will
  110. only be allowed a maximum of 80 characters.
  111.  
  112. The (B)order command tells Interface which border to use when rendering an
  113. icon. The border types available at present are :
  114.  
  115.     Type 0  This is a single border used mainly for headings and action
  116.             icons. The icon will slab inwards if the user clicks a button
  117.             whilst the pointer is over the icon providing it is not set to
  118.             ignore mouse clicks.
  119.  
  120.    Type 1   This is a double border and should be used to group together
  121.             icons that perform an operation.
  122.  
  123.    Type 2   This is a triple border and should be used on the default action
  124.             button. The icon will slab inwards when the user clicks a button
  125.             whilst the pointer is over this icon, providing it is not set to
  126.             ignore mouse clicks.
  127.  
  128.    Type 3   This is a wide inverted border and should be used on writable
  129.             icons. This border type is usually used in conjunction with the
  130.             writable pointer.
  131.         
  132.    Type 4   This is an inverted version of border type 0
  133.         
  134.    Type 5   This is a double wide border as used by Acorn in RISC OS 3
  135.         
  136.    Type 6   Etched in border
  137.         
  138.    Type 7   Similar to border type 0, thinner in mode 20
  139.  
  140. The second optional parameter is the button slabbing mask. This states
  141. whether the icon should be slabbed until the button is released. The values
  142. contained in this parameter can be from 0 to 7. The button slabbing mask can
  143. be calculated in the following way:
  144.  
  145.         Value       Button               Meaning
  146.  
  147.          1          Adjust      slab icon until adjust is released
  148.          2          Menu        slab icon until menu is released
  149.          4          Select      slab icon until select is released
  150.  
  151. The button slabbing mask can then be calculated by adding together the
  152. required  button values.  
  153.  
  154. The button slabbing time is the minimum time that the icon will be slabbed
  155. for, the  default time is for 15cs. This value is a decimal number in
  156. centi-seconds. The colours are specified in the following order:
  157.  
  158.         {,border colour1} {,border colour2} {,slabbing out colour} 
  159.         {,slabbing in colour} {,inner channel colour}
  160.  
  161. These colours can be any valid WIMP colour in the range of 0 to 15. The
  162. default selection is 4, 0, 1, 14, 12.
  163.  
  164. The (R)adio command specified in the validation string is used to set the
  165. state of other radio button type icons. The R command is followed by a
  166. decimal number in  the range 0 to 2, the action that these perform is:
  167.  
  168.     Radio type                      Operation
  169.  
  170.        0             Has the effect of switching off the specified icon(s).
  171.        1             Has the effect of switching on the specified icon(s).      
  172.        2             Has the effect of toggling the icons current state.
  173.  
  174. This command is followed by the numbers of the icons you wish to alter,
  175. these should be separated by commas. This command may be specified more than
  176. once in a validation string. For example to switch icons 1 and 2 off, 3 and
  177. 4 on and toggle the  state of icons 5 and 6 you could use the following
  178. validation string
  179.  
  180.         R0,1,2;R1,3,4;R2,5,6
  181.  
  182. The (U)nselectable command in the validation string has the effect of
  183. shading the  icon grey so that it cannot be selected by the user. It is
  184. followed by a decimal  number in the range 0 to 2, the action that these is
  185. described above in the radio command.
  186.  
  187. This command is then followed by the numbers of the icons you wish to alter,
  188. these  should be separated by commas. This command may be specified more
  189. than once in a validation string. For example to shade icons 1 and 2,
  190. un-shade 3 and 4 and toggle the state of icons 5 and 6 you could use the
  191. following validation string
  192.  
  193.         U0,1,2;U1,3,4;U2,5,6
  194.  
  195. The (P)ointer command is used to define a pointer to be displayed when the
  196. pointer is over that icon. The first parameter is a sprite name to use for
  197. the pointer. This  should be no longer than 12 characters and should be
  198. present in the WIMP sprite  pool. The optional parameters specify the x and
  199. y offsets to the active point in the  sprite. These should be specified in
  200. pixels.
  201.  
  202. The (I)nformation command is used to define a message to be sent to the
  203. interactive help application when the pointer is over the icon. If you wish
  204. to use a semi-colon then you must place two next to each other. The maximum
  205. length of the help message is 235 characters.
  206.  
  207. The Interface module will change to the specified pointer when the mouse
  208. pointer is  over the icon/workarea. If no pointer is specified then the
  209. pointer will default to Shape One (the default arrow shape). There are 5
  210. pointer shapes designed in the sprite file in the !Interface directory,
  211. these are:
  212.  
  213.    ptr_write  - This pointer should be used on writable icons. The
  214.                 suggested active point is at coordinates x = 4, y = 4.
  215.  
  216.    ptr_menu   - This pointer is used where a menu can be activated by
  217.                 pressing the menu button over the icon. This stops the user
  218.                 having to search all over the window to find where the menu
  219.                 is. The suggested active point is x = 6, y = 5.
  220.  
  221.    ptr_direct - This pointer is used where an object may be re-sized. The
  222.                 suggested active point is at x = 13, y = 7.
  223.  
  224.    ptr_hand   - This pointer is used where and icon may be dragged. It is
  225.                 usually set on the workarea, but it can be used on any icon
  226.                 (the save file icon looks great when using it). Its
  227.                 suggested active point is at x = 12, y = 8.
  228.  
  229.    ptr_cross  - This pointer is used as a crosshair. It is the same as the
  230.                 one used in the Draw application. This icon gives the user a
  231.                 precise point when working with line drawings. Its suggested
  232.                 active point is at x = 13, y = 7.
  233.  
  234. You may also design your own pointers, which should be loaded into the WIMP 
  235. sprite pool. There are a few points that you should note when designing
  236. pointers, these are :
  237.  
  238.         Pointer sprite names should have the form ptr_XXXXX, although this
  239.         is not compulsory it helps so that you do not get confused with
  240.         pointers and normal sprites.
  241.  
  242.         Do not use logical colour 2 in the pointer sprites, as this is
  243.         unavailable in very high resolution modes.
  244.  
  245. The pointers used should only be valid in your application, so you must not
  246. mask out Pointer_Leaving_Window in your application. You should claim 
  247. Null_Reason_Code when passed to your application, otherwise the pointer will
  248. not change when the pointer is over the icon/workarea. See the examples for
  249. more.
  250.  
  251. You should support the !Help application to help new users using your
  252. application, this is why I implemented a feature in Interface to make this
  253. easier. The following was for some reason not published in the Programmers
  254. Reference Manuals, but was in the pre-release disc version of the manuals.
  255.  
  256. For an application to use interactive help, two WIMP messages are employed. 
  257. One is used by the Help to request help, and the other is used by the
  258. application to return the help message.
  259.  
  260. To request help, the Help application sends a message of the following form:
  261.  
  262. block   +16     &502 - indicates request for help
  263.                 +20     mouse x co-ordinate
  264.                 +24     mouse y co-ordinate
  265.                 +28     mouse button state
  266.                 +32     window handle               (-1 if not over a window)
  267.                 +36     icon handle                 (-1 if not over an icon)
  268.  
  269. The WIMP system will pass this message automatically to the task in charge
  270. of the  appropriate window/icon. If the application receiving the message
  271. wishes to produce some help it should respond with the following message:
  272.  
  273. block   +16     &503
  274.                 +20     help message terminated by 0
  275.  
  276. This message can be sent to the Help application by using Wimp_SendHelp,
  277. which is provided by the Interface module (SWI &81687).
  278.  
  279. The help text may contain any printable character codes. If the sequence |M
  280. is  encountered then this will be treated as a line break and subsequent
  281. text will be printed on the next line in the window. If the text is too long
  282. for one line then it will be split at a word boundary (space character).
  283.  
  284. The text should consist of simple complete English sentences, each starting
  285. on a  new line and ending with a full stop. The sentences should usually be
  286. simple imperatives or information such as:
  287.  
  288.         Click SELECT to set the alarm.
  289.  
  290.         You are in Select mode.
  291.  
  292.         Click ADJUST to change to path edit mode.
  293.  
  294.         This is the icon for Edit.
  295.  
  296. You need not mention menu entries, except when specific ones interact with
  297. pointer operations. As a general rule present information of interest to the
  298. beginner near the top, and expert tips or information lower down.
  299.  
  300. You must use the terminology defined. For mouse operations you must use
  301. initial capitals (for example Click). The mouse buttons must be in capitals
  302. (for example  SELECT), as must key names (for example ESC, RETURN, SHIFT,
  303. CONTROL, A, B, F1, COPY). Miss out speedups and shortcuts - just provide
  304. enough to help a beginner without drowning them with information.
  305.  
  306. Provide interactive help thoroughly - include the icon bar, and the workarea
  307. of all your windows. If no actions are possible in a window, just
  308.  
  309.         This window shows....
  310.  
  311. if better than nothing.
  312.  
  313. You should assume a user knows:
  314.  
  315.         what a MENU key is
  316.         how to navigate menu trees and choose entries
  317.         what the icon bar is
  318.         how to move/size/toggle/close windows, and so on
  319.         what 'dragging an icon' means
  320.         what 'filling in a field' (writable icon) means
  321.  
  322. The keycode command should be placed in the icon that is activated by the 
  323. keycode. It should be a decimal integer specifying the key. The up/down
  324. arrows, tab etc.. are dealt with.
  325.  
  326.  
  327. **************************** The SWI Calls *********************************
  328.  
  329. Wimp_BorderIcon (Interface_SlabButton) (SWI &81680)
  330.  
  331. R1 = pointer to block
  332. R1 preserved
  333.  
  334. Interrupts are not defined
  335. Fast interrupts are enabled
  336.  
  337. Processor is in SVC mode
  338.  
  339. SWI is not re-entrant
  340.  
  341. The block contains the following on entry:
  342.  
  343.         R1+0    mouse x (screen coordinates - not window relative)
  344.         R1+4    mouse y
  345.         R1+8    buttons (depending on icon button type)
  346.         R1+12   window handle
  347.         R1+16   icon handle  
  348.  
  349. This call is used to update an icons border. It is typically called as a
  350. result of a  Mouse_Click event. If the icon has a border type of 0 or 2 then
  351. the icon will slab  inwards. The format of the validation string is
  352. described n the previous section.
  353.  
  354. The application should the perform the task and then force the icon to
  355. normal status by calling Wimp_BorderIcon (SWI &81680) with R1+8 set to 0.
  356.  
  357. The code to border icons and windows is outlined in the section Programming 
  358. Interface. 
  359.  
  360. Note that the mouse coordinates specified in R1+0 and R1+4 are not used by
  361. the SWI and are only present to make the block compatible with a Mouse_Click
  362. event  block.
  363.  
  364. Wimp_BorderWindow (SWI &81681)
  365.  
  366. None
  367.  
  368.  
  369.  
  370.  
  371.  
  372. Wimp_BorderWindow (Interface_Render3dWindow) (SWI &81681)
  373.  
  374. R1 = pointer to block
  375. R1 preserved
  376.  
  377. Interrupts are not defined
  378. Fast interrupts are enabled
  379.  
  380. Processor is in SVC mode
  381.  
  382. SWI is not re-entrant
  383.  
  384. The block contains the following on entry:
  385.  
  386.         R1+0    window handle
  387.         R1+4    visible area minimum x coordinate
  388.         R1+8    visible area minimum y coordinate
  389.         R1+12   visible area maximum x coordinate
  390.         R1+16   visible area maximum y coordinate
  391.         R1+20   scroll x offset relative to work area origin
  392.         R1+24   scroll y offset relative to work area origin
  393.         R1+28   current graphics window minimum x coordinate
  394.         R1+32   current graphics window minimum y coordinate
  395.         R1+36   current graphics window maximum x coordinate
  396.         R1+40   current graphics window maximum y coordinate
  397.  
  398. This call is used to redraw the borders of icons in the window that are not
  399. up-to-date. This SWI is typically called during the redraw loop of a window.
  400. The SWI will update the window, drawing borders around any icons which have
  401. the b command  specified in the validation string and are within the
  402. specified graphics window.
  403.  
  404. The code to border icons and windows is outlined in the section Programming 
  405. Interface. 
  406.  
  407. Wimp_BorderIcon (SWI &81680)
  408.  
  409. None 
  410.  
  411.  
  412.  
  413.  
  414. Wimp_ClaimInterface (Interface_Initialise) (SWI &81682)
  415.  
  416. R0 = task handle
  417. R0 preserved
  418.  
  419. Interrupts are not defined
  420. Fast interrupts are enabled
  421.  
  422. Processor is in SVC mode
  423.  
  424. SWI is not re-entrant
  425.  
  426. This SWI allows your application to use pointers via the Interface module,
  427. is should be called at the beginning of your program. If you don't use 
  428. Wimp_ClaimInterface then your pointers will not be displayed.
  429.  
  430. Wimp_ReleaseInterface (SWI &81683)
  431.  
  432. None
  433.  
  434.  
  435.  
  436.  
  437. Wimp_ReleaseInterface (Interface_CloseDown) (SWI &81683)
  438.  
  439. R0 = task handle
  440. R0 preserved
  441.  
  442. Interrupts are not defined
  443. Fast interrupts are enabled
  444.  
  445. Processor is in SVC mode
  446.  
  447. SWI is not re-entrant
  448.  
  449. This SWI stops your application from using pointers. When this SWI is called 
  450. Interface Manager will erase any workarea pointers assigned to your
  451. application and  free the memory. This should be called in your exit
  452. handler, also if an error occurs you should also call this SWI to stop other
  453. applications from gaining your pointers.
  454.  
  455. Wimp_ClaimInterface (SWI &81682)
  456.  
  457. None
  458.  
  459.  
  460.  
  461.  
  462. Wimp_SetWorkareaPointer (Interface_SetWorkareaPointer) (SWI &81684)
  463.  
  464. R1 = pointer to block
  465. R1 preserved
  466.  
  467. Interrupt status is undefined
  468. Fast interrupts are enabled
  469.  
  470. Processor is in SVC mode
  471.  
  472. SWI is not re-entrant
  473.  
  474. The block contains the following on entry:
  475.  
  476.         R1+0    window handle
  477.         R1+4    minimum x coordinate of bounding box
  478.         R1+8    minimum y coordinate of bounding box
  479.         R1+12   maximum x coordinate of bounding box
  480.         R1+16   maximum y coordinate of bounding box
  481.         R1+20   24 bytes of pointer data
  482.  
  483. This specifies the pointer for an area of the window. The bounding box
  484. coordinates are given relative to the window's work area origin. R1+4 to
  485. R1+16 can be set to -1 to specify the whole of the window's work area. The
  486. pointer data at +20 to +44 contains the sprite name and any x, y offset. See 
  487. validation strings for more information.
  488.  
  489. Wimp_RemoveWorkareaPointer (SWI &81685)
  490. Wimp_PollPointer (SWI &81686)
  491.  
  492. None
  493.  
  494.  
  495.  
  496.  
  497.  
  498. Wimp_RemoveWorkareaPointer (Interface_RemoveWorkareaPointer) (SWI &81685)
  499.  
  500. R0 = task handle
  501. R1 = pointer to block
  502.  
  503. R0 preserved
  504. R1 preserved
  505.  
  506. Interrupt status is undefined
  507. Fast interrupts are enabled
  508.  
  509. Processor is in SVC mode
  510.  
  511. SWI is not re-entrant
  512.  
  513. The block contains the following on entry:
  514.  
  515.         R1+0    window handle
  516.         R1+4    minimum x coordinate of bounding box
  517.         R1+8    minimum y coordinate of bounding box
  518.         R1+12   maximum x coordinate of bounding box
  519.         R1+16   maximum y coordinate of bounding box
  520.  
  521. This call removes a previously installed pointer from the list of active
  522. pointer areas for the specified window. When a window is deleted you should
  523. remove any pointers that were related to the window, otherwise these
  524. pointers may become active on any window which gains the same window handle
  525. in the future. 
  526.  
  527. The bounding box coordinates are given relative to the window's work area
  528. origin. R1+4 to R1+16 can be set to -1 to specify the whole of the window's
  529. work area. R1+4 to R1+16 may be set to 0 to remove all work area pointers
  530. assigned to the window.
  531.  
  532. Wimp_SetWorkareaPointer (SWI &81684)
  533. Wimp_PollPointer (SWI &81686)
  534.  
  535. None
  536.  
  537.  
  538.  
  539.  
  540.  
  541. Wimp_PollPointer (Interface_Poll) (SWI &81686)
  542.  
  543. R0 = Wimp_Poll reason code
  544. R2 = task handle
  545.  
  546. R0 preserved
  547. R@ preserved
  548.  
  549. Interrupt status is undefined
  550. Fast interrupts are enabled
  551.  
  552. Processor is in SVC mode
  553.  
  554. SWI not re-entrant
  555.  
  556. This call checks to see if the pointer is up-to-date. If the pointer is not
  557. up-to-date it will change to the pointer specified in the icons validation
  558. string. If the pointer is not over an icon then the pointer will change
  559. according to the position on the window background.
  560.  
  561. Note that wimp_poll reason codes 0 and 4 should not be masked out, otherwise
  562. the pointer will be out-of-date and will not function correctly.
  563.  
  564. Wimp_SetWorkareaPointer (SWI &81684)
  565. Wimp_RemoveWorkareaPointer (SWI &81685)
  566.  
  567. None
  568.  
  569.  
  570.  
  571.  
  572.  
  573. Wimp_SendInformation (Interface_SendHelp) (SWI &81687)
  574.  
  575. R1 = message block as returned from help application
  576. R1 preserved
  577.  
  578. Interrupt status is undefined
  579. Fast interrupts are enabled
  580.  
  581. Processor is in SVC mode
  582.  
  583. SWI not re-entrant
  584.  
  585. This call returns a help text message to the interactive help application. 
  586. It should be called when a message with the number &502 is received and the
  587. pointer is over an  icon. If there is a message in the icons validation
  588. string that the pointer is currently over this will be sent to the help
  589. application. It is up to the applications  programmer to take care of the
  590. help message when the pointer is over the icon on the  icon bar or is over
  591. the window workarea. 
  592.  
  593. None
  594.  
  595. None
  596.  
  597.  
  598. Wimp_PreProcessKey (Interface_PreProcessKey) (SWI &81688)
  599.  
  600. R0 = event type
  601. R1 = event block
  602. R2 = task handle
  603.  
  604. R0 = updated to new event type
  605. R1 = updated event block
  606. R2 = 0 if event was not dealt intercepted
  607.  
  608. This call pre-processes the up, down, tab, shift-tab keys and any specified
  609. in a specific icons validation string using the command k<keycode>. The SWI
  610. will move icon, if neccessary or activate a button.  his call sould be
  611. called after the wimp_poll command, it will match the key to an icon and if
  612. neccessary modify your wimp poll block and event type.
  613.  
  614.  
  615. Wimp_BorderPlotIcon (Interface_Plot3dIcon) (SWI &81689)
  616.  
  617. R0 = window state (either from wimp_update/redraw or from a wimp_getwindowstate)
  618. R1 = icon block as for Wimp_PlotIcon
  619.  
  620. Plots a border on a window like Wimp_PlotIcon. The icon block passed in R1
  621. should contain a block as described for Wimp_PlotIcon in the PRMs.
  622.  
  623. Wimp_BorderBoundingBox (Interface_BoundingBox) (SWI &8168A)
  624.  
  625. R1 = icon block as for Wimp_PlotIcon
  626.  
  627. R1 = updates icon block
  628.           
  629.           offset
  630.           0         min x
  631.           4         min y
  632.           8         max x
  633.           12        max y
  634.           16        border width
  635.           20        button slab state (1 = out, 0 = in)
  636.  
  637. This call returns information about the icon block passed to it. If you wish
  638. to get the size of an icons box use Wimp_GetIconState and then pass the icon
  639. block returned to this function.
  640.  
  641.