MacGui: move the application delegate to its own class. Removed the "Open Source...
authorritsuka <damiog@gmail.com>
Thu, 22 Jan 2015 10:30:26 +0000 (10:30 +0000)
committerritsuka <damiog@gmail.com>
Thu, 22 Jan 2015 10:30:26 +0000 (10:30 +0000)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6784 b64f7644-9d1e-0410-96f1-a4d463321fa5

macosx/Controller.h
macosx/Controller.m
macosx/English.lproj/MainMenu.xib
macosx/English.lproj/MainWindow.xib [new file with mode: 0644]
macosx/English.lproj/Preferences.xib
macosx/HBAppDelegate.h [new file with mode: 0644]
macosx/HBAppDelegate.m [new file with mode: 0644]
macosx/HBQueueController.h
macosx/HBQueueController.mm
macosx/HandBrake.xcodeproj/project.pbxproj
macosx/main.mm

index 49074f3229a0315f433cdbb1021cb0a562c5e5c1..83a47e434df184a8450d658debc542748915d614 100644 (file)
 @class HBPreviewController;
 
 @class HBPreferencesController;
-@class HBOutputPanelController;
 @class HBPresetsViewController;
 @class HBPresetsManager;
 
 @class HBJob;
 
-@interface HBController : NSObject <NSApplicationDelegate, NSDrawerDelegate>
+@interface HBController : NSWindowController <NSDrawerDelegate>
 {
-    IBOutlet NSWindow  *fWindow;
     IBOutlet NSTabView *fMainTabView;
 
     // Video view controller
     HBAdvancedController         * fAdvancedOptions;
        IBOutlet NSTabViewItem       * fAdvancedTab;
 
-    // Main Menu Outlets
-    NSMenuItem                   * fOpenSourceTitleMMenu;
-    
-    // Source Title Scan Outlets
-    IBOutlet NSPanel              * fScanSrcTitlePanel;
-    IBOutlet NSTextField          * fScanSrcTitlePathField;
-    IBOutlet NSTextField          * fSrcDsplyNameTitleScan;
-    IBOutlet NSTextField          * fScanSrcTitleNumField;
-    IBOutlet NSButton             * fScanSrcTitleCancelButton;
-    IBOutlet NSButton             * fScanSrcTitleOpenButton;
-
     // Picture Settings
     HBPictureController           * fPictureController;
     // Picture Preview
@@ -68,9 +55,6 @@
     
     // Queue panel
     HBQueueController            * fQueueController;
-
-    // Output panel
-    HBOutputPanelController      * outputPanel;
        
     // Source box
        IBOutlet NSProgressIndicator * fScanIndicator;
     IBOutlet NSTextField         * fQueueStatus;
     IBOutlet NSProgressIndicator * fRipIndicator;
        BOOL                           fRipIndicatorShown;
-    
+
        // User Preset
        HBPresetsManager             * presetManager;
     HBPresetsViewController      * fPresetsView;
 
-    IBOutlet NSMenu              * presetsMenu;
        IBOutlet NSDrawer            * fPresetDrawer;
 }
 
-@property (nonatomic, readonly) NSWindow *window;
+- (instancetype)initWithQueue:(HBQueueController *)queueController presetsManager:(HBPresetsManager *)manager;
 
-- (IBAction) browseSources: (id) sender;
-- (IBAction) showSourceTitleScanPanel: (id) sender;
-- (IBAction) closeSourceTitleScanPanel: (id) sender;  
-- (void) performScan:(NSURL *)scanURL scanTitleNum:(NSInteger)scanTitleNum;
+- (void)launchAction;
+- (void)openFile:(NSURL *)fileURL;
 
-- (IBAction) titlePopUpChanged: (id) sender;
-- (IBAction) chapterPopUpChanged: (id) sender;
+- (IBAction)browseSources:(id)sender;
 
-- (IBAction) autoSetM4vExtension: (id) sender;
-
-- (IBAction) browseFile: (id) sender;
-
-- (IBAction) showPicturePanel: (id) sender;
-- (IBAction) showPreviewWindow: (id) sender;
-- (void)pictureSettingsDidChange;
-- (IBAction) openMainWindow: (id) sender;
+- (IBAction)showPicturePanel:(id)sender;
+- (IBAction)showPreviewWindow:(id)sender;
 
 // Queue
 - (IBAction)addToQueue:(id)sender;
 - (void)setQueueState:(NSString *)info;
 - (void)setQueueInfo:(NSString *)info progress:(double)progress hidden:(BOOL)hidden;
 
-- (IBAction)showQueueWindow:(id)sender;
-
-- (IBAction)showPreferencesWindow:(id)sender;
-
 - (IBAction)rip:(id)sender;
 - (IBAction)pause:(id)sender;
 
-- (IBAction) openHomepage: (id) sender;
-- (IBAction) openForums:   (id) sender;
-- (IBAction) openUserGuide:   (id) sender;
+// Preset Methods
+// Export / Import Presets
+- (IBAction)browseExportPresetFile:(id)sender;
+- (IBAction)browseImportPresetFile:(id)sender;
 
-// Preset Methods Here
-/* Export / Import Presets */
-- (IBAction) browseExportPresetFile: (id) sender;
-- (IBAction) browseImportPresetFile: (id) sender;
+- (IBAction)selectPresetFromMenu:(id)sender;
 
-/* Manage User presets */    
-- (IBAction) showAddPresetPanel: (id) sender;
+// Manage User presets
+- (IBAction)showAddPresetPanel:(id)sender;
 - (IBAction)selectDefaultPreset:(id)sender;
-- (IBAction)addFactoryPresets:(id)sender;
-- (IBAction)showDebugOutputPanel:(id)sender;
 
 @end
index 0f729eb578f161a8d0c95753484ae6da3ccbbc65..bed4b5280ff0a7b84c45eb9778fbceaad43f4de4 100644 (file)
@@ -9,7 +9,6 @@
 #import "HBQueueController.h"
 
 #import "HBOutputPanelController.h"
-#import "HBPreferencesController.h"
 #import "HBPresetsManager.h"
 #import "HBPreset.h"
 #import "HBUtilities.h"
 
 @interface HBController () <HBPresetsViewControllerDelegate, HBPreviewControllerDelegate, HBPictureControllerDelegate>
 
+@property (assign) IBOutlet NSView *openTitleView;
+@property (nonatomic, readwrite) BOOL scanSpecificTitle;
+@property (nonatomic, readwrite) NSInteger scanSpecificTitleIdx;
+
+/**
+ * The name of the source, it might differ from the source
+ * last path component if it's a package or a folder.
+ */
 @property (nonatomic, copy) NSString *browsedSourceDisplayName;
 
 /// The current job.
 
 @implementation HBController
 
-- (instancetype)init
+- (instancetype)initWithQueue:(HBQueueController *)queueController presetsManager:(HBPresetsManager *)manager;
 {
-    self = [super init];
+    self = [super initWithWindowNibName:@"MainWindow"];
     if (self)
     {
-        // Register the defaults preferences
-        [HBPreferencesController registerUserDefaults];
-
-        // Inits the controllers
-        outputPanel = [[HBOutputPanelController alloc] init];
-        fPictureController = [[HBPictureController alloc] init];
-        fPreviewController = [[HBPreviewController  alloc] initWithDelegate:self];
-        fQueueController = [[HBQueueController alloc] init];
-        fQueueController.controller = self;
-        fQueueController.outputPanel = outputPanel;
-
-        // we init the HBPresetsManager
-        NSURL *presetsURL = [NSURL fileURLWithPath:[[HBUtilities appSupportPath] stringByAppendingPathComponent:@"UserPresets.plist"]];
-        presetManager = [[HBPresetsManager alloc] initWithURL:presetsURL];
-        _selectedPreset = [presetManager.defaultPreset retain];
-
-        // Lets report the HandBrake version number here to the activity log and text log file
-        NSDictionary *infoDict = [[NSBundle mainBundle] infoDictionary];
-        NSString *versionStringFull = [NSString stringWithFormat:@"Handbrake Version: %@  (%@)", infoDict[@"CFBundleShortVersionString"], infoDict[@"CFBundleVersion"]];
-        [HBUtilities writeToActivityLog: "%s", versionStringFull.UTF8String];
-
-        // Optionally use dvd nav
-        [HBCore setDVDNav:[[[NSUserDefaults standardUserDefaults] objectForKey:@"UseDvdNav"] boolValue]];
-
         // Init libhb
         int loggingLevel = [[[NSUserDefaults standardUserDefaults] objectForKey:@"LoggingLevel"] intValue];
         _core = [[HBCore alloc] initWithLoggingLevel:loggingLevel];
         _core.name = @"ScanCore";
 
+        // Inits the controllers
+        fPictureController = [[HBPictureController alloc] init];
         [fPictureController setDelegate:self];
+
+        fPreviewController = [[HBPreviewController  alloc] initWithDelegate:self];
         [fPreviewController setCore:self.core];
 
-        // Set the Growl Delegate
-        [GrowlApplicationBridge setGrowlDelegate:fQueueController];
+        fQueueController = queueController;
+        fQueueController.controller = self;
+
+        presetManager = manager;
+        _selectedPreset = [presetManager.defaultPreset retain];
 
         [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(autoSetM4vExtension:) name:HBMixdownChangedNotification object:nil];
     }
     return self;
 }
 
-- (void) applicationDidFinishLaunching: (NSNotification *) notification
+- (void)dealloc
 {
-    [self enableUI:NO];
-
-    // Checks for presets updates
-    [self checkBuiltInsForUpdates];
-
-    // Show/Hide the Presets drawer upon launch based
-    // on user preference DefaultPresetsDrawerShow
-    if ([[NSUserDefaults standardUserDefaults] boolForKey:@"HBDefaultPresetsDrawerShow"])
-    {
-        [fPresetDrawer open:self];
-    }
-
-    // Get the number of HandBrake instances currently running
-    NSUInteger hbInstanceNum = [NSRunningApplication runningApplicationsWithBundleIdentifier:[[NSBundle mainBundle] bundleIdentifier]].count;
-
-    // If we are a single instance it is safe to clean up the previews if there are any
-    // left over. This is a bit of a kludge but will prevent a build up of old instance
-    // live preview cruft. No danger of removing an active preview directory since they
-    // are created later in HBPreviewController if they don't exist at the moment a live
-    // preview encode is initiated.
-    if (hbInstanceNum == 1)
-    {
-        NSString *previewDirectory = [[HBUtilities appSupportPath] stringByAppendingPathComponent:@"Previews"];
-        NSError *error = nil;
-        NSArray *files = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:previewDirectory error:&error];
-        for (NSString *file in files)
-        {
-            BOOL result = [[NSFileManager defaultManager] removeItemAtPath:[previewDirectory stringByAppendingPathComponent:file] error:&error];
-            if (result == NO && error)
-            {
-                [HBUtilities writeToActivityLog: "Could not remove existing preview at : %s", file.UTF8String];
-            }
-        }
-    }
-
-    // Open debug output window now if it was visible when HB was closed
-    if ([[NSUserDefaults standardUserDefaults] boolForKey:@"OutputPanelIsOpen"])
-        [self showDebugOutputPanel:nil];
-
-    // Open queue window now if it was visible when HB was closed
-    if ([[NSUserDefaults standardUserDefaults] boolForKey:@"QueueWindowIsOpen"])
-        [self showQueueWindow:nil];
-
-       [self openMainWindow:nil];
-
-    // Now we re-check the queue array to see if there are
-    // any remaining encodes to be done in it and ask the
-    // user if they want to reload the queue */
-    if (fQueueController.count)
-       {
-        // On Screen Notification
-        // We check to see if there is already another instance of hb running.
-        // Note: hbInstances == 1 means we are the only instance of HandBrake.app
-        NSAlert *alert = nil;
-        if (hbInstanceNum > 1)
-        {
-            alert = [[NSAlert alloc] init];
-            [alert setMessageText:NSLocalizedString(@"There is already an instance of HandBrake running.", @"")];
-            [alert setInformativeText:NSLocalizedString(@"HandBrake will now load up the existing queue.", nil)];
-            [alert addButtonWithTitle:NSLocalizedString(@"Reload Queue", nil)];
-        }
-        else
-        {
-            if (fQueueController.workingItemsCount > 0 || fQueueController.pendingItemsCount > 0)
-            {
-                NSString *alertTitle;
-
-                if (fQueueController.workingItemsCount > 0)
-                {
-                    alertTitle = [NSString stringWithFormat:
-                                  NSLocalizedString(@"HandBrake Has Detected %d Previously Encoding Item(s) and %d Pending Item(s) In Your Queue.", @""),
-                                  fQueueController.workingItemsCount, fQueueController.pendingItemsCount];
-                }
-                else
-                {
-                    alertTitle = [NSString stringWithFormat:
-                                  NSLocalizedString(@"HandBrake Has Detected %d Pending Item(s) In Your Queue.", @""),
-                                  fQueueController.pendingItemsCount];
-                }
-
-                alert = [[NSAlert alloc] init];
-                [alert setMessageText:alertTitle];
-                [alert setInformativeText:NSLocalizedString(@"Do you want to reload them ?", nil)];
-                [alert addButtonWithTitle:NSLocalizedString(@"Reload Queue", nil)];
-                [alert addButtonWithTitle:NSLocalizedString(@"Empty Queue", nil)];
-                [alert setAlertStyle:NSCriticalAlertStyle];
-            }
-            else
-            {
-                // Since we addressed any pending or previously encoding items above, we go ahead and make sure
-                // the queue is empty of any finished items or cancelled items.
-                [fQueueController removeAllJobs];
-
-                if (self.core.state != HBStateScanning && !self.job)
-                {
-                    // We show whichever open source window specified in LaunchSourceBehavior preference key
-                    if ([[[NSUserDefaults standardUserDefaults] stringForKey:@"LaunchSourceBehavior"] isEqualToString: @"Open Source"])
-                    {
-                        [self browseSources:nil];
-                    }
-
-                    if ([[[NSUserDefaults standardUserDefaults] stringForKey:@"LaunchSourceBehavior"] isEqualToString: @"Open Source (Title Specific)"])
-                    {
-                        [self browseSources:(id)fOpenSourceTitleMMenu];
-                    }
-                }
-            }
-        }
-
-        if (alert)
-        {
-            NSModalResponse response = [alert runModal];
-
-            if (response == NSAlertSecondButtonReturn)
-            {
-                [HBUtilities writeToActivityLog: "didDimissReloadQueue NSAlertSecondButtonReturn Chosen"];
-                [fQueueController removeAllJobs];
-
-                // We show whichever open source window specified in LaunchSourceBehavior preference key
-                if ([[[NSUserDefaults standardUserDefaults] stringForKey:@"LaunchSourceBehavior"] isEqualToString: @"Open Source"])
-                {
-                    [self browseSources:nil];
-                }
-
-                if ([[[NSUserDefaults standardUserDefaults] stringForKey:@"LaunchSourceBehavior"] isEqualToString: @"Open Source (Title Specific)"])
-                {
-                    [self browseSources:(id)fOpenSourceTitleMMenu];
-                }
-            }
-            else
-            {
-                [HBUtilities writeToActivityLog: "didDimissReloadQueue NSAlertFirstButtonReturn Chosen"];
-                if (hbInstanceNum == 1)
-                {
-                    [fQueueController setEncodingJobsAsPending];
-                }
-                
-                [self showQueueWindow:nil];
-            }
-
-            [alert release];
-        }
-    }
-    else
-    {
-        if (self.core.state != HBStateScanning && !self.job)
-        {
-            // We show whichever open source window specified in LaunchSourceBehavior preference key
-            if ([[[NSUserDefaults standardUserDefaults] stringForKey:@"LaunchSourceBehavior"] isEqualToString: @"Open Source"])
-            {
-                [self browseSources:nil];
-            }
-
-            if ([[[NSUserDefaults standardUserDefaults] stringForKey:@"LaunchSourceBehavior"] isEqualToString: @"Open Source (Title Specific)"])
-            {
-                [self browseSources:(id)fOpenSourceTitleMMenu];
-            }
-        }
-    }
-}
-
-- (void)application:(NSApplication *)sender openFiles:(NSArray *)filenames
-{
-    [self openFile:[NSURL fileURLWithPath:filenames.firstObject]];
-    [NSApp replyToOpenOrPrint:NSApplicationDelegateReplySuccess];
-}
-
-- (void)openFile:(NSURL *)fileURL
-{
-    if (self.core.state != HBStateScanning)
-    {
-        self.browsedSourceDisplayName = fileURL.lastPathComponent;
-        [self performScan:fileURL scanTitleNum:0];
-    }
-}
-
-- (void)setJob:(HBJob *)job
-{
-    // Set the jobs info to the view controllers
-    fPictureController.picture = job.picture;
-    fPictureController.filters = job.filters;
-    fPreviewController.job = job;
-
-    fVideoController.job = job;
-    fAudioController.audio = job.audio;
-    fSubtitlesViewController.subtitles = job.subtitles;
-    fChapterTitlesController.job = job;
-
-    if (job)
-    {
-        [[NSNotificationCenter defaultCenter] removeObserver:_job];
-        [[NSNotificationCenter defaultCenter] removeObserver:_job.picture];
-        [[NSNotificationCenter defaultCenter] removeObserver:_job.filters];
-        [[NSNotificationCenter defaultCenter] removeObserver:_job.video];
-
-        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pictureSettingsDidChange) name:HBPictureChangedNotification object:job.picture];
-        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pictureSettingsDidChange) name:HBFiltersChangedNotification object:job.filters];
-        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(formatChanged:) name:HBContainerChangedNotification object:job];
-        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(customSettingUsed) name:HBVideoChangedNotification object:job.video];
-    }
-
-    // Retain the new job
-    [_job autorelease];
-    _job = [job retain];
-
-    [self enableUI:(job != nil)];
-}
-
-#pragma mark -
-#pragma mark Drag & drop handling
-
-// This method is used by OSX to know what kind of files can be drag & drop on the NSWindow
-// We only want filenames (and so folders too)
-- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
-{
-    NSPasteboard *pboard = [sender draggingPasteboard];
-
-    if ([[pboard types] containsObject:NSFilenamesPboardType])
-    {
-        NSArray *paths = [pboard propertyListForType:NSFilenamesPboardType];
-        return paths.count == 1 ? NSDragOperationGeneric : NSDragOperationNone;
-    }
-
-    return NSDragOperationNone;
-}
-
-// This method is doing the job after the drag & drop operation has been validated by [self draggingEntered] and OSX
-- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
-{
-    NSPasteboard *pboard = [sender draggingPasteboard];
-
-    if ([pboard.types containsObject:NSFilenamesPboardType])
-    {
-        NSArray *paths = [pboard propertyListForType:NSFilenamesPboardType];
-        [self openFile:[NSURL fileURLWithPath:paths.firstObject]];
-    }
-
-    return YES;
-}
-
-#pragma mark -
-
-- (NSApplicationTerminateReply) applicationShouldTerminate: (NSApplication *) app
-{
-    if (fQueueController.core.state != HBStateIdle)
-    {
-        NSAlert *alert = [[NSAlert alloc] init];
-        [alert setMessageText:NSLocalizedString(@"Are you sure you want to quit HandBrake?", nil)];
-        [alert setInformativeText:NSLocalizedString(@"If you quit HandBrake your current encode will be reloaded into your queue at next launch. Do you want to quit anyway?", nil)];
-        [alert addButtonWithTitle:NSLocalizedString(@"Quit", nil)];
-        [alert addButtonWithTitle:NSLocalizedString(@"Don't Quit", nil)];
-        [alert setAlertStyle:NSCriticalAlertStyle];
-
-        NSInteger result = [alert runModal];
-        [alert release];
-
-        if (result == NSAlertFirstButtonReturn)
-        {
-            return NSTerminateNow;
-        }
-        else
-        {
-            return NSTerminateCancel;
-        }
-    }
-
-    // Warn if items still in the queue
-    else if (fQueueController.pendingItemsCount > 0)
-    {
-        NSAlert *alert = [[NSAlert alloc] init];
-        [alert setMessageText:NSLocalizedString(@"Are you sure you want to quit HandBrake?", nil)];
-        [alert setInformativeText:NSLocalizedString(@"There are pending encodes in your queue. Do you want to quit anyway?",nil)];
-        [alert addButtonWithTitle:NSLocalizedString(@"Quit", nil)];
-        [alert addButtonWithTitle:NSLocalizedString(@"Don't Quit", nil)];
-        [alert setAlertStyle:NSCriticalAlertStyle];
-        NSInteger result = [alert runModal];
-        [alert release];
-        if (result == NSAlertFirstButtonReturn)
-        {
-            return NSTerminateNow;
-        }
-        else
-        {
-            return NSTerminateCancel;
-        }
-    }
-
-    return NSTerminateNow;
-}
-
-- (void)applicationWillTerminate:(NSNotification *)aNotification
-{
-    [presetManager savePresets];
-    [presetManager release];
-
     [[NSNotificationCenter defaultCenter] removeObserver:self];
 
-    [outputPanel release];
-       [fQueueController release];
-    [fQueueController release];
     [fPreviewController release];
     [fPictureController release];
 
-    self.core = nil;
-    self.browsedSourceDisplayName = nil;
+    [_browsedSourceDisplayName release];
+    [_job release];
+    [_jobFromQueue release];
+    [_selectedPreset release];
+    [_labelColor release];
+    [_core release];
 
-    [HBCore closeGlobal];
+    [super dealloc];
 }
 
