NSTextView and Line Numbering
NSTextView and Line Numbering
- Subject: NSTextView and Line Numbering
- From: James Derry <email@hidden>
- Date: Wed, 19 Feb 2003 19:53:49 -0500
Hi again all,
Here I am once again soliciting some help. Specifically I'm trying to
implement a scheme whereby I can override NSTextView (or something) to
display line numbers along side the NSTextView contents. Problem is, there
aren't not a whole lot of comments out there (well, here and Google groups)
and I'm getting all lost.
I guess the base problem is I don't understand the text system well enough
on the level I need to -- I have Cocoa Programming (Anguish et al) and all
of the Apple documentation, and my eyes are straining from it all. Okay,
this isn't part of my question -- just trying to show I'm not lazy and am
checking the dox.
One approach I'd considered is override NSRulerView and in drawRect checking
to see if the current measurement unit is "Lines" which I can invent with
+registerUnitWithName:
I could then do the inherited drawing for all other
units, or put in my line numbers for Lines. All I care about is Line
numbers, no markers or anything else. The trouble with this approach is I
have no idea how to correlate where the actual NSTextView (or is it the
layout manager or the scroll view) is "located" relative to the ruler to
figure out where to draw the line numbers. It'd be nice to figure out the
line heights, so I could accomdate variable height lines.
Or am I going about this the wrong way? Should I override NSTextView and
force in some self-created NSView to draw upon to the left of the TextView?
I'd still have the same problem whereby I have no idea where to correlate
the position of one to the other.
Ideas or general pointers? Thanks all!
Sincerely,
Jim Derry
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.