]> granicus.if.org Git - handbrake/commitdiff
MacGui: use an pair of 'OK' and 'Cancel' buttons in the defaults sheets instead of...
authorDamiano Galassi <damiog@gmail.com>
Thu, 29 Oct 2015 07:55:47 +0000 (08:55 +0100)
committerDamiano Galassi <damiog@gmail.com>
Thu, 29 Oct 2015 07:55:47 +0000 (08:55 +0100)
macosx/English.lproj/AudioDefaults.xib
macosx/English.lproj/SubtitlesDefaults.xib
macosx/HBAudio.m
macosx/HBAudioController.m
macosx/HBAudioDefaultsController.m
macosx/HBAudioTrackPreset.m
macosx/HBSubtitles.m
macosx/HBSubtitlesController.m
macosx/HBSubtitlesDefaultsController.m

index 0a736de80ad5870027257fc68e3e4eca207630d4..ef48ea516a7a65e5aaf980b18cc24804b837c245 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9059" systemVersion="15B42" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9059" systemVersion="15C27e" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
     <dependencies>
         <deployment identifier="macosx"/>
         <development version="6300" identifier="xcode"/>
                         </connections>
                     </button>
                     <button verticalHuggingPriority="750" id="sC2-52-liU">
-                        <rect key="frame" x="744" y="14" width="54" height="28"/>
+                        <rect key="frame" x="718" y="14" width="80" height="28"/>
                         <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
                         <animations/>
-                        <buttonCell key="cell" type="push" title="Done" bezelStyle="rounded" alignment="center" controlSize="small" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="kDe-1L-VkD">
+                        <buttonCell key="cell" type="push" title="OK" bezelStyle="rounded" alignment="center" controlSize="small" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="kDe-1L-VkD">
                             <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                             <font key="font" metaFont="smallSystem"/>
                             <string key="keyEquivalent" base64-UTF8="YES">
@@ -167,7 +167,7 @@ DQ
 </string>
                         </buttonCell>
                         <connections>
-                            <action selector="done:" target="-2" id="Rdg-PN-7l6"/>
+                            <action selector="ok:" target="-2" id="pNO-TU-osz"/>
                             <outlet property="nextKeyView" destination="oiD-QI-wly" id="1gO-sY-HNE"/>
                         </connections>
                     </button>
@@ -488,7 +488,6 @@ DQ
                                                                 <menu key="menu" id="xhO-vr-WJF"/>
                                                             </popUpButtonCell>
                                                             <connections>
-                                                                <binding destination="5No-Mm-bpD" name="content" keyPath="objectValue.sampleRates" id="adb-9q-L5r"/>
                                                                 <binding destination="5No-Mm-bpD" name="enabled" keyPath="objectValue.mixdownEnabled" id="E9O-S2-Uq8"/>
                                                                 <binding destination="5No-Mm-bpD" name="selectedValue" keyPath="objectValue.sampleRate" previousBinding="adb-9q-L5r" id="DxT-bF-prJ">
                                                                     <dictionary key="options">
@@ -496,6 +495,7 @@ DQ
                                                                         <string key="NSValueTransformerName">HBSampleRateTransformer</string>
                                                                     </dictionary>
                                                                 </binding>
+                                                                <binding destination="5No-Mm-bpD" name="content" keyPath="objectValue.sampleRates" id="adb-9q-L5r"/>
                                                             </connections>
                                                         </popUpButton>
                                                     </subviews>
@@ -530,13 +530,13 @@ DQ
                                                                 <menu key="menu" id="pWk-70-S7v"/>
                                                             </popUpButtonCell>
                                                             <connections>
-                                                                <binding destination="Bxd-gI-dFS" name="content" keyPath="objectValue.bitRates" id="aT6-o7-lFG"/>
-                                                                <binding destination="Bxd-gI-dFS" name="enabled" keyPath="objectValue.bitrateEnabled" id="paa-Sa-JU9"/>
                                                                 <binding destination="Bxd-gI-dFS" name="selectedValue" keyPath="objectValue.bitRate" previousBinding="aT6-o7-lFG" id="CSr-pu-s9O">
                                                                     <dictionary key="options">
                                                                         <string key="NSValueTransformerName">HBIntegerTransformer</string>
                                                                     </dictionary>
                                                                 </binding>
