Commits

Jens Alfke committed cd966a3

* Drop into gdb on Warn call.
* Fix deprecation warning in ImageAndTextCell.
* Removed nonexistent function prototype from MYErrorUtils.h.

  • Participants
  • Parent commits e40c8ea

Comments (0)

Files changed (4)

File ImageAndTextCell.h

 #import <Cocoa/Cocoa.h>
 
 /** Subclass of NSTextFieldCell which can display text and an image simultaneously.
-    Taken directly from Apple sample code. */
+    Taken from Apple sample code. */
 @interface ImageAndTextCell : NSTextFieldCell
 {
     @private
     NSImage *image;
 }
 
-- (void)setImage:(NSImage *)anImage;
-- (NSImage *)image;
-
-- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView;
-- (NSSize)cellSize;
+@property (retain) NSImage* image;
 
 @end

File ImageAndTextCell.m

         imageFrame.origin.x += 3;
         imageFrame.size = imageSize;
 
-        if ([controlView isFlipped])
-            imageFrame.origin.y += ceilf((cellFrame.size.height + imageFrame.size.height) / 2);
-        else
-            imageFrame.origin.y += ceilf((cellFrame.size.height - imageFrame.size.height) / 2);
+        // I modified the following to avoid using 10.6-deprecated APIs. --Jens
+        
+        imageFrame.origin.y -= ceilf((cellFrame.size.height - imageFrame.size.height) / 2);
 
-        [image compositeToPoint:imageFrame.origin operation:NSCompositeSourceOver];
+        [image drawInRect: imageFrame
+                 fromRect: NSZeroRect
+                operation: NSCompositeSourceOver
+                 fraction: 1.0f
+           respectFlipped: YES
+                    hints: nil];
     }
     [super drawWithFrame:cellFrame inView:controlView];
 }
     va_start(args,msg);
     _Logv(kWarningPrefix,msg,args);
     va_end(args);
+
+    // If running in Xcode, drop into the debugger on a warning.
+    // You must check the "Run > Stop On Debugger()/DebugStr()" menu item to enable this.
+    Debugger();
 }
 
 

File MYErrorUtils.h

     look up error messages. (This is turned off by default because it creates
     a dependency on linking against Security.framework.)
  */
-NSString* MYPrintableErrorCode( int code );
 NSString* MYErrorName( NSString *domain, NSInteger code );
 
 @interface NSError (MYUtilities)