Cleaned Code by Removing Location Tracking for Errors
This commit is contained in:
@@ -34,8 +34,6 @@
|
||||
@property (nonatomic, strong) NSPopover *functionsPopover;
|
||||
@property (nonatomic, strong) MPFunctionsViewController *functionsViewController;
|
||||
|
||||
@property (nonatomic, strong) NSTextField *errorLabel;
|
||||
|
||||
@property (nonatomic, strong) NSTimer *caretTimer;
|
||||
@property (nonatomic) NSTimeInterval caretBlinkRate;
|
||||
@property (nonatomic) BOOL caretVisible;
|
||||
@@ -339,7 +337,7 @@
|
||||
_expressionStorage = expressionStorage;
|
||||
|
||||
[self initializeButtons];
|
||||
[self initializeErrorLabel];
|
||||
[self initializeErrorMessageTextField];
|
||||
|
||||
self.selection = [[MPRangePath alloc] initWithRange:NSMakeRange(0, 0)];
|
||||
self.caretBlinkRate = 1.0;
|
||||
@@ -377,9 +375,9 @@
|
||||
constant:0]];
|
||||
}
|
||||
|
||||
- (void)initializeErrorLabel
|
||||
- (void)initializeErrorMessageTextField
|
||||
{
|
||||
NSTextField *errorLabel = self.errorLabel;
|
||||
NSTextField *errorLabel = self.errorMessageTextField;
|
||||
[self addSubview:errorLabel];
|
||||
NSDictionary *variableBindings = NSDictionaryOfVariableBindings(errorLabel);
|
||||
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-10-[errorLabel]"
|
||||
@@ -408,13 +406,6 @@
|
||||
self.needsDisplay = YES;
|
||||
}
|
||||
|
||||
- (void)setError:(MPParseError *)error
|
||||
{
|
||||
_error = error;
|
||||
self.errorLabel.stringValue = error.localizedErrorMessage != nil ? error.localizedErrorMessage : @"";
|
||||
self.needsDisplay = YES;
|
||||
}
|
||||
|
||||
- (NSButton *)radiansDegreesButton
|
||||
{
|
||||
if (!_radiansDegreesButton) {
|
||||
@@ -457,9 +448,9 @@
|
||||
return _functionsButton;
|
||||
}
|
||||
|
||||
- (NSTextField *)errorLabel
|
||||
- (NSTextField *)errorMessageTextField
|
||||
{
|
||||
if (!_errorLabel) {
|
||||
if (!_errorMessageTextField) {
|
||||
NSTextField *label = [[NSTextField alloc] initWithFrame:NSZeroRect];
|
||||
label.textColor = [NSColor redColor];
|
||||
label.translatesAutoresizingMaskIntoConstraints = NO;
|
||||
@@ -467,9 +458,9 @@
|
||||
label.drawsBackground = NO;
|
||||
label.editable = NO;
|
||||
label.selectable = NO;
|
||||
_errorLabel = label;
|
||||
_errorMessageTextField = label;
|
||||
}
|
||||
return _errorLabel;
|
||||
return _errorMessageTextField;
|
||||
}
|
||||
|
||||
#pragma mark Actions
|
||||
@@ -922,25 +913,7 @@
|
||||
[transform translateXBy:expressionOrigin.x
|
||||
yBy:expressionOrigin.y];
|
||||
[transform concat];
|
||||
|
||||
// Draw the error
|
||||
// if (self.error) {
|
||||
// [[NSColor redColor] set];
|
||||
// NSRect rect = [self.expressionStorage.rootLayout boundingRectForRangePath:self.error.rangePath];
|
||||
// if (self.error.rangePath.length == 0) {
|
||||
// NSBezierPath *bezierPath = [NSBezierPath bezierPath];
|
||||
// [bezierPath moveToPoint:rect.origin];
|
||||
// [bezierPath lineToPoint:NSMakePoint(rect.origin.x - 5, rect.origin.y - 5)];
|
||||
// [bezierPath moveToPoint:rect.origin];
|
||||
// [bezierPath lineToPoint:NSMakePoint(rect.origin.x + 5, rect.origin.y - 5)];
|
||||
// bezierPath.lineWidth = 2.0;
|
||||
// [bezierPath stroke];
|
||||
// } else {
|
||||
// NSRect underlineRect = NSMakeRect(rect.origin.x, rect.origin.y + 2, rect.size.width, 2);
|
||||
// NSRectFill(underlineRect);
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// Draw the selection
|
||||
if (self.caretVisible || self.selection.length > 0) {
|
||||
if (self.selection.length == 0) {
|
||||
|
||||
Reference in New Issue
Block a user