Streamline fetching topLevelParent.
This commit is contained in:
parent
ddb141ff08
commit
4eb51be0a2
|
@ -118,10 +118,7 @@ int EDA_3D_CONTROLLER::Main( const TOOL_EVENT& aEvent )
|
||||||
if( evt->IsCancelInteractive() )
|
if( evt->IsCancelInteractive() )
|
||||||
{
|
{
|
||||||
wxWindow* canvas = m_toolMgr->GetToolHolder()->GetToolCanvas();
|
wxWindow* canvas = m_toolMgr->GetToolHolder()->GetToolCanvas();
|
||||||
wxWindow* topLevelParent = canvas->GetParent();
|
wxWindow* topLevelParent = wxGetTopLevelParent( canvas->GetParent() );
|
||||||
|
|
||||||
while( topLevelParent && !topLevelParent->IsTopLevel() )
|
|
||||||
topLevelParent = topLevelParent->GetParent();
|
|
||||||
|
|
||||||
if( topLevelParent && dynamic_cast<DIALOG_SHIM*>( topLevelParent ) )
|
if( topLevelParent && dynamic_cast<DIALOG_SHIM*>( topLevelParent ) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -200,10 +200,7 @@ COLOR_SWATCH::COLOR_SWATCH( wxWindow* aParent, wxWindowID aID, const wxPoint& aP
|
||||||
|
|
||||||
void COLOR_SWATCH::setupEvents( bool aTriggerWithSingleClick )
|
void COLOR_SWATCH::setupEvents( bool aTriggerWithSingleClick )
|
||||||
{
|
{
|
||||||
wxWindow* topLevelParent = GetParent();
|
wxWindow* topLevelParent = wxGetTopLevelParent( GetParent() );
|
||||||
|
|
||||||
while( topLevelParent && !topLevelParent->IsTopLevel() )
|
|
||||||
topLevelParent = topLevelParent->GetParent();
|
|
||||||
|
|
||||||
if( topLevelParent && dynamic_cast<DIALOG_SHIM*>( topLevelParent ) )
|
if( topLevelParent && dynamic_cast<DIALOG_SHIM*>( topLevelParent ) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include <wx/sizer.h>
|
#include <wx/sizer.h>
|
||||||
#include <wx/srchctrl.h>
|
#include <wx/srchctrl.h>
|
||||||
#include <wx/popupwin.h>
|
#include <wx/popupwin.h>
|
||||||
|
#include "wx/app.h"
|
||||||
|
|
||||||
constexpr int RECENT_SEARCHES_MAX = 10;
|
constexpr int RECENT_SEARCHES_MAX = 10;
|
||||||
|
|
||||||
|
@ -610,10 +611,7 @@ void LIB_TREE::showPreview( wxDataViewItem aItem )
|
||||||
{
|
{
|
||||||
m_hoverItem = aItem;
|
m_hoverItem = aItem;
|
||||||
|
|
||||||
wxWindow* topLevelParent = m_parent;
|
wxWindow* topLevelParent = wxGetTopLevelParent( m_parent );
|
||||||
|
|
||||||
while( topLevelParent && !topLevelParent->IsTopLevel() )
|
|
||||||
topLevelParent = topLevelParent->GetParent();
|
|
||||||
|
|
||||||
m_previewWindow = new wxPopupWindow( topLevelParent );
|
m_previewWindow = new wxPopupWindow( topLevelParent );
|
||||||
m_previewWindow->SetPosition( wxPoint( m_tree_ctrl->GetScreenRect().GetRight() - 10,
|
m_previewWindow->SetPosition( wxPoint( m_tree_ctrl->GetScreenRect().GetRight() - 10,
|
||||||
|
@ -647,15 +645,8 @@ void LIB_TREE::onIdle( wxIdleEvent& aEvent )
|
||||||
// The wxDataViewCtrl won't give us its mouseMoved events so we're forced to use idle
|
// The wxDataViewCtrl won't give us its mouseMoved events so we're forced to use idle
|
||||||
// events to track the hover state
|
// events to track the hover state
|
||||||
|
|
||||||
wxWindow* topLevelParent = m_parent;
|
wxWindow* topLevelParent = wxGetTopLevelParent( m_parent );
|
||||||
|
wxWindow* topLevelFocus = wxGetTopLevelParent( wxWindow::FindFocus() );
|
||||||
while( topLevelParent && !topLevelParent->IsTopLevel() )
|
|
||||||
topLevelParent = topLevelParent->GetParent();
|
|
||||||
|
|
||||||
wxWindow* topLevelFocus = FindFocus();
|
|
||||||
|
|
||||||
while( topLevelFocus && !topLevelFocus->IsTopLevel() )
|
|
||||||
topLevelFocus = topLevelFocus->GetParent();
|
|
||||||
|
|
||||||
wxPoint screenPos = wxGetMousePosition();
|
wxPoint screenPos = wxGetMousePosition();
|
||||||
wxRect screenRect = m_tree_ctrl->GetScreenRect();
|
wxRect screenRect = m_tree_ctrl->GetScreenRect();
|
||||||
|
|
Loading…
Reference in New Issue