mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 07:00:46 +00:00
Handle NSTiffPboardType. Based on patch from Nicolas Roard.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@17693 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
50b7d5288b
commit
310ac897be
2 changed files with 31 additions and 3 deletions
|
@ -1,3 +1,8 @@
|
|||
2003-09-21 15:15 Alexander Malmberg <alexander@malmberg.org>
|
||||
|
||||
* Source/NSTextView.m (-readSelectionFromPasteboard:type:): Handle
|
||||
NSTIFFPboardType. Based on patch from Nicolas Roard.
|
||||
|
||||
2003-09-20 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
* Source/NSWindowController.m ([NSWindowController -setDocument:]):
|
||||
|
|
|
@ -3554,7 +3554,30 @@ right.)
|
|||
}
|
||||
return YES;
|
||||
}
|
||||
// TODO: Should also support: NSTIFFPboardType
|
||||
if ([type isEqualToString: NSTIFFPboardType])
|
||||
{
|
||||
if (changeRange.location != NSNotFound)
|
||||
{
|
||||
NSData *pboardData = [pboard dataForType: NSTIFFPboardType];
|
||||
NSFileWrapper *wrapper = [[NSFileWrapper alloc] initRegularFileWithContents: pboardData];
|
||||
NSImage *image = [[NSImage alloc] initWithData: pboardData];
|
||||
NSTextAttachment *attachment = [[NSTextAttachment alloc] initWithFileWrapper: wrapper];
|
||||
NSAttributedString *as = [NSAttributedString attributedStringWithAttachment: attachment];
|
||||
|
||||
[wrapper setIcon: image];
|
||||
if ([self shouldChangeTextInRange: changeRange
|
||||
replacementString: [as string]])
|
||||
{
|
||||
[self replaceCharactersInRange: changeRange
|
||||
withAttributedString: as];
|
||||
[self didChangeText];
|
||||
}
|
||||
RELEASE(attachment);
|
||||
RELEASE(image);
|
||||
RELEASE(wrapper);
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
if ([type isEqualToString: NSFileContentsPboardType])
|
||||
{
|
||||
NSTextAttachment *attachment = [[NSTextAttachment alloc]
|
||||
|
@ -3565,7 +3588,7 @@ right.)
|
|||
|
||||
if (changeRange.location != NSNotFound &&
|
||||
[self shouldChangeTextInRange: changeRange
|
||||
replacementString: [as string]]) /* TODO: is this correct? */
|
||||
replacementString: [as string]])
|
||||
{
|
||||
[self replaceCharactersInRange: changeRange
|
||||
withAttributedString: as];
|
||||
|
@ -3668,7 +3691,7 @@ right.)
|
|||
if (_tf.imports_graphics)
|
||||
{
|
||||
[ret addObject: NSRTFDPboardType];
|
||||
//[ret addObject: NSTIFFPboardType];
|
||||
[ret addObject: NSTIFFPboardType];
|
||||
[ret addObject: NSFileContentsPboardType];
|
||||
}
|
||||
if (_tf.is_rich_text)
|
||||
|
|
Loading…
Reference in a new issue