]> granicus.if.org Git - handbrake/commitdiff
MacGui: end the textfields editing before adding a job to queue or creating a preset...
authorDamiano Galassi <damiog@gmail.com>
Thu, 16 Mar 2017 10:03:25 +0000 (11:03 +0100)
committerDamiano Galassi <damiog@gmail.com>
Thu, 16 Mar 2017 10:03:25 +0000 (11:03 +0100)
macosx/English.lproj/MainWindow.xib
macosx/HBController.m
macosx/NSWindow+HBAdditions.h
macosx/NSWindow+HBAdditions.m

index 13443946ff4a7857ee36bcb9322725baa98d8752..3b1d50aab800f6daf03982fa1c4b59e92efc97cc 100644 (file)
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="12113" systemVersion="16E175b" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="12117" systemVersion="16E189a" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
     <dependencies>
         <deployment identifier="macosx"/>
         <development version="7000" identifier="xcode"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="12113"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="12117"/>
     </dependencies>
     <objects>
         <customObject id="-2" userLabel="File's Owner" customClass="HBController">
                                     <string key="NSValueTransformerName">NSIsNotNil</string>
                                 </dictionary>
                             </binding>
-                            <binding destination="-2" name="value" keyPath="self.job.outputFileName" id="cct-2d-Ycx">
-                                <dictionary key="options">
-                                    <bool key="NSContinuouslyUpdatesValue" value="YES"/>
-                                </dictionary>
-                            </binding>
+                            <binding destination="-2" name="value" keyPath="self.job.outputFileName" id="NAL-fw-AF5"/>
                         </connections>
                     </textField>
                     <textField hidden="YES" toolTip="First second to encode." verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" id="5491">
@@ -632,58 +628,36 @@ Blu-ray and DVD sources often have multiple titles, the longest of which is typi
                 <allowedToolbarItems>
                     <toolbarItem implicitItemIdentifier="NSToolbarSpaceItem" id="ZEH-cS-zXY"/>
                     <toolbarItem implicitItemIdentifier="NSToolbarFlexibleSpaceItem" id="wjB-Tl-5qq"/>
-                    <toolbarItem implicitItemIdentifier="B3BAB305-77BF-4967-B8E6-D11F40EF822B" label="Open Source" paletteLabel="Open Source" toolTip="Open Source" tag="-1" image="source" id="8r8-nZ-dYs">
+                    <toolbarItem implicitItemIdentifier="DE791733-5430-4B2F-B91D-ACAA95BAF7F0" label="Open Source" paletteLabel="Open Source" toolTip="Open Source" tag="-1" image="source" id="8r8-nZ-dYs">
                         <connections>
                             <action selector="browseSources:" target="-2" id="zi1-Tk-0YL"/>
                         </connections>
                     </toolbarItem>
-                    <toolbarItem implicitItemIdentifier="4CAB4280-DF01-4BDC-B23B-98BD6E6190F4" label="Start" paletteLabel="Start Encoding" toolTip="Start Encoding" tag="-1" image="encode" id="byg-kj-sEM">
+                    <toolbarItem implicitItemIdentifier="10063EA1-C821-4363-8F59-7840853EB568" label="Start" paletteLabel="Start Encoding" toolTip="Start Encoding" tag="-1" image="encode" id="byg-kj-sEM">
                         <connections>
                             <action selector="rip:" target="-2" id="f6w-0B-Qvn"/>
                         </connections>
                     </toolbarItem>
-                    <toolbarItem implicitItemIdentifier="E4C5E251-DD8D-4288-AC80-AF8E654B7A32" label="Pause" paletteLabel="Pause Encoding" toolTip="Pause Encoding" tag="-1" image="pauseencode" id="wTQ-KF-5KW">
+                    <toolbarItem implicitItemIdentifier="B4A5CE50-6CD5-4CD0-B639-E1516E1C85C1" label="Pause" paletteLabel="Pause Encoding" toolTip="Pause Encoding" tag="-1" image="pauseencode" id="wTQ-KF-5KW">
                         <connections>
                             <action selector="pause:" target="-2" id="AN1-8V-lc1"/>
                         </connections>
                     </toolbarItem>
-                    <toolbarItem implicitItemIdentifier="69E83092-D0D1-48A5-BF46-99EFB3EC630A" label="Add To Queue" paletteLabel="Add To Queue" toolTip="Add To Queue" tag="-1" image="addqueue" id="DZZ-Fe-wjw">
+                    <toolbarItem implicitItemIdentifier="3B6A53EE-F973-41A7-A0DF-AEBD73DAC28E" label="Add To Queue" paletteLabel="Add To Queue" toolTip="Add To Queue" tag="-1" image="addqueue" id="DZZ-Fe-wjw">
                         <size key="minSize" width="32" height="32"/>
                         <size key="maxSize" width="32" height="32"/>
                         <connections>
                             <action selector="addToQueue:" target="-2" id="TRB-HE-1GW"/>
                         </connections>
                     </toolbarItem>
