diff --git a/eeschema/dialogs/dialog_symbol_properties.cpp b/eeschema/dialogs/dialog_symbol_properties.cpp
index 01cdd428bd..03f29df6b6 100644
--- a/eeschema/dialogs/dialog_symbol_properties.cpp
+++ b/eeschema/dialogs/dialog_symbol_properties.cpp
@@ -1209,3 +1209,16 @@ void DIALOG_SYMBOL_PROPERTIES::OnUnitChoice( wxCommandEvent& event )
OnModify();
}
+
+
+void DIALOG_SYMBOL_PROPERTIES::onUpdateEditSymbol( wxUpdateUIEvent& event )
+{
+ event.Enable( m_symbol && m_symbol->GetLibSymbolRef() );
+}
+
+
+void DIALOG_SYMBOL_PROPERTIES::onUpdateEditLibrarySymbol( wxUpdateUIEvent& event )
+{
+ event.Enable( m_symbol && m_symbol->GetLibSymbolRef() );
+}
+
diff --git a/eeschema/dialogs/dialog_symbol_properties.h b/eeschema/dialogs/dialog_symbol_properties.h
index afc0cbb672..165ba0a46a 100644
--- a/eeschema/dialogs/dialog_symbol_properties.h
+++ b/eeschema/dialogs/dialog_symbol_properties.h
@@ -95,6 +95,11 @@ private:
void HandleDelayedFocus( wxCommandEvent& event );
void HandleDelayedSelection( wxCommandEvent& event );
+ virtual void onUpdateEditSymbol( wxUpdateUIEvent& event ) override;
+ virtual void onUpdateEditLibrarySymbol( wxUpdateUIEvent& event ) override;
+
+ void AdjustGridColumns( int aWidth );
+
private:
SCH_SYMBOL* m_symbol;
LIB_SYMBOL* m_part;
diff --git a/eeschema/dialogs/dialog_symbol_properties_base.cpp b/eeschema/dialogs/dialog_symbol_properties_base.cpp
index b1543bfd7b..1d2d91b835 100644
--- a/eeschema/dialogs/dialog_symbol_properties_base.cpp
+++ b/eeschema/dialogs/dialog_symbol_properties_base.cpp
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
-// C++ code generated with wxFormBuilder (version 3.10.0-39-g3487c3cb)
+// C++ code generated with wxFormBuilder (version 3.10.0-4761b0c5)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -363,7 +363,9 @@ DIALOG_SYMBOL_PROPERTIES_BASE::DIALOG_SYMBOL_PROPERTIES_BASE( wxWindow* parent,
m_updateSymbolBtn->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnUpdateSymbol ), NULL, this );
m_changeSymbolBtn->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnExchangeSymbol ), NULL, this );
m_editSchematicSymbolBtn->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnEditSymbol ), NULL, this );
+ m_editSchematicSymbolBtn->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::onUpdateEditSymbol ), NULL, this );
m_editLibrarySymbolBtn->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnEditLibrarySymbol ), NULL, this );
+ m_editLibrarySymbolBtn->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::onUpdateEditLibrarySymbol ), NULL, this );
m_pinGrid->Connect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnPinTableCellEdited ), NULL, this );
m_pinGrid->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnSizePinsGrid ), NULL, this );
m_spiceFieldsButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnEditSpiceModel ), NULL, this );
@@ -393,7 +395,9 @@ DIALOG_SYMBOL_PROPERTIES_BASE::~DIALOG_SYMBOL_PROPERTIES_BASE()
m_updateSymbolBtn->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnUpdateSymbol ), NULL, this );
m_changeSymbolBtn->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnExchangeSymbol ), NULL, this );
m_editSchematicSymbolBtn->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnEditSymbol ), NULL, this );
+ m_editSchematicSymbolBtn->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::onUpdateEditSymbol ), NULL, this );
m_editLibrarySymbolBtn->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnEditLibrarySymbol ), NULL, this );
+ m_editLibrarySymbolBtn->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::onUpdateEditLibrarySymbol ), NULL, this );
m_pinGrid->Disconnect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnPinTableCellEdited ), NULL, this );
m_pinGrid->Disconnect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnSizePinsGrid ), NULL, this );
m_spiceFieldsButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnEditSpiceModel ), NULL, this );
diff --git a/eeschema/dialogs/dialog_symbol_properties_base.fbp b/eeschema/dialogs/dialog_symbol_properties_base.fbp
index c0cc01f30e..51e9af70ba 100644
--- a/eeschema/dialogs/dialog_symbol_properties_base.fbp
+++ b/eeschema/dialogs/dialog_symbol_properties_base.fbp
@@ -1711,6 +1711,7 @@
OnEditSymbol
+ onUpdateEditSymbol
diff --git a/eeschema/dialogs/dialog_symbol_properties_base.h b/eeschema/dialogs/dialog_symbol_properties_base.h
index 9b6efef2d6..9057faf44c 100644
--- a/eeschema/dialogs/dialog_symbol_properties_base.h
+++ b/eeschema/dialogs/dialog_symbol_properties_base.h
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
-// C++ code generated with wxFormBuilder (version 3.10.0-39-g3487c3cb)
+// C++ code generated with wxFormBuilder (version 3.10.0-4761b0c5)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -94,7 +94,9 @@ class DIALOG_SYMBOL_PROPERTIES_BASE : public DIALOG_SHIM
virtual void OnUpdateSymbol( wxCommandEvent& event ) { event.Skip(); }
virtual void OnExchangeSymbol( wxCommandEvent& event ) { event.Skip(); }
virtual void OnEditSymbol( wxCommandEvent& event ) { event.Skip(); }
+ virtual void onUpdateEditSymbol( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void OnEditLibrarySymbol( wxCommandEvent& event ) { event.Skip(); }
+ virtual void onUpdateEditLibrarySymbol( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void OnPinTableCellEdited( wxGridEvent& event ) { event.Skip(); }
virtual void OnSizePinsGrid( wxSizeEvent& event ) { event.Skip(); }
virtual void OnEditSpiceModel( wxCommandEvent& event ) { event.Skip(); }
diff --git a/eeschema/sch_symbol.cpp b/eeschema/sch_symbol.cpp
index 17bb6534c0..89a24a0e2a 100644
--- a/eeschema/sch_symbol.cpp
+++ b/eeschema/sch_symbol.cpp
@@ -234,6 +234,15 @@ EDA_ITEM* SCH_SYMBOL::Clone() const
}
+bool SCH_SYMBOL::IsMissingLibSymbol() const
+{
+ if( !m_part )
+ return true;
+
+ return false;
+}
+
+
void SCH_SYMBOL::ViewGetLayers( int aLayers[], int& aCount ) const
{
aCount = 7;
diff --git a/eeschema/sch_symbol.h b/eeschema/sch_symbol.h
index 1680ed2fa2..db6ac28218 100644
--- a/eeschema/sch_symbol.h
+++ b/eeschema/sch_symbol.h
@@ -120,6 +120,21 @@ public:
return wxT( "SCH_SYMBOL" );
}
+ /**
+ * Check to see if the library symbol is set to the dummy library symbol.
+ *
+ * When the library symbol is missing (which technically should not happen now that the
+ * library symbols are cached in the schematic file), a dummy library symbol is substituted
+ * for the missing symbol as an indicator that something is amiss. The dummy symbol cannot
+ * be edited so a check for this symbol must be performed before attempting to edit the
+ * library symbol with the library editor or it will crash KiCad.
+ *
+ * @see dummy()
+ *
+ * @return true if the library symbol is missing or false if it is valid.
+ */
+ bool IsMissingLibSymbol() const;
+
const std::vector& GetInstanceReferences()
{
return m_instanceReferences;
diff --git a/eeschema/tools/sch_edit_tool.cpp b/eeschema/tools/sch_edit_tool.cpp
index 73b3405738..94ed5c124e 100644
--- a/eeschema/tools/sch_edit_tool.cpp
+++ b/eeschema/tools/sch_edit_tool.cpp
@@ -1527,6 +1527,10 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
if( wxWindow* blocking_win = editor->Kiway().GetBlockingDialog() )
blocking_win->Close( true );
+ // The broken library symbol link indicator cannot be edited.
+ if( symbol->IsMissingLibSymbol() )
+ return 0;
+
editor->LoadSymbolFromSchematic( symbol );
editor->Show( true );
diff --git a/eeschema/tools/sch_editor_control.cpp b/eeschema/tools/sch_editor_control.cpp
index c6f9f5a929..95fd50bbc3 100644
--- a/eeschema/tools/sch_editor_control.cpp
+++ b/eeschema/tools/sch_editor_control.cpp
@@ -2023,7 +2023,7 @@ int SCH_EDITOR_CONTROL::EditWithSymbolEditor( const TOOL_EVENT& aEvent )
if( selection.GetSize() >= 1 )
symbol = (SCH_SYMBOL*) selection.Front();
- if( !symbol || symbol->GetEditFlags() != 0 )
+ if( !symbol || symbol->GetEditFlags() != 0 || symbol->IsMissingLibSymbol() )
return 0;
m_toolMgr->RunAction( ACTIONS::showSymbolEditor, true );