Archived
1

Improved Model

Added Keyboard Selection Support
Added Mouse Selection Support
Added Keyboard Editing Support
Corrected Some Bugs
Abstracted the Layout System further
Added Functions Button (test)
This commit is contained in:
Kim Wittenburg
2014-08-31 15:41:17 +02:00
parent 9aa4bca234
commit 4a3ea0cede
23 changed files with 885 additions and 262 deletions

View File

@@ -17,33 +17,34 @@
#pragma mark Creation Methods
+ (MPFunctionLayout *)functionLayoutForFunctionAtIndexPath:(NSIndexPath *)path
inRootExpression:(MPExpression *)rootExpression
parent:(MPExpressionLayout *)parent
{
MPFunction *function = [parent.expressionStorage elementAtIndexPath:path];
MPFunction *function = [rootExpression elementAtIndexPath:path];
Class class = [function class];
if (class == [MPSumFunction class]) {
return [[MPSumFunctionLayout alloc] initWithPath:path parent:parent];
return [[MPSumFunctionLayout alloc] initWithElementAtPath:path
inRootExpression:rootExpression
parent:parent];
}
return [[self alloc] initWithPath:path parent:parent];
return [[self alloc] initWithElementAtPath:path
inRootExpression:rootExpression
parent:parent];
}
- (instancetype)initWithPath:(NSIndexPath *)path
parent:(MPLayout *)parent
- (instancetype)initWithElementAtPath:(NSIndexPath *)path
inRootExpression:(MPExpression *)rootExpression
parent:(MPLayout *)parent
{
self = [super initWithPath:path
parent:parent];
self = [super initWithElementAtPath:path
inRootExpression:rootExpression
parent:parent];
if (self) {
_function = [parent.expressionStorage elementAtIndexPath:path];
_function = [rootExpression elementAtIndexPath:path];
}
return self;
}
#pragma mark Properties
//- (MPFunction *)function
//{
// return [self.expressionStorage elementAtIndexPath:self.path];
//}
#pragma mark Cache Methods
- (CTLineRef)lineForPrivateCacheIndex:(NSUInteger)index
generator:(CTLineRef (^)())generator
@@ -62,26 +63,22 @@
{
return [self cachableObjectForIndex:index generator:^id{
NSIndexPath *childPath = [self.function.indexPath indexPathByAddingIndex:index];
MPExpressionLayout *layout = [[MPExpressionLayout alloc] initWithPath:childPath
parent:self];
MPExpressionLayout *layout = [[MPExpressionLayout alloc] initWithElementAtPath:childPath
inRootExpression:self.function.rootExpression
parent:self];
layout.flipped = self.flipped;
layout.usesSmallSize = (index == 0 || index == 1) ? YES : self.usesSmallSize;
return layout;
}];
}
#pragma mark Size and Drawing Methods
- (NSSize)sizeForChildAtIndex:(NSUInteger)index
- (NSRect)generateBounds
{
MPLayout *childLayout = [self childLayoutAtIndex:index];
return [childLayout size];
return NSZeroRect;
}
- (NSSize)generateSize
{
return NSZeroSize;
}
- (void)drawAtPoint:(NSPoint)point
- (void)draw
{
}