Make sure to initialize cell start location.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/17379
This commit is contained in:
parent
c8d897ed0f
commit
fbc433deaa
|
@ -85,7 +85,8 @@ SCH_TABLECELL* SCH_EDIT_TABLE_TOOL::copyCell( SCH_TABLECELL* aSource )
|
||||||
{
|
{
|
||||||
SCH_TABLECELL* cell = new SCH_TABLECELL();
|
SCH_TABLECELL* cell = new SCH_TABLECELL();
|
||||||
|
|
||||||
cell->SetEnd( aSource->GetEnd() - aSource->GetStart() );
|
cell->SetStart( aSource->GetStart() );
|
||||||
|
cell->SetEnd( aSource->GetEnd() );
|
||||||
cell->SetFillMode( aSource->GetFillMode() );
|
cell->SetFillMode( aSource->GetFillMode() );
|
||||||
cell->SetFillColor( aSource->GetFillColor() );
|
cell->SetFillColor( aSource->GetFillColor() );
|
||||||
|
|
||||||
|
|
|
@ -133,6 +133,7 @@ protected:
|
||||||
int row = topmost->GetRow();
|
int row = topmost->GetRow();
|
||||||
T_TABLE* table = static_cast<T_TABLE*>( topmost->GetParent() );
|
T_TABLE* table = static_cast<T_TABLE*>( topmost->GetParent() );
|
||||||
T_COMMIT commit( getToolMgr() );
|
T_COMMIT commit( getToolMgr() );
|
||||||
|
VECTOR2I pos = table->GetPosition();
|
||||||
|
|
||||||
// Make a copy of the source row before things start moving around
|
// Make a copy of the source row before things start moving around
|
||||||
std::vector<T_TABLECELL*> sources;
|
std::vector<T_TABLECELL*> sources;
|
||||||
|
@ -152,8 +153,11 @@ protected:
|
||||||
for( int afterRow = table->GetRowCount() - 1; afterRow > row; afterRow-- )
|
for( int afterRow = table->GetRowCount() - 1; afterRow > row; afterRow-- )
|
||||||
table->SetRowHeight( afterRow, table->GetRowHeight( afterRow - 1 ) );
|
table->SetRowHeight( afterRow, table->GetRowHeight( afterRow - 1 ) );
|
||||||
|
|
||||||
|
table->SetPosition( pos );
|
||||||
table->Normalize();
|
table->Normalize();
|
||||||
|
|
||||||
|
getToolMgr()->PostEvent( EVENTS::SelectedEvent );
|
||||||
|
|
||||||
commit.Push( _( "Add Row Above" ) );
|
commit.Push( _( "Add Row Above" ) );
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -181,6 +185,7 @@ protected:
|
||||||
int row = bottommost->GetRow();
|
int row = bottommost->GetRow();
|
||||||
T_TABLE* table = static_cast<T_TABLE*>( bottommost->GetParent() );
|
T_TABLE* table = static_cast<T_TABLE*>( bottommost->GetParent() );
|
||||||
T_COMMIT commit( getToolMgr() );
|
T_COMMIT commit( getToolMgr() );
|
||||||
|
VECTOR2I pos = table->GetPosition();
|
||||||
|
|
||||||
// Make a copy of the source row before things start moving around
|
// Make a copy of the source row before things start moving around
|
||||||
std::vector<T_TABLECELL*> sources;
|
std::vector<T_TABLECELL*> sources;
|
||||||
|
@ -200,8 +205,11 @@ protected:
|
||||||
for( int afterRow = table->GetRowCount() - 1; afterRow > row; afterRow-- )
|
for( int afterRow = table->GetRowCount() - 1; afterRow > row; afterRow-- )
|
||||||
table->SetRowHeight( afterRow, table->GetRowHeight( afterRow - 1 ) );
|
table->SetRowHeight( afterRow, table->GetRowHeight( afterRow - 1 ) );
|
||||||
|
|
||||||
|
table->SetPosition( pos );
|
||||||
table->Normalize();
|
table->Normalize();
|
||||||
|
|
||||||
|
getToolMgr()->PostEvent( EVENTS::SelectedEvent );
|
||||||
|
|
||||||
commit.Push( _( "Add Row Below" ) );
|
commit.Push( _( "Add Row Below" ) );
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -227,6 +235,7 @@ protected:
|
||||||
T_TABLE* table = static_cast<T_TABLE*>( leftmost->GetParent() );
|
T_TABLE* table = static_cast<T_TABLE*>( leftmost->GetParent() );
|
||||||
int rowCount = table->GetRowCount();
|
int rowCount = table->GetRowCount();
|
||||||
T_COMMIT commit( getToolMgr() );
|
T_COMMIT commit( getToolMgr() );
|
||||||
|
VECTOR2I pos = table->GetPosition();
|
||||||
|
|
||||||
// Make a copy of the source column before things start moving around
|
// Make a copy of the source column before things start moving around
|
||||||
std::vector<T_TABLECELL*> sources;
|
std::vector<T_TABLECELL*> sources;
|
||||||
|
@ -247,8 +256,11 @@ protected:
|
||||||
for( int afterCol = table->GetColCount() - 1; afterCol > col; afterCol-- )
|
for( int afterCol = table->GetColCount() - 1; afterCol > col; afterCol-- )
|
||||||
table->SetColWidth( afterCol, table->GetColWidth( afterCol - 1 ) );
|
table->SetColWidth( afterCol, table->GetColWidth( afterCol - 1 ) );
|
||||||
|
|
||||||
|
table->SetPosition( pos );
|
||||||
table->Normalize();
|
table->Normalize();
|
||||||
|
|
||||||
|
getToolMgr()->PostEvent( EVENTS::SelectedEvent );
|
||||||
|
|
||||||
commit.Push( _( "Add Column Before" ) );
|
commit.Push( _( "Add Column Before" ) );
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -274,6 +286,7 @@ protected:
|
||||||
T_TABLE* table = static_cast<T_TABLE*>( rightmost->GetParent() );
|
T_TABLE* table = static_cast<T_TABLE*>( rightmost->GetParent() );
|
||||||
int rowCount = table->GetRowCount();
|
int rowCount = table->GetRowCount();
|
||||||
T_COMMIT commit( getToolMgr() );
|
T_COMMIT commit( getToolMgr() );
|
||||||
|
VECTOR2I pos = table->GetPosition();
|
||||||
|
|
||||||
// Make a copy of the source column before things start moving around
|
// Make a copy of the source column before things start moving around
|
||||||
std::vector<T_TABLECELL*> sources;
|
std::vector<T_TABLECELL*> sources;
|
||||||
|
@ -294,8 +307,11 @@ protected:
|
||||||
for( int afterCol = table->GetColCount() - 1; afterCol > col; afterCol-- )
|
for( int afterCol = table->GetColCount() - 1; afterCol > col; afterCol-- )
|
||||||
table->SetColWidth( afterCol, table->GetColWidth( afterCol - 1 ) );
|
table->SetColWidth( afterCol, table->GetColWidth( afterCol - 1 ) );
|
||||||
|
|
||||||
|
table->SetPosition( pos );
|
||||||
table->Normalize();
|
table->Normalize();
|
||||||
|
|
||||||
|
getToolMgr()->PostEvent( EVENTS::SelectedEvent );
|
||||||
|
|
||||||
commit.Push( _( "Add Column After" ) );
|
commit.Push( _( "Add Column After" ) );
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -343,6 +359,8 @@ protected:
|
||||||
{
|
{
|
||||||
commit.Modify( table, getScreen() );
|
commit.Modify( table, getScreen() );
|
||||||
|
|
||||||
|
VECTOR2I pos = table->GetPosition();
|
||||||
|
|
||||||
clearSelection();
|
clearSelection();
|
||||||
table->DeleteMarkedCells();
|
table->DeleteMarkedCells();
|
||||||
|
|
||||||
|
@ -359,7 +377,10 @@ protected:
|
||||||
table->SetRowHeight( row, table->GetRowHeight( row + offset ) );
|
table->SetRowHeight( row, table->GetRowHeight( row + offset ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
table->SetPosition( pos );
|
||||||
table->Normalize();
|
table->Normalize();
|
||||||
|
|
||||||
|
getToolMgr()->PostEvent( EVENTS::SelectedEvent );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( deleted.size() > 1 )
|
if( deleted.size() > 1 )
|
||||||
|
@ -412,6 +433,8 @@ protected:
|
||||||
{
|
{
|
||||||
commit.Modify( table, getScreen() );
|
commit.Modify( table, getScreen() );
|
||||||
|
|
||||||
|
VECTOR2I pos = table->GetPosition();
|
||||||
|
|
||||||
clearSelection();
|
clearSelection();
|
||||||
table->DeleteMarkedCells();
|
table->DeleteMarkedCells();
|
||||||
table->SetColCount( table->GetColCount() - deleted.size() );
|
table->SetColCount( table->GetColCount() - deleted.size() );
|
||||||
|
@ -429,7 +452,10 @@ protected:
|
||||||
table->SetColWidth( col, table->GetColWidth( col + offset ) );
|
table->SetColWidth( col, table->GetColWidth( col + offset ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
table->SetPosition( pos );
|
||||||
table->Normalize();
|
table->Normalize();
|
||||||
|
|
||||||
|
getToolMgr()->PostEvent( EVENTS::SelectedEvent );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( deleted.size() > 1 )
|
if( deleted.size() > 1 )
|
||||||
|
@ -504,6 +530,8 @@ protected:
|
||||||
table->Normalize();
|
table->Normalize();
|
||||||
commit.Push( _( "Merge Cells" ) );
|
commit.Push( _( "Merge Cells" ) );
|
||||||
|
|
||||||
|
getToolMgr()->PostEvent( EVENTS::SelectedEvent );
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -543,6 +571,8 @@ protected:
|
||||||
table->Normalize();
|
table->Normalize();
|
||||||
commit.Push( _( "Unmerge Cells" ) );
|
commit.Push( _( "Unmerge Cells" ) );
|
||||||
|
|
||||||
|
getToolMgr()->PostEvent( EVENTS::SelectedEvent );
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,8 @@ PCB_TABLECELL* PCB_EDIT_TABLE_TOOL::copyCell( PCB_TABLECELL* aSource )
|
||||||
{
|
{
|
||||||
PCB_TABLECELL* cell = new PCB_TABLECELL( aSource->GetParent() );
|
PCB_TABLECELL* cell = new PCB_TABLECELL( aSource->GetParent() );
|
||||||
|
|
||||||
cell->SetEnd( aSource->GetEnd() - aSource->GetStart() );
|
cell->SetStart( aSource->GetStart() );
|
||||||
|
cell->SetEnd( aSource->GetEnd() );
|
||||||
|
|
||||||
return cell;
|
return cell;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue