diff options
author | Damiano Galassi <[email protected]> | 2017-11-27 12:40:34 +0100 |
---|---|---|
committer | Damiano Galassi <[email protected]> | 2017-11-27 12:40:34 +0100 |
commit | f0200cb414f57e50361e263ddb78ef2ed8f6cbdc (patch) | |
tree | 90a0c40c5c47213b8df3a275bf6d8d8a29e52014 /macosx | |
parent | 970a5692548a9f600e1c969ba90850013ff1647c (diff) |
MacGui: show PAR and DAR in the summary panel.
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/HBPicture+UIAdditions.m | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/macosx/HBPicture+UIAdditions.m b/macosx/HBPicture+UIAdditions.m index 21b92d851..9223a47f1 100644 --- a/macosx/HBPicture+UIAdditions.m +++ b/macosx/HBPicture+UIAdditions.m @@ -91,7 +91,35 @@ - (NSString *)shortInfo { - return [NSString stringWithFormat:NSLocalizedString(@"%dx%d Storage, %dx%d Display", nil), self.width, self.height, self.displayWidth, self.height]; + return [NSString stringWithFormat:NSLocalizedString(@"%dx%d Storage, %dx%d Display\n %d : %d PAR, %@ DAR", nil), + self.width, self.height, self.displayWidth, self.height, + self.parWidth, self.parHeight, [self displayAspectInfo]]; +} + +- (NSString *)displayAspectInfo +{ + int dar_width, dar_height; + NSString *str; + + hb_reduce(&dar_width, &dar_height, self.displayWidth, self.height); + int iaspect = dar_width * 9 / dar_height; + if (dar_width > 2 * dar_height) + { + str = [NSString stringWithFormat:@"%.2g : 1", (double)dar_width / dar_height]; + } + else if (iaspect <= 16 && iaspect >= 15) + { + str = [NSString stringWithFormat:@"%.2g : 9", (double)dar_width * 9 / dar_height]; + } + else if (iaspect <= 12 && iaspect >= 11) + { + str = [NSString stringWithFormat:@"%.2g : 3", (double)dar_width * 3 / dar_height]; + } + else + { + str = [NSString stringWithFormat:@"%d : %d", dar_width, dar_height]; + } + return str; } - (NSString *)sourceInfo |