diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2017-01-09 13:27:17 +0100 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2017-01-09 17:46:26 +0100 |
commit | 9d96d035d3b7af53256ee64b5ddb0ad8bcf8df38 (patch) | |
tree | 408cbbb72315089db1b8efe58bce322f8734bb1b /platform/ios | |
parent | 50b39c939345c36eb5e95c8a71ccdb8cd24c9aad (diff) | |
download | mupdf-9d96d035d3b7af53256ee64b5ddb0ad8bcf8df38.tar.xz |
Remove platform/ios directory.
The iOS viewer has been moved to its own git repository.
Diffstat (limited to 'platform/ios')
81 files changed, 0 insertions, 5968 deletions
diff --git a/platform/ios/Classes/MuAnnotSelectView.h b/platform/ios/Classes/MuAnnotSelectView.h deleted file mode 100644 index d8c5d966..00000000 --- a/platform/ios/Classes/MuAnnotSelectView.h +++ /dev/null @@ -1,6 +0,0 @@ -#import <UIKit/UIKit.h> -#import "MuAnnotation.h" - -@interface MuAnnotSelectView : UIView -- (instancetype) initWithAnnot:(MuAnnotation *)_annot pageSize:(CGSize)_pageSize; -@end diff --git a/platform/ios/Classes/MuAnnotSelectView.m b/platform/ios/Classes/MuAnnotSelectView.m deleted file mode 100644 index a02adbf7..00000000 --- a/platform/ios/Classes/MuAnnotSelectView.m +++ /dev/null @@ -1,39 +0,0 @@ -#import "MuAnnotSelectView.h" - -@implementation MuAnnotSelectView -{ - MuAnnotation *annot; - CGSize pageSize; - UIColor *color; -} - -- (instancetype)initWithAnnot:(MuAnnotation *)_annot pageSize:(CGSize)_pageSize -{ - self = [super initWithFrame:CGRectMake(0.0, 0.0, 100.0, 100.0)]; - if (self) - { - [self setOpaque:NO]; - annot = [_annot retain]; - pageSize = _pageSize; - color = [[UIColor colorWithRed:0x44/255.0 green:0x44/255.0 blue:1.0 alpha:1.0] retain]; - } - return self; -} - --(void) dealloc -{ - [annot release]; - [color release]; - [super dealloc]; -} - -- (void)drawRect:(CGRect)rect -{ - CGSize scale = fitPageToScreen(pageSize, self.bounds.size); - CGContextRef cref = UIGraphicsGetCurrentContext(); - CGContextScaleCTM(cref, scale.width, scale.height); - [color set]; - CGContextStrokeRect(cref, annot.rect); -} - -@end diff --git a/platform/ios/Classes/MuAnnotation.h b/platform/ios/Classes/MuAnnotation.h deleted file mode 100644 index 6f8e9da3..00000000 --- a/platform/ios/Classes/MuAnnotation.h +++ /dev/null @@ -1,10 +0,0 @@ -#include "common.h" -#include "mupdf/pdf.h" -#import <Foundation/Foundation.h> - -@interface MuAnnotation : NSObject --(instancetype) initFromAnnot:(fz_annot *)annot; -@property(readonly) int type; -@property(readonly) CGRect rect; -+(MuAnnotation *) annotFromAnnot:(fz_annot *)annot; -@end diff --git a/platform/ios/Classes/MuAnnotation.m b/platform/ios/Classes/MuAnnotation.m deleted file mode 100644 index 57fd7ea6..00000000 --- a/platform/ios/Classes/MuAnnotation.m +++ /dev/null @@ -1,31 +0,0 @@ -#import "MuAnnotation.h" - -@implementation MuAnnotation -{ - int type; - CGRect rect; -} - -@synthesize type, rect; - --(instancetype) initFromAnnot:(fz_annot *)annot; -{ - self = [super init]; - if (self) - { - fz_rect frect; - type = pdf_annot_type(ctx, (pdf_annot *)annot); - fz_bound_annot(ctx, annot, &frect); - rect.origin.x = frect.x0; - rect.origin.y = frect.y0; - rect.size.width = frect.x1 - frect.x0; - rect.size.height = frect.y1 - frect.y0; - } - return self; -} - -+(MuAnnotation *) annotFromAnnot:(fz_annot *)annot; -{ - return [[[MuAnnotation alloc] initFromAnnot:annot] autorelease]; -} -@end diff --git a/platform/ios/Classes/MuAppDelegate.h b/platform/ios/Classes/MuAppDelegate.h deleted file mode 100644 index c3d5e1d6..00000000 --- a/platform/ios/Classes/MuAppDelegate.h +++ /dev/null @@ -1,11 +0,0 @@ -#import <UIKit/UIKit.h> - -#import "MuLibraryController.h" - -enum -{ - ResourceCacheMaxSize = 128<<20 /**< use at most 128M for resource cache */ -}; - -@interface MuAppDelegate : NSObject <UIApplicationDelegate> -@end diff --git a/platform/ios/Classes/MuAppDelegate.m b/platform/ios/Classes/MuAppDelegate.m deleted file mode 100644 index 12f9978f..00000000 --- a/platform/ios/Classes/MuAppDelegate.m +++ /dev/null @@ -1,115 +0,0 @@ -#include "common.h" -#include "mupdf/fitz.h" - -#import "MuAppDelegate.h" - -#ifdef CRASHLYTICS_ENABLE -#import <Fabric/Fabric.h> -#import <Crashlytics/Crashlytics.h> -#endif - -@interface MuAppDelegate () <UINavigationControllerDelegate> -@end - -@implementation MuAppDelegate -{ - UIWindow *window; - UINavigationController *navigator; - MuLibraryController *library; - BOOL _isInBackground; -} - -- (BOOL) application: (UIApplication*)application didFinishLaunchingWithOptions: (NSDictionary*)launchOptions -{ - NSString *filename; - - queue = dispatch_queue_create("com.artifex.mupdf.queue", NULL); - - ctx = fz_new_context(NULL, NULL, ResourceCacheMaxSize); - fz_register_document_handlers(ctx); - -#ifdef CRASHLYTICS_ENABLE - NSLog(@"Starting Crashlytics"); - [Fabric with:@[[Crashlytics class]]]; -#endif - - screenScale = [UIScreen mainScreen].scale; - - library = [[MuLibraryController alloc] initWithStyle: UITableViewStylePlain]; - - navigator = [[UINavigationController alloc] initWithRootViewController: library]; - [navigator.navigationBar setTranslucent: YES]; - [navigator.toolbar setTranslucent: YES]; - navigator.delegate = self; - - window = [[UIWindow alloc] initWithFrame: [UIScreen mainScreen].bounds]; - window.backgroundColor = [UIColor grayColor]; - window.rootViewController = navigator; - [window makeKeyAndVisible]; - - filename = [[NSUserDefaults standardUserDefaults] objectForKey: @"OpenDocumentKey"]; - if (filename) - [library openDocument: filename]; - - filename = launchOptions[UIApplicationLaunchOptionsURLKey]; - NSLog(@"urlkey = %@\n", filename); - - return YES; -} - -- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation -{ - NSLog(@"openURL: %@\n", url); - if (url.fileURL) { - NSString *path = url.path; - NSString *dir = [NSString stringWithFormat: @"%@/Documents/", NSHomeDirectory()]; - path = [path stringByReplacingOccurrencesOfString:@"/private" withString:@""]; - path = [path stringByReplacingOccurrencesOfString:dir withString:@""]; - NSLog(@"file relative path: %@\n", path); - [library openDocument:path]; - return YES; - } - return NO; -} - -- (void)applicationDidEnterBackground:(UIApplication *)application -{ - printf("applicationDidEnterBackground!\n"); - [[NSUserDefaults standardUserDefaults] synchronize]; - _isInBackground = YES; -} - -- (void)applicationWillEnterForeground:(UIApplication *)application -{ - printf("applicationWillEnterForeground!\n"); - _isInBackground = NO; -} - -- (void)applicationDidBecomeActive:(UIApplication *)application -{ - printf("applicationDidBecomeActive!\n"); -} - -- (void)applicationWillTerminate:(UIApplication *)application -{ - printf("applicationWillTerminate!\n"); - [[NSUserDefaults standardUserDefaults] synchronize]; -} - -- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application -{ - NSLog(@"applicationDidReceiveMemoryWarning"); - int success = fz_shrink_store(ctx, _isInBackground ? 0 : 50); - NSLog(@"fz_shrink_store: success = %d", success); -} - -- (void) dealloc -{ - dispatch_release(queue); - [library release]; - [navigator release]; - [window release]; - [super dealloc]; -} - -@end diff --git a/platform/ios/Classes/MuChoiceFieldController.h b/platform/ios/Classes/MuChoiceFieldController.h deleted file mode 100644 index 4f9a9961..00000000 --- a/platform/ios/Classes/MuChoiceFieldController.h +++ /dev/null @@ -1,5 +0,0 @@ -#import <UIKit/UIKit.h> - -@interface MuChoiceFieldController : UIViewController<UIPickerViewDataSource, UIPickerViewDelegate> -- (instancetype)initWithChoices:(NSArray *)choices okayAction:(void (^)(NSArray *))block; -@end diff --git a/platform/ios/Classes/MuChoiceFieldController.m b/platform/ios/Classes/MuChoiceFieldController.m deleted file mode 100644 index 3a3aee94..00000000 --- a/platform/ios/Classes/MuChoiceFieldController.m +++ /dev/null @@ -1,76 +0,0 @@ -#import "MuChoiceFieldController.h" - -@interface MuChoiceFieldController () -- (IBAction)onCancel:(id)sender; -- (IBAction)onOkay:(id)sender; -@property (retain, nonatomic) IBOutlet UIPickerView *picker; -@end - -@implementation MuChoiceFieldController -{ - void (^okayBlock)(NSArray *); - NSArray *choices; - NSInteger selected; -} - -- (instancetype)initWithChoices:(NSArray *)_choices okayAction:(void (^)(NSArray *))block -{ - self = [super initWithNibName:@"MuChoiceFieldController" bundle:nil]; - if (self) - { - okayBlock = Block_copy(block); - choices = [_choices retain]; - selected = 0; - } - return self; -} - -- (void)viewDidLoad -{ - [super viewDidLoad]; - _picker.dataSource = self; - _picker.delegate = self; - // Do any additional setup after loading the view from its nib. -} - -- (void)dealloc -{ - [okayBlock release]; - [choices release]; - [_picker release]; - [super dealloc]; -} - -- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView -{ - return 1; -} - -- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component -{ - return choices.count; -} - -- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component -{ - return choices[row]; -} - -- (void) pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component -{ - selected = row; -} - -- (IBAction)onOkay:(id)sender -{ - if (selected >= 0 && selected < choices.count) - okayBlock(@[choices[selected]]); - [self dismissViewControllerAnimated:YES completion:nil]; -} - -- (IBAction)onCancel:(id)sender -{ - [self dismissViewControllerAnimated:YES completion:nil]; -} - -@end diff --git a/platform/ios/Classes/MuChoiceFieldController.xib b/platform/ios/Classes/MuChoiceFieldController.xib deleted file mode 100644 index 8ec37dcf..00000000 --- a/platform/ios/Classes/MuChoiceFieldController.xib +++ /dev/null @@ -1,49 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="4514" systemVersion="13B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none"> - <dependencies> - <deployment defaultVersion="1552" identifier="iOS"/> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3747"/> - </dependencies> - <objects> - <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="MuChoiceFieldController"> - <connections> - <outlet property="picker" destination="ObZ-B5-91l" id="9fH-1p-jPy"/> - <outlet property="view" destination="1" id="3"/> - </connections> - </placeholder> - <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> - <view contentMode="scaleToFill" id="1"> - <rect key="frame" x="0.0" y="0.0" width="320" height="480"/> - <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> - <subviews> - <navigationBar contentMode="scaleToFill" id="awm-dX-cWs"> - <rect key="frame" x="0.0" y="0.0" width="320" height="44"/> - <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/> - <items> - <navigationItem title="Choose value" id="CQX-gg-Sq8"> - <barButtonItem key="leftBarButtonItem" image="ic_cancel.png" id="okq-YT-wra"> - <connections> - <action selector="onCancel:" destination="-1" id="vH7-Kh-HIj"/> - </connections> - </barButtonItem> - <barButtonItem key="rightBarButtonItem" image="ic_check.png" id="HV4-3D-vB9"> - <connections> - <action selector="onOkay:" destination="-1" id="1St-96-Qkc"/> - </connections> - </barButtonItem> - </navigationItem> - </items> - </navigationBar> - <pickerView contentMode="scaleToFill" id="ObZ-B5-91l"> - <rect key="frame" x="0.0" y="44" width="320" height="162"/> - <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/> - </pickerView> - </subviews> - <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/> - </view> - </objects> - <resources> - <image name="ic_cancel.png" width="24" height="24"/> - <image name="ic_check.png" width="24" height="19"/> - </resources> -</document>
\ No newline at end of file diff --git a/platform/ios/Classes/MuDialogCreator.h b/platform/ios/Classes/MuDialogCreator.h deleted file mode 100644 index aec786d0..00000000 --- a/platform/ios/Classes/MuDialogCreator.h +++ /dev/null @@ -1,6 +0,0 @@ -#import <Foundation/Foundation.h> - -@protocol MuDialogCreator <NSObject> -- (void) invokeTextDialog:(NSString *)aString okayAction:(void (^)(NSString *))block; -- (void) invokeChoiceDialog:(NSArray *)anArray okayAction:(void (^)(NSArray *))block; -@end diff --git a/platform/ios/Classes/MuDocRef.h b/platform/ios/Classes/MuDocRef.h deleted file mode 100644 index a0933e8a..00000000 --- a/platform/ios/Classes/MuDocRef.h +++ /dev/null @@ -1,12 +0,0 @@ -#import <Foundation/Foundation.h> - -#include "mupdf/fitz.h" - -@interface MuDocRef : NSObject -{ -@public - fz_document *doc; - bool interactive; -} --(instancetype) initWithFilename:(NSString *)aFilename; -@end diff --git a/platform/ios/Classes/MuDocRef.m b/platform/ios/Classes/MuDocRef.m deleted file mode 100644 index d8d3295a..00000000 --- a/platform/ios/Classes/MuDocRef.m +++ /dev/null @@ -1,53 +0,0 @@ -#include "common.h" -#include "mupdf/pdf.h" -#import "MuDocRef.h" - -@implementation MuDocRef - --(instancetype) initWithFilename:(NSString *)aFilename; -{ - self = [super init]; - if (self) - { - dispatch_sync(queue, ^{}); - - fz_var(self); - - fz_try(ctx) - { - doc = fz_open_document(ctx, aFilename.UTF8String); - if (!doc) - { - [self release]; - self = nil; - } - else - { - pdf_document *idoc = pdf_specifics(ctx, doc); - if (idoc) pdf_enable_js(ctx, idoc); - interactive = (idoc != NULL) && (pdf_crypt_version(ctx, idoc) == 0); - } - } - fz_catch(ctx) - { - if (self) - { - fz_drop_document(ctx, doc); - [self release]; - self = nil; - } - } - } - return self; -} - --(void) dealloc -{ - __block fz_document *block_doc = doc; - dispatch_async(queue, ^{ - fz_drop_document(ctx, block_doc); - }); - [super dealloc]; -} - -@end diff --git a/platform/ios/Classes/MuDocumentController.h b/platform/ios/Classes/MuDocumentController.h deleted file mode 100644 index c7c1fcdb..00000000 --- a/platform/ios/Classes/MuDocumentController.h +++ /dev/null @@ -1,40 +0,0 @@ -#import <UIKit/UIKit.h> - -#undef ABS -#undef MIN -#undef MAX - -#include "mupdf/fitz.h" - -#import "MuOutlineController.h" -#import "MuDocRef.h" -#import "MuDialogCreator.h" -#import "MuUpdater.h" - -enum -{ - BARMODE_MAIN, - BARMODE_SEARCH, - BARMODE_MORE, - BARMODE_ANNOTATION, - BARMODE_HIGHLIGHT, - BARMODE_UNDERLINE, - BARMODE_STRIKE, - BARMODE_INK, - BARMODE_DELETE -}; - -@interface MuDocumentController : UIViewController <UIScrollViewDelegate, UIGestureRecognizerDelegate, UISearchBarDelegate, MuDialogCreator, MuUpdater> -- (instancetype) initWithFilename: (NSString*)nsfilename path:(NSString *)path document:(MuDocRef *)aDoc; -- (void) createPageView: (int)number; -- (void) gotoPage: (int)number animated: (BOOL)animated; -- (void) onShowOutline: (id)sender; -- (void) onShowSearch: (id)sender; -- (void) onCancel: (id)sender; -- (void) resetSearch; -- (void) showSearchResults: (int)count forPage: (int)number; -- (void) onSlide: (id)sender; -- (void) onTap: (UITapGestureRecognizer*)sender; -- (void) showNavigationBar; -- (void) hideNavigationBar; -@end diff --git a/platform/ios/Classes/MuDocumentController.m b/platform/ios/Classes/MuDocumentController.m deleted file mode 100644 index 2a070b71..00000000 --- a/platform/ios/Classes/MuDocumentController.m +++ /dev/null @@ -1,1181 +0,0 @@ -#include "common.h" - -#import "MuPageViewNormal.h" -#import "MuPageViewReflow.h" -#import "MuDocumentController.h" -#import "MuTextFieldController.h" -#import "MuChoiceFieldController.h" -#import "MuPrintPageRenderer.h" - -#define GAP 20 -#define INDICATOR_Y -44-24 -#define SLIDER_W (width - GAP - 24) -#define SEARCH_W (width - GAP - 170) -#define MIN_SCALE (1.0) -#define MAX_SCALE (5.0) - -static NSString *const AlertTitle = @"Save Document?"; -// Correct functioning of the app relies on CloseAlertMessage and ShareAlertMessage differing -static NSString *const CloseAlertMessage = @"Changes have been made to the document that will be lost if not saved"; -static NSString *const ShareAlertMessage = @"Your changes will not be shared unless the document is first saved"; - -static void flattenOutline(NSMutableArray *titles, NSMutableArray *pages, fz_outline *outline, int level) -{ - char indent[8*4+1]; - if (level > 8) - level = 8; - memset(indent, ' ', level * 4); - indent[level * 4] = 0; - while (outline) - { - int page = outline->page; - if (page >= 0 && outline->title) - { - NSString *title = @(outline->title); - [titles addObject: [NSString stringWithFormat: @"%s%@", indent, title]]; - [pages addObject: @(page)]; - } - flattenOutline(titles, pages, outline->down, level + 1); - outline = outline->next; - } -} - -static char *tmp_path(const char *path) -{ - int f; - char *buf = malloc(strlen(path) + 6 + 1); - if (!buf) - return NULL; - - strcpy(buf, path); - strcat(buf, "XXXXXX"); - - f = mkstemp(buf); - - if (f >= 0) - { - close(f); - return buf; - } - else - { - free(buf); - return NULL; - } -} - -static void saveDoc(const char *current_path, fz_document *doc) -{ - char *tmp; - pdf_document *idoc = pdf_specifics(ctx, doc); - pdf_write_options opts = { 0 }; - - opts.do_incremental = 1; - - if (!idoc) - return; - - tmp = tmp_path(current_path); - if (tmp) - { - int written = 0; - - fz_var(written); - fz_try(ctx) - { - FILE *fin = fopen(current_path, "rb"); - FILE *fout = fopen(tmp, "wb"); - char buf[256]; - size_t n; - int err = 1; - - if (fin && fout) - { - while ((n = fread(buf, 1, sizeof(buf), fin)) > 0) - fwrite(buf, 1, n, fout); - err = (ferror(fin) || ferror(fout)); - } - - if (fin) - fclose(fin); - if (fout) - fclose(fout); - - if (!err) - { - pdf_save_document(ctx, idoc, tmp, &opts); - written = 1; - } - } - fz_catch(ctx) - { - written = 0; - } - - if (written) - { - rename(tmp, current_path); - } - - free(tmp); - } -} - -@implementation MuDocumentController -{ - fz_document *doc; - MuDocRef *docRef; - NSString *key; - NSString *_filePath; - BOOL reflowMode; - MuOutlineController *outline; - UIScrollView *canvas; - UILabel *indicator; - UISlider *slider; - UISearchBar *searchBar; - UIBarButtonItem *nextButton, *prevButton, *cancelButton, *searchButton, *outlineButton, *linkButton; - UIBarButtonItem *moreButton; - UIBarButtonItem *shareButton, *printButton, *annotButton; - UIBarButtonItem *highlightButton, *underlineButton, *strikeoutButton; - UIBarButtonItem *inkButton; - UIBarButtonItem *tickButton; - UIBarButtonItem *deleteButton; - UIBarButtonItem *reflowButton; - UIBarButtonItem *backButton; - UIBarButtonItem *sliderWrapper; - int barmode; - int searchPage; - int cancelSearch; - int showLinks; - int width; // current screen size - int height; - int current; // currently visible page - int scroll_animating; // stop view updates during scrolling animations - float scale; // scale applied to views (only used in reflow mode) - BOOL _isRotating; -} - -- (instancetype) initWithFilename: (NSString*)filename path:(NSString *)cstr document: (MuDocRef *)aDoc -{ - self = [super initWithNibName:nil bundle:nil]; - if (!self) - return nil; - -#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000 - if ([self respondsToSelector:@selector(automaticallyAdjustsScrollViewInsets)]) - self.automaticallyAdjustsScrollViewInsets = NO; -#endif - key = [filename copy]; - docRef = [aDoc retain]; - doc = docRef->doc; - _filePath = [cstr copy]; - - // this will be created right before the outline is shown - outline = nil; - - dispatch_sync(queue, ^{}); - - return self; -} - -- (UIBarButtonItem *) newResourceBasedButton:(NSString *)resource withAction:(SEL)selector -{ - if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) - { - return [[UIBarButtonItem alloc] initWithImage:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:resource ofType:@"png"]] style:UIBarButtonItemStylePlain target:self action:selector]; - } - else - { - UIView *buttonView; - BOOL iOS7Style = (([UIDevice currentDevice].systemVersion).floatValue >= 7.0f); - UIButton *button = [UIButton buttonWithType:iOS7Style ? UIButtonTypeSystem : UIButtonTypeCustom]; - [button setImage:[UIImage imageNamed:resource] forState:UIControlStateNormal]; - [button addTarget:self action:selector forControlEvents:UIControlEventTouchUpInside]; - [button sizeToFit]; - buttonView = button; - - return [[UIBarButtonItem alloc] initWithCustomView:buttonView]; - } -} - -- (void) addMainMenuButtons -{ - NSMutableArray *array = [NSMutableArray arrayWithCapacity:3]; - [array addObject:moreButton]; - [array addObject:searchButton]; - if (outlineButton) - [array addObject:outlineButton]; - [array addObject:reflowButton]; - [array addObject:linkButton]; - self.navigationItem.rightBarButtonItems = array ; - self.navigationItem.leftBarButtonItem = backButton; -} - -- (void) loadView -{ - [[NSUserDefaults standardUserDefaults] setObject: key forKey: @"OpenDocumentKey"]; - - current = (int)[[NSUserDefaults standardUserDefaults] integerForKey: key]; - if (current < 0 || current >= fz_count_pages(ctx, doc)) - current = 0; - - UIView *view = [[UIView alloc] initWithFrame: CGRectZero]; - view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; - [view setAutoresizesSubviews: YES]; - view.backgroundColor = [UIColor grayColor]; - - canvas = [[UIScrollView alloc] initWithFrame: CGRectMake(0,0,GAP,0)]; - canvas.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; - [canvas setPagingEnabled: YES]; - [canvas setShowsHorizontalScrollIndicator: NO]; - [canvas setShowsVerticalScrollIndicator: NO]; - canvas.delegate = self; - - UITapGestureRecognizer *tapRecog = [[UITapGestureRecognizer alloc] initWithTarget: self action: @selector(onTap:)]; - tapRecog.delegate = self; - [canvas addGestureRecognizer: tapRecog]; - [tapRecog release]; - // In reflow mode, we need to track pinch gestures on the canvas and pass - // the scale changes to the subviews. - UIPinchGestureRecognizer *pinchRecog = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(onPinch:)]; - pinchRecog.delegate = self; - [canvas addGestureRecognizer:pinchRecog]; - [pinchRecog release]; - - scale = 1.0; - - scroll_animating = NO; - - indicator = [[UILabel alloc] initWithFrame: CGRectZero]; - indicator.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin; - indicator.text = @"0000 of 9999"; - [indicator sizeToFit]; - indicator.center = CGPointMake(0, INDICATOR_Y); - indicator.textAlignment = NSTextAlignmentCenter; - indicator.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent: 0.5]; - indicator.textColor = [UIColor whiteColor]; - - [view addSubview: canvas]; - [view addSubview: indicator]; - - slider = [[UISlider alloc] initWithFrame: CGRectZero]; - slider.minimumValue = 0; - slider.maximumValue = fz_count_pages(ctx, doc) - 1; - [slider addTarget: self action: @selector(onSlide:) forControlEvents: UIControlEventValueChanged]; - - if ([UIDevice currentDevice].systemVersion.floatValue < 7.0) - { - sliderWrapper = [[UIBarButtonItem alloc] initWithCustomView: slider]; - - self.toolbarItems = @[sliderWrapper]; - } - - // Set up the buttons on the navigation and search bar - - fz_outline *outlineRoot; - fz_try(ctx) - outlineRoot = fz_load_outline(ctx, doc); - fz_catch(ctx) - outlineRoot = NULL; - if (outlineRoot) - { - // only show the outline button if there is an outline - outlineButton = [self newResourceBasedButton:@"ic_list" withAction:@selector(onShowOutline:)]; - fz_drop_outline(ctx, outlineRoot); - } - - linkButton = [self newResourceBasedButton:@"ic_link" withAction:@selector(onToggleLinks:)]; - cancelButton = [self newResourceBasedButton:@"ic_cancel" withAction:@selector(onCancel:)]; - searchButton = [self newResourceBasedButton:@"ic_magnifying_glass" withAction:@selector(onShowSearch:)]; - prevButton = [self newResourceBasedButton:@"ic_arrow_left" withAction:@selector(onSearchPrev:)]; - nextButton = [self newResourceBasedButton:@"ic_arrow_right" withAction:@selector(onSearchNext:)]; - reflowButton = [self newResourceBasedButton:@"ic_reflow" withAction:@selector(onToggleReflow:)]; - moreButton = [self newResourceBasedButton:@"ic_more" withAction:@selector(onMore:)]; - annotButton = [self newResourceBasedButton:@"ic_annotation" withAction:@selector(onAnnot:)]; - shareButton = [self newResourceBasedButton:@"ic_share" withAction:@selector(onShare:)]; - printButton = [self newResourceBasedButton:@"ic_print" withAction:@selector(onPrint:)]; - highlightButton = [self newResourceBasedButton:@"ic_highlight" withAction:@selector(onHighlight:)]; - underlineButton = [self newResourceBasedButton:@"ic_underline" withAction:@selector(onUnderline:)]; - strikeoutButton = [self newResourceBasedButton:@"ic_strike" withAction:@selector(onStrikeout:)]; - inkButton = [self newResourceBasedButton:@"ic_pen" withAction:@selector(onInk:)]; - tickButton = [self newResourceBasedButton:@"ic_check" withAction:@selector(onTick:)]; - deleteButton = [self newResourceBasedButton:@"ic_trash" withAction:@selector(onDelete:)]; - searchBar = [[UISearchBar alloc] initWithFrame: CGRectMake(0,0,50,32)]; - backButton = [self newResourceBasedButton:@"ic_arrow_left" withAction:@selector(onBack:)]; - searchBar.placeholder = @"Search"; - searchBar.delegate = self; - - [prevButton setEnabled: NO]; - [nextButton setEnabled: NO]; - - [self addMainMenuButtons]; - - // TODO: add activityindicator to search bar - - self.view = view; - [view release]; -} - -- (void) dealloc -{ - [docRef release]; docRef = nil; doc = NULL; - [indicator release]; indicator = nil; - [slider release]; slider = nil; - [sliderWrapper release]; sliderWrapper = nil; - [reflowButton release]; reflowButton = nil; - [backButton release]; backButton = nil; - [moreButton release]; moreButton = nil; - [searchBar release]; searchBar = nil; - [outlineButton release]; outlineButton = nil; - [linkButton release]; linkButton = nil; - [searchButton release]; searchButton = nil; - [cancelButton release]; cancelButton = nil; - [prevButton release]; prevButton = nil; - [nextButton release]; nextButton = nil; - [shareButton release]; shareButton = nil; - [printButton release]; printButton = nil; - [annotButton release]; annotButton = nil; - [highlightButton release]; highlightButton = nil; - [underlineButton release]; underlineButton = nil; - [strikeoutButton release]; strikeoutButton = nil; - [inkButton release]; inkButton = nil; - [tickButton release]; tickButton = nil; - [deleteButton release]; deleteButton = nil; - [canvas release]; canvas = nil; - [_filePath release]; _filePath = NULL; - - [outline release]; - [key release]; - [super dealloc]; -} - -- (void) viewWillAppear: (BOOL)animated -{ - [super viewWillAppear:animated]; - self.title = key.lastPathComponent; - - slider.value = current; - - if ([UIDevice currentDevice].systemVersion.floatValue >= 7.0) - [self.navigationController.toolbar addSubview:slider]; - - indicator.text = [NSString stringWithFormat: @" %d of %d ", current+1, fz_count_pages(ctx, doc)]; - - [self.navigationController setToolbarHidden: NO animated: animated]; -} - -- (void) viewWillLayoutSubviews -{ - CGSize size = canvas.frame.size; - int max_width = fz_max(width, size.width); - - width = size.width; - height = size.height; - - canvas.contentInset = UIEdgeInsetsZero; - canvas.contentSize = CGSizeMake(fz_count_pages(ctx, doc) * width, height); - canvas.contentOffset = CGPointMake(current * width, 0); - - [sliderWrapper setWidth: SLIDER_W]; - searchBar.frame = CGRectMake(0,0,SEARCH_W,32); - if ([UIDevice currentDevice].systemVersion.floatValue >= 7.0) - { - CGRect r = self.navigationController.toolbar.frame; - r.origin.x = 0; - r.origin.y = 0; - slider.frame = r; - } - - [self.navigationController.toolbar setNeedsLayout]; // force layout! - - // use max_width so we don't clamp the content offset too early during animation - canvas.contentSize = CGSizeMake(fz_count_pages(ctx, doc) * max_width, height); - canvas.contentOffset = CGPointMake(current * width, 0); - - for (UIView<MuPageView> *view in canvas.subviews) { - if (view.number == current) { - view.frame = CGRectMake(view.number * width, 0, width-GAP, height); - [view willRotate]; - } - } - for (UIView<MuPageView> *view in canvas.subviews) { - if (view.number != current) { - view.frame = CGRectMake(view.number * width, 0, width-GAP, height); - [view willRotate]; - } - } -} - -- (void) viewDidAppear: (BOOL)animated -{ - [super viewDidAppear:animated]; - [self scrollViewDidScroll: canvas]; -} - -- (void) viewWillDisappear: (BOOL)animated -{ - [super viewWillDisappear:animated]; - if ([UIDevice currentDevice].systemVersion.floatValue >= 7.0) - [slider removeFromSuperview]; - - self.title = @"Resume"; - [[NSUserDefaults standardUserDefaults] removeObjectForKey: @"OpenDocumentKey"]; - [self.navigationController setToolbarHidden: YES animated: animated]; -} - -- (void) showNavigationBar -{ - if (self.navigationController.navigationBarHidden) { - [sliderWrapper setWidth: SLIDER_W]; - if ([UIDevice currentDevice].systemVersion.floatValue >= 7.0) - { - CGRect r = self.navigationController.toolbar.frame; - r.origin.x = 0; - r.origin.y = 0; - slider.frame = r; - } - [self.navigationController setNavigationBarHidden: NO]; - [self.navigationController setToolbarHidden: NO]; - [indicator setHidden: NO]; - - [UIView beginAnimations: @"MuNavBar" context: NULL]; - - self.navigationController.navigationBar.alpha = 1; - self.navigationController.toolbar.alpha = 1; - indicator.alpha = 1; - - [UIView commitAnimations]; - } -} - -- (void) hideNavigationBar -{ - if (!self.navigationController.navigationBarHidden) { - [searchBar resignFirstResponder]; - - [UIView beginAnimations: @"MuNavBar" context: NULL]; - [UIView setAnimationDelegate: self]; - [UIView setAnimationDidStopSelector: @selector(onHideNavigationBarFinished)]; - - self.navigationController.navigationBar.alpha = 0; - self.navigationController.toolbar.alpha = 0; - indicator.alpha = 0; - - [UIView commitAnimations]; - } -} - -- (void) onHideNavigationBarFinished -{ - [self.navigationController setNavigationBarHidden: YES]; - [self.navigationController setToolbarHidden: YES]; - [indicator setHidden: YES]; -} - -- (void) onShowOutline: (id)sender -{ - // rebuild the outline in case the layout has changed - fz_outline *root; - fz_try(ctx) - root = fz_load_outline(ctx, doc); - fz_catch(ctx) - root = NULL; - if (root) - { - NSMutableArray *titles = [[NSMutableArray alloc] init]; - NSMutableArray *pages = [[NSMutableArray alloc] init]; - flattenOutline(titles, pages, root, 0); - [outline release]; - if (titles.count) - outline = [[MuOutlineController alloc] initWithTarget: self titles: titles pages: pages]; - [titles release]; - [pages release]; - fz_drop_outline(ctx, root); - } - - // now show it - - [self.navigationController pushViewController: outline animated: YES]; -} - -- (void) onToggleLinks: (id)sender -{ - showLinks = !showLinks; - for (UIView<MuPageView> *view in canvas.subviews) - { - if (showLinks) - [view showLinks]; - else - [view hideLinks]; - } -} - -- (void) onToggleReflow: (id)sender -{ - reflowMode = !reflowMode; - - annotButton.enabled = !reflowMode; - searchButton.enabled = !reflowMode; - linkButton.enabled = !reflowMode; - moreButton.enabled = !reflowMode; - - [canvas.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)]; - [self scrollViewDidScroll:canvas]; -} - -- (void) showMoreMenu -{ - NSMutableArray *rightbuttons = [NSMutableArray arrayWithObjects:printButton, shareButton, nil]; - if (docRef->interactive) - [rightbuttons insertObject:annotButton atIndex:0]; - self.navigationItem.rightBarButtonItems = rightbuttons; - self.navigationItem.leftBarButtonItem = cancelButton; - - barmode = BARMODE_MORE; -} - -- (void) showAnnotationMenu -{ - self.navigationItem.rightBarButtonItems = @[inkButton, strikeoutButton, underlineButton, highlightButton]; - self.navigationItem.leftBarButtonItem = cancelButton; - - for (UIView<MuPageView> *view in canvas.subviews) - { - if (view.number == current) - [view deselectAnnotation]; - } - - barmode = BARMODE_ANNOTATION; -} - -- (void) update -{ - for (UIView<MuPageView> *view in canvas.subviews) - [view update]; -} - -- (void) onMore: (id)sender -{ - [self showMoreMenu]; -} - -- (void) onAnnot: (id)sender -{ - [self showAnnotationMenu]; -} - -- (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) { - [pic presentFromBarButtonItem:printButton animated:YES - completionHandler:completionHandler]; - } else { - [pic presentAnimated:YES completionHandler:completionHandler]; - } - } -} - -- (void) shareDocument -{ - NSURL *url = [NSURL fileURLWithPath:_filePath]; - UIActivityViewController *cont = [[UIActivityViewController alloc] initWithActivityItems:@[url] applicationActivities:nil]; - cont.popoverPresentationController.barButtonItem = shareButton; - [self presentViewController:cont animated:YES completion:nil]; - [cont release]; -} - -- (void) onShare: (id)sender -{ - pdf_document *idoc = pdf_specifics(ctx, doc); - if (idoc && pdf_has_unsaved_changes(ctx, idoc)) - { - UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:AlertTitle message:ShareAlertMessage delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Save and Share", nil]; - [alertView show]; - [alertView release]; - } - else - { - [self shareDocument]; - } -} - -- (void) textSelectModeOn -{ - self.navigationItem.rightBarButtonItems = @[tickButton]; - for (UIView<MuPageView> *view in canvas.subviews) - { - if (view.number == current) - [view textSelectModeOn]; - } -} - -- (void) textSelectModeOff -{ - for (UIView<MuPageView> *view in canvas.subviews) - { - [view textSelectModeOff]; - } -} - -- (void) inkModeOn -{ - self.navigationItem.rightBarButtonItems = @[tickButton]; - for (UIView<MuPageView> *view in canvas.subviews) - { - if (view.number == current) - [view inkModeOn]; - } -} - -- (void) deleteModeOn -{ - self.navigationItem.rightBarButtonItems = @[deleteButton]; - barmode = BARMODE_DELETE; -} - -- (void) inkModeOff -{ - for (UIView<MuPageView> *view in canvas.subviews) - { - [view inkModeOff]; - } -} - -- (void) onHighlight: (id)sender -{ - barmode = BARMODE_HIGHLIGHT; - [self textSelectModeOn]; -} - -- (void) onUnderline: (id)sender -{ - barmode = BARMODE_UNDERLINE; - [self textSelectModeOn]; -} - -- (void) onStrikeout: (id)sender -{ - barmode = BARMODE_STRIKE; - [self textSelectModeOn]; -} - -- (void) onInk: (id)sender -{ - barmode = BARMODE_INK; - [self inkModeOn]; -} - -- (void) onShowSearch: (id)sender -{ - self.navigationItem.rightBarButtonItems = @[nextButton, prevButton]; - self.navigationItem.leftBarButtonItem = cancelButton; - self.navigationItem.titleView = searchBar; - [searchBar becomeFirstResponder]; - barmode = BARMODE_SEARCH; -} - -- (void) onTick: (id)sender -{ - for (UIView<MuPageView> *view in canvas.subviews) - { - if (view.number == current) - { - switch (barmode) - { - case BARMODE_HIGHLIGHT: - [view saveSelectionAsMarkup:PDF_ANNOT_HIGHLIGHT]; - break; - - case BARMODE_UNDERLINE: - [view saveSelectionAsMarkup:PDF_ANNOT_UNDERLINE]; - break; - - case BARMODE_STRIKE: - [view saveSelectionAsMarkup:PDF_ANNOT_STRIKE_OUT]; - break; - - case BARMODE_INK: - [view saveInk]; - } - } - } - - [self showAnnotationMenu]; -} - -- (void) onDelete: (id)sender -{ - for (UIView<MuPageView> *view in canvas.subviews) - { - if (view.number == current) - [view deleteSelectedAnnotation]; - } - [self showAnnotationMenu]; -} - -- (void) onCancel: (id)sender -{ - switch (barmode) - { - case BARMODE_SEARCH: - cancelSearch = YES; - [searchBar resignFirstResponder]; - [self resetSearch]; - /* fallthrough */ - case BARMODE_ANNOTATION: - case BARMODE_MORE: - [self.navigationItem setTitleView: nil]; - [self addMainMenuButtons]; - barmode = BARMODE_MAIN; - break; - - case BARMODE_HIGHLIGHT: - case BARMODE_UNDERLINE: - case BARMODE_STRIKE: - case BARMODE_DELETE: - [self showAnnotationMenu]; - [self textSelectModeOff]; - break; - - case BARMODE_INK: - [self showAnnotationMenu]; - [self inkModeOff]; - break; - } -} - -- (void) onBack: (id)sender -{ - pdf_document *idoc = pdf_specifics(ctx, doc); - if (idoc && pdf_has_unsaved_changes(ctx, idoc)) - { - UIAlertView *saveAlert = [[UIAlertView alloc] - initWithTitle:AlertTitle message:CloseAlertMessage delegate:self - cancelButtonTitle:@"Discard" otherButtonTitles:@"Save", nil]; - [saveAlert show]; - [saveAlert release]; - } - else - { - [self.navigationController popViewControllerAnimated:YES]; - } -} - -- (void) alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex -{ - if ([CloseAlertMessage isEqualToString:alertView.message]) - { - if (buttonIndex == 1) - saveDoc(_filePath.UTF8String, doc); - - [alertView dismissWithClickedButtonIndex:buttonIndex animated:YES]; - [self.navigationController popViewControllerAnimated:YES]; - } - - if ([ShareAlertMessage isEqualToString:alertView.message]) - { - [alertView dismissWithClickedButtonIndex:buttonIndex animated:NO]; - if (buttonIndex == 1) - { - saveDoc(_filePath.UTF8String, doc); - [self shareDocument]; - } - } -} - -- (void) resetSearch -{ - searchPage = -1; - for (UIView<MuPageView> *view in canvas.subviews) - [view clearSearchResults]; -} - -- (void) showSearchResults: (int)count forPage: (int)number -{ - printf("search found match on page %d\n", number); - searchPage = number; - [self gotoPage: number animated: NO]; - for (UIView<MuPageView> *view in canvas.subviews) - if (view.number == number) - [view showSearchResults: count]; - else - [view clearSearchResults]; -} - -- (void) searchInDirection: (int)dir -{ - UITextField *searchField; - char *needle; - int start; - - [searchBar resignFirstResponder]; - - if (searchPage == current) - start = current + dir; - else - start = current; - - needle = strdup(searchBar.text.UTF8String); - - searchField = nil; - for (id view in searchBar.subviews) - if ([view isKindOfClass: [UITextField class]]) - searchField = view; - - [prevButton setEnabled: NO]; - [nextButton setEnabled: NO]; - [searchField setEnabled: NO]; - - cancelSearch = NO; - - dispatch_async(queue, ^{ - for (int i = start; i >= 0 && i < fz_count_pages(ctx, doc); i += dir) { - int n = search_page(doc, i, needle, NULL); - if (n) { - dispatch_async(dispatch_get_main_queue(), ^{ - [prevButton setEnabled: YES]; - [nextButton setEnabled: YES]; - [searchField setEnabled: YES]; - [self showSearchResults: n forPage: i]; - free(needle); - }); - return; - } - if (cancelSearch) { - dispatch_async(dispatch_get_main_queue(), ^{ - [prevButton setEnabled: YES]; - [nextButton setEnabled: YES]; - [searchField setEnabled: YES]; - free(needle); - }); - return; - } - } - dispatch_async(dispatch_get_main_queue(), ^{ - printf("no search results found\n"); - [prevButton setEnabled: YES]; - [nextButton setEnabled: YES]; - [searchField setEnabled: YES]; - UIAlertView *alert = [[UIAlertView alloc] - initWithTitle: @"No matches found for:" - message: @(needle) - delegate: nil - cancelButtonTitle: @"Close" - otherButtonTitles: nil]; - [alert show]; - [alert release]; - free(needle); - }); - }); -} - -- (void) onSearchPrev: (id)sender -{ - [self searchInDirection: -1]; -} - -- (void) onSearchNext: (id)sender -{ - [self searchInDirection: 1]; -} - -- (void) searchBarSearchButtonClicked: (UISearchBar*)sender -{ - [self onSearchNext: sender]; -} - -- (void) searchBar: (UISearchBar*)sender textDidChange: (NSString*)searchText -{ - [self resetSearch]; - if (searchBar.text.length > 0) { - [prevButton setEnabled: YES]; - [nextButton setEnabled: YES]; - } else { - [prevButton setEnabled: NO]; - [nextButton setEnabled: NO]; - } -} - -- (void) onSlide: (id)sender -{ - int number = slider.value; - if (slider.tracking) - indicator.text = [NSString stringWithFormat: @" %d of %d ", number+1, fz_count_pages(ctx, doc)]; - else - [self gotoPage: number animated: NO]; -} - -- (BOOL) gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer -{ - // For reflow mode, we load UIWebViews into the canvas. Returning YES - // here prevents them stealing our tap and pinch events. - return YES; -} - -- (void) onTap: (UITapGestureRecognizer*)sender -{ - CGPoint p = [sender locationInView: canvas]; - CGPoint ofs = canvas.contentOffset; - float x0 = (width - GAP) / 5; - float x1 = (width - GAP) - x0; - p.x -= ofs.x; - p.y -= ofs.y; - __block BOOL tapHandled = NO; - for (UIView<MuPageView> *view in canvas.subviews) - { - CGPoint pp = [sender locationInView:view]; - if (CGRectContainsPoint(view.bounds, pp)) - { - MuTapResult *result = [view handleTap:pp]; - __block BOOL hitAnnot = NO; - [result switchCaseInternal:^(MuTapResultInternalLink *link) { - [self gotoPage:link.pageNumber animated:NO]; - tapHandled = YES; - } caseExternal:^(MuTapResultExternalLink *link) { - // Not currently supported - } caseRemote:^(MuTapResultRemoteLink *link) { - // Not currently supported - } caseWidget:^(MuTapResultWidget *widget) { - tapHandled = YES; - } caseAnnotation:^(MuTapResultAnnotation *annot) { - hitAnnot = YES; - }]; - - switch (barmode) - { - case BARMODE_ANNOTATION: - if (hitAnnot) - [self deleteModeOn]; - tapHandled = YES; - break; - - case BARMODE_DELETE: - if (!hitAnnot) - [self showAnnotationMenu]; - tapHandled = YES; - break; - - default: - if (hitAnnot) - { - // Annotation will have been selected, which is wanted - // only in annotation-editing mode - [view deselectAnnotation]; - } - break; - } - - if (tapHandled) - break; - } - } - if (tapHandled) { - // Do nothing further - } else if (p.x < x0) { - [self gotoPage: current-1 animated: YES]; - } else if (p.x > x1) { - [self gotoPage: current+1 animated: YES]; - } else { - if (self.navigationController.navigationBarHidden) - [self showNavigationBar]; - else if (barmode == BARMODE_MAIN) - [self hideNavigationBar]; - } -} - -- (void) onPinch:(UIPinchGestureRecognizer*)sender -{ - if (sender.state == UIGestureRecognizerStateBegan) - sender.scale = scale; - - if (sender.scale < MIN_SCALE) - sender.scale = MIN_SCALE; - - if (sender.scale > MAX_SCALE) - sender.scale = MAX_SCALE; - - if (sender.state == UIGestureRecognizerStateEnded) - scale = sender.scale; - - for (UIView<MuPageView> *view in canvas.subviews) - { - // Zoom only the visible page until end of gesture - if (view.number == current || sender.state == UIGestureRecognizerStateEnded) - [view setScale:sender.scale]; - } -} - -- (void) scrollViewWillBeginDragging: (UIScrollView *)scrollView -{ - if (barmode == BARMODE_MAIN) - [self hideNavigationBar]; -} - -- (void) scrollViewDidScroll: (UIScrollView*)scrollview -{ - // scrollViewDidScroll seems to get called part way through a screen rotation. - // (This is possibly a UIScrollView bug - see - // http://stackoverflow.com/questions/4123991/uiscrollview-disable-scrolling-while-rotating-on-iphone-ipad/8141423#8141423 ). - // This ends up corrupting the current page number, because the calculation - // 'current = x / width' is using the new value of 'width' before the - // pages have been resized/repositioned. To avoid this problem, we filter out - // calls to scrollViewDidScroll during rotation. - if (_isRotating) - return; - - if (width == 0) - return; // not visible yet - - if (scroll_animating) - return; // don't mess with layout during animations - - float x = canvas.contentOffset.x + width * 0.5f; - current = x / width; - - [[NSUserDefaults standardUserDefaults] setInteger: current forKey: key]; - - indicator.text = [NSString stringWithFormat: @" %d of %d ", current+1, fz_count_pages(ctx, doc)]; - slider.value = current; - - // swap the distant page views out - - NSMutableSet *invisiblePages = [[NSMutableSet alloc] init]; - for (UIView<MuPageView> *view in canvas.subviews) { - if (view.number != current) - [view resetZoomAnimated: YES]; - if (view.number < current - 2 || view.number > current + 2) - [invisiblePages addObject: view]; - } - for (UIView<MuPageView> *view in invisiblePages) - [view removeFromSuperview]; - [invisiblePages release]; // don't bother recycling them... - - [self createPageView: current]; - [self createPageView: current - 1]; - [self createPageView: current + 1]; - - // reset search results when page has flipped - if (current != searchPage) - [self resetSearch]; -} - -- (void) createPageView: (int)number -{ - if (number < 0 || number >= fz_count_pages(ctx, doc)) - return; - int found = 0; - for (UIView<MuPageView> *view in canvas.subviews) - if (view.number == number) - found = 1; - if (!found) { - UIView<MuPageView> *view - = reflowMode - ? [[MuPageViewReflow alloc] initWithFrame:CGRectMake(number * width, 0, width-GAP, height) document:docRef page:number] - : [[MuPageViewNormal alloc] initWithFrame:CGRectMake(number * width, 0, width-GAP, height) dialogCreator:self updater:self document:docRef page:number]; - [view setScale:scale]; - [canvas addSubview: view]; - if (showLinks) - [view showLinks]; - [view release]; - } -} - -- (void) gotoPage: (int)number animated: (BOOL)animated -{ - if (number < 0) - number = 0; - if (number >= fz_count_pages(ctx, doc)) - number = fz_count_pages(ctx, doc) - 1; - if (current == number) - return; - if (animated) { - // setContentOffset:animated: does not use the normal animation - // framework. It also doesn't play nice with the tap gesture - // recognizer. So we do our own page flipping animation here. - // We must set the scroll_animating flag so that we don't create - // or remove subviews until after the animation, or they'll - // swoop in from origo during the animation. - - scroll_animating = YES; - [UIView beginAnimations: @"MuScroll" context: NULL]; - [UIView setAnimationDuration: 0.4]; - [UIView setAnimationBeginsFromCurrentState: YES]; - [UIView setAnimationDelegate: self]; - [UIView setAnimationDidStopSelector: @selector(onGotoPageFinished)]; - - for (UIView<MuPageView> *view in canvas.subviews) - [view resetZoomAnimated: NO]; - - canvas.contentOffset = CGPointMake(number * width, 0); - slider.value = number; - indicator.text = [NSString stringWithFormat: @" %d of %d ", number+1, fz_count_pages(ctx, doc)]; - - [UIView commitAnimations]; - } else { - for (UIView<MuPageView> *view in canvas.subviews) - [view resetZoomAnimated: NO]; - canvas.contentOffset = CGPointMake(number * width, 0); - } - current = number; -} - -- (void) invokeTextDialog:(NSString *)aString okayAction:(void (^)(NSString *))block -{ - MuTextFieldController *tf = [[MuTextFieldController alloc] initWithText:aString okayAction:block]; - tf.modalPresentationStyle = UIModalPresentationFormSheet; - [self presentViewController:tf animated:YES completion:nil]; - [tf release]; -} - -- (void) invokeChoiceDialog:(NSArray *)anArray okayAction:(void (^)(NSArray *))block -{ - MuChoiceFieldController *cf = [[MuChoiceFieldController alloc] initWithChoices:anArray okayAction:block]; - cf.modalPresentationStyle = UIModalPresentationFormSheet; - [self presentViewController:cf animated:YES completion:nil]; - [cf release]; -} - -- (void) onGotoPageFinished -{ - scroll_animating = NO; - [self scrollViewDidScroll: canvas]; -} - -- (BOOL) shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)o -{ - return YES; -} - -- (void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration -{ - _isRotating = YES; -} - -- (void) didRotateFromInterfaceOrientation: (UIInterfaceOrientation)o -{ - _isRotating = NO; - - // We need to set these here, because during the animation we may use a wider - // size (the maximum of the landscape/portrait widths), to avoid clipping during - // the rotation. - canvas.contentSize = CGSizeMake(fz_count_pages(ctx, doc) * width, height); - canvas.contentOffset = CGPointMake(current * width, 0); -} - -@end diff --git a/platform/ios/Classes/MuHitView.h b/platform/ios/Classes/MuHitView.h deleted file mode 100644 index c976c321..00000000 --- a/platform/ios/Classes/MuHitView.h +++ /dev/null @@ -1,15 +0,0 @@ -#import <UIKit/UIKit.h> -#import "MuTapResult.h" - -#undef ABS -#undef MIN -#undef MAX - -#include "mupdf/fitz.h" - -@interface MuHitView : UIView -- (instancetype) initWithSearchResults: (int)n forDocument: (fz_document *)doc; -- (instancetype) initWithLinks: (fz_link*)links forDocument: (fz_document *)doc; -- (void) setPageSize: (CGSize)s; -- (MuTapResult *) handleTap:(CGPoint)pt; -@end diff --git a/platform/ios/Classes/MuHitView.m b/platform/ios/Classes/MuHitView.m deleted file mode 100644 index 91f5f1ab..00000000 --- a/platform/ios/Classes/MuHitView.m +++ /dev/null @@ -1,125 +0,0 @@ -#import "common.h" -#import "MuHitView.h" - -@implementation MuHitView -{ - CGSize pageSize; - int hitCount; - CGRect hitRects[500]; - int linkPage[500]; - char *linkUrl[500]; - UIColor *color; -} - -- (instancetype) initWithSearchResults: (int)n forDocument: (fz_document *)doc -{ - self = [super initWithFrame: CGRectMake(0,0,100,100)]; - if (self) { - [self setOpaque: NO]; - - color = [[UIColor colorWithRed: 0x25/255.0 green: 0x72/255.0 blue: 0xAC/255.0 alpha: 0.5] retain]; - - pageSize = CGSizeMake(100,100); - - for (int i = 0; i < n && i < nelem(hitRects); i++) { - fz_rect bbox = search_result_bbox(doc, i); // this is thread-safe enough - hitRects[i].origin.x = bbox.x0; - hitRects[i].origin.y = bbox.y0; - hitRects[i].size.width = bbox.x1 - bbox.x0; - hitRects[i].size.height = bbox.y1 - bbox.y0; - } - hitCount = n; - } - return self; -} - -- (instancetype) initWithLinks: (fz_link*)link forDocument: (fz_document *)doc -{ - self = [super initWithFrame: CGRectMake(0,0,100,100)]; - if (self) { - [self setOpaque: NO]; - - color = [[UIColor colorWithRed: 0xAC/255.0 green: 0x72/255.0 blue: 0x25/255.0 alpha: 0.5] retain]; - - pageSize = CGSizeMake(100,100); - - while (link && hitCount < nelem(hitRects)) { - if (link->uri) { - fz_rect bbox = link->rect; - hitRects[hitCount].origin.x = bbox.x0; - hitRects[hitCount].origin.y = bbox.y0; - hitRects[hitCount].size.width = bbox.x1 - bbox.x0; - hitRects[hitCount].size.height = bbox.y1 - bbox.y0; - if (fz_is_external_link(ctx, link->uri)) { - linkPage[hitCount] = -1; - linkUrl[hitCount] = strdup(link->uri); - } else { - linkPage[hitCount] = fz_resolve_link(ctx, doc, link->uri, NULL, NULL); - linkUrl[hitCount] = nil; - } - hitCount++; - } - link = link->next; - } - } - return self; -} - -- (void) setPageSize: (CGSize)s -{ - pageSize = s; - // if page takes a long time to load we may have drawn at the initial (wrong) size - [self setNeedsDisplay]; -} - -- (MuTapResult *) handleTap:(CGPoint)pt -{ - CGSize scale = fitPageToScreen(pageSize, self.bounds.size); - pt.x /= scale.width; - pt.y /= scale.height; - - for (int i = 0; i < hitCount; i++) - { - if (CGRectContainsPoint(hitRects[i], pt)) - { - if (linkPage[i] >= 0) - { - return [[[MuTapResultInternalLink alloc] initWithPageNumber:linkPage[i]] autorelease]; - } - if (linkUrl[i]) - { - NSString *url = @(linkUrl[i]); - return [[[MuTapResultExternalLink alloc] initWithUrl:url] autorelease]; - } - } - } - - return nil; -} - -- (void) drawRect: (CGRect)r -{ - CGSize scale = fitPageToScreen(pageSize, self.bounds.size); - - [color set]; - - for (int i = 0; i < hitCount; i++) { - CGRect rect = hitRects[i]; - rect.origin.x *= scale.width; - rect.origin.y *= scale.height; - rect.size.width *= scale.width; - rect.size.height *= scale.height; - UIRectFill(rect); - } -} - -- (void) dealloc -{ - int i; - [color release]; - for (i = 0; i < hitCount; i++) - free(linkUrl[i]); - [super dealloc]; -} - -@end diff --git a/platform/ios/Classes/MuInkView.h b/platform/ios/Classes/MuInkView.h deleted file mode 100644 index 8dd607f3..00000000 --- a/platform/ios/Classes/MuInkView.h +++ /dev/null @@ -1,9 +0,0 @@ -#import <UIKit/UIKit.h> - -@interface MuInkView : UIView - -@property(readonly) NSArray *curves; - -- (instancetype) initWithPageSize:(CGSize)pageSize; - -@end diff --git a/platform/ios/Classes/MuInkView.m b/platform/ios/Classes/MuInkView.m deleted file mode 100644 index 75799941..00000000 --- a/platform/ios/Classes/MuInkView.m +++ /dev/null @@ -1,82 +0,0 @@ -#include "common.h" -#import "MuInkView.h" - -@implementation MuInkView -{ - CGSize pageSize; - NSMutableArray *curves; - UIColor *color; -} - -- (instancetype) initWithPageSize:(CGSize)_pageSize -{ - self = [super initWithFrame:CGRectMake(0, 0, 100, 100)]; - if (self) { - [self setOpaque:NO]; - pageSize = _pageSize; - color = [[UIColor colorWithRed:1.0 green:0.0 blue:0.0 alpha:1.0] retain]; - curves = [[NSMutableArray array] retain]; - UIPanGestureRecognizer *rec = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(onDrag:)]; - [self addGestureRecognizer:rec]; - [rec release]; - } - return self; -} - -@synthesize curves; - --(void)dealloc -{ - [curves release]; - [color release]; - [super dealloc]; -} - --(void) onDrag:(UIPanGestureRecognizer *)rec -{ - CGSize scale = fitPageToScreen(pageSize, self.bounds.size); - CGPoint p = [rec locationInView:self]; - p.x /= scale.width; - p.y /= scale.height; - - if (rec.state == UIGestureRecognizerStateBegan) - [curves addObject:[NSMutableArray array]]; - - NSMutableArray *curve = curves.lastObject; - [curve addObject:[NSValue valueWithCGPoint:p]]; - - [self setNeedsDisplay]; -} - -- (void)drawRect:(CGRect)rect -{ - CGSize scale = fitPageToScreen(pageSize, self.bounds.size); - CGContextRef cref = UIGraphicsGetCurrentContext(); - CGContextScaleCTM(cref, scale.width, scale.height); - - [color set]; - CGContextSetLineWidth(cref, 5.0); - - for (NSArray *curve in curves) - { - if (curve.count >= 2) - { - CGPoint pt = [curve[0] CGPointValue]; - CGContextBeginPath(cref); - CGContextMoveToPoint(cref, pt.x, pt.y); - CGPoint lpt = pt; - - for (int i = 1; i < curve.count; i++) - { - pt = [curve[i] CGPointValue]; - CGContextAddQuadCurveToPoint(cref, lpt.x, lpt.y, (pt.x + lpt.x)/2, (pt.y + lpt.y)/2); - lpt = pt; - } - - CGContextAddLineToPoint(cref, pt.x, pt.y); - CGContextStrokePath(cref); - } - } -} - -@end diff --git a/platform/ios/Classes/MuLibraryController.h b/platform/ios/Classes/MuLibraryController.h deleted file mode 100644 index b56a3d5b..00000000 --- a/platform/ios/Classes/MuLibraryController.h +++ /dev/null @@ -1,17 +0,0 @@ -#import <UIKit/UIKit.h> - -#undef ABS -#undef MIN -#undef MAX - -#include "mupdf/fitz.h" - -#import "MuDocRef.h" - -@interface MuLibraryController : UITableViewController <UIActionSheetDelegate> -- (void) openDocument: (NSString*)filename; -- (void) askForPassword: (NSString*)prompt; -- (void) onPasswordOkay; -- (void) onPasswordCancel; -- (void) reload; -@end diff --git a/platform/ios/Classes/MuLibraryController.m b/platform/ios/Classes/MuLibraryController.m deleted file mode 100644 index 31a78914..00000000 --- a/platform/ios/Classes/MuLibraryController.m +++ /dev/null @@ -1,257 +0,0 @@ -#include "common.h" -#import "MuDocumentController.h" -#import "MuLibraryController.h" - -static void showAlert(NSString *msg, NSString *filename) -{ - UIAlertView *alert = [[UIAlertView alloc] - initWithTitle: msg - message: filename - delegate: nil - cancelButtonTitle: @"Okay" - otherButtonTitles: nil]; - [alert show]; - [alert release]; -} - -@implementation MuLibraryController -{ - NSArray *files; - NSTimer *timer; - MuDocRef *doc; - NSString *_filename; - NSString *_filePath; -} - -- (void) viewWillAppear: (BOOL)animated -{ - [super viewWillAppear:animated]; - self.title = @"PDF, XPS, CBZ and EPUB Documents"; - [self reload]; - timer = [NSTimer timerWithTimeInterval: 3 - target: self selector: @selector(reload) userInfo: nil - repeats: YES]; - [[NSRunLoop currentRunLoop] addTimer: timer forMode: NSDefaultRunLoopMode]; -} - -- (void) viewWillDisappear: (BOOL)animated -{ - [super viewWillDisappear:animated]; - [timer invalidate]; - timer = nil; -} - -- (void) reload -{ - if (files) { - [files release]; - files = nil; - } - - NSFileManager *fileman = [NSFileManager defaultManager]; - NSString *docdir = [NSString stringWithFormat: @"%@/Documents", NSHomeDirectory()]; - NSMutableArray *outfiles = [[NSMutableArray alloc] init]; - NSDirectoryEnumerator *direnum = [fileman enumeratorAtPath:docdir]; - NSString *file; - BOOL isdir; - while (file = [direnum nextObject]) { - NSString *filepath = [docdir stringByAppendingPathComponent:file]; - if ([fileman fileExistsAtPath:filepath isDirectory:&isdir] && !isdir) { - [outfiles addObject:file]; - } - } - - files = outfiles; - - [self.tableView reloadData]; -} - -- (void) dealloc -{ - [doc release]; - [files release]; - [super dealloc]; -} - -- (BOOL) shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)o -{ - return YES; -} - -- (NSInteger) numberOfSectionsInTableView: (UITableView*)tableView -{ - return 1; -} - -- (NSInteger) tableView: (UITableView*)tableView numberOfRowsInSection: (NSInteger)section -{ - return files.count; -} - -- (void) actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex -{ - if (buttonIndex == actionSheet.destructiveButtonIndex) - { - char filename[PATH_MAX]; - NSInteger row = actionSheet.tag; - - dispatch_sync(queue, ^{}); - - strcpy(filename, [NSHomeDirectory() UTF8String]); - strcat(filename, "/Documents/"); - strcat(filename, [files[row] UTF8String]); - - unlink(filename); - - [self reload]; - } -} - -- (void) onTapDelete: (UIControl*)sender -{ - NSInteger row = sender.tag; - NSString *title = [NSString stringWithFormat: @"Delete %@?", files[row]]; - UIActionSheet *sheet = [[UIActionSheet alloc] - initWithTitle: title - delegate: self - cancelButtonTitle: @"Cancel" - destructiveButtonTitle: @"Delete" - otherButtonTitles: nil]; - sheet.tag = row; - [sheet showInView: self.tableView]; - [sheet release]; -} - -- (UITableViewCell*) tableView: (UITableView*)tableView cellForRowAtIndexPath: (NSIndexPath*)indexPath -{ - static NSString *cellid = @"MuCellIdent"; - UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier: cellid]; - if (!cell) - cell = [[[UITableViewCell alloc] initWithStyle: UITableViewCellStyleDefault reuseIdentifier: cellid] autorelease]; - NSInteger row = indexPath.row; - cell.textLabel.text = files[row]; - cell.textLabel.font = [UIFont systemFontOfSize: 20]; - - UIButton *deleteButton = [UIButton buttonWithType:UIButtonTypeCustom]; - [deleteButton setImage: [UIImage imageNamed: @"x_alt_blue.png"] forState: UIControlStateNormal]; - deleteButton.frame = CGRectMake(0, 0, 35, 35); - [deleteButton addTarget: self action: @selector(onTapDelete:) forControlEvents: UIControlEventTouchUpInside]; - deleteButton.tag = row; - cell.accessoryView = deleteButton; - - return cell; -} - -- (void) tableView: (UITableView*)tableView didSelectRowAtIndexPath: (NSIndexPath*)indexPath -{ - NSInteger row = indexPath.row; - [self openDocument: files[row]]; -} - -static NSString *alteredfilename(NSString *name, int i) -{ - if (i == 0) - return name; - - NSString *nam = name.stringByDeletingPathExtension; - NSString *e = name.pathExtension; - return [[[NSString alloc] initWithFormat:@"%@(%d).%@", nam, i, e] autorelease]; -} - -static NSString *moveOutOfInbox(NSString *docpath) -{ - if ([docpath hasPrefix:@"Inbox/"]) - { - NSFileManager *fileMan = [NSFileManager defaultManager]; - NSString *base = [docpath stringByReplacingOccurrencesOfString:@"Inbox/" withString:@""]; - - for (int i = 0; YES; i++) - { - NSString *newname = alteredfilename(base, i); - NSString *newfullpath = [NSString pathWithComponents:@[NSHomeDirectory(), @"Documents", newname]]; - - if (![fileMan fileExistsAtPath:newfullpath]) - { - NSString *fullpath = [NSString pathWithComponents:@[NSHomeDirectory(), @"Documents", docpath]]; - [fileMan copyItemAtPath:fullpath toPath:newfullpath error:nil]; - [fileMan removeItemAtPath:fullpath error:nil]; - return newname; - } - } - } - - return docpath; -} - -- (void) openDocument: (NSString*)nsfilename -{ - nsfilename = moveOutOfInbox(nsfilename); - _filePath = [[@[NSHomeDirectory(), @"Documents", nsfilename] - componentsJoinedByString:@"/"] retain]; - if (_filePath == NULL) { - showAlert(@"Out of memory in openDocument", nsfilename); - return; - } - - dispatch_sync(queue, ^{}); - - _filename = [nsfilename retain]; - [doc release]; - doc = [[MuDocRef alloc] initWithFilename:_filePath]; - if (!doc) { - showAlert(@"Cannot open document", nsfilename); - return; - } - - if (fz_needs_password(ctx, doc->doc)) - [self askForPassword: @"'%@' needs a password:"]; - else - [self onPasswordOkay]; -} - -- (void) askForPassword: (NSString*)prompt -{ - UIAlertView *passwordAlertView = [[UIAlertView alloc] - initWithTitle: @"Password Protected" - message: [NSString stringWithFormat: prompt, _filename.lastPathComponent] - delegate: self - cancelButtonTitle: @"Cancel" - otherButtonTitles: @"Done", nil]; - passwordAlertView.alertViewStyle = UIAlertViewStyleSecureTextInput; - [passwordAlertView show]; - [passwordAlertView release]; -} - -- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex -{ - const char *password = [alertView textFieldAtIndex: 0].text.UTF8String; - [alertView dismissWithClickedButtonIndex: buttonIndex animated: TRUE]; - if (buttonIndex == 1) { - if (fz_authenticate_password(ctx, doc->doc, password)) - [self onPasswordOkay]; - else - [self askForPassword: @"Wrong password for '%@'. Try again:"]; - } else { - [self onPasswordCancel]; - } -} - -- (void) onPasswordOkay -{ - MuDocumentController *document = [[MuDocumentController alloc] initWithFilename: _filename path:_filePath document: doc]; - if (document) { - self.title = @"Library"; - [self.navigationController pushViewController: document animated: YES]; - [document release]; - } - [_filename release]; - [_filePath release]; -} - -- (void) onPasswordCancel -{ - [_filename release]; - [_filePath release]; -} - -@end diff --git a/platform/ios/Classes/MuOutlineController.h b/platform/ios/Classes/MuOutlineController.h deleted file mode 100644 index 4065645e..00000000 --- a/platform/ios/Classes/MuOutlineController.h +++ /dev/null @@ -1,7 +0,0 @@ -#import <UIKit/UIKit.h> - -@class MuDocumentController; - -@interface MuOutlineController : UITableViewController -- (instancetype) initWithTarget: (id)aTarget titles: (NSMutableArray*)aTitles pages: (NSMutableArray*)aPages; -@end diff --git a/platform/ios/Classes/MuOutlineController.m b/platform/ios/Classes/MuOutlineController.m deleted file mode 100644 index 26bda59a..00000000 --- a/platform/ios/Classes/MuOutlineController.m +++ /dev/null @@ -1,75 +0,0 @@ -#import "MuDocumentController.h" -#import "MuOutlineController.h" - -@implementation MuOutlineController -{ - MuDocumentController *target; - NSMutableArray *titles; - NSMutableArray *pages; -} - -- (instancetype) initWithTarget: (id)aTarget titles: (NSMutableArray*)aTitles pages: (NSMutableArray*)aPages -{ - self = [super initWithStyle: UITableViewStylePlain]; - if (self) { - self.title = @"Table of Contents"; - target = aTarget; // only keep a weak reference, to avoid retain cycles - titles = [aTitles retain]; - pages = [aPages retain]; - self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; - } - return self; -} - -- (void) dealloc -{ - [titles release]; - [pages release]; - [super dealloc]; -} - -- (BOOL) shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)o -{ - return YES; -} - -- (NSInteger) numberOfSectionsInTableView: (UITableView*)tableView -{ - return 1; -} - -- (NSInteger) tableView: (UITableView*)tableView numberOfRowsInSection: (NSInteger)section -{ - return titles.count; -} - -- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath -{ - return 28; -} - -- (UITableViewCell*) tableView: (UITableView*)tableView cellForRowAtIndexPath: (NSIndexPath*)indexPath -{ - static NSString *cellid = @"MuCellIdent"; - UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier: cellid]; - if (!cell) - { - cell = [[[UITableViewCell alloc] initWithStyle: UITableViewCellStyleValue1 reuseIdentifier: cellid] autorelease]; - cell.textLabel.font = [UIFont systemFontOfSize: 16]; - cell.detailTextLabel.font = [UIFont systemFontOfSize: 16]; - } - NSString *title = titles[indexPath.row]; - NSString *page = pages[indexPath.row]; - cell.textLabel.text = title; - cell.detailTextLabel.text = [NSString stringWithFormat: @"%d", page.intValue+1]; - return cell; -} - -- (void) tableView: (UITableView*)tableView didSelectRowAtIndexPath: (NSIndexPath*)indexPath -{ - NSNumber *page = pages[indexPath.row]; - [target gotoPage: page.intValue animated: NO]; - [self.navigationController popViewControllerAnimated: YES]; -} - -@end diff --git a/platform/ios/Classes/MuPageView.h b/platform/ios/Classes/MuPageView.h deleted file mode 100644 index f3b8c0d9..00000000 --- a/platform/ios/Classes/MuPageView.h +++ /dev/null @@ -1,23 +0,0 @@ -#import <UIKit/UIKit.h> -#import "MuTapResult.h" - -@protocol MuPageView -@property (NS_NONATOMIC_IOSONLY, readonly) int number; --(void) willRotate; --(void) showLinks; --(void) hideLinks; --(void) showSearchResults: (int)count; --(void) clearSearchResults; --(void) resetZoomAnimated: (BOOL)animated; --(void) setScale:(float)scale; --(MuTapResult *) handleTap:(CGPoint)pt; --(void) textSelectModeOn; --(void) textSelectModeOff; --(void) deselectAnnotation; --(void) deleteSelectedAnnotation; --(void) inkModeOn; --(void) inkModeOff; --(void) saveSelectionAsMarkup:(int)type; --(void) saveInk; --(void) update; -@end diff --git a/platform/ios/Classes/MuPageViewNormal.h b/platform/ios/Classes/MuPageViewNormal.h deleted file mode 100644 index 25b0c3ca..00000000 --- a/platform/ios/Classes/MuPageViewNormal.h +++ /dev/null @@ -1,24 +0,0 @@ -#import <UIKit/UIKit.h> - -#undef ABS -#undef MIN -#undef MAX - -#include "mupdf/fitz.h" - -#import "MuHitView.h" -#import "MuPageView.h" -#import "MuDocRef.h" -#import "MuDialogCreator.h" -#import "MuTextSelectView.h" -#import "MuInkView.h" -#import "MuAnnotSelectView.h" -#import "MuUpdater.h" - -@interface MuPageViewNormal : UIScrollView <UIScrollViewDelegate,MuPageView> -- (instancetype) initWithFrame: (CGRect)frame dialogCreator:(id<MuDialogCreator>)dia updater:(id<MuUpdater>)upd document: (MuDocRef *)aDoc page: (int)aNumber; -- (void) displayImage: (UIImage*)image; -- (void) resizeImage; -- (void) loadPage; -- (void) loadTile; -@end diff --git a/platform/ios/Classes/MuPageViewNormal.m b/platform/ios/Classes/MuPageViewNormal.m deleted file mode 100644 index 4f8a9202..00000000 --- a/platform/ios/Classes/MuPageViewNormal.m +++ /dev/null @@ -1,1401 +0,0 @@ -#include "common.h" -#include "mupdf/pdf.h" -#import "MuWord.h" -#import "MuTextFieldController.h" -#import "MuAnnotation.h" - -#import "MuPageViewNormal.h" - -#define STRIKE_HEIGHT (0.375f) -#define UNDERLINE_HEIGHT (0.075f) -#define LINE_THICKNESS (0.07f) -#define INK_THICKNESS (4.0f) - -static UIImage *newImageWithPixmap(fz_pixmap *pix, CGDataProviderRef cgdata) -{ - CGImageRef cgimage = CreateCGImageWithPixmap(pix, cgdata); - UIImage *image = [[UIImage alloc] initWithCGImage: cgimage scale: screenScale orientation: UIImageOrientationUp]; - CGImageRelease(cgimage); - return image; -} - -static NSArray *enumerateWidgetRects(fz_document *doc, fz_page *page) -{ - pdf_document *idoc = pdf_specifics(ctx, doc); - pdf_widget *widget; - NSMutableArray *arr = [NSMutableArray arrayWithCapacity:10]; - - if (!idoc) - return nil; - - for (widget = pdf_first_widget(ctx, idoc, (pdf_page *)page); widget; widget = pdf_next_widget(ctx, widget)) - { - fz_rect rect; - - pdf_bound_widget(ctx, widget, &rect); - [arr addObject:[NSValue valueWithCGRect:CGRectMake( - rect.x0, - rect.y0, - rect.x1-rect.x0, - rect.y1-rect.y0)]]; - } - - return [arr retain]; -} - -static NSArray *enumerateAnnotations(fz_document *doc, fz_page *page) -{ - fz_annot *annot; - NSMutableArray *arr = [NSMutableArray arrayWithCapacity:10]; - - for (annot = fz_first_annot(ctx, page); annot; annot = fz_next_annot(ctx, annot)) - [arr addObject:[MuAnnotation annotFromAnnot:annot]]; - - return [arr retain]; -} - -static NSArray *enumerateWords(fz_document *doc, fz_page *page) -{ - fz_stext_sheet *sheet = NULL; - fz_stext_page *text = NULL; - fz_device *dev = NULL; - NSMutableArray *lns = [NSMutableArray array]; - NSMutableArray *wds; - MuWord *word; - - if (!lns) - return NULL; - - fz_var(sheet); - fz_var(text); - fz_var(dev); - - fz_try(ctx) - { - fz_rect mediabox; - int b, l, c; - - sheet = fz_new_stext_sheet(ctx); - text = fz_new_stext_page(ctx, fz_bound_page(ctx, page, &mediabox)); - dev = fz_new_stext_device(ctx, sheet, text, NULL); - fz_run_page(ctx, page, dev, &fz_identity, NULL); - fz_close_device(ctx, dev); - fz_drop_device(ctx, dev); - dev = NULL; - - for (b = 0; b < text->len; b++) - { - fz_stext_block *block; - - if (text->blocks[b].type != FZ_PAGE_BLOCK_TEXT) - continue; - - block = text->blocks[b].u.text; - - for (l = 0; l < block->len; l++) - { - fz_stext_line *line = &block->lines[l]; - fz_stext_span *span; - - wds = [NSMutableArray array]; - if (!wds) - fz_throw(ctx, FZ_ERROR_GENERIC, "Failed to create word array"); - - word = [MuWord word]; - if (!word) - fz_throw(ctx, FZ_ERROR_GENERIC, "Failed to create word"); - - for (span = line->first_span; span; span = span->next) - { - for (c = 0; c < span->len; c++) - { - fz_stext_char *ch = &span->text[c]; - fz_rect bbox; - CGRect rect; - - fz_stext_char_bbox(ctx, &bbox, span, c); - rect = CGRectMake(bbox.x0, bbox.y0, bbox.x1 - bbox.x0, bbox.y1 - bbox.y0); - - if (ch->c != ' ') - { - [word appendChar:ch->c withRect:rect]; - } - else if (word.string.length > 0) - { - [wds addObject:word]; - word = [MuWord word]; - if (!word) - fz_throw(ctx, FZ_ERROR_GENERIC, "Failed to create word"); - } - } - } - - if (word.string.length > 0) - [wds addObject:word]; - - if (wds.count > 0) - [lns addObject:wds]; - } - } - fz_close_device(ctx, dev); - } - fz_always(ctx) - { - fz_drop_stext_page(ctx, text); - fz_drop_stext_sheet(ctx, sheet); - fz_drop_device(ctx, dev); - } - fz_catch(ctx) - { - lns = NULL; - } - - return [lns retain]; -} - -static void addMarkupAnnot(fz_document *doc, fz_page *page, int type, NSArray *rects) -{ - pdf_document *idoc; - float *quadpts = NULL; - float color[3]; - float alpha; - float line_height; - float line_thickness; - - idoc = pdf_specifics(ctx, doc); - if (!idoc) - return; - - switch (type) - { - case PDF_ANNOT_HIGHLIGHT: - color[0] = 1.0; - color[1] = 1.0; - color[2] = 0.0; - alpha = 0.5; - line_thickness = 1.0; - line_height = 0.5; - break; - case PDF_ANNOT_UNDERLINE: - color[0] = 0.0; - color[1] = 0.0; - color[2] = 1.0; - alpha = 1.0; - line_thickness = LINE_THICKNESS; - line_height = UNDERLINE_HEIGHT; - break; - case PDF_ANNOT_STRIKE_OUT: - color[0] = 1.0; - color[1] = 0.0; - color[2] = 0.0; - alpha = 1.0; - line_thickness = LINE_THICKNESS; - line_height = STRIKE_HEIGHT; - break; - - default: - return; - } - - fz_var(quadpts); - fz_try(ctx) - { - int i; - pdf_annot *annot; - - quadpts = fz_malloc_array(ctx, (int)rects.count * 8, sizeof(float)); - for (i = 0; i < rects.count; i++) - { - CGRect rect = [rects[i] CGRectValue]; - float top = rect.origin.y; - float bot = top + rect.size.height; - float left = rect.origin.x; - float right = left + rect.size.width; - quadpts[i*8+0] = left; - quadpts[i*8+1] = bot; - quadpts[i*8+2] = right; - quadpts[i*8+3] = bot; - quadpts[i*8+4] = right; - quadpts[i*8+5] = top; - quadpts[i*8+6] = left; - quadpts[i*8+7] = top; - } - - annot = pdf_create_annot(ctx, (pdf_page *)page, type); - pdf_set_annot_quad_points(ctx, annot, rects.count, quadpts); - pdf_set_markup_appearance(ctx, idoc, annot, color, alpha, line_thickness, line_height); - } - fz_always(ctx) - { - fz_free(ctx, quadpts); - } - fz_catch(ctx) - { - printf("Annotation creation failed\n"); - } -} - -static void addInkAnnot(fz_document *doc, fz_page *page, NSArray *curves) -{ - pdf_document *idoc; - float *pts = NULL; - int *counts = NULL; - int total; - float color[4] = {1.0, 0.0, 0.0, 0.0}; - - idoc = pdf_specifics(ctx, doc); - if (!idoc) - return; - - fz_var(pts); - fz_var(counts); - fz_try(ctx) - { - int i, j, k, n; - pdf_annot *annot; - - n = (int)curves.count; - - counts = fz_malloc_array(ctx, n, sizeof(int)); - total = 0; - - for (i = 0; i < n; i++) - { - NSArray *curve = curves[i]; - counts[i] = (int)curve.count; - total += (int)curve.count; - } - - pts = fz_malloc_array(ctx, total * 2, sizeof(float)); - - k = 0; - for (i = 0; i < n; i++) - { - NSArray *curve = curves[i]; - int count = counts[i]; - - for (j = 0; j < count; j++) - { - CGPoint pt = [curve[j] CGPointValue]; - pts[k++] = pt.x; - pts[k++] = pt.y; - } - } - - annot = pdf_create_annot(ctx, (pdf_page *)page, PDF_ANNOT_INK); - - pdf_set_annot_border(ctx, annot, INK_THICKNESS); - pdf_set_annot_color(ctx, annot, 3, color); - pdf_set_annot_ink_list(ctx, annot, n, counts, pts); - } - fz_always(ctx) - { - fz_free(ctx, pts); - fz_free(ctx, counts); - } - fz_catch(ctx) - { - printf("Annotation creation failed\n"); - } -} - -static void deleteAnnotation(fz_document *doc, fz_page *page, int index) -{ - pdf_document *idoc = pdf_specifics(ctx, doc); - if (!idoc) - return; - - fz_try(ctx) - { - int i; - fz_annot *annot = fz_first_annot(ctx, page); - for (i = 0; i < index && annot; i++) - annot = fz_next_annot(ctx, annot); - - if (annot) - pdf_delete_annot(ctx, (pdf_page *)page, (pdf_annot *)annot); - } - fz_catch(ctx) - { - printf("Annotation deletion failed\n"); - } -} - -static int setFocussedWidgetText(fz_document *doc, fz_page *page, const char *text) -{ - int accepted = 0; - - fz_var(accepted); - - fz_try(ctx) - { - pdf_document *idoc = pdf_specifics(ctx, doc); - if (idoc) - { - pdf_widget *focus = pdf_focused_widget(ctx, idoc); - if (focus) - { - accepted = pdf_text_widget_set_text(ctx, idoc, focus, (char *)text); - } - } - } - fz_catch(ctx) - { - accepted = 0; - } - - return accepted; -} - -static int setFocussedWidgetChoice(fz_document *doc, fz_page *page, const char *text) -{ - int accepted = 0; - - fz_var(accepted); - - fz_try(ctx) - { - pdf_document *idoc = pdf_specifics(ctx, doc); - if (idoc) - { - pdf_widget *focus = pdf_focused_widget(ctx, idoc); - if (focus) - { - pdf_choice_widget_set_value(ctx, idoc, focus, 1, (char **)&text); - accepted = 1; - } - } - } - fz_catch(ctx) - { - accepted = 0; - } - - return accepted; -} - -static fz_display_list *create_page_list(fz_document *doc, fz_page *page) -{ - fz_display_list *list = NULL; - fz_device *dev = NULL; - - fz_var(dev); - fz_try(ctx) - { - list = fz_new_display_list(ctx, NULL); - dev = fz_new_list_device(ctx, list); - fz_run_page_contents(ctx, page, dev, &fz_identity, NULL); - fz_close_device(ctx, dev); - } - fz_always(ctx) - { - fz_drop_device(ctx, dev); - } - fz_catch(ctx) - { - return NULL; - } - - return list; -} - -static fz_display_list *create_annot_list(fz_document *doc, fz_page *page) -{ - fz_display_list *list = NULL; - fz_device *dev = NULL; - - fz_var(dev); - fz_try(ctx) - { - fz_annot *annot; - pdf_document *idoc = pdf_specifics(ctx, doc); - - if (idoc) - pdf_update_page(ctx, (pdf_page *)page); - list = fz_new_display_list(ctx, NULL); - dev = fz_new_list_device(ctx, list); - for (annot = fz_first_annot(ctx, page); annot; annot = fz_next_annot(ctx, annot)) - fz_run_annot(ctx, annot, dev, &fz_identity, NULL); - fz_close_device(ctx, dev); - } - fz_always(ctx) - { - fz_drop_device(ctx, dev); - } - fz_catch(ctx) - { - return NULL; - } - - return list; -} - -static fz_pixmap *renderPixmap(fz_document *doc, fz_display_list *page_list, fz_display_list *annot_list, CGSize pageSize, CGSize screenSize, CGRect tileRect, float zoom) -{ - fz_irect bbox; - fz_rect rect; - fz_matrix ctm; - fz_device *dev = NULL; - fz_pixmap *pix = NULL; - CGSize scale; - - screenSize.width *= screenScale; - screenSize.height *= screenScale; - tileRect.origin.x *= screenScale; - tileRect.origin.y *= screenScale; - tileRect.size.width *= screenScale; - tileRect.size.height *= screenScale; - - scale = fitPageToScreen(pageSize, screenSize); - fz_scale(&ctm, scale.width * zoom, scale.height * zoom); - - bbox.x0 = tileRect.origin.x; - bbox.y0 = tileRect.origin.y; - bbox.x1 = tileRect.origin.x + tileRect.size.width; - bbox.y1 = tileRect.origin.y + tileRect.size.height; - fz_rect_from_irect(&rect, &bbox); - - fz_var(dev); - fz_var(pix); - fz_try(ctx) - { - pix = fz_new_pixmap_with_bbox(ctx, fz_device_rgb(ctx), &bbox, 1); - fz_clear_pixmap_with_value(ctx, pix, 255); - - dev = fz_new_draw_device(ctx, NULL, pix); - fz_run_display_list(ctx, page_list, dev, &ctm, &rect, NULL); - fz_run_display_list(ctx, annot_list, dev, &ctm, &rect, NULL); - - fz_close_device(ctx, dev); - } - fz_always(ctx) - { - fz_drop_device(ctx, dev); - } - fz_catch(ctx) - { - fz_drop_pixmap(ctx, pix); - return NULL; - } - - return pix; -} - -typedef struct rect_list_s rect_list; - -struct rect_list_s -{ - fz_rect rect; - rect_list *next; -}; - -static void drop_list(rect_list *list) -{ - while (list) - { - rect_list *n = list->next; - fz_free(ctx, list); - list = n; - } -} - -static rect_list *updatePage(fz_document *doc, fz_page *page) -{ - rect_list *list = NULL; - - fz_var(list); - fz_try(ctx) - { - pdf_document *idoc = pdf_specifics(ctx, doc); - if (idoc) - { - pdf_page *ppage = (pdf_page*)page; - pdf_annot *pannot; - - pdf_update_page(ctx, (pdf_page *)page); - for (pannot = pdf_first_annot(ctx, ppage); pannot; pannot = pdf_next_annot(ctx, pannot)) - { - if (pannot->changed) - { - rect_list *node = fz_malloc_struct(ctx, rect_list); - fz_bound_annot(ctx, (fz_annot*)pannot, &node->rect); - node->next = list; - list = node; - } - } - } - } - fz_catch(ctx) - { - drop_list(list); - list = NULL; - } - - return list; -} - -static void updatePixmap(fz_document *doc, fz_display_list *page_list, fz_display_list *annot_list, fz_pixmap *pixmap, rect_list *rlist, CGSize pageSize, CGSize screenSize, CGRect tileRect, float zoom) -{ - fz_irect bbox; - fz_rect rect; - fz_matrix ctm; - fz_device *dev = NULL; - CGSize scale; - - screenSize.width *= screenScale; - screenSize.height *= screenScale; - tileRect.origin.x *= screenScale; - tileRect.origin.y *= screenScale; - tileRect.size.width *= screenScale; - tileRect.size.height *= screenScale; - - scale = fitPageToScreen(pageSize, screenSize); - fz_scale(&ctm, scale.width * zoom, scale.height * zoom); - - bbox.x0 = tileRect.origin.x; - bbox.y0 = tileRect.origin.y; - bbox.x1 = tileRect.origin.x + tileRect.size.width; - bbox.y1 = tileRect.origin.y + tileRect.size.height; - fz_rect_from_irect(&rect, &bbox); - - fz_var(dev); - fz_try(ctx) - { - while (rlist) - { - fz_irect abox; - fz_rect arect = rlist->rect; - fz_transform_rect(&arect, &ctm); - fz_intersect_rect(&arect, &rect); - fz_round_rect(&abox, &arect); - if (!fz_is_empty_irect(&abox)) - { - fz_clear_pixmap_rect_with_value(ctx, pixmap, 255, &abox); - dev = fz_new_draw_device_with_bbox(ctx, NULL, pixmap, &abox); - fz_run_display_list(ctx, page_list, dev, &ctm, &arect, NULL); - fz_run_display_list(ctx, annot_list, dev, &ctm, &arect, NULL); - - fz_close_device(ctx, dev); - fz_drop_device(ctx, dev); - dev = NULL; - } - rlist = rlist->next; - } - } - fz_always(ctx) - { - fz_drop_device(ctx, dev); - } - fz_catch(ctx) - { - } -} - -@implementation MuPageViewNormal -{ - MuDocRef *docRef; - fz_document *doc; - fz_page *page; - fz_display_list *page_list; - fz_display_list *annot_list; - int number; - UIActivityIndicatorView *loadingView; - fz_pixmap *image_pix; - CGDataProviderRef imageData; - UIImageView *imageView; - fz_pixmap *tile_pix; - CGDataProviderRef tileData; - UIImageView *tileView; - MuHitView *hitView; - MuHitView *linkView; - MuTextSelectView *textSelectView; - MuInkView *inkView; - MuAnnotSelectView *annotSelectView; - NSArray *widgetRects; - NSArray *annotations; - int selectedAnnotationIndex; - CGSize pageSize; - CGRect tileFrame; - float tileScale; - BOOL cancel; - id<MuDialogCreator> dialogCreator; - id<MuUpdater> updater; -} - -- (void) ensurePageLoaded -{ - if (page) - return; - - fz_try(ctx) - { - fz_rect bounds; - page = fz_load_page(ctx, doc, number); - fz_bound_page(ctx, page, &bounds); - pageSize.width = bounds.x1 - bounds.x0; - pageSize.height = bounds.y1 - bounds.y0; - } - fz_catch(ctx) - { - return; - } -} - -- (void) ensureDisplaylists -{ - [self ensurePageLoaded]; - if (!page) - return; - - if (!page_list) - page_list = create_page_list(doc, page); - - if (!annot_list) - annot_list = create_annot_list(doc, page); -} - --(instancetype) initWithFrame:(CGRect)frame dialogCreator:(id<MuDialogCreator>)dia updater:(id<MuUpdater>)upd document:(MuDocRef *)aDoc page:(int)aNumber -{ - self = [super initWithFrame: frame]; - if (self) { - docRef = [aDoc retain]; - doc = docRef->doc; - number = aNumber; - cancel = NO; - dialogCreator = dia; - updater = upd; - selectedAnnotationIndex = -1; - - [self setShowsVerticalScrollIndicator: NO]; - [self setShowsHorizontalScrollIndicator: NO]; - self.decelerationRate = UIScrollViewDecelerationRateFast; - self.delegate = self; - - // zoomDidFinish/Begin events fire before bounce animation completes, - // making a mess when we rearrange views during the animation. - [self setBouncesZoom: NO]; - - [self resetZoomAnimated: NO]; - - // TODO: use a one shot timer to delay the display of this? - loadingView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge]; - [loadingView startAnimating]; - [self addSubview: loadingView]; - - [self loadPage]; - } - return self; -} - -- (void) dealloc -{ - // dealloc can trigger in background thread when the queued block is - // our last owner, and releases us on completion. - // Send the dealloc back to the main thread so we don't mess up UIKit. - if (![NSThread isMainThread]) { - __block id block_self = self; // don't auto-retain self! - dispatch_async(dispatch_get_main_queue(), ^{ [block_self dealloc]; }); - } else { - __block fz_display_list *block_page_list = page_list; - __block fz_display_list *block_annot_list = annot_list; - __block fz_page *block_page = page; -// __block fz_document *block_doc = docRef->doc; - __block CGDataProviderRef block_tileData = tileData; - __block CGDataProviderRef block_imageData = imageData; - dispatch_async(queue, ^{ - fz_drop_display_list(ctx, block_page_list); - fz_drop_display_list(ctx, block_annot_list); - fz_drop_page(ctx, block_page); - block_page = nil; - CGDataProviderRelease(block_tileData); - CGDataProviderRelease(block_imageData); - }); - [docRef release]; - [widgetRects release]; - [linkView release]; - [hitView release]; - [textSelectView release]; - [inkView release]; - [annotSelectView release]; - [tileView release]; - [loadingView release]; - [imageView release]; - [super dealloc]; - } -} - -- (int) number -{ - return number; -} - -- (void) showLinks -{ - if (!linkView) { - dispatch_async(queue, ^{ - [self ensurePageLoaded]; - fz_link *links = fz_load_links(ctx, page); - dispatch_async(dispatch_get_main_queue(), ^{ - linkView = [[MuHitView alloc] initWithLinks: links forDocument: doc]; - dispatch_async(queue, ^{ - fz_drop_link(ctx, links); - }); - if (imageView) { - linkView.frame = imageView.frame; - [linkView setPageSize: pageSize]; - } - [self addSubview: linkView]; - }); - }); - } -} - -- (void) hideLinks -{ - [linkView removeFromSuperview]; - [linkView release]; - linkView = nil; -} - -- (void) showSearchResults: (int)count -{ - if (hitView) { - [hitView removeFromSuperview]; - [hitView release]; - hitView = nil; - } - hitView = [[MuHitView alloc] initWithSearchResults: count forDocument: doc]; - if (imageView) { - hitView.frame = imageView.frame; - [hitView setPageSize: pageSize]; - } - [self addSubview: hitView]; -} - -- (void) clearSearchResults -{ - if (hitView) { - [hitView removeFromSuperview]; - [hitView release]; - hitView = nil; - } -} - -- (void) textSelectModeOn -{ - dispatch_async(queue, ^{ - [self ensurePageLoaded]; - NSArray *words = enumerateWords(doc, page); - dispatch_sync(dispatch_get_main_queue(), ^{ - textSelectView = [[MuTextSelectView alloc] initWithWords:words pageSize:pageSize]; - [words release]; - if (imageView) - textSelectView.frame = imageView.frame; - [self addSubview:textSelectView]; - }); - }); -} - -- (void) inkModeOn -{ - inkView = [[MuInkView alloc] initWithPageSize:pageSize]; - if (imageView) - inkView.frame = imageView.frame; - [self addSubview:inkView]; -} - -- (void) textSelectModeOff -{ - [textSelectView removeFromSuperview]; - [textSelectView release]; - textSelectView = nil; -} - -- (void) inkModeOff -{ - [inkView removeFromSuperview]; - [inkView release]; - inkView = nil; -} - --(void) saveSelectionAsMarkup:(int)type -{ - NSArray *rects = textSelectView.selectionRects; - if (rects.count == 0) - return; - - [rects retain]; - - dispatch_async(queue, ^{ - addMarkupAnnot(doc, page, type, rects); - [rects release]; - dispatch_async(dispatch_get_main_queue(), ^{ - [self update]; - }); - [self loadAnnotations]; - }); - [self textSelectModeOff]; -} - --(void) saveInk -{ - NSArray *curves = inkView.curves; - if (curves.count == 0) - return; - - [curves retain]; - - dispatch_async(queue, ^{ - addInkAnnot(doc, page, curves); - [curves release]; - dispatch_async(dispatch_get_main_queue(), ^{ - [self update]; - }); - [self loadAnnotations]; - }); - [self inkModeOff]; -} - --(void) selectAnnotation:(int)i -{ - selectedAnnotationIndex = i; - [annotSelectView removeFromSuperview]; - [annotSelectView release]; - annotSelectView = [[MuAnnotSelectView alloc] initWithAnnot:annotations[i] pageSize:pageSize]; - [self addSubview:annotSelectView]; -} - --(void) deselectAnnotation -{ - selectedAnnotationIndex = -1; - [annotSelectView removeFromSuperview]; - [annotSelectView release]; - annotSelectView = nil; -} - --(void) deleteSelectedAnnotation -{ - int index = selectedAnnotationIndex; - if (index >= 0) - { - dispatch_async(queue, ^{ - deleteAnnotation(doc, page, index); - dispatch_async(dispatch_get_main_queue(), ^{ - [self update]; - }); - [self loadAnnotations]; - }); - } - [self deselectAnnotation]; -} - -- (void) resetZoomAnimated: (BOOL)animated -{ - // discard tile and any pending tile jobs - tileFrame = CGRectZero; - tileScale = 1; - if (tileView) { - [tileView removeFromSuperview]; - [tileView release]; - tileView = nil; - } - - self.minimumZoomScale = 1; - self.maximumZoomScale = 5; - [self setZoomScale: 1 animated: animated]; -} - -- (void) removeFromSuperview -{ - cancel = YES; - [super removeFromSuperview]; -} - -- (void) loadAnnotations -{ - if (number < 0 || number >= fz_count_pages(ctx, doc)) - return; - - NSArray *annots = enumerateAnnotations(doc, page); - dispatch_async(dispatch_get_main_queue(), ^{ - [annotations release]; - annotations = annots; - }); -} - -- (void) loadPage -{ - if (number < 0 || number >= fz_count_pages(ctx, doc)) - return; - dispatch_async(queue, ^{ - if (!cancel) { - [self renderPage]; - } else { - printf("cancel page %d\n", number); - } - }); -} - -- (void) renderPage -{ - printf("render page %d\n", number); - [self ensureDisplaylists]; - CGSize scale = fitPageToScreen(pageSize, self.bounds.size); - CGRect rect = (CGRect){{0.0, 0.0},{pageSize.width * scale.width, pageSize.height * scale.height}}; - image_pix = renderPixmap(doc, page_list, annot_list, pageSize, self.bounds.size, rect, 1.0); - CGDataProviderRelease(imageData); - imageData = CreateWrappedPixmap(image_pix); - UIImage *image = newImageWithPixmap(image_pix, imageData); - widgetRects = enumerateWidgetRects(doc, page); - [self loadAnnotations]; - dispatch_async(dispatch_get_main_queue(), ^{ - [self displayImage: image]; - [image release]; - [imageView setNeedsDisplay]; - }); -} - -- (void) displayImage: (UIImage*)image -{ - if (loadingView) { - [loadingView removeFromSuperview]; - [loadingView release]; - loadingView = nil; - } - - if (hitView) - [hitView setPageSize: pageSize]; - - if (!imageView) { - imageView = [[UIImageView alloc] initWithImage: image]; - imageView.opaque = YES; - [self addSubview: imageView]; - if (hitView) - [self bringSubviewToFront: hitView]; - if (textSelectView) - [self bringSubviewToFront:textSelectView]; - if (inkView) - [self bringSubviewToFront:inkView]; - if (annotSelectView) - [self bringSubviewToFront:annotSelectView]; - } else { - imageView.image = image; - } - - [self resizeImage]; -} - -- (void) resizeImage -{ - if (imageView) { - CGSize imageSize = imageView.image.size; - CGSize scale = fitPageToScreen(imageSize, self.bounds.size); - if (fabs(scale.width - 1) > 0.1) { - CGRect frame = imageView.frame; - frame.size.width = imageSize.width * scale.width; - frame.size.height = imageSize.height * scale.height; - imageView.frame = frame; - - printf("resized view; queuing up a reload (%d)\n", number); - dispatch_async(queue, ^{ - dispatch_async(dispatch_get_main_queue(), ^{ - CGSize scale = fitPageToScreen(imageView.image.size, self.bounds.size); - if (fabs(scale.width - 1) > 0.01) - [self loadPage]; - }); - }); - } else { - [imageView sizeToFit]; - } - - self.contentSize = imageView.frame.size; - - [self layoutIfNeeded]; - } -} - -- (void) willRotate -{ - if (imageView) { - [self resetZoomAnimated: NO]; - [self resizeImage]; - } -} - -- (void) layoutSubviews -{ - [super layoutSubviews]; - - // center the image as it becomes smaller than the size of the screen - - CGSize boundsSize = self.bounds.size; - CGRect frameToCenter = loadingView ? loadingView.frame : imageView.frame; - - // center horizontally - if (frameToCenter.size.width < boundsSize.width) - frameToCenter.origin.x = floor((boundsSize.width - frameToCenter.size.width) / 2); - else - frameToCenter.origin.x = 0; - - // center vertically - if (frameToCenter.size.height < boundsSize.height) - frameToCenter.origin.y = floor((boundsSize.height - frameToCenter.size.height) / 2); - else - frameToCenter.origin.y = 0; - - if (loadingView) - loadingView.frame = frameToCenter; - else - imageView.frame = frameToCenter; - - if (imageView) - { - CGRect frm = imageView.frame; - - if (hitView) - hitView.frame = frm; - - if (linkView) - linkView.frame = frm; - - if (textSelectView) - textSelectView.frame = frm; - - if (inkView) - inkView.frame = frm; - - if (annotSelectView) - annotSelectView.frame = frm; - } -} - -- (UIView*) viewForZoomingInScrollView: (UIScrollView*)scrollView -{ - return imageView; -} - -- (void) loadTile -{ - CGSize screenSize = self.bounds.size; - - tileFrame.origin = self.contentOffset; - tileFrame.size = self.bounds.size; - tileFrame = CGRectIntersection(tileFrame, imageView.frame); - tileScale = self.zoomScale; - - CGRect frame = tileFrame; - float scale = tileScale; - - CGRect viewFrame = frame; - // Adjust viewFrame to be relative to imageView's origin - viewFrame.origin.x -= imageView.frame.origin.x; - viewFrame.origin.y -= imageView.frame.origin.y; - - if (scale < 1.01) - return; - - dispatch_async(queue, ^{ - __block BOOL isValid; - dispatch_sync(dispatch_get_main_queue(), ^{ - isValid = CGRectEqualToRect(frame, tileFrame) && scale == tileScale; - }); - if (!isValid) { - printf("cancel tile\n"); - return; - } - - [self ensureDisplaylists]; - - printf("render tile\n"); - tile_pix = renderPixmap(doc, page_list, annot_list, pageSize, screenSize, viewFrame, scale); - CGDataProviderRelease(tileData); - tileData = CreateWrappedPixmap(tile_pix); - UIImage *image = newImageWithPixmap(tile_pix, tileData); - - dispatch_async(dispatch_get_main_queue(), ^{ - isValid = CGRectEqualToRect(frame, tileFrame) && scale == tileScale; - if (isValid) { - if (tileView) { - [tileView removeFromSuperview]; - [tileView release]; - tileView = nil; - } - - tileView = [[UIImageView alloc] initWithFrame: frame]; - tileView.image = image; - [self addSubview: tileView]; - if (hitView) - [self bringSubviewToFront: hitView]; - if (linkView) - [self bringSubviewToFront:linkView]; - if (textSelectView) - [self bringSubviewToFront:textSelectView]; - if (inkView) - [self bringSubviewToFront:inkView]; - if (annotSelectView) - [self bringSubviewToFront:annotSelectView]; - } else { - printf("discard tile\n"); - } - [image release]; - }); - }); -} - -- (void) scrollViewDidScrollToTop:(UIScrollView *)scrollView { [self loadTile]; } -- (void) scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView { [self loadTile]; } -- (void) scrollViewDidEndDecelerating:(UIScrollView *)scrollView { [self loadTile]; } -- (void) scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate -{ - if (!decelerate) - [self loadTile]; -} - -- (void) scrollViewWillBeginZooming: (UIScrollView*)scrollView withView: (UIView*)view -{ - // discard tile and any pending tile jobs - tileFrame = CGRectZero; - tileScale = 1; - if (tileView) { - [tileView removeFromSuperview]; - [tileView release]; - tileView = nil; - } -} - -- (void) scrollViewDidEndZooming: (UIScrollView*)scrollView withView: (UIView*)view atScale: (CGFloat)scale -{ - [self loadTile]; -} - -- (void) scrollViewDidZoom: (UIScrollView*)scrollView -{ - if (imageView) - { - CGRect frm = imageView.frame; - - if (hitView) - hitView.frame = frm; - - if (textSelectView) - textSelectView.frame = frm; - - if (inkView) - inkView.frame = frm; - - if (annotSelectView) - annotSelectView.frame = frm; - } -} - -- (void) setScale:(float)scale {} - -- (void) updatePageAndTileWithTileFrame:(CGRect)tframe tileScale:(float)tscale viewFrame:(CGRect)vframe -{ - rect_list *rlist = updatePage(doc, page); - fz_drop_display_list(ctx, annot_list); - annot_list = create_annot_list(doc, page); - if (tile_pix) - { - updatePixmap(doc, page_list, annot_list, tile_pix, rlist, pageSize, self.bounds.size, vframe, tscale); - UIImage *timage = newImageWithPixmap(tile_pix, tileData); - dispatch_async(dispatch_get_main_queue(), ^{ - BOOL isValid = CGRectEqualToRect(tframe, tileFrame) && tscale == tileScale; - if (isValid) - tileView.image = timage; - [timage release]; - [tileView setNeedsDisplay]; - }); - } - drop_list(rlist); - - // re-render the full-page image - [self renderPage]; -} - -- (void) update -{ - CGRect tframe = tileFrame; - float tscale = tileScale; - CGRect vframe = tframe; - vframe.origin.x -= imageView.frame.origin.x; - vframe.origin.y -= imageView.frame.origin.y; - - dispatch_async(queue, ^{ - [self updatePageAndTileWithTileFrame:tframe tileScale:tscale viewFrame:vframe]; - }); -} - -- (void) invokeTextDialog:(NSString *)text -{ - [dialogCreator invokeTextDialog:text okayAction:^(NSString *newText) { - dispatch_async(queue, ^{ - BOOL accepted = setFocussedWidgetText(doc, page, newText.UTF8String); - if (accepted) - { - dispatch_async(dispatch_get_main_queue(), ^{ - [updater update]; - }); - } - else - { - dispatch_async(dispatch_get_main_queue(), ^{ - [self invokeTextDialog:newText]; - }); - } - }); - }]; -} - -- (void) invokeChoiceDialog:(NSArray *)choices -{ - [dialogCreator invokeChoiceDialog:choices okayAction:^(NSArray *selection) { - dispatch_async(queue, ^{ - BOOL accepted = setFocussedWidgetChoice(doc, page, [selection[0] UTF8String]); - if (accepted) - { - dispatch_async(dispatch_get_main_queue(), ^{ - [updater update]; - }); - } - else - { - dispatch_async(dispatch_get_main_queue(), ^{ - [self invokeChoiceDialog:choices]; - }); - } - }); - - }]; -} - -- (int) passTapToPage:(CGPoint)pt -{ - pdf_document *idoc = pdf_specifics(ctx, doc); - pdf_ui_event event; - int changed = 0; - pdf_widget *focus; - char **opts = NULL; - char *text = NULL; - - if (!idoc) - return 0; - - fz_var(opts); - fz_var(text); - fz_try(ctx) - { - event.etype = PDF_EVENT_TYPE_POINTER; - event.event.pointer.pt.x = pt.x; - event.event.pointer.pt.y = pt.y; - event.event.pointer.ptype = PDF_POINTER_DOWN; - changed = pdf_pass_event(ctx, idoc, (pdf_page *)page, &event); - event.event.pointer.ptype = PDF_POINTER_UP; - changed |= pdf_pass_event(ctx, idoc, (pdf_page *)page, &event); - - focus = pdf_focused_widget(ctx, idoc); - if (focus) - { - switch (pdf_widget_type(ctx, focus)) - { - case PDF_WIDGET_TYPE_TEXT: - { - text = pdf_text_widget_text(ctx, idoc, focus); - NSString *stext = [@(text?text:"") retain]; - dispatch_async(dispatch_get_main_queue(), ^{ - [self invokeTextDialog:stext]; - [stext release]; - }); - break; - } - - case PDF_WIDGET_TYPE_LISTBOX: - case PDF_WIDGET_TYPE_COMBOBOX: - { - int nopts = pdf_choice_widget_options(ctx, idoc, focus, 0, NULL); - opts = fz_malloc(ctx, nopts * sizeof(*opts)); - (void)pdf_choice_widget_options(ctx, idoc, focus, 0, opts); - NSMutableArray *arr = [[NSMutableArray arrayWithCapacity:nopts] retain]; - for (int i = 0; i < nopts; i++) - { - NSString *utf8 = @(opts[i]); - // FIXME: temporary patch to handle the library not converting to utf8 - if (utf8 == nil) - utf8 = @(opts[i]); - if (utf8 != nil) - [arr addObject:utf8]; - } - dispatch_async(dispatch_get_main_queue(), ^{ - [self invokeChoiceDialog:arr]; - [arr release]; - }); - break; - } - - case PDF_WIDGET_TYPE_SIGNATURE: - break; - - default: - break; - } - } - } - fz_always(ctx) - { - fz_free(ctx, text); - fz_free(ctx, opts); - } - fz_catch(ctx) - { - } - - return changed; -} - -- (MuTapResult *) handleTap:(CGPoint)pt -{ - CGPoint ipt = [self convertPoint:pt toView:imageView]; - CGSize scale = fitPageToScreen(pageSize, imageView.bounds.size); - int i; - - ipt.x /= scale.width; - ipt.y /= scale.height; - - for (i = 0; i < annotations.count; i++) - { - MuAnnotation *annot = annotations[i]; - if (annot.type != PDF_ANNOT_WIDGET && CGRectContainsPoint(annot.rect, ipt)) - { - [self selectAnnotation:i]; - return [[[MuTapResultAnnotation alloc] initWithAnnotation:annot] autorelease]; - } - } - - [self deselectAnnotation]; - - for (i = 0; i < widgetRects.count; i++) - { - CGRect r = [widgetRects[i] CGRectValue]; - if (CGRectContainsPoint(r, ipt)) - { - dispatch_async(queue, ^{ - int changed = [self passTapToPage:ipt]; - if (changed) - dispatch_async(dispatch_get_main_queue(), ^{ - [self update]; - }); - }); - return [[[MuTapResultWidget alloc] init] autorelease]; - } - } - - if (linkView) - { - CGPoint lpt = [self convertPoint:pt toView:linkView]; - return [linkView handleTap:lpt]; - } - - return nil; -} - -@end diff --git a/platform/ios/Classes/MuPageViewReflow.h b/platform/ios/Classes/MuPageViewReflow.h deleted file mode 100644 index f6140e81..00000000 --- a/platform/ios/Classes/MuPageViewReflow.h +++ /dev/null @@ -1,9 +0,0 @@ -#import <UIKit/UIKit.h> -#import "MuDocRef.h" -#import "MuPageView.h" - -@interface MuPageViewReflow : UIWebView <UIWebViewDelegate,MuPageView> - --(instancetype) initWithFrame:(CGRect)frame document:(MuDocRef *)aDoc page:(int)aNumber; - -@end diff --git a/platform/ios/Classes/MuPageViewReflow.m b/platform/ios/Classes/MuPageViewReflow.m deleted file mode 100644 index f58bf72f..00000000 --- a/platform/ios/Classes/MuPageViewReflow.m +++ /dev/null @@ -1,151 +0,0 @@ -#include "common.h" -#import "MuPageViewReflow.h" - -NSString *textAsHtml(fz_document *doc, int pageNum) -{ - NSString *str = nil; - fz_page *page = NULL; - fz_stext_sheet *sheet = NULL; - fz_stext_page *text = NULL; - fz_device *dev = NULL; - fz_matrix ctm; - fz_buffer *buf = NULL; - fz_output *out = NULL; - fz_rect mediabox; - size_t len; - unsigned char *data; - - fz_var(page); - fz_var(sheet); - fz_var(text); - fz_var(dev); - fz_var(buf); - fz_var(out); - - fz_try(ctx) - { - ctm = fz_identity; - sheet = fz_new_stext_sheet(ctx); - text = fz_new_stext_page(ctx, fz_bound_page(ctx, page, &mediabox)); - dev = fz_new_stext_device(ctx, sheet, text, NULL); - page = fz_load_page(ctx, doc, pageNum); - fz_run_page(ctx, page, dev, &ctm, NULL); - fz_close_device(ctx, dev); - fz_drop_device(ctx, dev); - dev = NULL; - - fz_analyze_text(ctx, sheet, text); - - buf = fz_new_buffer(ctx, 256); - out = fz_new_output_with_buffer(ctx, buf); - fz_printf(ctx, out, "<html>\n"); - fz_printf(ctx, out, "<style>\n"); - fz_printf(ctx, out, "body{margin:0;}\n"); - fz_printf(ctx, out, "div.page{background-color:white;}\n"); - fz_printf(ctx, out, "div.block{margin:0pt;padding:0pt;}\n"); - fz_printf(ctx, out, "div.metaline{display:table;width:100%%}\n"); - fz_printf(ctx, out, "div.line{display:table-row;}\n"); - fz_printf(ctx, out, "div.cell{display:table-cell;padding-left:0.25em;padding-right:0.25em}\n"); - //fz_printf(ctx, out, "p{margin:0;padding:0;}\n"); - fz_printf(ctx, out, "</style>\n"); - fz_printf(ctx, out, "<body style=\"margin:0\"><div style=\"padding:10px\" id=\"content\">"); - fz_print_stext_page_html(ctx, out, text); - fz_printf(ctx, out, "</div></body>\n"); - fz_printf(ctx, out, "<style>\n"); - fz_print_stext_sheet(ctx, out, sheet); - fz_printf(ctx, out, "</style>\n</html>\n"); - - out = NULL; - - len = fz_buffer_storage(ctx, buf, &data); - str = [[[NSString alloc] initWithBytes:data length:len encoding:NSUTF8StringEncoding] autorelease]; - } - fz_always(ctx) - { - fz_drop_stext_page(ctx, text); - fz_drop_stext_sheet(ctx, sheet); - fz_drop_device(ctx, dev); - fz_drop_output(ctx, out); - fz_drop_buffer(ctx, buf); - fz_drop_page(ctx, page); - } - fz_catch(ctx) - { - str = nil; - } - - return str; -} - -@implementation MuPageViewReflow -{ - int number; - float scale; -} - -- (instancetype)initWithFrame:(CGRect)frame document:(MuDocRef *)aDoc page:(int)aNumber -{ - self = [super initWithFrame:frame]; - if (self) { - number = aNumber; - scale = 1.0; - self.scalesPageToFit = NO; - self.delegate = self; - dispatch_async(queue, ^{ - __block NSString *cont = [textAsHtml(aDoc->doc, aNumber) retain]; - dispatch_async(dispatch_get_main_queue(), ^{ - [self loadHTMLString:cont baseURL:nil]; - }); - }); - } - return self; -} - --(void) webViewDidFinishLoad:(UIWebView *)webView -{ - [self stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"document.getElementById('content').style.zoom=\"%f\"", scale]]; -} - --(void) dealloc -{ - [self setDelegate:nil]; - [super dealloc]; -} - --(int) number -{ - return number; -} - --(void) willRotate {} --(void) showLinks {} --(void) hideLinks {} --(void) showSearchResults: (int)count {} --(void) clearSearchResults {} --(void) textSelectModeOn {} --(void) textSelectModeOff {} --(void) inkModeOn {} --(void) inkModeOff {} --(void) saveSelectionAsMarkup:(int)type {} --(void) saveInk {} --(void) deselectAnnotation {} --(void) deleteSelectedAnnotation {} --(void) update {} - --(void) resetZoomAnimated: (BOOL)animated -{ - [self.scrollView setContentOffset:CGPointZero animated:NO]; -} - --(void) setScale:(float)aFloat -{ - scale = aFloat; - [self stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"document.getElementById('content').style.zoom=\"%f\"", scale]]; -} - --(MuTapResult *) handleTap:(CGPoint)pt -{ - return nil; -} - -@end diff --git a/platform/ios/Classes/MuPrintPageRenderer.h b/platform/ios/Classes/MuPrintPageRenderer.h deleted file mode 100644 index ffda7025..00000000 --- a/platform/ios/Classes/MuPrintPageRenderer.h +++ /dev/null @@ -1,9 +0,0 @@ -#import <UIKit/UIKit.h> - -#import "MuDocRef.h" - -@interface MuPrintPageRenderer : UIPrintPageRenderer - --(instancetype) initWithDocRef:(MuDocRef *) docRef; - -@end diff --git a/platform/ios/Classes/MuPrintPageRenderer.m b/platform/ios/Classes/MuPrintPageRenderer.m deleted file mode 100644 index ad03f6c5..00000000 --- a/platform/ios/Classes/MuPrintPageRenderer.m +++ /dev/null @@ -1,203 +0,0 @@ -#include "common.h" -#import "MuPrintPageRenderer.h" - -const int MaxStripPixels = 1024*1024; - -@implementation MuPrintPageRenderer -{ - MuDocRef *docRef; -} - --(instancetype) initWithDocRef:(MuDocRef *)aDocRef -{ - self = [super init]; - if (self) - { - docRef = [aDocRef retain]; - } - return self; -} - --(void) dealloc -{ - [docRef release]; - [super dealloc]; -} - --(NSInteger) numberOfPages -{ - __block NSInteger npages = 0; - dispatch_sync(queue, ^{ - fz_try(ctx) - { - npages = fz_count_pages(ctx, docRef->doc); - } - fz_catch(ctx) - { - } - }); - return npages; -} - -static fz_page *getPage(fz_document *doc, NSInteger pageIndex) -{ - __block fz_page *page = NULL; - - dispatch_sync(queue, ^{ - fz_try(ctx) - { - page = fz_load_page(ctx, doc, (int)pageIndex); - } - fz_catch(ctx) - { - printf("Failed to load page\n"); - } - }); - - return page; -} - -static CGSize getPageSize(fz_document *doc, fz_page *page) -{ - __block CGSize size = {0.0,0.0}; - - dispatch_sync(queue, ^{ - fz_try(ctx) - { - fz_rect bounds; - fz_bound_page(ctx, page, &bounds); - size.width = bounds.x1 - bounds.x0; - size.height = bounds.y1 - bounds.y0; - } - fz_catch(ctx) - { - printf("Failed to find page bounds\n"); - } - }); - - return size; -} - -static fz_pixmap *createPixMap(CGSize size) -{ - __block fz_pixmap *pix = NULL; - - dispatch_sync(queue, ^{ - fz_try(ctx) - { - pix = fz_new_pixmap(ctx, fz_device_rgb(ctx), size.width, size.height, 1); - } - fz_catch(ctx) - { - printf("Failed to create pixmap\n"); - } - }); - - return pix; -} - -static void freePage(fz_document *doc, fz_page *page) -{ - dispatch_sync(queue, ^{ - fz_drop_page(ctx, page); - }); -} - -static void renderPage(fz_document *doc, fz_page *page, fz_pixmap *pix, fz_matrix *ctm) -{ - dispatch_sync(queue, ^{ - fz_device *dev = NULL; - fz_var(dev); - fz_try(ctx) - { - dev = fz_new_draw_device(ctx, ctm, pix); - fz_clear_pixmap_with_value(ctx, pix, 0xFF); - fz_run_page(ctx, page, dev, &fz_identity, NULL); - fz_close_device(ctx, dev); - } - fz_always(ctx) - { - fz_drop_device(ctx, dev); - } - fz_catch(ctx) - { - printf("Failed to render page\n"); - } - }); -} - --(void) drawPageAtIndex:(NSInteger)pageIndex inRect:(CGRect)printableRect -{ - fz_page *page = NULL; - fz_pixmap *pix = NULL; - CGDataProviderRef dataref = NULL; - CGImageRef img = NULL; - CGContextRef cgctx = UIGraphicsGetCurrentContext(); - float dpi = 300.0; - float ppi = 72.0; - - if (!cgctx) return; - - CGSize paperSize = self.paperRect.size; - page = getPage(docRef->doc, pageIndex); - if (page == NULL) return; - - CGSize pageSize = getPageSize(docRef->doc, page); - if (pageSize.width == 0.0 || pageSize.height == 0.0) - goto exit; - - CGSize scale = fitPageToScreen(pageSize, paperSize); - pageSize.width *= scale.width; - pageSize.height *= scale.height; - - CGSize pageSizePix = {roundf(pageSize.width * dpi / ppi), roundf(pageSize.height * dpi /ppi)}; - int max_strip_height = MaxStripPixels / (int)pageSizePix.width; - if (pageSizePix.height > max_strip_height) - pageSizePix.height = max_strip_height; - CGSize stripSize = {pageSize.width, pageSizePix.height * ppi / dpi}; - - float cursor = 0.0; - - while (cursor < pageSize.height) - { - // Overlap strips by 1 point - if (cursor > 0.0) - cursor -= 1.0; - - pix = createPixMap(pageSizePix); - if (!pix) - goto exit; - - dataref = CreateWrappedPixmap(pix); - if (dataref == NULL) - goto exit; - - img = CreateCGImageWithPixmap(pix, dataref); - if (img == NULL) - goto exit; - - fz_matrix ctm; - fz_scale(&ctm, dpi / ppi, -dpi / ppi); - fz_pre_translate(&ctm, 0, -stripSize.height-cursor); - fz_pre_scale(&ctm, scale.width, scale.height); - - renderPage(docRef->doc, page, pix, &ctm); - - CGRect rect = {{0.0,cursor},stripSize}; - CGContextDrawImage(cgctx, rect, img); - - CGImageRelease(img); - img = NULL; - CGDataProviderRelease(dataref); // releases pix - dataref = NULL; - - cursor += stripSize.height; - } - -exit: - freePage(docRef->doc, page); - CGImageRelease(img); - CGDataProviderRelease(dataref); //releases pix -} - -@end diff --git a/platform/ios/Classes/MuTapResult.h b/platform/ios/Classes/MuTapResult.h deleted file mode 100644 index 78063117..00000000 --- a/platform/ios/Classes/MuTapResult.h +++ /dev/null @@ -1,41 +0,0 @@ -#import <Foundation/Foundation.h> -#import "MuAnnotation.h" - -@class MuTapResultInternalLink; -@class MuTapResultExternalLink; -@class MuTapResultRemoteLink; -@class MuTapResultWidget; -@class MuTapResultAnnotation; - -@interface MuTapResult : NSObject --(void) switchCaseInternal:(void (^)(MuTapResultInternalLink *))internalLinkBlock - caseExternal:(void (^)(MuTapResultExternalLink *))externalLinkBlock - caseRemote:(void (^)(MuTapResultRemoteLink *))remoteLinkBlock - caseWidget:(void (^)(MuTapResultWidget *))widgetBlock - caseAnnotation:(void (^)(MuTapResultAnnotation *))annotationBlock; -@end - -@interface MuTapResultInternalLink : MuTapResult -@property(readonly) int pageNumber; --(instancetype)initWithPageNumber:(int)aNumber; -@end - -@interface MuTapResultExternalLink : MuTapResult -@property(readonly) NSString *url; --(instancetype)initWithUrl:(NSString *)aString; -@end - -@interface MuTapResultRemoteLink : MuTapResult -@property(readonly) NSString *fileSpec; -@property(readonly) int pageNumber; -@property(readonly) BOOL newWindow; --(instancetype)initWithFileSpec:(NSString *)aString pageNumber:(int)aNumber newWindow:(BOOL)aBool; -@end - -@interface MuTapResultWidget : MuTapResult -@end - -@interface MuTapResultAnnotation : MuTapResult -@property(readonly) MuAnnotation *annot; --(instancetype)initWithAnnotation:(MuAnnotation *)aAnnot; -@end diff --git a/platform/ios/Classes/MuTapResult.m b/platform/ios/Classes/MuTapResult.m deleted file mode 100644 index f6ec06f1..00000000 --- a/platform/ios/Classes/MuTapResult.m +++ /dev/null @@ -1,132 +0,0 @@ -#import "MuTapResult.h" - -@implementation MuTapResult --(void) switchCaseInternal:(void (^)(MuTapResultInternalLink *))internalLinkBlock caseExternal:(void (^)(MuTapResultExternalLink *))externalLinkBlock caseRemote:(void (^)(MuTapResultRemoteLink *))remoteLinkBlock caseWidget:(void (^)(MuTapResultWidget *))widgetBlock caseAnnotation:(void (^)(MuTapResultAnnotation *))annotationBlock {} -@end - -@implementation MuTapResultInternalLink -{ - int pageNumber; -} - -@synthesize pageNumber; - --(instancetype) initWithPageNumber:(int)aNumber -{ - self = [super init]; - if (self) - { - pageNumber = aNumber; - } - return self; -} - --(void) switchCaseInternal:(void (^)(MuTapResultInternalLink *))internalLinkBlock caseExternal:(void (^)(MuTapResultExternalLink *))externalLinkBlock caseRemote:(void (^)(MuTapResultRemoteLink *))remoteLinkBlock caseWidget:(void (^)(MuTapResultWidget *))widgetBlock caseAnnotation:(void (^)(MuTapResultAnnotation *))annotationBlock -{ - internalLinkBlock(self); -} - -@end - -@implementation MuTapResultExternalLink -{ - NSString *url; -} - -@synthesize url; - --(instancetype) initWithUrl:(NSString *)aString -{ - self = [super init]; - if (self) - { - url = [aString retain]; - } - return self; -} - --(void) dealloc -{ - [url release]; - [super dealloc]; -} - --(void) switchCaseInternal:(void (^)(MuTapResultInternalLink *))internalLinkBlock caseExternal:(void (^)(MuTapResultExternalLink *))externalLinkBlock caseRemote:(void (^)(MuTapResultRemoteLink *))remoteLinkBlock caseWidget:(void (^)(MuTapResultWidget *))widgetBlock caseAnnotation:(void (^)(MuTapResultAnnotation *))annotationBlock -{ - externalLinkBlock(self); -} - -@end - -@implementation MuTapResultRemoteLink -{ - NSString *fileSpec; - int pageNumber; - BOOL newWindow; -} - -@synthesize fileSpec, pageNumber, newWindow; - --(instancetype) initWithFileSpec:(NSString *)aString pageNumber:(int)aNumber newWindow:(BOOL)aBool -{ - self = [super init]; - if (self) - { - fileSpec = [aString retain]; - pageNumber = aNumber; - newWindow = aBool; - } - return self; -} - --(void) dealloc -{ - [fileSpec release]; - [super dealloc]; -} - --(void) switchCaseInternal:(void (^)(MuTapResultInternalLink *))internalLinkBlock caseExternal:(void (^)(MuTapResultExternalLink *))externalLinkBlock caseRemote:(void (^)(MuTapResultRemoteLink *))remoteLinkBlock caseWidget:(void (^)(MuTapResultWidget *))widgetBlock caseAnnotation:(void (^)(MuTapResultAnnotation *))annotationBlock -{ - remoteLinkBlock(self); -} - -@end - -@implementation MuTapResultWidget - --(void) switchCaseInternal:(void (^)(MuTapResultInternalLink *))internalLinkBlock caseExternal:(void (^)(MuTapResultExternalLink *))externalLinkBlock caseRemote:(void (^)(MuTapResultRemoteLink *))remoteLinkBlock caseWidget:(void (^)(MuTapResultWidget *))widgetBlock caseAnnotation:(void (^)(MuTapResultAnnotation *))annotationBlock -{ - widgetBlock(self); -} - -@end - -@implementation MuTapResultAnnotation -{ - MuAnnotation *annot; -} - -@synthesize annot; - --(instancetype) initWithAnnotation:(MuAnnotation *)aAnnot -{ - self = [super init]; - if (self) - { - annot = [aAnnot retain]; - } - return self; -} - --(void) dealloc -{ - [annot release]; - [super dealloc]; -} - --(void) switchCaseInternal:(void (^)(MuTapResultInternalLink *))internalLinkBlock caseExternal:(void (^)(MuTapResultExternalLink *))externalLinkBlock caseRemote:(void (^)(MuTapResultRemoteLink *))remoteLinkBlock caseWidget:(void (^)(MuTapResultWidget *))widgetBlock caseAnnotation:(void (^)(MuTapResultAnnotation *))annotationBlock -{ - annotationBlock(self); -} - -@end diff --git a/platform/ios/Classes/MuTextFieldController.h b/platform/ios/Classes/MuTextFieldController.h deleted file mode 100644 index 4cdf1c62..00000000 --- a/platform/ios/Classes/MuTextFieldController.h +++ /dev/null @@ -1,5 +0,0 @@ -#import <UIKit/UIKit.h> - -@interface MuTextFieldController : UIViewController -- (instancetype)initWithText:(NSString *)text okayAction:(void (^)(NSString *))block; -@end diff --git a/platform/ios/Classes/MuTextFieldController.m b/platform/ios/Classes/MuTextFieldController.m deleted file mode 100644 index 78546293..00000000 --- a/platform/ios/Classes/MuTextFieldController.m +++ /dev/null @@ -1,59 +0,0 @@ -#import "MuTextFieldController.h" - -@interface MuTextFieldController () -@property (retain, nonatomic) IBOutlet UINavigationBar *navBar; -- (IBAction)onCancel:(id)sender; -- (IBAction)onOkay:(id)sender; -@property (retain, nonatomic) IBOutlet UITextView *textView; - -@end - -@implementation MuTextFieldController -{ - void (^okayBlock)(NSString *); - NSString *initialText; -} - --(instancetype)initWithText:(NSString *)text okayAction:(void (^)(NSString *))block -{ - self = [super initWithNibName:@"MuTextFieldController" bundle:nil]; - if (self) - { - okayBlock = Block_copy(block); - initialText = [text retain]; - } - return self; -} - -- (void)viewDidLoad -{ - [super viewDidLoad]; - _textView.text = initialText; - [_textView becomeFirstResponder]; -} - -- (void)didReceiveMemoryWarning -{ - [super didReceiveMemoryWarning]; -} - -- (void)dealloc -{ - [okayBlock release]; - [initialText release]; - [_navBar release]; - [_textView release]; - [super dealloc]; -} - -- (IBAction)onOkay:(id)sender -{ - okayBlock(_textView.text); - [self dismissViewControllerAnimated:YES completion:nil]; -} - -- (IBAction)onCancel:(id)sender -{ - [self dismissViewControllerAnimated:YES completion:nil]; -} -@end diff --git a/platform/ios/Classes/MuTextFieldController.xib b/platform/ios/Classes/MuTextFieldController.xib deleted file mode 100644 index cf59cf01..00000000 --- a/platform/ios/Classes/MuTextFieldController.xib +++ /dev/null @@ -1,54 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="4514" systemVersion="13B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none"> - <dependencies> - <deployment defaultVersion="1552" identifier="iOS"/> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3747"/> - </dependencies> - <objects> - <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="MuTextFieldController"> - <connections> - <outlet property="navBar" destination="6Jq-f2-vyU" id="2pw-wC-kWN"/> - <outlet property="textView" destination="w7Z-oh-2jS" id="qeP-Gn-zJl"/> - <outlet property="view" destination="1" id="3"/> - </connections> - </placeholder> - <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> - <view contentMode="scaleToFill" id="1"> - <rect key="frame" x="0.0" y="0.0" width="480" height="320"/> - <autoresizingMask key="autoresizingMask" heightSizable="YES" flexibleMaxY="YES"/> - <subviews> - <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" id="w7Z-oh-2jS"> - <rect key="frame" x="20" y="65" width="440" height="119"/> - <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES" flexibleMaxY="YES"/> - <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/> - <fontDescription key="fontDescription" type="system" pointSize="14"/> - <textInputTraits key="textInputTraits" autocapitalizationType="sentences"/> - </textView> - <navigationBar contentMode="scaleToFill" id="6Jq-f2-vyU"> - <rect key="frame" x="0.0" y="0.0" width="480" height="44"/> - <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/> - <items> - <navigationItem title="Fill out text field" id="FqH-n2-lG7"> - <barButtonItem key="leftBarButtonItem" image="ic_cancel.png" id="VNN-6U-foB"> - <connections> - <action selector="onCancel:" destination="-1" id="K03-ay-2Vk"/> - </connections> - </barButtonItem> - <barButtonItem key="rightBarButtonItem" image="ic_check.png" id="BBZ-VY-Z8l"> - <connections> - <action selector="onOkay:" destination="-1" id="Zud-YG-Opq"/> - </connections> - </barButtonItem> - </navigationItem> - </items> - </navigationBar> - </subviews> - <color key="backgroundColor" cocoaTouchSystemColor="scrollViewTexturedBackgroundColor"/> - <simulatedOrientationMetrics key="simulatedOrientationMetrics" orientation="landscapeRight"/> - </view> - </objects> - <resources> - <image name="ic_cancel.png" width="24" height="24"/> - <image name="ic_check.png" width="24" height="19"/> - </resources> -</document>
\ No newline at end of file diff --git a/platform/ios/Classes/MuTextSelectView.h b/platform/ios/Classes/MuTextSelectView.h deleted file mode 100644 index eb5c9610..00000000 --- a/platform/ios/Classes/MuTextSelectView.h +++ /dev/null @@ -1,7 +0,0 @@ -#include "common.h" - -@interface MuTextSelectView : UIView -- (instancetype) initWithWords:(NSArray *)_words pageSize:(CGSize)_pageSize; -@property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *selectionRects; -@property (NS_NONATOMIC_IOSONLY, readonly, copy) NSString *selectedText; -@end diff --git a/platform/ios/Classes/MuTextSelectView.m b/platform/ios/Classes/MuTextSelectView.m deleted file mode 100644 index fdf1b0f2..00000000 --- a/platform/ios/Classes/MuTextSelectView.m +++ /dev/null @@ -1,111 +0,0 @@ -#include "common.h" -#import "MuTextSelectView.h" -#import "MuWord.h" - -@implementation MuTextSelectView -{ - NSArray *words; - CGSize pageSize; - UIColor *color; - CGPoint start; - CGPoint end; -} - -- (instancetype) initWithWords:(NSArray *)_words pageSize:(CGSize)_pageSize -{ - self = [super initWithFrame:CGRectMake(0,0,100,100)]; - if (self) - { - [self setOpaque:NO]; - words = [_words retain]; - pageSize = _pageSize; - color = [[UIColor colorWithRed:0x25/255.0 green:0x72/255.0 blue:0xAC/255.0 alpha:0.5] retain]; - UIPanGestureRecognizer *rec = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(onDrag:)]; - [self addGestureRecognizer:rec]; - [rec release]; - } - return self; -} - --(void) dealloc -{ - [words release]; - [color release]; - [super dealloc]; -} - -- (NSArray *) selectionRects -{ - NSMutableArray *arr = [NSMutableArray array]; - __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]]; - }]; - - return arr; -} - -- (NSString *) selectedText -{ - __block NSMutableString *text = [NSMutableString string]; - __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]; - }]; - - return text; -} - --(void) onDrag:(UIPanGestureRecognizer *)rec -{ - CGSize scale = fitPageToScreen(pageSize, self.bounds.size); - CGPoint p = [rec locationInView:self]; - p.x /= scale.width; - p.y /= scale.height; - - if (rec.state == UIGestureRecognizerStateBegan) - start = p; - - end = p; - - [self setNeedsDisplay]; -} - -- (void) drawRect:(CGRect)rect -{ - CGSize scale = fitPageToScreen(pageSize, self.bounds.size); - CGContextRef cref = UIGraphicsGetCurrentContext(); - CGContextScaleCTM(cref, scale.width, scale.height); - __block CGRect r; - - [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); - }]; -} - -@end diff --git a/platform/ios/Classes/MuUpdater.h b/platform/ios/Classes/MuUpdater.h deleted file mode 100644 index 0291f821..00000000 --- a/platform/ios/Classes/MuUpdater.h +++ /dev/null @@ -1,5 +0,0 @@ -#import <Foundation/Foundation.h> - -@protocol MuUpdater <NSObject> -- (void)update; -@end diff --git a/platform/ios/Classes/MuWord.h b/platform/ios/Classes/MuWord.h deleted file mode 100644 index 9f880375..00000000 --- a/platform/ios/Classes/MuWord.h +++ /dev/null @@ -1,10 +0,0 @@ -#import <Foundation/Foundation.h> -#import <UIKit/UIKit.h> - -@interface MuWord : NSObject -@property(retain) NSString *string; -@property(assign) CGRect rect; -+ (MuWord *) word; -- (void) appendChar:(unichar)c withRect:(CGRect)rect; -+ (void) selectFrom:(CGPoint)pt1 to:(CGPoint)pt2 fromWords:(NSArray *)words onStartLine:(void (^)(void))startBlock onWord:(void (^)(MuWord *))wordBlock onEndLine:(void (^)(void))endBLock; -@end diff --git a/platform/ios/Classes/MuWord.m b/platform/ios/Classes/MuWord.m deleted file mode 100644 index cd05e23b..00000000 --- a/platform/ios/Classes/MuWord.m +++ /dev/null @@ -1,97 +0,0 @@ -#import "MuWord.h" - -@implementation MuWord -{ - NSMutableString *string; - CGRect rect; -} - -@synthesize string, rect; - -- (instancetype) init -{ - self = [super init]; - if (self) - { - self.string = [NSMutableString string]; - self.rect = CGRectNull; - } - return self; -} - -- (void) dealloc -{ - self.string = nil; - [super dealloc]; -} - -+ (MuWord *) word -{ - return [[[MuWord alloc] init] autorelease]; -} - -- (void) appendChar:(unichar)c withRect:(CGRect)_rect -{ - [string appendFormat:@"%C", c]; - rect = CGRectUnion(rect, _rect); -} - -+ (void) selectFrom:(CGPoint)pt1 to:(CGPoint)pt2 fromWords:(NSArray *)words onStartLine:(void (^)(void))startBlock onWord:(void (^)(MuWord *))wordBlock onEndLine:(void (^)(void))endBLock -{ - CGPoint toppt, botpt; - - if (pt1.y < pt2.y) - { - toppt = pt1; - botpt = pt2; - } - else - { - toppt = pt2; - botpt = pt1; - } - - for (NSArray *line in words) - { - MuWord *fst = line[0]; - float ltop = fst.rect.origin.y; - float lbot = ltop + fst.rect.size.height; - - if (toppt.y < lbot && ltop < botpt.y) - { - BOOL topline = toppt.y > ltop; - BOOL botline = botpt.y < lbot; - float left = -INFINITY; - float right = INFINITY; - - if (topline && botline) - { - left = MIN(toppt.x, botpt.x); - right = MAX(toppt.x, botpt.x); - } - else if (topline) - { - left = toppt.x; - } - else if (botline) - { - right = botpt.x; - } - - startBlock(); - - for (MuWord *word in line) - { - float wleft = word.rect.origin.x; - float wright = wleft + word.rect.size.width; - - if (wright > left && wleft < right) - wordBlock(word); - } - - endBLock(); - } - } -} - -@end diff --git a/platform/ios/Info.plist b/platform/ios/Info.plist deleted file mode 100644 index 582a3470..00000000 --- a/platform/ios/Info.plist +++ /dev/null @@ -1,248 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>CFBundleDevelopmentRegion</key> - <string>en</string> - <key>CFBundleDisplayName</key> - <string>${PRODUCT_NAME}</string> - <key>CFBundleDocumentTypes</key> - <array> - <dict> - <key>CFBundleTypeName</key> - <string>PDF</string> - <key>LSHandlerRank</key> - <string>Alternate</string> - <key>LSItemContentTypes</key> - <array> - <string>com.adobe.pdf</string> - </array> - </dict> - <dict> - <key>CFBundleTypeName</key> - <string>XPS</string> - <key>LSHandlerRank</key> - <string>Alternate</string> - <key>LSItemContentTypes</key> - <array> - <string>com.microsoft.xps</string> - </array> - </dict> - <dict> - <key>CFBundleTypeIconFiles</key> - <array/> - <key>CFBundleTypeName</key> - <string>CBZ</string> - <key>LSHandlerRank</key> - <string>Alternate</string> - <key>LSItemContentTypes</key> - <array> - <string>public.cbz-archive</string> - </array> - </dict> - <dict> - <key>CFBundleTypeIconFiles</key> - <array/> - <key>CFBundleTypeName</key> - <string>OXPS</string> - <key>LSHandlerRank</key> - <string>Alternate</string> - <key>LSItemContentTypes</key> - <array> - <string>com.microsoft.oxps</string> - </array> - </dict> - <dict> - <key>CFBundleTypeIconFiles</key> - <array/> - <key>CFBundleTypeName</key> - <string>EPUB</string> - <key>LSHandlerRank</key> - <string>Alternate</string> - <key>LSItemContentTypes</key> - <array> - <string>org.idpf.epub-container</string> - </array> - </dict> - <dict> - <key>CFBundleTypeIconFiles</key> - <array/> - <key>CFBundleTypeName</key> - <string>EPUB</string> - <key>LSHandlerRank</key> - <string>Alternate</string> - <key>LSItemContentTypes</key> - <array> - <string>org.fictionbook.fb2</string> - </array> - </dict> - </array> - <key>CFBundleExecutable</key> - <string>${EXECUTABLE_NAME}</string> - <key>CFBundleIdentifier</key> - <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> - <key>CFBundleInfoDictionaryVersion</key> - <string>6.0</string> - <key>CFBundleName</key> - <string>${PRODUCT_NAME}</string> - <key>CFBundlePackageType</key> - <string>APPL</string> - <key>CFBundleShortVersionString</key> - <string>1.10</string> - <key>CFBundleSignature</key> - <string>????</string> - <key>CFBundleVersion</key> - <string>1.10a</string> - <key>Fabric</key> - <dict> - <key>APIKey</key> - <string>invalid key</string> - <key>Kits</key> - <array> - <dict> - <key>KitInfo</key> - <dict/> - <key>KitName</key> - <string>Crashlytics</string> - </dict> - </array> - </dict> - <key>LSRequiresIPhoneOS</key> - <true/> - <key>UIFileSharingEnabled</key> - <true/> - <key>UILaunchStoryboardName</key> - <string>Launch Screen</string> - <key>UIPrerenderedIcon</key> - <true/> - <key>UIRequiredDeviceCapabilities</key> - <array> - <string>armv7</string> - </array> - <key>UIRequiresFullScreen</key> - <true/> - <key>UIStatusBarHidden</key> - <true/> - <key>UISupportedInterfaceOrientations</key> - <array> - <string>UIInterfaceOrientationPortrait</string> - <string>UIInterfaceOrientationLandscapeLeft</string> - <string>UIInterfaceOrientationPortraitUpsideDown</string> - <string>UIInterfaceOrientationLandscapeRight</string> - </array> - <key>UISupportedInterfaceOrientations~ipad</key> - <array> - <string>UIInterfaceOrientationPortrait</string> - <string>UIInterfaceOrientationPortraitUpsideDown</string> - <string>UIInterfaceOrientationLandscapeLeft</string> - <string>UIInterfaceOrientationLandscapeRight</string> - </array> - <key>UIViewControllerBasedStatusBarAppearance</key> - <false/> - <key>UTImportedTypeDeclarations</key> - <array> - <dict> - <key>UTTypeConformsTo</key> - <array> - <string>public.data</string> - </array> - <key>UTTypeIdentifier</key> - <string>com.microsoft.xps</string> - <key>UTTypeTagSpecification</key> - <dict> - <key>public.filename-extension</key> - <array> - <string>xps</string> - </array> - <key>public.mime-type</key> - <string>application/vnd.ms-xpsdocument</string> - </dict> - </dict> - <dict> - <key>UTTypeConformsTo</key> - <array> - <string>public.data</string> - </array> - <key>UTTypeIdentifier</key> - <string>public.cbz-archive</string> - <key>UTTypeTagSpecification</key> - <dict> - <key>public.filename-extension</key> - <array> - <string>cbz</string> - </array> - <key>public.mime-type</key> - <string>application/x-cbz</string> - </dict> - </dict> - <dict> - <key>UTTypeConformsTo</key> - <array> - <string>public.data</string> - </array> - <key>UTTypeIdentifier</key> - <string>com.adobe.pdf</string> - <key>UTTypeTagSpecification</key> - <dict> - <key>public.filename-extension</key> - <array> - <string>pdf</string> - </array> - <key>public.mime-type</key> - <string>application/pdf</string> - </dict> - </dict> - <dict> - <key>UTTypeConformsTo</key> - <array> - <string>public.data</string> - </array> - <key>UTTypeIdentifier</key> - <string>com.microsoft.oxps</string> - <key>UTTypeTagSpecification</key> - <dict> - <key>public.filename-extension</key> - <array> - <string>oxps</string> - </array> - <key>public.mime-type</key> - <string>application/oxps</string> - </dict> - </dict> - <dict> - <key>UTTypeConformsTo</key> - <array> - <string>public.data</string> - </array> - <key>UTTypeIdentifier</key> - <string>org.idpf.epub-container</string> - <key>UTTypeTagSpecification</key> - <dict> - <key>public.filename-extension</key> - <array> - <string>epub</string> - </array> - <key>public.mime-type</key> - <string>application/epub+zip</string> - </dict> - </dict> - <dict> - <key>UTTypeConformsTo</key> - <array> - <string>public.data</string> - </array> - <key>UTTypeIdentifier</key> - <string>org.fictionbook.fb2</string> - <key>UTTypeTagSpecification</key> - <dict> - <key>public.filename-extension</key> - <array> - <string>fb2</string> - </array> - <key>public.mime-type</key> - <string>text/xml</string> - </dict> - </dict> - </array> -</dict> -</plist> diff --git a/platform/ios/MuPDF.xcodeproj/project.pbxproj b/platform/ios/MuPDF.xcodeproj/project.pbxproj deleted file mode 100644 index 37f0177b..00000000 --- a/platform/ios/MuPDF.xcodeproj/project.pbxproj +++ /dev/null @@ -1,589 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 7C6152E819DDD6A90095ECAC /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7C6152E719DDD6A90095ECAC /* Images.xcassets */; }; - 7C6152EA19DDF05B0095ECAC /* Launch Screen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7C6152E919DDF05B0095ECAC /* Launch Screen.xib */; }; - 96C8ED011779A88E00A30AF4 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 96C8ED001779A88E00A30AF4 /* main.m */; }; - 96C8ED1B1779A9AF00A30AF4 /* libmupdfthird.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 96C8ED141779A9AE00A30AF4 /* libmupdfthird.a */; }; - 96C8ED1C1779A9AF00A30AF4 /* libmupdf.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 96C8ED151779A9AE00A30AF4 /* libmupdf.a */; }; - 96E1CDF31779A60700FCF717 /* x_alt_blue.png in Resources */ = {isa = PBXBuildFile; fileRef = 96E1CDEC1779A60700FCF717 /* x_alt_blue.png */; }; - 96E1CDF41779A60700FCF717 /* x_alt_blue@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 96E1CDED1779A60700FCF717 /* x_alt_blue@2x.png */; }; - DA0354EB18FFF48400EE31BA /* MuPrintPageRenderer.m in Sources */ = {isa = PBXBuildFile; fileRef = DA0354EA18FFF48400EE31BA /* MuPrintPageRenderer.m */; }; - DA1C68AB17E86A500061F586 /* MuLibraryController.m in Sources */ = {isa = PBXBuildFile; fileRef = DA1C689917E85E8E0061F586 /* MuLibraryController.m */; }; - DA1C68AD17E86A500061F586 /* MuOutlineController.m in Sources */ = {isa = PBXBuildFile; fileRef = DA1C689D17E861020061F586 /* MuOutlineController.m */; }; - DA1C68AF17E86A500061F586 /* MuHitView.m in Sources */ = {isa = PBXBuildFile; fileRef = DA1C689F17E861870061F586 /* MuHitView.m */; }; - DA1C68B117E86A500061F586 /* MuPageViewNormal.m in Sources */ = {isa = PBXBuildFile; fileRef = DA1C68A517E863C70061F586 /* MuPageViewNormal.m */; }; - DA1C68B317E86A500061F586 /* MuDocumentController.m in Sources */ = {isa = PBXBuildFile; fileRef = DA1C68A717E864180061F586 /* MuDocumentController.m */; }; - DA1C68B517E86A500061F586 /* MuAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = DA1C68A917E864CB0061F586 /* MuAppDelegate.m */; }; - DA1C68C417E8969C0061F586 /* common.m in Sources */ = {isa = PBXBuildFile; fileRef = DA1C68C317E8969C0061F586 /* common.m */; }; - DA442E2D183B796F008EF49B /* ic_pen.png in Resources */ = {isa = PBXBuildFile; fileRef = DA442E2C183B796F008EF49B /* ic_pen.png */; }; - DA442E30183B9F13008EF49B /* MuInkView.m in Sources */ = {isa = PBXBuildFile; fileRef = DA442E2F183B9F13008EF49B /* MuInkView.m */; }; - DA4C0622187B1EA200755D0D /* MuTextFieldController.m in Sources */ = {isa = PBXBuildFile; fileRef = DA4C0620187B1EA200755D0D /* MuTextFieldController.m */; }; - DA4C0623187B1EA200755D0D /* MuTextFieldController.xib in Resources */ = {isa = PBXBuildFile; fileRef = DA4C0621187B1EA200755D0D /* MuTextFieldController.xib */; }; - DA7AAA3B18E4683600A577E3 /* ic_annotation.png in Resources */ = {isa = PBXBuildFile; fileRef = DA7AAA3A18E45FA300A577E3 /* ic_annotation.png */; }; - DA7AAA3C18E4683600A577E3 /* ic_print.png in Resources */ = {isa = PBXBuildFile; fileRef = DA32FC7218E33CC7001D7902 /* ic_print.png */; }; - DAA6E56F17F03F96002B1E4E /* MuPageViewReflow.m in Sources */ = {isa = PBXBuildFile; fileRef = DAA6E56E17F03AAE002B1E4E /* MuPageViewReflow.m */; }; - DAAC6A2E17FC6E4A00A0E83A /* MuTapResult.m in Sources */ = {isa = PBXBuildFile; fileRef = DAAC6A2D17FC6E4A00A0E83A /* MuTapResult.m */; }; - DAB067A61831225D00DDA774 /* MuWord.m in Sources */ = {isa = PBXBuildFile; fileRef = DAB067A51831225D00DDA774 /* MuWord.m */; }; - DAB9F4BB17F1B24000117D2E /* ic_arrow_left.png in Resources */ = {isa = PBXBuildFile; fileRef = DAB9F4B517F1B24000117D2E /* ic_arrow_left.png */; }; - DAB9F4BC17F1B24000117D2E /* ic_arrow_right.png in Resources */ = {isa = PBXBuildFile; fileRef = DAB9F4B617F1B24000117D2E /* ic_arrow_right.png */; }; - DAB9F4BD17F1B24000117D2E /* ic_cancel.png in Resources */ = {isa = PBXBuildFile; fileRef = DAB9F4B717F1B24000117D2E /* ic_cancel.png */; }; - DAB9F4BE17F1B24000117D2E /* ic_link.png in Resources */ = {isa = PBXBuildFile; fileRef = DAB9F4B817F1B24000117D2E /* ic_link.png */; }; - DAB9F4BF17F1B24000117D2E /* ic_list.png in Resources */ = {isa = PBXBuildFile; fileRef = DAB9F4B917F1B24000117D2E /* ic_list.png */; }; - DAB9F4C017F1B24000117D2E /* ic_magnifying_glass.png in Resources */ = {isa = PBXBuildFile; fileRef = DAB9F4BA17F1B24000117D2E /* ic_magnifying_glass.png */; }; - DAB9F4C217F1CB6D00117D2E /* ic_reflow.png in Resources */ = {isa = PBXBuildFile; fileRef = DAB9F4C117F1CB6D00117D2E /* ic_reflow.png */; }; - DABDEF5A17EC484A00AC35F1 /* MuDocRef.m in Sources */ = {isa = PBXBuildFile; fileRef = DABDEF5917EC484A00AC35F1 /* MuDocRef.m */; }; - DACD12271833CDA600D4B9C5 /* ic_check.png in Resources */ = {isa = PBXBuildFile; fileRef = DACD12261833CDA600D4B9C5 /* ic_check.png */; }; - DAD10489183D0A2900960F4C /* MuAnnotation.m in Sources */ = {isa = PBXBuildFile; fileRef = DAD10488183D0A2900960F4C /* MuAnnotation.m */; }; - DAD2BA821835064E00E7C49D /* MuTextSelectView.m in Sources */ = {isa = PBXBuildFile; fileRef = DAD2BA811835064E00E7C49D /* MuTextSelectView.m */; }; - DAD47D2A1832475C00E173A0 /* ic_more.png in Resources */ = {isa = PBXBuildFile; fileRef = DAD47D291832475C00E173A0 /* ic_more.png */; }; - DAD47D2E1832615900E173A0 /* ic_highlight.png in Resources */ = {isa = PBXBuildFile; fileRef = DAD47D2B1832615900E173A0 /* ic_highlight.png */; }; - DAD47D2F1832615900E173A0 /* ic_strike.png in Resources */ = {isa = PBXBuildFile; fileRef = DAD47D2C1832615900E173A0 /* ic_strike.png */; }; - DAD47D301832615900E173A0 /* ic_underline.png in Resources */ = {isa = PBXBuildFile; fileRef = DAD47D2D1832615900E173A0 /* ic_underline.png */; }; - DAD72802183E53F0005C14FA /* MuAnnotSelectView.m in Sources */ = {isa = PBXBuildFile; fileRef = DAD72801183E53F0005C14FA /* MuAnnotSelectView.m */; }; - DAD72804183E6F33005C14FA /* ic_trash.png in Resources */ = {isa = PBXBuildFile; fileRef = DAD72803183E6F33005C14FA /* ic_trash.png */; }; - DADF824D1905242800855662 /* ic_share.png in Resources */ = {isa = PBXBuildFile; fileRef = DADF824C1905241900855662 /* ic_share.png */; }; - DAFF997B187C12430081C756 /* MuChoiceFieldController.m in Sources */ = {isa = PBXBuildFile; fileRef = DAFF9979187C12430081C756 /* MuChoiceFieldController.m */; }; - DAFF997C187C12430081C756 /* MuChoiceFieldController.xib in Resources */ = {isa = PBXBuildFile; fileRef = DAFF997A187C12430081C756 /* MuChoiceFieldController.xib */; }; - E845CC6E1C20C09B00474C19 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = E845CC6D1C20C09B00474C19 /* Default-568h@2x.png */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 963AD8CF17D60084000B0779 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 968E1E351779A54F0050CEA3 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 963AD8CB17D5FFD9000B0779; - remoteInfo = Generate; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXFileReference section */ - 7C6152E719DDD6A90095ECAC /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = MuPDF/Images.xcassets; sourceTree = "<group>"; }; - 7C6152E919DDF05B0095ECAC /* Launch Screen.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = "Launch Screen.xib"; path = "MuPDF/Launch Screen.xib"; sourceTree = "<group>"; }; - 968E1E3D1779A54F0050CEA3 /* MuPDF.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MuPDF.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 968E1E481779A54F0050CEA3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; }; - 96C8ED001779A88E00A30AF4 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; }; - 96C8ED141779A9AE00A30AF4 /* libmupdfthird.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libmupdfthird.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 96C8ED151779A9AE00A30AF4 /* libmupdf.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libmupdf.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 96E1CDEC1779A60700FCF717 /* x_alt_blue.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = x_alt_blue.png; sourceTree = "<group>"; }; - 96E1CDED1779A60700FCF717 /* x_alt_blue@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "x_alt_blue@2x.png"; sourceTree = "<group>"; }; - DA012CA218803D1C00E47712 /* MuUpdater.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = MuUpdater.h; path = Classes/MuUpdater.h; sourceTree = "<group>"; }; - DA0354E918FFF48400EE31BA /* MuPrintPageRenderer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MuPrintPageRenderer.h; path = Classes/MuPrintPageRenderer.h; sourceTree = "<group>"; }; - DA0354EA18FFF48400EE31BA /* MuPrintPageRenderer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MuPrintPageRenderer.m; path = Classes/MuPrintPageRenderer.m; sourceTree = "<group>"; }; - DA1C689817E85E8E0061F586 /* MuLibraryController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MuLibraryController.h; path = Classes/MuLibraryController.h; sourceTree = "<group>"; }; - DA1C689917E85E8E0061F586 /* MuLibraryController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MuLibraryController.m; path = Classes/MuLibraryController.m; sourceTree = "<group>"; }; - DA1C689C17E861020061F586 /* MuOutlineController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MuOutlineController.h; path = Classes/MuOutlineController.h; sourceTree = "<group>"; }; - DA1C689D17E861020061F586 /* MuOutlineController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MuOutlineController.m; path = Classes/MuOutlineController.m; sourceTree = "<group>"; }; - DA1C689E17E861870061F586 /* MuHitView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MuHitView.h; path = Classes/MuHitView.h; sourceTree = "<group>"; }; - DA1C689F17E861870061F586 /* MuHitView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MuHitView.m; path = Classes/MuHitView.m; sourceTree = "<group>"; }; - DA1C68A417E863C70061F586 /* MuPageViewNormal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MuPageViewNormal.h; path = Classes/MuPageViewNormal.h; sourceTree = "<group>"; }; - DA1C68A517E863C70061F586 /* MuPageViewNormal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MuPageViewNormal.m; path = Classes/MuPageViewNormal.m; sourceTree = "<group>"; }; - DA1C68A617E864180061F586 /* MuDocumentController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MuDocumentController.h; path = Classes/MuDocumentController.h; sourceTree = "<group>"; }; - DA1C68A717E864180061F586 /* MuDocumentController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MuDocumentController.m; path = Classes/MuDocumentController.m; sourceTree = "<group>"; }; - DA1C68A817E864CB0061F586 /* MuAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MuAppDelegate.h; path = Classes/MuAppDelegate.h; sourceTree = "<group>"; }; - DA1C68A917E864CB0061F586 /* MuAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MuAppDelegate.m; path = Classes/MuAppDelegate.m; sourceTree = "<group>"; }; - DA1C68C217E8968C0061F586 /* common.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = common.h; sourceTree = "<group>"; }; - DA1C68C317E8969C0061F586 /* common.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = common.m; sourceTree = "<group>"; }; - DA32FC7218E33CC7001D7902 /* ic_print.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = ic_print.png; path = resources/ic_print.png; sourceTree = "<group>"; }; - DA442E2C183B796F008EF49B /* ic_pen.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = ic_pen.png; path = resources/ic_pen.png; sourceTree = "<group>"; }; - DA442E2E183B9F13008EF49B /* MuInkView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MuInkView.h; path = Classes/MuInkView.h; sourceTree = "<group>"; }; - DA442E2F183B9F13008EF49B /* MuInkView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MuInkView.m; path = Classes/MuInkView.m; sourceTree = "<group>"; }; - DA4C061F187B1EA200755D0D /* MuTextFieldController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MuTextFieldController.h; path = Classes/MuTextFieldController.h; sourceTree = "<group>"; }; - DA4C0620187B1EA200755D0D /* MuTextFieldController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MuTextFieldController.m; path = Classes/MuTextFieldController.m; sourceTree = "<group>"; }; - DA4C0621187B1EA200755D0D /* MuTextFieldController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = MuTextFieldController.xib; path = Classes/MuTextFieldController.xib; sourceTree = "<group>"; }; - DA7AAA3A18E45FA300A577E3 /* ic_annotation.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = ic_annotation.png; path = resources/ic_annotation.png; sourceTree = "<group>"; }; - DAA6E56D17F03AAE002B1E4E /* MuPageViewReflow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MuPageViewReflow.h; path = Classes/MuPageViewReflow.h; sourceTree = "<group>"; }; - DAA6E56E17F03AAE002B1E4E /* MuPageViewReflow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MuPageViewReflow.m; path = Classes/MuPageViewReflow.m; sourceTree = "<group>"; }; - DAAC6A2C17FC6E4A00A0E83A /* MuTapResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MuTapResult.h; path = Classes/MuTapResult.h; sourceTree = "<group>"; }; - DAAC6A2D17FC6E4A00A0E83A /* MuTapResult.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MuTapResult.m; path = Classes/MuTapResult.m; sourceTree = "<group>"; }; - DAB067A41831225D00DDA774 /* MuWord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MuWord.h; path = Classes/MuWord.h; sourceTree = "<group>"; }; - DAB067A51831225D00DDA774 /* MuWord.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MuWord.m; path = Classes/MuWord.m; sourceTree = "<group>"; }; - DAB20D4718045AC40030623F /* MuDialogCreator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MuDialogCreator.h; path = Classes/MuDialogCreator.h; sourceTree = "<group>"; }; - DAB9F4B517F1B24000117D2E /* ic_arrow_left.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = ic_arrow_left.png; path = resources/ic_arrow_left.png; sourceTree = "<group>"; }; - DAB9F4B617F1B24000117D2E /* ic_arrow_right.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = ic_arrow_right.png; path = resources/ic_arrow_right.png; sourceTree = "<group>"; }; - DAB9F4B717F1B24000117D2E /* ic_cancel.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = ic_cancel.png; path = resources/ic_cancel.png; sourceTree = "<group>"; }; - DAB9F4B817F1B24000117D2E /* ic_link.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = ic_link.png; path = resources/ic_link.png; sourceTree = "<group>"; }; - DAB9F4B917F1B24000117D2E /* ic_list.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = ic_list.png; path = resources/ic_list.png; sourceTree = "<group>"; }; - DAB9F4BA17F1B24000117D2E /* ic_magnifying_glass.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = ic_magnifying_glass.png; path = resources/ic_magnifying_glass.png; sourceTree = "<group>"; }; - DAB9F4C117F1CB6D00117D2E /* ic_reflow.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = ic_reflow.png; path = resources/ic_reflow.png; sourceTree = "<group>"; }; - DABDEF5817EC484A00AC35F1 /* MuDocRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MuDocRef.h; path = Classes/MuDocRef.h; sourceTree = "<group>"; }; - DABDEF5917EC484A00AC35F1 /* MuDocRef.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MuDocRef.m; path = Classes/MuDocRef.m; sourceTree = "<group>"; }; - DACD12261833CDA600D4B9C5 /* ic_check.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = ic_check.png; path = resources/ic_check.png; sourceTree = "<group>"; }; - DAD10487183D0A2900960F4C /* MuAnnotation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MuAnnotation.h; path = Classes/MuAnnotation.h; sourceTree = "<group>"; }; - DAD10488183D0A2900960F4C /* MuAnnotation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MuAnnotation.m; path = Classes/MuAnnotation.m; sourceTree = "<group>"; }; - DAD2BA801835064E00E7C49D /* MuTextSelectView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MuTextSelectView.h; path = Classes/MuTextSelectView.h; sourceTree = "<group>"; }; - DAD2BA811835064E00E7C49D /* MuTextSelectView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MuTextSelectView.m; path = Classes/MuTextSelectView.m; sourceTree = "<group>"; }; - DAD47D291832475C00E173A0 /* ic_more.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = ic_more.png; path = resources/ic_more.png; sourceTree = "<group>"; }; - DAD47D2B1832615900E173A0 /* ic_highlight.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = ic_highlight.png; path = resources/ic_highlight.png; sourceTree = "<group>"; }; - DAD47D2C1832615900E173A0 /* ic_strike.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = ic_strike.png; path = resources/ic_strike.png; sourceTree = "<group>"; }; - DAD47D2D1832615900E173A0 /* ic_underline.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = ic_underline.png; path = resources/ic_underline.png; sourceTree = "<group>"; }; - DAD72800183E53F0005C14FA /* MuAnnotSelectView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MuAnnotSelectView.h; path = Classes/MuAnnotSelectView.h; sourceTree = "<group>"; }; - DAD72801183E53F0005C14FA /* MuAnnotSelectView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MuAnnotSelectView.m; path = Classes/MuAnnotSelectView.m; sourceTree = "<group>"; }; - DAD72803183E6F33005C14FA /* ic_trash.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = ic_trash.png; path = resources/ic_trash.png; sourceTree = "<group>"; }; - DADD8D6917EB24C000C49E0B /* MuPageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MuPageView.h; path = Classes/MuPageView.h; sourceTree = "<group>"; }; - DADF824C1905241900855662 /* ic_share.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = ic_share.png; path = resources/ic_share.png; sourceTree = "<group>"; }; - DAFF9978187C12430081C756 /* MuChoiceFieldController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MuChoiceFieldController.h; path = Classes/MuChoiceFieldController.h; sourceTree = "<group>"; }; - DAFF9979187C12430081C756 /* MuChoiceFieldController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MuChoiceFieldController.m; path = Classes/MuChoiceFieldController.m; sourceTree = "<group>"; }; - DAFF997A187C12430081C756 /* MuChoiceFieldController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = MuChoiceFieldController.xib; path = Classes/MuChoiceFieldController.xib; sourceTree = "<group>"; }; - E845CC6D1C20C09B00474C19 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Default-568h@2x.png"; path = "MuPDF/Images.xcassets/LaunchImage.launchimage/Default-568h@2x.png"; sourceTree = "<group>"; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 968E1E3A1779A54F0050CEA3 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 96C8ED1C1779A9AF00A30AF4 /* libmupdf.a in Frameworks */, - 96C8ED1B1779A9AF00A30AF4 /* libmupdfthird.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 968E1E341779A54F0050CEA3 = { - isa = PBXGroup; - children = ( - E845CC6D1C20C09B00474C19 /* Default-568h@2x.png */, - DA1C68C317E8969C0061F586 /* common.m */, - DA1C68C217E8968C0061F586 /* common.h */, - 96C8ED001779A88E00A30AF4 /* main.m */, - DA1C689717E85E4A0061F586 /* Classes */, - 968E1E461779A54F0050CEA3 /* Resources */, - 968E1E3F1779A54F0050CEA3 /* Frameworks */, - 968E1E3E1779A54F0050CEA3 /* Products */, - ); - sourceTree = "<group>"; - usesTabs = 1; - }; - 968E1E3E1779A54F0050CEA3 /* Products */ = { - isa = PBXGroup; - children = ( - 968E1E3D1779A54F0050CEA3 /* MuPDF.app */, - 96C8ED151779A9AE00A30AF4 /* libmupdf.a */, - 96C8ED141779A9AE00A30AF4 /* libmupdfthird.a */, - ); - name = Products; - sourceTree = "<group>"; - }; - 968E1E3F1779A54F0050CEA3 /* Frameworks */ = { - isa = PBXGroup; - children = ( - ); - name = Frameworks; - sourceTree = "<group>"; - }; - 968E1E461779A54F0050CEA3 /* Resources */ = { - isa = PBXGroup; - children = ( - 7C6152E719DDD6A90095ECAC /* Images.xcassets */, - 7C6152E919DDF05B0095ECAC /* Launch Screen.xib */, - DADF824C1905241900855662 /* ic_share.png */, - DA7AAA3A18E45FA300A577E3 /* ic_annotation.png */, - DA32FC7218E33CC7001D7902 /* ic_print.png */, - DAD72803183E6F33005C14FA /* ic_trash.png */, - DACD12261833CDA600D4B9C5 /* ic_check.png */, - DAD47D2B1832615900E173A0 /* ic_highlight.png */, - DAD47D2C1832615900E173A0 /* ic_strike.png */, - DAD47D2D1832615900E173A0 /* ic_underline.png */, - DA442E2C183B796F008EF49B /* ic_pen.png */, - DAD47D291832475C00E173A0 /* ic_more.png */, - DAB9F4C117F1CB6D00117D2E /* ic_reflow.png */, - DAB9F4B517F1B24000117D2E /* ic_arrow_left.png */, - DAB9F4B617F1B24000117D2E /* ic_arrow_right.png */, - DAB9F4B717F1B24000117D2E /* ic_cancel.png */, - DAB9F4B817F1B24000117D2E /* ic_link.png */, - DAB9F4B917F1B24000117D2E /* ic_list.png */, - DAB9F4BA17F1B24000117D2E /* ic_magnifying_glass.png */, - 96E1CDEC1779A60700FCF717 /* x_alt_blue.png */, - 96E1CDED1779A60700FCF717 /* x_alt_blue@2x.png */, - 968E1E481779A54F0050CEA3 /* Info.plist */, - ); - name = Resources; - sourceTree = SOURCE_ROOT; - }; - DA1C689717E85E4A0061F586 /* Classes */ = { - isa = PBXGroup; - children = ( - DA1C689817E85E8E0061F586 /* MuLibraryController.h */, - DA1C689917E85E8E0061F586 /* MuLibraryController.m */, - DA1C689C17E861020061F586 /* MuOutlineController.h */, - DA1C689D17E861020061F586 /* MuOutlineController.m */, - DA1C689E17E861870061F586 /* MuHitView.h */, - DA1C689F17E861870061F586 /* MuHitView.m */, - DAD2BA801835064E00E7C49D /* MuTextSelectView.h */, - DAD2BA811835064E00E7C49D /* MuTextSelectView.m */, - DA442E2E183B9F13008EF49B /* MuInkView.h */, - DA442E2F183B9F13008EF49B /* MuInkView.m */, - DAD72800183E53F0005C14FA /* MuAnnotSelectView.h */, - DAD72801183E53F0005C14FA /* MuAnnotSelectView.m */, - DAB067A41831225D00DDA774 /* MuWord.h */, - DAB067A51831225D00DDA774 /* MuWord.m */, - DAD10487183D0A2900960F4C /* MuAnnotation.h */, - DAD10488183D0A2900960F4C /* MuAnnotation.m */, - DA1C68A417E863C70061F586 /* MuPageViewNormal.h */, - DA1C68A517E863C70061F586 /* MuPageViewNormal.m */, - DA1C68A617E864180061F586 /* MuDocumentController.h */, - DA1C68A717E864180061F586 /* MuDocumentController.m */, - DA1C68A817E864CB0061F586 /* MuAppDelegate.h */, - DA1C68A917E864CB0061F586 /* MuAppDelegate.m */, - DADD8D6917EB24C000C49E0B /* MuPageView.h */, - DABDEF5817EC484A00AC35F1 /* MuDocRef.h */, - DABDEF5917EC484A00AC35F1 /* MuDocRef.m */, - DAA6E56D17F03AAE002B1E4E /* MuPageViewReflow.h */, - DAA6E56E17F03AAE002B1E4E /* MuPageViewReflow.m */, - DAAC6A2C17FC6E4A00A0E83A /* MuTapResult.h */, - DAAC6A2D17FC6E4A00A0E83A /* MuTapResult.m */, - DAB20D4718045AC40030623F /* MuDialogCreator.h */, - DA4C061F187B1EA200755D0D /* MuTextFieldController.h */, - DA4C0620187B1EA200755D0D /* MuTextFieldController.m */, - DA4C0621187B1EA200755D0D /* MuTextFieldController.xib */, - DAFF9978187C12430081C756 /* MuChoiceFieldController.h */, - DAFF9979187C12430081C756 /* MuChoiceFieldController.m */, - DAFF997A187C12430081C756 /* MuChoiceFieldController.xib */, - DA012CA218803D1C00E47712 /* MuUpdater.h */, - DA0354E918FFF48400EE31BA /* MuPrintPageRenderer.h */, - DA0354EA18FFF48400EE31BA /* MuPrintPageRenderer.m */, - ); - name = Classes; - sourceTree = "<group>"; - }; -/* End PBXGroup section */ - -/* Begin PBXLegacyTarget section */ - 963AD8CB17D5FFD9000B0779 /* Generate */ = { - isa = PBXLegacyTarget; - buildArgumentsString = generate; - buildConfigurationList = 963AD8CE17D5FFD9000B0779 /* Build configuration list for PBXLegacyTarget "Generate" */; - buildPhases = ( - ); - buildToolPath = /usr/bin/make; - buildWorkingDirectory = ../..; - dependencies = ( - ); - name = Generate; - passBuildSettingsInEnvironment = 0; - productName = Generate; - }; -/* End PBXLegacyTarget section */ - -/* Begin PBXNativeTarget section */ - 968E1E3C1779A54F0050CEA3 /* MuPDF */ = { - isa = PBXNativeTarget; - buildConfigurationList = 968E1E5A1779A54F0050CEA3 /* Build configuration list for PBXNativeTarget "MuPDF" */; - buildPhases = ( - 9614D56A1779A81D00F1879E /* ShellScript */, - 968E1E391779A54F0050CEA3 /* Sources */, - 968E1E3A1779A54F0050CEA3 /* Frameworks */, - 968E1E3B1779A54F0050CEA3 /* Resources */, - C9E0CC68196EE93F006EB94D /* ShellScript */, - ); - buildRules = ( - ); - dependencies = ( - 963AD8D017D60084000B0779 /* PBXTargetDependency */, - ); - name = MuPDF; - productName = MuPDF; - productReference = 968E1E3D1779A54F0050CEA3 /* MuPDF.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 968E1E351779A54F0050CEA3 /* Project object */ = { - isa = PBXProject; - attributes = { - CLASSPREFIX = Mu; - LastUpgradeCheck = 0810; - ORGANIZATIONNAME = "Artifex Software, Inc"; - TargetAttributes = { - 968E1E3C1779A54F0050CEA3 = { - DevelopmentTeam = 7M9658FA5G; - }; - }; - }; - buildConfigurationList = 968E1E381779A54F0050CEA3 /* Build configuration list for PBXProject "MuPDF" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 968E1E341779A54F0050CEA3; - productRefGroup = 968E1E3E1779A54F0050CEA3 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 963AD8CB17D5FFD9000B0779 /* Generate */, - 968E1E3C1779A54F0050CEA3 /* MuPDF */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 968E1E3B1779A54F0050CEA3 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - E845CC6E1C20C09B00474C19 /* Default-568h@2x.png in Resources */, - DA7AAA3B18E4683600A577E3 /* ic_annotation.png in Resources */, - DA7AAA3C18E4683600A577E3 /* ic_print.png in Resources */, - DA4C0623187B1EA200755D0D /* MuTextFieldController.xib in Resources */, - DAFF997C187C12430081C756 /* MuChoiceFieldController.xib in Resources */, - 96E1CDF31779A60700FCF717 /* x_alt_blue.png in Resources */, - 7C6152E819DDD6A90095ECAC /* Images.xcassets in Resources */, - 96E1CDF41779A60700FCF717 /* x_alt_blue@2x.png in Resources */, - DAB9F4BB17F1B24000117D2E /* ic_arrow_left.png in Resources */, - DAB9F4BC17F1B24000117D2E /* ic_arrow_right.png in Resources */, - DAB9F4BD17F1B24000117D2E /* ic_cancel.png in Resources */, - DAB9F4BE17F1B24000117D2E /* ic_link.png in Resources */, - DAB9F4BF17F1B24000117D2E /* ic_list.png in Resources */, - DAB9F4C017F1B24000117D2E /* ic_magnifying_glass.png in Resources */, - 7C6152EA19DDF05B0095ECAC /* Launch Screen.xib in Resources */, - DAB9F4C217F1CB6D00117D2E /* ic_reflow.png in Resources */, - DAD47D2A1832475C00E173A0 /* ic_more.png in Resources */, - DAD47D2E1832615900E173A0 /* ic_highlight.png in Resources */, - DAD47D2F1832615900E173A0 /* ic_strike.png in Resources */, - DAD47D301832615900E173A0 /* ic_underline.png in Resources */, - DACD12271833CDA600D4B9C5 /* ic_check.png in Resources */, - DA442E2D183B796F008EF49B /* ic_pen.png in Resources */, - DAD72804183E6F33005C14FA /* ic_trash.png in Resources */, - DADF824D1905242800855662 /* ic_share.png in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - 9614D56A1779A81D00F1879E /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/libmupdf.a", - "$(DERIVED_FILE_DIR)/libmupdfthird.a", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "bash build_libs.sh"; - }; - C9E0CC68196EE93F006EB94D /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "if [ \"$COMMAND_LINE_POSTBUILD_SCRIPT\" != \"\" ] ;\nthen\n exec bash $COMMAND_LINE_POSTBUILD_SCRIPT\nfi\n"; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 968E1E391779A54F0050CEA3 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DAA6E56F17F03F96002B1E4E /* MuPageViewReflow.m in Sources */, - DA1C68AB17E86A500061F586 /* MuLibraryController.m in Sources */, - DA1C68AD17E86A500061F586 /* MuOutlineController.m in Sources */, - DA1C68AF17E86A500061F586 /* MuHitView.m in Sources */, - DA1C68B117E86A500061F586 /* MuPageViewNormal.m in Sources */, - DA1C68B317E86A500061F586 /* MuDocumentController.m in Sources */, - DA0354EB18FFF48400EE31BA /* MuPrintPageRenderer.m in Sources */, - DA1C68B517E86A500061F586 /* MuAppDelegate.m in Sources */, - 96C8ED011779A88E00A30AF4 /* main.m in Sources */, - DA1C68C417E8969C0061F586 /* common.m in Sources */, - DABDEF5A17EC484A00AC35F1 /* MuDocRef.m in Sources */, - DAAC6A2E17FC6E4A00A0E83A /* MuTapResult.m in Sources */, - DAFF997B187C12430081C756 /* MuChoiceFieldController.m in Sources */, - DAB067A61831225D00DDA774 /* MuWord.m in Sources */, - DAD2BA821835064E00E7C49D /* MuTextSelectView.m in Sources */, - DA442E30183B9F13008EF49B /* MuInkView.m in Sources */, - DAD10489183D0A2900960F4C /* MuAnnotation.m in Sources */, - DAD72802183E53F0005C14FA /* MuAnnotSelectView.m in Sources */, - DA4C0622187B1EA200755D0D /* MuTextFieldController.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 963AD8D017D60084000B0779 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 963AD8CB17D5FFD9000B0779 /* Generate */; - targetProxy = 963AD8CF17D60084000B0779 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin XCBuildConfiguration section */ - 963AD8CC17D5FFD9000B0779 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = macosx; - }; - name = Debug; - }; - 963AD8CD17D5FFD9000B0779 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = macosx; - }; - name = Release; - }; - 968E1E581779A54F0050CEA3 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ENABLE_MODULES = YES; - CLANG_MODULES_AUTOLINK = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COMMAND_LINE_DEFINES = ""; - COMMAND_LINE_FRAMEWORK_SEARCH_PATHS = ""; - COMMAND_LINE_LINKER_FLAGS = ""; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - FRAMEWORK_SEARCH_PATHS = "$(COMMAND_LINE_FRAMEWORKS_SEARCH_PATH)"; - GCC_NO_COMMON_BLOCKS = YES; - GCC_PREPROCESSOR_DEFINITIONS = "$(COMMAND_LINE_DEFINES)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - ONLY_ACTIVE_ARCH = YES; - OTHER_LDFLAGS = "$(COMMAND_LINE_LINKER_FLAGS)"; - }; - name = Debug; - }; - 968E1E591779A54F0050CEA3 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ENABLE_MODULES = YES; - CLANG_MODULES_AUTOLINK = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COMMAND_LINE_DEFINES = ""; - COMMAND_LINE_FRAMEWORK_SEARCH_PATHS = ""; - COMMAND_LINE_LINKER_FLAGS = ""; - ENABLE_STRICT_OBJC_MSGSEND = YES; - FRAMEWORK_SEARCH_PATHS = "$(COMMAND_LINE_FRAMEWORKS_SEARCH_PATH)"; - GCC_NO_COMMON_BLOCKS = YES; - GCC_PREPROCESSOR_DEFINITIONS = "$(COMMAND_LINE_DEFINES)"; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - OTHER_LDFLAGS = "$(COMMAND_LINE_LINKER_FLAGS)"; - }; - name = Release; - }; - 968E1E5B1779A54F0050CEA3 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; - CODE_SIGN_IDENTITY = "iPhone Developer"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - GCC_OPTIMIZATION_LEVEL = 0; - INFOPLIST_FILE = "$(SRCROOT)/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - PRODUCT_BUNDLE_IDENTIFIER = com.artifex.mupdf; - PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE = ""; - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - USER_HEADER_SEARCH_PATHS = ../../include; - }; - name = Debug; - }; - 968E1E5C1779A54F0050CEA3 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; - CODE_SIGN_IDENTITY = "iPhone Developer"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - GCC_OPTIMIZATION_LEVEL = s; - INFOPLIST_FILE = "$(SRCROOT)/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - PRODUCT_BUNDLE_IDENTIFIER = com.artifex.mupdf; - PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE = ""; - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - USER_HEADER_SEARCH_PATHS = ../../include; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 963AD8CE17D5FFD9000B0779 /* Build configuration list for PBXLegacyTarget "Generate" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 963AD8CC17D5FFD9000B0779 /* Debug */, - 963AD8CD17D5FFD9000B0779 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 968E1E381779A54F0050CEA3 /* Build configuration list for PBXProject "MuPDF" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 968E1E581779A54F0050CEA3 /* Debug */, - 968E1E591779A54F0050CEA3 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 968E1E5A1779A54F0050CEA3 /* Build configuration list for PBXNativeTarget "MuPDF" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 968E1E5B1779A54F0050CEA3 /* Debug */, - 968E1E5C1779A54F0050CEA3 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 968E1E351779A54F0050CEA3 /* Project object */; -} diff --git a/platform/ios/MuPDF.xcodeproj/xcshareddata/xcschemes/Generate.xcscheme b/platform/ios/MuPDF.xcodeproj/xcshareddata/xcschemes/Generate.xcscheme deleted file mode 100644 index 3a9138ee..00000000 --- a/platform/ios/MuPDF.xcodeproj/xcshareddata/xcschemes/Generate.xcscheme +++ /dev/null @@ -1,71 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<Scheme - LastUpgradeVersion = "0810" - version = "1.3"> - <BuildAction - parallelizeBuildables = "YES" - buildImplicitDependencies = "YES"> - <BuildActionEntries> - <BuildActionEntry - buildForTesting = "YES" - buildForRunning = "YES" - buildForProfiling = "YES" - buildForArchiving = "YES" - buildForAnalyzing = "YES"> - <BuildableReference - BuildableIdentifier = "primary" - BlueprintIdentifier = "963AD8CB17D5FFD9000B0779" - BuildableName = "Generate" - BlueprintName = "Generate" - ReferencedContainer = "container:MuPDF.xcodeproj"> - </BuildableReference> - </BuildActionEntry> - </BuildActionEntries> - </BuildAction> - <TestAction - buildConfiguration = "Debug" - selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" - selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - shouldUseLaunchSchemeArgsEnv = "YES"> - <Testables> - </Testables> - <AdditionalOptions> - </AdditionalOptions> - </TestAction> - <LaunchAction - buildConfiguration = "Debug" - selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" - selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - launchStyle = "0" - useCustomWorkingDirectory = "NO" - ignoresPersistentStateOnLaunch = "NO" - debugDocumentVersioning = "YES" - debugServiceExtension = "internal" - allowLocationSimulation = "YES"> - <MacroExpansion> - <BuildableReference - BuildableIdentifier = "primary" - BlueprintIdentifier = "963AD8CB17D5FFD9000B0779" - BuildableName = "Generate" - BlueprintName = "Generate" - ReferencedContainer = "container:MuPDF.xcodeproj"> - </BuildableReference> - </MacroExpansion> - <AdditionalOptions> - </AdditionalOptions> - </LaunchAction> - <ProfileAction - buildConfiguration = "Release" - shouldUseLaunchSchemeArgsEnv = "YES" - savedToolIdentifier = "" - useCustomWorkingDirectory = "NO" - debugDocumentVersioning = "YES"> - </ProfileAction> - <AnalyzeAction - buildConfiguration = "Debug"> - </AnalyzeAction> - <ArchiveAction - buildConfiguration = "Release" - revealArchiveInOrganizer = "YES"> - </ArchiveAction> -</Scheme> diff --git a/platform/ios/MuPDF.xcodeproj/xcshareddata/xcschemes/MuPDF.xcscheme b/platform/ios/MuPDF.xcodeproj/xcshareddata/xcschemes/MuPDF.xcscheme deleted file mode 100644 index 493971bf..00000000 --- a/platform/ios/MuPDF.xcodeproj/xcshareddata/xcschemes/MuPDF.xcscheme +++ /dev/null @@ -1,109 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<Scheme - LastUpgradeVersion = "0810" - version = "1.7"> - <BuildAction - parallelizeBuildables = "YES" - buildImplicitDependencies = "YES"> - <BuildActionEntries> - <BuildActionEntry - buildForTesting = "YES" - buildForRunning = "YES" - buildForProfiling = "YES" - buildForArchiving = "YES" - buildForAnalyzing = "YES"> - <BuildableReference - BuildableIdentifier = "primary" - BlueprintIdentifier = "968E1E3C1779A54F0050CEA3" - BuildableName = "MuPDF.app" - BlueprintName = "MuPDF" - ReferencedContainer = "container:MuPDF.xcodeproj"> - </BuildableReference> - </BuildActionEntry> - </BuildActionEntries> - </BuildAction> - <TestAction - buildConfiguration = "Debug" - selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" - selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - shouldUseLaunchSchemeArgsEnv = "YES"> - <Testables> - </Testables> - <MacroExpansion> - <BuildableReference - BuildableIdentifier = "primary" - BlueprintIdentifier = "968E1E3C1779A54F0050CEA3" - BuildableName = "MuPDF.app" - BlueprintName = "MuPDF" - ReferencedContainer = "container:MuPDF.xcodeproj"> - </BuildableReference> - </MacroExpansion> - <AdditionalOptions> - </AdditionalOptions> - </TestAction> - <LaunchAction - buildConfiguration = "Debug" - selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" - selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - launchStyle = "0" - useCustomWorkingDirectory = "NO" - ignoresPersistentStateOnLaunch = "NO" - debugDocumentVersioning = "YES" - debugServiceExtension = "internal" - allowLocationSimulation = "YES"> - <BuildableProductRunnable - runnableDebuggingMode = "0"> - <BuildableReference - BuildableIdentifier = "primary" - BlueprintIdentifier = "968E1E3C1779A54F0050CEA3" - BuildableName = "MuPDF.app" - BlueprintName = "MuPDF" - ReferencedContainer = "container:MuPDF.xcodeproj"> - </BuildableReference> - </BuildableProductRunnable> - <AdditionalOptions> - </AdditionalOptions> - </LaunchAction> - <ProfileAction - buildConfiguration = "Release" - shouldUseLaunchSchemeArgsEnv = "YES" - savedToolIdentifier = "" - useCustomWorkingDirectory = "NO" - debugDocumentVersioning = "YES"> - <BuildableProductRunnable - runnableDebuggingMode = "0"> - <BuildableReference - BuildableIdentifier = "primary" - BlueprintIdentifier = "968E1E3C1779A54F0050CEA3" - BuildableName = "MuPDF.app" - BlueprintName = "MuPDF" - ReferencedContainer = "container:MuPDF.xcodeproj"> - </BuildableReference> - </BuildableProductRunnable> - </ProfileAction> - <AnalyzeAction - buildConfiguration = "Debug"> - </AnalyzeAction> - <ArchiveAction - buildConfiguration = "Release" - revealArchiveInOrganizer = "YES"> - <PostActions> - <ExecutionAction - ActionType = "Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction"> - <ActionContent - title = "Run Script" - scriptText = "if [ "$COMMAND_LINE_POSTARCHIVE_SCRIPT" != "" ] ; then bash $COMMAND_LINE_POSTARCHIVE_SCRIPT RESULT=$? # Manually pass the result of the script back to the caller, as errors # that occur here do not cause the Archive step to fail. I believe this # is an Xcode bug. if [ "$COMMAND_LINE_POSTARCHIVE_SCRIPT_RESULT_FILE" != "" ] ; then echo $RESULT >$COMMAND_LINE_POSTARCHIVE_SCRIPT_RESULT_FILE fi fi exit 1 "> - <EnvironmentBuildable> - <BuildableReference - BuildableIdentifier = "primary" - BlueprintIdentifier = "968E1E3C1779A54F0050CEA3" - BuildableName = "MuPDF.app" - BlueprintName = "MuPDF" - ReferencedContainer = "container:MuPDF.xcodeproj"> - </BuildableReference> - </EnvironmentBuildable> - </ActionContent> - </ExecutionAction> - </PostActions> - </ArchiveAction> -</Scheme> diff --git a/platform/ios/MuPDF/Images.xcassets/AppIcon.appiconset/Contents.json b/platform/ios/MuPDF/Images.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index 83d49d48..00000000 --- a/platform/ios/MuPDF/Images.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,116 +0,0 @@ -{ - "images" : [ - { - "idiom" : "iphone", - "size" : "29x29", - "scale" : "1x" - }, - { - "idiom" : "iphone", - "size" : "29x29", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "29x29", - "scale" : "3x" - }, - { - "idiom" : "iphone", - "size" : "40x40", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "40x40", - "scale" : "3x" - }, - { - "size" : "57x57", - "idiom" : "iphone", - "filename" : "Icon.png", - "scale" : "1x" - }, - { - "size" : "57x57", - "idiom" : "iphone", - "filename" : "Icon@2x.png", - "scale" : "2x" - }, - { - "size" : "60x60", - "idiom" : "iphone", - "filename" : "Icon-120.png", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "60x60", - "scale" : "3x" - }, - { - "idiom" : "ipad", - "size" : "29x29", - "scale" : "1x" - }, - { - "idiom" : "ipad", - "size" : "29x29", - "scale" : "2x" - }, - { - "idiom" : "ipad", - "size" : "40x40", - "scale" : "1x" - }, - { - "idiom" : "ipad", - "size" : "40x40", - "scale" : "2x" - }, - { - "idiom" : "ipad", - "size" : "50x50", - "scale" : "1x" - }, - { - "idiom" : "ipad", - "size" : "50x50", - "scale" : "2x" - }, - { - "size" : "72x72", - "idiom" : "ipad", - "filename" : "Icon-72.png", - "scale" : "1x" - }, - { - "size" : "72x72", - "idiom" : "ipad", - "filename" : "Icon-72@2x.png", - "scale" : "2x" - }, - { - "size" : "76x76", - "idiom" : "ipad", - "filename" : "Icon-76.png", - "scale" : "1x" - }, - { - "size" : "76x76", - "idiom" : "ipad", - "filename" : "Icon-76@2x.png", - "scale" : "2x" - }, - { - "size" : "83.5x83.5", - "idiom" : "ipad", - "filename" : "Icon-167.png", - "scale" : "2x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -}
\ No newline at end of file diff --git a/platform/ios/MuPDF/Images.xcassets/AppIcon.appiconset/Icon-120.png b/platform/ios/MuPDF/Images.xcassets/AppIcon.appiconset/Icon-120.png Binary files differdeleted file mode 100644 index 3fff0732..00000000 --- a/platform/ios/MuPDF/Images.xcassets/AppIcon.appiconset/Icon-120.png +++ /dev/null diff --git a/platform/ios/MuPDF/Images.xcassets/AppIcon.appiconset/Icon-167.png b/platform/ios/MuPDF/Images.xcassets/AppIcon.appiconset/Icon-167.png Binary files differdeleted file mode 100644 index aab7c18f..00000000 --- a/platform/ios/MuPDF/Images.xcassets/AppIcon.appiconset/Icon-167.png +++ /dev/null diff --git a/platform/ios/MuPDF/Images.xcassets/AppIcon.appiconset/Icon-72.png b/platform/ios/MuPDF/Images.xcassets/AppIcon.appiconset/Icon-72.png Binary files differdeleted file mode 100644 index 66fb00bd..00000000 --- a/platform/ios/MuPDF/Images.xcassets/AppIcon.appiconset/Icon-72.png +++ /dev/null diff --git a/platform/ios/MuPDF/Images.xcassets/AppIcon.appiconset/Icon-72@2x.png b/platform/ios/MuPDF/Images.xcassets/AppIcon.appiconset/Icon-72@2x.png Binary files differdeleted file mode 100644 index 5f295e94..00000000 --- a/platform/ios/MuPDF/Images.xcassets/AppIcon.appiconset/Icon-72@2x.png +++ /dev/null diff --git a/platform/ios/MuPDF/Images.xcassets/AppIcon.appiconset/Icon-76.png b/platform/ios/MuPDF/Images.xcassets/AppIcon.appiconset/Icon-76.png Binary files differdeleted file mode 100644 index 89036ae3..00000000 --- a/platform/ios/MuPDF/Images.xcassets/AppIcon.appiconset/Icon-76.png +++ /dev/null diff --git a/platform/ios/MuPDF/Images.xcassets/AppIcon.appiconset/Icon-76@2x.png b/platform/ios/MuPDF/Images.xcassets/AppIcon.appiconset/Icon-76@2x.png Binary files differdeleted file mode 100644 index 9ad054ff..00000000 --- a/platform/ios/MuPDF/Images.xcassets/AppIcon.appiconset/Icon-76@2x.png +++ /dev/null diff --git a/platform/ios/MuPDF/Images.xcassets/AppIcon.appiconset/Icon.png b/platform/ios/MuPDF/Images.xcassets/AppIcon.appiconset/Icon.png Binary files differdeleted file mode 100644 index 5b40fe90..00000000 --- a/platform/ios/MuPDF/Images.xcassets/AppIcon.appiconset/Icon.png +++ /dev/null diff --git a/platform/ios/MuPDF/Images.xcassets/AppIcon.appiconset/Icon@2x.png b/platform/ios/MuPDF/Images.xcassets/AppIcon.appiconset/Icon@2x.png Binary files differdeleted file mode 100644 index f30dced0..00000000 --- a/platform/ios/MuPDF/Images.xcassets/AppIcon.appiconset/Icon@2x.png +++ /dev/null diff --git a/platform/ios/MuPDF/Images.xcassets/LaunchImage.launchimage/Contents.json b/platform/ios/MuPDF/Images.xcassets/LaunchImage.launchimage/Contents.json deleted file mode 100644 index 5b841420..00000000 --- a/platform/ios/MuPDF/Images.xcassets/LaunchImage.launchimage/Contents.json +++ /dev/null @@ -1,94 +0,0 @@ -{ - "images" : [ - { - "orientation" : "portrait", - "idiom" : "ipad", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "1x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "1x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "extent" : "to-status-bar", - "scale" : "1x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "extent" : "to-status-bar", - "scale" : "1x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "extent" : "to-status-bar", - "scale" : "2x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "extent" : "to-status-bar", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "filename" : "Default@2x.png", - "minimum-system-version" : "7.0", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "filename" : "Default-568h@2x.png", - "minimum-system-version" : "7.0", - "subtype" : "retina4", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "filename" : "Default.png", - "scale" : "1x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "filename" : "Default@2x.png", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "filename" : "Default-568h@2x.png", - "subtype" : "retina4", - "scale" : "2x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -}
\ No newline at end of file diff --git a/platform/ios/MuPDF/Images.xcassets/LaunchImage.launchimage/Default-568h@2x.png b/platform/ios/MuPDF/Images.xcassets/LaunchImage.launchimage/Default-568h@2x.png Binary files differdeleted file mode 100644 index 0891b7aa..00000000 --- a/platform/ios/MuPDF/Images.xcassets/LaunchImage.launchimage/Default-568h@2x.png +++ /dev/null diff --git a/platform/ios/MuPDF/Images.xcassets/LaunchImage.launchimage/Default.png b/platform/ios/MuPDF/Images.xcassets/LaunchImage.launchimage/Default.png Binary files differdeleted file mode 100644 index 4c8ca6f6..00000000 --- a/platform/ios/MuPDF/Images.xcassets/LaunchImage.launchimage/Default.png +++ /dev/null diff --git a/platform/ios/MuPDF/Images.xcassets/LaunchImage.launchimage/Default@2x.png b/platform/ios/MuPDF/Images.xcassets/LaunchImage.launchimage/Default@2x.png Binary files differdeleted file mode 100644 index 35b84cff..00000000 --- a/platform/ios/MuPDF/Images.xcassets/LaunchImage.launchimage/Default@2x.png +++ /dev/null diff --git a/platform/ios/MuPDF/Launch Screen.xib b/platform/ios/MuPDF/Launch Screen.xib deleted file mode 100644 index 6c39450f..00000000 --- a/platform/ios/MuPDF/Launch Screen.xib +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="10116" systemVersion="15E65" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES"> - <dependencies> - <deployment identifier="iOS"/> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/> - </dependencies> - <objects> - <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/> - <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> - <view contentMode="scaleToFill" id="iN0-l3-epB"> - <rect key="frame" x="0.0" y="0.0" width="480" height="480"/> - <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> - <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/> - <nil key="simulatedStatusBarMetrics"/> - <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/> - <point key="canvasLocation" x="404" y="445"/> - </view> - </objects> -</document> diff --git a/platform/ios/build_libs.sh b/platform/ios/build_libs.sh deleted file mode 100644 index 16ee41e7..00000000 --- a/platform/ios/build_libs.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash - -# Call this script from a "Run Script" target in the Xcode project to -# cross compile MuPDF and third party libraries using the regular Makefile. -# Also see "iOS" section in Makerules. - -if [ ! -e ../../generated/gen_cmap_cjk.h ] -then - echo 'ERROR: You are missing the generated files.' - echo 'ERROR: Please run "make generate" from the mupdf directory.' - exit 1 -fi - -export OS=ios -export build=$(echo $CONFIGURATION | tr A-Z a-z) - -FLAGS="-Wno-unused-function -Wno-empty-body -Wno-implicit-function-declaration" -for A in $ARCHS -do - FLAGS="$FLAGS -arch $A" -done - -# add bitcode for Xcode 7 and up -XCODE_VER=`xcodebuild -version | head -1` -ARRAY=(${XCODE_VER// / }) -XCODE_VER_NUM=${ARRAY[1]} -ARRAY=(${XCODE_VER_NUM//./ }) -MAJOR=${ARRAY[0]} -if [ "$MAJOR" -ge "7" ] -then - FLAGS="$FLAGS -fembed-bitcode" -fi - -OUT=build/$build-$OS-$(echo $ARCHS | tr ' ' '-') - -echo Compiling libraries for $ARCHS. -make -j4 -C ../.. OUT=$OUT XCFLAGS="$FLAGS" XLDFLAGS="$FLAGS" third libs || exit 1 - -echo Copying library to $BUILT_PRODUCTS_DIR/. -mkdir -p "$BUILT_PRODUCTS_DIR" -cp -f ../../$OUT/lib*.a $BUILT_PRODUCTS_DIR -ranlib $BUILT_PRODUCTS_DIR/lib*.a - -echo Done. diff --git a/platform/ios/common.h b/platform/ios/common.h deleted file mode 100644 index 15d9a64c..00000000 --- a/platform/ios/common.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef MuPDF_common_h -#define MuPDF_common_h - -#include <UIKit/UIKit.h> - -#undef ABS -#undef MIN -#undef MAX - -#include "mupdf/fitz.h" - -extern fz_context *ctx; -extern dispatch_queue_t queue; -extern float screenScale; - -CGSize fitPageToScreen(CGSize page, CGSize screen); - -int search_page(fz_document *doc, int number, char *needle, fz_cookie *cookie); - -fz_rect search_result_bbox(fz_document *doc, int i); - -CGDataProviderRef CreateWrappedPixmap(fz_pixmap *pix); - -CGImageRef CreateCGImageWithPixmap(fz_pixmap *pix, CGDataProviderRef cgdata); - -#endif diff --git a/platform/ios/common.m b/platform/ios/common.m deleted file mode 100644 index 232f3b29..00000000 --- a/platform/ios/common.m +++ /dev/null @@ -1,73 +0,0 @@ -#include "common.h" - -fz_context *ctx; -dispatch_queue_t queue; -float screenScale = 1; - -CGSize fitPageToScreen(CGSize page, CGSize screen) -{ - float hscale = screen.width / page.width; - float vscale = screen.height / page.height; - float scale = fz_min(hscale, vscale); - hscale = floorf(page.width * scale) / page.width; - vscale = floorf(page.height * scale) / page.height; - return CGSizeMake(hscale, vscale); -} - -static int hit_count = 0; -static fz_rect hit_bbox[500]; - -int search_page(fz_document *doc, int number, char *needle, fz_cookie *cookie) -{ - fz_page *page = fz_load_page(ctx, doc, number); - fz_rect mediabox; - fz_stext_sheet *sheet = fz_new_stext_sheet(ctx); - fz_stext_page *text = fz_new_stext_page(ctx, fz_bound_page(ctx, page, &mediabox)); - fz_device *dev = fz_new_stext_device(ctx, sheet, text, NULL); - fz_run_page(ctx, page, dev, &fz_identity, cookie); - fz_close_device(ctx, dev); - fz_drop_device(ctx, dev); - - hit_count = fz_search_stext_page(ctx, text, needle, hit_bbox, nelem(hit_bbox)); - - fz_drop_stext_page(ctx, text); - fz_drop_stext_sheet(ctx, sheet); - fz_drop_page(ctx, page); - - return hit_count; -} - -fz_rect search_result_bbox(fz_document *doc, int i) -{ - return hit_bbox[i]; -} - -static void releasePixmap(void *info, const void *data, size_t size) -{ - if (queue) - dispatch_async(queue, ^{ - fz_drop_pixmap(ctx, info); - }); - else - { - fz_drop_pixmap(ctx, info); - } -} - -CGDataProviderRef CreateWrappedPixmap(fz_pixmap *pix) -{ - unsigned char *samples = fz_pixmap_samples(ctx, pix); - int w = fz_pixmap_width(ctx, pix); - int h = fz_pixmap_height(ctx, pix); - return CGDataProviderCreateWithData(pix, samples, w * 4 * h, releasePixmap); -} - -CGImageRef CreateCGImageWithPixmap(fz_pixmap *pix, CGDataProviderRef cgdata) -{ - int w = fz_pixmap_width(ctx, pix); - int h = fz_pixmap_height(ctx, pix); - CGColorSpaceRef cgcolor = CGColorSpaceCreateDeviceRGB(); - CGImageRef cgimage = CGImageCreate(w, h, 8, 32, 4 * w, cgcolor, kCGBitmapByteOrderDefault, cgdata, NULL, NO, kCGRenderingIntentDefault); - CGColorSpaceRelease(cgcolor); - return cgimage; -} diff --git a/platform/ios/iTunesArtwork2.png b/platform/ios/iTunesArtwork2.png Binary files differdeleted file mode 100644 index 3d9704f1..00000000 --- a/platform/ios/iTunesArtwork2.png +++ /dev/null diff --git a/platform/ios/main.m b/platform/ios/main.m deleted file mode 100644 index 6a2c570c..00000000 --- a/platform/ios/main.m +++ /dev/null @@ -1,17 +0,0 @@ -#import <UIKit/UIKit.h> -#import "MuAppDelegate.h" - -int main(int argc, char *argv[]) -{ - @autoreleasepool { - @try { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([MuAppDelegate class])); - } - @catch (NSException* exception) { - NSLog(@"Uncaught exception %@", exception); - NSLog(@"Stack trace: %@", exception.callStackSymbols); - } - - return 0; - } -} diff --git a/platform/ios/resources/ic_annotation.png b/platform/ios/resources/ic_annotation.png Binary files differdeleted file mode 100644 index 1f4e6d48..00000000 --- a/platform/ios/resources/ic_annotation.png +++ /dev/null diff --git a/platform/ios/resources/ic_arrow_left.png b/platform/ios/resources/ic_arrow_left.png Binary files differdeleted file mode 100644 index d49c7438..00000000 --- a/platform/ios/resources/ic_arrow_left.png +++ /dev/null diff --git a/platform/ios/resources/ic_arrow_right.png b/platform/ios/resources/ic_arrow_right.png Binary files differdeleted file mode 100644 index e76d0cb0..00000000 --- a/platform/ios/resources/ic_arrow_right.png +++ /dev/null diff --git a/platform/ios/resources/ic_cancel.png b/platform/ios/resources/ic_cancel.png Binary files differdeleted file mode 100644 index 6912e1ed..00000000 --- a/platform/ios/resources/ic_cancel.png +++ /dev/null diff --git a/platform/ios/resources/ic_check.png b/platform/ios/resources/ic_check.png Binary files differdeleted file mode 100644 index fb789c8d..00000000 --- a/platform/ios/resources/ic_check.png +++ /dev/null diff --git a/platform/ios/resources/ic_highlight.png b/platform/ios/resources/ic_highlight.png Binary files differdeleted file mode 100644 index 3d6d29b9..00000000 --- a/platform/ios/resources/ic_highlight.png +++ /dev/null diff --git a/platform/ios/resources/ic_link.png b/platform/ios/resources/ic_link.png Binary files differdeleted file mode 100644 index a447b87d..00000000 --- a/platform/ios/resources/ic_link.png +++ /dev/null diff --git a/platform/ios/resources/ic_list.png b/platform/ios/resources/ic_list.png Binary files differdeleted file mode 100644 index 4a2dde6d..00000000 --- a/platform/ios/resources/ic_list.png +++ /dev/null diff --git a/platform/ios/resources/ic_magnifying_glass.png b/platform/ios/resources/ic_magnifying_glass.png Binary files differdeleted file mode 100644 index a3c8f598..00000000 --- a/platform/ios/resources/ic_magnifying_glass.png +++ /dev/null diff --git a/platform/ios/resources/ic_more.png b/platform/ios/resources/ic_more.png Binary files differdeleted file mode 100644 index 68988a56..00000000 --- a/platform/ios/resources/ic_more.png +++ /dev/null diff --git a/platform/ios/resources/ic_pen.png b/platform/ios/resources/ic_pen.png Binary files differdeleted file mode 100644 index 7b7de296..00000000 --- a/platform/ios/resources/ic_pen.png +++ /dev/null diff --git a/platform/ios/resources/ic_print.png b/platform/ios/resources/ic_print.png Binary files differdeleted file mode 100644 index f191fc85..00000000 --- a/platform/ios/resources/ic_print.png +++ /dev/null diff --git a/platform/ios/resources/ic_reflow.png b/platform/ios/resources/ic_reflow.png Binary files differdeleted file mode 100644 index e9e8b052..00000000 --- a/platform/ios/resources/ic_reflow.png +++ /dev/null diff --git a/platform/ios/resources/ic_share.png b/platform/ios/resources/ic_share.png Binary files differdeleted file mode 100644 index 05fbe31a..00000000 --- a/platform/ios/resources/ic_share.png +++ /dev/null diff --git a/platform/ios/resources/ic_strike.png b/platform/ios/resources/ic_strike.png Binary files differdeleted file mode 100644 index fc39409f..00000000 --- a/platform/ios/resources/ic_strike.png +++ /dev/null diff --git a/platform/ios/resources/ic_trash.png b/platform/ios/resources/ic_trash.png Binary files differdeleted file mode 100644 index 465d1245..00000000 --- a/platform/ios/resources/ic_trash.png +++ /dev/null diff --git a/platform/ios/resources/ic_underline.png b/platform/ios/resources/ic_underline.png Binary files differdeleted file mode 100644 index 0a5be3d4..00000000 --- a/platform/ios/resources/ic_underline.png +++ /dev/null diff --git a/platform/ios/x_alt_blue.png b/platform/ios/x_alt_blue.png Binary files differdeleted file mode 100644 index 0ca9a6cc..00000000 --- a/platform/ios/x_alt_blue.png +++ /dev/null diff --git a/platform/ios/x_alt_blue@2x.png b/platform/ios/x_alt_blue@2x.png Binary files differdeleted file mode 100644 index 1cb67549..00000000 --- a/platform/ios/x_alt_blue@2x.png +++ /dev/null |