mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 18:50:48 +00:00
Commented out unused static variables.
Dummy implementation of new methods. In [openDocumentWithContentsOfFile:display:] call [noteNewRecentDocument:]. In [openDocumentWithContentsOfURL:display:] only call [noteNewRecentDocumentURL:] when document is not nil. Implemented [noteNewRecentDocument:]. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@10606 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
77040f849f
commit
e76f5a553a
1 changed files with 44 additions and 9 deletions
|
@ -42,8 +42,8 @@ static NSString *NSRoleKey = @"NSRole";
|
||||||
static NSString *NSHumanReadableNameKey = @"NSHumanReadableName";
|
static NSString *NSHumanReadableNameKey = @"NSHumanReadableName";
|
||||||
static NSString *NSUnixExtensionsKey = @"NSUnixExtensions";
|
static NSString *NSUnixExtensionsKey = @"NSUnixExtensions";
|
||||||
static NSString *NSDOSExtensionsKey = @"NSDOSExtensions";
|
static NSString *NSDOSExtensionsKey = @"NSDOSExtensions";
|
||||||
static NSString *NSMacOSTypesKey = @"NSMacOSTypes";
|
//static NSString *NSMacOSTypesKey = @"NSMacOSTypes";
|
||||||
static NSString *NSMIMETypesKey = @"NSMIMETypes";
|
//static NSString *NSMIMETypesKey = @"NSMIMETypes";
|
||||||
static NSString *NSDocumentClassKey = @"NSDocumentClass";
|
static NSString *NSDocumentClassKey = @"NSDocumentClass";
|
||||||
|
|
||||||
#define TYPE_INFO(name) TypeInfoForName(_types, name)
|
#define TYPE_INFO(name) TypeInfoForName(_types, name)
|
||||||
|
@ -98,7 +98,7 @@ static NSDictionary *TypeInfoForName (NSArray *types, NSString *typeName)
|
||||||
|
|
||||||
ASSIGN (_types, [customDict objectForKey: NSTypesKey]);
|
ASSIGN (_types, [customDict objectForKey: NSTypesKey]);
|
||||||
_documents = [[NSMutableArray alloc] init];
|
_documents = [[NSMutableArray alloc] init];
|
||||||
// FIXME: Should fill this list form some stored values
|
// FIXME: Should fill this list from some stored values
|
||||||
_recentDocuments = [[NSMutableArray alloc] init];
|
_recentDocuments = [[NSMutableArray alloc] init];
|
||||||
[self setShouldCreateUI:YES];
|
[self setShouldCreateUI:YES];
|
||||||
|
|
||||||
|
@ -214,6 +214,9 @@ static NSDictionary *TypeInfoForName (NSArray *types, NSString *typeName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// remember this document as opened
|
||||||
|
[self noteNewRecentDocument: document];
|
||||||
|
|
||||||
if (display && [self shouldCreateUI])
|
if (display && [self shouldCreateUI])
|
||||||
{
|
{
|
||||||
[document showWindows];
|
[document showWindows];
|
||||||
|
@ -227,9 +230,6 @@ static NSDictionary *TypeInfoForName (NSArray *types, NSString *typeName)
|
||||||
// Should we only do this if [url isFileURL] is YES?
|
// Should we only do this if [url isFileURL] is YES?
|
||||||
NSDocument *document = [self documentForFileName: [url path]];
|
NSDocument *document = [self documentForFileName: [url path]];
|
||||||
|
|
||||||
// remember this document as opened
|
|
||||||
[self noteNewRecentDocumentURL: url];
|
|
||||||
|
|
||||||
if (document == nil)
|
if (document == nil)
|
||||||
{
|
{
|
||||||
NSString *type = [self typeFromFileExtension:
|
NSString *type = [self typeFromFileExtension:
|
||||||
|
@ -250,6 +250,9 @@ static NSDictionary *TypeInfoForName (NSArray *types, NSString *typeName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// remember this document as opened
|
||||||
|
[self noteNewRecentDocumentURL: url];
|
||||||
|
|
||||||
if (display && [self shouldCreateUI])
|
if (display && [self shouldCreateUI])
|
||||||
{
|
{
|
||||||
[document showWindows];
|
[document showWindows];
|
||||||
|
@ -366,6 +369,13 @@ static NSDictionary *TypeInfoForName (NSArray *types, NSString *typeName)
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)closeAllDocumentsWithDelegate:(id)delegate
|
||||||
|
didCloseAllSelector:(SEL)didAllCloseSelector
|
||||||
|
contextInfo:(void *)contextInfo
|
||||||
|
{
|
||||||
|
//FIXME
|
||||||
|
}
|
||||||
|
|
||||||
- (BOOL) reviewUnsavedDocumentsWithAlertTitle: (NSString *)title
|
- (BOOL) reviewUnsavedDocumentsWithAlertTitle: (NSString *)title
|
||||||
cancellable: (BOOL)cancellable
|
cancellable: (BOOL)cancellable
|
||||||
{
|
{
|
||||||
|
@ -394,6 +404,16 @@ static NSDictionary *TypeInfoForName (NSArray *types, NSString *typeName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)reviewUnsavedDocumentsWithAlertTitle:(NSString *)title
|
||||||
|
cancellable:(BOOL)cancellable
|
||||||
|
delegate:(id)delegate
|
||||||
|
didReviewAllSelector:(SEL)didReviewAllSelector
|
||||||
|
contextInfo:(void *)contextInfo
|
||||||
|
{
|
||||||
|
// FIXME
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef OPENSTEP_ONLY
|
#ifdef OPENSTEP_ONLY
|
||||||
/*
|
/*
|
||||||
* App delegate methods. Apple doesn't have these, but they put code
|
* App delegate methods. Apple doesn't have these, but they put code
|
||||||
|
@ -476,8 +496,8 @@ static NSDictionary *TypeInfoForName (NSArray *types, NSString *typeName)
|
||||||
return directory;
|
return directory;
|
||||||
}
|
}
|
||||||
|
|
||||||
//FIXME -- need to remember last saved directory, and return that here.
|
//FIXME -- need to remember last opened directory, and return that here.
|
||||||
//Only return NSHomeDirectory if nothing's been saved yet.
|
//Only return NSHomeDirectory if nothing's been opened yet.
|
||||||
return NSHomeDirectory ();
|
return NSHomeDirectory ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -531,6 +551,12 @@ static NSDictionary *TypeInfoForName (NSArray *types, NSString *typeName)
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)anItem
|
||||||
|
{
|
||||||
|
// FIXME
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
- (NSString *) displayNameForType: (NSString *)type
|
- (NSString *) displayNameForType: (NSString *)type
|
||||||
{
|
{
|
||||||
NSString *name = [TYPE_INFO(type) objectForKey: NSHumanReadableNameKey];
|
NSString *name = [TYPE_INFO(type) objectForKey: NSHumanReadableNameKey];
|
||||||
|
@ -584,6 +610,15 @@ static NSDictionary *TypeInfoForName (NSArray *types, NSString *typeName)
|
||||||
// The number of remembered recent documents
|
// The number of remembered recent documents
|
||||||
#define MAX_DOCS 5
|
#define MAX_DOCS 5
|
||||||
|
|
||||||
|
- (void)noteNewRecentDocument:(NSDocument *)aDocument
|
||||||
|
{
|
||||||
|
NSString *fileName = [aDocument fileName];
|
||||||
|
NSURL *anURL = [NSURL fileURLWithPath: fileName];
|
||||||
|
|
||||||
|
if (anURL != nil)
|
||||||
|
[self noteNewRecentDocumentURL: anURL];
|
||||||
|
}
|
||||||
|
|
||||||
- (void) noteNewRecentDocumentURL: (NSURL *)anURL
|
- (void) noteNewRecentDocumentURL: (NSURL *)anURL
|
||||||
{
|
{
|
||||||
unsigned index = [_recentDocuments indexOfObject: anURL];
|
unsigned index = [_recentDocuments indexOfObject: anURL];
|
||||||
|
@ -611,7 +646,7 @@ static NSDictionary *TypeInfoForName (NSArray *types, NSString *typeName)
|
||||||
@implementation NSDocumentController (Private)
|
@implementation NSDocumentController (Private)
|
||||||
static NSString *NSEditorRole = @"Editor";
|
static NSString *NSEditorRole = @"Editor";
|
||||||
static NSString *NSViewerRole = @"Viewer";
|
static NSString *NSViewerRole = @"Viewer";
|
||||||
static NSString *NSNoRole = @"None";
|
//static NSString *NSNoRole = @"None";
|
||||||
|
|
||||||
- (NSArray *) _editorAndViewerTypesForClass: (Class)documentClass
|
- (NSArray *) _editorAndViewerTypesForClass: (Class)documentClass
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue