Update number formatter

This commit is contained in:
Gregory John Casamento 2024-12-08 00:42:53 -05:00
parent ea7307a91b
commit eab17e9f2f
6 changed files with 22 additions and 23 deletions

View file

@ -4,15 +4,15 @@
Actions = (
);
Outlets = (
formatTable,
detachButton,
addThousandSeparatorSwitch,
commaPointSwitch,
formatForm,
formatTable,
localizeSwitch,
negativeField,
negativeRedSwitch,
positiveField,
detachButton
positiveField
);
Super = IBInspector;
};

View file

@ -35,11 +35,11 @@
id commaPointSwitch;
id formatForm;
id formatTable;
id localizeSwitch;
id negativeField;
id negativeRedSwitch;
id positiveField;
id detachButton;
id localizeSwitch;
id positiveField;
id negativeField;
}
@end

View file

@ -98,17 +98,16 @@ extern NSArray *predefinedNumberFormats;
zeroFmt = [NSNumberFormatter zeroFormatAtIndex:row];
negativeFmt = [NSNumberFormatter negativeFormatAtIndex:row];
fullFmt = [NSNumberFormatter formatAtIndex:row];
// Update Appearance samples
[self updateAppearanceFieldsWithFormat: fullFmt];
// Update editable format fields
[[formatForm cellAtIndex:0] setStringValue: VSTR(positiveFmt)];
[[formatForm cellAtIndex:1] setStringValue: VSTR(zeroFmt)];
[[formatForm cellAtIndex:2] setStringValue: VSTR(negativeFmt)];
[fmtr setFormat:fullFmt];
// Update Appearance samples
[self updateAppearanceFieldsWithFormat: fullFmt];
// Update editable format fields
[[formatForm cellAtIndex:0] setStringValue: VSTR(positiveFmt)];
// [[formatForm cellAtIndex:1] setStringValue: VSTR(zeroFmt)];
[[formatForm cellAtIndex:2] setStringValue: VSTR(negativeFmt)];
[fmtr setFormat:fullFmt];
}
}
else if (sender == formatForm)
@ -116,10 +115,10 @@ extern NSArray *predefinedNumberFormats;
NSUInteger idx;
positiveFmt = [[sender cellAtIndex:0] stringValue];
zeroFmt = [[sender cellAtIndex:1] stringValue];
negativeFmt = [[sender cellAtIndex:2] stringValue];
minValue = [[sender cellAtIndex:3] stringValue];
maxValue = [[sender cellAtIndex:4] stringValue];
// zeroFmt = [[sender cellAtIndex:1] stringValue];
negativeFmt = [[sender cellAtIndex:1] stringValue];
minValue = [[sender cellAtIndex:2] stringValue];
maxValue = [[sender cellAtIndex:3] stringValue];
NSDebugLog(@"min,max: %@, %@", minValue, maxValue);
fullFmt = [NSString stringWithFormat:@"%@;%@;%@",
@ -187,10 +186,10 @@ extern NSArray *predefinedNumberFormats;
// Format form
NSDebugLog(@"format from object: %@", [fmtr format]);
[[formatForm cellAtIndex:0] setStringValue: [fmtr positiveFormat]];
[[formatForm cellAtIndex:1] setStringValue: [fmtr zeroFormat]];
[[formatForm cellAtIndex:2] setStringValue: [fmtr negativeFormat]];
[[formatForm cellAtIndex:3] setObjectValue: [fmtr minimum]];
[[formatForm cellAtIndex:4] setObjectValue: [fmtr maximum]];
// [[formatForm cellAtIndex:1] setStringValue: [fmtr zeroFormat]];
[[formatForm cellAtIndex:1] setStringValue: [fmtr negativeFormat]];
[[formatForm cellAtIndex:2] setObjectValue: [fmtr minimum]];
[[formatForm cellAtIndex:3] setObjectValue: [fmtr maximum]];
// If the string typed is a predefined one then highligh it in
// Number Format table view above