diff --git a/eeschema/symbol_editor/symbol_edit_frame.cpp b/eeschema/symbol_editor/symbol_edit_frame.cpp index b7492145e7..c18682c880 100644 --- a/eeschema/symbol_editor/symbol_edit_frame.cpp +++ b/eeschema/symbol_editor/symbol_edit_frame.cpp @@ -78,6 +78,8 @@ bool SYMBOL_EDIT_FRAME::m_showDeMorgan = false; BEGIN_EVENT_TABLE( SYMBOL_EDIT_FRAME, SCH_BASE_FRAME ) + EVT_SIZE( SYMBOL_EDIT_FRAME::OnSize ) + EVT_COMBOBOX( ID_LIBEDIT_SELECT_UNIT_NUMBER, SYMBOL_EDIT_FRAME::OnSelectUnit ) // menubar commands @@ -98,9 +100,8 @@ SYMBOL_EDIT_FRAME::SYMBOL_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : SCH_BASE_FRAME( aKiway, aParent, FRAME_SCH_SYMBOL_EDITOR, _( "Library Editor" ), wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, LIB_EDIT_FRAME_NAME ), - m_unitSelectBox( nullptr ), - m_isSymbolFromSchematic( false ), - m_initialRaise( false ) + m_unitSelectBox( nullptr ), + m_isSymbolFromSchematic( false ) { SetShowDeMorgan( false ); m_SyncPinEdit = false; @@ -220,6 +221,9 @@ SYMBOL_EDIT_FRAME::SYMBOL_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : treePane.MinSize( 250, -1 ); } + Raise(); + Show( true ); + SyncView(); GetCanvas()->GetView()->UseDrawPriority( true ); GetCanvas()->GetGAL()->SetAxesEnabled( true ); @@ -247,14 +251,11 @@ SYMBOL_EDIT_FRAME::SYMBOL_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : Bind( wxEVT_CHAR, &TOOL_DISPATCHER::DispatchWxEvent, m_toolDispatcher ); Bind( wxEVT_CHAR_HOOK, &TOOL_DISPATCHER::DispatchWxEvent, m_toolDispatcher ); + // Ensure the window is on top + Raise(); + if( loadingCancelled ) ShowInfoBarWarning( _( "Symbol library loading was cancelled by user." ) ); - - // This is an ugly hack to ensure that the symbol editor window gets raised to the top when - // launched from the schematic editor edit symbol in symbol editor tool. - Bind( wxEVT_IDLE, &SYMBOL_EDIT_FRAME::onIdle, this ); - - Show( true ); } @@ -284,18 +285,6 @@ SYMBOL_EDIT_FRAME::~SYMBOL_EDIT_FRAME() } -void SYMBOL_EDIT_FRAME::onIdle( wxIdleEvent& aEvent ) -{ - if( !m_initialRaise ) - { - Unbind( wxEVT_IDLE, &SYMBOL_EDIT_FRAME::onIdle, this ); - Raise(); - GetCanvas()->SetFocus(); - m_initialRaise = true; - } -} - - void SYMBOL_EDIT_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg ) { wxCHECK_RET( m_settings, "Call to SYMBOL_EDIT_FRAME::LoadSettings with null m_boardAdapter" ); diff --git a/eeschema/symbol_editor/symbol_edit_frame.h b/eeschema/symbol_editor/symbol_edit_frame.h index 5dda268ab7..216bbeb499 100644 --- a/eeschema/symbol_editor/symbol_edit_frame.h +++ b/eeschema/symbol_editor/symbol_edit_frame.h @@ -399,8 +399,6 @@ protected: void doReCreateMenuBar() override; - void onIdle( wxIdleEvent& aEvent ); - private: // Set up the tool framework void setupTools(); @@ -566,7 +564,6 @@ private: ///< Flag if the symbol being edited was loaded directly from a schematic. bool m_isSymbolFromSchematic; - bool m_initialRaise; KIID m_schematicSymbolUUID; ///< RefDes of the symbol (only valid if symbol was loaded from schematic) diff --git a/eeschema/tools/ee_inspection_tool.cpp b/eeschema/tools/ee_inspection_tool.cpp index e9ee3ad3e8..f2b1a3fb49 100644 --- a/eeschema/tools/ee_inspection_tool.cpp +++ b/eeschema/tools/ee_inspection_tool.cpp @@ -148,14 +148,6 @@ int EE_INSPECTION_TOOL::NextMarker( const TOOL_EVENT& aEvent ) int EE_INSPECTION_TOOL::CrossProbe( const TOOL_EVENT& aEvent ) { - SCH_EDIT_FRAME* frame = dynamic_cast( m_frame ); - - wxCHECK( frame, 0 ); - - DIALOG_ERC* dlg = frame->GetErcDialog(); - - wxCHECK( dlg, 0 ); - EE_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool(); wxCHECK( selectionTool, 0 ); @@ -164,10 +156,19 @@ int EE_INSPECTION_TOOL::CrossProbe( const TOOL_EVENT& aEvent ) if( selection.GetSize() == 1 && selection.Front()->Type() == SCH_MARKER_T ) { - if( !dlg->IsShown() ) - dlg->Show( true ); + SCH_EDIT_FRAME* frame = dynamic_cast( m_frame ); + DIALOG_ERC* dlg = frame ? frame->GetErcDialog() : nullptr; - dlg->SelectMarker( static_cast( selection.Front() ) ); + if( dlg ) + { + if( !dlg->IsShown() ) + { + dlg->Show( true ); + dlg->Raise(); + } + + dlg->SelectMarker( static_cast( selection.Front() ) ); + } } // Show the item info on a left click on this item