-- (void) awakeFromNib
-{    
+- (void)windowDidLoad
+{
+    [self enableUI:NO];
+
     /* For 64 bit builds, the threaded animation in the progress
      * indicators conflicts with the animation in the advanced tab
      * for reasons not completely clear. jbrjake found a note in the
      * as it test out fine on both and there is no reason our progress indicators
      * should require their own thread.
      */
-
-    _window = fWindow;
-
     [fScanIndicator setUsesThreadedAnimation:NO];
     [fRipIndicator setUsesThreadedAnimation:NO];
 
-    // Presets initialization
-    [self buildPresetsMenu];
-
-    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(buildPresetsMenu) name:HBPresetsChangedNotification object:nil];
-
-    [fPresetDrawer setDelegate:self];
     NSSize drawerSize = NSSizeFromString([[NSUserDefaults standardUserDefaults]
-                                           stringForKey:@"HBDrawerSize"]);
+                                          stringForKey:@"HBDrawerSize"]);
     if (drawerSize.width)
     {
         [fPresetDrawer setContentSize: drawerSize];
 
     [fSrcTimeStartEncodingField setFrameOrigin:startPoint];
     [fSrcTimeEndEncodingField setFrameOrigin:endPoint];
-    
+
     [fSrcFrameStartEncodingField setFrameOrigin:startPoint];
     [fSrcFrameEndEncodingField setFrameOrigin:endPoint];
 
     [fStatusField setStringValue:@""];
 
     // Register HBController's Window as a receiver for files/folders drag & drop operations
-    [fWindow registerForDraggedTypes:@[NSFilenamesPboardType]];
+    [self.window registerForDraggedTypes:@[NSFilenamesPboardType]];
 
     // Set up the preset drawer
     fPresetsView = [[HBPresetsViewController alloc] initWithPresetManager:presetManager];
 
     // setup the subtitles view
     fSubtitlesViewController = [[HBSubtitlesController alloc] init];
-       [fSubtitlesTab setView:[fSubtitlesViewController view]];
+    [fSubtitlesTab setView:[fSubtitlesViewController view]];
 
-       // setup the audio controller
+    // setup the audio controller
     fAudioController = [[HBAudioController alloc] init];
-       [fAudioTab setView:[fAudioController view]];
+    [fAudioTab setView:[fAudioController view]];
 
     // setup the advanced view controller
     fAdvancedOptions = [[HBAdvancedController alloc] init];
-       [fAdvancedTab setView:[fAdvancedOptions view]];
+    [fAdvancedTab setView:[fAdvancedOptions view]];
 
     // setup the video view controller
     fVideoController = [[HBVideoController alloc] initWithAdvancedController:fAdvancedOptions];
-       [fVideoTab setView:[fVideoController view]];
+    [fVideoTab setView:[fVideoController view]];
 
     [[NSUserDefaultsController sharedUserDefaultsController] addObserver:self
                                                               forKeyPath:@"values.HBShowAdvancedTab"
                                                                  options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionInitial
                                                                  context:NULL];
+    
+    [self.window recalculateKeyViewLoop];
+}
+
+#pragma mark -
+#pragma mark Drag & drop handling
+
+/** This method is used by OSX to know what kind of files can be drag & drop on the NSWindow
+ * We only want filenames (and so folders too)
+ */
+- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
+{
+    NSPasteboard *pboard = [sender draggingPasteboard];
+
+    if ([[pboard types] containsObject:NSFilenamesPboardType])
+    {
+        NSArray *paths = [pboard propertyListForType:NSFilenamesPboardType];
+        return paths.count == 1 ? NSDragOperationGeneric : NSDragOperationNone;
+    }
 
-    [fWindow recalculateKeyViewLoop];
+    return NSDragOperationNone;
 }
 
+// This method is doing the job after the drag & drop operation has been validated by [self draggingEntered] and OSX
+- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
+{
+    NSPasteboard *pboard = [sender draggingPasteboard];
+
+    if ([pboard.types containsObject:NSFilenamesPboardType])
+    {
+        NSArray *paths = [pboard propertyListForType:NSFilenamesPboardType];
+        [self openFile:[NSURL fileURLWithPath:paths.firstObject]];
+    }
+
+    return YES;
+}
+
+#pragma mark - KVO
+
 - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
 {
     if (context == NULL)
     fPresetsView.enabled = enabled;
 }
 
-#pragma mark -
-#pragma mark Toolbar
+- (NSSize)drawerWillResizeContents:(NSDrawer *) drawer toSize:(NSSize)contentSize {
+    [[NSUserDefaults standardUserDefaults] setObject:NSStringFromSize(contentSize) forKey:@"HBDrawerSize"];
+    return contentSize;
+}
 
-- (BOOL) validateToolbarItem: (NSToolbarItem *) toolbarItem
+#pragma mark - UI Validation
+
+- (BOOL)validateToolbarItem:(NSToolbarItem *)toolbarItem
 {
     SEL action = toolbarItem.action;
 
 
     if (self.job)
     {
-        if (action == @selector(showPicturePanel:))
-            return YES;
-        if (action == @selector(showPreviewWindow:))
-            return YES;
-        if (action == @selector(addToQueue:))
+        if (action == @selector(showPicturePanel:) ||
+            action == @selector(showPreviewWindow:) ||
+            action == @selector(addToQueue:))
+        {
             return YES;
+        }
     }
     else
     {
-        if (action == @selector(showPicturePanel:))
-            return NO;
-        if (action == @selector(showPreviewWindow:))
-            return NO;
-        if (action == @selector(addToQueue:))
+        if (action == @selector(showPicturePanel:) ||
+            action == @selector(showPreviewWindow:) ||
+            action == @selector(addToQueue:))
+        {
             return NO;
+        }
     }
 
     // If there are any pending queue items, make sure the start/stop button is active.
     if (action == @selector(rip:) && (fQueueController.pendingItemsCount > 0 || self.job))
+    {
         return YES;
-    if (action == @selector(showQueueWindow:))
-        return YES;
-    if (action == @selector(toggleDrawer:))
-        return YES;
-    if (action == @selector(browseSources:))
-        return YES;
-    if (action == @selector(showDebugOutputPanel:))
-        return YES;
+    }
 
-    return NO;
+    return YES;
 }
 
-- (BOOL) validateMenuItem: (NSMenuItem *) menuItem
+- (BOOL)validateMenuItem:(NSMenuItem *)menuItem
 {
     SEL action = [menuItem action];
-    HBState queueState = fQueueController.core.state;
-
-    if (action == @selector(addToQueue:) || action == @selector(addAllTitlesToQueue:) || action == @selector(showPicturePanel:) || action == @selector(showAddPresetPanel:))
-        return self.job && [fWindow attachedSheet] == nil;
 
+    if (action == @selector(addToQueue:) || action == @selector(addAllTitlesToQueue:) ||
+        action == @selector(showPicturePanel:) || action == @selector(showAddPresetPanel:) ||
+        action == @selector(showPreviewWindow:))
+    {
+        return self.job && self.window.attachedSheet == nil;
+    }
     if (action == @selector(selectDefaultPreset:))
-        return [fWindow attachedSheet] == nil;
-
+    {
+        return self.window.attachedSheet == nil;
+    }
     if (action == @selector(pause:))
     {
-        if (queueState == HBStateWorking)
-        {
-            if(![[menuItem title] isEqualToString:@"Pause Encoding"])
-                [menuItem setTitle:@"Pause Encoding"];
-            return YES;
-        }
-        else if (queueState == HBStatePaused)
-        {
-            if(![[menuItem title] isEqualToString:@"Resume Encoding"])
-                [menuItem setTitle:@"Resume Encoding"];
-            return YES;
-        }
-        else
-            return NO;
+        return [fQueueController validateMenuItem:menuItem];
     }
     if (action == @selector(rip:))
     {
-        if (queueState == HBStateWorking || queueState == HBStateMuxing || queueState == HBStatePaused)
-        {
-            if(![[menuItem title] isEqualToString:@"Stop Encoding"])
-                [menuItem setTitle:@"Stop Encoding"];
-            return YES;
-        }
-        else if (self.job)
+        BOOL result = [fQueueController validateMenuItem:menuItem];
+
+        if ([menuItem.title isEqualToString:NSLocalizedString(@"Start Encoding", nil)])
         {
-            if(![[menuItem title] isEqualToString:@"Start Encoding"])
-                [menuItem setTitle:@"Start Encoding"];
-            return [fWindow attachedSheet] == nil;
+            if (!result && self.job)
+            {
+                return YES;
+            }
         }
-        else
-            return NO;
+
+        return result;
     }
     if (action == @selector(browseSources:))
     {
-        if (self.core.state == HBStateScanning)
+        if (self.core.state == HBStateScanning) {
             return NO;
+        }
         else
-            return [fWindow attachedSheet] == nil;
+        {
+            return self.window.attachedSheet == nil;
+        }
     }
     if (action == @selector(selectPresetFromMenu:))
     {
         {
             menuItem.state = NSOffState;
         }
+        return (self.job != nil);
     }
 
     return YES;
 }
 
-#pragma mark -
-#pragma mark Get New Source
+#pragma mark - Get New Source
+
+- (void)launchAction
+{
+    if (self.core.state != HBStateScanning && !self.job)
+    {
+        // We show whichever open source window specified in LaunchSourceBehavior preference key
+        if ([[[NSUserDefaults standardUserDefaults] stringForKey:@"LaunchSourceBehavior"] isEqualToString: @"Open Source"])
+        {
+            [self browseSources:nil];
+        }
+    }
+    
+}
+
+- (void)openFile:(NSURL *)fileURL
+{
+    if (self.core.state != HBStateScanning)
+    {
+        self.browsedSourceDisplayName = fileURL.lastPathComponent;
+        [self performScan:fileURL scanTitleNum:0];
+    }
+}
+
+- (void)setJob:(HBJob *)job
+{
+    // Set the jobs info to the view controllers
+    fPictureController.picture = job.picture;
+    fPictureController.filters = job.filters;
+    fPreviewController.job = job;
+
+    fVideoController.job = job;
+    fAudioController.audio = job.audio;
+    fSubtitlesViewController.subtitles = job.subtitles;
+    fChapterTitlesController.job = job;
+
+    if (job)
+    {
+        [[NSNotificationCenter defaultCenter] removeObserver:_job];
+        [[NSNotificationCenter defaultCenter] removeObserver:_job.picture];
+        [[NSNotificationCenter defaultCenter] removeObserver:_job.filters];
+        [[NSNotificationCenter defaultCenter] removeObserver:_job.video];
+
+        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pictureSettingsDidChange) name:HBPictureChangedNotification object:job.picture];
+        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pictureSettingsDidChange) name:HBFiltersChangedNotification object:job.filters];
+        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(formatChanged:) name:HBContainerChangedNotification object:job];
+        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(customSettingUsed) name:HBVideoChangedNotification object:job.video];
+    }
+
+    // Retain the new job
+    [_job autorelease];
+    _job = [job retain];
+
+    [self enableUI:(job != nil)];
+}
 
 /**
  * Opens the source browse window, called from Open Source widgets
        }
 
     [panel setDirectoryURL:sourceDirectory];
-
-    [panel beginSheetModalForWindow:fWindow completionHandler: ^(NSInteger result)
-    {
-        if (result == NSOKButton)
-        {
-            NSURL *scanURL = panel.URL;
-            // we set the last searched source directory in the prefs here
-            [[NSUserDefaults standardUserDefaults] setURL:scanURL.URLByDeletingLastPathComponent forKey:@"HBLastSourceDirectoryURL"];
-
-            // we order out sheet, which is the browse window as we need to open
-            // the title selection sheet right away
-            [panel orderOut:self];
-
-            if (sender == fOpenSourceTitleMMenu || [[NSApp currentEvent] modifierFlags] & NSAlternateKeyMask)
-            {
-                // We put the chosen source path in the source display text field for the
-                // source title selection sheet in which the user specifies the specific title to be
-                // scanned  as well as the short source name in fSrcDsplyNameTitleScan just for display
-                // purposes in the title panel
-
-                // Full Path
-                [fScanSrcTitlePathField setStringValue:scanURL.path];
-                NSString *displayTitlescanSourceName;
-
-                if ([scanURL.lastPathComponent isEqualToString:@"VIDEO_TS"])
-                {
-                    // If VIDEO_TS Folder is chosen, choose its parent folder for the source display name
-                    // we have to use the title->path value so we get the proper name of the volume if a physical dvd is the source
-                    displayTitlescanSourceName = scanURL.URLByDeletingLastPathComponent.lastPathComponent;
-                }
-                else
-                {
-                    // if not the VIDEO_TS Folder, we can assume the chosen folder is the source name
-                    displayTitlescanSourceName = scanURL.lastPathComponent;
-                }
-                // we set the source display name in the title selection dialogue
-                [fSrcDsplyNameTitleScan setStringValue:displayTitlescanSourceName];
-                // we set the attempted scans display name for main window to displayTitlescanSourceName
-                self.browsedSourceDisplayName = displayTitlescanSourceName;
-                // We show the actual sheet where the user specifies the title to be scanned
-                // as we are going to do a title specific scan
-
-                [self showSourceTitleScanPanel:nil];
-            }
-            else
-            {
-                // We are just doing a standard full source scan, so we specify "0" to libhb
-                NSURL *url = panel.URL;
-
-                // We check to see if the chosen file at path is a package
-                if ([[NSWorkspace sharedWorkspace] isFilePackageAtPath:url.path])
-                {
-                    [HBUtilities writeToActivityLog:"trying to open a package at: %s", url.path.UTF8String];
-                    // We check to see if this is an .eyetv package
-                    if ([url.pathExtension isEqualToString:@"eyetv"])
-                    {
-                        [HBUtilities writeToActivityLog:"trying to open eyetv package"];
-                        // We're looking at an EyeTV package - try to open its enclosed .mpg media file
-                        self.browsedSourceDisplayName = url.URLByDeletingPathExtension.lastPathComponent;
-                        NSString *mpgname;
-                        NSUInteger n = [[url.path stringByAppendingString: @"/"]
-                                        completePathIntoString: &mpgname caseSensitive: YES
-                                        matchesIntoArray: nil
-                                        filterTypes: @[@"mpg"]];
-                        if (n > 0)
-                        {
-                            // Found an mpeg inside the eyetv package, make it our scan path
-                            [HBUtilities writeToActivityLog:"found mpeg in eyetv package"];
-                            url = [NSURL fileURLWithPath:mpgname];
-                        }
-                        else
-                        {
-                            // We did not find an mpeg file in our package, so we do not call performScan
-                            [HBUtilities writeToActivityLog:"no valid mpeg in eyetv package"];
-                        }
-                    }
-                    // We check to see if this is a .dvdmedia package
-                    else if ([url.pathExtension isEqualToString:@"dvdmedia"])
-                    {
-                        // path IS a package - but dvdmedia packages can be treaded like normal directories
-                        self.browsedSourceDisplayName = url.URLByDeletingPathExtension.lastPathComponent;
-                        [HBUtilities writeToActivityLog:"trying to open dvdmedia package"];
-                    }
-                    else
-                    {
-                        // The package is not an eyetv package, try to open it anyway
-                        self.browsedSourceDisplayName = url.lastPathComponent;
-                        [HBUtilities writeToActivityLog:"not a known to package"];
-                    }
-                }
-                else
-                {
-                    // path is not a package, so we call perform scan directly on our file
-                    if ([url.lastPathComponent isEqualToString:@"VIDEO_TS"])
-                    {
-                        [HBUtilities writeToActivityLog:"trying to open video_ts folder (video_ts folder chosen)"];
-                        // If VIDEO_TS Folder is chosen, choose its parent folder for the source display name
-                        url = url.URLByDeletingLastPathComponent;
-                        self.browsedSourceDisplayName = url.lastPathComponent;
-                    }
-                    else
-                    {
-                        [HBUtilities writeToActivityLog:"trying to open a folder or file"];
-                        // if not the VIDEO_TS Folder, we can assume the chosen folder is the source name
-                        // make sure we remove any path extension
-                        self.browsedSourceDisplayName = url.lastPathComponent;
-                    }
-                }
-
-                [self performScan:url scanTitleNum:0];
-            }
-        }
-    }];
-}
-
-/* Here we open the title selection sheet where we can specify an exact title to be scanned */
-- (IBAction) showSourceTitleScanPanel: (id) sender
-{
-    /* We default the title number to be scanned to "0" which results in a full source scan, unless the
-    * user changes it
-    */
-    [fScanSrcTitleNumField setStringValue: @"0"];
-       /* Show the panel */
-       [NSApp beginSheet:fScanSrcTitlePanel modalForWindow:fWindow modalDelegate:nil didEndSelector:NULL contextInfo:NULL];
-}
-
-- (IBAction) closeSourceTitleScanPanel: (id) sender
-{
-    [NSApp endSheet: fScanSrcTitlePanel];
-    [fScanSrcTitlePanel orderOut: self];
-
-    if (sender == fScanSrcTitleOpenButton)
-    {
-        // We setup the scan status in the main window to indicate a source title scan
-        [fSrcDVD2Field setStringValue: @"Opening a new source title…"];
-        [fScanIndicator setHidden: NO];
-        [fScanHorizontalLine setHidden: YES];
-        [fScanIndicator setIndeterminate: YES];
-        [fScanIndicator startAnimation: nil];
-               
-        // We use the performScan method to actually perform the specified scan passing the path and the title
-        // to be scanned
-        [self performScan:[NSURL fileURLWithPath:fScanSrcTitlePathField.stringValue] scanTitleNum:fScanSrcTitleNumField.intValue];
-    }
+    [panel setAccessoryView:self.openTitleView];
+
+    [panel beginSheetModalForWindow:self.window completionHandler: ^(NSInteger result)
+    {
+         if (result == NSOKButton)
+         {
+             NSURL *scanURL = panel.URL;
+             // we set the last searched source directory in the prefs here
+             [[NSUserDefaults standardUserDefaults] setURL:scanURL.URLByDeletingLastPathComponent forKey:@"HBLastSourceDirectoryURL"];
+
+             NSURL *url = panel.URL;
+
+             // We check to see if the chosen file at path is a package
+             if ([[NSWorkspace sharedWorkspace] isFilePackageAtPath:url.path])
+             {
+                 [HBUtilities writeToActivityLog:"trying to open a package at: %s", url.path.UTF8String];
+                 // We check to see if this is an .eyetv package
+                 if ([url.pathExtension isEqualToString:@"eyetv"])
+                 {
+                     [HBUtilities writeToActivityLog:"trying to open eyetv package"];
+                     // We're looking at an EyeTV package - try to open its enclosed .mpg media file
+                     self.browsedSourceDisplayName = url.URLByDeletingPathExtension.lastPathComponent;
+                     NSString *mpgname;
+                     NSUInteger n = [[url.path stringByAppendingString: @"/"]
+                                     completePathIntoString: &mpgname caseSensitive: YES
+                                     matchesIntoArray: nil
+                                     filterTypes: @[@"mpg"]];
+                     if (n > 0)
+                     {
+                         // Found an mpeg inside the eyetv package, make it our scan path
+                         [HBUtilities writeToActivityLog:"found mpeg in eyetv package"];
+                         url = [NSURL fileURLWithPath:mpgname];
+                     }
+                     else
+                     {
+                         // We did not find an mpeg file in our package, so we do not call performScan
+                         [HBUtilities writeToActivityLog:"no valid mpeg in eyetv package"];
+                     }
+                 }
+                 // We check to see if this is a .dvdmedia package
+                 else if ([url.pathExtension isEqualToString:@"dvdmedia"])
+                 {
+                     // path IS a package - but dvdmedia packages can be treaded like normal directories
+                     self.browsedSourceDisplayName = url.URLByDeletingPathExtension.lastPathComponent;
+                     [HBUtilities writeToActivityLog:"trying to open dvdmedia package"];
+                 }
+                 else
+                 {
+                     // The package is not an eyetv package, try to open it anyway
+                     self.browsedSourceDisplayName = url.lastPathComponent;
+                     [HBUtilities writeToActivityLog:"not a known to package"];
+                 }
+             }
+             else
+             {
+                 // path is not a package, so we call perform scan directly on our file
+                 if ([url.lastPathComponent isEqualToString:@"VIDEO_TS"])
+                 {
+                     [HBUtilities writeToActivityLog:"trying to open video_ts folder (video_ts folder chosen)"];
+                     // If VIDEO_TS Folder is chosen, choose its parent folder for the source display name
+                     url = url.URLByDeletingLastPathComponent;
+                     self.browsedSourceDisplayName = url.lastPathComponent;
+                 }
+                 else
+                 {
+                     [HBUtilities writeToActivityLog:"trying to open a folder or file"];
+                     // if not the VIDEO_TS Folder, we can assume the chosen folder is the source name
+                     // make sure we remove any path extension
+                     self.browsedSourceDisplayName = url.lastPathComponent;
+                 }
+             }
+
+             NSInteger titleIdx = 0;
+             if (self.scanSpecificTitle)
+             {
+                 titleIdx = self.scanSpecificTitleIdx;
+             }
+             [self performScan:url scanTitleNum:titleIdx];
+         }
+     }];
 }
 
 /* Here we actually tell hb_scan to perform the source scan, using the path to source and title number*/
     }
 
     self.job = nil;
+    [fSrcTitlePopUp removeAllItems];
 
     NSError *outError = NULL;
     BOOL suppressWarning = [[NSUserDefaults standardUserDefaults] boolForKey:@"suppresslibdvdcss"];
                 // We display a message if a valid source was not chosen
                 fSrcDVD2Field.stringValue = NSLocalizedString(@"No Valid Source Found", @"");
             }
-            [fWindow.toolbar validateVisibleItems];
+            [self.window.toolbar validateVisibleItems];
         }];
     }
 }
         [HBUtilities writeToActivityLog: "showNewScan: This is a new source item scan"];
     }
 
-    [fSrcTitlePopUp removeAllItems];
-
     for (HBTitle *title in self.core.titles)
     {
         // Set Source Name at top of window with the browsedSourceDisplayName grokked right before -performScan
     }
 }
 
-#pragma mark -
-#pragma mark New Output Destination
+#pragma mark - GUI Controls Changed Methods
 
-- (IBAction)browseFile:(id)sender
+- (IBAction)browseDestination:(id)sender
 {
     // Open a panel to let the user choose and update the text field
     NSSavePanel *panel = [NSSavePanel savePanel];
     panel.directoryURL = self.job.destURL.URLByDeletingLastPathComponent;
     panel.nameFieldStringValue = self.job.destURL.lastPathComponent;
 
-    [panel beginSheetModalForWindow:fWindow completionHandler:^(NSInteger result) {
-        if (result == NSFileHandlingPanelOKButton)
-        {
-            self.job.destURL = panel.URL;
+    [panel beginSheetModalForWindow:self.window completionHandler:^(NSInteger result)
+     {
+         if (result == NSFileHandlingPanelOKButton)
+         {
+             self.job.destURL = panel.URL;
 
-            // Save this path to the prefs so that on next browse destination window it opens there
-            [[NSUserDefaults standardUserDefaults] setURL:panel.URL.URLByDeletingLastPathComponent
-                                                      forKey:@"HBLastDestinationDirectory"];
-        }
-    }];
+             // Save this path to the prefs so that on next browse destination window it opens there
+             [[NSUserDefaults standardUserDefaults] setURL:panel.URL.URLByDeletingLastPathComponent
+                                                    forKey:@"HBLastDestinationDirectory"];
+         }
+     }];
 }
 
-#pragma mark -
-#pragma mark Main Window Control
+- (void)updateFileName
+{
+    HBTitle *title = self.job.title;
+
+    // Generate a new file name
+    NSString *fileName = [HBUtilities automaticNameForSource:title.name
+                                                       title:title.hb_title->index
+                                                    chapters:NSMakeRange(self.job.range.chapterStart + 1, self.job.range.chapterStop + 1)
+                                                     quality:self.job.video.qualityType ? self.job.video.quality : 0
+                                                     bitrate:!self.job.video.qualityType ? self.job.video.avgBitrate : 0
+                                                  videoCodec:self.job.video.encoder];
 
-- (IBAction) openMainWindow: (id) sender
+    // Swap the old one with the new one
+    self.job.destURL = [[self.job.destURL URLByDeletingLastPathComponent] URLByAppendingPathComponent:
+                        [NSString stringWithFormat:@"%@.%@", fileName, self.job.destURL.pathExtension]];
+}
+
+- (NSURL *)destURLForJob:(HBJob *)job
 {
-    [fWindow  makeKeyAndOrderFront:nil];
+    // Check to see if the last destination has been set,use if so, if not, use Desktop
+    NSURL *destURL = [[NSUserDefaults standardUserDefaults] URLForKey:@"HBLastDestinationDirectory"];
+    if (!destURL || ![[NSFileManager defaultManager] fileExistsAtPath:destURL.path])
+    {
+        destURL = [NSURL fileURLWithPath:[NSSearchPathForDirectoriesInDomains(NSDesktopDirectory, NSUserDomainMask, YES) firstObject]
+                             isDirectory:YES];
+    }
+
+    destURL = [destURL URLByAppendingPathComponent:job.title.name];
+    // use the correct extension based on the container
+    const char *ext = hb_container_get_default_extension(self.job.container);
+    destURL = [destURL URLByAppendingPathExtension:@(ext)];
+
+    return destURL;
 }
 
