Added Function Chooser as a Popover
Improved Evaluation Added Parenthesis Function
This commit is contained in:
@@ -13,6 +13,12 @@
|
||||
#import "NSIndexPath+MPAdditions.h"
|
||||
|
||||
#define kMPEmptyBoxWidth (self.usesSmallSize ? 2.0 : 3.0)
|
||||
#define kMPEmptyBoxHeight (CTFontGetDescent((CTFontRef)self.font) + CTFontGetAscent((CTFontRef)self.font) + CTFontGetLeading((CTFontRef)self.font))
|
||||
#define kMPEmptyBoxYOrigin (-(CTFontGetDescent((CTFontRef)self.font) + CTFontGetLeading((CTFontRef)self.font)))
|
||||
|
||||
#define kMPEmptyBoxDrawingWidth kMPEmptyBoxWidth
|
||||
#define kMPEmptyBoxDrawingHeight (CTFontGetDescent((CTFontRef)self.font) + CTFontGetAscent((CTFontRef)self.font))
|
||||
#define kMPEmptyBoxDrawingYOrigin (-(CTFontGetDescent((CTFontRef)self.font) + CTFontGetLeading((CTFontRef)self.font)/2))
|
||||
|
||||
@interface MPExpressionLayout (MPLineGeneration)
|
||||
|
||||
@@ -86,7 +92,7 @@
|
||||
- (NSRect)generateBounds
|
||||
{
|
||||
if (self.expression.numberOfElements == 0) {
|
||||
return NSMakeRect(0, [self.font descender], kMPEmptyBoxWidth, self.fontSize);
|
||||
return NSMakeRect(0, kMPEmptyBoxYOrigin, kMPEmptyBoxWidth, kMPEmptyBoxHeight);
|
||||
}
|
||||
CGFloat x = 0, y = 0, width = 0, height = 0;
|
||||
for (NSUInteger index = 0; index < self.expression.numberOfElements; index++) {
|
||||
@@ -211,10 +217,23 @@
|
||||
(CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
|
||||
CGContextSaveGState(context);
|
||||
|
||||
#ifdef MPDEBUG_DRAW_ORIGIN
|
||||
[[NSColor blueColor] set];
|
||||
[[NSBezierPath bezierPathWithOvalInRect:NSMakeRect(-2, -2, 4, 4)] fill];
|
||||
#endif
|
||||
|
||||
[[NSColor textColor] set];
|
||||
|
||||
#ifdef MPDEBUG_DRAW_BOUNDS
|
||||
[[NSColor greenColor] set];
|
||||
[[NSBezierPath bezierPathWithRect:self.bounds] stroke];
|
||||
[[NSColor textColor] set];
|
||||
#endif
|
||||
|
||||
if (self.expression.numberOfElements == 0) {
|
||||
|
||||
CGContextRestoreGState(context);
|
||||
NSBezierPath *path = [NSBezierPath bezierPathWithRect:NSMakeRect(0, 0 + self.font.descender, kMPEmptyBoxWidth, self.fontSize)];
|
||||
NSBezierPath *path = [NSBezierPath bezierPathWithRect:NSMakeRect(0, kMPEmptyBoxDrawingYOrigin, kMPEmptyBoxDrawingWidth, kMPEmptyBoxDrawingHeight)];
|
||||
path.lineWidth = 0.5;
|
||||
[path stroke];
|
||||
return;
|
||||
@@ -238,10 +257,16 @@
|
||||
|
||||
// Move to the appropriate position
|
||||
CGContextSetTextPosition(context, x, 0);
|
||||
|
||||
|
||||
#ifdef MPDEBUG_DRAW_BASELINE
|
||||
[[NSColor redColor] set];
|
||||
NSRectFill(NSMakeRect(x, -1, elementBounds.size.width, 1));
|
||||
[[NSColor textColor] set];
|
||||
#endif
|
||||
|
||||
// Perform the drawing
|
||||
CTLineDraw(line, context);
|
||||
|
||||
|
||||
CFRelease(line);
|
||||
} else {
|
||||
// Let the child layout draw itself
|
||||
|
||||
Reference in New Issue
Block a user