FROM : Jens Miltner
DATE : Thu Mar 27 14:46:14 2008
Am 27.03.2008 um 11:57 schrieb Gerriet M. Denkmann:
> On 26 Mar 2008, at 22:56, Graham Cox wrote:
>> The undo manager will directly change the data in the text view
>> using an invocation or target/action - it doesn't go back through
>> changeFont: normally, which is really a "high level" method.
>>
>> Maybe the solution to this is to subclass NSUndoManager so that you
>> can hook into the undo and redo methods and use those opportunities
>> to modify the change count of the document.
>
> So I implement in MyUndoManager:
> - (void)undo
> {
> NSString *action = [self undoActionName];
> [ super undo ];
> if ( action contains "Font" ) [myDocument
> updateChangeCount:NSChangeUndone];
> }
>
Maybe there's a way to trigger on the action selector instead of the
action name? However, even the action selector _might_ change in
future AppKit versions, so even this would be a somewhat fragile
solution.
I'd still think that it might be easier to register you own undo
action for the font changes instead of trying to hijack the automatic
undo...
just my €.02,
</jum>
DATE : Thu Mar 27 14:46:14 2008
Am 27.03.2008 um 11:57 schrieb Gerriet M. Denkmann:
> On 26 Mar 2008, at 22:56, Graham Cox wrote:
>> The undo manager will directly change the data in the text view
>> using an invocation or target/action - it doesn't go back through
>> changeFont: normally, which is really a "high level" method.
>>
>> Maybe the solution to this is to subclass NSUndoManager so that you
>> can hook into the undo and redo methods and use those opportunities
>> to modify the change count of the document.
>
> So I implement in MyUndoManager:
> - (void)undo
> {
> NSString *action = [self undoActionName];
> [ super undo ];
> if ( action contains "Font" ) [myDocument
> updateChangeCount:NSChangeUndone];
> }
>
Maybe there's a way to trigger on the action selector instead of the
action name? However, even the action selector _might_ change in
future AppKit versions, so even this would be a somewhat fragile
solution.
I'd still think that it might be easier to register you own undo
action for the font changes instead of trying to hijack the automatic
undo...
just my €.02,
</jum>
| Related mails | Author | Date |
|---|---|---|
| Gerriet M. Denkman… | Mar 25, 18:48 | |
| Graham Cox | Mar 25, 23:12 | |
| Gerriet M. Denkman… | Mar 26, 03:07 | |
| Sherm Pendley | Mar 26, 04:07 | |
| Gerriet M. Denkman… | Mar 26, 11:26 | |
| Graham Cox | Mar 26, 22:56 | |
| Jens Miltner | Mar 27, 09:50 | |
| Gerriet M. Denkman… | Mar 27, 11:57 | |
| Jens Miltner | Mar 27, 14:46 | |
| Gerriet M. Denkman… | Mar 27, 18:44 | |
| Gerriet M. Denkman… | Mar 27, 18:48 |






Cocoa mail archive