+                                                                <binding destination="Bxd-gI-dFS" name="content" keyPath="objectValue.bitRates" id="aT6-o7-lFG"/>
+                                                                <binding destination="Bxd-gI-dFS" name="enabled" keyPath="objectValue.bitrateEnabled" id="paa-Sa-JU9"/>
                                                             </connections>
                                                         </popUpButton>
                                                     </subviews>
@@ -677,13 +677,28 @@ DQ
                             <binding destination="-2" name="value" keyPath="self.settings.secondaryEncoderMode" id="Umc-CV-pJy"/>
                         </connections>
                     </button>
+                    <button verticalHuggingPriority="750" id="kJY-av-BYf">
+                        <rect key="frame" x="640" y="14" width="80" height="28"/>
+                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+                        <animations/>
+                        <buttonCell key="cell" type="push" title="Cancel" bezelStyle="rounded" alignment="center" controlSize="small" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="Jn4-1L-J1g">
+                            <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                            <font key="font" metaFont="smallSystem"/>
+                            <string key="keyEquivalent" base64-UTF8="YES">
+Gw
+</string>
+                        </buttonCell>
+                        <connections>
+                            <action selector="cancel:" target="-2" id="Vkr-zh-YAJ"/>
+                        </connections>
+                    </button>
                 </subviews>
                 <animations/>
             </view>
             <connections>
                 <outlet property="initialFirstResponder" destination="oiD-QI-wly" id="Vxi-xi-P0d"/>
             </connections>
-            <point key="canvasLocation" x="-205.5" y="81"/>
+            <point key="canvasLocation" x="187.5" y="96"/>
         </window>
         <arrayController objectClassName="HBLang" id="ZBe-aP-wvq" userLabel="Languages Table Controller" customClass="HBLanguageArrayController">
             <declaredKeys>
index 8a77993305944ce329b1aa201c0e54266f08d126..b814e094bd126b7ce28b9dfb7d74c5cce130c758 100644 (file)
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="8164.2" systemVersion="15A225f" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9059" systemVersion="15C27e" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
     <dependencies>
         <deployment identifier="macosx"/>
         <development version="6300" identifier="xcode"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="8164.2"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9059"/>
     </dependencies>
     <objects>
         <customObject id="-2" userLabel="File's Owner" customClass="HBSubtitlesDefaultsController">
         <window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" restorable="NO" showsToolbarButton="NO" visibleAtLaunch="NO" animationBehavior="default" id="kwM-lz-5lG">
             <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="283" y="305" width="427" height="409"/>
+            <rect key="contentRect" x="283" y="305" width="427" height="421"/>
             <rect key="screenRect" x="0.0" y="0.0" width="2560" height="1418"/>
             <value key="minSize" type="size" width="427" height="304"/>
             <value key="maxSize" type="size" width="427" height="1000"/>
             <view key="contentView" id="ZP2-Cp-K5w">
-                <rect key="frame" x="0.0" y="0.0" width="427" height="409"/>
+                <rect key="frame" x="0.0" y="0.0" width="427" height="421"/>
                 <autoresizingMask key="autoresizingMask"/>
                 <subviews>
                     <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="fPg-3n-1TN">
-                        <rect key="frame" x="-2" y="373" width="157" height="14"/>
+                        <rect key="frame" x="-2" y="385" width="157" height="14"/>
                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                         <animations/>
                         <textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Track Selection Behavior:" id="GbM-vm-RC2">
@@ -37,7 +37,7 @@
                         </textFieldCell>
                     </textField>
                     <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="Jsz-Er-bsF">
-                        <rect key="frame" x="-2" y="349" width="157" height="14"/>
+                        <rect key="frame" x="-2" y="361" width="157" height="14"/>
                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                         <animations/>
                         <textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Languages:" id="mAT-Jp-SG1">
@@ -47,7 +47,7 @@
                         </textFieldCell>
                     </textField>
                     <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="Hqz-Lw-gAu">
-                        <rect key="frame" x="-2" y="171" width="157" height="14"/>
+                        <rect key="frame" x="-2" y="183" width="157" height="14"/>
                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                         <animations/>
                         <textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Options:" id="NJl-q3-zXL">
@@ -57,7 +57,7 @@
                         </textFieldCell>
                     </textField>
                     <popUpButton verticalHuggingPriority="750" id="oiD-QI-wly">
