// Inits the controllers
fPreviewController = [[HBPreviewController alloc] init];
+ fPreviewController.documentController = self;
fQueueController = queueController;
fQueueController.controller = self;
- (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:))
@interface HBPictureController : NSWindowController <NSWindowDelegate>
@property (nonatomic, readwrite, strong) HBPicture *picture;
+@property (nonatomic, readwrite, assign) NSWindowController *previewController;
@end
[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
@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
#import "HBPreviewView.h"
+#import "HBController.h"
+
#import <QTKit/QTKit.h>
#import "QTKit+HBQTMovieExtensions.h"
[_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;
if (self.pictureSettingsWindow == nil)
{
self.pictureSettingsWindow = [[HBPictureController alloc] init];
+ self.pictureSettingsWindow.previewController = self;
}
self.pictureSettingsWindow.picture = self.picture;