mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-13 17:53:11 +02:00
Shutdown safety. (Potentially KICAD-TJK.)
This commit is contained in:
parent
cef15bcf30
commit
479daa37c5
@ -290,6 +290,9 @@ void LIB_TREE::ShutdownPreviews()
|
||||
|
||||
if( m_previewWindow )
|
||||
{
|
||||
// Shutdown the preview window's canvas
|
||||
m_adapter->ShutdownPreview( m_previewWindow );
|
||||
|
||||
m_previewWindow->Hide();
|
||||
m_previewWindow->Destroy();
|
||||
m_previewWindow = nullptr;
|
||||
|
@ -55,7 +55,6 @@ public:
|
||||
|
||||
SCH_RENDER_SETTINGS* GetRenderSettings() const;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
void onPaint( wxPaintEvent& WXUNUSED( aEvent ) ) override;
|
||||
|
@ -381,11 +381,12 @@ bool SYMBOL_TREE_SYNCHRONIZING_ADAPTER::HasPreview( const wxDataViewItem& aItem
|
||||
}
|
||||
|
||||
|
||||
static const wxString c_previewName = wxS( "symHoverPreview" );
|
||||
|
||||
|
||||
void SYMBOL_TREE_SYNCHRONIZING_ADAPTER::ShowPreview( wxWindow* aParent,
|
||||
const wxDataViewItem& aItem )
|
||||
{
|
||||
static const wxString c_previewName = wxS( "symHoverPreview" );
|
||||
|
||||
LIB_TREE_NODE* node = ToNode( aItem );
|
||||
wxCHECK( node, /* void */ );
|
||||
|
||||
@ -416,3 +417,15 @@ void SYMBOL_TREE_SYNCHRONIZING_ADAPTER::ShowPreview( wxWindow* aPare
|
||||
|
||||
preview->DisplaySymbol( node->m_LibId, node->m_Unit );
|
||||
}
|
||||
|
||||
|
||||
void SYMBOL_TREE_SYNCHRONIZING_ADAPTER::ShutdownPreview( wxWindow* aParent )
|
||||
{
|
||||
wxWindow* previewWindow = wxWindow::FindWindowByName( c_previewName, aParent );
|
||||
|
||||
if( SYMBOL_PREVIEW_WIDGET* preview = dynamic_cast<SYMBOL_PREVIEW_WIDGET*>( previewWindow ) )
|
||||
{
|
||||
preview->GetCanvas()->SetEvtHandlerEnabled( false );
|
||||
preview->GetCanvas()->StopDrawing();
|
||||
}
|
||||
}
|
@ -50,8 +50,9 @@ public:
|
||||
|
||||
wxDataViewItem GetCurrentDataViewItem() override;
|
||||
|
||||
virtual bool HasPreview( const wxDataViewItem& aItem ) override;
|
||||
virtual void ShowPreview( wxWindow* aParent, const wxDataViewItem& aItem ) override;
|
||||
bool HasPreview( const wxDataViewItem& aItem ) override;
|
||||
void ShowPreview( wxWindow* aParent, const wxDataViewItem& aItem ) override;
|
||||
void ShutdownPreview( wxWindow* aParent ) override;
|
||||
|
||||
protected:
|
||||
void updateLibrary( LIB_TREE_NODE_LIBRARY& aLibNode );
|
||||
|
@ -60,6 +60,8 @@ public:
|
||||
|
||||
void DisplayPart( LIB_SYMBOL* aSymbol, int aUnit, int aBodyStyle = 0 );
|
||||
|
||||
EDA_DRAW_PANEL_GAL* GetCanvas() const { return m_preview; }
|
||||
|
||||
protected:
|
||||
void onSize( wxSizeEvent& aEvent );
|
||||
|
||||
|
@ -265,6 +265,7 @@ public:
|
||||
|
||||
virtual bool HasPreview( const wxDataViewItem& aItem ) { return false; }
|
||||
virtual void ShowPreview( wxWindow* aParent, const wxDataViewItem& aItem ) {}
|
||||
virtual void ShutdownPreview( wxWindow* aParent ) {}
|
||||
|
||||
TOOL_DISPATCHER* GetToolDispatcher() const { return m_parent->GetToolDispatcher(); }
|
||||
|
||||
|
@ -333,10 +333,11 @@ bool FP_TREE_SYNCHRONIZING_ADAPTER::HasPreview( const wxDataViewItem& aItem )
|
||||
}
|
||||
|
||||
|
||||
static const wxString c_previewName = wxS( "fpHoverPreview" );
|
||||
|
||||
|
||||
void FP_TREE_SYNCHRONIZING_ADAPTER::ShowPreview( wxWindow* aParent, const wxDataViewItem& aItem )
|
||||
{
|
||||
static const wxString c_previewName = wxS( "fpHoverPreview" );
|
||||
|
||||
LIB_TREE_NODE* node = ToNode( aItem );
|
||||
wxCHECK( node, /* void */ );
|
||||
|
||||
@ -358,4 +359,16 @@ void FP_TREE_SYNCHRONIZING_ADAPTER::ShowPreview( wxWindow* aParent, const wxData
|
||||
}
|
||||
|
||||
preview->DisplayFootprint( node->m_LibId );
|
||||
}
|
||||
|
||||
|
||||
void FP_TREE_SYNCHRONIZING_ADAPTER::ShutdownPreview( wxWindow* aParent )
|
||||
{
|
||||
wxWindow* previewWindow = wxWindow::FindWindowByName( c_previewName, aParent );
|
||||
|
||||
if( FOOTPRINT_PREVIEW_PANEL* preview = dynamic_cast<FOOTPRINT_PREVIEW_PANEL*>( previewWindow ) )
|
||||
{
|
||||
preview->GetCanvas()->SetEvtHandlerEnabled( false );
|
||||
preview->GetCanvas()->StopDrawing();
|
||||
}
|
||||
}
|
@ -46,8 +46,9 @@ public:
|
||||
|
||||
wxDataViewItem GetCurrentDataViewItem() override;
|
||||
|
||||
virtual bool HasPreview( const wxDataViewItem& aItem ) override;
|
||||
virtual void ShowPreview( wxWindow* aParent, const wxDataViewItem& aItem ) override;
|
||||
bool HasPreview( const wxDataViewItem& aItem ) override;
|
||||
void ShowPreview( wxWindow* aParent, const wxDataViewItem& aItem ) override;
|
||||
void ShutdownPreview( wxWindow* aParent ) override;
|
||||
|
||||
protected:
|
||||
FP_TREE_SYNCHRONIZING_ADAPTER( FOOTPRINT_EDIT_FRAME* aFrame, FP_LIB_TABLE* aLibs );
|
||||
|
Loading…
x
Reference in New Issue
Block a user