Skip to content
Browse files

Minor source formatting.

Modified some comments and pragma statements.
  • Loading branch information...
1 parent ab2419f commit 347003d5c28c2b81619ac0db99ac0f2ffe555592 @epreston committed Aug 19, 2011
View
6 Example 1/Classes/Controller/PSHTreeGraphAppDelegate.m
@@ -16,8 +16,7 @@ @implementation PSHTreeGraphAppDelegate
@synthesize viewController;
-#pragma mark -
-#pragma mark Application Lifecycle
+#pragma mark - Application Lifecycle
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
@@ -51,8 +50,7 @@ - (void)applicationWillTerminate:(UIApplication *)application {
}
-#pragma mark -
-#pragma mark Memory Management
+#pragma mark - Memory Management
- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application {
// Free up as much memory as possible by purging cached data objects that can be recreated
View
13 Example 1/Classes/Controller/PSHTreeGraphViewController.m
@@ -14,11 +14,11 @@
#import "ObjCClassWrapper.h"
+
@implementation PSHTreeGraphViewController
-#pragma mark -
-#pragma mark Property Accessors
+#pragma mark - Property Accessors
@synthesize treeGraphView;
@@ -40,8 +40,7 @@ - (void)setRootClassName:(NSString *)newRootClassName {
}
-#pragma mark -
-#pragma mark View Creation and Initializer
+#pragma mark - View Creation and Initializer
// The designated initializer. Override to perform setup that is required before the view is loaded.
//- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
@@ -85,8 +84,7 @@ - (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interf
}
-#pragma mark -
-#pragma mark TreeGraph Delegate
+#pragma mark - TreeGraph Delegate
-(void) configureNodeView:(UIView *)nodeView
withModelNode:(id <PSTreeGraphModelNode> )modelNode {
@@ -110,8 +108,7 @@ -(void) configureNodeView:(UIView *)nodeView
}
-#pragma mark -
-#pragma mark Memory Management
+#pragma mark - Memory Management
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
View
6 Example 1/Classes/Model/ObjCClass/ObjCClassWrapper.h
@@ -21,8 +21,7 @@
}
-#pragma mark -
-#pragma mark Creating Instances
+#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.
@@ -35,8 +34,7 @@
+ (ObjCClassWrapper *)wrapperForClassNamed:(NSString *)aClassName;
-#pragma mark -
-#pragma mark Property Accessors
+#pragma mark - Property Accessors
// The wrappedClass' name (e.g. @"UIButton")
View
12 Example 1/Classes/Model/ObjCClass/ObjCClassWrapper.m
@@ -31,8 +31,7 @@ - (id)copyWithZone:(NSZone *)zone {
}
-#pragma mark -
-#pragma mark Creating Instances
+#pragma mark - Creating Instances
- initWithWrappedClass:(Class)aClass {
self = [super init];
@@ -64,8 +63,7 @@ + (ObjCClassWrapper *)wrapperForClassNamed:(NSString *)aClassName {
}
-#pragma mark -
-#pragma mark Property Accessors
+#pragma mark - Property Accessors
- (NSString *)name {
return NSStringFromClass(wrappedClass);
@@ -115,8 +113,7 @@ - (NSArray *)subclasses {
}
-#pragma mark -
-#pragma mark TreeGraphModelNode Protocol Conformance
+#pragma mark - TreeGraphModelNode Protocol
- (id <PSTreeGraphModelNode> )parentModelNode {
return [self superclassWrapper];
@@ -127,8 +124,7 @@ - (NSArray *)childModelNodes {
}
-#pragma mark -
-#pragma mark Memory Management
+#pragma mark - Memory Management
- (void)dealloc {
[subclassesCache release];
View
3 PSTreeGraphView/PSBaseBranchView.m
@@ -32,8 +32,7 @@ - (PSBaseTreeGraphView *)enclosingTreeGraph {
}
-#pragma mark -
-#pragma mark Path Drawing
+#pragma mark - Drawing
- (UIBezierPath *)directConnectionsPath {
CGRect bounds = [self bounds];
View
6 PSTreeGraphView/PSBaseLeafView.h
@@ -32,8 +32,7 @@
}
-#pragma mark -
-#pragma mark Styling
+#pragma mark - Styling
//The color of the ContainerView's stroked border.
@property(copy) UIColor *borderColor;
@@ -48,8 +47,7 @@
@property(copy) UIColor *fillColor;
-#pragma mark -
-#pragma mark Selection State
+#pragma mark - Selection State
@property BOOL showingSelected;
View
18 PSTreeGraphView/PSBaseLeafView.m
@@ -22,8 +22,7 @@
@implementation PSBaseLeafView
-#pragma mark -
-#pragma mark Update Layer
+#pragma mark - Update Layer
- (void)updateLayerAppearanceToMatchContainerView {
CALayer *layer = [self layer];
@@ -64,8 +63,7 @@ - (void)updateLayerAppearanceToMatchContainerView {
}
-#pragma mark -
-#pragma mark Initialization
+#pragma mark - Initialization
- (void)configureDetaults {
// Initialize ivars directly. As a rule, it's best to avoid invoking accessors from an -init...
@@ -94,8 +92,7 @@ - (void)awakeFromNib {
}
-#pragma mark -
-#pragma mark Drawing
+#pragma mark - Drawing
// Since we set each ContainerView's layerContentsRedrawPolicy to UIViewLayerContentsRedrawNever,
// this -drawRect: method will only be invoked if the ContainerView is window-backed. If the
@@ -129,8 +126,7 @@ - (void)awakeFromNib {
//}
-#pragma mark -
-#pragma mark Styling
+#pragma mark - Styling
- (UIColor *)borderColor {
return borderColor;
@@ -179,8 +175,7 @@ - (void)setFillColor:(UIColor *)color {
}
-#pragma mark -
-#pragma mark Selection State
+#pragma mark - Selection State
- (BOOL)showingSelected {
return showingSelected;
@@ -194,8 +189,7 @@ - (void)setShowingSelected:(BOOL)newShowingSelected {
}
-#pragma mark -
-#pragma mark Memory Management
+#pragma mark - Memory Management
- (void)dealloc {
[borderColor release];
View
10 PSTreeGraphView/PSBaseSubtreeView.h
@@ -67,15 +67,15 @@
@property(readonly,getter=isLeaf) BOOL leaf;
-#pragma mark Selection State
+#pragma mark - Selection State
// Whether the node is part of the TreeGraph's current selection. This can be a useful property to bind user
// interface state to.
@property(readonly) BOOL nodeIsSelected;
-#pragma mark Layout
+#pragma mark - Layout
//Returns YES if this subtree needs relayout.
@@ -108,7 +108,7 @@
- (IBAction)toggleExpansion:(id)sender;
-#pragma mark Invalidation
+#pragma mark - Invalidation
//Marks all BranchView instances in this subtree as needing display.
@@ -119,7 +119,7 @@
- (void)resursiveSetSubtreeBordersNeedDisplay;
-#pragma mark Node Hit-Testing
+#pragma mark - Node Hit-Testing
// Returns the visible model node whose nodeView contains the given point "p", where "p" is specified in the
// SubtreeView's interior (bounds) coordinate space. Returns nil if there is no node under the specified point.
@@ -133,7 +133,7 @@
- ( id <PSTreeGraphModelNode> )modelNodeClosestToY:(CGFloat)y;
-#pragma mark Debugging
+#pragma mark - Debugging
//Returns an indented multi-line NSString summary of the displayed tree. Provided as a debugging aid.
View
79 PSTreeGraphView/PSBaseSubtreeView.m
@@ -35,8 +35,7 @@ static CGFloat subtreeBorderWidth(void) {
@implementation PSBaseSubtreeView
-#pragma mark -
-#pragma mark Attributes
+#pragma mark - Attributes
@synthesize modelNode;
@synthesize nodeView;
@@ -47,8 +46,7 @@ - (BOOL)isLeaf {
}
-#pragma mark -
-#pragma mark Instance Initialization
+#pragma mark - Instance Initialization
- initWithModelNode:(id <PSTreeGraphModelNode> )newModelNode {
@@ -93,36 +91,7 @@ - (PSBaseTreeGraphView *)enclosingTreeGraph {
}
-#pragma mark -
-#pragma mark Optimizations for Layer-Backed Mode
-
-- (void)updateSubtreeBorder {
- 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];
- }
-}
-
-
-#pragma mark -
-#pragma mark Layout
+#pragma mark - Layout
- (BOOL)needsGraphLayout {
return needsGraphLayout;
@@ -453,8 +422,7 @@ - (IBAction)toggleExpansion:(id)sender {
}
-#pragma mark -
-#pragma mark Drawing
+#pragma mark - Drawing
//- (void)drawRect:(CGRect)dirtyRect {
//
@@ -475,9 +443,32 @@ - (IBAction)toggleExpansion:(id)sender {
// }
//}
+- (void)updateSubtreeBorder {
+ 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];
+ }
+}
+
-#pragma mark -
-#pragma mark Invalidation
+#pragma mark - Invalidation
- (void)recursiveSetConnectorsViewsNeedDisplay {
@@ -513,16 +504,14 @@ - (void)resursiveSetSubtreeBordersNeedDisplay {
}
-#pragma mark -
-#pragma mark Selection State
+#pragma mark - Selection State
- (BOOL)nodeIsSelected {
return [[[self enclosingTreeGraph] selectedModelNodes] containsObject:[self modelNode]];
}
-#pragma mark -
-#pragma mark Node Hit-Testing
+#pragma mark - Node Hit-Testing
- (id <PSTreeGraphModelNode> )modelNodeAtPoint:(CGPoint)p {
@@ -586,8 +575,7 @@ - (BOOL)nodeIsSelected {
}
-#pragma mark -
-#pragma mark Debugging
+#pragma mark - Debugging
- (NSString *)description {
return [NSString stringWithFormat:@"SubtreeView<%@>", [modelNode description]];
@@ -615,8 +603,7 @@ - (NSString *)treeSummaryWithDepth:(NSInteger)depth {
}
-#pragma mark -
-#pragma mark Memory Management
+#pragma mark - Memory Management
- (void)dealloc {
// [nodeView release]; // not retained, since an IBOutlet
View
39 PSTreeGraphView/PSBaseTreeGraphView.h
@@ -94,22 +94,19 @@ typedef NSInteger PSTreeGraphOrientationStyle;
}
-#pragma mark -
-#pragma mark Delegate
+#pragma mark - Delegate
@property (nonatomic, assign) id delegate;
-#pragma mark -
-#pragma mark Parent Resize Notification
+#pragma mark - Parent Resize Notification
// Use this method to keep the view in sync for now.
- (void)parentClipViewDidResize:(id)object;
-#pragma mark -
-#pragma mark Creating Instances
+#pragma mark - Creating Instances
// Initializes a new TreeGraph instance. (TreeGraph's designated initializer is the same as
// UIView's: -initWithFrame:.) The TreeGraph has default appearance properties and layout
@@ -119,8 +116,7 @@ typedef NSInteger PSTreeGraphOrientationStyle;
- (id)initWithFrame:(CGRect)frame;
-#pragma mark -
-#pragma mark Connection to Model
+#pragma mark - Connection to Model
// The root of the model node tree that the TreeGraph is being asked to display. (The modelRoot
// may have ancestor nodes, but TreeGraph will ignore them and treat modelRoot as the root.) May
@@ -132,8 +128,7 @@ typedef NSInteger PSTreeGraphOrientationStyle;
@property(retain) id <PSTreeGraphModelNode> modelRoot;
-#pragma mark -
-#pragma mark Root SubtreeView Access
+#pragma mark - Root SubtreeView Access
// A TreeGraph builds the tree it displays using recursively nested SubtreeView instances. This
// read-only accessor provides a way to get the rootmost SubtreeView (the one that corresponds
@@ -142,8 +137,7 @@ typedef NSInteger PSTreeGraphOrientationStyle;
@property(readonly) PSBaseSubtreeView *rootSubtreeView;
-#pragma mark -
-#pragma mark Node View Nib Specification
+#pragma mark - Node View Nib Specification
// The name of the .nib file from which to instantiate node views. (This API design assumes that
// all node views should be instantiated from the same .nib. If a tree of heterogeneous nodes
@@ -160,8 +154,7 @@ typedef NSInteger PSTreeGraphOrientationStyle;
@property(retain) NSBundle *nodeViewNibBundle;
-#pragma mark -
-#pragma mark Selection State
+#pragma mark - Selection State
// The unordered set of model nodes that are currently selected in the TreeGraph. When no nodes
// are selected, this is an empty NSSet. It will never be nil (and attempting to set it to nil
@@ -181,8 +174,7 @@ typedef NSInteger PSTreeGraphOrientationStyle;
@property(readonly) CGRect selectionBounds;
-#pragma mark -
-#pragma mark Node Hit-Testing
+#pragma mark - Node Hit-Testing
// Returns the model node under the given point, which must be expressed in the TreeGraph's
// interior (bounds) coordinate space. If there is a collapsed subtree at the given point,
@@ -192,8 +184,7 @@ typedef NSInteger PSTreeGraphOrientationStyle;
- (id <PSTreeGraphModelNode> )modelNodeAtPoint:(CGPoint)p;
-#pragma mark -
-#pragma mark Sizing and Layout
+#pragma mark - Sizing and Layout
// A TreeGraph's minimumFrameSize is the size needed to accommodate its content (as currently
// laid out) and margins. Changes to the TreeGraph's content, layout, or margins will update
@@ -248,8 +239,7 @@ typedef NSInteger PSTreeGraphOrientationStyle;
- (CGRect)boundsOfModelNodes:(NSSet *)modelNodes;
-#pragma mark -
-#pragma mark Scrolling
+#pragma mark - Scrolling
// Does a [self scrollRectToVisible:] with the bounding box of the specified model nodes.
@@ -260,8 +250,7 @@ typedef NSInteger PSTreeGraphOrientationStyle;
- (void)scrollSelectedModelNodesToVisible;
-#pragma mark -
-#pragma mark Animation Support
+#pragma mark - Animation Support
// Whether the TreeGraph animates layout operations. Defaults to YES. If set to NO, layout
// jumpst instantaneously to the tree's new state.
@@ -274,8 +263,7 @@ typedef NSInteger PSTreeGraphOrientationStyle;
@property BOOL layoutAnimationSuppressed;
-#pragma mark -
-#pragma mark Layout Metrics
+#pragma mark - Layout Metrics
// The amount of padding to leave between the displayed tree and each of the four edges of the
// TreeGraph's bounds.
@@ -291,8 +279,7 @@ typedef NSInteger PSTreeGraphOrientationStyle;
@property CGFloat siblingSpacing;
-#pragma mark -
-#pragma mark Styling
+#pragma mark - Styling
// The fill color for the TreeGraph's content area.
View
54 PSTreeGraphView/PSBaseTreeGraphView.m
@@ -31,8 +31,7 @@ @implementation PSBaseTreeGraphView
@synthesize minimumFrameSize;
-#pragma mark -
-#pragma mark Creating Instances
+#pragma mark - Creating Instances
- (void)configureDetaults {
@@ -74,16 +73,14 @@ - (void)awakeFromNib {
}
-#pragma mark -
-#pragma mark Root SubtreeView Access
+#pragma mark - Root SubtreeView Access
- (PSBaseSubtreeView *)rootSubtreeView {
return [self subtreeViewForModelNode:[self modelRoot]];
}
-#pragma mark -
-#pragma mark Node View Nib Specification
+#pragma mark - Node View Nib Specification
- (NSString *)nodeViewNibName {
return nodeViewNibName;
@@ -120,8 +117,7 @@ - (void)setNodeViewNibBundle:(NSBundle *)newBundle {
}
-#pragma mark -
-#pragma mark Node View Nib Caching
+#pragma mark - Node View Nib Caching
// iOS 4.0 and above ONLY
@@ -137,8 +133,7 @@ - (void)setNodeViewNibBundle:(NSBundle *)newBundle {
//}
-#pragma mark -
-#pragma mark Selection State
+#pragma mark - Selection State
// The unordered set of model nodes that are currently selected in the TreeGraph. When
// no nodes are selected, this is an empty NSSet. It will never be nil (and attempting
@@ -204,8 +199,7 @@ - (CGRect)selectionBounds {
}
-#pragma mark -
-#pragma mark Graph Building
+#pragma mark - Graph Building
- (PSBaseSubtreeView *)newGraphForModelNode:(id <PSTreeGraphModelNode> )modelNode {
@@ -292,8 +286,7 @@ - (void)buildGraph {
}
-#pragma mark -
-#pragma mark Layout
+#pragma mark - Layout
- (void)updateFrameSizeForContentAndClipView {
CGSize newFrameSize;
@@ -478,8 +471,7 @@ - (CGRect)boundsOfModelNodes:(NSSet *)modelNodes {
}
-#pragma mark -
-#pragma mark Scrolling
+#pragma mark - Scrolling
- (void)scrollModelNodesToVisible:(NSSet *)modelNodes {
CGRect targetRect = [self boundsOfModelNodes:modelNodes];
@@ -500,8 +492,7 @@ - (void)scrollSelectedModelNodesToVisible {
}
-#pragma mark -
-#pragma mark Drawing
+#pragma mark - Drawing
// TreeGraph always completely fills its bounds with its backgroundColor, so as long
// as the TreeGraph's backgroundColor is opaque, the TreeGraph can be considered opaque.
@@ -524,8 +515,7 @@ - (void)scrollSelectedModelNodesToVisible {
//}
-#pragma mark -
-#pragma mark Data Source
+#pragma mark - Data Source
- (id <PSTreeGraphModelNode> )modelRoot {
return modelRoot;
@@ -561,8 +551,7 @@ - (void)setModelRoot:(id <PSTreeGraphModelNode> )newModelRoot {
}
-#pragma mark -
-#pragma mark Node Hit-Testing
+#pragma mark - Node Hit-Testing
// Returns the model node under the given point, which must be expressed in the TreeGraph's interior (bounds)
// coordinate space. If there is a collapsed subtree at the given point, returns the model node at the root
@@ -584,8 +573,7 @@ - (void)setModelRoot:(id <PSTreeGraphModelNode> )newModelRoot {
}
-#pragma mark -
-#pragma mark Key Event Handling
+#pragma mark - Key Event Handling
// Make TreeGraphs able to -becomeFirstResponder, so they can receive key events.
@@ -682,8 +670,7 @@ - (void)moveRight:(id)sender {
//}
-#pragma mark -
-#pragma mark Mouse Event Handling
+#pragma mark - Mouse Event Handling
// Always receive -mouseDown: messages for clicks that occur in a TreeGraph, even if the click
// is one that's activating the window. This lets the user start interacting with the TreeGraph's
@@ -715,8 +702,7 @@ - (void)moveRight:(id)sender {
//}
-#pragma mark -
-#pragma mark Gesture Event Handling
+#pragma mark - Gesture Event Handling
//- (void)beginGestureWithEvent:(NSEvent *)event {
// // Temporarily suspend layout animations during handling of a gesture sequence.
@@ -750,8 +736,7 @@ - (void)moveRight:(id)sender {
//}
-#pragma mark -
-#pragma mark Styling
+#pragma mark - Styling
// Getters and setters for TreeGraph's appearance-related properties: colors, metrics, etc. We could almost
// auto-generate these using "@synthesize", but we want each setter to automatically mark the affected parts
@@ -868,8 +853,7 @@ - (void)setShowsSubtreeFrames:(BOOL)newShowsSubtreeFrames {
@implementation PSBaseTreeGraphView (Internal)
-#pragma mark -
-#pragma mark ModelNode -> SubtreeView Relationship Management
+#pragma mark - ModelNode -> SubtreeView Relationship Management
- (PSBaseSubtreeView *)subtreeViewForModelNode:(id)modelNode {
return [modelNodeToSubtreeViewMapTable objectForKey:modelNode];
@@ -880,8 +864,7 @@ - (void)setSubtreeView:(PSBaseSubtreeView *)subtreeView forModelNode:(id)modelNo
}
-#pragma mark -
-#pragma mark Model Tree Navigation
+#pragma mark - Model Tree Navigation
- (BOOL)modelNode:(id <PSTreeGraphModelNode> )modelNode
isDescendantOf:(id <PSTreeGraphModelNode> )possibleAncestor {
@@ -935,8 +918,7 @@ - (BOOL)modelNodeIsInAssignedTree:(id <PSTreeGraphModelNode> )modelNode {
}
-#pragma mark -
-#pragma mark Memory Management
+#pragma mark - Memory Management
- (void)dealloc {
View
9 PSTreeGraphView/PSBaseTreeGraphView_Internal.h
@@ -24,8 +24,7 @@
@interface PSBaseTreeGraphView (Internal)
-#pragma mark -
-#pragma mark ModelNode -> SubtreeView Relationship Management
+#pragma mark - ModelNode -> SubtreeView Relationship Management
// Returns the SubtreeView that corresponds to the specified modelNode, as tracked by the TreeGraph's
// modelNodeToSubtreeViewMapTable.
@@ -39,8 +38,7 @@
forModelNode:(id)modelNode;
-#pragma mark -
-#pragma mark Model Tree Navigation
+#pragma mark - Model Tree Navigation
// Returns YES if modelNode is a descendant of possibleAncestor, NO if not.
//
@@ -73,8 +71,7 @@
atRelativeIndex:(NSInteger)relativeIndex;
-#pragma mark -
-#pragma mark Node View Nib Caching
+#pragma mark - Node View Nib Caching
//* NOT SUPPORTED ON iOS 3.2*

0 comments on commit 347003d

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