rbp@investor.pgh.pa.us (Bob Peirce #305) (06/26/91)
I noticed the other night that nxyplot appears as an option in one of my menus. I think it was in WriteNow, possibly services, although I don't remember excatly. Anyhow, was this always there or did it just appear since I added nxyplot? If the former, why that particular program? If the latter, how does it know? At the time I just though, Isn't this neat? Now I am beginning to wonder what is going on. Is there some way to write a program so other programs will just know it is there and can be used by the calling program? How? (Note: I am not a developer. I have just begun to work through the IB tutorial and I am very ignorant.) -- Bob Peirce, Pittsburgh, PA rbp@investor.pgh.pa.us 412-471-5320 venetia@investor.pgh.pa.us [NeXT Mail] ...!uunet!pitt!investor!rbp [UUCP]
hardy@golem.ps.uci.edu (Meinhard E. Mayer (Hardy)) (06/27/91)
It wasn't always there -- in the preferences panel you can enable/disable "Plot with nxyplot" It appears in other applications too (such as the Stuart I am using now, Improv, Wordperfect, etc). Same with Squash ("Drop on squash") in Workspace. I presume that any properly written program can call "appropriate" services (Mathematica will not call nxyplot; neither does Emacs). Greetings, Hardy -------****------- Meinhard E. Mayer (Hardy); Department of Physics, University of California Irvine CA 92717; (714) 856 5543; hardy@golem.ps.uci.edu or MMAYER@UCI.BITNET
izumi@mindseye.berkeley.edu (Izumi Ohzawa) (06/27/91)
In article <1991Jun26.121521.9302@investor.pgh.pa.us> rbp@investor.pgh.pa.us (Bob Peirce #305) writes: >I noticed the other night that nxyplot appears as an option in one of my >menus. I think it was in WriteNow, possibly services, although I don't >remember excatly. Anyhow, was this always there or did it just appear >since I added nxyplot? If the former, why that particular program? If >the latter, how does it know? > >At the time I just though, Isn't this neat? Now I am beginning to >wonder what is going on. Is there some way to write a program so other >programs will just know it is there and can be used by the calling >program? How? (Note: I am not a developer. I have just begun to work >through the IB tutorial and I am very ignorant.) It is done by an inter-application communication mechanism called "services" in 2.x releases. An appropriately written application can advertise services it can provide to other applications. Application which provides services advertise what it can do in a section of the executable file (__ICON segment's __services section). This section is read by Workspace when it starts up, and the services are registered. Workspace also scans sections in __ICON segment for application icon, document icons, and info on what filename extensions belong to a particular application. In principle, any application with the "Services" menu which can send out data of appropriate type will have the menu item, and can use its service. What is very NEAT about services is that neither the service provider application nor the service requester (client) applications have to know the specifics of each other. A service provider does not have to know what other applications might use its services, and service client does not have to have any compiled-in information on how to request a particular service from a service provider. It's all done at run time with Workspace as the intermediary. Nxyplot can accept data type of straight ASCII, and tabular text. For example, NeXT's Mail app has a section "__request" of "__ICON" segment in Mail.app/Mail [I suppose __request works the same way as __services for backward compatibility.] This section is simply ascii text which contains: ------ Message: mailSelection Port: Mail Send Type: NeXT plain ascii pasteboard type Send Type: NeXT Rich Text Format v1.0 pasteboard type Send Type: NeXT Encapsulated PostScript v1.2 pasteboard type Send Type: NeXT TIFF v4.0 pasteboard type Menu Item: Mail/Selection Message: mailDocument Port: Mail Send Type: NeXT filename pasteboard type Menu Item: Mail/Document ----- What Mail advertises is that it can receive a selection of the type, plain ascii, RTF, EPS, and TIFF. It can also receive a whole document in a file, and for this it accepts a filename on the pasteboard. For more info, look at ReleaseNotes/AppKit.rtf in the on-line doc. Also, search with Librarian for: setServicesDelegate: See also NXSetServicesMenuItemEnabled(), NXIsServiceMenuItemEnabled(). Also, a plug for my app. MailHelper which is at FTP site in 2.0-release/sources directory. It is probably the simplest app which provides a few services consisting of just a short .m file other then xxx_main.m file. You will see how easy it is to provide neat services. There are also examples called AtYourService (from NeXT), and MailService in sources. Both of these are also at the archive sites. Izumi Ohzawa [ 大澤五住 ] USMail: University of California, 360 Minor Hall, Berkeley, CA 94720 Telephone: (415) 642-6440 Fax: (415) 642-3323 Internet: izumi@violet.berkeley.edu NeXTmail: izumi@pinoko.berkeley.edu
eht@cs.cmu.edu (Eric Thayer) (06/27/91)
If you are interested in programming the "Services |>" menu option, take a look at the AtYourService mini-example (see /pub/next/docs/MiniExamples on sonata.cc.purdue.edu). The other examples in this directory are very enlightening as well. A very nice service (sorry, couldn't resist)! ..eric