mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-04-22 22:20:44 +00:00
Correction for crash when document is minimized.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@20632 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
dfc97a2944
commit
5c8d967dff
3 changed files with 177 additions and 111 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2005-01-29 18:55 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* GormClassInspector.m: In -addAction:, -addOutlet:, -removeAction:,
|
||||
-removeOutlet:, -selectClass: made changes to make sure that if
|
||||
the document is not active, that the method will fall through. This
|
||||
prevents a crash when user presses buttons on the class inspector
|
||||
window when the document is miniaturized.
|
||||
* Palettes/2Controls/inspectors.m: Improved error when the
|
||||
.gorm file can't be loaded for GormBoxInspector.
|
||||
|
||||
2005-01-28 21:50 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Palettes/2Controls/GormNSStepperInspector.gorm: Corrected problem
|
||||
|
|
|
@ -344,113 +344,157 @@ objectValueForTableColumn: (NSTableColumn *)tc
|
|||
|
||||
- (void) addAction: (id)sender
|
||||
{
|
||||
GormDocument *document = (GormDocument *)[(id <IB>)NSApp activeDocument];
|
||||
NSString *className = [self _currentClass];
|
||||
NSString *newAction = [classManager addNewActionToClassNamed: className];
|
||||
NSArray *list = [classManager allActionsForClassNamed: className];
|
||||
int row = [list indexOfObject: newAction];
|
||||
|
||||
[document collapseClass: className];
|
||||
[document reloadClasses];
|
||||
[nc postNotificationName: IBInspectorDidModifyObjectNotification
|
||||
object: classManager];
|
||||
[actionTable reloadData];
|
||||
[actionTable scrollRowToVisible: row];
|
||||
[actionTable selectRow: row byExtendingSelection: NO];
|
||||
[document selectClass: className];
|
||||
[super ok: sender];
|
||||
NS_DURING
|
||||
{
|
||||
GormDocument *document = (GormDocument *)[(id <IB>)NSApp activeDocument];
|
||||
if(document != nil)
|
||||
{
|
||||
NSString *className = [self _currentClass];
|
||||
NSString *newAction = [classManager addNewActionToClassNamed: className];
|
||||
NSArray *list = [classManager allActionsForClassNamed: className];
|
||||
int row = [list indexOfObject: newAction];
|
||||
|
||||
[document collapseClass: className];
|
||||
[document reloadClasses];
|
||||
[nc postNotificationName: IBInspectorDidModifyObjectNotification
|
||||
object: classManager];
|
||||
[actionTable reloadData];
|
||||
[actionTable scrollRowToVisible: row];
|
||||
[actionTable selectRow: row byExtendingSelection: NO];
|
||||
[document selectClass: className];
|
||||
[super ok: sender];
|
||||
}
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
NSLog(@"%@",[localException reason]);
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
}
|
||||
|
||||
- (void) addOutlet: (id)sender
|
||||
{
|
||||
GormDocument *document = (GormDocument *)[(id <IB>)NSApp activeDocument];
|
||||
NSString *className = [self _currentClass];
|
||||
NSString *newOutlet = [classManager addNewOutletToClassNamed: className];
|
||||
NSArray *list = [classManager allOutletsForClassNamed: className];
|
||||
int row = [list indexOfObject: newOutlet];
|
||||
|
||||
[document collapseClass: className];
|
||||
[document reloadClasses];
|
||||
[nc postNotificationName: IBInspectorDidModifyObjectNotification
|
||||
object: classManager];
|
||||
[outletTable reloadData];
|
||||
[outletTable scrollRowToVisible: row];
|
||||
[outletTable selectRow: row byExtendingSelection: NO];
|
||||
[document selectClass: className];
|
||||
[super ok: sender];
|
||||
NS_DURING
|
||||
{
|
||||
GormDocument *document = (GormDocument *)[(id <IB>)NSApp activeDocument];
|
||||
if(document != nil)
|
||||
{
|
||||
NSString *className = [self _currentClass];
|
||||
NSString *newOutlet = [classManager addNewOutletToClassNamed: className];
|
||||
NSArray *list = [classManager allOutletsForClassNamed: className];
|
||||
int row = [list indexOfObject: newOutlet];
|
||||
|
||||
[document collapseClass: className];
|
||||
[document reloadClasses];
|
||||
[nc postNotificationName: IBInspectorDidModifyObjectNotification
|
||||
object: classManager];
|
||||
[outletTable reloadData];
|
||||
[outletTable scrollRowToVisible: row];
|
||||
[outletTable selectRow: row byExtendingSelection: NO];
|
||||
[document selectClass: className];
|
||||
[super ok: sender];
|
||||
}
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
NSLog(@"%@",[localException reason]);
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
}
|
||||
|
||||
- (void) removeAction: (id)sender
|
||||
{
|
||||
int i = [actionTable selectedRow];
|
||||
NSString *className = [self _currentClass];
|
||||
NSArray *list = [classManager allActionsForClassNamed: className];
|
||||
BOOL removed = NO;
|
||||
BOOL isCustom = [classManager isCustomClass: className];
|
||||
NSString *name = nil;
|
||||
GormDocument *document = (GormDocument *)[(id <IB>)NSApp activeDocument];
|
||||
|
||||
// check the count...
|
||||
if(isCustom || [classManager isCategoryForClass: className])
|
||||
NS_DURING
|
||||
{
|
||||
if([list count] > 0 && i >= 0 && i < [list count])
|
||||
int i = [actionTable selectedRow];
|
||||
NSString *className = [self _currentClass];
|
||||
NSArray *list = [classManager allActionsForClassNamed: className];
|
||||
BOOL removed = NO;
|
||||
BOOL isCustom = [classManager isCustomClass: className];
|
||||
NSString *name = nil;
|
||||
GormDocument *document = (GormDocument *)[(id <IB>)NSApp activeDocument];
|
||||
|
||||
if(document != nil)
|
||||
{
|
||||
[actionTable deselectAll: self];
|
||||
name = [list objectAtIndex: i];
|
||||
if(isCustom || [classManager isAction: name onCategoryForClassNamed: className])
|
||||
// check the count...
|
||||
if(isCustom || [classManager isCategoryForClass: className])
|
||||
{
|
||||
removed = [document
|
||||
removeConnectionsWithLabel: name
|
||||
forClassNamed: currentClass
|
||||
isAction: YES];
|
||||
if([list count] > 0 && i >= 0 && i < [list count])
|
||||
{
|
||||
[actionTable deselectAll: self];
|
||||
name = [list objectAtIndex: i];
|
||||
if(isCustom || [classManager isAction: name onCategoryForClassNamed: className])
|
||||
{
|
||||
removed = [document
|
||||
removeConnectionsWithLabel: name
|
||||
forClassNamed: currentClass
|
||||
isAction: YES];
|
||||
}
|
||||
}
|
||||
|
||||
if(removed)
|
||||
{
|
||||
[super ok: sender];
|
||||
[document collapseClass: className];
|
||||
[document reloadClasses];
|
||||
[classManager removeAction: name fromClassNamed: className];
|
||||
[nc postNotificationName: IBInspectorDidModifyObjectNotification
|
||||
object: classManager];
|
||||
[actionTable reloadData];
|
||||
[document selectClass: className];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(removed)
|
||||
{
|
||||
[super ok: sender];
|
||||
[document collapseClass: className];
|
||||
[document reloadClasses];
|
||||
[classManager removeAction: name fromClassNamed: className];
|
||||
[nc postNotificationName: IBInspectorDidModifyObjectNotification
|
||||
object: classManager];
|
||||
[actionTable reloadData];
|
||||
[document selectClass: className];
|
||||
}
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
NSLog(@"%@",[localException reason]);
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
}
|
||||
|
||||
- (void) removeOutlet: (id)sender
|
||||
{
|
||||
int i = [outletTable selectedRow];
|
||||
NSString *className = [self _currentClass];
|
||||
NSArray *list = [classManager allOutletsForClassNamed: className];
|
||||
BOOL removed = NO;
|
||||
NSString *name = nil;
|
||||
GormDocument *document = (GormDocument *)[(id <IB>)NSApp activeDocument];
|
||||
|
||||
// check the count...
|
||||
if([list count] > 0 && i >= 0 && i < [list count])
|
||||
NS_DURING
|
||||
{
|
||||
[outletTable deselectAll: self];
|
||||
name = [list objectAtIndex: i];
|
||||
removed = [document
|
||||
removeConnectionsWithLabel: name
|
||||
forClassNamed: currentClass
|
||||
isAction: NO];
|
||||
int i = [outletTable selectedRow];
|
||||
NSString *className = [self _currentClass];
|
||||
NSArray *list = [classManager allOutletsForClassNamed: className];
|
||||
BOOL removed = NO;
|
||||
NSString *name = nil;
|
||||
GormDocument *document = (GormDocument *)[(id <IB>)NSApp activeDocument];
|
||||
|
||||
if(document != nil)
|
||||
{
|
||||
// check the count...
|
||||
if([list count] > 0 && i >= 0 && i < [list count])
|
||||
{
|
||||
[outletTable deselectAll: self];
|
||||
name = [list objectAtIndex: i];
|
||||
removed = [document
|
||||
removeConnectionsWithLabel: name
|
||||
forClassNamed: currentClass
|
||||
isAction: NO];
|
||||
}
|
||||
|
||||
if(removed)
|
||||
{
|
||||
[super ok: sender];
|
||||
[document collapseClass: className];
|
||||
[document reloadClasses];
|
||||
[classManager removeOutlet: name fromClassNamed: className];
|
||||
[nc postNotificationName: IBInspectorDidModifyObjectNotification
|
||||
object: classManager];
|
||||
[outletTable reloadData];
|
||||
[document selectClass: className];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(removed)
|
||||
NS_HANDLER
|
||||
{
|
||||
[super ok: sender];
|
||||
[document collapseClass: className];
|
||||
[document reloadClasses];
|
||||
[classManager removeOutlet: name fromClassNamed: className];
|
||||
[nc postNotificationName: IBInspectorDidModifyObjectNotification
|
||||
object: classManager];
|
||||
[outletTable reloadData];
|
||||
[document selectClass: className];
|
||||
NSLog(@"%@",[localException reason]);
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
}
|
||||
|
||||
- (void) select: (id)sender
|
||||
|
@ -479,36 +523,47 @@ objectValueForTableColumn: (NSTableColumn *)tc
|
|||
NSArray *list = [classManager allClassNames];
|
||||
int row = [parentClass selectedRow];
|
||||
|
||||
if(row >= 0)
|
||||
NS_DURING
|
||||
{
|
||||
NSString *newParent = [list objectAtIndex: row];
|
||||
NSString *name = [self _currentClass];
|
||||
BOOL removed = NO;
|
||||
GormDocument *document = (GormDocument *)[(id <IB>)NSApp activeDocument];
|
||||
|
||||
// if it's a custom class, let it go, if not do nothing.
|
||||
if([classManager isCustomClass: name])
|
||||
{
|
||||
[super ok: sender];
|
||||
|
||||
// check to see if the user wants to do this and remove the connections.
|
||||
removed = [document removeConnectionsForClassNamed: name];
|
||||
if(row >= 0)
|
||||
{
|
||||
NSString *newParent = [list objectAtIndex: row];
|
||||
NSString *name = [self _currentClass];
|
||||
BOOL removed = NO;
|
||||
GormDocument *document = (GormDocument *)[(id <IB>)NSApp activeDocument];
|
||||
|
||||
// if removed, move the class and notify...
|
||||
if(removed)
|
||||
// if it's a custom class, let it go, if not do nothing.
|
||||
if(document != nil)
|
||||
{
|
||||
NSString *oldSuper = [classManager superClassNameForClassNamed: name];
|
||||
|
||||
[classManager setSuperClassNamed: newParent forClassNamed: name];
|
||||
[nc postNotificationName: IBInspectorDidModifyObjectNotification
|
||||
object: classManager];
|
||||
[document collapseClass: oldSuper];
|
||||
[document collapseClass: name];
|
||||
[document reloadClasses];
|
||||
[document selectClass: name];
|
||||
if([classManager isCustomClass: name])
|
||||
{
|
||||
[super ok: sender];
|
||||
|
||||
// check to see if the user wants to do this and remove the connections.
|
||||
removed = [document removeConnectionsForClassNamed: name];
|
||||
|
||||
// if removed, move the class and notify...
|
||||
if(removed)
|
||||
{
|
||||
NSString *oldSuper = [classManager superClassNameForClassNamed: name];
|
||||
|
||||
[classManager setSuperClassNamed: newParent forClassNamed: name];
|
||||
[nc postNotificationName: IBInspectorDidModifyObjectNotification
|
||||
object: classManager];
|
||||
[document collapseClass: oldSuper];
|
||||
[document collapseClass: name];
|
||||
[document reloadClasses];
|
||||
[document selectClass: name];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
NSLog(@"%@",[localException reason]);
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
}
|
||||
|
||||
- (void) changeClassName: (id)sender
|
||||
|
@ -568,7 +623,8 @@ objectValueForTableColumn: (NSTableColumn *)tc
|
|||
|
||||
- (void) handleNotification: (NSNotification *)notification
|
||||
{
|
||||
if([notification object] == classManager)
|
||||
if([notification object] == classManager &&
|
||||
[(id<IB>)NSApp activeDocument] != nil)
|
||||
{
|
||||
[self _refreshView];
|
||||
}
|
||||
|
|
|
@ -128,7 +128,7 @@
|
|||
}
|
||||
if ([NSBundle loadNibNamed: @"GormNSBoxInspector" owner: self] == NO)
|
||||
{
|
||||
NSLog(@"Could not gorm GormBoxInspector");
|
||||
NSLog(@"Could not load GormBoxInspector");
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue