Revision: 2728 http://skim-app.svn.sourceforge.net/skim-app/?rev=2728&view=rev Author: hofman Date: 2007-08-27 08:09:12 -0700 (Mon, 27 Aug 2007)
Log Message: ----------- Periodically save the current open documents, so the last open file can be approximated in case of a crash. Make sure the normal window state is saved rather than the full screen state. Modified Paths: -------------- trunk/SKApplication.h trunk/SKApplication.m trunk/SKMainWindowController.m Modified: trunk/SKApplication.h =================================================================== --- trunk/SKApplication.h 2007-08-27 14:11:14 UTC (rev 2727) +++ trunk/SKApplication.h 2007-08-27 15:09:12 UTC (rev 2728) @@ -40,7 +40,9 @@ extern NSString *SKApplicationWillTerminateNotification; [EMAIL PROTECTED] SKApplication : NSApplication [EMAIL PROTECTED] SKApplication : NSApplication { + NSTimer *currentDocumentsTimer; +} - (IBAction)orderFrontLineInspector:(id)sender; @end Modified: trunk/SKApplication.m =================================================================== --- trunk/SKApplication.m 2007-08-27 14:11:14 UTC (rev 2727) +++ trunk/SKApplication.m 2007-08-27 15:09:12 UTC (rev 2728) @@ -90,9 +90,21 @@ [super sendEvent:anEvent]; } +- (void)saveCurrentOpenDocuments:(NSTimer *)timer { + [[NSUserDefaults standardUserDefaults] setObject:[[[NSDocumentController sharedDocumentController] documents] valueForKey:@"currentDocumentSetup"] forKey:SKLastOpenFileNamesKey]; +} + +- (void)finishLaunching { + [super finishLaunching]; + currentDocumentsTimer = [[NSTimer scheduledTimerWithTimeInterval:10.0 target:self selector:@selector(saveCurrentOpenDocuments:) userInfo:nil repeats:YES] retain]; +} + - (IBAction)terminate:(id)sender { [[NSNotificationCenter defaultCenter] postNotificationName:SKApplicationWillTerminateNotification object:self]; - [[NSUserDefaults standardUserDefaults] setObject:[[[NSDocumentController sharedDocumentController] documents] valueForKey:@"currentDocumentSetup"] forKey:SKLastOpenFileNamesKey]; + [currentDocumentsTimer invalidate]; + [currentDocumentsTimer release]; + currentDocumentsTimer = nil; + [self saveCurrentOpenDocuments:nil]; [super terminate:sender]; } Modified: trunk/SKMainWindowController.m =================================================================== --- trunk/SKMainWindowController.m 2007-08-27 14:11:14 UTC (rev 2727) +++ trunk/SKMainWindowController.m 2007-08-27 15:09:12 UTC (rev 2728) @@ -520,7 +520,12 @@ [setup setObject:[NSNumber numberWithFloat:NSWidth([leftSideContentBox frame])] forKey:@"leftSidePaneWidth"]; [setup setObject:[NSNumber numberWithFloat:NSWidth([rightSideContentBox frame])] forKey:@"rightSidePaneWidth"]; [setup setObject:[NSNumber numberWithUnsignedInt:[[pdfView document] indexForPage:[pdfView currentPage]]] forKey:@"pageIndex"]; - [setup addEntriesFromDictionary:[self currentPDFSettings]]; + if ([self isFullScreen] || [self isPresentation]) { + [setup addEntriesFromDictionary:savedNormalSetup]; + [setup removeObjectsForKeys:[NSArray arrayWithObjects:@"hasHorizontalScroller", @"hasVerticalScroller", @"autoHidesScrollers", nil]]; + } else { + [setup addEntriesFromDictionary:[self currentPDFSettings]]; + } return setup; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Skim-app-commit mailing list Skim-app-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/skim-app-commit