|
|
||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
|
OCTOBER 15th, 1997 What's NeXT? ARLEN BRITTON (abritton@webintosh.com) Behind the Scenes: The NeXTSTEP Pasteboard Thanks to the Macintosh, all modern GUIs and well-behaved applications can cut, copy, and paste; NeXTSTEP is no different. This is done by a bunch of code that can temporarily hold your cut or copied data until you want to paste it. The Mac OS calls this the Clipboard, while NeXTSTEP calls it the Pasteboard. At first glance this seems nothing more than a semantic distinction in terminology, but one with some very important differences for something that has become so ubiquitous. To the everyday user, the NeXTSTEP pasteboard appears identical to the Mac OS clipboard: you highlight the data you want to work with, then choose Cut (Command-x), Copy (Command-c) or Paste (Command-v). After choosing where you want to insert the pasteboard data, you issue the Paste command. You can duplicate your data by issuing the Paste command as many times as you like (Bart Simpson would find this a considerable time saver at the chalkboard), so long as no new data is put on the pasteboard, since it can only hold one thing at any given time. Actually, the NeXTSTEP pasteboard does more: it knows what types of data are available and can hold multiple copies of the same data, in different formats. To use an obvious example, let's say that you've copied some text from your word processor to the pasteboard. It now has at least two copies of that data, but in different formats: an ASCII text version and a Rich Text Format (RTF) version. If you then paste this data into another application such as a word processor or a page-layout program that understands RTF, you see the same thing as your original, all fonts and formatting included. If the application you choose to paste to doesn't understand RTF, then you get the ASCII text version, without fonts or formatting. This is also true of the Mac OS, but to a more limited extent. Communication is the Key You might think that having the same data on the pasteboard multiple times in various formats would really slow down your system. It would, so thankfully, NeXTSTEP gets around this problem nicely by having applications look at the data before it's put onto the pasteboard. Essentially, each application you're cutting or copying data from tells the pasteboard what data formats it has and how to ask for them. When you decide to paste that data, the application you're pasting to tells the pasteboard what format it wants and asks the pasteboard to get it. The pasteboard then gets that data, in the format requested and passes it through to the requesting application. All the other formats, if any, are never on the pasteboard because they weren't requested, and therefore aren't needed. If you paste something multiple times into different applications, it's possible to have all the data formats on the pasteboard; once there, it can be reused any number of times until new data is cut or copied. Even though this communication is taking place between the pasteboard and the applications, it's all done in the background, while the user is unaware of it. What's important to remember is that the data is being made easily available by a system-wide facility, which understands ASCII and RTF text, TIFF and EPS images, and PostScript fonts, to name a few. Of course, NeXTSTEP developers can use their own proprietary data formats, but they would be expected to make their data available to the pasteboard in a format understood by the OS so that other applications could inter-communicate. You may not realize it (and most people don't), but two other important features of NeXTSTEP, Drag & Drop and Services use a pasteboard to pass data between applications, but not the one used for cutting and pasting. It wouldn't be very helpful if your data on the pasteboard was wiped out every time you moved a file or used a service, so these pasteboards are separate and distinct. Building on a Foundation © All information presented on this site is copyrighted by The Mac Observer except where otherwise noted. No portion of this site may be copied without express written consent. Other sites are invited to link to any aspect of this site provided that all content is presented in its original form and is not placed within another frame. |
|||||||||||||||||||||||||||