[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: NSTextView NSTEXTVIEW_SYNC patch
From: |
Nicola Pero |
Subject: |
Re: NSTextView NSTEXTVIEW_SYNC patch |
Date: |
Tue, 30 Jul 2002 11:10:57 +0100 (BST) |
> Hello all,
>
> while investigating some of the mechanics of NSTextView I ran across the
> _syncTextViewsByCalling implementation. Eventhough the comments mention:
>
> We need to explicitly call the methods - we can't copy the flags
> directly from one textview to another, to allow subclasses to
> override eg setEditable: to take some particular action when
> editing is turned on or off.
>
> they don't fully honor the fact, that the layout manager my have different
> subclasses of NSTextView since the implementation caches the method pointer
> to the current NSTextView and applies it to all textContainers.
Yes - good point - it should compute the method pointer for each
NSTextView, rather than just once.
> Here is a patch using NSInvocation's invokeWithTarget: instead.
I prefer to get the method pointer for each NSTextView, as it's much
faster than creating an intermediate NSInvocation, setting it up etc.
> (It also replaces the NSTEXTVIEW_SYNC macro call by using a version
> that doesn't need a parameter.)
Nice.
I applied your patch (with the modification of not using the NSInvocation
etc) to CVS (0.8.0 branch). Thanks!
> I don't have a "real" Test-App that uses a layout manager with multiple
> NSTextViews. Is there one around? Or any easy accesible source from which I
> could quickly create a GSTest bundle?
Eh - I don't think I have one - actually I don't think it would work :-)
while NSTextView has some (partial ?) support for it, the NSLayoutManager
is really a mess still, and doesn't really support it.
What you can do (what I did to test the patch) is, you modify
NSTEXTVIEW_SYNC slightly, so that it always calls
_syncTextViewByCalling:withFlag: even if there is a single textview - that
at least does a basic check that _syncTextViewByCalling:withFlag: roughly
works.