Intelligent clipboard pasting
Intelligent clipboard pasting
- Subject: Intelligent clipboard pasting
- From: Ken Tabb <email@hidden>
- Date: Mon, 1 Oct 2001 16:31:50 +0100
Hi,
firstly bear in mind I've not done any clipboard / copy / paste etc.
stuff yet, so I could be talking rubbish (not for the first time...) or
asking for the world etc.
I have an Obj-C image processing app which deals with QuickTime movies
and NSImage-supported files (TIFF / PICT / PDF / JPEG etc.). It detects
humans which are walking around in the movie / image sequence.
I'd like to be able to copy the image / current frame (which is also made
into an NSImage, so in all cases this is an NSImage) out of the app and
into AppleWorks (for instance). But I'd also like to be able to copy and
paste from within the app to another document in the same app. In this
latter instance, I'd like to be able to include extra info in the
clipboard... as well as the bitmap image, I'd like the number and
locations of humans in the image. However when I'm going to AppleWorks, I
only want to copy the image (and not the NSArrays of human locations etc.)
How do I determine where I'm copying from and where I'm pasting to, in
particular:
[1] When 'copy'ing in my app, do I copy everything (as if I was pasting
within the same app, with all info (image + arrays))?
[2] Do I detect (somehow) that, since 'copy'ing an image + NSArray in my
app, the app has lost focus (user changed the foreground app) and so I
should remove everything in the clipboard which isn't the image (so that
only the image is pasted into the other app). If this is the case, (a)
how do I do this and (b) if the user goes back into my app and 'paste's,
it'll only contain the image, so I guess this approach is wrong.
[3] Can you even contain more than 1 thing in the clipboard at once
(image + array of ints), or can you only do this by putting them all in a
custom object class which you've designed to house an image + array etc.
Presumably this requires it to be an object type which other apps will
recognise?
[4] Would this work if pasted into Carbon apps too, or could I only paste
into Cocoa apps? And classic apps (not that this is as important)?
So as you can see I've managed to confuse myself quite successfully about
this. Thanks in advance if you can help... sorry if I've confused you too!
Yours head all a-spinning,
Ken
----------------------------------------------
Ken Tabb
Mac & UNIX Propellerhead & Network Bloke (Health & Human Sciences)
Computer Vision / Neural Network researcher (Computer Science)
University of Hertfordshire
e-mail: email@hidden
http://www.health.herts.ac.uk/ken/
Certified non-Microsoft Solution Provider