Make FOOTPRINT_PREVIEW_PANEL a FPHOLDER.

Also makes sure it get its user_units set up.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14913

(cherry picked from commit d18b0c62f6)
This commit is contained in:
Jeff Young 2023-06-10 13:34:54 +01:00
parent 472879e95a
commit 7d30a2bc54
1 changed files with 15 additions and 0 deletions

View File

@ -40,6 +40,7 @@
#include <view/view.h>
#include <wx/stattext.h>
#include <zoom_defines.h>
#include <dialog_shim.h>
FOOTPRINT_PREVIEW_PANEL::FOOTPRINT_PREVIEW_PANEL( KIWAY* aKiway, wxWindow* aParent,
std::unique_ptr<KIGFX::GAL_DISPLAY_OPTIONS> aOpts,
@ -53,8 +54,22 @@ FOOTPRINT_PREVIEW_PANEL::FOOTPRINT_PREVIEW_PANEL( KIWAY* aKiway, wxWindow* aPare
ShowScrollbars( wxSHOW_SB_NEVER, wxSHOW_SB_NEVER );
EnableScrolling( false, false ); // otherwise Zoom Auto disables GAL canvas
wxWindow* topLevelParent = aParent;
while( topLevelParent && !topLevelParent->IsTopLevel() )
topLevelParent = topLevelParent->GetParent();
if( topLevelParent )
{
if( DIALOG_SHIM* parentDlg = dynamic_cast<DIALOG_SHIM*>( topLevelParent ) )
m_userUnits = parentDlg->GetUserUnits();
else if( UNITS_PROVIDER* parentFrame = dynamic_cast<UNITS_PROVIDER*>( topLevelParent ) )
m_userUnits = parentFrame->GetUserUnits();
}
m_dummyBoard = std::make_unique<BOARD>();
m_dummyBoard->SetUserUnits( m_userUnits );
m_dummyBoard->SetBoardUse( BOARD_USE::FPHOLDER );
UpdateColors();
SyncLayersVisibility( m_dummyBoard.get() );