Get the formatter panel working again.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@33840 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2011-09-15 08:59:22 +00:00
parent ae8debf43d
commit 7cf6d8e775
4 changed files with 29 additions and 28 deletions

View file

@ -1,3 +1,12 @@
2011-09-15 Fred Kiefer <FredKiefer@gmx.de>
* GormCore/GormPrivate.h ([NSDateFormatter +initialize],
[NSNumberFormatter +initialize]): Remove these dangerours methods.
* Palettes/4Data/DataPalette.m: Move +initialize method into
DataPalette and retain the static objects.
* Palettes/4Data/GormNumberFormatterAttributesInspector.m: Clean
up compiler warnings.
2011-09-15 Fred Kiefer <FredKiefer@gmx.de>
* Palettes/0Menu/GormMenuEditor.m: Change becomeMainWindow call

View file

@ -97,7 +97,6 @@ extern NSString *GormResizeCellNotification;
@interface NSDateFormatter (GormAdditions)
+ (void) initialize;
+ (int) formatCount;
+ (NSString *) formatAtIndex: (int)index;
+ (int) indexOfFormat: (NSString *) format;
@ -108,7 +107,6 @@ extern NSString *GormResizeCellNotification;
@interface NSNumberFormatter (GormAdditions)
+ (void) initialize;
+ (int) formatCount;
+ (NSString *) formatAtIndex: (int)index;
+ (NSString *) positiveFormatAtIndex: (int)index;

View file

@ -46,20 +46,6 @@ int defaultNumberFormatIndex = 0;
@implementation NSNumberFormatter (GormAdditions)
+ (void) initialize
{
predefinedNumberFormats = [NSArray arrayWithObjects:
[NSArray arrayWithObjects: @"$#,##0.00;0.00;-$#,##0.00",@"9999.99",@"-9999.99",nil],
[NSArray arrayWithObjects: @"$#,##0.00;0.00;[Red]($#,##0.00)",@"9999.99",@"-9999.99",nil],
[NSArray arrayWithObjects: @"0.00;0.00;-0.00",@"9999.99",@"-9999.99",nil],
[NSArray arrayWithObjects: @"0;0;-0",@"100",@"-100",nil],
[NSArray arrayWithObjects: @"00000;00000;-00000",@"100",@"-100",nil],
[NSArray arrayWithObjects: @"0%;0%;-0%",@"100",@"-100",nil],
[NSArray arrayWithObjects: @"0.00%;0.00%;-0.00%",@"99.99",@"-99.99",nil],
nil];
}
+ (int) formatCount
{
return [predefinedNumberFormats count];
@ -152,14 +138,6 @@ int defaultDateFormatIndex = 3;
@implementation NSDateFormatter (GormAdditions)
+ (void) initialize
{
predefinedDateFormats = [NSArray arrayWithObjects: @"%c",@"%A, %B %e, %Y",
@"%B %e, %Y", @"%e %B %Y", @"%m/%d/%y",
@"%b %d, %Y", @"%B %H", @"%d %b %Y",
@"%H:%M:%S", @"%I:%M",nil];
}
+ (int) formatCount
{
return [predefinedDateFormats count];
@ -175,7 +153,6 @@ int defaultDateFormatIndex = 3;
return [predefinedDateFormats indexOfObject: format];
}
+ (NSString *) defaultFormat
{
return [NSDateFormatter formatAtIndex:defaultDateFormatIndex];
@ -197,6 +174,24 @@ int defaultDateFormatIndex = 3;
@implementation DataPalette
+ (void) initialize
{
predefinedNumberFormats = [[NSArray alloc] initWithObjects:
[NSArray arrayWithObjects: @"$#,##0.00;0.00;-$#,##0.00",@"9999.99",@"-9999.99",nil],
[NSArray arrayWithObjects: @"$#,##0.00;0.00;[Red]($#,##0.00)",@"9999.99",@"-9999.99",nil],
[NSArray arrayWithObjects: @"0.00;0.00;-0.00",@"9999.99",@"-9999.99",nil],
[NSArray arrayWithObjects: @"0;0;-0",@"100",@"-100",nil],
[NSArray arrayWithObjects: @"00000;00000;-00000",@"100",@"-100",nil],
[NSArray arrayWithObjects: @"0%;0%;-0%",@"100",@"-100",nil],
[NSArray arrayWithObjects: @"0.00%;0.00%;-0.00%",@"99.99",@"-99.99",nil],
nil];
predefinedDateFormats = [[NSArray alloc] initWithObjects: @"%c",@"%A, %B %e, %Y",
@"%B %e, %Y", @"%e %B %Y", @"%m/%d/%y",
@"%b %d, %Y", @"%B %H", @"%d %b %Y",
@"%H:%M:%S", @"%I:%M",nil];
}
- (id) init
{
if((self = [super init]) != nil)

View file

@ -98,7 +98,6 @@ extern NSArray *predefinedNumberFormats;
zeroFmt = [NSNumberFormatter zeroFormatAtIndex:row];
negativeFmt = [NSNumberFormatter negativeFormatAtIndex:row];
fullFmt = [NSNumberFormatter formatAtIndex:row];
}
// Update Appearance samples
[self updateAppearanceFieldsWithFormat: fullFmt];
@ -109,9 +108,9 @@ extern NSArray *predefinedNumberFormats;
[[formatForm cellAtIndex:2] setStringValue: VSTR(negativeFmt)];
[fmtr setFormat:fullFmt];
}
}
}
else if (sender == formatForm)
{
int idx;