diff --git a/eeschema/libedit/libedit.cpp b/eeschema/libedit/libedit.cpp index ed5a11ba54..10efc4e381 100644 --- a/eeschema/libedit/libedit.cpp +++ b/eeschema/libedit/libedit.cpp @@ -628,7 +628,8 @@ void LIB_EDIT_FRAME::loadPart( const wxString& aAlias, const wxString& aLibrary, if( !alias ) { wxString msg = wxString::Format( _( "Symbol name \"%s\" not found in library \"%s\"" ), - GetChars( aAlias ), GetChars( aLibrary ) ); + GetChars( aAlias ), + GetChars( aLibrary ) ); DisplayError( this, msg ); return; } diff --git a/eeschema/widgets/symbol_tree_pane.cpp b/eeschema/widgets/symbol_tree_pane.cpp index 21851e1b28..f6f64bb2e3 100644 --- a/eeschema/widgets/symbol_tree_pane.cpp +++ b/eeschema/widgets/symbol_tree_pane.cpp @@ -125,11 +125,7 @@ void SYMBOL_TREE_PANE::Regenerate() void SYMBOL_TREE_PANE::onComponentSelected( wxCommandEvent& aEvent ) { - // Repost the event wxCommandEvent evt( ID_LIBEDIT_EDIT_PART ); - // I cannot figure out why the two methods below do not work.. - //wxPostEvent( libEditFrame, evt ); - //wxQueueEvent( m_libEditFrame, new wxCommandEvent( ID_LIBEDIT_EDIT_PART ) ); m_libEditFrame->OnEditPart( evt ); // Make sure current-part highlighting doesn't get lost in seleciton highlighting diff --git a/pcbnew/footprint_editor_utils.cpp b/pcbnew/footprint_editor_utils.cpp index ea4a2cc8af..23f6254cc1 100644 --- a/pcbnew/footprint_editor_utils.cpp +++ b/pcbnew/footprint_editor_utils.cpp @@ -228,6 +228,7 @@ void FOOTPRINT_EDIT_FRAME::LoadModuleFromLibrary( LIB_ID aFPID) m_treePane->GetLibTree()->ExpandLibId( aFPID ); m_treePane->GetLibTree()->CenterLibId( aFPID ); + m_treePane->GetLibTree()->Refresh(); // update highlighting } @@ -459,6 +460,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) { // Save Library As const wxString& libName = getTargetFPID().GetLibNickname(); + if( SaveLibraryAs( Prj().PcbFootprintLibs()->FindRow( libName )->GetFullURI() ) ) SyncLibraryTree( true ); } @@ -469,14 +471,16 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) if( footprint && SaveFootprintAs( footprint ) ) { + m_footprintNameWhenLoaded = footprint->GetFPID().GetLibItemName(); m_toolManager->GetView()->Update( GetBoard()->m_Modules ); + GetScreen()->ClrModify(); if( IsGalCanvasActive() && GetGalCanvas() ) GetGalCanvas()->ForceRefresh(); else GetCanvas()->Refresh(); - GetScreen()->ClrModify(); + SyncLibraryTree( true ); } } else @@ -484,8 +488,8 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) // Save Selected Footprint As MODULE* footprint = LoadFootprint( getTargetFPID() ); - if( footprint ) - SaveFootprintAs( footprint ); + if( footprint && SaveFootprintAs( footprint ) ) + SyncLibraryTree( true ); } m_treePane->GetLibTree()->Refresh(); diff --git a/pcbnew/footprint_libraries_utils.cpp b/pcbnew/footprint_libraries_utils.cpp index 6c5a035d10..e4216ec9ff 100644 --- a/pcbnew/footprint_libraries_utils.cpp +++ b/pcbnew/footprint_libraries_utils.cpp @@ -712,9 +712,17 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprint( MODULE* aModule ) else return false; } - - if( libraryName.IsEmpty() || footprintName.IsEmpty() ) - return SaveFootprintAs( aModule ); + else if( libraryName.IsEmpty() || footprintName.IsEmpty() ) + { + if( SaveFootprintAs( aModule ) ) + { + m_footprintNameWhenLoaded = footprintName; + SyncLibraryTree( true ); + return true; + } + else + return false; + } FP_LIB_TABLE* tbl = Prj().PcbFootprintLibs(); @@ -963,8 +971,6 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprintAs( MODULE* aModule ) if( !saveFootprintInLibrary( aModule, libraryName ) ) return false; - m_footprintNameWhenLoaded = footprintName; - // Once saved-as a board footprint is no longer a board footprint aModule->SetLink( 0 ); @@ -975,8 +981,6 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprintAs( MODULE* aModule ) SetStatusText( msg ); updateTitle(); - SyncLibraryTree( true ); - return true; } diff --git a/pcbnew/footprint_tree_pane.cpp b/pcbnew/footprint_tree_pane.cpp index 2b27f60b5c..ecc401e619 100644 --- a/pcbnew/footprint_tree_pane.cpp +++ b/pcbnew/footprint_tree_pane.cpp @@ -128,11 +128,7 @@ void FOOTPRINT_TREE_PANE::Regenerate() void FOOTPRINT_TREE_PANE::onComponentSelected( wxCommandEvent& aEvent ) { - // Repost the event wxCommandEvent evt( wxEVT_COMMAND_TOOL_CLICKED, ID_MODEDIT_EDIT_MODULE ); - // I cannot figure out why the two methods below do not work.. - //wxPostEvent( libEditFrame, evt ); - //wxQueueEvent( m_libEditFrame, new wxCommandEvent( ID_LIBEDIT_EDIT_PART ) ); m_frame->Process_Special_Functions( evt ); // Make sure current-part highlighting doesn't get lost in seleciton highlighting diff --git a/pcbnew/load_select_footprint.cpp b/pcbnew/load_select_footprint.cpp index c55520366e..c3c5bb4c62 100644 --- a/pcbnew/load_select_footprint.cpp +++ b/pcbnew/load_select_footprint.cpp @@ -46,7 +46,7 @@ using namespace std::placeholders; #include #include #include - +#include #include #include #include @@ -59,6 +59,7 @@ using namespace std::placeholders; #include #include #include +#include #include "fp_tree_model_adapter.h" @@ -155,6 +156,8 @@ bool FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD( MODULE* aModule ) updateView(); m_canvas->Refresh(); + m_treePane->GetLibTree()->Refresh(); // update any previously-highlighted items + return true; }