Permalink
Browse files

Removed unused codepaths

UIViews are always "layer backed" so testing for the existence of the
layer is not required on iOS.
  • Loading branch information...
1 parent 02883f8 commit 1bb3a43dc59a7b3aeac4ffccc83b83d77a012d1c @epreston committed Dec 16, 2011
@@ -62,7 +62,10 @@ - (void) viewDidLoad
[self.treeGraphView setNodeViewNibName:@"ObjCClassTreeNodeView"];
// Specify a starting root class to inspect on launch.
+
[self setRootClassName:@"UIControl"];
+
+ // [self setRootClassName:@"CAAnimation"];
}
@@ -10,42 +10,46 @@
#import "PSTreeGraphModelNode.h"
-// Wraps an Objective-C Class in an NSObject, that we can conveninently query to find
-// related classes (superclass and subclasses) and the instance size. Conforms to
-// the PSTreeGraphModelNode protocol, so that we can use these as model nodes with a TreeGraph.
+/// Wraps an Objective-C Class in an NSObject, that we can conveninently query to find
+/// related classes (superclass and subclasses) and the instance size. Conforms to
+/// the PSTreeGraphModelNode protocol, so that we can use these as model nodes with a TreeGraph.
@interface ObjCClassWrapper : NSObject <PSTreeGraphModelNode, NSCopying>
#pragma mark - Creating Instances
-// Returns an ObjCClassWrapper for the given Objective-C class. ObjCClassWrapper maintains
-// a set of unique instances, so this will always return the same ObjCClassWrapper for a given Class.
+/// Returns an ObjCClassWrapper for the given Objective-C class. ObjCClassWrapper maintains
+/// a set of unique instances, so this will always return the same ObjCClassWrapper for a given Class.
+ (ObjCClassWrapper *) wrapperForClass:(Class)aClass;
-// Returns an ObjCClassWrapper for the given Objective-C class, by looking the Class up by
-// name and then invoking +wrapperForClass:
+
+/// Returns an ObjCClassWrapper for the given Objective-C class, by looking the Class up by
+/// name and then invoking +wrapperForClass:
+ (ObjCClassWrapper *) wrapperForClassNamed:(NSString *)aClassName;
#pragma mark - Property Accessors
-// The wrappedClass' name (e.g. @"UIButton" or @"CALayer")
+/// The wrappedClass' name (e.g. @"UIControl" or @"CALayer" or "CAAnimation")
@property (nonatomic, readonly) NSString *name;
-// An ObjCClassWrapper representing the wrappedClass' superclass.
+
+/// An ObjCClassWrapper representing the wrappedClass' superclass.
@property (nonatomic, readonly) ObjCClassWrapper *superclassWrapper;
-// An array of ObjCClassWrappers representing the wrappedClass' subclasses.
-// (For convenience, the subclasses are sorted by name.)
+
+/// An array of ObjCClassWrappers representing the wrappedClass' subclasses.
+/// (For convenience, the subclasses are sorted by name.)
@property (nonatomic, readonly) NSArray *subclasses;
-// The wrappedClass' intrinsic instance size (which doesn't include external/auxiliary storage).
+
+/// The wrappedClass' intrinsic instance size (which doesn't include external/auxiliary storage).
@property (nonatomic, readonly) size_t wrappedClassInstanceSize;
@@ -257,7 +257,6 @@ - (void) drawRect:(CGRect)dirtyRect
[[treeGraph connectingLineColor] set];
[path setLineWidth:[treeGraph connectingLineWidth]];
[path stroke];
-
}
@end
@@ -17,6 +17,8 @@
#import <QuartzCore/QuartzCore.h>
+#pragma mark - Internal Interface
+
@interface PSBaseLeafView ()
{
@@ -113,40 +115,37 @@ - (void) setShowingSelected:(BOOL)newShowingSelected
- (void) updateLayerAppearanceToMatchContainerView
{
- CALayer *layer = [self layer];
- if (layer) {
-
- // Disable implicit animations during these layer property changes, to make them take effect immediately.
-
- // BOOL actionsWereDisabled = [CATransaction disableActions];
- // [CATransaction setDisableActions:YES];
+ // // Disable implicit animations during these layer property changes, to make them take effect immediately.
- // Apply the ContainerView's appearance properties to its backing layer.
- // Important: While UIView metrics are conventionally expressed in points, CALayer metrics are
- // expressed in pixels. To produce the correct borderWidth and cornerRadius to apply to the
- // layer, we must multiply by the window's userSpaceScaleFactor (which is normally 1.0, but may
- // be larger on a higher-resolution display) to yield pixel units.
+ // BOOL actionsWereDisabled = [CATransaction disableActions];
+ // [CATransaction setDisableActions:YES];
- // CGFloat scaleFactor = [[self window] userSpaceScaleFactor];
- CGFloat scaleFactor = 1.0f;
+ // Apply the ContainerView's appearance properties to its backing layer.
+ // Important: While UIView metrics are conventionally expressed in points, CALayer metrics are
+ // expressed in pixels. To produce the correct borderWidth and cornerRadius to apply to the
+ // layer, we must multiply by the window's userSpaceScaleFactor (which is normally 1.0, but may
+ // be larger on a higher-resolution display) to yield pixel units.
- [layer setBorderWidth:(borderWidth_ * scaleFactor)];
- if (borderWidth_ > 0.0f) {
- [layer setBorderColor:[borderColor_ CGColor]];
- }
+ // CGFloat scaleFactor = [[self window] userSpaceScaleFactor];
+ CGFloat scaleFactor = 1.0f;
+
+ CALayer *layer = [self layer];
- [layer setCornerRadius:(cornerRadius_ * scaleFactor)];
+ [layer setBorderWidth:(borderWidth_ * scaleFactor)];
+ if (borderWidth_ > 0.0f) {
+ [layer setBorderColor:[borderColor_ CGColor]];
+ }
- if ( showingSelected_ ) {
- [layer setBackgroundColor:[[self selectionColor] CGColor] ];
- } else {
- [layer setBackgroundColor:[[self fillColor] CGColor] ];
- }
+ [layer setCornerRadius:(cornerRadius_ * scaleFactor)];
- // [CATransaction setDisableActions:actionsWereDisabled];
+ if ( showingSelected_ ) {
+ [layer setBackgroundColor:[[self selectionColor] CGColor] ];
} else {
- [self setNeedsDisplay];
+ [layer setBackgroundColor:[[self fillColor] CGColor] ];
}
+
+ // // Disable implicit animations during these layer property changes
+ // [CATransaction setDisableActions:actionsWereDisabled];
}
@@ -34,6 +34,8 @@ static CGFloat subtreeBorderWidth(void)
}
+#pragma mark - Internal Interface
+
@interface PSBaseSubtreeView ()
{
@@ -478,27 +480,29 @@ - (CGSize) layoutCollapsedGraph
- (void) updateSubtreeBorder
{
+ // // Disable implicit animations during these layer property changes, to make them take effect immediately.
+ // BOOL actionsWereDisabled = [CATransaction disableActions];
+ // [CATransaction setDisableActions:YES];
+
+ // If the enclosing TreeGraph has its "showsSubtreeFrames" debug feature enabled,
+ // configure the backing layer to draw its border programmatically. This is much more efficient
+ // than allocating a backing store for each SubtreeView's backing layer, only to stroke a simple
+ // rectangle into that backing store.
+
CALayer *layer = [self layer];
- if (layer) {
- // Disable implicit animations during these layer property changes, to make them take effect immediately.
- // BOOL actionsWereDisabled = [CATransaction disableActions];
- // [CATransaction setDisableActions:YES];
-
- // If the enclosing TreeGraph has its "showsSubtreeFrames" debug feature enabled,
- // configure the backing layer to draw its border programmatically. This is much more efficient
- // than allocating a backing store for each SubtreeView's backing layer, only to stroke a simple
- // rectangle into that backing store.
-
- PSBaseTreeGraphView *treeGraph = [self enclosingTreeGraph];
- if ([treeGraph showsSubtreeFrames]) {
- [layer setBorderWidth:subtreeBorderWidth()];
- [layer setBorderColor:[subtreeBorderColor() CGColor]];
- } else {
- [layer setBorderWidth:0.0];
- }
- // [CATransaction setDisableActions:actionsWereDisabled];
+ PSBaseTreeGraphView *treeGraph = [self enclosingTreeGraph];
+
+ if ([treeGraph showsSubtreeFrames]) {
+ [layer setBorderWidth:subtreeBorderWidth()];
+ [layer setBorderColor:[subtreeBorderColor() CGColor]];
+ } else {
+ [layer setBorderWidth:0.0];
}
+
+ // // Disable implicit animations during these layer property changes
+ // [CATransaction setDisableActions:actionsWereDisabled];
+
}
@@ -520,21 +524,17 @@ - (void) recursiveSetConnectorsViewsNeedDisplay
- (void) resursiveSetSubtreeBordersNeedDisplay
{
- if ( [self layer] ) {
- // We only need this if layer-backed. When we have a backing layer, we use the
- // layer's "border" properties to draw the subtree debug border.
+ // We only need this if layer-backed. When we have a backing layer, we use the
+ // layer's "border" properties to draw the subtree debug border.
- [self updateSubtreeBorder];
+ [self updateSubtreeBorder];
- // Recurse for descendant SubtreeViews.
- NSArray *subviews = [self subviews];
- for (UIView *subview in subviews) {
- if ([subview isKindOfClass:[PSBaseSubtreeView class]]) {
- [(PSBaseSubtreeView *)subview updateSubtreeBorder];
- }
+ // Recurse for descendant SubtreeViews.
+ NSArray *subviews = [self subviews];
+ for (UIView *subview in subviews) {
+ if ([subview isKindOfClass:[PSBaseSubtreeView class]]) {
+ [(PSBaseSubtreeView *)subview updateSubtreeBorder];
}
- } else {
- [self setNeedsDisplay];
}
}
@@ -22,6 +22,8 @@
#import <QuartzCore/QuartzCore.h>
+#pragma mark - Internal Interface
+
@interface PSBaseTreeGraphView ()
{
@@ -117,7 +119,6 @@ - (void) setContentMargin:(CGFloat)newContentMargin
if (contentMargin_ != newContentMargin) {
contentMargin_ = newContentMargin;
[self setNeedsGraphLayout];
- [[self layer] displayIfNeeded];
}
}
@@ -128,7 +129,6 @@ - (void) setParentChildSpacing:(CGFloat)newParentChildSpacing
if (parentChildSpacing_ != newParentChildSpacing) {
parentChildSpacing_ = newParentChildSpacing;
[self setNeedsGraphLayout];
- [[self layer] displayIfNeeded];
}
}
@@ -139,7 +139,6 @@ - (void) setSiblingSpacing:(CGFloat)newSiblingSpacing
if (siblingSpacing_ != newSiblingSpacing) {
siblingSpacing_ = newSiblingSpacing;
[self setNeedsGraphLayout];
- [[self layer] displayIfNeeded];
}
}
@@ -226,8 +225,6 @@ - (void) configureDetaults
if (inputView_ == nil) {
inputView_ = [[UIView alloc] initWithFrame:CGRectZero];
}
-
- // [self setLayerContentsRedrawPolicy:UIViewLayerContentsRedrawNever];
}

0 comments on commit 1bb3a43

Please sign in to comment.