mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-04-22 22:20:44 +00:00
Corrected a crash.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@21541 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
f7c68eb629
commit
428716326e
3 changed files with 90 additions and 71 deletions
|
@ -1,3 +1,10 @@
|
|||
2005-07-25 23:26 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* GormCore/GormClassEditor.m: [GormClassEditor selectClass:editClass:]
|
||||
add exception handling.
|
||||
* GormCore/GormDocument.m: [GormDocument pasteObjects:type
|
||||
fromPasteboard:] added check for specific pb types.
|
||||
|
||||
2005-07-24 16:43 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* GormCore/GormPrivate.h: Removed GormOutlineView.h from the
|
||||
|
|
|
@ -266,78 +266,87 @@ NSString *GormSwitchViewPreferencesNotification = @"GormSwitchViewPreferencesNot
|
|||
// class selection...
|
||||
- (void) selectClass: (NSString *)className editClass: (BOOL)flag
|
||||
{
|
||||
NSString *currentClass = nil;
|
||||
NSArray *classes, *subclasses;
|
||||
NSMutableArray *subClassesArray = [NSMutableArray array];
|
||||
NSEnumerator *en;
|
||||
int row = 0;
|
||||
int col = 0;
|
||||
|
||||
if ( ( className == nil )
|
||||
|| ( [className isEqual: @"CustomView"] )
|
||||
|| ( [className isEqual: @"GormSound"] )
|
||||
|| ( [className isEqual: @"GormImage"] )
|
||||
|| ( [outlineView isEditing] ) )
|
||||
NS_DURING
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
classes = [classManager allSuperClassesOf: className];
|
||||
en = [classes objectEnumerator];
|
||||
// open the items...
|
||||
while ((currentClass = [en nextObject]) != nil)
|
||||
{
|
||||
[outlineView expandItem: currentClass];
|
||||
}
|
||||
|
||||
// select the item in the outline view...
|
||||
row = [outlineView rowForItem: className];
|
||||
if (row != -1)
|
||||
{
|
||||
[outlineView selectRow: row byExtendingSelection: NO];
|
||||
[outlineView scrollRowToVisible: row];
|
||||
}
|
||||
|
||||
// select class in browser...
|
||||
subClassesArray = [NSMutableArray arrayWithArray: [classManager allSuperClassesOf: className]];
|
||||
if ((subClassesArray == nil || [subClassesArray count] == 0) &&
|
||||
[classManager isRootClass: className] == NO)
|
||||
{
|
||||
return;
|
||||
}
|
||||
[subClassesArray addObject: className]; // include in the list.
|
||||
|
||||
// Get the super class position in the browser. Passing "nil" to subClassesOf causes it
|
||||
// to get all of the root classes.
|
||||
col = 0;
|
||||
row = [[classManager subClassesOf: nil] indexOfObject: [subClassesArray objectAtIndex: 0]];
|
||||
|
||||
// reset the enumerator...
|
||||
currentClass = nil;
|
||||
[browserView reloadColumn:col];
|
||||
|
||||
// if row is not NSNotFound, then we found something.
|
||||
if(row != NSNotFound)
|
||||
{
|
||||
[browserView selectRow: row inColumn: col];
|
||||
en = [subClassesArray objectEnumerator];
|
||||
[en nextObject]; // skip the first one.
|
||||
while((currentClass = [en nextObject]) != nil)
|
||||
NSString *currentClass = nil;
|
||||
NSArray *classes, *subclasses;
|
||||
NSMutableArray *subClassesArray = [NSMutableArray array];
|
||||
NSEnumerator *en;
|
||||
int row = 0;
|
||||
int col = 0;
|
||||
|
||||
if ( ( className == nil )
|
||||
|| ( [className isEqual: @"CustomView"] )
|
||||
|| ( [className isEqual: @"GormSound"] )
|
||||
|| ( [className isEqual: @"GormImage"] )
|
||||
|| ( [outlineView isEditing] ) )
|
||||
{
|
||||
NSString *prevClass = [[browserView selectedCellInColumn: col] stringValue];
|
||||
subclasses = [classManager subClassesOf: prevClass];
|
||||
row = [subclasses indexOfObject: currentClass];
|
||||
col++;
|
||||
[browserView selectRow:row inColumn:col];
|
||||
return;
|
||||
}
|
||||
|
||||
classes = [classManager allSuperClassesOf: className];
|
||||
en = [classes objectEnumerator];
|
||||
// open the items...
|
||||
while ((currentClass = [en nextObject]) != nil)
|
||||
{
|
||||
[outlineView expandItem: currentClass];
|
||||
}
|
||||
|
||||
// select the item in the outline view...
|
||||
row = [outlineView rowForItem: className];
|
||||
if (row != -1)
|
||||
{
|
||||
[outlineView selectRow: row byExtendingSelection: NO];
|
||||
[outlineView scrollRowToVisible: row];
|
||||
}
|
||||
|
||||
// select class in browser...
|
||||
subClassesArray = [NSMutableArray arrayWithArray: [classManager allSuperClassesOf: className]];
|
||||
if ((subClassesArray == nil || [subClassesArray count] == 0) &&
|
||||
[classManager isRootClass: className] == NO)
|
||||
{
|
||||
return;
|
||||
}
|
||||
[subClassesArray addObject: className]; // include in the list.
|
||||
|
||||
// Get the super class position in the browser. Passing "nil" to subClassesOf causes it
|
||||
// to get all of the root classes.
|
||||
col = 0;
|
||||
row = [[classManager subClassesOf: nil] indexOfObject: [subClassesArray objectAtIndex: 0]];
|
||||
|
||||
// reset the enumerator...
|
||||
currentClass = nil;
|
||||
[browserView reloadColumn:col];
|
||||
|
||||
// if row is not NSNotFound, then we found something.
|
||||
if(row != -1)
|
||||
{
|
||||
[browserView selectRow: row inColumn: col];
|
||||
en = [subClassesArray objectEnumerator];
|
||||
[en nextObject]; // skip the first one.
|
||||
while((currentClass = [en nextObject]) != nil)
|
||||
{
|
||||
NSString *prevClass = [[browserView selectedCellInColumn: col] stringValue];
|
||||
subclasses = [classManager subClassesOf: prevClass];
|
||||
row = [subclasses indexOfObject: currentClass];
|
||||
col++;
|
||||
[browserView selectRow:row inColumn:col];
|
||||
}
|
||||
}
|
||||
|
||||
ASSIGN(selectedClass, className);
|
||||
|
||||
if(flag)
|
||||
{
|
||||
// set the editor...
|
||||
[document setSelectionFromEditor: (id)self];
|
||||
}
|
||||
}
|
||||
|
||||
if(flag)
|
||||
NS_HANDLER
|
||||
{
|
||||
// set the editor...
|
||||
ASSIGN(selectedClass, className);
|
||||
[document setSelectionFromEditor: (id)self];
|
||||
NSDebugLog(@"%@",[localException reason]);
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
}
|
||||
|
||||
- (void) selectClassWithObject: (id)obj
|
||||
|
@ -469,9 +478,9 @@ NSString *GormSwitchViewPreferencesNotification = @"GormSwitchViewPreferencesNot
|
|||
{
|
||||
NSArray *array;
|
||||
GormClassProxy *classProxy;
|
||||
NSString *sc = [NSString stringWithString: selectedClass];
|
||||
|
||||
classProxy = [[GormClassProxy alloc] initWithClassName:
|
||||
selectedClass];
|
||||
classProxy = [[GormClassProxy alloc] initWithClassName: sc];
|
||||
array = [NSArray arrayWithObject: classProxy];
|
||||
RELEASE(classProxy);
|
||||
return array;
|
||||
|
|
|
@ -2475,7 +2475,7 @@ static NSImage *fileImage = nil;
|
|||
* Windows and panels are a special case - for a multiple window paste,
|
||||
* the windows need to be positioned so they are not on top of each other.
|
||||
*/
|
||||
if ([aType isEqualToString: IBWindowPboardType] == YES)
|
||||
if ([aType isEqualToString: IBWindowPboardType])
|
||||
{
|
||||
NSWindow *win;
|
||||
|
||||
|
@ -2486,7 +2486,7 @@ static NSImage *fileImage = nil;
|
|||
screenPoint.y -= 10;
|
||||
}
|
||||
}
|
||||
else
|
||||
else if([aType isEqualToString: IBViewPboardType])
|
||||
{
|
||||
NSEnumerator *enumerator = [objects objectEnumerator];
|
||||
NSRect frame;
|
||||
|
@ -2496,7 +2496,8 @@ static NSImage *fileImage = nil;
|
|||
{
|
||||
// check to see if the object has a frame. If so, then
|
||||
// modify it. If not, simply iterate to the next object
|
||||
if([obj respondsToSelector: @selector(frame)])
|
||||
if([obj respondsToSelector: @selector(frame)]
|
||||
&& [obj respondsToSelector: @selector(setFrame:)])
|
||||
{
|
||||
frame = [obj frame];
|
||||
frame.origin.x -= 6;
|
||||
|
@ -2507,8 +2508,10 @@ static NSImage *fileImage = nil;
|
|||
}
|
||||
}
|
||||
|
||||
// attach the objects to the parent and touch the document.
|
||||
[self attachObjects: objects toParent: parent];
|
||||
[self touch];
|
||||
|
||||
return objects;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue