From 5dc43a1d7798a524942edd1f9f8aa40021379a57 Mon Sep 17 00:00:00 2001 From: Aylons Hazzud Date: Wed, 9 Nov 2016 21:11:47 -0200 Subject: [PATCH] Gray out "Units are not interchangeable" if 1 unit Fixes: lp:1503921 * https://bugs.launchpad.net/kicad/+bug/1503921 --- eeschema/dialogs/dialog_edit_component_in_lib.cpp | 9 +++++++++ eeschema/dialogs/dialog_edit_component_in_lib.h | 2 +- eeschema/dialogs/dialog_edit_component_in_lib_base.cpp | 4 +++- eeschema/dialogs/dialog_edit_component_in_lib_base.fbp | 2 +- eeschema/dialogs/dialog_edit_component_in_lib_base.h | 3 ++- 5 files changed, 16 insertions(+), 4 deletions(-) diff --git a/eeschema/dialogs/dialog_edit_component_in_lib.cpp b/eeschema/dialogs/dialog_edit_component_in_lib.cpp index 8f7b007d9a..440c8f4830 100644 --- a/eeschema/dialogs/dialog_edit_component_in_lib.cpp +++ b/eeschema/dialogs/dialog_edit_component_in_lib.cpp @@ -578,3 +578,12 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::EditOneFootprintFilter( wxCommandEvent& e m_FootprintFilterListBox->SetString( idx, filter ); } + + +void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnUpdateInterchangeableUnits( wxUpdateUIEvent& event ) +{ + if( m_SelNumberOfUnits->GetValue() <= 1 ) + m_OptionPartsLocked->Enable( false ); + else + m_OptionPartsLocked->Enable( true ); +} diff --git a/eeschema/dialogs/dialog_edit_component_in_lib.h b/eeschema/dialogs/dialog_edit_component_in_lib.h index e32d3a650c..dc30ad2a68 100644 --- a/eeschema/dialogs/dialog_edit_component_in_lib.h +++ b/eeschema/dialogs/dialog_edit_component_in_lib.h @@ -59,11 +59,11 @@ private: bool SetUnsetConvert(); void CopyDocFromRootToAlias(wxCommandEvent& event) override; void BrowseAndSelectDocFile(wxCommandEvent& event) override; - void DeleteAllFootprintFilter(wxCommandEvent& event) override; void DeleteOneFootprintFilter(wxCommandEvent& event) override; void AddFootprintFilter(wxCommandEvent& event) override; void EditOneFootprintFilter( wxCommandEvent& event ) override; + void OnUpdateInterchangeableUnits( wxUpdateUIEvent& event ) override; }; #endif diff --git a/eeschema/dialogs/dialog_edit_component_in_lib_base.cpp b/eeschema/dialogs/dialog_edit_component_in_lib_base.cpp index ebe1a36f1f..25ed8cad7e 100644 --- a/eeschema/dialogs/dialog_edit_component_in_lib_base.cpp +++ b/eeschema/dialogs/dialog_edit_component_in_lib_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Mar 28 2015) +// C++ code generated with wxFormBuilder (version Jul 17 2016) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -263,6 +263,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx bMainSizer->Fit( this ); // Connect Events + m_OptionPartsLocked->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnUpdateInterchangeableUnits ), NULL, this ); m_ButtonCopyDoc->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::CopyDocFromRootToAlias ), NULL, this ); m_buttonBrowseDocFiles->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::BrowseAndSelectDocFile ), NULL, this ); m_ButtonAddeAlias->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::AddAliasOfPart ), NULL, this ); @@ -279,6 +280,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::~DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE() { // Disconnect Events + m_OptionPartsLocked->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnUpdateInterchangeableUnits ), NULL, this ); m_ButtonCopyDoc->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::CopyDocFromRootToAlias ), NULL, this ); m_buttonBrowseDocFiles->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::BrowseAndSelectDocFile ), NULL, this ); m_ButtonAddeAlias->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::AddAliasOfPart ), NULL, this ); diff --git a/eeschema/dialogs/dialog_edit_component_in_lib_base.fbp b/eeschema/dialogs/dialog_edit_component_in_lib_base.fbp index 925397157a..60e6dd6447 100644 --- a/eeschema/dialogs/dialog_edit_component_in_lib_base.fbp +++ b/eeschema/dialogs/dialog_edit_component_in_lib_base.fbp @@ -1343,7 +1343,7 @@ - + OnUpdateInterchangeableUnits diff --git a/eeschema/dialogs/dialog_edit_component_in_lib_base.h b/eeschema/dialogs/dialog_edit_component_in_lib_base.h index 1c35914e31..8baeff2431 100644 --- a/eeschema/dialogs/dialog_edit_component_in_lib_base.h +++ b/eeschema/dialogs/dialog_edit_component_in_lib_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Mar 28 2015) +// C++ code generated with wxFormBuilder (version Jul 17 2016) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -96,6 +96,7 @@ class DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE : public DIALOG_SHIM wxButton* m_stdSizerButtonCancel; // Virtual event handlers, overide them in your derived class + virtual void OnUpdateInterchangeableUnits( wxUpdateUIEvent& event ) { event.Skip(); } virtual void CopyDocFromRootToAlias( wxCommandEvent& event ) { event.Skip(); } virtual void BrowseAndSelectDocFile( wxCommandEvent& event ) { event.Skip(); } virtual void AddAliasOfPart( wxCommandEvent& event ) { event.Skip(); }