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

View File

@@ -2,64 +2,18 @@
// MPExpressionLayout.h
// MathPad
//
// Created by Kim Wittenburg on 22.04.14.
// Created by Kim Wittenburg on 07.08.14.
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
//
#import <Foundation/Foundation.h>
@import Cocoa;
#import "MPLayout.h"
#import "MPExpression.h"
@class MPExpressionLayout, MPFunctionLayout, MPExpressionStorage, MPExpressionView, MPExpression;
@interface MPExpressionLayout : MPLayout
@interface MPExpressionLayout : NSObject {
BOOL _valid;
NSSize _cachedSize;
NSMutableArray *_symbolCache;
}
- (instancetype)initRootLayoutWithExpressionStorage:(MPExpressionStorage *)expressionStorage;
#pragma mark Creation Methods
// -init not supported
- (id)initRootLayoutWithExpressionStorage:(MPExpressionStorage *)expressionStorage;
- (id)initWithExpressionPath:(NSIndexPath *)expressionPath
parent:(MPFunctionLayout *)parent;
#pragma mark Properties
@property (readonly, nonatomic, weak) MPFunctionLayout *parent;
@property (readonly, nonatomic, weak) MPExpressionStorage *expressionStorage;
@property (readonly, nonatomic, strong) NSIndexPath *expressionPath;
@property (nonatomic, weak) MPExpressionView *expressionView;
- (MPExpression *)expression; // Convenience
- (NSLayoutManager *)layoutManager;
- (NSTextContainer *)textContainer;
- (NSTextStorage *)textStorage;
#pragma mark Cache Methods
- (void)invalidate;
- (void)editedExpressionInRange:(NSRange)range
replacementLength:(NSUInteger)length;
- (BOOL)hasCacheForSymbolAtIndex:(NSUInteger)index;
- (MPFunctionLayout *)functionLayoutForFunctionAtIndex:(NSUInteger)index;
- (NSSize)cachedSizeForSymbolAtIndex:(NSUInteger)index;
- (void)cacheSize:(NSSize)size forSymbolAtIndex:(NSUInteger)index;
#pragma mark Sizes Calculation Methods
- (NSSize)sizeForAllSymbols;
- (NSSize)sizeForSymbolAtIndex:(NSUInteger)index;
- (NSSize)sizeForSymbolsInRange:(NSRange)range;
#pragma mark Drawing Methods
- (void)drawSymbolAtIndex:(NSUInteger)index
atPoint:(NSPoint)point;
- (void)drawSymbolsInRange:(NSRange)range
atPoint:(NSPoint)point;
- (void)drawAllSymbolsAtPoint:(NSPoint)point;
@property (readonly, nonatomic, weak) MPExpression *expression; // Convenience
@end