Improve updating of symbol and footprint trees.
In particular, update highlighting when changing footprints.
This commit is contained in:
parent
d7ff3f8af5
commit
69952a7b9f
|
@ -628,7 +628,8 @@ void LIB_EDIT_FRAME::loadPart( const wxString& aAlias, const wxString& aLibrary,
|
||||||
if( !alias )
|
if( !alias )
|
||||||
{
|
{
|
||||||
wxString msg = wxString::Format( _( "Symbol name \"%s\" not found in library \"%s\"" ),
|
wxString msg = wxString::Format( _( "Symbol name \"%s\" not found in library \"%s\"" ),
|
||||||
GetChars( aAlias ), GetChars( aLibrary ) );
|
GetChars( aAlias ),
|
||||||
|
GetChars( aLibrary ) );
|
||||||
DisplayError( this, msg );
|
DisplayError( this, msg );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,11 +125,7 @@ void SYMBOL_TREE_PANE::Regenerate()
|
||||||
|
|
||||||
void SYMBOL_TREE_PANE::onComponentSelected( wxCommandEvent& aEvent )
|
void SYMBOL_TREE_PANE::onComponentSelected( wxCommandEvent& aEvent )
|
||||||
{
|
{
|
||||||
// Repost the event
|
|
||||||
wxCommandEvent evt( ID_LIBEDIT_EDIT_PART );
|
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 );
|
m_libEditFrame->OnEditPart( evt );
|
||||||
|
|
||||||
// Make sure current-part highlighting doesn't get lost in seleciton highlighting
|
// Make sure current-part highlighting doesn't get lost in seleciton highlighting
|
||||||
|
|
|
@ -228,6 +228,7 @@ void FOOTPRINT_EDIT_FRAME::LoadModuleFromLibrary( LIB_ID aFPID)
|
||||||
|
|
||||||
m_treePane->GetLibTree()->ExpandLibId( aFPID );
|
m_treePane->GetLibTree()->ExpandLibId( aFPID );
|
||||||
m_treePane->GetLibTree()->CenterLibId( 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
|
// Save Library As
|
||||||
const wxString& libName = getTargetFPID().GetLibNickname();
|
const wxString& libName = getTargetFPID().GetLibNickname();
|
||||||
|
|
||||||
if( SaveLibraryAs( Prj().PcbFootprintLibs()->FindRow( libName )->GetFullURI() ) )
|
if( SaveLibraryAs( Prj().PcbFootprintLibs()->FindRow( libName )->GetFullURI() ) )
|
||||||
SyncLibraryTree( true );
|
SyncLibraryTree( true );
|
||||||
}
|
}
|
||||||
|
@ -469,14 +471,16 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||||
|
|
||||||
if( footprint && SaveFootprintAs( footprint ) )
|
if( footprint && SaveFootprintAs( footprint ) )
|
||||||
{
|
{
|
||||||
|
m_footprintNameWhenLoaded = footprint->GetFPID().GetLibItemName();
|
||||||
m_toolManager->GetView()->Update( GetBoard()->m_Modules );
|
m_toolManager->GetView()->Update( GetBoard()->m_Modules );
|
||||||
|
GetScreen()->ClrModify();
|
||||||
|
|
||||||
if( IsGalCanvasActive() && GetGalCanvas() )
|
if( IsGalCanvasActive() && GetGalCanvas() )
|
||||||
GetGalCanvas()->ForceRefresh();
|
GetGalCanvas()->ForceRefresh();
|
||||||
else
|
else
|
||||||
GetCanvas()->Refresh();
|
GetCanvas()->Refresh();
|
||||||
|
|
||||||
GetScreen()->ClrModify();
|
SyncLibraryTree( true );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -484,8 +488,8 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||||
// Save Selected Footprint As
|
// Save Selected Footprint As
|
||||||
MODULE* footprint = LoadFootprint( getTargetFPID() );
|
MODULE* footprint = LoadFootprint( getTargetFPID() );
|
||||||
|
|
||||||
if( footprint )
|
if( footprint && SaveFootprintAs( footprint ) )
|
||||||
SaveFootprintAs( footprint );
|
SyncLibraryTree( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_treePane->GetLibTree()->Refresh();
|
m_treePane->GetLibTree()->Refresh();
|
||||||
|
|
|
@ -712,9 +712,17 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprint( MODULE* aModule )
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
else if( libraryName.IsEmpty() || footprintName.IsEmpty() )
|
||||||
if( libraryName.IsEmpty() || footprintName.IsEmpty() )
|
{
|
||||||
return SaveFootprintAs( aModule );
|
if( SaveFootprintAs( aModule ) )
|
||||||
|
{
|
||||||
|
m_footprintNameWhenLoaded = footprintName;
|
||||||
|
SyncLibraryTree( true );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
FP_LIB_TABLE* tbl = Prj().PcbFootprintLibs();
|
FP_LIB_TABLE* tbl = Prj().PcbFootprintLibs();
|
||||||
|
|
||||||
|
@ -963,8 +971,6 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprintAs( MODULE* aModule )
|
||||||
if( !saveFootprintInLibrary( aModule, libraryName ) )
|
if( !saveFootprintInLibrary( aModule, libraryName ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_footprintNameWhenLoaded = footprintName;
|
|
||||||
|
|
||||||
// Once saved-as a board footprint is no longer a board footprint
|
// Once saved-as a board footprint is no longer a board footprint
|
||||||
aModule->SetLink( 0 );
|
aModule->SetLink( 0 );
|
||||||
|
|
||||||
|
@ -975,8 +981,6 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprintAs( MODULE* aModule )
|
||||||
SetStatusText( msg );
|
SetStatusText( msg );
|
||||||
updateTitle();
|
updateTitle();
|
||||||
|
|
||||||
SyncLibraryTree( true );
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -128,11 +128,7 @@ void FOOTPRINT_TREE_PANE::Regenerate()
|
||||||
|
|
||||||
void FOOTPRINT_TREE_PANE::onComponentSelected( wxCommandEvent& aEvent )
|
void FOOTPRINT_TREE_PANE::onComponentSelected( wxCommandEvent& aEvent )
|
||||||
{
|
{
|
||||||
// Repost the event
|
|
||||||
wxCommandEvent evt( wxEVT_COMMAND_TOOL_CLICKED, ID_MODEDIT_EDIT_MODULE );
|
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 );
|
m_frame->Process_Special_Functions( evt );
|
||||||
|
|
||||||
// Make sure current-part highlighting doesn't get lost in seleciton highlighting
|
// Make sure current-part highlighting doesn't get lost in seleciton highlighting
|
||||||
|
|
|
@ -46,7 +46,7 @@ using namespace std::placeholders;
|
||||||
#include <macros.h>
|
#include <macros.h>
|
||||||
#include <fp_lib_table.h>
|
#include <fp_lib_table.h>
|
||||||
#include <lib_id.h>
|
#include <lib_id.h>
|
||||||
|
#include <footprint_tree_pane.h>
|
||||||
#include <class_board.h>
|
#include <class_board.h>
|
||||||
#include <class_module.h>
|
#include <class_module.h>
|
||||||
#include <io_mgr.h>
|
#include <io_mgr.h>
|
||||||
|
@ -59,6 +59,7 @@ using namespace std::placeholders;
|
||||||
#include <footprint_viewer_frame.h>
|
#include <footprint_viewer_frame.h>
|
||||||
#include <wildcards_and_files_ext.h>
|
#include <wildcards_and_files_ext.h>
|
||||||
#include <widgets/progress_reporter.h>
|
#include <widgets/progress_reporter.h>
|
||||||
|
#include <widgets/lib_tree.h>
|
||||||
#include "fp_tree_model_adapter.h"
|
#include "fp_tree_model_adapter.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -155,6 +156,8 @@ bool FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD( MODULE* aModule )
|
||||||
updateView();
|
updateView();
|
||||||
m_canvas->Refresh();
|
m_canvas->Refresh();
|
||||||
|
|
||||||
|
m_treePane->GetLibTree()->Refresh(); // update any previously-highlighted items
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue