mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 07:00:47 +00:00
Fixups to avoid crashes opening non-document-based apps.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@28844 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
d2e616cb73
commit
1c8cd6a0c4
4 changed files with 267 additions and 201 deletions
|
@ -31,7 +31,7 @@
|
|||
#define _GNUstep_H_NSDocumentController
|
||||
#import <GNUstepBase/GSVersionMacros.h>
|
||||
|
||||
#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
|
||||
#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
|
||||
|
||||
#include <Foundation/NSObject.h>
|
||||
#include <AppKit/NSNibDeclarations.h>
|
||||
|
@ -53,7 +53,7 @@
|
|||
@private
|
||||
NSMutableArray *_documents;
|
||||
NSMutableArray *_recent_documents;
|
||||
NSArray *_types; // from info.plist with key NSTypes
|
||||
NSArray *_types; // from info.plist with key NSTypes
|
||||
NSTimeInterval _autosavingDelay;
|
||||
struct __controller_flags {
|
||||
unsigned int should_create_ui:1;
|
||||
|
@ -62,111 +62,129 @@
|
|||
void *_reserved1;
|
||||
}
|
||||
|
||||
+ (id)sharedDocumentController;
|
||||
+ (id) sharedDocumentController;
|
||||
|
||||
/*" document creation "*/
|
||||
// doesn't create the windowControllers
|
||||
- (id)makeUntitledDocumentOfType:(NSString *)type;
|
||||
- (id)makeDocumentWithContentsOfFile:(NSString *)fileName ofType:(NSString *)type;
|
||||
- (id) makeUntitledDocumentOfType: (NSString*)type;
|
||||
- (id) makeDocumentWithContentsOfFile: (NSString*)fileName
|
||||
ofType: (NSString*)type;
|
||||
// creates window controllers
|
||||
- (id)openUntitledDocumentOfType:(NSString*)type display:(BOOL)display;
|
||||
- (id)openDocumentWithContentsOfFile:(NSString *)fileName display:(BOOL)display;
|
||||
- (id) openUntitledDocumentOfType: (NSString*)type
|
||||
display: (BOOL)display;
|
||||
- (id) openDocumentWithContentsOfFile: (NSString*)fileName
|
||||
display: (BOOL)display;
|
||||
|
||||
- (id)makeDocumentWithContentsOfURL:(NSURL *)url ofType:(NSString *)type;
|
||||
- (id)openDocumentWithContentsOfURL:(NSURL *)url display:(BOOL)display;
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
|
||||
- (id)makeDocumentForURL:(NSURL *)url
|
||||
withContentsOfURL:(NSURL *)contents
|
||||
ofType:(NSString *)type
|
||||
error:(NSError **)err;
|
||||
- (id)makeDocumentWithContentsOfURL:(NSURL *)url
|
||||
ofType:(NSString *)type
|
||||
error:(NSError **)err;
|
||||
- (id)makeUntitledDocumentOfType:(NSString *)type
|
||||
error:(NSError **)err;
|
||||
- (id)openDocumentWithContentsOfURL:(NSURL *) url
|
||||
display:(BOOL) flag
|
||||
error:(NSError **) err;
|
||||
- (id)openUntitledDocumentAndDisplay:(BOOL)flag
|
||||
error:(NSError **)err;
|
||||
- (BOOL)reopenDocumentForURL:(NSURL *)url
|
||||
withContentsOfURL:(NSURL *)contents
|
||||
error:(NSError **)err;
|
||||
- (BOOL)presentError:(NSError *)err;
|
||||
- (void)presentError:(NSError *)err
|
||||
modalForWindow:(NSWindow *)win
|
||||
delegate:(id)delegate
|
||||
didPresentSelector:(SEL)sel
|
||||
contextInfo:(void *)context;
|
||||
- (NSError *)willPresentError:(NSError *)err;
|
||||
- (id) makeDocumentWithContentsOfURL: (NSURL*)url
|
||||
ofType: (NSString*)type;
|
||||
- (id) openDocumentWithContentsOfURL: (NSURL*)url
|
||||
display: (BOOL)display;
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
|
||||
- (id) makeDocumentForURL: (NSURL*)url
|
||||
withContentsOfURL: (NSURL*)contents
|
||||
ofType: (NSString*)type
|
||||
error: (NSError**)err;
|
||||
- (id) makeDocumentWithContentsOfURL: (NSURL*)url
|
||||
ofType: (NSString*)type
|
||||
error: (NSError**)err;
|
||||
- (id) makeUntitledDocumentOfType: (NSString*)type
|
||||
error: (NSError**)err;
|
||||
- (id) openDocumentWithContentsOfURL: (NSURL*)url
|
||||
display: (BOOL)flag
|
||||
error: (NSError**)err;
|
||||
- (id) openUntitledDocumentAndDisplay: (BOOL)flag
|
||||
error: (NSError**)err;
|
||||
- (BOOL) reopenDocumentForURL: (NSURL*)url
|
||||
withContentsOfURL: (NSURL*)contents
|
||||
error: (NSError**)err;
|
||||
- (BOOL) presentError: (NSError*)err;
|
||||
- (void) presentError: (NSError*)err
|
||||
modalForWindow: (NSWindow*)win
|
||||
delegate: (id)delegate
|
||||
didPresentSelector: (SEL)sel
|
||||
contextInfo: (void*)context;
|
||||
- (NSError*) willPresentError: (NSError*)err;
|
||||
#endif
|
||||
|
||||
/*" With or without UI "*/
|
||||
- (BOOL)shouldCreateUI;
|
||||
- (void)setShouldCreateUI:(BOOL)flag;
|
||||
- (BOOL) shouldCreateUI;
|
||||
- (void) setShouldCreateUI: (BOOL)flag;
|
||||
|
||||
/*" Actions "*/
|
||||
- (IBAction)saveAllDocuments:(id)sender;
|
||||
- (IBAction)openDocument:(id)sender;
|
||||
- (IBAction)newDocument:(id)sender;
|
||||
- (IBAction)clearRecentDocuments:(id)sender;
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
|
||||
- (IBAction) saveAllDocuments: (id)sender;
|
||||
- (IBAction) openDocument: (id)sender;
|
||||
- (IBAction) newDocument: (id)sender;
|
||||
- (IBAction) clearRecentDocuments: (id)sender;
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
|
||||
- (NSUInteger) maximumRecentDocumentCount;
|
||||
#endif
|
||||
|
||||
/*" Recent Documents "*/
|
||||
- (void)noteNewRecentDocument:(NSDocument *)aDocument;
|
||||
- (void)noteNewRecentDocumentURL:(NSURL *)anURL;
|
||||
- (NSArray *)recentDocumentURLs;
|
||||
- (void) noteNewRecentDocument: (NSDocument*)aDocument;
|
||||
- (void) noteNewRecentDocumentURL: (NSURL*)anURL;
|
||||
- (NSArray*) recentDocumentURLs;
|
||||
|
||||
/*" Open panel "*/
|
||||
- (NSArray *)URLsFromRunningOpenPanel;
|
||||
- (NSArray *)fileNamesFromRunningOpenPanel;
|
||||
- (NSInteger)runModalOpenPanel:(NSOpenPanel *)openPanel forTypes:(NSArray *)openableFileExtensions;
|
||||
- (NSArray*) URLsFromRunningOpenPanel;
|
||||
- (NSArray*) fileNamesFromRunningOpenPanel;
|
||||
- (NSInteger) runModalOpenPanel: (NSOpenPanel*)openPanel
|
||||
forTypes: (NSArray*)openableFileExtensions;
|
||||
|
||||
/*" Document management "*/
|
||||
- (void)addDocument:(NSDocument *)document;
|
||||
- (void)removeDocument:(NSDocument *)document;
|
||||
- (BOOL)closeAllDocuments;
|
||||
- (void)closeAllDocumentsWithDelegate:(id)delegate
|
||||
didCloseAllSelector:(SEL)didAllCloseSelector
|
||||
contextInfo:(void *)contextInfo;
|
||||
- (BOOL)reviewUnsavedDocumentsWithAlertTitle:(NSString *)title cancellable:(BOOL)cancellable;
|
||||
- (void)reviewUnsavedDocumentsWithAlertTitle:(NSString *)title
|
||||
cancellable:(BOOL)cancellable
|
||||
delegate:(id)delegate
|
||||
didReviewAllSelector:(SEL)didReviewAllSelector
|
||||
contextInfo:(void *)contextInfo;
|
||||
- (NSArray *)documents;
|
||||
- (BOOL)hasEditedDocuments;
|
||||
- (id)currentDocument;
|
||||
- (NSString *)currentDirectory;
|
||||
- (id)documentForWindow:(NSWindow *)window;
|
||||
- (id)documentForFileName:(NSString *)fileName;
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
|
||||
- (id)documentForURL:(NSURL *)url;
|
||||
- (void) addDocument: (NSDocument*)document;
|
||||
- (void) removeDocument: (NSDocument*)document;
|
||||
- (BOOL) closeAllDocuments;
|
||||
- (void) closeAllDocumentsWithDelegate: (id)delegate
|
||||
didCloseAllSelector: (SEL)didAllCloseSelector
|
||||
contextInfo: (void*)contextInfo;
|
||||
- (BOOL) reviewUnsavedDocumentsWithAlertTitle: (NSString*)title
|
||||
cancellable: (BOOL)cancellable;
|
||||
- (void) reviewUnsavedDocumentsWithAlertTitle: (NSString*)title
|
||||
cancellable: (BOOL)cancellable
|
||||
delegate: (id)delegate
|
||||
didReviewAllSelector: (SEL)didReviewAllSelector
|
||||
contextInfo: (void*)contextInfo;
|
||||
- (NSArray*) documents;
|
||||
- (BOOL) hasEditedDocuments;
|
||||
- (id) currentDocument;
|
||||
- (NSString*) currentDirectory;
|
||||
- (id) documentForWindow: (NSWindow*)window;
|
||||
- (id) documentForFileName: (NSString*)fileName;
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
|
||||
- (id) documentForURL: (NSURL*)url;
|
||||
#endif
|
||||
|
||||
|
||||
/*" Menu validation "*/
|
||||
- (BOOL)validateMenuItem:(NSMenuItem *)anItem;
|
||||
- (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)anItem;
|
||||
- (BOOL) validateMenuItem: (NSMenuItem*)anItem;
|
||||
- (BOOL) validateUserInterfaceItem: (id <NSValidatedUserInterfaceItem>)anItem;
|
||||
|
||||
/*" Types and extensions "*/
|
||||
- (NSString *)displayNameForType:(NSString *)type;
|
||||
- (NSString *)typeFromFileExtension:(NSString *)fileExtension;
|
||||
- (NSArray *)fileExtensionsFromType:(NSString *)type;
|
||||
- (Class)documentClassForType:(NSString *)type;
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
|
||||
- (NSString *)defaultType;
|
||||
- (NSArray *)documentClassNames;
|
||||
- (NSString *)typeForContentsOfURL:(NSURL *)url error:(NSError **)err;
|
||||
- (NSString*) displayNameForType: (NSString*)type;
|
||||
- (NSString*) typeFromFileExtension: (NSString*)fileExtension;
|
||||
- (NSArray*) fileExtensionsFromType: (NSString*)type;
|
||||
- (Class) documentClassForType: (NSString*)type;
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
|
||||
/** Returns the first type found for which the application has an editor
|
||||
* role.
|
||||
*/
|
||||
- (NSString*) defaultType;
|
||||
|
||||
/** Returns the names of the NSDocument subclasses handling documents
|
||||
* in this application. This will be nil or empty if this is not a document
|
||||
* based application.
|
||||
*/
|
||||
- (NSArray*) documentClassNames;
|
||||
|
||||
- (NSString*) typeForContentsOfURL: (NSURL*)url
|
||||
error: (NSError**)err;
|
||||
#endif
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
|
||||
/* Autosaving */
|
||||
- (NSTimeInterval)autosavingDelay;
|
||||
- (void)setAutosavingDelay:(NSTimeInterval)autosavingDelay;
|
||||
- (NSTimeInterval) autosavingDelay;
|
||||
- (void) setAutosavingDelay: (NSTimeInterval)autosavingDelay;
|
||||
#endif
|
||||
|
||||
@end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue