diff --git a/pcbnew/dialogs/dialog_track_via_properties.cpp b/pcbnew/dialogs/dialog_track_via_properties.cpp index 5664f11374..880310cab3 100644 --- a/pcbnew/dialogs/dialog_track_via_properties.cpp +++ b/pcbnew/dialogs/dialog_track_via_properties.cpp @@ -232,6 +232,12 @@ DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParen if( m_vias ) { + if( m_viaNotFree->GetValue() ) + { + m_netSelectorLabel->Disable(); + m_netSelector->Disable(); + } + m_DesignRuleViasUnit->SetLabel( GetAbbreviatedUnitsLabel( m_units ) ); int viaSelection = wxNOT_FOUND; @@ -279,6 +285,7 @@ DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParen } else { + m_viaNotFree->Hide(); m_MainSizer->Hide( m_sbViaSizer, true ); } @@ -598,6 +605,13 @@ bool DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow() } +void DIALOG_TRACK_VIA_PROPERTIES::onViaNotFreeClicked( wxCommandEvent& event ) +{ + m_netSelectorLabel->Enable( !m_viaNotFree->GetValue() ); + m_netSelector->Enable( !m_viaNotFree->GetValue() ); +} + + void DIALOG_TRACK_VIA_PROPERTIES::onTrackNetclassCheck( wxCommandEvent& aEvent ) { bool enableNC = aEvent.IsChecked(); diff --git a/pcbnew/dialogs/dialog_track_via_properties.h b/pcbnew/dialogs/dialog_track_via_properties.h index 071ab2ef5d..1be34539e2 100644 --- a/pcbnew/dialogs/dialog_track_via_properties.h +++ b/pcbnew/dialogs/dialog_track_via_properties.h @@ -41,6 +41,7 @@ public: bool TransferDataFromWindow() override; private: + void onViaNotFreeClicked( wxCommandEvent& event ) override; void onTrackNetclassCheck( wxCommandEvent& aEvent ) override; void onWidthSelect( wxCommandEvent& aEvent ) override; void onWidthEdit( wxCommandEvent& aEvent ) override; diff --git a/pcbnew/dialogs/dialog_track_via_properties_base.cpp b/pcbnew/dialogs/dialog_track_via_properties_base.cpp index d9ab0db4c3..51431cdeea 100644 --- a/pcbnew/dialogs/dialog_track_via_properties_base.cpp +++ b/pcbnew/dialogs/dialog_track_via_properties_base.cpp @@ -27,16 +27,27 @@ DIALOG_TRACK_VIA_PROPERTIES_BASE::DIALOG_TRACK_VIA_PROPERTIES_BASE( wxWindow* pa bSizerNetWidgets->Add( m_netSelectorLabel, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); m_netSelector = new NET_SELECTOR( m_sbCommonSizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); - bSizerNetWidgets->Add( m_netSelector, 1, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + bSizerNetWidgets->Add( m_netSelector, 1, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizerNetWidgets->Add( 20, 0, 0, wxEXPAND, 5 ); + + m_viaNotFree = new wxCheckBox( m_sbCommonSizer->GetStaticBox(), wxID_ANY, _("Automatically update via nets"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE ); + m_viaNotFree->SetToolTip( _("Automatically change the net of this via when the pads or zones it touches are changed") ); + + bSizerNetWidgets->Add( m_viaNotFree, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); m_sbCommonSizer->Add( bSizerNetWidgets, 5, wxEXPAND|wxRIGHT, 10 ); + m_staticline1 = new wxStaticLine( m_sbCommonSizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + m_sbCommonSizer->Add( m_staticline1, 0, wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT, 5 ); + m_lockedCbox = new wxCheckBox( m_sbCommonSizer->GetStaticBox(), wxID_ANY, _("Locked"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE ); m_sbCommonSizer->Add( m_lockedCbox, 0, wxALL, 5 ); - m_MainSizer->Add( m_sbCommonSizer, 0, wxEXPAND|wxALL, 5 ); + m_MainSizer->Add( m_sbCommonSizer, 0, wxEXPAND|wxALL, 10 ); m_sbTrackSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Tracks") ), wxHORIZONTAL ); @@ -149,12 +160,12 @@ DIALOG_TRACK_VIA_PROPERTIES_BASE::DIALOG_TRACK_VIA_PROPERTIES_BASE( wxWindow* pa m_sbTrackSizer->Add( fgTrackRightSizer, 4, wxLEFT, 10 ); - m_MainSizer->Add( m_sbTrackSizer, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + m_MainSizer->Add( m_sbTrackSizer, 0, wxEXPAND|wxRIGHT|wxLEFT, 10 ); m_sbViaSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Vias") ), wxHORIZONTAL ); wxFlexGridSizer* fgViaLeftSizer; - fgViaLeftSizer = new wxFlexGridSizer( 6, 3, 3, 5 ); + fgViaLeftSizer = new wxFlexGridSizer( 6, 3, 4, 5 ); fgViaLeftSizer->AddGrowableCol( 1 ); fgViaLeftSizer->SetFlexibleDirection( wxBOTH ); fgViaLeftSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); @@ -238,7 +249,7 @@ DIALOG_TRACK_VIA_PROPERTIES_BASE::DIALOG_TRACK_VIA_PROPERTIES_BASE( wxWindow* pa m_ViaTypeLabel = new wxStaticText( m_sbViaSizer->GetStaticBox(), wxID_ANY, _("Via type:"), wxDefaultPosition, wxDefaultSize, 0 ); m_ViaTypeLabel->Wrap( -1 ); - gbViaRightSizer->Add( m_ViaTypeLabel, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALL, 5 ); + gbViaRightSizer->Add( m_ViaTypeLabel, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxEXPAND|wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); wxString m_ViaTypeChoiceChoices[] = { _("Through"), _("Micro"), _("Blind/buried") }; int m_ViaTypeChoiceNChoices = sizeof( m_ViaTypeChoiceChoices ) / sizeof( wxString ); @@ -246,37 +257,29 @@ DIALOG_TRACK_VIA_PROPERTIES_BASE::DIALOG_TRACK_VIA_PROPERTIES_BASE( wxWindow* pa m_ViaTypeChoice->SetSelection( 0 ); m_ViaTypeChoice->Enable( false ); - gbViaRightSizer->Add( m_ViaTypeChoice, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxALL, 5 ); + gbViaRightSizer->Add( m_ViaTypeChoice, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 3 ); m_ViaStartLayerLabel = new wxStaticText( m_sbViaSizer->GetStaticBox(), wxID_ANY, _("Start layer:"), wxDefaultPosition, wxDefaultSize, 0 ); m_ViaStartLayerLabel->Wrap( -1 ); - gbViaRightSizer->Add( m_ViaStartLayerLabel, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALL, 5 ); + gbViaRightSizer->Add( m_ViaStartLayerLabel, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); m_ViaStartLayer = new PCB_LAYER_BOX_SELECTOR( m_sbViaSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); - gbViaRightSizer->Add( m_ViaStartLayer, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxALL, 5 ); + gbViaRightSizer->Add( m_ViaStartLayer, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); m_ViaEndLayerLabel1 = new wxStaticText( m_sbViaSizer->GetStaticBox(), wxID_ANY, _("End layer:"), wxDefaultPosition, wxDefaultSize, 0 ); m_ViaEndLayerLabel1->Wrap( -1 ); - gbViaRightSizer->Add( m_ViaEndLayerLabel1, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALL, 5 ); + gbViaRightSizer->Add( m_ViaEndLayerLabel1, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); m_ViaEndLayer = new PCB_LAYER_BOX_SELECTOR( m_sbViaSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); - gbViaRightSizer->Add( m_ViaEndLayer, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), wxALL, 5 ); - - m_viaNotFree = new wxCheckBox( m_sbViaSizer->GetStaticBox(), wxID_ANY, _("Automatically update via net"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE ); - m_viaNotFree->SetToolTip( _("Automatically change the net of this via when the pads or zones it touches are changed") ); - - gbViaRightSizer->Add( m_viaNotFree, wxGBPosition( 3, 0 ), wxGBSpan( 1, 2 ), wxALL, 5 ); + gbViaRightSizer->Add( m_ViaEndLayer, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); gbViaRightSizer->AddGrowableCol( 1 ); - m_sbViaSizer->Add( gbViaRightSizer, 4, wxEXPAND|wxLEFT, 5 ); + m_sbViaSizer->Add( gbViaRightSizer, 4, wxEXPAND|wxRIGHT|wxLEFT, 5 ); - m_MainSizer->Add( m_sbViaSizer, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); - - - m_MainSizer->Add( 0, 0, 1, wxEXPAND, 5 ); + m_MainSizer->Add( m_sbViaSizer, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 10 ); m_StdButtons = new wxStdDialogButtonSizer(); m_StdButtonsOK = new wxButton( this, wxID_OK ); @@ -290,10 +293,12 @@ DIALOG_TRACK_VIA_PROPERTIES_BASE::DIALOG_TRACK_VIA_PROPERTIES_BASE( wxWindow* pa this->SetSizer( m_MainSizer ); this->Layout(); + m_MainSizer->Fit( this ); this->Centre( wxBOTH ); // Connect Events + m_viaNotFree->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onViaNotFreeClicked ), NULL, this ); m_DesignRuleWidthsCtrl->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onWidthSelect ), NULL, this ); m_TrackWidthCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onWidthEdit ), NULL, this ); m_trackNetclass->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onTrackNetclassCheck ), NULL, this ); @@ -307,6 +312,7 @@ DIALOG_TRACK_VIA_PROPERTIES_BASE::DIALOG_TRACK_VIA_PROPERTIES_BASE( wxWindow* pa DIALOG_TRACK_VIA_PROPERTIES_BASE::~DIALOG_TRACK_VIA_PROPERTIES_BASE() { // Disconnect Events + m_viaNotFree->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onViaNotFreeClicked ), NULL, this ); m_DesignRuleWidthsCtrl->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onWidthSelect ), NULL, this ); m_TrackWidthCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onWidthEdit ), NULL, this ); m_trackNetclass->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onTrackNetclassCheck ), NULL, this ); diff --git a/pcbnew/dialogs/dialog_track_via_properties_base.fbp b/pcbnew/dialogs/dialog_track_via_properties_base.fbp index 871cbd602d..bc51e0dbfd 100644 --- a/pcbnew/dialogs/dialog_track_via_properties_base.fbp +++ b/pcbnew/dialogs/dialog_track_via_properties_base.fbp @@ -45,7 +45,7 @@ -1,-1 DIALOG_TRACK_VIA_PROPERTIES_BASE - 720,685 + -1,-1 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU DIALOG_SHIM; dialog_shim.h Track & Via Properties @@ -59,7 +59,7 @@ wxVERTICAL protected - 5 + 10 wxEXPAND|wxALL 0 @@ -142,7 +142,7 @@ 5 - wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND + wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND|wxALIGN_CENTER_VERTICAL 1 1 @@ -202,6 +202,139 @@ + + 5 + wxEXPAND + 0 + + 0 + protected + 20 + + + + 5 + wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Automatically update via nets + + 0 + + + 0 + + 1 + m_viaNotFree + 1 + + + protected + 1 + + Resizable + 1 + + wxCHK_3STATE + ; ; forward_declare + 0 + Automatically change the net of this via when the pads or zones it touches are changed + + wxFILTER_NONE + wxDefaultValidator + + + + + onViaNotFreeClicked + + + + + + 5 + wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_staticline1 + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + ; ; forward_declare + 0 + + + + @@ -271,7 +404,7 @@ - 5 + 10 wxEXPAND|wxRIGHT|wxLEFT 0 @@ -1670,7 +1803,7 @@ - 5 + 10 wxEXPAND|wxTOP|wxRIGHT|wxLEFT 0 @@ -1696,7 +1829,7 @@ wxFLEX_GROWMODE_SPECIFIED none 6 - 3 + 4 3 wxALIGN_CENTER_VERTICAL @@ -2729,7 +2862,7 @@ 5 - wxEXPAND|wxLEFT + wxEXPAND|wxRIGHT|wxLEFT 4 @@ -2746,7 +2879,7 @@ 5 1 0 - wxALL + wxEXPAND|wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT 0 1 @@ -2807,10 +2940,10 @@ - 5 + 3 1 1 - wxALL + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND 0 1 @@ -2878,7 +3011,7 @@ 5 1 0 - wxALL + wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT 1 1 @@ -2942,7 +3075,7 @@ 5 1 1 - wxALL + wxALIGN_CENTER_VERTICAL|wxEXPAND 1 1 @@ -3010,7 +3143,7 @@ 5 1 0 - wxALL + wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT 2 1 @@ -3074,7 +3207,7 @@ 5 1 1 - wxALL + wxALIGN_CENTER_VERTICAL|wxEXPAND 2 1 @@ -3138,87 +3271,10 @@ - - 5 - 2 - 0 - wxALL - 3 - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Automatically update via net - - 0 - - - 0 - - 1 - m_viaNotFree - 1 - - - protected - 1 - - Resizable - 1 - - wxCHK_3STATE - ; ; forward_declare - 0 - Automatically change the net of this via when the pads or zones it touches are changed - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - 5 - wxEXPAND - 1 - - 0 - protected - 0 - - 5 wxEXPAND|wxALL diff --git a/pcbnew/dialogs/dialog_track_via_properties_base.h b/pcbnew/dialogs/dialog_track_via_properties_base.h index cd314d30e3..14515063e5 100644 --- a/pcbnew/dialogs/dialog_track_via_properties_base.h +++ b/pcbnew/dialogs/dialog_track_via_properties_base.h @@ -20,8 +20,9 @@ class PCB_LAYER_BOX_SELECTOR; #include #include #include -#include #include +#include +#include #include #include #include @@ -45,6 +46,8 @@ class DIALOG_TRACK_VIA_PROPERTIES_BASE : public DIALOG_SHIM wxStaticBoxSizer* m_sbCommonSizer; wxStaticText* m_netSelectorLabel; NET_SELECTOR* m_netSelector; + wxCheckBox* m_viaNotFree; + wxStaticLine* m_staticline1; wxCheckBox* m_lockedCbox; wxStaticBoxSizer* m_sbTrackSizer; wxStaticText* m_TrackStartXLabel; @@ -91,12 +94,12 @@ class DIALOG_TRACK_VIA_PROPERTIES_BASE : public DIALOG_SHIM PCB_LAYER_BOX_SELECTOR* m_ViaStartLayer; wxStaticText* m_ViaEndLayerLabel1; PCB_LAYER_BOX_SELECTOR* m_ViaEndLayer; - wxCheckBox* m_viaNotFree; wxStdDialogButtonSizer* m_StdButtons; wxButton* m_StdButtonsOK; wxButton* m_StdButtonsCancel; // Virtual event handlers, overide them in your derived class + virtual void onViaNotFreeClicked( wxCommandEvent& event ) { event.Skip(); } virtual void onWidthSelect( wxCommandEvent& event ) { event.Skip(); } virtual void onWidthEdit( wxCommandEvent& event ) { event.Skip(); } virtual void onTrackNetclassCheck( wxCommandEvent& event ) { event.Skip(); } @@ -107,7 +110,7 @@ class DIALOG_TRACK_VIA_PROPERTIES_BASE : public DIALOG_SHIM public: - DIALOG_TRACK_VIA_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Track & Via Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 720,685 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU ); + DIALOG_TRACK_VIA_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Track & Via Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU ); ~DIALOG_TRACK_VIA_PROPERTIES_BASE(); };