Update an outlier from the component -> symbol rename.

This commit is contained in:
Jeff Young 2020-12-08 18:30:14 +00:00
parent b26a5972c5
commit f29f052aa7
5 changed files with 61 additions and 59 deletions

View File

@ -55,7 +55,7 @@ set( EESCHEMA_DLGS
dialogs/dialog_fields_editor_global_base.cpp dialogs/dialog_fields_editor_global_base.cpp
dialogs/dialog_change_symbols.cpp dialogs/dialog_change_symbols.cpp
dialogs/dialog_change_symbols_base.cpp dialogs/dialog_change_symbols_base.cpp
dialogs/dialog_choose_component.cpp dialogs/dialog_choose_symbol.cpp
dialogs/dialog_lib_symbol_properties.cpp dialogs/dialog_lib_symbol_properties.cpp
dialogs/dialog_lib_symbol_properties_base.cpp dialogs/dialog_lib_symbol_properties_base.cpp
dialogs/dialog_edit_components_libid.cpp dialogs/dialog_edit_components_libid.cpp

View File

@ -25,11 +25,10 @@
#include <algorithm> #include <algorithm>
#include <class_libentry.h> #include <class_libentry.h>
#include <class_library.h> #include <class_library.h>
#include <dialog_choose_component.h> #include <dialog_choose_symbol.h>
#include <eeschema_settings.h> #include <eeschema_settings.h>
#include <kiface_i.h> #include <kiface_i.h>
#include <sch_base_frame.h> #include <sch_base_frame.h>
#include <symbol_lib_table.h>
#include <template_fieldnames.h> #include <template_fieldnames.h>
#include <widgets/footprint_preview_widget.h> #include <widgets/footprint_preview_widget.h>
#include <widgets/footprint_select_widget.h> #include <widgets/footprint_select_widget.h>
@ -44,13 +43,13 @@
#include <wx/timer.h> #include <wx/timer.h>
#include <wx/utils.h> #include <wx/utils.h>
std::mutex DIALOG_CHOOSE_COMPONENT::g_Mutex; std::mutex DIALOG_CHOOSE_SYMBOL::g_Mutex;
DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT( SCH_BASE_FRAME* aParent, const wxString& aTitle, DIALOG_CHOOSE_SYMBOL::DIALOG_CHOOSE_SYMBOL( SCH_BASE_FRAME* aParent, const wxString& aTitle,
wxObjectDataPtr<LIB_TREE_MODEL_ADAPTER>& aAdapter, wxObjectDataPtr<LIB_TREE_MODEL_ADAPTER>& aAdapter,
int aDeMorganConvert, bool aAllowFieldEdits, int aDeMorganConvert, bool aAllowFieldEdits,
bool aShowFootprints, bool aAllowBrowser ) bool aShowFootprints, bool aAllowBrowser )
: DIALOG_SHIM( aParent, wxID_ANY, aTitle, wxDefaultPosition, wxDefaultSize, : DIALOG_SHIM( aParent, wxID_ANY, aTitle, wxDefaultPosition, wxDefaultSize,
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER ), wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER ),
m_symbol_preview( nullptr ), m_symbol_preview( nullptr ),
@ -171,51 +170,55 @@ DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT( SCH_BASE_FRAME* aParent, const
SetInitialFocus( m_tree->GetFocusTarget() ); SetInitialFocus( m_tree->GetFocusTarget() );
okButton->SetDefault(); okButton->SetDefault();
Bind( wxEVT_INIT_DIALOG, &DIALOG_CHOOSE_COMPONENT::OnInitDialog, this ); Bind( wxEVT_INIT_DIALOG, &DIALOG_CHOOSE_SYMBOL::OnInitDialog, this );
Bind( wxEVT_TIMER, &DIALOG_CHOOSE_COMPONENT::OnCloseTimer, this, m_dbl_click_timer->GetId() ); Bind( wxEVT_TIMER, &DIALOG_CHOOSE_SYMBOL::OnCloseTimer, this, m_dbl_click_timer->GetId() );
Bind( COMPONENT_PRESELECTED, &DIALOG_CHOOSE_COMPONENT::OnComponentPreselected, this ); Bind( COMPONENT_PRESELECTED, &DIALOG_CHOOSE_SYMBOL::OnComponentPreselected, this );
Bind( COMPONENT_SELECTED, &DIALOG_CHOOSE_COMPONENT::OnComponentSelected, this ); Bind( COMPONENT_SELECTED, &DIALOG_CHOOSE_SYMBOL::OnComponentSelected, this );
if( m_browser_button ) if( m_browser_button )
{ {
m_browser_button->Bind( wxEVT_COMMAND_BUTTON_CLICKED, m_browser_button->Bind( wxEVT_COMMAND_BUTTON_CLICKED, &DIALOG_CHOOSE_SYMBOL::OnUseBrowser,
&DIALOG_CHOOSE_COMPONENT::OnUseBrowser, this ); this );
} }
if( m_fp_sel_ctrl ) if( m_fp_sel_ctrl )
{ {
m_fp_sel_ctrl->Bind( EVT_FOOTPRINT_SELECTED, m_fp_sel_ctrl->Bind( EVT_FOOTPRINT_SELECTED, &DIALOG_CHOOSE_SYMBOL::OnFootprintSelected,
&DIALOG_CHOOSE_COMPONENT::OnFootprintSelected, this ); this );
} }
if( m_details ) if( m_details )
{ {
m_details->Connect( wxEVT_CHAR_HOOK, m_details->Connect( wxEVT_CHAR_HOOK, wxKeyEventHandler( DIALOG_CHOOSE_SYMBOL::OnCharHook ),
wxKeyEventHandler( DIALOG_CHOOSE_COMPONENT::OnCharHook ),
NULL, this ); NULL, this );
} }
} }
DIALOG_CHOOSE_COMPONENT::~DIALOG_CHOOSE_COMPONENT() DIALOG_CHOOSE_SYMBOL::~DIALOG_CHOOSE_SYMBOL()
{ {
Unbind( wxEVT_INIT_DIALOG, &DIALOG_CHOOSE_COMPONENT::OnInitDialog, this ); Unbind( wxEVT_INIT_DIALOG, &DIALOG_CHOOSE_SYMBOL::OnInitDialog, this );
Unbind( wxEVT_TIMER, &DIALOG_CHOOSE_COMPONENT::OnCloseTimer, this ); Unbind( wxEVT_TIMER, &DIALOG_CHOOSE_SYMBOL::OnCloseTimer, this );
Unbind( COMPONENT_PRESELECTED, &DIALOG_CHOOSE_COMPONENT::OnComponentPreselected, this ); Unbind( COMPONENT_PRESELECTED, &DIALOG_CHOOSE_SYMBOL::OnComponentPreselected, this );
Unbind( COMPONENT_SELECTED, &DIALOG_CHOOSE_COMPONENT::OnComponentSelected, this ); Unbind( COMPONENT_SELECTED, &DIALOG_CHOOSE_SYMBOL::OnComponentSelected, this );
if( m_browser_button ) if( m_browser_button )
{
m_browser_button->Unbind( wxEVT_COMMAND_BUTTON_CLICKED, m_browser_button->Unbind( wxEVT_COMMAND_BUTTON_CLICKED,
&DIALOG_CHOOSE_COMPONENT::OnUseBrowser, this ); &DIALOG_CHOOSE_SYMBOL::OnUseBrowser, this );
}
if( m_fp_sel_ctrl ) if( m_fp_sel_ctrl )
m_fp_sel_ctrl->Unbind( EVT_FOOTPRINT_SELECTED, {
&DIALOG_CHOOSE_COMPONENT::OnFootprintSelected, this ); m_fp_sel_ctrl->Unbind( EVT_FOOTPRINT_SELECTED, &DIALOG_CHOOSE_SYMBOL::OnFootprintSelected,
this );
}
if( m_details ) if( m_details )
{
m_details->Disconnect( wxEVT_CHAR_HOOK, m_details->Disconnect( wxEVT_CHAR_HOOK,
wxKeyEventHandler( DIALOG_CHOOSE_COMPONENT::OnCharHook ), wxKeyEventHandler( DIALOG_CHOOSE_SYMBOL::OnCharHook ), NULL, this );
NULL, this ); }
// I am not sure the following two lines are necessary, but they will not hurt anyone // I am not sure the following two lines are necessary, but they will not hurt anyone
m_dbl_click_timer->Stop(); m_dbl_click_timer->Stop();
@ -238,7 +241,7 @@ DIALOG_CHOOSE_COMPONENT::~DIALOG_CHOOSE_COMPONENT()
} }
wxPanel* DIALOG_CHOOSE_COMPONENT::ConstructRightPanel( wxWindow* aParent ) wxPanel* DIALOG_CHOOSE_SYMBOL::ConstructRightPanel( wxWindow* aParent )
{ {
wxPanel* panel = new wxPanel( aParent ); wxPanel* panel = new wxPanel( aParent );
wxBoxSizer* sizer = new wxBoxSizer( wxVERTICAL ); wxBoxSizer* sizer = new wxBoxSizer( wxVERTICAL );
@ -303,7 +306,7 @@ wxPanel* DIALOG_CHOOSE_COMPONENT::ConstructRightPanel( wxWindow* aParent )
} }
void DIALOG_CHOOSE_COMPONENT::OnInitDialog( wxInitDialogEvent& aEvent ) void DIALOG_CHOOSE_SYMBOL::OnInitDialog( wxInitDialogEvent& aEvent )
{ {
if( m_fp_preview && m_fp_preview->IsInitialized() ) if( m_fp_preview && m_fp_preview->IsInitialized() )
{ {
@ -316,7 +319,7 @@ void DIALOG_CHOOSE_COMPONENT::OnInitDialog( wxInitDialogEvent& aEvent )
} }
void DIALOG_CHOOSE_COMPONENT::OnCharHook( wxKeyEvent& e ) void DIALOG_CHOOSE_SYMBOL::OnCharHook( wxKeyEvent& e )
{ {
if( m_details && e.GetKeyCode() == 'C' && e.ControlDown() && if( m_details && e.GetKeyCode() == 'C' && e.ControlDown() &&
!e.AltDown() && !e.ShiftDown() && !e.MetaDown() ) !e.AltDown() && !e.ShiftDown() && !e.MetaDown() )
@ -336,13 +339,13 @@ void DIALOG_CHOOSE_COMPONENT::OnCharHook( wxKeyEvent& e )
} }
LIB_ID DIALOG_CHOOSE_COMPONENT::GetSelectedLibId( int* aUnit ) const LIB_ID DIALOG_CHOOSE_SYMBOL::GetSelectedLibId( int* aUnit ) const
{ {
return m_tree->GetSelectedLibId( aUnit ); return m_tree->GetSelectedLibId( aUnit );
} }
void DIALOG_CHOOSE_COMPONENT::OnUseBrowser( wxCommandEvent& aEvent ) void DIALOG_CHOOSE_SYMBOL::OnUseBrowser( wxCommandEvent& aEvent )
{ {
m_external_browser_requested = true; m_external_browser_requested = true;
@ -355,7 +358,7 @@ void DIALOG_CHOOSE_COMPONENT::OnUseBrowser( wxCommandEvent& aEvent )
} }
void DIALOG_CHOOSE_COMPONENT::OnCloseTimer( wxTimerEvent& aEvent ) void DIALOG_CHOOSE_SYMBOL::OnCloseTimer( wxTimerEvent& aEvent )
{ {
// Hack handler because of eaten MouseUp event. See // Hack handler because of eaten MouseUp event. See
// DIALOG_CHOOSE_COMPONENT::OnComponentSelected for the beginning // DIALOG_CHOOSE_COMPONENT::OnComponentSelected for the beginning
@ -367,7 +370,7 @@ void DIALOG_CHOOSE_COMPONENT::OnCloseTimer( wxTimerEvent& aEvent )
{ {
// Mouse hasn't been raised yet, so fire the timer again. Otherwise the // Mouse hasn't been raised yet, so fire the timer again. Otherwise the
// purpose of this timer is defeated. // purpose of this timer is defeated.
m_dbl_click_timer->StartOnce( DIALOG_CHOOSE_COMPONENT::DblClickDelay ); m_dbl_click_timer->StartOnce( DIALOG_CHOOSE_SYMBOL::DblClickDelay );
} }
else else
{ {
@ -381,7 +384,7 @@ void DIALOG_CHOOSE_COMPONENT::OnCloseTimer( wxTimerEvent& aEvent )
} }
void DIALOG_CHOOSE_COMPONENT::ShowFootprintFor( LIB_ID const& aLibId ) void DIALOG_CHOOSE_SYMBOL::ShowFootprintFor( LIB_ID const& aLibId )
{ {
if( !m_fp_preview || !m_fp_preview->IsInitialized() ) if( !m_fp_preview || !m_fp_preview->IsInitialized() )
return; return;
@ -410,7 +413,7 @@ void DIALOG_CHOOSE_COMPONENT::ShowFootprintFor( LIB_ID const& aLibId )
} }
void DIALOG_CHOOSE_COMPONENT::ShowFootprint( wxString const& aName ) void DIALOG_CHOOSE_SYMBOL::ShowFootprint( wxString const& aName )
{ {
if( !m_fp_preview || !m_fp_preview->IsInitialized() ) if( !m_fp_preview || !m_fp_preview->IsInitialized() )
return; return;
@ -437,7 +440,7 @@ void DIALOG_CHOOSE_COMPONENT::ShowFootprint( wxString const& aName )
} }
void DIALOG_CHOOSE_COMPONENT::PopulateFootprintSelector( LIB_ID const& aLibId ) void DIALOG_CHOOSE_SYMBOL::PopulateFootprintSelector( LIB_ID const& aLibId )
{ {
if( !m_fp_sel_ctrl ) if( !m_fp_sel_ctrl )
return; return;
@ -484,7 +487,7 @@ void DIALOG_CHOOSE_COMPONENT::PopulateFootprintSelector( LIB_ID const& aLibId )
} }
void DIALOG_CHOOSE_COMPONENT::OnFootprintSelected( wxCommandEvent& aEvent ) void DIALOG_CHOOSE_SYMBOL::OnFootprintSelected( wxCommandEvent& aEvent )
{ {
m_fp_override = aEvent.GetString(); m_fp_override = aEvent.GetString();
@ -501,7 +504,7 @@ void DIALOG_CHOOSE_COMPONENT::OnFootprintSelected( wxCommandEvent& aEvent )
} }
void DIALOG_CHOOSE_COMPONENT::OnComponentPreselected( wxCommandEvent& aEvent ) void DIALOG_CHOOSE_SYMBOL::OnComponentPreselected( wxCommandEvent& aEvent )
{ {
int unit = 0; int unit = 0;
@ -526,7 +529,7 @@ void DIALOG_CHOOSE_COMPONENT::OnComponentPreselected( wxCommandEvent& aEvent )
} }
void DIALOG_CHOOSE_COMPONENT::OnComponentSelected( wxCommandEvent& aEvent ) void DIALOG_CHOOSE_SYMBOL::OnComponentSelected( wxCommandEvent& aEvent )
{ {
if( m_tree->GetSelectedLibId().IsValid() ) if( m_tree->GetSelectedLibId().IsValid() )
{ {
@ -542,7 +545,7 @@ void DIALOG_CHOOSE_COMPONENT::OnComponentSelected( wxCommandEvent& aEvent )
// //
// See DIALOG_CHOOSE_COMPONENT::OnCloseTimer for the other end of this // See DIALOG_CHOOSE_COMPONENT::OnCloseTimer for the other end of this
// spaghetti noodle. // spaghetti noodle.
m_dbl_click_timer->StartOnce( DIALOG_CHOOSE_COMPONENT::DblClickDelay ); m_dbl_click_timer->StartOnce( DIALOG_CHOOSE_SYMBOL::DblClickDelay );
} }
} }

View File

@ -50,9 +50,8 @@ class SCH_DRAW_PANEL;
/** /**
* Dialog class to select a component from the libraries. This is the master * Dialog class to select a symbol from the libraries. This is the master View class in a
* View class in a Model-View-Adapter (mediated MVC) architecture. The other * Model-View-Adapter (mediated MVC) architecture. The other pieces are in:
* pieces are in:
* *
* - Adapter: CMP_TREE_MODEL_ADAPTER in common/cmp_tree_model_adapter.h * - Adapter: CMP_TREE_MODEL_ADAPTER in common/cmp_tree_model_adapter.h
* - Model: CMP_TREE_NODE and descendants in common/cmp_tree_model.h * - Model: CMP_TREE_NODE and descendants in common/cmp_tree_model.h
@ -73,7 +72,7 @@ class SCH_DRAW_PANEL;
* adapter->AddLibrary( nickname ); * adapter->AddLibrary( nickname );
* *
* // Create and display dialog * // Create and display dialog
* DIALOG_CHOOSE_COMPONENT dlg( this, title, adapter, 1 ); * DIALOG_CHOOSE_SYMBOL dlg( this, title, adapter, 1 );
* bool selected = ( dlg.ShowModal() != wxID_CANCEL ); * bool selected = ( dlg.ShowModal() != wxID_CANCEL );
* *
* // Receive part * // Receive part
@ -85,7 +84,7 @@ class SCH_DRAW_PANEL;
* } * }
* *
*/ */
class DIALOG_CHOOSE_COMPONENT : public DIALOG_SHIM class DIALOG_CHOOSE_SYMBOL : public DIALOG_SHIM
{ {
public: public:
/** /**
@ -103,12 +102,12 @@ public:
* disabled. This forces aAllowFieldEdits false too. * disabled. This forces aAllowFieldEdits false too.
* @param aAllowBrowser show a Select with Browser button * @param aAllowBrowser show a Select with Browser button
*/ */
DIALOG_CHOOSE_COMPONENT( SCH_BASE_FRAME* aParent, const wxString& aTitle, DIALOG_CHOOSE_SYMBOL( SCH_BASE_FRAME* aParent, const wxString& aTitle,
wxObjectDataPtr<LIB_TREE_MODEL_ADAPTER>& aAdapter, wxObjectDataPtr<LIB_TREE_MODEL_ADAPTER>& aAdapter,
int aDeMorganConvert, bool aAllowFieldEdits, bool aShowFootprints, int aDeMorganConvert, bool aAllowFieldEdits, bool aShowFootprints,
bool aAllowBrowser ); bool aAllowBrowser );
~DIALOG_CHOOSE_COMPONENT(); ~DIALOG_CHOOSE_SYMBOL();
/** /**
* To be called after this dialog returns from ShowModal(). * To be called after this dialog returns from ShowModal().

View File

@ -37,7 +37,7 @@
#include <tool/tool_manager.h> #include <tool/tool_manager.h>
#include <tools/ee_actions.h> #include <tools/ee_actions.h>
#include <dialog_choose_component.h> #include <dialog_choose_symbol.h>
#include <symbol_tree_model_adapter.h> #include <symbol_tree_model_adapter.h>
PICKED_SYMBOL SCH_BASE_FRAME::PickSymbolFromLibBrowser( wxTopLevelWindow* aParent, PICKED_SYMBOL SCH_BASE_FRAME::PickSymbolFromLibBrowser( wxTopLevelWindow* aParent,
@ -94,7 +94,7 @@ PICKED_SYMBOL SCH_BASE_FRAME::PickSymbolFromLibTree( const SCHLIB_FILTER* aFilte
const LIB_ID* aHighlight, const LIB_ID* aHighlight,
bool aAllowFields ) bool aAllowFields )
{ {
std::unique_lock<std::mutex> dialogLock( DIALOG_CHOOSE_COMPONENT::g_Mutex, std::defer_lock ); std::unique_lock<std::mutex> dialogLock( DIALOG_CHOOSE_SYMBOL::g_Mutex, std::defer_lock );
wxString dialogTitle; wxString dialogTitle;
SYMBOL_LIB_TABLE* libs = Prj().SchSymbolLibTable(); SYMBOL_LIB_TABLE* libs = Prj().SchSymbolLibTable();
@ -153,8 +153,8 @@ PICKED_SYMBOL SCH_BASE_FRAME::PickSymbolFromLibTree( const SCHLIB_FILTER* aFilte
else else
dialogTitle.Printf( _( "Choose Symbol (%d items loaded)" ), adapter->GetItemCount() ); dialogTitle.Printf( _( "Choose Symbol (%d items loaded)" ), adapter->GetItemCount() );
DIALOG_CHOOSE_COMPONENT dlg( this, dialogTitle, adapter, aConvert, aAllowFields, DIALOG_CHOOSE_SYMBOL dlg( this, dialogTitle, adapter, aConvert, aAllowFields, aShowFootprints,
aShowFootprints, aUseLibBrowser ); aUseLibBrowser );
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
return PICKED_SYMBOL(); return PICKED_SYMBOL();

View File

@ -28,7 +28,7 @@
#include <class_library.h> #include <class_library.h>
#include <confirm.h> #include <confirm.h>
#include <dialog_helpers.h> #include <dialog_helpers.h>
#include <dialog_choose_component.h> #include <dialog_choose_symbol.h>
#include <eeschema_id.h> #include <eeschema_id.h>
#include <eeschema_settings.h> #include <eeschema_settings.h>
#include <kiface_i.h> #include <kiface_i.h>
@ -802,7 +802,7 @@ void LIB_VIEW_FRAME::FinishModal()
void LIB_VIEW_FRAME::OnSelectSymbol( wxCommandEvent& aEvent ) void LIB_VIEW_FRAME::OnSelectSymbol( wxCommandEvent& aEvent )
{ {
std::unique_lock<std::mutex> dialogLock( DIALOG_CHOOSE_COMPONENT::g_Mutex, std::defer_lock ); std::unique_lock<std::mutex> dialogLock( DIALOG_CHOOSE_SYMBOL::g_Mutex, std::defer_lock );
// One CHOOSE_COMPONENT dialog at a time. User probaby can't handle more anyway. // One CHOOSE_COMPONENT dialog at a time. User probaby can't handle more anyway.
if( !dialogLock.try_lock() ) if( !dialogLock.try_lock() )
@ -828,7 +828,7 @@ void LIB_VIEW_FRAME::OnSelectSymbol( wxCommandEvent& aEvent )
wxString dialogTitle; wxString dialogTitle;
dialogTitle.Printf( _( "Choose Symbol (%d items loaded)" ), adapter->GetItemCount() ); dialogTitle.Printf( _( "Choose Symbol (%d items loaded)" ), adapter->GetItemCount() );
DIALOG_CHOOSE_COMPONENT dlg( this, dialogTitle, adapter, m_convert, false, false, false ); DIALOG_CHOOSE_SYMBOL dlg( this, dialogTitle, adapter, m_convert, false, false, false );
if( dlg.ShowQuasiModal() == wxID_CANCEL ) if( dlg.ShowQuasiModal() == wxID_CANCEL )
return; return;