• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Ephemeral Changes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Ephemeral Changes


  • Subject: Re: Ephemeral Changes
  • From: "Gerriet M. Denkmann" <email@hidden>
  • Date: Thu, 27 Mar 2008 11:57:05 +0100


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.

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please 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


  • Follow-Ups:
    • Re: Ephemeral Changes
      • From: Jens Miltner <email@hidden>
References: 
 >Ephemeral Changes (From: "Gerriet M. Denkmann" <email@hidden>)
 >Re: Ephemeral Changes (From: Graham Cox <email@hidden>)
 >Re: Ephemeral Changes (From: "Gerriet M. Denkmann" <email@hidden>)
 >Re: Ephemeral Changes (From: "Sherm Pendley" <email@hidden>)
 >Re: Ephemeral Changes (From: "Gerriet M. Denkmann" <email@hidden>)
 >Re: Ephemeral Changes (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: Getting a list of all classes, etc...
  • Next by Date: Getting other application window reference
  • Previous by thread: Re: Ephemeral Changes
  • Next by thread: Re: Ephemeral Changes
  • Index(es):
    • Date
    • Thread