From e9ed112a73e26f1636cf4c3e4ab7860fe125ce31 Mon Sep 17 00:00:00 2001 From: Damiano Galassi Date: Mon, 28 Sep 2020 14:53:50 +0200 Subject: MacGui: remove the modulus popup button. --- macosx/Base.lproj/HBPictureViewController.xib | 72 +++----------------- macosx/Base.lproj/PictureSettings.xib | 94 ++++++++++----------------- macosx/HBPicture+UIAdditions.m | 1 - macosx/HBPicture.h | 1 - macosx/HBPicture.m | 37 ++--------- macosx/HBPictureController.m | 8 +-- macosx/HBPictureViewController.m | 30 --------- 7 files changed, 49 insertions(+), 194 deletions(-) (limited to 'macosx') diff --git a/macosx/Base.lproj/HBPictureViewController.xib b/macosx/Base.lproj/HBPictureViewController.xib index 3faa459c8..23bda5723 100644 --- a/macosx/Base.lproj/HBPictureViewController.xib +++ b/macosx/Base.lproj/HBPictureViewController.xib @@ -20,10 +20,10 @@ - + - + @@ -433,10 +433,10 @@ - + - + @@ -468,12 +468,12 @@ - NSIsNotNil + @@ -487,7 +487,7 @@ - + @@ -547,7 +547,7 @@ - + @@ -689,7 +689,7 @@ - - - - - - - - - - - - - - - - - Ensure storage dimensions are multiples of this value. Higher values are only necessary for compatibility with certain legacy devices. Set to 2 unless you have a specific compatibility concern. - - - - - - - - - - - - - - - - - NSIsNotNil - - - - - - - - - - - - - - - @@ -909,9 +860,8 @@ Custom allows manually setting all parameters. Useful for correcting an incorrec - - + @@ -923,7 +873,6 @@ Custom allows manually setting all parameters. Useful for correcting an incorrec - @@ -932,11 +881,10 @@ Custom allows manually setting all parameters. Useful for correcting an incorrec - - + diff --git a/macosx/Base.lproj/PictureSettings.xib b/macosx/Base.lproj/PictureSettings.xib index e9bd2fb93..a0e98160a 100644 --- a/macosx/Base.lproj/PictureSettings.xib +++ b/macosx/Base.lproj/PictureSettings.xib @@ -1,8 +1,8 @@ - + - + @@ -22,16 +22,16 @@ - + - + - + @@ -47,14 +47,14 @@ - + - + @@ -70,7 +70,7 @@ - + @@ -94,7 +94,7 @@ - + @@ -118,7 +118,7 @@ - + @@ -134,7 +134,7 @@ - + @@ -150,7 +150,7 @@ - + @@ -161,26 +161,7 @@ - - - - - - - - - - - - - - - - - - - - + @@ -198,10 +179,10 @@ - + - + @@ -209,7 +190,7 @@ - + @@ -218,7 +199,7 @@ - + @@ -227,7 +208,7 @@ - + @@ -246,16 +227,7 @@ - - - - - - - - - - + @@ -264,7 +236,7 @@ - + @@ -282,7 +254,7 @@ - - + @@ -328,14 +300,14 @@ - + - + @@ -351,7 +323,7 @@ - + @@ -367,7 +339,7 @@ - + @@ -397,7 +369,7 @@ - + @@ -419,7 +391,7 @@ - + @@ -441,7 +413,7 @@ - + @@ -457,7 +429,7 @@ - + @@ -479,7 +451,7 @@ - + @@ -495,7 +467,7 @@ - + @@ -504,7 +476,7 @@ - + diff --git a/macosx/HBPicture+UIAdditions.m b/macosx/HBPicture+UIAdditions.m index bc9403d79..5c3b9b983 100644 --- a/macosx/HBPicture+UIAdditions.m +++ b/macosx/HBPicture+UIAdditions.m @@ -137,7 +137,6 @@ { NSMutableString *summary = [NSMutableString stringWithString:@""]; [summary appendString:self.info]; - [summary appendFormat:HBKitLocalizedString(@", Modulus: %d", @"HBPicture -> summary"), self.modulus]; [summary appendFormat:HBKitLocalizedString(@", Crop: %@ %d/%d/%d/%d", @"HBPicture -> summary"), self.autocrop ? HBKitLocalizedString(@"Auto", @"HBPicture -> summary") : HBKitLocalizedString(@"Custom", @"HBPicture -> summary"), self.cropTop, self.cropBottom, diff --git a/macosx/HBPicture.h b/macosx/HBPicture.h index adc7a0b4b..925bad615 100644 --- a/macosx/HBPicture.h +++ b/macosx/HBPicture.h @@ -69,7 +69,6 @@ extern NSString * const HBPictureChangedNotification; @property (nonatomic, readwrite) BOOL keepDisplayAspect; @property (nonatomic, readwrite) HBPictureAnarmophicMode anamorphicMode; -@property (nonatomic, readwrite) int modulus; /** * Custom anamorphic settings diff --git a/macosx/HBPicture.m b/macosx/HBPicture.m index 1ba541542..f480aef1d 100644 --- a/macosx/HBPicture.m +++ b/macosx/HBPicture.m @@ -20,6 +20,8 @@ NSString * const HBPictureChangedNotification = @"HBPictureChangedNotification"; @property (nonatomic, readwrite, getter=isValidating) BOOL validating; @property (nonatomic, readwrite, getter=areNotificationsEnabled) BOOL notificationsEnabled; +@property (nonatomic, readonly) int modulus; + @property (nonatomic, readwrite) int keep; @property (nonatomic, readwrite) BOOL darUpdated; @@ -51,7 +53,6 @@ NSString * const HBPictureChangedNotification = @"HBPictureChangedNotification"; _sourceHeight = 1080; _anamorphicMode = HBPictureAnarmophicModeNone; - _modulus = 2; _paddingMode = HBPicturePaddingModeNone; _paddingColorMode = HBPicturePaddingColorModeBlack; @@ -605,17 +606,9 @@ NSString * const HBPictureChangedNotification = @"HBPictureChangedNotification"; } } -- (void)setModulus:(int)modulus +- (int)modulus { - if (modulus != _modulus) - { - [[self.undo prepareWithInvocationTarget:self] setModulus:_modulus]; - } - _modulus = modulus; - if (!self.isValidating) - { - [self validateSettings]; - } + return 2; } #pragma mark - Max sizes @@ -823,7 +816,6 @@ NSString * const HBPictureChangedNotification = @"HBPictureChangedNotification"; copy->_keepDisplayAspect = _keepDisplayAspect; copy->_anamorphicMode = _anamorphicMode; - copy->_modulus = _modulus; copy->_displayWidth = _displayWidth; copy->_parWidth = _parWidth; @@ -881,7 +873,6 @@ NSString * const HBPictureChangedNotification = @"HBPictureChangedNotification"; encodeBool(_keepDisplayAspect); encodeInteger(_anamorphicMode); - encodeInt(_modulus); encodeInt(_displayWidth); encodeInt(_parWidth); @@ -937,8 +928,6 @@ NSString * const HBPictureChangedNotification = @"HBPictureChangedNotification"; goto fail; } - decodeInt(_modulus); if (_modulus < 2 || _modulus > 16) { goto fail; } - decodeInt(_displayWidth); if (_displayWidth < 0) { goto fail; } decodeInt(_parWidth); if (_parWidth < 0) { goto fail; } decodeInt(_parHeight); if (_parHeight < 0) { goto fail; } @@ -993,7 +982,6 @@ fail: preset[@"PictureHeight"] = @(self.maxHeight); preset[@"PictureKeepRatio"] = @(self.keepDisplayAspect); - preset[@"PictureModulus"] = @(self.modulus); switch (self.anamorphicMode) { case HB_ANAMORPHIC_NONE: @@ -1081,7 +1069,7 @@ fail: } else if (self.maxWidth == 720 && self.maxHeight == 480) { - self.resolutionLimitMode = HBPictureResolutionLimitMode576p; + self.resolutionLimitMode = HBPictureResolutionLimitMode480p; } else { @@ -1116,21 +1104,6 @@ fail: self.cropRight = [preset[@"PictureRightCrop"] intValue]; } - // Set modulus - if (preset[@"PictureModulus"]) - { - self.modulus = [preset[@"PictureModulus"] intValue]; - } - else - { - self.modulus = 16; - } - - if (self.modulus <= 0 || self.modulus > 16) - { - self.modulus = 2; - } - // Assume max picture settings initially. self.keepDisplayAspect = [preset[@"PictureKeepRatio"] boolValue]; diff --git a/macosx/HBPictureController.m b/macosx/HBPictureController.m index fc0eb195a..81dbe017b 100644 --- a/macosx/HBPictureController.m +++ b/macosx/HBPictureController.m @@ -41,7 +41,6 @@ static void *HBPictureControllerContext = &HBPictureControllerContext; [self window]; [self addObserver:self forKeyPath:@"self.picture.anamorphicMode" options:NSKeyValueObservingOptionInitial context:HBPictureControllerContext]; - [self addObserver:self forKeyPath:@"self.picture.modulus" options:NSKeyValueObservingOptionInitial context:HBPictureControllerContext]; } return self; @@ -49,7 +48,7 @@ static void *HBPictureControllerContext = &HBPictureControllerContext; - (void)dealloc { - NSArray *observerdKeyPaths = @[@"self.picture.anamorphicMode", @"self.picture.modulus"]; + NSArray *observerdKeyPaths = @[@"self.picture.anamorphicMode"]; @try { for (NSString *keyPath in observerdKeyPaths) @@ -87,11 +86,6 @@ static void *HBPictureControllerContext = &HBPictureControllerContext; { [self adjustSizingDisplay:nil]; } - else if ([keyPath isEqualToString:@"self.picture.modulus"]) - { - [fWidthStepper setIncrement:self.picture.modulus]; - [fHeightStepper setIncrement:self.picture.modulus]; - } } else { diff --git a/macosx/HBPictureViewController.m b/macosx/HBPictureViewController.m index ae18cf38f..e517888f8 100644 --- a/macosx/HBPictureViewController.m +++ b/macosx/HBPictureViewController.m @@ -27,20 +27,10 @@ static void *HBPictureViewControllerContext = &HBPictureViewControllerContext; if (self) { _labelColor = [NSColor disabledControlTextColor]; - [self addObserver:self forKeyPath:@"self.picture.modulus" options:NSKeyValueObservingOptionInitial context:HBPictureViewControllerContext]; } return self; } -- (void)dealloc -{ - @try - { - [self removeObserver:self forKeyPath:@"self.picture.modulus" context:HBPictureViewControllerContext]; - } - @catch (NSException * __unused exception) {} -} - - (void)setPicture:(HBPicture *)picture { _picture = picture; @@ -56,24 +46,4 @@ static void *HBPictureViewControllerContext = &HBPictureViewControllerContext; } -#pragma mark - KVO - -- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context -{ - if (context == HBPictureViewControllerContext) - { - // Set the increment here, it's not possible with bindings. - if ([keyPath isEqualToString:@"self.picture.modulus"]) - { - [self.widthStepper setIncrement:self.picture.modulus]; - [self.heightStepper setIncrement:self.picture.modulus]; - } - } - else - { - [super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; - } -} - - @end -- cgit v1.2.3