Correction for exception when dragging images/sounds.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@20513 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2005-01-02 20:07:36 +00:00
parent 6d04958743
commit b9e8478246
3 changed files with 36 additions and 22 deletions

View file

@ -1,3 +1,9 @@
2005-01-02 15:11 Gregory John Casamento <greg_casamento@yahoo.com>
* GormImageEditor.m
* GormSoundEditor.m: Fix to correct exception when dragging
from a cell which doesn't contain a resource.
2005-01-01 10:33 Gregory John Casamento <greg_casamento@yahoo.com>
* GormLib/IBObjectAdditions.m: Implementation for nibLabel.

View file

@ -373,18 +373,22 @@ static int handled_mask= NSDragOperationCopy|NSDragOperationGeneric|NSDragOperat
int pos;
pos = row * [self numberOfColumns] + column;
pb = [NSPasteboard pasteboardWithName: NSDragPboard];
[pb declareTypes: [NSArray arrayWithObject: GormImagePboardType]
owner: self];
[pb setString: [[objects objectAtIndex: pos] imageName]
forType: GormImagePboardType];
[self dragImage: [[objects objectAtIndex: pos] image]
at: lastLocation
offset: NSZeroSize
// don't allow the user to drag empty resources.
if(pos < [objects count])
{
pb = [NSPasteboard pasteboardWithName: NSDragPboard];
[pb declareTypes: [NSArray arrayWithObject: GormImagePboardType]
owner: self];
[pb setString: [[objects objectAtIndex: pos] imageName]
forType: GormImagePboardType];
[self dragImage: [[objects objectAtIndex: pos] image]
at: lastLocation
offset: NSZeroSize
event: theEvent
pasteboard: pb
source: self
slideBack: YES];
pasteboard: pb
source: self
slideBack: YES];
}
return;
}

View file

@ -364,18 +364,22 @@ static NSMapTable *docMap = 0;
int pos;
pos = row * [self numberOfColumns] + column;
pb = [NSPasteboard pasteboardWithName: NSDragPboard];
[pb declareTypes: [NSArray arrayWithObject: GormSoundPboardType]
owner: self];
[pb setString: [[objects objectAtIndex: pos] soundName]
forType: GormSoundPboardType];
[self dragImage: [[objects objectAtIndex: pos] soundImageForViewer]
at: lastLocation
offset: NSZeroSize
// don't allow the user to drag empty resources.
if(pos < [objects count])
{
pb = [NSPasteboard pasteboardWithName: NSDragPboard];
[pb declareTypes: [NSArray arrayWithObject: GormSoundPboardType]
owner: self];
[pb setString: [[objects objectAtIndex: pos] soundName]
forType: GormSoundPboardType];
[self dragImage: [[objects objectAtIndex: pos] soundImageForViewer]
at: lastLocation
offset: NSZeroSize
event: theEvent
pasteboard: pb
source: self
slideBack: YES];
pasteboard: pb
source: self
slideBack: YES];
}
return;
}