Optimize the monospace font attribute.
This commit is contained in:
1 parent
772133a445
commit
ecb5bd1166
2 files changed
+18
-11
No files matched your search
@@ -47,6 +47,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
IBOutlet NSButton *_64bit_data;
|
IBOutlet NSButton *_64bit_data;
|
||||||
IBOutlet NSButton *_64bit_time;
|
IBOutlet NSButton *_64bit_time;
|
||||||
BOOL _optimize;
|
BOOL _optimize;
|
||||||
|
|
||||||
|
NSDictionary *_detailMonospacedAttr;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (instancetype)initWithMP4:(MP42File *)mp4File error:(NSError **)outError;
|
- (instancetype)initWithMP4:(MP42File *)mp4File error:(NSError **)outError;
|
||||||
|
|||||||
+16
-11
@@ -66,6 +66,17 @@
|
|||||||
[documentWindow setFrameUsingName:@"documentSave"];
|
[documentWindow setFrameUsingName:@"documentSave"];
|
||||||
[splitView setAutosaveName:@"splitViewSave"];
|
[splitView setAutosaveName:@"splitViewSave"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ([[NSFont class] respondsToSelector:@selector(monospacedDigitSystemFontOfSize:weight:)]) {
|
||||||
|
NSFont *font = [NSFont monospacedDigitSystemFontOfSize:[NSFont systemFontSize] weight:NSFontWeightRegular];
|
||||||
|
NSMutableParagraphStyle *ps = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
|
||||||
|
ps.alignment = NSTextAlignmentRight;
|
||||||
|
|
||||||
|
_detailMonospacedAttr = [@{NSFontAttributeName: font,
|
||||||
|
NSParagraphStyleAttributeName: ps} retain];
|
||||||
|
|
||||||
|
[ps release];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (instancetype)initWithMP4:(MP42File *)mp4File error:(NSError **)outError
|
- (instancetype)initWithMP4:(MP42File *)mp4File error:(NSError **)outError
|
||||||
@@ -463,17 +474,8 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
|||||||
|
|
||||||
if ([tableColumn.identifier isEqualToString:@"trackDuration"]) {
|
if ([tableColumn.identifier isEqualToString:@"trackDuration"]) {
|
||||||
|
|
||||||
if ([[NSFont class] respondsToSelector:@selector(monospacedDigitSystemFontOfSize:weight:)]) {
|
if (_detailMonospacedAttr) {
|
||||||
NSFont *font = [NSFont monospacedDigitSystemFontOfSize:[NSFont systemFontSize] weight:NSFontWeightRegular];
|
return [[[NSAttributedString alloc] initWithString:track.timeString attributes:_detailMonospacedAttr] autorelease];
|
||||||
NSMutableParagraphStyle *ps = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
|
|
||||||
ps.alignment = NSTextAlignmentRight;
|
|
||||||
|
|
||||||
NSDictionary *monospacedAttr = @{NSFontAttributeName: font,
|
|
||||||
NSParagraphStyleAttributeName: ps};
|
|
||||||
|
|
||||||
[ps release];
|
|
||||||
|
|
||||||
return [[[NSAttributedString alloc] initWithString:track.timeString attributes:monospacedAttr] autorelease];
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return track.timeString;
|
return track.timeString;
|
||||||
@@ -1099,6 +1101,9 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
|||||||
[_mp4File release];
|
[_mp4File release];
|
||||||
_mp4File = nil;
|
_mp4File = nil;
|
||||||
|
|
||||||
|
[_detailMonospacedAttr release];
|
||||||
|
_detailMonospacedAttr = nil;
|
||||||
|
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user