#import "HBQueueController.h"
#import "MVMenuButton.h"
#import "HBAdvancedController.h"
+#import "HBPreferencesController.h"
@class HBOutputPanelController;
HBAdvancedController * fAdvancedOptions;
IBOutlet NSBox * fAdvancedView;
+ HBPreferencesController * fPreferencesController;
+
/* Queue panel */
HBQueueController * fQueueController;
IBOutlet NSTextField * fQueueStatus;
- (IBAction) Pause: (id) sender;
- (IBAction) calculateBitrate: (id) sender;
-- (void) controlTextDidBeginEditing: (NSNotification *) notification;
-- (void) controlTextDidEndEditing: (NSNotification *) notification;
- (void) controlTextDidChange: (NSNotification *) notification;
- (IBAction) openHomepage: (id) sender;
fPictureController = [[PictureController alloc] initWithDelegate:self];
fQueueController = [[HBQueueController alloc] init];
fAdvancedOptions = [[HBAdvancedController alloc] init];
+ fPreferencesController = [[HBPreferencesController alloc] init];
return self;
}
}
[self qualitySliderChanged: sender];
- [self calculateBitrate: sender];
+ [self calculateBitrate: sender];
[self customSettingUsed: sender];
}
{
hb_list_t * list = hb_get_titles( fHandle );
hb_title_t * title = (hb_title_t*)
- hb_list_item( list, [fSrcTitlePopUp indexOfSelectedItem] );
+ hb_list_item( list, [fSrcTitlePopUp indexOfSelectedItem] );
/* If Auto Naming is on. We create an output filename of dvd name - title number */
_( @"AVC/H.264 Video / MP3 Audio" )];
[fDstCodecsPopUp addItemWithTitle:
_( @"AVC/H.264 Video / Vorbis Audio" )];
- /* We disable the create chapters checkbox here since we are NOT .mp4
- and make sure it is unchecked*/
+ /* We enable the create chapters checkbox here since */
[fCreateChapterMarkers setEnabled: YES];
break;
}
[fVidBitrateField setIntValue: hb_calc_bitrate( job,
[fVidTargetSizeField intValue] )];
-
- [self customSettingUsed:sender];
}
/* Method to determine if we should change the UI
}
-- (void) controlTextDidBeginEditing: (NSNotification *) notification
-{
- [self calculateBitrate: NULL];
-}
-
-- (void) controlTextDidEndEditing: (NSNotification *) notification
-{
- [self calculateBitrate: NULL];
-}
-
- (void) controlTextDidChange: (NSNotification *) notification
{
[self calculateBitrate: NULL];
}
/**
- * Creates preferences controller, shows preferences window modally, and
- * releases the controller after user has closed the window.
+ * Shows preferences window modally.
*/
-- (IBAction)showPreferencesWindow:(id)sender
+- (IBAction) showPreferencesWindow: (id) sender
{
- HBPreferencesController *controller = [[HBPreferencesController alloc] init];
- [controller runModal:nil];
- [controller release];
+ NSWindow * window = [fPreferencesController window];
+ if (![window isVisible])
+ [window center];
+
+ [window makeKeyAndOrderFront: nil];
}
/**
ACTIONS = {close = id; runModal = id; };
CLASS = HBPreferencesController;
LANGUAGE = ObjC;
+ OUTLETS = {
+ fAdvancedView = NSView;
+ fAudioView = NSView;
+ fGeneralView = NSView;
+ fPictureView = NSView;
+ };
SUPERCLASS = NSWindowController;
}
);
<plist version="1.0">
<dict>
<key>IBDocumentLocation</key>
- <string>84 122 674 609 0 0 1440 878 </string>
+ <string>202 77 589 436 0 0 1440 878 </string>
+ <key>IBEditorPositions</key>
+ <dict>
+ <key>233</key>
+ <string>506 481 468 208 0 0 1440 878 </string>
+ <key>234</key>
+ <string>529 520 421 130 0 0 1440 878 </string>
+ <key>235</key>
+ <string>490 525 499 119 0 0 1440 878 </string>
+ <key>236</key>
+ <string>361 513 456 172 0 0 1440 878 </string>
+ </dict>
<key>IBFramework Version</key>
<string>446.1</string>
- <key>IBOpenObjects</key>
- <array>
- <integer>5</integer>
- </array>
<key>IBSystem Version</key>
<string>8R2218</string>
</dict>
@interface HBPreferencesController : NSWindowController
{
+ IBOutlet NSView * fGeneralView, * fPictureView, * fAudioView, * fAdvancedView;
}
+ (void)registerUserDefaults;
- (id)init;
-- (IBAction)runModal:(id)sender;
- (IBAction)close:(id)sender;
@end
*/
#import "HBPreferencesController.h"
+#define TOOLBAR_GENERAL @"TOOLBAR_GENERAL"
+#define TOOLBAR_PICTURE @"TOOLBAR_PICTURE"
+#define TOOLBAR_AUDIO @"TOOLBAR_AUDIO"
+#define TOOLBAR_ADVANCED @"TOOLBAR_ADVANCED"
/**
* This class controls the preferences window of HandBrake. Default values for
* no getter/setter code is needed in this file (unless more complicated
* preference settings are added that cannot be handled with Cocoa bindings).
*/
+
+@interface HBPreferencesController (Private)
+
+- (void) setPrefView: (id) sender;
+
+@end
+
@implementation HBPreferencesController
/**
@"NO", @"ShowVerboseOutput",
@"NO", @"AllowLargeFiles",
@"NO", @"DisableDvdAutoDetect",
- @"Alert Window", @"AlertWhenDone",
+ @"Alert Window", @"AlertWhenDone",
nil]];
}
return self;
}
-/**
- * Shows the preferences window in modal state.
- */
-- (IBAction)runModal:(id)sender
+- (void) awakeFromNib
{
- [NSApp runModalForWindow:[self window]];
+ NSToolbar * toolbar = [[NSToolbar alloc] initWithIdentifier: @"Preferences Toolbar"];
+ [toolbar setDelegate: self];
+ [toolbar setAllowsUserCustomization: NO];
+ [toolbar setDisplayMode: NSToolbarDisplayModeIconAndLabel];
+ [toolbar setSizeMode: NSToolbarSizeModeRegular];
+ [[self window] setToolbar: toolbar];
+
+ [toolbar setSelectedItemIdentifier: TOOLBAR_GENERAL];
+ [self setPrefView:nil];
+}
+
+- (NSToolbarItem *) toolbar: (NSToolbar *) toolbar itemForItemIdentifier: (NSString *) ident
+ willBeInsertedIntoToolbar: (BOOL) flag
+{
+ NSToolbarItem * item;
+ item = [[NSToolbarItem alloc] initWithItemIdentifier: ident];
+
+ if ([ident isEqualToString: TOOLBAR_GENERAL])
+ {
+ [item setLabel: NSLocalizedString(@"General", "General")];
+ [item setImage: [NSImage imageNamed: @"Preferences.png"]];
+ [item setTarget: self];
+ [item setAction: @selector(setPrefView:)];
+ [item setAutovalidates: NO];
+ }
+ else if ([ident isEqualToString: TOOLBAR_PICTURE])
+ {
+ [item setLabel: NSLocalizedString(@"Picture", "Picture")];
+// [item setImage: [NSImage imageNamed: @"???.png"]];
+ [item setTarget: self];
+ [item setAction: @selector(setPrefView:)];
+ [item setAutovalidates: NO];
+ }
+ else if ([ident isEqualToString: TOOLBAR_AUDIO])
+ {
+ [item setLabel: NSLocalizedString(@"Audio", "Audio")];
+ // [item setImage: [NSImage imageNamed: @"???.png"]];
+ [item setTarget: self];
+ [item setAction: @selector(setPrefView:)];
+ [item setAutovalidates: NO];
+ }
+ else if ([ident isEqualToString: TOOLBAR_ADVANCED])
+ {
+ [item setLabel: NSLocalizedString(@"Advanced", "Advanced")];
+ // [item setImage: [NSImage imageNamed: @"???.png"]];
+ [item setTarget: self];
+ [item setAction: @selector(setPrefView:)];
+ [item setAutovalidates: NO];
+ }
+ else
+ {
+ [item release];
+ return nil;
+ }
+
+ return item;
+}
+
+- (NSArray *) toolbarSelectableItemIdentifiers: (NSToolbar *) toolbar
+{
+ return [self toolbarDefaultItemIdentifiers: toolbar];
+}
+
+- (NSArray *) toolbarDefaultItemIdentifiers: (NSToolbar *) toolbar
+{
+ return [self toolbarAllowedItemIdentifiers: toolbar];
+}
+
+- (NSArray *) toolbarAllowedItemIdentifiers: (NSToolbar *) toolbar
+{
+ return [NSArray arrayWithObjects: TOOLBAR_GENERAL, TOOLBAR_PICTURE,
+ TOOLBAR_AUDIO, TOOLBAR_ADVANCED, nil];
}
/**
*/
- (IBAction)close:(id)sender
{
- [[self window] endEditingFor:nil];
- [[self window] orderOut:sender];
- [NSApp stopModal];
+ //[self makeFirstResponder: nil];
+}
+
+@end
+
+@implementation HBPreferencesController (Private)
+
+- (void) setPrefView: (id) sender
+{
+ NSView * view = fGeneralView;
+ if (sender)
+ {
+ NSString * identifier = [sender itemIdentifier];
+ if ([identifier isEqualToString: TOOLBAR_PICTURE])
+ view = fPictureView;
+ else if ([identifier isEqualToString: TOOLBAR_AUDIO])
+ view = fAudioView;
+ else if ([identifier isEqualToString: TOOLBAR_ADVANCED])
+ view = fAdvancedView;
+ else;
+ }
+
+ NSWindow * window = [self window];
+ if ([window contentView] == view)
+ return;
+
+ NSRect windowRect = [window frame];
+ float difference = ([view frame].size.height - [[window contentView] frame].size.height) * [window userSpaceScaleFactor];
+ windowRect.origin.y -= difference;
+ windowRect.size.height += difference;
+
+ [view setHidden: YES];
+ [window setContentView: view];
+ [window setFrame: windowRect display: YES animate: YES];
+ [view setHidden: NO];
+
+ //set title label
+ if (sender)
+ [window setTitle: [sender label]];
+ else
+ {
+ NSToolbar * toolbar = [window toolbar];
+ NSString * itemIdentifier = [toolbar selectedItemIdentifier];
+ NSEnumerator * enumerator = [[toolbar items] objectEnumerator];
+ NSToolbarItem * item;
+ while ((item = [enumerator nextObject]))
+ if ([[item itemIdentifier] isEqualToString: itemIdentifier])
+ {
+ [window setTitle: [item label]];
+ break;
+ }
+ }
}
@end
A9AC41DF0C918DB500DDF9B8 /* HBAdvancedController.m in Sources */ = {isa = PBXBuildFile; fileRef = A9AC41DD0C918DB500DDF9B8 /* HBAdvancedController.m */; };
A9AC41E00C918DB500DDF9B8 /* HBAdvancedController.h in Headers */ = {isa = PBXBuildFile; fileRef = A9AC41DE0C918DB500DDF9B8 /* HBAdvancedController.h */; };
A9AC41E70C918DC000DDF9B8 /* AdvancedView.nib in Resources */ = {isa = PBXBuildFile; fileRef = A9AC41E50C918DC000DDF9B8 /* AdvancedView.nib */; };
+ A9B4CEC80C95752B0086548A /* Preferences.png in Resources */ = {isa = PBXBuildFile; fileRef = A9B4CEC70C95752B0086548A /* Preferences.png */; };
B48359A80C82960500E04440 /* lang.c in Sources */ = {isa = PBXBuildFile; fileRef = B48359A70C82960500E04440 /* lang.c */; };
D4D49FED0C83355600F01215 /* lang.c in Sources */ = {isa = PBXBuildFile; fileRef = B48359A70C82960500E04440 /* lang.c */; };
E3003C7F0C88505D0072F2A8 /* DeleteHighlightPressed.png in Resources */ = {isa = PBXBuildFile; fileRef = E3003C7E0C88505D0072F2A8 /* DeleteHighlightPressed.png */; };
A9AC41DD0C918DB500DDF9B8 /* HBAdvancedController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = HBAdvancedController.m; sourceTree = "<group>"; };
A9AC41DE0C918DB500DDF9B8 /* HBAdvancedController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HBAdvancedController.h; sourceTree = "<group>"; };
A9AC41E60C918DC000DDF9B8 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/AdvancedView.nib; sourceTree = "<group>"; };
+ A9B4CEC70C95752B0086548A /* Preferences.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Preferences.png; sourceTree = "<group>"; };
B48359A70C82960500E04440 /* lang.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = lang.c; path = ../libhb/lang.c; sourceTree = SOURCE_ROOT; };
E3003C7E0C88505D0072F2A8 /* DeleteHighlightPressed.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = DeleteHighlightPressed.png; sourceTree = "<group>"; };
E3003CB40C8852B70072F2A8 /* DeletePressed.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = DeletePressed.png; sourceTree = "<group>"; };
29B97314FDCFA39411CA2CEA /* HandBrake */ = {
isa = PBXGroup;
children = (
- A273E0460C57B39A00493A45 /* icons */,
526FBC940B4CAA310064E04C /* Instant HandBrake Sources */,
526FBC930B4CAA260064E04C /* HandBrake Sources */,
526FBC920B4CAA120064E04C /* HandBrakeCLI Sources */,
29B97317FDCFA39411CA2CEA /* Resources */ = {
isa = PBXGroup;
children = (
+ A273E0460C57B39A00493A45 /* icons */,
0DFA5C7A0B8DD1E90020BC09 /* HandBrake.icns */,
29B97318FDCFA39411CA2CEA /* MainMenu.nib */,
A9ABA2250C92AECA00D98324 /* PictureSettings.nib */,
A273E0460C57B39A00493A45 /* icons */ = {
isa = PBXGroup;
children = (
+ A9B4CEC70C95752B0086548A /* Preferences.png */,
A2DFC66C0C6196D900E66E89 /* actionWidget.png */,
A2DFC66D0C6196D900E66E89 /* actionWidgetPressed.png */,
A28468670C5A43D900EF9A98 /* Disc.tiff */,
A9AC41E70C918DC000DDF9B8 /* AdvancedView.nib in Resources */,
A97A1DB40C91A6800015BC08 /* Express.nib in Resources */,
A9ABA2270C92AECA00D98324 /* PictureSettings.nib in Resources */,
+ A9B4CEC80C95752B0086548A /* Preferences.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};