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