Skip to content

Commit

Permalink
Version 2.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
vfr committed Oct 5, 2012
1 parent 6a4d7a0 commit 2c75595
Show file tree
Hide file tree
Showing 19 changed files with 87 additions and 81 deletions.
5 changes: 5 additions & 0 deletions HISTORY.md
@@ -1,6 +1,11 @@

## History

2012-10-05: Version 2.6.1

- Greatly improved thumb operation cancel handling.
- iOS 4 support and various other miscellaneous fixes.

2012-09-24: Version 2.6.0

- Refactored to use ARC memory management.
Expand Down
8 changes: 4 additions & 4 deletions README.md
Expand Up @@ -16,10 +16,10 @@ project template that you could start building from, or, just pull
the required files into an existing project to enable PDF
reading/viewing in your app(s).

![iPod Page](http://i.imgur.com/DYElY.png)
![iPod Thumbs](http://i.imgur.com/61YJY.png)
![iPad Page](http://i.imgur.com/mY0gp.png)
![iPad Thumbs](http://i.imgur.com/3HCkj.png)
![iPod Page](http://i.imgur.com/wxC1B.png)
![iPod Thumbs](http://i.imgur.com/4VNyQ.png)
![iPad Page](http://i.imgur.com/T6nfI.png)
![iPad Thumbs](http://i.imgur.com/wxQRC.png)

After launching the sample app, tap on the left hand side of the
screen to go back a page. Tap on the right hand side to go to the
Expand Down
4 changes: 2 additions & 2 deletions Reader-Info.plist
Expand Up @@ -26,9 +26,9 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>2.6.0</string>
<string>2.6.1</string>
<key>CFBundleShortVersionString</key>
<string>2.6.0</string>
<string>2.6.1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIPrerenderedIcon</key>
Expand Down
4 changes: 2 additions & 2 deletions Reader.xcodeproj/project.pbxproj
Expand Up @@ -295,10 +295,10 @@
45AB72EE141FC0B1003524C3 /* CGPDFDocument.m */,
45D5ADA11610EADC00706B9A /* ReaderDocumentOutline.h */,
45D5ADA21610EADC00706B9A /* ReaderDocumentOutline.m */,
45AB72FF141FC0B1003524C3 /* ReaderThumbCache.h */,
45AB7300141FC0B1003524C3 /* ReaderThumbCache.m */,
45AB7307141FC0B1003524C3 /* ReaderThumbRequest.h */,
45AB7308141FC0B1003524C3 /* ReaderThumbRequest.m */,
45AB72FF141FC0B1003524C3 /* ReaderThumbCache.h */,
45AB7300141FC0B1003524C3 /* ReaderThumbCache.m */,
45AB7303141FC0B1003524C3 /* ReaderThumbQueue.h */,
45AB7304141FC0B1003524C3 /* ReaderThumbQueue.m */,
45AB7301141FC0B1003524C3 /* ReaderThumbFetch.h */,
Expand Down
4 changes: 2 additions & 2 deletions Sources/ReaderContentPage.h
@@ -1,6 +1,6 @@
//
// ReaderContentPage.h
// Reader v2.6.0
// Reader v2.6.1
//
// Created by Julius Oklamcak on 2011-07-01.
// Copyright © 2011-2012 Julius Oklamcak. All rights reserved.
Expand Down Expand Up @@ -45,7 +45,7 @@

@property (nonatomic, assign, readonly) CGPDFDictionaryRef dictionary;

+ (id)withRect:(CGRect)linkRect dictionary:(CGPDFDictionaryRef)linkDictionary;
+ (id)newWithRect:(CGRect)linkRect dictionary:(CGPDFDictionaryRef)linkDictionary;

- (id)initWithRect:(CGRect)linkRect dictionary:(CGPDFDictionaryRef)linkDictionary;

Expand Down
18 changes: 11 additions & 7 deletions Sources/ReaderContentPage.m
@@ -1,6 +1,6 @@
//
// ReaderContentPage.m
// Reader v2.6.0
// Reader v2.6.1
//
// Created by Julius Oklamcak on 2011-07-01.
// Copyright © 2011-2012 Julius Oklamcak. All rights reserved.
Expand Down Expand Up @@ -131,7 +131,7 @@ - (ReaderDocumentLink *)linkFromAnnotation:(CGPDFDictionaryRef)annotationDiction

CGRect viewRect = CGRectMake(vr_x, vr_y, vr_w, vr_h); // View CGRect from PDFRect

documentLink = [ReaderDocumentLink withRect:viewRect dictionary:annotationDictionary];
documentLink = [ReaderDocumentLink newWithRect:viewRect dictionary:annotationDictionary];
}

return documentLink;
Expand Down Expand Up @@ -531,9 +531,11 @@ - (void)didMoveToWindow

- (void)drawLayer:(CATiledLayer *)layer inContext:(CGContextRef)context
{
CGPDFPageRef drawPDFPageRef = NULL;
ReaderContentPage *readerContentPage = self; // Retain self

CGPDFDocumentRef drawPDFDocRef = NULL;
CGPDFPageRef drawPDFPageRef = NULL; // Document page reference

CGPDFDocumentRef drawPDFDocRef = NULL; // Document reference

@synchronized(self) // Block any other threads
{
Expand All @@ -542,12 +544,12 @@ - (void)drawLayer:(CATiledLayer *)layer inContext:(CGContextRef)context
drawPDFPageRef = CGPDFPageRetain(_PDFPageRef);
}

//NSLog(@"%s %@", __FUNCTION__, NSStringFromCGRect(CGContextGetClipBoundingBox(context)));

CGContextSetRGBFillColor(context, 1.0f, 1.0f, 1.0f, 1.0f); // White

CGContextFillRect(context, CGContextGetClipBoundingBox(context)); // Fill

//NSLog(@"%s %@", __FUNCTION__, NSStringFromCGRect(CGContextGetClipBoundingBox(context)));

if (drawPDFPageRef != NULL) // Go ahead and render the PDF page into the context
{
CGContextTranslateCTM(context, 0.0f, self.bounds.size.height); CGContextScaleCTM(context, 1.0f, -1.0f);
Expand All @@ -560,6 +562,8 @@ - (void)drawLayer:(CATiledLayer *)layer inContext:(CGContextRef)context
}

CGPDFPageRelease(drawPDFPageRef); CGPDFDocumentRelease(drawPDFDocRef); // Cleanup

if (readerContentPage != nil) readerContentPage = nil; // Release self
}

@end
Expand All @@ -584,7 +588,7 @@ @implementation ReaderDocumentLink

#pragma mark ReaderDocumentLink class methods

+ (id)withRect:(CGRect)linkRect dictionary:(CGPDFDictionaryRef)linkDictionary
+ (id)newWithRect:(CGRect)linkRect dictionary:(CGPDFDictionaryRef)linkDictionary
{
return [[ReaderDocumentLink alloc] initWithRect:linkRect dictionary:linkDictionary];
}
Expand Down
8 changes: 5 additions & 3 deletions Sources/ReaderContentView.m
@@ -1,6 +1,6 @@
//
// ReaderContentView.m
// Reader v2.6.0
// Reader v2.6.1
//
// Created by Julius Oklamcak on 2011-07-01.
// Copyright © 2011-2012 Julius Oklamcak. All rights reserved.
Expand Down Expand Up @@ -153,7 +153,9 @@ - (id)initWithFrame:(CGRect)frame fileURL:(NSURL *)fileURL page:(NSUInteger)page

- (void)dealloc
{
[self removeObserver:self forKeyPath:@"frame"];
// [self removeObserver:self forKeyPath:@"frame" context:ReaderContentViewContext];

[self removeObserver:self forKeyPath:@"frame"]; // Maintain iOS 4.x compatability
}

- (void)showPageThumb:(NSURL *)fileURL page:(NSInteger)page password:(NSString *)phrase guid:(NSString *)guid
Expand All @@ -164,7 +166,7 @@ - (void)showPageThumb:(NSURL *)fileURL page:(NSInteger)page password:(NSString *

CGSize size = (large ? CGSizeMake(PAGE_THUMB_LARGE, PAGE_THUMB_LARGE) : CGSizeMake(PAGE_THUMB_SMALL, PAGE_THUMB_SMALL));

ReaderThumbRequest *request = [ReaderThumbRequest forView:theThumbView fileURL:fileURL password:phrase guid:guid page:page size:size];
ReaderThumbRequest *request = [ReaderThumbRequest newForView:theThumbView fileURL:fileURL password:phrase guid:guid page:page size:size];

UIImage *image = [[ReaderThumbCache sharedInstance] thumbRequest:request priority:YES]; // Request the page thumb

Expand Down
4 changes: 2 additions & 2 deletions Sources/ReaderDocumentOutline.h
@@ -1,6 +1,6 @@
//
// ReaderDocumentOutline.m
// Reader v2.6.0
// Reader v2.6.1
//
// Created by Julius Oklamcak on 2012-09-01.
// Copyright © 2011-2012 Julius Oklamcak. All rights reserved.
Expand Down Expand Up @@ -35,7 +35,7 @@

@interface DocumentOutlineEntry : NSObject <NSObject>

+ (id)withTitle:(NSString *)title target:(id)target level:(NSInteger)level;
+ (id)newWithTitle:(NSString *)title target:(id)target level:(NSInteger)level;

- (id)initWithTitle:(NSString *)title target:(id)target level:(NSInteger)level;

Expand Down
6 changes: 3 additions & 3 deletions Sources/ReaderDocumentOutline.m
@@ -1,6 +1,6 @@
//
// ReaderDocumentOutline.m
// Reader v2.6.0
// Reader v2.6.1
//
// Created by Julius Oklamcak on 2012-09-01.
// Copyright © 2011-2012 Julius Oklamcak. All rights reserved.
Expand Down Expand Up @@ -343,7 +343,7 @@ + (void)outlineItems:(CGPDFDictionaryRef)outlineDictionary document:(CGPDFDocume

NSString *trimmed = [titleString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];

outlineEntry = [DocumentOutlineEntry withTitle:trimmed target:entryTarget level:level]; // New entry
outlineEntry = [DocumentOutlineEntry newWithTitle:trimmed target:entryTarget level:level]; // New entry

[array addObject:outlineEntry]; CFRelease(title); // Add new entry and cleanup
}
Expand Down Expand Up @@ -440,7 +440,7 @@ @implementation DocumentOutlineEntry

#pragma mark DocumentOutlineEntry class methods

+ (id)withTitle:(NSString *)title target:(id)target level:(NSInteger)level
+ (id)newWithTitle:(NSString *)title target:(id)target level:(NSInteger)level
{
return [[DocumentOutlineEntry alloc] initWithTitle:title target:target level:level];
}
Expand Down
6 changes: 3 additions & 3 deletions Sources/ReaderMainPagebar.m
@@ -1,6 +1,6 @@
//
// ReaderMainPagebar.m
// Reader v2.6.0
// Reader v2.6.1
//
// Created by Julius Oklamcak on 2011-09-01.
// Copyright © 2011-2012 Julius Oklamcak. All rights reserved.
Expand Down Expand Up @@ -110,7 +110,7 @@ - (void)updatePageThumbView:(NSInteger)page

NSURL *fileURL = document.fileURL; NSString *guid = document.guid; NSString *phrase = document.password;

ReaderThumbRequest *request = [ReaderThumbRequest forView:pageThumbView fileURL:fileURL password:phrase guid:guid page:page size:size];
ReaderThumbRequest *request = [ReaderThumbRequest newForView:pageThumbView fileURL:fileURL password:phrase guid:guid page:page size:size];

UIImage *image = [[ReaderThumbCache sharedInstance] thumbRequest:request priority:YES]; // Request the thumb

Expand Down Expand Up @@ -285,7 +285,7 @@ - (void)layoutSubviews

smallThumbView = [[ReaderPagebarThumb alloc] initWithFrame:thumbRect small:YES]; // Create a small thumb view

ReaderThumbRequest *thumbRequest = [ReaderThumbRequest forView:smallThumbView fileURL:fileURL password:phrase guid:guid page:page size:size];
ReaderThumbRequest *thumbRequest = [ReaderThumbRequest newForView:smallThumbView fileURL:fileURL password:phrase guid:guid page:page size:size];

UIImage *image = [[ReaderThumbCache sharedInstance] thumbRequest:thumbRequest priority:NO]; // Request the thumb

Expand Down
4 changes: 2 additions & 2 deletions Sources/ReaderThumbFetch.h
@@ -1,6 +1,6 @@
//
// ReaderThumbFetch.h
// Reader v2.6.0
// Reader v2.6.1
//
// Created by Julius Oklamcak on 2011-09-01.
// Copyright © 2011-2012 Julius Oklamcak. All rights reserved.
Expand Down Expand Up @@ -31,6 +31,6 @@

@interface ReaderThumbFetch : ReaderThumbOperation

- (id)initWithRequest:(ReaderThumbRequest *)object;
- (id)initWithRequest:(ReaderThumbRequest *)options;

@end
36 changes: 16 additions & 20 deletions Sources/ReaderThumbFetch.m
@@ -1,6 +1,6 @@
//
// ReaderThumbFetch.m
// Reader v2.6.0
// Reader v2.6.1
//
// Created by Julius Oklamcak on 2011-09-01.
// Copyright © 2011-2012 Julius Oklamcak. All rights reserved.
Expand Down Expand Up @@ -37,29 +37,25 @@ @implementation ReaderThumbFetch

#pragma mark ReaderThumbFetch instance methods

- (id)initWithRequest:(ReaderThumbRequest *)object
- (id)initWithRequest:(ReaderThumbRequest *)options
{
if ((self = [super initWithGUID:object.guid]))
if ((self = [super initWithGUID:options.guid]))
{
request = object;
request = options;
}

return self;
}

- (void)dealloc
{
if (request.thumbView.operation == self)
{
request.thumbView.operation = nil; // Done
}
}

- (void)cancel
{
[[ReaderThumbCache sharedInstance] removeNullForKey:request.cacheKey];
[super cancel]; // Cancel the operation

[super cancel];
request.thumbView.operation = nil; // Break retain loop

request.thumbView = nil; // Release target thumb view on cancel

[[ReaderThumbCache sharedInstance] removeNullForKey:request.cacheKey];
}

- (NSURL *)thumbFileURL
Expand All @@ -73,9 +69,7 @@ - (NSURL *)thumbFileURL

- (void)main
{
if (self.isCancelled == YES) return;

NSURL *thumbURL = [self thumbFileURL]; CGImageRef imageRef = NULL;
CGImageRef imageRef = NULL; NSURL *thumbURL = [self thumbFileURL];

CGImageSourceRef loadRef = CGImageSourceCreateWithURL((__bridge CFURLRef)thumbURL, NULL);

Expand All @@ -95,11 +89,11 @@ - (void)main
{
request.thumbView.operation = thumbRender; // Update the thumb view operation property to the new operation

[[ReaderThumbQueue sharedInstance] addWorkOperation:thumbRender]; // Queue the operation
[[ReaderThumbQueue sharedInstance] addWorkOperation:thumbRender]; return; // Queue the operation
}
}

if (imageRef != NULL) // Create UIImage from CGImage and show it
if (imageRef != NULL) // Create a UIImage from a CGImage and show it
{
UIImage *image = [UIImage imageWithCGImage:imageRef scale:request.scale orientation:UIImageOrientationUp];

Expand All @@ -113,7 +107,7 @@ - (void)main

UIGraphicsEndImageContext(); // Cleanup after the bitmap-based graphics drawing context

[[ReaderThumbCache sharedInstance] setObject:decoded forKey:request.cacheKey]; // Update cache
[[ReaderThumbCache sharedInstance] setObject:decoded forKey:request.cacheKey]; // Cache it

if (self.isCancelled == NO) // Show the image in the target thumb view on the main thread
{
Expand All @@ -127,6 +121,8 @@ - (void)main
});
}
}

request.thumbView.operation = nil; // Break retain loop
}

@end
4 changes: 2 additions & 2 deletions Sources/ReaderThumbRender.h
@@ -1,6 +1,6 @@
//
// ReaderThumbRender.h
// Reader v2.6.0
// Reader v2.6.1
//
// Created by Julius Oklamcak on 2011-09-01.
// Copyright © 2011-2012 Julius Oklamcak. All rights reserved.
Expand Down Expand Up @@ -31,6 +31,6 @@

@interface ReaderThumbRender : ReaderThumbOperation

- (id)initWithRequest:(ReaderThumbRequest *)request;
- (id)initWithRequest:(ReaderThumbRequest *)options;

@end

0 comments on commit 2c75595

Please sign in to comment.