Hi,
I'm ready to commit this patch, but I wanted to give the heads up before...
This basically remove the reverse splitview bar we draw to instead do
live resizing.
It's reasonably fast, tested on slow-ish machines (~1ghz x86 ppc),
and makes things much nicer from a UI point of view.
Comments before I submit ? :)
--
Nicolas Roard
I love deadlines. I like the whooshing sound
they make as they fly by. -- Douglas Adams
Index: Source/NSSplitView.m
===
--- Source/NSSplitView.m (revision 28272)
+++ Source/NSSplitView.m (working copy)
@@ -167,8 +167,6 @@
- (void) mouseDown: (NSEvent*)theEvent
{
NSApplication *app = [NSApplication sharedApplication];
- static NSRect oldRect; //only one can be dragged at a time
- static BOOL lit = NO;
NSPoint p, op;
NSEvent *e;
NSRect r, r1, bigRect, vis;
@@ -345,12 +343,8 @@
}
}
- oldRect = NSZeroRect;
- [self lockFocus];
-
[[NSRunLoop currentRunLoop] limitDateForMode: NSEventTrackingRunLoopMode];
- [_dividerColor set];
r.size.width = divHorizontal;
r.size.height = divVertical;
e = [app nextEventMatchingMask: eventMask
@@ -363,12 +357,13 @@
constrainImp = (floatIMP)[_delegate methodForSelector: constrainSel];
}
- // Save the old position
- op = p;
-
// user is moving the knob loop until left mouse up
while ([e type] != NSLeftMouseUp)
{
+
+ // Save the old position
+ op = p;
+
p = [self convertPoint: [e locationInWindow] fromView: nil];
if (delegateConstrains)
{
@@ -410,148 +405,7 @@
r.origin.x = p.x - (divHorizontal/2.);
r.origin.y = NSMinY(vis);
}
- if (NSEqualRects(r, oldRect) == NO)
-{
- NSDebugLLog(@NSSplitView, @drawing divider at %...@\n,
- NSStringFromRect(r));
- [_dividerColor set];
-
-
- if (lit == YES)
-{
- if (_isVertical == NO)
-{
- if ((NSMinY(r) NSMaxY(oldRect))
- || (NSMaxY(r) NSMinY(oldRect)))
-// the two rects don't intersect
-{
- NSHighlightRect(oldRect);
- NSHighlightRect(r);
-}
- else
-// the two rects intersect
-{
- if (NSMinY(r) NSMinY(oldRect))
-{
- NSRect onRect, offRect;
- onRect.size.width = r.size.width;
- onRect.origin.x = r.origin.x;
- offRect.size.width = r.size.width;
- offRect.origin.x = r.origin.x;
- offRect.origin.y = NSMinY(oldRect);
- offRect.size.height =
-NSMinY(r) - NSMinY(oldRect);
-
- onRect.origin.y = NSMaxY(oldRect);
- onRect.size.height =
-NSMaxY(r) - NSMaxY(oldRect);
-
- NSHighlightRect(onRect);
- NSHighlightRect(offRect);
-
- //NSLog(@on : %@, NSStringFromRect(onRect));
- //NSLog(@off : %@, NSStringFromRect(offRect));
- //NSLog(@old : %@, NSStringFromRect(oldRect));
- //NSLog(@r : %@, NSStringFromRect(r));
-}
- else
-{
- NSRect onRect, offRect;
- onRect.size.width = r.size.width;
- onRect.origin.x = r.origin.x;
- offRect.size.width = r.size.width;
- offRect.origin.x = r.origin.x;
-
- offRect.origin.y = NSMaxY(r);
- offRect.size.height =
-NSMaxY(oldRect) - NSMaxY(r);
-
- onRect.origin.y = NSMinY(r);
- onRect.size.height =
-NSMinY(oldRect) - NSMinY(r);
-
- NSHighlightRect(onRect);
- NSHighlightRect(offRect);
-
- //NSLog(@on : %@, NSStringFromRect(onRect));
- //NSLog(@off : %@, NSStringFromRect(offRect));
- //NSLog(@old : %@, NSStringFromRect(oldRect));
- //NSLog(@r : %@, NSStringFromRect(r));
-}
-}
-}
- else
-{
- if ((NSMinX(r) NSMaxX(oldRect))
- || (NSMaxX(r) NSMinX(oldRect)))
-// the two rects don't intersect
-{
- NSHighlightRect(oldRect);
-