diff options
author | ritsuka <[email protected]> | 2014-08-19 16:38:33 +0000 |
---|---|---|
committer | ritsuka <[email protected]> | 2014-08-19 16:38:33 +0000 |
commit | a37c2119baece04d28cd75816cd31270e317197a (patch) | |
tree | 567c00bd0ca0e34a0e0e0da978bf442797ec490e /macosx | |
parent | 5c5d825990ac79b9e7faa2d79a3edbd8b6232eea (diff) |
MacGui: added support for NLMeans denoise. Added the HBFilters class to store the filters settings, previously they were stored directly in the HBPictureController window controller.
Removed the filter tab animations for now, they will be added back later.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6319 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/Controller.h | 1 | ||||
-rw-r--r-- | macosx/Controller.m | 516 | ||||
-rw-r--r-- | macosx/English.lproj/PictureSettings.xib | 371 | ||||
-rw-r--r-- | macosx/HBCore.m | 6 | ||||
-rw-r--r-- | macosx/HBFilters.h | 74 | ||||
-rw-r--r-- | macosx/HBFilters.m | 453 | ||||
-rw-r--r-- | macosx/HBHUDButtonCell.h | 17 | ||||
-rw-r--r-- | macosx/HBHUDButtonCell.m | 22 | ||||
-rw-r--r-- | macosx/HBJob.h | 56 | ||||
-rw-r--r-- | macosx/HBJob.m | 191 | ||||
-rw-r--r-- | macosx/HBPicture.h | 30 | ||||
-rw-r--r-- | macosx/HBPicture.m | 13 | ||||
-rw-r--r-- | macosx/HBVideo.h | 34 | ||||
-rw-r--r-- | macosx/HBVideo.m | 13 | ||||
-rw-r--r-- | macosx/HandBrake.xcodeproj/project.pbxproj | 30 | ||||
-rw-r--r-- | macosx/PictureController.h | 18 | ||||
-rw-r--r-- | macosx/PictureController.m | 519 |
17 files changed, 1476 insertions, 888 deletions
diff --git a/macosx/Controller.h b/macosx/Controller.h index 14e4ac4ab..9ae122d21 100644 --- a/macosx/Controller.h +++ b/macosx/Controller.h @@ -236,7 +236,6 @@ extern NSString *keyTitleTag; /* Text summaries of various settings */ - (NSString*) pictureSettingsSummary; -- (NSString*) pictureFiltersSummary; - (NSString*) muxerOptionsSummary; /* Add All titles to the queue */ diff --git a/macosx/Controller.m b/macosx/Controller.m index efbf6e863..72cd0055c 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -2511,7 +2511,7 @@ fWorkingCount = 0; /* Text summaries of various settings */ [queueFileJob setObject:[NSString stringWithString:[self pictureSettingsSummary]] forKey:@"PictureSettingsSummary"]; - [queueFileJob setObject:[NSString stringWithString:[self pictureFiltersSummary]] + [queueFileJob setObject:fPictureController.filters.summary forKey:@"PictureFiltersSummary"]; [queueFileJob setObject:[NSString stringWithString:[self muxerOptionsSummary]] forKey:@"MuxerOptionsSummary"]; @@ -2522,25 +2522,27 @@ fWorkingCount = 0; [queueFileJob setObject:[NSNumber numberWithInt:job->crop[1]] forKey:@"PictureBottomCrop"]; [queueFileJob setObject:[NSNumber numberWithInt:job->crop[2]] forKey:@"PictureLeftCrop"]; [queueFileJob setObject:[NSNumber numberWithInt:job->crop[3]] forKey:@"PictureRightCrop"]; - + /* Picture Filters */ - [queueFileJob setObject:[NSNumber numberWithInteger:[fPictureController detelecine]] forKey:@"PictureDetelecine"]; - [queueFileJob setObject:[fPictureController detelecineCustomString] forKey:@"PictureDetelecineCustom"]; - - [queueFileJob setObject:[NSNumber numberWithInteger:[fPictureController useDecomb]] forKey:@"PictureDecombDeinterlace"]; - [queueFileJob setObject:[NSNumber numberWithInteger:[fPictureController decomb]] forKey:@"PictureDecomb"]; - [queueFileJob setObject:[fPictureController decombCustomString] forKey:@"PictureDecombCustom"]; - - [queueFileJob setObject:[NSNumber numberWithInteger:[fPictureController deinterlace]] forKey:@"PictureDeinterlace"]; - [queueFileJob setObject:[fPictureController deinterlaceCustomString] forKey:@"PictureDeinterlaceCustom"]; - - [queueFileJob setObject:[NSNumber numberWithInteger:[fPictureController denoise]] forKey:@"PictureDenoise"]; - [queueFileJob setObject:[fPictureController denoiseCustomString] forKey:@"PictureDenoiseCustom"]; - - [queueFileJob setObject:[NSString stringWithFormat:@"%ld",(long)[fPictureController deblock]] forKey:@"PictureDeblock"]; - - [queueFileJob setObject:[NSNumber numberWithInteger:[fPictureController grayscale]] forKey:@"VideoGrayScale"]; - + HBFilters *filters = fPictureController.filters; + queueFileJob[@"PictureDetelecine"] = @(filters.detelecine); + queueFileJob[@"PictureDetelecineCustom"] = filters.detelecineCustomString; + + queueFileJob[@"PictureDecombDeinterlace"] = @(filters.useDecomb); + queueFileJob[@"PictureDecomb"] = @(filters.decomb); + queueFileJob[@"PictureDecombCustom"] = filters.decombCustomString; + + queueFileJob[@"PictureDeinterlace"] = @(filters.deinterlace); + queueFileJob[@"PictureDeinterlaceCustom"] = filters.deinterlaceCustomString; + + queueFileJob[@"PictureDenoise"] = filters.denoise; + queueFileJob[@"PictureDenoisePreset"] = filters.denoisePreset; + queueFileJob[@"PictureDenoiseTune"] = filters.denoiseTune; + queueFileJob[@"PictureDenoiseCustom"] = filters.denoiseCustomString; + + queueFileJob[@"PictureDeblock"] = [NSString stringWithFormat:@"%ld",(long)filters.deblock]; + queueFileJob[@"VideoGrayScale"] = [NSString stringWithFormat:@"%ld",(long)filters.grayscale]; + /* Auto Passthru */ [queueFileJob setObject:@(fAudioController.settings.allowAACPassthru) forKey: @"AudioAllowAACPass"]; [queueFileJob setObject:@(fAudioController.settings.allowAC3Passthru) forKey: @"AudioAllowAC3Pass"]; @@ -2893,23 +2895,25 @@ fWorkingCount = 0; job->height = [[queueToApply objectForKey:@"PictureHeight"] intValue]; /* Filters */ - + + HBFilters *filters = [fPictureController filters]; + /* We only allow *either* Decomb or Deinterlace. So check for the PictureDecombDeinterlace key. */ - [fPictureController setUseDecomb:1]; - [fPictureController setDecomb:0]; - [fPictureController setDeinterlace:0]; - if ([[queueToApply objectForKey:@"PictureDecombDeinterlace"] intValue] == 1) + filters.useDecomb = YES; + filters.decomb = 0; + filters.deinterlace = 0; + if ([queueToApply[@"PictureDecombDeinterlace"] intValue] == 1) { /* we are using decomb */ /* Decomb */ - if ([[queueToApply objectForKey:@"PictureDecomb"] intValue] > 0) + if ([queueToApply[@"PictureDecomb"] intValue] > 0) { - [fPictureController setDecomb:[[queueToApply objectForKey:@"PictureDecomb"] intValue]]; - + filters.decomb = [queueToApply[@"PictureDecomb"] intValue]; + /* if we are using "Custom" in the decomb setting, also set the custom string*/ - if ([[queueToApply objectForKey:@"PictureDecomb"] intValue] == 1) + if ([queueToApply[@"PictureDecomb"] intValue] == 1) { - [fPictureController setDecombCustomString:[queueToApply objectForKey:@"PictureDecombCustom"]]; + filters.decombCustomString = queueToApply[@"PictureDecombCustom"]; } } } @@ -2917,70 +2921,53 @@ fWorkingCount = 0; { /* We are using Deinterlace */ /* Deinterlace */ - if ([[queueToApply objectForKey:@"PictureDeinterlace"] intValue] > 0) + if ([queueToApply[@"PictureDeinterlace"] intValue] > 0) { - [fPictureController setUseDecomb:0]; - [fPictureController setDeinterlace:[[queueToApply objectForKey:@"PictureDeinterlace"] intValue]]; + filters.useDecomb = NO; + filters.deinterlace = [queueToApply[@"PictureDeinterlace"] intValue]; /* if we are using "Custom" in the deinterlace setting, also set the custom string*/ - if ([[queueToApply objectForKey:@"PictureDeinterlace"] intValue] == 1) + if ([queueToApply[@"PictureDeinterlace"] intValue] == 1) { - [fPictureController setDeinterlaceCustomString:[queueToApply objectForKey:@"PictureDeinterlaceCustom"]]; + filters.deinterlaceCustomString = queueToApply[@"PictureDeinterlaceCustom"]; } } } - - + /* Detelecine */ - if ([[queueToApply objectForKey:@"PictureDetelecine"] intValue] > 0) + if ([queueToApply[@"PictureDetelecine"] intValue] > 0) { - [fPictureController setDetelecine:[[queueToApply objectForKey:@"PictureDetelecine"] intValue]]; + filters.detelecine = [queueToApply[@"PictureDetelecine"] intValue]; /* if we are using "Custom" in the detelecine setting, also set the custom string*/ - if ([[queueToApply objectForKey:@"PictureDetelecine"] intValue] == 1) + if ([queueToApply[@"PictureDetelecine"] intValue] == 1) { - [fPictureController setDetelecineCustomString:[queueToApply objectForKey:@"PictureDetelecineCustom"]]; + filters.detelecineCustomString = queueToApply[@"PictureDetelecineCustom"]; } } else { - [fPictureController setDetelecine:0]; + filters.detelecine = 0; } - + /* Denoise */ - if ([[queueToApply objectForKey:@"PictureDenoise"] intValue] > 0) - { - [fPictureController setDenoise:[[queueToApply objectForKey:@"PictureDenoise"] intValue]]; - /* if we are using "Custom" in the denoise setting, also set the custom string*/ - if ([[queueToApply objectForKey:@"PictureDenoise"] intValue] == 1) - { - [fPictureController setDenoiseCustomString:[queueToApply objectForKey:@"PictureDenoiseCustom"]]; - } - } - else - { - [fPictureController setDenoise:0]; - } - + filters.denoise = queueToApply[@"PictureDenoise"]; + filters.denoisePreset = queueToApply[@"PictureDenoisePreset"]; + filters.denoiseTune = queueToApply[@"PictureDenoiseTune"]; + filters.denoiseCustomString = queueToApply[@"PictureDenoiseCustom"]; + /* Deblock */ - if ([[queueToApply objectForKey:@"PictureDeblock"] intValue] == 1) + if ([queueToApply[@"PictureDeblock"] intValue] == 1) { /* if its a one, then its the old on/off deblock, set on to 5*/ - [fPictureController setDeblock:5]; + filters.deblock = 5; } else { /* use the settings intValue */ - [fPictureController setDeblock:[[queueToApply objectForKey:@"PictureDeblock"] intValue]]; - } - - if ([[queueToApply objectForKey:@"VideoGrayScale"] intValue] == 1) - { - [fPictureController setGrayscale:1]; - } - else - { - [fPictureController setGrayscale:0]; + filters.deblock = [queueToApply[@"PictureDeblock"] intValue]; } - + + filters.grayscale = [queueToApply[@"VideoGrayScale"] boolValue]; + /* we call SetTitle: in fPictureController so we get an instant update in the Picture Settings window */ [fPictureController setTitle:fTitle]; [self pictureSettingsDidChange]; @@ -3019,7 +3006,6 @@ fWorkingCount = 0; hb_title_t * title = (hb_title_t *) hb_list_item( list, (int)[fSrcTitlePopUp indexOfSelectedItem] ); hb_job_t * job = title->job; - hb_filter_object_t * filter; /* set job->angle for libdvdnav */ job->angle = (int)[fSrcAnglePopUp indexOfSelectedItem] + 1; /* Chapter selection */ @@ -3128,7 +3114,7 @@ fWorkingCount = 0; } if( one_burned ) { - filter = hb_filter_init( HB_FILTER_RENDER_SUB ); + hb_filter_object_t *filter = hb_filter_init( HB_FILTER_RENDER_SUB ); hb_add_filter( job, filter, [[NSString stringWithFormat:@"%d:%d:%d:%d", job->crop[0], job->crop[1], job->crop[2], job->crop[3]] UTF8String] ); @@ -3194,7 +3180,7 @@ fWorkingCount = 0; * we put it here since its in the filters panel */ - if ([fPictureController grayscale]) + if ([fPictureController.filters grayscale]) { job->grayscale = 1; } @@ -3209,122 +3195,123 @@ fWorkingCount = 0; /* Detelecine */ - filter = hb_filter_init( HB_FILTER_DETELECINE ); - if ([fPictureController detelecine] == 1) + HBFilters *filters = [fPictureController filters]; + if (filters.detelecine == 1) { + hb_filter_object_t *filter = hb_filter_init(HB_FILTER_DETELECINE); /* use a custom detelecine string */ - hb_add_filter( job, filter, [[fPictureController detelecineCustomString] UTF8String] ); + hb_add_filter(job, filter, [filters.detelecineCustomString UTF8String]); } - else if ([fPictureController detelecine] == 2) + else if (filters.detelecine == 2) { /* Default */ - hb_add_filter( job, filter, NULL ); + hb_filter_object_t *filter = hb_filter_init(HB_FILTER_DETELECINE); + hb_add_filter(job, filter, NULL); } - - - - if ([fPictureController useDecomb] == 1) + if (filters.useDecomb == YES) { /* Decomb */ - filter = hb_filter_init( HB_FILTER_DECOMB ); - if ([fPictureController decomb] == 1) + hb_filter_object_t *filter = hb_filter_init(HB_FILTER_DECOMB); + if (filters.decomb == 1) { /* use a custom decomb string */ - hb_add_filter( job, filter, [[fPictureController decombCustomString] UTF8String] ); + hb_add_filter(job, filter, [filters.decombCustomString UTF8String]); } - else if ([fPictureController decomb] == 2) + else if (filters.decomb == 2) { /* use libhb defaults */ - hb_add_filter( job, filter, NULL ); + hb_add_filter(job, filter, NULL); } - else if ([fPictureController decomb] == 3) + else if (filters.decomb == 3) { /* use old defaults (decomb fast) */ - hb_add_filter( job, filter, "7:2:6:9:1:80" ); + hb_add_filter(job, filter, "7:2:6:9:1:80"); } - else if ([fPictureController decomb] == 4) + else if (filters.decomb == 4) { /* decomb 3 with bobbing enabled */ - hb_add_filter( job, filter, "455" ); + hb_add_filter(job, filter, "455"); } } else { /* Deinterlace */ - filter = hb_filter_init( HB_FILTER_DEINTERLACE ); - if ([fPictureController deinterlace] == 1) + hb_filter_object_t *filter = hb_filter_init(HB_FILTER_DEINTERLACE); + if (filters.deinterlace == 1) { /* we add the custom string if present */ - hb_add_filter( job, filter, [[fPictureController deinterlaceCustomString] UTF8String] ); + hb_add_filter(job, filter, [filters.deinterlaceCustomString UTF8String]); } - else if ([fPictureController deinterlace] == 2) + else if (filters.deinterlace == 2) { /* Run old deinterlacer fd by default */ - hb_add_filter( job, filter, "0" ); + hb_add_filter(job, filter, "0"); } - else if ([fPictureController deinterlace] == 3) + else if (filters.deinterlace == 3) { /* Yadif mode 0 (without spatial deinterlacing) */ - hb_add_filter( job, filter, "1" ); + hb_add_filter(job, filter, "1"); } - else if ([fPictureController deinterlace] == 4) + else if (filters.deinterlace == 4) { /* Yadif (with spatial deinterlacing) */ - hb_add_filter( job, filter, "3" ); + hb_add_filter(job, filter, "3"); } - else if ([fPictureController deinterlace] == 5) + else if (filters.deinterlace == 5) { /* Yadif (with spatial deinterlacing and bobbing) */ - hb_add_filter( job, filter, "15" ); + hb_add_filter(job, filter, "15"); } } - + /* Denoise */ - filter = hb_filter_init( HB_FILTER_DENOISE ); - if ([fPictureController denoise] == 1) // custom in popup - { - /* we add the custom string if present */ - hb_add_filter( job, filter, [[fPictureController denoiseCustomString] UTF8String] ); - } - else if ([fPictureController denoise] == 2) // Weak in popup - { - hb_add_filter( job, filter, "2:1:1:2:3:3" ); - } - else if ([fPictureController denoise] == 3) // Medium in popup - { - hb_add_filter( job, filter, "3:2:2:2:3:3" ); - } - else if ([fPictureController denoise] == 4) // Strong in popup - { - hb_add_filter( job, filter, "7:7:7:5:5:5" ); - } - - + if (filters.denoise) + { + int filter_id = HB_FILTER_HQDN3D; + if ([filters.denoise isEqualToString:@"nlmeans"]) + filter_id = HB_FILTER_NLMEANS; + + if ([filters.denoisePreset isEqualToString:@"custom"]) + { + const char *filter_str; + filter_str = [filters.denoiseCustomString UTF8String]; + hb_filter_object_t *filter = hb_filter_init(filter_id); + hb_add_filter(job, filter, filter_str); + } + else + { + const char *filter_str, *preset, *tune; + preset = [filters.denoisePreset UTF8String]; + tune = [filters.denoiseTune UTF8String]; + filter_str = hb_generate_filter_settings(filter_id, preset, tune); + hb_filter_object_t *filter = hb_filter_init(filter_id); + hb_add_filter(job, filter, filter_str); + } + } + /* Deblock (uses pp7 default) */ /* NOTE: even though there is a valid deblock setting of 0 for the filter, for * the macgui's purposes a value of 0 actually means to not even use the filter * current hb_filter_deblock.settings valid ranges are from 5 - 15 */ - filter = hb_filter_init( HB_FILTER_DEBLOCK ); - if ([fPictureController deblock] != 0) + if (filters.deblock != 0) { - NSString *deblockStringValue = [NSString stringWithFormat: @"%ld",(long)[fPictureController deblock]]; + hb_filter_object_t *filter = hb_filter_init( HB_FILTER_DEBLOCK ); + NSString *deblockStringValue = [NSString stringWithFormat: @"%ld",(long)filters.deblock]; hb_add_filter( job, filter, [deblockStringValue UTF8String] ); } /* Add Crop/Scale filter */ - filter = hb_filter_init( HB_FILTER_CROP_SCALE ); + hb_filter_object_t *filter = hb_filter_init( HB_FILTER_CROP_SCALE ); hb_add_filter( job, filter, [[NSString stringWithFormat:@"%d:%d:%d:%d:%d:%d", job->width,job->height, job->crop[0], job->crop[1], job->crop[2], job->crop[3]] UTF8String] ); } - #pragma mark - #pragma mark Job Handling - - (void) prepareJob { @@ -3784,26 +3771,30 @@ fWorkingCount = 0; } } /* Denoise */ - filter = hb_filter_init( HB_FILTER_DENOISE ); - if ([[queueToApply objectForKey:@"PictureDenoise"] intValue] == 1) // Custom in popup - { - /* we add the custom string if present */ - hb_add_filter( job, filter, [[queueToApply objectForKey:@"PictureDenoiseCustom"] UTF8String] ); - } - else if ([[queueToApply objectForKey:@"PictureDenoise"] intValue] == 2) // Weak in popup - { - hb_add_filter( job, filter, "2:1:1:2:3:3" ); - } - else if ([[queueToApply objectForKey:@"PictureDenoise"] intValue] == 3) // Medium in popup - { - hb_add_filter( job, filter, "3:2:2:2:3:3" ); - } - else if ([[queueToApply objectForKey:@"PictureDenoise"] intValue] == 4) // Strong in popup - { - hb_add_filter( job, filter, "7:7:7:5:5:5" ); - } - - + if (![queueToApply[@"PictureDenoise"] isEqualToString:@"off"]) + { + int filter_id = HB_FILTER_HQDN3D; + if ([queueToApply[@"PictureDenoise"] isEqualToString:@"nlmeans"]) + filter_id = HB_FILTER_NLMEANS; + + if ([queueToApply[@"PictureDenoisePreset"] isEqualToString:@"custom"]) + { + const char *filter_str; + filter_str = [queueToApply[@"PictureDenoiseCustom"] UTF8String]; + filter = hb_filter_init(filter_id); + hb_add_filter(job, filter, filter_str); + } + else + { + const char *filter_str, *preset, *tune; + preset = [queueToApply[@"PictureDenoisePreset"] UTF8String]; + tune = [queueToApply[@"PictureDenoiseTune"] UTF8String]; + filter_str = hb_generate_filter_settings(filter_id, preset, tune); + filter = hb_filter_init(filter_id); + hb_add_filter(job, filter, filter_str); + } + } + /* Deblock (uses pp7 default) */ /* NOTE: even though there is a valid deblock setting of 0 for the filter, for * the macgui's purposes a value of 0 actually means to not even use the filter @@ -4610,7 +4601,7 @@ the user is using "Custom" settings by determining the sender*/ { // align picture settings and video filters in the UI using tabs fVideoController.pictureSettingsField = [self pictureSettingsSummary]; - fVideoController.pictureFiltersField = [self pictureFiltersSummary]; + fVideoController.pictureFiltersField = fPictureController.filters.summary; /* Store storage resolution for unparse */ if (fTitle) @@ -4644,128 +4635,6 @@ the user is using "Custom" settings by determining the sender*/ return [NSString stringWithString:summary]; } -- (NSString*) pictureFiltersSummary -{ - NSMutableString *summary = [NSMutableString stringWithString:@""]; - if (fPictureController) - { - /* Detelecine */ - switch ([fPictureController detelecine]) - { - case 1: - [summary appendFormat:@" - Detelecine (%@)", - [fPictureController detelecineCustomString]]; - break; - - case 2: - [summary appendString:@" - Detelecine (Default)"]; - break; - - default: - break; - } - - if ([fPictureController useDecomb] == 1) - { - /* Decomb */ - switch ([fPictureController decomb]) - { - case 1: - [summary appendFormat:@" - Decomb (%@)", - [fPictureController decombCustomString]]; - break; - - case 2: - [summary appendString:@" - Decomb (Default)"]; - break; - - case 3: - [summary appendString:@" - Decomb (Fast)"]; - break; - - case 4: - [summary appendString:@" - Decomb (Bob)"]; - break; - - default: - break; - } - } - else - { - /* Deinterlace */ - switch ([fPictureController deinterlace]) - { - case 1: - [summary appendFormat:@" - Deinterlace (%@)", - [fPictureController deinterlaceCustomString]]; - break; - - case 2: - [summary appendString:@" - Deinterlace (Fast)"]; - break; - - case 3: - [summary appendString:@" - Deinterlace (Slow)"]; - break; - - case 4: - [summary appendString:@" - Deinterlace (Slower)"]; - break; - - case 5: - [summary appendString:@" - Deinterlace (Bob)"]; - break; - - default: - break; - } - } - - /* Deblock */ - if ([fPictureController deblock] > 0) - { - [summary appendFormat:@" - Deblock (%ld)", - (long)[fPictureController deblock]]; - } - - /* Denoise */ - switch ([fPictureController denoise]) - { - case 1: - [summary appendFormat:@" - Denoise (%@)", - [fPictureController denoiseCustomString]]; - break; - - case 2: - [summary appendString:@" - Denoise (Weak)"]; - break; - - case 3: - [summary appendString:@" - Denoise (Medium)"]; - break; - - case 4: - [summary appendString:@" - Denoise (Strong)"]; - break; - - default: - break; - } - - /* Grayscale */ - if ([fPictureController grayscale]) - { - [summary appendString:@" - Grayscale"]; - } - } - if ([summary hasPrefix:@" - "]) - { - [summary deleteCharactersInRange:NSMakeRange(0, 3)]; - } - return [NSString stringWithString:summary]; -} - - (NSString*) muxerOptionsSummary { NSMutableString *summary = [NSMutableString stringWithString:@""]; @@ -5038,98 +4907,7 @@ the user is using "Custom" settings by determining the sender*/ job->anamorphic.par_width = par_width; job->anamorphic.par_height = par_height; - /* If the preset has an objectForKey:@"UsesPictureFilters", and handle the filters here */ - if ([chosenPreset objectForKey:@"UsesPictureFilters"] && [[chosenPreset objectForKey:@"UsesPictureFilters"] intValue] > 0) - { - /* Filters */ - - /* We only allow *either* Decomb or Deinterlace. So check for the PictureDecombDeinterlace key. */ - [fPictureController setUseDecomb:1]; - [fPictureController setDecomb:0]; - [fPictureController setDeinterlace:0]; - if ([[chosenPreset objectForKey:@"PictureDecombDeinterlace"] intValue] == 1) - { - /* we are using decomb */ - /* Decomb */ - if ([[chosenPreset objectForKey:@"PictureDecomb"] intValue] > 0) - { - [fPictureController setDecomb:[[chosenPreset objectForKey:@"PictureDecomb"] intValue]]; - - /* if we are using "Custom" in the decomb setting, also set the custom string*/ - if ([[chosenPreset objectForKey:@"PictureDecomb"] intValue] == 1) - { - [fPictureController setDecombCustomString:[chosenPreset objectForKey:@"PictureDecombCustom"]]; - } - } - } - else - { - /* We are using Deinterlace */ - /* Deinterlace */ - if ([[chosenPreset objectForKey:@"PictureDeinterlace"] intValue] > 0) - { - [fPictureController setUseDecomb:0]; - [fPictureController setDeinterlace:[[chosenPreset objectForKey:@"PictureDeinterlace"] intValue]]; - /* if we are using "Custom" in the deinterlace setting, also set the custom string*/ - if ([[chosenPreset objectForKey:@"PictureDeinterlace"] intValue] == 1) - { - [fPictureController setDeinterlaceCustomString:[chosenPreset objectForKey:@"PictureDeinterlaceCustom"]]; - } - } - } - - - /* Detelecine */ - if ([[chosenPreset objectForKey:@"PictureDetelecine"] intValue] > 0) - { - [fPictureController setDetelecine:[[chosenPreset objectForKey:@"PictureDetelecine"] intValue]]; - /* if we are using "Custom" in the detelecine setting, also set the custom string*/ - if ([[chosenPreset objectForKey:@"PictureDetelecine"] intValue] == 1) - { - [fPictureController setDetelecineCustomString:[chosenPreset objectForKey:@"PictureDetelecineCustom"]]; - } - } - else - { - [fPictureController setDetelecine:0]; - } - - /* Denoise */ - if ([[chosenPreset objectForKey:@"PictureDenoise"] intValue] > 0) - { - [fPictureController setDenoise:[[chosenPreset objectForKey:@"PictureDenoise"] intValue]]; - /* if we are using "Custom" in the denoise setting, also set the custom string*/ - if ([[chosenPreset objectForKey:@"PictureDenoise"] intValue] == 1) - { - [fPictureController setDenoiseCustomString:[chosenPreset objectForKey:@"PictureDenoiseCustom"]]; - } - } - else - { - [fPictureController setDenoise:0]; - } - - /* Deblock */ - if ([[chosenPreset objectForKey:@"PictureDeblock"] intValue] == 1) - { - /* if its a one, then its the old on/off deblock, set on to 5*/ - [fPictureController setDeblock:5]; - } - else - { - /* use the settings intValue */ - [fPictureController setDeblock:[[chosenPreset objectForKey:@"PictureDeblock"] intValue]]; - } - - if ([[chosenPreset objectForKey:@"VideoGrayScale"] intValue] == 1) - { - [fPictureController setGrayscale:1]; - } - else - { - [fPictureController setGrayscale:0]; - } - } + [fPictureController.filters applySettingsFromPreset:chosenPreset]; } /* we call SetTitle: in fPictureController so we get an instant update in the Picture Settings window */ [fPictureController setTitle:fTitle]; @@ -5300,17 +5078,7 @@ the user is using "Custom" settings by determining the sender*/ [preset setObject:[NSNumber numberWithInt:job->crop[3]] forKey:@"PictureRightCrop"]; /* Picture Filters */ - [preset setObject:[NSNumber numberWithInteger:[fPictureController useDecomb]] forKey:@"PictureDecombDeinterlace"]; - [preset setObject:[NSNumber numberWithInteger:[fPictureController deinterlace]] forKey:@"PictureDeinterlace"]; - [preset setObject:[fPictureController deinterlaceCustomString] forKey:@"PictureDeinterlaceCustom"]; - [preset setObject:[NSNumber numberWithInteger:[fPictureController detelecine]] forKey:@"PictureDetelecine"]; - [preset setObject:[fPictureController detelecineCustomString] forKey:@"PictureDetelecineCustom"]; - [preset setObject:[NSNumber numberWithInteger:[fPictureController denoise]] forKey:@"PictureDenoise"]; - [preset setObject:[fPictureController denoiseCustomString] forKey:@"PictureDenoiseCustom"]; - [preset setObject:[NSNumber numberWithInteger:[fPictureController deblock]] forKey:@"PictureDeblock"]; - [preset setObject:[NSNumber numberWithInteger:[fPictureController decomb]] forKey:@"PictureDecomb"]; - [preset setObject:[fPictureController decombCustomString] forKey:@"PictureDecombCustom"]; - [preset setObject:[NSNumber numberWithInteger:[fPictureController grayscale]] forKey:@"VideoGrayScale"]; + [fPictureController.filters prepareFiltersForPreset:preset]; /* Audio */ [fAudioController.settings prepareAudioForPreset:preset]; diff --git a/macosx/English.lproj/PictureSettings.xib b/macosx/English.lproj/PictureSettings.xib index 691d37b2f..70313f093 100644 --- a/macosx/English.lproj/PictureSettings.xib +++ b/macosx/English.lproj/PictureSettings.xib @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> -<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="5056" systemVersion="13F7" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none"> +<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="5056" systemVersion="13F14" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none"> <dependencies> <deployment version="1060" defaultVersion="1090" identifier="macosx"/> <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="5056"/> @@ -19,20 +19,22 @@ <outlet property="fCropTopStepper" destination="12" id="61"/> <outlet property="fDeblockBox" destination="421" id="434"/> <outlet property="fDeblockField" destination="291" id="372"/> - <outlet property="fDeblockSlider" destination="292" id="371"/> <outlet property="fDecombBox" destination="315" id="364"/> + <outlet property="fDecombCustomTextField" destination="316" id="VbO-pu-4GQ"/> <outlet property="fDecombDeinterlaceBox" destination="287" id="360"/> - <outlet property="fDecombDeinterlaceSlider" destination="313" id="361"/> - <outlet property="fDecombPopUp" destination="318" id="362"/> <outlet property="fDeinterlaceBox" destination="314" id="365"/> - <outlet property="fDeinterlacePopUp" destination="328" id="366"/> <outlet property="fDenoiseBox" destination="288" id="368"/> - <outlet property="fDenoisePopUp" destination="300" id="369"/> + <outlet property="fDenoiseCustomField" destination="302" id="OGp-PW-gBH"/> + <outlet property="fDenoiseCustomLabel" destination="301" id="gyb-ha-nT2"/> + <outlet property="fDenoiseCustomTextField" destination="302" id="ocm-va-TCv"/> + <outlet property="fDenoisePreset" destination="ZSz-Vu-qC0" id="ksD-JU-hU9"/> + <outlet property="fDenoisePresetPopUp" destination="2F0-KY-tOC" id="qWR-VK-SxC"/> + <outlet property="fDenoisePresetPopup" destination="2F0-KY-tOC" id="viA-Tt-qd7"/> + <outlet property="fDenoiseTuneLabel" destination="gpP-sp-Lev" id="Q7g-G7-JZZ"/> + <outlet property="fDenoiseTunePopUp" destination="Upd-5E-OpR" id="5UN-Gt-l11"/> <outlet property="fDetelecineBox" destination="286" id="356"/> - <outlet property="fDetelecinePopUp" destination="345" id="358"/> <outlet property="fDisplayWidthField" destination="396" id="407"/> <outlet property="fDisplayWidthLabel" destination="402" id="526"/> - <outlet property="fGrayscaleCheck" destination="293" id="373"/> <outlet property="fHeightField" destination="43" id="66"/> <outlet property="fHeightStepper" destination="46" id="67"/> <outlet property="fModulusLabel" destination="390" id="532"/> @@ -54,17 +56,17 @@ </customObject> <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/> <customObject id="-3" userLabel="Application"/> - <window title="Picture Settings" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" hidesOnDeactivate="YES" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" animationBehavior="default" id="5" userLabel="PicturePanel" customClass="NSPanel"> + <window title="Picture Settings" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" hidesOnDeactivate="YES" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" frameAutosaveName="PictureSizing" animationBehavior="default" id="5" userLabel="PicturePanel" customClass="NSPanel"> <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" utility="YES" HUD="YES"/> <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/> - <rect key="contentRect" x="63" y="414" width="635" height="394"/> + <rect key="contentRect" x="63" y="414" width="635" height="252"/> <rect key="screenRect" x="0.0" y="0.0" width="2560" height="1418"/> <view key="contentView" id="6"> - <rect key="frame" x="0.0" y="0.0" width="635" height="394"/> + <rect key="frame" x="0.0" y="0.0" width="635" height="252"/> <autoresizingMask key="autoresizingMask"/> <userGuides> <userLayoutGuide affinity="minY"/> - <userLayoutGuide location="125" affinity="minX"/> + <userLayoutGuide location="101" affinity="minX"/> </userGuides> <subviews> <textField verticalHuggingPriority="750" id="262"> @@ -86,17 +88,17 @@ </textFieldCell> </textField> <tabView controlSize="mini" initialItem="282" id="281"> - <rect key="frame" x="-12" y="18" width="658" height="358"/> + <rect key="frame" x="-12" y="18" width="658" height="216"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <font key="font" metaFont="miniSystem"/> <tabViewItems> <tabViewItem label="Size" identifier="1" id="282"> <view key="view" id="285"> - <rect key="frame" x="10" y="19" width="638" height="326"/> + <rect key="frame" x="10" y="19" width="638" height="184"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <subviews> <box title="Box" borderType="none" titlePosition="noTitle" id="436"> - <rect key="frame" x="14" y="191" width="358" height="126"/> + <rect key="frame" x="14" y="49" width="358" height="126"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <view key="contentView"> <rect key="frame" x="0.0" y="0.0" width="358" height="126"/> @@ -168,7 +170,7 @@ <stepper horizontalHuggingPriority="750" verticalHuggingPriority="750" id="44"> <rect key="frame" x="143" y="103" width="15" height="22"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> - <stepperCell key="cell" controlSize="small" continuous="YES" alignment="left" increment="16" minValue="64" maxValue="59" doubleValue="64" id="169"> + <stepperCell key="cell" controlSize="small" continuous="YES" alignment="left" increment="16" minValue="64" maxValue="59" doubleValue="59" id="169"> <font key="font" metaFont="smallSystem"/> </stepperCell> <connections> @@ -205,7 +207,7 @@ <stepper horizontalHuggingPriority="750" verticalHuggingPriority="750" id="46"> <rect key="frame" x="143" y="78" width="15" height="22"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> - <stepperCell key="cell" controlSize="small" continuous="YES" alignment="left" increment="16" minValue="64" maxValue="59" doubleValue="59" id="171"> + <stepperCell key="cell" controlSize="small" continuous="YES" alignment="left" increment="16" minValue="64" maxValue="59" doubleValue="64" id="171"> <font key="font" metaFont="smallSystem"/> </stepperCell> <connections> @@ -301,7 +303,7 @@ <color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> </box> <box borderType="none" titlePosition="noTitle" id="7"> - <rect key="frame" x="374" y="191" width="254" height="126"/> + <rect key="frame" x="374" y="49" width="254" height="126"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <view key="contentView"> <rect key="frame" x="0.0" y="0.0" width="254" height="126"/> @@ -328,22 +330,22 @@ </stepperCell> </stepper> <matrix verticalHuggingPriority="750" allowsEmptySelection="NO" autosizesCells="NO" id="16"> - <rect key="frame" x="64" y="97" width="20" height="24"/> + <rect key="frame" x="64" y="92" width="81" height="31"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> - <size key="cellSize" width="20" height="11"/> - <size key="intercellSpacing" width="4" height="2"/> - <buttonCell key="prototype" type="radio" title="Radio" imagePosition="left" alignment="left" controlSize="mini" inset="2" id="178"> + <size key="cellSize" width="81" height="14"/> + <size key="intercellSpacing" width="2" height="3"/> + <buttonCell key="prototype" type="radio" title="Radio" imagePosition="left" alignment="left" controlSize="mini" inset="2" id="178" customClass="HBHUDButtonCell"> <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> <font key="font" metaFont="miniSystem"/> </buttonCell> <cells> <column> - <buttonCell type="radio" title="Automatic" imagePosition="left" alignment="left" controlSize="mini" state="on" inset="2" id="17"> + <buttonCell type="radio" title="Automatic" imagePosition="left" alignment="left" controlSize="mini" state="on" inset="2" id="17" customClass="HBHUDButtonCell"> <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> <font key="font" metaFont="miniSystem"/> </buttonCell> - <buttonCell type="radio" title="Custom:" imagePosition="left" alignment="left" controlSize="mini" inset="2" id="18"> + <buttonCell type="radio" title="Custom:" imagePosition="left" alignment="left" controlSize="mini" inset="2" id="18" customClass="HBHUDButtonCell"> <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> <font key="font" metaFont="miniSystem"/> </buttonCell> @@ -409,24 +411,6 @@ </connections> </stepperCell> </stepper> - <textField verticalHuggingPriority="750" id="250"> - <rect key="frame" x="80" y="111" width="68" height="11"/> - <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> - <textFieldCell key="cell" controlSize="mini" sendsActionOnEndEditing="YES" alignment="left" title="Automatic" id="251"> - <font key="font" metaFont="miniSystem"/> - <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/> - <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> - </textFieldCell> - </textField> - <textField verticalHuggingPriority="750" id="252"> - <rect key="frame" x="80" y="97" width="68" height="11"/> - <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> - <textFieldCell key="cell" controlSize="mini" sendsActionOnEndEditing="YES" alignment="left" title="Custom" id="253"> - <font key="font" metaFont="miniSystem"/> - <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/> - <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> - </textFieldCell> - </textField> <textField verticalHuggingPriority="750" id="382"> <rect key="frame" x="3" y="107" width="59" height="17"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> @@ -446,18 +430,18 @@ </tabViewItem> <tabViewItem label="Filters" identifier="2" id="283"> <view key="view" id="284"> - <rect key="frame" x="10" y="19" width="638" height="326"/> + <rect key="frame" x="10" y="19" width="638" height="184"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <subviews> - <box autoresizesSubviews="NO" title="Box" borderType="line" titlePosition="noTitle" id="286"> - <rect key="frame" x="37" y="257" width="232" height="67"/> + <box autoresizesSubviews="NO" title="Box" borderType="bezel" titlePosition="noTitle" id="286"> + <rect key="frame" x="11" y="113" width="232" height="66"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <view key="contentView"> - <rect key="frame" x="1" y="1" width="230" height="65"/> + <rect key="frame" x="3" y="3" width="226" height="60"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <subviews> <textField verticalHuggingPriority="750" id="346"> - <rect key="frame" x="19" y="38" width="64" height="14"/> + <rect key="frame" x="19" y="36" width="64" height="14"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Detelecine:" id="347"> <font key="font" metaFont="smallSystem"/> @@ -466,34 +450,36 @@ </textFieldCell> </textField> <textField verticalHuggingPriority="750" id="344"> - <rect key="frame" x="34" y="15" width="49" height="14"/> + <rect key="frame" x="34" y="13" width="49" height="14"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Custom:" id="353"> <font key="font" metaFont="smallSystem"/> <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/> <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> </textFieldCell> + <connections> + <binding destination="-2" name="hidden" keyPath="self.filters.detelecine" id="GeL-Hh-N04"> + <dictionary key="options"> + <string key="NSValueTransformerName">HBCustomFilterTransformer</string> + </dictionary> + </binding> + </connections> </textField> <popUpButton verticalHuggingPriority="750" id="345"> - <rect key="frame" x="88" y="37" width="110" height="15"/> + <rect key="frame" x="87" y="35" width="110" height="15"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> - <popUpButtonCell key="cell" type="push" title="Item1" bezelStyle="rounded" alignment="left" controlSize="mini" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" inset="2" arrowPosition="arrowAtCenter" preferredEdge="maxY" selectedItem="350" id="348"> + <popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" controlSize="mini" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" inset="2" arrowPosition="arrowAtCenter" preferredEdge="maxY" id="348"> <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/> <font key="font" metaFont="miniSystem"/> - <menu key="menu" title="OtherViews" id="349"> - <items> - <menuItem title="Item1" state="on" id="350"/> - <menuItem title="Item2" id="351"/> - <menuItem title="Item3" id="352"/> - </items> - </menu> + <menu key="menu" title="OtherViews" id="349"/> </popUpButtonCell> <connections> - <action selector="FilterSettingsChanged:" target="-2" id="374"/> + <binding destination="-2" name="selectedIndex" keyPath="self.filters.detelecine" previousBinding="pGd-yk-F9V" id="nJ6-iy-GiP"/> + <binding destination="-2" name="content" keyPath="self.filters.detelecineSettings" id="pGd-yk-F9V"/> </connections> </popUpButton> <textField verticalHuggingPriority="750" id="343"> - <rect key="frame" x="89" y="14" width="108" height="16"/> + <rect key="frame" x="88" y="12" width="108" height="16"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <textFieldCell key="cell" controlSize="mini" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="354"> <font key="font" metaFont="miniSystem"/> @@ -501,8 +487,16 @@ <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> </textFieldCell> <connections> - <action selector="FilterSettingsChanged:" target="-2" id="ApX-0E-8GE"/> - <binding destination="-2" name="value" keyPath="self.detelecineCustomString" id="pxi-vJ-hxS"/> + <binding destination="-2" name="hidden" keyPath="self.filters.detelecine" id="BLn-QV-lw8"> + <dictionary key="options"> + <string key="NSValueTransformerName">HBCustomFilterTransformer</string> + </dictionary> + </binding> + <binding destination="-2" name="value" keyPath="self.filters.detelecineCustomString" id="gSO-TA-w8P"> + <dictionary key="options"> + <bool key="NSContinuouslyUpdatesValue" value="YES"/> + </dictionary> + </binding> </connections> </textField> </subviews> @@ -510,50 +504,48 @@ <color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/> <color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> </box> - <box titlePosition="aboveBottom" id="287"> - <rect key="frame" x="37" y="150" width="232" height="105"/> + <box borderType="bezel" titlePosition="aboveBottom" id="287"> + <rect key="frame" x="11" y="4" width="232" height="107"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <view key="contentView"> - <rect key="frame" x="2" y="18" width="228" height="85"/> + <rect key="frame" x="3" y="19" width="226" height="85"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <subviews> - <slider verticalHuggingPriority="750" id="313"> - <rect key="frame" x="59" y="58" width="37" height="16"/> + <matrix verticalHuggingPriority="750" allowsEmptySelection="NO" id="kSA-Hn-6ya"> + <rect key="frame" x="88" y="43" width="83" height="32"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> - <sliderCell key="cell" controlSize="small" state="on" alignment="left" maxValue="1" doubleValue="0.5" tickMarkPosition="above" allowsTickMarkValuesOnly="YES" sliderType="linear" id="340"> - <font key="font" metaFont="smallSystem"/> - </sliderCell> + <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> + <size key="cellSize" width="83" height="15"/> + <size key="intercellSpacing" width="4" height="2"/> + <buttonCell key="prototype" type="radio" title="Radio" imagePosition="left" alignment="left" inset="2" id="m9e-GO-6R2" customClass="HBHUDButtonCell"> + <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> + <font key="font" metaFont="system"/> + </buttonCell> + <cells> + <column> + <buttonCell type="radio" title="Deinterlace" imagePosition="left" alignment="left" controlSize="small" state="on" tag="1" inset="2" id="UmU-23-PdR" customClass="HBHUDButtonCell"> + <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> + <font key="font" metaFont="smallSystem"/> + </buttonCell> + <buttonCell type="radio" title="Decomb" imagePosition="left" alignment="left" controlSize="small" inset="2" id="N0e-d0-RLj" customClass="HBHUDButtonCell"> + <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> + <font key="font" metaFont="smallSystem"/> + </buttonCell> + </column> + </cells> <connections> - <action selector="modeDecombDeinterlaceSliderChanged:" target="-2" id="381"/> + <binding destination="-2" name="selectedIndex" keyPath="self.filters.useDecomb" id="FHi-fu-YUi"/> </connections> - </slider> - <textField verticalHuggingPriority="750" id="312"> - <rect key="frame" x="1" y="57" width="56" height="17"/> - <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> - <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Decomb" id="341"> - <font key="font" metaFont="smallSystem"/> - <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/> - <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> - </textFieldCell> - </textField> - <textField verticalHuggingPriority="750" id="311"> - <rect key="frame" x="97" y="56" width="89" height="17"/> - <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> - <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="left" title="Deinterlace" id="342"> - <font key="font" metaFont="smallSystem"/> - <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/> - <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> - </textFieldCell> - </textField> - <box autoresizesSubviews="NO" title="Box" boxType="custom" borderType="none" titlePosition="noTitle" id="315"> - <rect key="frame" x="14" y="-14" width="198" height="70"/> + </matrix> + <box autoresizesSubviews="NO" title="Box" borderType="none" titlePosition="noTitle" id="315" userLabel="Decomb Box"> + <rect key="frame" x="11" y="-11" width="207" height="62"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <view key="contentView"> - <rect key="frame" x="0.0" y="0.0" width="198" height="70"/> + <rect key="frame" x="0.0" y="0.0" width="207" height="62"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <subviews> <textField verticalHuggingPriority="750" id="319"> - <rect key="frame" x="14" y="40" width="52" height="14"/> + <rect key="frame" x="20" y="35" width="52" height="14"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Decomb:" id="320"> <font key="font" metaFont="smallSystem"/> @@ -562,34 +554,36 @@ </textFieldCell> </textField> <textField verticalHuggingPriority="750" id="317"> - <rect key="frame" x="17" y="17" width="49" height="14"/> + <rect key="frame" x="23" y="11" width="49" height="14"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Custom:" id="326"> <font key="font" metaFont="smallSystem"/> <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/> <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> </textFieldCell> + <connections> + <binding destination="-2" name="hidden" keyPath="self.filters.decomb" id="SgL-u6-Y9a"> + <dictionary key="options"> + <string key="NSValueTransformerName">HBCustomFilterTransformer</string> + </dictionary> + </binding> + </connections> </textField> <popUpButton verticalHuggingPriority="750" id="318"> - <rect key="frame" x="73" y="39" width="110" height="15"/> + <rect key="frame" x="76" y="34" width="111" height="15"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> - <popUpButtonCell key="cell" type="push" title="Item1" bezelStyle="rounded" alignment="left" controlSize="mini" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" inset="2" arrowPosition="arrowAtCenter" preferredEdge="maxY" selectedItem="323" id="321"> + <popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" controlSize="mini" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" inset="2" arrowPosition="arrowAtCenter" preferredEdge="maxY" id="321"> <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/> <font key="font" metaFont="miniSystem"/> - <menu key="menu" title="OtherViews" id="322"> - <items> - <menuItem title="Item1" state="on" id="323"/> - <menuItem title="Item2" id="324"/> - <menuItem title="Item3" id="325"/> - </items> - </menu> + <menu key="menu" title="OtherViews" id="322"/> </popUpButtonCell> <connections> - <action selector="FilterSettingsChanged:" target="-2" id="375"/> + <binding destination="-2" name="selectedIndex" keyPath="self.filters.decomb" previousBinding="Rky-63-XUy" id="0LF-hS-iFS"/> + <binding destination="-2" name="contentValues" keyPath="self.filters.decombSettings" id="Rky-63-XUy"/> </connections> </popUpButton> <textField verticalHuggingPriority="750" id="316"> - <rect key="frame" x="74" y="16" width="108" height="16"/> + <rect key="frame" x="77" y="10" width="108" height="16"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <textFieldCell key="cell" controlSize="mini" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="327"> <font key="font" metaFont="miniSystem"/> @@ -597,8 +591,12 @@ <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> </textFieldCell> <connections> - <action selector="FilterSettingsChanged:" target="-2" id="cQu-1x-zhN"/> - <binding destination="-2" name="value" keyPath="self.decombCustomString" id="4lc-Rt-V0u"> + <binding destination="-2" name="hidden" keyPath="self.filters.decomb" id="akE-8W-aND"> + <dictionary key="options"> + <string key="NSValueTransformerName">HBCustomFilterTransformer</string> + </dictionary> + </binding> + <binding destination="-2" name="value" keyPath="self.filters.decombCustomString" id="y3W-Df-Jgn"> <dictionary key="options"> <bool key="NSContinuouslyUpdatesValue" value="YES"/> </dictionary> @@ -610,15 +608,15 @@ <color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/> <color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> </box> - <box autoresizesSubviews="NO" title="Box" borderType="none" titlePosition="noTitle" id="314"> - <rect key="frame" x="-6" y="-13" width="222" height="66"/> + <box autoresizesSubviews="NO" title="Box" borderType="none" titlePosition="noTitle" id="314" userLabel="Deinterlace Box"> + <rect key="frame" x="11" y="-11" width="207" height="62"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <view key="contentView"> - <rect key="frame" x="0.0" y="0.0" width="222" height="66"/> + <rect key="frame" x="0.0" y="0.0" width="207" height="62"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <subviews> <textField verticalHuggingPriority="750" id="331"> - <rect key="frame" x="17" y="39" width="68" height="14"/> + <rect key="frame" x="4" y="35" width="68" height="14"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Deinterlace:" id="332"> <font key="font" metaFont="smallSystem"/> @@ -627,34 +625,36 @@ </textFieldCell> </textField> <textField verticalHuggingPriority="750" id="330"> - <rect key="frame" x="37" y="16" width="49" height="14"/> + <rect key="frame" x="23" y="11" width="49" height="14"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Custom:" id="333"> <font key="font" metaFont="smallSystem"/> <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/> <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> </textFieldCell> + <connections> + <binding destination="-2" name="hidden" keyPath="self.filters.deinterlace" id="rIM-KR-bUf"> + <dictionary key="options"> + <string key="NSValueTransformerName">HBCustomFilterTransformer</string> + </dictionary> + </binding> + </connections> </textField> <popUpButton verticalHuggingPriority="750" id="328"> - <rect key="frame" x="93" y="38" width="110" height="15"/> + <rect key="frame" x="77" y="34" width="111" height="15"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> - <popUpButtonCell key="cell" type="push" title="Item1" bezelStyle="rounded" alignment="left" controlSize="mini" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" inset="2" arrowPosition="arrowAtCenter" preferredEdge="maxY" selectedItem="337" id="335"> + <popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" controlSize="mini" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" inset="2" arrowPosition="arrowAtCenter" preferredEdge="maxY" id="335"> <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/> <font key="font" metaFont="miniSystem"/> - <menu key="menu" title="OtherViews" id="336"> - <items> - <menuItem title="Item1" state="on" id="337"/> - <menuItem title="Item2" id="338"/> - <menuItem title="Item3" id="339"/> - </items> - </menu> + <menu key="menu" title="OtherViews" id="336"/> </popUpButtonCell> <connections> - <action selector="FilterSettingsChanged:" target="-2" id="377"/> + <binding destination="-2" name="selectedIndex" keyPath="self.filters.deinterlace" previousBinding="hol-Lh-FVF" id="5jK-2w-2Fq"/> + <binding destination="-2" name="contentValues" keyPath="self.filters.deinterlaceSettings" id="hol-Lh-FVF"/> </connections> </popUpButton> <textField verticalHuggingPriority="750" id="329"> - <rect key="frame" x="95" y="15" width="108" height="16"/> + <rect key="frame" x="77" y="10" width="108" height="16"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <textFieldCell key="cell" controlSize="mini" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="334"> <font key="font" metaFont="miniSystem"/> @@ -662,8 +662,12 @@ <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> </textFieldCell> <connections> - <action selector="FilterSettingsChanged:" target="-2" id="54Z-kr-6oa"/> - <binding destination="-2" name="value" keyPath="self.deinterlaceCustomString" id="eu9-Ar-QY2"> + <binding destination="-2" name="hidden" keyPath="self.filters.deinterlace" id="7f6-Fd-pfo"> + <dictionary key="options"> + <string key="NSValueTransformerName">HBCustomFilterTransformer</string> + </dictionary> + </binding> + <binding destination="-2" name="value" keyPath="self.filters.deinterlaceCustomString" id="aSX-hF-LBO"> <dictionary key="options"> <bool key="NSContinuouslyUpdatesValue" value="YES"/> </dictionary> @@ -680,15 +684,15 @@ <color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/> <color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> </box> - <box autoresizesSubviews="NO" title="Box" borderType="line" titlePosition="noTitle" id="288"> - <rect key="frame" x="37" y="82" width="232" height="66"/> + <box autoresizesSubviews="NO" title="Box" borderType="bezel" titlePosition="noTitle" id="288"> + <rect key="frame" x="245" y="4" width="232" height="107"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <view key="contentView"> - <rect key="frame" x="1" y="1" width="230" height="64"/> + <rect key="frame" x="3" y="3" width="226" height="101"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <subviews> <textField verticalHuggingPriority="750" id="299"> - <rect key="frame" x="33" y="38" width="50" height="14"/> + <rect key="frame" x="32" y="73" width="50" height="14"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Denoise:" id="310"> <font key="font" metaFont="smallSystem"/> @@ -696,35 +700,86 @@ <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> </textFieldCell> </textField> - <textField verticalHuggingPriority="750" id="301"> - <rect key="frame" x="34" y="15" width="49" height="14"/> + <popUpButton toolTip="Denoise filtering reduces or removes the appearance of noise and grain." verticalHuggingPriority="750" id="300"> + <rect key="frame" x="86" y="73" width="110" height="15"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> - <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Custom:" id="304"> + <popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" controlSize="mini" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" inset="2" arrowPosition="arrowAtCenter" preferredEdge="maxY" id="305"> + <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/> + <font key="font" metaFont="miniSystem"/> + <menu key="menu" title="OtherViews" id="306"/> + </popUpButtonCell> + <connections> + <binding destination="-2" name="selectedValue" keyPath="self.filters.denoise" previousBinding="mkS-wD-luU" id="1LQ-5U-xih"> + <dictionary key="options"> + <string key="NSValueTransformerName">HBDenoiseTransformer</string> + </dictionary> + </binding> + <binding destination="-2" name="contentValues" keyPath="self.filters.denoiseTypes" id="mkS-wD-luU"/> + </connections> + </popUpButton> + <textField verticalHuggingPriority="750" id="ZSz-Vu-qC0"> + <rect key="frame" x="42" y="50" width="40" height="14"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Preset:" id="CBk-r9-aJb"> <font key="font" metaFont="smallSystem"/> <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/> <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> </textFieldCell> </textField> - <popUpButton verticalHuggingPriority="750" id="300"> - <rect key="frame" x="88" y="37" width="110" height="15"/> + <popUpButton verticalHuggingPriority="750" id="2F0-KY-tOC"> + <rect key="frame" x="86" y="50" width="110" height="15"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> - <popUpButtonCell key="cell" type="push" title="Item1" bezelStyle="rounded" alignment="left" controlSize="mini" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" inset="2" arrowPosition="arrowAtCenter" preferredEdge="maxY" selectedItem="309" id="305"> + <popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" controlSize="mini" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" inset="2" arrowPosition="arrowAtCenter" preferredEdge="maxY" id="nMP-H2-vMe"> <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/> <font key="font" metaFont="miniSystem"/> - <menu key="menu" title="OtherViews" id="306"> - <items> - <menuItem title="Item1" state="on" id="309"/> - <menuItem title="Item2" id="308"/> - <menuItem title="Item3" id="307"/> - </items> - </menu> + <menu key="menu" title="OtherViews" id="Mxi-ZP-xzf"/> </popUpButtonCell> <connections> - <action selector="FilterSettingsChanged:" target="-2" id="378"/> + <binding destination="-2" name="selectedValue" keyPath="self.filters.denoisePreset" previousBinding="Lju-Js-fav" id="8HL-Js-eww"> + <dictionary key="options"> + <string key="NSValueTransformerName">HBDenoisePresetTransformer</string> + </dictionary> + </binding> + <binding destination="-2" name="contentValues" keyPath="self.filters.denoisePresets" id="Lju-Js-fav"/> </connections> </popUpButton> + <textField verticalHuggingPriority="750" id="gpP-sp-Lev"> + <rect key="frame" x="48" y="28" width="34" height="14"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Tune:" id="BqI-14-fzH"> + <font key="font" metaFont="smallSystem"/> + <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/> + <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> + </textFieldCell> + </textField> + <popUpButton verticalHuggingPriority="750" id="Upd-5E-OpR"> + <rect key="frame" x="86" y="28" width="110" height="15"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" controlSize="mini" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" inset="2" arrowPosition="arrowAtCenter" preferredEdge="maxY" id="lPq-MO-3Oz"> + <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/> + <font key="font" metaFont="miniSystem"/> + <menu key="menu" title="OtherViews" id="NiL-SO-Fbj"/> + </popUpButtonCell> + <connections> + <binding destination="-2" name="selectedValue" keyPath="self.filters.denoiseTune" previousBinding="nST-CD-SjR" id="wvC-Ag-WKc"> + <dictionary key="options"> + <string key="NSValueTransformerName">HBDenoiseTuneTransformer</string> + </dictionary> + </binding> + <binding destination="-2" name="contentValues" keyPath="self.filters.denoiseTunes" id="nST-CD-SjR"/> + </connections> + </popUpButton> + <textField verticalHuggingPriority="750" id="301"> + <rect key="frame" x="33" y="27" width="49" height="14"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Custom:" id="304"> + <font key="font" metaFont="smallSystem"/> + <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/> + <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> + </textFieldCell> + </textField> <textField verticalHuggingPriority="750" id="302"> - <rect key="frame" x="89" y="14" width="108" height="16"/> + <rect key="frame" x="87" y="26" width="108" height="16"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <textFieldCell key="cell" controlSize="mini" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="303"> <font key="font" metaFont="miniSystem"/> @@ -732,8 +787,7 @@ <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> </textFieldCell> <connections> - <action selector="FilterSettingsChanged:" target="-2" id="em7-cp-nCV"/> - <binding destination="-2" name="value" keyPath="self.denoiseCustomString" id="9bk-dZ-FOv"> + <binding destination="-2" name="value" keyPath="self.filters.denoiseCustomString" id="cUD-QA-8K3"> <dictionary key="options"> <bool key="NSContinuouslyUpdatesValue" value="YES"/> </dictionary> @@ -745,15 +799,15 @@ <color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/> <color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> </box> - <box autoresizesSubviews="NO" title="Box" borderType="line" titlePosition="noTitle" id="421"> - <rect key="frame" x="37" y="20" width="232" height="60"/> + <box autoresizesSubviews="NO" title="Box" borderType="bezel" titlePosition="noTitle" id="421"> + <rect key="frame" x="245" y="113" width="232" height="66"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <view key="contentView"> - <rect key="frame" x="1" y="1" width="230" height="58"/> + <rect key="frame" x="3" y="3" width="226" height="60"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <subviews> <textField verticalHuggingPriority="750" id="289"> - <rect key="frame" x="30" y="32" width="51" height="14"/> + <rect key="frame" x="30" y="36" width="51" height="14"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Deblock:" id="298"> <font key="font" metaFont="smallSystem"/> @@ -762,7 +816,7 @@ </textFieldCell> </textField> <textField verticalHuggingPriority="750" id="290"> - <rect key="frame" x="24" y="9" width="58" height="14"/> + <rect key="frame" x="24" y="13" width="58" height="14"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Grayscale:" id="297"> <font key="font" metaFont="smallSystem"/> @@ -771,7 +825,7 @@ </textFieldCell> </textField> <textField verticalHuggingPriority="750" id="291"> - <rect key="frame" x="79" y="31" width="31" height="14"/> + <rect key="frame" x="79" y="35" width="31" height="14"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" alignment="center" title="Off" id="296"> <font key="font" metaFont="smallSystem"/> @@ -780,24 +834,24 @@ </textFieldCell> </textField> <slider verticalHuggingPriority="750" id="292"> - <rect key="frame" x="108" y="30" width="104" height="16"/> + <rect key="frame" x="108" y="34" width="104" height="16"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <sliderCell key="cell" controlSize="mini" continuous="YES" state="on" alignment="left" minValue="4" maxValue="15" doubleValue="4" tickMarkPosition="below" numberOfTickMarks="12" allowsTickMarkValuesOnly="YES" sliderType="linear" id="295"> <font key="font" metaFont="miniSystem"/> </sliderCell> <connections> - <action selector="deblockSliderChanged:" target="-2" id="379"/> + <binding destination="-2" name="value" keyPath="self.filters.deblock" id="QYG-e5-NYq"/> </connections> </slider> <button id="293"> - <rect key="frame" x="84" y="7" width="19" height="18"/> + <rect key="frame" x="84" y="11" width="19" height="18"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <buttonCell key="cell" type="check" title="Check" bezelStyle="regularSquare" imagePosition="left" alignment="left" controlSize="small" inset="2" id="294"> <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> <font key="font" metaFont="smallSystem"/> </buttonCell> <connections> - <action selector="FilterSettingsChanged:" target="-2" id="380"/> + <binding destination="-2" name="value" keyPath="self.filters.grayscale" id="CyF-w9-sk3"/> </connections> </button> </subviews> @@ -814,7 +868,7 @@ </connections> </tabView> <button verticalHuggingPriority="750" id="270"> - <rect key="frame" x="15" y="370" width="57" height="16"/> + <rect key="frame" x="15" y="228" width="64" height="16"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <buttonCell key="cell" type="push" title="Preview" bezelStyle="rounded" alignment="center" controlSize="mini" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="271"> <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/> @@ -826,6 +880,9 @@ </button> </subviews> </view> + <connections> + <outlet property="delegate" destination="-2" id="hby-dR-NFK"/> + </connections> </window> </objects> </document> diff --git a/macosx/HBCore.m b/macosx/HBCore.m index 403776051..0702d5d8e 100644 --- a/macosx/HBCore.m +++ b/macosx/HBCore.m @@ -83,13 +83,13 @@ NSString *HBCoreMuxingNotification = @"HBCoreMuxingNotification"; if (hb_handle) return NO; - state = HBStateIdle; + state = HBStateIdle; hb_handle = hb_init(debugMode ? HB_DEBUG_ALL : HB_DEBUG_NONE, checkForUpdates); if (!hb_handle) return NO; - updateTimer = [[NSTimer scheduledTimerWithTimeInterval:0.2 + updateTimer = [[NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(stateUpdateTimer:) userInfo:NULL @@ -109,7 +109,7 @@ NSString *HBCoreMuxingNotification = @"HBCoreMuxingNotification"; NSAssert(hb_handle, @"[HBCore close] libhb is not open"); if (!hb_handle) return NO; - + [updateTimer invalidate]; [updateTimer release]; updateTimer = nil; diff --git a/macosx/HBFilters.h b/macosx/HBFilters.h new file mode 100644 index 000000000..eaafef178 --- /dev/null +++ b/macosx/HBFilters.h @@ -0,0 +1,74 @@ +/* HBFilters.h $ + + This file is part of the HandBrake source code. + Homepage: <http://handbrake.fr/>. + It may be used under the terms of the GNU General Public License. */ + +#import <Foundation/Foundation.h> + +/** + * Filters settings. + */ +@interface HBFilters : NSObject + +- (void)prepareFiltersForPreset:(NSMutableDictionary *)preset; +- (void)applySettingsFromPreset:(NSDictionary *)preset; + +@property (nonatomic, readwrite) NSInteger detelecine; +@property (nonatomic, readwrite, copy) NSString *detelecineCustomString; + +@property (nonatomic, readwrite) NSInteger deinterlace; +@property (nonatomic, readwrite, copy) NSString *deinterlaceCustomString; + +@property (nonatomic, readwrite) NSInteger decomb; +@property (nonatomic, readwrite, copy) NSString *decombCustomString; + +@property (nonatomic, readwrite, copy) NSString *denoise; +@property (nonatomic, readwrite, copy) NSString *denoisePreset; +@property (nonatomic, readwrite, copy) NSString *denoiseTune; +@property (nonatomic, readwrite, copy) NSString *denoiseCustomString; + +@property (nonatomic, readwrite) NSInteger deblock; +@property (nonatomic, readwrite) BOOL grayscale; + +@property (nonatomic, readwrite) BOOL useDecomb; + +/** + * A textual summary of the filters settings. + */ +@property (nonatomic, readonly) NSString *summary; + +/** + * Getters to get the possible values for the filters. + */ ++ (NSDictionary *)denoisePresetDict; ++ (NSDictionary *)nlmeansTunesDict; ++ (NSDictionary *)denoiseTypesDict; + +@property (nonatomic, readonly) NSArray *detelecineSettings; +@property (nonatomic, readonly) NSArray *deinterlaceSettings; +@property (nonatomic, readonly) NSArray *decombSettings; + +@property (nonatomic, readonly) NSArray *denoiseTypes; +@property (nonatomic, readonly) NSArray *denoisePresets; +@property (nonatomic, readonly) NSArray *denoiseTunes; + +@end + +/** + * A collection of NSValueTransformer to map between localized UI values + * and the internals values. + */ + +@interface HBGenericDictionaryTransformer : NSValueTransformer +@property (nonatomic, retain) NSDictionary *dict; +@end + +@interface HBDenoisePresetTransformer : HBGenericDictionaryTransformer +@end + +@interface HBDenoiseTuneTransformer : HBGenericDictionaryTransformer +@end + +@interface HBDenoiseTransformer : HBGenericDictionaryTransformer +@end
\ No newline at end of file diff --git a/macosx/HBFilters.m b/macosx/HBFilters.m new file mode 100644 index 000000000..7a00004a5 --- /dev/null +++ b/macosx/HBFilters.m @@ -0,0 +1,453 @@ +/* HBFilters.m $ + + This file is part of the HandBrake source code. + Homepage: <http://handbrake.fr/>. + It may be used under the terms of the GNU General Public License. */ + +#import "HBFilters.h" + +@implementation HBGenericDictionaryTransformer + ++ (Class)transformedValueClass +{ + return [NSString class]; +} + +- (id)transformedValue:(id)value +{ + return [[self.dict allKeysForObject:value] firstObject]; +} + ++ (BOOL)allowsReverseTransformation +{ + return YES; +} + +- (id)reverseTransformedValue:(id)value +{ + return [self.dict valueForKey:value]; +} + +@end + +@implementation HBDenoisePresetTransformer + +- (instancetype)init +{ + if (self = [super init]) + self.dict = [HBFilters denoisePresetDict]; + + return self; +} + +@end + +@implementation HBDenoiseTuneTransformer + +- (instancetype)init +{ + if (self = [super init]) + self.dict = [HBFilters nlmeansTunesDict]; + + return self; +} + +@end + +@implementation HBDenoiseTransformer + +- (instancetype)init +{ + if (self = [super init]) + self.dict = [HBFilters denoiseTypesDict]; + + return self; +} + +@end + +static NSDictionary *_denoiseTypesDict; +static NSDictionary *_denoisePresetsDict; +static NSDictionary *_nlmeansTunesDict; + +@implementation HBFilters + ++ (void)initialize +{ + if (self == [HBFilters class]) { + _denoiseTypesDict = [@{NSLocalizedString(@"Off", nil): @"off", + NSLocalizedString(@"NLMeans", nil): @"nlmeans", + NSLocalizedString(@"HQDN3D", nil): @"hqdn3d"} retain]; + + _denoisePresetsDict = [@{NSLocalizedString(@"Custom", nil): @"none", + NSLocalizedString(@"Ultralight", nil): @"ultralight", + NSLocalizedString(@"Light", nil): @"light", + NSLocalizedString(@"Medium", nil) : @"medium", + NSLocalizedString(@"Strong", nil) : @"strong"} retain]; + + _nlmeansTunesDict = [@{NSLocalizedString(@"None", nil): @"none", + NSLocalizedString(@"Film", nil): @"film", + NSLocalizedString(@"Grain", nil): @"grain", + NSLocalizedString(@"High Motion", nil): @"highmotion", + NSLocalizedString(@"Animation", nil) : @"animation"} retain]; + } +} + +- (instancetype)init +{ + self = [super init]; + if (self) + { + _detelecineCustomString = @""; + _deinterlaceCustomString = @""; + _decombCustomString = @""; + _denoise = @"off"; + _denoiseCustomString = @""; + _denoisePreset = @"medium"; + _denoiseTune = @"none"; + } + return self; +} + +- (void)prepareFiltersForPreset:(NSMutableDictionary *)preset +{ + preset[@"PictureDecombDeinterlace"] = self.useDecomb; + + preset[@"PictureDeinterlace"] = @(self.deinterlace); + preset[@"PictureDeinterlaceCustom"] = self.deinterlaceCustomString; + + preset[@"PictureDecomb"] = @(self.decomb); + preset[@"PictureDecombCustom"] = self.decombCustomString; + + preset[@"PictureDetelecine"] = @(self.detelecine); + preset[@"PictureDetelecineCustom"] = self.detelecineCustomString; + + preset[@"PictureDenoiseFilter"] = self.denoise; + preset[@"PictureDenoisePreset"] = self.denoisePreset; + preset[@"PictureDenoiseTune"] = self.denoiseTune; + preset[@"PictureDenoiseCustom"] = self.denoiseCustomString; + + preset[@"PictureDeblock"] = @(self.deblock); + preset[@"VideoGrayScale"] = @(self.grayscale); +} + +- (void)applySettingsFromPreset:(NSDictionary *)preset +{ + /* If the preset has an objectForKey:@"UsesPictureFilters", and handle the filters here */ + if (preset[@"UsesPictureFilters"] && [preset[@"UsesPictureFilters"] intValue] > 0) + { + /* We only allow *either* Decomb or Deinterlace. So check for the PictureDecombDeinterlace key. */ + self.useDecomb = 1; + self.decomb = 0; + self.deinterlace = 0; + if ([preset[@"PictureDecombDeinterlace"] intValue] == 1) + { + /* we are using decomb */ + /* Decomb */ + if ([preset[@"PictureDecomb"] intValue] > 0) + { + self.decomb = [preset[@"PictureDecomb"] intValue]; + + /* if we are using "Custom" in the decomb setting, also set the custom string*/ + if ([preset[@"PictureDecomb"] intValue] == 1) + { + self.decombCustomString = preset[@"PictureDecombCustom"]; + } + } + } + else + { + /* We are using Deinterlace */ + /* Deinterlace */ + if ([preset[@"PictureDeinterlace"] intValue] > 0) + { + self.useDecomb = 0; + self.deinterlace = [preset[@"PictureDeinterlace"] intValue]; + /* if we are using "Custom" in the deinterlace setting, also set the custom string*/ + if ([preset[@"PictureDeinterlace"] intValue] == 1) + { + self.deinterlaceCustomString = preset[@"PictureDeinterlaceCustom"]; + } + } + } + + /* Detelecine */ + if ([preset[@"PictureDetelecine"] intValue] > 0) + { + self.detelecine = [preset[@"PictureDetelecine"] intValue]; + /* if we are using "Custom" in the detelecine setting, also set the custom string*/ + if ([preset[@"PictureDetelecine"] intValue] == 1) + { + self.detelecineCustomString = preset[@"PictureDetelecineCustom"]; + } + } + else + { + self.detelecine = 0; + } + + /* Denoise */ + if (preset[@"PictureDenoise"]) + { + // Old preset denoise format, try to map it to the new one + if ([preset[@"PictureDenoise"] intValue] > 0) + { + self.denoise = @"hqdn3d"; + /* if we are using "Custom" in the denoise setting, also set the custom string*/ + if ([preset[@"PictureDenoise"] intValue] == 1) + { + self.denoisePreset = @"custom"; + self.denoiseCustomString = preset[@"PictureDenoiseCustom"]; + } + switch ([preset[@"PictureDenoise"] intValue]) { + case 2: + self.denoisePreset = @"light"; + break; + case 3: + self.denoisePreset = @"medium"; + break; + case 4: + self.denoisePreset = @"strong"; + break; + default: + self.denoisePreset = @"medium"; + break; + } + } + else + { + self.denoise = @"off"; + } + } + else + { + // New format, read the values directly + self.denoise = preset[@"PictureDenoiseFilter"]; + self.denoisePreset = preset[@"PictureDenoisePreset"]; + self.denoiseTune = preset[@"PictureDenoiseTune"]; + self.denoiseCustomString = preset[@"PictureDenoiseCustom"]; + } + + /* Deblock */ + if ([preset[@"PictureDeblock"] intValue] == 1) + { + /* if its a one, then its the old on/off deblock, set on to 5*/ + self.deblock = 5; + } + else + { + /* use the settings intValue */ + self.deblock = [preset[@"PictureDeblock"] intValue]; + } + + self.grayscale = [preset[@"VideoGrayScale"] intValue]; + } +} + +- (NSString *)summary +{ + NSMutableString *summary = [NSMutableString string]; + + /* Detelecine */ + switch (self.detelecine) + { + case 1: + [summary appendFormat:@" - Detelecine (%@)", self.detelecineCustomString]; + break; + + case 2: + [summary appendString:@" - Detelecine (Default)"]; + break; + + default: + break; + } + + if (self.useDecomb) + { + /* Decomb */ + switch (self.decomb) + { + case 1: + [summary appendFormat:@" - Decomb (%@)", self.decombCustomString]; + break; + + case 2: + [summary appendString:@" - Decomb (Default)"]; + break; + + case 3: + [summary appendString:@" - Decomb (Fast)"]; + break; + + case 4: + [summary appendString:@" - Decomb (Bob)"]; + break; + + default: + break; + } + } + else + { + /* Deinterlace */ + switch (self.deinterlace) + { + case 1: + [summary appendFormat:@" - Deinterlace (%@)", self.deinterlaceCustomString]; + break; + + case 2: + [summary appendString:@" - Deinterlace (Fast)"]; + break; + + case 3: + [summary appendString:@" - Deinterlace (Slow)"]; + break; + + case 4: + [summary appendString:@" - Deinterlace (Slower)"]; + break; + + case 5: + [summary appendString:@" - Deinterlace (Bob)"]; + break; + + default: + break; + } + } + + /* Deblock */ + if (self.deblock > 0) + { + [summary appendFormat:@" - Deblock (%ld)", self.deblock]; + } + + /* Denoise */ + if (![self.denoise isEqualToString:@"off"]) + { + [summary appendFormat:@" - Denoise (%@", [[_denoiseTypesDict allKeysForObject:self.denoise] firstObject]]; + if (![self.denoisePreset isEqualToString:@"none"]) + { + [summary appendFormat:@", %@", [[_denoisePresetsDict allKeysForObject:self.denoisePreset] firstObject]]; + + if ([self.denoise isEqualToString:@"nlmeans"]) + { + [summary appendFormat:@", %@", [[_nlmeansTunesDict allKeysForObject:self.denoiseTune] firstObject]]; + } + } + else + { + [summary appendFormat:@", %@", self.denoiseCustomString]; + } + + [summary appendString:@")"]; + + } + + /* Grayscale */ + if (self.grayscale) + { + [summary appendString:@" - Grayscale"]; + } + + if ([summary hasPrefix:@" - "]) + { + [summary deleteCharactersInRange:NSMakeRange(0, 3)]; + } + + return [NSString stringWithString:summary]; +} + +// Override setter to avoid nil values. +- (void)setDetelecineCustomString:(NSString *)detelecineCustomString +{ + [_detelecineCustomString autorelease]; + + if (detelecineCustomString) + { + _detelecineCustomString = [detelecineCustomString copy]; + } + else + { + _detelecineCustomString = @""; + } +} + +- (void)setDeinterlaceCustomString:(NSString *)deinterlaceCustomString +{ + [_deinterlaceCustomString autorelease]; + + if (deinterlaceCustomString) + { + _deinterlaceCustomString = [deinterlaceCustomString copy]; + } + else + { + _deinterlaceCustomString = @""; + } +} + +- (void)setDenoiseCustomString:(NSString *)denoiseCustomString +{ + [_denoiseCustomString autorelease]; + + if (denoiseCustomString) + { + _denoiseCustomString = [denoiseCustomString copy]; + } + else + { + _denoiseCustomString = @""; + } +} + +#pragma mark - Valid values + ++ (NSDictionary *)denoisePresetDict +{ + return _denoisePresetsDict; +} + ++ (NSDictionary *)nlmeansTunesDict +{ + return _nlmeansTunesDict; +} + ++ (NSDictionary *)denoiseTypesDict +{ + return _denoiseTypesDict; +} + +- (NSArray *)detelecineSettings +{ + return @[@"Off", @"Custom", @"Default"]; +} + +- (NSArray *)decombSettings +{ + return @[@"Off", @"Custom", @"Default", @"Fast", @"Bob"]; +} + +- (NSArray *)deinterlaceSettings +{ + return @[@"Off", @"Custom", @"Fast", @"Slow", @"Slower", @"Bob"]; +} + +- (NSArray *)denoiseTypes +{ + return @[@"Off", @"NLMeans", @"HQDN3D"]; +} + +- (NSArray *)denoisePresets +{ + return @[@"Custom", @"Ultralight", @"Light", @"Medium", @"Strong"]; +} + +- (NSArray *)denoiseTunes +{ + return @[@"None", @"Film", @"Grain", @"High Motion", @"Animation"]; +} + +@end diff --git a/macosx/HBHUDButtonCell.h b/macosx/HBHUDButtonCell.h new file mode 100644 index 000000000..1596d1beb --- /dev/null +++ b/macosx/HBHUDButtonCell.h @@ -0,0 +1,17 @@ +// +// HBHUDButtonCell.h +// HandBrake +// +// Created by Damiano Galassi on 17/08/14. +// +// + +#import <Cocoa/Cocoa.h> + +/** + * A subclass of NSButtonCell that draws the cell title + * in white. + */ +@interface HBHUDButtonCell : NSButtonCell + +@end diff --git a/macosx/HBHUDButtonCell.m b/macosx/HBHUDButtonCell.m new file mode 100644 index 000000000..8f6228f22 --- /dev/null +++ b/macosx/HBHUDButtonCell.m @@ -0,0 +1,22 @@ +// +// HBHUDButtonCell.m +// HandBrake +// +// Created by Damiano Galassi on 17/08/14. +// +// + +#import "HBHUDButtonCell.h" + +@implementation HBHUDButtonCell + +- (NSRect)drawTitle:(NSAttributedString *)title withFrame:(NSRect)frame inView:(NSView *)controlView +{ + NSAttributedString *attrLabel = [[[NSAttributedString alloc] initWithString:[title string] + attributes:@{ NSFontAttributeName:[NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:self.controlSize]], + NSForegroundColorAttributeName: [NSColor whiteColor]}] autorelease]; + + return [super drawTitle:attrLabel withFrame:frame inView:controlView]; +} + +@end diff --git a/macosx/HBJob.h b/macosx/HBJob.h new file mode 100644 index 000000000..3521d4645 --- /dev/null +++ b/macosx/HBJob.h @@ -0,0 +1,56 @@ +/* HBJob.h $ + + This file is part of the HandBrake source code. + Homepage: <http://handbrake.fr/>. + It may be used under the terms of the GNU General Public License. */ + +#import <Foundation/Foundation.h> + +#include "hb.h" + +@class HBPreset; + +@class HBVideo; +@class HBPicture; +@class HBFilters; + +@class HBAudioSettings; +@class HBSubtitlesSettings; + +/** + * HBJob + */ +@interface HBJob : NSObject <NSCoding, NSCopying> + +- (instancetype)initWithTitle:(hb_title_t *)title url:(NSURL *)fileURL andPreset:(HBPreset *)preset; + +// libhb +@property (nonatomic, readonly) hb_title_t *title; +@property (nonatomic, readonly) NSURL *fileURL; + +// Old job format +@property (nonatomic, readwrite, retain) NSDictionary *jobDict; +@property (nonatomic, readonly) NSAttributedString *jobDescription; + +// Job settings + +@property (nonatomic, readwrite) int fileFormat; + +@property (nonatomic, readwrite) BOOL mp4LargeFile; +@property (nonatomic, readwrite) BOOL mp4HttpOptimize; +@property (nonatomic, readwrite) BOOL mp4iPodCompatible; + +@property (nonatomic, readonly) HBVideo *video; +@property (nonatomic, readonly) HBPicture *picture; +@property (nonatomic, readonly) HBFilters *filters; + +// Defaults settings +@property (nonatomic, readonly) HBAudioSettings *audioSettings; +@property (nonatomic, readonly) HBSubtitlesSettings *subtitlesSettings; + +// File resources +@property (nonatomic, readonly) NSMutableArray *audioTracks; +@property (nonatomic, readonly) NSMutableArray *subtitlesTracks; +@property (nonatomic, readonly) NSMutableArray *chapters; + +@end diff --git a/macosx/HBJob.m b/macosx/HBJob.m new file mode 100644 index 000000000..78e6a317b --- /dev/null +++ b/macosx/HBJob.m @@ -0,0 +1,191 @@ +/* HBJob.m $ + + This file is part of the HandBrake source code. + Homepage: <http://handbrake.fr/>. + It may be used under the terms of the GNU General Public License. */ + +#import "HBJob.h" +#import "HBAudioSettings.h" +#import "HBSubtitlesSettings.h" +#import "HBPreset.h" + +#include "lang.h" + +extern NSString *keyAudioTrackIndex; +extern NSString *keyAudioTrackName; +extern NSString *keyAudioInputBitrate; +extern NSString *keyAudioInputSampleRate; +extern NSString *keyAudioInputCodec; +extern NSString *keyAudioInputCodecParam; +extern NSString *keyAudioInputChannelLayout; +extern NSString *keyAudioTrackLanguageIsoCode; + +extern NSString *keySubTrackName; +extern NSString *keySubTrackIndex; +extern NSString *keySubTrackLanguage; +extern NSString *keySubTrackLanguageIsoCode; +extern NSString *keySubTrackType; + +extern NSString *keySubTrackForced; +extern NSString *keySubTrackBurned; +extern NSString *keySubTrackDefault; + +extern NSString *keySubTrackSrtOffset; +extern NSString *keySubTrackSrtFilePath; +extern NSString *keySubTrackSrtCharCode; + +@implementation HBJob + +- (instancetype)initWithTitle:(hb_title_t *)title url:(NSURL *)fileURL andPreset:(HBPreset *)preset +{ + self = [super init]; + if (self) { + _title = title; + _fileURL = [fileURL copy]; + + _audioTracks = [[NSMutableArray alloc] init]; + _subtitlesTracks = [[NSMutableArray alloc] init]; + _chapters = [[NSMutableArray alloc] init]; + + _audioSettings = [[HBAudioSettings alloc] init]; + _subtitlesSettings = [[HBSubtitlesSettings alloc] init]; + + [self loadAudioTracks]; + [self loadSubtitlesTracks]; + [self loadChapters]; + } + return self; +} + +- (void)applyPreset:(HBPreset *)preset +{ + [self.audioSettings applySettingsFromPreset:preset.content]; + [self.subtitlesSettings applySettingsFromPreset:preset.content]; +} + +#pragma mark - initialization + +- (void)loadAudioTracks +{ + hb_audio_config_t *audio; + hb_list_t *list = self.title->list_audio; + int count = hb_list_count(list); + + // Initialize the audio list of available audio tracks from this title + for (int i = 0; i < count; i++) + { + audio = (hb_audio_config_t *) hb_list_audio_config_item(list, i); + [self.audioTracks addObject: @{keyAudioTrackIndex: @(i + 1), + keyAudioTrackName: [NSString stringWithFormat: @"%d: %s", i, audio->lang.description], + keyAudioInputBitrate: @(audio->in.bitrate / 1000), + keyAudioInputSampleRate: @(audio->in.samplerate), + keyAudioInputCodec: [NSNumber numberWithUnsignedInteger: audio->in.codec], + keyAudioInputCodecParam: [NSNumber numberWithUnsignedInteger: audio->in.codec_param], + keyAudioInputChannelLayout: @(audio->in.channel_layout), + keyAudioTrackLanguageIsoCode: @(audio->lang.iso639_2)}]; + } +} + +- (void)loadSubtitlesTracks +{ + hb_subtitle_t *subtitle; + hb_list_t *list = self.title->list_audio; + int count = hb_list_count(list); + + NSMutableArray *forcedSourceNamesArray = [[NSMutableArray alloc] init]; + //NSString *foreignAudioSearchTrackName = nil; + + for (int i = 0; i < count; i++) + { + subtitle = (hb_subtitle_t *)hb_list_item(self.title->list_subtitle, i); + + /* Human-readable representation of subtitle->source */ + NSString *bitmapOrText = subtitle->format == PICTURESUB ? @"Bitmap" : @"Text"; + NSString *subSourceName = @(hb_subsource_name(subtitle->source)); + + /* if the subtitle track can be forced, add its source name to the array */ + if (hb_subtitle_can_force(subtitle->source) && [forcedSourceNamesArray containsObject:subSourceName] == NO) + { + [forcedSourceNamesArray addObject:subSourceName]; + } + + // Use the native language name if available + iso639_lang_t *language = lang_for_code2(subtitle->iso639_2); + NSString *nativeLanguage = strlen(language->native_name) ? @(language->native_name) : @(language->eng_name); + + /* create a dictionary of source subtitle information to store in our array */ + [self.subtitlesTracks addObject:@{keySubTrackName: [NSString stringWithFormat:@"%d: %@ (%@) (%@)", i, nativeLanguage, bitmapOrText, subSourceName], + keySubTrackIndex: @(i), + keySubTrackType: @(subtitle->source), + keySubTrackLanguage: nativeLanguage, + keySubTrackLanguageIsoCode: @(subtitle->iso639_2)}]; + } + + /* now set the name of the Foreign Audio Search track */ + if ([forcedSourceNamesArray count]) + { + [forcedSourceNamesArray sortUsingComparator:^(id obj1, id obj2) + { + return [((NSString *)obj1) compare:((NSString *)obj2)]; + }]; + + NSString *tempList = @""; + for (NSString *tempString in forcedSourceNamesArray) + { + if ([tempList length]) + { + tempList = [tempList stringByAppendingString:@", "]; + } + tempList = [tempList stringByAppendingString:tempString]; + } + //foreignAudioSearchTrackName = [NSString stringWithFormat:@"Foreign Audio Search (Bitmap) (%@)", tempList]; + } + else + { + //foreignAudioSearchTrackName = @"Foreign Audio Search (Bitmap)"; + } + [forcedSourceNamesArray release]; +} + +- (void)loadChapters +{ + for (int i = 0; i < hb_list_count(self.title->job->list_chapter); i++) + { + hb_chapter_t *chapter = hb_list_item(self.title->job->list_chapter, i); + if (chapter != NULL) + { + if (chapter->title != NULL) + { + [self.chapters addObject:[NSString + stringWithFormat:@"%s", + chapter->title]]; + } + else + { + [self.chapters addObject:[NSString + stringWithFormat:@"Chapter %d", + i + 1]]; + } + } + } +} + +#pragma mark - NSCoding + +- (void)encodeWithCoder:(NSCoder *)coder +{ +} + +- (id)initWithCoder:(NSCoder *)decoder +{ + return nil; +} + +#pragma mark - NSCopying + +- (instancetype)copyWithZone:(NSZone *)zone +{ + return nil; +} + +@end diff --git a/macosx/HBPicture.h b/macosx/HBPicture.h new file mode 100644 index 000000000..4366d3e6d --- /dev/null +++ b/macosx/HBPicture.h @@ -0,0 +1,30 @@ +// +// HBPicture.h +// HandBrake +// +// Created by Damiano Galassi on 12/08/14. +// +// + +#import <Foundation/Foundation.h> + +@interface HBPicture : NSObject + +/* + width + height + + autocrop + crop[] + anamorphic { + mode + keepDisplayAspect + par_width + par_height + dar_width + dar_height + } + modulus + */ + +@end diff --git a/macosx/HBPicture.m b/macosx/HBPicture.m new file mode 100644 index 000000000..bdbd2a677 --- /dev/null +++ b/macosx/HBPicture.m @@ -0,0 +1,13 @@ +// +// HBPicture.m +// HandBrake +// +// Created by Damiano Galassi on 12/08/14. +// +// + +#import "HBPicture.h" + +@implementation HBPicture + +@end diff --git a/macosx/HBVideo.h b/macosx/HBVideo.h new file mode 100644 index 000000000..3c174824f --- /dev/null +++ b/macosx/HBVideo.h @@ -0,0 +1,34 @@ +// +// HBVideo.h +// HandBrake +// +// Created by Damiano Galassi on 12/08/14. +// +// + +#import <Foundation/Foundation.h> + +@interface HBVideo : NSObject + +/* + videoEncoder + videoEncoderTag + + qualityType + avgBitrate + quality + + frameRate + frameRateTag + frameRateMode + + fastFirstPass + twoPass + turboTwoPass + + encoderOptions { + x264 + lav + }*/ + +@end diff --git a/macosx/HBVideo.m b/macosx/HBVideo.m new file mode 100644 index 000000000..ce662fbc4 --- /dev/null +++ b/macosx/HBVideo.m @@ -0,0 +1,13 @@ +// +// HBVideo.m +// HandBrake +// +// Created by Damiano Galassi on 12/08/14. +// +// + +#import "HBVideo.h" + +@implementation HBVideo + +@end diff --git a/macosx/HandBrake.xcodeproj/project.pbxproj b/macosx/HandBrake.xcodeproj/project.pbxproj index c92c026eb..f7a6fc851 100644 --- a/macosx/HandBrake.xcodeproj/project.pbxproj +++ b/macosx/HandBrake.xcodeproj/project.pbxproj @@ -123,9 +123,11 @@ A932E273198834130047D13E /* HBAudioSettings.m in Sources */ = {isa = PBXBuildFile; fileRef = A932E272198834130047D13E /* HBAudioSettings.m */; }; A93E0ED31972957000FD67FB /* HBVideoController.m in Sources */ = {isa = PBXBuildFile; fileRef = A93E0ED11972957000FD67FB /* HBVideoController.m */; }; A93E0ED71972958C00FD67FB /* Video.xib in Resources */ = {isa = PBXBuildFile; fileRef = A93E0ED51972958C00FD67FB /* Video.xib */; }; + A9523937199A6AAE00588AEF /* HBFilters.m in Sources */ = {isa = PBXBuildFile; fileRef = A9523936199A6AAE00588AEF /* HBFilters.m */; }; A98C29C41977B10600AF5DED /* HBLanguagesSelection.m in Sources */ = {isa = PBXBuildFile; fileRef = A98C29C31977B10600AF5DED /* HBLanguagesSelection.m */; }; A9935213196F38A70069C6B7 /* ChaptersTitles.xib in Resources */ = {isa = PBXBuildFile; fileRef = A9935211196F38A70069C6B7 /* ChaptersTitles.xib */; }; A9AA447A1970664A00D7DEFC /* HBUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = A9AA44791970664A00D7DEFC /* HBUtilities.m */; }; + A9BB0F2719A0ECE40079F1C1 /* HBHUDButtonCell.m in Sources */ = {isa = PBXBuildFile; fileRef = A9BB0F2619A0ECE40079F1C1 /* HBHUDButtonCell.m */; }; A9C0DB85197E7B0000DF55B3 /* SubtitlesDefaults.xib in Resources */ = {isa = PBXBuildFile; fileRef = A9C0DB83197E7B0000DF55B3 /* SubtitlesDefaults.xib */; }; A9CF25F11990D62C0023F727 /* Presets.xib in Resources */ = {isa = PBXBuildFile; fileRef = A9CF25EF1990D62C0023F727 /* Presets.xib */; }; A9CF25F41990D64E0023F727 /* HBPreset.m in Sources */ = {isa = PBXBuildFile; fileRef = A9CF25F31990D64E0023F727 /* HBPreset.m */; }; @@ -335,6 +337,8 @@ A93E0ED01972957000FD67FB /* HBVideoController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBVideoController.h; sourceTree = "<group>"; }; A93E0ED11972957000FD67FB /* HBVideoController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBVideoController.m; sourceTree = "<group>"; }; A93E0ED61972958C00FD67FB /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = Video.xib; sourceTree = "<group>"; }; + A9523935199A6AAE00588AEF /* HBFilters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBFilters.h; sourceTree = "<group>"; }; + A9523936199A6AAE00588AEF /* HBFilters.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBFilters.m; sourceTree = "<group>"; }; A98C29C21977B10600AF5DED /* HBLanguagesSelection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBLanguagesSelection.h; sourceTree = "<group>"; }; A98C29C31977B10600AF5DED /* HBLanguagesSelection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBLanguagesSelection.m; sourceTree = "<group>"; }; A9935212196F38A70069C6B7 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = ChaptersTitles.xib; sourceTree = "<group>"; }; @@ -344,6 +348,8 @@ A9AA447C1970726500D7DEFC /* HBQueueController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HBQueueController.h; sourceTree = "<group>"; }; A9AA447D1970729300D7DEFC /* HBPreviewGenerator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HBPreviewGenerator.h; sourceTree = "<group>"; }; A9B34D74197696FE00871B7D /* DiskArbitration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = DiskArbitration.framework; path = System/Library/Frameworks/DiskArbitration.framework; sourceTree = SDKROOT; }; + A9BB0F2519A0ECE40079F1C1 /* HBHUDButtonCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBHUDButtonCell.h; sourceTree = "<group>"; }; + A9BB0F2619A0ECE40079F1C1 /* HBHUDButtonCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBHUDButtonCell.m; sourceTree = "<group>"; }; A9C0DB84197E7B0000DF55B3 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = SubtitlesDefaults.xib; sourceTree = "<group>"; }; A9CF25F01990D62C0023F727 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = Presets.xib; sourceTree = "<group>"; }; A9CF25F21990D64E0023F727 /* HBPreset.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBPreset.h; sourceTree = "<group>"; }; @@ -578,6 +584,7 @@ children = ( A9B34D6F197683FE00871B7D /* Controllers */, A98C29C51977C00000AF5DED /* Model */, + A952392E199A647F00588AEF /* Presets */, A9AA447D1970729300D7DEFC /* HBPreviewGenerator.h */, A9D1E41618262364002F6424 /* HBPreviewGenerator.m */, A9AA44781970664A00D7DEFC /* HBUtilities.h */, @@ -586,6 +593,8 @@ 273F209814ADBE670021BE6D /* HBDVDDetector.m */, 273F209D14ADBE670021BE6D /* HBOutputRedirect.h */, 273F209E14ADBE670021BE6D /* HBOutputRedirect.m */, + A98C29C21977B10600AF5DED /* HBLanguagesSelection.h */, + A98C29C31977B10600AF5DED /* HBLanguagesSelection.m */, A9B34D711976844500871B7D /* UI Views */, 273F20BD14ADC09F0021BE6D /* main.mm */, ); @@ -751,7 +760,7 @@ name = "Audio Defaults"; sourceTree = "<group>"; }; - A98C29C51977C00000AF5DED /* Model */ = { + A952392E199A647F00588AEF /* Presets */ = { isa = PBXGroup; children = ( 273F20A114ADBE670021BE6D /* HBPresetsManager.h */, @@ -760,14 +769,23 @@ A9CF25F31990D64E0023F727 /* HBPreset.m */, A9D488A31996270300E9B1BA /* HBTreeNode.h */, A9D488A41996270300E9B1BA /* HBTreeNode.m */, + ); + name = Presets; + sourceTree = "<group>"; + }; + A98C29C51977C00000AF5DED /* Model */ = { + isa = PBXGroup; + children = ( A932E271198834130047D13E /* HBAudioSettings.h */, A932E272198834130047D13E /* HBAudioSettings.m */, A9F4728B1976BAA70009EC65 /* HBSubtitlesSettings.h */, A9F4728C1976BAA70009EC65 /* HBSubtitlesSettings.m */, + 273F209114ADBE670021BE6D /* HBAudio.h */, + 273F209214ADBE670021BE6D /* HBAudio.m */, A90A0CAD1988D57200DA65CE /* HBAudioTrackPreset.h */, A90A0CAE1988D57200DA65CE /* HBAudioTrackPreset.m */, - A98C29C21977B10600AF5DED /* HBLanguagesSelection.h */, - A98C29C31977B10600AF5DED /* HBLanguagesSelection.m */, + A9523935199A6AAE00588AEF /* HBFilters.h */, + A9523936199A6AAE00588AEF /* HBFilters.m */, ); name = Model; sourceTree = "<group>"; @@ -801,8 +819,6 @@ A93E0ED11972957000FD67FB /* HBVideoController.m */, A9AA447B1970724D00D7DEFC /* HBAdvancedController.h */, 273F209014ADBE670021BE6D /* HBAdvancedController.m */, - 273F209114ADBE670021BE6D /* HBAudio.h */, - 273F209214ADBE670021BE6D /* HBAudio.m */, 273F209314ADBE670021BE6D /* HBAudioController.h */, 273F209414ADBE670021BE6D /* HBAudioController.m */, A932E270198833960047D13E /* Audio Defaults */, @@ -823,6 +839,8 @@ 46AB433415F98A2B009C0961 /* DockTextField.m */, 273F209914ADBE670021BE6D /* HBImageAndTextCell.h */, 273F209A14ADBE670021BE6D /* HBImageAndTextCell.m */, + A9BB0F2519A0ECE40079F1C1 /* HBHUDButtonCell.h */, + A9BB0F2619A0ECE40079F1C1 /* HBHUDButtonCell.m */, ); name = "UI Views"; sourceTree = "<group>"; @@ -1014,7 +1032,9 @@ buildActionMask = 2147483647; files = ( A98C29C41977B10600AF5DED /* HBLanguagesSelection.m in Sources */, + A9BB0F2719A0ECE40079F1C1 /* HBHUDButtonCell.m in Sources */, A932E273198834130047D13E /* HBAudioSettings.m in Sources */, + A9523937199A6AAE00588AEF /* HBFilters.m in Sources */, A9AA447A1970664A00D7DEFC /* HBUtilities.m in Sources */, 273F20AC14ADBE670021BE6D /* Controller.m in Sources */, 273F20AD14ADBE670021BE6D /* HBAdvancedController.m in Sources */, diff --git a/macosx/PictureController.h b/macosx/PictureController.h index 23c8ed169..777868efb 100644 --- a/macosx/PictureController.h +++ b/macosx/PictureController.h @@ -5,6 +5,7 @@ It may be used under the terms of the GNU General Public License. */ #import <Cocoa/Cocoa.h> +#import "HBFilters.h" #include "hb.h" @protocol HBPictureControllerDelegate <NSObject> @@ -15,23 +16,8 @@ @interface HBPictureController : NSWindowController <NSWindowDelegate> -@property (nonatomic, readwrite) NSInteger detelecine; -@property (nonatomic, readwrite, copy) NSString *detelecineCustomString; - -@property (nonatomic, readwrite) NSInteger deinterlace; -@property (nonatomic, readwrite, copy) NSString *deinterlaceCustomString; - -@property (nonatomic, readwrite) NSInteger decomb; -@property (nonatomic, readwrite, copy) NSString *decombCustomString; - -@property (nonatomic, readwrite) NSInteger denoise; -@property (nonatomic, readwrite, copy) NSString *denoiseCustomString; - -@property (nonatomic, readwrite) NSInteger deblock; -@property (nonatomic, readwrite) NSInteger grayscale; - +@property (nonatomic, readwrite, retain) HBFilters *filters; @property (nonatomic, readwrite) BOOL autoCrop; -@property (nonatomic, readwrite) NSInteger useDecomb; @property (nonatomic, readwrite, assign) id <HBPictureControllerDelegate> delegate; diff --git a/macosx/PictureController.m b/macosx/PictureController.m index 7b8d88722..901bb5fe2 100644 --- a/macosx/PictureController.m +++ b/macosx/PictureController.m @@ -8,6 +8,33 @@ #import "PictureController.h" #import "HBPreviewController.h" +@interface HBCustomFilterTransformer : NSValueTransformer +@end + +@implementation HBCustomFilterTransformer + ++ (Class)transformedValueClass +{ + return [NSNumber class]; +} + +- (id)transformedValue:(id)value +{ + if ([value intValue] == 1) + return @NO; + else + return @YES; +} + ++ (BOOL)allowsReverseTransformation +{ + return NO; +} + +@end + +static void *HBPictureControllerContext = &HBPictureControllerContext; + @interface HBPictureController () { hb_title_t * fTitle; @@ -51,50 +78,30 @@ /* Video Filters */ IBOutlet NSBox * fDetelecineBox; - IBOutlet NSPopUpButton * fDetelecinePopUp; - IBOutlet NSBox * fDecombDeinterlaceBox; - IBOutlet NSSlider * fDecombDeinterlaceSlider; - IBOutlet NSBox * fDecombBox; - IBOutlet NSPopUpButton * fDecombPopUp; - IBOutlet NSBox * fDeinterlaceBox; - IBOutlet NSPopUpButton * fDeinterlacePopUp; - IBOutlet NSBox * fDenoiseBox; - IBOutlet NSPopUpButton * fDenoisePopUp; - - IBOutlet NSBox * fDeblockBox; // also holds the grayscale box IBOutlet NSTextField * fDeblockField; - IBOutlet NSSlider * fDeblockSlider; - IBOutlet NSButton * fGrayscaleCheck; + IBOutlet NSTextField *fDenoisePreset; + IBOutlet NSPopUpButton *fDenoisePresetPopUp; + IBOutlet NSTextField *fDenoiseTuneLabel; + IBOutlet NSPopUpButton *fDenoiseTunePopUp; + IBOutlet NSTextField *fDenoiseCustomLabel; + IBOutlet NSTextField *fDenoiseCustomField; } -- (void) tabView: (NSTabView *) tabView didSelectTabViewItem: (NSTabViewItem *) tabViewItem; - -- (void) resizeInspectorForTab: (id) sender; - -- (void) adjustSizingDisplay:(id) sender; -- (void) adjustFilterDisplay: (id) sender; - -- (void) reloadStillPreview; - -/* Internal Actions */ -- (IBAction) settingsChanged: (id) sender; -- (IBAction) FilterSettingsChanged: (id) sender; -- (IBAction) modeDecombDeinterlaceSliderChanged: (id) sender; -- (IBAction) deblockSliderChanged: (id) sender; - @end @implementation HBPictureController -- (id) init +- (instancetype)init { if (self = [super initWithWindowNibName:@"PictureSettings"]) { + _filters = [[HBFilters alloc] init]; + // NSWindowController likes to lazily load its window. However since // this controller tries to set all sorts of outlets before the window // is displayed, we need it to load immediately. The correct way to do @@ -105,10 +112,17 @@ // go away. [self window]; - _detelecineCustomString = @""; - _deinterlaceCustomString = @""; - _decombCustomString = @""; - _denoiseCustomString = @""; + // Add the observers for the filters values + NSArray *observerdKeyPaths = @[@"filters.detelecine", @"filters.detelecineCustomString", + @"filters.deinterlace", @"filters.deinterlaceCustomString", + @"filters.decomb", @"filters.decombCustomString", + @"filters.denoise", @"filters.denoisePreset", + @"filters.denoiseTune", @"filters.denoiseCustomString", + @"filters.deblock", @"filters.grayscale", @"filters.useDecomb"]; + for (NSString *keyPath in observerdKeyPaths) + { + [self addObserver:self forKeyPath:keyPath options:NSKeyValueObservingOptionInitial context:HBPictureControllerContext]; + } fPreviewController = [[HBPreviewController alloc] init]; } @@ -116,23 +130,34 @@ return self; } -- (void) awakeFromNib +- (void) dealloc { - [[self window] setDelegate:self]; + NSArray *observerdKeyPaths = @[@"filters.detelecine", @"filters.detelecineCustomString", + @"filters.deinterlace", @"filters.deinterlaceCustomString", + @"filters.decomb", @"filters.decombCustomString", + @"filters.denoise", @"filters.denoisePreset", + @"filters.denoiseTune", @"filters.denoiseCustomString", + @"filters.deblock", @"filters.grayscale", @"filters.useDecomb"]; + @try { + for (NSString *keyPath in observerdKeyPaths) + { + [self removeObserver:self forKeyPath:keyPath]; + } - if( ![[self window] setFrameUsingName:@"PictureSizing"] ) - [[self window] center]; + } @catch (NSException * __unused exception) {} - [self setWindowFrameAutosaveName:@"PictureSizing"]; + [_filters release]; + [fPreviewController release]; + [super dealloc]; +} + +- (void)windowDidLoad +{ [[self window] setExcludedFromWindowsMenu:YES]; /* Populate the user interface */ [fWidthStepper setValueWraps: NO]; - [fWidthStepper setIncrement: 16]; - [fWidthStepper setMinValue: 64]; [fHeightStepper setValueWraps: NO]; - [fHeightStepper setIncrement: 16]; - [fHeightStepper setMinValue: 64]; [fCropTopStepper setIncrement: 2]; [fCropTopStepper setMinValue: 0]; @@ -151,26 +176,8 @@ [fModulusPopUp removeAllItems]; [fModulusPopUp addItemsWithTitles:@[@"16", @"8", @"4", @"2"]]; - /* we use a popup to show the detelecine settings */ - [fDetelecinePopUp removeAllItems]; - [fDetelecinePopUp addItemsWithTitles:@[@"Off", @"Custom", @"Default"]]; - [fDetelecinePopUp selectItemAtIndex: self.detelecine]; - - /* we use a popup to show the decomb settings */ - [fDecombPopUp removeAllItems]; - [fDecombPopUp addItemsWithTitles:@[@"Off", @"Custom", @"Default", @"Fast", @"Bob"]]; - [self modeDecombDeinterlaceSliderChanged:nil]; - [fDecombPopUp selectItemAtIndex: self.decomb]; - - /* we use a popup to show the deinterlace settings */ - [fDeinterlacePopUp removeAllItems]; - [fDeinterlacePopUp addItemsWithTitles:@[@"Off", @"Custom", @"Fast", @"Slow", @"Slower", @"Bob"]]; - [fDeinterlacePopUp selectItemAtIndex: self.deinterlace]; - - /* we use a popup to show the denoise settings */ - [fDenoisePopUp removeAllItems]; - [fDenoisePopUp addItemsWithTitles:@[@"Off", @"Custom", @"Weak", @"Medium", @"Strong"]]; - [fDenoisePopUp selectItemAtIndex: self.denoise]; + [self resizeInspectorForTab:nil]; + [self adjustSizingDisplay:nil]; } - (void) setHandle: (hb_handle_t *) handle @@ -284,21 +291,123 @@ job->anamorphic.par_height; [fDisplayWidthField setIntValue: display_width]; + [fPreviewController setTitle:title]; - /* Set filters widgets according to the filters struct */ - [fDetelecinePopUp selectItemAtIndex:self.detelecine]; - [fDecombPopUp selectItemAtIndex:self.decomb]; - [fDeinterlacePopUp selectItemAtIndex: self.deinterlace]; - [fDenoisePopUp selectItemAtIndex: self.denoise]; - [fDeblockSlider setFloatValue:self.deblock]; - [fGrayscaleCheck setState:self.grayscale]; + [self settingsChanged:nil]; +} - [self deblockSliderChanged: nil]; +#pragma mark - KVO - [fPreviewController setTitle:title]; +- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context +{ + if (context == HBPictureControllerContext) + { + // We use KVO to update the panel + // and notify the main controller of the changes + // in the filters settings. + if ([keyPath isEqualToString:@"filters.useDecomb"]) + { + if (self.filters.useDecomb) + { + [fDecombBox setHidden:NO]; + [fDeinterlaceBox setHidden:YES]; + } + else + { + [fDecombBox setHidden:YES]; + [fDeinterlaceBox setHidden:NO]; + } + } + else if ([keyPath isEqualToString:@"filters.deblock"]) + { + // The minimum deblock value is 5, + // set it to 0 if the value is + // less than 4. + if (self.filters.deblock == 4) + { + [fDeblockField setStringValue: @"Off"]; + self.filters.deblock = 0; + } + else if (self.filters.deblock > 4) + { + [fDeblockField setStringValue:[NSString stringWithFormat: @"%.0ld", (long)self.filters.deblock]]; + } + } + else if ([keyPath isEqualToString:@"filters.deinterlace"] || [keyPath isEqualToString:@"filters.decomb"]) + { + // Might need to update the preview images with + // the new deinterlace/decomb setting. + if ((self.filters.deinterlace && !self.filters.useDecomb) || + (self.filters.decomb && self.filters.useDecomb)) + { + fPreviewController.deinterlacePreview = YES; + } + else + { + fPreviewController.deinterlacePreview = NO; + } + [fPreviewController reload]; + } + else if ([keyPath isEqualToString:@"filters.denoise"] || [keyPath isEqualToString:@"filters.denoisePreset"]) + { + [self validateDenoiseUI]; + } - [self FilterSettingsChanged:nil]; - [self settingsChanged:nil]; + // If one of the filters properties changes + // update the UI in the main window + if ([keyPath hasPrefix:@"filters"]) + { + [self.delegate pictureSettingsDidChange]; + } + } + else + { + [super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; + } +} + +/** + * Validates the denoise UI items, + * disables/enables the right ones. + */ +- (void)validateDenoiseUI +{ + if ([self.filters.denoise isEqualToString:@"off"]) + { + NSArray *uiElements = @[fDenoisePreset, fDenoisePresetPopUp, + fDenoiseTuneLabel, fDenoiseTunePopUp, + fDenoiseCustomLabel, fDenoiseCustomField]; + for (NSView *view in uiElements) + [view setHidden:YES]; + } + else + { + NSArray *uiElements = @[fDenoisePreset, fDenoisePresetPopUp]; + for (NSView *view in uiElements) + [view setHidden:NO]; + + if ([self.filters.denoisePreset isEqualToString:@"none"]) + { + [fDenoiseTuneLabel setHidden:YES]; + [fDenoiseTunePopUp setHidden:YES]; + [fDenoiseCustomLabel setHidden:NO]; + [fDenoiseCustomField setHidden:NO]; + } + else if ([self.filters.denoise isEqualToString:@"hqdn3d"]) + { + [fDenoiseTuneLabel setHidden:YES]; + [fDenoiseTunePopUp setHidden:YES]; + [fDenoiseCustomLabel setHidden:YES]; + [fDenoiseCustomField setHidden:YES]; + } + else + { + [fDenoiseTuneLabel setHidden:NO]; + [fDenoiseTunePopUp setHidden:NO]; + [fDenoiseCustomLabel setHidden:YES]; + [fDenoiseCustomField setHidden:YES]; + } + } } #pragma mark - @@ -319,20 +428,18 @@ /* we are 1 which is Filters*/ if ([fSizeFilterView indexOfTabViewItem: [fSizeFilterView selectedTabViewItem]] == 1) { - frame.size.width = 314; + frame.size.width = 484; /* we glean the height from the size of the boxes plus the extra window space * needed for non boxed display */ - frame.size.height = 110.0 + [fDetelecineBox frame].size.height + [fDecombDeinterlaceBox frame].size.height + [fDenoiseBox frame].size.height + [fDeblockBox frame].size.height; + frame.size.height = 100.0 + [fDetelecineBox frame].size.height + [fDecombDeinterlaceBox frame].size.height; /* Hide the size readout at the bottom as the vertical inspector is not wide enough */ - [fSizeInfoField setHidden:YES]; } else // we are Tab index 0 which is size { frame.size.width = 30.0 + [fPictureSizeBox frame].size.width + [fPictureCropBox frame].size.width; frame.size.height = [fPictureSizeBox frame].size.height + 90; /* hide the size summary field at the bottom */ - [fSizeInfoField setHidden:NO]; } /* get delta's for the change in window size */ CGFloat deltaX = frame.size.width - [[self window] frame].size.width; @@ -418,137 +525,11 @@ [self resizeInspectorForTab:nil]; } -- (void) adjustFilterDisplay: (id) sender -{ - NSBox *filterBox = nil; - if (sender == fDetelecinePopUp) - { - filterBox = fDetelecineBox; - } - - if (sender == fDecombDeinterlaceSlider) - { - if ([fDecombDeinterlaceSlider floatValue] == 0.0) - { - filterBox = fDecombBox; - } - else - { - filterBox = fDeinterlaceBox; - } - } - - if (sender == fDecombPopUp) - { - filterBox = fDecombBox; - } - - if (sender == fDeinterlacePopUp) - { - filterBox = fDeinterlaceBox; - } - - if (sender == fDenoisePopUp) - { - filterBox = fDenoiseBox; - } - - NSSize currentSize = [filterBox frame].size; - NSRect boxFrame = [filterBox frame]; - - if ([[sender titleOfSelectedItem] isEqualToString: @"Custom"]) - { - currentSize.height = 60; - } - else - { - currentSize.height = 36; - } - - /* Check to see if we have changed the size from current */ - if (currentSize.height != [filterBox frame].size.height) - { - /* We are changing the size of the box, so recalc the origin */ - NSPoint boxOrigin = [filterBox frame].origin; - /* We get the deltaY here for how much we are expanding/contracting the box vertically */ - CGFloat deltaYBoxShift = currentSize.height - [filterBox frame].size.height; - boxOrigin.y -= deltaYBoxShift; - - boxFrame.size.height = currentSize.height; - boxFrame.origin.y = boxOrigin.y; - [filterBox setFrame:boxFrame]; - - if (filterBox == fDecombBox || filterBox == fDeinterlaceBox) - { - /* fDecombDeinterlaceBox*/ - NSSize decombDeinterlaceBoxSize = [fDecombDeinterlaceBox frame].size; - NSPoint decombDeinterlaceBoxOrigin = [fDecombDeinterlaceBox frame].origin; - - if ([fDeinterlaceBox isHidden] == YES) - { - decombDeinterlaceBoxSize.height = [fDecombBox frame].size.height + 50; - } - else - { - decombDeinterlaceBoxSize.height = [fDeinterlaceBox frame].size.height + 50; - } - /* get delta's for the change in window size */ - - CGFloat deltaYdecombDeinterlace = decombDeinterlaceBoxSize.height - [fDecombDeinterlaceBox frame].size.height; - - deltaYBoxShift = deltaYdecombDeinterlace; - - decombDeinterlaceBoxOrigin.y -= deltaYdecombDeinterlace; - - [fDecombDeinterlaceBox setFrameSize:decombDeinterlaceBoxSize]; - [fDecombDeinterlaceBox setFrameOrigin:decombDeinterlaceBoxOrigin]; - } - - /* now we must reset the origin of each box below the adjusted box*/ - NSPoint decombDeintOrigin = [fDecombDeinterlaceBox frame].origin; - NSPoint denoiseOrigin = [fDenoiseBox frame].origin; - NSPoint deblockOrigin = [fDeblockBox frame].origin; - if (sender == fDetelecinePopUp) - { - decombDeintOrigin.y -= deltaYBoxShift; - [fDecombDeinterlaceBox setFrameOrigin:decombDeintOrigin]; - - denoiseOrigin.y -= deltaYBoxShift; - [fDenoiseBox setFrameOrigin:denoiseOrigin]; - - deblockOrigin.y -= deltaYBoxShift; - [fDeblockBox setFrameOrigin:deblockOrigin]; - } - if (sender == fDecombPopUp || sender == fDeinterlacePopUp) - { - denoiseOrigin.y -= deltaYBoxShift; - [fDenoiseBox setFrameOrigin:denoiseOrigin]; - - deblockOrigin.y -= deltaYBoxShift; - [fDeblockBox setFrameOrigin:deblockOrigin]; - } - - if (sender == fDenoisePopUp) - { - deblockOrigin.y -= deltaYBoxShift; - [fDeblockBox setFrameOrigin:deblockOrigin]; - } - - /* now we call to resize the entire inspector window */ - [self resizeInspectorForTab:nil]; - } -} - - (NSString *) pictureSizeInfoString { return [fSizeInfoField stringValue]; } -- (void) reloadStillPreview -{ - [fPreviewController reload]; -} - #pragma mark - /** @@ -573,7 +554,7 @@ [[self window] setLevel:NSFloatingWindowLevel]; } - [self adjustFilterDisplay:nil]; + [self resizeInspectorForTab:nil]; [self adjustSizingDisplay:nil]; } @@ -588,11 +569,6 @@ [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"PictureSizeWindowIsOpen"]; } -- (BOOL) windowShouldClose: (id) sender -{ - return YES; -} - /** * This method is used to detect clicking on a tab in fSizeFilterView */ @@ -601,14 +577,7 @@ [self resizeInspectorForTab:nil]; } -- (void) dealloc -{ - [fPreviewController release]; - [super dealloc]; -} - -#pragma mark - -#pragma mark Interface Update Logic +#pragma mark - Picture Update Logic - (IBAction) settingsChanged: (id) sender { @@ -795,7 +764,7 @@ */ if (job->width >= 64 && job->height >= 64) { - [self reloadStillPreview]; + [fPreviewController reload]; } /* we get the sizing info to display from fPreviewController */ @@ -812,118 +781,4 @@ } } -- (IBAction) modeDecombDeinterlaceSliderChanged: (id) sender -{ - /* since its a tickless slider, we have to make sure we are on or off */ - if ([fDecombDeinterlaceSlider floatValue] < 0.50) - { - [fDecombDeinterlaceSlider setFloatValue:0.0]; - } - else - { - [fDecombDeinterlaceSlider setFloatValue:1.0]; - } - - /* Decomb selected*/ - if ([fDecombDeinterlaceSlider floatValue] == 0.0) - { - [fDecombBox setHidden:NO]; - [fDeinterlaceBox setHidden:YES]; - self.decomb = [fDecombPopUp indexOfSelectedItem]; - _useDecomb = 1; - self.deinterlace = 0; - [fDecombPopUp selectItemAtIndex:self.decomb]; - [self adjustFilterDisplay:fDecombPopUp]; - } - else - { - [fDecombBox setHidden:YES]; - [fDeinterlaceBox setHidden:NO]; - _useDecomb = 0; - self.decomb = 0; - [fDeinterlacePopUp selectItemAtIndex: self.deinterlace]; - [self adjustFilterDisplay:fDeinterlacePopUp]; - } - - [self FilterSettingsChanged: fDecombDeinterlaceSlider]; -} - - -- (IBAction) FilterSettingsChanged: (id) sender -{ - if (!fTitle) - return; - - self.detelecine = [fDetelecinePopUp indexOfSelectedItem]; - [self adjustFilterDisplay:fDetelecinePopUp]; - - self.decomb = [fDecombPopUp indexOfSelectedItem]; - [self adjustFilterDisplay:fDecombPopUp]; - - self.deinterlace = [fDeinterlacePopUp indexOfSelectedItem]; - [self adjustFilterDisplay:fDeinterlacePopUp]; - - self.denoise = [fDenoisePopUp indexOfSelectedItem]; - [self adjustFilterDisplay:fDenoisePopUp]; - - if ([[fDeblockField stringValue] isEqualToString:@"Off"]) - { - self.deblock = 0; - } - else - { - self.deblock = [fDeblockField intValue]; - } - - // Tell PreviewController whether it should deinterlace - // the previews or not - if ((self.deinterlace && !self.useDecomb) || - (self.decomb && self.useDecomb)) - { - fPreviewController.deinterlacePreview = YES; - } - else - { - fPreviewController.deinterlacePreview = NO; - } - - self.grayscale = [fGrayscaleCheck state]; - - if (sender != nil) - { - [self.delegate pictureSettingsDidChange]; - [self reloadStillPreview]; - } -} - -- (IBAction) deblockSliderChanged: (id) sender -{ - if ([fDeblockSlider floatValue] == 4.0) - { - [fDeblockField setStringValue: @"Off"]; - } - else - { - [fDeblockField setStringValue: [NSString stringWithFormat: @"%.0f", [fDeblockSlider floatValue]]]; - } - [self FilterSettingsChanged: sender]; -} - -#pragma mark - - -- (void) setUseDecomb: (NSInteger) setting -{ - _useDecomb = setting; - if (self.useDecomb == 1) - { - [fDecombDeinterlaceSlider setFloatValue:0.0]; - } - else - { - [fDecombDeinterlaceSlider setFloatValue:1.0]; - } - - [self modeDecombDeinterlaceSliderChanged:nil]; -} - @end |