-                        <rect key="frame" x="158" y="368" width="252" height="22"/>
+                        <rect key="frame" x="158" y="380" width="252" height="22"/>
                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                         <animations/>
                         <popUpButtonCell key="cell" type="push" title="None" bezelStyle="rounded" alignment="left" controlSize="small" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="mvw-Hg-JFM" id="21e-KY-8TR">
@@ -77,7 +77,7 @@
                         </connections>
                     </popUpButton>
                     <button toolTip="Closed captions are text subtitles that can be added to any container as a soft subtitle track (not burned)." id="uF5-6E-EIe">
-                        <rect key="frame" x="158" y="168" width="251" height="18"/>
+                        <rect key="frame" x="158" y="180" width="251" height="18"/>
                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                         <animations/>
                         <buttonCell key="cell" type="check" title="Add Closed Captions when available" bezelStyle="regularSquare" imagePosition="left" controlSize="small" state="on" inset="2" id="66v-2g-DHn">
@@ -89,7 +89,7 @@
                         </connections>
                     </button>
                     <button toolTip="This search pass finds short sequences of foreign audio and provides subtitles for them." id="OOC-GZ-OFA">
-                        <rect key="frame" x="158" y="150" width="251" height="18"/>
+                        <rect key="frame" x="158" y="162" width="251" height="18"/>
                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                         <animations/>
                         <buttonCell key="cell" type="check" title="Add &quot;Foreign Audio Search&quot;" bezelStyle="regularSquare" imagePosition="left" controlSize="small" state="on" inset="2" id="vNY-OC-hTJ">
                         </connections>
                     </button>
                     <scrollView autohidesScrollers="YES" horizontalLineScroll="16" horizontalPageScroll="10" verticalLineScroll="16" verticalPageScroll="10" usesPredominantAxisScrolling="NO" id="aTC-39-h6S">
-                        <rect key="frame" x="161" y="228" width="246" height="135"/>
+                        <rect key="frame" x="161" y="240" width="246" height="135"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <clipView key="contentView" id="TdE-Sh-NcS">
                             <rect key="frame" x="1" y="1" width="244" height="133"/>
                             <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
                         </clipView>
                         <animations/>
-                        <scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="bXf-U5-ogz">
+                        <scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="bXf-U5-ogz">
                             <rect key="frame" x="1" y="118" width="244" height="16"/>
                             <autoresizingMask key="autoresizingMask"/>
                             <animations/>
                         </scroller>
-                        <scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="BWM-rq-VTg">
+                        <scroller key="verticalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="NO" id="BWM-rq-VTg">
                             <autoresizingMask key="autoresizingMask"/>
                             <animations/>
                         </scroller>
                     </scrollView>
                     <button verticalHuggingPriority="750" id="QAt-5X-NBT">
-                        <rect key="frame" x="161" y="198" width="71" height="23"/>
+                        <rect key="frame" x="161" y="210" width="71" height="23"/>
                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                         <animations/>
                         <buttonCell key="cell" type="smallSquare" title="Show All" bezelStyle="smallSquare" imagePosition="overlaps" alignment="center" controlSize="small" borderStyle="border" inset="3" id="PiQ-bA-7P1">
                         </connections>
                     </button>
                     <popUpButton verticalHuggingPriority="750" id="Lsa-kB-2BP">
-                        <rect key="frame" x="158" y="117" width="252" height="22"/>
+                        <rect key="frame" x="158" y="129" width="252" height="22"/>
                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                         <string key="toolTip">Set the behavior of subtitle "Burn-in"
 
@@ -207,7 +207,7 @@ Only one subtitle track can be burned. Since conflics can occur, the first chose
                         </connections>
                     </popUpButton>
                     <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="qAf-lQ-GN4">
-                        <rect key="frame" x="-2" y="122" width="157" height="14"/>
+                        <rect key="frame" x="-2" y="134" width="157" height="14"/>
                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                         <animations/>
                         <textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Burn-In Behavior:" id="640-NB-Uby">
@@ -217,7 +217,7 @@ Only one subtitle track can be burned. Since conflics can occur, the first chose
                         </textFieldCell>
                     </textField>
                     <button id="ceZ-On-t5S">
-                        <rect key="frame" x="158" y="97" width="96" height="18"/>
+                        <rect key="frame" x="158" y="109" width="96" height="18"/>
                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                         <string key="toolTip">Burn the first selected DVD subtitle track. All other DVD subtitle tracks will be discarded. Use this option if your player software or device does not support DVD Subtitles.
 
