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

View File

@ -335,9 +335,11 @@ public:
* parts or body styles in the component. See SetCommonToAllParts()
* 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.
* @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 );

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
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.
* This requires the user to open each part or body style to make changes
* 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;

View File

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