summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
authordynaflash <[email protected]>2008-12-15 15:11:49 +0000
committerdynaflash <[email protected]>2008-12-15 15:11:49 +0000
commit45e2e58bed396259f939f7482d6e7eec31b1a351 (patch)
tree1be6427f405edcd0c85830c6c39fe14bb3b32c2a /macosx
parent0137a81794777bc60e5dd34ea1af2b8336971a9d (diff)
MacGui: Picture window now uses a subclass of HBController to access the main controller.
- fixed issue where preview movie keeps playing even if the picture window is closed - Removed deprecated -ClosePanel method since we now use the windows native close button. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2033 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx')
-rw-r--r--macosx/Controller.h4
-rw-r--r--macosx/Controller.mm15
-rw-r--r--macosx/English.lproj/MainMenu.xib2
-rw-r--r--macosx/English.lproj/PictureSettings.xib32
-rw-r--r--macosx/PictureController.h16
-rw-r--r--macosx/PictureController.mm62
6 files changed, 85 insertions, 46 deletions
diff --git a/macosx/Controller.h b/macosx/Controller.h
index 5ab03c60b..e05b0afd8 100644
--- a/macosx/Controller.h
+++ b/macosx/Controller.h
@@ -15,6 +15,7 @@
#import "HBAdvancedController.h"
#import "HBPreferencesController.h"
#import "HBPresets.h"
+
@class HBOutputPanelController;
/* We subclass NSView so that our drags show both the icon as well as PresetName columns */
@@ -102,7 +103,7 @@ BOOL fIsDragging;
IBOutlet NSButton * fVidTurboPassCheck;
/* Picture Settings box */
- IBOutlet NSTextField * fPicLabelSettings;
+ IBOutlet NSTextField * fPicLabelSettings;
IBOutlet NSTextField * fPicLabelSrc;
IBOutlet NSTextField * fPicSettingsSrc;
IBOutlet NSTextField * fPicLabelOutp;
@@ -298,6 +299,7 @@ BOOL fIsDragging;
- (IBAction) audioDRCSliderChanged: (id) sender;
- (IBAction) showPicturePanel: (id) sender;
+- (void)pictureSettingsDidChange;
- (IBAction) calculatePictureSizing: (id) sender;
- (IBAction) openMainWindow: (id) sender;
diff --git a/macosx/Controller.mm b/macosx/Controller.mm
index 0bf28c766..cf5ad3057 100644
--- a/macosx/Controller.mm
+++ b/macosx/Controller.mm
@@ -60,7 +60,7 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It
attributes:nil];
}
outputPanel = [[HBOutputPanelController alloc] init];
- fPictureController = [[PictureController alloc] initWithDelegate:self];
+ fPictureController = [[PictureController alloc] init];
fQueueController = [[HBQueueController alloc] init];
fAdvancedOptions = [[HBAdvancedController alloc] init];
/* we init the HBPresets class which currently is only used
@@ -89,6 +89,7 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It
[GrowlApplicationBridge setGrowlDelegate: self];
/* Init others controllers */
[fPictureController SetHandle: fHandle];
+ [fPictureController setHBController: self];
[fQueueController setHandle: fQueueEncodeLibhb];
[fQueueController setHBController: self];
@@ -239,6 +240,7 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It
[browsedSourceDisplayName release];
[outputPanel release];
[fQueueController release];
+ [fPictureController release];
hb_close(&fHandle);
hb_close(&fQueueEncodeLibhb);
}
@@ -4102,7 +4104,8 @@ the user is using "Custom" settings by determining the sender*/
* Registers changes made in the Picture Settings Window.
*/
-- (void)pictureSettingsDidChange {
+- (void)pictureSettingsDidChange
+{
[self calculatePictureSizing:nil];
}
@@ -5146,11 +5149,13 @@ the user is using "Custom" settings by determining the sender*/
- (IBAction) showPicturePanel: (id) sender
{
- hb_list_t * list = hb_get_titles( fHandle );
+ /*
+ hb_list_t * list = hb_get_titles( fHandle );
hb_title_t * title = (hb_title_t *) hb_list_item( list,
[fSrcTitlePopUp indexOfSelectedItem] );
- //[fPictureController SetTitle:title];
- [fPictureController showPreviewPanel:sender forTitle:title];
+ */
+ //[fPictureController showPreviewPanel:sender forTitle:title];
+ [fPictureController showPictureWindow:sender];
}
#pragma mark -
diff --git a/macosx/English.lproj/MainMenu.xib b/macosx/English.lproj/MainMenu.xib
index d910dda87..aa14d9342 100644
--- a/macosx/English.lproj/MainMenu.xib
+++ b/macosx/English.lproj/MainMenu.xib
@@ -11528,7 +11528,6 @@
<string>fPicSettingsAnamorphic</string>
<string>fPicSettingsOutp</string>
<string>fPicSettingsSrc</string>
- <string>fPictureButton</string>
<string>fPresetDrawer</string>
<string>fPresetNewDesc</string>
<string>fPresetNewFolderCheck</string>
@@ -11653,7 +11652,6 @@
<string>NSTextField</string>
<string>NSTextField</string>
<string>NSTextField</string>
- <string>NSButton</string>
<string>NSDrawer</string>
<string>NSTextField</string>
<string>NSButton</string>
diff --git a/macosx/English.lproj/PictureSettings.xib b/macosx/English.lproj/PictureSettings.xib
index 68ea6c435..d57a6657a 100644
--- a/macosx/English.lproj/PictureSettings.xib
+++ b/macosx/English.lproj/PictureSettings.xib
@@ -8,7 +8,7 @@
<string key="IBDocument.HIToolboxVersion">352.00</string>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="23"/>
+ <integer value="5"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -1670,6 +1670,14 @@ AAB0ZXh0AAAAAENvcHlyaWdodCBBcHBsZSBDb21wdXRlciwgSW5jLiwgMjAwNQAAAAA</bytes>
</object>
<int key="connectionID">239</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">fPictureWindow</string>
+ <reference key="source" ref="355312334"/>
+ <reference key="destination" ref="616825745"/>
+ </object>
+ <int key="connectionID">240</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -2705,10 +2713,10 @@ AAB0ZXh0AAAAAENvcHlyaWdodCBBcHBsZSBDb21wdXRlciwgSW5jLiwgMjAwNQAAAAA</bytes>
<reference ref="9"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
- <string>{{497, 299}, {484, 557}}</string>
+ <string>{{491, 299}, {484, 557}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
- <string>{{497, 299}, {484, 557}}</string>
+ <string>{{491, 299}, {484, 557}}</string>
<reference ref="9"/>
<string>{{221, 276}, {533, 580}}</string>
<reference ref="9"/>
@@ -2747,7 +2755,7 @@ AAB0ZXh0AAAAAENvcHlyaWdodCBBcHBsZSBDb21wdXRlciwgSW5jLiwgMjAwNQAAAAA</bytes>
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">239</int>
+ <int key="maxID">240</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -2762,13 +2770,6 @@ AAB0ZXh0AAAAAENvcHlyaWdodCBBcHBsZSBDb21wdXRlciwgSW5jLiwgMjAwNQAAAAA</bytes>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier" id="251078365">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">PictureController.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBUserSource</string>
<string key="minorKey"/>
@@ -2788,6 +2789,7 @@ AAB0ZXh0AAAAAENvcHlyaWdodCBBcHBsZSBDb21wdXRlciwgSW5jLiwgMjAwNQAAAAA</bytes>
<string>pictureSliderChanged:</string>
<string>previewDurationPopUpChanged:</string>
<string>showMoviePreview:</string>
+ <string>showPictureWindow:</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -2798,6 +2800,7 @@ AAB0ZXh0AAAAAENvcHlyaWdodCBBcHBsZSBDb21wdXRlciwgSW5jLiwgMjAwNQAAAAA</bytes>
<string>id</string>
<string>id</string>
<string>NSString</string>
+ <string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="outlets">
@@ -2831,6 +2834,7 @@ AAB0ZXh0AAAAAENvcHlyaWdodCBBcHBsZSBDb21wdXRlciwgSW5jLiwgMjAwNQAAAAA</bytes>
<string>fPictureSlider</string>
<string>fPictureView</string>
<string>fPictureViewArea</string>
+ <string>fPictureWindow</string>
<string>fPreviewMovieLengthPopUp</string>
<string>fPreviewMovieStatusField</string>
<string>fRatioCheck</string>
@@ -2867,6 +2871,7 @@ AAB0ZXh0AAAAAENvcHlyaWdodCBBcHBsZSBDb21wdXRlciwgSW5jLiwgMjAwNQAAAAA</bytes>
<string>NSSlider</string>
<string>NSImageView</string>
<string>NSBox</string>
+ <string>NSWindow</string>
<string>NSPopUpButton</string>
<string>NSTextField</string>
<string>NSButton</string>
@@ -2875,7 +2880,10 @@ AAB0ZXh0AAAAAENvcHlyaWdodCBBcHBsZSBDb21wdXRlciwgSW5jLiwgMjAwNQAAAAA</bytes>
<string>NSStepper</string>
</object>
</object>
- <reference key="sourceIdentifier" ref="251078365"/>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">PictureController.h</string>
+ </object>
</object>
<object class="IBPartialClassDescription">
<string key="className">PictureController</string>
diff --git a/macosx/PictureController.h b/macosx/PictureController.h
index 631a1d11c..6c6eef765 100644
--- a/macosx/PictureController.h
+++ b/macosx/PictureController.h
@@ -10,6 +10,8 @@
/* Needed for Quicktime movie previews */
#import <QTKit/QTKit.h>
+@class HBController;
+
#define HB_NUM_HBLIB_PICTURES 20 // # of preview pictures libhb should generate
@interface PictureController : NSWindowController
@@ -17,6 +19,8 @@
hb_handle_t * fHandle;
hb_title_t * fTitle;
+ HBController *fHBController; // reference to HBController
+ IBOutlet NSWindow * fPictureWindow;
NSMutableDictionary * fPicturePreviews; // NSImages, one for each preview libhb creates, created lazily
int fPicture;
@@ -81,10 +85,13 @@
IBOutlet QTMovieView * fMovieView;
IBOutlet NSPopUpButton * fPreviewMovieLengthPopUp; // popup of choices for length of preview in seconds
}
-- (id)initWithDelegate:(id)del;
+- (id)init;
- (void) SetHandle: (hb_handle_t *) handle;
- (void) SetTitle: (hb_title_t *) title;
+- (void)setHBController: (HBController *)controller;
+- (IBAction) showPictureWindow: (id)sender;
+
- (void) setInitialPictureFilters;
- (void) displayPreview;
@@ -100,9 +107,6 @@
- (IBAction) showMoviePreview: (NSString *) path;
- (IBAction) previewDurationPopUpChanged: (id) sender;
-
-- (IBAction) ClosePanel: (id) sender;
-
- (BOOL) autoCrop;
- (void) setAutoCrop: (BOOL) setting;
@@ -130,7 +134,3 @@
- (void) purgeImageCache;
@end
-@interface NSObject (PictureControllertDelegateMethod)
-- (void)pictureSettingsDidChange;
-- (void)prepareJobForPreview;
-@end
diff --git a/macosx/PictureController.mm b/macosx/PictureController.mm
index 08d5c3e8e..8d61f562e 100644
--- a/macosx/PictureController.mm
+++ b/macosx/PictureController.mm
@@ -5,6 +5,7 @@
It may be used under the terms of the GNU General Public License. */
#import "PictureController.h"
+#import "Controller.h"
@interface PictureController (Private)
@@ -17,7 +18,7 @@
@implementation PictureController
-- (id)initWithDelegate:(id)del
+- (id)init
{
if (self = [super initWithWindowNibName:@"PictureSettings"])
{
@@ -31,8 +32,7 @@
// go away.
[self window];
- delegate = del;
- fPicturePreviews = [[NSMutableDictionary dictionaryWithCapacity: HB_NUM_HBLIB_PICTURES] retain];
+ fPicturePreviews = [[NSMutableDictionary dictionaryWithCapacity: HB_NUM_HBLIB_PICTURES] retain];
/* Init libhb with check for updates libhb style set to "0" so its ignored and lets sparkle take care of it */
int loggingLevel = [[[NSUserDefaults standardUserDefaults] objectForKey:@"LoggingLevel"] intValue];
fPreviewLibhb = hb_init(loggingLevel, 0);
@@ -40,6 +40,40 @@
return self;
}
+//------------------------------------------------------------------------------------
+// Displays and brings the picture window to the front
+//------------------------------------------------------------------------------------
+- (IBAction) showPictureWindow: (id)sender
+{
+ [self showWindow:sender];
+}
+
+- (void)setHBController: (HBController *)controller
+{
+ fHBController = controller;
+}
+
+- (void)awakeFromNib
+{
+ [fPictureWindow setDelegate:self];
+}
+
+
+- (void)windowWillClose:(NSNotification *)aNotification
+{
+ /* Upon Closing the picture window, we make sure we clean up any
+ * preview movie that might be playing
+ */
+ play_movie = NO;
+ hb_stop( fPreviewLibhb );
+ [self pictureSliderChanged:nil];
+}
+
+- (BOOL)windowShouldClose:(id)fPictureWindow
+{
+ return YES;
+}
+
- (void) dealloc
{
hb_stop(fPreviewLibhb);
@@ -478,8 +512,7 @@ are maintained across different sources */
if (sender != nil)
{
- if ([delegate respondsToSelector:@selector(pictureSettingsDidChange)])
- [delegate pictureSettingsDidChange];
+ [fHBController pictureSettingsDidChange];
}
}
@@ -505,6 +538,8 @@ are maintained across different sources */
#pragma mark Movie Preview
- (IBAction) createMoviePreview: (id) sender
{
+
+
/* Lets make sure the still picture previews are showing in case
* there is currently a movie showing */
[self pictureSliderChanged:nil];
@@ -526,18 +561,18 @@ are maintained across different sources */
return;
}
+
/* we use controller.mm's prepareJobForPreview to go ahead and set all of our settings
* however, we want to use a temporary destination field of course
* so that we do not put our temp preview in the users chosen
* directory */
hb_job_t * job = fTitle->job;
+
/* We run our current setting through prepeareJob in Controller.mm
* just as if it were a regular encode */
- if ([delegate respondsToSelector:@selector(prepareJobForPreview)])
- {
- [delegate prepareJobForPreview];
- }
+
+ [fHBController prepareJobForPreview];
/* Destination file. We set this to our preview directory
* changing the extension appropriately.*/
@@ -813,15 +848,6 @@ are maintained across different sources */
#pragma mark -
-- (IBAction) ClosePanel: (id) sender
-{
- if ([delegate respondsToSelector:@selector(pictureSettingsDidChange)])
- [delegate pictureSettingsDidChange];
-
- [NSApp endSheet:[self window]];
- [[self window] orderOut:self];
-}
-
- (BOOL) autoCrop
{
return autoCrop;