diff options
author | dmaclach <dmaclach@google.com> | 2016-10-07 12:10:23 -0400 |
---|---|---|
committer | Thomas Van Lenten <thomasvl@google.com> | 2016-10-07 12:21:06 -0400 |
commit | 42124b3691197c3c4f52f069775fa0390a8ff942 (patch) | |
tree | ebd373d398ea64b45bdc1d196fa0a2c5f57cabfd /AppKit/GTMUILocalizerAndLayoutTweaker.m | |
parent | 57eeab4193210df8ab0c81e9d3f1ee1ad3e24492 (diff) |
First cut at pruning things/updating things.
Remove a bunch of code that Google stopped using/maintaining rather than trying
to update it it. Some would be hard to update, some actually has system provided
replacements; others are patterns that just don't seem as common now.
Prune out the code related to macOS <= 10.5, start pruning some of the really
old iOS support also.
Get the projects mostly limping again with modern Xcodes so tests can be run.
If someone ends up on this commit via history for something they still find
as useful, feel free to do a pull request to bring the snippet of code back to
life and update it for current SDKs.
Diffstat (limited to 'AppKit/GTMUILocalizerAndLayoutTweaker.m')
-rw-r--r-- | AppKit/GTMUILocalizerAndLayoutTweaker.m | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/AppKit/GTMUILocalizerAndLayoutTweaker.m b/AppKit/GTMUILocalizerAndLayoutTweaker.m index 14876dc..be7b325 100644 --- a/AppKit/GTMUILocalizerAndLayoutTweaker.m +++ b/AppKit/GTMUILocalizerAndLayoutTweaker.m @@ -144,14 +144,14 @@ static const CGFloat kWrapperStringSlop = 0.9; } else if ([view isKindOfClass:[NSTabView class]]) { NSArray *tabViewItems = [(NSTabView *)view tabViewItems]; NSTabViewItem *item = nil; - GTM_FOREACH_OBJECT(item, tabViewItems) { + for (item in tabViewItems) { [self tweakView:[item view]]; } // Generically look for subviews... } else { NSArray *subviews = [view subviews]; NSView *subview = nil; - GTM_FOREACH_OBJECT(subview, subviews) { + for (subview in subviews) { [self tweakView:subview]; } } @@ -175,6 +175,10 @@ static const CGFloat kWrapperStringSlop = 0.9; // fragments to get the same wrapping as what the NSCell will do in the end. [textContainer setLineFragmentPadding:2.0f]; + if (font == NULL) { + // If the font is NULL, it is the System font. + font = [NSFont systemFontOfSize:[NSFont systemFontSize]]; + } // Apply the font. [textStorage setFont:font]; @@ -343,7 +347,7 @@ static const CGFloat kWrapperStringSlop = 0.9; NSFont *font = [radioGroup font]; NSCell *cell; - GTM_FOREACH_OBJECT(cell, [radioGroup cells]) { + for (cell in [radioGroup cells]) { NSRect titleFrame = [cell titleRectForBounds:tmpRect]; NSString* newTitle = [self wrapString:[cell title] width:NSWidth(titleFrame) @@ -437,7 +441,7 @@ static const CGFloat kWrapperStringSlop = 0.9; NSView *subView; CGFloat finalDelta = sumMode ? 0 : -CGFLOAT_MAX; NSPoint subViewOffset = NSZeroPoint; - GTM_FOREACH_OBJECT(subView, subviews) { + for (subView in subviews) { if (sumMode) { subViewOffset.x = finalDelta; } @@ -580,7 +584,7 @@ static NSSize SizeToFit(NSView *view, NSPoint offset) { NSMatrix *matrix = (NSMatrix *)view; // See note on kWrapperStringSlop for why this is done. NSCell *cell; - GTM_FOREACH_OBJECT(cell, [matrix cells]) { + for (cell in [matrix cells]) { if ([[cell title] rangeOfString:kForcedWrapString].location != NSNotFound) { newFrame.size.width += kWrapperStringSlop; |