Corrected crash when changing class hierarchy.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@21576 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2005-07-30 19:53:09 +00:00
parent 738aefb672
commit d0ab85ac95
9 changed files with 84 additions and 39 deletions

View file

@ -1,3 +1,14 @@
2005-07-30 15:57 Gregory John Casamento <greg_casamento@yahoo.com>
* English.lproj/GormPreferences.gorm: Changed class hierarchy. Also
added panel outlet.
* GormCore/GormClassInspector.m: -[GormClassInspector _currentClass]
copy the className.
* GormCore/GormPrivate.m: -[GormClassProxy init] copy the className.
* Gorm.m: Changed to initialize preferences panel using init.
* GormPrefs/GormPrefController.[hm]: Added panel method, changed
derivation to a subclass of NSObject, instead of NSWindowController.
2005-07-30 09:30 Gregory John Casamento <greg_casamento@yahoo.com>
* Documentation/Makefile.postamble: Generate documentation from

View file

@ -6,8 +6,9 @@
);
Outlets = (
popup,
prefBox
prefBox,
panel
);
Super = NSWindowController;
Super = NSObject;
};
}

6
Gorm.m
View file

@ -35,7 +35,7 @@
@interface Gorm : NSApplication <IB, Gorm>
{
id infoPanel;
id preferencesController;
GormPrefController *preferencesController;
GormClassManager *classManager;
GormInspectorsManager *inspectorsManager;
GormPalettesManager *palettesManager;
@ -425,10 +425,10 @@
{
if(! preferencesController)
{
preferencesController = [[GormPrefController alloc] initWithWindowNibName:@"GormPreferences"];
preferencesController = [[GormPrefController alloc] init];
}
[[preferencesController window] makeKeyAndOrderFront:nil];
[[preferencesController panel] makeKeyAndOrderFront:nil];
}
/** Document Menu Actions */

View file

@ -657,7 +657,17 @@ objectValueForTableColumn: (NSTableColumn *)tc
- (NSString *) _currentClass
{
return [object className];
if(object == nil)
{
return nil;
}
if([object className] == nil)
{
return nil;
}
return [NSString stringWithString: [object className]];
}
- (void) handleNotification: (NSNotification *)notification

View file

@ -186,7 +186,8 @@ static BOOL _isInInterfaceBuilder = NO;
{
if([n isKindOfClass: [NSString class]])
{
ASSIGN(name, n);
// create a copy.
name = [[NSString alloc] initWithString: n];
}
else
{

View file

@ -29,9 +29,9 @@
#include <Foundation/NSObject.h>
#include <AppKit/NSWindowController.h>
@interface GormPrefController : NSWindowController
@interface GormPrefController : NSObject
{
id window;
id panel;
id popup;
id prefBox;
@ -48,6 +48,10 @@
*/
- (void) popupAction: (id)sender;
/**
* Return the preferences panel.
*/
- (id) panel;
@end
#endif

View file

@ -13,6 +13,18 @@
@implementation GormPrefController
- (id) init
{
if(self = [super init])
{
if(![NSBundle loadNibNamed: @"GormPreferences" owner: self])
{
return nil;
}
}
return self;
}
- (void) awakeFromNib
{
_generalView = [[GormGeneralPref alloc] init];
@ -24,43 +36,43 @@
[prefBox setContentView:[_generalView view]];
[[self window] setFrameUsingName: @"Preferences"];
[[self window] setFrameAutosaveName: @"Preferences"];
[[self window] center];
[[self panel] setFrameUsingName: @"Preferences"];
[[self panel] setFrameAutosaveName: @"Preferences"];
[[self panel] center];
}
- (void) popupAction: (id)sender
{
int tag = -1;
if ( sender != popup )
return;
{
int tag = [[sender selectedItem] tag];
switch(tag)
{
case 0:
[prefBox setContentView: [_generalView view]];
break;
case 1:
[prefBox setContentView: [_headersView view]];
break;
case 2:
[prefBox setContentView: [_shelfView view]];
break;
case 3:
[prefBox setContentView: [_colorsView view]];
break;
case 4:
[prefBox setContentView: [_palettesView view]];
break;
case 5:
[prefBox setContentView: [_guidelineView view]];
break;
default:
NSLog(@"Error Default (GormPrefController.m) : - (void) popupAction: (id)sender, no match for tag %d",tag);
break;
}
}
tag = [[sender selectedItem] tag];
switch(tag)
{
case 0:
[prefBox setContentView: [_generalView view]];
break;
case 1:
[prefBox setContentView: [_headersView view]];
break;
case 2:
[prefBox setContentView: [_shelfView view]];
break;
case 3:
[prefBox setContentView: [_colorsView view]];
break;
case 4:
[prefBox setContentView: [_palettesView view]];
break;
case 5:
[prefBox setContentView: [_guidelineView view]];
break;
default:
NSLog(@"Error Default (GormPrefController.m) : - (void) popupAction: (id)sender, no match for tag %d",tag);
break;
}
}
- (void) dealloc
@ -70,6 +82,12 @@
RELEASE(_shelfView);
RELEASE(_colorsView);
RELEASE(_palettesView);
RELEASE(panel);
[super dealloc];
}
- (id) panel
{
return panel;
}
@end