create Xcode project for mac for bundled app
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "16x16",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "16x16",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "32x32",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "32x32",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "128x128",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "128x128",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "256x256",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "256x256",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "512x512",
|
||||
"idiom" : "mac",
|
||||
"filename" : "icon512.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "512x512",
|
||||
"idiom" : "mac",
|
||||
"filename" : "icon1024.png",
|
||||
"scale" : "2x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
BIN
PanoPainter-OSX/Assets.xcassets/AppIcon.appiconset/icon1024.png
Normal file
BIN
PanoPainter-OSX/Assets.xcassets/AppIcon.appiconset/icon1024.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 40 KiB |
BIN
PanoPainter-OSX/Assets.xcassets/AppIcon.appiconset/icon512.png
Normal file
BIN
PanoPainter-OSX/Assets.xcassets/AppIcon.appiconset/icon512.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 40 KiB |
6
PanoPainter-OSX/Assets.xcassets/Contents.json
Normal file
6
PanoPainter-OSX/Assets.xcassets/Contents.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
681
PanoPainter-OSX/Base.lproj/MainMenu.xib
Normal file
681
PanoPainter-OSX/Base.lproj/MainMenu.xib
Normal file
@@ -0,0 +1,681 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9531" systemVersion="15C50" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
||||
<dependencies>
|
||||
<deployment identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9531"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
|
||||
<connections>
|
||||
<outlet property="delegate" destination="Voe-Tx-rLC" id="GzC-gU-4Uq"/>
|
||||
</connections>
|
||||
</customObject>
|
||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
||||
<customObject id="Voe-Tx-rLC" customClass="AppDelegate">
|
||||
<connections>
|
||||
<outlet property="window" destination="QvC-M9-y7g" id="gIp-Ho-8D9"/>
|
||||
</connections>
|
||||
</customObject>
|
||||
<customObject id="YLy-65-1bz" customClass="NSFontManager"/>
|
||||
<menu title="Main Menu" systemMenu="main" id="AYu-sK-qS6">
|
||||
<items>
|
||||
<menuItem title="PanoPainter-OSX" id="1Xt-HY-uBw">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="PanoPainter-OSX" systemMenu="apple" id="uQy-DD-JDr">
|
||||
<items>
|
||||
<menuItem title="About PanoPainter-OSX" id="5kV-Vb-QxS">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="orderFrontStandardAboutPanel:" target="-1" id="Exp-CZ-Vem"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="VOq-y0-SEH"/>
|
||||
<menuItem title="Preferences…" keyEquivalent="," id="BOF-NM-1cW"/>
|
||||
<menuItem isSeparatorItem="YES" id="wFC-TO-SCJ"/>
|
||||
<menuItem title="Services" id="NMo-om-nkz">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Services" systemMenu="services" id="hz9-B4-Xy5"/>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="4je-JR-u6R"/>
|
||||
<menuItem title="Hide PanoPainter-OSX" keyEquivalent="h" id="Olw-nP-bQN">
|
||||
<connections>
|
||||
<action selector="hide:" target="-1" id="PnN-Uc-m68"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Hide Others" keyEquivalent="h" id="Vdr-fp-XzO">
|
||||
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="hideOtherApplications:" target="-1" id="VT4-aY-XCT"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Show All" id="Kd2-mp-pUS">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="unhideAllApplications:" target="-1" id="Dhg-Le-xox"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="kCx-OE-vgT"/>
|
||||
<menuItem title="Quit PanoPainter-OSX" keyEquivalent="q" id="4sb-4s-VLi">
|
||||
<connections>
|
||||
<action selector="terminate:" target="-1" id="Te7-pn-YzF"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="File" id="dMs-cI-mzQ">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="File" id="bib-Uj-vzu">
|
||||
<items>
|
||||
<menuItem title="New" keyEquivalent="n" id="Was-JA-tGl">
|
||||
<connections>
|
||||
<action selector="newDocument:" target="-1" id="4Si-XN-c54"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Open…" keyEquivalent="o" id="IAo-SY-fd9">
|
||||
<connections>
|
||||
<action selector="openDocument:" target="-1" id="bVn-NM-KNZ"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Open Recent" id="tXI-mr-wws">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Open Recent" systemMenu="recentDocuments" id="oas-Oc-fiZ">
|
||||
<items>
|
||||
<menuItem title="Clear Menu" id="vNY-rz-j42">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="clearRecentDocuments:" target="-1" id="Daa-9d-B3U"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="m54-Is-iLE"/>
|
||||
<menuItem title="Close" keyEquivalent="w" id="DVo-aG-piG">
|
||||
<connections>
|
||||
<action selector="performClose:" target="-1" id="HmO-Ls-i7Q"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Save…" keyEquivalent="s" id="pxx-59-PXV">
|
||||
<connections>
|
||||
<action selector="saveDocument:" target="-1" id="teZ-XB-qJY"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Save As…" keyEquivalent="S" id="Bw7-FT-i3A">
|
||||
<connections>
|
||||
<action selector="saveDocumentAs:" target="-1" id="mDf-zr-I0C"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Revert to Saved" id="KaW-ft-85H">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="revertDocumentToSaved:" target="-1" id="iJ3-Pv-kwq"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="aJh-i4-bef"/>
|
||||
<menuItem title="Page Setup…" keyEquivalent="P" id="qIS-W8-SiK">
|
||||
<modifierMask key="keyEquivalentModifierMask" shift="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="runPageLayout:" target="-1" id="Din-rz-gC5"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Print…" keyEquivalent="p" id="aTl-1u-JFS">
|
||||
<connections>
|
||||
<action selector="print:" target="-1" id="qaZ-4w-aoO"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Edit" id="5QF-Oa-p0T">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Edit" id="W48-6f-4Dl">
|
||||
<items>
|
||||
<menuItem title="Undo" keyEquivalent="z" id="dRJ-4n-Yzg">
|
||||
<connections>
|
||||
<action selector="undo:" target="-1" id="M6e-cu-g7V"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Redo" keyEquivalent="Z" id="6dh-zS-Vam">
|
||||
<connections>
|
||||
<action selector="redo:" target="-1" id="oIA-Rs-6OD"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="WRV-NI-Exz"/>
|
||||
<menuItem title="Cut" keyEquivalent="x" id="uRl-iY-unG">
|
||||
<connections>
|
||||
<action selector="cut:" target="-1" id="YJe-68-I9s"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Copy" keyEquivalent="c" id="x3v-GG-iWU">
|
||||
<connections>
|
||||
<action selector="copy:" target="-1" id="G1f-GL-Joy"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Paste" keyEquivalent="v" id="gVA-U4-sdL">
|
||||
<connections>
|
||||
<action selector="paste:" target="-1" id="UvS-8e-Qdg"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Paste and Match Style" keyEquivalent="V" id="WeT-3V-zwk">
|
||||
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="pasteAsPlainText:" target="-1" id="cEh-KX-wJQ"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Delete" id="pa3-QI-u2k">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="delete:" target="-1" id="0Mk-Ml-PaM"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Select All" keyEquivalent="a" id="Ruw-6m-B2m">
|
||||
<connections>
|
||||
<action selector="selectAll:" target="-1" id="VNm-Mi-diN"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="uyl-h8-XO2"/>
|
||||
<menuItem title="Find" id="4EN-yA-p0u">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Find" id="1b7-l0-nxx">
|
||||
<items>
|
||||
<menuItem title="Find…" tag="1" keyEquivalent="f" id="Xz5-n4-O0W">
|
||||
<connections>
|
||||
<action selector="performFindPanelAction:" target="-1" id="cD7-Qs-BN4"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Find and Replace…" tag="12" keyEquivalent="f" id="YEy-JH-Tfz">
|
||||
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="performFindPanelAction:" target="-1" id="WD3-Gg-5AJ"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Find Next" tag="2" keyEquivalent="g" id="q09-fT-Sye">
|
||||
<connections>
|
||||
<action selector="performFindPanelAction:" target="-1" id="NDo-RZ-v9R"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Find Previous" tag="3" keyEquivalent="G" id="OwM-mh-QMV">
|
||||
<connections>
|
||||
<action selector="performFindPanelAction:" target="-1" id="HOh-sY-3ay"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Use Selection for Find" tag="7" keyEquivalent="e" id="buJ-ug-pKt">
|
||||
<connections>
|
||||
<action selector="performFindPanelAction:" target="-1" id="U76-nv-p5D"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Jump to Selection" keyEquivalent="j" id="S0p-oC-mLd">
|
||||
<connections>
|
||||
<action selector="centerSelectionInVisibleArea:" target="-1" id="IOG-6D-g5B"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Spelling and Grammar" id="Dv1-io-Yv7">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Spelling" id="3IN-sU-3Bg">
|
||||
<items>
|
||||
<menuItem title="Show Spelling and Grammar" keyEquivalent=":" id="HFo-cy-zxI">
|
||||
<connections>
|
||||
<action selector="showGuessPanel:" target="-1" id="vFj-Ks-hy3"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Check Document Now" keyEquivalent=";" id="hz2-CU-CR7">
|
||||
<connections>
|
||||
<action selector="checkSpelling:" target="-1" id="fz7-VC-reM"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="bNw-od-mp5"/>
|
||||
<menuItem title="Check Spelling While Typing" id="rbD-Rh-wIN">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="toggleContinuousSpellChecking:" target="-1" id="7w6-Qz-0kB"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Check Grammar With Spelling" id="mK6-2p-4JG">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="toggleGrammarChecking:" target="-1" id="muD-Qn-j4w"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Correct Spelling Automatically" id="78Y-hA-62v">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="toggleAutomaticSpellingCorrection:" target="-1" id="2lM-Qi-WAP"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Substitutions" id="9ic-FL-obx">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Substitutions" id="FeM-D8-WVr">
|
||||
<items>
|
||||
<menuItem title="Show Substitutions" id="z6F-FW-3nz">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="orderFrontSubstitutionsPanel:" target="-1" id="oku-mr-iSq"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="gPx-C9-uUO"/>
|
||||
<menuItem title="Smart Copy/Paste" id="9yt-4B-nSM">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="toggleSmartInsertDelete:" target="-1" id="3IJ-Se-DZD"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Smart Quotes" id="hQb-2v-fYv">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="toggleAutomaticQuoteSubstitution:" target="-1" id="ptq-xd-QOA"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Smart Dashes" id="rgM-f4-ycn">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="toggleAutomaticDashSubstitution:" target="-1" id="oCt-pO-9gS"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Smart Links" id="cwL-P1-jid">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="toggleAutomaticLinkDetection:" target="-1" id="Gip-E3-Fov"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Data Detectors" id="tRr-pd-1PS">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="toggleAutomaticDataDetection:" target="-1" id="R1I-Nq-Kbl"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Text Replacement" id="HFQ-gK-NFA">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="toggleAutomaticTextReplacement:" target="-1" id="DvP-Fe-Py6"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Transformations" id="2oI-Rn-ZJC">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Transformations" id="c8a-y6-VQd">
|
||||
<items>
|
||||
<menuItem title="Make Upper Case" id="vmV-6d-7jI">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="uppercaseWord:" target="-1" id="sPh-Tk-edu"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Make Lower Case" id="d9M-CD-aMd">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="lowercaseWord:" target="-1" id="iUZ-b5-hil"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Capitalize" id="UEZ-Bs-lqG">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="capitalizeWord:" target="-1" id="26H-TL-nsh"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Speech" id="xrE-MZ-jX0">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Speech" id="3rS-ZA-NoH">
|
||||
<items>
|
||||
<menuItem title="Start Speaking" id="Ynk-f8-cLZ">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="startSpeaking:" target="-1" id="654-Ng-kyl"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Stop Speaking" id="Oyz-dy-DGm">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="stopSpeaking:" target="-1" id="dX8-6p-jy9"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Format" id="jxT-CU-nIS">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Format" id="GEO-Iw-cKr">
|
||||
<items>
|
||||
<menuItem title="Font" id="Gi5-1S-RQB">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Font" systemMenu="font" id="aXa-aM-Jaq">
|
||||
<items>
|
||||
<menuItem title="Show Fonts" keyEquivalent="t" id="Q5e-8K-NDq">
|
||||
<connections>
|
||||
<action selector="orderFrontFontPanel:" target="YLy-65-1bz" id="WHr-nq-2xA"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Bold" tag="2" keyEquivalent="b" id="GB9-OM-e27">
|
||||
<connections>
|
||||
<action selector="addFontTrait:" target="YLy-65-1bz" id="hqk-hr-sYV"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Italic" tag="1" keyEquivalent="i" id="Vjx-xi-njq">
|
||||
<connections>
|
||||
<action selector="addFontTrait:" target="YLy-65-1bz" id="IHV-OB-c03"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Underline" keyEquivalent="u" id="WRG-CD-K1S">
|
||||
<connections>
|
||||
<action selector="underline:" target="-1" id="FYS-2b-JAY"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="5gT-KC-WSO"/>
|
||||
<menuItem title="Bigger" tag="3" keyEquivalent="+" id="Ptp-SP-VEL">
|
||||
<connections>
|
||||
<action selector="modifyFont:" target="YLy-65-1bz" id="Uc7-di-UnL"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Smaller" tag="4" keyEquivalent="-" id="i1d-Er-qST">
|
||||
<connections>
|
||||
<action selector="modifyFont:" target="YLy-65-1bz" id="HcX-Lf-eNd"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="kx3-Dk-x3B"/>
|
||||
<menuItem title="Kern" id="jBQ-r6-VK2">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Kern" id="tlD-Oa-oAM">
|
||||
<items>
|
||||
<menuItem title="Use Default" id="GUa-eO-cwY">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="useStandardKerning:" target="-1" id="6dk-9l-Ckg"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Use None" id="cDB-IK-hbR">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="turnOffKerning:" target="-1" id="U8a-gz-Maa"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Tighten" id="46P-cB-AYj">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="tightenKerning:" target="-1" id="hr7-Nz-8ro"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Loosen" id="ogc-rX-tC1">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="loosenKerning:" target="-1" id="8i4-f9-FKE"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Ligatures" id="o6e-r0-MWq">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Ligatures" id="w0m-vy-SC9">
|
||||
<items>
|
||||
<menuItem title="Use Default" id="agt-UL-0e3">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="useStandardLigatures:" target="-1" id="7uR-wd-Dx6"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Use None" id="J7y-lM-qPV">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="turnOffLigatures:" target="-1" id="iX2-gA-Ilz"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Use All" id="xQD-1f-W4t">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="useAllLigatures:" target="-1" id="KcB-kA-TuK"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Baseline" id="OaQ-X3-Vso">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Baseline" id="ijk-EB-dga">
|
||||
<items>
|
||||
<menuItem title="Use Default" id="3Om-Ey-2VK">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="unscript:" target="-1" id="0vZ-95-Ywn"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Superscript" id="Rqc-34-cIF">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="superscript:" target="-1" id="3qV-fo-wpU"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Subscript" id="I0S-gh-46l">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="subscript:" target="-1" id="Q6W-4W-IGz"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Raise" id="2h7-ER-AoG">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="raiseBaseline:" target="-1" id="4sk-31-7Q9"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Lower" id="1tx-W0-xDw">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="lowerBaseline:" target="-1" id="OF1-bc-KW4"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="Ndw-q3-faq"/>
|
||||
<menuItem title="Show Colors" keyEquivalent="C" id="bgn-CT-cEk">
|
||||
<connections>
|
||||
<action selector="orderFrontColorPanel:" target="-1" id="mSX-Xz-DV3"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="iMs-zA-UFJ"/>
|
||||
<menuItem title="Copy Style" keyEquivalent="c" id="5Vv-lz-BsD">
|
||||
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="copyFont:" target="-1" id="GJO-xA-L4q"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Paste Style" keyEquivalent="v" id="vKC-jM-MkH">
|
||||
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="pasteFont:" target="-1" id="JfD-CL-leO"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Text" id="Fal-I4-PZk">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Text" id="d9c-me-L2H">
|
||||
<items>
|
||||
<menuItem title="Align Left" keyEquivalent="{" id="ZM1-6Q-yy1">
|
||||
<connections>
|
||||
<action selector="alignLeft:" target="-1" id="zUv-R1-uAa"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Center" keyEquivalent="|" id="VIY-Ag-zcb">
|
||||
<connections>
|
||||
<action selector="alignCenter:" target="-1" id="spX-mk-kcS"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Justify" id="J5U-5w-g23">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="alignJustified:" target="-1" id="ljL-7U-jND"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Align Right" keyEquivalent="}" id="wb2-vD-lq4">
|
||||
<connections>
|
||||
<action selector="alignRight:" target="-1" id="r48-bG-YeY"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="4s2-GY-VfK"/>
|
||||
<menuItem title="Writing Direction" id="H1b-Si-o9J">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Writing Direction" id="8mr-sm-Yjd">
|
||||
<items>
|
||||
<menuItem title="Paragraph" enabled="NO" id="ZvO-Gk-QUH">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
</menuItem>
|
||||
<menuItem id="YGs-j5-SAR">
|
||||
<string key="title"> Default</string>
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="makeBaseWritingDirectionNatural:" target="-1" id="qtV-5e-UBP"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem id="Lbh-J2-qVU">
|
||||
<string key="title"> Left to Right</string>
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="makeBaseWritingDirectionLeftToRight:" target="-1" id="S0X-9S-QSf"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem id="jFq-tB-4Kx">
|
||||
<string key="title"> Right to Left</string>
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="makeBaseWritingDirectionRightToLeft:" target="-1" id="5fk-qB-AqJ"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="swp-gr-a21"/>
|
||||
<menuItem title="Selection" enabled="NO" id="cqv-fj-IhA">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
</menuItem>
|
||||
<menuItem id="Nop-cj-93Q">
|
||||
<string key="title"> Default</string>
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="makeTextWritingDirectionNatural:" target="-1" id="lPI-Se-ZHp"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem id="BgM-ve-c93">
|
||||
<string key="title"> Left to Right</string>
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="makeTextWritingDirectionLeftToRight:" target="-1" id="caW-Bv-w94"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem id="RB4-Sm-HuC">
|
||||
<string key="title"> Right to Left</string>
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="makeTextWritingDirectionRightToLeft:" target="-1" id="EXD-6r-ZUu"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="fKy-g9-1gm"/>
|
||||
<menuItem title="Show Ruler" id="vLm-3I-IUL">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="toggleRuler:" target="-1" id="FOx-HJ-KwY"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Copy Ruler" keyEquivalent="c" id="MkV-Pr-PK5">
|
||||
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="copyRuler:" target="-1" id="71i-fW-3W2"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Paste Ruler" keyEquivalent="v" id="LVM-kO-fVI">
|
||||
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="pasteRuler:" target="-1" id="cSh-wd-qM2"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="View" id="H8h-7b-M4v">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="View" id="HyV-fh-RgO">
|
||||
<items>
|
||||
<menuItem title="Show Toolbar" keyEquivalent="t" id="snW-S8-Cw5">
|
||||
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="toggleToolbarShown:" target="-1" id="BXY-wc-z0C"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Customize Toolbar…" id="1UK-8n-QPP">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="runToolbarCustomizationPalette:" target="-1" id="pQI-g3-MTW"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Window" id="aUF-d1-5bR">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Window" systemMenu="window" id="Td7-aD-5lo">
|
||||
<items>
|
||||
<menuItem title="Minimize" keyEquivalent="m" id="OY7-WF-poV">
|
||||
<connections>
|
||||
<action selector="performMiniaturize:" target="-1" id="VwT-WD-YPe"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Zoom" id="R4o-n2-Eq4">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="performZoom:" target="-1" id="DIl-cC-cCs"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="eu3-7i-yIM"/>
|
||||
<menuItem title="Bring All to Front" id="LE2-aR-0XJ">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="arrangeInFront:" target="-1" id="DRN-fu-gQh"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Help" id="wpr-3q-Mcd">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Help" systemMenu="help" id="F2S-fz-NVQ">
|
||||
<items>
|
||||
<menuItem title="PanoPainter-OSX Help" keyEquivalent="?" id="FKE-Sm-Kum">
|
||||
<connections>
|
||||
<action selector="showHelp:" target="-1" id="y7X-2Q-9no"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
<window title="PanoPainter-OSX" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="QvC-M9-y7g">
|
||||
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
|
||||
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
|
||||
<rect key="contentRect" x="335" y="390" width="480" height="360"/>
|
||||
<rect key="screenRect" x="0.0" y="0.0" width="1440" height="877"/>
|
||||
<view key="contentView" id="EiT-Mj-1SZ">
|
||||
<rect key="frame" x="0.0" y="0.0" width="480" height="360"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</view>
|
||||
</window>
|
||||
</objects>
|
||||
</document>
|
||||
36
PanoPainter-OSX/Info.plist
Normal file
36
PanoPainter-OSX/Info.plist
Normal file
@@ -0,0 +1,36 @@
|
||||
<?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>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string></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.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
<string>public.app-category.graphics-design</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright © 2017 Omar Mohamed Ali Mudhir. All rights reserved.</string>
|
||||
<key>NSMainNibFile</key>
|
||||
<string></string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
</dict>
|
||||
</plist>
|
||||
364
PanoPainter-OSX/main.cpp
Normal file
364
PanoPainter-OSX/main.cpp
Normal file
@@ -0,0 +1,364 @@
|
||||
#include "pch.h"
|
||||
#include "log.h"
|
||||
#include "shader.h"
|
||||
#include "shape.h"
|
||||
#include "texture.h"
|
||||
#include "image.h"
|
||||
#include "app.h"
|
||||
#include "keymap.h"
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#include <Cocoa/Cocoa.h>
|
||||
#include <CoreVideo/CoreVideo.h>
|
||||
#include <OpenGL/OpenGL.h>
|
||||
|
||||
@interface View : NSOpenGLView
|
||||
{
|
||||
CVDisplayLinkRef dl;
|
||||
}
|
||||
- (void)terminateGL;
|
||||
@end @implementation View
|
||||
- (instancetype)initWithFrame:(NSRect)frameRect
|
||||
{
|
||||
NSOpenGLPixelFormatAttribute attrs[] =
|
||||
{
|
||||
NSOpenGLPFADoubleBuffer,
|
||||
NSOpenGLPFADepthSize, 24,
|
||||
// Must specify the 3.2 Core Profile to use OpenGL 3.2
|
||||
NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core,
|
||||
// Multisample
|
||||
NSOpenGLPFAMultisample,
|
||||
NSOpenGLPFASamples, 2,
|
||||
NSOpenGLPFASampleBuffers, 1,
|
||||
0
|
||||
};
|
||||
NSOpenGLPixelFormat *pf = [[NSOpenGLPixelFormat alloc] initWithAttributes:attrs];
|
||||
NSOpenGLContext* context = [[NSOpenGLContext alloc] initWithFormat:pf shareContext:nil];
|
||||
self = [super initWithFrame:frameRect pixelFormat:pf];
|
||||
[self setPixelFormat:pf];
|
||||
[self setOpenGLContext:context];
|
||||
return self;
|
||||
}
|
||||
- (void)prepareOpenGL
|
||||
{
|
||||
NSLog(@"prepare");
|
||||
|
||||
// Synchronize buffer swaps with vertical refresh rate
|
||||
GLint swapInt = 1;
|
||||
[[self openGLContext] setValues:&swapInt forParameter:NSOpenGLCPSwapInterval];
|
||||
|
||||
// Create a display link capable of being used with all active displays
|
||||
CVDisplayLinkCreateWithActiveCGDisplays(&dl);
|
||||
|
||||
// Set the renderer output callback function
|
||||
CVDisplayLinkSetOutputCallback(dl, &MyDisplayLinkCallback, (__bridge void*)self);
|
||||
|
||||
// Set the display link for the current renderer
|
||||
CGLContextObj cglContext = [[self openGLContext] CGLContextObj];
|
||||
CGLPixelFormatObj cglPixelFormat = [[self pixelFormat] CGLPixelFormatObj];
|
||||
CVDisplayLinkSetCurrentCGDisplayFromOpenGLContext(dl, cglContext, cglPixelFormat);
|
||||
|
||||
// Activate the display link
|
||||
CVDisplayLinkStart(dl);
|
||||
|
||||
CGLEnable([self.openGLContext CGLContextObj], kCGLCECrashOnRemovedFunctions);
|
||||
|
||||
CGLLockContext([[self openGLContext] CGLContextObj]);
|
||||
App::I.init();
|
||||
CGLUnlockContext([[self openGLContext] CGLContextObj]);
|
||||
}
|
||||
|
||||
- (void)terminateGL
|
||||
{
|
||||
CGLLockContext([[self openGLContext] CGLContextObj]);
|
||||
CVDisplayLinkRelease(dl);
|
||||
CGLUnlockContext([[self openGLContext] CGLContextObj]);
|
||||
}
|
||||
|
||||
// This is the renderer output callback function
|
||||
static CVReturn MyDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeStamp* now,
|
||||
const CVTimeStamp* outputTime, CVOptionFlags flagsIn, CVOptionFlags* flagsOut, void* displayLinkContext)
|
||||
{
|
||||
CVReturn result = [(__bridge View*)displayLinkContext getFrameForTime:outputTime];
|
||||
return result;
|
||||
}
|
||||
|
||||
- (CVReturn)getFrameForTime:(const CVTimeStamp*)outputTime
|
||||
{
|
||||
static double _timeFreq = CVGetHostClockFrequency();
|
||||
static double _prevTime = (double)outputTime->hostTime / _timeFreq;
|
||||
double hostTime = (double)outputTime->hostTime;
|
||||
double now = hostTime / _timeFreq;
|
||||
|
||||
// this will not update unless 1/30th of a second has passed since the last update
|
||||
if ( now < _prevTime + (1.0 / 30.0) )
|
||||
{
|
||||
// Add your drawing codes here
|
||||
[[self openGLContext] makeCurrentContext];
|
||||
|
||||
// We draw on a secondary thread through the display link
|
||||
// When resizing the view, -reshape is called automatically on the main
|
||||
// thread. Add a mutex around to avoid the threads accessing the context
|
||||
// simultaneously when resizing
|
||||
CGLLockContext([[self openGLContext] CGLContextObj]);
|
||||
App::I.clear();
|
||||
App::I.update(now - _prevTime);
|
||||
|
||||
//[[self openGLContext] flushBuffer];
|
||||
// returning NO will cause the layer to NOT be redrawn
|
||||
|
||||
CGLFlushDrawable([[self openGLContext] CGLContextObj]);
|
||||
CGLUnlockContext([[self openGLContext] CGLContextObj]);
|
||||
return NO;
|
||||
}
|
||||
else
|
||||
{
|
||||
// change whatever you want to change here, as a function of time elapsed
|
||||
_prevTime = now;
|
||||
// return YES to have your layer redrawn
|
||||
return YES;
|
||||
}
|
||||
|
||||
return kCVReturnSuccess;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
// Release the display link
|
||||
CVDisplayLinkRelease(dl);
|
||||
}
|
||||
|
||||
- (void)drawRect:(NSRect)dirtyRect
|
||||
{
|
||||
NSLog(@"drawRect");
|
||||
// Add your drawing codes here
|
||||
[[self openGLContext] makeCurrentContext];
|
||||
|
||||
// We draw on a secondary thread through the display link
|
||||
// When resizing the view, -reshape is called automatically on the main
|
||||
// thread. Add a mutex around to avoid the threads accessing the context
|
||||
// simultaneously when resizing
|
||||
CGLLockContext([[self openGLContext] CGLContextObj]);
|
||||
App::I.update(0);
|
||||
|
||||
//[[self openGLContext] flushBuffer];
|
||||
// returning NO will cause the layer to NOT be redrawn
|
||||
|
||||
CGLFlushDrawable([[self openGLContext] CGLContextObj]);
|
||||
CGLUnlockContext([[self openGLContext] CGLContextObj]);
|
||||
}
|
||||
|
||||
- (void)reshape
|
||||
{
|
||||
[super reshape];
|
||||
|
||||
// We draw on a secondary thread through the display link. However, when
|
||||
// resizing the view, -drawRect is called on the main thread.
|
||||
// Add a mutex around to avoid the threads accessing the context
|
||||
// simultaneously when resizing.
|
||||
CGLLockContext([[self openGLContext] CGLContextObj]);
|
||||
|
||||
// Get the view size in Points
|
||||
NSRect viewRectPoints = [self bounds];
|
||||
|
||||
#if SUPPORT_RETINA_RESOLUTION
|
||||
|
||||
// Rendering at retina resolutions will reduce aliasing, but at the potential
|
||||
// cost of framerate and battery life due to the GPU needing to render more
|
||||
// pixels.
|
||||
|
||||
// Any calculations the renderer does which use pixel dimentions, must be
|
||||
// in "retina" space. [NSView convertRectToBacking] converts point sizes
|
||||
// to pixel sizes. Thus the renderer gets the size in pixels, not points,
|
||||
// so that it can set it's viewport and perform and other pixel based
|
||||
// calculations appropriately.
|
||||
// viewRectPixels will be larger than viewRectPoints for retina displays.
|
||||
// viewRectPixels will be the same as viewRectPoints for non-retina displays
|
||||
NSRect viewRectPixels = [self convertRectToBacking:viewRectPoints];
|
||||
|
||||
#else //if !SUPPORT_RETINA_RESOLUTION
|
||||
|
||||
// App will typically render faster and use less power rendering at
|
||||
// non-retina resolutions since the GPU needs to render less pixels.
|
||||
// There is the cost of more aliasing, but it will be no-worse than
|
||||
// on a Mac without a retina display.
|
||||
|
||||
// Points:Pixels is always 1:1 when not supporting retina resolutions
|
||||
NSRect viewRectPixels = viewRectPoints;
|
||||
|
||||
#endif // !SUPPORT_RETINA_RESOLUTION
|
||||
App::I.resize(viewRectPixels.size.width, viewRectPixels.size.height);
|
||||
|
||||
CGLUnlockContext([[self openGLContext] CGLContextObj]);
|
||||
}
|
||||
- (void)renewGState
|
||||
{
|
||||
// Called whenever graphics state updated (such as window resize)
|
||||
|
||||
// OpenGL rendering is not synchronous with other rendering on the OSX.
|
||||
// Therefore, call disableScreenUpdatesUntilFlush so the window server
|
||||
// doesn't render non-OpenGL content in the window asynchronously from
|
||||
// OpenGL content, which could cause flickering. (non-OpenGL content
|
||||
// includes the title bar and drawing done by the app with other APIs)
|
||||
[[self window] disableScreenUpdatesUntilFlush];
|
||||
|
||||
[super renewGState];
|
||||
}
|
||||
- (void)mouseDown:(NSEvent *)theEvent
|
||||
{
|
||||
CGLLockContext([[self openGLContext] CGLContextObj]);
|
||||
auto mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
|
||||
App::I.mouse_down(0, mouseLoc.x, App::I.height - mouseLoc.y - 1, theEvent.pressure);
|
||||
CGLUnlockContext([[self openGLContext] CGLContextObj]);
|
||||
}
|
||||
- (void)rightMouseDown:(NSEvent *)theEvent
|
||||
{
|
||||
CGLLockContext([[self openGLContext] CGLContextObj]);
|
||||
auto mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
|
||||
App::I.mouse_down(1, mouseLoc.x, App::I.height - mouseLoc.y - 1, theEvent.pressure);
|
||||
CGLUnlockContext([[self openGLContext] CGLContextObj]);
|
||||
}
|
||||
- (void)mouseUp:(NSEvent *)theEvent
|
||||
{
|
||||
CGLLockContext([[self openGLContext] CGLContextObj]);
|
||||
auto mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
|
||||
App::I.mouse_up(0, mouseLoc.x, App::I.height - mouseLoc.y - 1);
|
||||
CGLUnlockContext([[self openGLContext] CGLContextObj]);
|
||||
}
|
||||
- (void)rightMouseUp:(NSEvent *)theEvent
|
||||
{
|
||||
CGLLockContext([[self openGLContext] CGLContextObj]);
|
||||
auto mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
|
||||
App::I.mouse_up(1, mouseLoc.x, App::I.height - mouseLoc.y - 1);
|
||||
CGLUnlockContext([[self openGLContext] CGLContextObj]);
|
||||
}
|
||||
- (void)mouseMoved:(NSEvent *)theEvent
|
||||
{
|
||||
CGLLockContext([[self openGLContext] CGLContextObj]);
|
||||
auto mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
|
||||
App::I.mouse_move(mouseLoc.x, App::I.height - mouseLoc.y - 1, theEvent.pressure);
|
||||
CGLUnlockContext([[self openGLContext] CGLContextObj]);
|
||||
}
|
||||
-(void)mouseDragged:(NSEvent *)theEvent
|
||||
{
|
||||
CGLLockContext([[self openGLContext] CGLContextObj]);
|
||||
auto mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
|
||||
App::I.mouse_move(mouseLoc.x, App::I.height - mouseLoc.y - 1, theEvent.pressure);
|
||||
CGLUnlockContext([[self openGLContext] CGLContextObj]);
|
||||
}
|
||||
- (void)rightMouseDragged:(NSEvent *)theEvent
|
||||
{
|
||||
CGLLockContext([[self openGLContext] CGLContextObj]);
|
||||
auto mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
|
||||
App::I.mouse_move(mouseLoc.x, App::I.height - mouseLoc.y - 1, theEvent.pressure);
|
||||
CGLUnlockContext([[self openGLContext] CGLContextObj]);
|
||||
}
|
||||
- (void)scrollWheel:(NSEvent *)theEvent
|
||||
{
|
||||
CGLLockContext([[self openGLContext] CGLContextObj]);
|
||||
auto mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
|
||||
App::I.mouse_scroll(mouseLoc.x, App::I.height - mouseLoc.y - 1, [theEvent deltaY]);
|
||||
CGLUnlockContext([[self openGLContext] CGLContextObj]);
|
||||
}
|
||||
- (void)keyDown:(NSEvent *)theEvent
|
||||
{
|
||||
CGLLockContext([[self openGLContext] CGLContextObj]);
|
||||
auto keyCode = [theEvent keyCode];
|
||||
auto chars = [theEvent characters];
|
||||
App::I.key_down(convert_key(keyCode));
|
||||
CGLUnlockContext([[self openGLContext] CGLContextObj]);
|
||||
}
|
||||
- (void)keyUp:(NSEvent *)theEvent
|
||||
{
|
||||
CGLLockContext([[self openGLContext] CGLContextObj]);
|
||||
auto keyCode = [theEvent keyCode];
|
||||
auto chars = [theEvent characters];
|
||||
App::I.key_up(convert_key(keyCode));
|
||||
CGLUnlockContext([[self openGLContext] CGLContextObj]);
|
||||
}
|
||||
@end
|
||||
|
||||
@interface Window : NSWindow
|
||||
@end @implementation Window
|
||||
- (void)keyDown:(NSEvent *)theEvent
|
||||
{
|
||||
[[self windowController] keyDown:theEvent];
|
||||
}
|
||||
@end
|
||||
|
||||
@interface Controller : NSWindowController<NSWindowDelegate>
|
||||
@end @implementation Controller
|
||||
- (void)keyDown:(NSEvent *)theEvent
|
||||
{
|
||||
unichar c = [[theEvent charactersIgnoringModifiers] characterAtIndex:0];
|
||||
if (c == 27)
|
||||
{
|
||||
[[NSApplication sharedApplication] terminate:nil];
|
||||
}
|
||||
}
|
||||
- (void)windowDidResize:(NSNotification *)notification
|
||||
{
|
||||
|
||||
}
|
||||
@end
|
||||
|
||||
@interface AppOSX : NSApplication<NSApplicationDelegate>
|
||||
{
|
||||
Window* window;
|
||||
Controller* controller;
|
||||
View* view;
|
||||
}
|
||||
@end @implementation AppOSX
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
[self setActivationPolicy:NSApplicationActivationPolicyRegular]; // make it to the front
|
||||
[self setDelegate:self];
|
||||
return self;
|
||||
}
|
||||
- (void)applicationWillTerminate:(NSNotification *)notification
|
||||
{
|
||||
[view terminateGL];
|
||||
[window close];
|
||||
}
|
||||
- (void)applicationDidFinishLaunching:(NSNotification *)notification
|
||||
{
|
||||
App::I.initLog();
|
||||
App::I.create();
|
||||
NSRect r = NSMakeRect(0, 0, App::I.width, App::I.height);
|
||||
|
||||
view = [[View alloc] initWithFrame:r];
|
||||
|
||||
auto style = NSTitledWindowMask|NSMiniaturizableWindowMask|NSResizableWindowMask;
|
||||
window = [[Window alloc] initWithContentRect:r styleMask:style backing:NSBackingStoreBuffered defer:NO];
|
||||
[window setTitle:@"PanoPainter 0.1.2 alpha"];
|
||||
[window center];
|
||||
[window makeKeyAndOrderFront:controller];
|
||||
[window setContentView:view];
|
||||
[window setAcceptsMouseMovedEvents:true];
|
||||
[window makeFirstResponder:view];
|
||||
|
||||
controller = [[Controller alloc] initWithWindow:window];
|
||||
|
||||
auto menubar = [NSMenu new];
|
||||
auto appMenuItem = [NSMenuItem new];
|
||||
[menubar addItem:appMenuItem];
|
||||
[self setMainMenu:menubar];
|
||||
|
||||
auto appMenu = [NSMenu new];
|
||||
auto appName = [[NSProcessInfo processInfo] processName];
|
||||
auto quitTitle = [@"Quit " stringByAppendingString:appName];
|
||||
auto quitMenuItem = [[NSMenuItem alloc] initWithTitle:quitTitle
|
||||
action:@selector(terminate:) keyEquivalent:@"q"];
|
||||
[appMenu addItem:quitMenuItem];
|
||||
[appMenuItem setSubmenu:appMenu];
|
||||
|
||||
NSLog(@"app launched");
|
||||
}
|
||||
@end
|
||||
|
||||
int main(int argc, const char * argv[])
|
||||
{
|
||||
AppOSX* app = [AppOSX sharedApplication];
|
||||
[app run];
|
||||
return 0;
|
||||
}
|
||||
@@ -19,6 +19,65 @@
|
||||
AD0E11A31ECA61B500CDA6BB /* jpge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD0E11A21ECA61B500CDA6BB /* jpge.cpp */; };
|
||||
AD0E11A41ECA61B900CDA6BB /* jpge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD0E11A21ECA61B500CDA6BB /* jpge.cpp */; };
|
||||
AD0E11A51ECA61B900CDA6BB /* jpgd.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD0E119F1ECA619F00CDA6BB /* jpgd.cpp */; };
|
||||
AD0E5CA31ECC6F2B00C35669 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD0E5CA21ECC6F2B00C35669 /* main.cpp */; };
|
||||
AD0E5CA51ECC6F2B00C35669 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = AD0E5CA41ECC6F2B00C35669 /* Assets.xcassets */; };
|
||||
AD0E5CA81ECC6F2B00C35669 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = AD0E5CA61ECC6F2B00C35669 /* MainMenu.xib */; };
|
||||
AD0E5CAD1ECC724D00C35669 /* libcurl.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = AD8CF7221E914DE400083FFD /* libcurl.tbd */; };
|
||||
AD0E5CAE1ECC725400C35669 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AD58E05F1E12DA86006ACC15 /* CoreVideo.framework */; };
|
||||
AD0E5CAF1ECC726000C35669 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AD58E05D1E10754F006ACC15 /* CoreFoundation.framework */; };
|
||||
AD0E5CB01ECC726400C35669 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AD58E05B1E107536006ACC15 /* Cocoa.framework */; };
|
||||
AD0E5CB11ECC726C00C35669 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AD58E0591E10752E006ACC15 /* OpenGL.framework */; };
|
||||
AD0E5CB21ECC72AD00C35669 /* jpge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD0E11A21ECA61B500CDA6BB /* jpge.cpp */; };
|
||||
AD0E5CB31ECC72AD00C35669 /* jpgd.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD0E119F1ECA619F00CDA6BB /* jpgd.cpp */; };
|
||||
AD0E5CB41ECC72AD00C35669 /* tinyxml2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD58E0781E342205006ACC15 /* tinyxml2.cpp */; };
|
||||
AD0E5CB51ECC72AD00C35669 /* YGNodeList.c in Sources */ = {isa = PBXBuildFile; fileRef = AD58E0741E3421F2006ACC15 /* YGNodeList.c */; };
|
||||
AD0E5CB61ECC72AD00C35669 /* Yoga.c in Sources */ = {isa = PBXBuildFile; fileRef = AD58E0751E3421F2006ACC15 /* Yoga.c */; };
|
||||
AD0E5CB71ECC72AD00C35669 /* layout.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD3B1EBE1E3B8B7600E918E3 /* layout.cpp */; };
|
||||
AD0E5CB81ECC72AD00C35669 /* node.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD10637D1EC7ADFA002A525F /* node.cpp */; };
|
||||
AD0E5CB91ECC72AD00C35669 /* node_border.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD1063511EC7ADFA002A525F /* node_border.cpp */; };
|
||||
AD0E5CBA1ECC72AD00C35669 /* node_button_custom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD1063531EC7ADFA002A525F /* node_button_custom.cpp */; };
|
||||
AD0E5CBB1ECC72AD00C35669 /* node_button.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD1063551EC7ADFA002A525F /* node_button.cpp */; };
|
||||
AD0E5CBC1ECC72AD00C35669 /* node_canvas.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD1063571EC7ADFA002A525F /* node_canvas.cpp */; };
|
||||
AD0E5CBD1ECC72AD00C35669 /* node_checkbox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD1063591EC7ADFA002A525F /* node_checkbox.cpp */; };
|
||||
AD0E5CBE1ECC72AD00C35669 /* node_color_quad.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD10635B1EC7ADFA002A525F /* node_color_quad.cpp */; };
|
||||
AD0E5CBF1ECC72AD00C35669 /* node_dialog_open.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD10635D1EC7ADFA002A525F /* node_dialog_open.cpp */; };
|
||||
AD0E5CC01ECC72AD00C35669 /* node_icon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD10635F1EC7ADFA002A525F /* node_icon.cpp */; };
|
||||
AD0E5CC11ECC72AD00C35669 /* node_image_texture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD1063611EC7ADFA002A525F /* node_image_texture.cpp */; };
|
||||
AD0E5CC21ECC72AD00C35669 /* node_image.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD1063631EC7ADFA002A525F /* node_image.cpp */; };
|
||||
AD0E5CC31ECC72AD00C35669 /* node_message_box.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD1063651EC7ADFA002A525F /* node_message_box.cpp */; };
|
||||
AD0E5CC41ECC72AD00C35669 /* node_panel_brush.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD1063671EC7ADFA002A525F /* node_panel_brush.cpp */; };
|
||||
AD0E5CC51ECC72AD00C35669 /* node_panel_color.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD1063691EC7ADFA002A525F /* node_panel_color.cpp */; };
|
||||
AD0E5CC61ECC72AD00C35669 /* node_panel_layer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD10636B1EC7ADFA002A525F /* node_panel_layer.cpp */; };
|
||||
AD0E5CC71ECC72AD00C35669 /* node_panel_stroke.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD10636D1EC7ADFA002A525F /* node_panel_stroke.cpp */; };
|
||||
AD0E5CC81ECC72AD00C35669 /* node_popup_menu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD10636F1EC7ADFA002A525F /* node_popup_menu.cpp */; };
|
||||
AD0E5CC91ECC72AD00C35669 /* node_settings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD1063711EC7ADFA002A525F /* node_settings.cpp */; };
|
||||
AD0E5CCA1ECC72AD00C35669 /* node_slider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD1063731EC7ADFA002A525F /* node_slider.cpp */; };
|
||||
AD0E5CCB1ECC72AD00C35669 /* node_scroll.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD0E11951ECA20F200CDA6BB /* node_scroll.cpp */; };
|
||||
AD0E5CCC1ECC72AD00C35669 /* node_stroke_preview.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD1063751EC7ADFA002A525F /* node_stroke_preview.cpp */; };
|
||||
AD0E5CCD1ECC72AD00C35669 /* node_text_input.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD1063771EC7ADFA002A525F /* node_text_input.cpp */; };
|
||||
AD0E5CCE1ECC72AD00C35669 /* node_text.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD1063791EC7ADFA002A525F /* node_text.cpp */; };
|
||||
AD0E5CCF1ECC72AD00C35669 /* node_viewport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD10637B1EC7ADFA002A525F /* node_viewport.cpp */; };
|
||||
AD0E5CD01ECC72AD00C35669 /* action.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD29CC601EA2B214008C8BFA /* action.cpp */; };
|
||||
AD0E5CD11ECC72AD00C35669 /* app.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD58E0701E2A90EF006ACC15 /* app.cpp */; };
|
||||
AD0E5CD21ECC72AD00C35669 /* app_events.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD0E11921ECA20F200CDA6BB /* app_events.cpp */; };
|
||||
AD0E5CD31ECC72AD00C35669 /* app_layout.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD0E11931ECA20F200CDA6BB /* app_layout.cpp */; };
|
||||
AD0E5CD41ECC72AD00C35669 /* app_shaders.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD0E11941ECA20F200CDA6BB /* app_shaders.cpp */; };
|
||||
AD0E5CD51ECC72AD00C35669 /* asset.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD4C08CF1E89BD0F0051D85F /* asset.cpp */; };
|
||||
AD0E5CD61ECC72AD00C35669 /* bezier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD4C08D11E89BD0F0051D85F /* bezier.cpp */; };
|
||||
AD0E5CD71ECC72AD00C35669 /* brush.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD4C08D31E89BD0F0051D85F /* brush.cpp */; };
|
||||
AD0E5CD81ECC72AD00C35669 /* canvas_modes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD744B6C1EBC9EF700B66E30 /* canvas_modes.cpp */; };
|
||||
AD0E5CD91ECC72AD00C35669 /* canvas.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD4C08D51E89BD0F0051D85F /* canvas.cpp */; };
|
||||
AD0E5CDA1ECC72AD00C35669 /* event.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ADB1C3D81EA3A156009A65BD /* event.cpp */; };
|
||||
AD0E5CDB1ECC72AD00C35669 /* font.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD95AEC31E41EDEC002DD03A /* font.cpp */; };
|
||||
AD0E5CDC1ECC72AD00C35669 /* image.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD58E0661E2A7741006ACC15 /* image.cpp */; };
|
||||
AD0E5CDD1ECC72AD00C35669 /* log.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD8CF71F1E913F0500083FFD /* log.cpp */; };
|
||||
AD0E5CDE1ECC72AD00C35669 /* pch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD95AEC51E41EDEC002DD03A /* pch.cpp */; };
|
||||
AD0E5CDF1ECC72AD00C35669 /* rtt.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD4C08D71E89BD0F0051D85F /* rtt.cpp */; };
|
||||
AD0E5CE01ECC72AD00C35669 /* shader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD58E0631E2A76FD006ACC15 /* shader.cpp */; };
|
||||
AD0E5CE11ECC72AD00C35669 /* shape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD58E06D1E2A80BC006ACC15 /* shape.cpp */; };
|
||||
AD0E5CE21ECC72AD00C35669 /* texture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD58E0691E2A774F006ACC15 /* texture.cpp */; };
|
||||
AD0E5CE31ECC72AD00C35669 /* util.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ADB61C801E3D38450093280F /* util.cpp */; };
|
||||
AD0E5CE41ECC76BA00C35669 /* data in Resources */ = {isa = PBXBuildFile; fileRef = AD58E0611E17F23D006ACC15 /* data */; };
|
||||
AD10637F1EC7ADFA002A525F /* node_border.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD1063511EC7ADFA002A525F /* node_border.cpp */; };
|
||||
AD1063801EC7ADFA002A525F /* node_button_custom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD1063531EC7ADFA002A525F /* node_button_custom.cpp */; };
|
||||
AD1063811EC7ADFA002A525F /* node_button.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD1063551EC7ADFA002A525F /* node_button.cpp */; };
|
||||
@@ -153,6 +212,11 @@
|
||||
AD0E11961ECA20F200CDA6BB /* node_scroll.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = node_scroll.h; sourceTree = "<group>"; };
|
||||
AD0E119F1ECA619F00CDA6BB /* jpgd.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = jpgd.cpp; path = libs/jpeg/jpgd.cpp; sourceTree = "<group>"; };
|
||||
AD0E11A21ECA61B500CDA6BB /* jpge.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = jpge.cpp; path = libs/jpeg/jpge.cpp; sourceTree = "<group>"; };
|
||||
AD0E5C9C1ECC6F2B00C35669 /* PanoPainter-OSX.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "PanoPainter-OSX.app"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
AD0E5CA21ECC6F2B00C35669 /* main.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; path = main.cpp; sourceTree = "<group>"; };
|
||||
AD0E5CA41ECC6F2B00C35669 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
AD0E5CA71ECC6F2B00C35669 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
|
||||
AD0E5CA91ECC6F2B00C35669 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
AD1063511EC7ADFA002A525F /* node_border.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = node_border.cpp; sourceTree = "<group>"; };
|
||||
AD1063521EC7ADFA002A525F /* node_border.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = node_border.h; sourceTree = "<group>"; };
|
||||
AD1063531EC7ADFA002A525F /* node_button_custom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = node_button_custom.cpp; sourceTree = "<group>"; };
|
||||
@@ -268,6 +332,18 @@
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
AD0E5C991ECC6F2B00C35669 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
AD0E5CB11ECC726C00C35669 /* OpenGL.framework in Frameworks */,
|
||||
AD0E5CB01ECC726400C35669 /* Cocoa.framework in Frameworks */,
|
||||
AD0E5CAF1ECC726000C35669 /* CoreFoundation.framework in Frameworks */,
|
||||
AD0E5CAE1ECC725400C35669 /* CoreVideo.framework in Frameworks */,
|
||||
AD0E5CAD1ECC724D00C35669 /* libcurl.tbd in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
AD58E04C1E107411006ACC15 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@@ -298,6 +374,25 @@
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
AD0E5C9D1ECC6F2B00C35669 /* PanoPainter-OSX */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
AD0E5CA41ECC6F2B00C35669 /* Assets.xcassets */,
|
||||
AD0E5CA61ECC6F2B00C35669 /* MainMenu.xib */,
|
||||
AD0E5CA91ECC6F2B00C35669 /* Info.plist */,
|
||||
AD0E5CA11ECC6F2B00C35669 /* Supporting Files */,
|
||||
);
|
||||
path = "PanoPainter-OSX";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
AD0E5CA11ECC6F2B00C35669 /* Supporting Files */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
AD0E5CA21ECC6F2B00C35669 /* main.cpp */,
|
||||
);
|
||||
name = "Supporting Files";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
AD1063501EC7ADDE002A525F /* ui */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -375,6 +470,7 @@
|
||||
AD58E0591E10752E006ACC15 /* OpenGL.framework */,
|
||||
AD58E0511E107411006ACC15 /* engine */,
|
||||
ADD7D26C1EBF9AE300D5A897 /* PanoPainter */,
|
||||
AD0E5C9D1ECC6F2B00C35669 /* PanoPainter-OSX */,
|
||||
AD58E0501E107411006ACC15 /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
@@ -384,6 +480,7 @@
|
||||
children = (
|
||||
AD58E04F1E107411006ACC15 /* engine */,
|
||||
ADD7D26B1EBF9AE300D5A897 /* PanoPainter.app */,
|
||||
AD0E5C9C1ECC6F2B00C35669 /* PanoPainter-OSX.app */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
@@ -474,6 +571,23 @@
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
AD0E5C9B1ECC6F2B00C35669 /* PanoPainter-OSX */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = AD0E5CAC1ECC6F2B00C35669 /* Build configuration list for PBXNativeTarget "PanoPainter-OSX" */;
|
||||
buildPhases = (
|
||||
AD0E5C981ECC6F2B00C35669 /* Sources */,
|
||||
AD0E5C991ECC6F2B00C35669 /* Frameworks */,
|
||||
AD0E5C9A1ECC6F2B00C35669 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = "PanoPainter-OSX";
|
||||
productName = "PanoPainter-OSX";
|
||||
productReference = AD0E5C9C1ECC6F2B00C35669 /* PanoPainter-OSX.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
AD58E04E1E107411006ACC15 /* engine */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = AD58E0561E107411006ACC15 /* Build configuration list for PBXNativeTarget "engine" */;
|
||||
@@ -517,6 +631,9 @@
|
||||
LastUpgradeCheck = 0720;
|
||||
ORGANIZATIONNAME = "Omar Mohamed Ali Mudhir";
|
||||
TargetAttributes = {
|
||||
AD0E5C9B1ECC6F2B00C35669 = {
|
||||
CreatedOnToolsVersion = 7.2;
|
||||
};
|
||||
AD58E04E1E107411006ACC15 = {
|
||||
CreatedOnToolsVersion = 7.2;
|
||||
};
|
||||
@@ -540,11 +657,22 @@
|
||||
targets = (
|
||||
AD58E04E1E107411006ACC15 /* engine */,
|
||||
ADD7D26A1EBF9AE300D5A897 /* PanoPainter */,
|
||||
AD0E5C9B1ECC6F2B00C35669 /* PanoPainter-OSX */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
AD0E5C9A1ECC6F2B00C35669 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
AD0E5CE41ECC76BA00C35669 /* data in Resources */,
|
||||
AD0E5CA51ECC6F2B00C35669 /* Assets.xcassets in Resources */,
|
||||
AD0E5CA81ECC6F2B00C35669 /* MainMenu.xib in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
ADD7D2691EBF9AE300D5A897 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@@ -559,6 +687,64 @@
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
AD0E5C981ECC6F2B00C35669 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
AD0E5CB91ECC72AD00C35669 /* node_border.cpp in Sources */,
|
||||
AD0E5CC81ECC72AD00C35669 /* node_popup_menu.cpp in Sources */,
|
||||
AD0E5CB71ECC72AD00C35669 /* layout.cpp in Sources */,
|
||||
AD0E5CB41ECC72AD00C35669 /* tinyxml2.cpp in Sources */,
|
||||
AD0E5CD81ECC72AD00C35669 /* canvas_modes.cpp in Sources */,
|
||||
AD0E5CA31ECC6F2B00C35669 /* main.cpp in Sources */,
|
||||
AD0E5CB21ECC72AD00C35669 /* jpge.cpp in Sources */,
|
||||
AD0E5CD21ECC72AD00C35669 /* app_events.cpp in Sources */,
|
||||
AD0E5CD11ECC72AD00C35669 /* app.cpp in Sources */,
|
||||
AD0E5CC21ECC72AD00C35669 /* node_image.cpp in Sources */,
|
||||
AD0E5CDB1ECC72AD00C35669 /* font.cpp in Sources */,
|
||||
AD0E5CDA1ECC72AD00C35669 /* event.cpp in Sources */,
|
||||
AD0E5CCB1ECC72AD00C35669 /* node_scroll.cpp in Sources */,
|
||||
AD0E5CBF1ECC72AD00C35669 /* node_dialog_open.cpp in Sources */,
|
||||
AD0E5CE31ECC72AD00C35669 /* util.cpp in Sources */,
|
||||
AD0E5CD51ECC72AD00C35669 /* asset.cpp in Sources */,
|
||||
AD0E5CCA1ECC72AD00C35669 /* node_slider.cpp in Sources */,
|
||||
AD0E5CCE1ECC72AD00C35669 /* node_text.cpp in Sources */,
|
||||
AD0E5CDC1ECC72AD00C35669 /* image.cpp in Sources */,
|
||||
AD0E5CE01ECC72AD00C35669 /* shader.cpp in Sources */,
|
||||
AD0E5CDD1ECC72AD00C35669 /* log.cpp in Sources */,
|
||||
AD0E5CD61ECC72AD00C35669 /* bezier.cpp in Sources */,
|
||||
AD0E5CB61ECC72AD00C35669 /* Yoga.c in Sources */,
|
||||
AD0E5CC51ECC72AD00C35669 /* node_panel_color.cpp in Sources */,
|
||||
AD0E5CD71ECC72AD00C35669 /* brush.cpp in Sources */,
|
||||
AD0E5CBE1ECC72AD00C35669 /* node_color_quad.cpp in Sources */,
|
||||
AD0E5CB51ECC72AD00C35669 /* YGNodeList.c in Sources */,
|
||||
AD0E5CE11ECC72AD00C35669 /* shape.cpp in Sources */,
|
||||
AD0E5CDF1ECC72AD00C35669 /* rtt.cpp in Sources */,
|
||||
AD0E5CCD1ECC72AD00C35669 /* node_text_input.cpp in Sources */,
|
||||
AD0E5CE21ECC72AD00C35669 /* texture.cpp in Sources */,
|
||||
AD0E5CCC1ECC72AD00C35669 /* node_stroke_preview.cpp in Sources */,
|
||||
AD0E5CDE1ECC72AD00C35669 /* pch.cpp in Sources */,
|
||||
AD0E5CCF1ECC72AD00C35669 /* node_viewport.cpp in Sources */,
|
||||
AD0E5CB31ECC72AD00C35669 /* jpgd.cpp in Sources */,
|
||||
AD0E5CD31ECC72AD00C35669 /* app_layout.cpp in Sources */,
|
||||
AD0E5CC71ECC72AD00C35669 /* node_panel_stroke.cpp in Sources */,
|
||||
AD0E5CC61ECC72AD00C35669 /* node_panel_layer.cpp in Sources */,
|
||||
AD0E5CBA1ECC72AD00C35669 /* node_button_custom.cpp in Sources */,
|
||||
AD0E5CC31ECC72AD00C35669 /* node_message_box.cpp in Sources */,
|
||||
AD0E5CC41ECC72AD00C35669 /* node_panel_brush.cpp in Sources */,
|
||||
AD0E5CBC1ECC72AD00C35669 /* node_canvas.cpp in Sources */,
|
||||
AD0E5CD01ECC72AD00C35669 /* action.cpp in Sources */,
|
||||
AD0E5CC01ECC72AD00C35669 /* node_icon.cpp in Sources */,
|
||||
AD0E5CC11ECC72AD00C35669 /* node_image_texture.cpp in Sources */,
|
||||
AD0E5CBD1ECC72AD00C35669 /* node_checkbox.cpp in Sources */,
|
||||
AD0E5CC91ECC72AD00C35669 /* node_settings.cpp in Sources */,
|
||||
AD0E5CBB1ECC72AD00C35669 /* node_button.cpp in Sources */,
|
||||
AD0E5CD41ECC72AD00C35669 /* app_shaders.cpp in Sources */,
|
||||
AD0E5CD91ECC72AD00C35669 /* canvas.cpp in Sources */,
|
||||
AD0E5CB81ECC72AD00C35669 /* node.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
AD58E04B1E107411006ACC15 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@@ -681,6 +867,14 @@
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
AD0E5CA61ECC6F2B00C35669 /* MainMenu.xib */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
AD0E5CA71ECC6F2B00C35669 /* Base */,
|
||||
);
|
||||
name = MainMenu.xib;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
ADD7D27A1EBF9AE300D5A897 /* Main.storyboard */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
@@ -700,6 +894,32 @@
|
||||
/* End PBXVariantGroup section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
AD0E5CAA1ECC6F2B00C35669 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "c++14";
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
INFOPLIST_FILE = "PanoPainter-OSX/Info.plist";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.omixlab.PanoPainter-OSX";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
AD0E5CAB1ECC6F2B00C35669 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "c++14";
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
INFOPLIST_FILE = "PanoPainter-OSX/Info.plist";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.omixlab.PanoPainter-OSX";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
AD58E0541E107411006ACC15 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
@@ -858,6 +1078,14 @@
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
AD0E5CAC1ECC6F2B00C35669 /* Build configuration list for PBXNativeTarget "PanoPainter-OSX" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
AD0E5CAA1ECC6F2B00C35669 /* Debug */,
|
||||
AD0E5CAB1ECC6F2B00C35669 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
};
|
||||
AD58E04A1E107411006ACC15 /* Build configuration list for PBXProject "engine" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
|
||||
@@ -4,6 +4,16 @@
|
||||
<dict>
|
||||
<key>SchemeUserState</key>
|
||||
<dict>
|
||||
<key>PanoPainter-OSX.xcscheme</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>2</integer>
|
||||
</dict>
|
||||
<key>PanoPainter.xcscheme</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>1</integer>
|
||||
</dict>
|
||||
<key>engine.xcscheme</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
@@ -12,6 +22,11 @@
|
||||
</dict>
|
||||
<key>SuppressBuildableAutocreation</key>
|
||||
<dict>
|
||||
<key>AD0E5C9B1ECC6F2B00C35669</key>
|
||||
<dict>
|
||||
<key>primary</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>AD58E04E1E107411006ACC15</key>
|
||||
<dict>
|
||||
<key>primary</key>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include "log.h"
|
||||
#include "asset.h"
|
||||
|
||||
#ifdef __IOS__
|
||||
#ifdef __APPLE__
|
||||
#include <Foundation/Foundation.h>
|
||||
#endif
|
||||
|
||||
@@ -24,11 +24,12 @@ bool Asset::open(const char* path)
|
||||
m_len = (int)AAsset_getLength(m_asset);
|
||||
m_data = (uint8_t*)AAsset_getBuffer(m_asset);
|
||||
#else
|
||||
#ifdef __IOS__
|
||||
NSString* bundle_path = [[NSBundle mainBundle] bundlePath];
|
||||
#ifdef __APPLE__
|
||||
NSString* bundle_path = [[NSBundle mainBundle] resourcePath];
|
||||
std::string base = [bundle_path cStringUsingEncoding:1];
|
||||
file_path = base + "/" + path;
|
||||
#endif
|
||||
LOG("asset file: %s", file_path.c_str());
|
||||
if (!(m_fp = fopen(file_path.c_str(), "rb")))
|
||||
{
|
||||
LOG("errno = %d", errno);
|
||||
|
||||
@@ -8,16 +8,16 @@
|
||||
|
||||
bool LayoutManager::load(const char* path)
|
||||
{
|
||||
// if (m_loaded)
|
||||
// return true; // already loaded
|
||||
if (m_loaded)
|
||||
return true; // already loaded
|
||||
|
||||
#if !defined(__ANDROID__)
|
||||
struct stat tmp_info;
|
||||
if (stat(path, &tmp_info) != 0)
|
||||
return false;
|
||||
if (tmp_info.st_mtime <= m_file_info.st_mtime)
|
||||
return false;
|
||||
m_file_info = tmp_info;
|
||||
// struct stat tmp_info;
|
||||
// if (stat(path, &tmp_info) != 0)
|
||||
// return false;
|
||||
// if (tmp_info.st_mtime <= m_file_info.st_mtime)
|
||||
// return false;
|
||||
// m_file_info = tmp_info;
|
||||
#endif // __ANDROID__
|
||||
|
||||
m_path = path;
|
||||
@@ -31,7 +31,12 @@ bool LayoutManager::load(const char* path)
|
||||
auto ret = xml.Parse((char*)file.m_data, file.m_len);
|
||||
file.close();
|
||||
if (ret != tinyxml2::XMLError::XML_SUCCESS)
|
||||
{
|
||||
return false;
|
||||
LOG("parsing xml failed");
|
||||
}
|
||||
|
||||
LOG("parsing loaded xml");
|
||||
|
||||
tinyxml2::XMLElement* current = xml.RootElement()->FirstChildElement();
|
||||
while (current)
|
||||
|
||||
348
engine/main.cpp
348
engine/main.cpp
@@ -7,354 +7,6 @@
|
||||
#include "app.h"
|
||||
#include "keymap.h"
|
||||
|
||||
#ifdef __APPLE__
|
||||
|
||||
#ifdef TARGET_OS_OSX
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#include <Cocoa/Cocoa.h>
|
||||
#include <CoreVideo/CoreVideo.h>
|
||||
#include <OpenGL/OpenGL.h>
|
||||
@interface View : NSOpenGLView
|
||||
{
|
||||
CVDisplayLinkRef dl;
|
||||
}
|
||||
@end @implementation View
|
||||
- (instancetype)initWithFrame:(NSRect)frameRect
|
||||
{
|
||||
NSOpenGLPixelFormatAttribute attrs[] =
|
||||
{
|
||||
NSOpenGLPFADoubleBuffer,
|
||||
NSOpenGLPFADepthSize, 24,
|
||||
// Must specify the 3.2 Core Profile to use OpenGL 3.2
|
||||
NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core,
|
||||
// Multisample
|
||||
NSOpenGLPFAMultisample,
|
||||
NSOpenGLPFASamples, 2,
|
||||
NSOpenGLPFASampleBuffers, 1,
|
||||
0
|
||||
};
|
||||
NSOpenGLPixelFormat *pf = [[NSOpenGLPixelFormat alloc] initWithAttributes:attrs];
|
||||
NSOpenGLContext* context = [[NSOpenGLContext alloc] initWithFormat:pf shareContext:nil];
|
||||
self = [super initWithFrame:frameRect pixelFormat:pf];
|
||||
[self setPixelFormat:pf];
|
||||
[self setOpenGLContext:context];
|
||||
return self;
|
||||
}
|
||||
- (void)prepareOpenGL
|
||||
{
|
||||
NSLog(@"prepare");
|
||||
|
||||
// Synchronize buffer swaps with vertical refresh rate
|
||||
GLint swapInt = 1;
|
||||
[[self openGLContext] setValues:&swapInt forParameter:NSOpenGLCPSwapInterval];
|
||||
|
||||
// Create a display link capable of being used with all active displays
|
||||
CVDisplayLinkCreateWithActiveCGDisplays(&dl);
|
||||
|
||||
// Set the renderer output callback function
|
||||
CVDisplayLinkSetOutputCallback(dl, &MyDisplayLinkCallback, (__bridge void*)self);
|
||||
|
||||
// Set the display link for the current renderer
|
||||
CGLContextObj cglContext = [[self openGLContext] CGLContextObj];
|
||||
CGLPixelFormatObj cglPixelFormat = [[self pixelFormat] CGLPixelFormatObj];
|
||||
CVDisplayLinkSetCurrentCGDisplayFromOpenGLContext(dl, cglContext, cglPixelFormat);
|
||||
|
||||
// Activate the display link
|
||||
CVDisplayLinkStart(dl);
|
||||
|
||||
CGLEnable([self.openGLContext CGLContextObj], kCGLCECrashOnRemovedFunctions);
|
||||
|
||||
CGLLockContext([[self openGLContext] CGLContextObj]);
|
||||
App::I.init();
|
||||
CGLUnlockContext([[self openGLContext] CGLContextObj]);
|
||||
}
|
||||
|
||||
// This is the renderer output callback function
|
||||
static CVReturn MyDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeStamp* now,
|
||||
const CVTimeStamp* outputTime, CVOptionFlags flagsIn, CVOptionFlags* flagsOut, void* displayLinkContext)
|
||||
{
|
||||
CVReturn result = [(__bridge View*)displayLinkContext getFrameForTime:outputTime];
|
||||
return result;
|
||||
}
|
||||
|
||||
- (CVReturn)getFrameForTime:(const CVTimeStamp*)outputTime
|
||||
{
|
||||
static double _timeFreq = CVGetHostClockFrequency();
|
||||
static double _prevTime = (double)outputTime->hostTime / _timeFreq;
|
||||
double hostTime = (double)outputTime->hostTime;
|
||||
double now = hostTime / _timeFreq;
|
||||
|
||||
// this will not update unless 1/30th of a second has passed since the last update
|
||||
if ( now < _prevTime + (1.0 / 30.0) )
|
||||
{
|
||||
// Add your drawing codes here
|
||||
[[self openGLContext] makeCurrentContext];
|
||||
|
||||
// We draw on a secondary thread through the display link
|
||||
// When resizing the view, -reshape is called automatically on the main
|
||||
// thread. Add a mutex around to avoid the threads accessing the context
|
||||
// simultaneously when resizing
|
||||
CGLLockContext([[self openGLContext] CGLContextObj]);
|
||||
App::I.clear();
|
||||
App::I.update(now - _prevTime);
|
||||
|
||||
//[[self openGLContext] flushBuffer];
|
||||
// returning NO will cause the layer to NOT be redrawn
|
||||
|
||||
CGLFlushDrawable([[self openGLContext] CGLContextObj]);
|
||||
CGLUnlockContext([[self openGLContext] CGLContextObj]);
|
||||
return NO;
|
||||
}
|
||||
else
|
||||
{
|
||||
// change whatever you want to change here, as a function of time elapsed
|
||||
_prevTime = now;
|
||||
// return YES to have your layer redrawn
|
||||
return YES;
|
||||
}
|
||||
|
||||
return kCVReturnSuccess;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
// Release the display link
|
||||
CVDisplayLinkRelease(dl);
|
||||
}
|
||||
|
||||
- (void)drawRect:(NSRect)dirtyRect
|
||||
{
|
||||
NSLog(@"drawRect");
|
||||
// Add your drawing codes here
|
||||
[[self openGLContext] makeCurrentContext];
|
||||
|
||||
// We draw on a secondary thread through the display link
|
||||
// When resizing the view, -reshape is called automatically on the main
|
||||
// thread. Add a mutex around to avoid the threads accessing the context
|
||||
// simultaneously when resizing
|
||||
CGLLockContext([[self openGLContext] CGLContextObj]);
|
||||
App::I.update(0);
|
||||
|
||||
//[[self openGLContext] flushBuffer];
|
||||
// returning NO will cause the layer to NOT be redrawn
|
||||
|
||||
CGLFlushDrawable([[self openGLContext] CGLContextObj]);
|
||||
CGLUnlockContext([[self openGLContext] CGLContextObj]);
|
||||
}
|
||||
|
||||
- (void)reshape
|
||||
{
|
||||
[super reshape];
|
||||
|
||||
// We draw on a secondary thread through the display link. However, when
|
||||
// resizing the view, -drawRect is called on the main thread.
|
||||
// Add a mutex around to avoid the threads accessing the context
|
||||
// simultaneously when resizing.
|
||||
CGLLockContext([[self openGLContext] CGLContextObj]);
|
||||
|
||||
// Get the view size in Points
|
||||
NSRect viewRectPoints = [self bounds];
|
||||
|
||||
#if SUPPORT_RETINA_RESOLUTION
|
||||
|
||||
// Rendering at retina resolutions will reduce aliasing, but at the potential
|
||||
// cost of framerate and battery life due to the GPU needing to render more
|
||||
// pixels.
|
||||
|
||||
// Any calculations the renderer does which use pixel dimentions, must be
|
||||
// in "retina" space. [NSView convertRectToBacking] converts point sizes
|
||||
// to pixel sizes. Thus the renderer gets the size in pixels, not points,
|
||||
// so that it can set it's viewport and perform and other pixel based
|
||||
// calculations appropriately.
|
||||
// viewRectPixels will be larger than viewRectPoints for retina displays.
|
||||
// viewRectPixels will be the same as viewRectPoints for non-retina displays
|
||||
NSRect viewRectPixels = [self convertRectToBacking:viewRectPoints];
|
||||
|
||||
#else //if !SUPPORT_RETINA_RESOLUTION
|
||||
|
||||
// App will typically render faster and use less power rendering at
|
||||
// non-retina resolutions since the GPU needs to render less pixels.
|
||||
// There is the cost of more aliasing, but it will be no-worse than
|
||||
// on a Mac without a retina display.
|
||||
|
||||
// Points:Pixels is always 1:1 when not supporting retina resolutions
|
||||
NSRect viewRectPixels = viewRectPoints;
|
||||
|
||||
#endif // !SUPPORT_RETINA_RESOLUTION
|
||||
App::I.resize(viewRectPixels.size.width, viewRectPixels.size.height);
|
||||
|
||||
CGLUnlockContext([[self openGLContext] CGLContextObj]);
|
||||
}
|
||||
- (void)renewGState
|
||||
{
|
||||
// Called whenever graphics state updated (such as window resize)
|
||||
|
||||
// OpenGL rendering is not synchronous with other rendering on the OSX.
|
||||
// Therefore, call disableScreenUpdatesUntilFlush so the window server
|
||||
// doesn't render non-OpenGL content in the window asynchronously from
|
||||
// OpenGL content, which could cause flickering. (non-OpenGL content
|
||||
// includes the title bar and drawing done by the app with other APIs)
|
||||
[[self window] disableScreenUpdatesUntilFlush];
|
||||
|
||||
[super renewGState];
|
||||
}
|
||||
- (void)mouseDown:(NSEvent *)theEvent
|
||||
{
|
||||
CGLLockContext([[self openGLContext] CGLContextObj]);
|
||||
auto mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
|
||||
App::I.mouse_down(0, mouseLoc.x, App::I.height - mouseLoc.y - 1, theEvent.pressure);
|
||||
CGLUnlockContext([[self openGLContext] CGLContextObj]);
|
||||
}
|
||||
- (void)rightMouseDown:(NSEvent *)theEvent
|
||||
{
|
||||
CGLLockContext([[self openGLContext] CGLContextObj]);
|
||||
auto mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
|
||||
App::I.mouse_down(1, mouseLoc.x, App::I.height - mouseLoc.y - 1, theEvent.pressure);
|
||||
CGLUnlockContext([[self openGLContext] CGLContextObj]);
|
||||
}
|
||||
- (void)mouseUp:(NSEvent *)theEvent
|
||||
{
|
||||
CGLLockContext([[self openGLContext] CGLContextObj]);
|
||||
auto mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
|
||||
App::I.mouse_up(0, mouseLoc.x, App::I.height - mouseLoc.y - 1);
|
||||
CGLUnlockContext([[self openGLContext] CGLContextObj]);
|
||||
}
|
||||
- (void)rightMouseUp:(NSEvent *)theEvent
|
||||
{
|
||||
CGLLockContext([[self openGLContext] CGLContextObj]);
|
||||
auto mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
|
||||
App::I.mouse_up(1, mouseLoc.x, App::I.height - mouseLoc.y - 1);
|
||||
CGLUnlockContext([[self openGLContext] CGLContextObj]);
|
||||
}
|
||||
- (void)mouseMoved:(NSEvent *)theEvent
|
||||
{
|
||||
CGLLockContext([[self openGLContext] CGLContextObj]);
|
||||
auto mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
|
||||
App::I.mouse_move(mouseLoc.x, App::I.height - mouseLoc.y - 1, theEvent.pressure);
|
||||
CGLUnlockContext([[self openGLContext] CGLContextObj]);
|
||||
}
|
||||
-(void)mouseDragged:(NSEvent *)theEvent
|
||||
{
|
||||
CGLLockContext([[self openGLContext] CGLContextObj]);
|
||||
auto mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
|
||||
App::I.mouse_move(mouseLoc.x, App::I.height - mouseLoc.y - 1, theEvent.pressure);
|
||||
CGLUnlockContext([[self openGLContext] CGLContextObj]);
|
||||
}
|
||||
- (void)rightMouseDragged:(NSEvent *)theEvent
|
||||
{
|
||||
CGLLockContext([[self openGLContext] CGLContextObj]);
|
||||
auto mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
|
||||
App::I.mouse_move(mouseLoc.x, App::I.height - mouseLoc.y - 1, theEvent.pressure);
|
||||
CGLUnlockContext([[self openGLContext] CGLContextObj]);
|
||||
}
|
||||
- (void)scrollWheel:(NSEvent *)theEvent
|
||||
{
|
||||
CGLLockContext([[self openGLContext] CGLContextObj]);
|
||||
auto mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
|
||||
App::I.mouse_scroll(mouseLoc.x, App::I.height - mouseLoc.y - 1, [theEvent deltaY]);
|
||||
CGLUnlockContext([[self openGLContext] CGLContextObj]);
|
||||
}
|
||||
- (void)keyDown:(NSEvent *)theEvent
|
||||
{
|
||||
CGLLockContext([[self openGLContext] CGLContextObj]);
|
||||
auto keyCode = [theEvent keyCode];
|
||||
auto chars = [theEvent characters];
|
||||
App::I.key_down(convert_key(keyCode));
|
||||
CGLUnlockContext([[self openGLContext] CGLContextObj]);
|
||||
}
|
||||
- (void)keyUp:(NSEvent *)theEvent
|
||||
{
|
||||
CGLLockContext([[self openGLContext] CGLContextObj]);
|
||||
auto keyCode = [theEvent keyCode];
|
||||
auto chars = [theEvent characters];
|
||||
App::I.key_up(convert_key(keyCode));
|
||||
CGLUnlockContext([[self openGLContext] CGLContextObj]);
|
||||
}
|
||||
@end
|
||||
|
||||
@interface Window : NSWindow
|
||||
@end @implementation Window
|
||||
- (void)keyDown:(NSEvent *)theEvent
|
||||
{
|
||||
[[self windowController] keyDown:theEvent];
|
||||
}
|
||||
@end
|
||||
|
||||
@interface Controller : NSWindowController<NSWindowDelegate>
|
||||
@end @implementation Controller
|
||||
- (void)keyDown:(NSEvent *)theEvent
|
||||
{
|
||||
unichar c = [[theEvent charactersIgnoringModifiers] characterAtIndex:0];
|
||||
if (c == 27)
|
||||
{
|
||||
[[NSApplication sharedApplication] terminate:nil];
|
||||
}
|
||||
}
|
||||
- (void)windowDidResize:(NSNotification *)notification
|
||||
{
|
||||
|
||||
}
|
||||
@end
|
||||
|
||||
@interface AppOSX : NSApplication<NSApplicationDelegate>
|
||||
{
|
||||
Window* window;
|
||||
Controller* controller;
|
||||
View* view;
|
||||
}
|
||||
@end @implementation AppOSX
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
[self setActivationPolicy:NSApplicationActivationPolicyRegular]; // make it to the front
|
||||
[self setDelegate:self];
|
||||
return self;
|
||||
}
|
||||
- (void)applicationDidFinishLaunching:(NSNotification *)notification
|
||||
{
|
||||
App::I.initLog();
|
||||
App::I.create();
|
||||
NSRect r = NSMakeRect(0, 0, App::I.width, App::I.height);
|
||||
|
||||
view = [[View alloc] initWithFrame:r];
|
||||
|
||||
auto style = NSTitledWindowMask|NSMiniaturizableWindowMask|NSResizableWindowMask;
|
||||
window = [[Window alloc] initWithContentRect:r styleMask:style backing:NSBackingStoreBuffered defer:NO];
|
||||
[window setTitle:@"PanoPainter 0.1.2 alpha"];
|
||||
[window center];
|
||||
[window makeKeyAndOrderFront:controller];
|
||||
[window setContentView:view];
|
||||
[window setAcceptsMouseMovedEvents:true];
|
||||
[window makeFirstResponder:view];
|
||||
|
||||
controller = [[Controller alloc] initWithWindow:window];
|
||||
|
||||
auto menubar = [NSMenu new];
|
||||
auto appMenuItem = [NSMenuItem new];
|
||||
[menubar addItem:appMenuItem];
|
||||
[self setMainMenu:menubar];
|
||||
|
||||
auto appMenu = [NSMenu new];
|
||||
auto appName = [[NSProcessInfo processInfo] processName];
|
||||
auto quitTitle = [@"Quit " stringByAppendingString:appName];
|
||||
auto quitMenuItem = [[NSMenuItem alloc] initWithTitle:quitTitle
|
||||
action:@selector(terminate:) keyEquivalent:@"q"];
|
||||
[appMenu addItem:quitMenuItem];
|
||||
[appMenuItem setSubmenu:appMenu];
|
||||
|
||||
NSLog(@"app launched");
|
||||
}
|
||||
@end
|
||||
|
||||
int main(int argc, const char * argv[])
|
||||
{
|
||||
AppOSX* app = [AppOSX sharedApplication];
|
||||
[app run];
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#pragma comment (lib, "opengl32.lib")
|
||||
|
||||
@@ -746,6 +746,7 @@ void Node::parse_attributes(kAttribute ka, const tinyxml2::XMLAttribute* attr)
|
||||
void Node::load_internal(const tinyxml2::XMLElement* x_node)
|
||||
{
|
||||
m_name = x_node->Name();
|
||||
LOG("node %s", m_name.c_str());
|
||||
|
||||
init();
|
||||
|
||||
|
||||
BIN
icon512.png
Normal file
BIN
icon512.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 40 KiB |
Reference in New Issue
Block a user