diff options
author | Damiano Galassi <[email protected]> | 2017-07-26 11:44:38 +0200 |
---|---|---|
committer | Damiano Galassi <[email protected]> | 2017-07-26 11:44:38 +0200 |
commit | 5dabd8e3f9d194047433a503234616bcf83b363d (patch) | |
tree | 12c81d07f105fde92aba97a41d46c172e6682bd2 /macosx | |
parent | 32154911403726fc89b257c073492d865198f0ce (diff) |
MacGui: allow crop values to be larger than sourceValue / 2
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/English.lproj/HBPictureViewController.xib | 24 | ||||
-rw-r--r-- | macosx/English.lproj/PictureSettings.xib | 63 | ||||
-rw-r--r-- | macosx/HBPicture+UIAdditions.h | 6 | ||||
-rw-r--r-- | macosx/HBPicture+UIAdditions.m | 6 | ||||
-rw-r--r-- | macosx/HBPicture.m | 68 |
5 files changed, 93 insertions, 74 deletions
diff --git a/macosx/English.lproj/HBPictureViewController.xib b/macosx/English.lproj/HBPictureViewController.xib index d7a429647..a833a08cc 100644 --- a/macosx/English.lproj/HBPictureViewController.xib +++ b/macosx/English.lproj/HBPictureViewController.xib @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="13122.17" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none"> +<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="13168.3" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none"> <dependencies> <deployment identifier="macosx"/> <development version="8000" identifier="xcode"/> - <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13122.17"/> + <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13168.3"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> <objects> @@ -27,6 +27,7 @@ <font key="font" metaFont="smallSystem"/> </stepperCell> <connections> + <binding destination="-2" name="maxValue" keyPath="self.picture.maxTopCrop" id="4Z9-jd-EzH"/> <binding destination="-2" name="enabled2" keyPath="self.picture" previousBinding="mtZ-Ty-n6s" id="HQZ-ek-iiD"> <dictionary key="options"> <integer key="NSMultipleValuesPlaceholder" value="-1"/> @@ -41,8 +42,7 @@ <string key="NSValueTransformerName">NSNegateBoolean</string> </dictionary> </binding> - <binding destination="-2" name="value" keyPath="self.picture.cropTop" previousBinding="W6e-6e-e0G" id="rui-ft-8qd"/> - <binding destination="-2" name="maxValue" keyPath="self.picture.maxVerticalCrop" id="W6e-6e-e0G"/> + <binding destination="-2" name="value" keyPath="self.picture.cropTop" previousBinding="4Z9-jd-EzH" id="c0Z-ZT-9Cf"/> </connections> </stepper> <matrix verticalHuggingPriority="750" allowsEmptySelection="NO" autosizesCells="NO" id="RTr-3u-52l"> @@ -157,6 +157,7 @@ Custom allows for manual settings.</string> <font key="font" metaFont="smallSystem"/> </stepperCell> <connections> + <binding destination="-2" name="maxValue" keyPath="self.picture.maxLeftCrop" id="ygC-Mk-gae"/> <binding destination="-2" name="enabled2" keyPath="self.picture" previousBinding="erl-nf-Xs5" id="UPJ-QD-Izo"> <dictionary key="options"> <integer key="NSMultipleValuesPlaceholder" value="-1"/> @@ -171,8 +172,7 @@ Custom allows for manual settings.</string> <string key="NSValueTransformerName">NSNegateBoolean</string> </dictionary> </binding> - <binding destination="-2" name="value" keyPath="self.picture.cropLeft" previousBinding="tYZ-2h-zIg" id="IBB-vL-VJ7"/> - <binding destination="-2" name="maxValue" keyPath="self.picture.maxHorizontalCrop" id="tYZ-2h-zIg"/> + <binding destination="-2" name="value" keyPath="self.picture.cropLeft" previousBinding="ygC-Mk-gae" id="YCc-wM-Iep"/> </connections> </stepper> <textField toolTip="Left edge cropping amount in pixels." verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" id="LTu-ic-Ty9"> @@ -214,6 +214,7 @@ Custom allows for manual settings.</string> <font key="font" metaFont="smallSystem"/> </stepperCell> <connections> + <binding destination="-2" name="maxValue" keyPath="self.picture.maxBottomCrop" id="9V7-cf-abT"/> <binding destination="-2" name="enabled2" keyPath="self.picture" previousBinding="ZKT-as-B7p" id="UHe-hi-SJo"> <dictionary key="options"> <integer key="NSMultipleValuesPlaceholder" value="-1"/> @@ -228,8 +229,7 @@ Custom allows for manual settings.</string> <string key="NSValueTransformerName">NSNegateBoolean</string> </dictionary> </binding> - <binding destination="-2" name="value" keyPath="self.picture.cropBottom" previousBinding="I1t-eF-byM" id="fjV-Mm-Iuz"/> - <binding destination="-2" name="maxValue" keyPath="self.picture.maxVerticalCrop" id="I1t-eF-byM"/> + <binding destination="-2" name="value" keyPath="self.picture.cropBottom" previousBinding="9V7-cf-abT" id="oaG-Bl-ag8"/> </connections> </stepper> <textField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" id="Bmd-c8-9hp"> @@ -708,7 +708,7 @@ HQDN3D default: y-spatial=3:cb-spatial=2:cr-spatial=2:y-temporal=2:cb-temporal=3 <stepper horizontalHuggingPriority="750" verticalHuggingPriority="750" id="FwZ-6T-zJe"> <rect key="frame" x="151" y="281" width="15" height="22"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> - <stepperCell key="cell" controlSize="small" continuous="YES" alignment="left" increment="16" minValue="64" maxValue="59" doubleValue="64" id="NP7-P2-Qga"> + <stepperCell key="cell" controlSize="small" continuous="YES" alignment="left" increment="16" minValue="64" maxValue="59" doubleValue="59" id="NP7-P2-Qga"> <font key="font" metaFont="smallSystem"/> </stepperCell> <connections> @@ -979,7 +979,7 @@ Custom allows manually setting all parameters. Useful for correcting an incorrec <stepper horizontalHuggingPriority="750" verticalHuggingPriority="750" id="2s0-5k-fjU"> <rect key="frame" x="240" y="281" width="15" height="22"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> - <stepperCell key="cell" controlSize="small" continuous="YES" alignment="left" increment="16" minValue="64" maxValue="59" doubleValue="64" id="MwK-aS-Oaf"> + <stepperCell key="cell" controlSize="small" continuous="YES" alignment="left" increment="16" minValue="64" maxValue="59" doubleValue="59" id="MwK-aS-Oaf"> <font key="font" metaFont="smallSystem"/> </stepperCell> <connections> @@ -999,6 +999,7 @@ Custom allows manually setting all parameters. Useful for correcting an incorrec <font key="font" metaFont="smallSystem"/> </stepperCell> <connections> + <binding destination="-2" name="maxValue" keyPath="self.picture.maxRightCrop" id="X5t-bh-W3a"/> <binding destination="-2" name="enabled2" keyPath="self.picture" previousBinding="qtl-2n-uKP" id="WyG-bu-8aC"> <dictionary key="options"> <integer key="NSMultipleValuesPlaceholder" value="-1"/> @@ -1013,8 +1014,7 @@ Custom allows manually setting all parameters. Useful for correcting an incorrec <string key="NSValueTransformerName">NSNegateBoolean</string> </dictionary> </binding> - <binding destination="-2" name="value" keyPath="self.picture.cropRight" previousBinding="HGA-OB-h94" id="Or7-sC-RVD"/> - <binding destination="-2" name="maxValue" keyPath="self.picture.maxHorizontalCrop" id="HGA-OB-h94"/> + <binding destination="-2" name="value" keyPath="self.picture.cropRight" previousBinding="X5t-bh-W3a" id="s5w-KS-LX0"/> </connections> </stepper> <textField verticalHuggingPriority="750" misplaced="YES" allowsCharacterPickerTouchBarItem="YES" id="xKf-yr-nCk"> diff --git a/macosx/English.lproj/PictureSettings.xib b/macosx/English.lproj/PictureSettings.xib index 2165431e5..6cc1caf51 100644 --- a/macosx/English.lproj/PictureSettings.xib +++ b/macosx/English.lproj/PictureSettings.xib @@ -1,10 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11762" systemVersion="16C67" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none"> +<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="13168.3" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none"> <dependencies> <deployment identifier="macosx"/> - <development version="7000" identifier="xcode"/> - <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11762"/> + <development version="8000" identifier="xcode"/> + <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13168.3"/> <capability name="box content view" minToolsVersion="7.0"/> + <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> <objects> <customObject id="-2" userLabel="File's Owner" customClass="HBPictureController"> @@ -32,7 +33,7 @@ <userLayoutGuide location="115" affinity="minX"/> </userGuides> <subviews> - <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="XmO-LR-1DQ"> + <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" id="XmO-LR-1DQ"> <rect key="frame" x="257" y="61" width="120" height="17"/> <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/> <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Nothing to inspect" id="buq-K6-Wvy"> @@ -55,7 +56,7 @@ <rect key="frame" x="0.0" y="0.0" width="358" height="126"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <subviews> - <textField verticalHuggingPriority="750" id="402"> + <textField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" id="402"> <rect key="frame" x="192" y="106" width="82" height="16"/> <autoresizingMask key="autoresizingMask"/> <textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" alignment="right" title="Display Width:" id="403"> @@ -71,7 +72,7 @@ </binding> </connections> </textField> - <textField verticalHuggingPriority="750" id="440"> + <textField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" id="440"> <rect key="frame" x="278" y="81" width="37" height="16"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <textFieldCell key="cell" controlSize="mini" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="left" drawsBackground="YES" id="441"> @@ -95,7 +96,7 @@ <binding destination="-2" name="value" keyPath="self.picture.parWidth" id="PXg-GA-vo6"/> </connections> </textField> - <textField verticalHuggingPriority="750" id="442"> + <textField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" id="442"> <rect key="frame" x="278" y="56" width="37" height="16"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <textFieldCell key="cell" controlSize="mini" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="left" drawsBackground="YES" id="443"> @@ -119,7 +120,7 @@ <binding destination="-2" name="value" keyPath="self.picture.parHeight" id="HrI-5d-evg"/> </connections> </textField> - <textField verticalHuggingPriority="750" id="444"> + <textField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" id="444"> <rect key="frame" x="207" y="81" width="67" height="16"/> <autoresizingMask key="autoresizingMask"/> <textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" alignment="right" title="PAR Width:" id="445"> @@ -135,7 +136,7 @@ </binding> </connections> </textField> - <textField verticalHuggingPriority="750" id="446"> + <textField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" id="446"> <rect key="frame" x="202" y="56" width="71" height="16"/> <autoresizingMask key="autoresizingMask"/> <textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" alignment="right" title="PAR Height:" id="447"> @@ -154,7 +155,7 @@ <stepper horizontalHuggingPriority="750" verticalHuggingPriority="750" id="44"> <rect key="frame" x="143" y="103" width="15" height="22"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> - <stepperCell key="cell" controlSize="small" continuous="YES" alignment="left" increment="16" minValue="64" maxValue="59" doubleValue="59" id="169"> + <stepperCell key="cell" controlSize="small" continuous="YES" alignment="left" increment="16" minValue="64" maxValue="59" doubleValue="64" id="169"> <font key="font" metaFont="smallSystem"/> </stepperCell> <connections> @@ -181,7 +182,7 @@ <binding destination="-2" name="selectedValue" keyPath="self.picture.modulus" id="anc-Ha-mxE"/> </connections> </popUpButton> - <textField verticalHuggingPriority="750" id="42"> + <textField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" id="42"> <rect key="frame" x="76" y="107" width="62" height="16"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <textFieldCell key="cell" controlSize="mini" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="left" drawsBackground="YES" id="167"> @@ -202,7 +203,7 @@ <stepper horizontalHuggingPriority="750" verticalHuggingPriority="750" id="46"> <rect key="frame" x="143" y="78" width="15" height="22"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> - <stepperCell key="cell" controlSize="small" continuous="YES" alignment="left" increment="16" minValue="64" maxValue="59" doubleValue="64" id="171"> + <stepperCell key="cell" controlSize="small" continuous="YES" alignment="left" increment="16" minValue="64" maxValue="59" doubleValue="59" id="171"> <font key="font" metaFont="smallSystem"/> </stepperCell> <connections> @@ -210,7 +211,7 @@ <binding destination="-2" name="maxValue" keyPath="self.picture.maxHeight" id="nJk-wN-aaB"/> </connections> </stepper> - <textField verticalHuggingPriority="750" id="138"> + <textField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" id="138"> <rect key="frame" x="-1" y="38" width="73" height="14"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <textFieldCell key="cell" controlSize="small" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Anamorphic:" id="174"> @@ -219,7 +220,7 @@ <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> </textFieldCell> </textField> - <textField verticalHuggingPriority="750" id="41"> + <textField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" id="41"> <rect key="frame" x="29" y="82" width="43" height="14"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" alignment="right" title="Height:" id="166"> @@ -247,7 +248,7 @@ <binding destination="-2" name="selectedTag" keyPath="self.picture.anamorphicMode" id="edu-WH-uPF"/> </connections> </popUpButton> - <textField verticalHuggingPriority="750" id="390"> + <textField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" id="390"> <rect key="frame" x="19" y="15" width="53" height="14"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <textFieldCell key="cell" controlSize="small" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Modulus:" id="391"> @@ -256,7 +257,7 @@ <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> </textFieldCell> </textField> - <textField verticalHuggingPriority="750" id="47"> + <textField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" id="47"> <rect key="frame" x="32" y="108" width="38" height="14"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" alignment="right" title="Width:" id="172"> @@ -265,7 +266,7 @@ <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> </textFieldCell> </textField> - <textField verticalHuggingPriority="750" id="43"> + <textField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" id="43"> <rect key="frame" x="76" y="81" width="62" height="16"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <textFieldCell key="cell" controlSize="mini" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="left" drawsBackground="YES" id="168"> @@ -295,7 +296,7 @@ <binding destination="-2" name="enabled" keyPath="self.picture.keepDisplayAspectEditable" id="DSI-Ra-G0d"/> </connections> </button> - <textField verticalHuggingPriority="750" id="396"> + <textField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" id="396"> <rect key="frame" x="278" y="106" width="61" height="16"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <textFieldCell key="cell" controlSize="mini" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="left" drawsBackground="YES" id="397"> @@ -343,13 +344,13 @@ <font key="font" metaFont="smallSystem"/> </stepperCell> <connections> + <binding destination="-2" name="maxValue" keyPath="self.picture.maxTopCrop" id="Kft-ci-UbK"/> <binding destination="-2" name="enabled" keyPath="self.picture.autocrop" id="Vp0-sU-c5s"> <dictionary key="options"> <string key="NSValueTransformerName">NSNegateBoolean</string> </dictionary> </binding> - <binding destination="-2" name="value" keyPath="self.picture.cropTop" previousBinding="9ff-Ns-69S" id="4Cj-4f-6FM"/> - <binding destination="-2" name="maxValue" keyPath="self.picture.maxVerticalCrop" id="9ff-Ns-69S"/> + <binding destination="-2" name="value" keyPath="self.picture.cropTop" previousBinding="Kft-ci-UbK" id="Zqw-Pu-qi1"/> </connections> </stepper> <stepper horizontalHuggingPriority="750" verticalHuggingPriority="750" id="15"> @@ -359,13 +360,13 @@ <font key="font" metaFont="smallSystem"/> </stepperCell> <connections> + <binding destination="-2" name="maxValue" keyPath="self.picture.maxRightCrop" id="Fyc-RI-h9A"/> <binding destination="-2" name="enabled" keyPath="self.picture.autocrop" id="5QD-Dh-bzl"> <dictionary key="options"> <string key="NSValueTransformerName">NSNegateBoolean</string> </dictionary> </binding> - <binding destination="-2" name="value" keyPath="self.picture.cropRight" previousBinding="39d-dv-rDM" id="OUg-17-HR9"/> - <binding destination="-2" name="maxValue" keyPath="self.picture.maxHorizontalCrop" id="39d-dv-rDM"/> + <binding destination="-2" name="value" keyPath="self.picture.cropRight" previousBinding="Fyc-RI-h9A" id="L3c-i2-kQY"/> </connections> </stepper> <matrix verticalHuggingPriority="750" allowsEmptySelection="NO" autosizesCells="NO" id="16"> @@ -398,7 +399,7 @@ </binding> </connections> </matrix> - <textField verticalHuggingPriority="750" id="13"> + <textField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" id="13"> <rect key="frame" x="131" y="58" width="36" height="16"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <textFieldCell key="cell" controlSize="mini" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="left" drawsBackground="YES" id="153"> @@ -420,7 +421,7 @@ </binding> </connections> </textField> - <textField verticalHuggingPriority="750" id="10"> + <textField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" id="10"> <rect key="frame" x="131" y="31" width="36" height="16"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <textFieldCell key="cell" controlSize="mini" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="left" drawsBackground="YES" id="150"> @@ -449,16 +450,16 @@ <font key="font" metaFont="smallSystem"/> </stepperCell> <connections> + <binding destination="-2" name="maxValue" keyPath="self.picture.maxLeftCrop" id="CcF-LX-2Wg"/> <binding destination="-2" name="enabled" keyPath="self.picture.autocrop" id="WmV-2A-EDo"> <dictionary key="options"> <string key="NSValueTransformerName">NSNegateBoolean</string> </dictionary> </binding> - <binding destination="-2" name="value" keyPath="self.picture.cropLeft" previousBinding="2Rh-om-NkW" id="hk3-CS-WKR"/> - <binding destination="-2" name="maxValue" keyPath="self.picture.maxHorizontalCrop" id="2Rh-om-NkW"/> + <binding destination="-2" name="value" keyPath="self.picture.cropLeft" previousBinding="CcF-LX-2Wg" id="VtG-0s-YHK"/> </connections> </stepper> - <textField verticalHuggingPriority="750" id="11"> + <textField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" id="11"> <rect key="frame" x="72" y="49" width="36" height="16"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <textFieldCell key="cell" controlSize="mini" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="left" drawsBackground="YES" id="151"> @@ -487,16 +488,16 @@ <font key="font" metaFont="smallSystem"/> </stepperCell> <connections> + <binding destination="-2" name="maxValue" keyPath="self.picture.maxBottomCrop" id="YKW-no-4sN"/> <binding destination="-2" name="enabled" keyPath="self.picture.autocrop" id="soK-UE-pde"> <dictionary key="options"> <string key="NSValueTransformerName">NSNegateBoolean</string> </dictionary> </binding> - <binding destination="-2" name="value" keyPath="self.picture.cropBottom" previousBinding="jS8-Tg-h3O" id="k6f-Bd-Crr"/> - <binding destination="-2" name="maxValue" keyPath="self.picture.maxVerticalCrop" id="jS8-Tg-h3O"/> + <binding destination="-2" name="value" keyPath="self.picture.cropBottom" previousBinding="YKW-no-4sN" id="4AO-dA-bmi"/> </connections> </stepper> - <textField verticalHuggingPriority="750" id="382"> + <textField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" id="382"> <rect key="frame" x="3" y="107" width="59" height="17"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Cropping:" id="383"> @@ -505,7 +506,7 @@ <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> </textFieldCell> </textField> - <textField verticalHuggingPriority="750" id="9"> + <textField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" id="9"> <rect key="frame" x="194" y="48" width="36" height="16"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <textFieldCell key="cell" controlSize="mini" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="left" drawsBackground="YES" id="149"> diff --git a/macosx/HBPicture+UIAdditions.h b/macosx/HBPicture+UIAdditions.h index 0d191db45..3e1fa2f60 100644 --- a/macosx/HBPicture+UIAdditions.h +++ b/macosx/HBPicture+UIAdditions.h @@ -19,8 +19,10 @@ @property (nonatomic, readonly) int maxWidth; @property (nonatomic, readonly) int maxHeight; -@property (nonatomic, readonly) int maxVerticalCrop; -@property (nonatomic, readonly) int maxHorizontalCrop; +@property (nonatomic, readonly) int maxTopCrop; +@property (nonatomic, readonly) int maxBottomCrop; +@property (nonatomic, readonly) int maxLeftCrop; +@property (nonatomic, readonly) int maxRightCrop; @property (nonatomic, readonly, getter=isKeepDisplayAspectEditable) BOOL keepDisplayAspectEditable; @property (nonatomic, readonly, getter=isCustomAnamorphicEnabled) BOOL customAnamorphicEnabled; diff --git a/macosx/HBPicture+UIAdditions.m b/macosx/HBPicture+UIAdditions.m index 265d1c1ad..a3a996942 100644 --- a/macosx/HBPicture+UIAdditions.m +++ b/macosx/HBPicture+UIAdditions.m @@ -13,8 +13,10 @@ @dynamic maxHeight; @dynamic maxWidth; -@dynamic maxHorizontalCrop; -@dynamic maxVerticalCrop; +@dynamic maxTopCrop; +@dynamic maxBottomCrop; +@dynamic maxLeftCrop; +@dynamic maxRightCrop; #pragma mark - Editable state diff --git a/macosx/HBPicture.m b/macosx/HBPicture.m index 97b1631aa..5578245e4 100644 --- a/macosx/HBPicture.m +++ b/macosx/HBPicture.m @@ -269,52 +269,36 @@ NSString * const HBPictureChangedNotification = @"HBPictureChangedNotification"; - (BOOL)validateCropTop:(id *)ioValue error:(NSError * __autoreleasing *)outError { - [self validateVCrop:ioValue]; + [self validateCrop:ioValue max:self.maxTopCrop]; return YES; } - (BOOL)validateCropBottom:(id *)ioValue error:(NSError * __autoreleasing *)outError { - [self validateVCrop:ioValue]; + [self validateCrop:ioValue max:self.maxBottomCrop]; return YES; } - (BOOL)validateCropLeft:(id *)ioValue error:(NSError * __autoreleasing *)outError { - [self validateHCrop:ioValue]; + [self validateCrop:ioValue max:self.maxLeftCrop]; return YES; } - (BOOL)validateCropRight:(id *)ioValue error:(NSError * __autoreleasing *)outError { - [self validateHCrop:ioValue]; + [self validateCrop:ioValue max:self.maxRightCrop]; return YES; } -- (void)validateHCrop:(NSNumber **)ioValue +- (void)validateCrop:(NSNumber **)ioValue max:(int)maxCrop { if (nil != *ioValue) { int value = [*ioValue intValue]; - if (value >= self.maxHorizontalCrop) + if (value >= maxCrop) { - *ioValue = @(self.maxHorizontalCrop); - } - else if (value < 0) - { - *ioValue = @0; - } - } -} - -- (void)validateVCrop:(NSNumber **)ioValue -{ - if (nil != *ioValue) - { - int value = [*ioValue intValue]; - if (value >= self.maxVerticalCrop) - { - *ioValue = @(self.maxVerticalCrop); + *ioValue = @(maxCrop); } else if (value < 0) { @@ -414,14 +398,44 @@ NSString * const HBPictureChangedNotification = @"HBPictureChangedNotification"; return self.sourceHeight - self.cropTop - self.cropBottom; } -- (int)maxVerticalCrop ++ (NSSet<NSString *> *)keyPathsForValuesAffectingMaxTopCrop +{ + return [NSSet setWithObjects:@"cropBottom", nil]; +} + +- (int)maxTopCrop +{ + return self.sourceHeight - self.cropBottom - 32; +} + ++ (NSSet<NSString *> *)keyPathsForValuesAffectingMaxBottomCrop +{ + return [NSSet setWithObjects:@"cropTop", nil]; +} + +- (int)maxBottomCrop +{ + return self.sourceHeight - self.cropTop - 32; +} + ++ (NSSet<NSString *> *)keyPathsForValuesAffectingMaxLeftCrop +{ + return [NSSet setWithObjects:@"cropRight", nil]; +} + +- (int)maxLeftCrop +{ + return self.sourceWidth - self.cropRight - 32; +} + ++ (NSSet<NSString *> *)keyPathsForValuesAffectingMaxRightCrop { - return self.sourceHeight / 2 - 2; + return [NSSet setWithObjects:@"cropLeft", nil]; } -- (int)maxHorizontalCrop +- (int)maxRightCrop { - return self.sourceWidth / 2 - 2; + return self.sourceWidth - self.cropLeft - 32; } - (int)sourceDisplayWidth |