Add specific selection updating when adding 3D models.
This keeps us from being at the receiving end of wxWidgets' vagaries. Fixes https://gitlab.com/kicad/code/kicad/issues/3760
This commit is contained in:
parent
d3e2345f94
commit
faace3090c
|
@ -493,6 +493,8 @@ void DIALOG_FOOTPRINT_BOARD_EDITOR::OnAdd3DModel( wxCommandEvent& )
|
||||||
if( !m_modelsGrid->CommitPendingChanges() )
|
if( !m_modelsGrid->CommitPendingChanges() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
int selected = m_modelsGrid->GetGridCursorRow();
|
||||||
|
|
||||||
PROJECT& prj = Prj();
|
PROJECT& prj = Prj();
|
||||||
MODULE_3D_SETTINGS model;
|
MODULE_3D_SETTINGS model;
|
||||||
|
|
||||||
|
@ -520,6 +522,7 @@ void DIALOG_FOOTPRINT_BOARD_EDITOR::OnAdd3DModel( wxCommandEvent& )
|
||||||
if( !S3D::Select3DModel( this, Prj().Get3DCacheManager(), initialpath, filter, &model )
|
if( !S3D::Select3DModel( this, Prj().Get3DCacheManager(), initialpath, filter, &model )
|
||||||
|| model.m_Filename.empty() )
|
|| model.m_Filename.empty() )
|
||||||
{
|
{
|
||||||
|
select3DModel( selected );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -547,6 +550,7 @@ void DIALOG_FOOTPRINT_BOARD_EDITOR::OnAdd3DModel( wxCommandEvent& )
|
||||||
m_modelsGrid->SetCellValue( idx, 0, filename );
|
m_modelsGrid->SetCellValue( idx, 0, filename );
|
||||||
m_modelsGrid->SetCellValue( idx, 1, wxT( "1" ) );
|
m_modelsGrid->SetCellValue( idx, 1, wxT( "1" ) );
|
||||||
|
|
||||||
|
select3DModel( idx );
|
||||||
m_PreviewPane->UpdateDummyModule();
|
m_PreviewPane->UpdateDummyModule();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -565,6 +569,8 @@ void DIALOG_FOOTPRINT_BOARD_EDITOR::OnAdd3DRow( wxCommandEvent& )
|
||||||
m_modelsGrid->AppendRows( 1 );
|
m_modelsGrid->AppendRows( 1 );
|
||||||
m_modelsGrid->SetCellValue( row, 1, wxT( "1" ) );
|
m_modelsGrid->SetCellValue( row, 1, wxT( "1" ) );
|
||||||
|
|
||||||
|
select3DModel( row );
|
||||||
|
|
||||||
m_modelsGrid->SetFocus();
|
m_modelsGrid->SetFocus();
|
||||||
m_modelsGrid->MakeCellVisible( row, 0 );
|
m_modelsGrid->MakeCellVisible( row, 0 );
|
||||||
m_modelsGrid->SetGridCursor( row, 0 );
|
m_modelsGrid->SetGridCursor( row, 0 );
|
||||||
|
|
|
@ -404,7 +404,7 @@ void DIALOG_FOOTPRINT_FP_EDITOR::OnRemove3DModel( wxCommandEvent& )
|
||||||
m_shapes3D_list.erase( m_shapes3D_list.begin() + idx );
|
m_shapes3D_list.erase( m_shapes3D_list.begin() + idx );
|
||||||
m_modelsGrid->DeleteRows( idx );
|
m_modelsGrid->DeleteRows( idx );
|
||||||
|
|
||||||
select3DModel( idx-1 ); // will clamp idx within bounds
|
select3DModel( idx ); // will clamp idx within bounds
|
||||||
m_PreviewPane->UpdateDummyModule();
|
m_PreviewPane->UpdateDummyModule();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -415,6 +415,8 @@ void DIALOG_FOOTPRINT_FP_EDITOR::OnAdd3DModel( wxCommandEvent& )
|
||||||
if( !m_modelsGrid->CommitPendingChanges() )
|
if( !m_modelsGrid->CommitPendingChanges() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
int selected = m_modelsGrid->GetGridCursorRow();
|
||||||
|
|
||||||
PROJECT& prj = Prj();
|
PROJECT& prj = Prj();
|
||||||
MODULE_3D_SETTINGS model;
|
MODULE_3D_SETTINGS model;
|
||||||
|
|
||||||
|
@ -442,6 +444,7 @@ void DIALOG_FOOTPRINT_FP_EDITOR::OnAdd3DModel( wxCommandEvent& )
|
||||||
if( !S3D::Select3DModel( this, Prj().Get3DCacheManager(), initialpath, filter, &model )
|
if( !S3D::Select3DModel( this, Prj().Get3DCacheManager(), initialpath, filter, &model )
|
||||||
|| model.m_Filename.empty() )
|
|| model.m_Filename.empty() )
|
||||||
{
|
{
|
||||||
|
select3DModel( selected );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -469,6 +472,7 @@ void DIALOG_FOOTPRINT_FP_EDITOR::OnAdd3DModel( wxCommandEvent& )
|
||||||
m_modelsGrid->SetCellValue( idx, 0, filename );
|
m_modelsGrid->SetCellValue( idx, 0, filename );
|
||||||
m_modelsGrid->SetCellValue( idx, 1, wxT( "1" ) );
|
m_modelsGrid->SetCellValue( idx, 1, wxT( "1" ) );
|
||||||
|
|
||||||
|
select3DModel( idx );
|
||||||
m_PreviewPane->UpdateDummyModule();
|
m_PreviewPane->UpdateDummyModule();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -487,6 +491,8 @@ void DIALOG_FOOTPRINT_FP_EDITOR::OnAdd3DRow( wxCommandEvent& )
|
||||||
m_modelsGrid->AppendRows( 1 );
|
m_modelsGrid->AppendRows( 1 );
|
||||||
m_modelsGrid->SetCellValue( row, 1, wxT( "1" ) );
|
m_modelsGrid->SetCellValue( row, 1, wxT( "1" ) );
|
||||||
|
|
||||||
|
select3DModel( row );
|
||||||
|
|
||||||
m_modelsGrid->SetFocus();
|
m_modelsGrid->SetFocus();
|
||||||
m_modelsGrid->MakeCellVisible( row, 0 );
|
m_modelsGrid->MakeCellVisible( row, 0 );
|
||||||
m_modelsGrid->SetGridCursor( row, 0 );
|
m_modelsGrid->SetGridCursor( row, 0 );
|
||||||
|
|
Loading…
Reference in New Issue