Revision: 5984
          http://skim-app.svn.sourceforge.net/skim-app/?rev=5984&view=rev
Author:   hofman
Date:     2009-11-03 00:55:22 +0000 (Tue, 03 Nov 2009)

Log Message:
-----------
make status bar a direct subclass of NSView and switch contentBorderThickness 
earlier when toggling it, otherwise we can't drag it

Modified Paths:
--------------
    trunk/SKStatusBar.h
    trunk/SKStatusBar.m

Modified: trunk/SKStatusBar.h
===================================================================
--- trunk/SKStatusBar.h 2009-11-02 09:22:15 UTC (rev 5983)
+++ trunk/SKStatusBar.h 2009-11-03 00:55:22 UTC (rev 5984)
@@ -46,7 +46,7 @@
 typedef NSInteger SKProgressIndicatorStyle;
 
 
-...@interface SKStatusBar : NSControl {
+...@interface SKStatusBar : NSView {
        id leftCell;
        id rightCell;
     id iconCell;

Modified: trunk/SKStatusBar.m
===================================================================
--- trunk/SKStatusBar.m 2009-11-02 09:22:15 UTC (rev 5983)
+++ trunk/SKStatusBar.m 2009-11-03 00:55:22 UTC (rev 5984)
@@ -151,8 +151,8 @@
                viewFrame.size.height += statusHeight;
                if ([contentView isFlipped] == NO)
                        viewFrame.origin.y -= statusHeight;
+        [[view window] setContentBorderThickness:0.0 forEdge:NSMinYEdge];
                [self removeFromSuperview];
-        [[view window] setContentBorderThickness:0.0 forEdge:NSMinYEdge];
        } else {
                viewFrame.size.height -= statusHeight;
                if ([contentView isFlipped] == NO)
@@ -160,8 +160,8 @@
                else 
                        statusRect.origin.y = NSMaxY([contentView bounds]) - 
statusHeight;
                [self setFrame:statusRect];
-               [contentView  addSubview:self positioned:NSWindowBelow 
relativeTo:nil];
         [[view window] setContentBorderThickness:statusHeight 
forEdge:NSMinYEdge];
+               [contentView addSubview:self positioned:NSWindowBelow 
relativeTo:nil];
        }
        [view setFrame:viewFrame];
        [contentView setNeedsDisplay:YES];
@@ -171,18 +171,24 @@
     NSPoint mouseLoc = [self convertPoint:[theEvent locationInWindow] 
fromView:nil];
     NSRect leftRect, rightRect;
     [self getLeftFrame:&leftRect rightFrame:&rightRect];
-    if (NSMouseInRect(mouseLoc, rightRect, [self isFlipped])) {
+    if (NSMouseInRect(mouseLoc, rightRect, [self isFlipped]) && [rightCell 
action]) {
         while ([theEvent type] != NSLeftMouseUp)
             theEvent = [[self window] nextEventMatchingMask: 
NSLeftMouseDraggedMask | NSLeftMouseUpMask];
         mouseLoc = [self convertPoint:[theEvent locationInWindow] 
fromView:nil];
-        if (NSMouseInRect(mouseLoc, rightRect, [self isFlipped]))
-            [rightCell performClick:self];
-    } else if (NSMouseInRect(mouseLoc, leftRect, [self isFlipped])) {
+        if (NSMouseInRect(mouseLoc, rightRect, [self isFlipped])) {
+            [rightCell setNextState];
+            [NSApp sendAction:[rightCell action] to:[rightCell target] 
from:self];
+        }
+    } else if (NSMouseInRect(mouseLoc, leftRect, [self isFlipped]) && 
[leftCell action]) {
         while ([theEvent type] != NSLeftMouseUp)
             theEvent = [[self window] nextEventMatchingMask: 
NSLeftMouseDraggedMask | NSLeftMouseUpMask];
         mouseLoc = [self convertPoint:[theEvent locationInWindow] 
fromView:nil];
-        if (NSMouseInRect(mouseLoc, leftRect, [self isFlipped]))
-            [leftCell performClick:self];
+        if (NSMouseInRect(mouseLoc, leftRect, [self isFlipped])) {
+            [leftCell setNextState];
+            [NSApp sendAction:[leftCell action] to:[leftCell target] 
from:self];
+        }
+    } else {
+        [super mouseDown:theEvent];
     }
 }
 


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

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to