SonyWWS / ATF

Authoring Tools Framework (ATF) is a set of C#/.NET components for making tools on Windows. ATF has been in continuous development in Sony Computer Entertainment's (SCE) Worldwide Studios central tools group since early 2005. ATF has been used by most SCE first party studios to make many custom tools such as Naughty Dog’s level editor and shader editor for The Last of Us, Guerrilla Games’ sequence editor for Killzone games (including the Killzone: Shadow Fall PS4 launch title), an animation blending tool at Santa Monica Studio, a level editor at Bend Studio, a visual state machine editor for Quantic Dream, sound editing tools, and many others.
Apache License 2.0
1.89k stars 262 forks source link

Save button does not update in DomTreeEditor #41

Closed nrvllrgrs closed 8 years ago

nrvllrgrs commented 8 years ago

In the DomTreeEditor sample project (release 3.9.0), the Save button in the menu or toolbar does not become enabled. Although, one can still use Ctrl + S to save.

Ron2 commented 8 years ago

Thank you for reporting this. I can reproduce the problem in the latest release. It looks like this sample app never marks its document as "dirty" (modified) which is why the File -> Save menu command and the toolstrip icon are disabled. That's another mystery and maybe a separate bug as to why Ctrl+S still works! I'll look into this more tomorrow.

Ron2 commented 8 years ago

I checked in a fix. Thanks again for reporting this.

The sample app had overridden the Dirty property in the base class DomDocument, but did not call the base class's OnDirtyChanged() when the Dirty property was changing. So, the DirtyChanged event wasn't being raised which eventually caused CommandService to not enable the Save command. Ctrl+S still worked because keyboard shortcuts cause the CommandService to double-check if the ICommandClient could do the command. The fix was to simplify the code -- there was no need to override the Dirty property; instead this sample app just needed to listen to the EditingContext's DirtyChanged event and update the document's dirty flag accordingly.