/* NSDocumentController.m The document controller class Copyright (C) 1999 Free Software Foundation, Inc. Author: Carl Lindberg Date: 1999 Modifications: Fred Kiefer Date: June 2000 This file is part of the GNUstep GUI Library. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include #include #include #include #include static NSString *NSTypesKey = @"NSTypes"; static NSString *NSNameKey = @"NSName"; static NSString *NSRoleKey = @"NSRole"; static NSString *NSHumanReadableNameKey = @"NSHumanReadableName"; static NSString *NSUnixExtensionsKey = @"NSUnixExtensions"; static NSString *NSDOSExtensionsKey = @"NSDOSExtensions"; static NSString *NSMacOSTypesKey = @"NSMacOSTypes"; static NSString *NSMIMETypesKey = @"NSMIMETypes"; static NSString *NSDocumentClassKey = @"NSDocumentClass"; #define TYPE_INFO(name) TypeInfoForName(_types, name) static NSDictionary *TypeInfoForName(NSArray *types, NSString *typeName) { int i, count = [types count]; for (i=0; i MAX_DOCS) [_recentDocuments removeObjectAtIndex: 0]; [_recentDocuments addObject: anURL]; } - (NSArray *)recentDocumentURLs { return _recentDocuments; } @end @implementation NSDocumentController (Private) static NSString *NSEditorRole = @"Editor"; static NSString *NSViewerRole = @"Viewer"; static NSString *NSNoRole = @"None"; - (NSArray *)_editorAndViewerTypesForClass:(Class)documentClass { int i, count = [_types count]; NSMutableArray *types = [NSMutableArray arrayWithCapacity:count]; NSString *docClassName = NSStringFromClass(documentClass); for (i=0; i