Revision: 4803
http://skim-app.svn.sourceforge.net/skim-app/?rev=4803&view=rev
Author: hofman
Date: 2008-10-16 11:50:07 +0000 (Thu, 16 Oct 2008)
Log Message:
-----------
Remember the main window controller, as it is not guaranteed to be the first
one, because windowControllers may not be removed in reversed order.
Save recent document info when removing the main windowController, as this
comes before windowWillClose on Tiger.
Modified Paths:
--------------
trunk/SKPDFDocument.h
trunk/SKPDFDocument.m
Modified: trunk/SKPDFDocument.h
===================================================================
--- trunk/SKPDFDocument.h 2008-10-15 21:49:27 UTC (rev 4802)
+++ trunk/SKPDFDocument.h 2008-10-16 11:50:07 UTC (rev 4803)
@@ -65,6 +65,8 @@
IBOutlet NSView *readNotesAccessoryView;
IBOutlet NSButton *replaceNotesCheckButton;
+ SKMainWindowController *mainWindowController;
+
NSButton *autoRotateButton;
// variables to be saved:
Modified: trunk/SKPDFDocument.m
===================================================================
--- trunk/SKPDFDocument.m 2008-10-15 21:49:27 UTC (rev 4802)
+++ trunk/SKPDFDocument.m 2008-10-16 11:50:07 UTC (rev 4803)
@@ -118,6 +118,7 @@
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
+ [mainWindowController release];
[synchronizer stopDOServer];
[synchronizer release];
[presentationNotesDocument release];
@@ -134,13 +135,13 @@
}
- (void)makeWindowControllers{
- SKMainWindowController *mainWindowController = [[[SKMainWindowController
alloc] init] autorelease];
+ mainWindowController = [[SKMainWindowController alloc] init];
[mainWindowController setShouldCloseDocument:YES];
[self addWindowController:mainWindowController];
}
- (void)windowControllerDidLoadNib:(NSWindowController *)aController{
- SKMainWindowController *mainController = (SKMainWindowController
*)aController;
+ SKMainWindowController *mainController = (SKMainWindowController
*)aController;
if ([pdfDocument isLocked])
[self tryToUnlockDocument:pdfDocument];
@@ -189,6 +190,16 @@
[[NSNotificationCenter defaultCenter]
postNotificationName:SKDocumentDidShowNotification object:self];
}
+- (void)removeWindowController:(NSWindowController *)windowController {
+ if ([windowController isEqual:mainWindowController]) {
+ // we need to do this on Tiger, because windowWillClose notifications
are posted after this
+ [self saveRecentDocumentInfo];
+ [mainWindowController release];
+ mainWindowController = nil;
+ }
+ [super removeWindowController:windowController];
+}
+
- (SKProgressController *)progressController {
if (progressController == nil)
progressController = [[SKProgressController alloc] init];
@@ -196,9 +207,9 @@
}
- (void)saveRecentDocumentInfo {
+ NSString *path = [[self fileURL] path];
unsigned int pageIndex = [[[self pdfView] currentPage] pageIndex];
- NSString *path = [[self fileURL] path];
- if (pageIndex != NSNotFound && path)
+ if (path && pageIndex != NSNotFound && [self mainWindowController])
[[SKBookmarkController sharedBookmarkController]
addRecentDocumentForPath:path pageIndex:pageIndex snapshots:[[[self
mainWindowController] snapshots] valueForKey:SKSnapshotCurrentSetupKey]];
}
@@ -1524,8 +1535,7 @@
#pragma mark Accessors
- (SKMainWindowController *)mainWindowController {
- NSArray *windowControllers = [self windowControllers];
- return [windowControllers count] ? [windowControllers objectAtIndex:0] :
nil;
+ return mainWindowController;
}
- (PDFDocument *)pdfDocument{
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 the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit