diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2014-04-22 13:13:29 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2014-04-22 13:13:29 +0200 |
commit | a879f26eaf3e86183966de124f3c30ceb7e8b2e4 (patch) | |
tree | b66ccdab02c7855e4e49d032f243ff64f564caae /platform/ios/Classes | |
parent | 74299aeef1cfd684b2466e73e95b88a52488a637 (diff) | |
download | mupdf-a879f26eaf3e86183966de124f3c30ceb7e8b2e4.tar.xz |
Fix iOS formatting.
Diffstat (limited to 'platform/ios/Classes')
-rw-r--r-- | platform/ios/Classes/MuDocumentController.m | 39 | ||||
-rw-r--r-- | platform/ios/Classes/MuPageViewNormal.m | 4 | ||||
-rw-r--r-- | platform/ios/Classes/MuPrintPageRenderer.h | 7 | ||||
-rw-r--r-- | platform/ios/Classes/MuPrintPageRenderer.m | 9 | ||||
-rw-r--r-- | platform/ios/Classes/MuTapResult.m | 2 | ||||
-rw-r--r-- | platform/ios/Classes/MuTextSelectView.m | 54 | ||||
-rw-r--r-- | platform/ios/Classes/MuWord.m | 2 |
7 files changed, 51 insertions, 66 deletions
diff --git a/platform/ios/Classes/MuDocumentController.m b/platform/ios/Classes/MuDocumentController.m index a9bd6261..9893b211 100644 --- a/platform/ios/Classes/MuDocumentController.m +++ b/platform/ios/Classes/MuDocumentController.m @@ -487,26 +487,25 @@ static void saveDoc(char *current_path, fz_document *doc) - (void) onPrint: (id)sender { UIPrintInteractionController *pic = [UIPrintInteractionController sharedPrintController]; - if (pic) { - - UIPrintInfo *printInfo = [UIPrintInfo printInfo]; - printInfo.outputType = UIPrintInfoOutputGeneral; - printInfo.jobName = key; - printInfo.duplex = UIPrintInfoDuplexLongEdge; - pic.printInfo = printInfo; - pic.showsPageRange = YES; - pic.printPageRenderer = [[[MuPrintPageRenderer alloc] initWithDocRef:docRef] autorelease]; - - void (^completionHandler)(UIPrintInteractionController *, BOOL, NSError *) = - ^(UIPrintInteractionController *pic, BOOL completed, NSError *error) { - if (!completed && error) - NSLog(@"FAILED! due to error in domain %@ with error code %u", - error.domain, (unsigned int)error.code); - }; - if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { + if (pic) { + UIPrintInfo *printInfo = [UIPrintInfo printInfo]; + printInfo.outputType = UIPrintInfoOutputGeneral; + printInfo.jobName = key; + printInfo.duplex = UIPrintInfoDuplexLongEdge; + pic.printInfo = printInfo; + pic.showsPageRange = YES; + pic.printPageRenderer = [[[MuPrintPageRenderer alloc] initWithDocRef:docRef] autorelease]; + + void (^completionHandler)(UIPrintInteractionController *, BOOL, NSError *) = + ^(UIPrintInteractionController *pic, BOOL completed, NSError *error) { + if (!completed && error) + NSLog(@"FAILED! due to error in domain %@ with error code %u", + error.domain, (unsigned int)error.code); + }; + if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { [pic presentFromBarButtonItem:printButton animated:YES - completionHandler:completionHandler]; - } else { + completionHandler:completionHandler]; + } else { [pic presentAnimated:YES completionHandler:completionHandler]; } } @@ -895,7 +894,7 @@ static void saveDoc(char *current_path, fz_document *doc) if (sender.scale > MAX_SCALE) sender.scale = MAX_SCALE; - if (sender.state == UIGestureRecognizerStateEnded) + if (sender.state == UIGestureRecognizerStateEnded) scale = sender.scale; for (UIView<MuPageView> *view in [canvas subviews]) diff --git a/platform/ios/Classes/MuPageViewNormal.m b/platform/ios/Classes/MuPageViewNormal.m index 18183458..1cf2023d 100644 --- a/platform/ios/Classes/MuPageViewNormal.m +++ b/platform/ios/Classes/MuPageViewNormal.m @@ -26,7 +26,7 @@ static NSArray *enumerateWidgetRects(fz_document *doc, fz_page *page) NSMutableArray *arr = [NSMutableArray arrayWithCapacity:10]; if (!idoc) - return nil; + return nil; for (widget = pdf_first_widget(idoc, (pdf_page *)page); widget; widget = pdf_next_widget(widget)) { @@ -1159,7 +1159,7 @@ static void updatePixmap(fz_document *doc, fz_display_list *page_list, fz_displa } CGSize fscale = fitPageToScreen(pageSize, self.bounds.size); CGRect rect = (CGRect){{0.0, 0.0},{pageSize.width * fscale.width, pageSize.height * fscale.height}}; - updatePixmap(doc, page_list, annot_list, image_pix, rlist, pageSize, self.bounds.size, rect, 1.0); + updatePixmap(doc, page_list, annot_list, image_pix, rlist, pageSize, self.bounds.size, rect, 1.0); drop_list(rlist); UIImage *image = newImageWithPixmap(image_pix, imageData); dispatch_async(dispatch_get_main_queue(), ^{ diff --git a/platform/ios/Classes/MuPrintPageRenderer.h b/platform/ios/Classes/MuPrintPageRenderer.h index 44d42af0..8f7ac31b 100644 --- a/platform/ios/Classes/MuPrintPageRenderer.h +++ b/platform/ios/Classes/MuPrintPageRenderer.h @@ -1,10 +1,3 @@ -// -// MuPrintPageRenderer.h -// MuPDF -// -// Copyright (c) 2014 Artifex Software, Inc. All rights reserved. -// - #import <UIKit/UIKit.h> #import <MuDocRef.h> diff --git a/platform/ios/Classes/MuPrintPageRenderer.m b/platform/ios/Classes/MuPrintPageRenderer.m index 53e46423..0ab74c79 100644 --- a/platform/ios/Classes/MuPrintPageRenderer.m +++ b/platform/ios/Classes/MuPrintPageRenderer.m @@ -1,10 +1,3 @@ -// -// MuPrintPageRenderer.m -// MuPDF -// -// Copyright (c) 2014 Artifex Software, Inc. All rights reserved. -// - #include "common.h" #import "MuPrintPageRenderer.h" @@ -17,7 +10,7 @@ { docRef = [aDocRef retain]; } - return self; + return self; } -(void) dealloc diff --git a/platform/ios/Classes/MuTapResult.m b/platform/ios/Classes/MuTapResult.m index 9db1d14c..6ec7d088 100644 --- a/platform/ios/Classes/MuTapResult.m +++ b/platform/ios/Classes/MuTapResult.m @@ -68,7 +68,7 @@ pageNumber = aNumber; newWindow = aBool; } - return self; + return self; } -(void) dealloc diff --git a/platform/ios/Classes/MuTextSelectView.m b/platform/ios/Classes/MuTextSelectView.m index 47955ea2..eac3132a 100644 --- a/platform/ios/Classes/MuTextSelectView.m +++ b/platform/ios/Classes/MuTextSelectView.m @@ -33,14 +33,14 @@ __block CGRect r; [MuWord selectFrom:start to:end fromWords:words - onStartLine:^{ - r = CGRectNull; - } onWord:^(MuWord *w) { - r = CGRectUnion(r, w.rect); - } onEndLine:^{ - if (!CGRectIsNull(r)) - [arr addObject:[NSValue valueWithCGRect:r]]; - }]; + onStartLine:^{ + r = CGRectNull; + } onWord:^(MuWord *w) { + r = CGRectUnion(r, w.rect); + } onEndLine:^{ + if (!CGRectIsNull(r)) + [arr addObject:[NSValue valueWithCGRect:r]]; + }]; return arr; } @@ -51,17 +51,17 @@ __block NSMutableString *line; [MuWord selectFrom:start to:end fromWords:words - onStartLine:^{ - line = [NSMutableString string]; - } onWord:^(MuWord *w) { - if (line.length > 0) - [line appendString:@" "]; - [line appendString:w.string]; - } onEndLine:^{ - if (text.length > 0) - [text appendString:@"\n"]; - [text appendString:line]; - }]; + onStartLine:^{ + line = [NSMutableString string]; + } onWord:^(MuWord *w) { + if (line.length > 0) + [line appendString:@" "]; + [line appendString:w.string]; + } onEndLine:^{ + if (text.length > 0) + [text appendString:@"\n"]; + [text appendString:line]; + }]; return text; } @@ -91,14 +91,14 @@ [color set]; [MuWord selectFrom:start to:end fromWords:words - onStartLine:^{ - r = CGRectNull; - } onWord:^(MuWord *w) { - r = CGRectUnion(r, w.rect); - } onEndLine:^{ - if (!CGRectIsNull(r)) - UIRectFill(r); - }]; + onStartLine:^{ + r = CGRectNull; + } onWord:^(MuWord *w) { + r = CGRectUnion(r, w.rect); + } onEndLine:^{ + if (!CGRectIsNull(r)) + UIRectFill(r); + }]; } @end diff --git a/platform/ios/Classes/MuWord.m b/platform/ios/Classes/MuWord.m index 9d13b315..f5f7c667 100644 --- a/platform/ios/Classes/MuWord.m +++ b/platform/ios/Classes/MuWord.m @@ -12,7 +12,7 @@ self.string = [NSMutableString string]; self.rect = CGRectNull; } - return self; + return self; } - (void) dealloc |