home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 4 / DATAFILE_PDCD4.iso / utilities / utilsp / pca / Docs / PCA7_HTM < prev    next >
Encoding:
Text File  |  1996-08-28  |  53.0 KB  |  1,764 lines

  1. <HTML>
  2. <HEAD>
  3. <TITLE>PCA</TITLE>
  4.  
  5.  
  6. </HEAD>
  7. <BODY bgcolor="#bbbbbb" BACKGROUND="graphics/crumple.gif" text="#000000" link="#004499" vlink="#dd0000">
  8. <CENTER><IMG SRC="GRAPHICS/PCA.GIF" ALT="PCA Logo" WIDTH=258 HEIGHT=144></CENTER><P>
  9. <HR>To view the latest version of this protocol visit our web site at
  10. <P>
  11. <A HREF="http://www.stcoll.ac.uk/clares/support/pca.html">http://www.stcoll.ac.uk/clares/support/pca.html</A>
  12.  <BR><HR>
  13. <H1>Plug In Compliant Application</H1>
  14. <P>
  15.  
  16. <H4>
  17. <A NAME="top">
  18. Contents
  19. </A></H4><P>
  20.  
  21. <UL>
  22. <LI><A HREF="#intro">Introduction</A>
  23. <LI><A HREF="#summary">Message Summary</A>
  24. <LI><A HREF="#mesdefs">Message definitions</A>
  25. <LI><A HREF="#remote">In-place editing</A>
  26. <LI><A HREF="#interface">User Interface</A>
  27. <LI><A HREF="#swis">SWIs</A>
  28. <LI><A HREF="#licence">Licence Conditions</A>
  29. <LI><A HREF="#contacts">Contacting Clares</A>
  30. <LI><A HREF="#disclaim">Disclaimer</A>
  31. <LI><A HREF="#examples">Example applications</A> (The examples archive contains a copy of this document for reading off line)
  32.  
  33. </UL>
  34. <BR>
  35. <P>
  36.  
  37. <HR>
  38.  
  39.  
  40. <H2><A NAME="intro">Introduction</A></H2>
  41.  
  42. The Clares Plug In Compliant Application (PCA) specification provides an
  43. easy to implement way of allowing multiple applications to share common
  44. objects residing in shared memory areas. A program written to the PCA
  45. specification will work with any other which supports the standard and uses
  46. the same type of objects.<BR>
  47. <P>
  48.  
  49. <B>What does PCA do for me as a user ?</B>
  50. <P>
  51.  
  52. The PCA standard works at two levels. In each case a document in a common
  53. memory area can be 'shared' between two or more applications. This is
  54. <B>not</B> like the versions of OLE implemented on the Acorn platform. There
  55. is a major difference in that OLE <B>copies</B> the document for the second
  56. application to work on, thus your data takes up twice as much RAM. With PCA
  57. all applications work on the <B>same</B> document thus incurring no RAM
  58. overheads. <P> The controlling application is called the <A
  59. HREF="#local">Local</A> application and the slave application is called the
  60. <A HREF="#remote1">Remote</A> application.
  61.  
  62. <P>
  63. When a document is edited in a Remote application the object in the Local
  64. application is automatically updated.
  65. <P>
  66. What we have up to now is a more efficient way of doing OLE. However, PCA
  67. does not stop there. Take an application like Composition which provides a
  68. page make up environment for bit image and vector images - all of which can
  69. be moved and edited - a bit like Draw for bit images but with a LOT of
  70. extras. Composition does not provide 'painting' tools but ProArtisan 24
  71. does. If both applications are PCA compliant then a Utilities menu in Compo
  72. will show ProArt 24 as a 'tool'. Clicking on this menu entry opens a PA24
  73. window showing the selected Compo object. PA24 can paint into this object or
  74. indeed perform any of its functions on the object. All changes are reflected
  75. immediately in Compo.
  76. <P>
  77. This means that an application can have other applications as 'tools'. Small
  78. 'applets' can be written to provide specific functions to a PCA application
  79. <I>and they will be usable by any other PCA compliant application.</I>
  80. <P>
  81. Imagine a simple application that does nothing else except display a sprite
  82. and conform to the PCA standard. Another application could provide paint
  83. tools, yet another could provide filters, another might provide warping
  84. tools - you get the picture I'm sure. From this range of applets you can
  85. construct the <B>tool</B> that you require to get the job done.
  86. <P>
  87.  
  88. What's more, more than one remote applet can work on the same object at the
  89. same time and changes made in any one of these will be immediately reflected
  90. in all of them.<P> This is an awful lot better than OLE but there's still
  91. more.
  92.  
  93. <P>
  94. Instead of each applet opening its own window we can use 'In-place' editing.
  95. This means that only the <B>Local</B> application displays the document.
  96. When you click on a 'tool' entry in the Utilities menu the new tool's
  97. Toolbar opens over the Local application's window. All tools then work on
  98. the image in the Local's window.
  99.  
  100. <P>
  101. Now you are really able to construct an application from a range of applets.
  102. All you will see is one window displaying the document.
  103. <P>
  104. Take this a little further and imagine a DTP package supporting the PCA
  105. standard. It could have a frame containing a graphic image and you could
  106. link this to PA24, Compo or any other PCA application, which could
  107. manipulate the image. The changes would be reflected immediately in the DTP
  108. window. However, if In-place editing is used, the Toolbars would appear in
  109. the DTP window and allow you to edit the graphic directly in the DTP window.
  110. <P>
  111. <CENTER><IMG SRC="GRAPHICS/PCA1.GIF" ALT="A screenshot showing PCA in a DTP
  112. app" WIDTH=254 HEIGHT=303></CENTER>
  113. <CENTER><I>A PCA Toolbar acting on an image in a DTP frame</I></CENTER>
  114. <P>
  115.  
  116. What we now have is a system whereby an application can have an infinite
  117. number of additional tools and all applications conforming to PCA can be
  118. used with and by all other PCA applications.
  119. <P>
  120. An example of this could be an image in a DTP frame linked to Compo which
  121. used this image as a 'canvas' for a composite picture. From Compo one of
  122. the images in the composite picture could also be linked to ProArt24 and
  123. any changes would immediately be reflected in Compo and the DTP package.
  124.  
  125. <P>
  126. If you jump to the bottom of this page you can download some <A HREF="#examples">example
  127. applications</A> and documentation that may make things clearer. The main
  128. document to read is 'ToTest'.
  129. <P>
  130. <H2>A more technical explanation</H2>
  131.  
  132. There are two 'sides' to PCA support. Applications may support either or
  133. both as it suits them.
  134. <P>
  135.  
  136. <B><A NAME=A NAME="local">Local</A></B>
  137. <P>
  138.  
  139.  
  140. A Local application creates and maintains an area of shared memory (on the
  141. RiscPC this is most likely to be a dynamic area, older hardware must use RMA
  142. or something like the Dynamite memory manager). Objects in this area may be
  143. edited by any PCA 'remote' application which is running, provided that it
  144. knows about the type of object concerned. It is the local application's
  145. responsibility to create and maintain pointers to objects and to take the
  146. correct action when an object moves or changes size. 
  147.  
  148.  <P>
  149.  
  150. <B><A NAME=A NAME="remote1">Remote</A></B>
  151. <P>
  152. A Remote application modifies an object in some way when requested to do so
  153. by a Local application. Remote applications can be small 'applets' or
  154. major programs in their own right. The PCA specification sets no limits
  155. on the changes which may be made to an object.
  156. <P>
  157. In practice, the two sides blur considerably. For example, it is possible
  158. for more than one 'Remote' task to work on the same object at the same
  159. time in which case the 'Remote' tasks must respond to some messages in a similar
  160. way to the 'Local' task.
  161. <P>
  162. In addition, an optional extension to the standard provides support for
  163. 'In-place' editing of objects directly in another application's window.
  164. <P>
  165.  
  166.  
  167. <B>
  168. Limitations, assumptions and philosophy
  169. </B>
  170.  
  171. <P>
  172.  
  173.  
  174.  
  175. The PCA standard requires the following:
  176. <P>
  177.  
  178.  
  179.  
  180. <UL>
  181.  
  182. <LI>    Objects are stored in an area of memory available to all tasks. (eg.
  183. Dynamic areas). Beyond that the PCA is designed to be as transparent as
  184. possible to the memory management system used by a program. See below for
  185. some notes on memory management related issues.
  186.  
  187. <LI>    Objects are either entirely paged into RAM during any PCA exchange, or a
  188.         virtual memory system which is transparent to the program accessing memory
  189.         is used (Eg. Clares Virtualise).<P>
  190.  
  191. <LI>    Objects are stored in a cross-program standard format for which there is a
  192.         method of rendering readily available to other programmers.
  193.         Examples are RISC OS Sprites, Drawfiles, ArtWorks files, Plain text
  194. etc.
  195. </UL><P>If you are writing or have written a program which produces
  196. data objects that may be desirable for other programs to render, you should
  197. consider providing a rendering module (or some code) which
  198. other applications can use to display your object types. You should also
  199. consider placing the details (if not the rendering code itself) in the
  200. public domain. <P>
  201.  
  202. No well written RISC OS application is an island. By supporting the PCA
  203. standard programs can take advantage of each other's good features and
  204. minimise their weaknesses while providing the user with a far richer and
  205. more productive working environment.
  206. <P>
  207.  
  208. <B>
  209. Memory management issues
  210. </B>
  211.  
  212. <P>
  213.  
  214. For backwards compatability programs that wish to use PCA on pre RiscPC
  215. hardware can fall back to using the RMA or something like the Dynamite
  216. memory manager. We do <b>not</b> however believe that Dynamite is the best
  217. solution for a PCA task on the RiscPC. This is because Dynamite uses one
  218. dynamic area to store all of its data rather than one dynamic area for each
  219. task. This practice means that, in the event of a PCA remote task going
  220. wrong and writing beyond the end of the object being edited, *all* tasks
  221. using Dynamite could crash rather than just the one local task in question.
  222. Also, Dynamite will not work with <i>Virtualise</i> which provides a PCA
  223. compatible virtual memory system.<P> 
  224.  
  225. <P>
  226. <A HREF="#top">Return to Contents</A>
  227. <HR>
  228.  
  229.  
  230. <H1><A NAME="mesdefs">Plug In Compliant Application Message specification</A></H1>  <P>
  231.  
  232.  
  233.  
  234. <AU>
  235.  </P> Author  : Rob Davison (rdavison@xtra.co.nz)<BR>
  236. Date    : 01/08/96<BR>
  237. Status  : Release 1<BR>
  238. </AU>
  239.  
  240. <P>
  241. Message Index<BR>
  242.  
  243.  
  244. <UL>
  245. <TT>
  246.  
  247. <LI><A HREF="#whos">Message_WhosAbout0x83484</A>
  248. <LI><A HREF="#im">Message_ImHere0x83485</A>
  249. <LI><A HREF="#do">Message_DoYourStuff0x83486</A>
  250. <LI><A HREF="#desel">Message_Deselect0x83487</A>
  251. <LI><A HREF="#done">Message_DoneMyStuff0x83488</A>
  252. <LI><A HREF="#changed">Message_Changed0x8348A</A>
  253. <LI><A HREF="#resize">Message_ResizeRequest0x8348B</A>
  254. <LI><A HREF="#update">Message_UpdateArea0x8348C</A>
  255. <LI><A HREF="#resizeack">Message_ResizeAck0x8348D</A>
  256. <LI><A HREF="#misc">Message_MiscOp0x8348E</A>
  257. <LI><A HREF="#info">Message_Info0x8348F</A>
  258. <LI><A HREF="#pos">Message_ObjectPosition0x83490</A>
  259. <LI><A HREF="#hook">Message_HookMe0x83491</A>
  260. <LI><A HREF="#unhook">Message_UnhookMe0x83492</A>
  261.  
  262.  
  263. </UL>
  264. </TT>
  265.  
  266. <P>
  267.  
  268.  
  269. <B>
  270. Notes:
  271. </B>
  272. <P>
  273.  
  274.  
  275. Filetype is divided into two fields with this format:
  276.  
  277. <PRE>
  278.  
  279.            b 0-12 RISC OS filetype
  280.            b13-31 reserved - zero.
  281.  
  282. </PRE>
  283.  
  284. <P>
  285.  
  286. On reading, please mask bits 13-31 out before checking the filetype.
  287. <P>
  288.  
  289. Strings are null terminated but supporting applications should accept Ctrl.
  290. terminated (ASCII 0-31).<P>
  291.  
  292.  
  293. 'Address of base' is the beginning of the data structure which contains the object.<P>
  294. 'Offset to object' is the offset from the Address of base to the object-of-interest
  295. <P>
  296.  
  297. For example, the 'Offset to object' of a sprite is the offset to the sprite
  298. itself (base!8 for the first sprite in a sprite area). The 'Address of base'
  299. is the address of the sprite area in which the sprite resides. For objects
  300. where the offset has no meaning the offset to the object must be zero.
  301.  
  302. <P>
  303.  
  304. The PCA references objects using 'tags'. Each tag is usually 16 bytes in length
  305. and its format is defined thus:<P>
  306. <PRE>
  307. tag+0  = Address of base. (anchor)
  308. tag+4  = Offset to object from base.
  309. tag+8  = Length of object. (if applicable - see note below)
  310. tag+12 = Extension size and flags
  311.                b0-15 These bits are to provide for expansion of the size of a
  312.                tag by up to 65532 bytes. Typically, this is for app. or object
  313.                specific data. This document specifies two extensions to show
  314.                you how it's done. Details below.
  315.  
  316.                b16-31 (reserved, set to zero)
  317. </PRE>
  318.  
  319. The first two values in a tag are most important as they are pointers to the
  320. address of the object and the base of the data structure containing it.
  321. Remote tasks must <B>*always*</B> reference an object by reading these values.
  322. Generally speaking, Remote tasks can usually trust the address and offset
  323. until the next Wimp_Poll but if in doubt, re-read it from the tag. The Local
  324. task has the responsibility of creating the object's tag when the object
  325. joins the PCA system, updating the relevant fields in the tag if the object
  326. is moved or resized and discarding the tag when it is sure it is no longer
  327. needed. Tags must themselves be in a common memory area and they <em>must
  328. not move</em> during the lifetime of the object in the PCA system. Clares
  329. provide a small module called 'PCASupport' which may be freely distributed
  330. by registered PCA developers to facilitate the creation of PCA tags for
  331. applications which do not want to create tags themselves.
  332.  
  333. <p>
  334.  
  335. Notes:<p>
  336.  
  337. Many objects store their length within the object data structure itself and
  338. in that case you <b>must</b> use the value stored within the object's data
  339. instead of relying on the length field in the tag. It is intended for object
  340. types which include no record of their size (text for example).
  341.  
  342. <P>
  343.  
  344. Tag extensions must adhere to the following standard:
  345. <pre>
  346. tag+12.b0-15   = (bytes required+4). Multiples of 4 bytes only.
  347. tag+16           extension id. Types 0-&fff are reserved for Clares PCA.
  348.                  Other values are allocated in line with SWI/Message
  349.                  chunk numbers for application developers.
  350. (extended data dependant on tag id)
  351. </pre>
  352.  
  353. To give an example of a tag extension we define two tag extensions which may
  354. be used with PCA text objects.
  355.  
  356. <p>
  357.  
  358. <pre>
  359.  
  360. Simple text object
  361. ------------------
  362. tag+12 8
  363. tag+16 &FFF
  364. tag+20 length of buffer allocated to object
  365.        (ie the remote task can extend the size of the text (as given at tag+8)
  366.        until its size reaches tag+20 bytes before calling Message_Resize.
  367.  
  368. Edited text object
  369. ------------------
  370. tag+12 16
  371. tag+16 &FFE
  372. tag+20 length of buffer for first chunk
  373. tag+24 offset to rest of text from object base
  374. tag+28 length of rest of text
  375. </pre>
  376.  
  377. Edited text objects are split into two separate parts, the pointer to base
  378. at the beginning of the tag, points to the start of the first chunk of text,
  379. the offset to object points to the end of this chunk of text (= the caret
  380. position) while the values at tag+24 and tag+28 point to the rest of the
  381. text. Suitable manipulation of these values should allow a text editor to
  382. work with PCA. <em>Note:</em> this has not been tested with any code -
  383. any comments please contact the author of PCA.
  384.  
  385. <p>
  386.  
  387. The tag extension system is potentially very powerful but please do not
  388. abuse it. If everyone who ever writes a PCA program creates a tag extension
  389. for their own object format then chaos will reign and the PCA system will
  390. become useless. (Anyone questioning this is invited to use the specification
  391. document for the TIFF file format as bedside reading - a perfect example of
  392. a tagged file format gone wrong). In general, the basic tag structure or the
  393. 'pca text' extension defined above will do for most data types. If you
  394. really feel you have to create your own extension then please double check
  395. with Clares that a suitable extension does not already exist. The extension
  396. should then be defined in the format given above and the information sent to
  397. Clares for distribution to the PCA community.
  398.  
  399. <p>
  400.  
  401. On receipt of a PCA message you should decide if the message refers to one
  402. of your objects (either a local one you created yourself or a remote object
  403. which you are editing). You do this by comparing the object's tag address,
  404. passed in the message, with a local array of tags that you know about. Get into
  405. the habit of doing it this way (rather than comparing the tag's address
  406. fields with your own data structures) as one message, <A
  407. HREF="#desel">Message_Deselect</A> may pass a tag address which no longer
  408. actually contains valid data (the object itself having been deleted). See
  409. its entry for details.
  410.  
  411. <p>
  412.  
  413. In the following documentation '<I>Local</I>' is the 'owning task' being the
  414. task to which the object is 'local'. This task created the object and its
  415. PCA tag. It knows how to resize and how to delete the object.
  416.  
  417. <P>
  418.  
  419. '<I>Remote</I>' is the 'utility' task - the one which modifies an object for
  420. the 'local' or owning task.
  421. <P>
  422.  
  423. Please note which messages are to be broadcast and which are sent
  424. task-to-task. The correct functioning of the system depends on the correct
  425. usage.
  426. <P>
  427.  
  428. <h3><A NAME="summary">PCA Message Summary</A></h3><BR>
  429.  
  430. This is intended to give the programmer an overview of what goes on in a typical
  431. PCA session. It ignores many of the finer points of the protocol.
  432.  
  433. <p>
  434.  
  435. 1. Local task broadcasts Message_WhosAbout for a selected object.<BR>
  436. 2. Remote tasks examine message data and respond with Message_ImHere.<BR>
  437. 3. Local task, in response to users choice of Remote sends Message_DoYourStuff.<BR>
  438. 4. (if doing inplace editing) Remote task, on receipt of DoYourStuff  sends Message_HookMe.<BR>
  439. 5. (repeated) Remote and Local tasks broadcast Message_UpdateArea if the user changes the object.<BR>
  440. 6. Remote task sends Message_Unhook when user closes window/toolbar onto object.<BR>
  441. 7. Local task broadcasts Message_Deselect if user deletes object/quits program.<BR>
  442.  
  443. The variable names used in the example BASIC program are included after the
  444. message number.
  445.  
  446. <P>
  447.  
  448.  
  449.  
  450. <STRONG><A NAME="whos">
  451. Message_WhosAbout
  452. </A> (&83484) </STRONG> (Msg_Whos%)<P>
  453.  
  454.  
  455. Broadcast by Local task when opening Utility sub-menu/popup (see the section
  456. on user interface). 
  457.  
  458. <P>
  459.  
  460. The block pointed to by R1 contains:<P>
  461. <PRE>
  462. R1+20   filetype of object
  463. R1+24   address of object tag
  464. R1+28   reserved - 0
  465. </PRE>
  466.  
  467. <P>
  468.  
  469.  
  470. Receiving remote tasks should respond with <A HREF="#im">Message_ImHere</A>
  471. as defined below if the filetype is 'interesting'. You can examine the data
  472. in the tag at R1+24 if the filetype alone does not suffice (for example, a
  473. program which can only edit 32bpp sprites should examine the sprite type
  474. word at !(R1+24)+(R1+24)!4) +40 (ie tag address field+offset to object
  475. field)+40 before sending <A HREF="#im">Message_ImHere</A>).
  476.  
  477. <P>
  478.  
  479. <STRONG><A NAME="im">
  480. Message_ImHere
  481. </A> (&83485) (Msg_Im%) </STRONG><P>
  482.  
  483.  
  484. Sent by Remote task to Local task. Local records the data passed for later
  485. use in creating a dialogue box or menu.
  486.  
  487. <P>
  488.  
  489.  
  490. The block pointed to by R1 contains:<P>
  491. <PRE>
  492. R1+20
  493.         bits 0-7 flags:
  494.                 b0 Spritename supplied
  495.                 b1 Info available
  496.                 b2 Reserved - 0
  497.                 b3 Tool wants to 'own' the object
  498.                 b4 Tool wants In place editing
  499.                 b5-7 Reserved - 0
  500.                 b8-31 Reserved - 0
  501.  
  502. R1+24           Tool id.
  503. R1+28           String. Menu entry/Function name (eg. Contrast...).
  504.                 Length limited to 31chars+terminator.
  505. R1+60           String. Name of sprite in wimp sprite pool
  506.                 (if b0 of R1+20 is set)
  507.  
  508.  
  509. <P>
  510. </PRE>
  511. </P>
  512.  
  513. The tool id is intended for remote tasks which provide more than one
  514. utility. It is returned to the task with <A
  515. HREF="#do">Message_DoYourStuff</A>.
  516.  
  517. <P>
  518. Flags:<P>
  519.  
  520. <PRE>
  521. b0      indicates to the recipient that there is a sprite name at R1+60
  522.         - the sprite is stored in the Wimp sprite pool and should be
  523.         used when rendering the popup dialogue box.<P>
  524.  
  525. b1      indicates that the tool can provide a response
  526.         to <A HREF="#info">Message_Info</A>.
  527.  
  528. b2      Reserved - 0
  529.  
  530. b3      indicates that the tool wants to 'own' the object.
  531.         Local task should send Msg_Deselect for the object
  532.         before sending <A HREF="#do">Message_DoYourStuff</A> if this bit is
  533.         set. Do not set this bit unless you have to as it
  534.         will prevent other remote tasks from sharing the
  535.         object at the same time. It should only be set when
  536.         the remote task wants to 'take over' the object completely.
  537.  
  538.         - such as Composition taking over a 32bpp sprite
  539.         for use as a canvas.
  540.  
  541. b4      This bit is designed to allow for real 'in place editing'
  542.         operations. Because of the amount of code necessary
  543.         at the local end to handle this it has been defined
  544.         as an optional part of the standard.
  545. </PRE>
  546.        
  547. <P>
  548. Local applications which do not support in place editing should clear bit 4
  549. of the flags word and send that with DoYourStuff. On receipt, the remote
  550. application should check if bit 4 is still set and if not open a remote
  551. window onto the object.
  552.  
  553. <P>
  554.  
  555.  
  556. Notes: In early versions of this standard bits 28-31 of the flags word had
  557. another use. This data has been moved to <A HREF="#hook">Message_HookMe.</A>
  558. Please see below.
  559.  
  560. <P>
  561.  
  562.  
  563. <STRONG>
  564. <A NAME="do">
  565. Message_DoYourStuff
  566. </A> (&83486) (Msg_Do%)
  567. </STRONG>
  568. <P>
  569.  
  570. The block pointed to by R1 contains:<P>
  571.  
  572. <PRE>
  573. R1+20   Filetype of object
  574. R1+24   Address of object tag
  575. R1+28   reserved - 0
  576. R1+32   Tool id
  577. R1+36   Tool flags word
  578. R1+40   String. Name of object or null (&0)
  579. </PRE>
  580. <P>
  581.  
  582. Sent by Local task to remote task depending on entry selected in Utilities
  583. sub-menu/dialogue. Remote task should record the tag address and open its
  584. window (or just its toolbar if bit 4 of the flags word is set). 
  585.  
  586. <P>
  587.  
  588. <B>
  589. Notes:
  590. </B><P>
  591.  
  592. If the Remote task set bit 4 of the flags word in <A
  593. HREF="#im">Message_ImHere</A> when replying to <A
  594. HREF="#whos">Message_WhosAbout</A> it should check that this bit is still
  595. set now. If it has been cleared then the Local task cannot handle remote
  596. messaging and the Remote task must open a separate window onto the object.
  597. <P>
  598.  
  599. If bit 4 is still set it means that the local task is willing to participate
  600. in an in-place editing session. In this case the Remote task should simply
  601. open its toolbar and send <A HREF="#hook">Message_HookMe</A> to the Local
  602. task to ask it to intercept mouse button and other Wimp events. Receipt of
  603. this message will also cause the Local task to send <A
  604. HREF="#pos">Message_ObjectPosition</A> to move the remote tasks toolbar to
  605. the correct position. 
  606.  
  607. <P>
  608.  
  609. Nothing about the standard prevents the object changing type (eg from sprite
  610. to Drawfile) between <A HREF="#whos">Message_WhosAbout</A> and this message.
  611. On receipt of this message the Remote task must therefore check the filetype
  612. field and as much of the object's data structure as necessary to ensure that
  613. it can edit the object and delink/ignore the message quietly if the type is
  614. not to its liking. This allows the Local task to 'move' a remote task to
  615. different objects cleanly.
  616.  
  617. <P>
  618.  
  619.  
  620. Before sending Message_DoYourStuff with bit 4 set the local task should
  621. broadcast <A HREF="#unhook">Message_UnhookMe</A> to prevent more than one
  622. remote task attempting to do in-place editing at once.
  623.  
  624. <p> 
  625.  
  626. Before sending Message_DoYourStuff with bit 3 set the local task should
  627. broadcast <A HREF="#desel">Message_Deselect</A> as the remote task in
  628. question wants to 'own' the object.
  629.  
  630. <P>
  631.  
  632. <STRONG>
  633. <A NAME="desel">
  634. Message_Deselect
  635. </A> (&83487) (Msg_Desel%)
  636. </STRONG>
  637. <P>
  638.  
  639. Broadcast by Local task when the object has been deleted.
  640. <P>
  641.  
  642. The block pointed to by R1 contains:<P>
  643.  
  644. <PRE>
  645. R1+20   Filetype of object.
  646. R1+24   Address of object tag
  647. </PRE>
  648. <P>
  649.  
  650. All Tasks interested in the object should close their window/abandon their
  651. operations as the object in question has been removed from the PCA system
  652. (usually because it has been deleted). Local tasks <b>must</b> generate this
  653. message when deleting an object, quitting etc. or remote tasks using the
  654. object will crash. If the Local task is using PCASupport for tag generation
  655. it should call SWI PCA_DeleteAndKill which will delete the tag and send this
  656. message in one operation but <b>only</b> when the object really is being
  657. deleted.<p> Note: This implies that the remote task, on receipt of this
  658. message <b>cannot</b> rely on more than the tag address as a key to the
  659. object. It _cannot_ access the object data via the tag passed as SWI
  660. PCA_DeleteTag has already been called (the address fields within the tag
  661. will contain -1 and the object data itself may well have been discarded).
  662. This is unavoidable without a two message (Message/Ack) deselection system
  663. which would be more difficuilt for tasks to handle. Especially (as is often
  664. the case) if the local task is about to quit.
  665.  
  666.  
  667. <P>
  668.  
  669.  
  670. <STRONG>
  671. <A NAME="done">
  672. Message_DoneMyStuff
  673. </A> (&83488) (Msg_Done%)
  674. </STRONG>
  675. <P>
  676.  
  677. Broadcast by a task when it has modified the object. All tasks accessing the
  678. object other than the originator of the message should recognise this
  679. message and redraw the object.
  680.  
  681. <P>
  682.  
  683. The block pointed to by R1 contains:<P>
  684. <PRE>
  685. R1+20   0
  686. R1+24   Address of object tag
  687.  
  688. </PRE><P>
  689.  
  690. Use this message for 'whole object changed' operations which do not involve
  691. changes to the object's basic structure (Eg. image filter of sprite).
  692.  
  693. <P>
  694.  
  695. Note: Recepit of this message by the Local task should
  696. not be taken as an indication that the remote task is no longer interested
  697. in it. That is what <A HREF="#unhook">Message_UnhookMe</A> is for.
  698.  
  699. <p>
  700.  
  701. <STRONG>
  702. <A NAME="changed">
  703. Message_Changed
  704. </A> (&8348A) (Msg_Changed%)
  705. </STRONG>
  706. <P>
  707.  
  708. Broadcast by Local or Remote task when the object has changed (either in
  709. size or its details). Task should act as if it had got a new DoYourStuff
  710. message.
  711.  
  712. <P>
  713.  
  714. Broadcast by Remote task after it has changed the object's size. Local and
  715. other interested Remote tasks will re-read the object's details and redraw
  716. the object.<P>
  717.  
  718.  
  719. The block pointed to by R1 contains:<P>
  720.  
  721. <PRE>
  722. R1+20   Filetype of object
  723. R1+24   Address of object tag
  724. R1+28   reserved - 0
  725. R1+32   String. New name of object or zero for no change.
  726.  
  727. </PRE><P>
  728.  
  729. Note: Nothing about the standard prevents the object changing type (eg from
  730. sprite to Drawfile). On receipt of this message please check the filetype
  731. field as well as all necessary aspects of the object's data structure. If
  732. the object is not to a Remote task's liking it should send Message_UnHook and
  733. delink quietly.
  734.  
  735.  
  736. <P>
  737.  
  738. <STRONG>
  739. <A NAME="resize">
  740. Message_ResizeRequest
  741. </A>  (&8348B) (Msg_Resize%)
  742. </STRONG><P>
  743.  
  744.  
  745. Sent by Remote task to Local (task handle in R1+4 of DoYourStuff message).
  746. If the Local task fails to deal successfully it will claim the message.
  747.  
  748. <P>
  749.  
  750.  
  751. The block pointed to by R1 contains:<P>
  752. <PRE>
  753. R1+20   0
  754. R1+24   Address of object tag
  755. R1+28   reserved - 0
  756. R1+32   New size. Total size of object structure
  757.         (including header, offset to base etc.) if flags b1
  758.         clear otherwise new size of object itself.
  759. R1+36   Flags
  760.                b0 set 'Resize associated objects as well'
  761.                b1 set 'New Size is for object alone - does not include header.'
  762. </PRE>
  763. <P>
  764.  
  765. If the Local task succeeds then it will send <A
  766. HREF="#resizeack">Message_ResizeAck</A> (basically, copy R1+8 to R1+12, put
  767. Message ResizeAck into R1+16, update R1+32 and return to sender). On receipt
  768. of ResizeAck message the sender of ResizeRequest should modify the object
  769. appropriately (for example, adding rows/columns to a sprite).
  770.  
  771. <P>
  772.  
  773. <B>
  774. Notes:
  775. </B><P>
  776.  
  777. You must be prepared for the resize request to fail in which case it is the
  778. responsibility of the Local task to report to the user and the Remote task
  779. to continue safely.
  780.  
  781. <P>
  782.  
  783.  
  784. If the ResizeAck message returns to a Remote task you must check that the
  785. field in R1+12 is equal to the MyRef generated by the Resize message you
  786. sent to ensure that the ResizeAck is for the object you have requested be
  787. resized. If it is, ensure that the object is in a renderable state before
  788. the next Wimp_Poll by updating the relevant parts of the object's internal
  789. data structure.
  790.  
  791. <P>
  792.  
  793.  
  794. The local task's only modification to the data after a Resize is to write new
  795. size fields where appropriate and to update the object's tag address fields
  796. if the object moves. For sprites the new total area size should be written
  797. into 'Base of data'+0 - it does not know what the Remote task is going to do
  798. with the sprite and therefore cannot make any other modifications to the
  799. data.
  800.  
  801. <P>
  802.  
  803. For data types which do not store size within their data structure then the
  804. length field of the tag should also be modified (along with the address
  805. fields if the object has to be moved).
  806.  
  807. <P>
  808.  
  809. After modifying the object the Remote task must broadcast <A
  810. HREF="#changed">Message_Changed</A>.
  811.  
  812. <P>
  813.  
  814. Composition will read bit zero of the flags word. If this bit is set, it will
  815. resize masks associated with the sprite in question as well. The amount by
  816. which masks will be resized is calculated from the resize-request for
  817. the sprite itself. Other applications can ignore or act on this bit as they
  818. wish. The task which requested the resize must be able to handle either
  819. action.
  820.  
  821. <P>
  822. Bit one of the flags word is intended to facilitate the resizing of paths
  823. in Drawfiles and similar data structures under the PCA though no code has been
  824. written to do this yet.
  825. <p>
  826.  
  827. <H3>
  828. Resize Summary
  829.  
  830. </H3><P>
  831.  
  832. This is what you do to change the size of an object you are editing:<P>
  833.  
  834. <em>From a Remote task's point of view:</em><P>
  835.  
  836. Send <A HREF="#resize">Message_ResizeRequest</A> and keep myref generated
  837. >from the message. On receipt of ResizeAck check myref, modify object data
  838. and broadcast <A HREF="#changed">Message_Changed</A>.
  839.  
  840. <P>
  841.  
  842. <em>From the Local task's point of view:</em><P>
  843.  
  844. On receipt of <A HREF="#resize">Message_ResizeRequest</A> resize object if
  845. possible, update the objects tag anchors and send ResizeAck otherwise claim
  846. the message and report an error to user.
  847.  
  848. <P>
  849.  
  850. <em>Both Remote and Local tasks:</em><P>
  851.  
  852. On receipt of <A HREF="#changed">Message_Changed</A> re-read the object
  853. header as if it was newly created and redraw the entire object. (You may
  854. need to regenerate an area of your window the size of the old object -
  855. remember the new object may occupy less screen area).
  856.  
  857.  
  858. <P>
  859. <em>Resize speed issues</em>
  860. <P>
  861.  
  862. When the object being resized is very large, VM (Virtual Memory)is being
  863. used, or the resize requests are frequent, there may be a performance issue.
  864. In such situations the Local task should consider moving the object to the
  865. top of its data storage area to prevent repeated memory moving operations.
  866. In applications where many small resize requests are likely then consider
  867. employing a tag extension system similar to the one defined above for text
  868. files to reduce the frequency of the resize requests. 
  869.  
  870.  <P>
  871.  
  872. <STRONG>
  873. <A NAME="update">
  874. Message_UpdateArea
  875. </A>  (&8348C) (Msg_Uparea%)
  876. </STRONG><P>
  877.  
  878.  
  879. Broadcast by task when it has modified part of an object. Apps interested in
  880. the object should redraw the appropriate area of the object as quickly as
  881. possible if they have a window onto the object open.
  882.  
  883. <P>
  884.  
  885. The block pointed to by R1 contains:<P>
  886. <PRE>
  887. R1+20   Format of subsequent data (0)
  888. R1+24   Address of object tag
  889. R1+28   Xlow  (OS units at 1:1 scale)
  890. R1+32   Ylow  (OS units at 1:1 scale)
  891. R1+36   Xhi   (OS units at 1:1 scale)
  892. R1+40   Yhi   (OS units at 1:1 scale)
  893. </PRE><P>
  894.  
  895. where coordinates are relative to the bottom left of the object.
  896. <P>
  897.  
  898. Currently this is the only format supported by code (working with bitmap
  899. sprites). 
  900.  
  901. <P>
  902.  
  903. Other proposed formats are as follows:
  904. <P>
  905.  
  906. <PRE>
  907. R1+20   Format of subsequent data (1)
  908. R1+24   Address of object tag
  909. R1+28   Xlow (Draw units = OS units <<8)
  910. R1+32   Ylow (Draw units = OS units <<8)
  911. R1+36   Xhi  (Draw units = OS units <<8)
  912. R1+40   Yhi  (Draw units = OS units <<8)
  913. </PRE>
  914. <P>
  915.  
  916. where coordinates are relative to the bottom left of the object.
  917. <P>
  918.  
  919. <PRE>
  920. R1+20   Format of subsequent data (2)
  921. R1+24   Address of object tag
  922. R1+28   Xlow (Draw units = OS units <<8)
  923. R1+32   Ylow (Draw units = OS units <<8)
  924. R1+36   Xhi  (Draw units = OS units <<8)
  925. R1+40   Yhi  (Draw units = OS units <<8)
  926. </PRE>
  927. <P>
  928.  
  929. where coordinates are relative to the top left of the object.
  930.  
  931. <P>                                                         
  932.  
  933. If you have anyother suggestions please contact Clares or the author.
  934.  
  935. <p>
  936.  
  937.  
  938. <STRONG>
  939. <A NAME="resizeack">
  940. Message_ResizeAck
  941. </A> (&8348D)  (Msg_ResizeAck%)
  942. </STRONG>
  943. <P>
  944.  
  945. Sent by Local task when a resize request has succeeded. On receipt by a
  946. Remote task, check that R1+12 is the myref generated from <A
  947. HREF="#resize">Message_ResizeRequest</A> before modifying the object data
  948. structure and broadcasting <A HREF="#changed">Message_Changed</A>.
  949.  
  950. <P>
  951.  
  952.  
  953. The block pointed to by R1 contains:
  954.  
  955. <P>
  956.  
  957. <PRE>
  958. R1+20   reserved - 0
  959. R1+24   Address of object tag
  960. R1+28   reserved - 0
  961. R1+32   New size allocated to object
  962. R1+36   Flags
  963.  
  964. </PRE><P>
  965.  
  966.  
  967. <STRONG>
  968. <A NAME="misc">
  969. Message_MiscOp
  970. </A>(&8348E)  (Msg_Misc%)
  971. </STRONG>
  972. <P>
  973.  
  974. This message is designed to provide a private interface option for PCA
  975. programs without them having to request other message allocations from
  976. Acorn.
  977.  
  978. <P>
  979.  
  980.  
  981. The block pointed to by R1 contains:<P>
  982.  
  983. <PRE>
  984. R1+20   Sub-reason code
  985. </PRE>
  986. <P>
  987.  
  988. - other data dependant on sub-reason code.<P>
  989.  
  990. The sub-reason codes available to application developers are allocated in
  991. line with SWI and Message blocks - if you have one of these then those
  992. values may be used by your programs. Where appropriate, please make details
  993. of your messages available to the PCA community by sending them to Clares
  994. for distribution.
  995.  
  996. <P>
  997.  
  998. Currently, only two sub-reasons are defined for use with Composition. The
  999. current format of these is given below but is subject to change. Please
  1000. contact Clares before releasing programs which rely on it:
  1001.  
  1002. <P>
  1003.  
  1004.  
  1005.         <STRONG>
  1006. SubReason_GiveAssociatedData (&83480)
  1007. </STRONG>
  1008. <P>
  1009.  
  1010.         Broadcast by remote plug-in when it would like to know more about the object.
  1011. <P>
  1012.  
  1013.         The block pointed to by R1 contains:<P>
  1014. <PRE>
  1015.         R1+24   Address of object tag
  1016. </PRE>
  1017.  
  1018.  
  1019.         <STRONG>
  1020. SubReason_AssociatedDataCompo  (&83481)
  1021. </STRONG><P>
  1022.  
  1023.  
  1024.         Sent by Compo to Remote which broadcast GiveAssociatedData containing a tag pointing to a Compo object.
  1025. <P>
  1026.  
  1027.         The block pointed to by R1 contains:<P>
  1028. <PRE>
  1029.         R1+24   Address of object tag
  1030.         R1+28   reserved - 0
  1031.         R1+32   two eight bit and one sixteen bit fields
  1032.                 bits 0-7     Masks in use by object
  1033.                 bits 8-15    Format of subsequent data (zero)
  1034.                 bits 16-31   Reserved
  1035.         R1+36   Reserved (0)
  1036.         R1+40   Blend mask address or zero    = no Blend mask
  1037.         R1+44   Tint mask address or zero     = no Tint mask
  1038.         R1+48   Curve mask address or zero    = no Curve mask
  1039.         R1+52   Displace mask address or zero = no Displace mask
  1040.         R1+56   Shadow mask address or zero   = no Shadow mask
  1041.         R1+60   Reserved
  1042.         R1+64   Reserved
  1043.         R1+68   Opacity of object (65536=solid 0=transparent)
  1044.         R1+72   Math type in use for object
  1045.  
  1046. </PRE><P>
  1047.  
  1048. Notes: The 'mask address' passed is the address of the base of a sprite area
  1049. containing one eight bit greyscale sprite (at address+address!8). The size
  1050. of a mask should not be assumed to be the same as that of the object - read
  1051. it from the mask sprite data or use OS_SpriteOp to extract it. 
  1052.  
  1053. <P>
  1054.  
  1055. The data returned by this message is fragile - re-read whenever you want to
  1056. make use of it.
  1057.  
  1058. <P>
  1059.  
  1060.  
  1061. <STRONG>
  1062.  
  1063. <A NAME="info">
  1064. Message_Info
  1065. </A> (&8348F) (Msg_Info%)
  1066. </STRONG><P>
  1067.  
  1068.  
  1069. Sent by Local to Remote application when the info button in the pop-up is clicked.
  1070. <P>
  1071.  
  1072. The block pointed to by R1 contains:<P>
  1073.  
  1074. <PRE>
  1075. R1+20   0
  1076. </PRE>
  1077. <P>
  1078.  
  1079. Remote application should write a suitable info string into +20, change the
  1080. message size and return the message to the sender.
  1081.  
  1082. <P>
  1083.  
  1084. Example info strings:<BR>
  1085.  
  1086. "Image Filter. No image linked at the moment."<BR>
  1087.  
  1088. "Image Filter. Image 'Face' linked at the moment."<BR>
  1089.  
  1090. <P>
  1091.  
  1092.  
  1093. <STRONG>
  1094. <A NAME="pos">
  1095. Message_ObjectPosition
  1096. </A>  (&83490) (Msg_ObjPos%)
  1097. </STRONG>
  1098. <P>
  1099.  
  1100. This message is generated by the Local application after receipt of <A
  1101. HREF="#hook">Message_HookMe</A>, object repositioning operations and window
  1102. open operations, if the Local application supports 'in-place editing'.<P>
  1103.  
  1104.  
  1105. The block pointed to by R1 contains:
  1106.  
  1107. <P>
  1108.  
  1109. <PRE>
  1110. R1+20   0
  1111. R1+24   Address of object tag
  1112. R1+28   Y scale of object in Local window (65536=1:1 or 100%)
  1113. R1+32   Xlow of object on screen in 'Local' window. (limited to visible area)
  1114. R1+36   Ylow of object on screen in 'Local' window. (limited to visible area)
  1115. R1+40   Handle of 'Local' window.
  1116. R1+44   Handle of Local windows toolbar window (or -1 if no toolbar)
  1117. R1+48   X scale factor of object in Local window (16.16 format eg 65536=1:1 or 100%)
  1118. R1+52   Xlow of object on screen in Local window. (unlimited)
  1119. R1+56   Ylow of object on screen in Local window. (unlimited)
  1120.  
  1121. </PRE><P>
  1122. On receipt, the Remote task should open its toolbar/infobar relative to the
  1123. positions in R1+32 and R1+36 behind the window handle at R1+44. The
  1124. coordinates passed in R1+32 and R1+36 should be limited to the windows
  1125. visible area (by the Local task) while those at +52 and +56 should not.
  1126.  
  1127. <P>
  1128.  
  1129. The information at R1+28 and R1+48 onwards is for use by the Remote task
  1130. during mouse click operations on the object. To convert mouse coordinates
  1131. read directly it should subtract the values at R1+52,R1+56 from the raw
  1132. mousex and mousey coordinates, and then scale them by the factors in
  1133. R1+28 and R1+48.
  1134. <P>
  1135. The X and Y scale factors are in 16.16 format. To convert a scale factor
  1136. into this format, multiply by 1 << 16. For example, 100% = a scale factor of
  1137. one and is therefore (1 << 16) * 1 which is 65536 or &10000. 150% = a scale
  1138. factor of 1.5 and is therefore (1 << 16) * 1.5 which is 98304 or &18000.
  1139.  
  1140. <p>
  1141.  
  1142. See the remote painting code (DEFPROCremote_win) in !Spaint for a practical
  1143. example of what you should do.
  1144.  
  1145. <P>
  1146.  
  1147. <STRONG>
  1148. <A NAME="hook">
  1149. Message_HookMe
  1150. </A>  (&83491)  (Msg_Hook%)
  1151.  
  1152. </STRONG><P>
  1153.  
  1154.  
  1155. This message is sent by the Remote task to the Local task. It indicates to
  1156. the Local task that it should begin intercepting mouse button and other Wimp
  1157. events to the object and send them to the Remote task. On receipt, the Local
  1158. task should create a trap icon over the object (using the button type in
  1159. r1+28) and send Message_ObjectPosition. 
  1160.  
  1161. <P>
  1162.  
  1163.  
  1164. The block pointed to by R1 contains:<P>
  1165.  
  1166. <PRE>
  1167. R1+20   0
  1168. R1+24   Address of object tag
  1169. R1+28   bits 0-27 Flags - reserved and set to zero.
  1170.         bits 28-31 Window 'work area' button type to use for trap icon.
  1171. R1+32   Window handle
  1172. R1+36   String. indirection string for icon or Null (&0)
  1173. </PRE>
  1174. <P>
  1175.  
  1176. To make life easier for the remote task the Local task should also take note
  1177. of the window handle at R1+32 and insert that value into the window handle
  1178. field when passing on Wimp messages. This allows the remote task to use much
  1179. of the same code to deal with remotely generated messages and messages to
  1180. their own window.
  1181.  
  1182. <P>
  1183.  
  1184. The optional indirection string at R1+36 is intended to allow for adding a
  1185. mouse pointer change when entering in-place edited objects. Take care with
  1186. this string as certain settings can disrupt the Local task's message
  1187. trapping. This extension is optional. Some local tasks may not support it so
  1188. do not rely on it. 
  1189.  
  1190. <p>
  1191.  
  1192. If the remote task is already editing an object in-place (and it is going to
  1193. replace it) then it should send Message_Unhook to the local task previously
  1194. being worked with so that it deletes its trap icon. 
  1195.  
  1196. <P>
  1197.  
  1198. Please see the section below on In-place editing for details of the best
  1199. method of trapping messages and the alterations which should be made before
  1200. forwarding them.
  1201.  
  1202. <P>
  1203.  
  1204. <STRONG>
  1205. <A NAME="unhook">
  1206. Message_UnhookMe
  1207. </A> (&83492)  (Msg_Unhook%)
  1208.  
  1209. </STRONG><P>
  1210.  
  1211. This message is sent by a remote task to the Local task (or local to remote)
  1212. when it wants to 'unhook' from the object.
  1213.  
  1214. <P>
  1215.  
  1216. The block pointed to by R1 contains:<P>
  1217.  
  1218. <PRE>
  1219. R1+20   0
  1220. R1+24   Address of object tag
  1221. R1+28   reserved  - 0
  1222. R1+32   Window handle
  1223. R1+36   Unhook 'type'
  1224.  
  1225. </PRE><P>
  1226.  
  1227. This message should be used by a Remote task to indicate its lack of
  1228. interest in an object. After sending this message the Remote task should
  1229. forget any references to the object and close its toolbar and/or window.
  1230.  
  1231. <P>
  1232.  
  1233. Little action need be taken at the Local end on receipt of this message
  1234. unless 'Inplace editing' is going on between the tasks in which case it
  1235. should remove the traps on Button click messages etc for the object. If the
  1236. Local task wishes to be efficient in its generation of PCA messages then it
  1237. should keep a counter for each object in the PCA system, increase the
  1238. counter on each call to Message_DoYourStuff and decrease it on each receipt
  1239. of Message_UnHook. Then PCA messages need only be generated in response to
  1240. changes made by the Local task if the objects counter is greater than zero.
  1241. When the counter reaches zero the Local task should broadcast Message_Deselect
  1242. as a saftey measure to ensure that all Remote tasks stop using the object.
  1243.  
  1244. <P>
  1245.  
  1246. The 'unhook type' at R1+36 currently has two defined values:
  1247. <P>
  1248.  
  1249. <PRE>
  1250. R1+36   0 'Unhook' is temporary
  1251.           (used by Compo to support the 'Track selected'
  1252.           preference option)
  1253. R1+36   1 'Unhook' is permanent - forget about this PCA.
  1254. </PRE><P>
  1255.  
  1256.  
  1257. All values other than zero should currently be treated as 'permanent'.<P>
  1258. <P>
  1259. <A HREF="#top">Return to Contents</A>
  1260. <HR>
  1261.  
  1262. <H1><A NAME="remote">PCA In-place editing specification</A></H1><P>
  1263. <AU>
  1264.  
  1265. Author  : Rob Davison (rdavison@xtra.co.nz)<BR>
  1266.  
  1267. Date    : 15/08/96<BR>
  1268.  
  1269. Status  : Release 1<BR>
  1270.  
  1271.  
  1272. </AU>
  1273.  
  1274. <H2>
  1275. Introduction
  1276. </H2>
  1277.  
  1278. <P>
  1279.  
  1280. The aim of this section is to define the work necessary for applications to
  1281. support 'in-place' editing (applications working on an object within another
  1282. application's window) within the framework supplied by the PCA itself.
  1283.  
  1284. <P>
  1285.  
  1286. This feature is an optional part of the PCA specification. All remote tasks
  1287. must be able to operate according to the normal PCA specification (open
  1288. their own window onto the object) if the Local task in question does not
  1289. support in-place editing. Even if the Local task does support this, it is
  1290. wise for the remote task to give the user the option of switching to
  1291. external editing as in-place editing has its disadvantages as well as
  1292. advantages. (The principal disadvantage being that
  1293. only one in-place editing session per object can be undertaken at a time,
  1294. for obvious reasons).
  1295.  
  1296. <P>
  1297.  
  1298.  
  1299. <B>
  1300. Local task
  1301.  
  1302. </B><P>
  1303. The greatest amount of work is down to the 'Local' or object-owning application.
  1304. <P>
  1305.  
  1306. After invoking a remote task with the PCA message DoYourStuff when bit 4 of
  1307. the flags word is set, it must expect receipt of <A
  1308. HREF="#hook">Message_HookMe</A> from the remote task. When it gets this
  1309. message it should create a transparent icon in its window which completely
  1310. covers the object and send <A HREF="#pos">Message_ObjectPosition</A>.
  1311.  
  1312. <P>
  1313.  
  1314. The button type of this icon should be taken from bits 28-31 of the flags
  1315. word as sent by <A HREF="#hook">Message_HookMe</A> and the indirection
  1316. string (if supported) from R1+36
  1317.  
  1318. <P>
  1319.  
  1320. Then, on receipt of the following standard Wimp messages the Local task must
  1321. check to see if the message refers to an icon covering the object, and if it
  1322. is, modify the message block and pass the message to the remote task using
  1323. Wimp_SendMessage.
  1324. <P>
  1325.  
  1326. Doing this effectively cuts a 'hole' in the window where the object is.
  1327. Messages into that region get shunted to the Remote task and are ignored by
  1328. the Local task.
  1329. <P>
  1330.  
  1331. <H3>
  1332. Details of the modifications:
  1333.  
  1334. </H3><P>
  1335.  
  1336. <B>
  1337. 6. Button_Click
  1338. </B><P>
  1339.  
  1340. xposition and yposition should be made relative to the object's bottom left.
  1341. Window handle must be set to the one supplied in <A
  1342. HREF="#hook">Message_HookMe</A>. Icon handle must be set to the special
  1343. value -&414350 (-"PCA")
  1344.  
  1345. <P>
  1346.  
  1347. ??? Other messages ???<BR>
  1348. ??? Which to support and how to modify them ???<BR>
  1349. ??? Advise us if you have any suggestions ???
  1350. <P>
  1351.  
  1352. On receipt of Message_OpenWindow for the window in which the object resides
  1353. the Local task must send <A HREF="#pos">Message_ObjectPosition</A> to the
  1354. remote task so that it can open its toolbar at an appropriate place.
  1355.  
  1356. <P>
  1357.  
  1358. Also, any actions which cause the position or size of the remotely linked
  1359. object to change must resize and reposition the icon created above and send
  1360. <A HREF="#pos">Message_ObjectPosition</A> again.
  1361.  
  1362. <P>
  1363.  
  1364. On receipt of <A HREF="#unhook">Message_UnhookMe</A> it must delete the icon
  1365. covering the object and carry out any other work necessary to restore normal
  1366. access to the object. The same action should obviously also be undertaken if
  1367. the object is deleted.
  1368.  
  1369. <P>
  1370. <B>Remote Task</B>
  1371. <P>
  1372.  
  1373. On receipt of <A HREF="#pos">Message_ObjectPosition</A> the remote task must
  1374. open its toolbar at an appropriate position calculated from the data
  1375. contained in the message.
  1376.  
  1377. <P>
  1378.  
  1379. This toolbar must contain at least one icon which, when clicked on, sends <A
  1380. HREF="#unhook">Message_UnhookMe</A> to the local task, removes any
  1381. references it has to the object and closes the toolbar. Model the appearance
  1382. of this icon on the window close icon and position the icon at the far left
  1383. horizontal toolbars or at the top left of vertical toolbars.
  1384.  
  1385. <P>
  1386.  
  1387. On receipt of<A HREF="#do"> Message_Do</A>/<A
  1388. HREF="#changed">Message_Changed</A> the remote task must check to see if
  1389. In-place editing is on (b4 of flags in Message_Do) and, if so, send <A
  1390. HREF="#hook">Message_HookMe</A> rather than opening its own window onto the
  1391. object.
  1392.  
  1393. <P>
  1394.  
  1395. On receipt of ButtonClick messages (apparently) to its main window the
  1396. remote task should check the icon handle and if it is equal to -&414350
  1397. treat the coordinates passed in the ButtonClick block as 'corrected' for the
  1398. position of its window, scrollbars etc as the coordinates are already
  1399. relative to the objects bottom left. Modify the object data as appropriate
  1400. and generate <A HREF="#update">Message_UpdateArea</A> as with standard PCA
  1401. practice.
  1402.  
  1403. <P>
  1404.  
  1405. You should be able to use the same code for remote and local actions just do
  1406. not convert pointer coordinates to be relative to your main window and do
  1407. not redraw your main window (it should be closed anyway).
  1408.  
  1409. <P>
  1410.  
  1411. Note: For 'painting' or 'dragging' type actions it is sometimes wise to set
  1412. the remote button type (in Message_HookMe) to Click and to do a tight
  1413. repeating 'loop' around your redraw/paint code, reading the mouse pointer
  1414. information directly until the button click stops. In this situation the
  1415. Remote task should make use of the information in the last
  1416. Message_ObjectPosition it receieved to work out the visible size and
  1417. position of the object in the Local task's window (see the !Spaint example).
  1418.  
  1419. <P>
  1420.  
  1421. <A HREF="#top">Return to Contents</A>
  1422. <HR>
  1423.  
  1424. <H1>
  1425. <A NAME="interface">
  1426. PCA User Interface specifications
  1427. </A>
  1428.  
  1429. </H1><AU>
  1430. Author  : Rob Davison (rdavison@xtra.co.nz)<BR>
  1431.  
  1432. Date    : 15/08/96<BR>
  1433.  
  1434. Status  : Release 1<BR>
  1435.  
  1436. </AU>
  1437. <P>
  1438.  
  1439. This documents the suggested user-interface and general message handling
  1440. requirements for applications on both sides of the PCA protocol. You should
  1441. note that it is possible for applications to implement either or both sides
  1442. of the protocol.
  1443.  
  1444. <P>
  1445.  
  1446. <H3>
  1447. Local application
  1448.  
  1449. </H3>
  1450. The local application must poll the PCA system with <A
  1451. HREF="#whos">Message_WhosAbout</A> and present that information to the user.
  1452. It is recommended that you provide several methods of doing this:
  1453.  
  1454. <P>
  1455.  
  1456. <H3>
  1457. Invoking the protocol
  1458.  
  1459. </H3>
  1460. Invoking the protocol scans the active tasks and presents a list of the
  1461. available utilities. This list can be presented in two ways; as a simple
  1462. RISC OS menu or as a graphical 'pop-up' window. You should support both
  1463. methods in your applications by providing a preferences option to the user.
  1464.  
  1465. <P>
  1466.  
  1467.  
  1468. To invoke the popup Ctrl-Shift-Double Click is recommended. If that shortcut
  1469. is not free another combination is acceptable, preferably related in some
  1470. way to the Ctrl-Double click Acorn OLE-1 standard.
  1471.  
  1472. <P>
  1473.  
  1474. In addition, add the PCA to your menu structure. The sub-menu item
  1475. "Utilities >" is appropriate.
  1476.  
  1477. <P>
  1478.  
  1479. Another alternative is to add a button to your toolbar to invoke the protocol.
  1480. <P>
  1481. <CENTER>
  1482. <IMG SRC="GRAPHICS/POPUP.gif" WIDTH=511 HEIGHT=253>
  1483. </CENTER>
  1484. <P>
  1485.  
  1486.  
  1487. <CENTER>
  1488. <B>
  1489. A typical PCA popup dialogue. All measurements in OS units
  1490.  
  1491. </B>
  1492. </CENTER>
  1493. <P>
  1494.  
  1495. The width of this dialogue should be set to the width of the longest tool
  1496. name returned in the <A HREF="#im">Message_ImHere</A> messages (which may be
  1497. found on the RiscPC using SWI Wimp_TextOp). Add 220 OS-units to the width of
  1498. all items to allow for the Tool icon and Info buttons. The height of each
  1499. item is fixed at 96 OS-units.
  1500.  
  1501. <P>
  1502.  
  1503. The tool icon is present in the Wimp sprite pool and is usually the PCA
  1504. applications icon. Applications which provide multiple 'tools' can register
  1505. more than once, passing a unique 'toolnumber' with <A
  1506. HREF="#im">Message_ImHere</A>.
  1507.  
  1508. <P>
  1509.  
  1510.  
  1511. The popup should be opened such that the pointer is centred over the top
  1512. tool name and as a menu so it automatically closes on any mouse access
  1513. outside it. If there are more than five PCAs available the popup dialogue
  1514. should be given a vertical scrollbar and the initial size limited to five
  1515. items. For a more detailed example, see the PCA version of Composition or
  1516. the dialogue creation and redraw code in !Spaint.
  1517.  
  1518. <P>
  1519.  
  1520. <B>Other options</B>
  1521. <P>
  1522.  
  1523. Several other options may be offered to the user by a Local task. Which are
  1524. practical depends on the application in question but the following may be
  1525. appropriate for a task which supports both sides of the protocol:
  1526.  
  1527. <P>
  1528.  
  1529. <CENTER>
  1530. <IMG SRC="GRAPHICS/prefs.gif" ALT="Preferences" WIDTH=382 HEIGHT=161 ALIGN="MIDDLE">
  1531. </CENTER>
  1532. <P>
  1533.  
  1534. The display radio buttons allow the user to choose the form of popup which
  1535. will be presented to the user. Menus are simpler and take up less desktop
  1536. space. Dialogue boxes look better and provide more information.
  1537.  
  1538. <P>
  1539.  
  1540. The In-place editing option should be provided by a Remote task. If no
  1541. objects are being edited then toggling this option simply prevents or allows
  1542. bit 4 of the flags word to be set in subsequent <A
  1543. HREF="#im">Message_ImHere</A> messages generated. If an object is being
  1544. edited in-place when this option is toggled the Remote task should switch
  1545. between in-place and remote operation on that object as the option is
  1546. toggled.
  1547.  
  1548. <P>
  1549.  
  1550. The 'Follow selected' option is provided by a Local task and, when on, the
  1551. last task sent a <A HREF="#do">Message_DoYourStuff</A> is automatically sent
  1552. a new <A HREF="#do">Message_DoYourStuff</A> every time the 'selected object'
  1553. changes. Obviously this option only has validity when there is a concept of
  1554. the 'selected object'.
  1555.  
  1556. <P>
  1557.  
  1558.  
  1559. <A HREF="#top">Return to Contents</A>
  1560. <HR>
  1561.  
  1562. <H1>
  1563. <A NAME="swis">
  1564. PCA support module SWIs
  1565. </A>
  1566. </H1>
  1567.  
  1568. Module  : PCASupport<P>
  1569. Version : 0.07 (12 August 1996)<P>
  1570. Chunk   : &4D6C0
  1571.  
  1572. <P>
  1573. <P>
  1574.  
  1575. The PCA support module is designed to facilitate the creation of PCA style
  1576. 'tags' in an area of shared memory. At a future date other useful PCA
  1577. related SWIs (eg. colaescing update area rectangles) may be added. In the
  1578. meantime the following SWIs are provided.
  1579.  
  1580. <p>
  1581.  
  1582. <pre>
  1583. <STRONG>SWI PCA_CreateTag</STRONG>
  1584. on entry -
  1585.  
  1586. r1 = address of base
  1587. r2 = Offset to object
  1588. r3 = size of object (optional)
  1589. r4 = flags/extension data (not in this version.)
  1590.  
  1591. on exit -
  1592.  
  1593. r0 = address of tag
  1594. (r1-r4 are written into the tag as initial values.)
  1595. All other registers preserved.
  1596.  
  1597.  
  1598. Errors returnable:
  1599.  
  1600. "This version of the PCA support module cannot create extended tags."
  1601. Produced if bits set in R4 (b0-15).
  1602.  
  1603. "This version does not resize the tag block on old hardware. (too many tags)."
  1604. Produced on pre-RPC hardware if more than 2048 tags are in use.
  1605.  
  1606.  
  1607. </pre><p>
  1608.  
  1609. <b>NOTE:</b> PCASupport relies on the first value of a valid tag not being
  1610. &FFFFFFFF (-1). NEVER write this value into the base field of the tag as the
  1611. next call to PCA_CreateTag will probably map your tag to another object -
  1612. causing chaos.
  1613.  
  1614. <p>
  1615. <pre>
  1616.  
  1617. <STRONG>SWI PCA_DeleteTag</STRONG>
  1618. on entry -
  1619.  
  1620. R0 = ptr to tag
  1621.  
  1622. on exit all registers preserved.
  1623.  
  1624. Errors returnable:
  1625. "Bad tag passed to PCASupport."
  1626.  
  1627.  
  1628. <STRONG>SWI PCA_DeleteAndKill</STRONG>
  1629. on entry -
  1630.  
  1631. R0 = ptr to tag
  1632. R1 = filetype of object
  1633.  
  1634. on exit all registers preserved.
  1635.  
  1636. </pre>
  1637.  
  1638. As well as the functionality of the above SWI this also broadcasts
  1639. Message_Deselect for you.
  1640.  
  1641. <P>
  1642.  
  1643.  
  1644. <A HREF="#top">Return to Contents</A>
  1645. <HR>
  1646.  
  1647.  
  1648.  
  1649. <H1>
  1650. <A NAME="licence">
  1651. Licence conditions
  1652. </A>
  1653.  
  1654. </H1>
  1655. <P>
  1656.  
  1657.  
  1658.  
  1659. You are invited to add the PCA standard to your programs and to create PCA
  1660. 'applets'. However, before publishing or distributing (in any form) a program
  1661. which makes use of the PCA standard you must first obtain a licence to do so
  1662. >from Clares Micro Supplies.
  1663. <P>
  1664.  
  1665. The licence is currently free of charge and early adopters will be guaranteed
  1666. that the license will remain free for a minimum of five years. We do not
  1667. have any plans to charge for a license but we do not want to preclude the
  1668. possibility at a later date - well would you ?<br>
  1669.  
  1670. <P>
  1671. PD Authors : We gurantee that your license will *always* be free.<p>
  1672.  
  1673. <P>
  1674.  
  1675. Licensing the PCA standard allows us to keep track of who is using it,
  1676. inform them of changes to the standard and provide support in the case of a
  1677. problem.
  1678.  
  1679. <P>
  1680.  
  1681.  
  1682. <B>
  1683. PCA Logo
  1684. </B>
  1685. <P>
  1686.  
  1687. The PCA logo may be used by licensed PCA developers to indicate PCA
  1688. compliancy. Licensed developers must not use the logo to suggest any Clares
  1689. approval or branding for their products.
  1690.  
  1691. <B><P>
  1692.  
  1693. <A NAME="contacts">
  1694. Contacts
  1695. </A>
  1696.  
  1697. </B>
  1698. <P>
  1699.  
  1700. <A HREF="mailto://DJackson@Clares.demon.co.uk">DJackson@clares.demon.co.uk</A> - Licensing details and project coordination.<BR>
  1701.  
  1702. <A HREF="mailto://rdavison@xtra.co.nz">
  1703. rdavison@xtra.co.nz
  1704. </A>           - Author of the standard.
  1705.  
  1706. <P>
  1707.  
  1708. <B>
  1709. <A NAME="disclaim">
  1710. Disclaimer
  1711. </A>
  1712.  
  1713. </B><P>
  1714.  
  1715. This standard is supplied 'as is'; neither Clares nor the author of the standard
  1716. make any warranty, whether express or implied, as to the merchantability of
  1717. the software or standard or its fitness for any purpose.
  1718. <P>
  1719.  
  1720. In no circumstances will Clares or the author of the standard be liable for
  1721. any damage, loss of profits, goodwill or for any indirect or consequential
  1722. loss arising from the use of this standard or software.
  1723. <P>
  1724.  
  1725. Implementation of the standard is deemed acceptance of these terms.
  1726.  
  1727. <P>
  1728. <A HREF="#top">Return to Contents</A>
  1729. <P>
  1730. <HR>
  1731. <A NAME="examples"></A>
  1732. <H1>PCA Compliant examples</H1>
  1733. <P>
  1734.  
  1735. We have prepared several examples of PCA applications in both C and BASIC.
  1736. They show different interfaces that can be used as well as an example of
  1737. 'In-Place' editing. <P>
  1738.  
  1739. Don't forget to let us know what applications you are writing to comply with
  1740. the standard. <A HREF="mailto://DClare@Clares.demon.co.uk">Clares</A> may be
  1741. interested in publishing any PCA applications that you write so please send
  1742. us a copy if this appeals to you.
  1743.  
  1744. <P>
  1745. The examples are compressed with Spark. Use either SparkFS or the PD
  1746. SparkPlug to decompress the files.
  1747.  
  1748.  
  1749. <P>
  1750. <A HREF="#top">Return to Contents</A>
  1751. <HR>
  1752. <FONT SIZE=1>
  1753. Last updated 28/08/96</FONT>
  1754. </BODY>
  1755. </HTML>
  1756.  
  1757.  
  1758.  
  1759.  
  1760.  
  1761.  
  1762.  
  1763.  
  1764.