]> granicus.if.org Git - handbrake/commitdiff
MacGui: add a divider in the menu after the last built in preset and make the default...
authorritsuka <damiog@gmail.com>
Sat, 9 Aug 2014 18:43:28 +0000 (18:43 +0000)
committerritsuka <damiog@gmail.com>
Sat, 9 Aug 2014 18:43:28 +0000 (18:43 +0000)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6279 b64f7644-9d1e-0410-96f1-a4d463321fa5

macosx/Controller.m
macosx/HBPresetsManager.m

index 2f14dae3622aa61ad0d734ef04df992f695e3945..4017113db405341fc3837e2f539def68098c3870 100644 (file)
@@ -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];
index 4cf1b3a76959b29b92b9c01ea994816d10d76683..c8dc9b797f8606cf4fc11ea32efa648ab143aef9 100644 (file)
@@ -325,6 +325,8 @@ NSString *HBPresetsChangedNotification = @"HBPresetsChangedNotification";
         }
         defaultPreset.isDefault = YES;
         _defaultPreset = [defaultPreset retain];
+
+        [self nodeDidChange];
     }
 }