mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 07:00:46 +00:00
Complete the implementation of NSDocument.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@27436 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
f68f306f43
commit
aba6776a65
4 changed files with 406 additions and 332 deletions
|
@ -1,3 +1,12 @@
|
|||
2008-12-26 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/NSDocumentController.m: Remove now unused override helper
|
||||
method.
|
||||
* Headers/AppKit/NSDocument.h: Change to use NSUInteger and
|
||||
NSInteger. Add new 10.5 method
|
||||
* Source/NSDocument.m: Implement all Cocoa methods of this class
|
||||
and clean up the rest of the implementation.
|
||||
|
||||
2008-12-25 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Headers/AppKit/NSMenuItem.h: Declare to implement interface
|
||||
|
|
|
@ -150,7 +150,7 @@ withContentsOfURL:(NSURL *)url
|
|||
- (void)showWindows;
|
||||
- (void)removeWindowController:(NSWindowController *)windowController;
|
||||
- (void)setWindow:(NSWindow *)aWindow;
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_3, GS_API_LATEST)
|
||||
- (NSWindow *)windowForSheet;
|
||||
#endif
|
||||
|
||||
|
@ -249,7 +249,7 @@ originalContentsURL:(NSURL *)orig
|
|||
- (BOOL)shouldRunSavePanelWithAccessoryView;
|
||||
#if OS_API_VERSION(GS_API_MACOSX, MAC_OS_X_VERSION_10_4)
|
||||
- (NSString *)fileNameFromRunningSavePanelForSaveOperation:(NSSaveOperationType)saveOperation;
|
||||
- (int)runModalSavePanel:(NSSavePanel *)savePanel withAccessoryView:(NSView *)accessoryView;
|
||||
- (NSInteger)runModalSavePanel:(NSSavePanel *)savePanel withAccessoryView:(NSView *)accessoryView;
|
||||
#endif
|
||||
- (NSString *)fileTypeFromLastRunSavePanel;
|
||||
- (NSDictionary *)fileAttributesToWriteToFile: (NSString *)fullDocumentPath
|
||||
|
@ -269,15 +269,21 @@ originalContentsURL:(NSURL *)orig
|
|||
forSaveOperation:(NSSaveOperationType)op
|
||||
originalContentsURL:(NSURL *)original
|
||||
error:(NSError **)error;
|
||||
#endif
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_1, GS_API_LATEST)
|
||||
- (BOOL)fileNameExtensionWasHiddenInLastRunSavePanel;
|
||||
#endif
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST)
|
||||
- (NSString *)fileNameExtensionForType:(NSString *)typeName
|
||||
saveOperation:(NSSaveOperationType)saveOperation;
|
||||
#endif
|
||||
|
||||
/*" Printing "*/
|
||||
- (NSPrintInfo *)printInfo;
|
||||
- (void)setPrintInfo:(NSPrintInfo *)printInfo;
|
||||
- (BOOL)shouldChangePrintInfo:(NSPrintInfo *)newPrintInfo;
|
||||
- (IBAction)runPageLayout:(id)sender;
|
||||
- (int)runModalPageLayoutWithPrintInfo:(NSPrintInfo *)printInfo;
|
||||
- (NSInteger)runModalPageLayoutWithPrintInfo:(NSPrintInfo *)printInfo;
|
||||
- (IBAction)printDocument:(id)sender;
|
||||
- (void)printShowingPrintPanel:(BOOL)flag;
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -262,22 +262,9 @@ static NSDictionary *TypeInfoForHumanReadableName (NSArray *types, NSString *typ
|
|||
}
|
||||
|
||||
/*
|
||||
* Private helper method to check, if the method given via the selector sel
|
||||
* Private helper macro to check, if the method given via the selector sel
|
||||
* has been overridden in the current subclass.
|
||||
*/
|
||||
- (BOOL)_hasOverridden: (SEL)sel
|
||||
{
|
||||
// The actual signature is not important as we wont call the methods.
|
||||
IMP meth1;
|
||||
IMP meth2;
|
||||
|
||||
meth1 = [self methodForSelector: sel];
|
||||
meth2 = [[NSDocumentController class] instanceMethodForSelector: sel];
|
||||
|
||||
return (meth1 != meth2);
|
||||
}
|
||||
|
||||
//#define OVERRIDDEN(sel) [self _hasOverridden: @selector(sel)]
|
||||
#define OVERRIDDEN(sel) ([self methodForSelector: @selector(sel)] != [[NSDocumentController class] instanceMethodForSelector: @selector(sel)])
|
||||
|
||||
- (BOOL) shouldCreateUI
|
||||
|
@ -297,7 +284,7 @@ static NSDictionary *TypeInfoForHumanReadableName (NSArray *types, NSString *typ
|
|||
|
||||
- (void) setAutosavingDelay: (NSTimeInterval)autosavingDelay
|
||||
{
|
||||
static NSTimer *autosavingTimer;
|
||||
static NSTimer *autosavingTimer = nil;
|
||||
|
||||
if (autosavingTimer)
|
||||
{
|
||||
|
@ -1404,8 +1391,8 @@ static BOOL _shouldClose = YES;
|
|||
[self _editorTypesForClass: documentClass]];
|
||||
}
|
||||
|
||||
static NSMapTable *autosavedDocuments;
|
||||
static NSString *processName;
|
||||
static NSMapTable *autosavedDocuments = NULL;
|
||||
static NSString *processName = nil;
|
||||
|
||||
- (NSString *) _autosaveDirectory: (BOOL)create
|
||||
{
|
||||
|
@ -1513,9 +1500,6 @@ static NSString *processName;
|
|||
NSCreateMapTable (NSObjectMapKeyCallBacks,
|
||||
NSObjectMapValueCallBacks,
|
||||
1);
|
||||
if (!processName)
|
||||
processName = [[[NSProcessInfo processInfo] processName] copy];
|
||||
|
||||
if (url)
|
||||
{
|
||||
NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
|
||||
|
@ -1538,6 +1522,9 @@ static NSString *processName;
|
|||
NSArray *autosaved = NSAllMapTableValues (autosavedDocuments);
|
||||
NSFileManager *fm = [NSFileManager defaultManager];
|
||||
|
||||
if (!processName)
|
||||
processName = [[[NSProcessInfo processInfo] processName] copy];
|
||||
|
||||
path = [path stringByAppendingPathComponent: processName];
|
||||
path = [path stringByAppendingPathExtension: @"plist"];
|
||||
if ([autosaved count] == 0)
|
||||
|
|
Loading…
Reference in a new issue