@@ -47,7 +47,7 @@ - (void)resizeAndAdjustSubviews;
47
47
@end
48
48
49
49
@interface BWSplitView ()
50
- @property BOOL checkboxIsEnabled;
50
+ @property ( nonatomic ) BOOL checkboxIsEnabled;
51
51
@end
52
52
53
53
@implementation BWSplitView
@@ -58,9 +58,9 @@ @implementation BWSplitView
58
58
59
59
+ (void )initialize ;
60
60
{
61
- borderColor = [[ NSColor colorWithCalibratedWhite: (165 .0f / 255 .0f ) alpha: 1 ] retain ];
62
- gradientStartColor = [[ NSColor colorWithCalibratedWhite: (253 .0f / 255 .0f ) alpha: 1 ] retain ];
63
- gradientEndColor = [[ NSColor colorWithCalibratedWhite: (222 .0f / 255 .0f ) alpha: 1 ] retain ];
61
+ borderColor = [NSColor colorWithCalibratedWhite: (165 .0f / 255 .0f ) alpha: 1 ];
62
+ gradientStartColor = [NSColor colorWithCalibratedWhite: (253 .0f / 255 .0f ) alpha: 1 ];
63
+ gradientEndColor = [NSColor colorWithCalibratedWhite: (222 .0f / 255 .0f ) alpha: 1 ];
64
64
65
65
gradient = [[NSGradient alloc ] initWithStartingColor: gradientStartColor endingColor: gradientEndColor];
66
66
@@ -312,7 +312,7 @@ - (void)setMinSizeForCollapsibleSubview:(NSNumber *)minSize
312
312
{
313
313
if ([self hasCollapsibleSubview ])
314
314
{
315
- NSMutableDictionary *tempMinValues = [[[ self minValues ] mutableCopy ] autorelease ];
315
+ NSMutableDictionary *tempMinValues = [[self minValues ] mutableCopy ];
316
316
[tempMinValues setObject: minSize forKey: [NSNumber numberWithInt: [[self subviews ] indexOfObject: [self collapsibleSubview ]]]];
317
317
[self setMinValues: tempMinValues];
318
318
}
@@ -322,7 +322,7 @@ - (void)removeMinSizeForCollapsibleSubview
322
322
{
323
323
if ([self hasCollapsibleSubview ])
324
324
{
325
- NSMutableDictionary *tempMinValues = [[[ self minValues ] mutableCopy ] autorelease ];
325
+ NSMutableDictionary *tempMinValues = [[self minValues ] mutableCopy ];
326
326
[tempMinValues removeObjectForKey: [NSNumber numberWithInt: [[self subviews ] indexOfObject: [self collapsibleSubview ]]]];
327
327
[self setMinValues: tempMinValues];
328
328
}
@@ -349,7 +349,7 @@ - (IBAction)toggleCollapse:(id)sender
349
349
// We'll later remove the min size temporarily while animating and then restore it.
350
350
BOOL hasMinSize = NO ;
351
351
NSNumber *minSize = [minValues objectForKey: [NSNumber numberWithInt: [[self subviews ] indexOfObject: [self collapsibleSubview ]]]];
352
- minSize = [[ minSize copy ] autorelease ];
352
+ minSize = [minSize copy ];
353
353
354
354
if (minSize != nil || [minSize intValue ] != 0 )
355
355
hasMinSize = YES ;
@@ -715,6 +715,13 @@ - (void)splitViewWillResizeSubviews:(NSNotification *)aNotification
715
715
[secondaryDelegate splitViewWillResizeSubviews: aNotification];
716
716
}
717
717
718
+ - (BOOL )splitView : (NSSplitView *)splitView shouldAdjustSizeOfSubview : (NSView *)view
719
+ {
720
+ if ([secondaryDelegate respondsToSelector: @selector (splitView:shouldAdjustSizeOfSubview: )])
721
+ return [secondaryDelegate splitView: splitView shouldAdjustSizeOfSubview: view];
722
+ return YES ;
723
+ }
724
+
718
725
#pragma mark - Resize Subviews Delegate Method and Helper Methods
719
726
720
727
- (int )resizableSubviews
@@ -907,8 +914,8 @@ - (void)correctCollapsiblePreferredProportionOrSize;
907
914
if (![self hasCollapsibleSubview ])
908
915
return ;
909
916
910
- NSMutableDictionary *preferredProportions = [[[ self resizableSubviewPreferredProportion ] mutableCopy ] autorelease ];
911
- NSMutableDictionary *preferredSizes = [[[ self nonresizableSubviewPreferredSize ] mutableCopy ] autorelease ];
917
+ NSMutableDictionary *preferredProportions = [[self resizableSubviewPreferredProportion ] mutableCopy ];
918
+ NSMutableDictionary *preferredSizes = [[self nonresizableSubviewPreferredSize ] mutableCopy ];
912
919
913
920
NSNumber *key = [NSNumber numberWithInt: [self collapsibleSubviewIndex ]];
914
921
NSView *subview = [self collapsibleSubview ];
@@ -1070,8 +1077,8 @@ - (void)resizeAndAdjustSubviews;
1070
1077
// TODO: Could add a special case for resizableSubviewsTotalAvailableSize <= 0 : just set all resizable subviews to minimum size
1071
1078
1072
1079
// Make array of all the resizable subviews indexes
1073
- NSMutableArray *resizableSubviewIndexes = [[[ resizableSubviewPreferredProportion allKeys ] mutableCopy ] autorelease ];
1074
- [resizableSubviewIndexes sortUsingDescriptors: [NSArray arrayWithObject: [[[ NSSortDescriptor alloc ] initWithKey: @" self" ascending: YES ] autorelease ]]];
1080
+ NSMutableArray *resizableSubviewIndexes = [[resizableSubviewPreferredProportion allKeys ] mutableCopy ];
1081
+ [resizableSubviewIndexes sortUsingDescriptors: [NSArray arrayWithObject: [[NSSortDescriptor alloc ] initWithKey: @" self" ascending: YES ]]];
1075
1082
1076
1083
// Loop until none of the resizable subviews' constraints are violated
1077
1084
CGFloat proportionTotal = 1 ;
@@ -1176,8 +1183,8 @@ - (void)resizeAndAdjustSubviews;
1176
1183
if (RESIZE_DEBUG_LOGS) NSLog (@" newSubviewSizes after nonresizable proportional resizing: %@ " , newSubviewSizes);
1177
1184
1178
1185
// Make array of all the non-resizable subviews indexes
1179
- NSMutableArray *nonresizableSubviewIndexes = [[[ nonresizableSubviewPreferredSize allKeys ] mutableCopy ] autorelease ];
1180
- [nonresizableSubviewIndexes sortUsingDescriptors: [NSArray arrayWithObject: [[[ NSSortDescriptor alloc ] initWithKey: @" self" ascending: YES ] autorelease ]]];
1186
+ NSMutableArray *nonresizableSubviewIndexes = [[nonresizableSubviewPreferredSize allKeys ] mutableCopy ];
1187
+ [nonresizableSubviewIndexes sortUsingDescriptors: [NSArray arrayWithObject: [[NSSortDescriptor alloc ] initWithKey: @" self" ascending: YES ]]];
1181
1188
1182
1189
// Loop until none of the non-resizable subviews' constraints are violated
1183
1190
CGFloat proportionTotal = 1 ;
@@ -1369,7 +1376,6 @@ - (void)setColor:(NSColor *)aColor
1369
1376
{
1370
1377
if (color != aColor)
1371
1378
{
1372
- [color release ];
1373
1379
color = [aColor copy ];
1374
1380
}
1375
1381
@@ -1379,56 +1385,42 @@ - (void)setColor:(NSColor *)aColor
1379
1385
- (NSColor *)color
1380
1386
{
1381
1387
if (color == nil )
1382
- color = [[ NSColor blackColor ] retain ];
1388
+ color = [NSColor blackColor ];
1383
1389
1384
- return [[ color retain ] autorelease ] ;
1390
+ return color;
1385
1391
}
1386
1392
1387
1393
- (NSMutableDictionary *)minValues
1388
1394
{
1389
1395
if (minValues == nil )
1390
1396
minValues = [NSMutableDictionary new ];
1391
1397
1392
- return [[ minValues retain ] autorelease ] ;
1398
+ return minValues;
1393
1399
}
1394
1400
1395
1401
- (NSMutableDictionary *)maxValues
1396
1402
{
1397
1403
if (maxValues == nil )
1398
1404
maxValues = [NSMutableDictionary new ];
1399
1405
1400
- return [[ maxValues retain ] autorelease ] ;
1406
+ return maxValues;
1401
1407
}
1402
1408
1403
1409
- (NSMutableDictionary *)minUnits
1404
1410
{
1405
1411
if (minUnits == nil )
1406
1412
minUnits = [NSMutableDictionary new ];
1407
1413
1408
- return [[ minUnits retain ] autorelease ] ;
1414
+ return minUnits;
1409
1415
}
1410
1416
1411
1417
- (NSMutableDictionary *)maxUnits
1412
1418
{
1413
1419
if (maxUnits == nil )
1414
1420
maxUnits = [NSMutableDictionary new ];
1415
1421
1416
- return [[ maxUnits retain ] autorelease ] ;
1422
+ return maxUnits;
1417
1423
}
1418
1424
1419
- - (void )dealloc
1420
- {
1421
- [color release ];
1422
- [minValues release ];
1423
- [maxValues release ];
1424
- [minUnits release ];
1425
- [maxUnits release ];
1426
- [resizableSubviewPreferredProportion release ];
1427
- [nonresizableSubviewPreferredSize release ];
1428
- [toggleCollapseButton release ];
1429
- [stateForLastPreferredCalculations release ];
1430
-
1431
- [super dealloc ];
1432
- }
1433
1425
1434
1426
@end
0 commit comments