summaryrefslogtreecommitdiff
path: root/apps/macosx
diff options
context:
space:
mode:
Diffstat (limited to 'apps/macosx')
-rw-r--r--apps/macosx/macpdf.app/Contents/Info.plist44
-rw-r--r--apps/macosx/macpdf.app/Contents/PkgInfo1
-rw-r--r--apps/macosx/macpdf.app/Contents/Resources/English.lproj/InfoPlist.strings7
-rw-r--r--apps/macosx/macpdf.app/Contents/Resources/English.lproj/main.nib/classes.nib4
-rw-r--r--apps/macosx/macpdf.app/Contents/Resources/English.lproj/main.nib/info.nib24
-rw-r--r--apps/macosx/macpdf.app/Contents/Resources/English.lproj/main.nib/objects.xib516
-rw-r--r--apps/macosx/macpdf.app/Contents/Resources/macpdf.icnsbin0 -> 31574 bytes
-rw-r--r--apps/macosx/macpdf.c613
8 files changed, 1209 insertions, 0 deletions
diff --git a/apps/macosx/macpdf.app/Contents/Info.plist b/apps/macosx/macpdf.app/Contents/Info.plist
new file mode 100644
index 00000000..dc789640
--- /dev/null
+++ b/apps/macosx/macpdf.app/Contents/Info.plist
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleExecutable</key>
+ <string>macpdf</string>
+ <key>CFBundleIconFile</key>
+ <string>macpdf.icns</string>
+ <key>CFBundleIdentifier</key>
+ <string>com.artofcode.MuPDF</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>0.1</string>
+ <key>CSResourcesFileMapped</key>
+ <true/>
+
+ <key>CFBundleDocumentTypes</key>
+ <array>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>pdf</string>
+ </array>
+ <key>CFBundleTypeIconFile</key>
+ <string>macpdf.icns</string>
+ <key>CFBundleTypeName</key>
+ <string>PDF Document</string>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ </dict>
+ </array>
+
+ <key>NSAppleScriptEnabled</key>
+ <string>YES</string>
+
+</dict>
+</plist>
diff --git a/apps/macosx/macpdf.app/Contents/PkgInfo b/apps/macosx/macpdf.app/Contents/PkgInfo
new file mode 100644
index 00000000..bd04210f
--- /dev/null
+++ b/apps/macosx/macpdf.app/Contents/PkgInfo
@@ -0,0 +1 @@
+APPL???? \ No newline at end of file
diff --git a/apps/macosx/macpdf.app/Contents/Resources/English.lproj/InfoPlist.strings b/apps/macosx/macpdf.app/Contents/Resources/English.lproj/InfoPlist.strings
new file mode 100644
index 00000000..ca333a5d
--- /dev/null
+++ b/apps/macosx/macpdf.app/Contents/Resources/English.lproj/InfoPlist.strings
@@ -0,0 +1,7 @@
+/* Localized versions of Info.plist keys */
+
+CFBundleName = "MuPDF";
+CFBundleShortVersionString = "MuPDF version 1.0.0";
+CFBundleGetInfoString = "Copyright (C) 2005 Tor & Raph.";
+NSHumanReadableCopyright = "Copyright (C) 2005 Tor & Raph.";
+
diff --git a/apps/macosx/macpdf.app/Contents/Resources/English.lproj/main.nib/classes.nib b/apps/macosx/macpdf.app/Contents/Resources/English.lproj/main.nib/classes.nib
new file mode 100644
index 00000000..ea58db11
--- /dev/null
+++ b/apps/macosx/macpdf.app/Contents/Resources/English.lproj/main.nib/classes.nib
@@ -0,0 +1,4 @@
+{
+IBClasses = ();
+IBVersion = 1;
+}
diff --git a/apps/macosx/macpdf.app/Contents/Resources/English.lproj/main.nib/info.nib b/apps/macosx/macpdf.app/Contents/Resources/English.lproj/main.nib/info.nib
new file mode 100644
index 00000000..8d83474f
--- /dev/null
+++ b/apps/macosx/macpdf.app/Contents/Resources/English.lproj/main.nib/info.nib
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>IBDocumentLocation</key>
+ <string>54 19 356 240 0 0 1024 746 </string>
+ <key>IBEditorPositions</key>
+ <dict>
+ <key>29</key>
+ <string>15 273 218 44 0 0 1024 746 </string>
+ </dict>
+ <key>IBFramework Version</key>
+ <string>349.0</string>
+ <key>IBOpenObjects</key>
+ <array>
+ <integer>29</integer>
+ <integer>231</integer>
+ </array>
+ <key>IBSystem Version</key>
+ <string>7S215</string>
+ <key>targetFramework</key>
+ <string>IBCarbonFramework</string>
+</dict>
+</plist>
diff --git a/apps/macosx/macpdf.app/Contents/Resources/English.lproj/main.nib/objects.xib b/apps/macosx/macpdf.app/Contents/Resources/English.lproj/main.nib/objects.xib
new file mode 100644
index 00000000..6e3aad82
--- /dev/null
+++ b/apps/macosx/macpdf.app/Contents/Resources/English.lproj/main.nib/objects.xib
@@ -0,0 +1,516 @@
+<?xml version="1.0" standalone="yes"?>
+<object class="NSIBObjectData">
+ <string name="targetFramework">IBCarbonFramework</string>
+ <object name="rootObject" class="NSCustomObject" id="1">
+ <string name="customClass">NSApplication</string>
+ </object>
+ <array count="58" name="allObjects">
+ <object class="IBCarbonMenu" id="29">
+ <string name="title">MuPDF</string>
+ <array count="4" name="items">
+ <object class="IBCarbonMenuItem" id="185">
+ <string name="title">MuPDF</string>
+ <object name="submenu" class="IBCarbonMenu" id="184">
+ <string name="title">MuPDF</string>
+ <array count="1" name="items">
+ <object class="IBCarbonMenuItem" id="187">
+ <boolean name="updateSingleItem">TRUE</boolean>
+ <string name="title">About MuPDF</string>
+ <int name="keyEquivalentModifier">0</int>
+ <ostype name="command">abou</ostype>
+ </object>
+ </array>
+ <string name="name">_NSAppleMenu</string>
+ </object>
+ </object>
+ <object class="IBCarbonMenuItem" id="127">
+ <string name="title">File</string>
+ <object name="submenu" class="IBCarbonMenu" id="131">
+ <string name="title">File</string>
+ <array count="10" name="items">
+ <object class="IBCarbonMenuItem" id="139">
+ <boolean name="updateSingleItem">TRUE</boolean>
+ <string name="title">New</string>
+ <string name="keyEquivalent">n</string>
+ <ostype name="command">new </ostype>
+ </object>
+ <object class="IBCarbonMenuItem" id="134">
+ <boolean name="updateSingleItem">TRUE</boolean>
+ <string name="title">Open…</string>
+ <string name="keyEquivalent">o</string>
+ <ostype name="command">open</ostype>
+ </object>
+ <object class="IBCarbonMenuItem" id="133">
+ <boolean name="separator">TRUE</boolean>
+ </object>
+ <object class="IBCarbonMenuItem" id="130">
+ <boolean name="updateSingleItem">TRUE</boolean>
+ <string name="title">Close</string>
+ <string name="keyEquivalent">w</string>
+ <ostype name="command">clos</ostype>
+ </object>
+ <object class="IBCarbonMenuItem" id="138">
+ <boolean name="updateSingleItem">TRUE</boolean>
+ <string name="title">Save</string>
+ <string name="keyEquivalent">s</string>
+ <ostype name="command">save</ostype>
+ </object>
+ <object class="IBCarbonMenuItem" id="137">
+ <boolean name="updateSingleItem">TRUE</boolean>
+ <string name="title">Save As…</string>
+ <string name="keyEquivalent">S</string>
+ <ostype name="command">svas</ostype>
+ </object>
+ <object class="IBCarbonMenuItem" id="132">
+ <boolean name="updateSingleItem">TRUE</boolean>
+ <string name="title">Revert</string>
+ <string name="keyEquivalent">r</string>
+ <ostype name="command">rvrt</ostype>
+ </object>
+ <object class="IBCarbonMenuItem" id="128">
+ <boolean name="separator">TRUE</boolean>
+ </object>
+ <object class="IBCarbonMenuItem" id="135">
+ <boolean name="updateSingleItem">TRUE</boolean>
+ <string name="title">Page Setup…</string>
+ <string name="keyEquivalent">P</string>
+ <ostype name="command">page</ostype>
+ </object>
+ <object class="IBCarbonMenuItem" id="136">
+ <boolean name="updateSingleItem">TRUE</boolean>
+ <string name="title">Print…</string>
+ <string name="keyEquivalent">p</string>
+ <ostype name="command">prnt</ostype>
+ </object>
+ </array>
+ </object>
+ </object>
+ <object class="IBCarbonMenuItem" id="152">
+ <string name="title">Edit</string>
+ <object name="submenu" class="IBCarbonMenu" id="147">
+ <string name="title">Edit</string>
+ <array count="10" name="items">
+ <object class="IBCarbonMenuItem" id="141">
+ <boolean name="updateSingleItem">TRUE</boolean>
+ <string name="title">Undo</string>
+ <string name="keyEquivalent">z</string>
+ <ostype name="command">undo</ostype>
+ </object>
+ <object class="IBCarbonMenuItem" id="146">
+ <boolean name="updateSingleItem">TRUE</boolean>
+ <string name="title">Redo</string>
+ <string name="keyEquivalent">Z</string>
+ <ostype name="command">redo</ostype>
+ </object>
+ <object class="IBCarbonMenuItem" id="142">
+ <boolean name="separator">TRUE</boolean>
+ </object>
+ <object class="IBCarbonMenuItem" id="143">
+ <boolean name="updateSingleItem">TRUE</boolean>
+ <string name="title">Cut</string>
+ <string name="keyEquivalent">x</string>
+ <ostype name="command">cut </ostype>
+ </object>
+ <object class="IBCarbonMenuItem" id="149">
+ <boolean name="updateSingleItem">TRUE</boolean>
+ <string name="title">Copy</string>
+ <string name="keyEquivalent">c</string>
+ <ostype name="command">copy</ostype>
+ </object>
+ <object class="IBCarbonMenuItem" id="144">
+ <boolean name="updateSingleItem">TRUE</boolean>
+ <string name="title">Paste</string>
+ <string name="keyEquivalent">v</string>
+ <ostype name="command">past</ostype>
+ </object>
+ <object class="IBCarbonMenuItem" id="151">
+ <boolean name="updateSingleItem">TRUE</boolean>
+ <string name="title">Delete</string>
+ <ostype name="command">clea</ostype>
+ </object>
+ <object class="IBCarbonMenuItem" id="148">
+ <boolean name="updateSingleItem">TRUE</boolean>
+ <string name="title">Select All</string>
+ <string name="keyEquivalent">a</string>
+ <ostype name="command">sall</ostype>
+ </object>
+ <object class="IBCarbonMenuItem" id="192">
+ <boolean name="separator">TRUE</boolean>
+ </object>
+ <object class="IBCarbonMenuItem" id="191">
+ <boolean name="updateSingleItem">TRUE</boolean>
+ <string name="title">Special Characters…</string>
+ <ostype name="command">chrp</ostype>
+ </object>
+ </array>
+ </object>
+ </object>
+ <object class="IBCarbonMenuItem" id="153">
+ <string name="title">Window</string>
+ <object name="submenu" class="IBCarbonMenu" id="154">
+ <string name="title">Window</string>
+ <array count="6" name="items">
+ <object class="IBCarbonMenuItem" id="155">
+ <boolean name="dynamic">TRUE</boolean>
+ <boolean name="updateSingleItem">TRUE</boolean>
+ <string name="title">Minimize Window</string>
+ <string name="keyEquivalent">m</string>
+ <ostype name="command">mini</ostype>
+ </object>
+ <object class="IBCarbonMenuItem" id="188">
+ <boolean name="dynamic">TRUE</boolean>
+ <boolean name="updateSingleItem">TRUE</boolean>
+ <string name="title">Minimize All Windows</string>
+ <string name="keyEquivalent">m</string>
+ <int name="keyEquivalentModifier">1572864</int>
+ <ostype name="command">mina</ostype>
+ </object>
+ <object class="IBCarbonMenuItem" id="190">
+ <boolean name="updateSingleItem">TRUE</boolean>
+ <string name="title">Zoom</string>
+ <ostype name="command">zoom</ostype>
+ </object>
+ <object class="IBCarbonMenuItem" id="156">
+ <boolean name="separator">TRUE</boolean>
+ </object>
+ <object class="IBCarbonMenuItem" id="157">
+ <boolean name="dynamic">TRUE</boolean>
+ <boolean name="updateSingleItem">TRUE</boolean>
+ <string name="title">Bring All to Front</string>
+ <ostype name="command">bfrt</ostype>
+ </object>
+ <object class="IBCarbonMenuItem" id="189">
+ <boolean name="dynamic">TRUE</boolean>
+ <boolean name="updateSingleItem">TRUE</boolean>
+ <string name="title">Arrange in Front</string>
+ <int name="keyEquivalentModifier">1572864</int>
+ <ostype name="command">frnt</ostype>
+ </object>
+ </array>
+ <string name="name">_NSWindowsMenu</string>
+ </object>
+ </object>
+ </array>
+ <string name="name">_NSMainMenu</string>
+ </object>
+ <reference idRef="127"/>
+ <reference idRef="128"/>
+ <reference idRef="130"/>
+ <reference idRef="131"/>
+ <reference idRef="132"/>
+ <reference idRef="133"/>
+ <reference idRef="134"/>
+ <reference idRef="135"/>
+ <reference idRef="136"/>
+ <reference idRef="137"/>
+ <reference idRef="138"/>
+ <reference idRef="139"/>
+ <reference idRef="141"/>
+ <reference idRef="142"/>
+ <reference idRef="143"/>
+ <reference idRef="144"/>
+ <reference idRef="146"/>
+ <reference idRef="147"/>
+ <reference idRef="148"/>
+ <reference idRef="149"/>
+ <reference idRef="151"/>
+ <reference idRef="152"/>
+ <reference idRef="153"/>
+ <reference idRef="154"/>
+ <reference idRef="155"/>
+ <reference idRef="156"/>
+ <reference idRef="157"/>
+ <object class="IBCarbonWindow" id="166">
+ <string name="windowRect">56 24 553 587 </string>
+ <string name="title">Window</string>
+ <object name="rootControl" class="IBCarbonRootControl" id="167">
+ <string name="bounds">0 0 497 563 </string>
+ <string name="viewFrame">0 0 563 497 </string>
+ <array count="13" name="subviews">
+ <object class="IBCarbonScrollBar" id="197">
+ <string name="bounds">482 248 497 549 </string>
+ <string name="viewFrame">248 482 301 15 </string>
+ <object name="layoutInfo" class="IBCarbonHILayoutInfo">
+ <int name="bindingLeftKind">1</int>
+ <int name="bindingBottomKind">2</int>
+ <int name="bindingRightKind">2</int>
+ </object>
+ </object>
+ <object class="IBCarbonScrollBar" id="198">
+ <string name="bounds">-1 548 483 563 </string>
+ <string name="viewFrame">548 -1 15 484 </string>
+ <object name="layoutInfo" class="IBCarbonHILayoutInfo">
+ <int name="bindingTopKind">1</int>
+ <int name="bindingBottomKind">2</int>
+ <int name="bindingRightKind">2</int>
+ </object>
+ </object>
+ <object class="IBCarbonBevelButton" id="201">
+ <string name="bounds">482 23 498 47 </string>
+ <string name="viewFrame">23 482 24 16 </string>
+ <string name="title">&lt;</string>
+ <object name="layoutInfo" class="IBCarbonHILayoutInfo">
+ <int name="bindingLeftKind">1</int>
+ <int name="bindingBottomKind">2</int>
+ </object>
+ <int name="contentType">0</int>
+ <int name="textPlacement">3</int>
+ </object>
+ <object class="IBCarbonBevelButton" id="204">
+ <string name="bounds">482 46 498 70 </string>
+ <string name="viewFrame">46 482 24 16 </string>
+ <string name="title">&gt;</string>
+ <object name="layoutInfo" class="IBCarbonHILayoutInfo">
+ <int name="bindingBottomKind">2</int>
+ </object>
+ <int name="contentType">0</int>
+ <int name="textPlacement">3</int>
+ </object>
+ <object class="IBCarbonBevelButton" id="205">
+ <string name="bounds">482 92 498 112 </string>
+ <string name="viewFrame">92 482 20 16 </string>
+ <string name="title">(</string>
+ <object name="layoutInfo" class="IBCarbonHILayoutInfo">
+ <int name="bindingBottomKind">2</int>
+ </object>
+ <int name="contentType">0</int>
+ <int name="textPlacement">3</int>
+ </object>
+ <object class="IBCarbonBevelButton" id="206">
+ <string name="bounds">482 111 498 131 </string>
+ <string name="viewFrame">111 482 20 16 </string>
+ <string name="title">)</string>
+ <object name="layoutInfo" class="IBCarbonHILayoutInfo">
+ <int name="bindingBottomKind">2</int>
+ </object>
+ <int name="contentType">0</int>
+ <int name="textPlacement">3</int>
+ </object>
+ <object class="IBCarbonEditText" id="209">
+ <string name="bounds">485 199 495 237 </string>
+ <string name="viewFrame">199 485 38 10 </string>
+ <boolean name="small">TRUE</boolean>
+ <int name="controlSize">3</int>
+ <object name="layoutInfo" class="IBCarbonHILayoutInfo">
+ <int name="bindingBottomKind">2</int>
+ </object>
+ <boolean name="isUnicode">TRUE</boolean>
+ </object>
+ <object class="IBCarbonBevelButton" id="210">
+ <string name="bounds">482 0 498 24 </string>
+ <string name="viewFrame">0 482 24 16 </string>
+ <string name="title">&lt;&lt;</string>
+ <object name="layoutInfo" class="IBCarbonHILayoutInfo">
+ <int name="bindingLeftKind">1</int>
+ <int name="bindingBottomKind">2</int>
+ </object>
+ <int name="contentType">0</int>
+ <int name="textPlacement">3</int>
+ </object>
+ <object class="IBCarbonBevelButton" id="211">
+ <string name="bounds">482 69 498 93 </string>
+ <string name="viewFrame">69 482 24 16 </string>
+ <string name="title">&gt;&gt;</string>
+ <object name="layoutInfo" class="IBCarbonHILayoutInfo">
+ <int name="bindingBottomKind">2</int>
+ </object>
+ <int name="contentType">0</int>
+ <int name="textPlacement">3</int>
+ </object>
+ <object class="IBCarbonBevelButton" id="227">
+ <string name="bounds">482 168 498 188 </string>
+ <string name="viewFrame">168 482 20 16 </string>
+ <string name="title">+</string>
+ <object name="layoutInfo" class="IBCarbonHILayoutInfo">
+ <int name="bindingBottomKind">2</int>
+ </object>
+ <int name="contentType">0</int>
+ <int name="textPlacement">3</int>
+ </object>
+ <object class="IBCarbonBevelButton" id="228">
+ <string name="bounds">482 130 498 150 </string>
+ <string name="viewFrame">130 482 20 16 </string>
+ <string name="title">-</string>
+ <object name="layoutInfo" class="IBCarbonHILayoutInfo">
+ <int name="bindingBottomKind">2</int>
+ </object>
+ <int name="contentType">0</int>
+ <int name="textPlacement">3</int>
+ </object>
+ <object class="IBCarbonBevelButton" id="229">
+ <string name="bounds">482 149 498 169 </string>
+ <string name="viewFrame">149 482 20 16 </string>
+ <string name="title">%</string>
+ <object name="layoutInfo" class="IBCarbonHILayoutInfo">
+ <int name="bindingBottomKind">2</int>
+ </object>
+ <int name="contentType">0</int>
+ <int name="textPlacement">3</int>
+ </object>
+ <object class="IBCarbonHIView" id="230">
+ <string name="bounds">0 0 484 549 </string>
+ <string name="viewFrame">0 0 549 484 </string>
+ <ostype name="controlSignature">Poof</ostype>
+ <int name="controlID">666</int>
+ <object name="layoutInfo" class="IBCarbonHILayoutInfo">
+ <int name="bindingTopKind">1</int>
+ <int name="bindingLeftKind">1</int>
+ <int name="bindingBottomKind">2</int>
+ <int name="bindingRightKind">2</int>
+ </object>
+ <string name="classID">com.artofcode.mupdf.View</string>
+ </object>
+ </array>
+ </object>
+ <boolean name="receiveUpdates">FALSE</boolean>
+ <boolean name="liveResize">TRUE</boolean>
+ <boolean name="compositing">TRUE</boolean>
+ <boolean name="isConstrained">FALSE</boolean>
+ </object>
+ <reference idRef="167"/>
+ <reference idRef="184"/>
+ <reference idRef="185"/>
+ <reference idRef="187"/>
+ <reference idRef="188"/>
+ <reference idRef="189"/>
+ <reference idRef="190"/>
+ <reference idRef="191"/>
+ <reference idRef="192"/>
+ <reference idRef="197"/>
+ <reference idRef="198"/>
+ <reference idRef="201"/>
+ <reference idRef="204"/>
+ <reference idRef="205"/>
+ <reference idRef="206"/>
+ <reference idRef="209"/>
+ <reference idRef="210"/>
+ <reference idRef="211"/>
+ <reference idRef="227"/>
+ <reference idRef="228"/>
+ <reference idRef="229"/>
+ <reference idRef="230"/>
+ <object class="IBCarbonWindow" id="231">
+ <string name="windowRect">200 83 330 337 </string>
+ <string name="title">Password</string>
+ <object name="rootControl" class="IBCarbonRootControl" id="232">
+ <string name="bounds">0 0 130 254 </string>
+ <string name="viewFrame">0 0 254 130 </string>
+ <array count="5" name="subviews">
+ <object class="IBCarbonStaticText" id="233">
+ <string name="bounds">20 20 36 234 </string>
+ <string name="viewFrame">20 20 214 16 </string>
+ <string name="title">This PDF document is encrypted.</string>
+ </object>
+ <object class="IBCarbonStaticText" id="234">
+ <string name="bounds">50 32 66 146 </string>
+ <string name="viewFrame">32 50 114 16 </string>
+ <string name="title">Password:</string>
+ </object>
+ <object class="IBCarbonEditText" id="235">
+ <string name="bounds">51 106 67 215 </string>
+ <string name="viewFrame">106 51 109 16 </string>
+ <boolean name="isPassword">TRUE</boolean>
+ <boolean name="isUnicode">TRUE</boolean>
+ <boolean name="isSingleLine">TRUE</boolean>
+ </object>
+ <object class="IBCarbonButton" id="237">
+ <string name="bounds">90 132 110 202 </string>
+ <string name="viewFrame">132 90 70 20 </string>
+ <string name="title">OK</string>
+ <int name="buttonType">1</int>
+ </object>
+ <object class="IBCarbonButton" id="238">
+ <string name="bounds">90 50 110 120 </string>
+ <string name="viewFrame">50 90 70 20 </string>
+ <string name="title">Cancel</string>
+ </object>
+ </array>
+ </object>
+ <boolean name="receiveUpdates">FALSE</boolean>
+ <boolean name="isResizable">FALSE</boolean>
+ <boolean name="liveResize">TRUE</boolean>
+ <boolean name="compositing">TRUE</boolean>
+ <int name="carbonWindowClass">11</int>
+ <boolean name="isConstrained">FALSE</boolean>
+ </object>
+ <reference idRef="232"/>
+ <reference idRef="233"/>
+ <reference idRef="234"/>
+ <reference idRef="235"/>
+ <reference idRef="237"/>
+ <reference idRef="238"/>
+ </array>
+ <array count="58" name="allParents">
+ <reference idRef="1"/>
+ <reference idRef="29"/>
+ <reference idRef="131"/>
+ <reference idRef="131"/>
+ <reference idRef="127"/>
+ <reference idRef="131"/>
+ <reference idRef="131"/>
+ <reference idRef="131"/>
+ <reference idRef="131"/>
+ <reference idRef="131"/>
+ <reference idRef="131"/>
+ <reference idRef="131"/>
+ <reference idRef="131"/>
+ <reference idRef="147"/>
+ <reference idRef="147"/>
+ <reference idRef="147"/>
+ <reference idRef="147"/>
+ <reference idRef="147"/>
+ <reference idRef="152"/>
+ <reference idRef="147"/>
+ <reference idRef="147"/>
+ <reference idRef="147"/>
+ <reference idRef="29"/>
+ <reference idRef="29"/>
+ <reference idRef="153"/>
+ <reference idRef="154"/>
+ <reference idRef="154"/>
+ <reference idRef="154"/>
+ <reference idRef="1"/>
+ <reference idRef="166"/>
+ <reference idRef="185"/>
+ <reference idRef="29"/>
+ <reference idRef="184"/>
+ <reference idRef="154"/>
+ <reference idRef="154"/>
+ <reference idRef="154"/>
+ <reference idRef="147"/>
+ <reference idRef="147"/>
+ <reference idRef="167"/>
+ <reference idRef="167"/>
+ <reference idRef="167"/>
+ <reference idRef="167"/>
+ <reference idRef="167"/>
+ <reference idRef="167"/>
+ <reference idRef="167"/>
+ <reference idRef="167"/>
+ <reference idRef="167"/>
+ <reference idRef="167"/>
+ <reference idRef="167"/>
+ <reference idRef="167"/>
+ <reference idRef="167"/>
+ <reference idRef="1"/>
+ <reference idRef="231"/>
+ <reference idRef="232"/>
+ <reference idRef="232"/>
+ <reference idRef="232"/>
+ <reference idRef="232"/>
+ <reference idRef="232"/>
+ </array>
+ <dictionary count="5" name="nameTable">
+ <string>Files Owner</string>
+ <reference idRef="1"/>
+ <string>MainWindow</string>
+ <reference idRef="166"/>
+ <string>MenuBar</string>
+ <reference idRef="29"/>
+ <string>PasswordWindow</string>
+ <reference idRef="231"/>
+ <string>View1</string>
+ <reference idRef="230"/>
+ </dictionary>
+ <unsigned_int name="nextObjectID">239</unsigned_int>
+</object>
diff --git a/apps/macosx/macpdf.app/Contents/Resources/macpdf.icns b/apps/macosx/macpdf.app/Contents/Resources/macpdf.icns
new file mode 100644
index 00000000..d11b8be1
--- /dev/null
+++ b/apps/macosx/macpdf.app/Contents/Resources/macpdf.icns
Binary files differ
diff --git a/apps/macosx/macpdf.c b/apps/macosx/macpdf.c
new file mode 100644
index 00000000..5e48a4ea
--- /dev/null
+++ b/apps/macosx/macpdf.c
@@ -0,0 +1,613 @@
+#include <Carbon/Carbon.h>
+
+#include <fitz.h>
+#include <mupdf.h>
+
+#define kViewClassID CFSTR("com.artofcode.mupdf.View")
+#define kViewPrivate 'MU_v'
+
+typedef struct viewctx
+{
+ WindowRef window;
+ HIViewRef view;
+ char *doctitle;
+
+ float zoom;
+ int rotate;
+ int pageno;
+
+ pdf_page *page;
+ fz_obj *pageobj;
+
+ pdf_xref *xref;
+ pdf_pagetree *pages;
+ pdf_outline *outline;
+ fz_renderer *rast;
+ fz_pixmap *image;
+} viewctx;
+
+static OSStatus
+view_construct(EventRef inEvent)
+{
+ OSStatus err;
+ viewctx *ctx;
+
+ ctx = (viewctx *)malloc(sizeof(viewctx));
+ require_action(ctx != NULL, CantMalloc, err = memFullErr);
+ err = GetEventParameter(inEvent, kEventParamHIObjectInstance,
+ typeHIObjectRef, NULL, sizeof(HIObjectRef), NULL,
+ (HIObjectRef *)&ctx->view);
+ require_noerr(err, ParameterMissing);
+ err = SetEventParameter(inEvent, kEventParamHIObjectInstance,
+ typeVoidPtr, sizeof(viewctx *), &ctx);
+
+ ParameterMissing:
+ if (err != noErr)
+ free(ctx);
+
+ CantMalloc:
+ return err;
+}
+
+static OSStatus
+view_destruct(EventRef inEvent, viewctx *inData)
+{
+ free(inData);
+ return noErr;
+}
+
+static OSStatus
+view_initialize(EventHandlerCallRef inCallRef, EventRef inEvent,
+ viewctx *ctx)
+{
+ OSStatus err;
+ HIRect bounds;
+
+ err = CallNextEventHandler(inCallRef, inEvent);
+ require_noerr(err, TroubleInSuperClass);
+
+ ctx->zoom = 1.0;
+ ctx->rotate = 0;
+ ctx->pageno = 1;
+ ctx->window = nil;
+
+ ParameterMissing:
+ TroubleInSuperClass:
+ return err;
+}
+
+#ifndef M_PI
+#define M_PI 3.14159265358979323846 /* pi */
+#endif
+
+static void
+cgcontext_set_rgba(CGContextRef ctx, unsigned int rgba)
+{
+ const double norm = 1.0 / 255;
+ CGContextSetRGBFillColor(ctx,
+ ((rgba >> 24) & 0xff) * norm,
+ ((rgba >> 16) & 0xff) * norm,
+ ((rgba >> 8) & 0xff) * norm,
+ (rgba & 0xff) * norm);
+}
+
+static void
+draw_dot(CGContextRef ctx, double x, double y, double r,
+ unsigned int rgba)
+{
+ cgcontext_set_rgba(ctx, rgba);
+ CGMutablePathRef path = CGPathCreateMutable();
+ CGPathAddArc(path, NULL, x, y, r, 0, 2 * M_PI, false);
+ CGContextAddPath(ctx, path);
+ CGPathRelease(path);
+ CGContextFillPath(ctx);
+}
+
+static void
+draw_raw_rect(CGContextRef ctx, double x0, double y0, double x1, double y1,
+ unsigned int rgba)
+{
+ HIRect rect;
+
+ cgcontext_set_rgba(ctx, rgba);
+ rect.origin.x = x0;
+ rect.origin.y = y0;
+ rect.size.width = x1 - x0;
+ rect.size.height = y1 - y0;
+ CGContextFillRect(ctx, rect);
+}
+
+static void
+draw_rect(CGContextRef ctx, double x, double y, double r,
+ unsigned int rgba)
+{
+ draw_raw_rect(ctx, x - r, y - r, x + r, y + r, rgba);
+}
+
+static OSStatus
+view_draw(EventRef inEvent, viewctx *ctx)
+{
+ OSStatus err;
+ CGContextRef gc;
+ CGDataProviderRef provider;
+ CGImageRef image;
+ CGColorSpaceRef colorspace;
+ CGRect rect;
+
+ err = GetEventParameter(inEvent, kEventParamCGContextRef, typeCGContextRef,
+ NULL, sizeof(CGContextRef), NULL, &gc);
+ require_noerr(err, cleanup);
+
+ colorspace = CGColorSpaceCreateDeviceRGB();
+ provider = CGDataProviderCreateWithData(NULL, ctx->image->samples,
+ ctx->image->w * ctx->image->h * 4,
+ NULL);
+ image = CGImageCreate(ctx->image->w, ctx->image->h,
+ 8, 32, ctx->image->w * 4,
+ colorspace, kCGImageAlphaNoneSkipFirst, provider,
+ NULL, 0, kCGRenderingIntentDefault);
+
+ rect.origin.x = 0;
+ rect.origin.y = 0;
+ rect.size.width = ctx->image->w;
+ rect.size.height = ctx->image->h;
+ HIViewDrawCGImage(gc, &rect, image);
+
+ CGColorSpaceRelease(colorspace);
+ CGDataProviderRelease(provider);
+
+ cleanup:
+ return err;
+}
+
+static OSStatus
+view_get_data(EventRef inEvent, viewctx *inData)
+{
+ OSStatus err;
+ OSType tag;
+ Ptr ptr;
+ Size outSize;
+
+ /* Probably could use a bit more error checking here, for type
+ and size match. Also, just returning a viewctx seems a
+ little hacky. */
+ err = GetEventParameter(inEvent, kEventParamControlDataTag, typeEnumeration,
+ NULL, sizeof(OSType), NULL, &tag);
+ require_noerr(err, ParameterMissing);
+
+ err = GetEventParameter(inEvent, kEventParamControlDataBuffer, typePtr,
+ NULL, sizeof(Ptr), NULL, &ptr);
+
+ if (tag == kViewPrivate) {
+ *((viewctx **)ptr) = inData;
+ outSize = sizeof(viewctx *);
+ } else
+ err = errDataNotSupported;
+
+ if (err == noErr)
+ err = SetEventParameter(inEvent, kEventParamControlDataBufferSize, typeLongInteger,
+ sizeof(Size), &outSize);
+
+ ParameterMissing:
+ return err;
+}
+
+static OSStatus
+view_set_data(EventRef inEvent, viewctx *inData)
+{
+ OSStatus err;
+ Ptr ptr;
+ OSType tag;
+
+ err = GetEventParameter(inEvent, kEventParamControlDataTag, typeEnumeration,
+ NULL, sizeof(OSType), NULL, &tag);
+ require_noerr(err, ParameterMissing);
+
+ err = GetEventParameter(inEvent, kEventParamControlDataBuffer, typePtr,
+ NULL, sizeof(Ptr), NULL, &ptr);
+ require_noerr(err, ParameterMissing);
+
+ if (tag == 'Plat') {
+ //inData->p = *(plate **)ptr;
+ } else
+ err = errDataNotSupported;
+
+ ParameterMissing:
+ return err;
+}
+
+static OSStatus
+view_hittest(EventRef inEvent, viewctx *inData)
+{
+ OSStatus err;
+ HIPoint where;
+ HIRect bounds;
+ ControlPartCode part;
+
+ err = GetEventParameter(inEvent, kEventParamMouseLocation, typeHIPoint,
+ NULL, sizeof(HIPoint), NULL, &where);
+ require_noerr(err, ParameterMissing);
+
+ err = HIViewGetBounds(inData->view, &bounds);
+ require_noerr(err, ParameterMissing);
+
+ if (CGRectContainsPoint(bounds, where))
+ part = 1;
+ else
+ part = kControlNoPart;
+ err = SetEventParameter(inEvent, kEventParamControlPart,
+ typeControlPartCode, sizeof(ControlPartCode),
+ &part);
+ printf("hittest %g, %g!\n", where.x, where.y);
+
+ ParameterMissing:
+ return err;
+}
+
+static void
+view_queue_draw(viewctx *pe)
+{
+ HIViewSetNeedsDisplay(pe->view, true);
+}
+
+
+static int
+view_motion(viewctx *pe, double x, double y)
+{
+ //if (pe->p->motmode == MOTION_MODE_MOVE)
+ //plate_motion_move(pe->p, x, y);
+ //else if (pe->p->motmode == MOTION_MODE_SELECT)
+ //plate_motion_select(pe->p, x, y);
+ view_queue_draw(pe);
+ return 1;
+}
+
+static int
+view_button_release(viewctx *pe)
+{
+ int need_redraw;
+
+ //need_redraw = (pe->p->motmode == MOTION_MODE_SELECT);
+
+ //plate_unpress(pe->p);
+
+ if (need_redraw)
+ view_queue_draw(pe);
+ return 1;
+}
+
+pascal OSStatus
+view_handler(EventHandlerCallRef inCallRef,
+ EventRef inEvent,
+ void* inUserData )
+{
+ OSStatus err = eventNotHandledErr;
+ UInt32 eventClass = GetEventClass(inEvent);
+ UInt32 eventKind = GetEventKind(inEvent);
+ viewctx *data = (viewctx *)inUserData;
+
+ switch (eventClass) {
+ case kEventClassHIObject:
+ switch (eventKind) {
+ case kEventHIObjectConstruct:
+ err = view_construct(inEvent);
+ break;
+ case kEventHIObjectInitialize:
+ err = view_initialize(inCallRef, inEvent, data);
+ break;
+ case kEventHIObjectDestruct:
+ err = view_destruct(inEvent, data);
+ break;
+ }
+ break;
+ case kEventClassControl:
+ switch (eventKind) {
+ case kEventControlInitialize:
+ err = noErr;
+ break;
+ case kEventControlDraw:
+ err = view_draw(inEvent, data);
+ break;
+ case kEventControlGetData:
+ err = view_get_data(inEvent, data);
+ break;
+ case kEventControlSetData:
+ err = view_set_data(inEvent, data);
+ break;
+ case kEventControlHitTest:
+ err = view_hittest(inEvent, data);
+ break;
+ /*...*/
+ }
+ break;
+ }
+ return err;
+}
+
+OSStatus
+view_register(void)
+{
+ OSStatus err = noErr;
+ static HIObjectClassRef view_ClassRef = NULL;
+
+ if (view_ClassRef == NULL) {
+ EventTypeSpec eventList[] = {
+ { kEventClassHIObject, kEventHIObjectConstruct },
+ { kEventClassHIObject, kEventHIObjectInitialize },
+ { kEventClassHIObject, kEventHIObjectDestruct },
+
+ { kEventClassControl, kEventControlActivate },
+ { kEventClassControl, kEventControlDeactivate },
+ { kEventClassControl, kEventControlDraw },
+ { kEventClassControl, kEventControlHiliteChanged },
+ { kEventClassControl, kEventControlHitTest },
+ { kEventClassControl, kEventControlInitialize },
+ { kEventClassControl, kEventControlGetData },
+ { kEventClassControl, kEventControlSetData },
+ };
+ err = HIObjectRegisterSubclass(kViewClassID,
+ kHIViewClassID,
+ NULL,
+ view_handler,
+ GetEventTypeCount(eventList),
+ eventList,
+ NULL,
+ &view_ClassRef);
+ }
+ return err;
+}
+
+OSStatus view_create(
+ WindowRef inWindow,
+ const HIRect* inBounds,
+ HIViewRef* outView)
+{
+ OSStatus err;
+ EventRef event;
+
+ err = view_register();
+ require_noerr(err, CantRegister);
+
+ err = CreateEvent(NULL, kEventClassHIObject, kEventHIObjectInitialize,
+ GetCurrentEventTime(), 0, &event);
+ require_noerr(err, CantCreateEvent);
+
+ if (inBounds != NULL) {
+ err = SetEventParameter(event, 'Boun', typeHIRect, sizeof(HIRect),
+ inBounds);
+ require_noerr(err, CantSetParameter);
+ }
+
+ err = HIObjectCreate(kViewClassID, event, (HIObjectRef*)outView);
+ require_noerr(err, CantCreate);
+
+ if (inWindow != NULL) {
+ HIViewRef root;
+ err = GetRootControl(inWindow, &root);
+ require_noerr(err, CantGetRootView);
+ err = HIViewAddSubview(root, *outView);
+ }
+ CantCreate:
+ CantGetRootView:
+ CantSetParameter:
+ CantCreateEvent:
+ ReleaseEvent(event);
+ CantRegister:
+ return err;
+}
+
+OSStatus
+view_openpdf(HIViewRef view, char *filename)
+{
+ OSStatus err;
+ viewctx *ctx;
+
+ err = GetControlData(view, 1, kViewPrivate, 4, &ctx, NULL);
+ require_noerr(err, CantGetPrivate);
+
+ fz_error *error;
+ fz_obj *obj;
+ pdf_xref *xref;
+
+ error = pdf_newxref(&xref);
+ if (error)
+ fz_abort(error);
+ ctx->xref = xref;
+
+ error = pdf_loadxref(xref, filename);
+ if (error)
+ {
+ fz_warn(error->msg);
+ printf("trying to repair...\n");
+ error = pdf_repairxref(xref, filename);
+ if (error)
+ fz_abort(error);
+ }
+
+ error = pdf_decryptxref(xref);
+ if (error)
+ fz_abort(error);
+
+#if 0
+ if (xref->crypt)
+ {
+ error = pdf_setpassword(xref->crypt, password);
+ if (error) fz_abort(error);
+ }
+#endif
+
+ obj = fz_dictgets(xref->trailer, "Root");
+ if (!obj)
+ fz_abort(fz_throw("syntaxerror: missing Root object"));
+ error = pdf_loadindirect(&xref->root, xref, obj);
+ if (error) fz_abort(error);
+
+ obj = fz_dictgets(xref->trailer, "Info");
+ if (obj)
+ {
+ error = pdf_loadindirect(&xref->info, xref, obj);
+ if (error) fz_abort(error);
+ }
+
+ error = pdf_loadnametrees(xref);
+ if (error) fz_abort(error);
+
+ error = pdf_loadoutline(&ctx->outline, xref);
+ if (error) fz_abort(error);
+
+ ctx->doctitle = filename;
+ if (xref->info)
+ {
+ obj = fz_dictgets(xref->info, "Title");
+ if (obj)
+ {
+ error = pdf_toutf8(&ctx->doctitle, obj);
+ if (error) fz_abort(error);
+ }
+ }
+
+ error = pdf_loadpagetree(&ctx->pages, xref);
+ if (error) fz_abort(error);
+
+ //count = pdf_getpagecount(ctx->pages);
+
+ error = fz_newrenderer(&ctx->rast, pdf_devicergb, 0, 1024 * 512);
+ if (error) fz_abort(error);
+
+ ctx->image = nil;
+ printf("hit bottom\n");
+
+
+ CantGetPrivate:
+ return err;
+}
+
+OSStatus view_showpage(HIViewRef view)
+{
+ OSStatus err;
+ viewctx *ctx;
+
+ err = GetControlData(view, 1, kViewPrivate, 4, &ctx, NULL);
+ require_noerr(err, CantGetPrivate);
+
+ fz_error *error;
+ fz_matrix ctm;
+ fz_rect bbox;
+ fz_obj *obj;
+ char s[256];
+
+ assert(ctx->pageno > 0 && ctx->pageno <= pdf_getpagecount(ctx->pages));
+
+ //XDefineCursor(xdpy, xwin, xcwait);
+
+ if (ctx->image)
+ fz_droppixmap(ctx->image);
+ ctx->image = nil;
+
+ obj = pdf_getpageobject(ctx->pages, ctx->pageno - 1);
+ if (obj == ctx->pageobj)
+ goto Lskipload;
+ ctx->pageobj = obj;
+
+ if (ctx->page)
+ pdf_droppage(ctx->page);
+
+ error = pdf_loadpage(&ctx->page, ctx->xref, ctx->pageobj);
+ if (error)
+ fz_abort(error);
+
+Lskipload:
+
+ ctm = fz_identity();
+ ctm = fz_concat(ctm, fz_translate(0, -ctx->page->mediabox.max.y));
+ ctm = fz_concat(ctm, fz_scale(ctx->zoom, -ctx->zoom));
+ ctm = fz_concat(ctm, fz_rotate(ctx->rotate + ctx->page->rotate));
+
+ bbox = fz_transformaabb(ctm, ctx->page->mediabox);
+
+ error = fz_rendertree(&ctx->image, ctx->rast, ctx->page->tree, ctm, fz_roundrect(bbox), 1);
+ if (error)
+ fz_abort(error);
+
+ //XDefineCursor(xdpy, xwin, xcarrow);
+
+ {
+ char buf[512];
+ int count = pdf_getpagecount(ctx->pages);
+ sprintf(buf, "%s - %d/%d", ctx->doctitle, ctx->pageno, count);
+ //xtitle(buf);
+ }
+
+ //xresize();
+ //xblit();
+ CantGetPrivate:
+ return err;
+}
+
+static void
+init_window(viewctx *ctx)
+{
+ WindowRef window = ctx->window;
+ HIViewRef viewPane;
+ static const HIViewID viewPaneID = { 'Poof', 666 };
+ OSStatus err;
+
+ err = HIViewFindByID(HIViewGetRoot(window), viewPaneID, &viewPane);
+ printf("err from findbyid: %d\n", err);
+}
+
+int
+openpdf(WindowRef window, const char *filename)
+{
+ HIViewRef viewPane;
+ static const HIViewID viewPaneID = { 'Poof', 666 };
+ OSStatus err;
+
+ err = HIViewFindByID(HIViewGetRoot(window), viewPaneID, &viewPane);
+ require_noerr(err, cleanup);
+
+ err = view_openpdf(viewPane, filename);
+ require_noerr(err, cleanup);
+
+ err = view_showpage(viewPane);
+
+ cleanup:
+ return err;
+}
+
+int main(int argc, char *argv[])
+{
+ IBNibRef nibRef;
+ OSStatus err;
+ WindowRef window;
+
+ fz_cpudetect();
+ fz_accelerate();
+
+ err = view_register();
+ require_noerr(err, CantRegisterView);
+
+ err = CreateNibReference(CFSTR("main"), &nibRef);
+ printf("err = %d\n", err);
+ require_noerr(err, CantGetNibRef);
+
+ err = SetMenuBarFromNib(nibRef, CFSTR("MenuBar"));
+ require_noerr(err, CantSetMenuBar);
+
+ err = CreateWindowFromNib(nibRef, CFSTR("MainWindow"), &window);
+ require_noerr(err, CantCreateWindow);
+
+ openpdf(window, "/Users/tor/src/pdf/tiger.pdf");
+
+ DisposeNibReference(nibRef);
+
+ ShowWindow(window);
+ RunApplicationEventLoop();
+
+ CantGetNibRef:
+ CantSetMenuBar:
+ CantCreateWindow:
+ CantRegisterView:
+
+ return err;
+}