PistonDevelopers / editor

Editor interface
MIT License
4 stars 1 forks source link

Decouple actions from editor #14

Open bvssvni opened 9 years ago

bvssvni commented 9 years ago

If actions can do all their work through the Editor trait, then it is possible to control actions externally without adding dependencies to the editor controller. The only thing shared between the editor and actions could be the type of the data that gets edited.

For example, one could write a tool controller that had button settings and linked up actions through fn (&mut Editor) -> Result<(), ()>. The editor or tool controller do not need to depend on the actions, so it could be used as a library and extended with new features.

Tool controllers could be part of the library that shares the tool state between editor and actions. There could be a default alternative for tool controller. However, it will be possible to switch it out for another.