Revision: 4734
http://skim-app.svn.sourceforge.net/skim-app/?rev=4734&view=rev
Author: hofman
Date: 2008-10-03 16:59:40 +0000 (Fri, 03 Oct 2008)
Log Message:
-----------
Add pageIndex ivar to thumbnail, so we know which page to draw.
Modified Paths:
--------------
trunk/SKMainWindowController.m
trunk/SKThumbnail.h
trunk/SKThumbnail.m
Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m 2008-10-03 15:02:33 UTC (rev 4733)
+++ trunk/SKMainWindowController.m 2008-10-03 16:59:40 UTC (rev 4734)
@@ -3606,7 +3606,7 @@
[image unlockFocus];
for (i = 0; i < count; i++) {
- SKThumbnail *thumbnail = [[SKThumbnail alloc] initWithImage:image
label:[pageLabels objectAtIndex:i]];
+ SKThumbnail *thumbnail = [[SKThumbnail alloc] initWithImage:image
label:[pageLabels objectAtIndex:i] pageIndex:i];
[thumbnail setDelegate:self];
[thumbnail setDirty:YES];
[thumbnails addObject:thumbnail];
@@ -3649,16 +3649,15 @@
NSImage *image = nil;
if (NO == isAnimating && NO == [thumbnailTableView isScrolling] &&
[[pdfView document] isLocked] == NO) {
- unsigned int theIndex = [thumbnails indexOfObject:thumbnail];
NSSize newSize, oldSize = [thumbnail size];
PDFDocument *pdfDoc = [pdfView document];
- PDFPage *page = [pdfDoc pageAtIndex:theIndex];
+ PDFPage *page = [pdfDoc pageAtIndex:[thumbnail pageIndex]];
NSRect readingBarRect = [[[pdfView readingBar] page] isEqual:page] ?
[[pdfView readingBar] currentBoundsForBox:[pdfView displayBox]] : NSZeroRect;
image = [page thumbnailWithSize:thumbnailCacheSize forBox:[pdfView
displayBox] readingBarRect:readingBarRect];
newSize = [image size];
if (fabsf(newSize.width - oldSize.width) > 1.0 || fabsf(newSize.height
- oldSize.height) > 1.0) {
- [thumbnailTableView
performSelector:@selector(noteHeightOfRowsWithIndexesChanged:)
withObject:[NSIndexSet indexSetWithIndex:theIndex] afterDelay:0.0];
+ [thumbnailTableView
performSelector:@selector(noteHeightOfRowsWithIndexesChanged:)
withObject:[NSIndexSet indexSetWithIndex:[thumbnail pageIndex]] afterDelay:0.0];
}
}
return image;
Modified: trunk/SKThumbnail.h
===================================================================
--- trunk/SKThumbnail.h 2008-10-03 15:02:33 UTC (rev 4733)
+++ trunk/SKThumbnail.h 2008-10-03 16:59:40 UTC (rev 4734)
@@ -42,11 +42,12 @@
@interface SKThumbnail : NSObject {
NSImage *image;
NSString *label;
+ unsigned int pageIndex;
BOOL dirty;
id delegate;
}
-- (id)initWithImage:(NSImage *)anImage label:(NSString *)aLabel;
+- (id)initWithImage:(NSImage *)anImage label:(NSString *)aLabel
pageIndex:(unsigned int)anIndex;
- (id)delegate;
- (void)setDelegate:(id)newDelegate;
@@ -55,11 +56,11 @@
- (void)setDirty:(BOOL)flag;
- (NSImage *)image;
-- (void)setImage:(NSImage *)newImage;
- (NSString *)label;
-- (void)setLabel:(NSString *)newLabel;
+- (unsigned int)pageIndex;
+
- (NSSize)size;
@end
Modified: trunk/SKThumbnail.m
===================================================================
--- trunk/SKThumbnail.m 2008-10-03 15:02:33 UTC (rev 4733)
+++ trunk/SKThumbnail.m 2008-10-03 16:59:40 UTC (rev 4734)
@@ -41,10 +41,11 @@
@implementation SKThumbnail
-- (id)initWithImage:(NSImage *)anImage label:(NSString *)aLabel {
+- (id)initWithImage:(NSImage *)anImage label:(NSString *)aLabel
pageIndex:(unsigned int)anIndex {
if (self = [super init]) {
image = [anImage retain];
label = [aLabel retain];
+ pageIndex = anIndex;
dirty = NO;
}
return self;
@@ -64,6 +65,13 @@
- (void)setDirty:(BOOL)flag { dirty = flag; }
+- (void)setImage:(NSImage *)newImage {
+ if (image != newImage) {
+ [image release];
+ image = [newImage retain];
+ }
+}
+
- (NSImage *)image {
if (dirty) {
NSImage *anImage = [delegate imageForThumbnail:self];
@@ -75,22 +83,12 @@
return image;
}
-- (void)setImage:(NSImage *)newImage {
- if (image != newImage) {
- [image release];
- image = [newImage retain];
- }
-}
-
- (NSString *)label {
return label;
}
-- (void)setLabel:(NSString *)newLabel {
- if (label != newLabel) {
- [label release];
- label = [newLabel retain];
- }
+- (unsigned int)pageIndex {
+ return pageIndex;
}
- (NSSize)size {
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