Revision: 2608
http://skim-app.svn.sourceforge.net/skim-app/?rev=2608&view=rev
Author: hofman
Date: 2007-08-06 02:35:34 -0700 (Mon, 06 Aug 2007)
Log Message:
-----------
Reset labels, thumbnails and outline when the document unlocks.
Modified Paths:
--------------
trunk/SKMainWindowController.m
trunk/SKSnapshotWindowController.h
trunk/SKSnapshotWindowController.m
Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m 2007-08-06 08:39:54 UTC (rev 2607)
+++ trunk/SKMainWindowController.m 2007-08-06 09:35:34 UTC (rev 2608)
@@ -1698,17 +1698,8 @@
}
- (void)passwordSheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode
contextInfo:(void *)contextInfo {
- if (returnCode == NSOKButton) {
+ if (returnCode == NSOKButton)
[pdfView takePasswordFrom:passwordField];
- if (pdfOutline && [[pdfView document] isLocked] == NO) {
- [outlineView reloadData];
- [outlineView setAutoresizesOutlineColumn: NO];
-
- if ([outlineView numberOfRows] == 1)
- [outlineView expandItem: [outlineView itemAtRow: 0]
expandChildren: NO];
- [self updateOutlineSelection];
- }
- }
}
- (IBAction)password:(id)sender {
@@ -2890,6 +2881,36 @@
[progressBar displayIfNeeded];
}
+- (void)documentDidUnlock:(NSNotification *)notification {
+ PDFDocument *pdfDoc = [self pdfDocument];
+
+ [self willChangeValueForKey:@"pageLabel"];
+ [self willChangeValueForKey:@"pageLabels"];
+ [pageLabels removeAllObjects];
+ int i, count = [pdfDoc pageCount];
+ for (i = 0; i < count; i++) {
+ NSString *label = [[pdfDoc pageAtIndex:i] label];
+ [pageLabels addObject:label ? label : @""];
+ }
+ [self didChangeValueForKey:@"pageLabels"];
+ [self didChangeValueForKey:@"pageLabel"];
+
+ [self resetThumbnails];
+
+ if (pdfOutline == nil) {
+ pdfOutline = [[pdfDoc outlineRoot] retain];
+ [pdfOutlineItems removeAllObjects];
+ }
+ if (pdfOutline) {
+ [outlineView reloadData];
+ [outlineView setAutoresizesOutlineColumn: NO];
+
+ if ([outlineView numberOfRows] == 1)
+ [outlineView expandItem: [outlineView itemAtRow: 0]
expandChildren: NO];
+ [self updateOutlineSelection];
+ }
+}
+
- (void)handleColorSwatchColorsChangedNotification:(NSNotification
*)notification {
NSMenu *menu = [[[toolbarItems
objectForKey:SKDocumentToolbarColorSwatchItemIdentifier]
menuFormRepresentation] submenu];
Modified: trunk/SKSnapshotWindowController.h
===================================================================
--- trunk/SKSnapshotWindowController.h 2007-08-06 08:39:54 UTC (rev 2607)
+++ trunk/SKSnapshotWindowController.h 2007-08-06 09:35:34 UTC (rev 2608)
@@ -78,6 +78,7 @@
- (void)deminiaturize;
- (void)handlePageChangedNotification:(NSNotification *)notification;
+- (void)handleDocumentDidUnlockNotification:(NSNotification *)notification;
- (void)handlePDFViewFrameChangedNotification:(NSNotification *)notification;
- (void)handleViewChangedNotification:(NSNotification *)notification;
- (void)handleAnnotationWillChangeNotification:(NSNotification *)notification;
Modified: trunk/SKSnapshotWindowController.m
===================================================================
--- trunk/SKSnapshotWindowController.m 2007-08-06 08:39:54 UTC (rev 2607)
+++ trunk/SKSnapshotWindowController.m 2007-08-06 09:35:34 UTC (rev 2608)
@@ -100,6 +100,12 @@
[self didChangeValueForKey:@"pageAndWindow"];
}
+- (void)handleDocumentDidUnlockNotification:(NSNotification *)notification {
+ [[self window] setTitle:[self windowTitleForDocumentDisplayName:[[self
document] displayName]]];
+ [self willChangeValueForKey:@"pageAndWindow"];
+ [self didChangeValueForKey:@"pageAndWindow"];
+}
+
- (void)handlePDFViewFrameChangedNotification:(NSNotification *)notification {
if ([[self delegate]
respondsToSelector:@selector(snapshotControllerViewDidChange:)]) {
NSNotification *note = [NSNotification
notificationWithName:SKSnapshotViewChangedNotification object:self];
@@ -155,6 +161,8 @@
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handlePageChangedNotification:)
name:PDFViewPageChangedNotification object:pdfView];
+ [[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleDocumentDidUnlockNotification:)
+
name:PDFDocumentDidUnlockNotification object:[pdfView document]];
NSView *clipView = [[[pdfView documentView] enclosingScrollView]
contentView];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handlePDFViewFrameChangedNotification:)
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit