Symbol editor: Fix incorrect pin edition coupling for non interchangeable multi-units symbols.

Fixes: lp:1744680
https://bugs.launchpad.net/kicad/+bug/1744680
This commit is contained in:
jean-pierre charras 2018-01-22 13:33:24 +01:00
parent 2201482e47
commit 6322c90c50
5 changed files with 18 additions and 9 deletions

View File

@ -511,7 +511,7 @@ void LIB_PIN::SetVisible( bool visible )
} }
void LIB_PIN::EnableEditMode( bool enable, bool editPinByPin ) void LIB_PIN::EnableEditMode( bool aEnable, bool aEditPinByPin )
{ {
LIB_PINS pinList; LIB_PINS pinList;
@ -526,11 +526,11 @@ void LIB_PIN::EnableEditMode( bool enable, bool editPinByPin )
continue; continue;
if( ( pinList[i]->m_position == m_position ) if( ( pinList[i]->m_position == m_position )
&& ( pinList[i]->m_orientation == m_orientation ) && ( pinList[i]->m_orientation == m_orientation )
&& !IsNew() && !IsNew() && !aEditPinByPin && aEnable )
&& editPinByPin == false {
&& enable )
pinList[i]->SetFlags( IS_LINKED | IN_EDIT ); pinList[i]->SetFlags( IS_LINKED | IN_EDIT );
}
else else
pinList[i]->ClearFlags( IS_LINKED | IN_EDIT ); pinList[i]->ClearFlags( IS_LINKED | IN_EDIT );
} }

View File

@ -335,9 +335,11 @@ public:
* parts or body styles in the component. See SetCommonToAllParts() * parts or body styles in the component. See SetCommonToAllParts()
* and SetCommonToAllBodyStyles() for more information. * and SetCommonToAllBodyStyles() for more information.
* *
* @param aEnable True marks all common pins for editing mode. False * @param aEnable = true marks all common pins for editing mode. False
* clears the editing mode. * clears the editing mode.
* @param aEditPinByPin Enables the edit pin by pin mode. * @param aEditPinByPin == true enables the edit pin by pin mode.
* aEditPinByPin == false enables the pin edition coupling between pins at the same location
* if aEnable == false, aEditPinByPin is not used
*/ */
void EnableEditMode( bool aEnable, bool aEditPinByPin = false ); void EnableEditMode( bool aEnable, bool aEditPinByPin = false );

View File

@ -1075,6 +1075,9 @@ void LIB_EDIT_FRAME::SetCurPart( LIB_PART* aPart )
// retain in case this wxFrame is re-opened later on the same PROJECT // retain in case this wxFrame is re-opened later on the same PROJECT
Prj().SetRString( PROJECT::SCH_LIBEDIT_CUR_PART, partName ); Prj().SetRString( PROJECT::SCH_LIBEDIT_CUR_PART, partName );
// Ensure pin editind can be coupled for multi unitz
m_editPinsSeparately = aPart && aPart->IsMulti() && aPart->UnitsLocked();
} }

View File

@ -91,6 +91,10 @@ class LIB_EDIT_FRAME : public SCH_BASE_FRAME
* regardless other pins at the same location. * regardless other pins at the same location.
* This requires the user to open each part or body style to make changes * This requires the user to open each part or body style to make changes
* to the other pins at the same location. * to the other pins at the same location.
* To know if others pins must be coupled when editing a pin, use
* SynchronizePins() instead of m_editPinsSeparately, because SynchronizePins()
* is more reliable (takes in account the fact units are interchangeable,
* there are more than one unit )
*/ */
bool m_editPinsSeparately; bool m_editPinsSeparately;

View File

@ -171,7 +171,7 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event )
LastPinCommonUnit = dlg.GetAddToAllParts(); LastPinCommonUnit = dlg.GetAddToAllParts();
LastPinVisible = dlg.GetVisible(); LastPinVisible = dlg.GetVisible();
pin->EnableEditMode( true, m_editPinsSeparately ); pin->EnableEditMode( true, SynchronizePins()? false : true );
pin->SetName( dlg.GetPinName() ); pin->SetName( dlg.GetPinName() );
pin->SetNameTextSize( GetLastPinNameSize() ); pin->SetNameTextSize( GetLastPinNameSize() );
pin->SetNumber( dlg.GetPadName() ); pin->SetNumber( dlg.GetPadName() );
@ -199,7 +199,7 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event )
m_canvas->Refresh(); m_canvas->Refresh();
} }
pin->EnableEditMode( false, m_editPinsSeparately ); pin->EnableEditMode( false );
// Restore pin flags, that can be changed by the dialog editor // Restore pin flags, that can be changed by the dialog editor
pin->ClearFlags(); pin->ClearFlags();