• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Grapher.app's Equation Editor
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Grapher.app's Equation Editor


  • Subject: Grapher.app's Equation Editor
  • From: Kevin Perry <email@hidden>
  • Date: Mon, 26 Dec 2005 01:54:43 -0800

Hi everyone!

I'm really curious about the implementation of Grapher.app's Equation editor view. Does anyone have any insight or really good guesses as to how it works? I'd like to implement something similar to it, but I'm not quite sure how to go about it. I'm referring specifically to how the view draws the entry fields around the various math symbols, and how it expands or extends some symbols such as the radical sign, and so forth. Is it possible to use a usual NSTextContainer/ NSLayoutManager combo to layout the text, or would it be necessary to write a class that does all the layout and drawing in a view itself?

From the class dump, it looks as if Apple reimplements everything, but I may not be interpreting it correctly, so I'll include the data members and noteworthy methods:

@interface EQView : CPFocusRingView <NSTextInput>
{
NSSplitView *mSplitView;
EQEquation *mEquation;
EQSelection *mSelection;
EQSelection *mInsertSelection;
struct _NSSize mOffset;
NSColor *mBgColor;
BOOL mDragHighlighted;
BOOL mInsertSelectionActive;
NSArray *mDraggedZones;
EQLine *mLineWithDraggedZones;
NSUndoManager *mUndoManager;
id mDelegate;
id mTimerLink;
NSTimer *mBlinkTimer;
BOOL mVisibleInsertionPoint;
}

+ (void)setDrawBackground:(BOOL)fp8;
- (id)initWithFrame:(struct _NSRect)fp8;
- (void)setBgColor:(id)fp8;
- (id)bgColor;
- (id)equation;
- (id)selection;
- (void)setSelection:(id)fp8;
- (id)text;
- (void)setText:(id)fp8;
- (void)drawInteriorWithRect:(struct _NSRect)fp8;
- (BOOL)equationViewShouldResignFirstResponder:(id)fp8;
- (void)setNeedsDisplay:(BOOL)fp8;
- (void)blink:(id)fp8;
- (void)stopBlinking;
- (void)startBlinking;
- (void)windowDidChangeStatus:(id)fp8;
- (BOOL)resignFirstResponder;
- (void)updateFont;
- (void)changeFont:(id)fp8;
- (void)changeColor:(id)fp8;
- (BOOL)becomeFirstResponder;
- (void)keyDown:(id)fp8;
- (void)mouseDown:(id)fp8;
- (void)autoResizeHeight;
- (unsigned int)draggingSourceOperationMaskForLocal:(BOOL)fp8;
- (void)draggedImage:(id)fp8 endedAt:(struct _NSPoint)fp12 operation: (unsigned int)fp20;
- (BOOL)canReadFromPasteboard:(id)fp8;
- (unsigned int)draggingEntered:(id)fp8;
- (unsigned int)draggingUpdated:(id)fp8;
- (void)draggingExited:(id)fp8;
- (BOOL)prepareForDragOperation:(id)fp8;
- (BOOL)performDragOperation:(id)fp8;
- (void)startDraggingLine:(id)fp8 range:(struct _NSRange)fp12;
- (void)insertContentOfPasteboard:(id)fp8 toSelection:(id)fp12 select: (BOOL)fp16;
- (id)getData;
- (void)setData:(id)fp8;
- (id)undoManager;
- (void)undo:(id)fp8;
- (void)redo:(id)fp8;
- (void)cut:(id)fp8;
- (id)copyAsView;
- (void)copyAsTIFF:(id)fp8;
- (void)copyAsPDF:(id)fp8;
- (void)copyAsEPS:(id)fp8;
- (void)copyAsText:(id)fp8;
- (void)copy:(id)fp8;
- (BOOL)canPaste;
- (void)paste:(id)fp8;
- (void)clear:(id)fp8;
- (void)selectAll:(id)fp8;
- (BOOL)hasMarkedText;
- (struct _NSRange)markedRange;
- (struct _NSRange)selectedRange;
- (void)setMarkedText:(id)fp8 selectedRange:(struct _NSRange)fp12;
- (void)unmarkText;
- (id)validAttributesForMarkedText;
- (id)attributedSubstringFromRange:(struct _NSRange)fp8;
- (void)insertText:(id)fp8;
- (unsigned int)characterIndexForPoint:(struct _NSPoint)fp8;
- (struct _NSRect)firstRectForCharacterRange:(struct _NSRange)fp8;
- (int)alignment;
- (id)backgroundColor;
- (BOOL)drawsBackground;
- (id)font;
- (BOOL)importsGraphics;
- (BOOL)isEditable;
- (BOOL)isFieldEditor;
- (BOOL)isHorizontallyResizable;
- (BOOL)isRichText;
- (BOOL)isRulerVisible;
- (BOOL)isSelectable;
- (BOOL)isVerticallyResizable;
- (struct _NSSize)maxSize;
- (struct _NSSize)minSize;
- (void)replaceCharactersInRange:(struct _NSRange)fp8 withString:(id) fp16;
- (void)replaceCharactersInRange:(struct _NSRange)fp8 withRTF:(id)fp16;
- (void)replaceCharactersInRange:(struct _NSRange)fp8 withRTFD:(id)fp16;
- (id)RTFDFromRange:(struct _NSRange)fp8;
- (id)RTFFromRange:(struct _NSRange)fp8;
- (void)scrollRangeToVisible:(struct _NSRange)fp8;
- (void)setAlignment:(int)fp8;
- (void)setBackgroundColor:(id)fp8;
- (void)setDrawsBackground:(BOOL)fp8;
- (void)setEditable:(BOOL)fp8;
- (void)setFieldEditor:(BOOL)fp8;
- (void)setFont:(id)fp8;
- (void)setFont:(id)fp8 range:(struct _NSRange)fp12;
- (void)setImportsGraphics:(BOOL)fp8;
- (void)setMaxSize:(struct _NSSize)fp8;
- (void)setMinSize:(struct _NSSize)fp8;
- (void)setRichText:(BOOL)fp8;
- (void)setSelectable:(BOOL)fp8;
- (void)setSelectedRange:(struct _NSRange)fp8;
- (void)setString:(id)fp8;
- (void)setTextColor:(id)fp8;
- (void)setTextColor:(id)fp8 range:(struct _NSRange)fp12;
- (void)setUsesFontPanel:(BOOL)fp8;
- (id)string;
- (id)textColor;
- (BOOL)usesFontPanel;
- (struct _NSSize)scrollBy:(struct _NSSize)fp8;
- (struct _NSSize)autoScroll;
- (void)insert2DVector:(id)fp8;
- (void)insert3DVector:(id)fp8;

@end

While pasting that in, I just noticed that there is something about a field editor, which perhaps indicates that it may use an NSText object, or even the default field editor? However, the interface for the class looks a lot like the NSTextView's interface. Perhaps it intends to emulate an NSTextView without actually subclassing it?

I'm trying to get into the more advanced parts of Cocoa and object oriented design in general, and figuring this out is part of one of my personal projects, so any insight and and or (re)direction would be greatly appreciated!

-Kevin Perry
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
  • Follow-Ups:
    • Re: Grapher.app's Equation Editor
      • From: "John C. Randolph" <email@hidden>
  • Prev by Date: Re: How do I access the Password Assistant dialog?
  • Next by Date: Re: Grapher.app's Equation Editor
  • Previous by thread: Re: CD/Bindings and NSTextView
  • Next by thread: Re: Grapher.app's Equation Editor
  • Index(es):
    • Date
    • Thread