Skip navigation.
 
mlRe: Ephemeral Changes
FROM : Gerriet M. Denkmann
DATE : Thu Mar 27 11:57:05 2008

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];
}

But: If the language is switched to German, this does no longer work. 
Now one would have to look for "Schrift" instead.

What I really want is:
NSInvocation *i = [ self invocationOnTopOfUndoStack]; But such a 
method I cannot find.

Or: +[NSTextView undoActionNameToBeUsedForSettingFonts] which would 
return "Schrift wählen" if the language currently is set to German.
Again - cannot find such a method.

So - what can I do?


> You can switch the document's undo manager early in the document 
> creation sequence.


Yes. I did in MyDocument init:
MyUndoManager *undoManager = [ [ MyUndoManager alloc ] 
initForDocument: self ];    
[ self setUndoManager: undoManager ];    
[ undoManager release ];


Kind regards,

Gerriet.

Related mailsAuthorDate
mlEphemeral Changes Gerriet M. Denkman… Mar 25, 18:48
mlRe: Ephemeral Changes Graham Cox Mar 25, 23:12
mlRe: Ephemeral Changes Gerriet M. Denkman… Mar 26, 03:07
mlRe: Ephemeral Changes Sherm Pendley Mar 26, 04:07
mlRe: Ephemeral Changes Gerriet M. Denkman… Mar 26, 11:26
mlRe: Ephemeral Changes Graham Cox Mar 26, 22:56
mlRe: Ephemeral Changes Jens Miltner Mar 27, 09:50
mlRe: Ephemeral Changes Gerriet M. Denkman… Mar 27, 11:57
mlRe: Ephemeral Changes Jens Miltner Mar 27, 14:46
mlRe: Ephemeral Changes Gerriet M. Denkman… Mar 27, 18:44
mlRe: Ephemeral Changes Gerriet M. Denkman… Mar 27, 18:48