Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fix warnings etc in PSMTabBarControl framework

This also gets rid of a runtime warning that would get logged on OS X
10.8 regarding the use of a deprecated method.
  • Loading branch information...
commit 259f4dee7cd3318b9a303f1234e745178fe08f6e 1 parent 25150b0
Björn Winckler authored August 17, 2012
0  src/MacVim/PSMTabBarControl/source/NSBezierPath_AMShading.h 100755 → 100644
File mode changed
0  src/MacVim/PSMTabBarControl/source/NSBezierPath_AMShading.m 100755 → 100644
File mode changed
11  src/MacVim/PSMTabBarControl/source/PSMAquaTabStyle.m
@@ -333,7 +333,7 @@ - (void)drawTabCell:(PSMTabBarCell *)cell;
333 333
         }
334 334
         
335 335
         [bgImage drawInRect:cellFrame fromRect:NSMakeRect(0.0, 0.0, 1.0, 22.0) operation:NSCompositeSourceOver fraction:1.0];
336  
-        [aquaDivider compositeToPoint:NSMakePoint(cellFrame.origin.x + cellFrame.size.width - 1.0, cellFrame.origin.y + cellFrame.size.height) operation:NSCompositeSourceOver];
  336
+        [aquaDivider drawAtPoint:NSMakePoint(cellFrame.origin.x + cellFrame.size.width - 1.0, cellFrame.origin.y + cellFrame.size.height) fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0];
337 337
         
338 338
         aRect.size.height+=0.5;
339 339
         
@@ -353,7 +353,7 @@ - (void)drawTabCell:(PSMTabBarCell *)cell;
353 353
             NSRectFillUsingOperation(aRect, NSCompositeSourceAtop);
354 354
         }
355 355
         
356  
-        [aquaDivider compositeToPoint:NSMakePoint(cellFrame.origin.x + cellFrame.size.width - 1.0, cellFrame.origin.y + cellFrame.size.height) operation:NSCompositeSourceOver];
  356
+        [aquaDivider drawAtPoint:NSMakePoint(cellFrame.origin.x + cellFrame.size.width - 1.0, cellFrame.origin.y + cellFrame.size.height) fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0];
357 357
     }
358 358
     
359 359
     [self drawInteriorWithTabCell:cell inView:[cell controlView]];
@@ -408,11 +408,8 @@ - (void)drawInteriorWithTabCell:(PSMTabBarCell *)cell inView:(NSView*)controlVie
408 408
         if([cell closeButtonPressed]) closeButton = aquaCloseButtonDown;
409 409
         
410 410
         closeButtonSize = [closeButton size];
411  
-        if([controlView isFlipped]) {
412  
-            closeButtonRect.origin.y += closeButtonRect.size.height;
413  
-        }
414  
-        
415  
-        [closeButton compositeToPoint:closeButtonRect.origin operation:NSCompositeSourceOver fraction:1.0];
  411
+        [closeButton setFlipped:YES];
  412
+        [closeButton drawAtPoint:closeButtonRect.origin fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0];
416 413
         
417 414
         // scoot label over
418 415
         labelPosition += closeButtonSize.width + kPSMTabBarCellPadding;
7  src/MacVim/PSMTabBarControl/source/PSMMetalTabStyle.m
@@ -393,11 +393,8 @@ - (void)drawInteriorWithTabCell:(PSMTabBarCell *)cell inView:(NSView*)controlVie
393 393
         if ([cell closeButtonPressed]) closeButton = metalCloseButtonDown;
394 394
         
395 395
         closeButtonSize = [closeButton size];
396  
-        if ([controlView isFlipped]) {
397  
-            closeButtonRect.origin.y += closeButtonRect.size.height;
398  
-        }
399  
-        
400  
-        [closeButton compositeToPoint:closeButtonRect.origin operation:NSCompositeSourceOver fraction:1.0];
  396
+        [closeButton setFlipped:YES];
  397
+        [closeButton drawAtPoint:closeButtonRect.origin fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0];
401 398
         
402 399
         // scoot label over
403 400
         labelPosition += closeButtonSize.width + kPSMTabBarCellPadding;
