summaryrefslogtreecommitdiff
path: root/ios
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2011-10-13 20:19:30 +0200
committerTor Andersson <tor.andersson@artifex.com>2011-11-01 23:46:56 +0100
commit33483b52654822b58390ebd2711b13b2dece8740 (patch)
tree981549a13f6754b5980d796ef886a57144636155 /ios
parenta89c74cd325b3ee670ba430756eec267a49400c0 (diff)
downloadmupdf-33483b52654822b58390ebd2711b13b2dece8740.tar.xz
Add skeleton iOS viewer project.
Support cross compiling for iPhone and iPad targets using the makefile.
Diffstat (limited to 'ios')
-rw-r--r--ios/Info.plist32
-rwxr-xr-xios/MuPDF.xcodeproj/project.pbxproj329
-rw-r--r--ios/build_libs.sh17
-rw-r--r--ios/main.m212
-rw-r--r--ios/mupdf_icon.pngbin0 -> 2756 bytes
5 files changed, 590 insertions, 0 deletions
diff --git a/ios/Info.plist b/ios/Info.plist
new file mode 100644
index 00000000..2c84fd8c
--- /dev/null
+++ b/ios/Info.plist
@@ -0,0 +1,32 @@
+<?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>UIRequiredDeviceCapabilities</key>
+ <array>
+ <string>armv7</string>
+ </array>
+ <key>UIFileSharingEnabled</key>
+ <true/>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleDisplayName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundleExecutable</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIconFile</key>
+ <string>mupdf_icon.png</string>
+ <key>CFBundleIdentifier</key>
+ <string>com.artifex.${PRODUCT_NAME:rfc1034identifier}</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1.0</string>
+</dict>
+</plist>
diff --git a/ios/MuPDF.xcodeproj/project.pbxproj b/ios/MuPDF.xcodeproj/project.pbxproj
new file mode 100755
index 00000000..5b4f842d
--- /dev/null
+++ b/ios/MuPDF.xcodeproj/project.pbxproj
@@ -0,0 +1,329 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 46;
+ objects = {
+
+/* Begin PBXAggregateTarget section */
+ 969E1929141FB5E200189AA3 /* Libraries */ = {
+ isa = PBXAggregateTarget;
+ buildConfigurationList = 969E1934141FB62400189AA3 /* Build configuration list for PBXAggregateTarget "Libraries" */;
+ buildPhases = (
+ 96165BEE143B4F3D00699814 /* ShellScript */,
+ );
+ dependencies = (
+ );
+ name = Libraries;
+ productName = Libraries;
+ };
+/* End PBXAggregateTarget section */
+
+/* Begin PBXBuildFile section */
+ 1D60589B0D05DD56006BFB54 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; };
+ 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; };
+ 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; };
+ 288765FD0DF74451002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765FC0DF74451002DB57D /* CoreGraphics.framework */; };
+ 968184A3143E251A00374B41 /* libfitz.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9681849B143E251A00374B41 /* libfitz.a */; };
+ 968184A4143E251A00374B41 /* libfreetype.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9681849C143E251A00374B41 /* libfreetype.a */; };
+ 968184A5143E251A00374B41 /* libjbig2dec.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9681849D143E251A00374B41 /* libjbig2dec.a */; };
+ 968184A6143E251A00374B41 /* libjpeg.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9681849E143E251A00374B41 /* libjpeg.a */; };
+ 968184A7143E251A00374B41 /* libmupdf.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9681849F143E251A00374B41 /* libmupdf.a */; };
+ 968184A8143E251A00374B41 /* libmuxps.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 968184A0143E251A00374B41 /* libmuxps.a */; };
+ 968184A9143E251A00374B41 /* libopenjpeg.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 968184A1143E251A00374B41 /* libopenjpeg.a */; };
+ 968184AA143E251A00374B41 /* libz.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 968184A2143E251A00374B41 /* libz.a */; };
+ 969E1294141FA57800189AA3 /* mupdf_icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 969E1293141FA57800189AA3 /* mupdf_icon.png */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXFileReference section */
+ 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
+ 1D6058910D05DD3D006BFB54 /* MuPDF.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MuPDF.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
+ 288765FC0DF74451002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
+ 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
+ 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = "<group>"; };
+ 96165BEB143B4F2800699814 /* build_libs.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = build_libs.sh; sourceTree = "<group>"; };
+ 9681849B143E251A00374B41 /* libfitz.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libfitz.a; path = "build/Debug-iphonesimulator/libfitz.a"; sourceTree = "<group>"; };
+ 9681849C143E251A00374B41 /* libfreetype.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libfreetype.a; path = "build/Debug-iphonesimulator/libfreetype.a"; sourceTree = "<group>"; };
+ 9681849D143E251A00374B41 /* libjbig2dec.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libjbig2dec.a; path = "build/Debug-iphonesimulator/libjbig2dec.a"; sourceTree = "<group>"; };
+ 9681849E143E251A00374B41 /* libjpeg.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libjpeg.a; path = "build/Debug-iphonesimulator/libjpeg.a"; sourceTree = "<group>"; };
+ 9681849F143E251A00374B41 /* libmupdf.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libmupdf.a; path = "build/Debug-iphonesimulator/libmupdf.a"; sourceTree = "<group>"; };
+ 968184A0143E251A00374B41 /* libmuxps.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libmuxps.a; path = "build/Debug-iphonesimulator/libmuxps.a"; sourceTree = "<group>"; };
+ 968184A1143E251A00374B41 /* libopenjpeg.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libopenjpeg.a; path = "build/Debug-iphonesimulator/libopenjpeg.a"; sourceTree = "<group>"; };
+ 968184A2143E251A00374B41 /* libz.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libz.a; path = "build/Debug-iphonesimulator/libz.a"; sourceTree = "<group>"; };
+ 969E1293141FA57800189AA3 /* mupdf_icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = mupdf_icon.png; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 1D60588F0D05DD3D006BFB54 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */,
+ 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */,
+ 288765FD0DF74451002DB57D /* CoreGraphics.framework in Frameworks */,
+ 968184A3143E251A00374B41 /* libfitz.a in Frameworks */,
+ 968184A4143E251A00374B41 /* libfreetype.a in Frameworks */,
+ 968184A5143E251A00374B41 /* libjbig2dec.a in Frameworks */,
+ 968184A6143E251A00374B41 /* libjpeg.a in Frameworks */,
+ 968184A7143E251A00374B41 /* libmupdf.a in Frameworks */,
+ 968184A8143E251A00374B41 /* libmuxps.a in Frameworks */,
+ 968184A9143E251A00374B41 /* libopenjpeg.a in Frameworks */,
+ 968184AA143E251A00374B41 /* libz.a in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 19C28FACFE9D520D11CA2CBB /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 9681849B143E251A00374B41 /* libfitz.a */,
+ 9681849C143E251A00374B41 /* libfreetype.a */,
+ 9681849D143E251A00374B41 /* libjbig2dec.a */,
+ 9681849E143E251A00374B41 /* libjpeg.a */,
+ 9681849F143E251A00374B41 /* libmupdf.a */,
+ 968184A0143E251A00374B41 /* libmuxps.a */,
+ 968184A1143E251A00374B41 /* libopenjpeg.a */,
+ 968184A2143E251A00374B41 /* libz.a */,
+ 1D6058910D05DD3D006BFB54 /* MuPDF.app */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = {
+ isa = PBXGroup;
+ children = (
+ 29B97315FDCFA39411CA2CEA /* Sources */,
+ 29B97323FDCFA39411CA2CEA /* Frameworks */,
+ 19C28FACFE9D520D11CA2CBB /* Products */,
+ );
+ name = CustomTemplate;
+ sourceTree = "<group>";
+ };
+ 29B97315FDCFA39411CA2CEA /* Sources */ = {
+ isa = PBXGroup;
+ children = (
+ 96165BEB143B4F2800699814 /* build_libs.sh */,
+ 969E1293141FA57800189AA3 /* mupdf_icon.png */,
+ 8D1107310486CEB800E47090 /* Info.plist */,
+ 29B97316FDCFA39411CA2CEA /* main.m */,
+ );
+ name = Sources;
+ sourceTree = "<group>";
+ };
+ 29B97323FDCFA39411CA2CEA /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */,
+ 1D30AB110D05D00D00671497 /* Foundation.framework */,
+ 288765FC0DF74451002DB57D /* CoreGraphics.framework */,
+ );
+ name = Frameworks;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 1D6058900D05DD3D006BFB54 /* MuPDF */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "MuPDF" */;
+ buildPhases = (
+ 1D60588D0D05DD3D006BFB54 /* Resources */,
+ 1D60588E0D05DD3D006BFB54 /* Sources */,
+ 1D60588F0D05DD3D006BFB54 /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = MuPDF;
+ productName = MuPDF;
+ productReference = 1D6058910D05DD3D006BFB54 /* MuPDF.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 29B97313FDCFA39411CA2CEA /* Project object */ = {
+ isa = PBXProject;
+ buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "MuPDF" */;
+ compatibilityVersion = "Xcode 3.2";
+ developmentRegion = English;
+ hasScannedForEncodings = 1;
+ knownRegions = (
+ English,
+ Japanese,
+ French,
+ German,
+ );
+ mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 1D6058900D05DD3D006BFB54 /* MuPDF */,
+ 969E1929141FB5E200189AA3 /* Libraries */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 1D60588D0D05DD3D006BFB54 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 969E1294141FA57800189AA3 /* mupdf_icon.png in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXShellScriptBuildPhase section */
+ 96165BEE143B4F3D00699814 /* ShellScript */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ );
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "sh build_libs.sh\n";
+ };
+/* End PBXShellScriptBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 1D60588E0D05DD3D006BFB54 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 1D60589B0D05DD56006BFB54 /* main.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin XCBuildConfiguration section */
+ 1D6058940D05DD3E006BFB54 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ COPY_PHASE_STRIP = NO;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ HEADER_SEARCH_PATHS = ..;
+ INFOPLIST_FILE = Info.plist;
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SRCROOT)/build/Debug-iphonesimulator\"",
+ );
+ PRODUCT_NAME = MuPDF;
+ SDKROOT = iphoneos;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ };
+ name = Debug;
+ };
+ 1D6058950D05DD3E006BFB54 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ COPY_PHASE_STRIP = YES;
+ INFOPLIST_FILE = Info.plist;
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SRCROOT)/build/Debug-iphonesimulator\"",
+ );
+ PRODUCT_NAME = MuPDF;
+ SDKROOT = iphoneos;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ VALIDATE_PRODUCT = YES;
+ };
+ name = Release;
+ };
+ 969E192A141FB5E200189AA3 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ COPY_PHASE_STRIP = NO;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ PRODUCT_NAME = Libraries;
+ };
+ name = Debug;
+ };
+ 969E192B141FB5E200189AA3 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ COPY_PHASE_STRIP = YES;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ GCC_ENABLE_FIX_AND_CONTINUE = NO;
+ PRODUCT_NAME = Libraries;
+ ZERO_LINK = NO;
+ };
+ name = Release;
+ };
+ C01FCF4F08A954540054247B /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ GCC_C_LANGUAGE_STANDARD = c99;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ PREBINDING = NO;
+ SDKROOT = iphoneos4.3;
+ };
+ name = Debug;
+ };
+ C01FCF5008A954540054247B /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ GCC_C_LANGUAGE_STANDARD = c99;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
+ PREBINDING = NO;
+ SDKROOT = iphoneos4.3;
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "MuPDF" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 1D6058940D05DD3E006BFB54 /* Debug */,
+ 1D6058950D05DD3E006BFB54 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 969E1934141FB62400189AA3 /* Build configuration list for PBXAggregateTarget "Libraries" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 969E192A141FB5E200189AA3 /* Debug */,
+ 969E192B141FB5E200189AA3 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ C01FCF4E08A954540054247B /* Build configuration list for PBXProject "MuPDF" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ C01FCF4F08A954540054247B /* Debug */,
+ C01FCF5008A954540054247B /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 29B97313FDCFA39411CA2CEA /* Project object */;
+}
diff --git a/ios/build_libs.sh b/ios/build_libs.sh
new file mode 100644
index 00000000..0a7f74f0
--- /dev/null
+++ b/ios/build_libs.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+# Call this script from a "Run Script" target in the Xcode project to
+# set up the environment and use the regular makefile to cross compile
+# MuPDF and third party libraries.
+
+# Ensure we have all the generated cmap and font files from a
+# regular build.
+make -C .. generate
+
+OS=$(basename $PLATFORM_DIR | sed s/\.platform// | tr A-Z a-z)
+build=$(echo $BUILD_STYLE | tr A-Z a-z)
+make -C .. CROSSCOMPILE=yes libs || exit 1
+mkdir -p "$BUILT_PRODUCTS_DIR"
+cp ../build/$build-$OS/lib*.a "$BUILT_PRODUCTS_DIR"
+
+echo Done.
diff --git a/ios/main.m b/ios/main.m
new file mode 100644
index 00000000..b03fd42c
--- /dev/null
+++ b/ios/main.m
@@ -0,0 +1,212 @@
+#import <UIKit/UIKit.h>
+
+#undef ABS
+#undef MIN
+#undef MAX
+
+#include "fitz/fitz.h"
+#include "pdf/mupdf.h"
+#include "xps/muxps.h"
+
+@interface MuOutline : UITableViewController
+{
+}
+@end
+
+@interface MuDocument : UIViewController
+{
+}
+@end
+
+@interface MuLibrary : UITableViewController
+{
+ NSArray *files;
+}
+@end
+
+@interface MuAppDelegate : NSObject <UIApplicationDelegate>
+{
+ UIWindow *window;
+ UINavigationController *navigator;
+ MuLibrary *library;
+ MuDocument *document;
+ MuOutline *outline;
+}
+- (void) doOpenDocument: (NSString*)filename;
+- (void) doCloseDocument;
+- (void) doShowOutline;
+- (void) doHideOutline;
+@end
+
+static MuAppDelegate *app = nil;
+
+#pragma mark -
+
+@implementation MuOutline
+@end
+
+@implementation MuDocument
+@end
+
+#pragma mark -
+
+@implementation MuLibrary
+
+- (void) viewDidLoad
+{
+ [super viewDidLoad];
+
+ [self setTitle: @"Library"];
+
+ NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
+ NSString *docdir = [paths objectAtIndex: 0];
+ NSError *error = nil;
+ files = [[NSFileManager defaultManager] contentsOfDirectoryAtPath: docdir error: &error];
+ if (error)
+ files = paths;
+ [files retain];
+}
+
+- (void) dealloc
+{
+ [files release];
+ [super dealloc];
+}
+
+- (NSInteger) numberOfSectionsInTableView: (UITableView*)tableView
+{
+ return 1;
+}
+
+- (NSInteger) tableView: (UITableView*)tableView numberOfRowsInSection:(NSInteger)section
+{
+ return [files count];
+}
+
+- (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];
+ NSString *value = [files objectAtIndex: [indexPath row]];
+ [[cell textLabel] setText: value];
+ return cell;
+}
+
+- (void) tableView: (UITableView*)tableView didSelectRowAtIndexPath: (NSIndexPath*)indexPath
+{
+ NSString *filename = [files objectAtIndex: [indexPath row]];
+ [app doOpenDocument: filename];
+}
+
+@end
+
+#pragma mark -
+
+@implementation MuAppDelegate
+
+- (BOOL) application: (UIApplication*)application didFinishLaunchingWithOptions: (NSDictionary*)launchOptions
+{
+ app = self;
+
+ library = [[MuLibrary alloc] initWithStyle: UITableViewStylePlain];
+
+ document = [[MuDocument alloc] init];
+ [[document view] setBackgroundColor: [UIColor yellowColor]];
+
+ outline = [[MuOutline alloc] initWithStyle: UITableViewStylePlain];
+
+ navigator = [[UINavigationController alloc] initWithRootViewController: library];
+
+ window = [[UIWindow alloc] initWithFrame: [[UIScreen mainScreen] bounds]];
+ [window addSubview: [navigator view]];
+ [window makeKeyAndVisible];
+
+ return YES;
+}
+
+// [library presentModalViewController: document animated: NO];
+// [library dismissModalViewControllerAnimated: NO];
+
+- (void) doShowOutline
+{
+ [outline setTitle: @"Table of Contents"];
+ [navigator pushViewController: document animated: YES];
+}
+
+- (void) doHideOutline
+{
+ [navigator popViewControllerAnimated: YES];
+}
+
+- (void) doOpenDocument: (NSString*)filename
+{
+ [document setTitle: filename];
+ [navigator pushViewController: document animated: YES];
+}
+
+- (void) doCloseDocument
+{
+ [navigator popViewControllerAnimated: YES];
+}
+
+- (void)applicationDidEnterBackground:(UIApplication *)application {
+ /*
+ Use this method to release shared resources, save user data, invalidate timers,
+ and store enough application state information to restore your application to
+ its current state in case it is terminated later.
+ If your application supports background execution,
+ called instead of applicationWillTerminate: when the user quits.
+ */
+}
+
+- (void)applicationWillEnterForeground:(UIApplication *)application {
+ /*
+ Called as part of transition from the background to the
+ inactive state: here you can undo many of the changes made
+ on entering the background.
+ */
+}
+
+- (void)applicationDidBecomeActive:(UIApplication *)application {
+ /*
+ Restart any tasks that were paused (or not yet started) while
+ the application was inactive. If the application was previously
+ in the background, optionally refresh the user interface.
+ */
+}
+
+- (void)applicationWillTerminate:(UIApplication *)application {
+ /*
+ Called when the application is about to terminate.
+ See also applicationDidEnterBackground:.
+ */
+}
+
+- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application {
+ /*
+ Free up as much memory as possible by purging cached data objects that can
+ be recreated (or reloaded from disk) later.
+ */
+}
+
+- (void) dealloc
+{
+ [document release];
+ [library release];
+ [window release];
+ [super dealloc];
+}
+
+@end
+
+#pragma mark -
+
+int main(int argc, char *argv[])
+{
+ NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
+ int retVal = UIApplicationMain(argc, argv, nil, @"MuAppDelegate");
+ [pool release];
+ return retVal;
+}
diff --git a/ios/mupdf_icon.png b/ios/mupdf_icon.png
new file mode 100644
index 00000000..b5e314de
--- /dev/null
+++ b/ios/mupdf_icon.png
Binary files differ