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 - (void) finishInstantiate
{ {
NSView *contentView = [originalWindow contentView]; 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 = [[GormNSPopUpButton alloc] initWithFrame: NSMakeRect(71.0, 157.0, 102.0, 24.0)];
[_prototypePopUp addItemWithTitle: @"Item #0"]; [_prototypePopUp addItemWithTitle: @"Item #0"];
[_prototypePopUp addItemWithTitle: @"Item #1"]; [_prototypePopUp addItemWithTitle: @"Item #1"];
[_prototypePopUp addItemWithTitle: @"Item #2"]; [_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]; [contentView addSubview: _prototypePopUp];
AUTORELEASE(_prototypePopUp); AUTORELEASE(_prototypePopUp);

View file

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

View file

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

View file

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

View file

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