6  src/MacVim/PSMTabBarControl/source/PSMOverflowPopUpButton.m
@@ -43,10 +43,8 @@ - (void)drawRect:(NSRect)rect
43 43
 	NSSize imageSize = [image size];
44 44
     rect.origin.x = NSMidX(rect) - (imageSize.width * 0.5);
45 45
     rect.origin.y = NSMidY(rect) - (imageSize.height * 0.5);
46  
-    if([self isFlipped]) {
47  
-        rect.origin.y += imageSize.height;
48  
-    }
49  
-    [image compositeToPoint:rect.origin operation:NSCompositeSourceOver];
  46
+    [image setFlipped:YES];
  47
+    [image drawAtPoint:rect.origin fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0];
50 48
 }
51 49
 
52 50
 - (void)mouseDown:(NSEvent *)event
2  src/MacVim/PSMTabBarControl/source/PSMTabBarCell.h
@@ -100,6 +100,6 @@
100 100
 
101 101
 @interface PSMTabBarControl (CellAccessors)
102 102
 
103  
-- (id<PSMTabStyle>)style;
  103
+- (id<PSMTabStyle>)psmTabStyle;
104 104
 
105 105
 @end
16  src/MacVim/PSMTabBarControl/source/PSMTabBarCell.m
@@ -137,7 +137,7 @@ - (NSSize)stringSize
137 137
 
138 138
 - (NSAttributedString *)attributedStringValue
139 139
 {
140  
-    return [(id <PSMTabStyle>)[_controlView style] attributedStringValueForTabCell:self];
  140
+    return [[_controlView psmTabStyle] attributedStringValueForTabCell:self];
141 141
 }
142 142
 
143 143
 - (int)tabState
@@ -271,22 +271,22 @@ - (void)setToolTip:(NSString *)tip
271 271
 
272 272
 - (NSRect)indicatorRectForFrame:(NSRect)cellFrame
273 273
 {
274  
-    return [(id <PSMTabStyle>)[_controlView style] indicatorRectForTabCell:self];
  274
+    return [[_controlView psmTabStyle] indicatorRectForTabCell:self];
275 275
 }
276 276
 
277 277
 - (NSRect)closeButtonRectForFrame:(NSRect)cellFrame
278 278
 {
279  
-    return [(id <PSMTabStyle>)[_controlView style] closeButtonRectForTabCell:self];
  279
+    return [[_controlView psmTabStyle] closeButtonRectForTabCell:self];
280 280
 }
281 281
 
282 282
 - (float)minimumWidthOfCell
283 283
 {
284  
-    return [(id <PSMTabStyle>)[_controlView style] minimumWidthOfTabCell:self];
  284
+    return [[_controlView psmTabStyle] minimumWidthOfTabCell:self];
285 285
 }
286 286
 
287 287
 - (float)desiredWidthOfCell
288 288
 {
289  
-    return [(id <PSMTabStyle>)[_controlView style] desiredWidthOfTabCell:self];
  289
+    return [[_controlView psmTabStyle] desiredWidthOfTabCell:self];
290 290
 }  
291 291
 
292 292
 #pragma mark -
@@ -300,7 +300,7 @@ - (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
300 300
         return;
301 301
     }
302 302
     
303  
-    [(id <PSMTabStyle>)[_controlView style] drawTabCell:self];	
  303
+    [[_controlView psmTabStyle] drawTabCell:self];
304 304
 }
305 305
 
306 306
 #pragma mark -
@@ -344,7 +344,7 @@ - (NSImage*)dragImageForRect:(NSRect)cellFrame
344 344
     [image addRepresentation:rep];
345 345
     NSImage *returnImage = [[[NSImage alloc] initWithSize:[rep size]] autorelease];
346 346
     [returnImage lockFocus];
347  
-    [image compositeToPoint:NSMakePoint(0.0, 0.0) operation:NSCompositeSourceOver fraction:0.7];
  347
+    [image drawAtPoint:NSMakePoint(0.0, 0.0) fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:0.7];
348 348
     [returnImage unlockFocus];
349 349
     if(![[self indicator] isHidden]){
350 350
         NSImage *pi = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"pi"]];
@@ -352,7 +352,7 @@ - (NSImage*)dragImageForRect:(NSRect)cellFrame
352 352
         NSPoint indicatorPoint = NSMakePoint([self frame].size.width - MARGIN_X - kPSMTabBarIndicatorWidth, MARGIN_Y);
