Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
OpenedFile / FileModels refactoring #303
Originally, view contents in SharpDevelop were loading/saving files on their own.
When I implemented SD-1234, the IViewContent interface was changed to put SharpDevelop in control of when files are saved/loaded (previously, the view content was in control).
Also, loading/saving a higher-level representation of the data really shouldn't be the job of the view content - we should separate model from view!
Here is a new idea that I've been considering for quite some while:
The basic idea is that instead of synchronizing multiple views by saving/loading through MemoryStreams, we will synchronize them by making them share the underlying model. If views use different kinds of models, the save/load functionality of the models will be used to convert from one type of model to the other.
API idea (from view content PoV):
If the view content needs multiple files, it can grab several models directly in the viewcontent ctor -- no more waiting for several
In the case where the file is open in multiple different views (e.g. text and hex editor), we will have multiple models that can potentially be modified
When saving, changes should be directly written into the model; and the model implementation is responsible of notifying the OpenedFile of the changes