Re: toggle new attribute in range of text (was : exponent action in NSTextView subclass)]
Re: toggle new attribute in range of text (was : exponent action in NSTextView subclass)]
- Subject: Re: toggle new attribute in range of text (was : exponent action in NSTextView subclass)]
- From: "Ewan Delanoy" <email@hidden>
- Date: Thu, 22 Mar 2007 18:39:19 +0100 (CET)
- Importance: Normal
>
> As with bold, italics, underline, etc., you would need to decide when to
perform the action and when to perform the inverse action. For example,
for the underline action the current criterion is that if there is a
selection and the first character of the selected range has any form of
underline on it, or if there is no selection and the typing attributes
have any form of underline, then underline is
> removed; otherwise a single simple underline is added. You would
probably want to add a line >to your validateMenuItem: implementation to
set the state of the menu item accordingly.
Indeed, but the "hard case" I had in mind was when there is
a selected text and we must look at the first character's attributes :
just how do we know if it is an exponentiated character or not ? As far as
I can see, one can only make a guess by looking at the
NSBaselineOffsetAttributeName
attribute. The difficulty is that we must keep a "record" somehow of any
exponentiation we make, as the undo manager does.
Ewan
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden