Revision: 6799
          http://skim-app.svn.sourceforge.net/skim-app/?rev=6799&view=rev
Author:   hofman
Date:     2010-09-12 23:57:04 +0000 (Sun, 12 Sep 2010)

Log Message:
-----------
Always call close on snapshot controller when removing, so it's properly 
cleaned up. This always calls windowWillClose:, so do cleanup there again.

Modified Paths:
--------------
    trunk/SKMainWindowController.m
    trunk/SKMainWindowController_UI.m
    trunk/SKSnapshotWindowController.h
    trunk/SKSnapshotWindowController.m

Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m      2010-09-12 12:15:27 UTC (rev 6798)
+++ trunk/SKMainWindowController.m      2010-09-12 23:57:04 UTC (rev 6799)
@@ -2053,11 +2053,11 @@
     [[self mutableArrayValueForKey:SNAPSHOTS_KEY] addObject:controller];
 }
 
-- (void)snapshotControllerRemove:(SKSnapshotWindowController *)controller {
+- (void)snapshotControllerWillClose:(SKSnapshotWindowController *)controller {
     [[self mutableArrayValueForKey:SNAPSHOTS_KEY] removeObject:controller];
 }
 
-- (void)snapshotControllerChanged:(SKSnapshotWindowController *)controller {
+- (void)snapshotControllerDidChange:(SKSnapshotWindowController *)controller {
     [self snapshotNeedsUpdate:controller];
 }
 

Modified: trunk/SKMainWindowController_UI.m
===================================================================
--- trunk/SKMainWindowController_UI.m   2010-09-12 12:15:27 UTC (rev 6798)
+++ trunk/SKMainWindowController_UI.m   2010-09-12 23:57:04 UTC (rev 6799)
@@ -423,7 +423,7 @@
 - (void)tableView:(NSTableView *)tv deleteRowsWithIndexes:(NSIndexSet 
*)rowIndexes {
     if ([tv isEqual:rightSideController.snapshotTableView]) {
         NSArray *controllers = [[rightSideController.snapshotArrayController 
arrangedObjects] objectsAtIndexes:rowIndexes];
-        [controllers makeObjectsPerformSelector:@selector(remove)];
+        [controllers makeObjectsPerformSelector:@selector(close)];
     }
 }
 
@@ -899,7 +899,7 @@
 }
 
 - (void)deleteSnapshot:(id)sender {
-    [[sender representedObject] remove];
+    [[sender representedObject] close];
 }
 
 - (void)showSnapshot:(id)sender {

Modified: trunk/SKSnapshotWindowController.h
===================================================================
--- trunk/SKSnapshotWindowController.h  2010-09-12 12:15:27 UTC (rev 6798)
+++ trunk/SKSnapshotWindowController.h  2010-09-12 23:57:04 UTC (rev 6799)
@@ -49,7 +49,6 @@
     id <SKSnapshotWindowControllerDelegate> delegate;
     NSString *pageLabel;
     BOOL hasWindow;
-    BOOL miniaturizing;
     BOOL forceOnTop;
 }
 
@@ -80,8 +79,6 @@
 - (void)miniaturize;
 - (void)deminiaturize;
 
-- (void)remove;
-
 - (void)handlePageChangedNotification:(NSNotification *)notification;
 - (void)handleDocumentDidUnlockNotification:(NSNotification *)notification;
 - (void)handlePDFViewFrameChangedNotification:(NSNotification *)notification;
@@ -99,8 +96,8 @@
 @optional
 
 - (void)snapshotControllerDidFinishSetup:(SKSnapshotWindowController 
*)controller;
-- (void)snapshotControllerRemove:(SKSnapshotWindowController *)controller;
-- (void)snapshotControllerChanged:(SKSnapshotWindowController *)controller;
+- (void)snapshotControllerWillClose:(SKSnapshotWindowController *)controller;
+- (void)snapshotControllerDidChange:(SKSnapshotWindowController *)controller;
 - 
(NSRect)snapshotControllerTargetRectForMiniaturize:(SKSnapshotWindowController 
*)controller;
 - 
(NSRect)snapshotControllerSourceRectForDeminiaturize:(SKSnapshotWindowController
 *)controller;
 

Modified: trunk/SKSnapshotWindowController.m
===================================================================
--- trunk/SKSnapshotWindowController.m  2010-09-12 12:15:27 UTC (rev 6798)
+++ trunk/SKSnapshotWindowController.m  2010-09-12 23:57:04 UTC (rev 6799)
@@ -107,16 +107,6 @@
     [self setHasWindow:YES];
 }
 
