Permalink
Browse files

fixing drag and drop support, no more crashes when dragging on top of…

… "workspace"
  • Loading branch information...
1 parent 330b48c commit 905e08c19f737d369a4dda4f9747828706ea091a @markhuot committed Jun 30, 2011
Showing with 12 additions and 2 deletions.
  1. +6 −1 src/MHOpenFiles.m
  2. +6 −1 src/MHOutlineView.m
View
@@ -208,7 +208,7 @@ - (BOOL)outlineView:(NSOutlineView *)outlineView writeItems:(NSArray *)items toP
- (NSDragOperation)outlineView:(NSOutlineView *)outlineView validateDrop:(id<NSDraggingInfo>)info proposedItem:(id)item proposedChildIndex:(NSInteger)index
{
- if ([item isEqualToString:@"WORKSPACE"] && index >= 0)
+ if (([item isEqualToString:@"WORKSPACE"] && index >= 0) || (item == nil && index == 1))
{
return NSDragOperationMove;
}
@@ -218,6 +218,11 @@ - (NSDragOperation)outlineView:(NSOutlineView *)outlineView validateDrop:(id<NSD
- (BOOL)outlineView:(NSOutlineView *)outlineView acceptDrop:(id<NSDraggingInfo>)info item:(id)item childIndex:(NSInteger)index
{
+ if (item == nil && index == 1)
+ {
+ index = [openFiles count];
+ }
+
id object = [openFiles objectAtIndex:draggedIndex];
[openFiles removeObjectAtIndex:draggedIndex];
View
@@ -15,12 +15,17 @@ - (id)init
{
self = [super init];
if (self) {
- // Initialization code here.
+ [self addTrackingRect:[self bounds] owner:self userData:nil assumeInside:NO];
}
return self;
}
+- (void)mouseEntered:(NSEvent *)theEvent
+{
+ NSLog(@"mouse entered!");
+}
+
- (NSRect)frameOfCellAtColumn:(NSInteger)column row:(NSInteger)row
{
NSRect rc = [super frameOfCellAtColumn:column row:row];

0 comments on commit 905e08c

Please sign in to comment.