From 64b18ea06a21016707f8bc7e53e68ae310141701 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Wed, 5 Jun 2019 20:37:24 +0100 Subject: [PATCH] Use qualified window names when searching for 3D viewers. Just searching in children didn't work because the windows aren't actually in the child window lists. Fixes: lp:1831774 * https://bugs.launchpad.net/kicad/+bug/1831774 --- 3d-viewer/3d_viewer/eda_3d_viewer.cpp | 2 +- 3d-viewer/3d_viewer/eda_3d_viewer.h | 2 ++ pcbnew/pcb_base_frame.cpp | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/3d-viewer/3d_viewer/eda_3d_viewer.cpp b/3d-viewer/3d_viewer/eda_3d_viewer.cpp index f485725d26..aabec112f7 100644 --- a/3d-viewer/3d_viewer/eda_3d_viewer.cpp +++ b/3d-viewer/3d_viewer/eda_3d_viewer.cpp @@ -158,7 +158,7 @@ EDA_3D_VIEWER::EDA_3D_VIEWER( KIWAY *aKiway, PCB_BASE_FRAME *aParent, KIWAY_PLAYER( aKiway, aParent, FRAME_PCB_DISPLAY3D, aTitle, wxDefaultPosition, wxDefaultSize, - style, VIEWER3D_FRAMENAME ) + style, QUALIFIED_VIEWER3D_FRAMENAME( aParent ) ) { wxLogTrace( m_logTrace, "EDA_3D_VIEWER::EDA_3D_VIEWER %s", aTitle ); diff --git a/3d-viewer/3d_viewer/eda_3d_viewer.h b/3d-viewer/3d_viewer/eda_3d_viewer.h index 63beb6ad17..4051048e01 100644 --- a/3d-viewer/3d_viewer/eda_3d_viewer.h +++ b/3d-viewer/3d_viewer/eda_3d_viewer.h @@ -47,6 +47,8 @@ #define KICAD_DEFAULT_3D_DRAWFRAME_STYLE (wxDEFAULT_FRAME_STYLE | wxWANTS_CHARS) #define VIEWER3D_FRAMENAME wxT( "Viewer3DFrameName" ) +#define QUALIFIED_VIEWER3D_FRAMENAME( parent ) \ + ( wxString( VIEWER3D_FRAMENAME ) + wxT( ":" ) + parent->GetName() ) /** * Create and handle a window for the 3d viewer connected to a Kiway and a pcbboard diff --git a/pcbnew/pcb_base_frame.cpp b/pcbnew/pcb_base_frame.cpp index b04135284f..9a54fb3323 100644 --- a/pcbnew/pcb_base_frame.cpp +++ b/pcbnew/pcb_base_frame.cpp @@ -114,7 +114,7 @@ PCB_BASE_FRAME::~PCB_BASE_FRAME() EDA_3D_VIEWER* PCB_BASE_FRAME::Get3DViewerFrame() { - return dynamic_cast( FindWindow( VIEWER3D_FRAMENAME ) ); + return dynamic_cast( FindWindowByName( QUALIFIED_VIEWER3D_FRAMENAME( this ) ) ); }