Fix checkmark in line spacing menu

This commit is contained in:
1024jp 2015-01-24 14:30:45 +01:00
parent be7ec8e664
commit 8d60d1c22b
4 changed files with 17 additions and 1 deletions

View File

@ -59,6 +59,7 @@ Change Log
- Fix an issue that Unicode character insertion was occasionally failed.
- Fix an issue that syntax highlights were removed after perform Unhighlight.
- Fix timing to display sheets on file open.
- Fix an issue that checkmark in line height menu was not displayed.
- Fix some missing localizations in simplified Chinese. (Thanks to Wei Wang!)
- Fix an issue that an alert message was not localized.
- And other trivial UI fixes and enhancements.

View File

@ -951,7 +951,8 @@ static NSPoint kTextContainerOrigin;
//
} else if ([menuItem action] == @selector(changeLineHeight:)) {
[menuItem setState:(([self lineSpacing] == (CGFloat)[[menuItem title] doubleValue] - 1.0) ? NSOnState : NSOffState)];
CGFloat lineSpacing = [[menuItem title] doubleValue] - 1.0;
[menuItem setState:(CEIsEqualCGFloats([self lineSpacing], lineSpacing, 3) ? NSOnState : NSOffState)];
} else if ([menuItem action] == @selector(changeTabWidth:)) {
[menuItem setState:(([self tabWidth] == [menuItem tag]) ? NSOnState : NSOffState)];
} else if ([menuItem action] == @selector(showSelectionInfo:)) {

View File

@ -70,6 +70,11 @@ typedef NS_ENUM(UInt32, CESystemSoundID) {
};
// convenient functions
/// compare CGFloats
BOOL CEIsEqualCGFloats(CGFloat float1, CGFloat float2, NSInteger accuracy);
#pragma mark Notifications

View File

@ -70,6 +70,15 @@ NSString *const kHelpAnchors[] = {
@"pref_integration"
};
// convenient functions
/// compare CGFloats
BOOL CEIsEqualCGFloats(CGFloat float1, CGFloat float2, NSInteger accuracy) {
return (fabs(float1 - float2) < pow(10, -accuracy));
}
#pragma mark Notifications
// ------------------------------------------------------