Keep value in sync with libId when they match.
Fixes: lp:1797482 * https://bugs.launchpad.net/kicad/+bug/1797482
This commit is contained in:
parent
29af26565d
commit
a6b36adb32
|
@ -235,7 +235,7 @@ GRIDCELL_AUTOWRAP_STRINGRENDERER::BreakWord(wxDC& dc,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define GRID_CELL_MARGIN 3
|
#define GRID_CELL_MARGIN 4
|
||||||
|
|
||||||
int GRIDCELL_AUTOWRAP_STRINGRENDERER::GetHeight( wxDC& aDC, wxGrid* aGrid, int aRow, int aCol )
|
int GRIDCELL_AUTOWRAP_STRINGRENDERER::GetHeight( wxDC& aDC, wxGrid* aGrid, int aRow, int aCol )
|
||||||
{
|
{
|
||||||
|
@ -246,7 +246,7 @@ int GRIDCELL_AUTOWRAP_STRINGRENDERER::GetHeight( wxDC& aDC, wxGrid* aGrid, int a
|
||||||
rect.SetWidth( aGrid->GetColSize( aCol ) - ( 2 * GRID_CELL_MARGIN ) );
|
rect.SetWidth( aGrid->GetColSize( aCol ) - ( 2 * GRID_CELL_MARGIN ) );
|
||||||
|
|
||||||
const size_t numLines = GetTextLines( *aGrid, aDC, *attr, rect, aRow, aCol ).size();
|
const size_t numLines = GetTextLines( *aGrid, aDC, *attr, rect, aRow, aCol ).size();
|
||||||
const int textHeight = numLines *aDC.GetCharHeight();
|
const int textHeight = numLines * aDC.GetCharHeight();
|
||||||
|
|
||||||
attr->DecRef();
|
attr->DecRef();
|
||||||
|
|
||||||
|
@ -778,8 +778,7 @@ bool DIALOG_EDIT_COMPONENTS_LIBID::TransferDataFromWindow()
|
||||||
if( new_libid.IsEmpty() || new_libid == m_grid->GetCellValue( row, COL_CURR_LIBID ) )
|
if( new_libid.IsEmpty() || new_libid == m_grid->GetCellValue( row, COL_CURR_LIBID ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// a new lib id is found and was already validated.
|
// A new lib id is found and was already validated.
|
||||||
// set this new value
|
|
||||||
LIB_ID id;
|
LIB_ID id;
|
||||||
id.Parse( new_libid, LIB_ID::ID_SCH, true );
|
id.Parse( new_libid, LIB_ID::ID_SCH, true );
|
||||||
|
|
||||||
|
@ -788,6 +787,12 @@ bool DIALOG_EDIT_COMPONENTS_LIBID::TransferDataFromWindow()
|
||||||
if( cmp.m_Row != row )
|
if( cmp.m_Row != row )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
SCH_FIELD* value = cmp.m_Component->GetField( VALUE );
|
||||||
|
|
||||||
|
// If value is a proxy for the itemName then make sure it gets updated
|
||||||
|
if( cmp.m_Component->GetLibId().GetLibItemName().wx_str() == value->GetText() )
|
||||||
|
value->SetText( id.GetLibItemName().wx_str() );
|
||||||
|
|
||||||
cmp.m_Component->SetLibId( id );
|
cmp.m_Component->SetLibId( id );
|
||||||
change = true;
|
change = true;
|
||||||
cmp.m_Screen->SetModify();
|
cmp.m_Screen->SetModify();
|
||||||
|
|
Loading…
Reference in New Issue