summaryrefslogtreecommitdiffstats
path: root/macosx/HBAudioController.m
diff options
context:
space:
mode:
Diffstat (limited to 'macosx/HBAudioController.m')
-rw-r--r--macosx/HBAudioController.m19
1 files changed, 15 insertions, 4 deletions
diff --git a/macosx/HBAudioController.m b/macosx/HBAudioController.m
index ca051c9da..5baf50a06 100644
--- a/macosx/HBAudioController.m
+++ b/macosx/HBAudioController.m
@@ -7,6 +7,7 @@
#import "HBAudioController.h"
#import "HBAudio.h"
+#import "HBAudioDefaults.h"
#import "HBAudioDefaultsController.h"
@interface HBAudioController ()
@@ -42,17 +43,27 @@
- (IBAction)showSettingsSheet:(id)sender
{
- self.defaultsController = [[HBAudioDefaultsController alloc] initWithSettings:self.audio.defaults];
+ HBAudioDefaults *defaults = [self.audio.defaults copy];
+ self.defaultsController = [[HBAudioDefaultsController alloc] initWithSettings:defaults];
[NSApp beginSheet:self.defaultsController.window
modalForWindow:self.view.window
modalDelegate:self
- didEndSelector:@selector(sheetDidEnd)
- contextInfo:NULL];
+ didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:)
+ contextInfo:(void *)CFBridgingRetain(defaults)];
}
-- (void)sheetDidEnd
+- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
{
+ HBAudioDefaults *defaults = (HBAudioDefaults *)CFBridgingRelease(contextInfo);
+
+ // If things changed, do this ugly
+ // operation to group the changes for the undo manager.
+ if (returnCode)
+ {
+ defaults.undo = self.audio.defaults.undo;
+ self.audio.defaults = defaults;
+ }
self.defaultsController = nil;
}