Revision: 11903
          http://bibdesk.svn.sourceforge.net/bibdesk/?rev=11903&view=rev
Author:   amaxwell
Date:     2007-12-13 11:44:53 -0800 (Thu, 13 Dec 2007)

Log Message:
-----------
swizzle -[NSSplitView mouseDown:] in the test program

Modified Paths:
--------------
    trunk/bibdesk_vendorsrc/amaxwell/FileView/FileView Program/Controller.m

Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FileView 
Program/Controller.m
===================================================================
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FileView Program/Controller.m     
2007-12-13 19:12:17 UTC (rev 11902)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FileView Program/Controller.m     
2007-12-13 19:44:53 UTC (rev 11903)
@@ -105,3 +105,107 @@
 }
 
 @end
+
+#if defined(MAC_OS_X_VERSION_10_5) && (MAC_OS_X_VERSION_MIN_REQUIRED >= 
MAC_OS_X_VERSION_10_5)
+
+#import <objc/runtime.h>
+
[EMAIL PROTECTED] NSSplitView (FileViewFixes)
+- (void)_fv_replacementMouseDown:(NSEvent *)theEvent;
[EMAIL PROTECTED]
+
[EMAIL PROTECTED] NSSplitView (FileViewFixes)
+
+static IMP originalMouseDown = NULL;
+
++ (void)load
+{
+    Method m = class_getInstanceMethod(self, @selector(mouseDown:));
+    IMP replacementMouseDown = class_getMethodImplementation(self, 
@selector(_fv_replacementMouseDown:));
+    originalMouseDown = method_setImplementation(m, replacementMouseDown);
+}
+
+- (void)_fv_replacementMouseDown:(NSEvent *)theEvent;
+{
+    BOOL inDivider = NO;
+    NSPoint mouseLoc = [self convertPoint:[theEvent locationInWindow] 
fromView:nil];
+    NSArray *subviews = [self subviews];
+    int i, count = [subviews count];
+    id view;
+    NSRect divRect;
+    
+    for (i = 0; i < count - 1; i++) {
+        view = [subviews objectAtIndex:i];
+        divRect = [view frame];
+        if ([self isVertical]) {
+            divRect.origin.x = NSMaxX(divRect);
+            divRect.size.width = [self dividerThickness];
+        } else {
+            divRect.origin.y = NSMaxY(divRect);
+            divRect.size.height = [self dividerThickness];
+        }
+        
+        if (NSPointInRect(mouseLoc, divRect)) {
+            inDivider = YES;
+            break;
+        }
+    }
+    
+    if (inDivider) {
+        originalMouseDown(self, _cmd, theEvent);
+    } else {
+        [[self nextResponder] mouseDown:theEvent];
+    }
+}
+
[EMAIL PROTECTED]
+
+#else
+
[EMAIL PROTECTED] PosingSplitView : NSSplitView
[EMAIL PROTECTED]
+
[EMAIL PROTECTED] PosingSplitView
+
++ (void)load
+{
+    NSAutoreleasePool *pool = [NSAutoreleasePool new];
+    [self poseAsClass:NSClassFromString(@"NSSplitView")];
+    [pool release];
+}
+
+- (void)mouseDown:(NSEvent *)theEvent {
+    BOOL inDivider = NO;
+    NSPoint mouseLoc = [self convertPoint:[theEvent locationInWindow] 
fromView:nil];
+    NSArray *subviews = [self subviews];
+    int i, count = [subviews count];
+    id view;
+    NSRect divRect;
+    
+    for (i = 0; i < count - 1; i++) {
+        view = [subviews objectAtIndex:i];
+        divRect = [view frame];
+        if ([self isVertical]) {
+            divRect.origin.x = NSMaxX(divRect);
+            divRect.size.width = [self dividerThickness];
+        } else {
+            divRect.origin.y = NSMaxY(divRect);
+            divRect.size.height = [self dividerThickness];
+        }
+        
+        if (NSPointInRect(mouseLoc, divRect)) {
+            inDivider = YES;
+            break;
+        }
+    }
+    
+    if (inDivider) {
+        [super mouseDown:theEvent];
+    } else {
+        [[self nextResponder] mouseDown:theEvent];
+    }
+}
+
[EMAIL PROTECTED]
+
+#endif


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to