Update an outlier from the component -> symbol rename.
This commit is contained in:
parent
b26a5972c5
commit
f29f052aa7
|
@ -55,7 +55,7 @@ set( EESCHEMA_DLGS
|
|||
dialogs/dialog_fields_editor_global_base.cpp
|
||||
dialogs/dialog_change_symbols.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_base.cpp
|
||||
dialogs/dialog_edit_components_libid.cpp
|
||||
|
|
|
@ -25,11 +25,10 @@
|
|||
#include <algorithm>
|
||||
#include <class_libentry.h>
|
||||
#include <class_library.h>
|
||||
#include <dialog_choose_component.h>
|
||||
#include <dialog_choose_symbol.h>
|
||||
#include <eeschema_settings.h>
|
||||
#include <kiface_i.h>
|
||||
#include <sch_base_frame.h>
|
||||
#include <symbol_lib_table.h>
|
||||
#include <template_fieldnames.h>
|
||||
#include <widgets/footprint_preview_widget.h>
|
||||
#include <widgets/footprint_select_widget.h>
|
||||
|
@ -44,13 +43,13 @@
|
|||
#include <wx/timer.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,
|
||||
wxObjectDataPtr<LIB_TREE_MODEL_ADAPTER>& aAdapter,
|
||||
int aDeMorganConvert, bool aAllowFieldEdits,
|
||||
bool aShowFootprints, bool aAllowBrowser )
|
||||
DIALOG_CHOOSE_SYMBOL::DIALOG_CHOOSE_SYMBOL( SCH_BASE_FRAME* aParent, const wxString& aTitle,
|
||||
wxObjectDataPtr<LIB_TREE_MODEL_ADAPTER>& aAdapter,
|
||||
int aDeMorganConvert, bool aAllowFieldEdits,
|
||||
bool aShowFootprints, bool aAllowBrowser )
|
||||
: DIALOG_SHIM( aParent, wxID_ANY, aTitle, wxDefaultPosition, wxDefaultSize,
|
||||
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER ),
|
||||
m_symbol_preview( nullptr ),
|
||||
|
@ -171,51 +170,55 @@ DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT( SCH_BASE_FRAME* aParent, const
|
|||
SetInitialFocus( m_tree->GetFocusTarget() );
|
||||
okButton->SetDefault();
|
||||
|
||||
Bind( wxEVT_INIT_DIALOG, &DIALOG_CHOOSE_COMPONENT::OnInitDialog, this );
|
||||
Bind( wxEVT_TIMER, &DIALOG_CHOOSE_COMPONENT::OnCloseTimer, this, m_dbl_click_timer->GetId() );
|
||||
Bind( COMPONENT_PRESELECTED, &DIALOG_CHOOSE_COMPONENT::OnComponentPreselected, this );
|
||||
Bind( COMPONENT_SELECTED, &DIALOG_CHOOSE_COMPONENT::OnComponentSelected, this );
|
||||
Bind( wxEVT_INIT_DIALOG, &DIALOG_CHOOSE_SYMBOL::OnInitDialog, this );
|
||||
Bind( wxEVT_TIMER, &DIALOG_CHOOSE_SYMBOL::OnCloseTimer, this, m_dbl_click_timer->GetId() );
|
||||
Bind( COMPONENT_PRESELECTED, &DIALOG_CHOOSE_SYMBOL::OnComponentPreselected, this );
|
||||
Bind( COMPONENT_SELECTED, &DIALOG_CHOOSE_SYMBOL::OnComponentSelected, this );
|
||||
|
||||
if( m_browser_button )
|
||||
{
|
||||
m_browser_button->Bind( wxEVT_COMMAND_BUTTON_CLICKED,
|
||||
&DIALOG_CHOOSE_COMPONENT::OnUseBrowser, this );
|
||||
m_browser_button->Bind( wxEVT_COMMAND_BUTTON_CLICKED, &DIALOG_CHOOSE_SYMBOL::OnUseBrowser,
|
||||
this );
|
||||
}
|
||||
|
||||
if( m_fp_sel_ctrl )
|
||||
{
|
||||
m_fp_sel_ctrl->Bind( EVT_FOOTPRINT_SELECTED,
|
||||
&DIALOG_CHOOSE_COMPONENT::OnFootprintSelected, this );
|
||||
m_fp_sel_ctrl->Bind( EVT_FOOTPRINT_SELECTED, &DIALOG_CHOOSE_SYMBOL::OnFootprintSelected,
|
||||
this );
|
||||
}
|
||||
|
||||
if( m_details )
|
||||
{
|
||||
m_details->Connect( wxEVT_CHAR_HOOK,
|
||||
wxKeyEventHandler( DIALOG_CHOOSE_COMPONENT::OnCharHook ),
|
||||
m_details->Connect( wxEVT_CHAR_HOOK, wxKeyEventHandler( DIALOG_CHOOSE_SYMBOL::OnCharHook ),
|
||||
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_TIMER, &DIALOG_CHOOSE_COMPONENT::OnCloseTimer, this );
|
||||
Unbind( COMPONENT_PRESELECTED, &DIALOG_CHOOSE_COMPONENT::OnComponentPreselected, this );
|
||||
Unbind( COMPONENT_SELECTED, &DIALOG_CHOOSE_COMPONENT::OnComponentSelected, this );
|
||||
Unbind( wxEVT_INIT_DIALOG, &DIALOG_CHOOSE_SYMBOL::OnInitDialog, this );
|
||||
Unbind( wxEVT_TIMER, &DIALOG_CHOOSE_SYMBOL::OnCloseTimer, this );
|
||||
Unbind( COMPONENT_PRESELECTED, &DIALOG_CHOOSE_SYMBOL::OnComponentPreselected, this );
|
||||
Unbind( COMPONENT_SELECTED, &DIALOG_CHOOSE_SYMBOL::OnComponentSelected, this );
|
||||
|
||||
if( m_browser_button )
|
||||
{
|
||||
m_browser_button->Unbind( wxEVT_COMMAND_BUTTON_CLICKED,
|
||||
&DIALOG_CHOOSE_COMPONENT::OnUseBrowser, this );
|
||||
&DIALOG_CHOOSE_SYMBOL::OnUseBrowser, this );
|
||||
}
|
||||
|
||||
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 )
|
||||
{
|
||||
m_details->Disconnect( wxEVT_CHAR_HOOK,
|
||||
wxKeyEventHandler( DIALOG_CHOOSE_COMPONENT::OnCharHook ),
|
||||
NULL, this );
|
||||
wxKeyEventHandler( DIALOG_CHOOSE_SYMBOL::OnCharHook ), NULL, this );
|
||||
}
|
||||
|
||||
// I am not sure the following two lines are necessary, but they will not hurt anyone
|
||||
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 );
|
||||
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() )
|
||||
{
|
||||
|
@ -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() &&
|
||||
!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 );
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_CHOOSE_COMPONENT::OnUseBrowser( wxCommandEvent& aEvent )
|
||||
void DIALOG_CHOOSE_SYMBOL::OnUseBrowser( wxCommandEvent& aEvent )
|
||||
{
|
||||
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
|
||||
// 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
|
||||
// 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
|
||||
{
|
||||
|
@ -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() )
|
||||
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() )
|
||||
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 )
|
||||
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();
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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() )
|
||||
{
|
||||
|
@ -542,7 +545,7 @@ void DIALOG_CHOOSE_COMPONENT::OnComponentSelected( wxCommandEvent& aEvent )
|
|||
//
|
||||
// See DIALOG_CHOOSE_COMPONENT::OnCloseTimer for the other end of this
|
||||
// spaghetti noodle.
|
||||
m_dbl_click_timer->StartOnce( DIALOG_CHOOSE_COMPONENT::DblClickDelay );
|
||||
m_dbl_click_timer->StartOnce( DIALOG_CHOOSE_SYMBOL::DblClickDelay );
|
||||
}
|
||||
}
|
||||
|
|
@ -50,9 +50,8 @@ class SCH_DRAW_PANEL;
|
|||
|
||||
|
||||
/**
|
||||
* Dialog class to select a component from the libraries. This is the master
|
||||
* View class in a Model-View-Adapter (mediated MVC) architecture. The other
|
||||
* pieces are in:
|
||||
* Dialog class to select a symbol from the libraries. This is the master View class in a
|
||||
* Model-View-Adapter (mediated MVC) architecture. The other pieces are in:
|
||||
*
|
||||
* - Adapter: CMP_TREE_MODEL_ADAPTER in common/cmp_tree_model_adapter.h
|
||||
* - Model: CMP_TREE_NODE and descendants in common/cmp_tree_model.h
|
||||
|
@ -73,7 +72,7 @@ class SCH_DRAW_PANEL;
|
|||
* adapter->AddLibrary( nickname );
|
||||
*
|
||||
* // 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 );
|
||||
*
|
||||
* // 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:
|
||||
/**
|
||||
|
@ -103,12 +102,12 @@ public:
|
|||
* disabled. This forces aAllowFieldEdits false too.
|
||||
* @param aAllowBrowser show a Select with Browser button
|
||||
*/
|
||||
DIALOG_CHOOSE_COMPONENT( SCH_BASE_FRAME* aParent, const wxString& aTitle,
|
||||
wxObjectDataPtr<LIB_TREE_MODEL_ADAPTER>& aAdapter,
|
||||
int aDeMorganConvert, bool aAllowFieldEdits, bool aShowFootprints,
|
||||
bool aAllowBrowser );
|
||||
DIALOG_CHOOSE_SYMBOL( SCH_BASE_FRAME* aParent, const wxString& aTitle,
|
||||
wxObjectDataPtr<LIB_TREE_MODEL_ADAPTER>& aAdapter,
|
||||
int aDeMorganConvert, bool aAllowFieldEdits, bool aShowFootprints,
|
||||
bool aAllowBrowser );
|
||||
|
||||
~DIALOG_CHOOSE_COMPONENT();
|
||||
~DIALOG_CHOOSE_SYMBOL();
|
||||
|
||||
/**
|
||||
* To be called after this dialog returns from ShowModal().
|
|
@ -37,7 +37,7 @@
|
|||
#include <tool/tool_manager.h>
|
||||
#include <tools/ee_actions.h>
|
||||
|
||||
#include <dialog_choose_component.h>
|
||||
#include <dialog_choose_symbol.h>
|
||||
#include <symbol_tree_model_adapter.h>
|
||||
|
||||
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,
|
||||
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;
|
||||
SYMBOL_LIB_TABLE* libs = Prj().SchSymbolLibTable();
|
||||
|
||||
|
@ -153,8 +153,8 @@ PICKED_SYMBOL SCH_BASE_FRAME::PickSymbolFromLibTree( const SCHLIB_FILTER* aFilte
|
|||
else
|
||||
dialogTitle.Printf( _( "Choose Symbol (%d items loaded)" ), adapter->GetItemCount() );
|
||||
|
||||
DIALOG_CHOOSE_COMPONENT dlg( this, dialogTitle, adapter, aConvert, aAllowFields,
|
||||
aShowFootprints, aUseLibBrowser );
|
||||
DIALOG_CHOOSE_SYMBOL dlg( this, dialogTitle, adapter, aConvert, aAllowFields, aShowFootprints,
|
||||
aUseLibBrowser );
|
||||
|
||||
if( dlg.ShowModal() == wxID_CANCEL )
|
||||
return PICKED_SYMBOL();
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include <class_library.h>
|
||||
#include <confirm.h>
|
||||
#include <dialog_helpers.h>
|
||||
#include <dialog_choose_component.h>
|
||||
#include <dialog_choose_symbol.h>
|
||||
#include <eeschema_id.h>
|
||||
#include <eeschema_settings.h>
|
||||
#include <kiface_i.h>
|
||||
|
@ -802,7 +802,7 @@ void LIB_VIEW_FRAME::FinishModal()
|
|||
|
||||
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.
|
||||
if( !dialogLock.try_lock() )
|
||||
|
@ -828,7 +828,7 @@ void LIB_VIEW_FRAME::OnSelectSymbol( wxCommandEvent& aEvent )
|
|||
wxString dialogTitle;
|
||||
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 )
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue