summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
Diffstat (limited to 'macosx')
-rw-r--r--macosx/Controller.m32
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])