home *** CD-ROM | disk | FTP | other *** search
/ ftp.mactech.com 2010 / ftp.mactech.com.tar / ftp.mactech.com / csmpdigest / csmp-digest-v3-080 < prev    next >
Text File  |  2010-09-21  |  41KB  |  1,310 lines

  1. Received-Date: Wed, 25 Jan 1995 11:10:41 +0100
  2. From: pottier@clipper.ens.fr (Francois Pottier)
  3. Subject: csmp-digest-v3-080
  4. To: csmp-digest@ens.fr
  5. Date: Wed, 25 Jan 1995 11:10:35 +0100 (MET)
  6. X-Mailer: ELM [version 2.4 PL23]
  7. Mime-Version: 1.0
  8. Content-Type: text/plain; charset=ISO-8859-1
  9. Content-Transfer-Encoding: 8bit
  10. Errors-To: listman@ens.fr
  11. Reply-To: pottier@clipper.ens.fr
  12. X-Sequence: 86
  13.  
  14. C.S.M.P. Digest             Wed, 25 Jan 95       Volume 3 : Issue 80
  15.  
  16. Today's Topics:
  17.  
  18.         Any special tricks for patching _Launch?
  19.         Auto Power on-off info anyone?
  20.         Bad Error in new MacTCP.h universal header file
  21.         Help! Regarding INITs
  22.         How do I do a scrolling list box?
  23.         Latest QuickTime Tech Notes
  24.         OpenDoc mailing list or FAQ?
  25.         Q: Bedrock Exception Library Questions
  26.         help with CLUT-Palette management
  27.  
  28.  
  29.  
  30. The Comp.Sys.Mac.Programmer Digest is moderated by Francois Pottier
  31. (pottier@clipper.ens.fr).
  32.  
  33. The digest is a collection of article threads from the internet newsgroup
  34. comp.sys.mac.programmer.  It is designed for people who read c.s.m.p. semi-
  35. regularly and want an archive of the discussions.  If you don't know what a
  36. newsgroup is, you probably don't have access to it.  Ask your systems
  37. administrator(s) for details.  If you don't have access to news, you may
  38. still be able to post messages to the group by using a mail server like
  39. anon.penet.fi (mail help@anon.penet.fi for more information).
  40.  
  41. Each issue of the digest contains one or more sets of articles (called
  42. threads), with each set corresponding to a 'discussion' of a particular
  43. subject.  The articles are not edited; all articles included in this digest
  44. are in their original posted form (as received by our news server at
  45. nef.ens.fr).  Article threads are not added to the digest until the last
  46. article added to the thread is at least two weeks old (this is to ensure that
  47. the thread is dead before adding it to the digest).  Article threads that
  48. consist of only one message are generally not included in the digest.
  49.  
  50. The digest is officially distributed by two means, by email and ftp.
  51.  
  52. If you want to receive the digest by mail, send email to listserv@ens.fr
  53. with no subject and one of the following commands as body:
  54.     help                        Sends you a summary of commands
  55.     subscribe csmp-digest Your Name    Adds you to the mailing list
  56.     signoff csmp-digest            Removes you from the list
  57. Once you have subscribed, you will automatically receive each new
  58. issue as it is created.
  59.  
  60. The official ftp info is //ftp.dartmouth.edu/pub/csmp-digest.
  61. Questions related to the ftp site should be directed to
  62. scott.silver@dartmouth.edu. Currently no previous volumes of the CSMP
  63. digest are available there.
  64.  
  65. Also, the digests are available to WAIS users.  To search back issues
  66. with WAIS, use comp.sys.mac.programmer.src. With Mosaic, use
  67. http://www.wais.com/wais-dbs/comp.sys.mac.programmer.html.
  68.  
  69.  
  70. -------------------------------------------------------
  71.  
  72. >From valuefax@netcom.com (Pancomm)
  73. Subject: Any special tricks for patching _Launch?
  74. Date: Mon, 9 Jan 1995 05:35:42 GMT
  75. Organization: NETCOM On-line Communication Services (408 261-4700 guest)
  76.  
  77. Greetings,
  78.    Are there any special tricks for patching _Launch? I am trying to 
  79. patch _Launch to determine if a program from a particular set is being 
  80. started. I catch the launch of Multifinder on startup but after that I 
  81. don't catch anything. I suspect Multifinder overrides my patch and does 
  82. not bother to call my patch routine before or after it does its thing. 
  83. What am I doing wrong? My other patches (_ExitToShell, _Open, _Close) are 
  84. working fine so I am sure my method of patching is working. This is on 
  85. system 7.5 but earlier systems probable behave the same.
  86.  
  87.    Please help with any pointers or suggestions. Users of ValueFax and 
  88. myself will be very grateful.
  89.  
  90. TIA.
  91. Pancomm.
  92.  
  93. +++++++++++++++++++++++++++
  94.  
  95. >From haynes@asel.udel.edu (Carl W. Haynes III)
  96. Date: Mon, 09 Jan 1995 02:49:43 -0500
  97. Organization: Univ. of Delaware
  98.  
  99. In article <valuefaxD24I7J.50v@netcom.com>, valuefax@netcom.com (Pancomm) wrote:
  100.  
  101. > Greetings,
  102. >    Are there any special tricks for patching _Launch? I am trying to 
  103. > patch _Launch to determine if a program from a particular set is being 
  104. > started. I catch the launch of Multifinder on startup but after that I 
  105. > don't catch anything. I suspect Multifinder overrides my patch and does 
  106. > not bother to call my patch routine before or after it does its thing. 
  107.  
  108. I think you're right about Multifinder patching out _Launch, How about
  109. patching _InitGraf instead, or patching GetResource (looking for 'CODE'
  110. resource 0).
  111.  
  112. carl
  113.  
  114. -- 
  115. Get1Resource -- A Mac Programming WebZine
  116. http://www.asel.udel.edu/~haynes/g1r.html
  117.  
  118. +++++++++++++++++++++++++++
  119.  
  120. >From quinn@cs.uwa.edu.au (Quinn "The Eskimo!")
  121. Date: Tue, 10 Jan 1995 09:38:15 +0800
  122. Organization: Department of Computer Science, University of Western Australia
  123.  
  124. In article <haynes-0901950249430001@abyss.asel.udel.edu>,
  125. haynes@asel.udel.edu (Carl W. Haynes III) wrote:
  126.  
  127. >In article <valuefaxD24I7J.50v@netcom.com>, valuefax@netcom.com (Pancomm)
  128. wrote:
  129. >
  130. >>    Are there any special tricks for patching _Launch? I am trying to 
  131. >> patch _Launch to determine if a program from a particular set is being 
  132. >> started. I catch the launch of Multifinder on startup but after that I 
  133. >> don't catch anything. I suspect Multifinder overrides my patch and does 
  134. >> not bother to call my patch routine before or after it does its thing. 
  135.  
  136. Yep.
  137.  
  138. >I think you're right about Multifinder patching out _Launch, How about
  139. >patching _InitGraf instead, or patching GetResource (looking for 'CODE'
  140. >resource 0).
  141.  
  142. Yep, patching _InitGraf is a better way of doing it.  Be careful if you do
  143. it that way though, things calling _InitGraf may not be applications.  For
  144. example any INIT that shows an icon calls _InitGraf.  There are also a
  145. variety of other, infrequently used, Toolbox traps that you can patch that
  146. most applications will call when they start up.
  147.  
  148. I have successfully managed to patch _Launch but I needed to prevent
  149. launches rather than just monitor them.  I wouldn't recommend my method (:
  150.  
  151. Don't you just wish that support for this was in the Process Manager???
  152.  
  153. Share and Enjoy.
  154. --
  155. Quinn "The Eskimo!"  "Ah, so that's the secret,
  156.                       if only Captain Bipto had known.
  157.  
  158. ---------------------------
  159.  
  160. >From david.matusow@gsfc.nasa.gov (David Matusow)
  161. Subject: Auto Power on-off info anyone?
  162. Date: Mon, 09 Jan 1995 11:01:15 -0500
  163. Organization: NASA Goddard Space Flight Center -- Greenbelt, Maryland USA
  164.  
  165. I was wondering if anyone knows how apple's Auto Power On/Off control
  166. panel does the power on?  How does the program run when the Mac is off,
  167. and is there some way for us developers to do a similar thing?
  168.  
  169. Thanks,
  170. --David
  171.  
  172. -- 
  173. David Matusow
  174. NASA - GSFC
  175. email -> david.matusow@gsfc.nasa.gov
  176.  
  177. +++++++++++++++++++++++++++
  178.  
  179. >From Jeff@purple.com (Jeff Abrahamson)
  180. Date: 11 Jan 1995 22:07:17 -0500 (EST)
  181. Organization: Purple Software
  182.  
  183.  
  184. In article <david.matusow-0901951101150001@129.188.12.62>
  185. david.matusow@gsfc.nasa.gov (David Matusow) writes:
  186. >I was wondering if anyone knows how apple's Auto Power On/Off control
  187. >panel does the power on?  How does the program run when the Mac is off,
  188. >and is there some way for us developers to do a similar thing?
  189.  
  190. It's pretty clever, actually. It makes use, as you may have guessed since you
  191. posted this, of the Subspace Manager (see Develop, issue 7). When you request
  192. the Auto on/off control panel to turn your Mac on at a certain time, it uses
  193. the Subspace Manager to request a Mac in an alternate universe to signal your
  194. Mac at the appropriate time. The Subspace circuitry may be activated even when
  195. main power is off (it's a very low power device), and it is thus able to raise
  196. a power on signal, bringing up your Mac.
  197.  
  198. Note that the apparent lack of correlation between our time line and time lines
  199. in parallel universes allows the Mac in the parallel universe to send the
  200. signal to start your Mac almost immediately after receiving the signal from
  201. your Mac. This increases reliability, since it's unlikely the Mac in the
  202. alternate universe will be off when you need it. See the appropriate header
  203. files in the Subspace section of the MacOS SDK. (The SubspaceParamBlock has a
  204. field for time, although this is usually left zero, meaning default time.)
  205.  
  206. Originally Apple was going to use the Advanced Time Services Manager, but it
  207. was a bit tricky to signal the same Mac in the future, even with the ATSM-aware
  208. chips, and those chips were eventually cut by Apple anyway, canning the
  209. project.
  210.  
  211. Contact Jens Alfke for further information on ATSM. I think he wrote the
  212. definitive article on it last year in csmp....
  213.  
  214.  
  215.  Jeff Abrahamson
  216.  PDI
  217.  
  218.  jeff@purple.com
  219.  jeff31415@aol.com
  220.  
  221.  
  222.  
  223. ---------------------------
  224.  
  225. >From j-norstad@nwu.edu (John Norstad)
  226. Subject: Bad Error in new MacTCP.h universal header file
  227. Date: Sat, 07 Jan 1995 21:07:01 -0600
  228. Organization: Northwestern University
  229.  
  230. There's a bad error in the new MacTCP.h file in version 2.0a3 of Apple's
  231. universal headers (at least, in the copy on the new CodeWarrior Release 5
  232. CD). If your program uses MacTCP, and you are working with the new
  233. MacTCP.h file, this could be rather important.
  234.  
  235. TCPSendPB is defined as follows in MacTCP.h:
  236.  
  237. struct TCPSendPB {
  238.         SInt8           ulpTimeoutValue;
  239.         SInt8           ulpTimeoutAction;
  240.         SInt8           validityFlags;
  241.         UInt8           filler; /* Filler for proper byte alignment */
  242.         Boolean         pushFlag;
  243.         Boolean         urgentFlag;
  244.         Ptr             wdsPtr;
  245.         unsigned long   sendFree;
  246.         unsigned short  sendLength;
  247.         Ptr             userDataPtr;
  248. };
  249.  
  250. The filler byte is in the wrong place. The proper definition is:
  251.  
  252. struct TCPSendPB {
  253.         SInt8           ulpTimeoutValue;
  254.         SInt8           ulpTimeoutAction;
  255.         SInt8           validityFlags;
  256.         Boolean         pushFlag;
  257.         Boolean         urgentFlag;
  258.         UInt8           filler; /* Filler for proper byte alignment */
  259.         Ptr             wdsPtr;
  260.         unsigned long   sendFree;
  261.         unsigned short  sendLength;
  262.         Ptr             userDataPtr;
  263. };
  264.  
  265. For example, if you try to set the push flag with the bogus version of the
  266. MacTCP.h header file, you send up setting the urgent flag instead! This
  267. caused big problems with a new version of NewsWatcher I released
  268. yesterday.
  269.  
  270. Moral: People who live on the edge and are the first to use new
  271. development tools (from Apple or elsewhere) sometimes fall off and get
  272. what they deserve.
  273.  
  274. -- 
  275. John Norstad
  276. Academic Computing and Network Services
  277. Northwestern University
  278. j-norstad@nwu.edu
  279.  
  280. ---------------------------
  281.  
  282. >From u567510@csi.uottawa.ca (Patricke Coutue the Firste)
  283. Subject: Help! Regarding INITs
  284. Date: 29 Dec 1994 12:26:54 GMT
  285. Organization: Dept. of Computer Science, University of Ottawa
  286.  
  287. On the subject of INITs, is there a way to time when the INIT runs? I want
  288. an INIT I am running to execute AFTER QuickTime, cause I want the INIT
  289. to play a .moov. Mind you, I get the "unimplemented trap" crash, which
  290. is incredibly annoying.
  291.  
  292. I am a complete and utter novice, any help with this project appreciated.
  293.  
  294.  
  295.  
  296.  
  297. +++++++++++++++++++++++++++
  298.  
  299. >From gurgle@dnai.com (Pete Gontier)
  300. Date: Thu, 29 Dec 1994 11:23:15 -0700
  301. Organization: cellular
  302.  
  303. In article <3du9ue$3m3@csi0.csi.UOttawa.CA>, u567510@csi.uottawa.ca
  304. (Patricke Coutue the Firste) wrote:
  305.  
  306. > On the subject of INITs, is there a way to time when the INIT runs? I want
  307. > an INIT I am running to execute AFTER QuickTime...
  308.  
  309. With respect to reliance on the way the system calls extensions, you have
  310. two options:
  311.  
  312.    (1)  Name your extension something alphabetically later than QuickTime,
  313.         document this fact, and hope that your users don't rename it.
  314.         Don't simply settle for telling them it must run last, because
  315.         that creates competition with other extensions which impose
  316.         similar requirements. I believe the usual thing to do is to prepend
  317.         a '~' onto whatever name you'd otherwise like to use.
  318.  
  319.    (2)  Have your installer put your extension in the System Folder so that
  320.         its name is less important. Users could still move your extension
  321.         into the Extensions folder, and Finder will offer to do so if the
  322.         user ever disables your extension by dragging it out of the System
  323.         Folder sub-tree and then enables it by dragging it onto the System
  324.         Folder icon.
  325.  
  326. Or, if QuickTime is not already present when your INIT is called, it can
  327. patch into some system routine and either:
  328.  
  329.    (1)  Wait for extension loading time to be over. (In general, but perhaps
  330.         not for your purposes, patching _Launch works, as do several other
  331.         things.)
  332.  
  333.    (2)  Check to see if QuickTime has been loaded every time that system
  334.         routine is called. (Patching CloseResFile and watching for QuickTime
  335.         being closed [see PBGetFCBInfo] might be useful here.)
  336.  
  337. Of course, you might wish to employ more than one of these techniques.
  338.  
  339. In all cases you must determine whether QuickTime is present before
  340. calling it. Although it is installed by default under System 7.5, users
  341. are perfectly capable of removing it.
  342.  
  343. ______________________________________________________________________________
  344.  Pete Gontier -- MacZealotry, Ink. -- gurgle@dnai.com
  345.  Where do I want to go today? Anywhere but Chicago.
  346.  
  347. +++++++++++++++++++++++++++
  348.  
  349. >From walkerj@math.scarolina.edu (James W. Walker)
  350. Date: Sat, 07 Jan 1995 21:31:11 -0500
  351. Organization: Dept. of Mathematics, Univ. of South Carolina
  352.  
  353. In article <ericstadD1v6tG.5Dx@netcom.com>, ericstad@netcom.com (Eric
  354. Stadtherr) wrote:
  355.  
  356. ...
  357. > If playing when the Finder starts up is good enough, just set up a
  358. > Notification Manager task to play the movie for you.  This will guarantee
  359. > that QuickTime has been loaded (if present).
  360.  
  361.  
  362. Slight "gotcha":  Certain extensions (Desktop Reset comes to mind) display
  363. a dialog during startup time, and cause notifications to fire
  364. prematurely.  The workaround is to make the response procedure reinstall
  365. the notification if the time is not ripe.
  366. -- 
  367.  Jim Walker
  368.  
  369. ---------------------------
  370.  
  371. >From timmyd@netcom.com (Tim DeBenedictis)
  372. Subject: How do I do a scrolling list box?
  373. Date: Tue, 10 Jan 1995 02:48:38 GMT
  374. Organization: NETCOM On-line Communication Services (408 261-4700 guest)
  375.  
  376. This is probably a FAQ, but...
  377.  
  378. How do I implement a scrolling list box in a modal dialog window?
  379. Does anybody know where I can find some reliable example code for this?
  380.  
  381. Thanks in advance,
  382.  
  383. Tim DeBenedictis
  384.  
  385.  
  386. +++++++++++++++++++++++++++
  387.  
  388. >From Lars Travers <ltravers@igc.apc.org>
  389. Date: 10 Jan 1995 16:51:40 GMT
  390. Organization: Tufts University
  391.  
  392. In article <timmydD26552.DED@netcom.com> Tim DeBenedictis,
  393. timmyd@netcom.com writes:
  394. >How do I implement a scrolling list box in a modal dialog window?
  395. >Does anybody know where I can find some reliable example code for this?
  396.  
  397. see the book _Macintosh Programming Secrets_ by Scott Knaster and Keith
  398. Rollin page 429 (2nd edition, Addison-Wesley Publishing).
  399.  
  400. +++++++++++++++++++++++++++
  401.  
  402. >From oster@netcom.com (David Phillip Oster)
  403. Date: Tue, 10 Jan 1995 17:09:35 GMT
  404. Organization: Netcom Online Communications Services (408-241-9760 login: guest)
  405.  
  406. In article <timmydD26552.DED@netcom.com> timmyd@netcom.com (Tim DeBenedictis) writes:
  407. >How do I implement a scrolling list box in a modal dialog window?
  408. >Does anybody know where I can find some reliable example code for this?
  409.  
  410. One way:
  411. in your resources:
  412. declare a user item in your ditl, and have your dialog be initially invisible.
  413.  
  414. in your program:
  415. GetNewDialog() to bring the dialog in.
  416. get your user item's rect.
  417. LNew() an appripriate listHnadle.
  418. Set the update procedure (i.e., the handle) of the user item to
  419. similarly to:
  420. static ListHandle myListHandle = NULL;
  421. static UpdateUPP    updateUPP = NULL;
  422.  
  423. static pascal void UpdateList(DialogPtr dp, short item){
  424.     LUpdate( dp->visRgn, myListHandle);
  425. }
  426.     GetItem(kDLOGsUserItem, &type, &id, &dontCare);
  427.     if(NULL != updateUPP){
  428.         updateUPP = NewUpdateUPP(UpdateList);
  429.     }
  430.     SetItem(kDLOGsUserItem, type, id, (Handle) updateUPP);
  431.  
  432. You can ignore the UPP stuff and just set UpdateList directly into SetItem
  433. if you don't care about fat binaries. The above schema doesn't need to be
  434. modified if you are compiling for a 68000 instead of PowerPC, since 
  435. UpdateUPP will expand to a variable of type procedure pointer, and 
  436. NewUpdateUPP() just returns its argument on the 68000. On the PowerPC
  437. an appropriate data structure will be allocated and initialized.
  438.  
  439.  
  440. last things:
  441. Remember to LDispose() you list handle when you are done with it.
  442. You'll need to filter events in ModalDialog() or in your event loop,
  443. and handle clicks in the userItem yourself, by passing them to LClick
  444. (convert from global to local.)
  445.  
  446. Figure a half day for the first one.
  447. -- 
  448. - ------- oster@netcom.com ----------
  449. "A man hears what he wants to hear and misremembers the rest."
  450.      -- Paul Simon, ("The Boxer")
  451.  
  452.  
  453. +++++++++++++++++++++++++++
  454.  
  455. >From mxmora@unix.sri.com (Matthew Xavier Mora)
  456. Date: Tue, 10 Jan 1995 10:00:48 -0800
  457. Organization: SRI International
  458.  
  459. In article <timmydD26552.DED@netcom.com>, timmyd@netcom.com (Tim
  460. DeBenedictis) wrote:
  461.  
  462. > This is probably a FAQ, but...
  463. > How do I implement a scrolling list box in a modal dialog window?
  464. > Does anybody know where I can find some reliable example code for this?
  465. > Thanks in advance,
  466. > Tim DeBenedictis
  467.  
  468.  
  469. Here is a snippet that I used from Steve Falkenburg. I was using it to 
  470. test Script compiling.
  471.  
  472.  
  473.  
  474. /*
  475.    Modal Dialog TextEdit useritem snippet
  476.    Steve Falkenburg-- MacDTS
  477.    
  478.    This snippet shows the steps necessary to implement a scrolling,
  479. editable text field
  480.    in a dialog.  You may want to do this if you will be requiring the user
  481. to enter more than
  482.    255 characters (the limit for editText items), if you want a different
  483. font for several
  484.    different editText items, or it you want to add scrolling support to an
  485. editible text item.
  486. */
  487.  
  488. #include <AppleScript.h>
  489. // constants
  490.  
  491. #define  kMyDialog      128
  492. #define  kInFront    (WindowPtr)-1L
  493. #define  kEditTextItem  2
  494. #define  kScrollerItem  3
  495. #define  kMargin        4
  496. #define  kPageLines     16
  497. #define  kScrollToTop   0
  498. #define  kScrollToBottom   1
  499. #define  kMaxLines      128
  500. #define  kOSACompile    5
  501. #define  kOSAExecute    6
  502.  
  503. #pragma mark Prototypes
  504.  
  505. void main(void);
  506. void InitStuff(void);
  507. void DoDialog(void);
  508. void SetupDialog(DialogPtr theDialog);
  509. void PrepareFreeDialog(DialogPtr theDialog);
  510.  
  511. pascal void EditTextDrawProc(DialogPtr theDialog,short theItem);
  512. pascal Boolean MyDialogFilter(DialogPtr theDialog,EventRecord *ev,short
  513. *itemHit);
  514. void HandleKeyPress(DialogPtr theDialog,char theChar);
  515. void HandleIdle(DialogPtr theDialog);
  516. void HandleActivate(DialogPtr theDialog);
  517. Boolean HandleMouse(DialogPtr theDialog,Point pt,short modifiers);
  518.  
  519. void HandleScroller(DialogPtr theDialog,Point pt);
  520. pascal void ScrollBarAction(ControlHandle theControl,short part);
  521. void ScrollText(DialogPtr theDialog,short lines);
  522. void ReAlignTextToScrollbar(DialogPtr theDialog);
  523. void ReAlignScrollbarToText(DialogPtr theDialog);
  524.  
  525. pascal Boolean MyTEClickProc(void);
  526.  
  527. ControlHandle GetScrollBar(DialogPtr theDialog);
  528. TEHandle GetTEHandle(DialogPtr theDialog);
  529.  
  530. #pragma mark Globals
  531.  
  532. ModalFilterUPP       gMyDialogFilterUPP ;
  533. UserItemUPP       gEditDrawUPP;
  534. TEClickLoopUPP    gTEClickLoopUPP;
  535. ControlActionUPP  gScrollBarUPP;
  536. extern OSAID            gContext;
  537.  OSAID            gScriptID;
  538.  
  539. #pragma mark -
  540.  
  541. /* main entry point */
  542.  
  543. //----------------------------------------------------------------
  544.    void main(void)
  545. //----------------------------------------------------------------
  546. {
  547.    InitStuff();
  548.    
  549.    DoDialog();
  550.    ExitToShell();
  551. }
  552.  
  553.  
  554. /* initialize the Mac managers */
  555.  
  556. //----------------------------------------------------------------
  557.    void InitStuff(void)
  558. //----------------------------------------------------------------
  559. {
  560.    InitGraf(&qd.thePort);
  561.    InitFonts();
  562.    InitWindows();
  563.    InitMenus();
  564.    TEInit();
  565.    InitDialogs(nil);
  566.    InitCursor();
  567.    FlushEvents(everyEvent,0);
  568.    gMyDialogFilterUPP = NewModalFilterProc(MyDialogFilter);
  569.    gEditDrawUPP = NewUserItemProc(EditTextDrawProc);
  570.    gTEClickLoopUPP = NewTEClickLoopProc(MyTEClickProc);
  571.    gScrollBarUPP = NewControlActionProc(ScrollBarAction);
  572.  
  573. }
  574.  
  575. //----------------------------------------------------------------
  576.    void DoCompile(DialogPtr theDialog)
  577. //----------------------------------------------------------------
  578. {
  579.    TEHandle te = GetTEHandle(theDialog);
  580.    Handle h;
  581.    
  582.    h = (**te).hText;
  583.    HLock(h);
  584.    gScriptID = CompileText(h);
  585.    HUnlock(h);
  586. }
  587.  
  588. //----------------------------------------------------------------
  589.    void DoExecute(gScriptID)
  590. //----------------------------------------------------------------
  591. {
  592.    short err;
  593.    
  594.       err = ExecuteScript( gScriptID);
  595. }
  596.  
  597. /* display dialog, and handle pretty standard ModalDialog loop.  The modal
  598. dialog loop doesn't
  599.    handle item hits to the scroll bar or text items.  These are handled
  600. through the filter
  601.    procedure
  602. */
  603.  
  604. //----------------------------------------------------------------
  605.    void DoDialog(void)
  606. //----------------------------------------------------------------
  607. {
  608.    DialogPtr theDialog;
  609.    short item;
  610.    ControlHandle checkBoxControl;
  611.    short iType;
  612.    Rect iRect;
  613.    
  614.    theDialog = GetNewDialog(kMyDialog,nil,kInFront);
  615.    SetupDialog(theDialog);
  616.    
  617.       InitCompiler();
  618.       
  619.    do {
  620.       ModalDialog(gMyDialogFilterUPP,&item);
  621.       switch (item) {
  622.          case  kOSACompile:
  623.             DoCompile(theDialog);
  624.             break;
  625.          case  kOSAExecute:
  626.             DoExecute(gScriptID);
  627.             break;
  628.       }  
  629.    } while (item!=ok);
  630.    
  631.    PrepareFreeDialog(theDialog);
  632.    DisposeDialog(theDialog);
  633. }
  634.  
  635.  
  636. /* Creates the necessary data structures necessary to use the textedit
  637. item in our dialog.  A
  638.    handle to the TextEdit record is stored in the Dialog's window refCon field.
  639. */
  640.  
  641. //----------------------------------------------------------------
  642.    void SetupDialog(DialogPtr theDialog)
  643. //----------------------------------------------------------------
  644. {
  645.    short iType;
  646.    Handle iHndl;
  647.    Rect iRect;
  648.    ControlHandle theControl; 
  649.    short fontNum;
  650.    TEHandle theTE;
  651.    
  652.    SetPort(theDialog);
  653.    
  654.    GetDialogItem(theDialog,kScrollerItem,&iType,(Handle
  655. *)&theControl,&iRect);   // set up the scroll bar
  656.    SetCtlMin(theControl,0);                              // (it's stored
  657. in a CNTL)
  658.    SetCtlMax(theControl,kMaxLines);
  659.  
  660.    GetDItem(theDialog,kEditTextItem,&iType,&iHndl,&iRect);
  661.    SetDItem(theDialog,kEditTextItem,iType,(Handle)gEditDrawUPP,&iRect);
  662.    
  663.    InsetRect(&iRect,kMargin,kMargin);
  664.    
  665.    GetFNum("\pgeneva",&fontNum);
  666.    TextFont(fontNum);
  667.    theTE = TENew(&iRect,&iRect);       // create our textedit item
  668.    GetFNum("\pchicago",&fontNum);
  669.    TextFont(fontNum);
  670.  
  671.    TESetClickLoop(gTEClickLoopUPP,theTE);    // callback for drag-scrolling
  672.    TEAutoView(true,theTE);             // turn auto-scroll on for text entry
  673.    
  674.    SetWRefCon(theDialog,(long)theTE);
  675. }
  676.  
  677.  
  678.  
  679. /* free the memory taken by the textedit record before closing the dialog
  680. */
  681.  
  682. void PrepareFreeDialog(DialogPtr theDialog)
  683. {
  684.    TEHandle theTE;
  685.    
  686.    theTE = GetTEHandle(theDialog);
  687.    TEDispose(theTE);
  688. }
  689.  
  690.  
  691. /* dialog user item draw procedure for text box.  It just calls FrameRect
  692. */
  693.  
  694. pascal void EditTextDrawProc(DialogPtr theDialog,short theItem)
  695. {
  696.    short iType;
  697.    Handle iHndl;
  698.    Rect iRect;
  699.    GrafPtr savePort;
  700.    
  701.    GetPort(&savePort);
  702.    SetPort(theDialog);
  703.    
  704.    GetDItem(theDialog,theItem,&iType,&iHndl,&iRect);
  705.    FrameRect(&iRect);
  706.    
  707.    SetPort(savePort);
  708. }
  709.  
  710.  
  711. /* this is the main dispatcher for events to be passed off to the scroll
  712. bar or textedit box.
  713.    looks sort of like a WaitNextEvent event handler.
  714. */
  715.  
  716. pascal Boolean MyDialogFilter(DialogPtr theDialog,EventRecord *ev,short
  717. *itemHit)
  718. {
  719.    char theChar;
  720.    
  721.    switch (ev->what) {
  722.       case keyDown:
  723.       case autoKey:
  724.          theChar = (ev->message & charCodeMask);
  725.          HandleKeyPress(theDialog,theChar);
  726.          return true;
  727.       case nullEvent:
  728.          HandleIdle(theDialog);
  729.          return false;
  730.       case activateEvt:
  731.          HandleActivate(theDialog);
  732.          return false;
  733.       case mouseDown:
  734.          return HandleMouse(theDialog,ev->where,ev->modifiers);
  735.       default:
  736.          return false;
  737.    }
  738. }
  739.  
  740.  
  741. /* dialog filter event handler for keypresses.  All keypresses are passed
  742. to the textedit box
  743. */
  744.  
  745. void HandleKeyPress(DialogPtr theDialog,char theChar)
  746. {
  747.    TEHandle theTE;
  748.  
  749.    theTE = GetTEHandle(theDialog);
  750.    TEKey(theChar,theTE);
  751.    ReAlignScrollbarToText(theDialog);
  752. }
  753.  
  754.  
  755. /* handler for null events.  used in our case to blink the insertion point
  756. */
  757.  
  758. void HandleIdle(DialogPtr theDialog)
  759. {
  760.    TEHandle theTE;
  761.  
  762.    theTE = GetTEHandle(theDialog);
  763.    TEIdle(theTE);
  764. }
  765.  
  766.  
  767. /* activate event handler.  we take this opportunity to call TEActivate to
  768. activate the textedit
  769.    box
  770. */
  771.  
  772. void HandleActivate(DialogPtr theDialog)
  773. {
  774.    TEHandle theTE;
  775.  
  776.    theTE = GetTEHandle(theDialog);
  777.    TEActivate(theTE);
  778. }
  779.  
  780.  
  781. /* mouse-down hander.  here, we see if the mousedown was in the scrollbar
  782. or in the textedit
  783.    record.  if in the textedit item, we call teclick.  If in the
  784. scrollbar, we call handlescroller
  785.    to do further processing
  786. */
  787.  
  788. Boolean HandleMouse(DialogPtr theDialog,Point pt,short modifiers)
  789. {
  790.    short iType;
  791.    Handle iHndl;
  792.    Rect textRect,scrollerRect;
  793.    TEHandle theTE;
  794.    GrafPtr savePort;
  795.    Boolean shiftDown,result;
  796.    ControlHandle theControl;
  797.    short part;
  798.    
  799.    GetPort(&savePort);
  800.    SetPort(theDialog);
  801.    
  802.    shiftDown = modifiers & shiftKey;
  803.    GlobalToLocal(&pt);
  804.    
  805.    GetDItem(theDialog,kEditTextItem,&iType,&iHndl,&textRect);
  806.    GetDItem(theDialog,kScrollerItem,&iType,&iHndl,&scrollerRect);
  807.    
  808.    if (PtInRect(pt,&textRect)) {
  809.       theTE = GetTEHandle(theDialog);
  810.       TEClick(pt,shiftDown,theTE);
  811.       result = true;
  812.    }
  813.    else if (PtInRect(pt,&scrollerRect)) {
  814.       HandleScroller(theDialog,pt);
  815.       result = true;
  816.    }
  817.    else
  818.       result = false;
  819.       
  820.    SetPort(savePort);
  821.    
  822.    return result;
  823. }
  824.  
  825.  
  826. /* here, we see which part of the scrollbar was clicked in by calling
  827. findcontrol.  trackcontrol
  828.    is then called with the appropriate action proc if in one of the
  829. buttons or page areas.  if
  830.    in the thumb, the text is simply re-aligned to the new scrollbar position
  831. */
  832.  
  833. void HandleScroller(DialogPtr theDialog,Point pt)
  834. {
  835.    short part;
  836.    ControlHandle theControl;
  837.    
  838.    part = FindControl(pt,theDialog,&theControl);
  839.    switch (part) {
  840.       case inUpButton:
  841.       case inDownButton:
  842.       case inPageUp:
  843.       case inPageDown:
  844.          TrackControl(theControl,pt,gScrollBarUPP);
  845.          break;
  846.       case inThumb:
  847.          TrackControl(theControl,pt,nil);
  848.          ReAlignTextToScrollbar(theDialog);
  849.          break;
  850.    }
  851. }
  852.  
  853.  
  854. /* trackcontrol callback used to determine which direction to scroll the
  855. text, and by how much.
  856.    once this is known, the text is scrolled, and the scrollbar adjusted.
  857. */
  858.  
  859. pascal void ScrollBarAction(ControlHandle theControl,short part)
  860. {
  861.    DialogPtr theDialog;
  862.    short lines;
  863.    short ctlValue,ctlMax,ctlMin;
  864.    
  865.    ctlMax = GetCtlMax(theControl);
  866.    ctlMin = GetCtlMin(theControl);
  867.    ctlValue = GetCtlValue(theControl);
  868.    
  869.    theDialog = (*theControl)->contrlOwner;
  870.    
  871.    switch (part) {
  872.       case inUpButton:
  873.          lines = -1;
  874.          break;
  875.       case inDownButton:
  876.          lines = 1;
  877.          break;
  878.       case inPageUp:
  879.          lines = -kPageLines;
  880.          break;
  881.       case inPageDown:
  882.          lines = kPageLines;
  883.          break;
  884.       default:
  885.          return;
  886.    }
  887.  
  888.    if ((ctlValue+lines)>ctlMax)
  889.       lines = ctlMax-ctlValue;
  890.    if ((ctlValue+lines)<ctlMin)
  891.       lines = ctlMin-ctlValue;
  892.       
  893.    if (lines!=0) {
  894.       ScrollText(theDialog,lines);
  895.       SetCtlValue(theControl,ctlValue+lines);
  896.    }
  897. }
  898.  
  899.  
  900. /* sets the text top line to be the same as the current scrollbar
  901. position.  this is called after
  902.    a thumb movement in the scrollbar.
  903. */
  904.  
  905. void ReAlignTextToScrollbar(DialogPtr theDialog)
  906. {
  907.    TEHandle theTE;
  908.    ControlHandle scrollBar;
  909.    short controlScrollPosition,textScrollPosition,scrollDelta,scrollPix;
  910.    
  911.    theTE = GetTEHandle(theDialog);
  912.    scrollBar = GetScrollBar(theDialog);
  913.    
  914.    controlScrollPosition = GetCtlValue(scrollBar);
  915.    textScrollPosition = ((**theTE).viewRect.top - (**theTE).destRect.top)
  916. / (**theTE).lineHeight;
  917.    scrollDelta = textScrollPosition - controlScrollPosition;
  918.    scrollPix = scrollDelta * (*theTE)->lineHeight;
  919.    TEScroll(0,scrollPix,theTE);
  920. }
  921.  
  922.  
  923. /* sets the scrollbar thumb to the current text position.  this is called
  924. after autoscrolling,
  925.    which may occur after a call to TEKey, or during a drag-scroll
  926. */
  927.  
  928. void ReAlignScrollbarToText(DialogPtr theDialog)
  929. {
  930.    TEHandle theTE;
  931.    ControlHandle scrollBar;
  932.    short textScrollPosition;
  933.       
  934.    theTE = GetTEHandle(theDialog);
  935.    scrollBar = GetScrollBar(theDialog);
  936.    
  937.    textScrollPosition = ((**theTE).viewRect.top - (**theTE).destRect.top)
  938. / (**theTE).lineHeight;
  939.    SetCtlValue(scrollBar,textScrollPosition);
  940. }
  941.  
  942.  
  943. /* scrolls the text by the delta passed in to the function.  called in
  944. response to clicking the
  945.    arrows or page areas of the scrollbar to move the text
  946. */
  947.  
  948. void ScrollText(DialogPtr theDialog,short lines)
  949. {
  950.    TEHandle theTE;
  951.    short scrollPix;
  952.    short textScrollPosition;
  953.    
  954.    theTE = GetTEHandle(theDialog);
  955.  
  956.    textScrollPosition = ((**theTE).viewRect.top - (**theTE).destRect.top)
  957. / (**theTE).lineHeight;
  958.    if ((textScrollPosition+lines)<0)
  959.       lines = -textScrollPosition;
  960.    if ((textScrollPosition+lines)>kMaxLines)
  961.       lines = kMaxLines-textScrollPosition;
  962.             
  963.    scrollPix = lines * (*theTE)->lineHeight;
  964.    
  965.    TEScroll(0,-scrollPix,theTE);
  966. }
  967.  
  968.  
  969. /* text drag callback procedure.  this routine handles drag scrolling by
  970. checking to see if we
  971.    are in the area where drag-scrolling is necessary, and calling
  972. scrolltext followed by a
  973.    scrollbar realignment
  974. */
  975.  
  976. pascal Boolean MyTEClickProc(void)
  977. {
  978.    Point pt;
  979.    DialogPtr theDialog;
  980.    ControlHandle theControl;
  981.    TEHandle theTE;
  982.    Rect textRect;
  983.    short scrollLines;
  984.    GrafPtr savePort;
  985.    RgnHandle saveClip;
  986.       
  987.    GetMouse(&pt);
  988.    theDialog = (DialogPtr)FrontWindow();
  989.    theTE = GetTEHandle(theDialog);
  990.    
  991.    GetPort(&savePort);
  992.    SetPort(theDialog);
  993.  
  994.    saveClip = NewRgn();
  995.    GetClip(saveClip);
  996.    ClipRect(&theDialog->portRect);
  997.  
  998.    scrollLines = 0;
  999.    textRect = (**theTE).viewRect;
  1000.    if (pt.v < textRect.top)
  1001.       scrollLines = -1;
  1002.    else if (pt.v > textRect.bottom)
  1003.       scrollLines = 1;
  1004.    
  1005.    if (scrollLines) {
  1006.       ScrollText(theDialog,scrollLines);
  1007.       ReAlignScrollbarToText(theDialog);
  1008.    }
  1009.    
  1010.    SetClip(saveClip);
  1011.    DisposeHandle((Handle)saveClip);
  1012.    SetPort(savePort);
  1013.    return true;
  1014. }
  1015.  
  1016.  
  1017. /* utility procedure to return a handle to the scrollbar control
  1018. */
  1019.  
  1020. ControlHandle GetScrollBar(DialogPtr theDialog)
  1021. {
  1022.    ControlHandle theScroller;
  1023.    short iType;
  1024.    Rect iRect;
  1025.    
  1026.    GetDItem(theDialog,kScrollerItem,&iType,(Handle *)&theScroller,&iRect);
  1027.    return theScroller;
  1028. }
  1029.  
  1030.  
  1031. /* utility procedure to return the textedit record for the given dialog */
  1032.  
  1033. TEHandle GetTEHandle(DialogPtr theDialog)
  1034. {
  1035.    return( (TEHandle)GetWRefCon((WindowPtr)theDialog) );
  1036. }
  1037.  
  1038. -- 
  1039. __________________________________________________________________
  1040. Matthew Xavier Mora  (cybernaut)            The keeper of the UMPG
  1041. SRI International                              mxmora@unix.sri.com
  1042. __________________________________________________________________
  1043.  
  1044. ---------------------------
  1045.  
  1046. >From sandvik@apple.com (Kent Sandvik)
  1047. Subject: Latest QuickTime Tech Notes
  1048. Date: Sat, 07 Jan 1995 20:03:20 -0800
  1049. Organization: Apple Computer, Inc. Developer Technical Support
  1050.  
  1051. We have brand new (sort of) Tech Notes for QuickTime, these will go out
  1052. with various developer distributions, but I uploaded them to the
  1053. ftp.apple.com dts directory (dts/multimedia/quicktime), or:
  1054.  
  1055. "ftp://ftp.apple.com/dts/multimedia/quicktime/LatestTNs/QT01 - QuickTime.hqx"
  1056. "ftp://ftp.apple.com/dts/multimedia/quicktime/LatestTNs/QT02 - QuickTime
  1057. Comp.hqx"
  1058. "ftp://ftp.apple.com/dts/multimedia/quicktime/LatestTNs/QT03 - QTW.hqx"
  1059.  
  1060. What's new since the last time any QuickTime related TNs were released?
  1061.  
  1062. * There's just these three Tech Notes, they all correspond to the Inside
  1063. Macintosh QuickTime books, even on chapter level. If you don't find
  1064. something in the NIM QuickTime books in a chapter, do a second lookup in
  1065. the Tech Notes. This is easier than searching in a multitude of Tech
  1066. Notes. Thus, all information is re-classified so it falls into the
  1067. categories defined by the NIM books.
  1068.  
  1069. * The Q&A entries are in many cases rewritten and placed into these Tech
  1070. Notes as well, so you don't need to check these TNs out as well (they are
  1071. gone).
  1072.  
  1073. * All relevant information up to December 1994 is now in the Tech Notes,
  1074. including email Q&A entries DTS has answered for the last 12 months.  This
  1075. also includes errata notes concerning the NIM QuickTime books.
  1076.  
  1077. * Anything not relevant to QT 2.0/1.6.1 is now out from the Tech Notes.
  1078.  
  1079. In future we hope to update these TNs more frequently, for instance it's
  1080. doable to publish a separate delta document with the new information since
  1081. December 1994, so if you want to just check out what's new you don't need
  1082. to read the bigger Tech Notes (even if it's in there as well).
  1083.  
  1084. If you have any feedback about the Tech Notes, the contents or the
  1085. process, feel free to send me an email. You should see these TNs appearing
  1086. over the normal channels, but I didn't want them to gather dust as they
  1087. are finished already :-).
  1088.  
  1089.  
  1090. --Kent
  1091.  
  1092. -- 
  1093. Kent Sandvik   sandvik@apple.com   New Media Analyst/Programmer
  1094. Private activities on Internet.
  1095.  
  1096. ---------------------------
  1097.  
  1098. >From jdv@netcom.com (Julian Vrieslander)
  1099. Subject: OpenDoc mailing list or FAQ?
  1100. Date: Sat, 7 Jan 1995 23:27:12 GMT
  1101. Organization: Cornell University, Ithaca, NY
  1102.  
  1103. Title line pretty much sums it up.  Besides the articles in MacTech and
  1104. the OpenDoc CD-ROM, where should I look for info to help me come up to
  1105. speed on OpenDoc?
  1106.  
  1107. -- 
  1108.                        Julian Vrieslander
  1109.                jdv@netcom.com      jdv2@cornell.edu
  1110.  
  1111. +++++++++++++++++++++++++++
  1112.  
  1113. >From Alan Harper <aharper@dnai.com>
  1114. Date: 7 Jan 1995 18:05:31 GMT
  1115. Organization: Eclectus
  1116.  
  1117. In article <jdvD226HD.J6y@netcom.com> Julian Vrieslander, jdv@netcom.com
  1118. writes:
  1119. > Title line pretty much sums it up.  Besides the articles in MacTech and
  1120. > the OpenDoc CD-ROM, where should I look for info to help me come up to
  1121. > speed on OpenDoc?
  1122.  
  1123. send a message
  1124. SUBSCRIBE OPENDOC-ANNOUNCE <your name>
  1125. SUBSCRIBE OPENDOC-INTEREST <your name>
  1126.  
  1127. to listproc@CILabs.ORG
  1128.  
  1129. - ---------------
  1130. Alan Harper                       aharper@dnai.com
  1131. 77 Jack London Sq, Ste. H         510/444-6605 (voice/fax)
  1132. Oakland, CA 94607
  1133.  
  1134. ---------------------------
  1135.  
  1136. >From ericg@cs.uoregon.edu (MystryMan)
  1137. Subject: Q: Bedrock Exception Library Questions
  1138. Date: 9 Jan 1995 15:43:17 -0800
  1139. Organization: University of Oregon Computer and Information Sciences Dept.
  1140.  
  1141. I was reading through some of the CodeWarrior documentation and it said that
  1142.  
  1143. "The Bedrock Exception Library which was added to the TCL in version 2.0 seems
  1144. to be somewhat buggy, especially on the PowerPC"
  1145.  
  1146. Unfortunatly, it does not go on to specify where these bugs come into play,
  1147. what they are or how to avoid them.
  1148.  
  1149. I would like to continue to use the BEL for now and would like more information
  1150. on what these bugs are.
  1151.  
  1152. Thanx..
  1153.  
  1154. ===Eric Gorr================ericg@cs.uoregon.edu===========aka MystryMan===
  1155. _____ 
  1156. |\ /| * Invincibility is in oneself, vulnerability is in the opponent
  1157. | O | * Therefore the considerations of the intelligent always include both
  1158. |/_\|   benefit and harm (Sun Tzu)
  1159.  
  1160. #include <standard.disclaimer>
  1161. =====Insults, like violence, are the last resort of the incompetent...=====
  1162.  
  1163.  
  1164. +++++++++++++++++++++++++++
  1165.  
  1166. >From afcjlloyd@aol.com (AFC JLloyd)
  1167. Date: 11 Jan 1995 17:15:35 -0500
  1168. Organization: America Online, Inc. (1-800-827-6364)
  1169.  
  1170. >I was reading through some of the CodeWarrior documentation and it said
  1171. that
  1172. >
  1173. >"The Bedrock Exception Library which was added to the TCL in version 2.0
  1174. seems
  1175. >to be somewhat buggy, especially on the PowerPC"
  1176. >
  1177. >Unfortunatly, it does not go on to specify where these bugs come into
  1178. play,
  1179. >what they are or how to avoid them.
  1180. >
  1181. >I would like to continue to use the BEL for now and would like more
  1182. information
  1183. >on what these bugs are.
  1184.  
  1185. I'm the engineer who has done most of the work on BEL.  There is an
  1186. extensive test suite for BEL that was written by myself and a quality
  1187. assurance engineer (David Dodd).  We've run that test suite on multiple
  1188. compilers and platforms (Symantec C++ for MPW, Symantec C++ for Think
  1189. Project Manager, Symantec C++ for Windows, Borland C++, Metrowerks C++,
  1190. Apple's MrC).  BEL is being used in shipping applications on both Mac and
  1191. Windows.
  1192.  
  1193. I have heard rumors that BEL is buggy.  When looking into these rumors the
  1194. only problem that I have been able to confirm is one where a register
  1195. value is not preserved across the longjmp.  This is easily fixed by proper
  1196. use of the C++ keyword volatile.  If you need a local value to be
  1197. preserved from the TRY block to the CATCH block when an exception is
  1198. thrown, be sure to declare the value volatile.  Here are some examples:
  1199.  
  1200. TRY
  1201. {
  1202.      volatile int i;
  1203.      CMyClass * volatile myClassPtr;
  1204. }
  1205.  
  1206. Note the postion of the volatile keyword when declaring a pointer.  The
  1207. keyword must come after the *, not before.
  1208.  
  1209. If anyone is aware of any bugs in BEL, please send mail to me at one of
  1210. the addresses below.  To my knowledge there are NO bugs in BEL, though
  1211. there are some limitations that may not be fully documented.  Here are two
  1212. limitations to be aware of:
  1213.  
  1214. BEL has a hard time in some cases with TRY/CATCH blocks nested inside of a
  1215. CATCH block.  In particular, you can only THROW_SAME from within the
  1216. innermost nested CATCH block.
  1217.  
  1218. If you want to embed an autodestruct object by value inside of another
  1219. object, then the outer object must also be an autodestruct object, and it
  1220. should have the END_CONSTRUCTOR/START_DESTRUCTOR macros inside of its
  1221. constructors and destructor.
  1222.  
  1223. Finally be aware of the fact that if you don't create one, the compiler
  1224. will write a copy constructor for you.  A compiler-generated copy
  1225. constructor won't have the END_CONSTRUCTOR macro.  If the destructor has a
  1226. START_DESTRUCTOR macro, then you will get an assertion failure when that
  1227. object is destroyed.
  1228.  
  1229. Jim Lloyd
  1230. afcjlloyd@aol.com -or- Jim_Lloyd@powertalk.apple.com
  1231.  
  1232. ---------------------------
  1233.  
  1234. >From allender@prairienet.org (Mark W. Allender)
  1235. Subject: help with CLUT-Palette management
  1236. Date: 10 Jan 1995 20:01:15 GMT
  1237. Organization: Prairienet, the East-Central Illinois Free-Net
  1238.  
  1239.  
  1240. I have a very simple problem that I am trying desperately to solve.
  1241.  
  1242. I have a palette of 256 colors that I want to display in a simple little
  1243. grid format.  I am having no trouble doing the actual drawing.  The problem
  1244. is that I don't understand (after wading through endless volumes of Inside
  1245. Macintosh, developer notes, etc) how the palette and color table manager
  1246. work to produce colors for a particular window.
  1247.  
  1248. In my case, all I want to do is replace the first 256 entries in my
  1249. windows color table, and draw my little grid.  It appears to me that I
  1250. still have the system colors when I do this.
  1251.  
  1252. What I tried initially was to create a Palette with my entries, used
  1253. palette2CTab, and then placed the CTable into the Pixmap area pointed
  1254. to by the window that I created.  Sounded simple, but doesn't work.
  1255.  
  1256. Can some kind soul help me out with this seemingly simple task.  Thanks
  1257. in advance!!!
  1258.  
  1259. --
  1260. -Mark Allender
  1261. -Parallax Software
  1262. -allender@prairienet.org
  1263.  
  1264. +++++++++++++++++++++++++++
  1265.  
  1266. >From gurgle@dnai.com (Pete Gontier)
  1267. Date: Tue, 10 Jan 1995 18:41:18 -0700
  1268. Organization: cellular
  1269.  
  1270. In article <3eup2b$oae@vixen.cso.uiuc.edu>,
  1271. allender@prairienet.org (Mark W. Allender) wrote:
  1272.  
  1273. > In my case, all I want to do is replace the first 256 entries in my
  1274. > windows color table...
  1275.  
  1276. No you don't. :-) The window color table describes the colors to use for
  1277. drawing various parts of the window itself, not the image in the window's
  1278. content region, which is what you are drawing.
  1279.  
  1280. > What I tried initially was to create a Palette with my entries, used
  1281. > palette2CTab, and then placed the CTable into the Pixmap area pointed
  1282. > to by the window that I created...
  1283.  
  1284. This certainly does something, but I'm not sure what. :-) You took too
  1285. many steps. All you want to do is:
  1286.  
  1287.         (1) build a palette
  1288.         (2) call GetPalette to see if the window already has a palette;
  1289.             if so, I believe you can call DisposePalette against it,
  1290.             but I'm shooting from the hip here as palettes may be shared;
  1291.             someone else should verify this info
  1292.         (3) call SetPalette
  1293.  
  1294. I sympathize with your plight; finding Palette Manager documentation is
  1295. non-trivial these days.
  1296.  
  1297. ______________________________________________________________________________
  1298.  Pete Gontier -- MacZealotry, Ink. -- gurgle@dnai.com
  1299.  Where do I want to go today? Anywhere but Chicago.
  1300.  
  1301. ---------------------------
  1302.  
  1303. End of C.S.M.P. Digest
  1304. **********************
  1305.  
  1306.  
  1307.