Path: utzoo!attcan!uunet!decwrl!bacchus.pa.dec.com!shlump.nac.dec.com!mountn.dec.com!minow From: minow@mountn.dec.com (Martin Minow) Newsgroups: comp.sys.mac.programmer Subject: Re: questions, questions, questions.... Message-ID: <1797@mountn.dec.com> Date: 26 Jul 90 19:11:33 GMT References: <1990Jul25.192329.11315@sbcs.sunysb.edu> Reply-To: minow@bolt.enet.dec.com (Martin Minow) Organization: Digital Equipment Corporation Lines: 56 In article <1990Jul25.192329.11315@sbcs.sunysb.edu> rmiller@sbcs.sunysb.edu (Robert Miller) writes: >1. I would like to store the graphics in a PicHandle for easy updating. >What is the effect of calling DrawPicture when there is a picture definition >open? Dunno. You might consider keeping an offscreen GrafPort with a shadow of the graphics. Then, you code would be, roughly, draw into the offscreen grafport. Inval[Rect/Region] the boundaries of the drawing on the screen. Now, your update event handles all the drawing. The update event is trivial: CopyBits from the offscreen port onto the screen port. (You do roughly the same thing for color.) >2. I would like to keep the viewRect in the TextEdit record large >enough so that no lines wrap to the next line. That is, each line ends >with an end-of-line character. Would calculating the length of the longest >line be a problem? Look at the definition of crOnly in the TextEdit record. Calculating the width of a piece of text is messy, since you need to deal with styles and international (text direction) issues. Look at the TextEdit stuff in Inside Mac V for a start. Also, look at the Script Manager documentation (in the Sumex or apple.com archives?). If you "know" the text is old-style, you can just get pointers to the start and finish and call the Quickdraw measure routine TextWidth. >3. Is there a straightforward way of printing a Picture or a TextEdit >record? Yes. Rich Siegel posted a generic print manager handler a few months ago. Try to find it in the archives. It is very nice. Basically, you have to create a print task (straightforward: just follow the code in Inside Mac) and, for each page, just draw the page as if you were responding to an update event. I.e. your updateEvt handler is, more or less: GetPort(&savePort); SetPort(theWindow); BeginUpdate(theWindow); EraseRect(&theWindow->portRect); draw_everything(theWindow); EndUpdate(theWindow); SetPort(savePort); To print the drawing, just call draw_everything() with the print port. >I apologize if these questions are too simple, but sometimes it is >very hard to know where to look, even if supposedly everything is spelled >out in Inside Macintosh. No problem, and they're not quite as simple as you might imagine. (Besides, I didn't really answer them. :-) Martin Minow minow@bolt.enet.dec.com