Revision: 15181
          http://bibdesk.svn.sourceforge.net/bibdesk/?rev=15181&view=rev
Author:   hofman
Date:     2009-04-25 00:31:00 +0000 (Sat, 25 Apr 2009)

Log Message:
-----------
simplify header popup button cell

Modified Paths:
--------------
    trunk/bibdesk/BDSKHeaderPopUpButtonCell.h
    trunk/bibdesk/BDSKHeaderPopUpButtonCell.m

Modified: trunk/bibdesk/BDSKHeaderPopUpButtonCell.h
===================================================================
--- trunk/bibdesk/BDSKHeaderPopUpButtonCell.h   2009-04-24 19:46:56 UTC (rev 
15180)
+++ trunk/bibdesk/BDSKHeaderPopUpButtonCell.h   2009-04-25 00:31:00 UTC (rev 
15181)
@@ -41,11 +41,6 @@
 
 @interface BDSKHeaderPopUpButtonCell : NSPopUpButtonCell {
        NSTableHeaderCell *headerCell;
-       NSImage *indicatorImage;
 }
 - (id)initWithHeaderCell:(NSTableHeaderCell *)aHeaderCell;
-- (NSRect)sortIndicatorRectForBounds:(NSRect)aRect;
-- (NSRect)popUpRectForBounds:(NSRect)aRect;
-- (void)setIndicatorImage:(NSImage *)image;
-- (NSImage *)indicatorImage;
 @end

Modified: trunk/bibdesk/BDSKHeaderPopUpButtonCell.m
===================================================================
--- trunk/bibdesk/BDSKHeaderPopUpButtonCell.m   2009-04-24 19:46:56 UTC (rev 
15180)
+++ trunk/bibdesk/BDSKHeaderPopUpButtonCell.m   2009-04-25 00:31:00 UTC (rev 
15181)
@@ -67,20 +67,18 @@
                
                // we keep the headercell for drawing
                headerCell = [aHeaderCell retain];
-               
-               indicatorImage = nil;
        }
        return self;
 }
 
-// a copy is used to fill in empty space if the column do not fill the table. 
That better be an empty headerCell
 - (id)copyWithZone:(NSZone *)aZone {
-       return [headerCell copyWithZone:aZone];
+       BDSKHeaderPopUpButtonCell *copy = [super copyWithZone:aZone];
+    copy->headerCell = [headerCell copyWithZone:aZone];
+    return copy;
 }
 
 - (void)dealloc {
        [headerCell release];
-       [indicatorImage release];
        [super dealloc];
 }
 
@@ -96,24 +94,6 @@
        return size;
 }
 
-- (NSRect)sortIndicatorRectForBounds:(NSRect)aRect {
-       NSRect indicatorRect = NSZeroRect;
-       if (indicatorImage != nil) {
-               NSSize indicatorSize = [indicatorImage size];
-               NSDivideRect(aRect, &indicatorRect, &aRect, indicatorSize.width 
+ 8.0, NSMaxXEdge);
-       }
-       return indicatorRect;
-}
-
-- (NSRect)popUpRectForBounds:(NSRect)aRect {
-       NSRect popupRect = aRect;
-       if (indicatorImage != nil) {
-               NSSize indicatorSize = [indicatorImage size];
-               NSDivideRect(aRect, &aRect, &popupRect, indicatorSize.width + 
8.0, NSMaxXEdge);
-       }
-       return popupRect;
-}
-
 - (NSString *)title {
     if ([self usesItemFromMenu])
         return [super title];
@@ -135,19 +115,6 @@
        [headerCell setHighlighted:[self isHighlighted]];
        [headerCell drawWithFrame:cellFrame inView:controlView];
        
-       if (indicatorImage != nil) {
-               NSSize indicatorSize = [indicatorImage size];
-               NSRect indicatorRect, ignored;
-               
-               NSDivideRect(cellFrame, &ignored, &cellFrame, 4.0, NSMaxXEdge);
-               NSDivideRect(cellFrame, &indicatorRect, &cellFrame, 
indicatorSize.width, NSMaxXEdge);
-               NSDivideRect(cellFrame, &ignored, &cellFrame, 4.0, NSMaxXEdge);
-               
-        indicatorRect = BDSKCenterRect(indicatorRect, indicatorSize, 
[controlView isFlipped]);
-               
-               [indicatorImage drawFlipped:[controlView isFlipped] 
inRect:indicatorRect fromRect:NSZeroRect operation:NSCompositeSourceOver 
fraction:1.0];
-       }
-       
        // Two little arrows. We could also use some image here
        NSInteger controlSize = [self controlSize];
        CGFloat width = 5.0 - controlSize;
@@ -176,20 +143,8 @@
     }
 }    
 
-- (void)setIndicatorImage:(NSImage *)image {
-       if (image != indicatorImage) {
-               [indicatorImage release];
-               indicatorImage = [image retain];
-       }
-}
-
-- (NSImage *)indicatorImage {
-       return indicatorImage;
-}
-
 - (BOOL)trackMouse:(NSEvent *)theEvent inRect:(NSRect)cellFrame ofView:(NSView 
*)controlView untilMouseUp:(BOOL)untilMouseUp {
        // fool super to get the right menu position
-       cellFrame = [self popUpRectForBounds:cellFrame];
        cellFrame.origin.x -= 7.0;
        cellFrame.origin.y += 2.0;
        cellFrame.size.width += 7.0;


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

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensign option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to