-- (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows:(BOOL)flag
+- (IBAction)titlePopUpChanged:(id)sender
 {
-    if( !flag ) {
-        [fWindow makeKeyAndOrderFront:nil];
+    // If there is already a title load, save the current settings to a preset
+    if (self.job)
+    {
+        self.selectedPreset = [self createPresetFromCurrentSettings];
+    }
+
+    HBTitle *title = self.core.titles[fSrcTitlePopUp.indexOfSelectedItem];
+
+    // Check if we are reapplying a job from the queue, or creating a new one
+    if (self.jobFromQueue)
+    {
+        self.jobFromQueue.title = title;
+        self.job = self.jobFromQueue;
+    }
+    else
+    {
+        self.job = [[[HBJob alloc] initWithTitle:title andPreset:self.selectedPreset] autorelease];
+        self.job.destURL = [self destURLForJob:self.job];
+
+        // set m4v extension if necessary - do not override user-specified .mp4 extension
+        if (self.job.container & HB_MUX_MASK_MP4)
+        {
+            [self autoSetM4vExtension:nil];
+        }
+    }
+
+    // If we are a stream type and a batch scan, grok the output file name from title->name upon title change
+    if ((title.hb_title->type == HB_STREAM_TYPE || title.hb_title->type == HB_FF_STREAM_TYPE) && self.core.titles.count > 1)
+    {
+        // Change the source to read out the parent folder also
+        fSrcDVD2Field.stringValue = [NSString stringWithFormat:@"%@/%@", self.browsedSourceDisplayName, title.name];
+    }
+
+    // apply the current preset
+    if (!self.jobFromQueue)
+    {
+        [self applyPreset:self.selectedPreset];
+    }
+}
+
+- (void)chapterPopUpChanged:(NSNotification *)notification
+{
+    // We're changing the chapter range - we may need to flip the m4v/mp4 extension
+    if (self.job.container & HB_MUX_MASK_MP4)
+    {
+        [self autoSetM4vExtension:notification];
+    }
+
+    // If Auto Naming is on it might need to be update if it includes the chapters range
+    if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultAutoNaming"])
+    {
+        [self updateFileName];
     }
-    return YES;
 }
 
-- (NSSize) drawerWillResizeContents:(NSDrawer *) drawer toSize:(NSSize) contentSize {
-       [[NSUserDefaults standardUserDefaults] setObject:NSStringFromSize( contentSize ) forKey:@"HBDrawerSize"];
-       return contentSize;
+- (void)formatChanged:(NSNotification *)notification
+{
+    if (self.job)
+    {
+        int videoContainer = self.job.container;
+
+        // set the file extension
+        const char *ext = hb_container_get_default_extension(videoContainer);
+        self.job.destURL = [[self.job.destURL URLByDeletingPathExtension] URLByAppendingPathExtension:@(ext)];
+
+        if (videoContainer & HB_MUX_MASK_MP4)
+        {
+            [self autoSetM4vExtension:notification];
+        }
+    }
 }
 
-#pragma mark - Queue Item Editing
+- (void)autoSetM4vExtension:(NSNotification *)notification
+{
+    if (!(self.job.container & HB_MUX_MASK_MP4))
+        return;
+
+    NSString *extension = @"mp4";
+
+    BOOL anyCodecAC3 = [self.job.audio anyCodecMatches:HB_ACODEC_AC3] || [self.job.audio anyCodecMatches:HB_ACODEC_AC3_PASS];
+    // Chapter markers are enabled if the checkbox is ticked and we are doing p2p or we have > 1 chapter
+    BOOL chapterMarkers = (self.job.chaptersEnabled) &&
+    (self.job.range.type != HBRangeTypeChapters ||
+     self.job.range.chapterStart < self.job.range.chapterStop);
+
+    if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"DefaultMpegExtension"] isEqualToString: @".m4v"] ||
+        ((YES == anyCodecAC3 || YES == chapterMarkers) &&
+         [[[NSUserDefaults standardUserDefaults] objectForKey:@"DefaultMpegExtension"] isEqualToString: @"Auto"]))
+    {
+        extension = @"m4v";
+    }
+
+    if ([extension isEqualTo:self.job.destURL.pathExtension])
+    {
+        return;
+    }
+    else
+    {
+        self.job.destURL = [[self.job.destURL URLByDeletingPathExtension] URLByAppendingPathExtension:extension];
+    }
+}
 
 /**
- * Rescans the chosen queue item back into the main window
+ * Method to determine if we should change the UI
+ * To reflect whether or not a Preset is being used or if
+ * the user is using "Custom" settings by determining the sender
  */
-- (void)rescanJobToMainWindow:(HBJob *)queueItem
+- (void)customSettingUsed
 {
-    // Set the browsedSourceDisplayName for showNewScan
-    self.jobFromQueue = queueItem;
-    self.browsedSourceDisplayName = self.jobFromQueue.fileURL.lastPathComponent;
+    // Deselect the currently selected Preset if there is one
+    [fPresetsView deselect];
+    // Change UI to show "Custom" settings are being used
+    self.job.presetName = NSLocalizedString(@"Custom", @"");
 
-    [self performScan:self.jobFromQueue.fileURL scanTitleNum:self.jobFromQueue.titleIdx];
+    // If Auto Naming is on it might need to be update if it includes the quality token
+    if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultAutoNaming"])
+    {
+        [self updateFileName];
+    }
 }
 
-#pragma mark - Queue
+#pragma mark - Queue progress
 
 - (void)setQueueState:(NSString *)info
 {
     {
         if (fRipIndicatorShown)
         {
-            NSRect frame = fWindow.frame;
+            NSRect frame = self.window.frame;
             if (frame.size.width <= WINDOW_HEIGHT)
                 frame.size.width = WINDOW_HEIGHT;
             frame.size.height += -WINDOW_HEIGHT_OFFSET;
             frame.origin.y -= -WINDOW_HEIGHT_OFFSET;
-            [fWindow setFrame:frame display:YES animate:YES];
+            [self.window setFrame:frame display:YES animate:YES];
             fRipIndicatorShown = NO;
 
             // Refresh the toolbar buttons
-            [fWindow.toolbar validateVisibleItems];
+            [self.window.toolbar validateVisibleItems];
         }
     }
     else
         // that now.
         if (!fRipIndicatorShown)
         {
-            NSRect frame = fWindow.frame;
+            NSRect frame = self.window.frame;
             if (frame.size.width <= WINDOW_HEIGHT)
                 frame.size.width = WINDOW_HEIGHT;
             frame.size.height += WINDOW_HEIGHT_OFFSET;
             frame.origin.y -= WINDOW_HEIGHT_OFFSET;
-            [fWindow setFrame:frame display:YES animate:YES];
+            [self.window setFrame:frame display:YES animate:YES];
             fRipIndicatorShown = YES;
 
             // Refresh the toolbar buttons
-            [fWindow.toolbar validateVisibleItems];
+            [self.window.toolbar validateVisibleItems];
         }
     }
 }
         [alert addButtonWithTitle:NSLocalizedString(@"Overwrite", @"")];
         [alert setAlertStyle:NSCriticalAlertStyle];
 
-        [alert beginSheetModalForWindow:fWindow modalDelegate:self didEndSelector:@selector(overwriteAddToQueueAlertDone:returnCode:contextInfo:) contextInfo:NULL];
+        [alert beginSheetModalForWindow:self.window modalDelegate:self didEndSelector:@selector(overwriteAddToQueueAlertDone:returnCode:contextInfo:) contextInfo:NULL];
         [alert release];
     }
     else if ([fQueueController jobExistAtURL:self.job.destURL])
         [alert addButtonWithTitle:NSLocalizedString(@"Overwrite", @"")];
         [alert setAlertStyle:NSCriticalAlertStyle];
 
-        [alert beginSheetModalForWindow:fWindow modalDelegate:self didEndSelector:@selector(overwriteAddToQueueAlertDone:returnCode:contextInfo:) contextInfo:NULL];
+        [alert beginSheetModalForWindow:self.window modalDelegate:self didEndSelector:@selector(overwriteAddToQueueAlertDone:returnCode:contextInfo:) contextInfo:NULL];
         [alert release];
     }
     else
     }
 }
 
+/**
+ * Rescans the chosen queue item back into the main window
+ */
+- (void)rescanJobToMainWindow:(HBJob *)queueItem
+{
+    // Set the browsedSourceDisplayName for showNewScan
+    self.jobFromQueue = queueItem;
+    self.browsedSourceDisplayName = self.jobFromQueue.fileURL.lastPathComponent;
+
+    [self performScan:self.jobFromQueue.fileURL scanTitleNum:self.jobFromQueue.titleIdx];
+}
+
 - (void)doRip
 {
     // if there are no jobs in the queue, then add this one to the queue and rip
         [alert addButtonWithTitle:NSLocalizedString(@"Overwrite", @"")];
         [alert setAlertStyle:NSCriticalAlertStyle];
 
-        [alert beginSheetModalForWindow:fWindow modalDelegate:self didEndSelector:@selector(overWriteAlertDone:returnCode:contextInfo:) contextInfo:NULL];
+        [alert beginSheetModalForWindow:self.window modalDelegate:self didEndSelector:@selector(overWriteAlertDone:returnCode:contextInfo:) contextInfo:NULL];
         // overWriteAlertDone: will be called when the alert is dismissed. It will call doRip.
         [alert release];
     }
     [alert addButtonWithTitle:NSLocalizedString(@"Yes, I want to add all titles to the queue", @"")];
     [alert setAlertStyle:NSCriticalAlertStyle];
 
-    [alert beginSheetModalForWindow:fWindow modalDelegate:self didEndSelector:@selector(addAllTitlesToQueueAlertDone:returnCode:contextInfo:) contextInfo:NULL];
+    [alert beginSheetModalForWindow:self.window modalDelegate:self didEndSelector:@selector(addAllTitlesToQueueAlertDone:returnCode:contextInfo:) contextInfo:NULL];
     [alert release];
 }
 
     [jobs release];
 }
 
-#pragma mark -
-#pragma mark GUI Controls Changed Methods
-
-- (void)updateFileName
-{
-    HBTitle *title = self.job.title;
-
-    // Generate a new file name
-    NSString *fileName = [HBUtilities automaticNameForSource:title.name
-                                                       title:title.hb_title->index
-                                                    chapters:NSMakeRange(self.job.range.chapterStart + 1, self.job.range.chapterStop + 1)
-                                                     quality:self.job.video.qualityType ? self.job.video.quality : 0
-                                                     bitrate:!self.job.video.qualityType ? self.job.video.avgBitrate : 0
-                                                  videoCodec:self.job.video.encoder];
-
-    // Swap the old one with the new one
-    self.job.destURL = [[self.job.destURL URLByDeletingLastPathComponent] URLByAppendingPathComponent:
-                        [NSString stringWithFormat:@"%@.%@", fileName, self.job.destURL.pathExtension]];
-}
-
-- (NSURL *)destURLForJob:(HBJob *)job
-{
-    // Check to see if the last destination has been set,use if so, if not, use Desktop
-    NSURL *destURL = [[NSUserDefaults standardUserDefaults] URLForKey:@"HBLastDestinationDirectory"];
-    if (!destURL || ![[NSFileManager defaultManager] fileExistsAtPath:destURL.path])
-    {
-        destURL = [NSURL fileURLWithPath:[NSSearchPathForDirectoriesInDomains(NSDesktopDirectory, NSUserDomainMask, YES) firstObject]
-                             isDirectory:YES];
-    }
-
-    destURL = [destURL URLByAppendingPathComponent:job.title.name];
-    // use the correct extension based on the container
-    const char *ext = hb_container_get_default_extension(self.job.container);
-    destURL = [destURL URLByAppendingPathExtension:@(ext)];
-
-    return destURL;
-}
-
-- (IBAction) titlePopUpChanged: (id) sender
-{
-    // If there is already a title load, save the current settings to a preset
-    if (self.job)
-    {
-        self.selectedPreset = [self createPresetFromCurrentSettings];
-    }
-
-    HBTitle *title = self.core.titles[fSrcTitlePopUp.indexOfSelectedItem];
-
-    // Check if we are reapplying a job from the queue, or creating a new one
-    if (self.jobFromQueue)
-    {
-        self.jobFromQueue.title = title;
-        self.job = self.jobFromQueue;
-    }
-    else
-    {
-        self.job = [[[HBJob alloc] initWithTitle:title andPreset:self.selectedPreset] autorelease];
-        self.job.destURL = [self destURLForJob:self.job];
-
-        // set m4v extension if necessary - do not override user-specified .mp4 extension
-        if (self.job.container & HB_MUX_MASK_MP4)
-        {
-            [self autoSetM4vExtension:nil];
-        }
-    }
-
-    // If we are a stream type and a batch scan, grok the output file name from title->name upon title change
-    if ((title.hb_title->type == HB_STREAM_TYPE || title.hb_title->type == HB_FF_STREAM_TYPE) && self.core.titles.count > 1)
-    {
-        // Change the source to read out the parent folder also
-        fSrcDVD2Field.stringValue = [NSString stringWithFormat:@"%@/%@", self.browsedSourceDisplayName, title.name];
-    }
-
-    // apply the current preset
-    if (!self.jobFromQueue)
-    {
-        [self applyPreset:self.selectedPreset];
-    }
-}
-
-- (void)chapterPopUpChanged:(NSNotification *)notification
-{
-    // We're changing the chapter range - we may need to flip the m4v/mp4 extension
-    if (self.job.container & HB_MUX_MASK_MP4)
-    {
-        [self autoSetM4vExtension:notification];
-    }
-
-    // If Auto Naming is on it might need to be update if it includes the chapters range
-    if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultAutoNaming"])
-       {
-        [self updateFileName];
-       }
-}
-
-- (void)formatChanged:(NSNotification *)notification
-{
-    if (self.job)
-    {
-        int videoContainer = self.job.container;
-
-        // set the file extension
-        const char *ext = hb_container_get_default_extension(videoContainer);
-        self.job.destURL = [[self.job.destURL URLByDeletingPathExtension] URLByAppendingPathExtension:@(ext)];
-
-        if (videoContainer & HB_MUX_MASK_MP4)
-        {
-            [self autoSetM4vExtension:notification];
-        }
-    }
-}
-
-- (void) autoSetM4vExtension:(NSNotification *)notification
-{
-    if (!(self.job.container & HB_MUX_MASK_MP4))
-        return;
-    
-    NSString *extension = @"mp4";
-    
-    BOOL anyCodecAC3 = [self.job.audio anyCodecMatches:HB_ACODEC_AC3] || [self.job.audio anyCodecMatches:HB_ACODEC_AC3_PASS];
-    // Chapter markers are enabled if the checkbox is ticked and we are doing p2p or we have > 1 chapter
-    BOOL chapterMarkers = (self.job.chaptersEnabled) &&
-                          (self.job.range.type != HBRangeTypeChapters ||
-                           self.job.range.chapterStart < self.job.range.chapterStop);
-
-    if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"DefaultMpegExtension"] isEqualToString: @".m4v"] || 
-        ((YES == anyCodecAC3 || YES == chapterMarkers) &&
-         [[[NSUserDefaults standardUserDefaults] objectForKey:@"DefaultMpegExtension"] isEqualToString: @"Auto"]))
-    {
-        extension = @"m4v";
-    }
-    
-    if ([extension isEqualTo:self.job.destURL.pathExtension])
-    {
-        return;
-    }
-    else
-    {
-        self.job.destURL = [[self.job.destURL URLByDeletingPathExtension] URLByAppendingPathExtension:extension];
-   }
-}
-
-/**
- * Method to determine if we should change the UI
- * To reflect whether or not a Preset is being used or if
- * the user is using "Custom" settings by determining the sender
- */
-- (void)customSettingUsed
-{
-    // Deselect the currently selected Preset if there is one
-    [fPresetsView deselect];
-    // Change UI to show "Custom" settings are being used
-    self.job.presetName = NSLocalizedString(@"Custom", @"");
-
-    // If Auto Naming is on it might need to be update if it includes the quality token
-    if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultAutoNaming"])
-       {
-        [self updateFileName];
-       }
-}
-
-#pragma mark -
 #pragma mark - Picture
 
 /**
     [self customSettingUsed];
 }
 
-#pragma mark -
-#pragma mark Open New Windows
-
-- (IBAction) openHomepage: (id) sender
-{
-    [[NSWorkspace sharedWorkspace] openURL: [NSURL
-        URLWithString:@"http://handbrake.fr/"]];
-}
-
-- (IBAction) openForums: (id) sender
-{
-    [[NSWorkspace sharedWorkspace] openURL: [NSURL
-        URLWithString:@"http://forum.handbrake.fr/"]];
-}
-- (IBAction) openUserGuide: (id) sender
-{
-    [[NSWorkspace sharedWorkspace] openURL: [NSURL
-        URLWithString:@"http://trac.handbrake.fr/wiki/HandBrakeGuide"]];
-}
-
-/**
- * Shows debug output window.
- */
-- (IBAction)showDebugOutputPanel:(id)sender
-{
-    [outputPanel showOutputPanel:sender];
-}
-
-/**
- * Shows preferences window.
- */
-- (IBAction) showPreferencesWindow: (id) sender
-{
-    if (fPreferencesController == nil)
-    {
-        fPreferencesController = [[HBPreferencesController alloc] init];
-    }
-
-    NSWindow *window = [fPreferencesController window];
-    if (![window isVisible])
-        [window center];
-
-    [window makeKeyAndOrderFront: nil];
-}
-
-/**
- * Shows queue window.
- */
-- (IBAction) showQueueWindow:(id)sender
-{
-    [fQueueController showWindow:sender];
-}
-
-- (IBAction) toggleDrawer:(id)sender
+- (IBAction)toggleDrawer:(id)sender
 {
-    if ([fPresetDrawer state] == NSDrawerClosedState)
+    if (fPresetDrawer.state == NSDrawerClosedState)
     {
         [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"HBDefaultPresetsDrawerShow"];
     }
 /**
  * Shows Picture Settings Window.
  */
-- (IBAction) showPicturePanel: (id) sender
+- (IBAction)showPicturePanel:(id)sender
 {
        [fPictureController showPictureWindow];
 }
 
-- (IBAction) showPreviewWindow: (id) sender
+- (IBAction)showPreviewWindow:(id)sender
 {
        [fPreviewController showWindow:sender];
 }
 
-#pragma mark - Preset  Methods
+#pragma mark - Presets View Controller Delegate
+
+- (void)selectionDidChange
+{
+    [self applyPreset:fPresetsView.selectedPreset];
+}
+
+#pragma mark -  Presets
 
 - (void)applyPreset:(HBPreset *)preset
 {
     }
 }
 
