Better tracking of drag events

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@5608 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 1999-12-22 10:13:18 +00:00
parent 52c914c2c5
commit d9f6720bbf
3 changed files with 30 additions and 17 deletions

39
Gorm.m
View file

@ -469,21 +469,10 @@ NSString *GormLinkPboardType = @"GormLinkPboardType";
NSPanel *p;
int r;
NSTextField *t;
NSString *n;
NSArray *s = [selectionOwner selection];
id o = [s objectAtIndex: 0];
NSString *n;
if ([s count] == 0)
{
NSRunAlertPanel (@"Set Name", @"Nothing currently selected",
@"OK", NULL, NULL);
return nil;
}
if ([s count] > 1)
{
NSRunAlertPanel (@"Set Name", @"Multiple objects selected",
@"OK", NULL, NULL);
return nil;
}
p = NSGetAlertPanel(@"Set Name", @"Name: ", @"OK", @"Cancel", nil);
t = [[NSTextField alloc] initWithFrame: NSMakeRect(60,46,240,20)];
[[p contentView] addSubview: t];
@ -496,7 +485,7 @@ NSString *GormLinkPboardType = @"GormLinkPboardType";
n = [[t stringValue] stringByTrimmingSpaces];
if (n != nil && [n isEqual: @""] == NO)
{
[activeDocument setName: n forObject: [s lastObject]];
[activeDocument setName: n forObject: o];
}
}
[t removeFromSuperview];
@ -611,8 +600,26 @@ NSString *GormLinkPboardType = @"GormLinkPboardType";
if (sel_eq(action, @selector(setName:)))
{
if ([[selectionOwner selection] count] != 1)
return NO;
NSArray *s = [selectionOwner selection];
NSString *n;
id o;
if ([s count] == 0)
{
return NO;
}
if ([s count] > 1)
{
return NO;
}
o = [s objectAtIndex: 0];
n = [activeDocument nameForObject: o];
if ([n isEqual: @"NSOwner"] || [n isEqual: @"NSFirst"]
|| [n isEqual: @"NSFont"])
{
return NO;
}
}
return YES;

View file

@ -973,6 +973,10 @@ static NSImage *classesImage = nil;
{
[nameTable removeObjectForKey: oldName];
}
if ([objectsView containsObject: object] == YES)
{
[objectsView refreshCells];
}
}
- (id) saveAsDocument: (id)sender

View file

@ -1106,9 +1106,11 @@ NSRectFromPoints(NSPoint p0, NSPoint p1)
}
else
{
NSLog(@"Drop with unrecognized type!");
NSLog(@"Drop with unrecognized type (%@)!", dragType);
dragType = nil;
return NO;
}
dragType = nil;
return YES;
}