[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
problems creating & copying PICTs
- To: info-macl@cambridge.apple.com
- Subject: problems creating & copying PICTs
- From: sbchanin@ai.mit.edu (Steve Chanin)
- Date: Sat, 22 Dec 90 02:01:13 EST
- Reply-to: sbchanin@ai.mit.edu
I have a bunch of code in 1.3.2 which draws pictures composed of lines.
I'd like to be able to create pict's from these pictures which I can paste
into macdraw, edit, and then use in my thesis. In the examples folder is
pict-scrap.lisp which claims to provide this functionality, but I can't get
it to work correctly. If I create a window, (start-picture) and issue a
bunch of (line-to ...)'s, then (put-scrap :pict (get-picture)), it puts the
picture into the scrap. If I then start macdraw (running under MF) and
paste, the picture I captured pastes in fine. However, if I repeat the
same process with a different sequence of (line-to ...)'s, selecting paste
in MacDraw pastes a copy of the first picture (which I would have expected
to have been garbage collected). I can't figure out what's going on, but
appended to the end of this message is some code which I believe
demonstrates the problem. As far as I can tell, externalize-scrap is being
called and I believe macdraw is working correctly because 1) the same
problem arises with superpaint 2) if I copy/paste text from MACL to MacDraw
it works fine, and 3) pasting PICTs between superpaint and macdraw works.
Thanks,
Steve
==============================================================================
;;; -*- Mode: LISP; Syntaxx: Common-lisp; Package: user; Base: 10; -*-
(in-package 'user)
(require 'quickdraw)
(if (not (assoc :pict *scrap-handler-alist* :test #'equal))
(load "examples;pict-scrap"))
(setq xx (oneof *window* :window-size #@(200 200)))
(ask xx (start-picture)
(move-to 0 0)
(line-to 40 50)
(line-to 80 60)
(line-to 40 10)
(line-to 100 30)
(put-scrap :pict (get-picture)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; These are actually not executed, but I copied them from the listener
;;; to give you more information
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;? *scrap-state*
;(:PICT)
;
;? (get-scrap :pict)
;#<Mac Handle, Unlocked, Size 36 #x146A04>
;T
;;;;;;; If I copy some text right now, (i.e. select it and Edit->Copy
;? *scrap-state*
;(:TEXT :FRED)
;
;? (get-scrap :pict)
;NIL
;NIL
;
;? (get-scrap :text)
;"Unlocked" <- this is the word I double clicked
;T
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(ask xx (start-picture)
(move-to 0 0)
(line-to 80 60)
(line-to 100 30)
(put-scrap :pict (get-picture)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; These aren't executed either
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;? *scrap-state*
;(:PICT)
;
;? (get-scrap :pict)
;#<Mac Handle, Unlocked, Size 30 #x146A00>
;T
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;