-                    <toolbarItem implicitItemIdentifier="6EFCA879-A80D-45D7-A846-EAD85261F864" label="Queue" paletteLabel="Show Queue Window" toolTip="Show Queue Window" tag="-1" image="showqueue" id="HCx-ku-nF7" customClass="HBToolbarBadgedItem">
-                        <size key="minSize" width="32" height="32"/>
-                        <size key="maxSize" width="32" height="32"/>
-                        <connections>
-                            <action selector="showQueueWindow:" target="-1" id="vZB-dY-DbD"/>
-                        </connections>
-                    </toolbarItem>
-                    <toolbarItem implicitItemIdentifier="DAAC2346-2B39-4A35-A62B-C12826F6AB42" label="Preview" paletteLabel="Show Preview Window" toolTip="Show Preview Window" tag="-1" image="preview" id="dK4-jt-v4K">
-                        <connections>
-                            <action selector="showPreviewWindow:" target="-2" id="uci-BT-5bQ"/>
-                        </connections>
-                    </toolbarItem>
-                    <toolbarItem implicitItemIdentifier="D9753B5B-F09B-451E-9FD8-E8DD979FBFA2" label="Activity Log" paletteLabel="Show Activity Window" toolTip="Show Activity Window" tag="-1" image="activity" id="p7Q-L3-zcW">
-                        <connections>
-                            <action selector="showOutputPanel:" target="-1" id="TxI-PX-wlm"/>
-                        </connections>
-                    </toolbarItem>
-                    <toolbarItem implicitItemIdentifier="B774D9D7-AE89-4C1A-8685-D631473867F6" label="Toggle Presets" paletteLabel="Toggle Presets" toolTip="Open/Close Presets List" tag="-1" image="presets" id="9ll-Jg-YAB">
-                        <connections>
-                            <action selector="toggleDrawer:" target="-2" id="YN2-RM-4ss"/>
-                        </connections>
-                    </toolbarItem>
-                    <toolbarItem implicitItemIdentifier="BC981D6D-0945-4001-BCB0-F9A1BBBD2C04" label="Add Titles To Queue" paletteLabel="Add Titles To Queue" image="addqueue" id="38K-hd-P5J">
+                    <toolbarItem implicitItemIdentifier="A5F62853-5047-43C2-AD64-73654B0E34B2" label="Add Titles To Queue" paletteLabel="Add Titles To Queue" image="addqueue" id="38K-hd-P5J">
                         <nil key="toolTip"/>
                         <size key="minSize" width="58" height="32"/>
                         <size key="maxSize" width="58" height="32"/>
                         <popUpButton key="view" misplaced="YES" imageHugsTitle="YES" id="pJJ-0V-TQq">
                             <rect key="frame" x="28" y="14" width="58" height="25"/>
                             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" heightSizable="YES"/>
-                            <popUpButtonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" image="addqueue" alignment="center" lineBreakMode="truncatingTail" state="on" inset="2" pullsDown="YES" id="BAK-n3-eIN">
+                            <popUpButtonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" alignment="center" lineBreakMode="truncatingTail" state="on" inset="2" pullsDown="YES" id="BAK-n3-eIN">
                                 <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                 <font key="font" metaFont="menu"/>
                                 <menu key="menu" id="QCi-1O-Msg">
@@ -710,6 +684,28 @@ Blu-ray and DVD sources often have multiple titles, the longest of which is typi
                             </popUpButtonCell>
                         </popUpButton>
                     </toolbarItem>
+                    <toolbarItem implicitItemIdentifier="29BB9965-48E8-4B07-97B2-3C3706F3D150" label="Queue" paletteLabel="Show Queue Window" toolTip="Show Queue Window" tag="-1" image="showqueue" id="HCx-ku-nF7" customClass="HBToolbarBadgedItem">
+                        <size key="minSize" width="32" height="32"/>
+                        <size key="maxSize" width="32" height="32"/>
+                        <connections>
+                            <action selector="showQueueWindow:" target="-1" id="vZB-dY-DbD"/>
+                        </connections>
+                    </toolbarItem>
+                    <toolbarItem implicitItemIdentifier="90131A42-4120-458B-A63F-04A8D7486202" label="Preview" paletteLabel="Show Preview Window" toolTip="Show Preview Window" tag="-1" image="preview" id="dK4-jt-v4K">
+                        <connections>
+                            <action selector="showPreviewWindow:" target="-2" id="uci-BT-5bQ"/>
+                        </connections>
+                    </toolbarItem>
+                    <toolbarItem implicitItemIdentifier="AC64166E-55C9-431A-8085-74C960AAF1D5" label="Activity Log" paletteLabel="Show Activity Window" toolTip="Show Activity Window" tag="-1" image="activity" id="p7Q-L3-zcW">
+                        <connections>
+                            <action selector="showOutputPanel:" target="-1" id="TxI-PX-wlm"/>
+                        </connections>
+                    </toolbarItem>
+                    <toolbarItem implicitItemIdentifier="44A85DDE-F1ED-47FD-9A02-6B6DDF515FD8" label="Toggle Presets" paletteLabel="Toggle Presets" toolTip="Open/Close Presets List" tag="-1" image="presets" id="9ll-Jg-YAB">
+                        <connections>
+                            <action selector="toggleDrawer:" target="-2" id="YN2-RM-4ss"/>
+                        </connections>
+                    </toolbarItem>
                 </allowedToolbarItems>
                 <defaultToolbarItems>
                     <toolbarItem reference="8r8-nZ-dYs"/>
