TE RI AL The Mac OS X Environment MA Welcome to the wonderful world of Mac OS X, the next-generation operating system from Apple Computer! D The Mac OS X operating system powers modern Macintosh computers. After many long years and a few scrapped attempts to modernize the older Mac OS operating system, Apple released Mac OS X in April of 2001. Since then, Apple has released a steady stream of upgrades and system updates. This book was written around Mac OS X version 10.
Chapter 1 Applications Frameworks and UI Graphics and Media Core Operating System Figure 1-1 You are probably already familiar with the topmost layer: the applications that run on Mac OS X (like Mail, iTunes, Safari, and so on). These applications are all written against a collection of application frameworks. These frameworks are special libraries that provide the code and all the other resources (icons, translated strings, and so on) to perform common tasks.
The Mac OS X Environment Figure 1-2 5. Export a slide show as a QuickTime movie by choosing File ➪ Export. Slide Master writes out a QuickTime movie and opens it with QuickTime Player. 6. Save your document by choosing File ➪ Save. How It Works Slide Master is a document-based application, which means that it provides a user interface for individual documents. In this case, documents are collections of slides that you can sift through and export as QuickTime movies.
Chapter 1 QuickTime movies. But QuickTime also makes most, if not all, of its functionality available to applications through its framework interface. When you save a Slide Master document, the document file contains a list of image files that are part of your slide show, not the actual images themselves. As a result, these documents can be relatively small. Behind the scenes, Slide Master uses aliases to track these image files so that they can be found if the files are moved around on your disk.
The Mac OS X Environment Program, Process, Application — What’s the Difference? Much of the time you can use the terms program and process interchangeably to refer to something that’s executable. But these terms do have distinct definitions. The word program refers to a file on disk containing a series of computer instructions. When this file is executed (or run, launched, and so on) the computer starts processing the instructions in the file. Process describes the act of executing the file.
Chapter 1 The Kernel The heart of a Unix operating system is its kernel. The kernel is the program that loads when the computer is first turned on and is responsible for managing all the hardware resources available to the computer. The kernel is also responsible for running the other programs on the system, scheduling process execution so that they can share the central processing unit (CPU) and other resources, and preventing one process from seeing what another process is doing.
The Mac OS X Environment The system library takes the form of a dynamic library installed as /usr/lib/libSystem.B.dylib. Mac OS X also includes a framework called System.framework in /System/Library/Frameworks that refers to this library. The files that define the Darwin interface live in the /usr/include directory. By the way, neither of these directories is visible from Finder; Mac OS X actively hides much of the complexity of Darwin from the average Mac user.
Chapter 1 5. You can display more information about the files in your home directory by passing additional arguments, called flags, into ls. By using ls –l, you can build what is often called a long list. Again, your results may differ from what is printed here: Macintosh:~ sample$ ls total 0 drwx-----3 sample drwx-----3 sample drwx------ 17 sample drwx-----3 sample drwx-----4 sample drwx-----3 sample drwxr-xr-x 4 sample drwxr-xr-x 5 sample 6.
The Mac OS X Environment If no operands are given, the contents of the current directory are displayed. If more than one operand is given, non-directory operands are displayed first; directory and non-directory operands are sorted separately and in lexicographical order. The following options are available: -A List all entries except for . and ... Always set for the super- : 8. The arguments you are allowed to pass to a Unix command depend entirely on the command.
Chapter 1 Applications Frameworks and UI Quartz 2D OpenGL QuickTime Quartz Compositor Core Operating System Figure 1-4 Mac OS X provides a rich graphics library for doing two-dimensional drawing, called Quartz 2D. The Quartz 2D library is specific to Mac OS X, although it uses industry-standard graphic formats, such as PDF. Mac OS X also includes OpenGL for those interested in three-dimensional drawing.
The Mac OS X Environment The Quartz Compositor was designed with modern best practices for graphics in mind. For example, the drawing coordinate space uses floating-point values, allowing for sub-pixel precision and image smoothing. Compositing operations can take advantage of available hardware, such as the G4’s Altivec vector unit. Transparency is supported natively and naturally in all drawing operations.
Chapter 1 What Are PDF Files? PDF stands for Portable Document Format. The PDF standard was invented by Adobe as a means for describing documents that can be displayed or printed virtually anywhere. The file specification itself is open, meaning the public-at-large can view the format and write their own tools for reading and generating PDF documents. Adobe continues to own and develop the standard. Mac OS X reads and writes PDF documents as its preferred native image file format.
The Mac OS X Environment QuickTime Apple Computer invented QuickTime back in 1991 as a way to describe, author, and play back video on Macintosh computers running System 6 and System 7. Since then, QuickTime has exploded into a crossplatform library encompassing a variety of multimedia file formats and algorithms. QuickTime provides tools for working with digital video, panoramic images, digital sound, MIDI, and more.
Chapter 1 Applications Aqua User Interface Cocoa Carbon Java JDK Graphics and Media Core Operating System Figure 1-6 Each of these application frameworks is appropriate in different situations. In addition, these application frameworks are not mutually exclusive. An application may draw on features from all three frameworks. Cocoa The Cocoa application framework provides programmers with a means of building feature-rich Mac OS X applications quickly.
The Mac OS X Environment that made transitioning to a new core operating system impossible. In 1998, Apple set out to revise the traditional Mac OS API and eliminate these problems, which would give existing Macintosh developers an easy path for migrating their code to Mac OS X. This revised API was called Carbon. If you are interested in porting a traditional Mac OS application to Mac OS X, Carbon is a good place to start.
Chapter 1 focus on commonly available technologies and concepts. It is difficult to gain access to features unique to Mac OS X, such as the power of CoreGraphics, through Java’s application frameworks, because those features are not available on all Java systems. Because this book focuses on technologies specific to Mac OS X, we will not examine Java in further detail.
The Mac OS X Environment The information in the Apple Human Interface Guidelines is quite extensive. It covers all the user interface elements available within Mac OS X, such as windows, menus, controls, separators, text labels, and icons. All Mac OS X programmers should be familiar with the Apple Human Interface Guidelines in order to know what correct Aqua user interfaces are supposed to look like, and how they’re supposed to behave.
Chapter 1 Exercises 1. The apropos command returns a list of manual pages that match one or more keywords. Try entering the following commands into Terminal: a. apropos copy b. apropos copy file c. apropos “copy file” Which of these commands provides the best result? 2. 20 You have seen how you can use man to read the online help for a specific command. Type man man into Terminal and read about what man is capable of.