-- (void)doRemove {
-    @try { [[NSUserDefaultsController sharedUserDefaultsController] 
removeObserver:self forKeys:[NSArray arrayWithObjects:SKSnapshotsOnTopKey, 
SKShouldAntiAliasKey, SKGreekingThresholdKey, SKPageBackgroundColorKey, nil]]; }
-    @catch (id e) {}
-    if ([[self delegate] 
respondsToSelector:@selector(snapshotControllerRemove:)])
-        [[self delegate] snapshotControllerRemove:self];
-    delegate = nil;
-    // this is necessary to break a retain loop between the popup and its 
parent
-       [NSAccessibilityUnignoredDescendant([pdfView scalePopUpButton]) 
accessibilitySetOverrideValue:nil forAttribute:NSAccessibilityParentAttribute];
-}
-
 - (NSString *)windowTitleForDocumentDisplayName:(NSString *)displayName {
     return [NSString stringWithFormat:@"%@ %C %@", displayName, 
EM_DASH_CHARACTER, [NSString stringWithFormat:NSLocalizedString(@"Page %@", 
@""), [self pageLabel]]];
 }
@@ -151,15 +141,15 @@
 }
 
 - (void)handlePDFViewFrameChangedNotification:(NSNotification *)notification {
-    if ([[self delegate] 
respondsToSelector:@selector(snapshotControllerChanged:)]) {
+    if ([[self delegate] 
respondsToSelector:@selector(snapshotControllerDidChange:)]) {
         NSNotification *note = [NSNotification 
notificationWithName:SKSnapshotViewChangedNotification object:self];
         [[NSNotificationQueue defaultQueue] enqueueNotification:note 
postingStyle:NSPostWhenIdle coalesceMask:NSNotificationCoalescingOnName 
forModes:nil];
     }
 }
 
 - (void)handleViewChangedNotification:(NSNotification *)notification {
-    if ([[self delegate] 
respondsToSelector:@selector(snapshotControllerChanged:)])
-        [[self delegate] snapshotControllerChanged:self];
+    if ([[self delegate] 
respondsToSelector:@selector(snapshotControllerDidChange:)])
+        [[self delegate] snapshotControllerDidChange:self];
 }
 
 - (void)handleDidAddRemoveAnnotationNotification:(NSNotification 
*)notification {
@@ -182,8 +172,13 @@
 }
 
 - (void)windowWillClose:(NSNotification *)notification {
-    if (miniaturizing == NO)
-        [self doRemove];
+    @try { [[NSUserDefaultsController sharedUserDefaultsController] 
removeObserver:self forKeys:[NSArray arrayWithObjects:SKSnapshotsOnTopKey, 
SKShouldAntiAliasKey, SKGreekingThresholdKey, SKPageBackgroundColorKey, nil]]; }
+    @catch (id e) {}
+    if ([[self delegate] 
respondsToSelector:@selector(snapshotControllerWillClose:)])
+        [[self delegate] snapshotControllerWillClose:self];
+    [self setDelegate:nil];
+    // this is necessary to break a retain loop between the popup and its 
parent
+       [NSAccessibilityUnignoredDescendant([pdfView scalePopUpButton]) 
accessibilitySetOverrideValue:nil forAttribute:NSAccessibilityParentAttribute];
     if ([[self window] isKeyWindow])
         [[[[self document] mainWindowController] window] makeKeyWindow];
     else if ([[self window] isMainWindow])
@@ -280,13 +275,6 @@
     return [[page document] isEqual:[pdfView document]] && [[pdfView 
visiblePages] containsObject:page];
 }
 
-- (void)remove {
-    if ([[self window] isVisible])
-        [[self window] orderOut:nil];
-    else
-        [self doRemove];
-}
-
 #pragma mark Acessors
 
 - (NSRect)bounds {
@@ -492,7 +480,6 @@
 }
 
 - (void)miniaturize {
-    miniaturizing = YES;
     if ([[self delegate] 
respondsToSelector:@selector(snapshotControllerTargetRectForMiniaturize:)]) {
         NSRect startRect, endRect, dockRect = [[self delegate] 
snapshotControllerTargetRectForMiniaturize:self];
         
@@ -509,7 +496,6 @@
     } else {
         [[self window] orderOut:self];
     }
-    miniaturizing = NO;
     [self setHasWindow:NO];
 }
 


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to