Merge branch 'master' into parser_improvements

This commit is contained in:
Gregory John Casamento 2024-12-17 14:34:32 -05:00
commit 185119df80
6 changed files with 52 additions and 27 deletions

View file

@ -64,11 +64,24 @@
- (void) finishInstantiate
{
NSView *contentView = [originalWindow contentView];
NSArray *allItems = nil;
NSEnumerator *en = nil;
id item = nil;
_prototypePopUp = [[GormNSPopUpButton alloc] initWithFrame: NSMakeRect(71.0, 157.0, 102.0, 24.0)];
[_prototypePopUp addItemWithTitle: @"Item #0"];
[_prototypePopUp addItemWithTitle: @"Item #1"];
[_prototypePopUp addItemWithTitle: @"Item #2"];
[_prototypePopUp setAutoenablesItems: YES];
allItems = [[_prototypePopUp menu] itemArray];
en = [allItems objectEnumerator];
while ((item = [en nextObject]) != nil)
{
[item setTarget: nil];
[item setAction: NULL]; // @selector(_popUpItemAction:)];
[item setEnabled: YES];
}
[contentView addSubview: _prototypePopUp];
AUTORELEASE(_prototypePopUp);

View file

@ -78,8 +78,13 @@
[object setPullsDown: pullsDown];
while ((o = [en nextObject]) != nil)
{
id<NSMenuItem> mi = nil;
[object addItemWithTitle: [o title]];
}
mi = [object lastItem];
[mi setAction: NULL]; // @selector(_popUpItemAction:)];
[mi setTarget: nil];
}
}
else if (sender == autoenableSwitch)
{

View file

@ -12,7 +12,8 @@
localizeSwitch,
negativeField,
negativeRedSwitch,
positiveField
positiveField,
zeroField
);
Super = IBInspector;
};

View file

@ -31,15 +31,16 @@
@interface GormNumberFormatterAttributesInspector : IBInspector
{
id addThousandSeparatorSwitch;
id commaPointSwitch;
id formatForm;
id formatTable;
id negativeRedSwitch;
id detachButton;
id localizeSwitch;
id positiveField;
id negativeField;
IBOutlet id addThousandSeparatorSwitch;
IBOutlet id commaPointSwitch;
IBOutlet id formatForm;
IBOutlet id formatTable;
IBOutlet id negativeRedSwitch;
IBOutlet id detachButton;
IBOutlet id localizeSwitch;
IBOutlet id positiveField;
IBOutlet id negativeField;
IBOutlet id zeroField;
}
@end

View file

@ -51,8 +51,10 @@ extern NSArray *predefinedNumberFormats;
else
{
NSNumberFormatter *fmtr = [[NSNumberFormatter alloc] init];
[fmtr setFormat: [NSNumberFormatter defaultFormat]];
[fmtr setFormat: [NSNumberFormatter defaultFormat]];
[[positiveField cell] setFormatter: fmtr];
[[zeroField cell] setFormatter: fmtr];
[[negativeField cell] setFormatter: fmtr];
}
}
@ -61,14 +63,17 @@ extern NSArray *predefinedNumberFormats;
- (void) updateAppearanceFieldsWithFormat: (NSString *)format;
{
[[[positiveField cell] formatter] setFormat: format];
[[positiveField cell] setObjectValue:
[NSDecimalNumber decimalNumberWithString: @"123456.789"]];
[NSDecimalNumber decimalNumberWithString: @"123456.789"]];
[[[zeroField cell] formatter] setFormat: format];
[[zeroField cell] setObjectValue:
[NSDecimalNumber decimalNumberWithString: @"0.000"]];
[[[negativeField cell] formatter] setFormat: format];
[[negativeField cell] setObjectValue:
[NSDecimalNumber decimalNumberWithString: @"-123456.789"]];
[NSDecimalNumber decimalNumberWithString: @"-123456.789"]];
}
- (void) ok: (id)sender
@ -104,7 +109,7 @@ extern NSArray *predefinedNumberFormats;
// Update editable format fields
[[formatForm cellAtIndex:0] setStringValue: VSTR(positiveFmt)];
// [[formatForm cellAtIndex:1] setStringValue: VSTR(zeroFmt)];
[[formatForm cellAtIndex:1] setStringValue: VSTR(zeroFmt)];
[[formatForm cellAtIndex:2] setStringValue: VSTR(negativeFmt)];
[fmtr setFormat:fullFmt];
@ -114,11 +119,11 @@ extern NSArray *predefinedNumberFormats;
{
NSUInteger idx;
positiveFmt = [[sender cellAtIndex:0] stringValue];
// zeroFmt = [[sender cellAtIndex:1] stringValue];
negativeFmt = [[sender cellAtIndex:1] stringValue];
minValue = [[sender cellAtIndex:2] stringValue];
maxValue = [[sender cellAtIndex:3] stringValue];
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];
NSDebugLog(@"min,max: %@, %@", minValue, maxValue);
fullFmt = [NSString stringWithFormat:@"%@;%@;%@",
@ -186,10 +191,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:1] setStringValue: [fmtr negativeFormat]];
[[formatForm cellAtIndex:2] setObjectValue: [fmtr minimum]];
[[formatForm cellAtIndex:3] setObjectValue: [fmtr maximum]];
[[formatForm cellAtIndex:1] setStringValue: [fmtr zeroFormat]];
[[formatForm cellAtIndex:2] setStringValue: [fmtr negativeFormat]];
[[formatForm cellAtIndex:3] setObjectValue: [fmtr minimum]];
[[formatForm cellAtIndex:4] setObjectValue: [fmtr maximum]];
// If the string typed is a predefined one then highligh it in
// Number Format table view above