Browse Source

Move centering of lib-tree item to idle event.

Fixes https://gitlab.com/kicad/code/kicad/issues/9294
6.0.7
Jeff Young 4 years ago
parent
commit
ef74421922
  1. 4
      eeschema/symbol_editor/symbol_edit_frame.h
  2. 21
      eeschema/symbol_editor/symbol_editor.cpp
  3. 4
      pcbnew/footprint_edit_frame.h
  4. 13
      pcbnew/footprint_editor_utils.cpp

4
eeschema/symbol_editor/symbol_edit_frame.h

@ -448,6 +448,8 @@ private:
///< the library that is currently modified.
wxString getTargetLib() const;
void centerItemIdleHandler( wxIdleEvent& aEvent );
/*
* Return true when the operation has succeeded (all requested libraries have been saved
* or none was selected and confirmed by OK).
@ -535,6 +537,8 @@ private:
SYMBOL_LIBRARY_MANAGER* m_libMgr; // manager taking care of temporary modifications
SYMBOL_EDITOR_SETTINGS* m_settings; // Handle to the settings
LIB_ID m_centerItemOnIdle;
// The unit number to edit and show
int m_unit;

21
eeschema/symbol_editor/symbol_editor.cpp

@ -270,7 +270,26 @@ bool SYMBOL_EDIT_FRAME::LoadSymbol( const LIB_ID& aLibId, int aUnit, int aConver
}
SelectActiveLibrary( aLibId.GetLibNickname() );
return LoadSymbolFromCurrentLib( aLibId.GetLibItemName(), aUnit, aConvert );
if( LoadSymbolFromCurrentLib( aLibId.GetLibItemName(), aUnit, aConvert ) )
{
m_treePane->GetLibTree()->SelectLibId( aLibId );
m_treePane->GetLibTree()->ExpandLibId( aLibId );
m_centerItemOnIdle = aLibId;
Bind( wxEVT_IDLE, &SYMBOL_EDIT_FRAME::centerItemIdleHandler, this );
return true;
}
return false;
}
void SYMBOL_EDIT_FRAME::centerItemIdleHandler( wxIdleEvent& aEvent )
{
m_treePane->GetLibTree()->CenterLibId( m_centerItemOnIdle );
Unbind( wxEVT_IDLE, &SYMBOL_EDIT_FRAME::centerItemIdleHandler, this );
}

4
pcbnew/footprint_edit_frame.h

@ -333,6 +333,8 @@ protected:
void setupUIConditions() override;
void centerItemIdleHandler( wxIdleEvent& aEvent );
protected:
PCB_LAYER_BOX_SELECTOR* m_selLayerBox; // a combo box to display and select active layer
FOOTPRINT_EDITOR_SETTINGS* m_editorSettings;
@ -341,6 +343,8 @@ private:
friend struct PCB::IFACE;
FOOTPRINT_TREE_PANE* m_treePane;
LIB_ID m_centerItemOnIdle;
wxObjectDataPtr<LIB_TREE_MODEL_ADAPTER> m_adapter;

13
pcbnew/footprint_editor_utils.cpp

@ -100,11 +100,22 @@ void FOOTPRINT_EDIT_FRAME::LoadFootprintFromLibrary( LIB_ID aFPID )
}
m_treePane->GetLibTree()->ExpandLibId( aFPID );
m_treePane->GetLibTree()->CenterLibId( aFPID );
m_centerItemOnIdle = aFPID;
Bind( wxEVT_IDLE, &FOOTPRINT_EDIT_FRAME::centerItemIdleHandler, this );
m_treePane->GetLibTree()->RefreshLibTree(); // update highlighting
}
void FOOTPRINT_EDIT_FRAME::centerItemIdleHandler( wxIdleEvent& aEvent )
{
m_treePane->GetLibTree()->CenterLibId( m_centerItemOnIdle );
Unbind( wxEVT_IDLE, &FOOTPRINT_EDIT_FRAME::centerItemIdleHandler, this );
}
void FOOTPRINT_EDIT_FRAME::SelectLayer( wxCommandEvent& event )
{
SetActiveLayer( ToLAYER_ID( m_selLayerBox->GetLayerSelection() ) );

Loading…
Cancel
Save