← Back to team overview

kicad-developers team mailing list archive

Re: SCH_LEGACY_PLUGIN buffering

 

On 02/28/2017 03:01 PM, Wayne Stambaugh wrote:
> On 2/28/2017 4:37 AM, Maciej Sumiński wrote:
>> Hi Wayne,
>>
>> Would you have a look at the attached patches? I do not want to
>> introduce changes to the schematic plugins code without your approval.
>>
>> The first one removes multiple chunks of code that regenerate properties
>> basing on the PART_LIB field values. Instead, a PROPERTIES object is
>> maintained, so it is always ready whenever needed.
> 
> This patch is fine.  I already had this on my list of updates after I
> complete the symbol library table.  Feel free to commit it as it cleans
> up the property creation code.

Ok, committed.

>> Regarding the second patch: I am looking for a way to store temporary
>> changes to libraries. Libraries are linked to files, and now the binding
>> is even stronger, as files are reloaded upon a change [1].
>>
>> It means that once I save only a part of modifications to a library, my
>> buffer will be reloaded and the remaining unsaved changes will be gone.
>> Do you think it is reasonable to disable cache updating when buffering
>> is enabled?
> 
> I not sure I understand your question but the cache reloading doesn't
> make sense when copying libraries and creating the schematic cache
> library.  Otherwise, you get a library file write every new symbol you
> add to the library.  On a schematic with a 100 different symbols, this
> would be 100 file write operations just to save a library cache file.
> That is why I added buffering to the legacy I/O plugin.  I know it's an
> ugly hack but it's a stop gap measure until the new file format is in
> place which will eliminate the need for library caching.  I suppose we
> could change the cache reloading but that could have it's own set of
> issues.  Technically the cache should only be loaded when the cache
> hasn't been created, the library file name changes, or the file time
> stamp has changed since the last file load.  If the file is being
> reloaded other than these cases, then there is a bug in the cache
> loading logic.

Actually I wanted to limit cache reloading even more: do not reload the
cache when a file timestamp changes & buffering is enabled.

In the new library manager, I am creating copies of modified libraries.
This way, one can select changes to be saved and drop the others.

When a PART_LIB object is created, it is associated with a certain file.
If there are two PART_LIBs associated with the same file and one of them
has a new timestamp (i.e. editor saves *some* of the changes), the other
object will reload everything from the saved file in cacheLib() method,
losing all the unsaved changes.

I want to inhibit cache updating when buffering is enabled. With the
proposed patch, it gets reloaded only if cache == NULL or if the file
name changed, but not when the file contents is changed.

If you see an easier solution, I will be grateful for details.

Cheers,
Orson

> Cheers,
> 
> Wayne
> 
>>
>> Regards,
>> Orson
>>
>> 1. https://git.launchpad.net/kicad/tree/eeschema/sch_legacy_plugin.cpp#n3359
>>
>>
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~kicad-developers
>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~kicad-developers
>> More help   : https://help.launchpad.net/ListHelp
>>
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp
> 


Attachment: signature.asc
Description: OpenPGP digital signature


Follow ups

References