Revision: 6796
http://skim-app.svn.sourceforge.net/skim-app/?rev=6796&view=rev
Author: hofman
Date: 2010-09-11 11:10:23 +0000 (Sat, 11 Sep 2010)
Log Message:
-----------
Make sure snapshots are properly cleaned up when removing, also when the window
was miniaturized to the table. Let the snapshot controller notify the delegate
to remove it. Break a retain loop in the snapshot window due to accessibility
overrides.
Modified Paths:
--------------
trunk/SKMainWindowController_UI.m
trunk/SKSnapshotWindowController.h
trunk/SKSnapshotWindowController.m
Modified: trunk/SKMainWindowController_UI.m
===================================================================
--- trunk/SKMainWindowController_UI.m 2010-09-10 21:14:39 UTC (rev 6795)
+++ trunk/SKMainWindowController_UI.m 2010-09-11 11:10:23 UTC (rev 6796)
@@ -423,8 +423,7 @@
- (void)tableView:(NSTableView *)tv deleteRowsWithIndexes:(NSIndexSet
*)rowIndexes {
if ([tv isEqual:rightSideController.snapshotTableView]) {
NSArray *controllers = [[rightSideController.snapshotArrayController
arrangedObjects] objectsAtIndexes:rowIndexes];
- [[controllers valueForKey:@"window"]
makeObjectsPerformSelector:@selector(orderOut:) withObject:self];
- [[self mutableArrayValueForKey:SNAPSHOTS_KEY]
removeObjectsInArray:controllers];
+ [controllers makeObjectsPerformSelector:@selector(remove)];
}
}
@@ -900,9 +899,7 @@
}
- (void)deleteSnapshot:(id)sender {
- SKSnapshotWindowController *controller = [sender representedObject];
- [[controller window] orderOut:nil];
- [[self mutableArrayValueForKey:SNAPSHOTS_KEY] removeObject:controller];
+ [[sender representedObject] remove];
}
- (void)showSnapshot:(id)sender {
Modified: trunk/SKSnapshotWindowController.h
===================================================================
--- trunk/SKSnapshotWindowController.h 2010-09-10 21:14:39 UTC (rev 6795)
+++ trunk/SKSnapshotWindowController.h 2010-09-11 11:10:23 UTC (rev 6796)
@@ -80,6 +80,8 @@
- (void)miniaturize;
- (void)deminiaturize;
+- (void)remove;
+
- (void)handlePageChangedNotification:(NSNotification *)notification;
- (void)handleDocumentDidUnlockNotification:(NSNotification *)notification;
- (void)handlePDFViewFrameChangedNotification:(NSNotification *)notification;
Modified: trunk/SKSnapshotWindowController.m
===================================================================
--- trunk/SKSnapshotWindowController.m 2010-09-10 21:14:39 UTC (rev 6795)
+++ trunk/SKSnapshotWindowController.m 2010-09-11 11:10:23 UTC (rev 6796)
@@ -107,6 +107,16 @@
[self setHasWindow:YES];
}
+- (void)willRemove {
+ @try { [[NSUserDefaultsController sharedUserDefaultsController]
removeObserver:self forKeys:[NSArray arrayWithObjects:SKSnapshotsOnTopKey,
SKShouldAntiAliasKey, SKGreekingThresholdKey, SKPageBackgroundColorKey, nil]]; }
+ @catch (id e) {}
+ if ([[self delegate]
respondsToSelector:@selector(snapshotControllerWindowWillClose:)])
+ [[self delegate] snapshotControllerWindowWillClose: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]]];
}
@@ -172,9 +182,8 @@
}
- (void)windowWillClose:(NSNotification *)notification {
- [[NSUserDefaultsController sharedUserDefaultsController]
removeObserver:self forKeys:[NSArray arrayWithObjects:SKSnapshotsOnTopKey,
SKShouldAntiAliasKey, SKGreekingThresholdKey, SKPageBackgroundColorKey, nil]];
- if (miniaturizing == NO && [[self delegate]
respondsToSelector:@selector(snapshotControllerWindowWillClose:)])
- [[self delegate] snapshotControllerWindowWillClose:self];
+ if (miniaturizing == NO)
+ [self willRemove];
if ([[self window] isKeyWindow])
[[[[self document] mainWindowController] window] makeKeyWindow];
else if ([[self window] isMainWindow])
@@ -271,6 +280,13 @@
return [[page document] isEqual:[pdfView document]] && [[pdfView
visiblePages] containsObject:page];
}
+- (void)remove {
+ if ([[self window] isVisible])
+ [[self window] orderOut:nil];
+ else
+ [self willRemove];
+}
+
#pragma mark Acessors
- (NSRect)bounds {
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