353 353
         if(([self state] == NSOnState) && ([[_controlView styleName] isEqualToString:@"Metal"]))
354 354
             indicatorPoint.y += 1.0;
355  
-        [pi compositeToPoint:indicatorPoint operation:NSCompositeSourceOver fraction:0.7];
  355
+        [pi drawAtPoint:indicatorPoint fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:0.7];
356 356
         [returnImage unlockFocus];
357 357
         [pi release];
358 358
     }
2  src/MacVim/PSMTabBarControl/source/PSMTabBarControl.m
@@ -242,7 +242,7 @@ - (void)setTabView:(NSTabView *)view
242 242
     tabView = view;
243 243
 }
244 244
 
245  
-- (id<PSMTabStyle>)style
  245
+- (id<PSMTabStyle>)psmTabStyle
246 246
 {
247 247
     return style;
248 248
 }
2  src/MacVim/PSMTabBarControl/source/PSMTabDragAssistant.h
@@ -74,7 +74,7 @@
74 74
 
75 75
 @interface PSMTabBarControl (DragAccessors)
76 76
 
77  
-- (id<PSMTabStyle>)style;
  77
+- (id<PSMTabStyle>)psmTabStyle;
78 78
 - (NSMutableArray *)cells;
79 79
 - (void)setControlView:(id)view;
80 80
 - (id)cellForPoint:(NSPoint)point cellFrame:(NSRectPointer)outFrame;
6  src/MacVim/PSMTabBarControl/source/PSMTabDragAssistant.m
@@ -280,14 +280,14 @@ - (void)calculateDragAnimationForTabBar:(PSMTabBarControl *)control
280 280
     BOOL removeFlag = YES;
281 281
     NSMutableArray *cells = [control cells];
282 282
     int i, cellCount = [cells count];
283  
-    float xPos = [[control style] leftMarginForTabBarControl];
  283
+    float xPos = [[control psmTabStyle] leftMarginForTabBarControl];
284 284
     
285 285
     // identify target cell
286 286
     // mouse at beginning of tabs
287 287
     NSPoint mouseLoc = [self currentMouseLoc];
288 288
     if([self destinationTabBar] == control){
289 289
         removeFlag = NO;
290  
-        if(mouseLoc.x < [[control style] leftMarginForTabBarControl]){
  290
+        if(mouseLoc.x < [[control psmTabStyle] leftMarginForTabBarControl]){
291 291
             [self setTargetCell:[cells objectAtIndex:0]];
292 292
             goto layout;
293 293
         }
@@ -342,7 +342,7 @@ - (void)calculateDragAnimationForTabBar:(PSMTabBarControl *)control
342 342
         newRect.origin.x = xPos;
343 343
         [cell setFrame:newRect];
344 344
         if([cell indicator])
345  
-            [[cell indicator] setFrame:[[control style] indicatorRectForTabCell:cell]];
  345
+            [[cell indicator] setFrame:[[control psmTabStyle] indicatorRectForTabCell:cell]];
346 346
         xPos += newRect.size.width;
347 347
     }
348 348
     if(removeFlag){
7  src/MacVim/PSMTabBarControl/source/PSMUnifiedTabStyle.m
@@ -389,11 +389,8 @@ - (void)drawInteriorWithTabCell:(PSMTabBarCell *)cell inView:(NSView*)controlVie
389 389
         if ([cell closeButtonPressed]) closeButton = unifiedCloseButtonDown;
390 390
         
391 391
         closeButtonSize = [closeButton size];
392  
-        if ([controlView isFlipped]) {
393  
-            closeButtonRect.origin.y += closeButtonRect.size.height;
394  
-        }
395  
-        
396  
-        [closeButton compositeToPoint:closeButtonRect.origin operation:NSCompositeSourceOver fraction:1.0];
  392
+        [closeButton setFlipped:YES];
  393
+        [closeButton drawAtPoint:closeButtonRect.origin fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0];
397 394
         
398 395
         // scoot label over
399 396
         labelPosition += closeButtonSize.width + kPSMTabBarCellPadding;

0 notes on commit 259f4de

Please sign in to comment.
Something went wrong with that request. Please try again.