@@ -232,7 +232,7 @@ Only one subtitle track can be burned. Since conflics can occur, the first chose
                         </connections>
                     </button>
                     <button id="Px8-G6-NVX">
-                        <rect key="frame" x="158" y="79" width="110" height="18"/>
+                        <rect key="frame" x="158" y="91" width="110" height="18"/>
                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                         <string key="toolTip">Burn the first selected Blu-ray subtitle track. All other Blu-ray subtitle tracks will be discarded. Use this option if your player software or device does not support Blu-ray Subtitles.
 
@@ -247,7 +247,7 @@ Only one subtitle track can be burned. Since conflics can occur, the first chose
                         </connections>
                     </button>
                     <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="MlS-tB-pEv">
-                        <rect key="frame" x="159" y="46" width="250" height="28"/>
+                        <rect key="frame" x="159" y="58" width="250" height="28"/>
                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                         <animations/>
                         <textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" title="Only one of the above subtitle burn options will be applied, starting with the top." id="N4s-K9-RwM">
@@ -256,11 +256,11 @@ Only one subtitle track can be burned. Since conflics can occur, the first chose
                             <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
                         </textFieldCell>
                     </textField>
-                    <button verticalHuggingPriority="750" id="sC2-52-liU">
-                        <rect key="frame" x="363" y="14" width="54" height="28"/>
+                    <button verticalHuggingPriority="750" id="QdJ-64-GgC">
+                        <rect key="frame" x="332" y="14" width="80" height="28"/>
                         <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
                         <animations/>
-                        <buttonCell key="cell" type="push" title="Done" bezelStyle="rounded" alignment="center" controlSize="small" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="kDe-1L-VkD">
+                        <buttonCell key="cell" type="push" title="OK" bezelStyle="rounded" alignment="center" controlSize="small" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="iLI-Nb-D7t">
                             <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                             <font key="font" metaFont="smallSystem"/>
                             <string key="keyEquivalent" base64-UTF8="YES">
@@ -268,13 +268,28 @@ DQ
 </string>
                         </buttonCell>
                         <connections>
-                            <action selector="done:" target="-2" id="Rdg-PN-7l6"/>
+                            <action selector="ok:" target="-2" id="MND-2r-dHh"/>
+                        </connections>
+                    </button>
+                    <button verticalHuggingPriority="750" id="AAX-DK-L3G">
+                        <rect key="frame" x="254" y="14" width="80" height="28"/>
+                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+                        <animations/>
+                        <buttonCell key="cell" type="push" title="Cancel" bezelStyle="rounded" alignment="center" controlSize="small" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="ego-rt-a64">
+                            <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                            <font key="font" metaFont="smallSystem"/>
+                            <string key="keyEquivalent" base64-UTF8="YES">
+Gw
+</string>
+                        </buttonCell>
+                        <connections>
+                            <action selector="cancel:" target="-2" id="Ysh-pi-YX2"/>
                         </connections>
                     </button>
                 </subviews>
                 <animations/>
             </view>
-            <point key="canvasLocation" x="302.5" y="103.5"/>
+            <point key="canvasLocation" x="499.5" y="160.5"/>
         </window>
         <arrayController objectClassName="HBLang" id="ZBe-aP-wvq" userLabel="Table Controller" customClass="HBLanguageArrayController">
             <declaredKeys>
index f1b6ce8545769282088c8766957e14977fcd37a8..8f8872777cb0f592b34de5357c0d23cfa1e07f28 100644 (file)
@@ -355,6 +355,7 @@ NSString *HBAudioChangedNotification = @"HBAudioChangedNotification";
         [[self.undo prepareWithInvocationTarget:self] setDefaults:_defaults];
     }
     _defaults = defaults;
+    _defaults.undo = self.undo;
 }
 
 - (void)mixdownChanged
index 5baf50a064ddd558c3b8c995a64db83317a934f7..f3d49767de71d39a7377a3c442e69ee91bed353f 100644 (file)
 {
     HBAudioDefaults *defaults = (HBAudioDefaults *)CFBridgingRelease(contextInfo);
 
-    // If things changed, do this ugly
-    // operation to group the changes for the undo manager.
-    if (returnCode)
+    if (returnCode == NSModalResponseOK)
     {
-        defaults.undo = self.audio.defaults.undo;
         self.audio.defaults = defaults;
     }
     self.defaultsController = nil;
index cc90879de49ed75f30af79c705f6fe6a2c7c38d4..7f8db2009aedc442a1d82e1694d669c58fc2a468 100644 (file)
@@ -83,14 +83,17 @@ static void *HBAudioDefaultsContext = &HBAudioDefaultsContext;
     }
 }
 
