diff --git a/eeschema/dialogs/dialog_pin_properties.cpp b/eeschema/dialogs/dialog_pin_properties.cpp index 5bd337a99d..61bc65c2d1 100644 --- a/eeschema/dialogs/dialog_pin_properties.cpp +++ b/eeschema/dialogs/dialog_pin_properties.cpp @@ -171,8 +171,13 @@ DIALOG_PIN_PROPERTIES::DIALOG_PIN_PROPERTIES( SYMBOL_EDIT_FRAME* parent, LIB_PIN m_sdbSizerButtonsCancel }; - // Default alternates turndow to whether or not alternates exist - m_alternatesTurndown->Collapse( m_pin->GetAlternates().size() == 0 ); + // Default alternates turndown to whether or not alternates exist, or if we've had it open before + m_alternatesTurndown->Collapse( m_pin->GetAlternates().size() == 0 && !s_alternatesTurndownOpen); + + // wxwidgets doesn't call the OnCollapseChange even at init, so we update this value if + // the alternates pane defaults to open + if ( m_pin->GetAlternates().size() > 0 ) + s_alternatesTurndownOpen = true; m_alternatesDataModel = new ALT_PIN_DATA_MODEL( GetUserUnits() ); @@ -427,6 +432,11 @@ void DIALOG_PIN_PROPERTIES::OnPropertiesChange( wxCommandEvent& event ) m_panelShowPin->Refresh(); } +void DIALOG_PIN_PROPERTIES::OnCollapsiblePaneChanged( wxCollapsiblePaneEvent& event ) +{ + s_alternatesTurndownOpen = !event.GetCollapsed(); +} + wxString DIALOG_PIN_PROPERTIES::getSyncPinsMessage() { diff --git a/eeschema/dialogs/dialog_pin_properties.h b/eeschema/dialogs/dialog_pin_properties.h index d4f363b768..7851919827 100644 --- a/eeschema/dialogs/dialog_pin_properties.h +++ b/eeschema/dialogs/dialog_pin_properties.h @@ -61,6 +61,7 @@ public: void OnPaintShowPanel( wxPaintEvent& event ) override; void OnPropertiesChange( wxCommandEvent& event ) override; + void OnCollapsiblePaneChanged( wxCollapsiblePaneEvent& event ) override; void OnAddAlternate( wxCommandEvent& event ) override; void OnDeleteAlternate( wxCommandEvent& event ) override; void OnSize( wxSizeEvent& event ) override; @@ -93,6 +94,7 @@ private: int m_originalColWidths[ COL_COUNT ]; wxSize m_size; bool m_initialized; + inline static bool s_alternatesTurndownOpen = false; }; #endif // __dialog_lib_edit_pin__ diff --git a/eeschema/dialogs/dialog_pin_properties_base.cpp b/eeschema/dialogs/dialog_pin_properties_base.cpp index 8e99f94686..358a915709 100644 --- a/eeschema/dialogs/dialog_pin_properties_base.cpp +++ b/eeschema/dialogs/dialog_pin_properties_base.cpp @@ -288,6 +288,7 @@ DIALOG_PIN_PROPERTIES_BASE::DIALOG_PIN_PROPERTIES_BASE( wxWindow* parent, wxWind m_checkApplyToAllConversions->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPropertiesChange ), NULL, this ); m_checkShow->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPropertiesChange ), NULL, this ); m_panelShowPin->Connect( wxEVT_PAINT, wxPaintEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPaintShowPanel ), NULL, this ); + m_alternatesTurndown->Connect( wxEVT_COLLAPSIBLEPANE_CHANGED, wxCollapsiblePaneEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnCollapsiblePaneChanged ), NULL, this ); m_addAlternate->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnAddAlternate ), NULL, this ); m_deleteAlternate->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnDeleteAlternate ), NULL, this ); } @@ -309,6 +310,7 @@ DIALOG_PIN_PROPERTIES_BASE::~DIALOG_PIN_PROPERTIES_BASE() m_checkApplyToAllConversions->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPropertiesChange ), NULL, this ); m_checkShow->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPropertiesChange ), NULL, this ); m_panelShowPin->Disconnect( wxEVT_PAINT, wxPaintEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPaintShowPanel ), NULL, this ); + m_alternatesTurndown->Disconnect( wxEVT_COLLAPSIBLEPANE_CHANGED, wxCollapsiblePaneEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnCollapsiblePaneChanged ), NULL, this ); m_addAlternate->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnAddAlternate ), NULL, this ); m_deleteAlternate->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnDeleteAlternate ), NULL, this ); diff --git a/eeschema/dialogs/dialog_pin_properties_base.fbp b/eeschema/dialogs/dialog_pin_properties_base.fbp index 80ea8f9bf6..d2a17bfa0f 100644 --- a/eeschema/dialogs/dialog_pin_properties_base.fbp +++ b/eeschema/dialogs/dialog_pin_properties_base.fbp @@ -2218,6 +2218,7 @@ + OnCollapsiblePaneChanged bAlternatesSizer wxVERTICAL diff --git a/eeschema/dialogs/dialog_pin_properties_base.h b/eeschema/dialogs/dialog_pin_properties_base.h index 82587c7f52..3ac88e096a 100644 --- a/eeschema/dialogs/dialog_pin_properties_base.h +++ b/eeschema/dialogs/dialog_pin_properties_base.h @@ -90,11 +90,12 @@ class DIALOG_PIN_PROPERTIES_BASE : public DIALOG_SHIM wxButton* m_sdbSizerButtonsOK; wxButton* m_sdbSizerButtonsCancel; - // Virtual event handlers, overide them in your derived class + // Virtual event handlers, override them in your derived class virtual void OnSize( wxSizeEvent& event ) { event.Skip(); } virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); } virtual void OnPropertiesChange( wxCommandEvent& event ) { event.Skip(); } virtual void OnPaintShowPanel( wxPaintEvent& event ) { event.Skip(); } + virtual void OnCollapsiblePaneChanged( wxCollapsiblePaneEvent& event ) { event.Skip(); } virtual void OnAddAlternate( wxCommandEvent& event ) { event.Skip(); } virtual void OnDeleteAlternate( wxCommandEvent& event ) { event.Skip(); } @@ -102,6 +103,7 @@ class DIALOG_PIN_PROPERTIES_BASE : public DIALOG_SHIM public: DIALOG_PIN_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Pin Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + ~DIALOG_PIN_PROPERTIES_BASE(); };