From 1fc472259467d82c7d934ff2f836653aaea52b68 Mon Sep 17 00:00:00 2001 From: dynaflash Date: Fri, 27 Jul 2007 15:27:31 +0000 Subject: [PATCH] MacGui: Add a "Source" icon to the toolbar - Replaces the old "Browse" button that was in the Source section of the main window - For now, uses a Disc icon from the icon developer Matt Ball. Should get replaced with something less "Disc-centrict" as we can now use Transport Streams as a source. - Thanks hawman for this one ! git-svn-id: svn://localhost/HandBrake/trunk@750 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- macosx/Controller.mm | 27 +++++++++++++++++++++++---- macosx/HandBrake.xcodeproj/project.pbxproj | 4 ++++ 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/macosx/Controller.mm b/macosx/Controller.mm index fb8d0ad8..e811797b 100644 --- a/macosx/Controller.mm +++ b/macosx/Controller.mm @@ -44,6 +44,7 @@ static NSString* PauseEncodingIdentifier = @"Pause Encoding Item I static NSString* ShowQueueIdentifier = @"Show Queue Item Identifier"; static NSString* AddToQueueIdentifier = @"Add to Queue Item Identifier"; static NSString* DebugOutputIdentifier = @"Debug Output Item Identifier"; +static NSString* ChooseSourceIdentifier = @"Choose Source Item Identifier"; /******************************* * HBController implementation * @@ -400,7 +401,22 @@ static NSString* DebugOutputIdentifier = @"Debug Output Item Identifier" // Tell the item what message to send when it is clicked [toolbarItem setTarget: self]; [toolbarItem setAction: @selector(showDebugOutputPanel:)]; - + + } else if ([itemIdent isEqual: ChooseSourceIdentifier]) { + toolbarItem = [[[NSToolbarItem alloc] initWithItemIdentifier: itemIdent] autorelease]; + + // Set the text label to be displayed in the toolbar and customization palette + [toolbarItem setLabel: @"Source"]; + [toolbarItem setPaletteLabel: @"Source"]; + + // Set up a reasonable tooltip, and image Note, these aren't localized, but you will likely want to localize many of the item's properties + [toolbarItem setToolTip: @"Choose Video Source"]; + [toolbarItem setImage: [NSImage imageNamed: @"Disc"]]; + + // Tell the item what message to send when it is clicked + [toolbarItem setTarget: self]; + [toolbarItem setAction: @selector(ShowScanPanel:)]; + } else { //itemIdent refered to a toolbar item that is not provide or supported by us or cocoa //Returning nil will inform the toolbar this kind of item is not supported @@ -418,7 +434,7 @@ static NSString* DebugOutputIdentifier = @"Debug Output Item Identifier" // Required delegate method: Returns the ordered list of items to be shown in the toolbar by default // If during the toolbar's initialization, no overriding values are found in the user defaults, or if the // user chooses to revert to the default items this set will be used - return [NSArray arrayWithObjects: StartEncodingIdentifier, PauseEncodingIdentifier, NSToolbarSeparatorItemIdentifier, + return [NSArray arrayWithObjects: ChooseSourceIdentifier, NSToolbarSeparatorItemIdentifier, StartEncodingIdentifier, PauseEncodingIdentifier, AddToQueueIdentifier, ShowQueueIdentifier, NSToolbarFlexibleSpaceItemIdentifier, NSToolbarSpaceItemIdentifier, DebugOutputIdentifier, ToggleDrawerIdentifier, nil]; @@ -430,7 +446,7 @@ static NSString* DebugOutputIdentifier = @"Debug Output Item Identifier" // The set of allowed items is used to construct the customization palette return [NSArray arrayWithObjects: StartEncodingIdentifier, PauseEncodingIdentifier, AddToQueueIdentifier, ShowQueueIdentifier, DebugOutputIdentifier, NSToolbarCustomizeToolbarItemIdentifier, - NSToolbarFlexibleSpaceItemIdentifier, NSToolbarSpaceItemIdentifier, + NSToolbarFlexibleSpaceItemIdentifier, NSToolbarSpaceItemIdentifier, NSToolbarSpaceItemIdentifier, ChooseSourceIdentifier, NSToolbarSeparatorItemIdentifier,ToggleDrawerIdentifier, nil]; } @@ -480,7 +496,10 @@ static NSString* DebugOutputIdentifier = @"Debug Output Item Identifier" if ([[toolbarItem itemIdentifier] isEqual: AddToQueueIdentifier]) { enable = AddToQueueButtonEnabled; } - return enable; + if ([[toolbarItem itemIdentifier] isEqual: ChooseSourceIdentifier]) { + enable = YES; + } + return enable; } // register a test notification and make diff --git a/macosx/HandBrake.xcodeproj/project.pbxproj b/macosx/HandBrake.xcodeproj/project.pbxproj index a8f017a4..f84b2488 100644 --- a/macosx/HandBrake.xcodeproj/project.pbxproj +++ b/macosx/HandBrake.xcodeproj/project.pbxproj @@ -121,6 +121,7 @@ A273E0540C57B39A00493A45 /* Terminal.tiff in Resources */ = {isa = PBXBuildFile; fileRef = A273E04D0C57B39A00493A45 /* Terminal.tiff */; }; A273E09A0C57C1CC00493A45 /* muxmkv.c in Sources */ = {isa = PBXBuildFile; fileRef = A273E0950C57C19500493A45 /* muxmkv.c */; }; A273E09B0C57C1CD00493A45 /* muxmkv.c in Sources */ = {isa = PBXBuildFile; fileRef = A273E0950C57C19500493A45 /* muxmkv.c */; }; + A28468680C5A43D900EF9A98 /* Disc.tiff in Resources */ = {isa = PBXBuildFile; fileRef = A28468670C5A43D900EF9A98 /* Disc.tiff */; }; A29E05800BE1283E000533F5 /* Growl.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A29E057F0BE1283E000533F5 /* Growl.framework */; }; A29E058B0BE12889000533F5 /* Growl.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = A29E057F0BE1283E000533F5 /* Growl.framework */; }; EAA526930C3B25D200944FF2 /* stream.c in Sources */ = {isa = PBXBuildFile; fileRef = EAA526920C3B25D200944FF2 /* stream.c */; }; @@ -257,6 +258,7 @@ A273E04C0C57B39A00493A45 /* Stop.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = Stop.tiff; sourceTree = ""; }; A273E04D0C57B39A00493A45 /* Terminal.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = Terminal.tiff; sourceTree = ""; }; A273E0950C57C19500493A45 /* muxmkv.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = muxmkv.c; path = ../libhb/muxmkv.c; sourceTree = SOURCE_ROOT; }; + A28468670C5A43D900EF9A98 /* Disc.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = Disc.tiff; sourceTree = ""; }; A29E057F0BE1283E000533F5 /* Growl.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Growl.framework; sourceTree = ""; }; EAA526920C3B25D200944FF2 /* stream.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = stream.c; path = ../libhb/stream.c; sourceTree = SOURCE_ROOT; }; FC85194C0C59A02C0073812C /* denoise.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = denoise.c; path = ../libhb/denoise.c; sourceTree = SOURCE_ROOT; }; @@ -471,6 +473,7 @@ A273E0460C57B39A00493A45 /* icons */ = { isa = PBXGroup; children = ( + A28468670C5A43D900EF9A98 /* Disc.tiff */, A273E0470C57B39A00493A45 /* Add.tiff */, A273E0480C57B39A00493A45 /* Brushed Window.tiff */, A273E0490C57B39A00493A45 /* Drawer-List2.png */, @@ -656,6 +659,7 @@ A273E0520C57B39A00493A45 /* Play.tiff in Resources */, A273E0530C57B39A00493A45 /* Stop.tiff in Resources */, A273E0540C57B39A00493A45 /* Terminal.tiff in Resources */, + A28468680C5A43D900EF9A98 /* Disc.tiff in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; -- 2.11.0