-- (IBAction)done:(id)sender
+- (IBAction)ok:(id)sender
 {
+    self.settings.trackSelectionLanguages = [self.languagesList.selectedLanguages mutableCopy];
     [self.window orderOut:nil];
-    if (self.window.undoManager.canUndo)
-    {
-        self.settings.trackSelectionLanguages = [self.languagesList.selectedLanguages mutableCopy];
-    }
-    [NSApp endSheet:self.window returnCode:self.window.undoManager.canUndo];
+    [NSApp endSheet:self.window returnCode:NSModalResponseOK];
+}
+
+- (IBAction)cancel:(id)sender
+{
+    [self.window orderOut:nil];
+    [NSApp endSheet:self.window returnCode:NSModalResponseCancel];
 }
 
 - (void)dealloc
index 1cd900969d06c3f81065e360fe749998940b8f38..5ce04258f20765827726357124261aaa2a0c73dd 100644 (file)
@@ -302,6 +302,14 @@ static void *HBAudioEncoderContex = &HBAudioEncoderContex;
     {
         retval = [NSSet setWithObjects:@"encoder", nil];
     }
+    else if ([key isEqualToString:@"mixdowns"])
+    {
+        retval = [NSSet setWithObjects:@"encoder", nil];
+    }
+    else if ([key isEqualToString:@"bitRates"])
+    {
+        retval = [NSSet setWithObjects:@"encoder", @"mixdown", @"sampleRate", nil];
+    }
 
     return retval;
 }
index a61002dcc03c8b29cf74c52fdcd59cee4903a5d9..1c9b401ff115ed3615713ca807cf3884dd8b79d6 100644 (file)
@@ -240,6 +240,16 @@ extern NSString *keySubTrackSrtFileURL;
     self.defaults.undo = undo;
 }
 
+- (void)setDefaults:(HBSubtitlesDefaults *)defaults
+{
+    if (defaults != _defaults)
+    {
+        [[self.undo prepareWithInvocationTarget:self] setDefaults:_defaults];
+    }
+    _defaults = defaults;
+    _defaults.undo = self.undo;
+}
+
 /**
  *  Convenience method to add a track to subtitlesArray.
  *
index 99c0ac99806c167efc496c20eb27cd7b2e5e28ee..3cd47e215633a1c766c061c3b02b93d2889312e9 100644 (file)
 {
     HBSubtitlesDefaults *defaults = (HBSubtitlesDefaults *)CFBridgingRelease(contextInfo);
 
-    // If things changed, do this ugly
-    // operation to group the changes for the undo manager.
-    if (returnCode)
+    if (returnCode == NSModalResponseOK)
     {
-        defaults.undo = self.subtitles.defaults.undo;
         self.subtitles.defaults = defaults;
     }
     self.defaultsController = nil;
index a78a14b48b72424061272ca96929069761cb634e..a4e71bbff078a30a7a6e4c27e0cbccedd6f6234e 100644 (file)
@@ -64,14 +64,17 @@ static void *HBSubtitlesDefaultsContext = &HBSubtitlesDefaultsContext;
     self.tableController.showSelectedOnly = !self.tableController.showSelectedOnly;
 }
 
-- (IBAction)done:(id)sender
+- (IBAction)ok:(id)sender
 {
+    self.settings.trackSelectionLanguages = [self.languagesList.selectedLanguages mutableCopy];
     [self.window orderOut:nil];
-    if (self.window.undoManager.canUndo)
-    {
-        self.settings.trackSelectionLanguages = [self.languagesList.selectedLanguages mutableCopy];
-    }
-    [NSApp endSheet:self.window returnCode:self.window.undoManager.canUndo];
+    [NSApp endSheet:self.window returnCode:NSModalResponseOK];
+}
+
+- (IBAction)cancel:(id)sender
+{
+    [self.window orderOut:nil];
+    [NSApp endSheet:self.window returnCode:NSModalResponseCancel];
 }
 
 - (void)dealloc