diff options
author | ritsuka <[email protected]> | 2014-08-29 05:53:33 +0000 |
---|---|---|
committer | ritsuka <[email protected]> | 2014-08-29 05:53:33 +0000 |
commit | c3c7ff9c04f071f41fbe5e9cd041fd00d8157bd4 (patch) | |
tree | 674f2771ad178a4b843bdae473c3186f3a279ba2 /macosx/Controller.m | |
parent | 2e78013f7959223ae37af023f8c9ab041608717e (diff) |
MacGui: set the NSOnState on the selected preset menu item.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6381 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx/Controller.m')
-rw-r--r-- | macosx/Controller.m | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/macosx/Controller.m b/macosx/Controller.m index adbddd880..8c83e358d 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -45,6 +45,7 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It // The current selected preset. @property (nonatomic, retain) HBPreset *selectedPreset; +@property (nonatomic) BOOL customPreset; @end @@ -1475,6 +1476,17 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It else return [fWindow attachedSheet] == nil; } + if (action == @selector(selectPresetFromMenu:)) + { + if (!self.customPreset && [menuItem.representedObject isEqualTo:self.selectedPreset]) + { + [menuItem setState:NSOnState]; + } + else + { + [menuItem setState:NSOffState]; + } + } } return YES; @@ -4539,6 +4551,7 @@ the user is using "Custom" settings by determining the sender*/ [fPresetsView deselect]; /* Change UI to show "Custom" settings are being used */ [fPresetSelectedDisplay setStringValue: @"Custom"]; + self.customPreset = YES; } /* If Auto Naming is on it might need to be update if it includes the quality token */ @@ -5141,23 +5154,11 @@ the user is using "Custom" settings by determining the sender*/ - (IBAction)selectPresetFromMenu:(id)sender { - __block HBPreset *preset = nil; - __block NSInteger i = -1; - - NSInteger tag = [sender tag]; - - [presetManager.root enumerateObjectsUsingBlock:^(id obj, NSIndexPath *idx, BOOL *stop) - { - if (i == tag) - { - preset = obj; - *stop = YES; - } - i++; - }]; + // Retrieve the preset stored in the NSMenuItem + HBPreset *preset = [sender representedObject]; [self applyPreset:preset]; - [fPresetsView setSelection:_selectedPreset]; + [fPresetsView setSelection:preset]; } /** @@ -5192,6 +5193,7 @@ the user is using "Custom" settings by determining the sender*/ if ([obj isLeaf]) { item.action = @selector(selectPresetFromMenu:); + item.representedObject = obj; } // Make the default preset font bold. if ([obj isDefault]) |