mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-21 00:21:25 +00:00
Reduce dependency on dynamic_cast.
This commit is contained in:
parent
0bcf6000a4
commit
04b5ccbdb2
@ -135,21 +135,16 @@ void FOOTPRINT_PREVIEW_WIDGET::RefreshAll()
|
||||
FOOTPRINT_PREVIEW_PANEL_BASE* FOOTPRINT_PREVIEW_PANEL_BASE::Create( wxWindow* aParent,
|
||||
KIWAY& aKiway )
|
||||
{
|
||||
FOOTPRINT_PREVIEW_PANEL_BASE* panel = nullptr;
|
||||
wxWindow* panel = nullptr;
|
||||
|
||||
try
|
||||
{
|
||||
KIFACE* kiface = aKiway.KiFACE( KIWAY::FACE_PCB );
|
||||
wxWindow* window = kiface->CreateKiWindow( aParent, FRAME_FOOTPRINT_PREVIEW, &aKiway );
|
||||
|
||||
panel = dynamic_cast<FOOTPRINT_PREVIEW_PANEL_BASE*>( window );
|
||||
|
||||
if( window && !panel )
|
||||
delete window;
|
||||
if( KIFACE* kiface = aKiway.KiFACE( KIWAY::FACE_PCB ) )
|
||||
panel = kiface->CreateKiWindow( aParent, FRAME_FOOTPRINT_PREVIEW, &aKiway );
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
}
|
||||
|
||||
return panel;
|
||||
return (FOOTPRINT_PREVIEW_PANEL_BASE*) panel;
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ S3D_CACHE* PROJECT_PCB::Get3DCacheManager( PROJECT* aProject, bool aUpdateProjDi
|
||||
std::lock_guard<std::mutex> lock( mutex3D_cacheManager );
|
||||
|
||||
// Get the existing cache from the project
|
||||
S3D_CACHE* cache = dynamic_cast<S3D_CACHE*>( aProject->GetElem( PROJECT::ELEM::S3DCACHE ) );
|
||||
S3D_CACHE* cache = static_cast<S3D_CACHE*>( aProject->GetElem( PROJECT::ELEM::S3DCACHE ) );
|
||||
|
||||
if( !cache )
|
||||
{
|
||||
@ -115,7 +115,7 @@ void PROJECT_PCB::Cleanup3DCache( PROJECT* aProject )
|
||||
std::lock_guard<std::mutex> lock( mutex3D_cacheManager );
|
||||
|
||||
// Get the existing cache from the project
|
||||
S3D_CACHE* cache = dynamic_cast<S3D_CACHE*>( aProject->GetElem( PROJECT::ELEM::S3DCACHE ) );
|
||||
S3D_CACHE* cache = static_cast<S3D_CACHE*>( aProject->GetElem( PROJECT::ELEM::S3DCACHE ) );
|
||||
|
||||
if( cache )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user