All pastes #778804 Raw Edit

Mine

public diff v1 · immutable
·published 2007-11-17 22:46 UTC
rendered paste body
Index: libhb/dvd.c===================================================================--- libhb/dvd.c	(revision 1064)+++ libhb/dvd.c	(working copy)@@ -146,6 +146,12 @@     /* VTS which our title is in */     title->vts = d->vmg->tt_srpt->title[t-1].title_set_nr; +    if (!title->vts)+    {+        hb_error("Invalid VTS number!");+        goto fail;+    }+         hb_log( "scan: opening IFO for VTS %d", title->vts );     if( !( vts = ifoOpen( d->reader, title->vts ) ) )     {Index: macosx/Controller.mm===================================================================--- macosx/Controller.mm	(revision 1064)+++ macosx/Controller.mm	(working copy)@@ -134,10 +134,10 @@              } 	-    /* Show scan panel ASAP */-    [self performSelectorOnMainThread: @selector(showScanPanel:)+    /* Show Browse Sources Window ASAP */+    [self performSelectorOnMainThread: @selector(browseSources:)                            withObject: NULL waitUntilDone: NO];-}+                           }  - (void) updateAlertDone: (NSWindow *) sheet               returnCode: (int) returnCode contextInfo: (void *) contextInfo@@ -861,7 +861,7 @@         [item setToolTip: @"Choose Video Source"];         [item setImage: [NSImage imageNamed: @"Source"]];         [item setTarget: self];-        [item setAction: @selector(showScanPanel:)];+        [item setAction: @selector(browseSources:)];     }     else     {@@ -978,7 +978,7 @@         if (action == @selector(addToQueue:) || action == @selector(showPicturePanel:) || action == @selector(showAddPresetPanel:))             return SuccessfulScan && [fWindow attachedSheet] == nil;         -        if (action == @selector(showScanPanel:))+        if (action == @selector(showScanPanel:) || action == @selector(browseSources:))         {             if (s.state == HB_STATE_SCANNING)                 return NO;@@ -1054,14 +1054,11 @@ #pragma mark - #pragma mark Get New Source -- (IBAction) showScanPanel: (id) sender+/*Opens the source browse window, called from Open Source widgets */+- (IBAction) browseSources: (id) sender {     [self enableUI: NO];-	[self browseSources:NULL];-}--- (void) browseSources: (id) sender-{+         NSOpenPanel * panel; 	     panel = [NSOpenPanel openPanel];@@ -1078,48 +1075,116 @@ 		sourceDirectory = @"~/Desktop"; 		sourceDirectory = [sourceDirectory stringByExpandingTildeInPath]; 	}-   [panel beginSheetForDirectory: sourceDirectory file: nil types: nil-				   modalForWindow: fWindow modalDelegate: self-				   didEndSelector: @selector( browseSourcesDone:returnCode:contextInfo: )-					  contextInfo: nil];+    /* 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+        */+    [panel beginSheetForDirectory: sourceDirectory file: nil types: nil+                   modalForWindow: fWindow modalDelegate: self+                   didEndSelector: @selector( browseSourcesDone:returnCode:contextInfo: )+                      contextInfo: sender];  }  - (void) browseSourcesDone: (NSOpenPanel *) sheet-		 returnCode: (int) returnCode contextInfo: (void *) contextInfo+                returnCode: (int) returnCode contextInfo: (void *) contextInfo {+    /* we convert the sender content of contextInfo back into a variable called sender+    * mostly just for consistency for evaluation later+    */+    id sender = (id)contextInfo;     /* User selected a file to open */ 	if( returnCode == NSOKButton )     {-        [fSrcDVD2Field setStringValue: _( @"Opening a new source ..." )];+        +        NSString *scanPath = [[sheet filenames] objectAtIndex: 0];+        /* we order out sheet, which is the browse window as we need to open+        * the title selection sheet right away+        */+        [sheet orderOut: self];+        /* 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 */+        [fScanSrcTitlePathField setStringValue: [NSString stringWithFormat:@"%@", scanPath]];+        +        if (sender == fOpenSourceTitleMMenu)+        {+            /* 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:NULL];+        }+        else+        {+            /* We are just doing a standard full source scan, so we specify "0" to libhb */+            NSString *path = [[sheet filenames] objectAtIndex: 0];+            [self performScan:path scanTitleNum:0];   +        }+        +    }+    else // User clicked Cancel in browse window+    {+        /* if we have a title loaded up */+        if ([[fSrcDVD2Field stringValue] length] > 0)+        {+            [self enableUI: YES];+        }+    }+}+    +/* 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: NULL 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]; 	    [fScanIndicator setIndeterminate: YES];         [fScanIndicator startAnimation: nil]; 		 		/* we set the last source directory in the prefs here */-		NSString *sourceDirectory = [[[sheet filenames] objectAtIndex: 0] stringByDeletingLastPathComponent];+		NSString *sourceDirectory = [[fScanSrcTitlePathField stringValue] stringByDeletingLastPathComponent]; 		[[NSUserDefaults standardUserDefaults] setObject:sourceDirectory forKey:@"LastSourceDirectory"];-		-        NSString *path = [[sheet filenames] objectAtIndex: 0];-        HBDVDDetector *detector = [HBDVDDetector detectorForPath:path];-        if( [detector isVideoDVD] )-        {-            // The chosen path was actually on a DVD, so use the raw block-            // device path instead.-            path = [detector devicePath];-        }-		-		hb_scan( fHandle, [path UTF8String], 0 );-	}-	else // User clicked Cancel in browse window-	{-		/* if we have a title loaded up */-		if ([[fSrcDVD2Field stringValue] length] > 0)-		{-            [self enableUI: YES];-        }-	}+        /* We use the performScan method to actually perform the specified scan passing the path and the title+            * to be scanned+            */+        [self performScan:[fScanSrcTitlePathField stringValue] scanTitleNum:[fScanSrcTitleNumField intValue]];+    } } ++/* Here we actually tell libhb to perform the source scan, using the path to source and title number*/+- (void) performScan:(NSString *) scanPath scanTitleNum: (int) scanTitleNum+{+    NSString *path = scanPath;+    HBDVDDetector *detector = [HBDVDDetector detectorForPath:path];+    if( [detector isVideoDVD] )+    {+        // The chosen path was actually on a DVD, so use the raw block+        // device path instead.+        path = [detector devicePath];+    }+    /* If there is no title number passed to scan, we use "0"+        * which causes the default behavior of a full source scan+    */+    if (!scanTitleNum)+    {+        scanTitleNum = 0;+    }+    hb_scan( fHandle, [path UTF8String], scanTitleNum );+}+ - (IBAction) showNewScan:(id)sender { 	hb_list_t  * list;Index: macosx/English.lproj/MainMenu.nib/info.nib===================================================================--- macosx/English.lproj/MainMenu.nib/info.nib	(revision 1064)+++ macosx/English.lproj/MainMenu.nib/info.nib	(working copy)@@ -3,7 +3,7 @@ <plist version="1.0"> <dict> 	<key>IBDocumentLocation</key>-	<string>133 168 417 350 0 0 1440 878 </string>+	<string>37 120 663 378 0 0 1440 878 </string> 	<key>IBEditorPositions</key> 	<dict> 		<key>1843</key>@@ -11,7 +11,7 @@ 		<key>2436</key> 		<string>307 361 192 68 0 0 1440 878 </string> 		<key>29</key>-		<string>233 476 368 44 0 0 1440 878 </string>+		<string>57 811 368 44 0 0 1440 878 </string> 	</dict> 	<key>IBFramework Version</key> 	<string>446.1</string>@@ -28,10 +28,9 @@ 	<key>IBOpenObjects</key> 	<array> 		<integer>29</integer>-		<integer>21</integer> 	</array> 	<key>IBSystem Version</key>-	<string>8R2218</string>+	<string>8S2167</string> 	<key>IBUserGuides</key> 	<dict> 		<key>21</key>Index: macosx/English.lproj/MainMenu.nib/keyedobjects.nib===================================================================Cannot display: file marked as a binary type.svn:mime-type = application/octet-streamIndex: macosx/English.lproj/MainMenu.nib/classes.nib===================================================================--- macosx/English.lproj/MainMenu.nib/classes.nib	(revision 1064)+++ macosx/English.lproj/MainMenu.nib/classes.nib	(working copy)@@ -71,6 +71,7 @@                 calculatePictureSizing = id;                  chapterPopUpChanged = id;                  closeAddPresetPanel = id; +                closeSourceTitleScanPanel = id;                  codecsPopUpChanged = id;                  customSettingUsed = id;                  deleteFactoryPresets = id; @@ -96,6 +97,7 @@                 showPreferencesWindow = id;                  showQueueWindow = id;                  showScanPanel = id; +                showSourceTitleScanPanel = id;                  subtitleSelectionChanged = id;                  tableViewSelected = id;                  titlePopUpChanged = id; @@ -130,6 +132,7 @@                 fDstFormatField = NSTextField;                  fDstFormatPopUp = NSPopUpButton;                  fDstMpgLargeFileCheck = NSButton; +                fOpenSourceTitleMMenu = NSMenuItem;                  fPicLabelAnamorphic = NSTextField;                  fPicLabelAr = NSTextField;                  fPicLabelAutoCrop = NSTextField; @@ -169,6 +172,11 @@                 fQueueStatus = NSTextField;                  fRipIndicator = NSProgressIndicator;                  fScanIndicator = NSProgressIndicator; +                fScanSrcTitleCancelButton = NSButton; +                fScanSrcTitleNumField = NSTextField; +                fScanSrcTitleOpenButton = NSButton; +                fScanSrcTitlePanel = NSPanel; +                fScanSrcTitlePathField = NSTextField;                  fSrcChapterEndPopUp = NSPopUpButton;                  fSrcChapterField = NSTextField;                  fSrcChapterStartPopUp = NSPopUpButton; Index: macosx/Controller.h===================================================================--- macosx/Controller.h	(revision 1064)+++ macosx/Controller.h	(working copy)@@ -24,6 +24,16 @@     IBOutlet NSWindow            * fWindow;     NSToolbar                    * toolbar;     +    /* Main Menu Outlets */+    NSMenuItem                   * fOpenSourceTitleMMenu;+    +    /* Source Title Scan Outlets */+    IBOutlet NSPanel              * fScanSrcTitlePanel;+    IBOutlet NSTextField          * fScanSrcTitlePathField;+    IBOutlet NSTextField          * fScanSrcTitleNumField;+    IBOutlet NSButton             * fScanSrcTitleCancelButton;+    IBOutlet NSButton             * fScanSrcTitleOpenButton;+         /* Picture panel */     PictureController            * fPictureController;     @@ -183,16 +193,19 @@ 	NSString                      * currentSource; } +- (IBAction) browseSources: (id) sender;+- (void) browseSourcesDone: (NSOpenPanel *) sheet+                returnCode: (int) returnCode contextInfo: (void *) contextInfo;+- (IBAction) showSourceTitleScanPanel: (id) sender;+- (IBAction) closeSourceTitleScanPanel: (id) sender;  +- (void) performScan:(NSString *) scanPath scanTitleNum: (int) scanTitleNum;+- (IBAction) showNewScan: (id) sender;+ - (void)     TranslateStrings;  - (void)     updateUI: (NSTimer *) timer; - (void)     enableUI: (bool) enable;-- (IBAction) showNewScan: (id) sender;-- (IBAction) showScanPanel: (id) sender;-- (IBAction) browseSources: (id) sender;-- (void) browseSourcesDone: (NSOpenPanel *) sheet-    returnCode: (int) returnCode contextInfo: (void *) contextInfo;-    + - (IBAction) titlePopUpChanged: (id) sender; - (IBAction) chapterPopUpChanged: (id) sender; @@ -211,7 +224,7 @@  - (IBAction) browseFile: (id) sender; - (void)     browseFileDone: (NSSavePanel *) sheet-    returnCode: (int) returnCode contextInfo: (void *) contextInfo;+                 returnCode: (int) returnCode contextInfo: (void *) contextInfo;  - (IBAction) videoMatrixChanged: (id) sender; - (IBAction) qualitySliderChanged: (id) sender;@@ -222,7 +235,7 @@  - (IBAction) addToQueue: (id) sender; - (void) overwriteAddToQueueAlertDone: (NSWindow *) sheet-    returnCode: (int) returnCode contextInfo: (void *) contextInfo;+                           returnCode: (int) returnCode contextInfo: (void *) contextInfo; - (void)     doAddToQueue;  - (IBAction) showQueueWindow:(id)sender;@@ -231,9 +244,9 @@  - (IBAction) Rip: (id) sender; - (void)     overWriteAlertDone: (NSWindow *) sheet-    returnCode: (int) returnCode contextInfo: (void *) contextInfo;+                     returnCode: (int) returnCode contextInfo: (void *) contextInfo; - (void)     updateAlertDone: (NSWindow *) sheet-    returnCode: (int) returnCode contextInfo: (void *) contextInfo;+                  returnCode: (int) returnCode contextInfo: (void *) contextInfo; - (void)     doRip;  - (IBAction) Cancel: (id) sender;@@ -248,7 +261,7 @@ - (IBAction) openForums:   (id) sender; - (IBAction) openUserGuide:   (id) sender; -// Preset Methods Here+    // Preset Methods Here - (void) loadPresets; - (IBAction) customSettingUsed: (id) sender; - (IBAction) showAddPresetPanel: (id) sender;@@ -286,21 +299,21 @@ - (IBAction)getDefaultPresets:(id)sender; - (IBAction)tableViewSelected:(id)sender; -// NSTableDataSource methods+    // NSTableDataSource methods - (int)numberOfRowsInTableView:(NSTableView *)aTableView; - (id)tableView:(NSTableView *)aTableView       objectValueForTableColumn:(NSTableColumn *)aTableColumn-      row:(int)rowIndex;+            row:(int)rowIndex; - (void)tableView:(NSTableView *)aTableView-        setObjectValue:(id)anObject-        forTableColumn:(NSTableColumn *)aTableColumn-        row:(int)rowIndex;-// To determine user presets cell display properties+   setObjectValue:(id)anObject+   forTableColumn:(NSTableColumn *)aTableColumn+              row:(int)rowIndex;+    // To determine user presets cell display properties - (void)tableView:(NSTableView *)aTableView 		willDisplayCell:(id)aCell forTableColumn:(NSTableColumn *)aTableColumn-		 row:(int)rowIndex;+              row:(int)rowIndex; -// Growl methods+    // Growl methods - (NSDictionary *) registrationDictionaryForGrowl; -(IBAction)showGrowlDoneNotification:(id)sender; - (IBAction)showDebugOutputPanel:(id)sender;