home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / Information / CSMP Digest / volume 1 / csmp-v1-110.txt < prev    next >
Encoding:
Text File  |  1994-12-08  |  50.0 KB  |  1,370 lines  |  [TEXT/R*ch]

  1. C.S.M.P. Digest             Tue, 09 Jun 92       Volume 1 : Issue 110
  2.  
  3. Today's Topics:
  4.  
  5.     using stdio on a mac
  6.     ResEdit - estr and hrct templates
  7.     Color QD Pattern Alignment
  8.     ADB Extended Keycodes
  9.     C video application
  10.     Mac Programming Primer
  11.     SetHandleSize corrupts block?
  12.     GWorlds & XCMDs
  13.     Forcing CTB Serial Connection to close - How?
  14.     Trying to get an overview of MacApp 3.0 classes: 2 quick questions
  15.     Launching an appe
  16.  
  17.  
  18. The Comp.Sys.Mac.Programmer Digest is moderated by Michael A. Kelly.
  19.  
  20. These digests are available (by using FTP, account anonymous, your email
  21. address as password) in the pub/mac/csmp-digest directory on ftp.cs.uoregon.
  22. edu.  This is also the home of the comp.sys.mac.programmer Frequently Asked
  23. Questions list.  The last several issues of the digest are available from
  24. sumex-aim.stanford.edu as well.
  25.  
  26. These digests are also available via email.  Just send a note saying that you
  27. want to be on the digest mailing list to mkelly@cs.uoregon.edu, and you will
  28. automatically receive each new digest as it is created.
  29.  
  30. The digest is a collection of articles from the internet newsgroup comp.sys.
  31. mac.programmer.  It is designed for people who read c.s.m.p. semi-regularly
  32. and want an archive of the discussions.  If you don't know what a newsgroup
  33. is, you probably don't have access to it.  Ask your systems administrator(s)
  34. for details.  (This means you can't post questions to the digest.)
  35.  
  36. The articles in these digests are taken directly from comp.sys.mac.programmer.
  37. They are not edited; all articles included in this digest are in their original
  38. posted form.  The only articles that are -not- included in these digests are
  39. those which didn't receive any replies (except those that give information
  40. rather than ask a question).  All replies to each article are concatenated
  41. onto the original article in the order in which they were received.  Article
  42. threads are not added to the digests until the last article added to the
  43. thread is at least one month old (this is to ensure that the thread is dead
  44. before adding it to the digests).
  45.  
  46. Send administrative mail to mkelly@cs.uoregon.edu.
  47.  
  48. -------------------------------------------------------
  49.  
  50. Organization: Freshman, Electrical and Computer Engineering, Carnegie Mellon, Pittsburgh, PA
  51. Date: Tue,  5 May 1992 13:23:48 -0400 
  52. From: Peter William Wieland <pw1r+@andrew.cmu.edu>
  53. Subject: using stdio on a mac
  54.  
  55. Is there any way to convert mac file references into C FILE pointers? 
  56. I've got some filter routines written using C that I'm trying to slap a
  57. file-picker on.  I've seen code to get the full path name for a file,
  58. but since Str255's  can't exceed 255 characters, that kind of limits the
  59. pathnames.  Does anyone have any suggestions and/or sample code?
  60.  
  61. thanx
  62.  
  63. Peter Wieland        pw1r@andrew.cmu.edu
  64.  
  65. +++++++++++++++++++++++++++
  66.  
  67. From: zben@ni.umd.edu (Charles B. Cranston)
  68. Organization: UM Home for the Terminally Analytical
  69. Date: Wed, 6 May 1992 20:51:04 GMT
  70.  
  71. In article <se1gGY_00WBN84BGAS@andrew.cmu.edu>, Peter William Wieland <pw1r+@andrew.cmu.edu> writes:
  72.  
  73. > Is there any way to convert mac file references into C FILE pointers? 
  74. > I've got some filter routines written using C that I'm trying to slap a
  75. > file-picker on.  I've seen code to get the full path name for a file,
  76. > but since Str255's  can't exceed 255 characters, that kind of limits the
  77. > pathnames.  Does anyone have any suggestions and/or sample code?
  78.  
  79. Several solutions come to mind.  One general solution for the long path
  80. name problem is to periodically open a working directory on the path name
  81. so far, then SetVol this to be the current volume, then proceed with the
  82. remainder of the path name.  The working directories then become a kind
  83. of "stepping stone" to the final file.  This is expensive because you are
  84. creating and destroying all these directories each time.  The worst case
  85. is when you do this for EVERY folder on the path.
  86.  
  87. If the file is already open, you could use PBGetFCBInfo to extract the
  88. filename and ioVRefNum, then SetVol to that ioVRefNum, then open the bare
  89. filename with the C open routine.
  90.  
  91. If you are starting out with a vRefNum/dirID/filename triple you might
  92. make a working directory (using PBOpenWD) out of the vRefNum/dirID,
  93. then SetVol to the WDRefNum you made, then use the C open routine to open
  94. the bare filename.
  95.  
  96. BTW it is "clean" to PBCloseWD any WD you might make, and to use GetVol
  97. and SetVol to save and restore the "current volume (folder)" around the
  98. open code.
  99.  
  100. See also Tech Note 246 "Mixing HFS and C File I/O".
  101.  
  102.  
  103. +++++++++++++++++++++++++++
  104.  
  105. Organization: Freshman, Electrical and Computer Engineering, Carnegie Mellon, Pittsburgh, PA
  106. Date: Thu,  7 May 1992 15:40:13 -0400 
  107. From: Peter William Wieland <pw1r+@andrew.cmu.edu>
  108.  
  109. Thanks to everyone who responded to my original post.  Of all the
  110. solutions, the best one I found was to hack Think c's stdio routines
  111. (fopen, freopen, __open) to use a vRefNum along with the full pathname
  112. (it ususally sets the ioVRefNum to zero).  Thanks for the help.
  113.  
  114. peter wieland                    pw1r@andrew.cmu.edu
  115.  
  116. ---------------------------
  117.  
  118. From: kevin@dcs.ed.ac.uk (Kevin Mitchell)
  119. Subject: ResEdit - estr and hrct templates
  120. Date: 6 May 92 09:24:20 GMT
  121. Organization: Department of Computer Science, University of Edinburgh, UK
  122.  
  123. I was reading the Think C manual, and some of the class libraries mentioned
  124. using estr and hrct resources.  My copy of ResEdit 2.1.1 doesn't have a
  125. template editor for these resources.  Are these resource types just alternative
  126. names for existing types, i.e. I can create them using some other template
  127. editors, or am I missing some templates?
  128.  
  129. Any help would be appreciated.
  130.  
  131. Kevin  
  132.  
  133. Kevin Mitchell                   JANET: kevin@uk.ac.ed.dcs
  134. LFCS, Dept. of Computer Science  ARPA:  kevin%dcs.ed.ac.uk@nsfnet-relay.ac.uk    
  135. University of Edinburgh          
  136. Edinburgh EH9 3JZ, UK.           Tel:   (+44) (0)31-650-5195
  137.  
  138. +++++++++++++++++++++++++++
  139.  
  140. From: michaelh@Xenon.Stanford.EDU (Mike Hennahane)
  141. Date: 7 May 92 23:56:10 GMT
  142. Organization: CS Department, Stanford University, California, USA
  143.  
  144. kevin@dcs.ed.ac.uk (Kevin Mitchell) writes:
  145.  
  146. >I was reading the Think C manual, and some of the class libraries mentioned
  147. >using estr and hrct resources.  My copy of ResEdit 2.1.1 doesn't have a
  148. >template editor for these resources.  Are these resource types just alternative
  149. >names for existing types, i.e. I can create them using some other template
  150. >editors, or am I missing some templates?
  151.  
  152. i think that the manual states that estr is just the same as a pascal
  153. str resource (but used for error strings). you could open as a str or
  154. create a duplicate of the str template called estr. i'm not sure about
  155. the hrct resource offhand.
  156.  
  157. - --mike
  158.  
  159. ---------------------------
  160.  
  161. From: jimc@tau-ceti.isc-br.com (Jim Cathey)
  162. Subject: Color QD Pattern Alignment
  163. Date: 6 May 92 18:32:09 GMT
  164. Organization: ISC - Bunker Ramo, Spokane, WA
  165.  
  166. In the non-color QD world, patterns were always byte-aligned with the
  167. bit image they were placed upon (unless you fiddled with the QD global
  168. PatAlign).  Apparently this is no longer true under Color QD (using
  169. CGrafPorts, etc).  Our native system shares the original QD pattern
  170. behavior, and our paint application accounts for this behavior when it
  171. is painting with patterns.  However, when this application displays
  172. its windows on the Mac via our relay application (and the network) we
  173. get misaligned patterns on systems with Color QD.  I've tried fiddling
  174. with PatAlign (a long at -0xA8 offset from (a5)) --- no joy.  I don't
  175. see _any_ mention of pattern alignment in IMV, nor in the Tech Notes.
  176. Any suggestions?
  177.  
  178. - -- 
  179. +----------------+
  180. ! II      CCCCCC !  Jim Cathey
  181. ! II  SSSSCC     !  ISC-Bunker Ramo
  182. ! II      CC     !  TAF-C8;  Spokane, WA  99220
  183. ! IISSSS  CC     !  UUCP: uunet!isc-br!jimc (jimc@isc-br.isc-br.com)
  184. ! II      CCCCCC !  (509) 927-5757
  185. +----------------+
  186.             "PC's --- the junk bonds of the computer industry"
  187.  
  188. +++++++++++++++++++++++++++
  189.  
  190. From: ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University)
  191. Date: 7 May 92 06:08:38 GMT
  192. Organization: University of Waikato, Hamilton, New Zealand
  193.  
  194. In article <2076@tau-ceti.isc-br.com>, jimc@tau-ceti.isc-br.com (Jim Cathey) writes:
  195. > In the non-color QD world, patterns were always byte-aligned with the
  196. > bit image they were placed upon (unless you fiddled with the QD global
  197. > PatAlign).  Apparently this is no longer true under Color QD (using
  198. > CGrafPorts, etc).
  199.  
  200. It seems to me the more natural way to do it would be if "patterns are always
  201. aligned on coordinates which are multiples of their dimensions". Black-and-
  202. white patterns are always 8-by-8, but, for example, if you had a colour
  203. pattern which was 32 pixels wide and 16 tall, then it would be aligned on
  204. multiples of 16 pixels vertically and 32 horizontally.
  205.  
  206. I must go home and check this. But honestly, I can't imagine that Color
  207. QuickDraw would be so brain-damaged as to do things any other way. :-}
  208.  
  209. > Our native system shares the original QD pattern
  210. > behavior, and our paint application accounts for this behavior when it
  211. > is painting with patterns.  However, when this application displays
  212. > its windows on the Mac via our relay application (and the network) we
  213. > get misaligned patterns on systems with Color QD.
  214.  
  215. So you're passing the pattern definition over the network, followed by
  216. a command to draw with that pattern? If my assumption above is right,
  217. you should be able to get the patterns to line up simply by making sure
  218. that the window/grafport origin is always set consistently at both ends.
  219.  
  220. > I've tried fiddling
  221. > with PatAlign (a long at -0xA8 offset from (a5)) --- no joy.
  222.  
  223. Interesting. So fiddling patAlign has *no* effect on colour patterns?
  224. (I guess the way to check that you're doing it correctly is to watch
  225. for the effect on B&W patterns).
  226.  
  227. > I don't
  228. > see _any_ mention of pattern alignment in IMV, nor in the Tech Notes.
  229. > Any suggestions?
  230.  
  231. I think it would be really nice if somebody in the know could explain to us
  232. this business about patAlign once and for all. Any takers?
  233.  
  234. Lawrence D'Oliveiro                       fone: +64-7-856-2889
  235. Computer Services Dept                     fax: +64-7-838-4066
  236. University of Waikato            electric mail: ldo@waikato.ac.nz
  237. Hamilton, New Zealand    37^ 47' 26" S, 175^ 19' 7" E, GMT+13:00
  238.                        Signature tow-away zone. You have been wa
  239.  
  240. +++++++++++++++++++++++++++
  241.  
  242. From: is_s440@kingston.ac.uk (Simon Lucas)
  243. Date: 7 May 92 08:49:47 GMT
  244. Organization: Kingston Polytechnic
  245.  
  246. Subject: StringPtrs in MacApp2.0.1/C++
  247. Newsgroups: comp.sys.mac.programmer
  248. Distribution: world
  249.  
  250. Probably a FAQ or generally stupid question, but I have tried evrything
  251. I can think of to solve this. I'm trying to get used to C++ without
  252. much luck and with much frustration. 
  253. I've consulted every manual and book I have but the subject is not covered. 
  254. PLease help. CODE frags included at end:
  255.  
  256. I need to save the strings from a dialog in my document object. Simple??
  257. To do this I figured using Pascal strings would be easiest and am using
  258. StringPtr types. This works fine when using GetText or SetText.
  259. However, when I try and copy the strings to a struct in order to write them
  260. to disk I get a bus error:
  261.  
  262. Q1. Would I be right in assuming that memory reallocation is causing the
  263. dangling string pointers inside the doc object? and why doesnt it happen when
  264. using GetText?
  265. Q2. What is the correct (or more correct) way to deal with this problem?
  266. - - Do I have to resort to char arrays and then do lots of c2pstr's and vice
  267. versa? Would using global StringPtrs be a better way?
  268. Q3. In general what are the rules vis-a-vis pointers inside objects? Does
  269. MacApp lock down objects to prevent dangling pointers or should the programmer
  270. be doing this?
  271.  
  272. CODE FRAGMENTS:-
  273. // doc class
  274. class TNewGateDoc : public TDocument {
  275.   public:
  276.     StringPtr fStrRad1;
  277.     StringPtr fStrRad2;
  278.     // etc..
  279.     TControlView fControlView;
  280.     TMainView fMainView;
  281.     // etc....
  282. }
  283.  
  284. // saving the strings via GetText works ....
  285. pascal void TNewGateDoc::GetValues(void)
  286. {
  287.     ((TEditText *)fControlView->FindSubView('Rad1'))->GetText(fStrRad1);
  288.     // etc....
  289. }
  290.     
  291. // i declare a type to collect the strings into a struct for writing to disk:
  292.  
  293. typedef struct {
  294.     StringPtr StrRad1;
  295.     StringPtr StrRad2;
  296.     / etc....
  297. } GateDocDiskInfo;
  298.  
  299. // then try copying the strings into the struct:
  300.  
  301. pascal void TNewGateDoc::DoWrite(short aRefNum, Boolean makingCopy)
  302. {
  303.     GateDocDiskInfo aDiskInfo; // data structure for writing to disk
  304.     long nBytes = sizeof(GateDocDiskInfo); //number of bytes to be written
  305.  
  306.     aDiskInfo.StrRad1=PLstrcpy(aDiskInfo.StrRad1,fStrRad1); // BUS ERROR!!!!
  307.     aDiskInfo.StrRad2=PLstrcpy(aDiskInfo.StrRad2,fStrRad2);
  308.     /etc..
  309. }
  310.  
  311. thanks for any help..
  312.  
  313. Simon Lucas
  314.  
  315. +++++++++++++++++++++++++++
  316.  
  317. From: jimc@tau-ceti.isc-br.com (Jim Cathey)
  318. Date: 7 May 92 19:41:56 GMT
  319. Organization: ISC - Bunker Ramo, Spokane, WA
  320.  
  321. In article <1992May7.180838.7939@waikato.ac.nz> ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University) writes:
  322. >It seems to me the more natural way to do it would be if "patterns are always
  323. >aligned on coordinates which are multiples of their dimensions". Black-and-
  324. >white patterns are always 8-by-8, but, for example, if you had a colour
  325. >pattern which was 32 pixels wide and 16 tall, then it would be aligned on
  326. >multiples of 16 pixels vertically and 32 horizontally.
  327.  
  328. This would make sense.  The patterns should end up tiled across the pixel
  329. image, starting at the first pixel in the image.  This would be equivalent
  330. to what happens in the B&W world.
  331.  
  332. >> Our native system shares the original QD pattern
  333. >> behavior, and our paint application accounts for this behavior when it
  334. >> is painting with patterns.  However, when this application displays
  335. >> its windows on the Mac via our relay application (and the network) we
  336. >> get misaligned patterns on systems with Color QD.
  337. >
  338. >So you're passing the pattern definition over the network, followed by
  339. >a command to draw with that pattern? If my assumption above is right,
  340. >you should be able to get the patterns to line up simply by making sure
  341. >that the window/grafport origin is always set consistently at both ends.
  342.  
  343. Yes.  The application does its own offscreen drawing using 8x8 patterns
  344. that are aligned with (tiled from) 0,0 of that image.  It also whips up
  345. another pattern to match the fill pattern, the new one is rotated up to
  346. 7 pixels on each axis (the LocalToGlobal offset of the coordinate system
  347. of the window modulo the pattern size) so that when it is used (in
  348. FillRect, say) the on-screen fill will match what happened offscreen. 
  349. To draw on-screen, the application mixes pattern drawing calls with
  350. CopyBits's of its offscreen image, depending on what it is doing.  On a
  351. B/W Mac, all this merges seamlessly.  On a machine with Color QD, the
  352. patterns don't merge.  (They _do_ merge if I use NewWindow instead of
  353. NewCWindow, but that's not a solution, since this thing needs to draw in
  354. color, too). 
  355.  
  356. It _appears_ that a CGrafPort's patterns are aligned with the start of
  357. the portRect, instead of with the pixMap.bounds rectangle.  If so, I'm
  358. going to have to mangle the pattern myself before each drawing call that
  359. uses a pattern, in order to shift it to align with the pixel image ---
  360. effectively un-doing what the application had to do in the first place
  361. to deal with non-color Macs (and our native systems).  Blech.
  362.  
  363. >Interesting. So fiddling patAlign has *no* effect on colour patterns?
  364. >(I guess the way to check that you're doing it correctly is to watch
  365. >for the effect on B&W patterns).
  366.  
  367. I didn't check it this thoroughly.  I disassembled (using ResEdit's CODE
  368. disassembler) the standard WDEF 0 to find out where PatAlign was, since
  369. I have (from ftp.apple.com) the source to WDEF 0, but not the include
  370. files that declare the offsets.  (WDEF 0 uses PatAlign to draw the lines
  371. in the title bar as a single pattern-filled rectangle.)
  372.  
  373. - -- 
  374. +----------------+
  375. ! II      CCCCCC !  Jim Cathey
  376. ! II  SSSSCC     !  ISC-Bunker Ramo
  377. ! II      CC     !  TAF-C8;  Spokane, WA  99220
  378. ! IISSSS  CC     !  UUCP: uunet!isc-br!jimc (jimc@isc-br.isc-br.com)
  379. ! II      CCCCCC !  (509) 927-5757
  380. +----------------+
  381.             "PC's --- the junk bonds of the computer industry"
  382.  
  383. ---------------------------
  384.  
  385. From: jpugh@apple.com (Jon Pugh)
  386. Subject: ADB Extended Keycodes
  387. Date: 6 May 92 19:44:30 GMT
  388. Organization: Apple Co.
  389.  
  390. I'm trying to get the extended keyboard to return extended keycodes for the
  391. duration of a GetKeys call so that I can tell the difference between the 
  392. right and left shift, control and option keys.  Since I have written an LED
  393. XCMD, I figured this would be easy given my existing ADB code.  Sure enough,
  394. I can change register 3 as IMV-193 says to, but it doesn't seem to work
  395. properly.
  396.  
  397. The trick is that register 3 contains a word with the high byte containing
  398. state info, including the address, and the low byte containing the device
  399. handler ID, which is normally 2 and should be 3 for extended keycodes.
  400. The documentation on register 3 (IMV-365) says that you need to get the
  401. whole word, change the low byte and set it to this, so I do that, but I
  402. suspect that some of the high nibble shouldn't be messed with, but I don't
  403. know how to avoid it or if that is really true.  All I know is that I cannot
  404. return the keyboard to its original state (reboot!). It seems to behave like
  405. the right hand shift key is locked down.
  406.  
  407. My friends in DTS claim that the ADB guys all dropped off the face of the
  408. earth and/or never really existed in the first place. Does anyone have any
  409. experience messing with this crap or am I in the weeds again?
  410.  
  411. Jon
  412.  
  413. +++++++++++++++++++++++++++
  414.  
  415. From: jpugh@apple.com (Jon Pugh)
  416. Date: 7 May 92 20:44:58 GMT
  417. Organization: Apple Co.
  418.  
  419. In article <24527@goofy.Apple.COM>, I (Jon Pugh) write:
  420. > My friends in DTS claim that the ADB guys all dropped off the face of the
  421. > earth and/or never really existed in the first place. Does anyone have any
  422. > experience messing with this crap or am I in the weeds again?
  423.  
  424. In actuality all the ADB guys went to Pink.
  425.  
  426. My other friends in DTS (you can't whine at everyone all the time) came 
  427. to the rescue to point out that there is sample code on the Dev CDs.
  428.  
  429. Of course, mine does the same stuff, so we're hoping it's merely a latency
  430. problem.  A couple of Delay calls should determine the truth of this rumor.
  431.  
  432. Jon
  433.  
  434. ---------------------------
  435.  
  436. From: erich@rodan (Eric Hilfer)
  437. Subject: C video application
  438. Date: 7 May 92 13:38:45 GMT
  439.  
  440. I am planning to write a Mac application in C that will provide a simple
  441. interface to a digitized video image.  This is my first Mac
  442. programming project, but I have lots of experience writing
  443. X-Windows applications under Unix.  I would like some general advice
  444. on how to do the following:
  445.  
  446. 1) What is a good choice for a compiler?  I've heard Think C
  447. recommended.
  448.  
  449. 2) Are there any special tricks to let my application get the
  450. coordinates of a mouse click that occurs in another application's
  451. window?  The user will display digitized video in a window using the
  452. viewing software that came with the digitizing card.  Then the user
  453. will launch my application, and point and click in the video graphics
  454. window.  The coordinates of the clicks (relative to the viewing
  455. software's window) will be saved by my application as data.
  456.  
  457. 3) I want the user to be able to send the accumulated list of
  458. coordinates into other applications ( a commercial spreadsheet, for
  459. example).  What is involved in supporting the ability to drag and drop
  460. the list into another application?  How does the new Publisher/Subscriber
  461. mechanism work?
  462.  
  463. Thanks in advance for your help!!
  464.  
  465. Eric
  466.  
  467.  
  468. - -- 
  469. - ----------------
  470. Eric Hilfer
  471. erich@hri.com
  472.  
  473. +++++++++++++++++++++++++++
  474.  
  475. From: ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University)
  476. Date: 8 May 92 06:54:26 GMT
  477. Organization: University of Waikato, Hamilton, New Zealand
  478.  
  479. In article <6357@bigbird.hri.com.hri.com>, erich@rodan (Eric Hilfer) writes:
  480. > I am planning to write a Mac application in C that will provide a simple
  481. > interface to a digitized video image.  This is my first Mac
  482. > programming project, but I have lots of experience writing
  483. > X-Windows applications under Unix.  I would like some general advice
  484. > on how to do the following:
  485.  
  486. [I'll let someone else answer the question about a good choice of C compiler,
  487. as I tend to avoid C myself :-)]
  488.  
  489. > 2) Are there any special tricks to let my application get the
  490. > coordinates of a mouse click that occurs in another application's
  491. > window?  The user will display digitized video in a window using the
  492. > viewing software that came with the digitizing card.  Then the user
  493. > will launch my application, and point and click in the video graphics
  494. > window.  The coordinates of the clicks (relative to the viewing
  495. > software's window) will be saved by my application as data.
  496.  
  497. I have a better idea: use the standard QuickTime interface (which is supported
  498. by most video input cards these days) so you can display the live video in one
  499. of your own windows, and you can handle clicks without any special tricks.
  500.  
  501. (Hey, that rhymes...)
  502.  
  503. > 3) I want the user to be able to send the accumulated list of
  504. > coordinates into other applications ( a commercial spreadsheet, for
  505. > example).  What is involved in supporting the ability to drag and drop
  506. > the list into another application?  How does the new Publisher/Subscriber
  507. > mechanism work?
  508.  
  509. Publish and Subscribe is a method for maintaining "live" links, such that
  510. any changes in the original data are automatically propagated to all
  511. subscribers. I might be wrong, but it seems to me that you really just want
  512. to accumulate a list of coordinates, move them into a document, generate
  513. another list, move that into a (possibly different) document, and so on.
  514. Doing this is easy: you just need to support copy-and-paste. The technical
  515. details are documented in Chapter 15 ("The Scrap Manager") of Inside Mac Vol I.
  516.  
  517. You *do* have the full set of Inside Mac volumes I-VI, don't you...?
  518.  
  519. Lawrence D'Oliveiro                       fone: +64-7-856-2889
  520. Computer Services Dept                     fax: +64-7-838-4066
  521. University of Waikato            electric mail: ldo@waikato.ac.nz
  522. Hamilton, New Zealand    37^ 47' 26" S, 175^ 19' 7" E, GMT+13:00
  523. X Windows: distributed computing in reverse.
  524.  
  525. ---------------------------
  526.  
  527. From: tlspurli@athena.mit.edu (Terry Spurling)
  528. Subject: Mac Programming Primer
  529. Organization: Massachusetts Institute of Technology
  530. Date: Thu, 7 May 1992 16:09:18 GMT
  531.  
  532. I am new to Macintosh C programming and am using the Mac Programming Primer with Think C 5.0 and when I use their pointer for window placement:
  533.  
  534. #define MOVE_TO_FRONT -1L
  535.  
  536. I get the error:
  537.  
  538. last argument to function 'GetNewWindow' does not match prototype.
  539.  
  540.  
  541. Can anyone provide me with an explanation and, if possible, the new value for that pointer.
  542.  
  543.  
  544. thanx
  545.  
  546. - -terry spurling
  547.  
  548.  
  549.  
  550. +++++++++++++++++++++++++++
  551.  
  552. From: tlspurli@athena.mit.edu (Terry Spurling)
  553. Organization: Massachusetts Institute of Technology
  554. Date: Thu, 7 May 1992 19:55:30 GMT
  555.  
  556. Thanx to everyone whoo responded to the MOVE_TO_FRONT pointer question I had.  I now have several ways to overcome my problem.!!!!!
  557.  
  558.  
  559. THANX LODES
  560. - -terry
  561.  
  562.  
  563. +++++++++++++++++++++++++++
  564.  
  565. From: mxmora@unix.SRI.COM (Matt Mora)
  566. Date: 8 May 92 15:22:49 GMT
  567. Organization: SRI International, Menlo Park, California
  568.  
  569. In article <1992May7.160918.10541@athena.mit.edu> tlspurli@athena.mit.edu (Terry Spurling) writes:
  570. >I am new to Macintosh C programming and am using the Mac Programming Primer with Think C 5.0 and when I use their pointer for window placement:
  571.  
  572. >#define MOVE_TO_FRONT -1L
  573.  
  574. >I get the error:
  575.  
  576. >last argument to function 'GetNewWindow' does not match prototype.
  577.  
  578. Try #define MOVE_TO_FRONT (WindowPtr) -1L
  579.  
  580. I think you have the Check Pointer types option on in the compiler settings.
  581. Since -1L does not equal a WindowPtr (which is what GetNewWindow wants)
  582. you have to cast it to a WindowPtr type.
  583.  
  584.  
  585. Matt
  586.  
  587.  
  588.  
  589. - -- 
  590. ___________________________________________________________
  591. Matthew Mora                |   my Mac  Matt_Mora@sri.com
  592. SRI International           |  my unix  mxmora@unix.sri.com
  593. ___________________________________________________________
  594.  
  595. ---------------------------
  596.  
  597. From: anarch@bonaire.dartmouth.edu (The Anarch)
  598. Subject: SetHandleSize corrupts block?
  599. Date: 7 May 92 17:21:15 GMT
  600. Organization: Secular Humanists from Hell
  601.  
  602.  
  603.      Has anyone encountered corrupted data as a result of using SetHandleSize?
  604. It *is* supposed to maintain the contents of the current block, right?  I've
  605. always assumed this, and it seemed to work pretty well in the past, but I
  606. notice that Inside Mac doesn't actually *say* that it does, and something is
  607. definitely going wrong for me now.  I'm using SetHandleSize to enlarge a
  608. block, and though the call succeeds, some of the data from before gets changed
  609. (the pieces I've looked at get changed to 0, but I haven't gone through the
  610. entire block).  I've looked through the technical info available to me (tech
  611. notes, Inside Mac) and asked a few people and haven't found any explanation
  612. yet.  I'd appreciate whatever advice people here can offer.  This is Think C
  613. 5.0.1 on a IIfx, Sys 7.0, no INITs, no virtual memory, both 24 and 32 bit
  614. addressing.  Thanks!
  615.  
  616. - -- 
  617. +-+-+-+-+-+-+-+-+-+-+-+anarch@bonaire.dartmouth.edu-+-+-+-+-+-+-+-+-+-+-+-+-+
  618.    "The Walpurgisnacht has become synonomous with any general revelry, and
  619.      particularly for the breaking out of demonic lewdness and disorder."
  620. D I S C L A I M E R :   E V E R Y T H I N G   I   W R I T E   I S   F A L S E
  621.  
  622. +++++++++++++++++++++++++++
  623.  
  624. From: keith@taligent.com (Keith Rollin)
  625. Date: 7 May 92 22:41:49 GMT
  626. Organization: Taligent
  627.  
  628. In article <1992May7.172115.18067@dartvax.dartmouth.edu>,
  629. anarch@bonaire.dartmouth.edu (The Anarch) writes:
  630. >      Has anyone encountered corrupted data as a result of using SetHandleSize?
  631. > It *is* supposed to maintain the contents of the current block, right?  I've
  632. > always assumed this, and it seemed to work pretty well in the past, but I
  633. > notice that Inside Mac doesn't actually *say* that it does, and something is
  634. > definitely going wrong for me now.  I'm using SetHandleSize to enlarge a
  635. > block, and though the call succeeds, some of the data from before gets changed
  636. > (the pieces I've looked at get changed to 0, but I haven't gone through the
  637. > entire block).  I've looked through the technical info available to me (tech
  638. > notes, Inside Mac) and asked a few people and haven't found any explanation
  639. > yet.  I'd appreciate whatever advice people here can offer.  This is Think C
  640. > 5.0.1 on a IIfx, Sys 7.0, no INITs, no virtual memory, both 24 and 32 bit
  641. > addressing.  Thanks!
  642.  
  643. SetHandleSize _does_ preserve the contents of the data block when you make the
  644. block larger. Most applications and the system itself relies on this fact.
  645.  
  646. What immediately comes to mind when I read your problem is that perhaps the
  647. handle is not as large as you think it is when you grow it. In that case, the
  648. bytes you are losing may not actually be bytes that you own.
  649.  
  650. - --
  651. Keith Rollin
  652. Phantom Programmer
  653. Taligent, Inc.
  654.  
  655.  
  656. +++++++++++++++++++++++++++
  657.  
  658. From: anarch@bonaire.dartmouth.edu (The Anarch)
  659. Date: 7 May 92 23:52:10 GMT
  660. Organization: Secular Humanists from Hell
  661.  
  662. I asked for advice about SetHandleSize corrupting data, and
  663. in article <66749@apple.Apple.COM> keith@taligent.com (Keith Rollin) replied:
  664. >SetHandleSize _does_ preserve the contents of the data block when you make the
  665. >block larger. Most applications and the system itself relies on this fact.
  666. >
  667. >What immediately comes to mind when I read your problem is that perhaps the
  668. >handle is not as large as you think it is when you grow it. In that case, the
  669. >bytes you are losing may not actually be bytes that you own.
  670.  
  671.      Not quite, but close--turns out I wasn't asking for as much as I thought.
  672. Misplaced parentheses and some tricky operator precedence will do it every
  673. time.  Sigh...somehow, as soon as I put it onto the net, I knew it would turn
  674. out to be something stupid.  But thanks for your help--I probably wouldn't
  675. have noticed for days without it.
  676.  
  677. - -- 
  678. +-+-+-+-+-+-+-+-+-+-+-+anarch@bonaire.dartmouth.edu-+-+-+-+-+-+-+-+-+-+-+-+-+
  679.    "The Walpurgisnacht has become synonomous with any general revelry, and
  680.      particularly for the breaking out of demonic lewdness and disorder."
  681. D I S C L A I M E R :   E V E R Y T H I N G   I   W R I T E   I S   F A L S E
  682.  
  683. ---------------------------
  684.  
  685. From: mike@optimla.aimla.com (Mike Diehr)
  686. Subject: GWorlds & XCMDs
  687. Date: 7 May 92 22:00:46 GMT
  688. Organization: Philips Interactive Media
  689.  
  690.  
  691. The following code is <most> of an XCMD I`m writing.  The goal
  692. is to take a COLOR snapshot of the screen and do two things with it:
  693. (1) make a COLOR PICT
  694. (2) convert to another file format.
  695.  
  696. To do this, I thought that I'd simply create a new 32 bit GWorld, then
  697. Open a picture, CopyBits() from the screen to the new GWorld, and
  698. finally close and save the picture.  Then, I could use the 32 bit
  699. GWorld to do my own file transformation.
  700.  
  701. However, I'm having trouble accessing the screen.  I have a simpler
  702. version which simply uses OpenCPort(), and this works fine.  I think
  703. I'm having problems with the GWorld stuff.  I'm not trying to access
  704. PixMaps directly, so I don't see why it should be so difficult.
  705. (Note: I am using Spectrum PDQ 24 bit accelerated color card, so 
  706.  I must be careful about doing the GWorld stuff correctly, no?)
  707.  
  708. Some Question:
  709. (1) can I access QuickDraw globals (i.e. thePort) from a XCMD
  710.  (I'm using Think C 5.0.2)
  711. (2) How do I ensure that OpenPicture will create a color pic?
  712.   or do I have to use OpenCPicture?
  713. (3) as you can see below, I'm having trouble with the CopyBits command.
  714.    which form is correct?
  715.  
  716. thanks!
  717.  
  718.  
  719.  
  720.  
  721. #define CLEAN_UP_GWORLD    SetGWorld(savePort, saveDevice);    \
  722.                 UnlockPixels(gWorld->portPixMap);        \
  723.                 DisposeGWorld(gWorld)
  724.  
  725.  
  726.  
  727. #define PICTHEADERSIZE 512
  728.  
  729. #define NIL            0L
  730. #define MINPARAMS    4
  731. #define MAXPARAMS    5
  732.  
  733. Str255 GErrStr;
  734. int        GUseGErrStr = FALSE;
  735.  
  736. pascal void main(XCmdPtr pp)
  737. {
  738.     CGrafPtr            theOldCPort;
  739.     CGrafPtr        oldPort;
  740.     CGrafPtr        newPort;
  741.     RgnHandle        rgn;
  742.     Rect            copyRect;
  743.     PicHandle        pict;
  744.     
  745.     int                ParamNum;
  746.     Str255            ParamStr;
  747.     Rect            theRect, rect2;
  748.     
  749.     Str255            tempStr;
  750.     Handle            tempHandle;
  751.     Point            tempPoint;
  752.     
  753.     Point            p1,p2;
  754.     
  755.     Str255            fileName;
  756.     Str255            fileType;
  757.     Str255            iffTypeStr;
  758.     int                iffType;
  759.     int                doIffFile;
  760.     OSType            fileCreator;
  761.     
  762.     
  763.     /**************************
  764.          GWorld stuff
  765.     ***************************/
  766.     GWorldPtr        gWorld;
  767.     CGrafPtr        savePort;
  768.     GDHandle        saveDevice;
  769.     PixMapHandle     srcPm, destPm;
  770.     
  771.     
  772.     RememberA0();
  773.     SetUpA4();
  774.     
  775.     
  776.     
  777.  
  778.     GetPort (&theOldCPort);
  779.     
  780.  
  781. [ deleted the stuff to read the xcmd parameters ]
  782.  
  783.  
  784.  
  785.     
  786. /*********************
  787.      DO IT 
  788.  **********************/
  789.  
  790.  
  791.      /****************************************
  792.          Create a new 32 bit GWorld,
  793.          lock it
  794.      ****************************************/
  795.      if (
  796.          (NewGWorld(&gWorld, 32, &theRect, NULL, NULL, useTempMem | keepLocal) != noErr) 
  797.  
  798.         )
  799.     {
  800.     
  801.         SetErrorResult(pp, "Error creating GWorld");
  802.         return;
  803.     
  804.     }
  805.  
  806.     /* remember the current GWorld */
  807.     GetGWorld(&savePort, &saveDevice);
  808.     /* set the GWorld to the new one, so that
  809.         the picture routines can read it's pixels */
  810.     SetGWorld(gWorld, NULL);
  811.  
  812.     
  813.     if ( LockPixels(gWorld->portPixMap) == FALSE)
  814.     {
  815.         SetErrorResult(pp, "Error locking GWorld");
  816.         return;
  817.     }
  818.     
  819.     
  820.  
  821.     pict = OpenPicture(&theRect);
  822.     if (!pict)
  823.     {
  824.     
  825.     
  826.         CLEAN_UP_GWORLD;
  827.         
  828.         SetErrorResult(pp, "Error creating PICT");
  829.         return;
  830.     }
  831.     
  832.     srcPm = GetGWorldPixMap(savePort);
  833.     destPm = GetGWorldPixMap(gWorld);
  834.  
  835.     /* ARRGH, I don't know which one is right??? */
  836.  
  837.     //CopyBits((BitMap*) *srcPm, (BitMap*) *destPm,&theRect,&theRect,srcCopy,NIL);
  838.     //CopyBits(&theOldPort->portBits, (BitMap*) *destPm,&theRect,&theRect,srcCopy,NIL);
  839.     CopyBits( (BitMap*)*(theOldCPort->portPixMap), (BitMap*) *destPm,&theRect,&theRect,srcCopy,NIL);
  840.     //CopyBits(&thePort->portBits, (BitMap*)*destPm,&theRect,&theRect,srcCopy,NIL);
  841.     //CopyBits(&newPort->portPixMap,&newPort->portPixMap,&theRect,&theRect,srcCopy,NIL);
  842.     
  843.     ClosePicture();
  844.     
  845.     
  846.  
  847.         /********************
  848.             Add PICT to resource
  849.         **********************/
  850.     
  851.         AddResource(pict,'PICT',0,"\pTest Picture2");
  852.         if (ResError())
  853.         {
  854.             SetErrorResult(pp, "Error creating PICT resource");
  855.  
  856.             //ClosePort(newPort);
  857.             //DisposPtr(newPort);
  858.             //SetPort(oldPort);
  859.             CLEAN_UP_GWORLD;
  860.             return;
  861.         }
  862.         
  863.         ChangedResource(pict);
  864.         WriteResource(pict);
  865.         
  866.         UpdateResFile(CurResFile());
  867.         
  868.         ReleaseResource(pict);
  869.     
  870.     }
  871.     DisposeHandle(pict);
  872.  
  873.  
  874.     /********************
  875.         Clean Up
  876.     ********************/
  877.     CLEAN_UP_GWORLD;
  878.  
  879.     RestoreA4();
  880. }
  881.  
  882.  
  883. - -mike
  884.  
  885. +++++++++++++++++++++++++++
  886.  
  887. From: ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University)
  888. Date: 8 May 92 19:22:43 +1200
  889. Organization: University of Waikato, Hamilton, New Zealand
  890.  
  891. In article <1992May7.220046.11083@aimla.com>, mike@optimla.aimla.com (Mike Diehr) writes:
  892.  
  893. > Some Question:
  894. > (1) can I access QuickDraw globals (i.e. thePort) from a XCMD
  895. >  (I'm using Think C 5.0.2)
  896.  
  897. Yes, but you have to double-indirect from A5. That is, A5 itself points to a
  898. longword which contains the address of the QuickDraw globals.
  899.  
  900. > (2) How do I ensure that OpenPicture will create a color pic?
  901. >   or do I have to use OpenCPicture?
  902.  
  903. OpenPicture will do fine if the current port is a CGrafPort.
  904.  
  905. > (3) as you can see below, I'm having trouble with the CopyBits command.
  906. >    which form is correct?
  907. >
  908. > #define CLEAN_UP_GWORLD    SetGWorld(savePort, saveDevice);    \
  909. >                 UnlockPixels(gWorld->portPixMap);        \
  910. >                 DisposeGWorld(gWorld)
  911.  
  912. You can save yourself the unlock call, if you're going to dispose of the
  913. GWorld anyway.
  914.  
  915. >     GetPort (&theOldCPort);
  916.  
  917. >      if (
  918. >          (NewGWorld(&gWorld, 32, &theRect, NULL, NULL, useTempMem | keepLocal) != noErr)
  919. >
  920. >         )
  921. >     {
  922. >
  923. >         SetErrorResult(pp, "Error creating GWorld");
  924. >         return;
  925. >
  926. >     }
  927. >
  928. >     /* remember the current GWorld */
  929. >     GetGWorld(&savePort, &saveDevice);
  930.  
  931. Hmm, it seems to me you've now got a pointer to the card window GrafPort
  932. in both theOldCPort and savePort. Surely you don't need both?
  933.  
  934. >     /* set the GWorld to the new one, so that
  935. >         the picture routines can read it's pixels */
  936. >     SetGWorld(gWorld, NULL);
  937. >
  938. >
  939. >     if ( LockPixels(gWorld->portPixMap) == FALSE)
  940. >     {
  941. >         SetErrorResult(pp, "Error locking GWorld");
  942. >         return;
  943. >     }
  944.  
  945. Personally I prefer to lock the pixels BEFORE making the GWorld current.
  946.  
  947. >
  948. >
  949. >
  950. >     pict = OpenPicture(&theRect);
  951. >     if (!pict)
  952. >     {
  953. >
  954. >
  955. >         CLEAN_UP_GWORLD;
  956. >
  957. >         SetErrorResult(pp, "Error creating PICT");
  958. >         return;
  959. >     }
  960. >
  961. >     srcPm = GetGWorldPixMap(savePort);
  962. >     destPm = GetGWorldPixMap(gWorld);
  963.  
  964. GetGWorldPixMap is known not to work correctly in 32-Bit QuickDraw 1.2
  965. (Systems 6.0.x, x >= 5). (Did it work correctly in earlier versions?)
  966. Of course, if your code will only run under System 7, that's no problem.
  967. Otherwise, I'd suggest using:
  968.  
  969.     srcPm = savePort->portPixMap;
  970.     destPm = gWorld->portPixMap;
  971.  
  972. (This code will only malfunction with black-and-white gworlds on non-colour-
  973. capable machines--a feature new with System 7.)
  974.  
  975. >
  976. >     /* ARRGH, I don't know which one is right??? */
  977. >
  978. >     //CopyBits((BitMap*) *srcPm, (BitMap*) *destPm,&theRect,&theRect,
  979. >          srcCopy,NIL);
  980.  
  981. This one should work! However, I suspect you should lock down the pixmap
  982. handles before doing this; I'm not sure if QuickDraw will do this for you.
  983.  
  984. >     //CopyBits(&theOldPort->portBits, (BitMap*) *destPm,&theRect,&theRect,
  985. >          srcCopy,NIL);
  986.  
  987. Yes, this one should work too. You can always pretend that a CGrafPort is
  988. a GrafPort, pass the address of its portBits field, and QuickDraw will do the
  989. right thing. My worries about locking pixmaps still apply to the second
  990. argument.
  991.  
  992. >     CopyBits( (BitMap*)*(theOldCPort->portPixMap), (BitMap*) *destPm,
  993. >          &theRect,&theRect,srcCopy,NIL);
  994.  
  995. Should work, provided pixmaps are locked.
  996.  
  997. >     //CopyBits(&thePort->portBits, (BitMap*)*destPm,&theRect,&theRect,
  998. >          srcCopy,NIL);
  999.  
  1000. Ditto.
  1001.  
  1002. >     //CopyBits(&newPort->portPixMap,&newPort->portPixMap,&theRect,&theRect,
  1003. >          srcCopy,NIL);
  1004.  
  1005. No, I don't think you can pass a pixmap handle; it must be a pointer to
  1006. an actual bitmap or pixmap.
  1007.  
  1008. [rest of the code looks OK]
  1009.  
  1010. Lawrence D'Oliveiro                       fone: +64-7-856-2889
  1011. Computer Services Dept                     fax: +64-7-838-4066
  1012. University of Waikato            electric mail: ldo@waikato.ac.nz
  1013. Hamilton, New Zealand    37^ 47' 26" S, 175^ 19' 7" E, GMT+13:00
  1014. Brought to you by Chemical Computing, Inc: We may not have the solution,
  1015. but at least we can provide the solvent.
  1016.  
  1017. ---------------------------
  1018.  
  1019. From: tj@kona.cs.ucla.edu (Tom Johnson)
  1020. Subject: Forcing CTB Serial Connection to close - How?
  1021. Organization: UCLA Computer Science Department
  1022. Date: Fri, 8 May 92 06:13:36 GMT
  1023.  
  1024. A question for the CTB experts out there:
  1025.  
  1026. How can you force the CTB to close a serial connection and free up a
  1027. serial port when you no longer have a ConnHandle and can't call CMClose?
  1028.  
  1029. Background:  I'm working on an application that uses the CTB for serial port
  1030. connections.  Every once in a while I'll crash my mac during development and
  1031. when I try to relaunch my application and open up the serial port again,
  1032. I get a "Sorry that port is busy" error dialog, since I was never able to 
  1033. call CMClose.  I would like to throw together a quick FKEY or an application
  1034. that forces all serial connections to close, so I don't have to reboot my
  1035. machine before I get back to work.
  1036.  
  1037. Any ideas?
  1038.  
  1039. Thanks-
  1040.   Tom
  1041. - -- 
  1042. Tom Johnson             "They say Confucious does his crossword with a pen."
  1043. tj@cs.ucla.edu                               -Tori Amos
  1044.  
  1045. +++++++++++++++++++++++++++
  1046.  
  1047. From: lipa@camis.Stanford.EDU (Bill Lipa)
  1048. Date: 8 May 92 07:16:31 GMT
  1049. Organization: Stanford School of Medicine
  1050.  
  1051. In article <1992May8.061336.22666@cs.ucla.edu> tj@kona.cs.ucla.edu (Tom Johnson) writes:
  1052. >How can you force the CTB to close a serial connection and free up a
  1053. >serial port when you no longer have a ConnHandle and can't call CMClose?
  1054. >Background:  I'm working on an application that uses the CTB for serial port
  1055. >connections.  Every once in a while I'll crash my mac during development and
  1056. >when I try to relaunch my application and open up the serial port again,
  1057. >I get a "Sorry that port is busy" error dialog, since I was never able to 
  1058. >call CMClose.
  1059.  
  1060. I think that holding down the option or control key will turn the OK in that
  1061. dialog to Override. However, a more significant problem you may face might
  1062. be crashes from subsequent CTB calls after an app crashes. The CTB does not
  1063. properly clean up in this case. You HAVE to call CMClose if you want
  1064. reliable operation in later apps. This makes development an incredible pain.
  1065.  
  1066. I debug my CTB apps with sanity intact by having a routine called terminate.
  1067. This is a panic exit function that calls CMClose for me. When my program
  1068. crashes, I get into MacsBug and type "g terminate". Most of the time, this
  1069. works pretty well.
  1070.  
  1071. Bill Lipa
  1072. lipa@camis.stanford.edu
  1073.  
  1074. ---------------------------
  1075.  
  1076. From: gft_robert@gsbacd.uchicago.edu (opcode ranger)
  1077. Subject: Trying to get an overview of MacApp 3.0 classes: 2 quick questions
  1078. Date: 30 Apr 92 03:31:53 GMT
  1079.  
  1080. Two quick MacApp (3.0) questions:
  1081.  
  1082. I'm looking for some overview of the MA class hierarchy, and it occurred to me
  1083. that parsing the library code (.cp files) with MacBrowse would be a good idea. 
  1084. It all seemed to parse fine(i.e. it said it was parsing all the U*.cp files),
  1085. but it only shows me the global routines and a couple of other classes, but not
  1086. most of them.  What gives?
  1087.  
  1088. Also, in the MacApp tutorial and/or programmer's guide there is reference made
  1089. to some sort of MacApp reference that details all the MA classes (I don't have
  1090. the manuals on me so I can't look up the exact title).  Is there such a beast? 
  1091. I don't recall having gotten anything like that with my ETO shipment.
  1092.  
  1093.  
  1094. Thanks for any help! (email would be best since my line charges are high to read
  1095. this group).
  1096.  
  1097. Robert
  1098.  
  1099. - -- 
  1100. ==============================================================================
  1101. = gft_robert@gsbacd.uchicago.edu * "Out there on a darkened road, the lights =
  1102. = are dead and the cars explode" -- "Good Things", Sisters of Mercy           =
  1103. ==============================================================================
  1104.  
  1105. +++++++++++++++++++++++++++
  1106.  
  1107. From: cory@enigami.mv.com (Cory Kempf)
  1108. Date: Thu, 7 May 92 21:50:32 EST
  1109. Organization: EnigamI, Inc., Nashua, NH
  1110.  
  1111.  
  1112. In article <1992Apr29.213153.1@gsbacd.uchicago.edu> (comp.sys.mac.programmer), gft_robert@gsbacd.uchicago.edu (opcode ranger) writes:
  1113. >Two quick MacApp (3.0) questions:
  1114. >
  1115. >I'm looking for some overview of the MA class hierarchy, and it occurred to me
  1116. >that parsing the library code (.cp files) with MacBrowse would be a good idea. 
  1117.  
  1118. There is a chart that was in one of the manuals that came with ETO
  1119. 7 that shows all of the MacApp classes and their inheritance, as well
  1120. as some other commonly needed info.  This may be what you are looking
  1121. for.  As I remember, it was tucked into the release notes, but I am
  1122. not positive.
  1123.  
  1124. >Also, in the MacApp tutorial and/or programmer's guide there is reference made
  1125. >to some sort of MacApp reference that details all the MA classes (I don't have
  1126. >the manuals on me so I can't look up the exact title).  Is there such a beast? 
  1127. >I don't recall having gotten anything like that with my ETO shipment.
  1128.  
  1129. There is a Programmer's Guide to MacApp, but it really sucks.  It
  1130. gives the most cursory overview of the classes, and how they are to
  1131. be used, but the examples are trivial at best, and most of the classes
  1132. are missing.
  1133.  
  1134. What MacApp really needs is good documentation.  I am trying to learn
  1135. MacApp / write a small program in it, and I spend most of my time
  1136. trying to trace the source code.  A good set of Unix-style man pages
  1137. for each class (preferably with each one duplicating the info in the
  1138. super classes) would be ideal!  411's MacApp support is a joke.  70%
  1139. of the time, I cannot find methods / constants / datatypes that MacApp
  1140. uses, and the rest, I can almost never select some of my code and
  1141. get anywhere with MacApp like I can with the toolbox.
  1142.  
  1143. If Apple really wants people to use MacApp, good docs & 411 support
  1144. are essential!
  1145.  
  1146. +C
  1147.  
  1148.  
  1149. - -------------------------------------------------------------
  1150. Cory Kempf                    EnigamI, Inc.
  1151. cory@enigami.mv.com           ...!decvax!enigami!cory
  1152. Microsoft Free and Proud Of It!... 
  1153.                            ...Microsoft Products: Just Say no.
  1154.  
  1155. ---------------------------
  1156.  
  1157. From: mspace@netcom.com (Brian Hall)
  1158. Subject: Launching an appe
  1159. Date: 30 Apr 92 06:12:57 GMT
  1160. Organization: Netcom - Online Communication Services  (408 241-9760 guest)
  1161.  
  1162. Anyone know of a way to launch an 'appe' (background only) application
  1163. at a time other than startup?  ('appe's live in the extentions folder)
  1164.  
  1165. - -- 
  1166.  
  1167.  \ | /   | Brian Hall                 mspace@netcom.com
  1168.  - : -   | Mark/Space Softworks       Applelink: markspace
  1169.   /|\    |                            America Online: MarkSpace
  1170.  |-+-|   |
  1171. /-\|/-\  | People don't kill people, toasters kill people.
  1172.  
  1173. +++++++++++++++++++++++++++
  1174.  
  1175. From: leonardr@ccs.itd.umich.edu
  1176. Organization: Campus Computing Sites, University of Michigan-Ann Arbor
  1177. Date: Thu, 30 Apr 92 16:49:21 GMT
  1178.  
  1179. In article <3q+k92q.mspace@netcom.com> mspace@netcom.com (Brian Hall) writes:
  1180. >Anyone know of a way to launch an 'appe' (background only) application
  1181. >at a time other than startup?  ('appe's live in the extentions folder)
  1182. >
  1183.     Sure, same way you'd launch an application - call _LaunchApplication.
  1184. The only thing "special" about the 'appe' is that the Finder knows where
  1185. to put them & they can be launched at startup.  You can even put an 'appe'
  1186. inside something else (like a cdev) and have it launched - the new version
  1187. of Rival does this so that it can recieve anti-viral Apple events.
  1188.  
  1189.  
  1190. - -- 
  1191. - -----------------------------------------------------------------------
  1192. Leonard Rosenthol          Internet: leonardr@ccs.itd.umich.edu
  1193. Director of Advanced Technology   AppleLink: MACgician
  1194. Aladdin Systems, inc.          GEnie:     MACgician
  1195.  
  1196. +++++++++++++++++++++++++++
  1197.  
  1198. From: ross@bnr.ca (Ross Brown)
  1199. Date: 1 May 92 14:06:39 GMT
  1200. Organization: Bell-Northern Research
  1201.  
  1202. In article <1992Apr30.164921.16118@terminator.cc.umich.edu>
  1203. leonardr@ccs.itd.umich.edu writes:
  1204. >In article <3q+k92q.mspace@netcom.com> mspace@netcom.com (Brian Hall) writes:
  1205. >>Anyone know of a way to launch an 'appe' (background only) application
  1206. >>at a time other than startup?  ('appe's live in the extentions folder)
  1207. >>
  1208. >    Sure, same way you'd launch an application - call _LaunchApplication.
  1209. >The only thing "special" about the 'appe' is that the Finder knows where
  1210. >to put them & they can be launched at startup.  You can even put an 'appe'
  1211. >inside something else (like a cdev) and have it launched - the new version
  1212. >of Rival does this so that it can recieve anti-viral Apple events.
  1213.  
  1214. This is a topic of much interest.  Not everyone has access to d e v e l o p. 
  1215. Can anyone summarize all the differences between 'appe's and 'APPL's for the
  1216. benefit of this newsgroup?
  1217.  
  1218. Specifically, I want to know:  Can 'appe's have bundles and be launched by the
  1219. Finder when the user double-clicks on an associated file?
  1220.  
  1221. Ross Brown
  1222. Bell-Northern Research Ltd.
  1223. Ottawa, Ontario, Canada
  1224. ross@bnr.ca
  1225. Opinions expressed do not necessarily represent those of BNR.
  1226.  
  1227. +++++++++++++++++++++++++++
  1228.  
  1229. From: sagen@techbook.com (Milton Sagen)
  1230. Date: 5 May 92 18:08:54 GMT
  1231. Organization: TECHbooks of Beaverton Oregon - Public Access Unix
  1232.  
  1233. In article <1992May1.140639.26427@bmers95.bnr.ca> ross@bnr.ca (Ross Brown) writes:
  1234. >This is a topic of much interest.  Not everyone has access to d e v e l o p. 
  1235.  
  1236. Speaking of d e v e l o p, I haven't received a copy since the autumn 1991
  1237. edition.  Anybody else having problems?  Was this the last issue everbody
  1238. else received?  Who should I call to check on this?  APDA?
  1239.  
  1240. I apologize for the interruption.  I now return you to our regular programming.
  1241. - -- 
  1242. Milton E. Sagen                          sagen@techbook.COM
  1243. Software Engineer                        !{sequent,nosun,uunet}techbook!sagen 
  1244. Prometheus Products, Inc.                (503) 692-9600 (voice)
  1245. Tualatin, OR 97062                       (503) 691-1101 (fax)
  1246.  
  1247. +++++++++++++++++++++++++++
  1248.  
  1249. From: gavin.eadie@umich.edu (Gavin Eadie)
  1250. Date: 6 May 92 14:58:51 GMT
  1251. Organization: University of Michigan
  1252.  
  1253. I've been developing a background application framework which I plan to
  1254. use for a collection of small collaborating tasks.  In doing this work, I
  1255. learned a few things about these beasts.
  1256.  
  1257. First, though we might call them 'appe's that doesn't have to be the file
  1258. type of the application. Mine are all regular 'APPL' files and that seems
  1259. to work just fine.  I launch them via the Finder by double click or
  1260. menu-'Open'.
  1261.  
  1262. They are totally invisible while running, they don't show in the 'About
  1263. This Macintosh...' display, they don't show in the application menu on
  1264. the top right of the screen.  Mine just still there, quiet as mice, and
  1265. take tiny slices of CPU time every 10 seconds.  The only way to find them
  1266. is via Process Manager calls in a litle app like NoFinder (which displays
  1267. a list of running apps, including faceless ones, and let's you quit
  1268. them).  You need something like NoFinder to cause them to stop by the way
  1269. - - or use Frontier and send them a 'quit' AppleEvent.
  1270.  
  1271. There's one strangeness that I've noticed.  If you launch a
  1272. background-app from the Finder, the icon of the application goes grey as
  1273. it launches.  It stays grey after you kill the running application - I
  1274. assume Finder has no way to restore the solid icon of the app because it
  1275. has no idea the background app has been stopped.  Similarly, of course,
  1276. if you use Frontier to launch a background app, the Finder doesn't grey
  1277. it's icon.
  1278.  
  1279. I think the potential for these little apps is pretty exciting. What
  1280. background processes would you want to run on your Mac all day, every
  1281. day?!
  1282. ===
  1283. Gavin Eadie, Ramsay Consulting
  1284.  
  1285. +++++++++++++++++++++++++++
  1286.  
  1287. From: mwalker@wc.novell.com (Mel Walker)
  1288. Organization: Novell, Inc. - Walnut Creek
  1289. Date: Wed, 6 May 1992 15:45:44 GMT
  1290.  
  1291. In article <1992May6.145851.26541@terminator.cc.umich.edu> gavin.eadie@umich.edu (Gavin Eadie) writes:
  1292. >There's one strangeness that I've noticed.  If you launch a
  1293. >background-app from the Finder, the icon of the application goes grey as
  1294. >it launches.  It stays grey after you kill the running application - I
  1295. >assume Finder has no way to restore the solid icon of the app because it
  1296. >has no idea the background app has been stopped.  Similarly, of course,
  1297. >if you use Frontier to launch a background app, the Finder doesn't grey
  1298. >it's icon.
  1299.  
  1300. The finder restores the solid icon of the app as soon as possible after the
  1301. DrawMenuBar() trap is called, if some manager (which one I can't remember,
  1302. but it's not QuickDraw) is inited. Hence, a FBA will never call DrawMenuBar,
  1303. and so the finder doesn't know to solidify the icon. At least, this is how
  1304. it was explained to me.
  1305.  
  1306.  
  1307. - --
  1308. +------------------------------+---------------------------------------------+
  1309. + Mel Walker                   | ******** Dave Barry for President ********  +
  1310. + mwalker@optics.wc.novell.com |  "A clever slogan should be written here"   +
  1311. +------------------------------+---------------------------------------------+
  1312.  
  1313. +++++++++++++++++++++++++++
  1314.  
  1315. From: mspace@netcom.com (Brian Hall)
  1316. Date: 6 May 92 19:48:39 GMT
  1317. Organization: Netcom - Online Communication Services  (408 241-9760 guest)
  1318.  
  1319. Gavin Eadie <gavin.eadie@umich.edu> writes:
  1320.  
  1321. >I've been developing a background application framework which I plan to
  1322. >use for a collection of small collaborating tasks.  In doing this work, I
  1323. >learned a few things about these beasts.
  1324.  
  1325. >First, though we might call them 'appe's that doesn't have to be the file
  1326. >type of the application. Mine are all regular 'APPL' files and that seems
  1327. >to work just fine.  I launch them via the Finder by double click or
  1328. >menu-'Open'.
  1329.  
  1330. I have been using a little app I found on America Online called
  1331. Processorize to launch and kill my background apps.  I'll have to try
  1332. your trick though.
  1333.  
  1334. Any thoughts on how to use a symbolic debugger on these beasts?  I'm using
  1335. Think C 5.0 and it just chokes if I "run" the project instead of building
  1336. the app to disk and then launching it.  I have gone back to mid-80's style
  1337. debugging.  Lots of DebugStr calls.  ICK!
  1338.  
  1339.  
  1340. - -- 
  1341.  
  1342.  \ | /   | Brian Hall                 mspace@netcom.com
  1343.  - : -   | Mark/Space Softworks       Applelink: markspace
  1344.   /|\    |                            America Online: MarkSpace
  1345.  |-+-|   |
  1346. /-\|/-\  | People don't kill people, toasters kill people.
  1347.  
  1348. +++++++++++++++++++++++++++
  1349.  
  1350. From: unity@mcl.mcl.ucsb.edu (Pete Gontier)
  1351. Date: 9 May 92 01:42:13 GMT
  1352.  
  1353. In <1992May1.140639.26427@bmers95.bnr.ca> ross@bnr.ca (Ross Brown) writes:
  1354. >Specifically, I want to know:  Can 'appe's have bundles and be launched by the
  1355. >Finder when the user double-clicks on an associated file?
  1356.  
  1357. No. Unfortunately, I don't have the sort of generalized info you want.
  1358. But I do know that Kiwi(tm) POWER WINDOWS would have one less installed file
  1359. if I could have gotten documents to launch into an (open) 'appe'.
  1360. - --
  1361.  Pete Gontier // EC Technology // unity@mcl.ucsb.edu
  1362.  
  1363. ---------------------------
  1364.  
  1365. End of C.S.M.P. Digest
  1366. **********************
  1367.