kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #42466
Re: Symbol library code changes
-
To:
Seth Hillbrand <seth@xxxxxxxxxxxxx>
-
From:
Wayne Stambaugh <stambaughw@xxxxxxxxx>
-
Date:
Thu, 7 Nov 2019 14:30:19 -0500
-
Autocrypt:
addr=stambaughw@xxxxxxxxx; prefer-encrypt=mutual; keydata= mQGiBEM0hxQRBAC2fNh3YOVLu1d5GZ0SbrTNldGiGnCJPLqzEnqFX9v6jmf33TMt6EmSLkl6 Wtfkoj0nVwKxcYmJkA8DX0QAokBkwNIzhSsBzQvthBLIk/5LnPVVKrEXOcL4mUyH1doKlkaE slgJozNa6Av+oavcvD02o1zJOloBbaHlNlyRt7fKswCgtIFlVjWggVH/15KfWk+Qo5JVPbME AIUBAQyL2OAx0n60AWec2WHnO9buHuG0ibtICgUMkE+2MRmYyKwYRdyVwGoIUemFuOyHp0AJ InX4T+vy2E7vkwODqjtMLfIoRkokW74Fi4nrvjlhOAw/vdq/twLbAmR9MOfPTpR4y7kQy1O2 /n+RkkRvh26vTzfbQmrH7cBJhk6aA/9Uwvu3E4zNJgHVZeS0HyWtmR1eOPPRbnkPgJTToX5O KMKzTJI/FX6kT7cFoCamitHrW3BJP4Dx+cMMsa47EGxqVTdbVJ4LjogsXTXxb+0Fn1u4zBdx x3Cer6O7+hqWy7zvpzeC6nSREjqDKa5CgHtv/GLm5uFPOmsjAsnHj2tlBrQmV2F5bmUgU3Rh bWJhdWdoIDxzdGFtYmF1Z2h3QGdtYWlsLmNvbT6IeAQTEQIAOBYhBOffs6CbblRzBkv33BtR cWlZ+CReBQJbFBS2AhsDBQsJCAcCBhUKCQgLAgQWAgMBAh4BAheAAAoJEBtRcWlZ+CReMI8A nRbrLkzp7+c2f0vX7sfg4ICX8LAKAJ9uClo4uJajmZa5zZrL2nKdZlUwIrkCDQRDNIcxEAgA gCru+3/aOC6RCjpvYC72wY+d5SmHphC6yeiV2/mOumyt5MLo/Ps2GznZr11JspqFk5K/Zpvp MMLqqjDZ39+50a2iKRQFJ6NlK+hJWMmj6eJygQrCwYo3Gjc6CqfrqUv+8VSnf/i5sIZmtOVA 4ZjML18MuBvMSsNdVLFJd5HNnYb1iOECpvqdPVh/21LLCEw7MUUGGnHBhCrmk2aJe5hFmcSN g4ldBcXrgMQBwf7aMVoobXBMFDb/IENByXn0llB7Gr2IFMRmNS9/p8s/II1Yl2bTqyX4FSz8 cfn7C9KEz7faZ7wzAcpwHFC/zs3JoAjJ0IEKdNUpIwAlKMzT3CzctwADBQf/cxpG28MKyrqk nNmq/8LQLy+x6FSYXBLjxQz9BiBNYeesDZQ6J5UbL1mjpJzMa5tLZypPYo4bbGyR22hrbyDF K7m6AcVaMIJKl98g4ukMutFfAJyRDaREH5Zl/X1P4u1Z/yaAIy9mKaNbaK1/5djNJ5wCTFen TUgAp9xdc30kGkFDdLJFp5uxDY4P0vaZiZdjUCvDM3Zjv5IzpNOfxVqTUBQNUP/BnnKhkk0p DTD6s3X8S+D0rOtEBQ8K0cwERI/E8EFa8nj0TNw4e2MYGR8wg+SxqJ7z5f0zPY0bO6G9DDFB wYCqzzPWGqdAh9vA5971TAbPERtdFybhkurozp2SfYhJBBgRAgAJBQJDNIcxAhsMAAoJEBtR cWlZ+CResHUAniULLCWiT26ieRTl7N2vS6vBo/DuAJ4m7Ss/gyiW6ybTn1ctDXAUgm2QVQ==
-
Cc:
KiCad Developers <kicad-developers@xxxxxxxxxxxxxxxxxxx>
-
In-reply-to:
<56d6190d-0a28-f72f-8bd4-0d513010bacd@kipro-pcb.com>
-
Openpgp:
preference=signencrypt
-
User-agent:
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0
Hey Seth,
On 11/7/19 12:22 PM, Seth Hillbrand wrote:
> On 2019-11-06 12:34, Wayne Stambaugh wrote:
>> I finally finish up the initial attempt at simple inheritance for the
>> symbol library code. The change is non-trivial and will likely have
>> some unexpected side affects that I missed. I pushed the branch to my
>> personal repo[1] and I would like a few pair of extra eyes on it before
>> I merge it into master. If you prefer, I can set up a merge request
>> from this branch in Launchpad.
>>
>> The biggest user facing change is that the concept of aliases is gone
>> which means internally, the LIB_ALIAS object has been removed and all of
>> the information it managed was moved into LIB_PART. This actually
>> simplified some of the UI code but made the LIB_MANAGER and LIB_PART
>> object code more complicated. The symbol library editor works
>> significantly different now. When you select a derived part (formerly a
>> LIB_ALIAS), it will show the parent symbol that it was derived from
>> darkened and all of the edit features disabled. Until the new symbol
>> file format is done and writing to the legacy symbol file format is
>> deprecated, this restriction will have to remain in place. The
>> properties editor no longer has an aliases panel and is limited to what
>> it can change in the derived or parent symbols depending on which symbol
>> is currently being edited. I suspect this will be the biggest stumbling
>> block for existing users so if you can think of a better way to handle
>> this, I'm open to suggestion. The other thing that I am concerned about
>> is symbol library editing. There were a lot of LIB_MANAGER object
>> changes which I am not 100% confident in.
>>
>> Just a couple of other internal changes to be aware of:
>>
>> A flattened copy of the symbol is used in SCH_COMPONENT instead of
>> relying on the weak reference to the library symbol. This way we don't
>> have to worry about the shared pointer disappearing and causing issues.
>> However, this will require that we be diligent about updating modified
>> symbol libraries in the schematic. Otherwise, the schematic could
>> change the next time it is loaded. I'm open to changing this back if we
>> think it's going to be an issue.
>>
>> There is now a compare function for the LIB_PART object which can be
>> rather tricky. I created a new test suite inside the current LIB_PART
>> test file so if you change anything, please run the test to ensure
>> nothing gets broken. I also added a bunch of other new tests for the
>> LIB_PART object.
>>
>> I added code to DIALOG_SHIM to allow the caller to reset the last dialog
>> size when hiding dialog control state changes between dialog instances.
>> We have some dialog windows that are not the correct default size
>> depending on which controls are shown so there is now a convenient way
>> to address this.
>>
>> Please let me know if you find anything so I can get it fixed and merged
>> into master. The next step is to convert the schematic internal units
>> from 1mil to 10nm. Once that step is complete, I will knock out the new
>> symbol library format. Thanks in advance for the help.
>>
>> Cheers,
>>
>> Wayne
>>
>> [1]:https://code.launchpad.net/~stambaughw/kicad/+git/kicad-dev/+ref/lib-alias-merge
>>
>>
>
> Hi Wayne-
>
> I'm psyched to see this progress! Congrats. I'll have a chance to
> fully test after next week but I wanted to get you the code read
> feedback before then.
>
> 1) Compare function:
> - It looks like rhs isn't checked for end() in the loop. While size
> gets checked ahead of time, we've had a couple cases where code gets
> added between checks and loops in the past, so it's probably safer to
> put the check in the loop.
> - Same with the footprint check. Ideally, these would be the same style
> (iterators vs. dereference) but that's minor
> - Do we expect these containers to remain sorted?
I'm not sure thats strictly necessary but I will take a look at it.
>
> 2) You have a few C-style casts in Flatten()>
> 3) The LIB_PART() copy constructor should take a const reference rather
> than the existing one, that should remove the requirement of using
> const_cast in Flatten()
Gaaa! How did I miss that?
>
> 4) That ternary in GetNextDrawItem() is breaking my brain a bit.
This will only get worse with multiple inheritance. Draw items from
each parent will have to be recused to create a final image of the symbol.
>
> 5) In footprint_info.h, if we are returning the wxString itself (instead
> of the reference), it shouldn't be const. (addendum: Also loadAliases())
Missed another one.
>
> 6) sch_view.cpp has a couple c-style casts that can probably be
> compressed into our dyn_cast routine.
>
> 7) DeleteSymbol mixes up it and it1 in the while() loop.
I'll take a look at it.
>
> I can't wait to test it out! On the usability issue for aliases, I
> suspect that this is a time limited constraint, so there shouldn't be
> large issues as people should not be building aliased libraries with the
> master branch at this point. We may want to clarify that in a list
> message. Overall, I am very excited for the new formats. Thanks again
> for taking on this huge job!
Thanks for the review, I should have most of the issues above fixed by
in the next day or so. There are lot more big changes coming. I
desperately want to have the new file formats in place by FOSDEM.
Cheers,
Wayne
>
> Best-
> Seth
>
> Seth Hillbrand
> KiCad Services Corporation
> https://www.kipro-pcb.com
> +1 530 302 5483 | +1 212 603 9372
Follow ups
References