mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-02-23 19:51:00 +00:00
Corrected a problem with switching top level editors during drag and drop.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@21144 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
2d0b6fc07e
commit
577c17a847
5 changed files with 46 additions and 14 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
2005-04-22 17:15 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* GormCore/GormDocument.h: Changed signature.
|
||||
* GormCore/GormDocument.m: Add another parameter on the new
|
||||
method added previously.
|
||||
* GormCore/GormObjectEditor.m: Get the ext to pass and call
|
||||
changeToTopLevelEditorAcceptingTypes:andFileTypes: if the
|
||||
type is NSFilenamePboardType.
|
||||
* GormCore/GormResourceEditor.m: Get the ext to pass and call
|
||||
changeToTopLevelEditorAcceptingTypes:andFileTypes:
|
||||
|
||||
2005-04-22 15:57 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* GormCore/GormDocument.h: Added new method.
|
||||
|
|
|
@ -105,7 +105,8 @@
|
|||
- (void) createResourceManagers;
|
||||
- (NSArray *) resourceManagers;
|
||||
- (IBResourceManager *) resourceManagerForPasteboard: (NSPasteboard *)pboard;
|
||||
- (void) changeToTopLevelEditorAcceptingTypes: (NSArray *)types;
|
||||
- (void) changeToTopLevelEditorAcceptingTypes: (NSArray *)types
|
||||
andFileType: (NSString *)fileType;
|
||||
|
||||
/* Managing classes */
|
||||
- (GormClassManager*) classManager;
|
||||
|
|
|
@ -813,23 +813,29 @@ static NSImage *fileImage = nil;
|
|||
}
|
||||
|
||||
- (void) changeToTopLevelEditorAcceptingTypes: (NSArray *)types
|
||||
andFileType: (NSString *)fileType
|
||||
{
|
||||
if([objectsView acceptsTypeFromArray: types])
|
||||
{
|
||||
[self changeToViewWithTag: 0];
|
||||
}
|
||||
else if([imagesView acceptsTypeFromArray: types])
|
||||
else if([imagesView acceptsTypeFromArray: types] &&
|
||||
[[imagesView fileTypes] containsObject: fileType])
|
||||
{
|
||||
[self changeToViewWithTag: 1];
|
||||
}
|
||||
else if([soundsView acceptsTypeFromArray: types])
|
||||
else if([soundsView acceptsTypeFromArray: types] &&
|
||||
[[soundsView fileTypes] containsObject: fileType])
|
||||
{
|
||||
[self changeToViewWithTag: 2];
|
||||
}
|
||||
else if([classesView acceptsTypeFromArray: types])
|
||||
/*
|
||||
else if([classesView acceptsTypeFromArray: types] &&
|
||||
[[classesView fileTypes] containsObject: fileType])
|
||||
{
|
||||
[self changeToViewWithTag: 3];
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -232,9 +232,18 @@ static NSMapTable *docMap = 0;
|
|||
{
|
||||
dragType = GormLinkPboardType;
|
||||
}
|
||||
else if ([pbTypes containsObject: NSFilenamesPboardType] == YES)
|
||||
{
|
||||
NSArray *data = [dragPb propertyListForType: NSFilenamesPboardType];
|
||||
NSString *fileName = [data objectAtIndex: 0];
|
||||
NSString *ext = [fileName pathExtension];
|
||||
|
||||
[(GormDocument *)document changeToTopLevelEditorAcceptingTypes: pbTypes
|
||||
andFileType: ext];
|
||||
dragType = nil;
|
||||
}
|
||||
else
|
||||
{
|
||||
[(GormDocument *)document changeToTopLevelEditorAcceptingTypes: pbTypes];
|
||||
dragType = nil;
|
||||
}
|
||||
|
||||
|
@ -289,7 +298,8 @@ static NSMapTable *docMap = 0;
|
|||
|
||||
- (void) _registerForAllResourceManagers
|
||||
{
|
||||
NSMutableArray *allTypes = [[NSMutableArray alloc] initWithObjects: GormLinkPboardType, nil];
|
||||
NSMutableArray *allTypes = [[NSMutableArray alloc] initWithObjects: NSFilenamesPboardType,
|
||||
GormLinkPboardType, nil];
|
||||
NSArray *mgrs = [(GormDocument *)document resourceManagers];
|
||||
NSEnumerator *en = [mgrs objectEnumerator];
|
||||
IBResourceManager *mgr = nil;
|
||||
|
|
|
@ -60,6 +60,8 @@ static int handled_mask= NSDragOperationCopy | NSDragOperationGeneric | NSDragOp
|
|||
NSPasteboard *pb = [sender draggingPasteboard];
|
||||
NSArray *pbTypes = [pb types];
|
||||
unsigned int mask = [sender draggingSourceOperationMask];
|
||||
unsigned int oper = NSDragOperationNone;
|
||||
NSString *ext = nil;
|
||||
|
||||
if ((mask & handled_mask) && [pbTypes containsObject: NSFilenamesPboardType])
|
||||
{
|
||||
|
@ -77,25 +79,27 @@ static int handled_mask= NSDragOperationCopy | NSDragOperationGeneric | NSDragOp
|
|||
en = [data objectEnumerator];
|
||||
while((fileName = (NSString *)[en nextObject]) != nil)
|
||||
{
|
||||
NSString *ext = [fileName pathExtension];
|
||||
ext = [fileName pathExtension];
|
||||
if([types containsObject: ext] == YES)
|
||||
{
|
||||
return NSDragOperationCopy;
|
||||
oper = NSDragOperationCopy;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
return NSDragOperationNone;
|
||||
oper = NSDragOperationNone;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return NSDragOperationCopy;
|
||||
}
|
||||
else
|
||||
|
||||
if(oper == NSDragOperationNone)
|
||||
{
|
||||
[(GormDocument *)document changeToTopLevelEditorAcceptingTypes: pbTypes];
|
||||
[(GormDocument *)document changeToTopLevelEditorAcceptingTypes: pbTypes
|
||||
andFileType: ext];
|
||||
}
|
||||
|
||||
return NSDragOperationNone;
|
||||
return oper;
|
||||
}
|
||||
|
||||
- (unsigned int) draggingUpdated: (id<NSDraggingInfo>)sender
|
||||
|
|
Loading…
Reference in a new issue