[Lazarus] Component palette enhancements

Michael Van Canneyt michael at freepascal.org
Wed Apr 6 17:48:44 CEST 2022



On Wed, 6 Apr 2022, Sven Barth wrote:

> Michael Van Canneyt via lazarus <lazarus at lists.lazarus-ide.org> schrieb am
> Mi., 6. Apr. 2022, 14:47:
>
>>
>>
>> On Wed, 6 Apr 2022, Sven Barth via lazarus wrote:
>>
>>> Michael Van Canneyt via lazarus <lazarus at lists.lazarus-ide.org> schrieb
>> am
>>> Mi., 6. Apr. 2022, 12:56:
>>>
>>>>
>>>> 1. Currently a component is identified by its class name.
>>>>
>>>>     This should be enhanced: a component must be identified with
>>>> UnitName.Name.
>>>>     a unit name is a "namespace" and so MyControls.TButton <>
>>>> StdCtrls.TButton.
>>>>
>>>>     Currently there are several component name clashes in the pas2js and
>>>> FPC class trees.
>>>>
>>>
>>> The streaming system can't differentiate by unit name, so this simply
>> isn't
>>> possible.
>>
>> I know that.
>>
>> We simply need to adapt the streaming system so it can,
>> I already studied that, it's fairly trivial:
>>
>> * When writing: write UnitName.ComponentName instead of ComponentName.
>>    A trivial change, which can be done in a backward compatible manner.
>>
>> * When reading, there are 2 lines that must be changed:
>>    One in GetClass and one in TReader.FindComponentClass.
>>
>> * To handle the text format, 2 lines need changing.
>>
>> So this is not exactly lots of work.
>>
>
> But then this needs to be in FPC first and there it will only be officially
> available once 3.4.0 is released. And since Lazarus supports the last two
> releases it would need to be handled in a way that allows the user to cater
> to older FPC versions as well.

Yes. Hence the 'backwards compatible' writing. 
A global flag to set a default in the writer should suffice.

I'm just proposing things to move forward, hoping to get feedback, 
being informed of possible pitfalls.

That the "unit scoped identifier names" part will not be ready tomorrow was clear
to me before I asked the question. But the first step is asking :-)

Michael.


More information about the lazarus mailing list