Archived
1

Internal Redesign:

- Combined MPExpression and MPMutableExpression
- Abstracted children of MPExpression into MPExpressionElement protocol
- Abstracted most of MPExpressionLayout and MPFunctionLayout into common superclass MPLayout
This commit is contained in:
Kim Wittenburg
2014-08-11 13:57:48 +02:00
parent 740c3fd80a
commit 60760b8b3d
31 changed files with 1222 additions and 1343 deletions

56
MathPad/MPLayout.h Normal file
View File

@@ -0,0 +1,56 @@
//
// MPDrawable.h
// MathPad
//
// Created by Kim Wittenburg on 07.08.14.
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
//
@import Cocoa;
#import "MPExpressionStorage.h"
#define MPNull [NSNull null]
@interface MPLayout : NSObject
#pragma mark Creation Methods
- (instancetype)init;
- (instancetype)initWithPath:(NSIndexPath *)path
parent:(MPLayout *)parent;
#pragma mark Text System Objects
@property (readonly, nonatomic, weak) MPExpressionStorage *expressionStorage;
@property (readonly, nonatomic, weak) NSLayoutManager *layoutManager;
@property (readonly, nonatomic, weak) NSTextContainer *textContainer;
@property (readonly, nonatomic, weak) NSTextStorage *textStorage;
#pragma mark Cache Tree
@property (readonly, nonatomic, weak) MPLayout *parent;
@property (readonly, nonatomic, strong) NSIndexPath *path;
#pragma mark Cache Methods
// Querying Caches
- (id)cachableObjectForIndex:(NSUInteger)index
generator:(id(^)())generator;
// Clearing Caches
- (void)clearCacheInRange:(NSRange)range
replacementLength:(NSUInteger)replacementLength;
- (void)invalidate;
#pragma mark Calculation and Drawing Methods
// @property (nonatomic) BOOL usesSmallSize;
- (NSSize)size;
- (NSBezierPath *)bezierPath;
- (NSBezierPath *)bezierPathAtOrigin:(NSPoint)point;
- (void)drawAtPoint:(NSPoint)point;
@end
@interface MPLayout (MPSubclassImplement)
- (MPLayout *)childLayoutAtIndex:(NSUInteger)index; // To be implemented
- (NSSize)sizeForChildAtIndex:(NSUInteger)index; // To be implemented
- (NSBezierPath *)generateBezierPath; // To be implemented
@end