Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!usc!apple!ksand@apple.com From: ksand@apple.com (Kent Sandvik) Newsgroups: comp.sys.mac.programmer Subject: Re: MacApp question on TTEView Message-ID: <14200@goofy.Apple.COM> Date: 23 Jun 91 01:27:27 GMT References: <1991Jun20.173035.29174@doc.ic.ac.uk> Sender: usenet@Apple.COM Organization: Apple Lines: 24 In article <1991Jun20.173035.29174@doc.ic.ac.uk>, kn@doc.ic.ac.uk (Keng Ng) writes: > > I need to keep track of the number of changes that have been applied to the > text in a TTEView. (Similar to the fChangeCount field of TDocument). My > first idea was to override the DoKeyCommand method to increment a field > within the view, but this won't work if the text was changed though cut and > paste. > > I then thought of overriding the methods of TTECommand or its subclasses. > Before I spent too much time figuring out how these work (I've had a look > but am a little confused), can someone tell me whether I'm heading in the > right direction ? Larry, Keith, Kent, anyone ? I checked the MacApp sources, and yes the TTECommand should handle both typing (TTETypingCommand) cut/copy (TTECutcopyCommand) and pasting (TTEPasteCommand). Now depending on the actual need of logging (typing, paste only, or also cut/copy) one could overrided either the TTECommand.ITECommand and keep track of changes in the actual view, or separate this into various sub TECommand objects. So you could subclass these and keep track of changes - maybe there's a better way. I checked for the fSpecsChanged field, but it does not seem to be updated in every case. ..Saturday evening, so I guess I should go home. Kent