diff options
author | ritsuka <[email protected]> | 2014-11-23 12:54:31 +0000 |
---|---|---|
committer | ritsuka <[email protected]> | 2014-11-23 12:54:31 +0000 |
commit | 9e0dcb82bdbf0801b79b84241ab67088c2fb0553 (patch) | |
tree | 7eb8845516a8e3bb091e07a0eaa40e8459c1a93e /macosx | |
parent | 20e1a9b2e253fe2d59dbf64a878e735a8d4d7c91 (diff) |
MacGui: moved the "add preset" window to its own window controller class. Keep the current settings when changing title or scanning a new file.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6538 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/Controller.h | 19 | ||||
-rw-r--r-- | macosx/Controller.m | 201 | ||||
-rw-r--r-- | macosx/English.lproj/AddPreset.xib | 205 | ||||
-rw-r--r-- | macosx/English.lproj/MainMenu.xib | 198 | ||||
-rw-r--r-- | macosx/HBAddPresetController.h | 20 | ||||
-rw-r--r-- | macosx/HBAddPresetController.m | 138 | ||||
-rw-r--r-- | macosx/HBPreset.h | 4 | ||||
-rw-r--r-- | macosx/HBPresetsManager.h | 9 | ||||
-rw-r--r-- | macosx/HBPresetsManager.m | 9 | ||||
-rw-r--r-- | macosx/HBQueueOutlineView.h | 46 | ||||
-rw-r--r-- | macosx/HBQueueOutlineView.m | 97 | ||||
-rw-r--r-- | macosx/HandBrake.xcodeproj/project.pbxproj | 18 |
12 files changed, 626 insertions, 338 deletions
diff --git a/macosx/Controller.h b/macosx/Controller.h index 925aaab10..1dc56759d 100644 --- a/macosx/Controller.h +++ b/macosx/Controller.h @@ -148,20 +148,10 @@ extern NSString *keyTitleTag; /* User Preset variables here */ HBPresetsManager * presetManager; HBPresetsViewController * fPresetsView; - IBOutlet NSMenu * presetsMenu; + IBOutlet NSMenu * presetsMenu; IBOutlet NSDrawer * fPresetDrawer; - IBOutlet NSTextField * fPresetNewName; - IBOutlet NSTextField * fPresetNewDesc; - IBOutlet NSPopUpButton * fPresetNewPicSettingsPopUp; - IBOutlet NSTextField * fPresetNewPicWidth; - IBOutlet NSTextField * fPresetNewPicHeight; - IBOutlet NSBox * fPresetNewPicWidthHeightBox; - - IBOutlet NSButton * fPresetNewPicFiltersCheck; - IBOutlet NSTextField * fPresetSelectedDisplay; - - IBOutlet NSPanel * fAddPresetPanel; + IBOutlet NSTextField * fPresetSelectedDisplay; hb_handle_t * fHandle; @@ -184,6 +174,7 @@ extern NSString *keyTitleTag; of encode 0==idle, 1==encoding, 2==cancelled*/ int fEncodeState; BOOL SuccessfulScan; + BOOL titleLoaded; BOOL applyQueueToScan; NSString * currentSource; NSString * browsedSourceDisplayName; @@ -295,13 +286,9 @@ extern NSString *keyTitleTag; /* Manage User presets */ - (IBAction) customSettingUsed: (id) sender; - (IBAction) showAddPresetPanel: (id) sender; -- (IBAction) addPresetPicDropdownChanged: (id) sender; -- (IBAction) closeAddPresetPanel: (id) sender; -- (NSDictionary *)createPreset; - (IBAction)selectDefaultPreset:(id)sender; - (IBAction)addFactoryPresets:(id)sender; -- (IBAction)addUserPreset:(id)sender; -(void)sendToMetaX:(NSString *) filePath; // Growl methods diff --git a/macosx/Controller.m b/macosx/Controller.m index b44b58265..f22dfdee5 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -16,6 +16,7 @@ #import "HBUtilities.h" #import "HBPresetsViewController.h" +#import "HBAddPresetController.h" #import "HBAudioDefaults.h" #import "HBSubtitlesDefaults.h" @@ -1818,6 +1819,12 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It NSString *path = scanPath; HBDVDDetector *detector = [HBDVDDetector detectorForPath:path]; + // Save the current settings + if (titleLoaded) { + self.selectedPreset = [self createPresetFromCurrentSettings]; + titleLoaded = NO; + } + [fPictureController setTitle:NULL]; // Notify anyone interested (audio/subtitles/chapters controller) that there's no title @@ -2060,6 +2067,9 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It SuccessfulScan = YES; [self titlePopUpChanged:nil]; + + titleLoaded = YES; + [self encodeStartStopPopUpChanged:nil]; [self enableUI: YES]; @@ -4270,6 +4280,12 @@ fWorkingCount = 0; hb_title_t * title = (hb_title_t*) hb_list_item( list, (int)[fSrcTitlePopUp indexOfSelectedItem] ); + // If there is already a title load, save the current settings to a preset + if (titleLoaded) + { + self.selectedPreset = [self createPresetFromCurrentSettings]; + } + /* If we are a stream type and a batch scan, grok the output file name from title->name upon title change */ if ((title->type == HB_STREAM_TYPE || title->type == HB_FF_STREAM_TYPE) && hb_list_count( list ) > 1 ) @@ -4345,7 +4361,7 @@ fWorkingCount = 0; [self updateFileName]; } - /* lets call tableViewSelected to make sure that any preset we have selected is enforced after a title change */ + /* apply the current preset */ [self applyPreset:self.selectedPreset]; } @@ -4907,147 +4923,84 @@ the user is using "Custom" settings by determining the sender*/ } } -- (IBAction) addPresetPicDropdownChanged: (id) sender +- (IBAction)showAddPresetPanel:(id)sender { - if ([[fPresetNewPicSettingsPopUp selectedItem] tag] == 1) - { - [fPresetNewPicWidthHeightBox setHidden:NO]; - } - else - { - [fPresetNewPicWidthHeightBox setHidden:YES]; - } -} + /* Show the add panel */ + HBAddPresetController *addPresetController = [[HBAddPresetController alloc] initWithPreset:[self createPresetFromCurrentSettings] + videoSize:NSMakeSize(fTitle->job->width, fTitle->job->height)]; -- (IBAction) showAddPresetPanel: (id) sender -{ - /* - * Populate the preset picture settings popup. - * - * Custom is not applicable when the anamorphic mode is Strict. - * - * Use [NSMenuItem tag] to store preset values for each option. - */ - [fPresetNewPicSettingsPopUp removeAllItems]; - [fPresetNewPicSettingsPopUp addItemWithTitle:@"None"]; - [[fPresetNewPicSettingsPopUp lastItem] setTag: 0]; - if (fTitle->job->anamorphic.mode != HB_ANAMORPHIC_STRICT) - { - // not Strict, Custom is applicable - [fPresetNewPicSettingsPopUp addItemWithTitle:@"Custom"]; - [[fPresetNewPicSettingsPopUp lastItem] setTag: 1]; - } - [fPresetNewPicSettingsPopUp addItemWithTitle:@"Source Maximum (post source scan)"]; - [[fPresetNewPicSettingsPopUp lastItem] setTag: 2]; - /* - * Default to Source Maximum for anamorphic Strict - * Default to Custom for all other anamorphic modes - */ - [fPresetNewPicSettingsPopUp selectItemWithTag: (1 + (fTitle->job->anamorphic.mode == HB_ANAMORPHIC_STRICT))]; - /* Save the current filters in the preset by default */ - [fPresetNewPicFiltersCheck setState:NSOnState]; - /* Erase info from the input fields*/ - [fPresetNewName setStringValue: @""]; - [fPresetNewDesc setStringValue: @""]; - - /* Initialize custom height and width settings to current values */ - - [fPresetNewPicWidth setStringValue: [NSString stringWithFormat:@"%d",fTitle->job->width]]; - [fPresetNewPicHeight setStringValue: [NSString stringWithFormat:@"%d",fTitle->job->height]]; - [self addPresetPicDropdownChanged:nil]; - /* Show the panel */ - [NSApp beginSheet:fAddPresetPanel modalForWindow:fWindow modalDelegate:nil didEndSelector:NULL contextInfo:NULL]; + [NSApp beginSheet:addPresetController.window modalForWindow:fWindow modalDelegate:self didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:addPresetController]; } -- (IBAction) closeAddPresetPanel: (id) sender +- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo { - [NSApp endSheet: fAddPresetPanel]; - [fAddPresetPanel orderOut: self]; -} + HBAddPresetController *addPresetController = (HBAddPresetController *)contextInfo; -- (IBAction)addUserPreset:(id)sender -{ - if (![[fPresetNewName stringValue] length]) + if (returnCode == NSModalResponseContinue) { - NSAlert *alert = [[NSAlert alloc] init]; - [alert setMessageText:@"Warning!"]; - [alert setInformativeText:@"You need to insert a name for the preset."]; - [alert runModal]; - [alert release]; + [presetManager addPreset:addPresetController.preset]; } - else - { - /* Here we create a custom user preset */ - [presetManager addPreset:[self createPreset]]; - [self closeAddPresetPanel:nil]; - } + [addPresetController release]; } -- (NSDictionary *)createPreset +- (HBPreset *)createPresetFromCurrentSettings { - NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; - /* Preset build number */ - [preset setObject:[NSString stringWithFormat: @"%d", [[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"] intValue]] forKey:@"PresetBuildNumber"]; - [preset setObject:[fPresetNewName stringValue] forKey:@"PresetName"]; - /* Get the New Preset Name from the field in the AddPresetPanel */ - [preset setObject:[fPresetNewName stringValue] forKey:@"PresetName"]; - /* Set whether or not this is to be a folder fPresetNewFolderCheck*/ - [preset setObject:[NSNumber numberWithBool:NO] forKey:@"Folder"]; - /*Set whether or not this is a user preset or factory 0 is factory, 1 is user*/ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"Type"]; - /*Set whether or not this is default, at creation set to 0*/ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; - - /*Get the whether or not to apply pic Size and Cropping (includes Anamorphic)*/ - [preset setObject:[NSNumber numberWithInteger:[[fPresetNewPicSettingsPopUp selectedItem] tag]] forKey:@"UsesPictureSettings"]; - /* Get whether or not to use the current Picture Filter settings for the preset */ - [preset setObject:[NSNumber numberWithInteger:[fPresetNewPicFiltersCheck state]] forKey:@"UsesPictureFilters"]; - - /* Get New Preset Description from the field in the AddPresetPanel*/ - [preset setObject:[fPresetNewDesc stringValue] forKey:@"PresetDescription"]; - /* File Format */ - [preset setObject:[fDstFormatPopUp titleOfSelectedItem] forKey:@"FileFormat"]; - /* Chapter Markers fCreateChapterMarkers*/ - [preset setObject:@(fChapterTitlesController.createChapterMarkers) forKey:@"ChapterMarkers"]; - /* Mux mp4 with http optimization */ - [preset setObject:[NSNumber numberWithInteger:[fDstMp4HttpOptFileCheck state]] forKey:@"Mp4HttpOptimize"]; - /* Add iPod uuid atom */ - [preset setObject:[NSNumber numberWithInteger:[fDstMp4iPodFileCheck state]] forKey:@"Mp4iPodCompatible"]; - - /* Codecs */ - /* Video encoder */ + NSMutableDictionary *preset = [NSMutableDictionary dictionary]; + NSDictionary *currentPreset = self.selectedPreset.content; + + preset[@"PresetBuildNumber"] = [NSString stringWithFormat: @"%d", [[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"] intValue]]; + preset[@"PresetName"] = fPresetSelectedDisplay.stringValue; + preset[@"Folder"] = @NO; + + // Set whether or not this is a user preset or factory 0 is factory, 1 is user + preset[@"Type"] = @1; + preset[@"Default"] = @0; + + // Get the whether or not to apply pic Size and Cropping (includes Anamorphic) + preset[@"UsesPictureSettings"] = currentPreset[@"UsesPictureSettings"]; + // Get whether or not to use the current Picture Filter settings for the preset + preset[@"UsesPictureFilters"] = currentPreset[@"UsesPictureFilters"]; + + preset[@"PresetDescription"] = currentPreset[@"PresetDescription"]; + preset[@"FileFormat"] = fDstFormatPopUp.titleOfSelectedItem; + preset[@"ChapterMarkers"] = @(fChapterTitlesController.createChapterMarkers); + + // Mux mp4 with http optimization + preset[@"Mp4HttpOptimize"] = @(fDstMp4HttpOptFileCheck.state); + // Add iPod uuid atom + preset[@"Mp4iPodCompatible"] = @(fDstMp4iPodFileCheck.state); + + // Video encoder [fVideoController prepareVideoForPreset:preset]; - /*Picture Settings*/ - hb_job_t * job = fTitle->job; - - /* Picture Sizing */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"UsesMaxPictureSettings"]; - [preset setObject:[NSNumber numberWithInt:[fPresetNewPicWidth intValue]] forKey:@"PictureWidth"]; - [preset setObject:[NSNumber numberWithInt:[fPresetNewPicHeight intValue]] forKey:@"PictureHeight"]; - [preset setObject:[NSNumber numberWithInt:fTitle->job->anamorphic.keep_display_aspect] forKey:@"PictureKeepRatio"]; - [preset setObject:[NSNumber numberWithInt:fTitle->job->anamorphic.mode] forKey:@"PicturePAR"]; - [preset setObject:[NSNumber numberWithInt:fTitle->job->modulus] forKey:@"PictureModulus"]; + // Picture Sizing + preset[@"PictureWidth"] = currentPreset[@"PictureWidth"]; + preset[@"PictureHeight"] = currentPreset[@"PictureHeight"]; - /* Set crop settings here */ - [preset setObject:[NSNumber numberWithInt:[fPictureController autoCrop]] forKey:@"PictureAutoCrop"]; - [preset setObject:[NSNumber numberWithInt:job->crop[0]] forKey:@"PictureTopCrop"]; - [preset setObject:[NSNumber numberWithInt:job->crop[1]] forKey:@"PictureBottomCrop"]; - [preset setObject:[NSNumber numberWithInt:job->crop[2]] forKey:@"PictureLeftCrop"]; - [preset setObject:[NSNumber numberWithInt:job->crop[3]] forKey:@"PictureRightCrop"]; - - /* Picture Filters */ + hb_job_t *job = fTitle->job; + preset[@"PictureKeepRatio"] = @(job->anamorphic.keep_display_aspect); + preset[@"PicturePAR"] = @(job->anamorphic.mode); + preset[@"PictureModulus"] = @(job->modulus); + + // Set crop settings + preset[@"PictureAutoCrop"] = @(fPictureController.autoCrop); + + preset[@"PictureTopCrop"] = @(job->crop[0]); + preset[@"PictureBottomCrop"] = @(job->crop[1]); + preset[@"PictureLeftCrop"] = @(job->crop[2]); + preset[@"PictureRightCrop"] = @(job->crop[3]); + + // Picture Filters [fPictureController.filters prepareFiltersForPreset:preset]; - /* Audio */ + // Audio [fAudioController.settings prepareAudioDefaultsForPreset:preset]; - /* Subtitles */ + // Subtitles [fSubtitlesViewController.settings prepareSubtitlesDefaultsForPreset:preset]; - [preset autorelease]; - return preset; + return [[[HBPreset alloc] initWithName:preset[@"PresetName"] content:preset builtIn:NO] autorelease]; } @@ -5121,9 +5074,9 @@ the user is using "Custom" settings by determining the sender*/ [[NSUserDefaults standardUserDefaults] setURL:importPresetsDirectory forKey:@"LastPresetImportDirectoryURL"]; /* NOTE: here we need to do some sanity checking to verify we do not hose up our presets file */ - NSMutableArray * presetsToImport = [[NSMutableArray alloc] initWithContentsOfURL:importPresetsFile]; + NSMutableArray *presetsToImport = [[NSMutableArray alloc] initWithContentsOfURL:importPresetsFile]; /* iterate though the new array of presets to import and add them to our presets array */ - for (id tempObject in presetsToImport) + for (NSMutableDictionary *tempObject in presetsToImport) { /* make any changes to the incoming preset we see fit */ /* make sure the incoming preset is not tagged as default */ @@ -5133,7 +5086,7 @@ the user is using "Custom" settings by determining the sender*/ [tempObject setObject:prependedName forKey:@"PresetName"]; /* actually add the new preset to our presets array */ - [presetManager addPreset:tempObject]; + [presetManager addPresetFromDictionary:tempObject]; } [presetsToImport autorelease]; }]; diff --git a/macosx/English.lproj/AddPreset.xib b/macosx/English.lproj/AddPreset.xib new file mode 100644 index 000000000..64ed003ef --- /dev/null +++ b/macosx/English.lproj/AddPreset.xib @@ -0,0 +1,205 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="6250" systemVersion="14C68k" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none"> + <dependencies> + <deployment version="1060" identifier="macosx"/> + <development version="5100" identifier="xcode"/> + <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="6250"/> + </dependencies> + <objects> + <customObject id="-2" userLabel="File's Owner" customClass="HBAddPresetController"> + <connections> + <outlet property="desc" destination="8kl-Sh-Gh7" id="Go1-hY-VFV"/> + <outlet property="name" destination="aKg-n4-OUS" id="FXa-ee-AN8"/> + <outlet property="picFilters" destination="zJI-d5-0k8" id="caQ-ST-efg"/> + <outlet property="picHeight" destination="Mga-dS-8BF" id="blD-Jx-MtN"/> + <outlet property="picSettingsPopUp" destination="z6B-ig-ouq" id="Nxq-Lm-dmh"/> + <outlet property="picWidth" destination="gOg-oO-8ar" id="oOu-qH-C4Q"/> + <outlet property="picWidthHeightBox" destination="H9n-64-GXz" id="aUH-bq-e2x"/> + <outlet property="window" destination="dbZ-Wo-9nG" id="BGs-m9-Ptx"/> + </connections> + </customObject> + <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/> + <customObject id="-3" userLabel="Application" customClass="NSObject"/> + <window title="Create A New Preset" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="dbZ-Wo-9nG" userLabel="AddPresetPanel"> + <windowStyleMask key="styleMask" titled="YES"/> + <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/> + <rect key="contentRect" x="421" y="536" width="338" height="281"/> + <rect key="screenRect" x="0.0" y="0.0" width="2560" height="1417"/> + <value key="minSize" type="size" width="338" height="232"/> + <view key="contentView" id="AcO-9f-fnb"> + <rect key="frame" x="0.0" y="0.0" width="338" height="281"/> + <autoresizingMask key="autoresizingMask"/> + <subviews> + <button verticalHuggingPriority="750" id="fLU-xs-0du"> + <rect key="frame" x="239" y="13" width="85" height="32"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <buttonCell key="cell" type="push" title="Add" bezelStyle="rounded" alignment="center" borderStyle="border" inset="2" id="Deg-rS-mRc"> + <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/> + <font key="font" metaFont="system"/> + <string key="keyEquivalent" base64-UTF8="YES"> +DQ +</string> + </buttonCell> + <connections> + <action selector="add:" target="-2" id="8sP-tP-fJv"/> + </connections> + </button> + <button verticalHuggingPriority="750" id="Y03-Ts-ZA4"> + <rect key="frame" x="155" y="13" width="84" height="32"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <buttonCell key="cell" type="push" title="Cancel" bezelStyle="rounded" alignment="center" borderStyle="border" inset="2" id="5Xb-gz-QEa"> + <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/> + <font key="font" metaFont="system"/> + <string key="keyEquivalent" base64-UTF8="YES"> +Gw +</string> + </buttonCell> + <connections> + <action selector="cancel:" target="-2" id="Ygd-gd-Yd0"/> + </connections> + </button> + <textField verticalHuggingPriority="750" id="aKg-n4-OUS"> + <rect key="frame" x="20" y="229" width="298" height="19"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="xe0-bj-f3Z"> + <font key="font" metaFont="smallSystem"/> + <color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/> + <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> + </textFieldCell> + </textField> + <popUpButton verticalHuggingPriority="750" id="z6B-ig-ouq"> + <rect key="frame" x="128" y="180" width="193" height="22"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" controlSize="small" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" inset="2" arrowPosition="arrowAtCenter" preferredEdge="maxY" id="Mi7-V1-sSf"> + <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/> + <font key="font" metaFont="smallSystem"/> + <menu key="menu" title="OtherViews" id="qsA-gt-zdK"/> + </popUpButtonCell> + <connections> + <action selector="addPresetPicDropdownChanged:" target="-2" id="tfe-c5-8JF"/> + </connections> + </popUpButton> + <textField verticalHuggingPriority="750" id="Wy7-cF-tGv"> + <rect key="frame" x="17" y="252" width="303" height="14"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" alignment="left" title="Preset Name:" id="jhj-Et-ncF"> + <font key="font" metaFont="smallSystem"/> + <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> + <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> + </textFieldCell> + </textField> + <textField verticalHuggingPriority="750" id="Wpk-WC-aVk"> + <rect key="frame" x="17" y="201" width="98" height="20"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" alignment="left" title="Picture Settings:" id="75B-xq-Qbe"> + <font key="font" metaFont="smallSystem"/> + <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> + <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> + </textFieldCell> + </textField> + <textField verticalHuggingPriority="750" id="zDq-QP-LAu"> + <rect key="frame" x="17" y="106" width="84" height="14"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" title="Description:" id="hc8-1h-Jye"> + <font key="font" metaFont="smallSystem"/> + <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> + <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> + </textFieldCell> + </textField> + <textField verticalHuggingPriority="750" id="8kl-Sh-Gh7"> + <rect key="frame" x="20" y="61" width="298" height="41"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <textFieldCell key="cell" controlSize="small" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="HKY-Cq-VyU"> + <font key="font" metaFont="smallSystem"/> + <color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/> + <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> + </textFieldCell> + </textField> + <textField verticalHuggingPriority="750" id="PBQ-YN-YLi"> + <rect key="frame" x="18" y="185" width="108" height="14"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" alignment="right" title="Use Picture Size:" id="yYI-zX-ctL"> + <font key="font" metaFont="smallSystem"/> + <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> + <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> + </textFieldCell> + </textField> + <button id="zJI-d5-0k8"> + <rect key="frame" x="128" y="132" width="24" height="18"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" alignment="left" controlSize="small" state="on" inset="2" id="a3h-LA-LEO"> + <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> + <font key="font" metaFont="smallSystem"/> + </buttonCell> + </button> + <box verticalHuggingPriority="750" title="Box" boxType="separator" titlePosition="noTitle" id="uCB-5u-Rt4"> + <rect key="frame" x="113" y="210" width="205" height="5"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/> + <color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> + <font key="titleFont" metaFont="system"/> + </box> + <box verticalHuggingPriority="750" title="Box" boxType="separator" titlePosition="noTitle" id="GHj-H0-hyS"> + <rect key="frame" x="91" y="108" width="227" height="5"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/> + <color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> + <font key="titleFont" metaFont="system"/> + </box> + <textField verticalHuggingPriority="750" id="sep-4m-XLj"> + <rect key="frame" x="17" y="134" width="109" height="15"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" alignment="right" title="Use Picture Filters:" id="GNd-Vz-0ao"> + <font key="font" metaFont="smallSystem"/> + <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> + <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> + </textFieldCell> + </textField> + <box autoresizesSubviews="NO" title="Box" borderType="none" titlePosition="noTitle" id="H9n-64-GXz"> + <rect key="frame" x="128" y="153" width="155" height="32"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <view key="contentView"> + <rect key="frame" x="0.0" y="0.0" width="155" height="32"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> + <subviews> + <textField verticalHuggingPriority="750" id="gOg-oO-8ar"> + <rect key="frame" x="3" y="6" width="52" 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="right" drawsBackground="YES" id="ExG-3m-WxY"> + <font key="font" metaFont="miniSystem"/> + <color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/> + <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> + </textFieldCell> + </textField> + <textField verticalHuggingPriority="750" id="mQk-Ua-wzc"> + <rect key="frame" x="53" y="6" width="29" height="15"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" alignment="center" title="X" id="Nfk-ix-xIv"> + <font key="font" metaFont="smallSystem"/> + <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> + <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> + </textFieldCell> + </textField> + <textField verticalHuggingPriority="750" id="Mga-dS-8BF"> + <rect key="frame" x="82" y="6" width="52" 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="tBe-1m-0r9"> + <font key="font" metaFont="miniSystem"/> + <color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/> + <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> + </textFieldCell> + </textField> + </subviews> + </view> + <color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/> + <color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> + </box> + </subviews> + </view> + <connections> + <outlet property="delegate" destination="-2" id="YgD-Uk-vtp"/> + </connections> + <point key="canvasLocation" x="570" y="406.5"/> + </window> + </objects> +</document> diff --git a/macosx/English.lproj/MainMenu.xib b/macosx/English.lproj/MainMenu.xib index 4fe7a91f0..f302ba8fa 100644 --- a/macosx/English.lproj/MainMenu.xib +++ b/macosx/English.lproj/MainMenu.xib @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> -<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="6250" systemVersion="14B23" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none"> +<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="6250" systemVersion="14C68k" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none"> <dependencies> <deployment version="1060" identifier="macosx"/> <development version="5100" identifier="xcode"/> @@ -76,9 +76,9 @@ </tabViewItems> </tabView> <textField verticalHuggingPriority="750" id="1538"> - <rect key="frame" x="20" y="540" width="45" height="14"/> + <rect key="frame" x="20" y="540" width="54" height="14"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> - <textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" alignment="right" title="Source:" id="4905"> + <textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" alignment="left" title="Source:" id="4905"> <font key="font" metaFont="smallSystemBold"/> <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> @@ -420,6 +420,7 @@ <connections> <outlet property="delegate" destination="240" id="433"/> </connections> + <point key="canvasLocation" x="507" y="501"/> </window> <menu title="MainMenu" systemMenu="main" id="29" userLabel="MainMenu"> <items> @@ -783,189 +784,6 @@ <outlet property="parentWindow" destination="21" id="1842"/> </connections> </drawer> - <window title="Create A New Preset" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="1867" userLabel="AddPresetPanel" customClass="NSPanel"> - <windowStyleMask key="styleMask" titled="YES"/> - <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/> - <rect key="contentRect" x="421" y="536" width="338" height="281"/> - <rect key="screenRect" x="0.0" y="0.0" width="1920" height="1178"/> - <value key="minSize" type="size" width="338" height="232"/> - <view key="contentView" id="1868"> - <rect key="frame" x="0.0" y="0.0" width="338" height="281"/> - <autoresizingMask key="autoresizingMask"/> - <subviews> - <button verticalHuggingPriority="750" id="1870"> - <rect key="frame" x="239" y="13" width="85" height="32"/> - <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/> - <buttonCell key="cell" type="push" title="Add" bezelStyle="rounded" alignment="center" borderStyle="border" inset="2" id="4934"> - <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/> - <font key="font" metaFont="system"/> - <string key="keyEquivalent" base64-UTF8="YES"> -DQ -</string> - </buttonCell> - <connections> - <action selector="addUserPreset:" target="240" id="1907"/> - </connections> - </button> - <button verticalHuggingPriority="750" id="1871"> - <rect key="frame" x="155" y="13" width="84" height="32"/> - <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/> - <buttonCell key="cell" type="push" title="Cancel" bezelStyle="rounded" alignment="center" borderStyle="border" inset="2" id="4935"> - <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/> - <font key="font" metaFont="system"/> - <string key="keyEquivalent" base64-UTF8="YES"> -Gw -</string> - </buttonCell> - <connections> - <action selector="closeAddPresetPanel:" target="240" id="1878"/> - </connections> - </button> - <textField verticalHuggingPriority="750" id="1872"> - <rect key="frame" x="20" y="229" width="298" height="19"/> - <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/> - <textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="4936"> - <font key="font" metaFont="smallSystem"/> - <color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/> - <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> - </textFieldCell> - </textField> - <popUpButton verticalHuggingPriority="750" id="2008"> - <rect key="frame" x="128" y="180" width="193" height="22"/> - <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/> - <popUpButtonCell key="cell" type="push" title="Item1" bezelStyle="rounded" alignment="left" controlSize="small" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" inset="2" arrowPosition="arrowAtCenter" preferredEdge="maxY" selectedItem="2012" id="4937"> - <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/> - <font key="font" metaFont="smallSystem"/> - <menu key="menu" title="OtherViews" id="2009"> - <items> - <menuItem title="Item1" state="on" id="2012"/> - <menuItem title="Item2" id="2011"/> - <menuItem title="Item3" id="2010"/> - </items> - </menu> - </popUpButtonCell> - <connections> - <action selector="addPresetPicDropdownChanged:" target="240" id="5672"/> - </connections> - </popUpButton> - <textField verticalHuggingPriority="750" id="2670"> - <rect key="frame" x="17" y="252" width="303" height="14"/> - <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> - <textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" alignment="left" title="Preset Name:" id="4938"> - <font key="font" metaFont="smallSystem"/> - <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> - <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> - </textFieldCell> - </textField> - <textField verticalHuggingPriority="750" id="2671"> - <rect key="frame" x="17" y="207" width="91" height="14"/> - <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> - <textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" alignment="left" title="Picture Settings:" id="4939"> - <font key="font" metaFont="smallSystem"/> - <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> - <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> - </textFieldCell> - </textField> - <textField verticalHuggingPriority="750" id="2672"> - <rect key="frame" x="17" y="106" width="84" height="14"/> - <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> - <textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" title="Description:" id="4940"> - <font key="font" metaFont="smallSystem"/> - <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> - <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> - </textFieldCell> - </textField> - <textField verticalHuggingPriority="750" id="2673"> - <rect key="frame" x="20" y="61" width="298" height="41"/> - <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> - <textFieldCell key="cell" controlSize="small" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="4941"> - <font key="font" metaFont="smallSystem"/> - <color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/> - <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> - </textFieldCell> - </textField> - <textField verticalHuggingPriority="750" id="2833"> - <rect key="frame" x="18" y="185" width="108" height="14"/> - <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> - <textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" alignment="right" title="Use Picture Size:" id="4942"> - <font key="font" metaFont="smallSystem"/> - <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> - <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> - </textFieldCell> - </textField> - <button id="2837"> - <rect key="frame" x="128" y="132" width="24" height="18"/> - <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> - <buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" alignment="left" controlSize="small" state="on" inset="2" id="4943"> - <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> - <font key="font" metaFont="smallSystem"/> - </buttonCell> - </button> - <box verticalHuggingPriority="750" title="Box" boxType="separator" titlePosition="noTitle" id="2839"> - <rect key="frame" x="113" y="210" width="205" height="5"/> - <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> - <color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/> - <color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> - <font key="titleFont" metaFont="system"/> - </box> - <box verticalHuggingPriority="750" title="Box" boxType="separator" titlePosition="noTitle" id="2840"> - <rect key="frame" x="91" y="108" width="227" height="5"/> - <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> - <color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/> - <color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> - <font key="titleFont" metaFont="system"/> - </box> - <textField verticalHuggingPriority="750" id="2957"> - <rect key="frame" x="17" y="134" width="109" height="15"/> - <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> - <textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" alignment="right" title="Use Picture Filters:" id="4944"> - <font key="font" metaFont="smallSystem"/> - <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> - <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> - </textFieldCell> - </textField> - <box autoresizesSubviews="NO" title="Box" borderType="none" titlePosition="noTitle" id="5670"> - <rect key="frame" x="128" y="153" width="155" height="32"/> - <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> - <view key="contentView"> - <rect key="frame" x="0.0" y="0.0" width="155" height="32"/> - <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> - <subviews> - <textField verticalHuggingPriority="750" id="5549"> - <rect key="frame" x="3" y="6" width="52" height="16"/> - <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/> - <textFieldCell key="cell" controlSize="mini" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="right" drawsBackground="YES" id="5550"> - <font key="font" metaFont="miniSystem"/> - <color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/> - <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> - </textFieldCell> - </textField> - <textField verticalHuggingPriority="750" id="5553"> - <rect key="frame" x="53" y="6" width="29" height="15"/> - <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> - <textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" alignment="center" title="X" id="5554"> - <font key="font" metaFont="smallSystem"/> - <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> - <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> - </textFieldCell> - </textField> - <textField verticalHuggingPriority="750" id="5551"> - <rect key="frame" x="82" y="6" width="52" height="16"/> - <autoresizingMask key="autoresizingMask" widthSizable="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="5552"> - <font key="font" metaFont="miniSystem"/> - <color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/> - <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> - </textFieldCell> - </textField> - </subviews> - </view> - <color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/> - <color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> - </box> - </subviews> - </view> - </window> <window title="SourceTitlePanel" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="2701" userLabel="SourceTitlePanel" customClass="NSPanel"> <windowStyleMask key="styleMask" titled="YES"/> <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/> @@ -1070,7 +888,6 @@ DQ </window> <customObject id="240" userLabel="HBController" customClass="HBController"> <connections> - <outlet property="fAddPresetPanel" destination="1867" id="1869"/> <outlet property="fAdvancedTab" destination="2015" id="4eO-Lg-7cH"/> <outlet property="fAudioTab" destination="1475" id="AuZ-Uf-bla"/> <outlet property="fChaptersTitlesTab" destination="1989" id="oUt-8L-Ag2"/> @@ -1085,13 +902,6 @@ DQ <outlet property="fMainTabView" destination="1474" id="XMU-Vi-8QM"/> <outlet property="fOpenSourceTitleMMenu" destination="2698" id="2700"/> <outlet property="fPresetDrawer" destination="1841" id="1889"/> - <outlet property="fPresetNewDesc" destination="2673" id="2674"/> - <outlet property="fPresetNewName" destination="1872" id="1875"/> - <outlet property="fPresetNewPicFiltersCheck" destination="2837" id="2841"/> - <outlet property="fPresetNewPicHeight" destination="5551" id="5669"/> - <outlet property="fPresetNewPicSettingsPopUp" destination="2008" id="2013"/> - <outlet property="fPresetNewPicWidth" destination="5549" id="5668"/> - <outlet property="fPresetNewPicWidthHeightBox" destination="5670" id="5671"/> <outlet property="fPresetSelectedDisplay" destination="1882" id="1883"/> <outlet property="fQueueStatus" destination="2006" id="2007"/> <outlet property="fRipIndicator" destination="1373" id="1374"/> diff --git a/macosx/HBAddPresetController.h b/macosx/HBAddPresetController.h new file mode 100644 index 000000000..3fa4bf921 --- /dev/null +++ b/macosx/HBAddPresetController.h @@ -0,0 +1,20 @@ +// +// HBAddPresetController.h +// HandBrake +// +// Created by Damiano Galassi on 23/11/14. +// +// + +#import <Cocoa/Cocoa.h> +#include "hb.h" + +@class HBPreset; + +@interface HBAddPresetController : NSWindowController + +- (instancetype)initWithPreset:(HBPreset *)preset videoSize:(NSSize)size; + +@property (readonly) HBPreset *preset; + +@end diff --git a/macosx/HBAddPresetController.m b/macosx/HBAddPresetController.m new file mode 100644 index 000000000..c33610496 --- /dev/null +++ b/macosx/HBAddPresetController.m @@ -0,0 +1,138 @@ +// +// HBAddPresetController.m +// HandBrake +// +// Created by Damiano Galassi on 23/11/14. +// +// + +#import "HBAddPresetController.h" +#import "HBPreset.h" + +@interface HBAddPresetController () + +@property (assign) IBOutlet NSTextField *name; +@property (assign) IBOutlet NSTextField *desc; + +@property (assign) IBOutlet NSPopUpButton *picSettingsPopUp; +@property (assign) IBOutlet NSTextField *picWidth; +@property (assign) IBOutlet NSTextField *picHeight; +@property (assign) IBOutlet NSBox *picWidthHeightBox; + +@property (assign) IBOutlet NSButton *picFilters; + +@property (retain) HBPreset *preset; +@property NSSize size; + +@end + +@implementation HBAddPresetController + +- (instancetype)initWithPreset:(HBPreset *)preset videoSize:(NSSize)size; +{ + self = [super initWithWindowNibName:@"AddPreset"]; + if (self) + { + NSParameterAssert(preset); + _preset = [preset retain]; + _size = size; + } + return self; +} + +- (void)dealloc +{ + self.preset = nil;; + [super dealloc]; +} + +- (void)windowDidLoad { + [super windowDidLoad]; + + /* + * Populate the preset picture settings popup. + * + * Custom is not applicable when the anamorphic mode is Strict. + * + * Use [NSMenuItem tag] to store preset values for each option. + */ + [self.picSettingsPopUp addItemWithTitle:NSLocalizedString(@"None", @"")]; + [[self.picSettingsPopUp lastItem] setTag: 0]; + + if ([self.preset.content[@"PicturePAR"] integerValue] != HB_ANAMORPHIC_STRICT) + { + // not Strict, Custom is applicable + [self.picSettingsPopUp addItemWithTitle:NSLocalizedString(@"Custom", @"")]; + [[self.picSettingsPopUp lastItem] setTag: 1]; + } + [self.picSettingsPopUp addItemWithTitle:NSLocalizedString(@"Source Maximum (post source scan)", @"")]; + [[self.picSettingsPopUp lastItem] setTag: 2]; + + /* + * Default to Source Maximum for anamorphic Strict + * Default to Custom for all other anamorphic modes + */ + [self.picSettingsPopUp selectItemWithTag: (1 + ([self.preset.content[@"PicturePAR"] integerValue] == HB_ANAMORPHIC_STRICT))]; + /* Save the current filters in the preset by default */ + [self.picFilters setState:NSOnState]; + + /* Initialize custom height and width settings to current values */ + + [self.picWidth setStringValue: [NSString stringWithFormat:@"%d", (int)self.size.width]]; + [self.picHeight setStringValue: [NSString stringWithFormat:@"%d",(int)self.size.height]]; + [self addPresetPicDropdownChanged:nil]; +} + +- (IBAction)addPresetPicDropdownChanged:(id)sender +{ + if (self.picSettingsPopUp.selectedItem.tag == 1) + { + self.picWidthHeightBox.hidden = NO; + } + else + { + self.picWidthHeightBox.hidden = YES; + } +} + +- (IBAction)add:(id)sender +{ + if (self.name.stringValue.length == 0) + { + NSAlert *alert = [[NSAlert alloc] init]; + [alert setMessageText:NSLocalizedString(@"Warning!", @"")]; + [alert setInformativeText:NSLocalizedString(@"You need to insert a name for the preset.", @"")]; + [alert runModal]; + [alert release]; + } + else + { + self.preset.name = self.name.stringValue; + self.preset.presetDescription = self.name.stringValue; + + NSMutableDictionary *dict = [[self.preset.content mutableCopy] autorelease]; + + // Get the picture size + dict[@"PictureWidth"] = @(self.picWidth.integerValue); + dict[@"PictureHeight"] = @(self.picHeight.integerValue); + + //Get the whether or not to apply pic Size and Cropping (includes Anamorphic) + dict[@"UsesPictureSettings"] = @(self.picSettingsPopUp.selectedItem.tag); + + // Get whether or not to use the current Picture Filter settings for the preset + dict[@"UsesPictureFilters"] = @(self.picFilters.state); + + self.preset.content = [[dict copy] autorelease]; + + [[self window] orderOut:nil]; + [NSApp endSheet:[self window] returnCode:NSModalResponseContinue]; + } +} + +- (IBAction)cancel:(id)sender +{ + [[self window] orderOut:nil]; + [NSApp endSheet:[self window] returnCode:NSModalResponseAbort]; +} + +@end diff --git a/macosx/HBPreset.h b/macosx/HBPreset.h index 73f4321c4..25c1e3b5d 100644 --- a/macosx/HBPreset.h +++ b/macosx/HBPreset.h @@ -19,10 +19,10 @@ - (instancetype)initWithFolderName:(NSString *)title builtIn:(BOOL)builtIn; @property (nonatomic, copy) NSString *name; -@property (nonatomic, readwrite, retain) NSString *presetDescription; +@property (nonatomic, copy) NSString *presetDescription; @property (nonatomic, retain) NSDictionary *content; -@property (nonatomic, readwrite) BOOL isDefault; +@property (nonatomic) BOOL isDefault; @property (nonatomic, readonly) BOOL isBuiltIn; @end diff --git a/macosx/HBPresetsManager.h b/macosx/HBPresetsManager.h index 74427f550..4eddec365 100644 --- a/macosx/HBPresetsManager.h +++ b/macosx/HBPresetsManager.h @@ -55,7 +55,14 @@ extern NSString *HBPresetsChangedNotification; * * @param preset the preset dict. */ -- (void)addPreset:(NSDictionary *)preset; +- (void)addPresetFromDictionary:(NSDictionary *)preset; + +/** + * Adds a given preset to the manager. + * + * @param preset the preset dict. + */ +- (void)addPreset:(HBPreset *)preset; /** * Deletes the presets at the specified index path. diff --git a/macosx/HBPresetsManager.m b/macosx/HBPresetsManager.m index 86bd7f4fa..778963b7d 100644 --- a/macosx/HBPresetsManager.m +++ b/macosx/HBPresetsManager.m @@ -229,7 +229,7 @@ NSString *HBPresetsChangedNotification = @"HBPresetsChangedNotification"; return retValue; } -- (void)addPreset:(NSDictionary *)preset +- (void)addPresetFromDictionary:(NSDictionary *)preset { HBPreset *presetNode = [[HBPreset alloc] initWithName:preset[@"PresetName"] content:preset @@ -241,6 +241,13 @@ NSString *HBPresetsChangedNotification = @"HBPresetsChangedNotification"; [self savePresets]; } +- (void)addPreset:(HBPreset *)preset +{ + [self.root insertObject:preset inChildrenAtIndex:[self.root countOfChildren]]; + + [self savePresets]; +} + - (void)deletePresetAtIndexPath:(NSIndexPath *)idx { HBPreset *parentNode = self.root; diff --git a/macosx/HBQueueOutlineView.h b/macosx/HBQueueOutlineView.h new file mode 100644 index 000000000..964c4f0d0 --- /dev/null +++ b/macosx/HBQueueOutlineView.h @@ -0,0 +1,46 @@ +// +// HBQueueOutlineView.h +// HandBrake +// +// Created by Damiano Galassi on 23/11/14. +// +// + +#import <Cocoa/Cocoa.h> + +//------------------------------------------------------------------------------------ +// As usual, we need to subclass NSOutlineView to handle a few special cases: +// +// (1) variable row heights during live resizes +// HBQueueOutlineView exists solely to get around a bug in variable row height outline +// views in which row heights get messed up during live resizes. See this discussion: +// http://lists.apple.com/archives/cocoa-dev/2005/Oct/msg00871.html +// However, the recommeneded fix (override drawRect:) does not work. Instead, this +// subclass implements viewDidEndLiveResize in order to recalculate all row heights. +// +// (2) prevent expanding of items during drags +// During dragging operations, we don't want outline items to expand, since a queue +// doesn't really have children items. +// +// (3) generate a drag image that incorporates more than just the first column +// By default, NSTableView only drags an image of the first column. Change this to +// drag an image of the queue's icon and desc columns. + +@protocol HBQueueOutlineViewDelegate + +@optional +- (void)HB_deleteSelectionFromTableView:(NSTableView *)tableView; +@end + +@interface HBQueueOutlineView : NSOutlineView + +@property (nonatomic, readonly) BOOL isDragging; + +/** + * An index set containing the indexes of the targeted rows. + * If the selected row indexes contain the clicked row index, it returns every selected row, + * otherwise it returns only the clicked row index. + */ +- (NSIndexSet *)targetedRowIndexes; + +@end
\ No newline at end of file diff --git a/macosx/HBQueueOutlineView.m b/macosx/HBQueueOutlineView.m new file mode 100644 index 000000000..2408f9129 --- /dev/null +++ b/macosx/HBQueueOutlineView.m @@ -0,0 +1,97 @@ +// +// HBQueueOutlineView.m +// HandBrake +// +// Created by Damiano Galassi on 23/11/14. +// +// + +#import "HBQueueOutlineView.h" + +@implementation HBQueueOutlineView + +- (void)viewDidEndLiveResize +{ + // Since we disabled calculating row heights during a live resize, force them to + // recalculate now. + [self noteHeightOfRowsWithIndexesChanged:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [self numberOfRows])]]; + [super viewDidEndLiveResize]; +} + +/* This should be for dragging, we take this info from the presets right now */ +- (NSImage *)dragImageForRowsWithIndexes:(NSIndexSet *)dragRows + tableColumns:(NSArray *)tableColumns + event:(NSEvent *)dragEvent + offset:(NSPointPointer)dragImageOffset +{ + _isDragging = YES; + + // By default, NSTableView only drags an image of the first column. Change this to + // drag an image of the queue's icon and desc and action columns. + NSArray *cols = @[[self tableColumnWithIdentifier:@"desc"], + [self tableColumnWithIdentifier:@"icon"], + [self tableColumnWithIdentifier:@"action"]]; + + return [super dragImageForRowsWithIndexes:dragRows tableColumns:cols event:dragEvent offset:dragImageOffset]; +} + +- (void)mouseDown:(NSEvent *)theEvent +{ + [super mouseDown:theEvent]; + _isDragging = NO; +} + +- (void)keyDown:(NSEvent *)event +{ + id delegate = [self delegate]; + + unichar key = [[event charactersIgnoringModifiers] characterAtIndex:0]; + if ((key == NSDeleteCharacter || key == NSDeleteFunctionKey) && + [delegate respondsToSelector:@selector(HB_deleteSelectionFromTableView:)]) + { + if ([self selectedRow] == -1) + { + NSBeep(); + } + else + { + [delegate HB_deleteSelectionFromTableView:self]; + } + return; + } + else + { + [super keyDown:event]; + } +} + +/** + * An index set containing the indexes of the targeted rows. + * If the selected row indexes contain the clicked row index, it returns every selected row, + * otherwise it returns only the clicked row index. + */ +- (NSIndexSet *)targetedRowIndexes +{ + NSMutableIndexSet *rowIndexes = [NSMutableIndexSet indexSet]; + NSIndexSet *selectedRowIndexes = [self selectedRowIndexes]; + NSInteger clickedRow = [self clickedRow]; + + if (clickedRow != -1) + { + [rowIndexes addIndex:clickedRow]; + + // If we clicked on a selected row, then we want to consider all rows in the selection. Otherwise, we only consider the clicked on row. + if ([selectedRowIndexes containsIndex:clickedRow]) + { + [rowIndexes addIndexes:selectedRowIndexes]; + } + } + else + { + [rowIndexes addIndexes:selectedRowIndexes]; + } + + return [[rowIndexes copy] autorelease]; +} + +@end diff --git a/macosx/HandBrake.xcodeproj/project.pbxproj b/macosx/HandBrake.xcodeproj/project.pbxproj index 15c4c5b75..b8094601f 100644 --- a/macosx/HandBrake.xcodeproj/project.pbxproj +++ b/macosx/HandBrake.xcodeproj/project.pbxproj @@ -155,6 +155,8 @@ A9E1468116BC2AD800C307BC /* pause-p.pdf in Resources */ = {isa = PBXBuildFile; fileRef = A9E1467D16BC2AD800C307BC /* pause-p.pdf */; }; A9E1468216BC2AD800C307BC /* play-p.pdf in Resources */ = {isa = PBXBuildFile; fileRef = A9E1467E16BC2AD800C307BC /* play-p.pdf */; }; A9E1468316BC2AD800C307BC /* prev-p.pdf in Resources */ = {isa = PBXBuildFile; fileRef = A9E1467F16BC2AD800C307BC /* prev-p.pdf */; }; + A9E2FD271A21BC4A000E8D3F /* HBAddPresetController.m in Sources */ = {isa = PBXBuildFile; fileRef = A9E2FD251A21BC4A000E8D3F /* HBAddPresetController.m */; }; + A9E2FD2B1A21BC6F000E8D3F /* AddPreset.xib in Resources */ = {isa = PBXBuildFile; fileRef = A9E2FD291A21BC6F000E8D3F /* AddPreset.xib */; }; A9F2EB6F196F12C800066546 /* Audio.xib in Resources */ = {isa = PBXBuildFile; fileRef = A9F2EB6D196F12C800066546 /* Audio.xib */; }; A9F472891976B7F30009EC65 /* HBSubtitlesDefaultsController.m in Sources */ = {isa = PBXBuildFile; fileRef = A9F472871976B7F30009EC65 /* HBSubtitlesDefaultsController.m */; }; A9F4728D1976BAA70009EC65 /* HBSubtitlesDefaults.m in Sources */ = {isa = PBXBuildFile; fileRef = A9F4728C1976BAA70009EC65 /* HBSubtitlesDefaults.m */; }; @@ -397,6 +399,9 @@ A9E1467D16BC2AD800C307BC /* pause-p.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = "pause-p.pdf"; sourceTree = "<group>"; }; A9E1467E16BC2AD800C307BC /* play-p.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = "play-p.pdf"; sourceTree = "<group>"; }; A9E1467F16BC2AD800C307BC /* prev-p.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = "prev-p.pdf"; sourceTree = "<group>"; }; + A9E2FD241A21BC4A000E8D3F /* HBAddPresetController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBAddPresetController.h; sourceTree = "<group>"; }; + A9E2FD251A21BC4A000E8D3F /* HBAddPresetController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBAddPresetController.m; sourceTree = "<group>"; }; + A9E2FD2A1A21BC6F000E8D3F /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = AddPreset.xib; sourceTree = "<group>"; }; A9F2EB6E196F12C800066546 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = Audio.xib; sourceTree = "<group>"; }; A9F472861976B7F30009EC65 /* HBSubtitlesDefaultsController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBSubtitlesDefaultsController.h; sourceTree = "<group>"; }; A9F472871976B7F30009EC65 /* HBSubtitlesDefaultsController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBSubtitlesDefaultsController.m; sourceTree = "<group>"; }; @@ -729,6 +734,7 @@ 273F217C14ADDDA10021BE6D /* InfoPlist.strings */, 273F217E14ADDDA10021BE6D /* MainMenu.xib */, A9CF25EF1990D62C0023F727 /* Presets.xib */, + A9E2FD291A21BC6F000E8D3F /* AddPreset.xib */, A93E0ED51972958C00FD67FB /* Video.xib */, A9F2EB6D196F12C800066546 /* Audio.xib */, A932E26A1988334B0047D13E /* AudioDefaults.xib */, @@ -851,6 +857,8 @@ 273F20AA14ADBE670021BE6D /* PictureController.m */, 273F20A314ADBE670021BE6D /* HBPreviewController.h */, 273F20A414ADBE670021BE6D /* HBPreviewController.m */, + A9E2FD241A21BC4A000E8D3F /* HBAddPresetController.h */, + A9E2FD251A21BC4A000E8D3F /* HBAddPresetController.m */, ); name = Controllers; sourceTree = "<group>"; @@ -1012,6 +1020,7 @@ 273F216814ADCBF80021BE6D /* RevealHighlight.png in Resources */, A91C02521A165EA200DEA6F3 /* EncodeComplete.png in Resources */, 273F216914ADCBF80021BE6D /* RevealHighlightPressed.png in Resources */, + A9E2FD2B1A21BC6F000E8D3F /* AddPreset.xib in Resources */, 273F216A14ADCBF80021BE6D /* RevealPressed.png in Resources */, 273F218A14ADDDA10021BE6D /* AdvancedView.xib in Resources */, 273F218B14ADDDA10021BE6D /* InfoPlist.strings in Resources */, @@ -1125,6 +1134,7 @@ A9C9F88919A733FE00DC8923 /* HBHUDView.m in Sources */, A932E26F198833920047D13E /* HBAudioDefaultsController.m in Sources */, 46AB433515F98A2B009C0961 /* DockTextField.m in Sources */, + A9E2FD271A21BC4A000E8D3F /* HBAddPresetController.m in Sources */, A9D488A51996270300E9B1BA /* HBTreeNode.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -1257,6 +1267,14 @@ name = Subtitles.xib; sourceTree = "<group>"; }; + A9E2FD291A21BC6F000E8D3F /* AddPreset.xib */ = { + isa = PBXVariantGroup; + children = ( + A9E2FD2A1A21BC6F000E8D3F /* English */, + ); + name = AddPreset.xib; + sourceTree = "<group>"; + }; A9F2EB6D196F12C800066546 /* Audio.xib */ = { isa = PBXVariantGroup; children = ( |