-#pragma mark - Presets View Controller Delegate
-
-- (void)selectionDidChange
-{
-    [self applyPreset:fPresetsView.selectedPreset];
-}
-
-#pragma mark -
-#pragma mark Manage Presets
-
-- (void) checkBuiltInsForUpdates
-{
-    /* if we have built in presets to update, then do so AlertBuiltInPresetUpdate*/
-    if ([presetManager checkBuiltInsForUpdates])
-    {
-        if( [[NSUserDefaults standardUserDefaults] boolForKey:@"AlertBuiltInPresetUpdate"] == YES)
-        {
-            /* Show an alert window that built in presets will be updated */
-            /*On Screen Notification*/
-            [NSApp requestUserAttention:NSCriticalRequest];
-            NSAlert *alert = [[NSAlert alloc] init];
-            [alert setMessageText:@"HandBrake has determined your built in presets are out of date…"];
-            [alert setInformativeText:@"HandBrake will now update your built-in presets."];
-            [alert runModal];
-            [alert release];
-        }
-        /* when alert is dismissed, go ahead and update the built in presets */
-        [presetManager generateBuiltInPresets];
-    }
-}
-
 - (IBAction)showAddPresetPanel:(id)sender
 {
-       /* Show the add panel */
+       // Show the add panel
     HBAddPresetController *addPresetController = [[HBAddPresetController alloc] initWithPreset:[self createPresetFromCurrentSettings]
                                                                                      videoSize:NSMakeSize(self.job.picture.width, self.job.picture.height)];
 
-    [NSApp beginSheet:addPresetController.window modalForWindow:fWindow modalDelegate:self didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:addPresetController];
+    [NSApp beginSheet:addPresetController.window modalForWindow:self.window modalDelegate:self didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:addPresetController];
 }
 
 - (void)sheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
 
 - (IBAction) browseExportPresetFile: (id) sender
 {
-    /* Open a panel to let the user choose where and how to save the export file */
+    // Open a panel to let the user choose where and how to save the export file
     NSSavePanel *panel = [NSSavePanel savePanel];
-       /* We get the current file name and path from the destination field here */
-    NSString *defaultExportDirectory = [NSString stringWithFormat: @"%@/Desktop/", NSHomeDirectory()];
-    [panel setDirectoryURL:[NSURL fileURLWithPath:defaultExportDirectory]];
+       // We get the current file name and path from the destination field here
+    NSURL *defaultExportDirectory = [[NSURL fileURLWithPath:NSHomeDirectory()] URLByAppendingPathComponent:@"Desktop"];
+    [panel setDirectoryURL:defaultExportDirectory];
     [panel setNameFieldStringValue:@"HB_Export.plist"];
-    [panel beginSheetModalForWindow:fWindow completionHandler:^(NSInteger result) {
+    [panel beginSheetModalForWindow:self.window completionHandler:^(NSInteger result) {
         if( result == NSOKButton )
         {
             NSURL *exportPresetsFile = [panel URL];
             NSURL *presetExportDirectory = [exportPresetsFile URLByDeletingLastPathComponent];
             [[NSUserDefaults standardUserDefaults] setURL:presetExportDirectory forKey:@"LastPresetExportDirectoryURL"];
 
-            /* We check for the presets.plist */
+            // We check for the presets.plist
             if ([[NSFileManager defaultManager] fileExistsAtPath:[exportPresetsFile path]] == 0)
             {
                 [[NSFileManager defaultManager] createFileAtPath:[exportPresetsFile path] contents:nil attributes:nil];
             if (presetsToExport == nil)
             {
                 presetsToExport = [[NSMutableArray alloc] init];
-                /* now get and add selected presets to export */
+                // now get and add selected presets to export
             }
             if (fPresetsView.selectedPreset != nil)
             {
 
 - (IBAction)browseImportPresetFile:(id)sender
 {
-    NSOpenPanel *panel;
-
-    panel = [NSOpenPanel openPanel];
+    NSOpenPanel *panel = [NSOpenPanel openPanel];
     [panel setAllowsMultipleSelection:NO];
     [panel setCanChooseFiles:YES];
     [panel setCanChooseDirectories:NO];
        {
                sourceDirectory = [[NSURL fileURLWithPath:NSHomeDirectory()] URLByAppendingPathComponent:@"Desktop"];
        }
-    /* we open up the browse sources sheet here and call for browseSourcesDone after the sheet is closed
-        * to evaluate whether we want to specify a title, we pass the sender in the contextInfo variable
-        */
-    /* set this for allowed file types, not sure if we should allow xml or not */
+
+    // set this for allowed file types, not sure if we should allow xml or not.
     [panel setDirectoryURL:sourceDirectory];
-    [panel beginSheetModalForWindow:fWindow completionHandler:^(NSInteger result)
+    [panel beginSheetModalForWindow:self.window completionHandler:^(NSInteger result)
     {
         NSURL *importPresetsFile = [panel URL];
         NSURL *importPresetsDirectory = nil;//[importPresetsFile URLByDeletingLastPathComponent];
         [[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   */
+        // 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];
-        /* iterate though the new array of presets to import and add them to our presets array */
-        for (NSMutableDictionary *tempObject in presetsToImport)
+        // iterate though the new array of presets to import and add them to our presets array
+        for (NSMutableDictionary *dict in presetsToImport)
         {
-            /* make any changes to the incoming preset we see fit */
-            /* make sure the incoming preset is not tagged as default */
-            [tempObject setObject:[NSNumber numberWithInt:0] forKey:@"Default"];
-            /* prepend "(imported) to the name of the incoming preset for clarification since it can be changed */
-            NSString *prependedName = [@"(import) " stringByAppendingString:[tempObject objectForKey:@"PresetName"]] ;
-            [tempObject setObject:prependedName forKey:@"PresetName"];
-            
-            /* actually add the new preset to our presets array */
-            [presetManager addPresetFromDictionary:tempObject];
+            // make any changes to the incoming preset we see fit
+            // make sure the incoming preset is not tagged as default
+            dict[@"Default"] = @0;
+            // prepend "(imported) to the name of the incoming preset for clarification since it can be changed
+            NSString *prependedName = [@"(import) " stringByAppendingString:dict[@"PresetName"]] ;
+            dict[@"PresetName"] = prependedName;
+
+            // actually add the new preset to our presets array
+            [presetManager addPresetFromDictionary:dict];
         }
         [presetsToImport autorelease];
     }];
     [fPresetsView setSelection:preset];
 }
 
-/**
- *  Adds the presets list to the menu.
- */
-- (void)buildPresetsMenu
-{
-    // First we remove all the preset menu items
-    // inserted previosly
-    NSArray *menuItems = [presetsMenu.itemArray copy];
-    for (NSMenuItem *item in menuItems)
-    {
-        if (item.tag != -1)
-        {
-            [presetsMenu removeItem:item];
-        }
-    }
-    [menuItems release];
-
-    __block NSUInteger i = 0;
-    __block BOOL builtInEnded = NO;
-    [presetManager.root enumerateObjectsUsingBlock:^(id obj, NSIndexPath *idx, BOOL *stop)
-    {
-        if (idx.length)
-        {
-            NSMenuItem *item = [[NSMenuItem alloc] init];
-            item.title = [obj name];
-            item.tag = i++;
-
-            // Set an action only to the actual presets,
-            // not on the folders.
-            if ([obj isLeaf])
-            {
-                item.action = @selector(selectPresetFromMenu:);
-                item.representedObject = obj;
-            }
-            // Make the default preset font bold.
-            if ([obj isDefault])
-            {
-                NSAttributedString *newTitle = [[NSAttributedString alloc] initWithString:[obj name]
-                                                                               attributes:@{NSFontAttributeName: [NSFont boldSystemFontOfSize:14]}];
-                [item setAttributedTitle:newTitle];
-                [newTitle release];
-            }
-            // Add a separator line after the last builtIn preset
-            if ([obj isBuiltIn] == NO && builtInEnded == NO)
-            {
-                [presetsMenu addItem:[NSMenuItem separatorItem]];
-                builtInEnded = YES;
-            }
-
-            item.indentationLevel = idx.length - 1;
-
-            [presetsMenu addItem:item];
-            [item release];
-        }
-    }];
-}
-
-/**
- * We use this method to recreate new, updated factory presets
- */
-- (IBAction)addFactoryPresets:(id)sender
-{
-    [presetManager generateBuiltInPresets];
-}
-
 @end
index 5675c4a5649320b10eb1327aef46bb58ae7239d9..112c27a1f8d49a145ceb77cc9901066db4398c86 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="6724" systemVersion="14C99d" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="6724" systemVersion="14C106a" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
     <dependencies>
         <deployment version="1060" identifier="macosx"/>
         <development version="5100" identifier="xcode"/>
     <objects>
         <customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
             <connections>
-                <outlet property="delegate" destination="240" id="247"/>
+                <outlet property="delegate" destination="6lr-Yy-GMc" id="XE4-FY-xSp"/>
             </connections>
         </customObject>
         <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
         <customObject id="-3" userLabel="Application" customClass="NSObject"/>
-        <window title="HandBrake" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" frameAutosaveName="HBMainWindow" animationBehavior="default" id="21" userLabel="MainWindow">
-            <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" unifiedTitleAndToolbar="YES"/>
-            <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
-            <rect key="contentRect" x="41" y="572" width="946" height="568"/>
-            <rect key="screenRect" x="0.0" y="0.0" width="1920" height="1178"/>
-            <value key="minSize" type="size" width="946" height="568"/>
-            <value key="maxSize" type="size" width="1600" height="568"/>
-            <view key="contentView" id="2">
-                <rect key="frame" x="0.0" y="0.0" width="946" height="568"/>
-                <autoresizingMask key="autoresizingMask"/>
-                <subviews>
-                    <textField verticalHuggingPriority="750" id="1123">
-                        <rect key="frame" x="18" y="2" width="711" height="28"/>
-                        <autoresizingMask key="autoresizingMask" flexibleMinY="YES"/>
-                        <textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" alignment="left" id="4846">
-                            <font key="font" metaFont="smallSystem"/>
-                            <string key="title">DO NOT TRANSLATE THIS NIB FILE,
-</string>
-                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
-                            <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
-                        </textFieldCell>
-                    </textField>
-                    <progressIndicator verticalHuggingPriority="750" maxValue="100" bezeled="NO" style="bar" id="1373">
-                        <rect key="frame" x="18" y="-26" width="910" height="20"/>
-                        <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
-                    </progressIndicator>
-                    <tabView controlSize="small" initialItem="1477" id="1474">
-                        <rect key="frame" x="13" y="27" width="920" height="357"/>
-                        <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
-                        <tabViewItems>
-                            <tabViewItem label="Video" identifier="1" id="1477">
-                                <view key="view" id="1478">
-                                    <rect key="frame" x="10" y="29" width="900" height="315"/>
-                                    <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
-                                </view>
-                            </tabViewItem>
-                            <tabViewItem label="Audio" identifier="2" id="1475">
-                                <view key="view" id="1476">
-                                    <rect key="frame" x="10" y="25" width="900" height="319"/>
-                                    <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
-                                </view>
-                            </tabViewItem>
-                            <tabViewItem label="Subtitles" identifier="3" id="5194">
-                                <view key="view" id="5195">
-                                    <rect key="frame" x="10" y="25" width="900" height="319"/>
-                                    <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
-                                </view>
-                            </tabViewItem>
-                            <tabViewItem label="Advanced" identifier="5" id="2015">
-                                <view key="view" id="2016">
-                                    <rect key="frame" x="10" y="25" width="900" height="319"/>
-                                    <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
-                                </view>
-                            </tabViewItem>
-                            <tabViewItem label="Chapters" identifier="4" id="1989">
-                                <view key="view" id="1990">
-                                    <rect key="frame" x="10" y="25" width="900" height="319"/>
-                                    <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
-                                </view>
-                            </tabViewItem>
-                        </tabViewItems>
-                    </tabView>
-                    <textField verticalHuggingPriority="750" id="1538">
-                        <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="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"/>
-                        </textFieldCell>
-                    </textField>
-                    <textField verticalHuggingPriority="750" id="1540">
-                        <rect key="frame" x="17" y="511" width="35" height="14"/>
-                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
-                        <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Title:" id="4907">
-                            <font key="font" metaFont="smallSystem"/>
-                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
-                            <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
-                        </textFieldCell>
-                        <connections>
-                            <binding destination="240" name="textColor" keyPath="self.labelColor" id="hQD-eK-scB"/>
-                        </connections>
-                    </textField>
-                    <popUpButton verticalHuggingPriority="750" id="1541">
-                        <rect key="frame" x="53" y="506" width="312" height="22"/>
-                        <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
-                        <popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" controlSize="small" lineBreakMode="clipping" state="on" borderStyle="borderAndBezel" inset="2" arrowPosition="arrowAtCenter" preferredEdge="maxY" selectedItem="1543" id="4908">
-                            <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
-                            <font key="font" metaFont="smallSystem"/>
-                            <menu key="menu" title="OtherViews" id="1542">
-                                <items>
-                                    <menuItem state="on" id="1543"/>
-                                </items>
-                            </menu>
-                        </popUpButtonCell>
-                        <accessibility description="Title"/>
-                        <connections>
-                            <action selector="titlePopUpChanged:" target="240" id="1567"/>
-                            <binding destination="240" name="enabled" keyPath="self.job" id="qhW-2r-Dyu">
-                                <dictionary key="options">
-                                    <string key="NSValueTransformerName">NSIsNotNil</string>
-                                </dictionary>
-                            </binding>
-                        </connections>
-                    </popUpButton>
-                    <popUpButton verticalHuggingPriority="750" id="5513">
-                        <rect key="frame" x="492" y="506" width="84" height="22"/>
-                        <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
-                        <popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" controlSize="small" lineBreakMode="clipping" borderStyle="borderAndBezel" inset="2" arrowPosition="arrowAtCenter" preferredEdge="maxY" id="5514">
-                            <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
-                            <font key="font" metaFont="smallSystem"/>
-                            <menu key="menu" title="OtherViews" id="5515"/>
-                        </popUpButtonCell>
-                        <connections>
-                            <binding destination="240" name="enabled" keyPath="self.job" id="0hv-wd-DYQ">
-                                <dictionary key="options">
-                                    <string key="NSValueTransformerName">NSIsNotNil</string>
-                                </dictionary>
-                            </binding>
-                            <binding destination="240" name="selectedIndex" keyPath="self.job.range.type" previousBinding="nr8-sN-wpW" id="eJw-0h-DAa"/>
-                            <binding destination="240" name="content" keyPath="self.job.range.types" id="nr8-sN-wpW"/>
-                        </connections>
-                    </popUpButton>
-                    <textField verticalHuggingPriority="750" id="5180">
-                        <rect key="frame" x="390" y="511" width="46" height="14"/>
-                        <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
-                        <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Angle:" id="5185">
-                            <font key="font" metaFont="smallSystem"/>
-                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
-                            <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
-                        </textFieldCell>
-                        <connections>
-                            <binding destination="240" name="textColor" keyPath="self.labelColor" id="04p-bK-jZu"/>
-                            <binding destination="5676" name="hidden" keyPath="values.UseDvdNav" id="GhV-lP-BWw">
-                                <dictionary key="options">
-                                    <string key="NSValueTransformerName">NSNegateBoolean</string>
-                                </dictionary>
-                            </binding>
-                        </connections>
-                    </textField>
-                    <popUpButton verticalHuggingPriority="750" id="5181">
-                        <rect key="frame" x="436" y="506" width="44" height="22"/>
-                        <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
-                        <popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" controlSize="small" lineBreakMode="clipping" state="on" borderStyle="borderAndBezel" inset="2" arrowPosition="arrowAtCenter" preferredEdge="maxY" selectedItem="5184" id="5182">
-                            <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
-                            <font key="font" metaFont="smallSystem"/>
-                            <menu key="menu" title="OtherViews" id="5183">
-                                <items>
-                                    <menuItem state="on" id="5184"/>
-                                </items>
-                            </menu>
-                        </popUpButtonCell>
-                        <accessibility description="Angle"/>
-                        <connections>
-                            <binding destination="240" name="enabled" keyPath="self.job" id="E6D-8s-CYK">
-                                <dictionary key="options">
-                                    <string key="NSValueTransformerName">NSIsNotNil</string>
-                                </dictionary>
-                            </binding>
-                            <binding destination="240" name="content" keyPath="self.job.angles" id="oFZ-d6-aeJ"/>
-                            <binding destination="5676" name="hidden" keyPath="values.UseDvdNav" previousBinding="E6D-8s-CYK" id="U04-3Y-Z7d">
-                                <dictionary key="options">
-                                    <string key="NSValueTransformerName">NSNegateBoolean</string>
-                                </dictionary>
-                            </binding>
-                        </connections>
-                    </popUpButton>
-                    <textField verticalHuggingPriority="750" id="1552">
-                        <rect key="frame" x="5" y="454" width="47" height="17"/>
-                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
-                        <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="File:" id="4913">
-                            <font key="font" metaFont="smallSystem"/>
-                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
-                            <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
-                        </textFieldCell>
-                        <connections>
-                            <binding destination="240" name="textColor" keyPath="self.labelColor" id="qTW-e6-NIe"/>
-                        </connections>
-                    </textField>
-                    <textField verticalHuggingPriority="750" id="1553">
-                        <rect key="frame" x="764" y="511" width="65" height="14"/>
-                        <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
-                        <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Duration:" id="4914">
-                            <font key="font" metaFont="smallSystem"/>
-                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
-                            <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
-                        </textFieldCell>
-                        <connections>
-                            <binding destination="240" name="hidden" keyPath="self.job" id="1z1-WP-lXF">
-                                <dictionary key="options">
-                                    <string key="NSValueTransformerName">NSIsNil</string>
-                                </dictionary>
-                            </binding>
-                        </connections>
-                    </textField>
-                    <textField verticalHuggingPriority="750" id="1554">
-                        <rect key="frame" x="829" y="511" width="99" height="14"/>
-                        <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
-                        <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="left" title="00:00:00" id="4915">
-                            <font key="font" metaFont="smallSystem"/>
-                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
-                            <color key="backgroundColor" red="0.76630436999999996" green="0.0" blue="0.0" alpha="0.0" colorSpace="calibratedRGB"/>
-                        </textFieldCell>
-                        <connections>
-                            <binding destination="240" name="hidden" keyPath="self.job" id="Xf7-IA-bzp">
-                                <dictionary key="options">
-                                    <string key="NSValueTransformerName">NSIsNil</string>
-                                </dictionary>
-                            </binding>
-                            <binding destination="240" name="value" keyPath="self.job.range.duration" id="D3F-S5-u15"/>
-                        </connections>
-                    </textField>
-                    <textField verticalHuggingPriority="750" id="1555">
-                        <rect key="frame" x="20" y="486" width="70" height="14"/>
-                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
-                        <textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" alignment="left" title="Destination" id="4916">
-                            <font key="font" metaFont="smallSystemBold"/>
-                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
-                            <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
-                        </textFieldCell>
-                    </textField>
-                    <popUpButton verticalHuggingPriority="750" id="1557">
-                        <rect key="frame" x="76" y="398" width="177" height="22"/>
-                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
-                        <popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" controlSize="small" lineBreakMode="clipping" state="on" borderStyle="borderAndBezel" inset="2" arrowPosition="arrowAtCenter" preferredEdge="maxY" selectedItem="1559" id="4918">
-                            <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
-                            <font key="font" metaFont="smallSystem"/>
-                            <menu key="menu" title="OtherViews" id="1558">
-                                <items>
-                                    <menuItem state="on" id="1559"/>
-                                </items>
-                            </menu>
-                        </popUpButtonCell>
-                        <accessibility description="Format"/>
-                        <connections>
-                            <binding destination="240" name="enabled" keyPath="self.job" id="rkV-UW-k5X">
-                                <dictionary key="options">
-                                    <string key="NSValueTransformerName">NSIsNotNil</string>
-                                </dictionary>
-                            </binding>
-                            <binding destination="240" name="selectedValue" keyPath="self.job.container" previousBinding="7Po-AA-KsM" id="brh-Ek-It1">
-                                <dictionary key="options">
-                                    <string key="NSValueTransformerName">HBContainerTransformer</string>
-                                </dictionary>
-                            </binding>
-                            <binding destination="240" name="content" keyPath="self.job.containers" id="7Po-AA-KsM"/>
-                        </connections>
-                    </popUpButton>
-                    <button verticalHuggingPriority="750" id="1562">
-                        <rect key="frame" x="841" y="450" width="90" height="28"/>
-                        <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
-                        <buttonCell key="cell" type="push" title="Browse…" bezelStyle="rounded" alignment="center" controlSize="small" borderStyle="border" inset="2" id="4920">
-                            <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
-                            <font key="font" metaFont="smallSystem"/>
-                        </buttonCell>
-                        <connections>
-                            <action selector="browseFile:" target="240" id="1579"/>
-                            <binding destination="240" name="enabled" keyPath="self.job" id="MHg-yi-1ag">
-                                <dictionary key="options">
-                                    <string key="NSValueTransformerName">NSIsNotNil</string>
-                                </dictionary>
-                            </binding>
-                        </connections>
-                    </button>
-                    <box verticalHuggingPriority="750" title="Box" boxType="separator" titlePosition="noTitle" id="1623">
-                        <rect key="frame" x="98" y="490" width="828" height="5"/>
-                        <autoresizingMask key="autoresizingMask" widthSizable="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="1539">
-                        <rect key="frame" x="70" y="540" width="310" height="14.000000042040593"/>
-                        <autoresizingMask key="autoresizingMask" flexibleMinY="YES" heightSizable="YES"/>
-                        <textFieldCell key="cell" controlSize="small" lineBreakMode="truncatingMiddle" selectable="YES" sendsActionOnEndEditing="YES" alignment="left" id="4906">
-                            <font key="font" metaFont="smallSystem"/>
-                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
-                            <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
-                        </textFieldCell>
-                    </textField>
-                    <textField verticalHuggingPriority="750" id="1561">
-                        <rect key="frame" x="56" y="455" width="782" height="19"/>
-                        <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
-                        <textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" continuous="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="left" drawsBackground="YES" id="4919">
-                            <font key="font" metaFont="smallSystem"/>
-                            <color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
-                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
-                        </textFieldCell>
-                        <connections>
-                            <binding destination="240" name="enabled" keyPath="self.job" id="13e-O9-Pfx">
-                                <dictionary key="options">
-                                    <string key="NSValueTransformerName">NSIsNotNil</string>
-                                </dictionary>
-                            </binding>
-                            <binding destination="240" name="value" keyPath="self.job.destURL" id="Vmi-3b-LD5">
-                                <dictionary key="options">
-                                    <bool key="NSContinuouslyUpdatesValue" value="YES"/>
-                                    <string key="NSValueTransformerName">HBURLTransformer</string>
-                                </dictionary>
-                            </binding>
-                        </connections>
-                    </textField>
-                    <textField hidden="YES" verticalHuggingPriority="750" id="5491">
-                        <rect key="frame" x="581" y="492" width="54" height="19"/>
-                        <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
-                        <textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="right" drawsBackground="YES" id="5492">
-                            <numberFormatter key="formatter" formatterBehavior="default10_4" usesGroupingSeparator="NO" minimumIntegerDigits="0" maximumIntegerDigits="42" id="Fdv-uE-tUA">
-                                <real key="minimum" value="0.0"/>
-                            </numberFormatter>
-                            <font key="font" metaFont="smallSystem"/>
-                            <color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
-                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
-                        </textFieldCell>
-                        <connections>
-                            <binding destination="240" name="hidden" keyPath="self.job.range.secondsSelected" id="VlL-Hz-ZR5">
-                                <dictionary key="options">
-                                    <string key="NSValueTransformerName">NSNegateBoolean</string>
-                                </dictionary>
-                            </binding>
-                            <binding destination="240" name="value" keyPath="self.job.range.secondsStart" id="oC5-nl-aJ3">
-                                <dictionary key="options">
-                                    <bool key="NSContinuouslyUpdatesValue" value="YES"/>
-                                    <bool key="NSValidatesImmediately" value="YES"/>
-                                </dictionary>
-                            </binding>
-                        </connections>
-                    </textField>
-                    <textField hidden="YES" verticalHuggingPriority="750" id="5521">
-                        <rect key="frame" x="638" y="492" width="54" height="19"/>
-                        <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
-                        <textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="right" drawsBackground="YES" id="5522">
-                            <numberFormatter key="formatter" formatterBehavior="default10_4" usesGroupingSeparator="NO" minimumIntegerDigits="0" maximumIntegerDigits="42" id="Wpt-92-R1O">
-                                <real key="minimum" value="0.0"/>
-                            </numberFormatter>
-                            <font key="font" metaFont="smallSystem"/>
-                            <color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
-                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
-                        </textFieldCell>
-                        <connections>
-                            <binding destination="240" name="hidden" keyPath="self.job.range.framesSelected" id="nnF-AN-v4Q">
-                                <dictionary key="options">
-                                    <string key="NSValueTransformerName">NSNegateBoolean</string>
-                                </dictionary>
-                            </binding>
-                            <binding destination="240" name="value" keyPath="self.job.range.frameStart" id="xEY-Wf-hxo">
-                                <dictionary key="options">
-                                    <bool key="NSContinuouslyUpdatesValue" value="YES"/>
-                                    <bool key="NSValidatesImmediately" value="YES"/>
-                                </dictionary>
-                            </binding>
-                        </connections>
-                    </textField>
-                    <textField hidden="YES" verticalHuggingPriority="750" id="5493">
-                        <rect key="frame" x="696" y="492" width="54" height="19"/>
-                        <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
-                        <textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="left" drawsBackground="YES" id="5494">
-                            <numberFormatter key="formatter" formatterBehavior="default10_4" usesGroupingSeparator="NO" minimumIntegerDigits="0" maximumIntegerDigits="42" id="tD5-HN-B7h">
-                                <real key="minimum" value="0.0"/>
-                            </numberFormatter>
-                            <font key="font" metaFont="smallSystem"/>
-                            <color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
-                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
-                        </textFieldCell>
-                        <connections>
-                            <binding destination="240" name="hidden" keyPath="self.job.range.secondsSelected" id="Qmg-D1-0rm">
-                                <dictionary key="options">
-                                    <string key="NSValueTransformerName">NSNegateBoolean</string>
-                                </dictionary>
-                            </binding>
-                            <binding destination="240" name="value" keyPath="self.job.range.secondsStop" id="yhq-KM-3Fs">
-                                <dictionary key="options">
-                                    <bool key="NSContinuouslyUpdatesValue" value="YES"/>
-                                    <bool key="NSValidatesImmediately" value="YES"/>
-                                </dictionary>
-                            </binding>
-                        </connections>
-                    </textField>
-                    <textField hidden="YES" verticalHuggingPriority="750" id="5523">
-                        <rect key="frame" x="758" y="492" width="54" height="19"/>
-                        <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
-                        <textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="left" drawsBackground="YES" id="5524">
-                            <numberFormatter key="formatter" formatterBehavior="default10_4" usesGroupingSeparator="NO" minimumIntegerDigits="0" maximumIntegerDigits="42" id="WrK-kN-ZN0">
-                                <real key="minimum" value="0.0"/>
-                            </numberFormatter>
-                            <font key="font" metaFont="smallSystem"/>
-                            <color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
-                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
-                        </textFieldCell>
-                        <connections>
-                            <binding destination="240" name="hidden" keyPath="self.job.range.framesSelected" id="P5u-F3-Qyx">
-                                <dictionary key="options">
-                                    <string key="NSValueTransformerName">NSNegateBoolean</string>
-                                </dictionary>
-                            </binding>
-                            <binding destination="240" name="value" keyPath="self.job.range.frameStop" id="JVa-Qr-2DQ">
-                                <dictionary key="options">
-                                    <bool key="NSContinuouslyUpdatesValue" value="YES"/>
-                                    <bool key="NSValidatesImmediately" value="YES"/>
-                                </dictionary>
-                            </binding>
-                        </connections>
-                    </textField>
-                    <textField verticalHuggingPriority="750" id="1627">
-                        <rect key="frame" x="20" y="430" width="97" height="14"/>
-                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
-                        <textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" alignment="left" title="Output Settings:" id="4923">
-                            <font key="font" metaFont="smallSystemBold"/>
-                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
-                            <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
-                        </textFieldCell>
-                    </textField>
-                    <box verticalHuggingPriority="750" title="Box" boxType="separator" titlePosition="noTitle" id="1628">
-                        <rect key="frame" x="292" y="434" width="634" height="5"/>
-                        <autoresizingMask key="autoresizingMask" widthSizable="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="1882">
-                        <rect key="frame" x="121" y="430" width="165" height="14"/>
-                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
-                        <textFieldCell key="cell" sendsActionOnEndEditing="YES" id="4924">
-                            <font key="font" metaFont="smallSystemBold"/>
-                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
-                            <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
-                        </textFieldCell>
-                        <connections>
-                            <binding destination="240" name="value" keyPath="self.job.presetName" id="R4b-YQ-IeI"/>
-                        </connections>
-                    </textField>
-                    <textField verticalHuggingPriority="750" id="2006">
-                        <rect key="frame" x="711" y="15" width="218" height="14"/>
-                        <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
-                        <textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" alignment="right" id="4925">
-                            <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="1556">
-                        <rect key="frame" x="21" y="403" width="53" height="14"/>
-                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
-                        <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Format:" id="4917">
-                            <font key="font" metaFont="smallSystem"/>
-                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
-                            <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
-                        </textFieldCell>
-                        <connections>
-                            <binding destination="240" name="textColor" keyPath="self.labelColor" id="Esr-ae-0fm"/>
-                        </connections>
-                    </textField>
-                    <box verticalHuggingPriority="750" title="Box" boxType="separator" titlePosition="noTitle" id="3205">
-                        <rect key="frame" x="386" y="543" width="540" height="5"/>
-                        <autoresizingMask key="autoresizingMask" flexibleMinX="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>
-                    <progressIndicator hidden="YES" verticalHuggingPriority="750" maxValue="100" bezeled="NO" controlSize="small" style="bar" id="3203">
-                        <rect key="frame" x="386" y="542.0000000420406" width="541" height="12"/>
-                        <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
-                    </progressIndicator>
-                    <button toolTip="This rearranges the header of the MP4 file to optimize it for streaming across the web." id="4579">
-                        <rect key="frame" x="269" y="401" width="102" height="18"/>
-                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
-                        <buttonCell key="cell" type="check" title="Web optimized" bezelStyle="regularSquare" imagePosition="left" alignment="left" controlSize="small" inset="2" id="4927">
-                            <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
-                            <font key="font" metaFont="smallSystem"/>
-                        </buttonCell>
-                        <connections>
-                            <binding destination="240" name="value" keyPath="self.job.mp4HttpOptimize" id="b1e-md-dT3"/>
-                            <binding destination="240" name="hidden" keyPath="self.job.mp4OptionsEnabled" id="D27-Mk-6hO">
-                                <dictionary key="options">
-                                    <string key="NSValueTransformerName">NSNegateBoolean</string>
-                                </dictionary>
-                            </binding>
-                        </connections>
-                    </button>
-                    <button toolTip="This option adds an atom to the MP4 file which allows older iPods (5th Generation classic style) to play the file." id="4967">
-                        <rect key="frame" x="388" y="401" width="108" height="18"/>
-                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
-                        <buttonCell key="cell" type="check" title="iPod 5G support" bezelStyle="regularSquare" imagePosition="left" alignment="left" controlSize="small" inset="2" id="4968">
-                            <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
-                            <font key="font" metaFont="smallSystem"/>
-                        </buttonCell>
-                        <connections>
-                            <binding destination="240" name="value" keyPath="self.job.mp4iPodCompatible" id="GWA-QG-Bfu"/>
-                            <binding destination="240" name="hidden" keyPath="self.job.mp4iPodCompatibleEnabled" id="eGS-R2-zSV">
-                                <dictionary key="options">
-                                    <string key="NSValueTransformerName">NSNegateBoolean</string>
-                                </dictionary>
-                            </binding>
-                        </connections>
-                    </button>
-                    <textField verticalHuggingPriority="750" id="5505">
-                        <rect key="frame" x="637" y="510" width="56" height="15"/>
-                        <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
-                        <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="center" title="through" id="5506">
-                            <font key="font" metaFont="smallSystem"/>
-                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
-                            <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
-                        </textFieldCell>
-                        <connections>
-                            <binding destination="240" name="hidden" keyPath="self.job" id="6TJ-gX-20A">
-                                <dictionary key="options">
-                                    <string key="NSValueTransformerName">NSIsNil</string>
-                                </dictionary>
-                            </binding>
-                        </connections>
-                    </textField>
-                    <popUpButton verticalHuggingPriority="750" id="1545">
-                        <rect key="frame" x="578" y="506" width="60" height="22"/>
-                        <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
-                        <popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" controlSize="small" lineBreakMode="clipping" state="on" borderStyle="borderAndBezel" inset="2" arrowPosition="arrowAtCenter" preferredEdge="maxY" selectedItem="1547" id="4910">
-                            <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
-                            <font key="font" metaFont="smallSystem"/>
-                            <menu key="menu" title="OtherViews" id="1546">
-                                <items>
-                                    <menuItem state="on" id="1547"/>
-                                </items>
-                            </menu>
-                        </popUpButtonCell>
-                        <accessibility description="Start Chapter"/>
-                        <connections>
-                            <binding destination="240" name="selectedIndex" keyPath="self.job.range.chapterStart" previousBinding="6kP-TS-bEc" id="U76-2W-TvD"/>
-                            <binding destination="240" name="content" keyPath="self.job.range.chapters" id="6kP-TS-bEc"/>
-                            <binding destination="240" name="hidden" keyPath="self.job.range.chaptersSelected" id="fix-9c-5P3">
-                                <dictionary key="options">
-                                    <string key="NSValueTransformerName">NSNegateBoolean</string>
-                                </dictionary>
-                            </binding>
-                        </connections>
-                    </popUpButton>
-                    <popUpButton verticalHuggingPriority="750" id="1548">
-                        <rect key="frame" x="693" y="506" width="60" height="22"/>
-                        <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
-                        <popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" controlSize="small" lineBreakMode="clipping" state="on" borderStyle="borderAndBezel" inset="2" arrowPosition="arrowAtCenter" preferredEdge="maxY" selectedItem="1550" id="4911">
-                            <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
-                            <font key="font" metaFont="smallSystem"/>
-                            <menu key="menu" title="OtherViews" id="1549">
-                                <items>
-                                    <menuItem state="on" id="1550"/>
-                                </items>
-                            </menu>
-                        </popUpButtonCell>
-                        <accessibility description="End Chapter"/>
-                        <connections>
-                            <binding destination="240" name="selectedIndex" keyPath="self.job.range.chapterStop" previousBinding="Yqp-Sg-lBf" id="4k2-Sm-RoJ"/>
-                            <binding destination="240" name="content" keyPath="self.job.range.chapters" id="Yqp-Sg-lBf"/>
-                            <binding destination="240" name="hidden" keyPath="self.job.range.chaptersSelected" id="PxP-LY-ZXR">
-                                <dictionary key="options">
-                                    <string key="NSValueTransformerName">NSNegateBoolean</string>
-                                </dictionary>
-                            </binding>
-                        </connections>
-                    </popUpButton>
-                </subviews>
-            </view>
-            <toolbar key="toolbar" implicitIdentifier="E92CA47A-01F7-432A-A61C-28FE4D58C2CD" autosavesConfiguration="NO" displayMode="iconAndLabel" sizeMode="regular" id="7g3-gy-bUl">
-                <allowedToolbarItems>
-                    <toolbarItem implicitItemIdentifier="NSToolbarSpaceItem" id="ZEH-cS-zXY"/>
-                    <toolbarItem implicitItemIdentifier="NSToolbarFlexibleSpaceItem" id="wjB-Tl-5qq"/>
-                    <toolbarItem implicitItemIdentifier="B3BAB305-77BF-4967-B8E6-D11F40EF822B" label="Source" paletteLabel="Source" toolTip="Choose Video Source" tag="-1" image="source" id="8r8-nZ-dYs">
-                        <connections>
-                            <action selector="browseSources:" target="240" id="LD2-b1-vqJ"/>
-                        </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">
-                        <connections>
-                            <action selector="rip:" target="240" id="0Db-56-2aY"/>
-                        </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">
-                        <connections>
-                            <action selector="pause:" target="240" id="OjT-ck-YX1"/>
-                        </connections>
-                    </toolbarItem>
-                    <toolbarItem implicitItemIdentifier="69E83092-D0D1-48A5-BF46-99EFB3EC630A" label="Add To Queue" paletteLabel="Add To Queue" tag="-1" image="addqueue" id="DZZ-Fe-wjw">
-                        <connections>
-                            <action selector="addToQueue:" target="240" id="3oq-nG-Sdo"/>
-                        </connections>
-                    </toolbarItem>
-                    <toolbarItem implicitItemIdentifier="6EFCA879-A80D-45D7-A846-EAD85261F864" label="Show Queue" paletteLabel="Show Queue" tag="-1" image="showqueue" id="HCx-ku-nF7">
-                        <connections>
-                            <action selector="showQueueWindow:" target="240" id="Rur-8T-VEx"/>
-                        </connections>
-                    </toolbarItem>
-                    <toolbarItem implicitItemIdentifier="CBA63584-4A4E-43E5-8096-9C20B59AC580" label="Picture Settings" paletteLabel="Show Picture Settings" toolTip="Show Picture Settings" tag="-1" image="picturesettings" id="2uP-T2-02Q">
-                        <connections>
-                            <action selector="showPicturePanel:" target="240" id="tlM-Jx-yzk"/>
-                        </connections>
-                    </toolbarItem>
-                    <toolbarItem implicitItemIdentifier="DAAC2346-2B39-4A35-A62B-C12826F6AB42" label="Preview Window" paletteLabel="Show Preview Window" toolTip="Show Preview Window" tag="-1" image="preview" id="dK4-jt-v4K">
-                        <connections>
-                            <action selector="showPreviewWindow:" target="240" id="C49-TV-CDw"/>
-                        </connections>
-                    </toolbarItem>
-                    <toolbarItem implicitItemIdentifier="D9753B5B-F09B-451E-9FD8-E8DD979FBFA2" label="Activity Window" paletteLabel="Show Activity Window" toolTip="Show Activity Window" tag="-1" image="activity" id="p7Q-L3-zcW">
-                        <connections>
-                            <action selector="showDebugOutputPanel:" target="240" id="TTZ-YA-vgx"/>
-                        </connections>
-                    </toolbarItem>
-                    <toolbarItem implicitItemIdentifier="B774D9D7-AE89-4C1A-8685-D631473867F6" label="Toggle Presets" paletteLabel="Toggle Presets" toolTip="Open/Close Preset Drawer" tag="-1" image="presets" id="9ll-Jg-YAB">
-                        <connections>
-                            <action selector="toggleDrawer:" target="240" id="gY0-Xe-pxb"/>
-                        </connections>
-                    </toolbarItem>
-                </allowedToolbarItems>
-                <defaultToolbarItems>
-                    <toolbarItem reference="8r8-nZ-dYs"/>
-                    <toolbarItem reference="byg-kj-sEM"/>
-                    <toolbarItem reference="wTQ-KF-5KW"/>
-                    <toolbarItem reference="DZZ-Fe-wjw"/>
-                    <toolbarItem reference="HCx-ku-nF7"/>
-                    <toolbarItem reference="wjB-Tl-5qq"/>
-                    <toolbarItem reference="2uP-T2-02Q"/>
-                    <toolbarItem reference="dK4-jt-v4K"/>
-                    <toolbarItem reference="p7Q-L3-zcW"/>
-                    <toolbarItem reference="9ll-Jg-YAB"/>
-                </defaultToolbarItems>
-            </toolbar>
-            <connections>
-                <outlet property="delegate" destination="240" id="433"/>
-            </connections>
-            <point key="canvasLocation" x="842" y="531"/>
-        </window>
         <menu title="MainMenu" systemMenu="main" id="29" userLabel="MainMenu">
             <items>
                 <menuItem title="HandBrake" id="56">
                             </menuItem>
                             <menuItem title="Preferences…" keyEquivalent="," id="1445">
                                 <connections>
-                                    <action selector="showPreferencesWindow:" target="240" id="2517"/>
+                                    <action selector="showPreferencesWindow:" target="6lr-Yy-GMc" id="ORc-bQ-Pdo"/>
                                 </connections>
                             </menuItem>
                             <menuItem isSeparatorItem="YES" id="bDt-OE-wyf">
                         <items>
                             <menuItem title="Open Source…" keyEquivalent="o" id="1198">
                                 <connections>
-                                    <action selector="browseSources:" target="240" id="2718"/>
-                                </connections>
-                            </menuItem>
-                            <menuItem title="Open Source (Title Specific)…" id="2698">
-                                <connections>
-                                    <action selector="browseSources:" target="240" id="2717"/>
+                                    <action selector="browseSources:" target="-1" id="9Ko-Me-Xae"/>
                                 </connections>
                             </menuItem>
                             <menuItem isSeparatorItem="YES" id="2507">
                             </menuItem>
                             <menuItem title="Add To Queue" keyEquivalent="b" id="2443">
                                 <connections>
-                                    <action selector="addToQueue:" target="240" id="2447"/>
+                                    <action selector="addToQueue:" target="-1" id="9mH-2S-tBG"/>
                                 </connections>
                             </menuItem>
                             <menuItem title="Add All Titles To Queue…" keyEquivalent="B" id="5897">
                                 <connections>
-                                    <action selector="addAllTitlesToQueue:" target="240" id="5899"/>
+                                    <action selector="addAllTitlesToQueue:" target="-1" id="EyT-yw-TMf"/>
                                 </connections>
                             </menuItem>
                             <menuItem isSeparatorItem="YES" id="Kee-pg-bfk">
                             </menuItem>
                             <menuItem title="Start Encoding" keyEquivalent="s" id="2444">
                                 <connections>
-                                    <action selector="rip:" target="240" id="kGM-Ym-khx"/>
+                                    <action selector="rip:" target="-1" id="gca-l6-qac"/>
                                 </connections>
                             </menuItem>
                             <menuItem title="Pause Encoding" keyEquivalent="p" id="2494">
                                 <connections>
-                                    <action selector="pause:" target="240" id="RAM-7s-91U"/>
+                                    <action selector="pause:" target="-1" id="tq4-oz-OV9"/>
                                 </connections>
                             </menuItem>
                         </items>
                         <items>
                             <menuItem title="New Preset…" tag="-1" keyEquivalent="n" id="1955">
                                 <connections>
-                                    <action selector="showAddPresetPanel:" target="-1" id="iWH-6U-rv2"/>
+                                    <action selector="showAddPresetPanel:" target="-1" id="83j-3C-fCg"/>
                                 </connections>
                             </menuItem>
                             <menuItem title="New Folder" tag="-1" keyEquivalent="N" id="wvb-60-cWL">
                             </menuItem>
                             <menuItem title="Select Default Preset" tag="-1" id="2421">
                                 <connections>
-                                    <action selector="selectDefaultPreset:" target="240" id="2422"/>
+                                    <action selector="selectDefaultPreset:" target="-1" id="2eH-zk-T3n"/>
                                 </connections>
                             </menuItem>
                             <menuItem isSeparatorItem="YES" tag="-1" id="CQW-qW-5C5">
                             <menuItem title="Import…" tag="-1" id="5192">
                                 <modifierMask key="keyEquivalentModifierMask"/>
                                 <connections>
-                                    <action selector="browseImportPresetFile:" target="240" id="5193"/>
+                                    <action selector="browseImportPresetFile:" target="-1" id="keX-1B-XYZ"/>
                                 </connections>
                             </menuItem>
                             <menuItem title="Export…" tag="-1" id="5188">
                                 <modifierMask key="keyEquivalentModifierMask"/>
                                 <connections>
-                                    <action selector="browseExportPresetFile:" target="240" id="5191"/>
+                                    <action selector="browseExportPresetFile:" target="-1" id="kJa-oi-hY2"/>
                                 </connections>
                             </menuItem>
                             <menuItem title="Update Built-in Presets" tag="-1" id="1950">
                                 <connections>
-                                    <action selector="addFactoryPresets:" target="240" id="1952"/>
+                                    <action selector="addFactoryPresets:" target="6lr-Yy-GMc" id="5Ga-rb-ORy"/>
                                 </connections>
                             </menuItem>
                             <menuItem isSeparatorItem="YES" tag="-1" id="wgI-bc-Ors">
                             </menuItem>
                             <menuItem title="HandBrake" keyEquivalent="1" id="2368">
                                 <connections>
-                                    <action selector="openMainWindow:" target="240" id="2369"/>
+                                    <action selector="showMainWindow:" target="6lr-Yy-GMc" id="jt4-Bl-0zq"/>
                                 </connections>
                             </menuItem>
                             <menuItem title="Queue" keyEquivalent="2" id="2445">
                                 <connections>
-                                    <action selector="showQueueWindow:" target="240" id="2446"/>
+                                    <action selector="showQueueWindow:" target="6lr-Yy-GMc" id="WFe-Tm-3XP"/>
                                 </connections>
                             </menuItem>
                             <menuItem isSeparatorItem="YES" id="2519">
                             </menuItem>
                             <menuItem title="Presets Drawer" keyEquivalent="t" id="1884">
                                 <connections>
-                                    <action selector="toggleDrawer:" target="240" id="5Yh-Cm-6ea"/>
+                                    <action selector="toggleDrawer:" target="-1" id="pVD-TD-4r1"/>
                                 </connections>
                             </menuItem>
                             <menuItem title="Picture Settings" keyEquivalent="P" id="2488">
                                 <connections>
-                                    <action selector="showPicturePanel:" target="240" id="2493"/>
+                                    <action selector="showPicturePanel:" target="-1" id="e5F-sb-9Jt"/>
                                 </connections>
                             </menuItem>
                             <menuItem title="Preview Window" id="5157">
                                 <modifierMask key="keyEquivalentModifierMask"/>
                                 <connections>
-                                    <action selector="showPreviewWindow:" target="240" id="5158"/>
+                                    <action selector="showPreviewWindow:" target="-1" id="b7R-uV-KeA"/>
                                 </connections>
                             </menuItem>
                             <menuItem title="Activity Window" keyEquivalent="D" id="2295">
                                 <connections>
-                                    <action selector="showDebugOutputPanel:" target="240" id="2296"/>
+                                    <action selector="showOutputPanel:" target="6lr-Yy-GMc" id="mEr-6M-u1q"/>
                                 </connections>
                             </menuItem>
                         </items>
                         <items>
                             <menuItem title="HandBrake User Guide" keyEquivalent="?" id="1985">
                                 <connections>
-                                    <action selector="openUserGuide:" target="240" id="1986"/>
+                                    <action selector="openUserGuide:" target="6lr-Yy-GMc" id="Fda-3E-7Ya"/>
                                 </connections>
                             </menuItem>
                             <menuItem title="HandBrake Homepage" id="1432">
                                 <connections>
-                                    <action selector="openHomepage:" target="240" id="1434"/>
+                                    <action selector="openHomepage:" target="6lr-Yy-GMc" id="KTB-6B-jIe"/>
                                 </connections>
                             </menuItem>
                             <menuItem title="HandBrake Forums" id="1433">
                                 <connections>
-                                    <action selector="openForums:" target="240" id="1435"/>
+                                    <action selector="openForums:" target="6lr-Yy-GMc" id="k9C-68-hJt"/>
                                 </connections>
                             </menuItem>
                         </items>
                 </menuItem>
             </items>
         </menu>
-        <drawer trailingOffset="15" id="1841" userLabel="PresetsDrawer">
-            <size key="contentSize" width="240" height="550"/>
-            <size key="minContentSize" width="100" height="50"/>
-            <size key="maxContentSize" width="280" height="550"/>
-            <connections>
-                <outlet property="parentWindow" destination="21" id="1842"/>
-            </connections>
-        </drawer>
-        <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"/>
-            <rect key="contentRect" x="302" y="989" width="392" height="144"/>
-            <rect key="screenRect" x="0.0" y="0.0" width="1920" height="1178"/>
-            <value key="minSize" type="size" width="213" height="107"/>
-            <view key="contentView" id="2702">
-                <rect key="frame" x="0.0" y="0.0" width="392" height="144"/>
-                <autoresizingMask key="autoresizingMask"/>
-                <subviews>
-                    <textField verticalHuggingPriority="750" id="2703">
-                        <rect key="frame" x="96" y="45" width="279" height="38"/>
-                        <autoresizingMask key="autoresizingMask"/>
-                        <textFieldCell key="cell" sendsActionOnEndEditing="YES" title="Source Path Here" id="4945">
-                            <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="2704">
-                        <rect key="frame" x="155" y="106" width="26" height="14"/>
-                        <autoresizingMask key="autoresizingMask"/>
-                        <textFieldCell key="cell" sendsActionOnEndEditing="YES" title="for" id="4946">
-                            <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="2705">
-                        <rect key="frame" x="17" y="106" width="104" height="15"/>
-                        <autoresizingMask key="autoresizingMask"/>
-                        <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Scan title number" id="4947">
-                            <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="2706">
-                        <rect key="frame" x="126" y="105" width="24" height="19"/>
-                        <autoresizingMask key="autoresizingMask"/>
-                        <textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="center" title="0" drawsBackground="YES" id="4948">
-                            <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>
-                    <button verticalHuggingPriority="750" id="2708">
-                        <rect key="frame" x="290" y="13" width="87" height="28"/>
-                        <autoresizingMask key="autoresizingMask"/>
-                        <buttonCell key="cell" type="push" title="Open Title" bezelStyle="rounded" alignment="center" controlSize="small" borderStyle="border" inset="2" id="4950">
-                            <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
-                            <font key="font" metaFont="smallSystem"/>
-                            <string key="keyEquivalent" base64-UTF8="YES">
-DQ
-</string>
-                        </buttonCell>
-                        <connections>
-                            <action selector="closeSourceTitleScanPanel:" target="240" id="2715"/>
-                        </connections>
-                    </button>
-                    <textField verticalHuggingPriority="750" id="2716">
-                        <rect key="frame" x="17" y="83" width="455" height="19"/>
-                        <autoresizingMask key="autoresizingMask"/>
-                        <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="left" title="Note: (entering 0 or leaving blank will result in a full source scan)" id="4951">
-                            <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="2719">
-                        <rect key="frame" x="17" y="69" width="77" height="14"/>
-                        <autoresizingMask key="autoresizingMask"/>
-                        <textFieldCell key="cell" sendsActionOnEndEditing="YES" title="Source Path:" id="4952">
-                            <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="2720">
-                        <rect key="frame" x="177" y="106" width="198" height="14"/>
-                        <autoresizingMask key="autoresizingMask"/>
-                        <textFieldCell key="cell" sendsActionOnEndEditing="YES" title="Small System Font Text" id="4953">
-                            <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 verticalHuggingPriority="750" id="2707">
-                        <rect key="frame" x="212" y="13" width="80" height="28"/>
-                        <autoresizingMask key="autoresizingMask"/>
-                        <buttonCell key="cell" type="push" title="Cancel" bezelStyle="rounded" alignment="center" controlSize="small" borderStyle="border" inset="2" id="4949">
-                            <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
-                            <font key="font" metaFont="smallSystem"/>
-                        </buttonCell>
-                        <connections>
-                            <action selector="closeSourceTitleScanPanel:" target="240" id="2714"/>
-                        </connections>
-                    </button>
-                </subviews>
-            </view>
-            <point key="canvasLocation" x="515" y="271"/>
-        </window>
-        <customObject id="240" userLabel="HBController" customClass="HBController">
+        <customObject id="4963" customClass="SUUpdater"/>
+        <customObject id="6lr-Yy-GMc" customClass="HBAppDelegate">
             <connections>
-                <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"/>
-                <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="fQueueStatus" destination="2006" id="2007"/>
-                <outlet property="fRipIndicator" destination="1373" id="1374"/>
-                <outlet property="fScanHorizontalLine" destination="3205" id="6004"/>
-                <outlet property="fScanIndicator" destination="3203" id="3204"/>
-                <outlet property="fScanSrcTitleCancelButton" destination="2707" id="2711"/>
-                <outlet property="fScanSrcTitleNumField" destination="2706" id="2710"/>
-                <outlet property="fScanSrcTitleOpenButton" destination="2708" id="2712"/>
-                <outlet property="fScanSrcTitlePanel" destination="2701" id="2713"/>
-                <outlet property="fScanSrcTitlePathField" destination="2703" id="2709"/>
-                <outlet property="fSrcChapterEndPopUp" destination="1548" id="1569"/>
-                <outlet property="fSrcChapterStartPopUp" destination="1545" id="1568"/>
-                <outlet property="fSrcDVD2Field" destination="1539" id="1591"/>
-                <outlet property="fSrcDsplyNameTitleScan" destination="2720" id="2721"/>
-                <outlet property="fSrcFrameEndEncodingField" destination="5523" id="5526"/>
-                <outlet property="fSrcFrameStartEncodingField" destination="5521" id="5525"/>
-                <outlet property="fSrcTimeEndEncodingField" destination="5493" id="5508"/>
-                <outlet property="fSrcTimeStartEncodingField" destination="5491" id="5507"/>
-                <outlet property="fSrcTitlePopUp" destination="1541" id="1593"/>
-                <outlet property="fStatusField" destination="1123" id="1238"/>
-                <outlet property="fSubtitlesTab" destination="5194" id="d9b-rJ-XrS"/>
-                <outlet property="fVideoTab" destination="1477" id="6o2-cM-yy4"/>
-                <outlet property="fWindow" destination="21" id="350"/>
-                <outlet property="presetsMenu" destination="1949" id="bkm-2h-uFI"/>
+                <outlet property="presetsMenu" destination="1949" id="7YL-mr-2tO"/>
             </connections>
         </customObject>
-        <customObject id="4963" customClass="SUUpdater"/>
         <userDefaultsController representsSharedInstance="YES" id="5676"/>
     </objects>
-    <resources>
-        <image name="activity" width="24" height="24"/>
-        <image name="addqueue" width="12" height="12"/>
-        <image name="encode" width="24" height="24"/>
-        <image name="pauseencode" width="24" height="24"/>
-        <image name="picturesettings" width="24" height="24"/>
-        <image name="presets" width="24" height="24"/>
-        <image name="preview" width="24" height="24"/>
-        <image name="showqueue" width="24" height="24"/>
-        <image name="source" width="24" height="24"/>
-    </resources>
 </document>
diff --git a/macosx/English.lproj/MainWindow.xib b/macosx/English.lproj/MainWindow.xib
new file mode 100644 (file)
index 0000000..1ecae02
--- /dev/null
@@ -0,0 +1,724 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="6724" systemVersion="14C106a" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
+    <dependencies>
+        <deployment version="1060" identifier="macosx"/>
+        <development version="5100" identifier="xcode"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="6724"/>
+    </dependencies>
+    <objects>
+        <customObject id="-2" userLabel="File's Owner" customClass="HBController">
+            <connections>
+                <outlet property="fAdvancedTab" destination="2015" id="8FF-6a-xSj"/>
+                <outlet property="fAudioTab" destination="1475" id="AJX-Da-Tfc"/>
+                <outlet property="fChaptersTitlesTab" destination="1989" id="df9-TK-GBD"/>
+                <outlet property="fMainTabView" destination="1474" id="sl5-BZ-ymC"/>
+                <outlet property="fPresetDrawer" destination="1841" id="LDc-Da-rl7"/>
+                <outlet property="fQueueStatus" destination="2006" id="o5x-Kd-lxv"/>
+                <outlet property="fRipIndicator" destination="1373" id="an5-ng-etT"/>
+                <outlet property="fScanHorizontalLine" destination="3205" id="W26-Wu-2YJ"/>
+                <outlet property="fScanIndicator" destination="3203" id="cG1-SY-gbt"/>
+                <outlet property="fSrcChapterEndPopUp" destination="1548" id="9V3-lu-BqX"/>
+                <outlet property="fSrcChapterStartPopUp" destination="1545" id="ZQk-wM-0mL"/>
+                <outlet property="fSrcDVD2Field" destination="1539" id="pxg-Wl-Mn7"/>
+                <outlet property="fSrcFrameEndEncodingField" destination="5523" id="0lZ-7S-OEo"/>
+                <outlet property="fSrcFrameStartEncodingField" destination="5521" id="iCh-Jo-pXi"/>
+                <outlet property="fSrcTimeEndEncodingField" destination="5493" id="QN5-jU-eed"/>
+                <outlet property="fSrcTimeStartEncodingField" destination="5491" id="2ln-oU-tgH"/>
+                <outlet property="fSrcTitlePopUp" destination="1541" id="glh-1k-i69"/>
+                <outlet property="fStatusField" destination="1123" id="mPD-cg-5dk"/>
+                <outlet property="fSubtitlesTab" destination="5194" id="PF0-qx-Iu4"/>
+                <outlet property="fVideoTab" destination="1477" id="hFY-kK-afW"/>
+                <outlet property="openTitleView" destination="lZQ-gl-3wX" id="Wh6-fB-pWi"/>
+                <outlet property="window" destination="21" id="qib-ZH-aNm"/>
+            </connections>
+        </customObject>
+        <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+        <customObject id="-3" userLabel="Application" customClass="NSObject"/>
+        <window title="HandBrake" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" frameAutosaveName="HBMainWindow" animationBehavior="default" id="21" userLabel="MainWindow">
+            <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" unifiedTitleAndToolbar="YES"/>
+            <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
+            <rect key="contentRect" x="41" y="572" width="946" height="568"/>
+            <rect key="screenRect" x="0.0" y="0.0" width="1920" height="1178"/>
+            <value key="minSize" type="size" width="946" height="568"/>
+            <value key="maxSize" type="size" width="1600" height="568"/>
+            <view key="contentView" id="2">
+                <rect key="frame" x="0.0" y="0.0" width="946" height="568"/>
+                <autoresizingMask key="autoresizingMask"/>
+                <subviews>
+                    <textField verticalHuggingPriority="750" id="1123">
+                        <rect key="frame" x="18" y="2" width="711" height="28"/>
+                        <autoresizingMask key="autoresizingMask" flexibleMinY="YES"/>
+                        <textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" alignment="left" id="4846">
+                            <font key="font" metaFont="smallSystem"/>
+                            <string key="title">DO NOT TRANSLATE THIS NIB FILE,
+</string>
+                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                            <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+                        </textFieldCell>
+                    </textField>
+                    <progressIndicator verticalHuggingPriority="750" maxValue="100" bezeled="NO" style="bar" id="1373">
+                        <rect key="frame" x="18" y="-26" width="910" height="20"/>
+                        <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
+                    </progressIndicator>
+                    <tabView controlSize="small" initialItem="1477" id="1474">
+                        <rect key="frame" x="13" y="27" width="920" height="357"/>
+                        <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
+                        <tabViewItems>
+                            <tabViewItem label="Video" identifier="1" id="1477">
+                                <view key="view" id="1478">
+                                    <rect key="frame" x="10" y="29" width="900" height="315"/>
+                                    <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                </view>
+                            </tabViewItem>
+                            <tabViewItem label="Audio" identifier="2" id="1475">
+                                <view key="view" id="1476">
+                                    <rect key="frame" x="10" y="25" width="900" height="319"/>
+                                    <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                </view>
+                            </tabViewItem>
+                            <tabViewItem label="Subtitles" identifier="3" id="5194">
+                                <view key="view" id="5195">
+                                    <rect key="frame" x="10" y="25" width="900" height="319"/>
+                                    <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                </view>
+                            </tabViewItem>
+                            <tabViewItem label="Advanced" identifier="5" id="2015">
+                                <view key="view" id="2016">
+                                    <rect key="frame" x="10" y="25" width="900" height="319"/>
+                                    <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                </view>
+                            </tabViewItem>
+                            <tabViewItem label="Chapters" identifier="4" id="1989">
+                                <view key="view" id="1990">
+                                    <rect key="frame" x="10" y="25" width="900" height="319"/>
+                                    <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                </view>
+                            </tabViewItem>
+                        </tabViewItems>
+                    </tabView>
+                    <textField verticalHuggingPriority="750" id="1538">
+                        <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="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"/>
+                        </textFieldCell>
+                    </textField>
+                    <textField verticalHuggingPriority="750" id="1540">
+                        <rect key="frame" x="17" y="511" width="35" height="14"/>
+                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+                        <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Title:" id="4907">
+                            <font key="font" metaFont="smallSystem"/>
+                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                            <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+                        </textFieldCell>
+                        <connections>
+                            <binding destination="-2" name="textColor" keyPath="self.labelColor" id="cpH-Kt-lRM"/>
+                        </connections>
+                    </textField>
+                    <popUpButton verticalHuggingPriority="750" id="1541">
+                        <rect key="frame" x="53" y="506" width="312" height="22"/>
+                        <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
+                        <popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" controlSize="small" lineBreakMode="clipping" state="on" borderStyle="borderAndBezel" inset="2" arrowPosition="arrowAtCenter" preferredEdge="maxY" selectedItem="1543" id="4908">
+                            <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
+                            <font key="font" metaFont="smallSystem"/>
+                            <menu key="menu" title="OtherViews" id="1542">
+                                <items>
+                                    <menuItem state="on" id="1543"/>
+                                </items>
+                            </menu>
+                        </popUpButtonCell>
+                        <accessibility description="Title"/>
+                        <connections>
+                            <action selector="titlePopUpChanged:" target="-2" id="kSs-y7-Mfi"/>
+                            <binding destination="-2" name="enabled" keyPath="self.job" id="FoT-nx-ryU">
+                                <dictionary key="options">
+                                    <string key="NSValueTransformerName">NSIsNotNil</string>
+                                </dictionary>
+                            </binding>
+                        </connections>
+                    </popUpButton>
+                    <popUpButton verticalHuggingPriority="750" id="5513">
+                        <rect key="frame" x="492" y="506" width="84" height="22"/>
+                        <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
+                        <popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" controlSize="small" lineBreakMode="clipping" borderStyle="borderAndBezel" inset="2" arrowPosition="arrowAtCenter" preferredEdge="maxY" id="5514">
+                            <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
+                            <font key="font" metaFont="smallSystem"/>
+                            <menu key="menu" title="OtherViews" id="5515"/>
+                        </popUpButtonCell>
+                        <connections>
+                            <binding destination="-2" name="enabled" keyPath="self.job" id="OMf-GZ-Uvf">
+                                <dictionary key="options">
+                                    <string key="NSValueTransformerName">NSIsNotNil</string>
+                                </dictionary>
+                            </binding>
+                            <binding destination="-2" name="selectedIndex" keyPath="self.job.range.type" previousBinding="jpv-yJ-Fca" id="lsk-jg-EAY"/>
+                            <binding destination="-2" name="content" keyPath="self.job.range.types" id="jpv-yJ-Fca"/>
+                        </connections>
+                    </popUpButton>
+                    <textField verticalHuggingPriority="750" id="5180">
+                        <rect key="frame" x="390" y="511" width="46" height="14"/>
+                        <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
+                        <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Angle:" id="5185">
+                            <font key="font" metaFont="smallSystem"/>
+                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                            <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+                        </textFieldCell>
+                        <connections>
+                            <binding destination="-2" name="textColor" keyPath="self.labelColor" id="pe4-ce-1x7"/>
+                            <binding destination="5676" name="hidden" keyPath="values.UseDvdNav" id="GhV-lP-BWw">
+                                <dictionary key="options">
+                                    <string key="NSValueTransformerName">NSNegateBoolean</string>
+                                </dictionary>
+                            </binding>
+                        </connections>
+                    </textField>
+                    <popUpButton verticalHuggingPriority="750" id="5181">
+                        <rect key="frame" x="436" y="506" width="44" height="22"/>
+                        <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
+                        <popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" controlSize="small" lineBreakMode="clipping" state="on" borderStyle="borderAndBezel" inset="2" arrowPosition="arrowAtCenter" preferredEdge="maxY" selectedItem="5184" id="5182">
+                            <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
+                            <font key="font" metaFont="smallSystem"/>
+                            <menu key="menu" title="OtherViews" id="5183">
+                                <items>
+                                    <menuItem state="on" id="5184"/>
+                                </items>
+                            </menu>
+                        </popUpButtonCell>
+                        <accessibility description="Angle"/>
+                        <connections>
+                            <binding destination="-2" name="enabled" keyPath="self.job" id="pA6-GK-w84">
+                                <dictionary key="options">
+                                    <string key="NSValueTransformerName">NSIsNotNil</string>
+                                </dictionary>
+                            </binding>
+                            <binding destination="-2" name="content" keyPath="self.job.angles" id="If4-Fp-R0g"/>
+                            <binding destination="5676" name="hidden" keyPath="values.UseDvdNav" previousBinding="pA6-GK-w84" id="Ocv-Hr-bje">
+                                <dictionary key="options">
+                                    <string key="NSValueTransformerName">NSNegateBoolean</string>
+                                </dictionary>
+                            </binding>
+                        </connections>
+                    </popUpButton>
+                    <textField verticalHuggingPriority="750" id="1552">
+                        <rect key="frame" x="5" y="454" width="47" height="17"/>
+                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+                        <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="File:" id="4913">
+                            <font key="font" metaFont="smallSystem"/>
+                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                            <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+                        </textFieldCell>
+                        <connections>
+                            <binding destination="-2" name="textColor" keyPath="self.labelColor" id="cNL-U3-HcC"/>
+                        </connections>
+                    </textField>
+                    <textField verticalHuggingPriority="750" id="1553">
+                        <rect key="frame" x="764" y="511" width="65" height="14"/>
+                        <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
+                        <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Duration:" id="4914">
+                            <font key="font" metaFont="smallSystem"/>
+                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                            <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+                        </textFieldCell>
+                        <connections>
+                            <binding destination="-2" name="hidden" keyPath="self.job" id="A4K-w4-n6U">
+                                <dictionary key="options">
+                                    <string key="NSValueTransformerName">NSIsNil</string>
+                                </dictionary>
+                            </binding>
+                        </connections>
+                    </textField>
+                    <textField verticalHuggingPriority="750" id="1554">
+                        <rect key="frame" x="829" y="511" width="99" height="14"/>
+                        <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
+                        <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="left" title="00:00:00" id="4915">
+                            <font key="font" metaFont="smallSystem"/>
+                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                            <color key="backgroundColor" red="0.76630436999999996" green="0.0" blue="0.0" alpha="0.0" colorSpace="calibratedRGB"/>
+                        </textFieldCell>
+                        <connections>
+                            <binding destination="-2" name="hidden" keyPath="self.job" id="42H-WA-xrv">
+                                <dictionary key="options">
+                                    <string key="NSValueTransformerName">NSIsNil</string>
+                                </dictionary>
+                            </binding>
+                            <binding destination="-2" name="value" keyPath="self.job.range.duration" id="I4g-Nz-YXQ"/>
+                        </connections>
+                    </textField>
+                    <textField verticalHuggingPriority="750" id="1555">
+                        <rect key="frame" x="20" y="486" width="70" height="14"/>
+                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+                        <textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" alignment="left" title="Destination" id="4916">
+                            <font key="font" metaFont="smallSystemBold"/>
+                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                            <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+                        </textFieldCell>
+                    </textField>
+                    <popUpButton verticalHuggingPriority="750" id="1557">
+                        <rect key="frame" x="76" y="398" width="177" height="22"/>
+                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+                        <popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" controlSize="small" lineBreakMode="clipping" state="on" borderStyle="borderAndBezel" inset="2" arrowPosition="arrowAtCenter" preferredEdge="maxY" selectedItem="1559" id="4918">
+                            <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
+                            <font key="font" metaFont="smallSystem"/>
+                            <menu key="menu" title="OtherViews" id="1558">
+                                <items>
+                                    <menuItem state="on" id="1559"/>
+                                </items>
+                            </menu>
+                        </popUpButtonCell>
+                        <accessibility description="Format"/>
+                        <connections>
+                            <binding destination="-2" name="enabled" keyPath="self.job" id="GHf-iI-Xg0">
+                                <dictionary key="options">
+                                    <string key="NSValueTransformerName">NSIsNotNil</string>
+                                </dictionary>
+                            </binding>
+                            <binding destination="-2" name="selectedValue" keyPath="self.job.container" previousBinding="aNr-1N-DaN" id="lwk-pF-rbW">
+                                <dictionary key="options">
+                                    <string key="NSValueTransformerName">HBContainerTransformer</string>
+                                </dictionary>
+                            </binding>
+                            <binding destination="-2" name="content" keyPath="self.job.containers" id="aNr-1N-DaN"/>
+                        </connections>
+                    </popUpButton>
+                    <button verticalHuggingPriority="750" id="1562">
+                        <rect key="frame" x="841" y="450" width="90" height="28"/>
+                        <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
+                        <buttonCell key="cell" type="push" title="Browse…" bezelStyle="rounded" alignment="center" controlSize="small" borderStyle="border" inset="2" id="4920">
+                            <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                            <font key="font" metaFont="smallSystem"/>
+                        </buttonCell>
+                        <connections>
+                            <action selector="browseDestination:" target="-2" id="FqS-ZD-MaJ"/>
+                            <binding destination="-2" name="enabled" keyPath="self.job" id="uGd-Ul-eBq">
+                                <dictionary key="options">
+                                    <string key="NSValueTransformerName">NSIsNotNil</string>
+                                </dictionary>
+                            </binding>
+                        </connections>
+                    </button>
+                    <box verticalHuggingPriority="750" title="Box" boxType="separator" titlePosition="noTitle" id="1623">
+                        <rect key="frame" x="98" y="490" width="828" height="5"/>
+                        <autoresizingMask key="autoresizingMask" widthSizable="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="1539">
+                        <rect key="frame" x="70" y="540" width="310" height="14.000000042040593"/>
+                        <autoresizingMask key="autoresizingMask" flexibleMinY="YES" heightSizable="YES"/>
+                        <textFieldCell key="cell" controlSize="small" lineBreakMode="truncatingMiddle" selectable="YES" sendsActionOnEndEditing="YES" alignment="left" id="4906">
+                            <font key="font" metaFont="smallSystem"/>
+                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                            <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+                        </textFieldCell>
+                    </textField>
+                    <textField verticalHuggingPriority="750" id="1561">
+                        <rect key="frame" x="56" y="455" width="782" height="19"/>
+                        <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
+                        <textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" continuous="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="left" drawsBackground="YES" id="4919">
+                            <font key="font" metaFont="smallSystem"/>
+                            <color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
+                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                        </textFieldCell>
+                        <connections>
+                            <binding destination="-2" name="enabled" keyPath="self.job" id="JXO-Eg-p84">
+                                <dictionary key="options">
+                                    <string key="NSValueTransformerName">NSIsNotNil</string>
+                                </dictionary>
+                            </binding>
+                            <binding destination="-2" name="value" keyPath="self.job.destURL" id="5zX-7b-Y0f">
+                                <dictionary key="options">
+                                    <bool key="NSContinuouslyUpdatesValue" value="YES"/>
+                                    <string key="NSValueTransformerName">HBURLTransformer</string>
+                                </dictionary>
+                            </binding>
+                        </connections>
+                    </textField>
+                    <textField hidden="YES" verticalHuggingPriority="750" id="5491">
+                        <rect key="frame" x="581" y="492" width="54" height="19"/>
+                        <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
+                        <textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="right" drawsBackground="YES" id="5492">
+                            <numberFormatter key="formatter" formatterBehavior="default10_4" usesGroupingSeparator="NO" minimumIntegerDigits="0" maximumIntegerDigits="42" id="Fdv-uE-tUA">
+                                <real key="minimum" value="0.0"/>
+                            </numberFormatter>
+                            <font key="font" metaFont="smallSystem"/>
+                            <color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
+                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                        </textFieldCell>
+                        <connections>
+                            <binding destination="-2" name="hidden" keyPath="self.job.range.secondsSelected" id="nK6-QE-OSQ">
+                                <dictionary key="options">
+                                    <string key="NSValueTransformerName">NSNegateBoolean</string>
+                                </dictionary>
+                            </binding>
+                            <binding destination="-2" name="value" keyPath="self.job.range.secondsStart" id="0Cj-wW-5Se">
+                                <dictionary key="options">
+                                    <bool key="NSContinuouslyUpdatesValue" value="YES"/>
+                                    <bool key="NSValidatesImmediately" value="YES"/>
+                                </dictionary>
+                            </binding>
+                        </connections>
+                    </textField>
+                    <textField hidden="YES" verticalHuggingPriority="750" id="5521">
+                        <rect key="frame" x="638" y="492" width="54" height="19"/>
+                        <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
+                        <textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="right" drawsBackground="YES" id="5522">
+                            <numberFormatter key="formatter" formatterBehavior="default10_4" usesGroupingSeparator="NO" minimumIntegerDigits="0" maximumIntegerDigits="42" id="Wpt-92-R1O">
+                                <real key="minimum" value="0.0"/>
+                            </numberFormatter>
+                            <font key="font" metaFont="smallSystem"/>
+                            <color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
+                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                        </textFieldCell>
+                        <connections>
+                            <binding destination="-2" name="value" keyPath="self.job.range.frameStart" id="gMK-Oo-iNV">
+                                <dictionary key="options">
+                                    <bool key="NSContinuouslyUpdatesValue" value="YES"/>
+                                    <bool key="NSValidatesImmediately" value="YES"/>
+                                </dictionary>
+                            </binding>
+                            <binding destination="-2" name="hidden" keyPath="self.job.range.framesSelected" id="0dp-Lu-RBt">
+                                <dictionary key="options">
+                                    <string key="NSValueTransformerName">NSNegateBoolean</string>
+                                </dictionary>
+                            </binding>
+                        </connections>
+                    </textField>
+                    <textField hidden="YES" verticalHuggingPriority="750" id="5493">
+                        <rect key="frame" x="696" y="492" width="54" height="19"/>
+                        <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
+                        <textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="left" drawsBackground="YES" id="5494">
+                            <numberFormatter key="formatter" formatterBehavior="default10_4" usesGroupingSeparator="NO" minimumIntegerDigits="0" maximumIntegerDigits="42" id="tD5-HN-B7h">
+                                <real key="minimum" value="0.0"/>
+                            </numberFormatter>
+                            <font key="font" metaFont="smallSystem"/>
+                            <color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
+                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                        </textFieldCell>
+                        <connections>
+                            <binding destination="-2" name="hidden" keyPath="self.job.range.secondsSelected" id="CkY-Gb-kMw">
+                                <dictionary key="options">
+                                    <string key="NSValueTransformerName">NSNegateBoolean</string>
+                                </dictionary>
+                            </binding>
+                            <binding destination="-2" name="value" keyPath="self.job.range.secondsStop" id="5SR-rs-7eh">
+                                <dictionary key="options">
+                                    <bool key="NSContinuouslyUpdatesValue" value="YES"/>
+                                    <bool key="NSValidatesImmediately" value="YES"/>
+                                </dictionary>
+                            </binding>
+                        </connections>
+                    </textField>
+                    <textField hidden="YES" verticalHuggingPriority="750" id="5523">
+                        <rect key="frame" x="758" y="492" width="54" height="19"/>
+                        <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
+                        <textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="left" drawsBackground="YES" id="5524">
+                            <numberFormatter key="formatter" formatterBehavior="default10_4" usesGroupingSeparator="NO" minimumIntegerDigits="0" maximumIntegerDigits="42" id="WrK-kN-ZN0">
+                                <real key="minimum" value="0.0"/>
+                            </numberFormatter>
+                            <font key="font" metaFont="smallSystem"/>
+                            <color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
+                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                        </textFieldCell>
+                        <connections>
+                            <binding destination="-2" name="value" keyPath="self.job.range.frameStop" id="pjc-WR-Cps">
+                                <dictionary key="options">
+                                    <bool key="NSContinuouslyUpdatesValue" value="YES"/>
+                                    <bool key="NSValidatesImmediately" value="YES"/>
+                                </dictionary>
+                            </binding>
+                            <binding destination="-2" name="hidden" keyPath="self.job.range.framesSelected" id="mCj-hb-nRY">
+                                <dictionary key="options">
+                                    <string key="NSValueTransformerName">NSNegateBoolean</string>
+                                </dictionary>
+                            </binding>
+                        </connections>
+                    </textField>
+                    <textField verticalHuggingPriority="750" id="1627">
+                        <rect key="frame" x="20" y="430" width="97" height="14"/>
+                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+                        <textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" alignment="left" title="Output Settings:" id="4923">
+                            <font key="font" metaFont="smallSystemBold"/>
+                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                            <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+                        </textFieldCell>
+                    </textField>
+                    <box verticalHuggingPriority="750" title="Box" boxType="separator" titlePosition="noTitle" id="1628">
+                        <rect key="frame" x="292" y="434" width="634" height="5"/>
+                        <autoresizingMask key="autoresizingMask" widthSizable="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="1882">
+                        <rect key="frame" x="121" y="430" width="165" height="14"/>
+                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+                        <textFieldCell key="cell" sendsActionOnEndEditing="YES" id="4924">
+                            <font key="font" metaFont="smallSystemBold"/>
+                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                            <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+                        </textFieldCell>
+                        <connections>
+                            <binding destination="-2" name="value" keyPath="self.job.presetName" id="W9D-4K-e1F"/>
+                        </connections>
+                    </textField>
+                    <textField verticalHuggingPriority="750" id="2006">
+                        <rect key="frame" x="711" y="15" width="218" height="14"/>
+                        <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
+                        <textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" alignment="right" id="4925">
+                            <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="1556">
+                        <rect key="frame" x="21" y="403" width="53" height="14"/>
+                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+                        <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Format:" id="4917">
+                            <font key="font" metaFont="smallSystem"/>
+                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                            <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+                        </textFieldCell>
+                        <connections>
+                            <binding destination="-2" name="textColor" keyPath="self.labelColor" id="j6q-iC-kqw"/>
+                        </connections>
+                    </textField>
+                    <box verticalHuggingPriority="750" title="Box" boxType="separator" titlePosition="noTitle" id="3205">
+                        <rect key="frame" x="386" y="543" width="540" height="5"/>
+                        <autoresizingMask key="autoresizingMask" flexibleMinX="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>
+                    <progressIndicator hidden="YES" verticalHuggingPriority="750" maxValue="100" bezeled="NO" controlSize="small" style="bar" id="3203">
+                        <rect key="frame" x="386" y="542.0000000420406" width="541" height="12"/>
+                        <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
+                    </progressIndicator>
+                    <button toolTip="This rearranges the header of the MP4 file to optimize it for streaming across the web." id="4579">
+                        <rect key="frame" x="269" y="401" width="102" height="18"/>
+                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+                        <buttonCell key="cell" type="check" title="Web optimized" bezelStyle="regularSquare" imagePosition="left" alignment="left" controlSize="small" inset="2" id="4927">
+                            <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
+                            <font key="font" metaFont="smallSystem"/>
+                        </buttonCell>
+                        <connections>
+                            <binding destination="-2" name="value" keyPath="self.job.mp4HttpOptimize" id="k6d-kB-gvH"/>
+                            <binding destination="-2" name="hidden" keyPath="self.job.mp4OptionsEnabled" id="5Ru-HP-Pjj">
+                                <dictionary key="options">
+                                    <string key="NSValueTransformerName">NSNegateBoolean</string>
+                                </dictionary>
+                            </binding>
+                        </connections>
+                    </button>
+                    <button toolTip="This option adds an atom to the MP4 file which allows older iPods (5th Generation classic style) to play the file." id="4967">
+                        <rect key="frame" x="388" y="401" width="126" height="18"/>
+                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+                        <buttonCell key="cell" type="check" title="iPod 5G support" bezelStyle="regularSquare" imagePosition="left" alignment="left" controlSize="small" inset="2" id="4968">
+                            <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
+                            <font key="font" metaFont="smallSystem"/>
+                        </buttonCell>
+                        <connections>
+                            <binding destination="-2" name="value" keyPath="self.job.mp4iPodCompatible" id="Wze-yP-0B0"/>
+                            <binding destination="-2" name="hidden" keyPath="self.job.mp4iPodCompatibleEnabled" id="uSs-Xh-6ng">
+                                <dictionary key="options">
+                                    <string key="NSValueTransformerName">NSNegateBoolean</string>
+                                </dictionary>
+                            </binding>
+                        </connections>
+                    </button>
+                    <textField verticalHuggingPriority="750" id="5505">
+                        <rect key="frame" x="637" y="510" width="56" height="15"/>
+                        <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
+                        <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="center" title="through" id="5506">
+                            <font key="font" metaFont="smallSystem"/>
+                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                            <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+                        </textFieldCell>
+                        <connections>
+                            <binding destination="-2" name="hidden" keyPath="self.job" id="3Oi-Rz-VGX">
+                                <dictionary key="options">
+                                    <string key="NSValueTransformerName">NSIsNil</string>
+                                </dictionary>
+                            </binding>
+                        </connections>
+                    </textField>
+                    <popUpButton verticalHuggingPriority="750" id="1545">
+                        <rect key="frame" x="578" y="506" width="60" height="22"/>
+                        <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
+                        <popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" controlSize="small" lineBreakMode="clipping" state="on" borderStyle="borderAndBezel" inset="2" arrowPosition="arrowAtCenter" preferredEdge="maxY" selectedItem="1547" id="4910">
+                            <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
+                            <font key="font" metaFont="smallSystem"/>
+                            <menu key="menu" title="OtherViews" id="1546">
+                                <items>
+                                    <menuItem state="on" id="1547"/>
+                                </items>
+                            </menu>
+                        </popUpButtonCell>
+                        <accessibility description="Start Chapter"/>
+                        <connections>
+                            <binding destination="-2" name="selectedIndex" keyPath="self.job.range.chapterStart" previousBinding="iug-tk-BPC" id="6Lh-6x-j09"/>
+                            <binding destination="-2" name="content" keyPath="self.job.range.chapters" id="iug-tk-BPC"/>
+                            <binding destination="-2" name="hidden" keyPath="self.job.range.chaptersSelected" id="ycW-js-Hi5">
+                                <dictionary key="options">
+                                    <string key="NSValueTransformerName">NSNegateBoolean</string>
+                                </dictionary>
+                            </binding>
+                        </connections>
+                    </popUpButton>
+                    <popUpButton verticalHuggingPriority="750" id="1548">
+                        <rect key="frame" x="693" y="506" width="60" height="22"/>
+                        <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
+                        <popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" controlSize="small" lineBreakMode="clipping" state="on" borderStyle="borderAndBezel" inset="2" arrowPosition="arrowAtCenter" preferredEdge="maxY" selectedItem="1550" id="4911">
+                            <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
+                            <font key="font" metaFont="smallSystem"/>
+                            <menu key="menu" title="OtherViews" id="1549">
+                                <items>
+                                    <menuItem state="on" id="1550"/>
+                                </items>
+                            </menu>
+                        </popUpButtonCell>
+                        <accessibility description="End Chapter"/>
+                        <connections>
+                            <binding destination="-2" name="selectedIndex" keyPath="self.job.range.chapterStop" previousBinding="wDD-Bt-zMX" id="eHK-zg-A5x"/>
+                            <binding destination="-2" name="content" keyPath="self.job.range.chapters" id="wDD-Bt-zMX"/>
+                            <binding destination="-2" name="hidden" keyPath="self.job.range.chaptersSelected" id="Afk-fL-rtv">
+                                <dictionary key="options">
+                                    <string key="NSValueTransformerName">NSNegateBoolean</string>
+                                </dictionary>
+                            </binding>
+                        </connections>
+                    </popUpButton>
+                </subviews>
+            </view>
+            <toolbar key="toolbar" implicitIdentifier="E92CA47A-01F7-432A-A61C-28FE4D58C2CD" autosavesConfiguration="NO" displayMode="iconAndLabel" sizeMode="regular" id="7g3-gy-bUl">
+                <allowedToolbarItems>
+                    <toolbarItem implicitItemIdentifier="NSToolbarSpaceItem" id="ZEH-cS-zXY"/>
+                    <toolbarItem implicitItemIdentifier="NSToolbarFlexibleSpaceItem" id="wjB-Tl-5qq"/>
+                    <toolbarItem implicitItemIdentifier="B3BAB305-77BF-4967-B8E6-D11F40EF822B" label="Source" paletteLabel="Source" toolTip="Choose Video 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">
+                        <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">
+                        <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" tag="-1" image="addqueue" id="DZZ-Fe-wjw">
+                        <connections>
+                            <action selector="addToQueue:" target="-2" id="TRB-HE-1GW"/>
+                        </connections>
+                    </toolbarItem>
+                    <toolbarItem implicitItemIdentifier="6EFCA879-A80D-45D7-A846-EAD85261F864" label="Show Queue" paletteLabel="Show Queue" tag="-1" image="showqueue" id="HCx-ku-nF7">
+                        <connections>
+                            <action selector="showQueueWindow:" target="-1" id="vZB-dY-DbD"/>
+                        </connections>
+                    </toolbarItem>
+                    <toolbarItem implicitItemIdentifier="CBA63584-4A4E-43E5-8096-9C20B59AC580" label="Picture Settings" paletteLabel="Show Picture Settings" toolTip="Show Picture Settings" tag="-1" image="picturesettings" id="2uP-T2-02Q">
+                        <connections>
+                            <action selector="showPicturePanel:" target="-2" id="xXB-FD-XyP"/>
+                        </connections>
+                    </toolbarItem>
+                    <toolbarItem implicitItemIdentifier="DAAC2346-2B39-4A35-A62B-C12826F6AB42" label="Preview Window" 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 Window" 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 Preset Drawer" 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"/>
+                    <toolbarItem reference="byg-kj-sEM"/>
+                    <toolbarItem reference="wTQ-KF-5KW"/>
+                    <toolbarItem reference="DZZ-Fe-wjw"/>
+                    <toolbarItem reference="HCx-ku-nF7"/>
+                    <toolbarItem reference="wjB-Tl-5qq"/>
+                    <toolbarItem reference="2uP-T2-02Q"/>
+                    <toolbarItem reference="dK4-jt-v4K"/>
+                    <toolbarItem reference="p7Q-L3-zcW"/>
+                    <toolbarItem reference="9ll-Jg-YAB"/>
+                </defaultToolbarItems>
+            </toolbar>
+            <connections>
+                <outlet property="delegate" destination="-2" id="M3v-Rc-7Ca"/>
+            </connections>
+            <point key="canvasLocation" x="538" y="-161"/>
+        </window>
+        <drawer trailingOffset="15" id="1841" userLabel="PresetsDrawer">
+            <size key="contentSize" width="240" height="550"/>
+            <size key="minContentSize" width="100" height="50"/>
+            <size key="maxContentSize" width="280" height="550"/>
+            <connections>
+                <outlet property="delegate" destination="-2" id="skU-2X-nDc"/>
+                <outlet property="parentWindow" destination="21" id="1842"/>
+            </connections>
+        </drawer>
+        <userDefaultsController representsSharedInstance="YES" id="5676"/>
+        <customView id="lZQ-gl-3wX" userLabel="Open Panel View">
+            <rect key="frame" x="0.0" y="0.0" width="227" height="38"/>
+            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+            <subviews>
+                <button id="DN4-48-aOI">
+                    <rect key="frame" x="28" y="9" width="114" height="18"/>
+                    <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+                    <buttonCell key="cell" type="check" title="Scan only title:" bezelStyle="regularSquare" imagePosition="left" inset="2" id="eQA-t2-FcV">
+                        <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
+                        <font key="font" metaFont="system"/>
+                    </buttonCell>
+                    <connections>
+                        <binding destination="-2" name="value" keyPath="self.scanSpecificTitle" id="bMP-E7-iZy"/>
+                    </connections>
+                </button>
+                <textField verticalHuggingPriority="750" id="3w9-Iu-3u2">
+                    <rect key="frame" x="148" y="7" width="50" height="22"/>
+                    <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+                    <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" title="0" drawsBackground="YES" id="6E4-AG-PEh">
+                        <numberFormatter key="formatter" formatterBehavior="default10_4" usesGroupingSeparator="NO" minimumIntegerDigits="0" maximumIntegerDigits="42" id="V1R-X1-vLz">
+                            <real key="minimum" value="0.0"/>
+                        </numberFormatter>
+                        <font key="font" metaFont="system"/>
+                        <color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
+                        <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                    </textFieldCell>
+                    <connections>
+                        <binding destination="-2" name="enabled" keyPath="self.scanSpecificTitle" id="3aE-hX-Q0r"/>
+                        <binding destination="-2" name="value" keyPath="self.scanSpecificTitleIdx" id="dJZ-JM-2BP">
+                            <dictionary key="options">
+                                <bool key="NSContinuouslyUpdatesValue" value="YES"/>
+                                <integer key="NSNullPlaceholder" value="0"/>
+                            </dictionary>
+                        </binding>
+                    </connections>
+                </textField>
+            </subviews>
+            <point key="canvasLocation" x="458.5" y="-571"/>
+        </customView>
+    </objects>
+    <resources>
+        <image name="activity" width="24" height="24"/>
+        <image name="addqueue" width="12" height="12"/>
+        <image name="encode" width="24" height="24"/>
+        <image name="pauseencode" width="24" height="24"/>
+        <image name="picturesettings" width="24" height="24"/>
+        <image name="presets" width="24" height="24"/>
+        <image name="preview" width="24" height="24"/>
+        <image name="showqueue" width="24" height="24"/>
+        <image name="source" width="24" height="24"/>
+    </resources>
+</document>
index c2e0f97c586f20b02be304a380fefd6e2b8b5798..f6abd81a06bf70bead75f9afb0d53dc14a9b197d 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="6250" systemVersion="14B23" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="6724" systemVersion="14C99d" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
     <dependencies>
         <deployment version="1060" identifier="macosx"/>
         <development version="5100" identifier="xcode"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="6250"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="6724"/>
     </dependencies>
     <objects>
         <customObject id="-2" userLabel="File's Owner" customClass="HBPreferencesController">
@@ -49,7 +49,6 @@
                             <items>
                                 <menuItem title="Do Nothing" id="378"/>
                                 <menuItem title="Open Source" state="on" id="379"/>
-                                <menuItem title="Open Source (Title Specific)" id="377"/>
                             </items>
                         </menu>
                     </popUpButtonCell>
                 <popUpButton verticalHuggingPriority="750" id="491">
                     <rect key="frame" x="124" y="271" width="195" height="22"/>
                     <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
-                    <popUpButtonCell key="cell" type="push" title="Alert Window" bezelStyle="rounded" alignment="left" controlSize="small" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="495" id="492">
+                    <popUpButtonCell key="cell" type="push" title="Do Nothing" bezelStyle="rounded" alignment="left" controlSize="small" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="494" id="492">
                         <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
                         <font key="font" metaFont="smallSystem"/>
                         <menu key="menu" title="OtherViews" id="493">
                             <items>
-                                <menuItem title="Do Nothing" id="494"/>
-                                <menuItem title="Alert Window" state="on" id="495"/>
+                                <menuItem title="Do Nothing" state="on" id="494"/>
+                                <menuItem title="Alert Window" id="495"/>
                                 <menuItem title="Growl Notification" id="499"/>
                                 <menuItem title="Alert Window And Growl" id="496"/>
                                 <menuItem title="Put Computer To Sleep" id="497"/>
diff --git a/macosx/HBAppDelegate.h b/macosx/HBAppDelegate.h
new file mode 100644 (file)
index 0000000..a115696
--- /dev/null
@@ -0,0 +1,14 @@
+/*  HBAppDelegate.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>
+
+@interface HBAppDelegate : NSObject <NSApplicationDelegate>
+
+- (IBAction)showPreferencesWindow:(id)sender;
+- (IBAction)showOutputPanel:(id)sender;
+
+@end
diff --git a/macosx/HBAppDelegate.m b/macosx/HBAppDelegate.m
new file mode 100644 (file)
index 0000000..09b294b
--- /dev/null
@@ -0,0 +1,482 @@
+/*  HBAppDelegate.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 "HBAppDelegate.h"
+
+#import "HBUtilities.h"
+#import "HBPresetsManager.h"
+#import "HBPreset.h"
+
+#import "HBPreferencesController.h"
+#import "HBQueueController.h"
+#import "HBOutputPanelController.h"
+#import "HBCore.h"
+#import "Controller.h"
+
+static void hb_error_handler(const char *errmsg)
+{
+    NSString *error = @(errmsg);
+
+    if (error && [[NSUserDefaults standardUserDefaults] boolForKey:@"HBDebugAlert"])
+    {
+        dispatch_async(dispatch_get_main_queue(), ^{
+            NSAlert *alert = [[NSAlert alloc] init];
+            [alert setMessageText:NSLocalizedString(@"Internal Error.", @"")];
+            [alert runModal];
+            [alert release];
+        });
+    }
+
+    fprintf(stderr, "error: %s\n", errmsg);
+}
+
+@interface HBAppDelegate ()
+
+@property (nonatomic, retain) HBPresetsManager *presetsManager;
+@property (assign) IBOutlet NSMenu *presetsMenu;
+
+@property (nonatomic, retain) HBPreferencesController *preferencesController;
+@property (nonatomic, retain) HBQueueController *queueController;
+
+@property (nonatomic, retain) HBOutputPanelController *outputPanel;
+
+@property (nonatomic, retain) HBController *mainController;
+
+@end
+
+@implementation HBAppDelegate
+
+- (instancetype)init
+{
+    self = [super init];
+    if (self)
+    {
+        hb_global_init();
+        hb_register_error_handler(&hb_error_handler);
+
+        // Optionally use dvd nav
+        [HBCore setDVDNav:[[[NSUserDefaults standardUserDefaults] objectForKey:@"UseDvdNav"] boolValue]];
+
+        // Register the defaults preferences
+        [HBPreferencesController registerUserDefaults];
+
+        _outputPanel = [[HBOutputPanelController alloc] init];
+
+        // Lets report the HandBrake version number here to the activity log and text log file
+        NSDictionary *infoDict = [[NSBundle mainBundle] infoDictionary];
+        NSString *versionStringFull = [NSString stringWithFormat:@"Handbrake Version: %@  (%@)", infoDict[@"CFBundleShortVersionString"], infoDict[@"CFBundleVersion"]];
+        [HBUtilities writeToActivityLog: "%s", versionStringFull.UTF8String];
+
+        // we init the HBPresetsManager
+        NSURL *presetsURL = [NSURL fileURLWithPath:[[HBUtilities appSupportPath] stringByAppendingPathComponent:@"UserPresets.plist"]];
+        _presetsManager = [[HBPresetsManager alloc] initWithURL:presetsURL];
+
+        _queueController = [[HBQueueController alloc] init];
+        _queueController.outputPanel = _outputPanel;
+        _queueController.delegate = self;
+        _mainController = [[HBController alloc] initWithQueue:_queueController presetsManager:_presetsManager];
+
+        // Set the Growl Delegate
+        [GrowlApplicationBridge setGrowlDelegate:_queueController];
+    }
+    return self;
+}
+
+#pragma mark - NSApplicationDelegate
+
+- (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows:(BOOL)flag
+{
+    if (!flag)
+    {
+        [self.mainController showWindow:nil];
+    }
+    return YES;
+}
+
+- (void)applicationDidFinishLaunching:(NSNotification *)notification
+{
+    // Updates built-ins presets if needed
+    [self checkBuiltInsForUpdates];
+    [self buildPresetsMenu];
+
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(buildPresetsMenu) name:HBPresetsChangedNotification object:nil];
+
+    // Get the number of HandBrake instances currently running
+    NSUInteger instances = [NSRunningApplication runningApplicationsWithBundleIdentifier:[[NSBundle mainBundle] bundleIdentifier]].count;
+
+    // If we are a single instance it is safe to clean up the previews if there are any
+    // left over. This is a bit of a kludge but will prevent a build up of old instance
+    // live preview cruft. No danger of removing an active preview directory since they
+    // are created later in HBPreviewController if they don't exist at the moment a live
+    // preview encode is initiated.
+    if (instances == 1)
+    {
+        NSString *previewDirectory = [[HBUtilities appSupportPath] stringByAppendingPathComponent:@"Previews"];
+        NSError *error = nil;
+        NSArray *files = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:previewDirectory error:&error];
+        for (NSString *file in files)
+        {
+            BOOL result = [[NSFileManager defaultManager] removeItemAtPath:[previewDirectory stringByAppendingPathComponent:file] error:&error];
+            if (result == NO && error)
+            {
+                [HBUtilities writeToActivityLog: "Could not remove existing preview at : %s", file.UTF8String];
+            }
+        }
+    }
+
+    [self showMainWindow:self];
+
+    // Now we re-check the queue array to see if there are
+    // any remaining encodes to be done in it and ask the
+    // user if they want to reload the queue
+    if (self.queueController.count)
+    {
+        // On Screen Notification
+        // We check to see if there is already another instance of hb running.
+        // Note: hbInstances == 1 means we are the only instance of HandBrake.app
+        NSAlert *alert = nil;
+        if (instances > 1)
+        {
+            alert = [[NSAlert alloc] init];
+            [alert setMessageText:NSLocalizedString(@"There is already an instance of HandBrake running.", @"")];
+            [alert setInformativeText:NSLocalizedString(@"HandBrake will now load up the existing queue.", nil)];
+            [alert addButtonWithTitle:NSLocalizedString(@"Reload Queue", nil)];
+        }
+        else
+        {
+            if (self.queueController.workingItemsCount > 0 || self.queueController.pendingItemsCount > 0)
+            {
+                NSString *alertTitle;
+
+                if (self.queueController.workingItemsCount > 0)
+                {
+                    alertTitle = [NSString stringWithFormat:
+                                  NSLocalizedString(@"HandBrake Has Detected %d Previously Encoding Item(s) and %d Pending Item(s) In Your Queue.", @""),
+                                  self.queueController.workingItemsCount, self.queueController.pendingItemsCount];
+                }
+                else
+                {
+                    alertTitle = [NSString stringWithFormat:
+                                  NSLocalizedString(@"HandBrake Has Detected %d Pending Item(s) In Your Queue.", @""),
+                                  self.queueController.pendingItemsCount];
+                }
+
+                alert = [[NSAlert alloc] init];
+                [alert setMessageText:alertTitle];
+                [alert setInformativeText:NSLocalizedString(@"Do you want to reload them ?", nil)];
+                [alert addButtonWithTitle:NSLocalizedString(@"Reload Queue", nil)];
+                [alert addButtonWithTitle:NSLocalizedString(@"Empty Queue", nil)];
+                [alert setAlertStyle:NSCriticalAlertStyle];
+            }
+            else
+            {
+                // Since we addressed any pending or previously encoding items above, we go ahead and make sure
+                // the queue is empty of any finished items or cancelled items.
+                [self.queueController removeAllJobs];
+                [self.mainController launchAction];
+            }
+        }
+
+        if (alert)
+        {
+            NSModalResponse response = [alert runModal];
+
+            if (response == NSAlertSecondButtonReturn)
+            {
+                [HBUtilities writeToActivityLog:"didDimissReloadQueue NSAlertSecondButtonReturn Chosen"];
+                [self.queueController removeAllJobs];
+                [self.mainController launchAction];
+            }
+            else
+            {
+                [HBUtilities writeToActivityLog:"didDimissReloadQueue NSAlertFirstButtonReturn Chosen"];
+                if (instances == 1)
+                {
+                    [self.queueController setEncodingJobsAsPending];
+                }
+
+                [self showQueueWindow:nil];
+            }
+
+            [alert release];
+        }
+    }
+    else
+    {
+        [self.mainController launchAction];
+    }
+
+    // Open debug output window now if it was visible when HB was closed
+    if ([[NSUserDefaults standardUserDefaults] boolForKey:@"OutputPanelIsOpen"])
+        [self showOutputPanel:nil];
+
+    // Open queue window now if it was visible when HB was closed
+    if ([[NSUserDefaults standardUserDefaults] boolForKey:@"QueueWindowIsOpen"])
+        [self showQueueWindow:nil];
+}
+
+- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)app
+{
+    if (self.queueController.core.state != HBStateIdle)
+    {
+        NSAlert *alert = [[NSAlert alloc] init];
+        [alert setMessageText:NSLocalizedString(@"Are you sure you want to quit HandBrake?", nil)];
+        [alert setInformativeText:NSLocalizedString(@"If you quit HandBrake your current encode will be reloaded into your queue at next launch. Do you want to quit anyway?", nil)];
+        [alert addButtonWithTitle:NSLocalizedString(@"Quit", nil)];
+        [alert addButtonWithTitle:NSLocalizedString(@"Don't Quit", nil)];
+        [alert setAlertStyle:NSCriticalAlertStyle];
+
+        NSInteger result = [alert runModal];
+        [alert release];
+
+        if (result == NSAlertFirstButtonReturn)
+        {
+            return NSTerminateNow;
+        }
+        else
+        {
+            return NSTerminateCancel;
+        }
+    }
+
+    // Warn if items still in the queue
+    else if (self.queueController.pendingItemsCount > 0)
+    {
+        NSAlert *alert = [[NSAlert alloc] init];
+        [alert setMessageText:NSLocalizedString(@"Are you sure you want to quit HandBrake?", nil)];
+        [alert setInformativeText:NSLocalizedString(@"There are pending encodes in your queue. Do you want to quit anyway?",nil)];
+        [alert addButtonWithTitle:NSLocalizedString(@"Quit", nil)];
+        [alert addButtonWithTitle:NSLocalizedString(@"Don't Quit", nil)];
+        [alert setAlertStyle:NSCriticalAlertStyle];
+        NSInteger result = [alert runModal];
+        [alert release];
+        if (result == NSAlertFirstButtonReturn)
+        {
+            return NSTerminateNow;
+        }
+        else
+        {
+            return NSTerminateCancel;
+        }
+    }
+
+    return NSTerminateNow;
+}
+
+- (void)applicationWillTerminate:(NSNotification *)notification
+{
+    [self.presetsManager savePresets];
+
+    [_mainController release];
+    _mainController = nil;
+    [_queueController release];
+    _queueController = nil;
+
+    [HBCore closeGlobal];
+}
+
+- (void)application:(NSApplication *)sender openFiles:(NSArray *)filenames
+{
+    [self.mainController openFile:[NSURL fileURLWithPath:filenames.firstObject]];
+    [NSApp replyToOpenOrPrint:NSApplicationDelegateReplySuccess];
+}
+
+- (BOOL)validateMenuItem:(NSMenuItem *)menuItem
+{
+    SEL action = menuItem.action;
+
+    if (action == @selector(rip:) || action == @selector(pause:))
+    {
+        // Delegate the validation to the queue controller
+        return [self.queueController validateMenuItem:menuItem];
+    }
+    else if (action == @selector(showPicturePanel:) || action == @selector(showAddPresetPanel:) ||
+             action == @selector(showPreviewWindow:) || action == @selector(browseSources:))
+    {
+        // Delegate the validation to the main controller
+        return [self.mainController validateMenuItem:menuItem];
+    }
+
+    return YES;
+}
+
+#pragma mark - Menu actions
+
+- (IBAction)rip:(id)sender
+{
+    [self.queueController rip:self];
+}
+
+- (IBAction)pause:(id)sender
+{
+    [self.queueController togglePauseResume:self];
+}
+
+- (IBAction)browseSources:(id)sender
+{
+    [self.mainController browseSources:self];
+}
+
+#pragma mark - Presets Menu actions
+
+- (void)checkBuiltInsForUpdates
+{
+    // if we have built in presets to update, then do so AlertBuiltInPresetUpdate
+    if ([self.presetsManager checkBuiltInsForUpdates])
+    {
+        if( [[NSUserDefaults standardUserDefaults] boolForKey:@"AlertBuiltInPresetUpdate"] == YES)
+        {
+            // Show an alert window that built in presets will be updated
+            [NSApp requestUserAttention:NSCriticalRequest];
+            NSAlert *alert = [[NSAlert alloc] init];
+            [alert setMessageText:@"HandBrake has determined your built in presets are out of date…"];
+            [alert setInformativeText:@"HandBrake will now update your built-in presets."];
+            [alert runModal];
+            [alert release];
+        }
+        // when alert is dismissed, go ahead and update the built in presets
+        [self.presetsManager generateBuiltInPresets];
+    }
+}
+
+/**
+ *  Adds the presets list to the menu.
+ */
+- (void)buildPresetsMenu
+{
+    // First we remove all the preset menu items
+    // inserted previosly
+    NSArray *menuItems = [self.presetsMenu.itemArray copy];
+    for (NSMenuItem *item in menuItems)
+    {
+        if (item.tag != -1)
+        {
+            [self.presetsMenu removeItem:item];
+        }
+    }
+    [menuItems release];
+
+    __block NSUInteger i = 0;
+    __block BOOL builtInEnded = NO;
+    [self.presetsManager.root enumerateObjectsUsingBlock:^(id obj, NSIndexPath *idx, BOOL *stop)
+     {
+         if (idx.length)
+         {
+             NSMenuItem *item = [[NSMenuItem alloc] init];
+             item.title = [obj name];
+             item.tag = i++;
+
+             // Set an action only to the actual presets,
+             // not on the folders.
+             if ([obj isLeaf])
+             {
+                 item.action = @selector(selectPresetFromMenu:);
+                 item.representedObject = obj;
+             }
+             // Make the default preset font bold.
+             if ([obj isDefault])
+             {
+                 NSAttributedString *newTitle = [[NSAttributedString alloc] initWithString:[obj name]
+                                                                                attributes:@{NSFontAttributeName: [NSFont boldSystemFontOfSize:14]}];
+                 [item setAttributedTitle:newTitle];
+                 [newTitle release];
+             }
+             // Add a separator line after the last builtIn preset
+             if ([obj isBuiltIn] == NO && builtInEnded == NO)
+             {
+                 [self.presetsMenu addItem:[NSMenuItem separatorItem]];
+                 builtInEnded = YES;
+             }
+
+             item.indentationLevel = idx.length - 1;
+
+             [self.presetsMenu addItem:item];
+             [item release];
+         }
+     }];
+}
+
+/**
+ * We use this method to recreate new, updated factory presets
+ */
+- (IBAction)addFactoryPresets:(id)sender
+{
+    [self.presetsManager generateBuiltInPresets];
+}
+
+#pragma mark - Show Window Menu Items
+
+/**
+ * Shows preferences window.
+ */
+- (IBAction)showPreferencesWindow:(id)sender
+{
+    if (_preferencesController == nil)
+    {
+        _preferencesController = [[HBPreferencesController alloc] init];
+    }
+
+    NSWindow *window = [_preferencesController window];
+    if (![window isVisible])
+    {
+        [window center];
+    }
+
+    [window makeKeyAndOrderFront:nil];
+}
+
+/**
+ * Shows queue window.
+ */
+- (IBAction)showQueueWindow:(id)sender
+{
+    [self.queueController showWindow:sender];
+}
+
+/**
+ * Shows debug output window.
+ */
+- (IBAction)showOutputPanel:(id)sender
+{
+    [self.outputPanel showOutputPanel:sender];
+}
+
+- (IBAction)showPicturePanel:(id)sender
+{
+    [self.mainController showPicturePanel:self];
+}
+
+- (IBAction)showPreviewWindow:(id)sender
+{
+    [self.mainController showPreviewWindow:self];
+}
+
+/**
+ * Shows main window.
+ */
+- (IBAction)showMainWindow:(id)sender
+{
+    [self.mainController showWindow:sender];
+}
+
+- (IBAction)openHomepage:(id)sender
+{
+    [[NSWorkspace sharedWorkspace] openURL:[NSURL
+                                            URLWithString:@"http://handbrake.fr/"]];
+}
+
+- (IBAction)openForums:(id)sender
+{
+    [[NSWorkspace sharedWorkspace] openURL:[NSURL
+                                            URLWithString:@"http://forum.handbrake.fr/"]];
+}
+- (IBAction)openUserGuide:(id)sender
+{
+    [[NSWorkspace sharedWorkspace] openURL:[NSURL
+                                            URLWithString:@"http://trac.handbrake.fr/wiki/HandBrakeGuide"]];
+}
+
+@end
index 73cdc2a2172c4cf29b952f49d2ced363a720f8b5..0a48dff66358ec432e92fc763ae8dc1a33b4ba28 100644 (file)
@@ -7,6 +7,7 @@
 #import <Cocoa/Cocoa.h>
 #import <Growl/Growl.h>
 
+@class HBAppDelegate;
 @class HBController;
 @class HBOutputPanelController;
 @class HBCore;
@@ -18,6 +19,7 @@
 @property (nonatomic, readonly) HBCore *core;
 
 @property (nonatomic, assign) HBController *controller;
+@property (nonatomic, assign) HBAppDelegate *delegate;
 @property (nonatomic, assign) HBOutputPanelController *outputPanel;
 
 @property (nonatomic, readonly) NSUInteger count;
@@ -35,4 +37,6 @@
 - (IBAction)rip:(id)sender;
 - (IBAction)cancelRip:(id)sender;
 
+- (IBAction)togglePauseResume:(id)sender;
+
 @end
index b835599a937067a951830dac900a2a21c003ae40..1a8712653d791944e31efb087345978d10cc747f 100644 (file)
@@ -9,6 +9,7 @@
 
 #import "HBCore.h"
 #import "Controller.h"
+#import "HBAppDelegate.h"
 #import "HBOutputPanelController.h"
 
 #import "HBQueueOutlineView.h"
 
 #pragma mark Toolbar
 
+- (BOOL)validateMenuItem:(NSMenuItem *)menuItem
+{
+    SEL action = menuItem.action;
+
+    if (action == @selector(rip:))
+    {
+        if (self.core.state == HBStateIdle)
+        {
+            menuItem.title = NSLocalizedString(@"Start Encoding", nil);
+            menuItem.keyEquivalent = @"s";
+
+            return (self.pendingItemsCount > 0);
+        }
+        else if (self.core.state != HBStateIdle)
+        {
+            menuItem.title = NSLocalizedString(@"Stop Encoding", nil);
+            menuItem.keyEquivalent = @".";
+
+            return YES;
+        }
+    }
+
+    if (action == @selector(pause:))
+    {
+        if (self.core.state != HBStatePaused)
+        {
+            menuItem.title = NSLocalizedString(@"Pause Encoding", nil);
+        }
+        else
+        {
+            menuItem.title = NSLocalizedString(@"Resume Encoding", nil);
+        }
+
+        return (self.core.state == HBStateWorking || self.core.state == HBStatePaused);
+    }
+    
+    return YES;
+}
+
 - (BOOL)validateToolbarItem:(NSToolbarItem *)theItem
 {
     SEL action = theItem.action;
         NSInteger response = [alert runModal];
         if (response == NSAlertSecondButtonReturn)
         {
-            [self.controller showPreferencesWindow:nil];
+            [self.delegate showPreferencesWindow:nil];
         }
         [alert release];
     }
         NSInteger response = [alert runModal];
         if (response == NSAlertSecondButtonReturn)
         {
-            [self.controller showPreferencesWindow:nil];
+            [self.delegate showPreferencesWindow:nil];
         }
         [alert release];
     }
index 48805d7130c79ad83685604c103cc36cd3a96642..6410bdb02cef007fe99c788dec0a4ac4a45175cc 100644 (file)
                A9204DC51A16C5AB007CA74C /* Delete@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A9204DC21A16C5AB007CA74C /* Delete@2x.png */; };
                A9204DC61A16C5AB007CA74C /* DeleteHighlightPressed@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A9204DC31A16C5AB007CA74C /* DeleteHighlightPressed@2x.png */; };
                A9204DC71A16C5AB007CA74C /* DeletePressed@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A9204DC41A16C5AB007CA74C /* DeletePressed@2x.png */; };
+               A92268781A6E555500A8D5C5 /* HBAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = A92268771A6E555500A8D5C5 /* HBAppDelegate.m */; };
+               A922687B1A6E569B00A8D5C5 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = A92268791A6E569B00A8D5C5 /* MainWindow.xib */; };
                A9252C041A17343500B8B7F8 /* DeleteHighlight@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A9252C031A17343500B8B7F8 /* DeleteHighlight@2x.png */; };
                A9252C091A173D4800B8B7F8 /* Reveal@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A9252C051A173D4800B8B7F8 /* Reveal@2x.png */; };
                A9252C0A1A173D4800B8B7F8 /* RevealHighlight@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A9252C061A173D4800B8B7F8 /* RevealHighlight@2x.png */; };
                A9204DC21A16C5AB007CA74C /* Delete@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Delete@2x.png"; sourceTree = "<group>"; };
                A9204DC31A16C5AB007CA74C /* DeleteHighlightPressed@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "DeleteHighlightPressed@2x.png"; sourceTree = "<group>"; };
                A9204DC41A16C5AB007CA74C /* DeletePressed@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "DeletePressed@2x.png"; sourceTree = "<group>"; };
+               A92268761A6E555500A8D5C5 /* HBAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBAppDelegate.h; sourceTree = "<group>"; };
+               A92268771A6E555500A8D5C5 /* HBAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBAppDelegate.m; sourceTree = "<group>"; };
+               A922687A1A6E569B00A8D5C5 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = MainWindow.xib; sourceTree = "<group>"; };
                A9252C031A17343500B8B7F8 /* DeleteHighlight@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "DeleteHighlight@2x.png"; sourceTree = "<group>"; };
                A9252C051A173D4800B8B7F8 /* Reveal@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Reveal@2x.png"; sourceTree = "<group>"; };
                A9252C061A173D4800B8B7F8 /* RevealHighlight@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "RevealHighlight@2x.png"; sourceTree = "<group>"; };
                        children = (
                                273F217C14ADDDA10021BE6D /* InfoPlist.strings */,
                                273F217E14ADDDA10021BE6D /* MainMenu.xib */,
+                               A92268791A6E569B00A8D5C5 /* MainWindow.xib */,
                                A9CF25EF1990D62C0023F727 /* Presets.xib */,
                                A9E2FD291A21BC6F000E8D3F /* AddPreset.xib */,
                                A93E0ED51972958C00FD67FB /* Video.xib */,
                A9B34D6F197683FE00871B7D /* Controllers */ = {
                        isa = PBXGroup;
                        children = (
+                               A92268761A6E555500A8D5C5 /* HBAppDelegate.h */,
+                               A92268771A6E555500A8D5C5 /* HBAppDelegate.m */,
                                273F208E14ADBE670021BE6D /* Controller.h */,
                                273F208F14ADBE670021BE6D /* Controller.m */,
                                A9B34D701976841800871B7D /* Main Window View Controllers */,
                                273F218E14ADDDA10021BE6D /* PicturePreview.xib in Resources */,
                                273F218F14ADDDA10021BE6D /* PictureSettings.xib in Resources */,
                                273F219014ADDDA10021BE6D /* Preferences.xib in Resources */,
+                               A922687B1A6E569B00A8D5C5 /* MainWindow.xib in Resources */,
                                273F219114ADDDA10021BE6D /* Queue.xib in Resources */,
                                3490BCB41614CF8D002A5AD7 /* HandBrake.icns in Resources */,
                                A9E1468016BC2AD800C307BC /* next-p.pdf in Resources */,
                                A98C29C41977B10600AF5DED /* HBLanguagesSelection.m in Sources */,
                                A9BB0F2719A0ECE40079F1C1 /* HBHUDButtonCell.m in Sources */,
                                A932E273198834130047D13E /* HBAudioDefaults.m in Sources */,
+                               A92268781A6E555500A8D5C5 /* HBAppDelegate.m in Sources */,
                                A91806711A4807B000FC9BED /* HBRange.m in Sources */,
                                A9DEC8771A23C88D00C79B48 /* HBVideo.m in Sources */,
                                A9523937199A6AAE00588AEF /* HBFilters.m in Sources */,
                        name = Queue.xib;
                        sourceTree = "<group>";
                };
+               A92268791A6E569B00A8D5C5 /* MainWindow.xib */ = {
+                       isa = PBXVariantGroup;
+                       children = (
+                               A922687A1A6E569B00A8D5C5 /* English */,
+                       );
+                       name = MainWindow.xib;
+                       sourceTree = "<group>";
+               };
                A932E26A1988334B0047D13E /* AudioDefaults.xib */ = {
                        isa = PBXVariantGroup;
                        children = (
index 1d7d6ed6981bb1834cf559904fe574c66bb50c4d..961d1fa78b23e558b996815c2d34d93e2327f3ac 100644 (file)
@@ -5,24 +5,6 @@
    It may be used under the terms of the GNU General Public License. */
 
 #import <Cocoa/Cocoa.h>
-#include "hb.h"
-
-static void hb_error_handler(const char *errmsg)
-{
-    NSString *error = @(errmsg);
-
-    if (error && [[NSUserDefaults standardUserDefaults] boolForKey:@"HBDebugAlert"])
-    {
-        dispatch_async(dispatch_get_main_queue(), ^{
-            NSAlert *alert = [[NSAlert alloc] init];
-            [alert setMessageText:NSLocalizedString(@"Internal Error.", @"")];
-            [alert runModal];
-            [alert release];
-        });
-    }
-
-    fprintf(stderr, "error: %s\n", errmsg);
-}
 
 int main(int argc, const char **argv)
 {
@@ -39,8 +21,5 @@ int main(int argc, const char **argv)
     action.sa_handler = SIG_IGN;
     sigaction(SIGINT, &action, NULL);
 
-    hb_global_init();
-    hb_register_error_handler(&hb_error_handler);
-
     return NSApplicationMain(argc, argv);
 }