Symbol chooser has different canvases.

This commit is contained in:
Jeff Young 2025-07-12 22:01:36 +01:00
parent 401eba4e91
commit 05fcfdaf87
4 changed files with 18 additions and 2 deletions

View File

@ -140,8 +140,7 @@ bool SYMBOL_CHOOSER_FRAME::ShowModal( wxString* aSymbol, wxWindow* aParent )
void SYMBOL_CHOOSER_FRAME::doCloseWindow()
{
GetCanvas()->SetEvtHandlerEnabled( false );
GetCanvas()->StopDrawing();
m_chooserPanel->ShutdownCanvases();
// Only dismiss a modal frame once, so that the return values set by
// the prior DismissModal() are not bashed for ShowModal().

View File

@ -63,6 +63,8 @@ public:
*/
void SetFilter( std::function<bool( LIB_TREE_NODE& aNode )>* aFilter );
EDA_DRAW_PANEL_GAL* GetPreviewCanvas() const;
private:
void OnPaint( wxPaintEvent& aEvent );
void OnOK( wxCommandEvent& aEvent );

View File

@ -516,6 +516,19 @@ LIB_ID PANEL_SYMBOL_CHOOSER::GetSelectedLibId( int* aUnit ) const
}
void PANEL_SYMBOL_CHOOSER::ShutdownCanvases()
{
m_symbol_preview->GetCanvas()->SetEvtHandlerEnabled( false );
m_symbol_preview->GetCanvas()->StopDrawing();
if( m_fp_preview )
{
m_fp_preview->GetPreviewPanel()->GetCanvas()->SetEvtHandlerEnabled( false );
m_fp_preview->GetPreviewPanel()->GetCanvas()->StopDrawing();
}
}
void PANEL_SYMBOL_CHOOSER::onCloseTimer( wxTimerEvent& aEvent )
{
// Hack because of eaten MouseUp event. See PANEL_SYMBOL_CHOOSER::onSymbolChosen

View File

@ -102,6 +102,8 @@ public:
return m_field_edits;
}
void ShutdownCanvases();
protected:
static constexpr int DBLCLICK_DELAY = 100; // milliseconds