summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
authorritsuka <[email protected]>2014-08-09 18:43:28 +0000
committerritsuka <[email protected]>2014-08-09 18:43:28 +0000
commitd180a1aea8a0141851adf00802bd846777d2b6f1 (patch)
tree3e54342b05170acaac93a972e23cb05968abd128 /macosx
parent666e210efe202dc13273dd32de1b1901e194e4ce (diff)
MacGui: add a divider in the menu after the last built in preset and make the default preset bold.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6279 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx')
-rw-r--r--macosx/Controller.m21
-rw-r--r--macosx/HBPresetsManager.m2
2 files changed, 22 insertions, 1 deletions
diff --git a/macosx/Controller.m b/macosx/Controller.m
index 2f14dae36..4017113db 100644
--- a/macosx/Controller.m
+++ b/macosx/Controller.m
@@ -5381,8 +5381,9 @@ the user is using "Custom" settings by determining the sender*/
*/
- (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)
@@ -5393,6 +5394,7 @@ the user is using "Custom" settings by determining the sender*/
[menuItems release];
__block NSUInteger i = 0;
+ __block BOOL builtInEnded = NO;
[presetManager.root enumerateObjectsUsingBlock:^(id obj, NSIndexPath *idx, BOOL *stop)
{
if (idx.length)
@@ -5401,10 +5403,27 @@ the user is using "Custom" settings by determining the sender*/
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:);
}
+ // 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];
diff --git a/macosx/HBPresetsManager.m b/macosx/HBPresetsManager.m
index 4cf1b3a76..c8dc9b797 100644
--- a/macosx/HBPresetsManager.m
+++ b/macosx/HBPresetsManager.m
@@ -325,6 +325,8 @@ NSString *HBPresetsChangedNotification = @"HBPresetsChangedNotification";
}
defaultPreset.isDefault = YES;
_defaultPreset = [defaultPreset retain];
+
+ [self nodeDidChange];
}
}