diff --git a/pcbnew/dialogs/dialog_graphic_item_properties.cpp b/pcbnew/dialogs/dialog_graphic_item_properties.cpp index 69c13d27e8..9fc61d9e5f 100644 --- a/pcbnew/dialogs/dialog_graphic_item_properties.cpp +++ b/pcbnew/dialogs/dialog_graphic_item_properties.cpp @@ -63,8 +63,18 @@ private: void onFilledCheckbox( wxCommandEvent& event ) override; + void onLayerSelection( wxCommandEvent& event ) override; + bool Validate() override; + // Show/hide the widgets used in net selection (shown only for copper layers) + void showHideNetInfo() + { + m_netSelector->Show( m_item->IsOnCopperLayer() ); + m_netLabel->Show( m_item->IsOnCopperLayer() ); + } + + private: PCB_BASE_EDIT_FRAME* m_parent; PCB_SHAPE* m_item; @@ -147,17 +157,7 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES( PCB_BASE_EDIT_FR m_netSelector->SetIndeterminate(); } - auto showHideNetInfo = - [&]() - { - m_netSelector->Show( aShape->IsOnCopperLayer() ); - m_netLabel->Show( aShape->IsOnCopperLayer() ); - }; - showHideNetInfo(); - m_LayerSelectionCtrl->Bind( wxEVT_COMBOBOX, - [&]( wxCommandEvent& aEvt ) { showHideNetInfo() ;} ); - SetInitialFocus( m_startXCtrl ); @@ -182,6 +182,16 @@ void PCB_BASE_EDIT_FRAME::ShowGraphicItemPropertiesDialog( PCB_SHAPE* aShape ) } +void DIALOG_GRAPHIC_ITEM_PROPERTIES::onLayerSelection( wxCommandEvent& event ) +{ + if( m_LayerSelectionCtrl->GetLayerSelection() >= 0 ) + { + m_item->SetLayer( ToLAYER_ID( m_LayerSelectionCtrl->GetLayerSelection() ) ); + showHideNetInfo(); + } +} + + void DIALOG_GRAPHIC_ITEM_PROPERTIES::onFilledCheckbox( wxCommandEvent& event ) { if( m_filledCtrl->GetValue() ) diff --git a/pcbnew/dialogs/dialog_graphic_item_properties_base.cpp b/pcbnew/dialogs/dialog_graphic_item_properties_base.cpp index b6bb9ad670..3f70082661 100644 --- a/pcbnew/dialogs/dialog_graphic_item_properties_base.cpp +++ b/pcbnew/dialogs/dialog_graphic_item_properties_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3) +// C++ code generated with wxFormBuilder (version 3.10.1-282-g1fa54006) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -183,19 +183,19 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE( wxWind gbSizer2->Add( m_LayerLabel, wxGBPosition( 5, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); m_LayerSelectionCtrl = new PCB_LAYER_BOX_SELECTOR( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); - gbSizer2->Add( m_LayerSelectionCtrl, wxGBPosition( 5, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND, 5 ); + gbSizer2->Add( m_LayerSelectionCtrl, wxGBPosition( 5, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND|wxRESERVE_SPACE_EVEN_IF_HIDDEN, 5 ); m_netLabel = new wxStaticText( this, wxID_ANY, _("Net:"), wxDefaultPosition, wxDefaultSize, 0 ); m_netLabel->Wrap( -1 ); - gbSizer2->Add( m_netLabel, wxGBPosition( 6, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 ); + gbSizer2->Add( m_netLabel, wxGBPosition( 6, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT|wxRESERVE_SPACE_EVEN_IF_HIDDEN|wxRIGHT, 5 ); m_netSelector = new NET_SELECTOR( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); - gbSizer2->Add( m_netSelector, wxGBPosition( 6, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND, 5 ); + gbSizer2->Add( m_netSelector, wxGBPosition( 6, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND|wxRESERVE_SPACE_EVEN_IF_HIDDEN, 5 ); gbSizer2->AddGrowableCol( 1 ); - bMiddleSizer->Add( gbSizer2, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 ); + bMiddleSizer->Add( gbSizer2, 1, wxBOTTOM|wxEXPAND|wxTOP, 5 ); bUpperSizer->Add( bMiddleSizer, 0, wxBOTTOM|wxEXPAND, 5 ); @@ -223,6 +223,7 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE( wxWind this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::OnClose ) ); this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::OnInitDlg ) ); m_filledCtrl->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::onFilledCheckbox ), NULL, this ); + m_LayerSelectionCtrl->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::onLayerSelection ), NULL, this ); } DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::~DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE() @@ -231,5 +232,6 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::~DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE() this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::OnClose ) ); this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::OnInitDlg ) ); m_filledCtrl->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::onFilledCheckbox ), NULL, this ); + m_LayerSelectionCtrl->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::onLayerSelection ), NULL, this ); } diff --git a/pcbnew/dialogs/dialog_graphic_item_properties_base.fbp b/pcbnew/dialogs/dialog_graphic_item_properties_base.fbp index 916637e400..716dab4ece 100644 --- a/pcbnew/dialogs/dialog_graphic_item_properties_base.fbp +++ b/pcbnew/dialogs/dialog_graphic_item_properties_base.fbp @@ -36,6 +36,7 @@ wxBOTH 1 + 0 1 impl_virtual @@ -115,6 +116,7 @@ Dock 0 Left + 0 1 1 @@ -179,6 +181,7 @@ Dock 0 Left + 0 1 1 @@ -243,6 +246,7 @@ Dock 0 Left + 0 1 1 @@ -310,6 +314,7 @@ Dock 0 Left + 0 1 1 @@ -374,6 +379,7 @@ Dock 0 Left + 0 1 1 @@ -438,6 +444,7 @@ Dock 0 Left + 0 1 1 @@ -505,6 +512,7 @@ Dock 0 Left + 0 1 1 @@ -569,6 +577,7 @@ Dock 0 Left + 0 1 1 @@ -633,6 +642,7 @@ Dock 0 Left + 0 1 1 @@ -697,6 +707,7 @@ Dock 0 Left + 0 1 1 @@ -764,6 +775,7 @@ Dock 0 Left + 0 1 1 @@ -828,6 +840,7 @@ Dock 0 Left + 0 1 1 @@ -892,6 +905,7 @@ Dock 0 Left + 0 1 1 @@ -959,6 +973,7 @@ Dock 0 Left + 0 1 1 @@ -1023,6 +1038,7 @@ Dock 0 Left + 0 1 1 @@ -1087,6 +1103,7 @@ Dock 0 Left + 0 1 1 @@ -1151,6 +1168,7 @@ Dock 0 Left + 0 1 1 @@ -1218,6 +1236,7 @@ Dock 0 Left + 0 1 1 @@ -1282,6 +1301,7 @@ Dock 0 Left + 0 1 1 @@ -1346,6 +1366,7 @@ Dock 0 Left + 0 1 1 @@ -1413,6 +1434,7 @@ Dock 0 Left + 0 1 1 @@ -1477,6 +1499,7 @@ Dock 0 Left + 0 1 1 @@ -1541,6 +1564,7 @@ Dock 0 Left + 0 1 1 @@ -1605,6 +1629,7 @@ Dock 0 Left + 0 1 1 @@ -1672,6 +1697,7 @@ Dock 0 Left + 0 1 1 @@ -1736,6 +1762,7 @@ Dock 0 Left + 0 1 1 @@ -1800,6 +1827,7 @@ Dock 0 Left + 0 1 1 @@ -1867,6 +1895,7 @@ Dock 0 Left + 0 1 1 @@ -1916,7 +1945,7 @@ none 5 - wxEXPAND|wxTOP|wxBOTTOM + wxBOTTOM|wxEXPAND|wxTOP 1 @@ -1957,6 +1986,7 @@ Dock 0 Left + 0 1 1 @@ -2021,6 +2051,7 @@ Dock 0 Left + 0 1 1 @@ -2088,6 +2119,7 @@ Dock 0 Left + 0 1 1 @@ -2153,6 +2185,7 @@ Dock 0 Left + 0 1 1 @@ -2220,6 +2253,7 @@ Dock 0 Left + 0 1 1 @@ -2287,6 +2321,7 @@ Dock 0 Left + 0 1 1 @@ -2351,6 +2386,7 @@ Dock 0 Left + 0 1 1 @@ -2418,6 +2454,7 @@ Dock 0 Left + 0 1 1 @@ -2482,6 +2519,7 @@ Dock 0 Left + 0 1 1 @@ -2547,6 +2585,7 @@ Dock 0 Left + 0 1 1 @@ -2614,6 +2653,7 @@ Dock 0 Left + 0 1 1 @@ -2654,7 +2694,7 @@ 5 1 1 - wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND|wxRESERVE_SPACE_EVEN_IF_HIDDEN 5 1 @@ -2679,6 +2719,7 @@ Dock 0 Left + 0 1 1 @@ -2716,13 +2757,14 @@ + onLayerSelection 5 1 0 - wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT + wxALIGN_CENTER_VERTICAL|wxLEFT|wxRESERVE_SPACE_EVEN_IF_HIDDEN|wxRIGHT 6 1 @@ -2746,6 +2788,7 @@ Dock 0 Left + 0 1 1 @@ -2786,7 +2829,7 @@ 5 1 1 - wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND|wxRESERVE_SPACE_EVEN_IF_HIDDEN 6 1 @@ -2813,6 +2856,7 @@ Dock 0 Left + 0 1 1 diff --git a/pcbnew/dialogs/dialog_graphic_item_properties_base.h b/pcbnew/dialogs/dialog_graphic_item_properties_base.h index e188b71adf..82ae2a26ee 100644 --- a/pcbnew/dialogs/dialog_graphic_item_properties_base.h +++ b/pcbnew/dialogs/dialog_graphic_item_properties_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3) +// C++ code generated with wxFormBuilder (version 3.10.1-282-g1fa54006) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -90,6 +90,7 @@ class DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE : public DIALOG_SHIM virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } virtual void OnInitDlg( wxInitDialogEvent& event ) { event.Skip(); } virtual void onFilledCheckbox( wxCommandEvent& event ) { event.Skip(); } + virtual void onLayerSelection( wxCommandEvent& event ) { event.Skip(); } public: