Revision: 18293
          http://bibdesk.svn.sourceforge.net/bibdesk/?rev=18293&view=rev
Author:   hofman
Date:     2011-12-05 13:20:16 +0000 (Mon, 05 Dec 2011)
Log Message:
-----------
Use shared cell to draw text field bezel

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

Modified: trunk/bibdesk/BDSKFontWell.h
===================================================================
--- trunk/bibdesk/BDSKFontWell.h        2011-12-05 12:07:57 UTC (rev 18292)
+++ trunk/bibdesk/BDSKFontWell.h        2011-12-05 13:20:16 UTC (rev 18293)
@@ -60,7 +60,5 @@
 @end
 
 
-@interface BDSKFontWellCell : NSButtonCell {
-    NSTextFieldCell *bgCell;
-}
+@interface BDSKFontWellCell : NSButtonCell
 @end

Modified: trunk/bibdesk/BDSKFontWell.m
===================================================================
--- trunk/bibdesk/BDSKFontWell.m        2011-12-05 12:07:57 UTC (rev 18292)
+++ trunk/bibdesk/BDSKFontWell.m        2011-12-05 13:20:16 UTC (rev 18293)
@@ -306,8 +306,6 @@
 @implementation BDSKFontWellCell
 
 - (void)commonInit {
-    bgCell = [[NSTextFieldCell alloc] initTextCell:@""];
-    [bgCell setBezeled:YES];
     [self setBezelStyle:NSShadowlessSquareBezelStyle]; // this is mainly to 
make it selectable
     [self setButtonType:NSPushOnPushOffButton];
     [self setState:NSOffState];
@@ -329,19 +327,14 @@
        return self;
 }
 
-- (id)copyWithZone:(NSZone *)zone {
-    BDSKFontWellCell *copy = [super copyWithZone:zone];
-    copy->bgCell = [bgCell copyWithZone:zone];
-    return copy;
-}
-
-- (void)dealloc {
-    BDSKDESTROY(bgCell);
-    [super dealloc];
-}
-
 - (void)drawBezelWithFrame:(NSRect)frame inView:(NSView *)controlView {
+    static NSTextFieldCell *bgCell = nil;
+    if (bgCell == nil) {
+        bgCell = [[NSTextFieldCell alloc] initTextCell:@""];
+        [bgCell setBezeled:YES];
+    }
     [bgCell drawWithFrame:frame inView:controlView];
+    [bgCell setControlView:nil];
     
     [NSGraphicsContext saveGraphicsState];
     if ([self state] == NSOnState) {

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


------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to