Some dnd fixes.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@8830 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2001-01-27 06:18:17 +00:00
parent 21f4065d20
commit b5da9fa44b
2 changed files with 27 additions and 4 deletions

View file

@ -1,3 +1,8 @@
2001-01-27 Richard Frith-Macdonald <rfm@gnu.org>
* GormPalettesManager.m: Ensure that palette manager window can never
become key or main. Accept first mouse events so drag start works.
2000-11-06 Adam Fedor <fedor@gnu.org>
* Documenation: Remove use of tmpl texi files

View file

@ -28,7 +28,11 @@
@end
@implementation GormPalettePanel
- (BOOL) canBecomeKey
- (BOOL) canBecomeKeyWindow
{
return NO;
}
- (BOOL) canBecomeMainWindow
{
return NO;
}
@ -55,6 +59,11 @@ static NSImage *dragImage = nil;
}
}
- (BOOL) acceptsFirstMouse: (NSEvent*)theEvent
{
return YES; /* Ensure we get initial mouse down event. */
}
/*
* Initialisation - register to receive DnD with our own types.
*/
@ -173,15 +182,24 @@ static NSImage *dragImage = nil;
NSImageRep *rep;
NSSize offset;
offset.width = rect.origin.x - dragPoint.x;
offset.height = rect.origin.y - dragPoint.y;
if (active == nil)
{
NSRunAlertPanel (NULL, @"No document is currently active",
@"OK", NULL, NULL);
return;
}
offset.width = dragPoint.x - mouseDownPoint.x;
offset.height = dragPoint.x - mouseDownPoint.y;
NSLog(@"Drag start with offset %@", NSStringFromSize(offset));
RELEASE(dragImage);
dragImage = [NSImage new];
rep = [[NSCachedImageRep alloc] initWithWindow: [self window]
rect: rect];
[dragImage setSize: rect.size];
[dragImage addRepresentation: rep];
RELEASE(rep);
type = [IBPalette typeForView: view];
obj = [IBPalette objectForView: view];
@ -245,7 +263,7 @@ static NSImage *dragImage = nil;
NSRect dragRect = {{0, 0}, {272, 192}};
unsigned int style = NSTitledWindowMask | NSClosableWindowMask | NSResizableWindowMask;
panel = [[NSPanel alloc] initWithContentRect: contentRect
panel = [[GormPalettePanel alloc] initWithContentRect: contentRect
styleMask: style
backing: NSBackingStoreRetained
defer: NO];