mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-04-22 22:20:44 +00:00
Improved top level editor switching functionality.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@21150 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
2c832d7795
commit
314f0e9d38
6 changed files with 35 additions and 23 deletions
|
@ -1,3 +1,12 @@
|
|||
2005-04-23 20:13 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* GormCore/GormClassEditor.m: Register for all types.
|
||||
* GormCore/GormDocument.h: Added new method allManagedPbTypes.
|
||||
* GormCore/GormDocument.m: Implemented new method.
|
||||
* GormCore/GormObjectEditor.m: Register for all types.
|
||||
* GormCore/GormPrivate.m: Added call to new method which returns the
|
||||
pb types for all resource managers.
|
||||
|
||||
2005-04-23 14:37 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* GormCore/GNUmakefile: Added new files.
|
||||
|
|
|
@ -103,11 +103,6 @@ NSString *GormClassPboardType = @"GormClassPboardType";
|
|||
|
||||
// expand all of the items in the classesView...
|
||||
[self expandItem: @"NSObject"];
|
||||
|
||||
// register for types...
|
||||
[self registerForDraggedTypes: [NSArray arrayWithObjects: GormLinkPboardType,
|
||||
NSFilenamesPboardType,
|
||||
nil]];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
|
|
@ -107,6 +107,8 @@
|
|||
- (IBResourceManager *) resourceManagerForPasteboard: (NSPasteboard *)pboard;
|
||||
- (void) changeToTopLevelEditorAcceptingTypes: (NSArray *)types
|
||||
andFileType: (NSString *)fileType;
|
||||
- (void) changeToViewWithTag: (int)tag;
|
||||
- (NSArray *) allManagedPboardTypes;
|
||||
|
||||
/* Managing classes */
|
||||
- (GormClassManager*) classManager;
|
||||
|
|
|
@ -819,7 +819,8 @@ static NSImage *fileImage = nil;
|
|||
- (void) changeToTopLevelEditorAcceptingTypes: (NSArray *)types
|
||||
andFileType: (NSString *)fileType
|
||||
{
|
||||
if([objectsView acceptsTypeFromArray: types])
|
||||
if([objectsView acceptsTypeFromArray: types] &&
|
||||
fileType == nil)
|
||||
{
|
||||
[self changeToViewWithTag: 0];
|
||||
}
|
||||
|
@ -3767,6 +3768,26 @@ static NSImage *fileImage = nil;
|
|||
|
||||
return result;
|
||||
}
|
||||
|
||||
- (NSArray *) allManagedPboardTypes
|
||||
{
|
||||
NSMutableArray *allTypes = [[NSMutableArray alloc] initWithObjects: NSFilenamesPboardType,
|
||||
GormLinkPboardType,
|
||||
nil];
|
||||
NSArray *mgrs = [self resourceManagers];
|
||||
NSEnumerator *en = [mgrs objectEnumerator];
|
||||
IBResourceManager *mgr = nil;
|
||||
|
||||
AUTORELEASE(allTypes);
|
||||
|
||||
while((mgr = [en nextObject]) != nil)
|
||||
{
|
||||
NSArray *pbTypes = [mgr resourcePasteboardTypes];
|
||||
[allTypes addObjectsFromArray: pbTypes];
|
||||
}
|
||||
|
||||
return allTypes;
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation GormDocument (MenuValidation)
|
||||
|
|
|
@ -118,9 +118,7 @@ static NSMapTable *docMap = 0;
|
|||
|
||||
- (BOOL) acceptsTypeFromArray: (NSArray*)types
|
||||
{
|
||||
NSArray *resourceTypes = [resourceManager resourcePasteboardTypes];
|
||||
return ([resourceTypes firstObjectCommonWithArray: types] != nil ||
|
||||
[types containsObject: GormLinkPboardType] == YES);
|
||||
return ([[(GormDocument *)document allManagedPboardTypes] firstObjectCommonWithArray: types] != nil);
|
||||
}
|
||||
|
||||
- (void) pasteInSelection
|
||||
|
|
|
@ -231,20 +231,7 @@ static BOOL _illegalClassSubstitution = NO;
|
|||
+ (void) registerForAllPboardTypes: (id)editor
|
||||
inDocument: (id)doc
|
||||
{
|
||||
NSMutableArray *allTypes = [[NSMutableArray alloc] initWithObjects: NSFilenamesPboardType,
|
||||
GormLinkPboardType, nil];
|
||||
NSArray *mgrs = [(GormDocument *)doc resourceManagers];
|
||||
NSEnumerator *en = [mgrs objectEnumerator];
|
||||
IBResourceManager *mgr = nil;
|
||||
|
||||
AUTORELEASE(allTypes);
|
||||
|
||||
while((mgr = [en nextObject]) != nil)
|
||||
{
|
||||
NSArray *pbTypes = [mgr resourcePasteboardTypes];
|
||||
[allTypes addObjectsFromArray: pbTypes];
|
||||
}
|
||||
|
||||
NSArray *allTypes = [doc allManagedPboardTypes];
|
||||
[editor registerForDraggedTypes: allTypes];
|
||||
}
|
||||
@end
|
||||
|
|
Loading…
Reference in a new issue