diff options
author | ritsuka <[email protected]> | 2007-09-08 11:30:39 +0000 |
---|---|---|
committer | ritsuka <[email protected]> | 2007-09-08 11:30:39 +0000 |
commit | a3259dc1b1ce95995d8a83c65382519293cae540 (patch) | |
tree | 5a94a7b4585f5777f6e85813b047cb46f22e255d | |
parent | fb339bf1934b8feac7655806aca4f892e9232c29 (diff) |
MacGui:
- Move Picture Settings window in a new nib
- Cleanup main window nib, delete some useless hidden NSTextfField
- Change "Queue" menu item keyboard shortctus to cmd-2
- Add cmd-? keyboard shortcuts to "HandBrake User Guide" menu item
- HandBrake main windows is now shown if the dock icon is clicked and there is no open window
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@936 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r-- | macosx/Controller.h | 44 | ||||
-rw-r--r-- | macosx/Controller.mm | 318 | ||||
-rw-r--r-- | macosx/English.lproj/MainMenu.nib/classes.nib | 28 | ||||
-rw-r--r-- | macosx/English.lproj/MainMenu.nib/info.nib | 8 | ||||
-rw-r--r-- | macosx/English.lproj/MainMenu.nib/keyedobjects.nib | bin | 97622 -> 68453 bytes | |||
-rw-r--r-- | macosx/English.lproj/PictureSettings.nib/classes.nib | 44 | ||||
-rw-r--r-- | macosx/English.lproj/PictureSettings.nib/info.nib | 16 | ||||
-rw-r--r-- | macosx/English.lproj/PictureSettings.nib/keyedobjects.nib | bin | 0 -> 17603 bytes | |||
-rw-r--r-- | macosx/HandBrake.xcodeproj/project.pbxproj | 14 | ||||
-rw-r--r-- | macosx/PictureController.h | 36 | ||||
-rw-r--r-- | macosx/PictureController.mm | 213 |
11 files changed, 387 insertions, 334 deletions
diff --git a/macosx/Controller.h b/macosx/Controller.h index 232551b8c..704d064a0 100644 --- a/macosx/Controller.h +++ b/macosx/Controller.h @@ -4,15 +4,14 @@ Homepage: <http://handbrake.m0k.org/>. It may be used under the terms of the GNU General Public License. */ -#include <Cocoa/Cocoa.h> -#include <Growl/Growl.h> +#import <Cocoa/Cocoa.h> +#import <Growl/Growl.h> #include "hb.h" - -#include "ChapterTitles.h" -#include "PictureController.h" -#include "HBQueueController.h" +#import "ChapterTitles.h" +#import "PictureController.h" +#import "HBQueueController.h" #import "MVMenuButton.h" #import "HBAdvancedController.h" @@ -22,14 +21,21 @@ { IBOutlet NSWindow * fWindow; - + NSToolbar * toolbar; + /* Picture panel */ - IBOutlet PictureController * fPictureController; - IBOutlet NSPanel * fPicturePanel; + PictureController * fPictureController; + + /* Advanced options tab */ + HBAdvancedController * fAdvancedOptions; IBOutlet NSBox * fAdvancedView; + /* Queue panel */ HBQueueController * fQueueController; IBOutlet NSTextField * fQueueStatus; + + /* Output panel */ + HBOutputPanelController *outputPanel; /* Menu Items */ /* File Menu */ @@ -90,31 +96,25 @@ IBOutlet NSTextField * fPicLabelSrc; IBOutlet NSTextField * fPicLabelOutp; IBOutlet NSTextField * fPicLabelAr; - IBOutlet NSTextField * fPicLabelDeinter; IBOutlet NSTextField * fPicLabelSrcX; IBOutlet NSTextField * fPicLabelOutputX; + IBOutlet NSTextField * fPicLabelAutoCrop; + IBOutlet NSTextField * fPicLabelDetelecine; + IBOutlet NSTextField * fPicLabelDeinterlace; + IBOutlet NSTextField * fPicLabelDenoise; IBOutlet NSTextField * fPicSrcWidth; IBOutlet NSTextField * fPicSrcHeight; IBOutlet NSTextField * fPicSettingWidth; IBOutlet NSTextField * fPicSettingHeight; + IBOutlet NSTextField * fPicSettingDeinterlace; IBOutlet NSTextField * fPicSettingARkeep; IBOutlet NSTextField * fPicSettingPAR; - IBOutlet NSTextField * fPicSettingDeinterlace; - IBOutlet NSTextField * fPicSettingDeinterlaceDsply; - IBOutlet NSTextField * fPicSettingARkeepDsply; - IBOutlet NSTextField * fPicSettingPARDsply; - IBOutlet NSTextField * fPicSettingAutoCropLabel; IBOutlet NSTextField * fPicSettingAutoCrop; - IBOutlet NSTextField * fPicSettingAutoCropDsply; IBOutlet NSTextField * fPicSettingDetelecine; - IBOutlet NSTextField * fPicSettingDetelecineLabel; IBOutlet NSTextField * fPicSettingDenoise; - IBOutlet NSTextField * fPicSettingDenoiseDsply; - IBOutlet NSTextField * fPicSettingDenoiseLabel; IBOutlet NSTextField * fPicLabelAnamorphic; - IBOutlet NSTextField * fPicLabelPAROutp; IBOutlet NSTextField * fPicLabelPAROutputX; IBOutlet NSTextField * fPicSettingPARWidth; IBOutlet NSTextField * fPicSettingPARHeight; @@ -190,12 +190,8 @@ int currentSuccessfulScanCount; int SuccessfulScan; NSString * currentSource; - HBOutputPanelController *outputPanel; - HBAdvancedController *fAdvancedOptions; hb_job_t * fLastKnownCurrentJob; - - NSToolbar *toolbar; } - (void) TranslateStrings; diff --git a/macosx/Controller.mm b/macosx/Controller.mm index dbfbf1c8a..47b46dc1e 100644 --- a/macosx/Controller.mm +++ b/macosx/Controller.mm @@ -80,6 +80,7 @@ static int hb_group_count(hb_handle_t * h) [HBPreferencesController registerUserDefaults]; fHandle = NULL; outputPanel = [[HBOutputPanelController alloc] init]; + fPictureController = [[PictureController alloc] init]; fQueueController = [[HBQueueController alloc] init]; fAdvancedOptions = [[HBAdvancedController alloc] init]; return self; @@ -136,15 +137,14 @@ static int hb_group_count(hb_handle_t * h) /* Show scan panel ASAP */ [self performSelectorOnMainThread: @selector(showScanPanel:) withObject: NULL waitUntilDone: NO]; - } - (NSApplicationTerminateReply) applicationShouldTerminate: (NSApplication *) app { - hb_state_t s; + hb_state_t s; hb_get_state2( fHandle, &s ); - if ( s.state == HB_STATE_WORKING) + if ( s.state == HB_STATE_WORKING ) { [self Cancel: NULL]; return NSTerminateCancel; @@ -256,26 +256,12 @@ static int hb_group_count(hb_handle_t * h) [fVidRatePopUp selectItemAtIndex: 0]; /* Picture Settings */ - [fPicLabelPAROutp setStringValue: @""]; [fPicLabelPAROutputX setStringValue: @""]; [fPicSettingPARWidth setStringValue: @""]; [fPicSettingPARHeight setStringValue: @""]; - /*Set detelecine to Off upon launch */ - [fPicSettingDetelecine setStringValue: @"No"]; - [fPicSettingDenoise setStringValue: @"0"]; - /* if Deinterlace upon launch is specified in the prefs, then set to 1 for "Fast", - if not, then set to 0 for none */ - if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultDeinterlaceOn"] > 0) - { - [fPicSettingDeinterlace setStringValue: @"1"]; - } - else - { - [fPicSettingDeinterlace setStringValue: @"0"]; - } /* Set Auto Crop to On at launch */ - [fPicSettingAutoCrop setStringValue: @"1"]; + [fPictureController setAutoCrop:YES]; /* Audio bitrate */ [fAudBitratePopUp removeAllItems]; @@ -466,7 +452,7 @@ static int hb_group_count(hb_handle_t * h) hb_state_t s; hb_get_state2( fHandle, &s ); - if (s.state == HB_STATE_WORKING) + if (s.state == HB_STATE_WORKING || s.state == HB_STATE_MUXING) { if ([ident isEqualToString: StartEncodingIdentifier]) { @@ -1060,20 +1046,24 @@ list = hb_get_titles( fHandle ); /* we record the current source name here in case the next scan is unsuccessful, then we can replace the scan progress with the old name if necessary */ sourceDisplayName = [NSString stringWithFormat:[fSrcDVD2Field stringValue]]; - - /* if its the initial successful scan after awakeFromNib */ + + /* if its the initial successful scan after awakeFromNib */ if (currentSuccessfulScanCount == 1) { - [self selectDefaultPreset: NULL]; - } + [self selectDefaultPreset: NULL]; + /* if Deinterlace upon launch is specified in the prefs, then set to 1 for "Fast", + if not, then set to 0 for none */ + if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultDeinterlaceOn"] > 0) + [fPictureController setDeinterlace:1]; + else + [fPictureController setDeinterlace:0]; + } + } } - -(IBAction)showGrowlDoneNotification:(id)sender { - - [GrowlApplicationBridge notifyWithTitle:@"Put down that cocktail..." description:@"your HandBrake encode is done!" @@ -1083,6 +1073,7 @@ list = hb_get_titles( fHandle ); isSticky:1 clickContext:nil]; } + - (void) enableUI: (bool) b { NSControl * controls[] = @@ -1098,14 +1089,13 @@ list = hb_get_titles( fHandle ); fAudTrack1MixLabel, fAudTrack1MixPopUp, fAudTrack2MixLabel, fAudTrack2MixPopUp, fAudRateField, fAudRatePopUp, fAudBitrateField, fAudBitratePopUp, fPictureButton,fQueueStatus, - fPicSrcWidth,fPicSrcHeight,fPicSettingWidth,fPicSettingHeight, - fPicSettingARkeep,fPicSettingDeinterlace,fPicSettingARkeepDsply, - fPicSettingDeinterlaceDsply,fPicLabelSettings,fPicLabelSrc,fPicLabelOutp, - fPicLabelAr,fPicLabelDeinter,fPicLabelSrcX,fPicLabelOutputX, - fPicLabelPAROutp,fPicLabelPAROutputX,fPicSettingPARWidth,fPicSettingPARHeight, - fPicSettingPARDsply,fPicLabelAnamorphic,tableView,fPresetsAdd,fPresetsDelete, - fCreateChapterMarkers,fVidTurboPassCheck,fDstMpgLargeFileCheck,fPicSettingAutoCropLabel, - fPicSettingAutoCropDsply,fPicSettingDetelecine,fPicSettingDetelecineLabel,fPicSettingDenoiseLabel,fPicSettingDenoiseDsply,fSubForcedCheck,}; + fPicSrcWidth,fPicSrcHeight,fPicSettingWidth,fPicSettingHeight,fPicSettingARkeep, + fPicSettingDeinterlace,fPicLabelSettings,fPicLabelSrc,fPicLabelOutp, + fPicLabelAr,fPicLabelDeinterlace,fPicLabelSrcX,fPicLabelOutputX, + fPicLabelPAROutputX,fPicSettingPARWidth,fPicSettingPARHeight, + fPicSettingPAR,fPicLabelAnamorphic,tableView,fPresetsAdd,fPresetsDelete, + fCreateChapterMarkers,fVidTurboPassCheck,fDstMpgLargeFileCheck,fPicLabelAutoCrop, + fPicSettingAutoCrop,fPicSettingDetelecine,fPicLabelDetelecine,fPicLabelDenoise,fPicSettingDenoise,fSubForcedCheck,}; for( unsigned i = 0; i < sizeof( controls ) / sizeof( NSControl * ); i++ ) @@ -1221,18 +1211,30 @@ list = hb_get_titles( fHandle ); } } - - (IBAction) openMainWindow: (id) sender { [fWindow makeKeyAndOrderFront:nil]; [fWindow setReleasedWhenClosed: YES]; } + - (BOOL) windowShouldClose: (id) sender { [fWindow setReleasedWhenClosed: NO]; return YES; } +- (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows:(BOOL)flag +{ + if( !flag ) { + [fWindow makeKeyAndOrderFront:nil]; + [fWindow setReleasedWhenClosed: YES]; + + return YES; + } + + return NO; +} + - (IBAction) videoMatrixChanged: (id) sender; { bool target, bitrate, quality; @@ -1312,22 +1314,9 @@ 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 showPanelInWindow:fWindow forTitle:title]; - /* Resize the panel */ - NSSize newSize; - newSize.width = 246 + title->width; - newSize.height = 80 + title->height; - [fPicturePanel setContentSize: newSize]; - - [fPictureController SetTitle: title]; - - [NSApp beginSheet: fPicturePanel modalForWindow: fWindow - modalDelegate: NULL didEndSelector: NULL contextInfo: NULL]; - [NSApp runModalForWindow: fPicturePanel]; - [NSApp endSheet: fPicturePanel]; - [fPicturePanel orderOut: self]; - - /* Enable/Disable Menu Controls Accordingly */ [fMenuOpenSource setEnabled: YES]; [fMenuStartEncode setEnabled: YES]; [fMenuAddToQueue setEnabled: YES]; @@ -1491,61 +1480,53 @@ list = hb_get_titles( fHandle ); indexOfSelectedItem]].rate; job->abitrate = [[fAudBitratePopUp selectedItem] tag]; - /* TODO: Filter settings */ - if( job->filters ) - { - hb_list_close( &job->filters ); - } job->filters = hb_list_init(); /* Detelecine */ - if ([[fPicSettingDetelecine stringValue] isEqualToString: @"Yes"]) - { - hb_list_add( job->filters, &hb_filter_detelecine ); - } + if ([fPictureController detelecine]) + { + hb_list_add( job->filters, &hb_filter_detelecine ); + } - /* Deinterlace */ - if( job->deinterlace == 1) - { - if ([fPicSettingDeinterlace intValue] == 1) - { - /* Run old deinterlacer by default */ - hb_filter_deinterlace.settings = "-1"; - hb_list_add( job->filters, &hb_filter_deinterlace ); - } - if ([fPicSettingDeinterlace intValue] == 2) - { - /* Yadif mode 0 (1-pass with spatial deinterlacing.) */ - hb_filter_deinterlace.settings = "0"; - hb_list_add( job->filters, &hb_filter_deinterlace ); - } - if ([fPicSettingDeinterlace intValue] == 3) - { - /* Yadif (1-pass w/o spatial deinterlacing) and Mcdeint */ - hb_filter_deinterlace.settings = "2:-1:1"; - hb_list_add( job->filters, &hb_filter_deinterlace ); - } - if ([fPicSettingDeinterlace intValue] == 4) - { - /* Yadif (2-pass w/ spatial deinterlacing) and Mcdeint*/ - hb_filter_deinterlace.settings = "1:-1:1"; - hb_list_add( job->filters, &hb_filter_deinterlace ); - } + /* Deinterlace */ + if ([fPictureController deinterlace] == 1) + { + /* Run old deinterlacer by default */ + hb_filter_deinterlace.settings = "-1"; + hb_list_add( job->filters, &hb_filter_deinterlace ); + } + else if ([fPictureController deinterlace] == 2) + { + /* Yadif mode 0 (1-pass with spatial deinterlacing.) */ + hb_filter_deinterlace.settings = "0"; + hb_list_add( job->filters, &hb_filter_deinterlace ); + } + else if ([fPictureController deinterlace] == 3) + { + /* Yadif (1-pass w/o spatial deinterlacing) and Mcdeint */ + hb_filter_deinterlace.settings = "2:-1:1"; + hb_list_add( job->filters, &hb_filter_deinterlace ); + } + else if ([fPictureController deinterlace] == 4) + { + /* Yadif (2-pass w/ spatial deinterlacing) and Mcdeint*/ + hb_filter_deinterlace.settings = "1:-1:1"; + hb_list_add( job->filters, &hb_filter_deinterlace ); } /* Denoise */ - if ([fPicSettingDenoise intValue] == 1) // Weak in popup + if ([fPictureController denoise] == 1) // Weak in popup { hb_filter_denoise.settings = "2:1:2:3"; hb_list_add( job->filters, &hb_filter_denoise ); } - else if ([fPicSettingDenoise intValue] == 2) // Medium in popup + else if ([fPictureController denoise] == 2) // Medium in popup { hb_filter_denoise.settings = "3:2:2:3"; hb_list_add( job->filters, &hb_filter_denoise ); } - else if ([fPicSettingDenoise intValue] == 3) // Strong in popup + else if ([fPictureController denoise] == 3) // Strong in popup { hb_filter_denoise.settings = "7:7:5:5"; hb_list_add( job->filters, &hb_filter_denoise ); @@ -1819,11 +1800,11 @@ list = hb_get_titles( fHandle ); /* Turn Deinterlace on/off depending on the preference */ if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultDeinterlaceOn"] > 0) { - job->deinterlace = 1; + [fPictureController setDeinterlace:1]; } else { - job->deinterlace = 0; + [fPictureController setDeinterlace:0]; } /* Pixel Ratio Setting */ @@ -1843,8 +1824,8 @@ list = hb_get_titles( fHandle ); @"%d", fTitle->height]]; /* Set Auto Crop to on upon selecting a new title */ - [fPicSettingAutoCrop setStringValue: @"1"]; - + [fPictureController setAutoCrop:YES]; + /* We get the originial output picture width and height and put them in variables for use with some presets later on */ PicOrigOutputWidth = job->width; @@ -2164,10 +2145,10 @@ list = hb_get_titles( fHandle ); - (IBAction ) videoFrameRateChanged: (id) sender { -/* We call method method to calculatePictureSizing to error check detelecine*/ -[self calculatePictureSizing: sender]; + /* We call method method to calculatePictureSizing to error check detelecine*/ + [self calculatePictureSizing: sender]; -/* We call method method to change UI to reflect whether a preset is used or not*/ + /* We call method method to change UI to reflect whether a preset is used or not*/ [self customSettingUsed: sender]; } @@ -2538,8 +2519,7 @@ list = hb_get_titles( fHandle ); in TitlePopUpChanged */ job->width = PicOrigOutputWidth; job->height = PicOrigOutputHeight; - [fPicSettingAutoCrop setStringValue: [NSString stringWithFormat: - @"%d", 1]]; + [fPictureController setAutoCrop:YES]; /* Here we use the auto crop values determined right after scan */ job->crop[0] = AutoCropTop; job->crop[1] = AutoCropBottom; @@ -2556,125 +2536,109 @@ list = hb_get_titles( fHandle ); /* Get and Display Current Pic Settings in main window */ - (IBAction) calculatePictureSizing: (id) sender { - - - [fPicSettingWidth setStringValue: [NSString stringWithFormat: - @"%d", fTitle->job->width]]; - [fPicSettingHeight setStringValue: [NSString stringWithFormat: - @"%d", fTitle->job->height]]; - [fPicSettingARkeep setStringValue: [NSString stringWithFormat: - @"%d", fTitle->job->keep_ratio]]; - //[fPicSettingDeinterlace setStringValue: [NSString stringWithFormat: - // @"%d", fTitle->job->deinterlace]]; - [fPicSettingPAR setStringValue: [NSString stringWithFormat: - @"%d", fTitle->job->pixel_ratio]]; + [fPicSettingWidth setStringValue: [NSString stringWithFormat:@"%d", fTitle->job->width]]; + [fPicSettingHeight setStringValue: [NSString stringWithFormat:@"%d", fTitle->job->height]]; if (fTitle->job->pixel_ratio == 1) { - int titlewidth = fTitle->width-fTitle->job->crop[2]-fTitle->job->crop[3]; - int arpwidth = fTitle->job->pixel_aspect_width; - int arpheight = fTitle->job->pixel_aspect_height; - int displayparwidth = titlewidth * arpwidth / arpheight; - int displayparheight = fTitle->height-fTitle->job->crop[0]-fTitle->job->crop[1]; - [fPicSettingWidth setStringValue: [NSString stringWithFormat: - @"%d", titlewidth]]; - [fPicSettingHeight setStringValue: [NSString stringWithFormat: - @"%d", displayparheight]]; - [fPicLabelPAROutp setStringValue: @"Anamorphic Output:"]; - [fPicLabelPAROutputX setStringValue: @"x"]; - [fPicSettingPARWidth setStringValue: [NSString stringWithFormat: - @"%d", displayparwidth]]; - [fPicSettingPARHeight setStringValue: [NSString stringWithFormat: - @"%d", displayparheight]]; - - fTitle->job->keep_ratio = 0; - } - else - { - [fPicLabelPAROutp setStringValue: @""]; - [fPicLabelPAROutputX setStringValue: @""]; - [fPicSettingPARWidth setStringValue: @""]; - [fPicSettingPARHeight setStringValue: @""]; - } - if ([fPicSettingDeinterlace intValue] == 0) - { - fTitle->job->deinterlace = 0; + int titlewidth = fTitle->width-fTitle->job->crop[2]-fTitle->job->crop[3]; + int arpwidth = fTitle->job->pixel_aspect_width; + int arpheight = fTitle->job->pixel_aspect_height; + int displayparwidth = titlewidth * arpwidth / arpheight; + int displayparheight = fTitle->height-fTitle->job->crop[0]-fTitle->job->crop[1]; + + [fPicSettingWidth setStringValue: [NSString stringWithFormat:@"%d", titlewidth]]; + [fPicSettingHeight setStringValue: [NSString stringWithFormat:@"%d", displayparheight]]; + [fPicLabelPAROutputX setStringValue: @"x"]; + [fPicSettingPARWidth setStringValue: [NSString stringWithFormat:@"%d", displayparwidth]]; + [fPicSettingPARHeight setStringValue: [NSString stringWithFormat:@"%d", displayparheight]]; + + fTitle->job->keep_ratio = 0; } else { - fTitle->job->deinterlace = 1; + [fPicLabelPAROutputX setStringValue: @""]; + [fPicSettingPARWidth setStringValue: @""]; + [fPicSettingPARHeight setStringValue: @""]; } - /* Set ON/Off values for the deinterlace/keep aspect ratio according to boolean */ if (fTitle->job->keep_ratio > 0) { - [fPicSettingARkeepDsply setStringValue: @"On"]; + [fPicSettingARkeep setStringValue: @"On"]; } else { - [fPicSettingARkeepDsply setStringValue: @"Off"]; + [fPicSettingARkeep setStringValue: @"Off"]; } + /* Detelecine */ + if ([fPictureController detelecine]) { + [fPicSettingDetelecine setStringValue: @"Yes"]; + } + else { + [fPicSettingDetelecine setStringValue: @"No"]; + } + /* Deinterlace */ - if ([fPicSettingDeinterlace intValue] == 0) + if ([fPictureController deinterlace] == 0) { - [fPicSettingDeinterlaceDsply setStringValue: @"Off"]; + [fPicSettingDeinterlace setStringValue: @"Off"]; } - else if ([fPicSettingDeinterlace intValue] == 1) + else if ([fPictureController deinterlace] == 1) { - [fPicSettingDeinterlaceDsply setStringValue: @"Fast"]; + [fPicSettingDeinterlace setStringValue: @"Fast"]; } - else if ([fPicSettingDeinterlace intValue] == 2) + else if ([fPictureController deinterlace] == 2) { - [fPicSettingDeinterlaceDsply setStringValue: @"Slow"]; + [fPicSettingDeinterlace setStringValue: @"Slow"]; } - else if ([fPicSettingDeinterlace intValue] == 3) + else if ([fPictureController deinterlace] == 3) { - [fPicSettingDeinterlaceDsply setStringValue: @"Slower"]; + [fPicSettingDeinterlace setStringValue: @"Slower"]; } - else if ([fPicSettingDeinterlace intValue] == 4) + else if ([fPictureController deinterlace] ==4) { - [fPicSettingDeinterlaceDsply setStringValue: @"Slowest"]; + [fPicSettingDeinterlace setStringValue: @"Slowest"]; } /* Denoise */ - if ([fPicSettingDenoise intValue] == 0) + if ([fPictureController denoise] == 0) { - [fPicSettingDenoiseDsply setStringValue: @"Off"]; + [fPicSettingDenoise setStringValue: @"Off"]; } - else if ([fPicSettingDenoise intValue] == 1) + else if ([fPictureController denoise] == 1) { - [fPicSettingDenoiseDsply setStringValue: @"Weak"]; + [fPicSettingDenoise setStringValue: @"Weak"]; } - else if ([fPicSettingDenoise intValue] == 2) + else if ([fPictureController denoise] == 2) { - [fPicSettingDenoiseDsply setStringValue: @"Medium"]; + [fPicSettingDenoise setStringValue: @"Medium"]; } - else if ([fPicSettingDenoise intValue] == 3) + else if ([fPictureController denoise] == 3) { - [fPicSettingDenoiseDsply setStringValue: @"Strong"]; + [fPicSettingDenoise setStringValue: @"Strong"]; } if (fTitle->job->pixel_ratio > 0) { - [fPicSettingPARDsply setStringValue: @""]; + [fPicSettingPAR setStringValue: @""]; } else { - [fPicSettingPARDsply setStringValue: @"Off"]; + [fPicSettingPAR setStringValue: @"Off"]; } /* Set the display field for crop as per boolean */ - if ([[fPicSettingAutoCrop stringValue] isEqualToString: @"0"]) + if (![fPictureController autoCrop]) { - [fPicSettingAutoCropDsply setStringValue: @"Custom"]; + [fPicSettingAutoCrop setStringValue: @"Custom"]; } else { - [fPicSettingAutoCropDsply setStringValue: @"Auto"]; + [fPicSettingAutoCrop setStringValue: @"Auto"]; } /* check video framerate and turn off detelecine if necessary */ if (fTitle->rate_base == 1126125 || [[fVidRatePopUp titleOfSelectedItem] isEqualToString: @"23.976 (NTSC Film)"]) { - [fPicSettingDetelecine setStringValue: @"No"]; + [fPictureController setDetelecine:0]; } @@ -2901,13 +2865,13 @@ the user is using "Custom" settings by determining the sender*/ [preset setObject:[NSNumber numberWithInt:fTitle->job->width] forKey:@"PictureWidth"]; [preset setObject:[NSNumber numberWithInt:fTitle->job->height] forKey:@"PictureHeight"]; [preset setObject:[NSNumber numberWithInt:fTitle->job->keep_ratio] forKey:@"PictureKeepRatio"]; - [preset setObject:[NSNumber numberWithInt:[fPicSettingDeinterlace intValue]] forKey:@"PictureDeinterlace"]; + [preset setObject:[NSNumber numberWithInt:[fPictureController deinterlace]] forKey:@"PictureDeinterlace"]; [preset setObject:[NSNumber numberWithInt:fTitle->job->pixel_ratio] forKey:@"PicturePAR"]; - [preset setObject:[fPicSettingDetelecine stringValue] forKey:@"PictureDetelecine"]; - [preset setObject:[NSNumber numberWithInt:[fPicSettingDenoise intValue]] forKey:@"PictureDenoise"]; + [preset setObject:[NSNumber numberWithInt:[fPictureController detelecine]] forKey:@"PictureDetelecine"]; + [preset setObject:[NSNumber numberWithInt:[fPictureController denoise]] forKey:@"PictureDenoise"]; /* Set crop settings here */ /* The Auto Crop Matrix in the Picture Window autodetects differences in crop settings */ - [preset setObject:[NSNumber numberWithInt:[fPicSettingAutoCrop intValue]] forKey:@"PictureAutoCrop"]; + [preset setObject:[NSNumber numberWithInt:[fPictureController autoCrop]] forKey:@"PictureAutoCrop"]; [preset setObject:[NSNumber numberWithInt:job->crop[0]] forKey:@"PictureTopCrop"]; [preset setObject:[NSNumber numberWithInt:job->crop[1]] forKey:@"PictureBottomCrop"]; @@ -4309,22 +4273,21 @@ the user is using "Custom" settings by determining the sender*/ } } job->pixel_ratio = [[chosenPreset objectForKey:@"PicturePAR"] intValue]; - [fPicSettingDeinterlace setStringValue: [NSString stringWithFormat: @"%d",[[chosenPreset objectForKey:@"PictureDeinterlace"] intValue]]]; + [fPictureController setDeinterlace:[[chosenPreset objectForKey:@"PictureDeinterlace"] intValue]]; if ([chosenPreset objectForKey:@"PictureDetelecine"]) { - [fPicSettingDetelecine setStringValue: [NSString stringWithFormat: @"%@",[chosenPreset valueForKey:@"PictureDetelecine"]]]; + [fPictureController setDetelecine:[[chosenPreset objectForKey:@"PictureDetelecine"] intValue]]; } if ([chosenPreset objectForKey:@"PictureDenoise"]) { - [fPicSettingDenoise setStringValue: [NSString stringWithFormat: @"%d",[[chosenPreset objectForKey:@"PictureDenoise"] intValue]]]; + [fPictureController setDenoise:[[chosenPreset objectForKey:@"PictureDenoise"] intValue]]; } /* If Cropping is set to custom, then recall all four crop values from when the preset was created and apply them */ if ([[chosenPreset objectForKey:@"PictureAutoCrop"] intValue] == 0) { - [fPicSettingAutoCrop setStringValue: [NSString stringWithFormat: - @"%d", 0]]; + [fPictureController setAutoCrop:NO]; /* Here we use the custom crop values saved at the time the preset was saved */ job->crop[0] = [[chosenPreset objectForKey:@"PictureTopCrop"] intValue]; @@ -4335,9 +4298,8 @@ the user is using "Custom" settings by determining the sender*/ } else /* if auto crop has been saved in preset, set to auto and use post scan auto crop */ { - [fPicSettingAutoCrop setStringValue: [NSString stringWithFormat: - @"%d", 1]]; - /* Here we use the auto crop values determined right after scan */ + [fPictureController setAutoCrop:YES]; + /* Here we use the auto crop values determined right after scan */ job->crop[0] = AutoCropTop; job->crop[1] = AutoCropBottom; job->crop[2] = AutoCropLeft; diff --git a/macosx/English.lproj/MainMenu.nib/classes.nib b/macosx/English.lproj/MainMenu.nib/classes.nib index 40dbb00e4..e98d9bf15 100644 --- a/macosx/English.lproj/MainMenu.nib/classes.nib +++ b/macosx/English.lproj/MainMenu.nib/classes.nib @@ -142,37 +142,29 @@ fMenuStartEncode = NSMenuItem; fPicLabelAnamorphic = NSTextField; fPicLabelAr = NSTextField; - fPicLabelDeinter = NSTextField; + fPicLabelAutoCrop = NSTextField; + fPicLabelDeinterlace = NSTextField; + fPicLabelDenoise = NSTextField; + fPicLabelDetelecine = NSTextField; fPicLabelOutp = NSTextField; fPicLabelOutputX = NSTextField; - fPicLabelPAROutp = NSTextField; fPicLabelPAROutputX = NSTextField; fPicLabelSettings = NSTextField; fPicLabelSrc = NSTextField; fPicLabelSrcX = NSTextField; fPicSettingARkeep = NSTextField; - fPicSettingARkeepDsply = NSTextField; fPicSettingAutoCrop = NSTextField; - fPicSettingAutoCropDsply = NSTextField; - fPicSettingAutoCropLabel = NSTextField; fPicSettingDeinterlace = NSTextField; - fPicSettingDeinterlaceDsply = NSTextField; fPicSettingDenoise = NSTextField; - fPicSettingDenoiseDsply = NSTextField; - fPicSettingDenoiseLabel = NSTextField; fPicSettingDetelecine = NSTextField; - fPicSettingDetelecineLabel = NSTextField; fPicSettingHeight = NSTextField; fPicSettingPAR = NSTextField; - fPicSettingPARDsply = NSTextField; fPicSettingPARHeight = NSTextField; fPicSettingPARWidth = NSTextField; fPicSettingWidth = NSTextField; fPicSrcHeight = NSTextField; fPicSrcWidth = NSTextField; fPictureButton = NSButton; - fPictureController = PictureController; - fPicturePanel = NSPanel; fPresetDrawer = NSDrawer; fPresetNewDesc = NSTextField; fPresetNewName = NSTextField; @@ -241,7 +233,6 @@ CLASS = PictureController; LANGUAGE = ObjC; OUTLETS = { - fAutoCropMainWindow = NSTextField; fCropBottomField = NSTextField; fCropBottomStepper = NSStepper; fCropLeftField = NSTextField; @@ -251,29 +242,18 @@ fCropRightStepper = NSStepper; fCropTopField = NSTextField; fCropTopStepper = NSStepper; - fDeinterlaceLevelMainWindow = NSTextField; fDeinterlacePopUp = NSPopUpButton; - fDenoiseMainWindow = NSTextField; fDenoisePopUp = NSPopUpButton; fDetelecineCheck = NSButton; - fDetelecineMainWindow = NSTextField; fEffectsCheck = NSButton; fHeightField = NSTextField; fHeightStepper = NSStepper; fInfoField = NSTextField; fNextButton = NSButton; fPARCheck = NSButton; - fPicSettingARkeep = NSTextField; - fPicSettingDeinterlace = NSTextField; - fPicSettingHeight = NSTextField; - fPicSettingWidth = NSTextField; - fPicSettingsDisplay = NSTextField; - fPicSrcHeight = NSTextField; - fPicSrcWidth = NSTextField; fPictureGLView = HBPictureGLView; fPrevButton = NSButton; fRatioCheck = NSButton; - fVidFrameRatePopUpMainWindow = NSPopUpButton; fWidthField = NSTextField; fWidthStepper = NSStepper; }; diff --git a/macosx/English.lproj/MainMenu.nib/info.nib b/macosx/English.lproj/MainMenu.nib/info.nib index 532b25d26..11b94a46a 100644 --- a/macosx/English.lproj/MainMenu.nib/info.nib +++ b/macosx/English.lproj/MainMenu.nib/info.nib @@ -7,11 +7,11 @@ <key>IBEditorPositions</key> <dict> <key>1843</key> - <string>720 93 200 530 0 0 1440 878 </string> + <string>640 320 200 530 0 0 1440 878 </string> <key>2436</key> <string>307 361 192 68 0 0 1440 878 </string> <key>29</key> - <string>790 391 368 44 0 0 1440 878 </string> + <string>578 372 368 44 0 0 1440 878 </string> </dict> <key>IBFramework Version</key> <string>446.1</string> @@ -27,8 +27,8 @@ <integer>4</integer> <key>IBOpenObjects</key> <array> - <integer>365</integer> - <integer>29</integer> + <integer>1867</integer> + <integer>1843</integer> <integer>21</integer> </array> <key>IBSystem Version</key> diff --git a/macosx/English.lproj/MainMenu.nib/keyedobjects.nib b/macosx/English.lproj/MainMenu.nib/keyedobjects.nib Binary files differindex 5389ac3de..f1b543d20 100644 --- a/macosx/English.lproj/MainMenu.nib/keyedobjects.nib +++ b/macosx/English.lproj/MainMenu.nib/keyedobjects.nib diff --git a/macosx/English.lproj/PictureSettings.nib/classes.nib b/macosx/English.lproj/PictureSettings.nib/classes.nib new file mode 100644 index 000000000..0d83d8f54 --- /dev/null +++ b/macosx/English.lproj/PictureSettings.nib/classes.nib @@ -0,0 +1,44 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + {CLASS = HBPictureGLView; LANGUAGE = ObjC; SUPERCLASS = NSOpenGLView; }, + { + ACTIONS = { + ClosePanel = id; + NextPicture = id; + PreviousPicture = id; + SettingsChanged = id; + }; + CLASS = PictureController; + LANGUAGE = ObjC; + OUTLETS = { + fCropBottomField = NSTextField; + fCropBottomStepper = NSStepper; + fCropLeftField = NSTextField; + fCropLeftStepper = NSStepper; + fCropMatrix = NSMatrix; + fCropRightField = NSTextField; + fCropRightStepper = NSStepper; + fCropTopField = NSTextField; + fCropTopStepper = NSStepper; + fDeinterlacePopUp = NSPopUpButton; + fDenoisePopUp = NSPopUpButton; + fDetelecineCheck = NSButton; + fEffectsCheck = NSButton; + fHeightField = NSTextField; + fHeightStepper = NSStepper; + fInfoField = NSTextField; + fNextButton = NSButton; + fPARCheck = NSButton; + fPictureGLView = HBPictureGLView; + fPicturePanel = NSPanel; + fPrevButton = NSButton; + fRatioCheck = NSButton; + fWidthField = NSTextField; + fWidthStepper = NSStepper; + }; + SUPERCLASS = NSObject; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/macosx/English.lproj/PictureSettings.nib/info.nib b/macosx/English.lproj/PictureSettings.nib/info.nib new file mode 100644 index 000000000..c710553a5 --- /dev/null +++ b/macosx/English.lproj/PictureSettings.nib/info.nib @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>262 95 356 240 0 0 1440 878 </string> + <key>IBFramework Version</key> + <string>446.1</string> + <key>IBOpenObjects</key> + <array> + <integer>5</integer> + </array> + <key>IBSystem Version</key> + <string>8R2218</string> +</dict> +</plist> diff --git a/macosx/English.lproj/PictureSettings.nib/keyedobjects.nib b/macosx/English.lproj/PictureSettings.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..2747a082c --- /dev/null +++ b/macosx/English.lproj/PictureSettings.nib/keyedobjects.nib diff --git a/macosx/HandBrake.xcodeproj/project.pbxproj b/macosx/HandBrake.xcodeproj/project.pbxproj index 0ce0e89db..96161b246 100644 --- a/macosx/HandBrake.xcodeproj/project.pbxproj +++ b/macosx/HandBrake.xcodeproj/project.pbxproj @@ -125,6 +125,7 @@ A2DFC6750C6197C600E66E89 /* MVMenuButton.h in Headers */ = {isa = PBXBuildFile; fileRef = A2DFC6740C6197C600E66E89 /* MVMenuButton.h */; }; A2DFC6770C61980700E66E89 /* MVMenuButton.m in Sources */ = {isa = PBXBuildFile; fileRef = A2DFC6760C61980700E66E89 /* MVMenuButton.m */; }; A97A1DB40C91A6800015BC08 /* Express.nib in Resources */ = {isa = PBXBuildFile; fileRef = A97A1DB20C91A6800015BC08 /* Express.nib */; }; + A9ABA2270C92AECA00D98324 /* PictureSettings.nib in Resources */ = {isa = PBXBuildFile; fileRef = A9ABA2250C92AECA00D98324 /* PictureSettings.nib */; }; A9AC41DF0C918DB500DDF9B8 /* HBAdvancedController.m in Sources */ = {isa = PBXBuildFile; fileRef = A9AC41DD0C918DB500DDF9B8 /* HBAdvancedController.m */; }; A9AC41E00C918DB500DDF9B8 /* HBAdvancedController.h in Headers */ = {isa = PBXBuildFile; fileRef = A9AC41DE0C918DB500DDF9B8 /* HBAdvancedController.h */; }; A9AC41E70C918DC000DDF9B8 /* AdvancedView.nib in Resources */ = {isa = PBXBuildFile; fileRef = A9AC41E50C918DC000DDF9B8 /* AdvancedView.nib */; }; @@ -198,7 +199,7 @@ /* Begin PBXFileReference section */ 089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; }; 0D096DFF0B707D1200A845D4 /* libhb.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libhb.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - 0D6E35760B6BD4F0005AABB3 /* HandBrake.app */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.application; path = HandBrake.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 0D6E35760B6BD4F0005AABB3 /* HandBrake.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HandBrake.app; sourceTree = BUILT_PRODUCTS_DIR; }; 0DF377970B7BF99A00115CB0 /* fakexcode.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = fakexcode.cpp; path = ../test/fakexcode.cpp; sourceTree = SOURCE_ROOT; }; 0DFA5C7A0B8DD1E90020BC09 /* HandBrake.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = HandBrake.icns; sourceTree = "<group>"; }; 0DFA5C7E0B8DD3B60020BC09 /* declpcm.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = declpcm.c; path = ../libhb/declpcm.c; sourceTree = SOURCE_ROOT; }; @@ -285,6 +286,7 @@ A2DFC6740C6197C600E66E89 /* MVMenuButton.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MVMenuButton.h; sourceTree = "<group>"; }; A2DFC6760C61980700E66E89 /* MVMenuButton.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = MVMenuButton.m; sourceTree = "<group>"; }; A97A1DB30C91A6800015BC08 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/Express.nib; sourceTree = "<group>"; }; + A9ABA2260C92AECA00D98324 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/PictureSettings.nib; sourceTree = "<group>"; }; A9AC41DD0C918DB500DDF9B8 /* HBAdvancedController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = HBAdvancedController.m; sourceTree = "<group>"; }; A9AC41DE0C918DB500DDF9B8 /* HBAdvancedController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HBAdvancedController.h; sourceTree = "<group>"; }; A9AC41E60C918DC000DDF9B8 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/AdvancedView.nib; sourceTree = "<group>"; }; @@ -402,6 +404,7 @@ children = ( 0DFA5C7A0B8DD1E90020BC09 /* HandBrake.icns */, 29B97318FDCFA39411CA2CEA /* MainMenu.nib */, + A9ABA2250C92AECA00D98324 /* PictureSettings.nib */, A97A1DB20C91A6800015BC08 /* Express.nib */, A9AC41E50C918DC000DDF9B8 /* AdvancedView.nib */, 2538860A0BFE0B730064E995 /* OutputPanel.nib */, @@ -747,6 +750,7 @@ E318F0830C90DC4A003EFB59 /* Info.png in Resources */, A9AC41E70C918DC000DDF9B8 /* AdvancedView.nib in Resources */, A97A1DB40C91A6800015BC08 /* Express.nib in Resources */, + A9ABA2270C92AECA00D98324 /* PictureSettings.nib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -941,6 +945,14 @@ name = Express.nib; sourceTree = "<group>"; }; + A9ABA2250C92AECA00D98324 /* PictureSettings.nib */ = { + isa = PBXVariantGroup; + children = ( + A9ABA2260C92AECA00D98324 /* English */, + ); + name = PictureSettings.nib; + sourceTree = "<group>"; + }; A9AC41E50C918DC000DDF9B8 /* AdvancedView.nib */ = { isa = PBXVariantGroup; children = ( diff --git a/macosx/PictureController.h b/macosx/PictureController.h index bfc67bb86..9feae1e25 100644 --- a/macosx/PictureController.h +++ b/macosx/PictureController.h @@ -21,6 +21,8 @@ int fTexBufSize; int fPicture; + IBOutlet NSPanel * fPicturePanel; + IBOutlet HBPictureGLView * fPictureGLView; IBOutlet NSTextField * fWidthField; IBOutlet NSStepper * fWidthStepper; @@ -45,18 +47,15 @@ IBOutlet NSButton * fNextButton; IBOutlet NSTextField * fInfoField; - - - int MaxOutputWidth; - int MaxOutputHeight; - - /* widgets in main window */ - IBOutlet NSTextField * fAutoCropMainWindow; - IBOutlet NSTextField * fDeinterlaceLevelMainWindow; - IBOutlet NSTextField * fDetelecineMainWindow; - IBOutlet NSPopUpButton * fVidFrameRatePopUpMainWindow; - IBOutlet NSTextField * fDenoiseMainWindow; - + int MaxOutputWidth; + int MaxOutputHeight; + BOOL autoCrop; + + struct { + int detelecine; + int deinterlace; + int denoise; + } fPictureFilterSettings; } @@ -69,4 +68,17 @@ - (IBAction) NextPicture: (id) sender; - (IBAction) ClosePanel: (id) sender; +- (BOOL) autoCrop; +- (void) setAutoCrop: (BOOL) setting; + +- (int) detelecine; +- (void) setDetelecine: (int) setting; +- (int) deinterlace; +- (void) setDeinterlace: (int) setting; +- (int) denoise; +- (void) setDenoise: (int) setting; + +- (void) showPanelInWindow: (NSWindow *) fWindow forTitle:(hb_title_t *)title; +- (BOOL) loadMyNibFile; + @end diff --git a/macosx/PictureController.mm b/macosx/PictureController.mm index 58888f2a0..a8ae974f8 100644 --- a/macosx/PictureController.mm +++ b/macosx/PictureController.mm @@ -96,49 +96,41 @@ static int GetAlignedSize( int size ) [fDeinterlacePopUp addItemWithTitle: @"Slowest"]; /* Set deinterlaces level according to the integer in the main window */ - [fDeinterlacePopUp selectItemAtIndex: [fDeinterlaceLevelMainWindow intValue]]; + [fDeinterlacePopUp selectItemAtIndex: fPictureFilterSettings.deinterlace]; [fPARCheck setState: job->pixel_ratio ? NSOnState : NSOffState]; - if ([fAutoCropMainWindow intValue] == 0) + + if (!autoCrop) { - [fCropMatrix selectCellAtRow: 1 column:0]; - /* If auto, lets set the crop steppers according to current job->crop values */ - [fCropTopStepper setIntValue: job->crop[0]]; - [fCropTopField setIntValue: job->crop[0]]; - [fCropBottomStepper setIntValue: job->crop[1]]; - [fCropBottomField setIntValue: job->crop[1]]; - [fCropLeftStepper setIntValue: job->crop[2]]; - [fCropLeftField setIntValue: job->crop[2]]; - [fCropRightStepper setIntValue: job->crop[3]]; - [fCropRightField setIntValue: job->crop[3]]; + [fCropMatrix selectCellAtRow: 1 column:0]; + /* If auto, lets set the crop steppers according to current job->crop values */ + [fCropTopStepper setIntValue: job->crop[0]]; + [fCropTopField setIntValue: job->crop[0]]; + [fCropBottomStepper setIntValue: job->crop[1]]; + [fCropBottomField setIntValue: job->crop[1]]; + [fCropLeftStepper setIntValue: job->crop[2]]; + [fCropLeftField setIntValue: job->crop[2]]; + [fCropRightStepper setIntValue: job->crop[3]]; + [fCropRightField setIntValue: job->crop[3]]; } else { - [fCropMatrix selectCellAtRow: 0 column:0]; + [fCropMatrix selectCellAtRow: 0 column:0]; } /* set the detelecine state according to the state in main window */ /* if framerate is 23.976 we do not allow detelecine, otherwise, enable and set according to fDetelecineMainWindow outlet */ - if (fTitle->rate_base == 1126125 || [[fVidFrameRatePopUpMainWindow titleOfSelectedItem] isEqualToString: @"23.976 (NTSC Film)"]) + if (fTitle->rate_base == 1126125) { - [fDetelecineMainWindow setStringValue: @"No"]; [fDetelecineCheck setEnabled: NO]; [fDetelecineCheck setState: NSOffState]; } else { - [fDetelecineCheck setEnabled: YES]; - if ([[fDetelecineMainWindow stringValue] isEqualToString: @"Yes"]) - { - [fDetelecineCheck setState: NSOnState]; - } - else - { - [fDetelecineCheck setState: NSOffState]; - } - + [fDetelecineCheck setEnabled: YES]; + [fDetelecineCheck setState: fPictureFilterSettings.detelecine]; } /* we use a popup to show the denoise settings */ @@ -147,8 +139,8 @@ static int GetAlignedSize( int size ) [fDenoisePopUp addItemWithTitle: @"Weak"]; [fDenoisePopUp addItemWithTitle: @"Medium"]; [fDenoisePopUp addItemWithTitle: @"Strong"]; - /* Set deinterlaces level according to the integer in the main window */ - [fDenoisePopUp selectItemAtIndex: [fDenoiseMainWindow intValue]]; + /* Set denoises level according to the integer in the main window */ + [fDenoisePopUp selectItemAtIndex: fPictureFilterSettings.denoise]; MaxOutputWidth = job->width; MaxOutputHeight = job->height; @@ -230,77 +222,51 @@ static int GetAlignedSize( int size ) if ([fPARCheck state] == 1 ) { - [fWidthStepper setIntValue: MaxOutputWidth]; - [fWidthField setIntValue: MaxOutputWidth]; - - /* This will show correct anamorphic height values, but - show distorted preview picture ratio */ - [fHeightStepper setIntValue: fTitle->height-fTitle->job->crop[0]-fTitle->job->crop[1]]; - [fHeightField setIntValue: fTitle->height-fTitle->job->crop[0]-fTitle->job->crop[1]]; - - /* This will show wrong anamorphic height values, but - show proper preview picture ratio */ - //[fHeightStepper setIntValue: MaxOutputHeight]; - //[fHeightField setIntValue: MaxOutputHeight]; - [fRatioCheck setState: 0]; - - [fWidthStepper setEnabled: NO]; - [fWidthField setEnabled: NO]; - [fHeightStepper setEnabled: NO]; - [fHeightField setEnabled: NO]; - [fRatioCheck setEnabled: NO]; - - - } + [fWidthStepper setIntValue: MaxOutputWidth]; + [fWidthField setIntValue: MaxOutputWidth]; + + /* This will show correct anamorphic height values, but + show distorted preview picture ratio */ + [fHeightStepper setIntValue: fTitle->height-fTitle->job->crop[0]-fTitle->job->crop[1]]; + [fHeightField setIntValue: fTitle->height-fTitle->job->crop[0]-fTitle->job->crop[1]]; + + /* This will show wrong anamorphic height values, but + show proper preview picture ratio */ + //[fHeightStepper setIntValue: MaxOutputHeight]; + //[fHeightField setIntValue: MaxOutputHeight]; + [fRatioCheck setState: 0]; + + [fWidthStepper setEnabled: NO]; + [fWidthField setEnabled: NO]; + [fHeightStepper setEnabled: NO]; + [fHeightField setEnabled: NO]; + [fRatioCheck setEnabled: NO]; + } + else { - [fWidthStepper setEnabled: YES]; - [fWidthField setEnabled: YES]; - [fHeightStepper setEnabled: YES]; - [fHeightField setEnabled: YES]; - [fRatioCheck setEnabled: YES]; + [fWidthStepper setEnabled: YES]; + [fWidthField setEnabled: YES]; + [fHeightStepper setEnabled: YES]; + [fHeightField setEnabled: YES]; + [fRatioCheck setEnabled: YES]; } - - job->width = [fWidthStepper intValue]; job->height = [fHeightStepper intValue]; job->keep_ratio = ( [fRatioCheck state] == NSOnState ); - - /* multilevel deinterlacing popup */ - [fDeinterlaceLevelMainWindow setStringValue: [NSString stringWithFormat: @"%d",[fDeinterlacePopUp indexOfSelectedItem]]]; - if ([fDeinterlacePopUp indexOfSelectedItem] == 0) - { - job->deinterlace = 0; - } - else - { - job->deinterlace = 1; - } - - /* set the detelecine state according to the integer set in the main window field */ - if ([fDetelecineCheck state] == 1) - { - [fDetelecineMainWindow setStringValue: @"Yes"]; - } - else - { - [fDetelecineMainWindow setStringValue: @"No"]; - } - - /* new multilevel deinterlacing popup */ - [fDenoiseMainWindow setStringValue: [NSString stringWithFormat: @"%d",[fDenoisePopUp indexOfSelectedItem]]]; + fPictureFilterSettings.deinterlace = [fDeinterlacePopUp indexOfSelectedItem]; + fPictureFilterSettings.denoise = [fDenoisePopUp indexOfSelectedItem]; + fPictureFilterSettings.detelecine = [fDetelecineCheck state]; job->pixel_ratio = ( [fPARCheck state] == NSOnState ); - - - bool autocrop = ( [fCropMatrix selectedRow] == 0 ); - [fCropTopStepper setEnabled: !autocrop]; - [fCropBottomStepper setEnabled: !autocrop]; - [fCropLeftStepper setEnabled: !autocrop]; - [fCropRightStepper setEnabled: !autocrop]; - [fAutoCropMainWindow setStringValue: [NSString stringWithFormat:@"%d",autocrop]]; - if( autocrop ) + autoCrop = ( [fCropMatrix selectedRow] == 0 ); + [fCropTopStepper setEnabled: !autoCrop]; + [fCropBottomStepper setEnabled: !autoCrop]; + [fCropLeftStepper setEnabled: !autoCrop]; + [fCropRightStepper setEnabled: !autoCrop]; +// [fAutoCropMainWindow setStringValue: [NSString stringWithFormat:@"%d",autocrop]]; + if( autoCrop ) { memcpy( job->crop, fTitle->crop, 4 * sizeof( int ) ); } @@ -353,7 +319,7 @@ static int GetAlignedSize( int size ) no human can see any meaningful detail below that */ if (job->width >= 64 && job->height >= 64) { - [self Display: HB_ANIMATE_NONE]; + [self Display: HB_ANIMATE_NONE]; } } @@ -380,8 +346,73 @@ static int GetAlignedSize( int size ) - (IBAction) ClosePanel: (id) sender { - [NSApp stopModal]; } +- (BOOL) autoCrop +{ + return autoCrop; +} +- (void) setAutoCrop: (BOOL) setting +{ + autoCrop = setting; +} + +- (int) detelecine +{ + return fPictureFilterSettings.detelecine; +} + +- (void) setDetelecine: (int) setting +{ + fPictureFilterSettings.detelecine = setting; +} + +- (int) deinterlace +{ + return fPictureFilterSettings.deinterlace; +} + +- (void) setDeinterlace: (int) setting { + fPictureFilterSettings.deinterlace = setting; +} + +- (int) denoise +{ + return fPictureFilterSettings.denoise; +} + +- (void) setDenoise: (int) setting +{ + fPictureFilterSettings.denoise = setting; +} + +- (void) showPanelInWindow: (NSWindow *) fWindow forTitle:(hb_title_t *)title { + [self loadMyNibFile]; + + NSSize newSize; + newSize.width = 246 + title->width; + newSize.height = 80 + title->height; + [fPicturePanel setContentSize: newSize]; + + [self SetTitle: title]; + + [NSApp beginSheet: fPicturePanel modalForWindow: fWindow + modalDelegate: NULL didEndSelector: NULL contextInfo: NULL]; + [NSApp runModalForWindow: fPicturePanel]; + [NSApp endSheet: fPicturePanel]; + [fPicturePanel orderOut: self]; +} + +- (BOOL) loadMyNibFile +{ + if(![NSBundle loadNibNamed:@"PictureSettings" owner:self]) + { + NSLog(@"Warning! Could not load myNib file.\n"); + return NO; + } + + return YES; +} + @end |