summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
authorDamiano Galassi <[email protected]>2016-01-15 19:44:27 +0100
committerDamiano Galassi <[email protected]>2016-01-15 19:44:27 +0100
commit6ad1d603b266319d97a69fd53dcf3eeab88bde63 (patch)
tree092ff4ace3b65fe81c16b4f37a6f7d86cd81ee47 /macosx
parentea41fc2983591d73e1aa6d817f646bf5679060b7 (diff)
MacGui: pass the main window undomanager to the preview window.
Diffstat (limited to 'macosx')
-rw-r--r--macosx/HBController.m3
-rw-r--r--macosx/HBPictureController.h1
-rw-r--r--macosx/HBPictureController.m5
-rw-r--r--macosx/HBPreviewController.h3
-rw-r--r--macosx/HBPreviewController.m30
5 files changed, 41 insertions, 1 deletions
diff --git a/macosx/HBController.m b/macosx/HBController.m
index 2c6595380..53820dbf7 100644
--- a/macosx/HBController.m
+++ b/macosx/HBController.m
@@ -132,6 +132,7 @@
// Inits the controllers
fPreviewController = [[HBPreviewController alloc] init];
+ fPreviewController.documentController = self;
fQueueController = queueController;
fQueueController.controller = self;
@@ -415,7 +416,7 @@
- (BOOL)validateMenuItem:(NSMenuItem *)menuItem
{
- SEL action = [menuItem action];
+ SEL action = menuItem.action;
if (action == @selector(addToQueue:) || action == @selector(addAllTitlesToQueue:) ||
action == @selector(addTitlesToQueue:) || action == @selector(showAddPresetPanel:))
diff --git a/macosx/HBPictureController.h b/macosx/HBPictureController.h
index 1901420a5..577937dfd 100644
--- a/macosx/HBPictureController.h
+++ b/macosx/HBPictureController.h
@@ -11,5 +11,6 @@
@interface HBPictureController : NSWindowController <NSWindowDelegate>
@property (nonatomic, readwrite, strong) HBPicture *picture;
+@property (nonatomic, readwrite, assign) NSWindowController *previewController;
@end
diff --git a/macosx/HBPictureController.m b/macosx/HBPictureController.m
index 8dee13187..b6fed1f28 100644
--- a/macosx/HBPictureController.m
+++ b/macosx/HBPictureController.m
@@ -72,6 +72,11 @@ static void *HBPictureControllerContext = &HBPictureControllerContext;
[self adjustSizingDisplay:nil];
}
+- (NSUndoManager *)windowWillReturnUndoManager:(NSWindow *)window
+{
+ return self.previewController.window.undoManager;
+}
+
#pragma mark - KVO
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
diff --git a/macosx/HBPreviewController.h b/macosx/HBPreviewController.h
index ccef18cd1..ca0cdefbc 100644
--- a/macosx/HBPreviewController.h
+++ b/macosx/HBPreviewController.h
@@ -8,10 +8,13 @@
@class HBPreviewGenerator;
@class HBPicture;
+@class HBController;
@interface HBPreviewController : NSWindowController <NSWindowDelegate>
@property (nonatomic, strong) HBPreviewGenerator *generator;
@property (nonatomic, strong) HBPicture *picture;
+@property (nonatomic, assign) HBController *documentController;
+
@end
diff --git a/macosx/HBPreviewController.m b/macosx/HBPreviewController.m
index d9c7b055d..974173d52 100644
--- a/macosx/HBPreviewController.m
+++ b/macosx/HBPreviewController.m
@@ -10,6 +10,8 @@
#import "HBPreviewView.h"
+#import "HBController.h"
+
#import <QTKit/QTKit.h>
#import "QTKit+HBQTMovieExtensions.h"
@@ -141,6 +143,33 @@ typedef enum ViewMode : NSUInteger {
[_generator cancel];
}
+- (BOOL)validateMenuItem:(NSMenuItem *)menuItem
+{
+ SEL action = menuItem.action;
+
+ if (action == @selector(selectPresetFromMenu:))
+ {
+ return [self.documentController validateMenuItem:menuItem];
+ }
+
+ return YES;
+}
+
+- (IBAction)selectDefaultPreset:(id)sender
+{
+ [self.documentController selectDefaultPreset:sender];
+}
+
+- (NSUndoManager *)windowWillReturnUndoManager:(NSWindow *)window
+{
+ return self.documentController.window.undoManager;
+}
+
+- (IBAction)selectPresetFromMenu:(id)sender
+{
+ [self.documentController selectPresetFromMenu:sender];
+}
+
- (void)setPicture:(HBPicture *)picture
{
_picture = picture;
@@ -641,6 +670,7 @@ typedef enum ViewMode : NSUInteger {
if (self.pictureSettingsWindow == nil)
{
self.pictureSettingsWindow = [[HBPictureController alloc] init];
+ self.pictureSettingsWindow.previewController = self;
}
self.pictureSettingsWindow.picture = self.picture;