Currently SynEdit handles a lot of different DataSources. Such as:
- The raw text
- Bookmark
- folded/unfolded nodes
- ...

All of this should be collected into a single access point (Model). Such 
a Model could then be shared between 2 or more SynEdits (to view the 
same data, in more than one window).
- For the Viewing in different Windows there may be a need for 
individual SynEdits to have privatized parts of the public/shared Model. 
Such as different nodes may be folded.
- The public/shareable model would have to be ref-counted. Or explicit 
ownership would need to be assigned and the owner would need to keep 
track of all Shareholders.
- The Model can be serialized. Special classes would to this work. 
Therefore a model can be saved to one file, or to a set of files

Those are just a few points to start looking at design details for such 
a model.

So far this only concerns SynEdit.


But for Lazarus a benefit could be, that such a model could also contain 
data, on top of the information hold for synEdit. The Lfm (FormDesigner) 
info could become part of this.
The it would only need an appropriate serialize class to save all of them.

This may simplify the current implementation (even so I admit much based 
on assumption on fragmented knowledge) which has to retrieve this info 
from the various components. (the need for the source-editor or main ide 
to fetch the text from SynEdit)

The Model could also carry callback lists, so the anybody who needs to 
know that it was loaded or saved could register a callback
  Model.AddOnSerailizedCallback( AMethod )

AMethod may be called with the reason, why serialization took place (e.g 
saved to file)


Just starting some basic thought on it. It will be a very long way, and 
a very long time before any of this goes into implementation.

Best regards
Martin


> In some places below, I am unsure what you meant by "component":
> - the "view" (as in MVC)
> - the overall editor (as in SynEdit)
>
> Hans-Peter Diettrich wrote:
>> Martin Friebe schrieb:
>>  
>>> Model shall contain
>>> - the raw text
>>> - bookmarks, and other marks
>>> - foldable secitions
>>> - ...
>>>
>>> Other information can be local to a specific Component (in case 
>>> multiply component display the same model in more than one window). 
>>> An example would be which sections are folded. This info may or may 
>>> not be part of the model
>>>     
>>
>> Right. We should start with the persistent information, stored 
>> together with the text on disk, then add all information that is 
>> common to all (multiple) Views.
>>   
> Serializing the Model for storage purposes (such as saving to a file 
> or many files) for me comes after the decision how the model looks.
>
> There may be more than one way to serialize the model. As there are 
> many ways to use SynEdit.
> - In Lazarus it is used a SourceEditor, so serializing should write 
> the Text information into one file, and other information into another 
> file.
> - In User Applications, people may wish to serialize the model into 
> just one file (which can not be edited by other editors)
>
>>> We could differ between a public and a private model. (Probably not 
>>> needed)
>>>     
>> Most probably not needed in this form, default is the public Model.
> Actually we may need. Example folding.
> Having the same model displayed in many Windows, the user may want to 
> fold different nodes in each Window.
> Or even use different highlighters, leading to different nodes being 
> available.
>
> The design of this must leave the choice to the user, which 
> information is hold in the public, and which in the private model. The 
> private Model can store the same info as the public. The private model 
> only stores info the user whises to be different from the public 
> model, all other info will be forwarded.
>
> However concerning the design of the other Classes (Controller/View), 
> the differentation between private or public model is not relevant. 
> They access one Model. This Model knows what to do.
[.....]

_______________________________________________
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to