Strona główna | English English
Attached
Powrót

(Uwaga: Ta strona jest dostępna tylko w języku angielskim. Jeśli uważasz, że powinna być przetłumaczona na polski, daj mi znać)


A sidebar to the Apple Macintosh preview published in Byte, issue 2/1984, pp. 37.

The User-Interface Toolbox

The User-Interface Toolbox
Ten obrazek może zostać powiększony
The toolbox (which occupies two-thirds of the high-speed 64K-byte ROM inside the Macintosh) includes optimized 68000 machine-language routines that handle all aspects of the Macintosh user interface – things like windows, text, the mouse, pull-down menus, desk accessories, dialogue boxes, and fonts. The figure below shows the relative relationships among the different units (or packages of routines). Here is a brief description of each unit, starting with the lowest-level unit and working up:

  • Resource Manager: These routines coordinate the use of resources, which are data structures such as text strings, menus, and icon and font definitions. These resources are kept separate from the actual code of an application, which means that the resources of an application can be modified without forcing a recompilation (or modification) of the application program. The Resource Manager is usually called by higher units like the menu and font managers.

  • Font Manager: This unit supports the use of various text fonts. It calls the resource manager when it needs to use a font not already in memory, and it is usually called by the Quickdraw unit.

  • Quickdraw: Quickdraw is a graphics package that is at the heart of both the Lisa and Macintosh computers. Bill Atkinson, its creator, worked for 3½ years on the code, rewriting it many times and reducing it from a 160K-byte compiled Pascal program to a 24K-byte package of highly optimized 68000 code. Atkinson, who was involved in the early design of the Lisa’s user interface, designed and optimized Quickdraw for the Lisa computer; he later joined the Macintosh design team. draw is very fast – for example, it can print to the screen more than 7000 characters per second. Two of its most interesting capabilities are its ability to fill in any arbitrary shape with a pattern and its ability to “clip” an image to correspond to the boundaries of an arbitrary masking shape. The latter ability is needed to correctly display window contents when one window overlaps others. The source code for Quickdraw is identical in both the Lisa and the Macintosh.

  • Event Manager: All system events (e.g., keypresses and mouse button presses) are received and interpreted through this unit, which mediates between the application program and the outside world.

  • Toolbox Utilities: These routines handle miscellaneous tasks that include string operations, fixed-point arithmetic, and bitwise logical operations.

  • Window Manager: Since all action on the Macintosh display occurs within windows, this is a very important unit that is used a lot. The Window Manager allows the application program to interact with windows on a high level while it takes care of the low-level details automatically. It allows you to create different kinds of boxes (document, dialogue, and alert boxes, for example), delete them, move them, change their size, and make an inactive window active and vice versa. The Window Manager ensures that the computer automatically redraws the necessary screen areas when some aspect of a window is changed.

  • Control Manager: This unit controls the use of software buttons, check boxes, and dials, all of which can be called on to show and alter the status of certain variables.

  • Menu Manager: Given a two-dimensional matrix of menu items (each column is a menu title followed by its selections), this unit controls the display and behavior of that matrix of pull-down menus.

  • Text Edit: These routines control elementary text entry and editing. Text Edit is designed with lots of software “hooks” so that you can modify its behavior but still use it. An external unit called Core Edit, which must be loaded into RAM, contains more sophisticated entry and editing routines; Core Edit can handle different fonts, sizes, and text styles.

  • Dialog Manager: Dialogue boxes are text boxes with several check boxes; usually, clicking the mouse button near a box selects it (and the action or condition associated with it) and unselects the previously checked box. An alert box (as in figure 1h) alerts you to a potentially dangerous situation and forces you to click on one of two buttons, “Cancel” or “OK.” The Dialog Manager handles the display of and user response to a dialogue or alert box.

  • Desk Manager: This unit allows the application program to use the desk accessories, which are resources that are called in from disk if they are not currently in memory.

Applications can be written in Mac BASIC, Mac Pascal, or 68000 assembly language (usually one of the latter two). Both Mac Pascal and Mac BASIC are designed so that their keywords directly call most of the toolbox routines. Most applications that use the routines are essentially an endlessly repeating loop that waits for an event, determines what kind of event it is, and then processes the event.



 
Strona dodana 20 stycznia 2004 roku.

Copyright © 2002-2005 Marcin Wichary
Wersja do druku | Kontakt | Mapa serwisu