Archived
1

Added Lots of Documentation

Added some nice to haves
Improved and Unified General Code Layout
This commit is contained in:
Kim Wittenburg
2015-01-04 02:54:27 +01:00
parent 152b981e24
commit 7438fd1f95
83 changed files with 2282 additions and 416 deletions

View File

@@ -8,24 +8,28 @@
#import "MPFunctionLayout.h"
#import "MPExpression.h"
#import "MPExpressionLayout.h"
#import "MPFunction.h"
#import "MPSumFunction.h"
#import "MPFractionFunction.h"
#import "MPParenthesisFunction.h"
#import "MPPowerFunction.h"
#import "MPFractionFunction.h"
#import "MPSumFunction.h"
#import "MPExpressionLayout.h"
#import "MPSumFunctionLayout.h"
#import "MPFractionFunctionLayout.h"
#import "MPParenthesisFunctionLayout.h"
#import "MPPowerFunctionLayout.h"
#import "MPFractionFunctionLayout.h"
#import "MPSumFunctionLayout.h"
#import "NSIndexPath+MPAdditions.h"
@implementation MPFunctionLayout
#pragma mark Creation Methods
+ (MPFunctionLayout *)functionLayoutForFunction:(MPFunction *)function
parent:(MPExpressionLayout *)parent
{
@@ -43,6 +47,7 @@
parent:parent];
}
- (instancetype)initWithFunction:(MPFunction *)function
parent:(MPExpressionLayout *)parent
{
@@ -53,7 +58,9 @@
return self;
}
#pragma mark Cache Methods
- (CTLineRef)lineForPrivateCacheIndex:(NSUInteger)index
generator:(CTLineRef (^)())generator
{
@@ -67,6 +74,7 @@
return (__bridge CTLineRef)(lineObject);
}
- (id)objectForPrivateCacheIndex:(NSUInteger)index
generator:(id (^)())generator
{
@@ -74,11 +82,13 @@
return [self cachableObjectForIndex:actualIndex generator:generator];
}
- (NSUInteger)numberOfChildren
{
return self.function.numberOfChildren;
}
- (MPLayout *)childLayoutAtIndex:(NSUInteger)index
{
return [self cachableObjectForIndex:index generator:^id{
@@ -91,11 +101,13 @@
}];
}
- (BOOL)childAtIndexUsesSmallSize:(NSUInteger)index
{
return NO;
}
- (NSIndexPath *)indexPathForMousePoint:(NSPoint)point
{
// A single index is used to communicate back wether the
@@ -116,36 +128,43 @@
return [self indexPathForLocalMousePoint:point];
}
- (NSUInteger)indexOfLeadingChild
{
return 0;
}
- (NSUInteger)indexOfTrailingChild
{
return 0;
}
- (NSUInteger)indexOfChildBeforeChildAtIndex:(NSUInteger)index
{
return NSNotFound;
}
- (NSUInteger)indexOfChildAfterChildAtIndex:(NSUInteger)index
{
return NSNotFound;
}
- (NSUInteger)indexOfChildBelowChildAtIndex:(NSUInteger)index
{
return index;
}
- (NSUInteger)indexOfChildAboveChildAtIndex:(NSUInteger)index
{
return index;
}
- (NSIndexSet *)indexesOfRemainingChildren
{
return [NSIndexSet indexSet];