index 5b721237bfe79ea0862bc210333b8146540e8d0d..d29a10876fc7fb02d2e87bdd8bc9d23dfbef0c07 100644 (file)
@@ -9,6 +9,7 @@
 #import "HBToolbarBadgedItem.h"
 #import "HBQueueController.h"
 #import "HBTitleSelectionController.h"
+#import "NSWindow+HBAdditions.h"
 
 #import "HBPresetsManager.h"
 #import "HBPreset.h"
  */
 - (void)doAddToQueue
 {
+    [self.window HB_endEditing];
     [fQueueController addJob:[self.job copy]];
 }
 
 
 - (IBAction)addTitlesToQueue:(id)sender
 {
+    [self.window HB_endEditing];
+
     self.titlesSelectionController = [[HBTitleSelectionController alloc] initWithTitles:self.core.titles
                                                                              presetName:self.job.presetName
                                                                                delegate:self];
 
 - (IBAction)showAddPresetPanel:(id)sender
 {
+    [self.window HB_endEditing];
+
     BOOL defaultToCustom = ((self.job.picture.width + self.job.picture.cropRight + self.job.picture.cropLeft) < self.job.picture.sourceWidth) ||
                            ((self.job.picture.height + self.job.picture.cropTop + self.job.picture.cropBottom) < self.job.picture.sourceHeight);
 
index e8ceb3c0490e193ebf92afb3f0b953f08b9dd52d..caaeaf98263bf6500037f54fee352f1a70df76f3 100644 (file)
@@ -1,10 +1,8 @@
-//
-//  NSWindow+HBAdditions.h
-//  HandBrake
-//
-//  Created by Damiano Galassi on 25/04/16.
-//
-//
+/*  NSWindow+HBAdditions.h
+
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr/>.
+ It may be used under the terms of the GNU General Public License. */
 
 #import <Cocoa/Cocoa.h>
 
  */
 - (void)HB_resizeToBestSizeForViewSize:(NSSize)viewSize center:(NSPoint)center animate:(BOOL)performAnimation;
 
-
 /**
  *  Calculates and returns the center point of the window
  */
 - (NSPoint)HB_centerPoint;
 
+/**
+ End editing on the field editor
+ and keep the current first responder.
+
+ @return success
+ */
+- (BOOL)HB_endEditing;
+
+/**
+ Force end editing.
+ */
+- (void)HB_forceEndEditing;
+
 
 @end
index 2951d7a1f4c5528d3ee84631b4d2ea29ec57253c..fbf65f116c5d691930e7e9ede93a343da855dfd2 100644 (file)
@@ -1,10 +1,8 @@
-//
-//  NSWindow+HBAdditions.m
-//  HandBrake
-//
-//  Created by Damiano Galassi on 25/04/16.
-//
-//
+/*  NSWindow+HBAdditions.m
+
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr/>.
+ It may be used under the terms of the GNU General Public License. */
 
 #import "NSWindow+HBAdditions.h"
 
     return center;
 }
 
+- (BOOL)HB_endEditing;
+{
+    BOOL success;
+    id responder = self.firstResponder;
+
+    // If we're dealing with the field editor, the real first responder is
+    // its delegate.
+    if ((responder != nil) && [responder isKindOfClass:[NSTextView class]] && [(NSTextView*)responder isFieldEditor])
+    {
+        responder = ([[responder delegate] isKindOfClass:[NSResponder class]]) ? [responder delegate] : nil;
+    }
+
+    success = [self makeFirstResponder:nil];
+
+    // Return first responder status.
+    if (success && responder != nil)
+    {
+        [self makeFirstResponder:responder];
+    }
+
+    return success;
+}
+
+- (void)HB_forceEndEditing;
+{
+    [self endEditingFor:nil];
+}
+
+
 
 @end