[comp.sys.mac.programmer] PICTures to scrap and to files

cws@mbunix.mitre.org (Christopher C. Wilder-Smith) (03/21/90)

I am trying to put a series of saved pictures onto the clipboard, but it
doesn't seem to work just right.  Basically I draw a series of objects and
save each one as a picture in a linked list.  When I have to do a window
update I traverse the list to redraw everything.  That works fine, however,
when I do a copy or a cut operation it is flakey, sometimes it appears on
the clipboard, sometimes only one object appears, most often none.

IM says to turn off saving the picture when doing other ops you don't want
to save but that doesn't supply a ClosePicture() which is needed for a
DrawPicture to work for a window update, for instance.  How is this
typically done?  The scrap manager claims that you can continue to put
similar object types onto the clipboard with PutScrap and they will just be
appended, however, this doesn't seem to work.  It doesn't appear that I'm
using too much memory or anything of that sort.  Here's a short code
segment of what I'm doing


if ( ( error = ZeroScrap()) == noErr) {
	for (p = head; p != NULL; p = p->next) {
	  	if ( (error = PutScrap(GetHandleSize(p->thePic),
	  			'PICT', *(p->thePic))) != noErr) {
	  		SysBeep(1); /* do nothing for now! */
	  	} else {
			...
		}
	}
}

Anyhelp is appreciated!

Thanks,

Chris


================================================================================
--                                 --------------                             --
---   Christopher C. Wilder-Smith   ------------   Everything serious is     ---
----   The MITRE Corporation         ----------   difficult and almost      ----
-----   Burlington Road               --------   everything is serious     -----
------   Bedford, Massachusetts 01730  ------                             ------
-------   cws@mbunix.mitre.org          ----                             -------
--------                                 --                             --------
================================================================================
--

================================================================================
--                                 --------------                             --
---   Christopher C. Wilder-Smith   ------------   Everything serious is     ---
----   The MITRE Corporation         ----------   difficult and almost      ----
-----   Burlington Road               --------   everything is serious     -----
------   Bedford, Massachusetts 01730  ------                             ------
-------   cws@mbunix.mitre.org          ----                             -------
--------                                 --                             --------
================================================================================

cegrw@cc.nu.oz (04/11/90)

> In article <12155.2618b418@cc.nu.oz> cegrw@cc.nu.oz writes:
>> 2. When you get a cut or copy you run though this linked list from start 
> to
>>    finish with StdPutPic. This is where the PICTs have to be less than 
> 32K
>>    because you have to specify how long the PICT is that you are going to
>>    append and the size is an integer.
> 
> If you want to combine several pictures into one you should just open a 
> new picture (for recording) and call DrawPicture with each of the smaller 
> pictures.  That way you don't have to worry about any 32K limit.
> 

Tried that on my SE and all I ever managed to do was hang my machine. Sure IM
reads as if you can do that but I was never able to get it to work ... and I
spent quite some time trying to get it to work!!

Garry Willgoose
Uni of Newcastle
AUSTRALIA