home *** CD-ROM | disk | FTP | other *** search
/ Millennium Time Capsule / AC2000.BIN / disks / ac7_disk / gemma152 / commands.txt next >
Encoding:
Text File  |  1997-06-24  |  61.8 KB  |  1,451 lines

  1.  
  2.  ____    ____                      ______     
  3. /\  _`\ /\  _`\   /'\_/`\  /'\_/`\/\  _  \  v1.02. The GEMMA 
  4. \ \ \L\_\ \ \L\_\/\      \/\      \ \ \L\ \  extension for STOS. 
  5.  \ \ \L_L\ \  _\L\ \ \__\ \ \ \__\ \ \  __ \  The power of GEM in 
  6.   \ \ \/, \ \ \L\ \ \ \_/\ \ \ \_/\ \ \ \/\ \  the power of STOS.
  7.    \ \____/\ \____/\ \_\\ \_\ \_\\ \_\ \_\ \_\
  8.     \/___/  \/___/  \/_/ \/_/\/_/ \/_/\/_/\/_/
  9.    
  10. © 1997 The GEMMA programming team. All rights reserved. Command list.
  11.  
  12. Anything with a asterisk by it ("*") represents that the command 
  13. differs from Atari standard. As STOS extensions are limited to a 
  14. number of commands, some SUBs had to be converted to FUNCTIONs and 
  15. vice versa.
  16.  
  17. NB: a command which has a varptr() in it MUST have the varptr command. 
  18. If you don't pass the variables through a varptr, then your system 
  19. might crash!
  20.  
  21. The GEM commands
  22. ----------------
  23.  
  24. --------------------------------------------------------------------------
  25.                             Message Passing
  26. --------------------------------------------------------------------------
  27.  
  28. SUB appl_read ()
  29.     Syntax: appl_read ap_id, length, varptr(message)
  30.     
  31. This reads LENGTH bytes from the program identifier AP_ID message 
  32. pipeline, into the buffer at MESSAGE.
  33.  
  34. FUNCTION appl_write *
  35.     Syntax: dummy=appl_write (ap_id, length, varptr(message))
  36.     
  37. This does the opposite of the above command. It writes LENGTH bytes in 
  38. the message pipeline of the program identifier AP_ID from MESSAGE. 
  39. The AP_ID should be the identifier of an accessory, found by the 
  40. appl_find command.
  41.  
  42. FUNCTION appl_find
  43.     Syntax: number=appl_find (name$)
  44.     
  45. NUMBER will contain the accessory number which has the name NAME$. 
  46. This is for use of the appl_write command. NAME$ should be null 
  47. terminated and should be 8 characters long (excluding the NULL)
  48.  
  49. FUNCTION appl_init
  50.     Syntax: num=appl_init
  51.     
  52. Tells GEM you want to start using the GEM commands. This is not need 
  53. for your STOS programs, since STOS automatically has one in it's 
  54. compiler code on start up. Returned is your application id.
  55.  
  56. SUB appl_exit *
  57.     Syntax: appl_exit (id)
  58.  
  59. Tells GEM you've finished using GEM. WARNING: Don't use this command 
  60. in STOS! id is the application id returned from appl_init.
  61.  
  62. SUB appl_tplay (eventrec, num)
  63.  
  64. Plays back a series of actions recorded by appl_record, at the address 
  65. EVENTREC, and NUM events should be played back.
  66.  
  67. FUNCTION appl_trecord (eventrec, num)
  68.  
  69. Records a series of users actions. EVENTREC& is an address of where 
  70. the details are to be stored. 4 words (a word is two numbers long) are 
  71. required for each event. NUM is how many events to record. 
  72.  
  73. The first word is 0, the second the type and the next two the data for 
  74. that type:                   
  75.  
  76.  --------------------------------------------------------------------
  77. | Type | Description    | Event-specific information                 |
  78.  --------------------------------------------------------------------|
  79. |   0  |   timer event  | Give the elapsed time in 200th of a second |
  80. |   1  |  button event  | First data word is the button state, and   |
  81. |      |                | the last for the number of clicks.         |
  82. |   2  |   mouse event  | First data word is the x-codinate and the  |
  83. |      |                | final the y.                               |
  84. |   3  | keyboard event | The first data word is the key code and    |
  85. |      |                | the final the key shift state.             |
  86.  --------------------------------------------------------------------
  87.  
  88. FUNCTION appl_getinfo
  89.     Syntax: info=appl_getinfo (type, varptr(out1), varptr(out2), 
  90.             varptr(out3),varptr(out4))
  91.  
  92. This returns information about the AES, but is only available from AES 
  93. v4.0.
  94.  
  95. TYPE specifies the results in OUT1, OUT2, OUT3 and OUT4
  96.  
  97.  --------------------------------------------------------------------
  98. |      Name     | Value | Returns                                    |
  99.  --------------------------------------------------------------------
  100. | AES_LARGEFONT |   0   | Information about the AES Large Font. OUT1 |
  101. |               |       | contains the AES font's point size. OUT2 is|
  102. |               |       | the supported type of font, SYSTEM_FONT (0)| 
  103. |               |       | is the system font or OUTLINE_FONT (1) if  |
  104. |               |       | a outline font is being used. OUT4 is not  |
  105. |               |       | used.                                      |
  106. | AES_SMALLFONT |   1   | Returns information on the AES Small Font, |
  107. |               |       | parameters the same as AES Large Font.     |
  108. |  AES_SYSTEM   |   2   | Returns info on AES System Specifics. OUT1 |
  109. |               |       | contains the res type (as in Getrez). OUT2 |
  110. |               |       | contains the number of colours that the    |
  111. |               |       | object library supports. OUT3 says 0 if    |
  112. |               |       | colour icons are not supported, 1 if they  |
  113. |               |       | are. If OUT4=0 then the extended resource  |
  114. |               |       | file format is not supported, 1 if it is.  |
  115. | AES_LANGUAGE  |   3   | Returns information about the langauge.    |
  116. |               |       | OUT1 tells the language being used:        |
  117. |               |       | 0=English, 1=German, 2=French, 3=reserved, |
  118. |               |       | 4=Spanish, 5=Italian, 6=Swedish. OUT2, OUT3| 
  119. |               |       | and OUT4 are not used.                     |
  120. |  AES_PROCESS  |   4   | Returns information about the "AES Multiple|
  121. |               |       | Process Support". If OUT1=0 then there is  |
  122. |               |       | no pre-emptive multitasking, 1 if there is.| 
  123. |               |       | If OUT2=0 then appl_find cannot convert the| 
  124. |               |       | appl_init's between MiNT and AES, 1 if it  |
  125. |               |       | can. If OUT3=0 then appl_search does not   |
  126. |               |       | exist on this computer, 1 if it is. If     |
  127. |               |       | OUT4=0, rsrc_rcfix is not implemented, 1 if| 
  128. |               |       | it is.                                     |
  129. |  AES_PCGEM    |   5   | Returns info about the AES's PC-GEM        |
  130. |               |       | Features. If OUT1=0 then objc_xfind is not |
  131. |               |       | available, 1 if it is. OUT2 is unused. If  |
  132. |               |       | OUT3=0 then menu_click is not implimented, |
  133. |               |       | 1 if it is. If OUT4=0 then shel_rdef and   |
  134. |               |       | shel_wdef are not supported, 1 if they are.|
  135. |               |       | NB: None of these commands are implimented |
  136. |               |       | in this version of GEMMA.                  |
  137. | AES_INGUIRE   |   6   | Returns information about the AES's Inquiry|
  138. |               |       | Functions. If OUT1=0 then -1 is not a valid| 
  139. |               |       | ap_id parameter to appl_read, 1 if it is.  |
  140. |               |       | If OUT2=0 then -1 is not a valid length    |
  141. |               |       | parameter to shel_get, 1 if it is. If      |
  142. |               |       | OUT3=0 then -1 is not a valid mode         |
  143. |               |       | parameter to menu_bar, 1 if it is. If      |
  144. |               |       | OUT4=0 then MENU_INSTL is not a valid mode |
  145. |               |       | parameter to menu_bar, 1 if it is.         |
  146. |      -        |   7   | Reserved.                                  |
  147. |  AES_MOUSE    |   8   | Returns info about the AES mouse. If OUT1=0|
  148. |               |       | then mode parameters of 258-260 are not    |
  149. |               |       | supported by graf_mouse, 1 if they are. If |
  150. |               |       | OUT2=0 then the application has control    |
  151. |               |       | over the mouse form, and 1 to indicate that| 
  152. |               |       | the mouse form is maintained by the AES on |
  153. |               |       | a per-application basis. OUT3 and OUT4 are |
  154. |               |       | not used.                                  |
  155. |  AES_MENU     |   9   | Returns info on the AES Menu Support. If   |
  156. |               |       | OUT1=0 then sub-menus are not supported and| 
  157. |               |       | 1 if MultiTOS style sub-menus are. If      |
  158. |               |       | OUT2=0 then popup menus are not supported  |
  159. |               |       | (by a single GEM command), 1 if they are.  |
  160. |               |       | If OUT3=0 then scrollable menus are not    |
  161. |               |       | supported and 1 if MultiTOS style          |
  162. |               |       | scrollable menus are. If OUT4=0 then the   |
  163. |               |       | MN_SELECTED message does not contain object| 
  164. |               |       | tree information in msg+57 and 1 to        |
  165. |               |       | indicate that it does.                     |
  166. |  AES_SHELL    |   10  | Returns info on the AES Shell Support. OUT1| 
  167. |               |       | and $ff indicates the highest legal value  |
  168. |               |       | for the mode of shel_write. OUT1 and $ff00 | 
  169. |               |       | indicate which extended shel_write mode    |
  170. |               |       | bits are supported. If OUT2=0 then         |
  171. |               |       | shel_write with a mode of 0 launches an    |
  172. |               |       | application or 1 if it cancels the previous| 
  173. |               |       | shel_write. If OUT3=0 then shel_write with |
  174. |               |       | a mode of 1 launches an application        |
  175. |               |       | immediately or 1 if it after the current   |
  176. |               |       | program quits. If OUT4=0 then ARGV style   |
  177. |               |       | parameter passing is not supported, 1 if it| 
  178. |               |       | is.                                        |
  179. | AES_WINDOW    |   11  | Returns info on the AES's window features. | 
  180. |               |       | OUT1 will contain a bit mask of the modes  | 
  181. |               |       | supported by wind_set and wind_get, if a   |
  182. |               |       | bit is 1, it is supported. The mask is:    |
  183. |               |       | 0=also returns windows below the top one   | 
  184. |               |       | (WF_TOP), 1=WF_NEWDESK supported,          |
  185. |               |       | 2=WF_COLOR supported, 3=WF_DCOLOR          |
  186. |               |       | supported, 4=WF_OWNER supported,           |
  187. |               |       | 5=WF_BEVENT supported, 6=WF_BUTTOM         |
  188. |               |       | supported, 7=WF_ICONIFY supported,         |
  189. |               |       | 8=WF_UNICONIFY supported, 9-15 unused. OUT2| 
  190. |               |       | is unused. OUT3 is a bit mask of window    |
  191. |               |       | types, 0=Iconify button present, 1=buttomer| 
  192. |               |       | button present, 2=shift+mouse click on     |
  193. |               |       | window send it to the button, 3="hot" close| 
  194. |               |       | box supported, 4-15 unused. OUT4 is unused.|
  195. | AES_MESSAGE   |   12  | Returns info on the AES's extended         |
  196. |               |       | messages. OUT1 contains a bit map of       |
  197. |               |       | supported messages, 0=WM_NEWTOP supported, |
  198. |               |       | 1=WN_UNTOPPED supported, 2=WM_ONTOP        |
  199. |               |       | supported, 3=AP_TERM supported, 4=Shutdown | 
  200. |               |       | and res changes supported, 5=CH_EXIT will  |
  201. |               |       | be sent, 6=WM_BOTTOMED will be sent,       |
  202. |               |       | 7=WN_ICONIFY will be sent, 8=WN_UNICONIFY  |
  203. |               |       | will be sent, 9=WM_ALLICONIFY will be sent,| 
  204. |               |       | 10-15 unused. OUT2 is a bit mask of extra  | 
  205. |               |       | messages supported, which is unused. OUT3  |
  206. |               |       | is a bit mask of supported message         |
  207. |               |       | behaviour: 0=WN_ICONIFY messages give      |
  208. |               |       | co-ordinates, 1-15 not used. OUT4 is       |
  209. |               |       | unused.                                    |
  210. |  AES_OBJECT   |  13   | Returns info on the AES's extended objects.| 
  211. |               |       | If OUT1=0 then 3D objects are not          |
  212. |               |       | supported, 1 if they are. If OUT2=0 then   | 
  213. |               |       | objc_sysvar is not present, 1 if it is. If | 
  214. |               |       | OUT3=0 then just the system font is        |
  215. |               |       | supported, 1 if others are available (eg   |
  216. |               |       | GDOS is installed). OUT4 is reserved for OS| 
  217. |               |       | extensions.                                |
  218. |  AES_FONT     |  14   | Returns info on the AES's form support. If |
  219. |               |       | OUT1=0 then 'flying dialogs' are not       |
  220. |               |       | supported, 1 if they are. If OUT2=0 then   |
  221. |               |       | keyboard tables are not supported, or 1 if | 
  222. |               |       | MagiC style keyboard tables are supported. | 
  223. |               |       | If OUT3=0 then the last cursor position    |
  224. |               |       | from objc_edit is not returned or 1 if it  |
  225. |               |       | is. OUT4 is reserved.                      |
  226.  --------------------------------------------------------------------
  227.  
  228. Returns 1 if an error occurred or 0 otherwise.
  229.  
  230. NB: A value type above 4 is only supported from AES version 4.1.
  231.  
  232. --------------------------------------------------------------------------
  233.                                 Events
  234. --------------------------------------------------------------------------
  235.  
  236. FUNCTION evnt_keybd
  237.     Syntax: key=evnt_keybd
  238.     
  239. This returns the next KEY pressed. The low byte is the ASCII code and 
  240. the high byte is the scan code for a special key.
  241.  
  242.                    ----------------------------------
  243.                   |       Special key        | Value |
  244.                    ----------------------------------
  245.                   |  [control]+cursor left   |  115  |
  246.                   | [control]+cursor right   |  116  |
  247.                   |   [control]+clr/home     |  119  |
  248.                    ----------------------------------
  249.  
  250. FUNCTION evnt_button
  251.     Syntax: action=evnt_button (clicks, mask, state, varptr(xout), 
  252.                     varptr(yout), varptr(button), 
  253.                     varptr(kstate))
  254.  
  255. Waits for a particular mouse button state. CLICKS is a variable that 
  256. contains the maximun number of mouse clicks that the application is 
  257. waiting for. The number of mouse clicks is returned in ACTION. MASK, 
  258. STATE and BUTTON use a bit mask for the state of the button: bit 0 is 
  259. the left button and bit 1 is the right. A value of 0 means the button 
  260. is up and 1 pressed down. The state of all buttons is returned in 
  261. BUTTON. XOUT and YOUT are the position of the mouse when the state 
  262. occurred and KSTATE give the state of the [shift] keys. With the 
  263. following bits giving the state:
  264.  
  265.                       --------------------------
  266.                      |    Mask    | Key         | 
  267.                       --------------------------
  268.                      |     1      | right shift |
  269.                      |     2      | left shift  |
  270.                      |     4      | Control     |
  271.                      |     8      | Alt         |
  272.                       --------------------------
  273.  
  274. FUNCTION evnt_mouse *
  275.     Syntax: dummy=evnt_mouse (flag, x, y, w, h, varptr(xout), 
  276.                 varptr(yout), vartpr(button), 
  277.                 varptr(kstate))
  278.  
  279. X, Y, Width and Height give a rectangle, which this routine waits for 
  280. the mouse to enter or leave. If FLAG=0 then the routine will return 
  281. when the mouse comes in, or FLAG=1 to exit. The position of the mouse 
  282. when the event occurred is in XOUT and YOUT and the state and shift 
  283. keys in BUTTON and KSTATE as defined above.
  284.  
  285. SUB evnt_mesag
  286.     Syntax: evnt_mesag varptr(message)
  287.  
  288. Waits for a message in the applications pipeline and puts this in the 
  289. butter at MESSAGE. The buffer should be at least 16 bytes.
  290.  
  291. Eg
  292.  
  293. 10 DIM mess(16)
  294. 20 evnt_mesag vartpr(mess(0))
  295. 30 TYPE=deek (varptr(mess(0))
  296.  
  297. SUB evnt_timer
  298.     Syntax: evnt_timer time
  299.     
  300. Waits for TIME milliseconds to pass.
  301.  
  302. FUNCTION evnt_multi
  303.     Syntax: mask=evnt_multi (eflags, clicks, mask, state, flag1, 
  304.                 x1, y1, w1, h1, flag2, x2, y2, w2, h2, 
  305.                 varptr(message), time, varptr(xout), 
  306.                 varptr(yout), varptr(button), 
  307.                 varptr(kstate), varptr(key_pressed), 
  308.                 varptr(gotclicks))
  309.  
  310. This waits for a number of events to happen (a combination of the 
  311. events commands). EFLAGS contains which events to look for, each in a 
  312. bit:
  313.  
  314.                 -------------------------------------
  315.                | Mask |     Name      |    Alias     |
  316.                 -------------------------------------
  317.                |  1   |    MU_KEYBD   |  evnt_keybd  |
  318.                |  2   |    MU_BUTTON  | evnt_button  |
  319.                |  4   |     MU_M1     |  evnt_mouse  |
  320.                |  8   |     MU_M2     |  evnt_mouse  |
  321.                | 16   |    MU_MESAG   |  evnt_mesag  |
  322.                | 32   |    MU_TIMER   |  evnt_timer  |
  323.                 -------------------------------------
  324.  
  325. KEY_PRESSED is the same returned value as evnt_keybd. CLICKS, MASK, 
  326. STATE, XOUT, YOUT, BUTTON and KSTATE are defined in evnt_button. 
  327. GOTCLICKS is the same return output as evnt_button. MESSAGE is defined 
  328. in evnt_mesag and TIME in evnt_timer. FLAG1 to H2 of the parameters 
  329. are for the evnt_mouse features.
  330.  
  331. The return value is a mask of the above table, saying which events 
  332. occured. NB: with this evnt_multi command you can watch for more than 
  333. one event.
  334.  
  335. Eg
  336.  
  337. 10 dim MESS(16)
  338. 20 EV=evnt_multi (MU_KEYBD+MU_BUTTN+MU_MESAG,258,3,0,0,0,0,0,0,0,0,0,0,0,
  339. varptr(MESS(0)),0,varptr(XOUT),varptr(YOUT),varptr(BUT),varptr(KSTATE),
  340. varptr(KEY),varptr(CLICKS))
  341. 30 if EV and MU_BUTTN then...
  342.  
  343.  
  344. If you AND the result with a message number type, and the result is 1, 
  345. then there is a message from GEM about that type in your variables.
  346.  
  347. Note that GEM will only return to your program when a message in 
  348. EFLAGS has been found.
  349.  
  350. FUNCTION evnt_dclick
  351.     Syntax: click_speed=evnt_dclick(newvalue, setorget)
  352.     
  353. Sets or gets the mouse double click speed, if SETORGET=1 then the 
  354. speed is set to whatever NEWVALUE is, and the double click speed is 
  355. returned if SETORGET=0. These are the same values from the Control 
  356. Panel, ranging from 0 to 4.
  357.  
  358. --------------------------------------------------------------------------
  359.                                 Menus
  360. --------------------------------------------------------------------------
  361.  
  362. FUNCTION menu_bar *
  363.     Syntax: dummy=menu_bar (tree, flag)
  364.  
  365. Displays or removes a menu bar. If FLAG is 1 it is shown, and 0 to be 
  366. removed. The menu should be created in a Resource Construction Kit, 
  367. such as WERCS or Interface. TREE is an address to a valid menu (found 
  368. by rsrc_load and rsrc_gaddr). The menu bar should be removed before 
  369. quiting. NB: Removing an item does not cause the menu bar to be 
  370. cleared.
  371.  
  372. SUB menu_icheck
  373.     Syntax: menu_icheck tree, item, flag
  374.     
  375. Displays a tick (a check mark) by the item numbered ITEM if FLAG=1, 
  376. else removes it is FLAG=0. TREE is the address of a valid menu.
  377.  
  378. SUB menu_ienable
  379.     Syntax: menu_ienable tree, item, flag
  380.     
  381. Fades the item numbered ITEM if FLAG=0 (this also means you can't 
  382. click on it), and FLAG=1 when the item is to be retained at full 
  383. brightness (and meaning you can select it). TREE is the address of a 
  384. valid menu.
  385.  
  386. SUB menu_tnormal
  387.     Syntax: menu_tnormal tree, title, flag
  388.  
  389. This can display a title numbered TITLE in normal video if FLAG=1, 
  390. else in reverse if FLAG=0. TREE is the address of a valid menu. This 
  391. is needed to unhighlight a title when an item is clicked on when it's 
  392. displayed.
  393.  
  394. SUB menu_text
  395.     Syntax: menu_text tree, item, text$
  396.     
  397. Modifies the text in item number ITEM to TEXT$. TEXT$ should be null 
  398. terminated. TREE is the address of a valid menu. TEXT$ shouldn't be 
  399. longer than the orginal string text.
  400.  
  401. FUNCTION menu_register
  402.     Syntax: error=menu_register (id, title$)
  403.  
  404. This command will register the title TITLE$ in the 'Desk' menu if 
  405. under a multitasking environment.
  406.  
  407. ID is the identification number of the application, and TITLE$ is a 
  408. string which is null terminated.
  409.  
  410. TITLE$ should be 8 characters long, padded with spaces if nessesary, 
  411. and after these 8 characters there *MUST* be a chr$(0)
  412.  
  413. This returns a -1 if an error occurred or the menu identifier 
  414. otherwise.
  415.  
  416. You should not call this unless you are creating an accessory (in 
  417. STOS?) or MultiTOS is loaded.
  418.  
  419. FUNCTION menu_popup
  420.     Syntax: error=menu_pop (menu, xpos, ypos, mdata)
  421.     
  422. This displays a popup menu. Note this is only available as of AES 
  423. v3.30
  424.  
  425. MENU is the address of a menu structure (see menu_attach), XPOS and 
  426. YPOS being co-ordinates of the most left position of the menu.
  427.  
  428. The state of the menu will be filled in the address of MDATA if the 
  429. function returns a value of 1. This also contains which button the 
  430. user pressed.
  431.  
  432. Returns 0 if an error occurred or 1 if successful.
  433.  
  434. SUB menu_attach *
  435.     Syntax: menu_attach flag, tree, item, mdata
  436.  
  437. This allows the programmer to attach a menu to another menu creating a 
  438. sub-menu. This is available from AES v3.30 and above. In AES v4.0 and 
  439. beyond, an appl_getinfo call should be used to find what this command 
  440. does.
  441.  
  442. FLAG sets the mode.
  443.  
  444.  -----------------------------------------------------------------
  445. | FLAG |    Name    | Function                                    | 
  446. ------------------------------------------------------------------
  447. |   0  | ME_INQUIRE | Returns info on a sub-menu which it puts    |
  448. |      |            | into MDATA.                                 |
  449. |   1  | ME_ATTACH  | Attachs or changes a sub-menu. TREE is the  |
  450. |      |            | address of the menu to attach (or remove)   |
  451. |      |            | and ITEM is which item the menu will be     |
  452. |      |            | assigned (or removed) to.                   |
  453. |   2  | ME_REMOVE  | Removes a sub-menu, same parameters as      |
  454. |      |            | ME_ATTACH (1) except that MDATA should be 0.|
  455.  -----------------------------------------------------------------
  456.  
  457. MDATA should always point to a structure as follows (except 
  458. ME_REMOVE):
  459.  
  460. LONG  mn_tree     - the address of a tree menu.
  461. WORD  mn_menu     - index to a parent object of the menu items.
  462. WORD  mn_item     - the starting menu item.
  463. WORD  mn_scroll   - if 0 the menu will not scroll, if 1 and the number 
  464.                     of menu item exceed the menu scroll heigh, up and 
  465.                     down arrows will appear which allow the user to 
  466.                     scroll up and down respectively through the 
  467.                     choices.
  468. WORD  mn_keystate - unused and should be 0.
  469.  
  470. Example creating a structure:
  471.  
  472. 10 dim MENSTRUCT (12)
  473. 20 A=varptr(MENSTRUCT(0))
  474. 30 loke A+0,TREE
  475. 30 doke A+4,MENU
  476. 40 doke A+6,ITEM
  477. 50 doke A+8,0
  478. 60 doke A+10,0
  479.  
  480. ...A will contain the stucture pointer.
  481.  
  482. NB: AES versions less than 4.1 have a bug which causes the AES to 
  483. crash when changing or removing a sub-menu!!!
  484.  
  485. The menu items should be created with G_STRING's in your Resource 
  486. Construction Set.
  487.  
  488. Hints: 1) Pad the sub-menu with spaces to the end of the menu. 2) Do 
  489. not attach a sub-menu to itself! 3) menu_istart only works with 
  490. sub-menus created with menu_attach.
  491.  
  492. FUNCTION menu_istart
  493.     Syntax: result=menu_istart (flag, tree, imenu, item)
  494.  
  495. This command will shift a sub-menu that is already attached to a menu, 
  496. and align it vertically with the specified object in the sub-menu. 
  497. This is available from AES v3.30 and above.
  498.  
  499. The object will be modified is FLAG=1, and not if 0, however the 
  500. already sub-menu item index (which is already aligned) will be 
  501. returned with it's item.
  502.  
  503. TREE is the address of the menu to alter. IMENU specifies the object 
  504. which the AES will align the menu item ITEM with.
  505.  
  506. Returns 0 if an error occurred or the index which is now aligned if it 
  507. worked.
  508.  
  509. SUB menu_settings *
  510.     Syntax: menu_settings flag, set
  511.  
  512. This sets the global settings for both popup and scrollable menus 
  513. created by menu_popup and menu_attach. Available as of AES v3.30.
  514.  
  515. If FLAG=0 then the values will be returned at the address SET 
  516. (stucture follows). If FLAG=1 then the values are set, again SET is 
  517. the address of the stucture.
  518.  
  519. LONG display - Sub-menu display delay in milliseconds
  520. LONG drag    - Sub-menu drag delay in milliseconds
  521. LONG delay   - the single click delay while scrolling scrollable menus 
  522.                in milliseconds
  523. LONG speed   - a continous scroll delay in milliseconds
  524. WORD height  - menu scroll height (in items)
  525.  
  526. Note that this is a global setting, and not just localised to the 
  527. application. So, use sparingly, or only use to get the variables.
  528.  
  529. --------------------------------------------------------------------------
  530.                                   Objects
  531. --------------------------------------------------------------------------
  532.  
  533. SUB objc_add *
  534.     Syntax: objc_add tree, parent, child
  535.     
  536. Adds an object numbered CHILD in the object PARENT at the address of 
  537. the tree at TREE.
  538.  
  539. FUNCTION objc_delete
  540.     Syntax: error=objc_delete (tree, object)
  541.     
  542. Deletes the object numbered OBJECT from the tree TREE and also 
  543. removes the link from the parent to the OBJECT. Returns 0 if there was 
  544. an error, or non-zero if no error occured.
  545.  
  546. SUB objc_draw *
  547.     Syntax: objc_draw tree, object, depth, x, y, w, h
  548.     
  549. Draws part or all of the tree TREE starting at OBJECT with a depth of 
  550. DEPTH, using a clipping rectangle X, Y, W, H. If DEPTH=0 then only the 
  551. start OBJECT is drawn; if DEPTH=1 then only the first generation are 
  552. drawn... and so on.
  553.  
  554. FUNCTION objc_find
  555.     Syntax: error=objc_find (tree, object, depth, x, y)
  556.     
  557. Returns the OBJECT number of an item in the tree TREE which is a 
  558. point X,Y. The search begins at OBJECT and to a depth of DEPTH 
  559. (explained above). If the point is not under any object, then -1 is 
  560. returned.
  561.  
  562. FUNCTION objc_offset
  563.     Syntax: error=objc_offset (tree, object, varptr(x), varptr(y))
  564.     
  565. Returns in X and Y the co-ordinates of OBJECT in the tree at TREE 
  566. relative to the screen. Returns 0 if there was an error, else anything 
  567. else if there wasn't an error.
  568.  
  569. SUB objc_order *
  570.     Syntax: objc_order tree, object, newpos
  571.     
  572. Moves the object OBJECT in the tree TREE to a different position to 
  573. its parents list of children.
  574.  
  575.  -----------------------------------------
  576. | Newpos |         Function               |
  577.  -----------------------------------------
  578. |  -1    | Moved to the front of the list |
  579. |   0    |  Moved to the end of the list  |
  580. |   1    |   Moved to 1 from the end      |
  581. |   2    |   Moved to 2 from the end...   |
  582.  -----------------------------------------
  583.  
  584. FUNCTION objc_edit
  585.     Syntax: error=objc_edit (tree, object, char, index, kind, 
  586.                 varptr(newindex))
  587.  
  588. This is the low-editing of the object OBJECT in tree TREE, of which 
  589. the object must be G_TEXT or G_BOXTEXT. The operation depends on KIND:
  590.  
  591.  ---------------------------------------------------------------------
  592. | KIND |  Name   | Function                                          | 
  593.  ---------------------------------------------------------------------
  594. |  1   | ED_INIT | combine string from te_ptext and te_ptmplt of the | 
  595. |      |         | TEDINFO structure into a formatted string and     |
  596. |      |         | display it with the text cursor on                |
  597. |  2   | ED_CHAR | Check if the character CHAR is valid against      |
  598. |      |         | te_pvalid and update te_ptext and re-display the  |
  599. |      |         | string. The orginal index in the string to use is |
  600. |      |         | INDEX and the updated value is stored in NEWINDEX |
  601. |  3   | ED_END  | Removes the text cursor                           |
  602.  --------------------------------------------------------------------
  603.  
  604. This returns 0 if there was a error, anything else if there wasn't.
  605.  
  606. SUB objc_change *
  607.     Syntax: objc_change tree, object, x, y, w, h, newstate, 
  608.                 flag
  609.  
  610. Changed the ob_state field of the object OBJECT in the tree TREE to 
  611. be NEWSTATE. If FLAG=1, then the object is redrawn with a rectangle 
  612. clip of X,Y,W,H. If FLAG=0 then the object is not redrawn.
  613.  
  614. FUNCTION objc_sysvar
  615.     Syntax: error=objc_sysvaR (mode, which, in1, in2, 
  616.     varptr(out1), varptr(out2))
  617.  
  618. This sets or changes the colours in 3D objects. Available from AES 
  619. v3.40.
  620.  
  621. If MODE=0 then the values will be read, but 1 will set the values. 
  622. WHICH is which button/object wish to change. If MODE=0 then IN1 and 
  623. IN2 are unused, if MODE=1 then OUT1 and OUT2 are not used.
  624.  
  625.  --------------------------------------------------------------------
  626. |  Name     | WHICH | Function                                       |
  627.  --------------------------------------------------------------------
  628. |  LK3DIND  |   1   | If IN1/OUT1=1 then the text in indicators moves|
  629. |           |       | when selected, 0 if is doesn't. If IN2/OUT2=1  |
  630. |           |       | then the colour in a indicator object changes  |
  631. |           |       | when selected, 0 if not.                       |
  632. |  LK3DACT  |   2   | Same as LK3DIND but for activator objects.     |
  633. | INDBUTCOL |   3   | IN1/OUT1 is the default colour for indicator   |
  634. |           |       | objects. IN2/OUT2 unused.                      |
  635. | ACTBUTCOL |   4   | IN1/OUT1 is the default colour for activator   |
  636. |           |       | objects. IN2/OUT2 unused.                      |
  637. | BACKGRCOL |   5   | IN1/OUT1 is the default colour for background  |
  638. |           |       | objects. IN2/OUT2 unused.                      |
  639. |  AD3DVAL  |   6   | OUT1 contains the number of pixels which will  |
  640. |           |       | be added to each horizontal side of an         |
  641. |           |       | indicator or activator object. OUT2 contains   |
  642. |           |       | the number the same as OUT1 except for the     |
  643. |           |       | vertical. This cannot to set, only read.       |
  644.  --------------------------------------------------------------------
  645.  
  646. Returns 0 if unsuccessful or non-zero otherwise.
  647.  
  648. Again like menu_settings the setting are global, so should not really 
  649. be set in a program, only read.
  650.  
  651. --------------------------------------------------------------------------
  652.                                   Forms
  653. --------------------------------------------------------------------------
  654.  
  655. FUNCTION form_do
  656.     Syntax: index=frm_do (tree, object)
  657.     
  658. After the form has been drawn, this will let the user fill it in. 
  659. TREE is the address of a valid dialog box, and OBJECT is where the 
  660. interaction starts. OBJECT is the first number to a editable text 
  661. field, 0 if there isn't one.
  662.  
  663. Note that you should have drawn the tree first with objc_draw.
  664.  
  665. The return value is the object selected (such as a button).
  666.  
  667. SUB form_dial
  668.     Syntax: frm_dial flag, x1, y1, w1, h1, x2, y2, w2, h2
  669.     
  670. The function of this command depends on the status of FLAG
  671.  
  672.  ---------------------------------------------------------------------
  673. | FLAG |   Name     |                  Function                      |
  674.  ---------------------------------------------------------------------
  675. |   0  | FMD_START  | Doesn't do anything on current verions, but    |
  676. |      |            | should ALWAYS be used when starting a load of  |
  677. |      |            | frm_dial calls.                                |
  678. |   1  | FMD_GROW   | Draws a box expanding from x1, y1, w1, h1 to   |
  679. |      |            | x1, y2, w2, h2.                                |
  680. |   2  | FMD_SHRINK | Draws a shinking box from x2, y2, w2, h2 to    |
  681. |      |            | x1, y1, w1, h1.                                | 
  682. |   3  | FMD_FINISH | Sends a message to redraw the screen of which  |
  683. |      |            | is in 8the rectangle x2, y2, w2, h2            |
  684.  --------------------------------------------------------------------
  685.  
  686. FUNCTION form_alert
  687.     Syntax: number=frm_alert (default, text$)
  688.     
  689. This brings up a GEM alertbox. TEXT$ must be a string containing no 
  690. more then 255 characters. text$ is made by of three parts, the icon 
  691. number, the message and the button names:
  692.  
  693. The format for text$ is [icon number][message][button names].
  694.  
  695. Icon number 1 is an '!" symbol. Icon 2 is a '?' and icon 3 is a 'Stop 
  696. message'. 'message' and 'button names' are best used by having a space at 
  697. the start and end of the text. In 'message' having a '|' character will 
  698. separate the text onto another line. A '|' in 'button names' will create 
  699. another button. Thus...
  700.  
  701. [1][ Hello | there | World! ][ Ok | Cancel | Info ]
  702.  
  703. ...would produce an alert box like...
  704.  
  705.  ______________________________________
  706. |                                      |
  707. |  !!!    Hello                        |
  708. |  !!!    there                        |
  709. |  !!!    World!                       |
  710. |  !!!                                 |
  711. |          ____   ________   ______    |
  712. |  !!!    [ Ok ] [ Cancel ] [ Info ]   |
  713. |          ¯¯¯¯   ¯¯¯¯¯¯¯¯   ¯¯¯¯¯¯    |
  714.  ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  715.  
  716. There should be a maximum of 3 buttons, and the length of each should 
  717. not exceed 20.
  718.  
  719. DEFAULT is the button to be highlighted, and if the user presses 
  720. [return] when the alert is up, that button number is chosen. If it's 1 
  721. the first button will be selected, 2 for the second etc. 0 if there is 
  722. to be no default button.
  723.  
  724. Returned is the button number the user clicked on.
  725.  
  726. Check the ALERGRAF.ASC for an example of alertboxes, gemmaver$, 
  727. graf_growbox and graf_shrinkbox.
  728.  
  729. SUB form_error *
  730.     Syntax: frm_error errorcode
  731.     
  732. Brings up a alertbox corresponding to the 'PCDOS error code'. Anything 
  733. above 64 (really -64) is ignored. Not all of the errors are recoginised, 
  734. but here are the ones that are:
  735.  
  736.  ----------------------------------------------------------------------
  737. |  Code   |  Error produced                                            |
  738.  ---------|------------------------------------------------------------
  739. |         |                                                            |
  740. | 2,3,18  | "This application cannot find the folder or file that you  |
  741. |         | tried to access."                                          |
  742. |         |                                                            |
  743. |   4     | "This application does not have room to open another       |
  744. |         | document. To make room, close any document that you do not |
  745. |         | need."                                                     |
  746. |         |                                                            |
  747. |   5     | "An item with this name already exists in the directory, or|
  748. |         | this item is set to read-only status."                     |
  749. |         |                                                            |
  750. | 8,10,11 | "There is not enough memory for the application you tried  |
  751. |         | to run."                                                   |
  752. |         |                                                            |
  753. |   15    | "The drive you specified does not exist."                  |
  754.  ----------------------------------------------------------------------
  755.  
  756. Check FRMALERT.ASC for an example.
  757.  
  758. SUB form_center
  759.     Syntax: frm_center tree, varptr(x), varptr(y), varptr(w), 
  760.     varptr(h)
  761.  
  762. This centers the tree TREE and returns its co-ordinates in X, Y, W 
  763. and H. The tree is modified.
  764.  
  765. SUB form_keybd *
  766.     Syntax: frm_keybd tree, obj, nextobj, kc, varptr(newobj), 
  767.         varptr(keyout)
  768.  
  769. This command is only really useful if you are creating your own 
  770. form_do routine.
  771.  
  772. TREE is the address of a tree (from rsrc_gaddr) which you want to use. 
  773. OBJ is the default edit field you wish to edit (0 if none). NEXTOBJ is 
  774. currently reserved and should be passed as 1. NEWOBJ is an address to 
  775. an variable. This is the last object to be edited. KC is a value from 
  776. evnt_keybd or evnt_multi which represents a keyboard scan code (and 
  777. ASCII value). KEYOUT is a value which was passed to objc_edit is the 
  778. key needed processing, 0 if not.
  779.  
  780. FUNCTION form_button
  781.     Syntax: status=frm_buttn (tree, obj, clicks, varptr(newobj))
  782.  
  783. This is to be used with form_keybd in creating your own form_do 
  784. handler.
  785.  
  786. TREE is the address of a tree which you wish to use (from rsrc_gaddr) 
  787. to process button events for. OBJ is the object selected which needs 
  788. processing. CLICKS is the number of times the mouse button was 
  789. clicked. NEWOBJ is the next object which is to be edited (or 0 if 
  790. none) - if the top bit is set then a touchexit object was 
  791. double clicked on.
  792.  
  793. Returns a 0 if it finds a EXIT or TOUCHEXIT, else 1.
  794.  
  795. To make your own form_do handler:
  796.  
  797. 1) Check out for mouse clicks
  798. 2) When the user clicks, use objc_find to find the object that was 
  799.    clicked on
  800. 3) If a real button was clicked on, do a form_button with the need 
  801. values.
  802.  
  803. --------------------------------------------------------------------------
  804.                                  Graphics
  805. --------------------------------------------------------------------------
  806.  
  807. SUB graf_rubberbox
  808.     Syntax: graf_rubberbox x, y, minw, minh, varptr(outw), 
  809.     varptr(outh)
  810.     
  811. Lets a rubberbox (such as when selecting multiple files on the 
  812. desktop) starting at X,Y with a minimum width and height MINW and 
  813. MINH. The size of the box after the user lets go is returned in OUTW 
  814. and OUTH.
  815.  
  816. SUB graf_dragbox
  817.     Syntax: graf_dragbox w, h, startx, starty, boxx, boxy, boxw, 
  818.                  boxh, varptr(outx), varptr(outy)
  819.  
  820. Lets the user drag a box of size W,H starting at STARTX, STARTY, with 
  821. the final position in OUTX, OUTY. The box will always be contained in 
  822. the rectangle BOXX, BOXY, BOXW, BOXH.
  823.  
  824. SUB graf_movebox
  825.     Syntax: graf_movebox w, h, x1, y1, x2, y2
  826.  
  827. This draws a box of width W and height H moving from x1, y1 to x2, y2
  828.  
  829. SUB graf_growbox
  830.     Syntax: graf_growbox x1, y1, h1, w1, x2, y2, h2, w2
  831.  
  832. Graf_growbox calls GEM to draw a number of boxes growing from x1,y1 of 
  833. size h1,h1 to x2,y2 to the size h2,w2.
  834.  
  835. Check ALERGRAF.ASC for an example of alertboxes, gemmaver$, graf_growbox 
  836. and graf_shrinkbox.
  837.  
  838. SUB graf_shrinkbox
  839.     Syntax: graf_shrinkbox x1, y1, h1, w1, x2, y2, h2, w2
  840.  
  841. Does the same as graf_growbox but instead shrinks.
  842.  
  843. Check ALERGRAF.ASC for an example of alertboxes, gemmaver$, graf_growbox 
  844. and graf_shrinkbox.
  845.  
  846. FUNCTION graf_watchbox
  847.     Syntax: return=graf_watchbox (tree, object, instate, 
  848.                outstate)
  849.  
  850. This changes a box while the user is in or out of the box specified by 
  851. OBJECT in the tree TREE. The mouse *MUST* be down when this is called. 
  852. It returns 0 if the mouse is outside the box when the user released 
  853. the button, and 1 if it's inside. INSTATE and OUTSTATE give the box's 
  854. ob_state when the pointer is inside and outside of the box 
  855. respectively.
  856.  
  857. FUNCTION graf_slidebox
  858.     Syntax: postion=graf_slidebox (tree, parent, object, 
  859.             vertical)
  860.  
  861. Lets the user move the box of the object OBJECT from the tree TREE 
  862. within its parent box given by PARENT. If VERTICAL=1 then the movement 
  863. is vertical, if it's 0 then it's horizontal. The returned value is the 
  864. position of in inner box when the mouse is released, ranging from 0 to 
  865. 1000 with 0 being top or left (depending on VERTICAL). The mouse MUST 
  866. be down when this is called.
  867.  
  868. FUNCTION graf_handle
  869.     Syntax: dummy=graf_handle (vaprtr(wcell), varptr(hcell), 
  870.     varptr(wbox), varptr(hbox))
  871.     
  872. Returns the current GEM VDI handle, with the height and width of the 
  873. current character cell in HCELL and WCELL respectively, with the 
  874. minimum size of a box large enough to enclose a character in WBOX and 
  875. HBOX.
  876.  
  877. FUNCTION graf_mouse *
  878.     Syntax: dummy=graf_mouse flag, varptr(user_form)
  879.  
  880. Flag is what to change the GEM mouse pointer to:
  881.  
  882.  ----------------------------------------------------------------------
  883. |  Code  |  Arrow form                                                 |
  884.  ----------------------------------------------------------------------
  885. |   0    | Arrow                                                       |
  886. |   1    | Text cursor                                                 |
  887. |   2    | Busy bee                                                    |
  888. |   3    | Pointing finger                                             |
  889. |   4    | Exended fingers                                             |
  890. |   5    | Thin cross hair                                             |
  891. |   6    | Thick cross hair                                            |
  892. |   7    | Outline cross hair                                          |
  893. |  255   | User defined. user_form is the address of the new pointer.  |
  894. |  256   | Hide mouse                                                  |
  895. |  257   | Show mouse                                                  |
  896.  ----------------------------------------------------------------------
  897.  
  898. user_form can be an array, with the following structure:
  899.  
  900.        -----------------------------------------------------------
  901.       | Byte | Function                                           |
  902.        -----------------------------------------------------------
  903.       |  1   | x co-ordinate of hot spot                          |
  904.       |  2   | y co-ordinate of hot spot                          |
  905.       |  3   | should be 1                                        |
  906.       |  4   | mask colour                                        |
  907.       |  5   | data colour                                        |
  908.       | 6-22 | bits of mask                                       |
  909.       |22-38 | bits of data                                       |
  910.        -----------------------------------------------------------
  911.  
  912. For example:
  913.  
  914. arrow(1)=1
  915. arrow(2)=1
  916. arrow(3)=1
  917. arrow(4)=0
  918. arrow(5)=1
  919. arrow(6)=%10110100...
  920.  
  921. etc.
  922.  
  923. SUB graf_mkstate
  924.     Syntax: graf_mkstate varptr(x), varptr(y), varptr(state), 
  925.     varptr(kstate)
  926.     
  927. This returns the current mouse position in X and Y, the mouse button 
  928. state in STATE and the state of the shift, alt and control keys in 
  929. KSTATE. If bit 0 of STATE is set, the left button is pressed, and if 
  930. bit 1, the right button. If the value of any bit is 0 then the button 
  931. is up, while 1 means it's down.
  932.  
  933.  
  934.                       --------------------------
  935.                      |    Mask    | Key         | 
  936.                       --------------------------
  937.                      |     1      | right shift |
  938.                      |     2      | left shift  |
  939.                      |     4      | Control     |
  940.                      |     8      | Alt         |
  941.                       --------------------------
  942.  
  943. If a bit equals 0 then the button is up, and if 1 pressed down.
  944.  
  945. --------------------------------------------------------------------------
  946.                             Scrap Directory
  947. --------------------------------------------------------------------------
  948.  
  949. SUB scrp_read *
  950.     Syntax: scrp_read directory_name$
  951.     
  952. Reads the current scrap directory into the string variable 
  953. DIRECTORY_NAME$.
  954.  
  955. SUB scrp_write *
  956.     Syntax: scrp_write directory_name$
  957.     
  958. Sets the scrap directory to DIRECTORY_NAME$.
  959.  
  960. --------------------------------------------------------------------------
  961.                             File Selector
  962. --------------------------------------------------------------------------
  963.  
  964.  
  965. SUB fsel_input
  966.     Syntax: ok=0 : fsel_input path$,name$,varptr(ok)
  967.  
  968. Brings up the GEM fileselector, or another replacement one such as 
  969. Selectric.
  970.  
  971. PATH$ contains the path. PATH$ should be *128* characters long, this 
  972. is the Atari defined maximum.
  973.  
  974. path$="C:\STOS\*.EX?"+string$(chr$(0),115)
  975.  
  976. This will have 115 zeros on the end, plenty of space for folders. 
  977. Remember to put a chr$(0) on the end if not using the above method! 
  978. PATH$ after the call will contain the path of the file, so it's 
  979. modified. PATH$ should be *valid*, and have a file mask.
  980.  
  981. NAME$ will contain the name of the file selected. It can contain a 
  982. name at the start, which like with Selectric, is automatically found 
  983. and highlighted for you. You'll have to make sure that the string is 
  984. 13 characters long, even though it shouldn't matter if it's longer, 
  985. but you will be wasting memory:
  986.  
  987. name$="GEMMA.EXZ"+string$(chr$(0),4)
  988.  
  989. OK is a address to which will contain the status of the fileselector, 
  990. ie if the 'ok' or 'cancel' button was pressed. This should be four 
  991. bytes long. OK will contain will be 0 if canceled, 1 if ok pressed.
  992.  
  993. SUB fsel_exinput
  994.     Syntax: ok=0 : fsel_exinput path$, name$, varptr(ok), prompt$
  995.  
  996. In the second filselector (which was added in the AES v1.3 - Rainbow 
  997. TOS) the PROMT$ string contains a message when the selector appears:
  998.  
  999. promt$="Please select file to view..."+chr$(0)
  1000.  
  1001. PROMT$ should be null terminated, as above, for example. It should 
  1002. also be less than 30 characters long.
  1003.  
  1004. The PROMT$ will not change after the command has been issued.
  1005.  
  1006. --------------------------------------------------------------------------
  1007.                                 Windows
  1008. --------------------------------------------------------------------------
  1009.  
  1010. FUNCTION wind_create
  1011.     Syntax: id=wind_create (kind, x, y, w, h)
  1012.     
  1013. This creates a window with the maximum size given by the rectangle of 
  1014. width W and height H with top left X,Y, and returns the handle (id in 
  1015. the syntax) for later window commands. NB: A negitive number is 
  1016. returned if no windows and available.
  1017.  
  1018. KIND is a number which relates to the type of window used, multiple 
  1019. types can be used:
  1020.  
  1021.             -------------------------------------------------
  1022.            | KIND |   Name  | Function                       |
  1023.             -------------------------------------------------
  1024.            |  1   | NAME    | Title bar with name            |
  1025.            |  2   | CLOSE   | Close box                      |
  1026.            |  4   | FULL    | Full box                       |
  1027.            |  8   | MOVE    | Can be moved                   |
  1028.            |  16  | INFO    | Information line (below title) |
  1029.            |  32  | SIZE    | Sizer box                      |
  1030.            |  64  | UPARROW | Upwards arrow                  |
  1031.            | 128  | DNARROW | Down arrow                     |
  1032.            | 256  | VSLIDE  | Vertical slider                |
  1033.            | 512  | FLARROW | Left arrow                     |
  1034.            | 1024 | RTARROW | Right arrow                    |
  1035.            | 2046 | HSLIDE  | Horizontal slider              |
  1036.             -------------------------------------------------
  1037.  
  1038. This call DOES NOT display the window. The window SHOULD be deleted 
  1039. before your program quits.
  1040.  
  1041. SUB wind_open *
  1042.     Syntax: wind_open handle, x, y, w, h
  1043.     
  1044. Displays the window number HANDLE at the position of X,Y, with width W 
  1045. and height H.
  1046.  
  1047. FUNCTION wind_close
  1048.     Syntax: wind_close (handle)
  1049.     
  1050. Closes the window number HANDLE. The window is not deleted, and can be 
  1051. shown again using wind_open.
  1052.  
  1053. Returns 0 if there was an error, 1 otherwise.
  1054.  
  1055. SUB wind_delete *
  1056.     Syntax: wind_delete handle
  1057.     
  1058. Deletes the window number HANDLE. Memory from this window is freed, if 
  1059. window is displayed, you MUST close it using wind_close first.
  1060.  
  1061. SUB wind_get *
  1062.     Syntax: wind_get handle, sort, varptr(x), varptr(y), 
  1063.     varptr(w), varptr(h)
  1064.     
  1065. This returns information on the window number HANDLE, depending on 
  1066. what SORT is.
  1067.  
  1068. NB: X, Y, W and H mosty are the information from commands which return 
  1069. co-ordinates.
  1070.  
  1071.  --------------------------------------------------------------------
  1072. | SORT |   Name   |                  Function                        |
  1073.  --------------------------------------------------------------------
  1074. |  4   | WORKXYWH | the current work area of the window is returned. |
  1075. |  5   | CURRXYWH | the current size of the window including borders.|
  1076. |  6   | PREVXYWH | the co-ordinates of the previous window inlcuding| 
  1077. |      |          | borders.                                         |
  1078. |  7   | FULLXYWH | the maximum size of the current window including |
  1079. |      |          | borders                                          |
  1080. |  8   |  HSLIDE  | x will contain the current position of the       |
  1081. |      |          | horizontal slider (between 1 and 1000 - 1 being  | 
  1082. |      |          | the left most position).                         |
  1083. |  9   |  VSLIDE  | x will contain the current position of the       |
  1084. |      |          | vertical slider between 1 and 1000 - 1 being the |
  1085. |      |          | top most position.                               |
  1086. |  10  |   TOP    | x will contain the handle of the top (active)    |
  1087. |      |          | window.                                          |
  1088. |  11  | FIRSTXYWH| the co-ordinates of the first rectangle in the   |
  1089. |      |          | window's rectangle list.                         |
  1090. |  12  | NEXTXYWH | the co-ordinates of the next rectangle in the    |
  1091. |      |          | window's rectangle list.                         |
  1092. |  15  | HSLSIZE  | x contains the size of the horizontal slider     |
  1093. |      |          | relative to the horizontal scrool bar (1 to 1000)| 
  1094. |      |          | or -1 if the default square box.                 |
  1095. |  16  | VSLSIZE  | x contains the size of the vertical slider       |
  1096. |      |          | relative to the vertical scroll bar (1 to 1000)  |
  1097. |      |          | or -1 if the default square box.                 |
  1098. |  17  |  SCREEN  | x and y give the address of the internal to the  |
  1099. |      |          | AES alert buffer and w and h give the length of  |
  1100. |      |          | this buffer, x and w are the most significant    |
  1101. |      |          | words.                                           |
  1102.  --------------------------------------------------------------------
  1103.  
  1104. SUB wind_set *
  1105.     Syntax: wind_set handle, sort, x, y, w, h
  1106.     
  1107. Sets various attributes of the window HANDLE according to SORT. The 
  1108. following values of soft are the same as wind_get: CURRXYWH, HSLIDE, 
  1109. VSLIDE, TOP, HSLSIZE, VSLSIZE. In attition:
  1110.  
  1111.  -------------------------------------------------------------------
  1112. | SORT |   Name  |                  Function                        |
  1113.  -------------------------------------------------------------------
  1114. |  2   |   NAME  | x, y are the address of the name of the window.  |
  1115. |      |         | x is the most signficant word of the address.    |
  1116. |  3   |   INFO  | x,y are the address of the text in the           |
  1117. |      |         | information line of the window. x is the most    |
  1118. |      |         | significant word of the address.                 |
  1119. |  14  | NEWDESK | x,y are the address of an object tree containing | 
  1120. |      |         | the new GEM desktop for the AES to draw. w is    |
  1121. |      |         | the first object to draw in the tree. If x and y |
  1122. |      |         | are both 0 then the desktop is reset to the      |
  1123. |      |         | default one.                                     |
  1124.  -------------------------------------------------------------------
  1125.  
  1126. Be careful when passing strings to the AES using NAME and INFO as 
  1127. above, because these are not copied by the AES, so if the STOS program 
  1128. moves, the window names will be changed too.
  1129.  
  1130. Eg
  1131.  
  1132. ...
  1133. 60 A$=" Window title "+chr$(0)
  1134. 70 A=vaprtr(A$)
  1135. 80 A1=deek (varptr(A)) : A2=deek (varptr(A)+2)
  1136. 90 wind_set H,2,A1,A2,0,0
  1137. ...
  1138.  
  1139. Note that for name and info, the string should be null terminated.
  1140.  
  1141. FUNCTION wind_find
  1142.     Syntax: handle=wind_find (x, y)
  1143.     
  1144. Returns the handle of which window is under the co-ordinate X,Y. 0 is 
  1145. returned if there is no window under X,Y.
  1146.  
  1147. SUB wind_update *
  1148.     Syntax: wind_update sort
  1149.     
  1150. This can stop the user using menu, moving windows etc. whilst the 
  1151. application is outputting to the screen - or when it wants to do its 
  1152. own tracking of the mouse:
  1153.  
  1154.  ------------------------------------------------------------------
  1155. |  SORT |   Name     | Function                                    |
  1156.  ------------------------------------------------------------------
  1157. |   0   | END_UPDATE | tells the Operating System the windows have |
  1158. |       |            | been updated and the user may continue. This|
  1159. |       |            | should be called after BEG_UPDATE.          |
  1160. |   1   | BEG_UPDATE | tells the Operating System the window will  |
  1161. |       |            | be updated. This should be called before    |
  1162. |       |            | writing to a window with the AES.           |
  1163. |   2   | END_MCTRL  | tells the Operating System the application  |
  1164. |       |            | has finished doing its own mouse control,   |
  1165. |       |            | and the user can select thing again. Must   |
  1166. |       |            | be called after BEG_MCTRL.                  |
  1167. |   3   | BEG_MCTRL  | tells the Operating System that application | 
  1168. |       |            | is doing its own mouse control, and not let |
  1169. |       |            | the user click on any ull down menus or     |
  1170. |       |            | windows                                     |
  1171.  ------------------------------------------------------------------
  1172.  
  1173. FUNCTION wind_calc
  1174.     Syntax: error=wind_calc (type, kind, x, y, w, h, varptr(xout), 
  1175.             varptr(yout), varptr(wout), varptr(hout))
  1176.  
  1177. Calculates the work area of a window, which the command puts in XOUT, 
  1178. YOUT, WOUT and HOUT given a border X, Y, W, H and the sort of window 
  1179. KIND if TYPE=1. If TYPE=0 then the border area is calculated given the 
  1180. work area. KIND is defined under wind_create. Returns 0 if there was 
  1181. an error, 1 otherwise.
  1182.  
  1183. SUB wind_new
  1184.     Syntax: wind_new
  1185.     
  1186. Closes and deletes all windows, flushes all window buffers and returns 
  1187. to standard mouse usage.
  1188.  
  1189. This call is only available on the AES v1.3 (Rainbow TOS) and above, 
  1190. so no, you can't use it in all your programs... ;-)
  1191.  
  1192. --------------------------------------------------------------------------
  1193.                              Resource Files
  1194. --------------------------------------------------------------------------
  1195.     
  1196. FUNCTION rsrc_load
  1197.     Syntax: error=rsrc_load (file_name$)
  1198.     
  1199. Loads the resource file names FILE_NAME$ into memory. The filename 
  1200. should be null terminated. Returns 0 if there was an error, non-zero 
  1201. otherwise.
  1202.  
  1203. SUB rsrc_free *
  1204.     Syntax: rsrc_free
  1205.     
  1206. Frees the memory used by rsrc_load.
  1207.  
  1208. FUNCTION rsrc_gaddr *
  1209.     Syntax: address=rsrc_gaddr (type, index)
  1210.  
  1211. (This function differs from the Atari standard, since the result is 
  1212. the address of the object/tree.)
  1213.  
  1214. Returns the address of a type of data structure from the loaded 
  1215. resource via rsrc_load in ADDR. INDEX is the index of the data 
  1216. structure and TYPE is one of the following:
  1217.  
  1218.  -------------------------------------------------------------------
  1219. | TYPE |    Name    | Comments                                      |
  1220.  -------------------------------------------------------------------
  1221. |   0  |   Tree     |                                               |
  1222. |   1  |   OJECT    |                                               |
  1223. |   2  |  TEDINFO   |                                               |
  1224. |   3  |  ICONBLK   |                                               |
  1225. |   4  |   BITBLK   |                                               |
  1226. |   5  |  string    |                                               |
  1227. |   6  | image data |                                               |
  1228. |   7  |  ob_spec   |                                               |
  1229. |   8  | te_ptext   |                                               |
  1230. |   9  | te_ptmplt  |                                               |
  1231. |  10  | te_pvalid  |                                               |
  1232. |  11  | ib_pmask   |                                               |
  1233. |  12  | ib_pdata   |                                               |
  1234. |  13  | ib_ptext   |                                               |
  1235. |  14  | bi_pdata   |                                               |
  1236. |  15  | ad_frstr   | the address of a pointer to a free string (i.e| 
  1237. |      |            | with INDIRECT set in its ob_flags field).     |
  1238. |  16  | ad_frimg   | the address if a pointer to a free image (i.e |
  1239. |      |            | with INDIRECT set in its ob_flags field).     |
  1240.  -------------------------------------------------------------------
  1241.  
  1242. SUB rsrc_saddr *
  1243.     Syntax: rsrc_saddr type, index, varptr(addr)
  1244.     
  1245. Finds the address of free string or image given TYPE and INDEX. TYPE 
  1246. must be 15 or 16. The address is put into ADDR.
  1247.  
  1248. SUB rsrc_obfix
  1249.     Syntax: rsrc_obfix tree, object
  1250.     
  1251. Converts the OBJECT in TREE location from character co-ordinates to 
  1252. pixel co-ordinates. This is automatically performed by rsrc_load.
  1253.  
  1254. FUNCTION rsrc_rcfix
  1255.  
  1256. <a name=rsrcrcfix2><H3>rsrc_rcfix()</H3>
  1257.  
  1258. <P>
  1259. <B>WORD rsrc_rcfix( <I>rc_header</I> )</B>
  1260. <P>
  1261. <B>VOID *<I>rc_header</I>;</B>
  1262. <TABLE BORDER=1>
  1263.  
  1264. <TR><TH></TH><TD><B>rsrc_rcfix()</B> fixes up coordinates and memory pointers of raw resource data in memory. 
  1265. </TD></TR>
  1266.  
  1267. <TR><TH></TH><TD></TD></TR>
  1268.  
  1269. <TR><TH><B>Opcode</B></TH><TD>115 (0x73)</TD></TR>
  1270.  
  1271. <TR><TH></TH><TD></TD></TR>
  1272.  
  1273. <TR><TH><B>Availability</B></TH><TD>Available only in <B>AES</B> versions 4.0 and greater. The presence of this call should also be checked for using <B>appl_getinfo()</B>.
  1274. </TD></TR>
  1275.  
  1276. <TR><TH></TH><TD></TD></TR>
  1277.  
  1278. <TR><TH><B>Parameters</B></TH><TD><I>rc_header</I> is a pointer to an Atari Resource Construction Set (or compatible) resource file header in memory.
  1279. </TD></TR>
  1280.  
  1281. <TR><TH></TH><TD></TD></TR>
  1282.  
  1283. <TR><TH><B>Binding</B></TH><TD>
  1284. <PRE>
  1285. addrin[0] = rc_header;
  1286.  
  1287. return crys_if(0x73);
  1288. </PRE>
  1289.  
  1290. </TD></TR>
  1291.  
  1292. <TR><TH></TH><TD></TD></TR>
  1293.  
  1294. <TR><TH><B>Return Value</B></TH><TD><B>rsrc_rcfix()</B> returns a non-zero if successful or zero otherwise.
  1295. </TD></TR>
  1296.  
  1297. <TR><TH></TH><TD></TD></TR>
  1298.  
  1299. <TR><TH><B>Comments</B></TH><TD>If a resource has already been loaded with <B>rsrc_load()</B> it must be freed by <B>rsrc_free()</B> prior to this call. In addition, resources identified with this call must likewise be freed before program termination or another resource file is needed.
  1300. </TD></TR>
  1301.  
  1302. <TR><TH></TH><TD></TD></TR>
  1303.  
  1304. <TR><TH><B>See Also</B></TH><TD><B>rsrc_obfix()</B></TD></TR>
  1305.  
  1306. </TABLE>
  1307.  
  1308. <P>
  1309.  
  1310. <HR>
  1311.  
  1312. --------------------------------------------------------------------------
  1313.                                Shell Routines
  1314. --------------------------------------------------------------------------
  1315.  
  1316. SUB shel_read *
  1317.     Syntax: shel_read cmd$, tail$
  1318.     
  1319. Gets the file that the application was loaded from in CMD$, with the 
  1320. command line tail in TAIL$.
  1321.  
  1322. Make sure there is 13 bytes for the filename and plenty of space for 
  1323. the command line:
  1324.  
  1325. 10 CMD$=string$(chr$(0),13)
  1326. 20 TAIL$=string$(chr$0),50)
  1327. 30 shel_read CMD$,TAIL$
  1328.  
  1329. FUNCTION shel_find
  1330.     Syntax: error=shel_find (file$)
  1331.  
  1332. Searches for a file named FILE$ (which must be null terminated) in the 
  1333. current directory and the search path and returns this directory in 
  1334. FILE$, so it's modified by the call. FILE$ should then be a long 
  1335. string to cope with the path.
  1336.  
  1337. Returns 0 if there was an error, non-zero otherwise.
  1338.  
  1339. FUNTION shel_get *
  1340.     Syntax: dummy=shel_get (buff, length)
  1341.     
  1342. Reads the AES's internal shell buffer (a RAM version of the 
  1343. DESKTOP.INF or NEWDESK.INF) in the buffer at BUFF, and LENGTH bytes 
  1344. will be read. This buffer should be at least 4192 bytes long to 
  1345. accommodate for TOS version later than AES version 1.40 (Rainbow TOS).
  1346.  
  1347. SUB shel_put
  1348.     Syntax: shel_put buff, length
  1349.     
  1350. This does the opposite to the above command. BUFF is where the data 
  1351. is, and LENGTH says how many bytes should go to the AES buffer. If you 
  1352. write a new buffer to the AES, there must be a single Control-Z (26 
  1353. decimal) to indicate the end of buffer.
  1354.  
  1355. FUNCTION shel_write
  1356.     Syntax: dummy=shel_write (ex, gr, over, commandname$, 
  1357.               commandline$)
  1358.  
  1359. After this program has finished another is executed. EX and OVER must 
  1360. be 1 in all current version of the operation system. If GR=0 then the 
  1361. program will be ran as a TOS (or TTP) program, and 1 for a GEM program 
  1362. (PRG, APP etc.).
  1363.  
  1364. COMMANDNAME$ is the complete filename (null terminated) of the program 
  1365. to be ran. COMMANDLINE$ specifies (null terminated) the command tail.
  1366.  
  1367. SUB shel_envrn
  1368.     Syntax: shel_envrn env$, name$
  1369.     
  1370. Seaches the GEMDOS environment string for a variable and puts the 
  1371. result in ENV$. ENV$ must be quite long then. NAME$ should include the 
  1372. "=" sign. However, you cannot set the variables this way.
  1373.  
  1374. The VDI commands
  1375. ----------------
  1376.  
  1377. --------------------------------------------------------------------------
  1378.                           Drawing Primitives
  1379. --------------------------------------------------------------------------
  1380.  
  1381. FUNCTION v_bar *
  1382.     Syntax: dummy=v_bar (x1, y1, x2, y2)
  1383.  
  1384. This draws a rectangle and fills it in. The rectangle's co-ordinates 
  1385. being X1,Y1 to X2,Y2. Note that if you want to use this with GEM (for 
  1386. example filling in a blank window) that v_bar's last parameters use X 
  1387. and Y, not W and H like GEM. 
  1388.  
  1389. You can calculate W and H into X and Y by adding X1 to your Width, and 
  1390. putting this variable as X2, and adding Y1 to Height and putting this 
  1391. as Y2.
  1392.  
  1393. --------------------------------------------------------------------------
  1394.                               Attributes
  1395. --------------------------------------------------------------------------
  1396.  
  1397. SUB vsf_interior
  1398.     Syntax: svf_interior (fill_interior)
  1399.     
  1400. This sets the fill pattern to what FILL_INTERIOR is:
  1401.  
  1402.                      -----------------------------
  1403.                     | Style | Effect              |
  1404.                      -----------------------------
  1405.                     |   0   | Hollow              |
  1406.                     |   1   | Solid               |
  1407.                     |   2   | Pattern             |
  1408.                     |   3   | Hatch               |
  1409.                     |   4   | User-defined style  |
  1410.                      -----------------------------
  1411.  
  1412. Use vsf_style for fill type 2 and 3. The default pattern is the Atari 
  1413. logo.
  1414.  
  1415. FUNCTION vsf_color *
  1416.     Syntax: dummy=vsf_colr (colour)
  1417.     
  1418. This sets the fill colour to COLOUR. Note that the name is different 
  1419. to the Atari standard.
  1420.  
  1421. --------------------------------------------------------------------------
  1422.                       Mouse & Keyboard State Functions
  1423. --------------------------------------------------------------------------
  1424.  
  1425. FUNCTION v_show_c *
  1426.     Syntax: dummy=v_show_c
  1427.     
  1428. This VDI command will display the mouse. If you have removed the mouse 
  1429. x number of times before, you will need to call this x number of 
  1430. times. Use this instead of graf_mouse for displaying/removing the 
  1431. mouse.
  1432.  
  1433. SUB v_hide_c
  1434.     Syntax: v_hide_c
  1435.     
  1436. Removes the mouse from the screen, unless v_show_c has been called x 
  1437. number of times, in which case this routines should be called x times 
  1438. to remove the pointer.
  1439.  
  1440. Misc. commands
  1441. --------------
  1442.  
  1443. FUNCTION gemmaver$
  1444.     Syntax: ver$=gemmaver$
  1445.                                                                     
  1446. This function returns the current GEMMA version in VER$.
  1447.  
  1448. Check ALERGRAF.ASC for an example of alertboxes, gemmaver$, graf_growbox 
  1449. and graf_shrinkbox.
  1450.  
  1451.