diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt index 8f4e7bb864..3fd957c18f 100644 --- a/pcbnew/CMakeLists.txt +++ b/pcbnew/CMakeLists.txt @@ -169,6 +169,8 @@ set( PCBNEW_DIALOGS dialogs/panel_setup_netclasses_base.cpp dialogs/panel_setup_text_and_graphics.cpp dialogs/panel_setup_text_and_graphics_base.cpp + dialogs/panel_setup_tracks_and_vias.cpp + dialogs/panel_setup_tracks_and_vias_base.cpp footprint_wizard.cpp footprint_wizard_frame.cpp footprint_wizard_frame_functions.cpp diff --git a/pcbnew/dialogs/dialog_board_setup.cpp b/pcbnew/dialogs/dialog_board_setup.cpp index 61a5731009..453d1c45ef 100644 --- a/pcbnew/dialogs/dialog_board_setup.cpp +++ b/pcbnew/dialogs/dialog_board_setup.cpp @@ -22,10 +22,8 @@ #include #include #include +#include #include -#include -#include -#include #include #include "dialog_import_settings.h" @@ -39,6 +37,7 @@ DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP( PCB_EDIT_FRAME* aFrame ) : m_textAndGraphics = new PANEL_SETUP_TEXT_AND_GRAPHICS( this, aFrame ); m_constraints = new PANEL_SETUP_FEATURE_CONSTRAINTS( this, aFrame ); m_netclasses = new PANEL_SETUP_NETCLASSES( this, aFrame, m_constraints ); + m_tracksAndVias = new PANEL_SETUP_TRACKS_AND_VIAS( this, aFrame, m_constraints ); m_maskAndPaste = new PANEL_SETUP_MASK_AND_PASTE( this, aFrame ); m_treebook->AddPage( m_layers, _( "Layers" ) ); @@ -46,8 +45,8 @@ DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP( PCB_EDIT_FRAME* aFrame ) : m_treebook->AddPage( m_constraints, _( "Design Rules" ) ); m_treebook->AddSubPage( m_netclasses, _( "Net Classes" ) ); + m_treebook->AddSubPage( m_tracksAndVias, _( "Tracks & Vias" ) ); m_treebook->AddSubPage( m_maskAndPaste, _( "Solder Mask/Paste" ) ); - } diff --git a/pcbnew/dialogs/dialog_board_setup.h b/pcbnew/dialogs/dialog_board_setup.h index e514971667..84d43851d9 100644 --- a/pcbnew/dialogs/dialog_board_setup.h +++ b/pcbnew/dialogs/dialog_board_setup.h @@ -23,12 +23,12 @@ #include - class PCB_EDIT_FRAME; class PANEL_SETUP_FEATURE_CONSTRAINTS; class PANEL_SETUP_LAYERS; class PANEL_SETUP_TEXT_AND_GRAPHICS; class PANEL_SETUP_NETCLASSES; +class PANEL_SETUP_TRACKS_AND_VIAS; class PANEL_SETUP_MASK_AND_PASTE; @@ -46,6 +46,7 @@ protected: PANEL_SETUP_LAYERS* m_layers; PANEL_SETUP_TEXT_AND_GRAPHICS* m_textAndGraphics; PANEL_SETUP_NETCLASSES* m_netclasses; + PANEL_SETUP_TRACKS_AND_VIAS* m_tracksAndVias; PANEL_SETUP_MASK_AND_PASTE* m_maskAndPaste; }; diff --git a/pcbnew/dialogs/panel_setup_feature_constraints_base.cpp b/pcbnew/dialogs/panel_setup_feature_constraints_base.cpp index 371adbebd7..40f7614de9 100644 --- a/pcbnew/dialogs/panel_setup_feature_constraints_base.cpp +++ b/pcbnew/dialogs/panel_setup_feature_constraints_base.cpp @@ -27,20 +27,16 @@ PANEL_SETUP_FEATURE_CONSTRAINTS_BASE::PANEL_SETUP_FEATURE_CONSTRAINTS_BASE( wxWi sbFeatureRules->Add( 0, 0, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); m_OptRequireCourtyards = new wxCheckBox( this, wxID_ANY, _("Require courtyard definitions in footprints"), wxDefaultPosition, wxDefaultSize, 0 ); - m_OptRequireCourtyards->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_INFOBK ) ); - sbFeatureRules->Add( m_OptRequireCourtyards, 0, wxTOP|wxRIGHT, 5 ); m_OptOverlappingCourtyards = new wxCheckBox( this, wxID_ANY, _("Prohibit overlapping courtyards"), wxDefaultPosition, wxDefaultSize, 0 ); - m_OptOverlappingCourtyards->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_INFOBK ) ); - sbFeatureRules->Add( m_OptOverlappingCourtyards, 0, wxTOP|wxBOTTOM|wxRIGHT, 5 ); bMainSizer->Add( sbFeatureRules, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); - bMainSizer->Add( 0, 0, 0, wxEXPAND|wxRIGHT|wxLEFT, 15 ); + bMainSizer->Add( 0, 0, 0, wxEXPAND|wxRIGHT|wxLEFT, 25 ); wxBoxSizer* sbFeatureConstraints; sbFeatureConstraints = new wxBoxSizer( wxVERTICAL ); @@ -56,7 +52,9 @@ PANEL_SETUP_FEATURE_CONSTRAINTS_BASE::PANEL_SETUP_FEATURE_CONSTRAINTS_BASE( wxWi fgFeatureConstraints->Add( m_TrackMinWidthTitle, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxBOTTOM, 5 ); m_TrackMinWidthCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgFeatureConstraints->Add( m_TrackMinWidthCtrl, 0, wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND|wxBOTTOM|wxLEFT, 5 ); + m_TrackMinWidthCtrl->SetMinSize( wxSize( 120,-1 ) ); + + fgFeatureConstraints->Add( m_TrackMinWidthCtrl, 0, wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); m_TrackMinWidthUnits = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT ); m_TrackMinWidthUnits->Wrap( -1 ); @@ -76,7 +74,7 @@ PANEL_SETUP_FEATURE_CONSTRAINTS_BASE::PANEL_SETUP_FEATURE_CONSTRAINTS_BASE( wxWi fgFeatureConstraints->Add( m_ViaMinTitle, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT, 5 ); m_SetViasMinSizeCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgFeatureConstraints->Add( m_SetViasMinSizeCtrl, 0, wxEXPAND|wxLEFT, 5 ); + fgFeatureConstraints->Add( m_SetViasMinSizeCtrl, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); m_ViaMinUnits = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT ); m_ViaMinUnits->Wrap( -1 ); @@ -87,7 +85,7 @@ PANEL_SETUP_FEATURE_CONSTRAINTS_BASE::PANEL_SETUP_FEATURE_CONSTRAINTS_BASE( wxWi fgFeatureConstraints->Add( m_ViaMinDrillTitle, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT, 5 ); m_SetViasMinDrillCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgFeatureConstraints->Add( m_SetViasMinDrillCtrl, 0, wxEXPAND|wxBOTTOM|wxLEFT, 5 ); + fgFeatureConstraints->Add( m_SetViasMinDrillCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); m_ViaMinDrillUnits = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT ); m_ViaMinDrillUnits->Wrap( -1 ); @@ -107,7 +105,7 @@ PANEL_SETUP_FEATURE_CONSTRAINTS_BASE::PANEL_SETUP_FEATURE_CONSTRAINTS_BASE( wxWi fgFeatureConstraints->Add( m_uviaMinSizeLabel, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT, 5 ); m_uviaMinSizeCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgFeatureConstraints->Add( m_uviaMinSizeCtrl, 0, wxEXPAND|wxTOP|wxLEFT, 5 ); + fgFeatureConstraints->Add( m_uviaMinSizeCtrl, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); m_uviaMinSizeUnits = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT ); m_uviaMinSizeUnits->Wrap( -1 ); @@ -118,7 +116,7 @@ PANEL_SETUP_FEATURE_CONSTRAINTS_BASE::PANEL_SETUP_FEATURE_CONSTRAINTS_BASE( wxWi fgFeatureConstraints->Add( m_uviaMinDrillLabel, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT, 5 ); m_uviaMinDrillCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgFeatureConstraints->Add( m_uviaMinDrillCtrl, 0, wxEXPAND|wxLEFT, 5 ); + fgFeatureConstraints->Add( m_uviaMinDrillCtrl, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); m_uviaMinDrillUnits = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT ); m_uviaMinDrillUnits->Wrap( -1 ); @@ -135,14 +133,10 @@ PANEL_SETUP_FEATURE_CONSTRAINTS_BASE::PANEL_SETUP_FEATURE_CONSTRAINTS_BASE( wxWi m_HoleToHoleTitle = new wxStaticText( this, wxID_ANY, _("Minimum hole to hole:"), wxDefaultPosition, wxDefaultSize, 0 ); m_HoleToHoleTitle->Wrap( -1 ); - m_HoleToHoleTitle->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_INFOBK ) ); - fgFeatureConstraints->Add( m_HoleToHoleTitle, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxTOP, 5 ); m_SetHoleToHoleCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_SetHoleToHoleCtrl->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_INFOBK ) ); - - fgFeatureConstraints->Add( m_SetHoleToHoleCtrl, 0, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 ); + fgFeatureConstraints->Add( m_SetHoleToHoleCtrl, 0, wxEXPAND|wxALL, 5 ); m_HoleToHoleUnits = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 ); m_HoleToHoleUnits->Wrap( -1 ); diff --git a/pcbnew/dialogs/panel_setup_feature_constraints_base.fbp b/pcbnew/dialogs/panel_setup_feature_constraints_base.fbp index 8b52380151..cd2c2620fe 100644 --- a/pcbnew/dialogs/panel_setup_feature_constraints_base.fbp +++ b/pcbnew/dialogs/panel_setup_feature_constraints_base.fbp @@ -292,7 +292,7 @@ - wxSYS_COLOUR_INFOBK + 1 0 @@ -380,7 +380,7 @@ - wxSYS_COLOUR_INFOBK + 1 0 @@ -457,7 +457,7 @@ - 15 + 25 wxEXPAND|wxRIGHT|wxLEFT 0 @@ -576,7 +576,7 @@ 5 - wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND|wxBOTTOM|wxLEFT + wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT 0 1 @@ -612,7 +612,7 @@ 0 - + 120,-1 1 m_TrackMinWidthCtrl 1 @@ -863,7 +863,7 @@ 5 - wxEXPAND|wxLEFT + wxEXPAND|wxRIGHT|wxLEFT 0 1 @@ -1120,7 +1120,7 @@ 5 - wxEXPAND|wxBOTTOM|wxLEFT + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT 0 1 @@ -1407,7 +1407,7 @@ 5 - wxEXPAND|wxTOP|wxLEFT + wxEXPAND|wxTOP|wxRIGHT|wxLEFT 0 1 @@ -1664,7 +1664,7 @@ 5 - wxEXPAND|wxLEFT + wxEXPAND|wxRIGHT|wxLEFT 0 1 @@ -1880,7 +1880,7 @@ - wxSYS_COLOUR_INFOBK + 1 0 @@ -1951,7 +1951,7 @@ 5 - wxEXPAND|wxTOP|wxBOTTOM|wxLEFT + wxEXPAND|wxALL 0 1 @@ -1963,7 +1963,7 @@ - wxSYS_COLOUR_INFOBK + 1 0 diff --git a/pcbnew/dialogs/panel_setup_netclasses.cpp b/pcbnew/dialogs/panel_setup_netclasses.cpp index 68d36e72bb..d6f72f24b9 100644 --- a/pcbnew/dialogs/panel_setup_netclasses.cpp +++ b/pcbnew/dialogs/panel_setup_netclasses.cpp @@ -72,17 +72,14 @@ PANEL_SETUP_NETCLASSES::PANEL_SETUP_NETCLASSES( PAGED_DIALOG* aParent, PCB_EDIT_ // all our grids for consistency m_netclassGrid->SetDefaultRowSize( m_netclassGrid->GetDefaultRowSize() + 4 ); m_membershipGrid->SetDefaultRowSize( m_membershipGrid->GetDefaultRowSize() + 4 ); - m_trackWidthsGrid->SetDefaultRowSize( m_trackWidthsGrid->GetDefaultRowSize() + 4 ); - m_viaSizesGrid->SetDefaultRowSize( m_viaSizesGrid->GetDefaultRowSize() + 4 ); - m_diffPairsGrid->SetDefaultRowSize( m_diffPairsGrid->GetDefaultRowSize() + 4 ); - - m_textNetFilter->SetHint( _( "Net filter" ) ); // Set up the net name column of the netclass membership grid to read-only wxGridCellAttr* attr = new wxGridCellAttr; attr->SetReadOnly( true ); m_membershipGrid->SetColAttr( 0, attr ); + m_membershipGrid->SetSelectionMode( wxGrid::wxGridSelectRows ); + m_addButton->SetBitmap( KiBitmap( small_plus_xpm ) ); m_removeButton->SetBitmap( KiBitmap( trash_xpm ) ); @@ -167,8 +164,6 @@ bool PANEL_SETUP_NETCLASSES::TransferDataToWindow() addNet( *name, netclass->GetName() ); } - TransferDimensionListsToWindow(); - return true; } @@ -184,44 +179,6 @@ void PANEL_SETUP_NETCLASSES::addNet( wxString netName, const wxString& netclass } -void PANEL_SETUP_NETCLASSES::TransferDimensionListsToWindow() -{ -#define SETCELL( grid, row, col, val ) \ - grid->SetCellValue( row, col, StringFromValue( m_Frame->GetUserUnits(), val, true, true ) ) - - m_trackWidthsGrid->ClearGrid(); - m_viaSizesGrid->ClearGrid(); - m_diffPairsGrid->ClearGrid(); - - // Skip the first item, which is the current netclass value - for( unsigned ii = 1; ii < m_BrdSettings->m_TrackWidthList.size(); ii++ ) - { - SETCELL( m_trackWidthsGrid, ii-1, 0, m_BrdSettings->m_TrackWidthList[ii] ); - } - - // Skip the first item, which is the current netclass value - for( unsigned ii = 1; ii < m_BrdSettings->m_ViasDimensionsList.size(); ii++ ) - { - SETCELL( m_viaSizesGrid, ii-1, 0, m_BrdSettings->m_ViasDimensionsList[ii].m_Diameter ); - - if( m_BrdSettings->m_ViasDimensionsList[ii].m_Drill > 0 ) - SETCELL( m_viaSizesGrid, ii-1, 1, m_BrdSettings->m_ViasDimensionsList[ii].m_Drill ); - } - - // Skip the first item, which is the current netclass value - for( unsigned ii = 1; ii < m_BrdSettings->m_DiffPairDimensionsList.size(); ii++ ) - { - SETCELL( m_diffPairsGrid, ii-1, 0, m_BrdSettings->m_DiffPairDimensionsList[ii].m_Width ); - - if( m_BrdSettings->m_DiffPairDimensionsList[ii].m_Gap > 0 ) - SETCELL( m_diffPairsGrid, ii-1, 1, m_BrdSettings->m_DiffPairDimensionsList[ii].m_Gap ); - - if( m_BrdSettings->m_DiffPairDimensionsList[ii].m_ViaGap > 0 ) - SETCELL( m_diffPairsGrid, ii-1, 2, m_BrdSettings->m_DiffPairDimensionsList[ii].m_ViaGap ); - } -} - - /* Populates drop-downs with the list of net classes */ void PANEL_SETUP_NETCLASSES::rebuildNetclassDropdowns() @@ -238,6 +195,11 @@ void PANEL_SETUP_NETCLASSES::rebuildNetclassDropdowns() wxGridCellAttr* attr = new wxGridCellAttr; attr->SetEditor( new wxGridCellChoiceEditor( netclassNames ) ); m_membershipGrid->SetColAttr( 1, attr ); + + m_assignNetClass->Set( netclassNames ); + + netclassNames.Insert( wxEmptyString, 0 ); + m_netClassFilter->Set( netclassNames ); } @@ -260,8 +222,11 @@ static void gridRowToNetclass( EDA_UNITS_T aUnits, wxGrid* grid, int row, const } -void PANEL_SETUP_NETCLASSES::CopyNetclassesToBoard() +bool PANEL_SETUP_NETCLASSES::TransferDataFromWindow() { + if( !validateData() ) + return false; + NETCLASSES& netclasses = m_BrdSettings->m_NetClasses; // Remove all netclasses from board. We'll copy new list after @@ -289,86 +254,6 @@ void PANEL_SETUP_NETCLASSES::CopyNetclassesToBoard() } m_Pcb->SynchronizeNetsAndNetClasses(); -} - - -void PANEL_SETUP_NETCLASSES::CopyDimensionsListsToBoard() -{ - wxString msg; - std::vector trackWidths; - std::vector vias; - std::vector diffPairs; - - for( int row = 0; row < m_trackWidthsGrid->GetNumberRows(); ++row ) - { - msg = m_trackWidthsGrid->GetCellValue( row, 0 ); - - if( !msg.IsEmpty() ) - trackWidths.push_back( ValueFromString( m_Frame->GetUserUnits(), msg, true ) ); - } - - for( int row = 0; row < m_viaSizesGrid->GetNumberRows(); ++row ) - { - msg = m_viaSizesGrid->GetCellValue( row, 0 ); - - if( !msg.IsEmpty() ) - { - VIA_DIMENSION via_dim; - via_dim.m_Diameter = ValueFromString( m_Frame->GetUserUnits(), msg, true ); - - msg = m_viaSizesGrid->GetCellValue( row, 1 ); - - if( !msg.IsEmpty() ) - via_dim.m_Drill = ValueFromString( m_Frame->GetUserUnits(), msg, true ); - - vias.push_back( via_dim ); - } - } - - for( int row = 0; row < m_viaSizesGrid->GetNumberRows(); ++row ) - { - msg = m_diffPairsGrid->GetCellValue( row, 0 ); - - if( !msg.IsEmpty() ) - { - DIFF_PAIR_DIMENSION diffPair_dim; - diffPair_dim.m_Width = ValueFromString( m_Frame->GetUserUnits(), msg, true ); - - msg = m_diffPairsGrid->GetCellValue( row, 1 ); - diffPair_dim.m_Gap = ValueFromString( m_Frame->GetUserUnits(), msg, true ); - - msg = m_diffPairsGrid->GetCellValue( row, 2 ); - - if( !msg.IsEmpty() ) - diffPair_dim.m_ViaGap = ValueFromString( m_Frame->GetUserUnits(), msg, true ); - - diffPairs.push_back( diffPair_dim ); - } - } - - // Sort lists by increasing value - sort( trackWidths.begin(), trackWidths.end() ); - sort( vias.begin(), vias.end() ); - sort( diffPairs.begin(), diffPairs.end() ); - - trackWidths.insert( trackWidths.begin(), m_BrdSettings->m_TrackWidthList[ 0 ] ); - m_BrdSettings->m_TrackWidthList = trackWidths; - - vias.insert( vias.begin(), m_BrdSettings->m_ViasDimensionsList[ 0 ] ); - m_BrdSettings->m_ViasDimensionsList = vias; - - diffPairs.insert( diffPairs.begin(), m_BrdSettings->m_DiffPairDimensionsList[ 0 ] ); - m_BrdSettings->m_DiffPairDimensionsList = diffPairs; -} - - -bool PANEL_SETUP_NETCLASSES::TransferDataFromWindow() -{ - if( !validateData() ) - return false; - - CopyNetclassesToBoard(); - CopyDimensionsListsToBoard(); m_BrdSettings->SetCurrentNetClass( NETCLASS::Default ); return true; @@ -511,19 +396,33 @@ void PANEL_SETUP_NETCLASSES::OnSizeMembershipGrid( wxSizeEvent& event ) } -void PANEL_SETUP_NETCLASSES::OnFilterChanged( wxCommandEvent& event ) +void PANEL_SETUP_NETCLASSES::doApplyFilters( bool aShowAll ) { - wxString filter = m_textNetFilter->GetValue().MakeLower(); + // Commit any pending in-place edits in the membership grid + m_membershipGrid->DisableCellEditControl(); - if( filter.IsEmpty() ) - filter = wxT( "*" ); - else - filter = wxT( "*" ) + filter + wxT( "*" ); + wxString netClassFilter = m_netClassFilter->GetStringSelection(); + wxString netFilter = m_netNameFilter->GetValue().MakeLower(); + + if( !netFilter.IsEmpty() ) + netFilter = wxT( "*" ) + netFilter + wxT( "*" ); for( int row = 0; row < m_membershipGrid->GetNumberRows(); ++row ) { - if( m_membershipGrid->GetCellValue( row, 0 ).MakeLower().Matches( filter ) - || m_membershipGrid->GetCellValue( row, 1 ).MakeLower().Matches( filter ) ) + wxString net = m_membershipGrid->GetCellValue( row, 0 ); + wxString netClass = m_membershipGrid->GetCellValue( row, 1 ); + bool show = true; + + if( !aShowAll ) + { + if( !netFilter.IsEmpty() && !net.MakeLower().Matches( netFilter ) ) + show = false; + + if( !netClassFilter.IsEmpty() && netClass != netClassFilter ) + show = false; + } + + if( show ) m_membershipGrid->ShowRow( row ); else m_membershipGrid->HideRow( row ); @@ -531,6 +430,26 @@ void PANEL_SETUP_NETCLASSES::OnFilterChanged( wxCommandEvent& event ) } +void PANEL_SETUP_NETCLASSES::doAssignments( bool aAssignAll ) +{ + // Commit any pending in-place edits in the membership grid + m_membershipGrid->DisableCellEditControl(); + + wxArrayInt selectedRows = m_membershipGrid->GetSelectedRows(); + + for( int row = 0; row < m_membershipGrid->GetNumberRows(); ++row ) + { + if( !m_membershipGrid->IsRowShown( row ) ) + continue; + + if( !aAssignAll && selectedRows.Index( row ) == wxNOT_FOUND ) + continue; + + m_membershipGrid->SetCellValue( row, 1, m_assignNetClass->GetStringSelection() ); + } +} + + void PANEL_SETUP_NETCLASSES::OnUpdateUI( wxUpdateUIEvent& event ) { if( m_netclassesDirty ) @@ -552,9 +471,6 @@ bool PANEL_SETUP_NETCLASSES::validateData() // Commit any pending in-place edits and close editors from grid controls m_netclassGrid->DisableCellEditControl(); m_membershipGrid->DisableCellEditControl(); - m_trackWidthsGrid->DisableCellEditControl(); - m_viaSizesGrid->DisableCellEditControl(); - m_diffPairsGrid->DisableCellEditControl(); wxString msg; int minViaDia = m_ConstraintsPanel->m_viaMinSize.GetValue(); @@ -638,65 +554,6 @@ bool PANEL_SETUP_NETCLASSES::validateData() } } - // Test custom tracks - for( int row = 0; row < m_trackWidthsGrid->GetNumberRows(); ++row ) - { - wxString tvalue = m_trackWidthsGrid->GetCellValue( row, 0 ); - - if( tvalue.IsEmpty() ) - continue; - - if( ValueFromString( m_Frame->GetUserUnits(), tvalue ) < minTrackWidth ) - { - msg.Printf( _( "Track width less than minimum track width (%s)." ), - StringFromValue( m_Frame->GetUserUnits(), minTrackWidth, true, true ) ); - m_Parent->SetError( msg, this, m_trackWidthsGrid, row, 0 ); - return false; - } - } - - // Test custom vias - for( int row = 0; row < m_viaSizesGrid->GetNumberRows(); ++row ) - { - wxString viaDia = m_viaSizesGrid->GetCellValue( row, 0 ); - - if( viaDia.IsEmpty() ) - continue; - - if( ValueFromString( m_Frame->GetUserUnits(), viaDia ) < minViaDia ) - { - msg.Printf( _( "Via diameter less than minimum via diameter (%s)." ), - StringFromValue( m_Frame->GetUserUnits(), minViaDia, true, true ) ); - m_Parent->SetError( msg, this, m_viaSizesGrid, row, 0 ); - return false; - } - - wxString viaDrill = m_viaSizesGrid->GetCellValue( row, 1 ); - - if( viaDrill.IsEmpty() ) - { - msg = _( "No via drill defined." ); - m_Parent->SetError( msg, this, m_viaSizesGrid, row, 1 ); - return false; - } - - if( ValueFromString( m_Frame->GetUserUnits(), viaDrill ) < minViaDrill ) - { - msg.Printf( _( "Via drill less than minimum via drill (%s)." ), - StringFromValue( m_Frame->GetUserUnits(), minViaDrill, true, true ) ); - m_Parent->SetError( msg, this, m_viaSizesGrid, row, 1 ); - return false; - } - - if( ValueFromString( m_Frame->GetUserUnits(), viaDrill ) - >= ValueFromString( m_Frame->GetUserUnits(), viaDia ) ) - { - msg = _( "Via drill larger than via diameter." ); - m_Parent->SetError( msg, this, m_viaSizesGrid, row, 1 ); - return false; - } - } - return true; } diff --git a/pcbnew/dialogs/panel_setup_netclasses.h b/pcbnew/dialogs/panel_setup_netclasses.h index 4d65e1d909..5493077b41 100644 --- a/pcbnew/dialogs/panel_setup_netclasses.h +++ b/pcbnew/dialogs/panel_setup_netclasses.h @@ -58,21 +58,20 @@ private: void OnSizeMembershipGrid( wxSizeEvent& event ) override; void OnUpdateUI( wxUpdateUIEvent &event ) override; void OnNetclassGridCellChanging( wxGridEvent& event ); - void OnFilterChanged( wxCommandEvent& event ) override; + void OnShowAll( wxCommandEvent& event ) override { doApplyFilters( true ); } + void OnApplyFilters( wxCommandEvent& event ) override { doApplyFilters( false ); } + void OnAssignAll( wxCommandEvent& event ) override { doAssignments( true ); } + void OnAssignSelected( wxCommandEvent& event ) override { doAssignments( false ); } bool validateNetclassName( int aRow, wxString aName, bool focusFirst = true ); bool validateData(); void rebuildNetclassDropdowns(); - - /* Populates the lists of sizes (Tracks width list and Vias diameters & drill list) */ - void TransferDimensionListsToWindow(); - void CopyDimensionsListsToBoard( ); - int getNetclassValue( int aRow, int aCol ); - void CopyNetclassesToBoard(); void addNet( wxString netName, const wxString& netclass ); + void doApplyFilters( bool aShowAll ); + void doAssignments( bool aAssignAll ); void AdjustNetclassGridColumns( int aWidth ); void AdjustMembershipGridColumns( int aWidth ); diff --git a/pcbnew/dialogs/panel_setup_netclasses_base.cpp b/pcbnew/dialogs/panel_setup_netclasses_base.cpp index af1fa5961e..e621d8e2e8 100644 --- a/pcbnew/dialogs/panel_setup_netclasses_base.cpp +++ b/pcbnew/dialogs/panel_setup_netclasses_base.cpp @@ -16,6 +16,9 @@ PANEL_SETUP_NETCLASSES_BASE::PANEL_SETUP_NETCLASSES_BASE( wxWindow* parent, wxWi wxBoxSizer* bpanelNetClassesSizer; bpanelNetClassesSizer = new wxBoxSizer( wxVERTICAL ); + wxBoxSizer* bMargins; + bMargins = new wxBoxSizer( wxVERTICAL ); + wxStaticBoxSizer* sbSizerUpper; sbSizerUpper = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Net Classes") ), wxVERTICAL ); @@ -31,14 +34,14 @@ PANEL_SETUP_NETCLASSES_BASE::PANEL_SETUP_NETCLASSES_BASE( wxWindow* parent, wxWi // Columns m_netclassGrid->SetColSize( 0, 120 ); - m_netclassGrid->SetColSize( 1, 88 ); - m_netclassGrid->SetColSize( 2, 88 ); - m_netclassGrid->SetColSize( 3, 88 ); - m_netclassGrid->SetColSize( 4, 88 ); - m_netclassGrid->SetColSize( 5, 88 ); - m_netclassGrid->SetColSize( 6, 88 ); - m_netclassGrid->SetColSize( 7, 88 ); - m_netclassGrid->SetColSize( 8, 88 ); + m_netclassGrid->SetColSize( 1, 85 ); + m_netclassGrid->SetColSize( 2, 85 ); + m_netclassGrid->SetColSize( 3, 85 ); + m_netclassGrid->SetColSize( 4, 85 ); + m_netclassGrid->SetColSize( 5, 85 ); + m_netclassGrid->SetColSize( 6, 85 ); + m_netclassGrid->SetColSize( 7, 85 ); + m_netclassGrid->SetColSize( 8, 85 ); m_netclassGrid->EnableDragColMove( false ); m_netclassGrid->EnableDragColSize( true ); m_netclassGrid->SetColLabelSize( 22 ); @@ -65,7 +68,7 @@ PANEL_SETUP_NETCLASSES_BASE::PANEL_SETUP_NETCLASSES_BASE( wxWindow* parent, wxWi m_netclassGrid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP ); m_netclassGrid->SetToolTip( _("Net Class parameters") ); - sbSizerUpper->Add( m_netclassGrid, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); + sbSizerUpper->Add( m_netclassGrid, 1, wxEXPAND, 5 ); wxBoxSizer* buttonBoxSizer; buttonBoxSizer = new wxBoxSizer( wxHORIZONTAL ); @@ -78,22 +81,116 @@ PANEL_SETUP_NETCLASSES_BASE::PANEL_SETUP_NETCLASSES_BASE( wxWindow* parent, wxWi m_removeButton = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW ); m_removeButton->SetMinSize( wxSize( 29,29 ) ); - buttonBoxSizer->Add( m_removeButton, 0, wxRIGHT, 10 ); + buttonBoxSizer->Add( m_removeButton, 0, 0, 10 ); - sbSizerUpper->Add( buttonBoxSizer, 0, wxEXPAND|wxALL, 2 ); + sbSizerUpper->Add( buttonBoxSizer, 0, wxEXPAND|wxTOP, 2 ); - bpanelNetClassesSizer->Add( sbSizerUpper, 4, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + bMargins->Add( sbSizerUpper, 4, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - wxBoxSizer* bSizerLower; - bSizerLower = new wxBoxSizer( wxHORIZONTAL ); + wxStaticBoxSizer* sbMembership; + sbMembership = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Net Class Memberships") ), wxHORIZONTAL ); - wxStaticBoxSizer* sbSizerNetSelectMain; - sbSizerNetSelectMain = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Net Class Membership") ), wxVERTICAL ); + wxBoxSizer* bLeft; + bLeft = new wxBoxSizer( wxVERTICAL ); - m_textNetFilter = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - sbSizerNetSelectMain->Add( m_textNetFilter, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + wxStaticBoxSizer* sbFilters; + sbFilters = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Filter Nets") ), wxVERTICAL ); + + wxBoxSizer* bSizer9; + bSizer9 = new wxBoxSizer( wxHORIZONTAL ); + + m_staticText6 = new wxStaticText( sbFilters->GetStaticBox(), wxID_ANY, _("Net class filter:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText6->Wrap( -1 ); + m_staticText6->SetMinSize( wxSize( 120,-1 ) ); + + bSizer9->Add( m_staticText6, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); + + wxArrayString m_netClassFilterChoices; + m_netClassFilter = new wxChoice( sbFilters->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_netClassFilterChoices, 0 ); + m_netClassFilter->SetSelection( 0 ); + bSizer9->Add( m_netClassFilter, 1, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); + + + sbFilters->Add( bSizer9, 0, wxEXPAND, 5 ); + + wxBoxSizer* bSizer10; + bSizer10 = new wxBoxSizer( wxHORIZONTAL ); + + m_filterLabel = new wxStaticText( sbFilters->GetStaticBox(), wxID_ANY, _("Net name filter:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_filterLabel->Wrap( -1 ); + m_filterLabel->SetMinSize( wxSize( 120,-1 ) ); + + bSizer10->Add( m_filterLabel, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_netNameFilter = new wxTextCtrl( sbFilters->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + bSizer10->Add( m_netNameFilter, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + + sbFilters->Add( bSizer10, 0, wxEXPAND, 5 ); + + wxBoxSizer* bSizer13; + bSizer13 = new wxBoxSizer( wxHORIZONTAL ); + + m_showAllButton = new wxButton( sbFilters->GetStaticBox(), wxID_ANY, _("Show All Nets"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer13->Add( m_showAllButton, 1, wxALL, 5 ); + + + bSizer13->Add( 0, 0, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + + m_filterNetsButton = new wxButton( sbFilters->GetStaticBox(), wxID_ANY, _("Apply Filters"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer13->Add( m_filterNetsButton, 1, wxALL, 5 ); + + + sbFilters->Add( bSizer13, 1, wxEXPAND|wxTOP|wxBOTTOM, 6 ); + + + bLeft->Add( sbFilters, 0, wxEXPAND|wxBOTTOM, 5 ); + + wxStaticBoxSizer* sbEdit; + sbEdit = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Assign Net Class") ), wxVERTICAL ); + + wxBoxSizer* bSizer11; + bSizer11 = new wxBoxSizer( wxHORIZONTAL ); + + m_assignLabel = new wxStaticText( sbEdit->GetStaticBox(), wxID_ANY, _("New net class:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_assignLabel->Wrap( -1 ); + m_assignLabel->SetMinSize( wxSize( 120,-1 ) ); + + bSizer11->Add( m_assignLabel, 0, wxALL, 5 ); + + wxArrayString m_assignNetClassChoices; + m_assignNetClass = new wxChoice( sbEdit->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_assignNetClassChoices, 0 ); + m_assignNetClass->SetSelection( 0 ); + bSizer11->Add( m_assignNetClass, 1, wxALL, 5 ); + + + sbEdit->Add( bSizer11, 0, wxEXPAND, 5 ); + + wxBoxSizer* bSizer12; + bSizer12 = new wxBoxSizer( wxHORIZONTAL ); + + m_assignAllButton = new wxButton( sbEdit->GetStaticBox(), wxID_ANY, _("Assign To Listed Nets"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer12->Add( m_assignAllButton, 1, wxALL, 5 ); + + + bSizer12->Add( 0, 0, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + + m_assignSelectedButton = new wxButton( sbEdit->GetStaticBox(), wxID_ANY, _("Assign To Selected Nets"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer12->Add( m_assignSelectedButton, 1, wxALL, 5 ); + + + sbEdit->Add( bSizer12, 0, wxEXPAND|wxTOP, 6 ); + + + bLeft->Add( sbEdit, 1, wxEXPAND|wxTOP, 8 ); + + + sbMembership->Add( bLeft, 1, wxEXPAND|wxRIGHT, 5 ); + + wxBoxSizer* bRight; + bRight = new wxBoxSizer( wxVERTICAL ); m_membershipGrid = new WX_GRID( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); @@ -121,164 +218,16 @@ PANEL_SETUP_NETCLASSES_BASE::PANEL_SETUP_NETCLASSES_BASE( wxWindow* parent, wxWi // Cell Defaults m_membershipGrid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP ); - sbSizerNetSelectMain->Add( m_membershipGrid, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + bRight->Add( m_membershipGrid, 1, wxEXPAND|wxBOTTOM|wxLEFT, 5 ); - bSizerLower->Add( sbSizerNetSelectMain, 1, wxEXPAND|wxTOP|wxRIGHT, 5 ); - - wxStaticBoxSizer* sbOtherValuesSizer; - sbOtherValuesSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Non-netclass Predefined Values") ), wxHORIZONTAL ); - - wxBoxSizer* bSizer10; - bSizer10 = new wxBoxSizer( wxVERTICAL ); - - m_staticText24 = new wxStaticText( this, wxID_ANY, _("Tracks:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText24->Wrap( -1 ); - bSizer10->Add( m_staticText24, 0, wxRIGHT|wxLEFT, 5 ); - - m_trackWidthsGrid = new WX_GRID( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); - - // Grid - m_trackWidthsGrid->CreateGrid( 8, 1 ); - m_trackWidthsGrid->EnableEditing( true ); - m_trackWidthsGrid->EnableGridLines( true ); - m_trackWidthsGrid->EnableDragGridSize( false ); - m_trackWidthsGrid->SetMargins( 0, 0 ); - - // Columns - m_trackWidthsGrid->SetColSize( 0, 78 ); - m_trackWidthsGrid->EnableDragColMove( false ); - m_trackWidthsGrid->EnableDragColSize( false ); - m_trackWidthsGrid->SetColLabelSize( 22 ); - m_trackWidthsGrid->SetColLabelValue( 0, _("Width") ); - m_trackWidthsGrid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); - - // Rows - m_trackWidthsGrid->EnableDragRowSize( false ); - m_trackWidthsGrid->SetRowLabelSize( 0 ); - m_trackWidthsGrid->SetRowLabelValue( 0, _("Track 1") ); - m_trackWidthsGrid->SetRowLabelValue( 1, _("Track 2") ); - m_trackWidthsGrid->SetRowLabelValue( 2, _("Track 3") ); - m_trackWidthsGrid->SetRowLabelValue( 3, _("Track 4") ); - m_trackWidthsGrid->SetRowLabelValue( 4, _("Track 5") ); - m_trackWidthsGrid->SetRowLabelValue( 5, _("Track 6") ); - m_trackWidthsGrid->SetRowLabelValue( 6, _("Track 7") ); - m_trackWidthsGrid->SetRowLabelValue( 7, _("Track 8") ); - m_trackWidthsGrid->SetRowLabelValue( 8, _("Track 9") ); - m_trackWidthsGrid->SetRowLabelValue( 9, _("Track 10") ); - m_trackWidthsGrid->SetRowLabelValue( 10, _("Track 11") ); - m_trackWidthsGrid->SetRowLabelValue( 11, _("Track 12") ); - m_trackWidthsGrid->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); - - // Label Appearance - - // Cell Defaults - m_trackWidthsGrid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP ); - bSizer10->Add( m_trackWidthsGrid, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + sbMembership->Add( bRight, 1, wxEXPAND|wxLEFT, 5 ); - sbOtherValuesSizer->Add( bSizer10, 0, wxEXPAND, 5 ); - - wxBoxSizer* bSizer11; - bSizer11 = new wxBoxSizer( wxVERTICAL ); - - m_staticText25 = new wxStaticText( this, wxID_ANY, _("Vias:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText25->Wrap( -1 ); - bSizer11->Add( m_staticText25, 0, wxRIGHT|wxLEFT, 5 ); - - m_viaSizesGrid = new WX_GRID( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); - - // Grid - m_viaSizesGrid->CreateGrid( 8, 2 ); - m_viaSizesGrid->EnableEditing( true ); - m_viaSizesGrid->EnableGridLines( true ); - m_viaSizesGrid->EnableDragGridSize( false ); - m_viaSizesGrid->SetMargins( 0, 0 ); - - // Columns - m_viaSizesGrid->SetColSize( 0, 78 ); - m_viaSizesGrid->SetColSize( 1, 78 ); - m_viaSizesGrid->EnableDragColMove( false ); - m_viaSizesGrid->EnableDragColSize( false ); - m_viaSizesGrid->SetColLabelSize( 22 ); - m_viaSizesGrid->SetColLabelValue( 0, _("Size") ); - m_viaSizesGrid->SetColLabelValue( 1, _("Drill") ); - m_viaSizesGrid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); - - // Rows - m_viaSizesGrid->EnableDragRowSize( false ); - m_viaSizesGrid->SetRowLabelSize( 0 ); - m_viaSizesGrid->SetRowLabelValue( 0, _("Via 1") ); - m_viaSizesGrid->SetRowLabelValue( 1, _("Via 2") ); - m_viaSizesGrid->SetRowLabelValue( 2, _("Via 3") ); - m_viaSizesGrid->SetRowLabelValue( 3, _("Via 4") ); - m_viaSizesGrid->SetRowLabelValue( 4, _("Via 5") ); - m_viaSizesGrid->SetRowLabelValue( 5, _("Via 6") ); - m_viaSizesGrid->SetRowLabelValue( 6, _("Via 7") ); - m_viaSizesGrid->SetRowLabelValue( 7, _("Via 8") ); - m_viaSizesGrid->SetRowLabelValue( 8, _("Via 9") ); - m_viaSizesGrid->SetRowLabelValue( 9, _("Via 10") ); - m_viaSizesGrid->SetRowLabelValue( 10, _("Via 11") ); - m_viaSizesGrid->SetRowLabelValue( 11, _("Via 12") ); - m_viaSizesGrid->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); - - // Label Appearance - - // Cell Defaults - m_viaSizesGrid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP ); - bSizer11->Add( m_viaSizesGrid, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + bMargins->Add( sbMembership, 5, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); - sbOtherValuesSizer->Add( bSizer11, 0, wxEXPAND|wxLEFT, 5 ); - - wxBoxSizer* bSizer12; - bSizer12 = new wxBoxSizer( wxVERTICAL ); - - m_staticText26 = new wxStaticText( this, wxID_ANY, _("Differential Pairs:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText26->Wrap( -1 ); - bSizer12->Add( m_staticText26, 0, wxRIGHT|wxLEFT, 5 ); - - m_diffPairsGrid = new WX_GRID( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); - - // Grid - m_diffPairsGrid->CreateGrid( 8, 3 ); - m_diffPairsGrid->EnableEditing( true ); - m_diffPairsGrid->EnableGridLines( true ); - m_diffPairsGrid->EnableDragGridSize( false ); - m_diffPairsGrid->SetMargins( 0, 0 ); - - // Columns - m_diffPairsGrid->SetColSize( 0, 78 ); - m_diffPairsGrid->SetColSize( 1, 78 ); - m_diffPairsGrid->SetColSize( 2, 78 ); - m_diffPairsGrid->EnableDragColMove( false ); - m_diffPairsGrid->EnableDragColSize( true ); - m_diffPairsGrid->SetColLabelSize( 22 ); - m_diffPairsGrid->SetColLabelValue( 0, _("Width") ); - m_diffPairsGrid->SetColLabelValue( 1, _("Gap") ); - m_diffPairsGrid->SetColLabelValue( 2, _("Via Gap") ); - m_diffPairsGrid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); - - // Rows - m_diffPairsGrid->EnableDragRowSize( true ); - m_diffPairsGrid->SetRowLabelSize( 0 ); - m_diffPairsGrid->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); - - // Label Appearance - - // Cell Defaults - m_diffPairsGrid->SetDefaultCellBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_INFOBK ) ); - m_diffPairsGrid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP ); - bSizer12->Add( m_diffPairsGrid, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - - sbOtherValuesSizer->Add( bSizer12, 0, wxEXPAND|wxLEFT, 5 ); - - - bSizerLower->Add( sbOtherValuesSizer, 0, wxEXPAND|wxTOP|wxLEFT, 5 ); - - - bpanelNetClassesSizer->Add( bSizerLower, 5, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); + bpanelNetClassesSizer->Add( bMargins, 1, wxEXPAND|wxRIGHT, 5 ); this->SetSizer( bpanelNetClassesSizer ); @@ -289,7 +238,10 @@ PANEL_SETUP_NETCLASSES_BASE::PANEL_SETUP_NETCLASSES_BASE( wxWindow* parent, wxWi m_netclassGrid->Connect( wxEVT_SIZE, wxSizeEventHandler( PANEL_SETUP_NETCLASSES_BASE::OnSizeNetclassGrid ), NULL, this ); m_addButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SETUP_NETCLASSES_BASE::OnAddNetclassClick ), NULL, this ); m_removeButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SETUP_NETCLASSES_BASE::OnRemoveNetclassClick ), NULL, this ); - m_textNetFilter->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_SETUP_NETCLASSES_BASE::OnFilterChanged ), NULL, this ); + m_showAllButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SETUP_NETCLASSES_BASE::OnShowAll ), NULL, this ); + m_filterNetsButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SETUP_NETCLASSES_BASE::OnApplyFilters ), NULL, this ); + m_assignAllButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SETUP_NETCLASSES_BASE::OnAssignAll ), NULL, this ); + m_assignSelectedButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SETUP_NETCLASSES_BASE::OnAssignSelected ), NULL, this ); m_membershipGrid->Connect( wxEVT_SIZE, wxSizeEventHandler( PANEL_SETUP_NETCLASSES_BASE::OnSizeMembershipGrid ), NULL, this ); m_membershipGrid->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PANEL_SETUP_NETCLASSES_BASE::OnUpdateUI ), NULL, this ); } @@ -300,7 +252,10 @@ PANEL_SETUP_NETCLASSES_BASE::~PANEL_SETUP_NETCLASSES_BASE() m_netclassGrid->Disconnect( wxEVT_SIZE, wxSizeEventHandler( PANEL_SETUP_NETCLASSES_BASE::OnSizeNetclassGrid ), NULL, this ); m_addButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SETUP_NETCLASSES_BASE::OnAddNetclassClick ), NULL, this ); m_removeButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SETUP_NETCLASSES_BASE::OnRemoveNetclassClick ), NULL, this ); - m_textNetFilter->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_SETUP_NETCLASSES_BASE::OnFilterChanged ), NULL, this ); + m_showAllButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SETUP_NETCLASSES_BASE::OnShowAll ), NULL, this ); + m_filterNetsButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SETUP_NETCLASSES_BASE::OnApplyFilters ), NULL, this ); + m_assignAllButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SETUP_NETCLASSES_BASE::OnAssignAll ), NULL, this ); + m_assignSelectedButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SETUP_NETCLASSES_BASE::OnAssignSelected ), NULL, this ); m_membershipGrid->Disconnect( wxEVT_SIZE, wxSizeEventHandler( PANEL_SETUP_NETCLASSES_BASE::OnSizeMembershipGrid ), NULL, this ); m_membershipGrid->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PANEL_SETUP_NETCLASSES_BASE::OnUpdateUI ), NULL, this ); diff --git a/pcbnew/dialogs/panel_setup_netclasses_base.fbp b/pcbnew/dialogs/panel_setup_netclasses_base.fbp index c7c5696d14..452fbceef0 100644 --- a/pcbnew/dialogs/panel_setup_netclasses_base.fbp +++ b/pcbnew/dialogs/panel_setup_netclasses_base.fbp @@ -85,475 +85,29 @@ none 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT - 4 - - wxID_ANY - Net Classes - -1,220 - sbSizerUpper - wxVERTICAL - 0 - none - - - 5 - wxEXPAND|wxTOP|wxRIGHT|wxLEFT - 1 - - 1 - 1 - 1 - 1 - - - - - 0 - 0 - - - - 1 - - - wxALIGN_LEFT - - wxALIGN_TOP - 0 - 1 - wxALIGN_CENTRE - 22 - "Name" "Clearance" "Track Width" "Via Size" "Via Drill" "uVia Size" "uVia Drill" "dPair Width" "dPair Gap" - wxALIGN_CENTRE - 9 - 120,88,88,88,88,88,88,88,88 - - 1 - 0 - Dock - 0 - Left - 0 - 1 - 0 - 0 - 1 - 1 - - 1 - - - 1 - 0 - 0 - wxID_ANY - - - - 0 - 0 - - 0 - - - 0 - -1,-1 - 1 - m_netclassGrid - 1 - - - protected - 1 - - Resizable - wxALIGN_LEFT - 0 - "Default" - wxALIGN_CENTRE - - 1 - 1 - - WX_GRID; widgets/wx_grid.h; forward_declare - 0 - Net Class parameters - - - wxHSCROLL|wxTAB_TRAVERSAL|wxVSCROLL - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - OnSizeNetclassGrid - - - - - 2 - wxEXPAND|wxALL - 0 - - - buttonBoxSizer - wxHORIZONTAL - none - - 5 - - 0 - - 1 - 1 - 1 - 1 - - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 0 - - wxID_ANY - Add Net Class - - 0 - - - 0 - 29,29 - 1 - m_addButton - 1 - - - protected - 1 - - Resizable - - 1 - -1,-1 - wxBU_AUTODRAW - ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnAddNetclassClick - - - - - - - - - - - - - - - - - - - - - - - - - - - 10 - wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 0 - - wxID_ANY - Delete Net Class - - 0 - - - 0 - 29,29 - 1 - m_removeButton - 1 - - - protected - 1 - - Resizable - - 1 - -1,-1 - wxBU_AUTODRAW - ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnRemoveNetclassClick - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxTOP|wxRIGHT|wxLEFT - 5 + wxEXPAND|wxRIGHT + 1 - bSizerLower - wxHORIZONTAL + bMargins + wxVERTICAL none - + 5 - wxEXPAND|wxTOP|wxRIGHT - 1 - + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + 4 + wxID_ANY - Net Class Membership - - sbSizerNetSelectMain + Net Classes + -1,220 + sbSizerUpper wxVERTICAL 0 none 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - - 0 - - 1 - m_textNetFilter - 1 - - - protected - 1 - - Resizable - 1 - - - ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - OnFilterChanged - - - - - - - - 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + wxEXPAND 1 1 @@ -579,10 +133,10 @@ 1 wxALIGN_CENTRE 22 - "Net" "Net Class" + "Name" "Clearance" "Track Width" "Via Size" "Via Drill" "uVia Size" "uVia Drill" "dPair Width" "dPair Gap" wxALIGN_CENTRE - 2 - + 9 + 120,85,85,85,85,85,85,85,85 1 0 @@ -592,7 +146,7 @@ 0 1 0 - 1 + 0 1 1 @@ -615,7 +169,7 @@ 0 -1,-1 1 - m_membershipGrid + m_netclassGrid 1 @@ -623,20 +177,20 @@ 1 Resizable - wxALIGN_CENTRE + wxALIGN_LEFT 0 - + "Default" wxALIGN_CENTRE - 0 + 1 1 WX_GRID; widgets/wx_grid.h; forward_declare 0 - + Net Class parameters - + wxHSCROLL|wxTAB_TRAVERSAL|wxVSCROLL @@ -690,258 +244,1202 @@ - OnSizeMembershipGrid - OnUpdateUI + OnSizeNetclassGrid + + + + + 2 + wxEXPAND|wxTOP + 0 + + + buttonBoxSizer + wxHORIZONTAL + none + + 5 + + 0 + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + + wxID_ANY + Add Net Class + + 0 + + + 0 + 29,29 + 1 + m_addButton + 1 + + + protected + 1 + + Resizable + + 1 + -1,-1 + wxBU_AUTODRAW + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnAddNetclassClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 10 + + 0 + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + + wxID_ANY + Delete Net Class + + 0 + + + 0 + 29,29 + 1 + m_removeButton + 1 + + + protected + 1 + + Resizable + + 1 + -1,-1 + wxBU_AUTODRAW + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnRemoveNetclassClick + + + + + + + + + + + + + + + + + + + + + + + + + 5 - wxEXPAND|wxTOP|wxLEFT - 0 + wxEXPAND|wxTOP|wxRIGHT|wxLEFT + 5 wxID_ANY - Non-netclass Predefined Values + Net Class Memberships - sbOtherValuesSizer + sbMembership wxHORIZONTAL 0 none 5 - wxEXPAND - 0 + wxEXPAND|wxRIGHT + 1 - bSizer10 + bLeft wxVERTICAL none - + 5 - wxRIGHT|wxLEFT + wxEXPAND|wxBOTTOM 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 + wxID_ANY - Tracks: - - 0 - - - 0 + Filter Nets - 1 - m_staticText24 - 1 - - - protected - 1 - - Resizable - 1 - - - ; forward_declare - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - + sbFilters + wxVERTICAL + 1 + none + + 5 + wxEXPAND + 0 + + + bSizer9 + wxHORIZONTAL + none + + 5 + wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Net class filter: + + 0 + + + 0 + 120,-1 + 1 + m_staticText6 + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_netClassFilter + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 0 + + + bSizer10 + wxHORIZONTAL + none + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Net name filter: + + 0 + + + 0 + 120,-1 + 1 + m_filterLabel + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALL + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + + 0 + + 1 + m_netNameFilter + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 6 + wxEXPAND|wxTOP|wxBOTTOM + 1 + + + bSizer13 + wxHORIZONTAL + none + + 5 + wxALL + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Show All Nets + + 0 + + + 0 + + 1 + m_showAllButton + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnShowAll + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxRIGHT|wxLEFT + 0 + + 0 + protected + 0 + + + + 5 + wxALL + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Apply Filters + + 0 + + + 0 + + 1 + m_filterNetsButton + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnApplyFilters + + + + + + + + + + + + + + + + + + + + + + + + + + + - - 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + + 8 + wxEXPAND|wxTOP 1 - - 1 - 1 - 1 - 1 - - - - - 0 - 0 - - - - 1 - - - wxALIGN_LEFT - - wxALIGN_TOP - 0 - 1 - wxALIGN_CENTRE - 22 - "Width" - wxALIGN_CENTRE - 1 - 78 - - 1 - 0 - Dock - 0 - Left - 0 - 0 - 0 - 0 - 1 - 1 - - 1 - - - 1 - 0 - 0 + wxID_ANY - - - - 0 - 0 - - 0 - - - 0 + Assign Net Class - 1 - m_trackWidthsGrid - 1 - - - protected - 1 - - Resizable - wxALIGN_CENTRE - 0 - "Track 1" "Track 2" "Track 3" "Track 4" "Track 5" "Track 6" "Track 7" "Track 8" "Track 9" "Track 10" "Track 11" "Track 12" - wxALIGN_CENTRE - - 8 - 1 - - WX_GRID; widgets/wx_grid.h; forward_declare - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + sbEdit + wxVERTICAL + 1 + none + + 5 + wxEXPAND + 0 + + + bSizer11 + wxHORIZONTAL + none + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + New net class: + + 0 + + + 0 + 120,-1 + 1 + m_assignLabel + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_assignNetClass + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 6 + wxEXPAND|wxTOP + 0 + + + bSizer12 + wxHORIZONTAL + none + + 5 + wxALL + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Assign To Listed Nets + + 0 + + + 0 + + 1 + m_assignAllButton + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnAssignAll + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxRIGHT|wxLEFT + 0 + + 0 + protected + 0 + + + + 5 + wxALL + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Assign To Selected Nets + + 0 + + + 0 + + 1 + m_assignSelectedButton + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnAssignSelected + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -949,98 +1447,15 @@ 5 wxEXPAND|wxLEFT - 0 + 1 - bSizer11 + bRight wxVERTICAL none 5 - wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Vias: - - 0 - - - 0 - - 1 - m_staticText25 - 1 - - - protected - 1 - - Resizable - 1 - - - ; forward_declare - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + wxEXPAND|wxBOTTOM|wxLEFT 1 1 @@ -1066,247 +1481,10 @@ 1 wxALIGN_CENTRE 22 - "Size" "Drill" + "Net" "Net Class" wxALIGN_CENTRE 2 - 78,78 - - 1 - 0 - Dock - 0 - Left - 0 - 0 - 0 - 0 - 1 - 1 - - 1 - - - 1 - 0 - 0 - wxID_ANY - - - - 0 - 0 - - 0 - - - 0 - - 1 - m_viaSizesGrid - 1 - - - protected - 1 - - Resizable - wxALIGN_CENTRE - 0 - "Via 1" "Via 2" "Via 3" "Via 4" "Via 5" "Via 6" "Via 7" "Via 8" "Via 9" "Via 10" "Via 11" "Via 12" - wxALIGN_CENTRE - - 8 - 1 - - WX_GRID; widgets/wx_grid.h; forward_declare - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxLEFT - 0 - - - bSizer12 - wxVERTICAL - none - - 5 - wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Differential Pairs: - - 0 - - - 0 - - 1 - m_staticText26 - 1 - - - protected - 1 - - Resizable - 1 - - - ; forward_declare - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT - 1 - - 1 - 1 - 1 - 1 - - - - - 0 - 0 - - - - 1 - wxSYS_COLOUR_INFOBK - - wxALIGN_LEFT - - wxALIGN_TOP - 0 - 1 - wxALIGN_CENTRE - 22 - "Width" "Gap" "Via Gap" - wxALIGN_CENTRE - 3 - 78,78,78 + 1 0 @@ -1337,9 +1515,9 @@ 0 - + -1,-1 1 - m_diffPairsGrid + m_membershipGrid 1 @@ -1352,7 +1530,7 @@ wxALIGN_CENTRE - 8 + 0 1 WX_GRID; widgets/wx_grid.h; forward_declare @@ -1414,8 +1592,8 @@ - - + OnSizeMembershipGrid + OnUpdateUI diff --git a/pcbnew/dialogs/panel_setup_netclasses_base.h b/pcbnew/dialogs/panel_setup_netclasses_base.h index 45bed473d3..250b3e1b6e 100644 --- a/pcbnew/dialogs/panel_setup_netclasses_base.h +++ b/pcbnew/dialogs/panel_setup_netclasses_base.h @@ -26,8 +26,9 @@ class WX_GRID; #include #include #include -#include #include +#include +#include #include /////////////////////////////////////////////////////////////////////////// @@ -43,20 +44,26 @@ class PANEL_SETUP_NETCLASSES_BASE : public wxPanel WX_GRID* m_netclassGrid; wxBitmapButton* m_addButton; wxBitmapButton* m_removeButton; - wxTextCtrl* m_textNetFilter; + wxStaticText* m_staticText6; + wxChoice* m_netClassFilter; + wxStaticText* m_filterLabel; + wxTextCtrl* m_netNameFilter; + wxButton* m_showAllButton; + wxButton* m_filterNetsButton; + wxStaticText* m_assignLabel; + wxChoice* m_assignNetClass; + wxButton* m_assignAllButton; + wxButton* m_assignSelectedButton; WX_GRID* m_membershipGrid; - wxStaticText* m_staticText24; - WX_GRID* m_trackWidthsGrid; - wxStaticText* m_staticText25; - WX_GRID* m_viaSizesGrid; - wxStaticText* m_staticText26; - WX_GRID* m_diffPairsGrid; // Virtual event handlers, overide them in your derived class virtual void OnSizeNetclassGrid( wxSizeEvent& event ) { event.Skip(); } virtual void OnAddNetclassClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnRemoveNetclassClick( wxCommandEvent& event ) { event.Skip(); } - virtual void OnFilterChanged( wxCommandEvent& event ) { event.Skip(); } + virtual void OnShowAll( wxCommandEvent& event ) { event.Skip(); } + virtual void OnApplyFilters( wxCommandEvent& event ) { event.Skip(); } + virtual void OnAssignAll( wxCommandEvent& event ) { event.Skip(); } + virtual void OnAssignSelected( wxCommandEvent& event ) { event.Skip(); } virtual void OnSizeMembershipGrid( wxSizeEvent& event ) { event.Skip(); } virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); } diff --git a/pcbnew/dialogs/panel_setup_tracks_and_vias.cpp b/pcbnew/dialogs/panel_setup_tracks_and_vias.cpp new file mode 100644 index 0000000000..3897fed91c --- /dev/null +++ b/pcbnew/dialogs/panel_setup_tracks_and_vias.cpp @@ -0,0 +1,258 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2018 KiCad Developers, see change_log.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + + +#include +#include +#include +#include +#include +#include + +#include + + +PANEL_SETUP_TRACKS_AND_VIAS::PANEL_SETUP_TRACKS_AND_VIAS( + PAGED_DIALOG* aParent, PCB_EDIT_FRAME* aFrame, + PANEL_SETUP_FEATURE_CONSTRAINTS* aConstraintsPanel ) : + PANEL_SETUP_TRACKS_AND_VIAS_BASE( aParent->GetTreebook() ) +{ + m_Parent = aParent; + m_Frame = aFrame; + m_Pcb = m_Frame->GetBoard(); + m_BrdSettings = &m_Pcb->GetDesignSettings(); + m_ConstraintsPanel = aConstraintsPanel; + + // Membership combobox editors require a bit more room, so increase the row size of + // all our grids for consistency + m_trackWidthsGrid->SetDefaultRowSize( m_trackWidthsGrid->GetDefaultRowSize() + 4 ); + m_viaSizesGrid->SetDefaultRowSize( m_viaSizesGrid->GetDefaultRowSize() + 4 ); + m_diffPairsGrid->SetDefaultRowSize( m_diffPairsGrid->GetDefaultRowSize() + 4 ); +} + + +bool PANEL_SETUP_TRACKS_AND_VIAS::TransferDataToWindow() +{ +#define SETCELL( grid, row, col, val ) \ + grid->SetCellValue( row, col, StringFromValue( m_Frame->GetUserUnits(), val, true, true ) ) + + m_trackWidthsGrid->ClearGrid(); + m_viaSizesGrid->ClearGrid(); + m_diffPairsGrid->ClearGrid(); + + // Skip the first item, which is the current netclass value + for( unsigned ii = 1; ii < m_BrdSettings->m_TrackWidthList.size(); ii++ ) + { + SETCELL( m_trackWidthsGrid, ii-1, 0, m_BrdSettings->m_TrackWidthList[ii] ); + } + + // Skip the first item, which is the current netclass value + for( unsigned ii = 1; ii < m_BrdSettings->m_ViasDimensionsList.size(); ii++ ) + { + SETCELL( m_viaSizesGrid, ii-1, 0, m_BrdSettings->m_ViasDimensionsList[ii].m_Diameter ); + + if( m_BrdSettings->m_ViasDimensionsList[ii].m_Drill > 0 ) + SETCELL( m_viaSizesGrid, ii-1, 1, m_BrdSettings->m_ViasDimensionsList[ii].m_Drill ); + } + + // Skip the first item, which is the current netclass value + for( unsigned ii = 1; ii < m_BrdSettings->m_DiffPairDimensionsList.size(); ii++ ) + { + SETCELL( m_diffPairsGrid, ii-1, 0, m_BrdSettings->m_DiffPairDimensionsList[ii].m_Width ); + + if( m_BrdSettings->m_DiffPairDimensionsList[ii].m_Gap > 0 ) + SETCELL( m_diffPairsGrid, ii-1, 1, m_BrdSettings->m_DiffPairDimensionsList[ii].m_Gap ); + + if( m_BrdSettings->m_DiffPairDimensionsList[ii].m_ViaGap > 0 ) + SETCELL( m_diffPairsGrid, ii-1, 2, m_BrdSettings->m_DiffPairDimensionsList[ii].m_ViaGap ); + } + + return true; +} + + +bool PANEL_SETUP_TRACKS_AND_VIAS::TransferDataFromWindow() +{ + if( !validateData() ) + return false; + + wxString msg; + std::vector trackWidths; + std::vector vias; + std::vector diffPairs; + + for( int row = 0; row < m_trackWidthsGrid->GetNumberRows(); ++row ) + { + msg = m_trackWidthsGrid->GetCellValue( row, 0 ); + + if( !msg.IsEmpty() ) + trackWidths.push_back( ValueFromString( m_Frame->GetUserUnits(), msg, true ) ); + } + + for( int row = 0; row < m_viaSizesGrid->GetNumberRows(); ++row ) + { + msg = m_viaSizesGrid->GetCellValue( row, 0 ); + + if( !msg.IsEmpty() ) + { + VIA_DIMENSION via_dim; + via_dim.m_Diameter = ValueFromString( m_Frame->GetUserUnits(), msg, true ); + + msg = m_viaSizesGrid->GetCellValue( row, 1 ); + + if( !msg.IsEmpty() ) + via_dim.m_Drill = ValueFromString( m_Frame->GetUserUnits(), msg, true ); + + vias.push_back( via_dim ); + } + } + + for( int row = 0; row < m_viaSizesGrid->GetNumberRows(); ++row ) + { + msg = m_diffPairsGrid->GetCellValue( row, 0 ); + + if( !msg.IsEmpty() ) + { + DIFF_PAIR_DIMENSION diffPair_dim; + diffPair_dim.m_Width = ValueFromString( m_Frame->GetUserUnits(), msg, true ); + + msg = m_diffPairsGrid->GetCellValue( row, 1 ); + diffPair_dim.m_Gap = ValueFromString( m_Frame->GetUserUnits(), msg, true ); + + msg = m_diffPairsGrid->GetCellValue( row, 2 ); + + if( !msg.IsEmpty() ) + diffPair_dim.m_ViaGap = ValueFromString( m_Frame->GetUserUnits(), msg, true ); + + diffPairs.push_back( diffPair_dim ); + } + } + + // Sort lists by increasing value + sort( trackWidths.begin(), trackWidths.end() ); + sort( vias.begin(), vias.end() ); + sort( diffPairs.begin(), diffPairs.end() ); + + trackWidths.insert( trackWidths.begin(), m_BrdSettings->m_TrackWidthList[ 0 ] ); + m_BrdSettings->m_TrackWidthList = trackWidths; + + vias.insert( vias.begin(), m_BrdSettings->m_ViasDimensionsList[ 0 ] ); + m_BrdSettings->m_ViasDimensionsList = vias; + + diffPairs.insert( diffPairs.begin(), m_BrdSettings->m_DiffPairDimensionsList[ 0 ] ); + m_BrdSettings->m_DiffPairDimensionsList = diffPairs; + + return true; +} + + +bool PANEL_SETUP_TRACKS_AND_VIAS::validateData() +{ + // Commit any pending in-place edits and close editors from grid controls + m_trackWidthsGrid->DisableCellEditControl(); + m_viaSizesGrid->DisableCellEditControl(); + m_diffPairsGrid->DisableCellEditControl(); + + wxString msg; + int minViaDia = m_ConstraintsPanel->m_viaMinSize.GetValue(); + int minViaDrill = m_ConstraintsPanel->m_viaMinDrill.GetValue(); + int minTrackWidth = m_ConstraintsPanel->m_trackMinWidth.GetValue(); + + // Test tracks + for( int row = 0; row < m_trackWidthsGrid->GetNumberRows(); ++row ) + { + wxString tvalue = m_trackWidthsGrid->GetCellValue( row, 0 ); + + if( tvalue.IsEmpty() ) + continue; + + if( ValueFromString( m_Frame->GetUserUnits(), tvalue ) < minTrackWidth ) + { + msg.Printf( _( "Track width less than minimum track width (%s)." ), + StringFromValue( m_Frame->GetUserUnits(), minTrackWidth, true, true ) ); + m_Parent->SetError( msg, this, m_trackWidthsGrid, row, 0 ); + return false; + } + } + + // Test vias + for( int row = 0; row < m_viaSizesGrid->GetNumberRows(); ++row ) + { + wxString viaDia = m_viaSizesGrid->GetCellValue( row, 0 ); + + if( viaDia.IsEmpty() ) + continue; + + if( ValueFromString( m_Frame->GetUserUnits(), viaDia ) < minViaDia ) + { + msg.Printf( _( "Via diameter less than minimum via diameter (%s)." ), + StringFromValue( m_Frame->GetUserUnits(), minViaDia, true, true ) ); + m_Parent->SetError( msg, this, m_viaSizesGrid, row, 0 ); + return false; + } + + wxString viaDrill = m_viaSizesGrid->GetCellValue( row, 1 ); + + if( viaDrill.IsEmpty() ) + { + msg = _( "No via drill defined." ); + m_Parent->SetError( msg, this, m_viaSizesGrid, row, 1 ); + return false; + } + + if( ValueFromString( m_Frame->GetUserUnits(), viaDrill ) < minViaDrill ) + { + msg.Printf( _( "Via drill less than minimum via drill (%s)." ), + StringFromValue( m_Frame->GetUserUnits(), minViaDrill, true, true ) ); + m_Parent->SetError( msg, this, m_viaSizesGrid, row, 1 ); + return false; + } + + if( ValueFromString( m_Frame->GetUserUnits(), viaDrill ) + >= ValueFromString( m_Frame->GetUserUnits(), viaDia ) ) + { + msg = _( "Via drill larger than via diameter." ); + m_Parent->SetError( msg, this, m_viaSizesGrid, row, 1 ); + return false; + } + } + + return true; +} + + +void PANEL_SETUP_TRACKS_AND_VIAS::ImportSettingsFrom( BOARD* aBoard ) +{ + // Note: do not change the board, as we need to get the current nets from it for + // netclass memberships. All the netclass definitions and dimension lists are in + // the BOARD_DESIGN_SETTINGS. + + BOARD_DESIGN_SETTINGS* savedSettings = m_BrdSettings; + + m_BrdSettings = &aBoard->GetDesignSettings(); + TransferDataToWindow(); + + m_BrdSettings = savedSettings; +} + + diff --git a/pcbnew/dialogs/panel_setup_tracks_and_vias.fbp b/pcbnew/dialogs/panel_setup_tracks_and_vias.fbp new file mode 100644 index 0000000000..3f9f8dc8ac --- /dev/null +++ b/pcbnew/dialogs/panel_setup_tracks_and_vias.fbp @@ -0,0 +1,657 @@ + + + + + + C++ + 1 + source_name + 0 + 0 + res + UTF-8 + connect + panel_setup_tracks_and_vias_base + 1000 + none + 1 + panel_setup_tracks_and_vias_base + + . + + 1 + 1 + 1 + 1 + UI + 1 + 0 + + 0 + wxAUI_MGR_DEFAULT + + + 1 + 1 + impl_virtual + + + 0 + wxID_ANY + + + PANEL_SETUP_TRACKS_AND_VIAS_BASE + + -1,-1 + ; forward_declare + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bMainSizer + wxVERTICAL + none + + 5 + wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Pre-defined track and via dimensions: + + 0 + + + 0 + + 1 + m_label + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 20 + wxEXPAND|wxLEFT + 5 + + + bSizerLower + wxHORIZONTAL + none + + 5 + wxRIGHT|wxLEFT|wxEXPAND + 0 + + wxID_ANY + Tracks + + sbSizer4 + wxVERTICAL + 1 + none + + + 5 + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + 1 + + 1 + 1 + 1 + 1 + + + + + 0 + 0 + + + + 1 + + + wxALIGN_LEFT + + wxALIGN_TOP + 0 + 1 + wxALIGN_CENTRE + 22 + "Width" + wxALIGN_CENTRE + 1 + 100 + + 1 + 0 + Dock + 0 + Left + 0 + 0 + 0 + 0 + 1 + 1 + + 1 + + + 1 + 0 + 0 + wxID_ANY + + + + 0 + 0 + + 0 + + + 0 + + 1 + m_trackWidthsGrid + 1 + + + protected + 1 + + Resizable + wxALIGN_CENTRE + 30 + "1" "2" "3" "4" "5" "6" "7" "8" + wxALIGN_CENTRE + + 8 + 1 + + WX_GRID; widgets/wx_grid.h; forward_declare + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxRIGHT|wxLEFT + 0 + + wxID_ANY + Vias + + sbSizer5 + wxVERTICAL + 1 + none + + + 5 + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + 1 + + 1 + 1 + 1 + 1 + + + + + 0 + 0 + + + + 1 + + + wxALIGN_LEFT + + wxALIGN_TOP + 0 + 1 + wxALIGN_CENTRE + 22 + "Size" "Drill" + wxALIGN_CENTRE + 2 + 100,100 + + 1 + 0 + Dock + 0 + Left + 0 + 0 + 0 + 0 + 1 + 1 + + 1 + + + 1 + 0 + 0 + wxID_ANY + + + + 0 + 0 + + 0 + + + 0 + + 1 + m_viaSizesGrid + 1 + + + protected + 1 + + Resizable + wxALIGN_CENTRE + 30 + "1" "2" "3" "4" "5" "6" "7" "8" + wxALIGN_CENTRE + + 8 + 1 + + WX_GRID; widgets/wx_grid.h; forward_declare + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxRIGHT|wxLEFT|wxEXPAND + 0 + + wxID_ANY + Differential Pairs + + sbSizer6 + wxVERTICAL + 1 + none + + + 5 + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + 1 + + 1 + 1 + 1 + 1 + + + + + 0 + 0 + + + + 1 + wxSYS_COLOUR_WINDOW + + wxALIGN_LEFT + + wxALIGN_TOP + 0 + 1 + wxALIGN_CENTRE + 22 + "Width" "Gap" "Via Gap" + wxALIGN_CENTRE + 3 + 100,100,100 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + 0 + 1 + 1 + 1 + + 1 + + + 1 + 0 + 0 + wxID_ANY + + + + 0 + 0 + + 0 + + + 0 + + 1 + m_diffPairsGrid + 1 + + + protected + 1 + + Resizable + wxALIGN_CENTRE + 30 + "1" "2" "3" "4" "5" "6" "7" "8" + wxALIGN_CENTRE + + 8 + 1 + + WX_GRID; widgets/wx_grid.h; forward_declare + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pcbnew/dialogs/panel_setup_tracks_and_vias.h b/pcbnew/dialogs/panel_setup_tracks_and_vias.h new file mode 100644 index 0000000000..1a53e726b7 --- /dev/null +++ b/pcbnew/dialogs/panel_setup_tracks_and_vias.h @@ -0,0 +1,63 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2018 KiCad Developers, see change_log.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + + +#ifndef PANEL_SETUP_TRACKS_AND_VIAS_H +#define PANEL_SETUP_TRACKS_AND_VIAS_H + +#include +#include +#include + +#include +#include "panel_setup_feature_constraints.h" + +class PCB_EDIT_FRAME; +class BOARD_DESIGN_SETTINGS; + + +class PANEL_SETUP_TRACKS_AND_VIAS : public PANEL_SETUP_TRACKS_AND_VIAS_BASE +{ +private: + PAGED_DIALOG* m_Parent; + PCB_EDIT_FRAME* m_Frame; + BOARD* m_Pcb; + BOARD_DESIGN_SETTINGS* m_BrdSettings; + + // We must validate against the current m_BrdSettings as they may have been + // changed but not yet committed. Fetch them from the constraints panel. + PANEL_SETUP_FEATURE_CONSTRAINTS* m_ConstraintsPanel; + + bool validateData(); + +public: + PANEL_SETUP_TRACKS_AND_VIAS( PAGED_DIALOG* aParent, PCB_EDIT_FRAME* aFrame, + PANEL_SETUP_FEATURE_CONSTRAINTS* aConstraintsPanel ); + + bool TransferDataToWindow() override; + bool TransferDataFromWindow() override; + + void ImportSettingsFrom( BOARD* aBoard ); +}; + +#endif //PANEL_SETUP_TRACKS_AND_VIAS_H diff --git a/pcbnew/dialogs/panel_setup_tracks_and_vias_base.cpp b/pcbnew/dialogs/panel_setup_tracks_and_vias_base.cpp new file mode 100644 index 0000000000..a09ac0ddfc --- /dev/null +++ b/pcbnew/dialogs/panel_setup_tracks_and_vias_base.cpp @@ -0,0 +1,170 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Dec 30 2017) +// http://www.wxformbuilder.org/ +// +// PLEASE DO *NOT* EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "widgets/wx_grid.h" + +#include "panel_setup_tracks_and_vias_base.h" + +/////////////////////////////////////////////////////////////////////////// + +PANEL_SETUP_TRACKS_AND_VIAS_BASE::PANEL_SETUP_TRACKS_AND_VIAS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style ) +{ + wxBoxSizer* bMainSizer; + bMainSizer = new wxBoxSizer( wxVERTICAL ); + + m_label = new wxStaticText( this, wxID_ANY, _("Pre-defined track and via dimensions:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_label->Wrap( -1 ); + bMainSizer->Add( m_label, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + wxBoxSizer* bSizerLower; + bSizerLower = new wxBoxSizer( wxHORIZONTAL ); + + wxStaticBoxSizer* sbSizer4; + sbSizer4 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Tracks") ), wxVERTICAL ); + + m_trackWidthsGrid = new WX_GRID( sbSizer4->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); + + // Grid + m_trackWidthsGrid->CreateGrid( 8, 1 ); + m_trackWidthsGrid->EnableEditing( true ); + m_trackWidthsGrid->EnableGridLines( true ); + m_trackWidthsGrid->EnableDragGridSize( false ); + m_trackWidthsGrid->SetMargins( 0, 0 ); + + // Columns + m_trackWidthsGrid->SetColSize( 0, 100 ); + m_trackWidthsGrid->EnableDragColMove( false ); + m_trackWidthsGrid->EnableDragColSize( false ); + m_trackWidthsGrid->SetColLabelSize( 22 ); + m_trackWidthsGrid->SetColLabelValue( 0, _("Width") ); + m_trackWidthsGrid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); + + // Rows + m_trackWidthsGrid->EnableDragRowSize( false ); + m_trackWidthsGrid->SetRowLabelSize( 30 ); + m_trackWidthsGrid->SetRowLabelValue( 0, _("1") ); + m_trackWidthsGrid->SetRowLabelValue( 1, _("2") ); + m_trackWidthsGrid->SetRowLabelValue( 2, _("3") ); + m_trackWidthsGrid->SetRowLabelValue( 3, _("4") ); + m_trackWidthsGrid->SetRowLabelValue( 4, _("5") ); + m_trackWidthsGrid->SetRowLabelValue( 5, _("6") ); + m_trackWidthsGrid->SetRowLabelValue( 6, _("7") ); + m_trackWidthsGrid->SetRowLabelValue( 7, _("8") ); + m_trackWidthsGrid->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); + + // Label Appearance + + // Cell Defaults + m_trackWidthsGrid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP ); + sbSizer4->Add( m_trackWidthsGrid, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + + bSizerLower->Add( sbSizer4, 0, wxRIGHT|wxLEFT|wxEXPAND, 5 ); + + wxStaticBoxSizer* sbSizer5; + sbSizer5 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Vias") ), wxVERTICAL ); + + m_viaSizesGrid = new WX_GRID( sbSizer5->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); + + // Grid + m_viaSizesGrid->CreateGrid( 8, 2 ); + m_viaSizesGrid->EnableEditing( true ); + m_viaSizesGrid->EnableGridLines( true ); + m_viaSizesGrid->EnableDragGridSize( false ); + m_viaSizesGrid->SetMargins( 0, 0 ); + + // Columns + m_viaSizesGrid->SetColSize( 0, 100 ); + m_viaSizesGrid->SetColSize( 1, 100 ); + m_viaSizesGrid->EnableDragColMove( false ); + m_viaSizesGrid->EnableDragColSize( false ); + m_viaSizesGrid->SetColLabelSize( 22 ); + m_viaSizesGrid->SetColLabelValue( 0, _("Size") ); + m_viaSizesGrid->SetColLabelValue( 1, _("Drill") ); + m_viaSizesGrid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); + + // Rows + m_viaSizesGrid->EnableDragRowSize( false ); + m_viaSizesGrid->SetRowLabelSize( 30 ); + m_viaSizesGrid->SetRowLabelValue( 0, _("1") ); + m_viaSizesGrid->SetRowLabelValue( 1, _("2") ); + m_viaSizesGrid->SetRowLabelValue( 2, _("3") ); + m_viaSizesGrid->SetRowLabelValue( 3, _("4") ); + m_viaSizesGrid->SetRowLabelValue( 4, _("5") ); + m_viaSizesGrid->SetRowLabelValue( 5, _("6") ); + m_viaSizesGrid->SetRowLabelValue( 6, _("7") ); + m_viaSizesGrid->SetRowLabelValue( 7, _("8") ); + m_viaSizesGrid->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); + + // Label Appearance + + // Cell Defaults + m_viaSizesGrid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP ); + sbSizer5->Add( m_viaSizesGrid, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + + bSizerLower->Add( sbSizer5, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + + wxStaticBoxSizer* sbSizer6; + sbSizer6 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Differential Pairs") ), wxVERTICAL ); + + m_diffPairsGrid = new WX_GRID( sbSizer6->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); + + // Grid + m_diffPairsGrid->CreateGrid( 8, 3 ); + m_diffPairsGrid->EnableEditing( true ); + m_diffPairsGrid->EnableGridLines( true ); + m_diffPairsGrid->EnableDragGridSize( false ); + m_diffPairsGrid->SetMargins( 0, 0 ); + + // Columns + m_diffPairsGrid->SetColSize( 0, 100 ); + m_diffPairsGrid->SetColSize( 1, 100 ); + m_diffPairsGrid->SetColSize( 2, 100 ); + m_diffPairsGrid->EnableDragColMove( false ); + m_diffPairsGrid->EnableDragColSize( true ); + m_diffPairsGrid->SetColLabelSize( 22 ); + m_diffPairsGrid->SetColLabelValue( 0, _("Width") ); + m_diffPairsGrid->SetColLabelValue( 1, _("Gap") ); + m_diffPairsGrid->SetColLabelValue( 2, _("Via Gap") ); + m_diffPairsGrid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); + + // Rows + m_diffPairsGrid->EnableDragRowSize( true ); + m_diffPairsGrid->SetRowLabelSize( 30 ); + m_diffPairsGrid->SetRowLabelValue( 0, _("1") ); + m_diffPairsGrid->SetRowLabelValue( 1, _("2") ); + m_diffPairsGrid->SetRowLabelValue( 2, _("3") ); + m_diffPairsGrid->SetRowLabelValue( 3, _("4") ); + m_diffPairsGrid->SetRowLabelValue( 4, _("5") ); + m_diffPairsGrid->SetRowLabelValue( 5, _("6") ); + m_diffPairsGrid->SetRowLabelValue( 6, _("7") ); + m_diffPairsGrid->SetRowLabelValue( 7, _("8") ); + m_diffPairsGrid->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); + + // Label Appearance + + // Cell Defaults + m_diffPairsGrid->SetDefaultCellBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); + m_diffPairsGrid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP ); + sbSizer6->Add( m_diffPairsGrid, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + + bSizerLower->Add( sbSizer6, 0, wxRIGHT|wxLEFT|wxEXPAND, 5 ); + + + bMainSizer->Add( bSizerLower, 5, wxEXPAND|wxLEFT, 20 ); + + + this->SetSizer( bMainSizer ); + this->Layout(); + bMainSizer->Fit( this ); +} + +PANEL_SETUP_TRACKS_AND_VIAS_BASE::~PANEL_SETUP_TRACKS_AND_VIAS_BASE() +{ +} diff --git a/pcbnew/dialogs/panel_setup_tracks_and_vias_base.h b/pcbnew/dialogs/panel_setup_tracks_and_vias_base.h new file mode 100644 index 0000000000..0af7d2291c --- /dev/null +++ b/pcbnew/dialogs/panel_setup_tracks_and_vias_base.h @@ -0,0 +1,49 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Dec 30 2017) +// http://www.wxformbuilder.org/ +// +// PLEASE DO *NOT* EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#ifndef __PANEL_SETUP_TRACKS_AND_VIAS_BASE_H__ +#define __PANEL_SETUP_TRACKS_AND_VIAS_BASE_H__ + +#include +#include +#include +class WX_GRID; + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////////////////// +/// Class PANEL_SETUP_TRACKS_AND_VIAS_BASE +/////////////////////////////////////////////////////////////////////////////// +class PANEL_SETUP_TRACKS_AND_VIAS_BASE : public wxPanel +{ + private: + + protected: + wxStaticText* m_label; + WX_GRID* m_trackWidthsGrid; + WX_GRID* m_viaSizesGrid; + WX_GRID* m_diffPairsGrid; + + public: + + PANEL_SETUP_TRACKS_AND_VIAS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL ); + ~PANEL_SETUP_TRACKS_AND_VIAS_BASE(); + +}; + +#endif //__PANEL_SETUP_TRACKS_AND_VIAS_BASE_H__