Added Lots of Documentation
Added some nice to haves Improved and Unified General Code Layout
This commit is contained in:
@@ -10,9 +10,12 @@
|
||||
|
||||
#import "MPParenthesisFunction.h"
|
||||
|
||||
|
||||
#define MPParenthesisFunctionOpeningParensOffset 2
|
||||
#define MPParenthesisFunctionClosingParensOffset 0
|
||||
|
||||
|
||||
|
||||
@interface MPParenthesisFunctionLayout ()
|
||||
|
||||
- (NSBezierPath *)openingParens;
|
||||
@@ -25,6 +28,8 @@
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
@implementation MPParenthesisFunctionLayout
|
||||
|
||||
- (MPParenthesisFunction *)parenthesisFunction
|
||||
@@ -32,6 +37,7 @@
|
||||
return (MPParenthesisFunction *)self.function;
|
||||
}
|
||||
|
||||
|
||||
- (NSBezierPath *)openingParens
|
||||
{
|
||||
NSBezierPath *parens = [self objectForPrivateCacheIndex:0 generator:^id{
|
||||
@@ -60,6 +66,7 @@
|
||||
return parens;
|
||||
}
|
||||
|
||||
|
||||
- (NSBezierPath *)closingParens
|
||||
{
|
||||
NSBezierPath *parens = [self objectForPrivateCacheIndex:1 generator:^id{
|
||||
@@ -88,6 +95,7 @@
|
||||
return parens;
|
||||
}
|
||||
|
||||
|
||||
- (NSBezierPath *)transformedOpeningParens
|
||||
{
|
||||
NSBezierPath *parens = self.openingParens.copy;
|
||||
@@ -95,6 +103,7 @@
|
||||
return parens;
|
||||
}
|
||||
|
||||
|
||||
- (NSBezierPath *)transformedClosingParens
|
||||
{
|
||||
NSBezierPath *parens = self.closingParens.copy;
|
||||
@@ -102,6 +111,7 @@
|
||||
return parens;
|
||||
}
|
||||
|
||||
|
||||
- (NSAffineTransform *)parenthesisTransform
|
||||
{
|
||||
NSAffineTransform *transform = [NSAffineTransform transform];
|
||||
@@ -110,6 +120,7 @@
|
||||
return transform;
|
||||
}
|
||||
|
||||
|
||||
- (CGFloat)scaleFactor
|
||||
{
|
||||
NSRect parensBounds = self.openingParens.bounds;
|
||||
@@ -122,22 +133,25 @@
|
||||
return expressionHeight / parensHeight;
|
||||
}
|
||||
|
||||
|
||||
- (NSPoint)offsetOfChildLayoutAtIndex:(NSUInteger)index
|
||||
{
|
||||
return NSMakePoint(self.openingParens.bounds.size.width + MPParenthesisFunctionOpeningParensOffset, 0);
|
||||
}
|
||||
|
||||
|
||||
- (NSIndexPath *)indexPathForLocalMousePoint:(NSPoint)point
|
||||
{
|
||||
#warning Missing Implementation
|
||||
return [NSIndexPath indexPathWithIndex:0];
|
||||
}
|
||||
|
||||
|
||||
- (NSIndexSet *)indexesOfRemainingChildren
|
||||
{
|
||||
return [NSIndexSet indexSetWithIndex:0];
|
||||
}
|
||||
|
||||
|
||||
- (NSRect)generateBounds
|
||||
{
|
||||
NSRect openingParensBounds = self.transformedOpeningParens.bounds;
|
||||
@@ -159,6 +173,7 @@
|
||||
return bounds;
|
||||
}
|
||||
|
||||
|
||||
- (void)draw
|
||||
{
|
||||
NSBezierPath *openingParens = self.transformedOpeningParens;
|
||||
|
||||
Reference in New Issue
Block a user