mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-02-24 03:51:22 +00:00
Connection support changes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@5560 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
c01d75390e
commit
93eb2e3e9b
2 changed files with 86 additions and 16 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Fri Dec 17 18:44:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||||
|
|
||||||
|
Add some support for connections - handle link dragging within window
|
||||||
|
editor - raise connection inspector on completion.
|
||||||
|
|
||||||
Thu Dec 16 21:35:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
Thu Dec 16 21:35:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||||
|
|
||||||
Change directory structure - add palettes directory, move palettes
|
Change directory structure - add palettes directory, move palettes
|
||||||
|
|
|
@ -145,6 +145,8 @@ NSRectFromPoints(NSPoint p0, NSPoint p1)
|
||||||
BOOL shouldBeginDrag;
|
BOOL shouldBeginDrag;
|
||||||
BOOL isClosed;
|
BOOL isClosed;
|
||||||
NSPasteboard *dragPb;
|
NSPasteboard *dragPb;
|
||||||
|
NSString *dragType;
|
||||||
|
NSView *lastLinkView;
|
||||||
}
|
}
|
||||||
- (BOOL) acceptsTypeFromArray: (NSArray*)types;
|
- (BOOL) acceptsTypeFromArray: (NSArray*)types;
|
||||||
- (BOOL) activate;
|
- (BOOL) activate;
|
||||||
|
@ -831,10 +833,79 @@ NSRectFromPoints(NSPoint p0, NSPoint p1)
|
||||||
|
|
||||||
- (unsigned) draggingEntered: (id<NSDraggingInfo>)sender
|
- (unsigned) draggingEntered: (id<NSDraggingInfo>)sender
|
||||||
{
|
{
|
||||||
|
NSArray *types;
|
||||||
|
|
||||||
|
dragPb = [sender draggingPasteboard];
|
||||||
|
types = [dragPb types];
|
||||||
|
if ([types containsObject: IBViewPboardType] == YES)
|
||||||
|
{
|
||||||
|
dragType = IBViewPboardType;
|
||||||
|
}
|
||||||
|
else if ([types containsObject: GormLinkPboardType] == YES)
|
||||||
|
{
|
||||||
|
dragType = GormLinkPboardType;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dragType = nil;
|
||||||
|
}
|
||||||
|
return [self draggingUpdated: sender];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (unsigned) draggingUpdated: (id<NSDraggingInfo>)sender
|
||||||
|
{
|
||||||
|
if (dragType == IBViewPboardType)
|
||||||
|
{
|
||||||
|
return NSDragOperationCopy;
|
||||||
|
}
|
||||||
|
else if (dragType == GormLinkPboardType)
|
||||||
|
{
|
||||||
|
NSPoint loc = [sender draggingLocation];
|
||||||
|
NSView *sub = [super hitTest: loc];
|
||||||
|
|
||||||
|
if (sub == self)
|
||||||
|
{
|
||||||
|
sub = nil;
|
||||||
|
}
|
||||||
|
else if (sub == [NSApp connectSource])
|
||||||
|
{
|
||||||
|
sub = nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sub != lastLinkView)
|
||||||
|
{
|
||||||
|
NSImage *image = [(Gorm*)NSApp targetImage];
|
||||||
|
|
||||||
|
[self lockFocus];
|
||||||
|
if (lastLinkView != nil)
|
||||||
|
{
|
||||||
|
NSRect rect = [lastLinkView frame];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Let the dragging source know we will copy the dragged object.
|
* Erase image from old location.
|
||||||
*/
|
*/
|
||||||
return NSDragOperationCopy;;
|
rect.origin.x -= 1.0;
|
||||||
|
rect.origin.y += 1.0;
|
||||||
|
rect.size = [image size];
|
||||||
|
rect.size.width += 2.0;
|
||||||
|
rect.size.height += 2.0;
|
||||||
|
[self displayRect: rect];
|
||||||
|
}
|
||||||
|
if (sub != nil)
|
||||||
|
{
|
||||||
|
[image compositeToPoint: [sub frame].origin
|
||||||
|
operation: NSCompositeCopy];
|
||||||
|
}
|
||||||
|
lastLinkView = sub;
|
||||||
|
[self unlockFocus];
|
||||||
|
[[self window] flushWindow];
|
||||||
|
}
|
||||||
|
return NSDragOperationLink;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) drawSelection
|
- (void) drawSelection
|
||||||
|
@ -981,10 +1052,7 @@ NSRectFromPoints(NSPoint p0, NSPoint p1)
|
||||||
|
|
||||||
- (BOOL) performDragOperation: (id<NSDraggingInfo>)sender
|
- (BOOL) performDragOperation: (id<NSDraggingInfo>)sender
|
||||||
{
|
{
|
||||||
NSPasteboard *pb = [sender draggingPasteboard];
|
if (dragType == IBViewPboardType)
|
||||||
NSArray *types = [pb types];
|
|
||||||
|
|
||||||
if ([types containsObject: IBViewPboardType] == YES)
|
|
||||||
{
|
{
|
||||||
NSPoint loc = [sender draggedImageLocation];
|
NSPoint loc = [sender draggedImageLocation];
|
||||||
NSArray *views;
|
NSArray *views;
|
||||||
|
@ -996,7 +1064,7 @@ NSRectFromPoints(NSPoint p0, NSPoint p1)
|
||||||
* them to it's collection of known objects.
|
* them to it's collection of known objects.
|
||||||
*/
|
*/
|
||||||
views = [document pasteType: IBViewPboardType
|
views = [document pasteType: IBViewPboardType
|
||||||
fromPasteboard: pb
|
fromPasteboard: dragPb
|
||||||
parent: edited];
|
parent: edited];
|
||||||
/*
|
/*
|
||||||
* Now make all the views subviews of ourself, setting their origin to
|
* Now make all the views subviews of ourself, setting their origin to
|
||||||
|
@ -1014,10 +1082,10 @@ NSRectFromPoints(NSPoint p0, NSPoint p1)
|
||||||
[self addSubview: sub];
|
[self addSubview: sub];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ([types containsObject: GormLinkPboardType] == YES)
|
else if (dragType == GormLinkPboardType)
|
||||||
{
|
{
|
||||||
NSPoint loc = [sender draggingLocation];
|
NSPoint loc = [sender draggingLocation];
|
||||||
NSString *name = [pb stringForType: GormLinkPboardType];
|
NSString *name = [dragPb stringForType: GormLinkPboardType];
|
||||||
NSView *sub = [super hitTest: loc];
|
NSView *sub = [super hitTest: loc];
|
||||||
|
|
||||||
NSLog(@"Got link from %@", name);
|
NSLog(@"Got link from %@", name);
|
||||||
|
@ -1038,20 +1106,17 @@ NSLog(@"Got link from %@", name);
|
||||||
|
|
||||||
- (BOOL) prepareForDragOperation: (id<NSDraggingInfo>)sender
|
- (BOOL) prepareForDragOperation: (id<NSDraggingInfo>)sender
|
||||||
{
|
{
|
||||||
NSPasteboard *pb = [sender draggingPasteboard];
|
|
||||||
NSArray *types = [pb types];
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Tell the source that we will accept the drop if we can.
|
* Tell the source that we will accept the drop if we can.
|
||||||
*/
|
*/
|
||||||
if ([types containsObject: IBViewPboardType] == YES)
|
if (dragType == IBViewPboardType)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* We can accept views dropped anywhere.
|
* We can accept views dropped anywhere.
|
||||||
*/
|
*/
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
else if ([types containsObject: GormLinkPboardType] == YES)
|
else if (dragType == GormLinkPboardType)
|
||||||
{
|
{
|
||||||
NSPoint loc = [sender draggingLocation];
|
NSPoint loc = [sender draggingLocation];
|
||||||
NSView *sub = [super hitTest: loc];
|
NSView *sub = [super hitTest: loc];
|
||||||
|
|
Loading…
Reference in a new issue