Fix visual bugs when dragging items from pallette.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@23776 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2006-10-06 13:03:51 +00:00
parent f0119f3465
commit 404980e059
2 changed files with 24 additions and 2 deletions

View file

@ -1,3 +1,11 @@
2006-10-06 Richard Frith-Macdonald <rfm@gnu.org>
* GormCore/GormPalettesManager.m: rewrite code to set up drag image
so we avoid glitches on the pallette view (we no longer use the
pallette window directly as the cached image window) and ensure that
the image dragged is all copied correctly to avoid the glitches
when dragging BSBox and NSScrollView items.
2006-10-06 00:16-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* GormCore/GormClassEditor.m: Minor cleanup in handleNotification:

View file

@ -167,6 +167,7 @@ static NSImage *dragImage = nil;
- (void) mouseDown: (NSEvent*)theEvent
{
NSPoint dragPoint = [theEvent locationInWindow];
NSWindow *w = [self window];
NSView *view;
GormDocument *active = (GormDocument *)[(id<IB>)NSApp activeDocument];
NSRect rect;
@ -201,12 +202,25 @@ static NSImage *dragImage = nil;
RELEASE(dragImage);
dragImage = [[NSImage alloc] init];
rep = [[NSCachedImageRep alloc] initWithWindow: [self window]
rect: rect];
[dragImage setSize: rect.size];
rep = [[NSCachedImageRep alloc] initWithSize: rect.size
depth: [w depthLimit]
separate: YES
alpha: [w alphaValue]>0.0 ? YES : NO];
[dragImage addRepresentation: rep];
RELEASE(rep);
/* Copy the contents of the clicked view from our window into the
* cached image representation.
* NB. We use lockFocusOnRepresentation: for this because it sets
* up cached image representation information in the image, and if
* that's not done before our copy, the image will overwrite our
* copied data when asked to draw the representation.
*/
[dragImage lockFocusOnRepresentation: rep];
NSCopyBits([w gState], rect, NSZeroPoint);
[dragImage unlockFocus];
type = [IBPalette typeForView: view];
obj = [IBPalette objectForView: view];
pb = [NSPasteboard pasteboardWithName: NSDragPboard];