← Back to team overview

kicad-developers team mailing list archive

Re: Symbol library code changes

 

Le 06/11/2019 à 21:34, Wayne Stambaugh a écrit :
> 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 did not really have a look into the code, but I encountered an issue
in DIALOG_EDIT_COMPONENT_IN_LIBRARY dialog: the page 0 is incorrectly
drawn (the page 1 is drawn as background of page 0).

Attached a patch that fixes this issue (already encountered in
simulation options frame).

To remove a page from a wxNotebook, using Hide() is incorrect: one can
hide a widget inside a page, not the page itself.
(RemovePage must be used instead)

Hide() the panel can work on some platforms, but not all.
Moreover Show() the panel draws this panel in the background of the
active panel!
Strange result...

Thanks.

-- 
Jean-Pierre CHARRAS
 eeschema/dialogs/dialog_edit_component_in_lib.cpp | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/eeschema/dialogs/dialog_edit_component_in_lib.cpp b/eeschema/dialogs/dialog_edit_component_in_lib.cpp
index 0e3edcf67..2add8156c 100644
--- a/eeschema/dialogs/dialog_edit_component_in_lib.cpp
+++ b/eeschema/dialogs/dialog_edit_component_in_lib.cpp
@@ -684,10 +684,11 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnSizeGrid( wxSizeEvent& event )
 
 void DIALOG_EDIT_COMPONENT_IN_LIBRARY::syncControlStates( bool aIsAlias )
 {
+    // Remove the not wanted notebook page.
+    // *Do not use* Hide(), it is suitable to hide a widget,
+    // but it is not suitable to hide a notebook page (that is not a widget)
     if( aIsAlias )
-        m_PanelFootprintFilter->Hide();
-    else
-        m_PanelFootprintFilter->Show();
+        m_NoteBook->RemovePage( 1 );
 
     bSizerLowerBasicPanel->Show( !aIsAlias );
     bButtonSize->Show( !aIsAlias );

Follow ups

References