Macintosh Programming Techniques, Second Edition
From the originals
13 scansMachine-transcribed text and image descriptions. Check the linked original for uncertain words or fine print.
These are transcribed pages from the documents, not the full publications. Open the original for the remaining pages.
Image 1
New Technology Building Blocks Macintosh Programming Techniques SECOND EDITION A Foundation for all Macintosh Programmers CD-ROM INCLUDED Master the fundamentals of Macintosh programming Covers 68k and Power Macintosh techniques Includes advice on memory management, resources, and system calls CD-ROM includes a limited version of Symantec C++ for the Macintosh Series Editor: Tony Meadow Bear River Associates M&T BOOKS Dan Parks Sydow
A book cover with a dark background, large yellow title text, a blue banner, a photo of a hand reaching toward beige computers on the right, an orange vertical stripe on the left, a CD-ROM badge, and a bear river associates logo.
Reading notes: Small logo text near the bottom left (Bear River Associates) and the M&T Books mark are partially stylized and were transcribed as shown; the small text under the Series Editor line may be slightly imprecise.
- Printed product names
- Symantec C++ for the Macintosh
- Printed dates
- Second Edition
- Languages
- English
PDF page 1
New Technology Building Blocks Macintosh Programming Techniques SECOND EDITION A Foundation for all Macintosh Programmers CD-ROM INCLUDED Master the fundamentals of Macintosh programming Covers 68k and Power Macintosh techniques Includes advice on memory management, resources, and system calls CD-ROM includes a limited version of Symantec C++ for the Macintosh Series Editor: Tony Meadow Bear River Associates M&T BOOKS Dan Parks Sydow
Book cover with a dark green and black background, large yellow title text, a blue banner, a CD-ROM badge, and a photo of a hand reaching toward beige computers and a monitor.
Reading notes: Small text in the photo area and the publisher logo text may be imprecise; the 'Bear River Associates' logo text is partly stylized.
- Printed product names
- Symantec C++
- Languages
- English
PDF page 2
MACINTOSH PROGRAMMING TECHNIQUES, 2E
A cover-style title page with a vertical dark gray bar on the left displaying the large white letters M, P, and T, with the bold title text in dark type between two horizontal black rules on a plain white background.
Reading notes: Vertical letters M, P, T on the gray bar are stylized initials and were transcribed as part of the title block; the handwritten mark at top right is not legible text and was omitted.
- Printed product names
- Macintosh Programming Techniques, 2E
- Languages
- English
PDF page 3
Macintosh Programming Techniques, 2E
MACINTOSH PROGRAMMING TECHNIQUES, 2E MPT Dan Sydow M&T BOOKS
A book title page with a large vertical dark bar containing the letters M, P, T in white, horizontal rules above and below the title, the author name Dan Sydow in bold beneath, and the M&T Books logo at the bottom center, with faint bleed-through text from the reverse page visible on the right.
Reading notes: Faint bleed-through text from the reverse side of the page on the right edge and background is not transcribed because it is not legible. Title is set in stylized display type; the letters M, P, T are set in the vertical bar and read as MPT.
- Printed product names
- Macintosh Programming Techniques, 2E
- Languages
- English
PDF page 4
Macintosh programming techniques
M&r ~ M&T Books [ '·1111 ~ A Division of MIS:Press, Inc. 11111':: A Subsidiary of Henry Holt and Company, Inc. 115 West 18th Street New York, New York 10011 © 1996 by M&T Books Printed in the United States of America All rights reserved. No part of this book may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage and retrieval system, without prior written permission from the Publisher. Contact the Publisher for information on foreign rights. Limits of Liability and Disclaimer of Warranty The Author and Publisher of this book have used their best efforts in preparing the book and the programs contained in it. These efforts include the development, research, and testing of the theories and programs to determine their effectiveness. The Author and Publisher make no warranty of any kind, expressed or implied, with regard to these programs or the documentation contained in this book. The Author and Publisher shall not be liable in any event for incidental or consequential damages in con- nection with, or arising out of, the furnishing, performance, or use of these programs. All products, names and services are trademarks or registered trademarks of their respective companies. Library of Congress Cataloging-in-Publication Data Sydow. Dan Parks. Macintosh programming techniques I Dan Parks Sydow. -- 2nd ed. p. Cm. ISBN 1-55851-458-9 1. Macintosh (Computer)--Programming. I. Title. QA76.8.M3S9582 1996 005.265--dc20 95-51548 10987654321 Associate Publisher: Paul Farrell Editor: Michael Sprague Copy Edit Manager: Shari Chappell Managing Editor: Cary Sullivan Technical Editor: Peter Ferranti Copy Editor: Suzanne Ingrao Production Editor: Maya Riddick CIP
Reading notes: Publication date 1996 and 'dc20' cataloging code may be partly garbled; 'Sydow. Dan Parks.' author line has uncertain word order OCR spacing irregularities in the 'M&T Books' and ISBN fields
- Printed dates
- 1996 · 95-51548
- Languages
- English
PDF page 5
The image is an entirely blank white page with no visible artwork, layout elements, or text.
PDF page 6
ficKnOWLEDGMEnTS Michael Sprague, Development Editor, M&T Books, for keeping things rolling and on schedule. Maya Riddick, Production Editor, M&T Books, for such a fine page layout effort. Carole McClendon, Waterside Productions, for making this book happen.
Reading notes: Heading 'ficKnOWLEDGMEnTS' appears to be a stylized or OCR-affected rendering of 'ACKNOWLEDGMENTS'; uncertain whether it is a primary heading.
- Languages
- English
PDF page 7
flCIHTOSH PROGRAMMING TECHHIQOES, ZE Contents Why This Book is for You . . . . . . . . . . . . . . . .xx.I Introduction ... . • • . . . • . . . . . . . . . . . . . . •. .xx.Ill Chapter 1: Macintosh Programming Overview .. .1 Development Systems .......... .. .. . ........ ... ... .........1 Information Environments ...... . ..... . ............ ... ....2 Application Frameworks ............ .... .... . ..... ... ... .2 Programming Languages ............. ........... .. ... ....3 About Macintosh Programming .................. ..... . . . ...3 Bitrnapped Graphics .................... .. .. ....... . ... ... .4 Event-Driven Programming ............... .. ... ...... . .... . .5 Resources ............ . ....... . . ..... ................... .11 Resource Editors ........ ..... ................. .. .. . . . ..12 Creating a Resource File and a Resource Using ResEdit . .. ....13 Resources, Source Code, and Applications . .. ...... .........16 Resource Types ............ ......... .... .. .............19 The Toolbox ........... . ..... ... ................... .. ... .19 vii
Reading notes: OCR noise in the running header, e.g. 'flCIHTOSH' and 'TECHHIQOES' Page-number and table-of-contents layout may affect reading order
- Printed product names
- Macintosh · ResEdit
- Languages
- English
PDF page 8
viii Macintosh Programming Technlqaa. ZE Resources, Source Code, and the Toolbox ...................21 Toolbox Routines and Application-Defined Routines .........24 The Operating System .....................................25 System Software .........................................26 The System File and Finder ................................27 The System File ........................................27 The Finder ............................................28 Chapter Program: VeryBasics ............................... 30 Program Project: VeryBasics68K.μ or VeryBasics68K.7t ........32 Program Listing: VeryBasics.c ........................... .41 Stepping through the Code ..............................43 Chapter Summary ........................................51 Chapter Z: Macintosh Memory . . . . . . . . . . . .53 Memory Organization .....................................53 System Partition Organization ........................... .56 Application Partition Organization ........................57 Summary of Memory Organization .......................61 The Application Heap .....................................63 Heap Fragmentation ....................................63 Heap Compaction .......................................65 Nonrelocatable and Relocatable Blocks .....................67 Macintosh Memory Management ...........................72 Avoiding Heap Fragmentation ..............................74 How Nonrelocatable Blocks Get Created ...................74 Nonrelocatable Blocks and Heap Fragmentation .............76 Nonrelocatable Block Placement in the Heap ................77 Reserving Memory to Reduce Fragmentation ............... 79 Heap Management .......................................84 Allocating Master Pointer Blocks ..........................84
Reading notes: Source text is a table of contents with OCR damage in the header line ("Technlqaa.") and chapter title lines. Page numbers and reading order in the table of contents are partly garbled.
- Languages
- English
PDF page 9
Contents ix Expanding the Heap ....................................89 Setting the Application Partition Size of a Program ............. 90 The User's Role in Setting the Partition Size ................ 90 Setting an Application's Partition Size .....................92 Determining Your Application's Memory Needs .............93 Writing 32-Bit Clean Programs ..............................98 Chapter Program: MemoryBasics .......................... 101 Program Resources: MemoryBasics.rsrc ................... 103 Program Listing: MemoryBasics.c ........................ 103 Stepping through the Code ............................. 105 Chapter Summary ....................................... 107 Chapter 3: QuickDraw Graphics ......... . 109 About QuickDraw and Color QuickDraw ................... 110 Initializing QuickDraw ................................. 110 Pixels and the Coordinate System ........................111 Graphics Ports ..........................................112 The GrafPort and GrafPtr ...............................113 Color Windows and the CGrafPort .......................114 The Graphics Pen .....................................116 Defensive Drawing ......................................118 Changing Ports .......................................118 Changing Characteristics of a Port ....................... 120 Drawing Shapes .........................................122 Working with Rectangles ...............................123 Working with Ovals ...................................125 Working with Round Rectangles .........................127 Patterns ................................................129 The PAT Resource .....................................129 The PAT Source Code ..................................131
Reading notes: Source is a table of contents with dotted leaders and page numbers; no headline, product names, prices, or dates are printed. Some lines contain OCR-like spacing irregularities and possible dropped characters.
- Languages
- English
PDF page 10
x Macintosh Programming Techniques. ZE The ppat Color Pattern Resource .........................133 The ppat Color Pattern Source Code ......................134 Pictures and Animation ..................................137 The PICT Resource ....................................137 Displaying a PICT in a Program .........................139 Using PICT Resources to Create Animation ................143 Pictures as Patterns ......................................148 Converting a Picture to a ppat Resource Using Pict2ppat ..... 148 The Cursor .............................................153 Chapter Program: QuickDrawing ..........................157 Program Resources: QuickDrawing.rsrc ...................158 Program Listing: ResourceUser.c .........................159 Stepping through the Code .............................164 Chapter Summary .......................................166 Chapter 4: Working with Windows ....... .169 Windows Primer ........................................ 170 The WIND Resource ................................... 170 Loading a WIND ...................................... 170 The WindowRecord, WindowPtr and WindowPeek .........171 Event Handling .........................................173 Windows and Events ....................................178 Mouse Down Events ...................................179 Single-Window Techniques ...............................184 Activate Events .......................................185 Updating a Window ...................................185 Simple Window Techniques .............................191 Multiple-Window Techniques .............................193 Expanding the WindowRecord .......................... 194 Activates and Multiple Windows ........................199
Reading notes: Source appears to be a table of contents fragment with page numbers and no headline or advertised content. Leading and trailing text is cut off, so the first and last entries may be incomplete.
- Languages
- English
PDF page 11
Contents xi Updates and Multiple Windows ......................... 201 Chapter Program: MultiWindows .......................... 202 Program Resources: MultiWindows.rsrc ................... 203 Program Listing: MultiWindows.c ........................ 204 Stepping Through the Code .............................214 Chapter Summary .......................................238 Chapter 5: Dealing with Dialog Boxes .... .241 Alerts .................................................242 Alert Resources: ALRT and DITL ........................242 Alert Source Code .....................................244 Dialog Boxes ...........................................246 Dialog Box Resources ....................................247 Dialog Item Types .....................................247 The DLOG and DITL Resources .........................248 Working with Dialog Items ...............................255 Getting Dialog Box Item Information .....................255 Working with Edit Text Items ...........................256 Working with Checkbox Items ...........................258 Working with Radio Button Items ........................259 Modal Dialog Boxes ..................................... 260 The DialogRecord Data Structure ........................ 260 Modal Dialog Box Source Code ..........................262 Modeless Dialog Boxes ...................................265 Using User Items ........................................ 270 The User Item Resource ................................ 270 The User Item Source Code ..............................271 Chapter Program: DialogPlus .............................279 Program Resources: DialogPlus.rsrc ......................281 Program Listing: DialogPlus.c ...........................283
Reading notes: Source appears to be a table of contents with page numbers; no headline is printed. Some section entries contain irregular spacing from extraction.
- Languages
- English