Loading common/dialog_about/AboutDialog_main.cpp +7 −4 Original line number Original line Diff line number Diff line Loading @@ -113,8 +113,10 @@ static void InitKiCadAboutNew( AboutAppInfo& info ) description << wxT( "<p>" ); description << wxT( "<p>" ); description << wxT( "<b><u>" ) << _( "Description" ) << wxT( "</u></b>" ); // bold & underlined font for caption description << wxT( "<b><u>" ) << _( "Description" ) << wxT( "</u></b>" ); // bold & underlined font for caption description << wxT( description << wxT( "<p>" ) << "<p>The KiCad EDA Suite is a set of open source applications for the creation of electronic schematics and to design printed circuit boards.</p>" ); _( "The KiCad EDA Suite is a set of open source applications for the creation of electronic schematics and to design printed circuit boards." ) << wxT( "</p>" ); description << wxT( "</p>" ); description << wxT( "</p>" ); Loading Loading @@ -170,7 +172,7 @@ static void InitKiCadAboutNew( AboutAppInfo& info ) << HtmlNewline( 4 ) << HtmlNewline( 4 ) << _( "The complete KiCad EDA Suite is released under the" ) << HtmlNewline( 2 ) << _( "The complete KiCad EDA Suite is released under the" ) << HtmlNewline( 2 ) << HtmlHyperlink( wxT( "http://www.gnu.org/licenses" ), << HtmlHyperlink( wxT( "http://www.gnu.org/licenses" ), _( "GNU General Public License version 2" ) ) _( "GNU General Public License (GPL) version 2" ) ) << wxT( "</div>" ); << wxT( "</div>" ); info.SetLicense( license ); info.SetLicense( license ); Loading Loading @@ -201,7 +203,8 @@ static void InitKiCadAboutNew( AboutAppInfo& info ) info.AddDeveloper( new Contributor( wxT( "Lorenzo Marcantonio" ), wxT( "lomarcan@tin.it" ) ) ); info.AddDeveloper( new Contributor( wxT( "Lorenzo Marcantonio" ), wxT( "lomarcan@tin.it" ) ) ); info.AddDeveloper( new Contributor( wxT( "Marco Serantoni" ), wxT( "marco.serantoni@gmail.com" ) ) ); info.AddDeveloper( new Contributor( wxT( "Marco Serantoni" ), wxT( "marco.serantoni@gmail.com" ) ) ); info.AddDeveloper( new Contributor( wxT( "Marco Mattila" ), wxT( "marcom99@gmail.com" ) ) ); info.AddDeveloper( new Contributor( wxT( "Marco Mattila" ), wxT( "marcom99@gmail.com" ) ) ); info.AddDeveloper( new Contributor( wxT( "Rafael Sokolowski" ), wxT( "rafael.sokolowski@web.de" ) ) ); info.AddDeveloper( new Contributor( wxT( "Rafael Sokolowski" ), wxT( "rafael.sokolowski@web.de" ) ) ); info.AddDeveloper( new Contributor( wxT( "Rok Markovic" ), wxT( "rok@kanardia.eu" ) ) ); info.AddDeveloper( new Contributor( wxT( "Rok Markovic" ), wxT( "rok@kanardia.eu" ) ) ); info.AddDeveloper( new Contributor( wxT( "Tim Hanson" ), wxT( "sideskate@gmail.com" ) ) ); info.AddDeveloper( new Contributor( wxT( "Tim Hanson" ), wxT( "sideskate@gmail.com" ) ) ); info.AddDeveloper( new Contributor( wxT( "Vesa Solonen" ), wxT( "vesa.solonen@hut.fi" ) ) ); info.AddDeveloper( new Contributor( wxT( "Vesa Solonen" ), wxT( "vesa.solonen@hut.fi" ) ) ); Loading pcbnew/dialog_design_rules.cpp +217 −152 Original line number Original line Diff line number Diff line ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// // Name: dialog_design_rules.cpp // Name: dialog_design_rules.cpp ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// Loading Loading @@ -42,7 +43,7 @@ #include "pcbnew_id.h" #include "pcbnew_id.h" #include "dialog_design_rules.h" #include "dialog_design_rules.h" #include "wx/generic/gridctrl.h" #include "wx/generic/gridctrl.h" #include "dialog_design_rules_aux_helper_class.h" // Field Positions on rules grid // Field Positions on rules grid enum { enum { Loading @@ -63,6 +64,53 @@ int DIALOG_DESIGN_RULES::s_LastTabSelection = -1; wxPoint DIALOG_DESIGN_RULES:: s_LastPos( -1, -1 ); wxPoint DIALOG_DESIGN_RULES:: s_LastPos( -1, -1 ); wxSize DIALOG_DESIGN_RULES:: s_LastSize; wxSize DIALOG_DESIGN_RULES:: s_LastSize; // methods for the helper class NETS_LIST_CTRL /** OnGetItemText (overlaid method) * needed by wxListCtrl with wxLC_VIRTUAL options */ wxString NETS_LIST_CTRL::OnGetItemText( long item, long column ) const { if( column == 0 ) { if( item < (long) m_Netnames.GetCount() ) return m_Netnames[item]; else return wxEmptyString; } else if( item < (long) m_Classnames.GetCount() ) return m_Classnames[item]; return wxEmptyString; } /** Function setRowItems * Initialize the net name and the net class name at row aRow * @param aRow = row index (if aRow > number of stored row, empty rows will be created) * @param aNetname = the string to display in row aRow, column 0 * @param aNetclassName = the string to display in row aRow, column 1 */ void NETS_LIST_CTRL::setRowItems( unsigned aRow, const wxString& aNetname, const wxString& aNetclassName ) { // insert blanks if aRow is larger than existing row count unsigned cnt = m_Netnames.GetCount(); if( cnt <= aRow ) m_Netnames.Add( wxEmptyString, aRow - cnt + 1 ); cnt = m_Classnames.GetCount(); if( cnt <= aRow ) m_Classnames.Add( wxEmptyString, aRow - cnt + 1 ); if( (int)aRow <= GetItemCount() ) SetItemCount( aRow + 1 ); m_Netnames[aRow] = aNetname; m_Classnames[aRow] = aNetclassName; } /** /** Loading @@ -71,6 +119,7 @@ wxSize DIALOG_DESIGN_RULES::s_LastSize; * column titles and not on the grid cell requirements, assuming that the grid * column titles and not on the grid cell requirements, assuming that the grid * cell width requirements are narrower than the column title requirements. * cell width requirements are narrower than the column title requirements. */ */ // @todo: maybe move this to common.cpp if it works. // @todo: maybe move this to common.cpp if it works. void EnsureGridColumnWidths( wxGrid* aGrid ) void EnsureGridColumnWidths( wxGrid* aGrid ) { { Loading Loading @@ -156,7 +205,10 @@ void DIALOG_DESIGN_RULES::PrintCurrentSettings( ) m_MessagesList->AppendToPage( _( "<b>Current general settings:</b><br>" ) ); m_MessagesList->AppendToPage( _( "<b>Current general settings:</b><br>" ) ); // Display min values: // Display min values: value = ReturnStringFromValue( g_UserUnit, m_BrdSettings->m_TrackMinWidth, internal_units, true ); value = ReturnStringFromValue( g_UserUnit, m_BrdSettings->m_TrackMinWidth, internal_units, true ); msg.Printf( _( "Minimum value for tracks width: <b>%s</b><br>\n" ), GetChars( value ) ); msg.Printf( _( "Minimum value for tracks width: <b>%s</b><br>\n" ), GetChars( value ) ); m_MessagesList->AppendToPage( msg ); m_MessagesList->AppendToPage( msg ); Loading @@ -164,10 +216,12 @@ void DIALOG_DESIGN_RULES::PrintCurrentSettings( ) msg.Printf( _( "Minimum value for vias diameter: <b>%s</b><br>\n" ), GetChars( value ) ); msg.Printf( _( "Minimum value for vias diameter: <b>%s</b><br>\n" ), GetChars( value ) ); m_MessagesList->AppendToPage( msg ); m_MessagesList->AppendToPage( msg ); value = ReturnStringFromValue( g_UserUnit, m_BrdSettings->m_MicroViasMinSize, internal_units, true ); value = ReturnStringFromValue( g_UserUnit, m_BrdSettings->m_MicroViasMinSize, internal_units, true ); msg.Printf( _( "Minimum value for microvias diameter: <b>%s</b><br>\n" ), GetChars( value ) ); msg.Printf( _( "Minimum value for microvias diameter: <b>%s</b><br>\n" ), GetChars( value ) ); m_MessagesList->AppendToPage( msg ); m_MessagesList->AppendToPage( msg ); } } Loading Loading @@ -218,6 +272,7 @@ void DIALOG_DESIGN_RULES::InitDialogRules() PrintCurrentSettings(); PrintCurrentSettings(); } } /*******************************************/ /*******************************************/ void DIALOG_DESIGN_RULES::InitGlobalRules() void DIALOG_DESIGN_RULES::InitGlobalRules() /*******************************************/ /*******************************************/ Loading @@ -236,8 +291,12 @@ void DIALOG_DESIGN_RULES::InitGlobalRules() m_OptViaType->SetSelection( 1 ); m_OptViaType->SetSelection( 1 ); m_AllowMicroViaCtrl->SetSelection( m_BrdSettings->m_MicroViasAllowed ? 1 : 0 ); m_AllowMicroViaCtrl->SetSelection( m_BrdSettings->m_MicroViasAllowed ? 1 : 0 ); PutValueInLocalUnits( *m_SetMicroViasMinSizeCtrl, m_BrdSettings->m_MicroViasMinSize, Internal_Unit ); PutValueInLocalUnits( *m_SetMicroViasMinSizeCtrl, PutValueInLocalUnits( *m_SetMicroViasMinDrillCtrl, m_BrdSettings->m_MicroViasMinDrill, Internal_Unit ); m_BrdSettings->m_MicroViasMinSize, Internal_Unit ); PutValueInLocalUnits( *m_SetMicroViasMinDrillCtrl, m_BrdSettings->m_MicroViasMinDrill, Internal_Unit ); PutValueInLocalUnits( *m_SetTrackMinWidthCtrl, m_BrdSettings->m_TrackMinWidth, Internal_Unit ); PutValueInLocalUnits( *m_SetTrackMinWidthCtrl, m_BrdSettings->m_TrackMinWidth, Internal_Unit ); Loading @@ -249,9 +308,9 @@ void DIALOG_DESIGN_RULES::InitGlobalRules() m_ViasDimensionsList = m_Parent->GetBoard()->m_ViasDimensionsList; m_ViasDimensionsList = m_Parent->GetBoard()->m_ViasDimensionsList; m_ViasDimensionsList.erase( m_ViasDimensionsList.begin() ); // remove the netclass value m_ViasDimensionsList.erase( m_ViasDimensionsList.begin() ); // remove the netclass value InitDimensionsLists(); InitDimensionsLists(); } } /***************************************************/ /***************************************************/ void DIALOG_DESIGN_RULES::InitDimensionsLists() void DIALOG_DESIGN_RULES::InitDimensionsLists() /***************************************************/ /***************************************************/ Loading Loading @@ -286,6 +345,7 @@ void DIALOG_DESIGN_RULES::InitDimensionsLists() m_gridTrackWidthList->SetColumnWidth( 0, wxLIST_AUTOSIZE ); m_gridTrackWidthList->SetColumnWidth( 0, wxLIST_AUTOSIZE ); } } // Sort comparison function (helper for makePointers() ) // Sort comparison function (helper for makePointers() ) static bool sortByClassThenName( NETCUP* a, NETCUP* b ) static bool sortByClassThenName( NETCUP* a, NETCUP* b ) { { Loading @@ -303,6 +363,7 @@ static bool sortByClassThenName( NETCUP* a, NETCUP* b ) return false; return false; } } void DIALOG_DESIGN_RULES::makePointers( PNETCUPS* aList, const wxString& aNetClassName ) void DIALOG_DESIGN_RULES::makePointers( PNETCUPS* aList, const wxString& aNetClassName ) { { aList->clear(); aList->clear(); Loading Loading @@ -331,36 +392,14 @@ void DIALOG_DESIGN_RULES::makePointers( PNETCUPS* aList, const wxString& aNetCla } } void DIALOG_DESIGN_RULES::setRowItem( wxListCtrl* aListCtrl, int aRow, NETCUP* aNetAndClass ) { wxASSERT( aRow >= 0 ); // insert blanks if aRow is larger than existing count while( aRow >= aListCtrl->GetItemCount() ) { long ndx = aListCtrl->InsertItem( aListCtrl->GetItemCount(), wxEmptyString ); wxASSERT( ndx >= 0 ); aListCtrl->SetItem( ndx, 1, wxEmptyString ); } aListCtrl->SetItem( aRow, 0, aNetAndClass->net ); aListCtrl->SetItem( aRow, 1, aNetAndClass->clazz ); // recompute the column widths here, after setting texts aListCtrl->SetColumnWidth( 0, wxLIST_AUTOSIZE ); aListCtrl->SetColumnWidth( 1, wxLIST_AUTOSIZE ); } /** /** * Function FillListBoxWithNetNames * Function FillListBoxWithNetNames * populates aListCtrl with net names and class names from m_AllNets in a two column display. * populates aListCtrl with net names and class names from m_AllNets in a two column display. */ */ void DIALOG_DESIGN_RULES::FillListBoxWithNetNames( wxListCtrl* aListCtrl, const wxString& aNetClass ) void DIALOG_DESIGN_RULES::FillListBoxWithNetNames( NETS_LIST_CTRL* aListCtrl, const wxString& aNetClass ) { { aListCtrl->DeleteAllItems(); aListCtrl->ClearList(); PNETCUPS ptrList; PNETCUPS ptrList; Loading @@ -373,6 +412,7 @@ void DIALOG_DESIGN_RULES::FillListBoxWithNetNames( wxListCtrl* aListCtrl, const { { printf( "[%d]: %s %s\n", r, CONV_TO_UTF8( (*i)->net ), CONV_TO_UTF8( (*i)->clazz ) ); printf( "[%d]: %s %s\n", r, CONV_TO_UTF8( (*i)->net ), CONV_TO_UTF8( (*i)->clazz ) ); } } #endif #endif // to speed up inserting we hide the control temporarily // to speed up inserting we hide the control temporarily Loading @@ -381,9 +421,13 @@ void DIALOG_DESIGN_RULES::FillListBoxWithNetNames( wxListCtrl* aListCtrl, const int row = 0; int row = 0; for( PNETCUPS::iterator i = ptrList.begin(); i!=ptrList.end(); ++i, ++row ) for( PNETCUPS::iterator i = ptrList.begin(); i!=ptrList.end(); ++i, ++row ) { { setRowItem( aListCtrl, row, *i ); aListCtrl->setRowItems( row, (*i)->net, (*i)->clazz ); } } // recompute the column widths here, after setting texts aListCtrl->SetColumnWidth( 0, wxLIST_AUTOSIZE ); aListCtrl->SetColumnWidth( 1, wxLIST_AUTOSIZE ); aListCtrl->Show(); aListCtrl->Show(); } } Loading Loading @@ -444,6 +488,7 @@ static void class2gridRow( wxGrid* grid, int row, NETCLASS* nc, int units ) grid->SetCellValue( row, GRID_uVIADRILL, msg ); grid->SetCellValue( row, GRID_uVIADRILL, msg ); } } /** Function InitRulesList() /** Function InitRulesList() * Fill the grid showing current rules with values * Fill the grid showing current rules with values */ */ Loading Loading @@ -528,6 +573,7 @@ void DIALOG_DESIGN_RULES::CopyRulesListToBoard() m_Pcb->SynchronizeNetsAndNetClasses(); m_Pcb->SynchronizeNetsAndNetClasses(); } } /*************************************************/ /*************************************************/ void DIALOG_DESIGN_RULES::CopyGlobalRulesToBoard() void DIALOG_DESIGN_RULES::CopyGlobalRulesToBoard() /*************************************************/ /*************************************************/ Loading Loading @@ -555,6 +601,7 @@ void DIALOG_DESIGN_RULES::CopyGlobalRulesToBoard() ReturnValueFromTextCtrl( *m_SetTrackMinWidthCtrl, m_Parent->m_InternalUnits ); ReturnValueFromTextCtrl( *m_SetTrackMinWidthCtrl, m_Parent->m_InternalUnits ); } } /*******************************************************************/ /*******************************************************************/ void DIALOG_DESIGN_RULES::CopyDimensionsListsToBoard() void DIALOG_DESIGN_RULES::CopyDimensionsListsToBoard() /*******************************************************************/ /*******************************************************************/ Loading @@ -571,6 +618,7 @@ void DIALOG_DESIGN_RULES::CopyDimensionsListsToBoard( ) int value = ReturnValueFromString( g_UserUnit, msg, m_Parent->m_InternalUnits ); int value = ReturnValueFromString( g_UserUnit, msg, m_Parent->m_InternalUnits ); m_TracksWidthList.push_back( value ); m_TracksWidthList.push_back( value ); } } // Sort new list by by increasing value // Sort new list by by increasing value sort( m_TracksWidthList.begin(), m_TracksWidthList.end() ); sort( m_TracksWidthList.begin(), m_TracksWidthList.end() ); Loading @@ -592,6 +640,7 @@ void DIALOG_DESIGN_RULES::CopyDimensionsListsToBoard( ) } } m_ViasDimensionsList.push_back( via_dim ); m_ViasDimensionsList.push_back( via_dim ); } } // Sort new list by by increasing value // Sort new list by by increasing value sort( m_ViasDimensionsList.begin(), m_ViasDimensionsList.end() ); sort( m_ViasDimensionsList.begin(), m_ViasDimensionsList.end() ); Loading Loading @@ -657,6 +706,7 @@ void DIALOG_DESIGN_RULES::OnAddNetclassClick( wxCommandEvent& event ) wxString class_name; wxString class_name; wxTextEntryDialog dlg( this, _( "New Net Class Name:" ), wxEmptyString, class_name ); wxTextEntryDialog dlg( this, _( "New Net Class Name:" ), wxEmptyString, class_name ); if( dlg.ShowModal() != wxID_OK ) if( dlg.ShowModal() != wxID_OK ) return; // cancelled by user return; // cancelled by user Loading Loading @@ -695,25 +745,31 @@ void DIALOG_DESIGN_RULES::OnAddNetclassClick( wxCommandEvent& event ) InitializeRulesSelectionBoxes(); InitializeRulesSelectionBoxes(); } } // Sort function for wxArrayInt. Items (ints) are sorted by decreasing value // Sort function for wxArrayInt. Items (ints) are sorted by decreasing value // used in DIALOG_DESIGN_RULES::OnRemoveNetclassClick // used in DIALOG_DESIGN_RULES::OnRemoveNetclassClick int sort_int( int* first, int* second ) int sort_int( int* first, int* second ) { { return *second - *first; return *second - *first; } } /**************************************************************************/ /**************************************************************************/ void DIALOG_DESIGN_RULES::OnRemoveNetclassClick( wxCommandEvent& event ) void DIALOG_DESIGN_RULES::OnRemoveNetclassClick( wxCommandEvent& event ) /**************************************************************************/ /**************************************************************************/ { { wxArrayInt select = m_grid->GetSelectedRows(); wxArrayInt select = m_grid->GetSelectedRows(); // Sort selection by decreasing index order: // Sort selection by decreasing index order: select.Sort( sort_int ); select.Sort( sort_int ); bool reinit = false; bool reinit = false; // rows labels are not removed when deleting rows: they are not deleted. // rows labels are not removed when deleting rows: they are not deleted. // So we must store them, remove correponding labels and reinit them // So we must store them, remove correponding labels and reinit them wxArrayString labels; wxArrayString labels; for( int ii = 0; ii < m_grid->GetNumberRows(); ii++ ) for( int ii = 0; ii < m_grid->GetNumberRows(); ii++ ) labels.Add( m_grid->GetRowLabelValue( ii ) ); labels.Add( m_grid->GetRowLabelValue( ii ) ); // Delete rows from last to first (this is the order wxArrayInt select after sorting) ) // Delete rows from last to first (this is the order wxArrayInt select after sorting) ) // This order is Ok when removing rows // This order is Ok when removing rows for( unsigned ii = 0; ii < select.GetCount(); ii++ ) for( unsigned ii = 0; ii < select.GetCount(); ii++ ) Loading @@ -732,6 +788,7 @@ void DIALOG_DESIGN_RULES::OnRemoveNetclassClick( wxCommandEvent& event ) else else wxMessageBox( _( "The defaut Netclass cannot be removed" ) ); wxMessageBox( _( "The defaut Netclass cannot be removed" ) ); } } if( reinit ) if( reinit ) { { // Reinit labels : // Reinit labels : Loading @@ -742,6 +799,7 @@ void DIALOG_DESIGN_RULES::OnRemoveNetclassClick( wxCommandEvent& event ) } } } } /* /* * Called on "Move Up" button click * Called on "Move Up" button click * the selected(s) rules are moved up * the selected(s) rules are moved up Loading Loading @@ -770,6 +828,7 @@ void DIALOG_DESIGN_RULES::OnMoveUpSelectedNetClass( wxCommandEvent& event ) m_grid->SetCellValue( ii, icol, previous_value ); m_grid->SetCellValue( ii, icol, previous_value ); m_grid->SetCellValue( ii - 1, icol, curr_value ); m_grid->SetCellValue( ii - 1, icol, curr_value ); } } curr_value = m_grid->GetRowLabelValue( ii ); curr_value = m_grid->GetRowLabelValue( ii ); previous_value = m_grid->GetRowLabelValue( ii - 1 ); previous_value = m_grid->GetRowLabelValue( ii - 1 ); m_grid->SetRowLabelValue( ii, previous_value ); m_grid->SetRowLabelValue( ii, previous_value ); Loading Loading @@ -819,10 +878,11 @@ void DIALOG_DESIGN_RULES::OnRightCBSelection( wxCommandEvent& event ) } } void DIALOG_DESIGN_RULES::moveSelectedItems( wxListCtrl* src, const wxString& newClassName ) void DIALOG_DESIGN_RULES::moveSelectedItems( NETS_LIST_CTRL* src, const wxString& newClassName ) { { wxListItem item; wxListItem item; wxString netName; wxString netName; item.m_mask |= wxLIST_MASK_TEXT; // Validate the member m_text of the wxListItem item item.m_mask |= wxLIST_MASK_TEXT; // Validate the member m_text of the wxListItem item for( int row = 0; row < src->GetItemCount(); ++row ) for( int row = 0; row < src->GetItemCount(); ++row ) Loading Loading @@ -851,6 +911,7 @@ void DIALOG_DESIGN_RULES::OnRightToLeftCopyButton( wxCommandEvent& event ) FillListBoxWithNetNames( m_rightListCtrl, m_rightClassChoice->GetStringSelection() ); FillListBoxWithNetNames( m_rightListCtrl, m_rightClassChoice->GetStringSelection() ); } } void DIALOG_DESIGN_RULES::OnLeftToRightCopyButton( wxCommandEvent& event ) void DIALOG_DESIGN_RULES::OnLeftToRightCopyButton( wxCommandEvent& event ) { { wxString newClassName = m_rightClassChoice->GetStringSelection(); wxString newClassName = m_rightClassChoice->GetStringSelection(); Loading Loading @@ -908,11 +969,16 @@ bool DIALOG_DESIGN_RULES::TestDataValidity() wxString msg; wxString msg; int minViaDia = ReturnValueFromTextCtrl( *m_SetViasMinSizeCtrl, m_Parent->m_InternalUnits ); int minViaDia = ReturnValueFromTextCtrl( *m_SetViasMinSizeCtrl, int minViaDrill = ReturnValueFromTextCtrl( *m_SetViasMinDrillCtrl, m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits ); int minUViaDia = ReturnValueFromTextCtrl( *m_SetMicroViasMinSizeCtrl, m_Parent->m_InternalUnits ); int minViaDrill = ReturnValueFromTextCtrl( *m_SetViasMinDrillCtrl, int minUViaDrill = ReturnValueFromTextCtrl( *m_SetMicroViasMinDrillCtrl, m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits ); int minTrackWidth = ReturnValueFromTextCtrl( *m_SetTrackMinWidthCtrl, m_Parent->m_InternalUnits ); int minUViaDia = ReturnValueFromTextCtrl( *m_SetMicroViasMinSizeCtrl, m_Parent->m_InternalUnits ); int minUViaDrill = ReturnValueFromTextCtrl( *m_SetMicroViasMinDrillCtrl, m_Parent->m_InternalUnits ); int minTrackWidth = ReturnValueFromTextCtrl( *m_SetTrackMinWidthCtrl, m_Parent->m_InternalUnits ); for( int row = 0; row < m_grid->GetNumberRows(); row++ ) for( int row = 0; row < m_grid->GetNumberRows(); row++ ) Loading Loading @@ -1057,4 +1123,3 @@ bool DIALOG_DESIGN_RULES::TestDataValidity() return result; return result; } } pcbnew/dialog_design_rules.h +2 −4 Original line number Original line Diff line number Diff line Loading @@ -76,7 +76,7 @@ private: void CopyGlobalRulesToBoard(); void CopyGlobalRulesToBoard(); void CopyDimensionsListsToBoard( ); void CopyDimensionsListsToBoard( ); void SetRoutableLayerStatus(); void SetRoutableLayerStatus(); void FillListBoxWithNetNames( wxListCtrl* aListCtrl, const wxString& aNetClass ); void FillListBoxWithNetNames( NETS_LIST_CTRL* aListCtrl, const wxString& aNetClass ); void PrintCurrentSettings( ); void PrintCurrentSettings( ); /** /** Loading @@ -96,9 +96,7 @@ private: void setNetClass( const wxString& aNetName, const wxString& aClassName ); void setNetClass( const wxString& aNetName, const wxString& aClassName ); static void setRowItem( wxListCtrl* aListCtrl, int aRow, NETCUP* aNetAndClass ); void moveSelectedItems( NETS_LIST_CTRL* src, const wxString& newClassName ); void moveSelectedItems( wxListCtrl* src, const wxString& newClassName ); public: public: Loading pcbnew/dialog_design_rules_aux_helper_class.h 0 → 100644 +46 −0 Original line number Original line Diff line number Diff line /////////////////////////////////////////////////////////////////////////////// /// Class DIALOG_DESIGN_RULES /////////////////////////////////////////////////////////////////////////////// #ifndef __dialog_design_rules_aux_helper_class_h_ #define __dialog_design_rules_aux_helper_class_h_ #include <wx/listctrl.h> /* helper class to display lists of nets and associated netclasses * used in dialog design rules. * It s needed because the 2 wxListCtlr used to display lists of nets * use the wxLC_VIRTUAL option. * The virtual wxString OnGetItemText(long item, long column) const method * must be overlaid. */ class NETS_LIST_CTRL: public wxListCtrl { private: wxArrayString m_Netnames; ///< an array to store the list of nets (column 0) wxArrayString m_Classnames; ///< an array to store the list of netclasse (column 1) public: NETS_LIST_CTRL(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxLC_ICON): wxListCtrl( parent, id, pos, size, style ) { }; NETS_LIST_CTRL() { }; void setRowItems(unsigned aRow, const wxString & aNetname, const wxString & aNetclassName ); void ClearList() { SetItemCount(0); m_Netnames.Clear(); m_Classnames.Clear(); } virtual wxString OnGetItemText(long item, long column) const; }; #endif //__dialog_design_rules_aux_helper_class_h_ pcbnew/dialog_design_rules_base.cpp +421 −419 Original line number Original line Diff line number Diff line Loading @@ -5,6 +5,8 @@ // PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// #include "dialog_design_rules_aux_helper_class.h" #include "dialog_design_rules_base.h" #include "dialog_design_rules_base.h" /////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// Loading Loading @@ -99,7 +101,7 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID m_leftClassChoice->SetSelection( 0 ); m_leftClassChoice->SetSelection( 0 ); leftNetSelectBoxSizer->Add( m_leftClassChoice, 0, wxEXPAND, 5 ); leftNetSelectBoxSizer->Add( m_leftClassChoice, 0, wxEXPAND, 5 ); m_leftListCtrl = new wxListCtrl( m_panelNetClassesEditor, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_VRULES|wxSUNKEN_BORDER ); m_leftListCtrl = new NETS_LIST_CTRL( m_panelNetClassesEditor, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_VIRTUAL|wxLC_VRULES|wxSUNKEN_BORDER ); m_leftListCtrl->SetMinSize( wxSize( 220,200 ) ); m_leftListCtrl->SetMinSize( wxSize( 220,200 ) ); leftNetSelectBoxSizer->Add( m_leftListCtrl, 1, wxEXPAND|wxTOP, 5 ); leftNetSelectBoxSizer->Add( m_leftListCtrl, 1, wxEXPAND|wxTOP, 5 ); Loading Loading @@ -139,7 +141,7 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID m_rightClassChoice->SetSelection( 0 ); m_rightClassChoice->SetSelection( 0 ); rghtNetSelectBoxSizer->Add( m_rightClassChoice, 0, wxEXPAND, 5 ); rghtNetSelectBoxSizer->Add( m_rightClassChoice, 0, wxEXPAND, 5 ); m_rightListCtrl = new wxListCtrl( m_panelNetClassesEditor, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_VRULES|wxSUNKEN_BORDER ); m_rightListCtrl = new NETS_LIST_CTRL( m_panelNetClassesEditor, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_VIRTUAL|wxLC_VRULES|wxSUNKEN_BORDER ); m_rightListCtrl->SetMinSize( wxSize( 220,-1 ) ); m_rightListCtrl->SetMinSize( wxSize( 220,-1 ) ); rghtNetSelectBoxSizer->Add( m_rightListCtrl, 1, wxEXPAND|wxTOP, 5 ); rghtNetSelectBoxSizer->Add( m_rightListCtrl, 1, wxEXPAND|wxTOP, 5 ); Loading Loading
common/dialog_about/AboutDialog_main.cpp +7 −4 Original line number Original line Diff line number Diff line Loading @@ -113,8 +113,10 @@ static void InitKiCadAboutNew( AboutAppInfo& info ) description << wxT( "<p>" ); description << wxT( "<p>" ); description << wxT( "<b><u>" ) << _( "Description" ) << wxT( "</u></b>" ); // bold & underlined font for caption description << wxT( "<b><u>" ) << _( "Description" ) << wxT( "</u></b>" ); // bold & underlined font for caption description << wxT( description << wxT( "<p>" ) << "<p>The KiCad EDA Suite is a set of open source applications for the creation of electronic schematics and to design printed circuit boards.</p>" ); _( "The KiCad EDA Suite is a set of open source applications for the creation of electronic schematics and to design printed circuit boards." ) << wxT( "</p>" ); description << wxT( "</p>" ); description << wxT( "</p>" ); Loading Loading @@ -170,7 +172,7 @@ static void InitKiCadAboutNew( AboutAppInfo& info ) << HtmlNewline( 4 ) << HtmlNewline( 4 ) << _( "The complete KiCad EDA Suite is released under the" ) << HtmlNewline( 2 ) << _( "The complete KiCad EDA Suite is released under the" ) << HtmlNewline( 2 ) << HtmlHyperlink( wxT( "http://www.gnu.org/licenses" ), << HtmlHyperlink( wxT( "http://www.gnu.org/licenses" ), _( "GNU General Public License version 2" ) ) _( "GNU General Public License (GPL) version 2" ) ) << wxT( "</div>" ); << wxT( "</div>" ); info.SetLicense( license ); info.SetLicense( license ); Loading Loading @@ -201,7 +203,8 @@ static void InitKiCadAboutNew( AboutAppInfo& info ) info.AddDeveloper( new Contributor( wxT( "Lorenzo Marcantonio" ), wxT( "lomarcan@tin.it" ) ) ); info.AddDeveloper( new Contributor( wxT( "Lorenzo Marcantonio" ), wxT( "lomarcan@tin.it" ) ) ); info.AddDeveloper( new Contributor( wxT( "Marco Serantoni" ), wxT( "marco.serantoni@gmail.com" ) ) ); info.AddDeveloper( new Contributor( wxT( "Marco Serantoni" ), wxT( "marco.serantoni@gmail.com" ) ) ); info.AddDeveloper( new Contributor( wxT( "Marco Mattila" ), wxT( "marcom99@gmail.com" ) ) ); info.AddDeveloper( new Contributor( wxT( "Marco Mattila" ), wxT( "marcom99@gmail.com" ) ) ); info.AddDeveloper( new Contributor( wxT( "Rafael Sokolowski" ), wxT( "rafael.sokolowski@web.de" ) ) ); info.AddDeveloper( new Contributor( wxT( "Rafael Sokolowski" ), wxT( "rafael.sokolowski@web.de" ) ) ); info.AddDeveloper( new Contributor( wxT( "Rok Markovic" ), wxT( "rok@kanardia.eu" ) ) ); info.AddDeveloper( new Contributor( wxT( "Rok Markovic" ), wxT( "rok@kanardia.eu" ) ) ); info.AddDeveloper( new Contributor( wxT( "Tim Hanson" ), wxT( "sideskate@gmail.com" ) ) ); info.AddDeveloper( new Contributor( wxT( "Tim Hanson" ), wxT( "sideskate@gmail.com" ) ) ); info.AddDeveloper( new Contributor( wxT( "Vesa Solonen" ), wxT( "vesa.solonen@hut.fi" ) ) ); info.AddDeveloper( new Contributor( wxT( "Vesa Solonen" ), wxT( "vesa.solonen@hut.fi" ) ) ); Loading
pcbnew/dialog_design_rules.cpp +217 −152 Original line number Original line Diff line number Diff line ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// // Name: dialog_design_rules.cpp // Name: dialog_design_rules.cpp ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// Loading Loading @@ -42,7 +43,7 @@ #include "pcbnew_id.h" #include "pcbnew_id.h" #include "dialog_design_rules.h" #include "dialog_design_rules.h" #include "wx/generic/gridctrl.h" #include "wx/generic/gridctrl.h" #include "dialog_design_rules_aux_helper_class.h" // Field Positions on rules grid // Field Positions on rules grid enum { enum { Loading @@ -63,6 +64,53 @@ int DIALOG_DESIGN_RULES::s_LastTabSelection = -1; wxPoint DIALOG_DESIGN_RULES:: s_LastPos( -1, -1 ); wxPoint DIALOG_DESIGN_RULES:: s_LastPos( -1, -1 ); wxSize DIALOG_DESIGN_RULES:: s_LastSize; wxSize DIALOG_DESIGN_RULES:: s_LastSize; // methods for the helper class NETS_LIST_CTRL /** OnGetItemText (overlaid method) * needed by wxListCtrl with wxLC_VIRTUAL options */ wxString NETS_LIST_CTRL::OnGetItemText( long item, long column ) const { if( column == 0 ) { if( item < (long) m_Netnames.GetCount() ) return m_Netnames[item]; else return wxEmptyString; } else if( item < (long) m_Classnames.GetCount() ) return m_Classnames[item]; return wxEmptyString; } /** Function setRowItems * Initialize the net name and the net class name at row aRow * @param aRow = row index (if aRow > number of stored row, empty rows will be created) * @param aNetname = the string to display in row aRow, column 0 * @param aNetclassName = the string to display in row aRow, column 1 */ void NETS_LIST_CTRL::setRowItems( unsigned aRow, const wxString& aNetname, const wxString& aNetclassName ) { // insert blanks if aRow is larger than existing row count unsigned cnt = m_Netnames.GetCount(); if( cnt <= aRow ) m_Netnames.Add( wxEmptyString, aRow - cnt + 1 ); cnt = m_Classnames.GetCount(); if( cnt <= aRow ) m_Classnames.Add( wxEmptyString, aRow - cnt + 1 ); if( (int)aRow <= GetItemCount() ) SetItemCount( aRow + 1 ); m_Netnames[aRow] = aNetname; m_Classnames[aRow] = aNetclassName; } /** /** Loading @@ -71,6 +119,7 @@ wxSize DIALOG_DESIGN_RULES::s_LastSize; * column titles and not on the grid cell requirements, assuming that the grid * column titles and not on the grid cell requirements, assuming that the grid * cell width requirements are narrower than the column title requirements. * cell width requirements are narrower than the column title requirements. */ */ // @todo: maybe move this to common.cpp if it works. // @todo: maybe move this to common.cpp if it works. void EnsureGridColumnWidths( wxGrid* aGrid ) void EnsureGridColumnWidths( wxGrid* aGrid ) { { Loading Loading @@ -156,7 +205,10 @@ void DIALOG_DESIGN_RULES::PrintCurrentSettings( ) m_MessagesList->AppendToPage( _( "<b>Current general settings:</b><br>" ) ); m_MessagesList->AppendToPage( _( "<b>Current general settings:</b><br>" ) ); // Display min values: // Display min values: value = ReturnStringFromValue( g_UserUnit, m_BrdSettings->m_TrackMinWidth, internal_units, true ); value = ReturnStringFromValue( g_UserUnit, m_BrdSettings->m_TrackMinWidth, internal_units, true ); msg.Printf( _( "Minimum value for tracks width: <b>%s</b><br>\n" ), GetChars( value ) ); msg.Printf( _( "Minimum value for tracks width: <b>%s</b><br>\n" ), GetChars( value ) ); m_MessagesList->AppendToPage( msg ); m_MessagesList->AppendToPage( msg ); Loading @@ -164,10 +216,12 @@ void DIALOG_DESIGN_RULES::PrintCurrentSettings( ) msg.Printf( _( "Minimum value for vias diameter: <b>%s</b><br>\n" ), GetChars( value ) ); msg.Printf( _( "Minimum value for vias diameter: <b>%s</b><br>\n" ), GetChars( value ) ); m_MessagesList->AppendToPage( msg ); m_MessagesList->AppendToPage( msg ); value = ReturnStringFromValue( g_UserUnit, m_BrdSettings->m_MicroViasMinSize, internal_units, true ); value = ReturnStringFromValue( g_UserUnit, m_BrdSettings->m_MicroViasMinSize, internal_units, true ); msg.Printf( _( "Minimum value for microvias diameter: <b>%s</b><br>\n" ), GetChars( value ) ); msg.Printf( _( "Minimum value for microvias diameter: <b>%s</b><br>\n" ), GetChars( value ) ); m_MessagesList->AppendToPage( msg ); m_MessagesList->AppendToPage( msg ); } } Loading Loading @@ -218,6 +272,7 @@ void DIALOG_DESIGN_RULES::InitDialogRules() PrintCurrentSettings(); PrintCurrentSettings(); } } /*******************************************/ /*******************************************/ void DIALOG_DESIGN_RULES::InitGlobalRules() void DIALOG_DESIGN_RULES::InitGlobalRules() /*******************************************/ /*******************************************/ Loading @@ -236,8 +291,12 @@ void DIALOG_DESIGN_RULES::InitGlobalRules() m_OptViaType->SetSelection( 1 ); m_OptViaType->SetSelection( 1 ); m_AllowMicroViaCtrl->SetSelection( m_BrdSettings->m_MicroViasAllowed ? 1 : 0 ); m_AllowMicroViaCtrl->SetSelection( m_BrdSettings->m_MicroViasAllowed ? 1 : 0 ); PutValueInLocalUnits( *m_SetMicroViasMinSizeCtrl, m_BrdSettings->m_MicroViasMinSize, Internal_Unit ); PutValueInLocalUnits( *m_SetMicroViasMinSizeCtrl, PutValueInLocalUnits( *m_SetMicroViasMinDrillCtrl, m_BrdSettings->m_MicroViasMinDrill, Internal_Unit ); m_BrdSettings->m_MicroViasMinSize, Internal_Unit ); PutValueInLocalUnits( *m_SetMicroViasMinDrillCtrl, m_BrdSettings->m_MicroViasMinDrill, Internal_Unit ); PutValueInLocalUnits( *m_SetTrackMinWidthCtrl, m_BrdSettings->m_TrackMinWidth, Internal_Unit ); PutValueInLocalUnits( *m_SetTrackMinWidthCtrl, m_BrdSettings->m_TrackMinWidth, Internal_Unit ); Loading @@ -249,9 +308,9 @@ void DIALOG_DESIGN_RULES::InitGlobalRules() m_ViasDimensionsList = m_Parent->GetBoard()->m_ViasDimensionsList; m_ViasDimensionsList = m_Parent->GetBoard()->m_ViasDimensionsList; m_ViasDimensionsList.erase( m_ViasDimensionsList.begin() ); // remove the netclass value m_ViasDimensionsList.erase( m_ViasDimensionsList.begin() ); // remove the netclass value InitDimensionsLists(); InitDimensionsLists(); } } /***************************************************/ /***************************************************/ void DIALOG_DESIGN_RULES::InitDimensionsLists() void DIALOG_DESIGN_RULES::InitDimensionsLists() /***************************************************/ /***************************************************/ Loading Loading @@ -286,6 +345,7 @@ void DIALOG_DESIGN_RULES::InitDimensionsLists() m_gridTrackWidthList->SetColumnWidth( 0, wxLIST_AUTOSIZE ); m_gridTrackWidthList->SetColumnWidth( 0, wxLIST_AUTOSIZE ); } } // Sort comparison function (helper for makePointers() ) // Sort comparison function (helper for makePointers() ) static bool sortByClassThenName( NETCUP* a, NETCUP* b ) static bool sortByClassThenName( NETCUP* a, NETCUP* b ) { { Loading @@ -303,6 +363,7 @@ static bool sortByClassThenName( NETCUP* a, NETCUP* b ) return false; return false; } } void DIALOG_DESIGN_RULES::makePointers( PNETCUPS* aList, const wxString& aNetClassName ) void DIALOG_DESIGN_RULES::makePointers( PNETCUPS* aList, const wxString& aNetClassName ) { { aList->clear(); aList->clear(); Loading Loading @@ -331,36 +392,14 @@ void DIALOG_DESIGN_RULES::makePointers( PNETCUPS* aList, const wxString& aNetCla } } void DIALOG_DESIGN_RULES::setRowItem( wxListCtrl* aListCtrl, int aRow, NETCUP* aNetAndClass ) { wxASSERT( aRow >= 0 ); // insert blanks if aRow is larger than existing count while( aRow >= aListCtrl->GetItemCount() ) { long ndx = aListCtrl->InsertItem( aListCtrl->GetItemCount(), wxEmptyString ); wxASSERT( ndx >= 0 ); aListCtrl->SetItem( ndx, 1, wxEmptyString ); } aListCtrl->SetItem( aRow, 0, aNetAndClass->net ); aListCtrl->SetItem( aRow, 1, aNetAndClass->clazz ); // recompute the column widths here, after setting texts aListCtrl->SetColumnWidth( 0, wxLIST_AUTOSIZE ); aListCtrl->SetColumnWidth( 1, wxLIST_AUTOSIZE ); } /** /** * Function FillListBoxWithNetNames * Function FillListBoxWithNetNames * populates aListCtrl with net names and class names from m_AllNets in a two column display. * populates aListCtrl with net names and class names from m_AllNets in a two column display. */ */ void DIALOG_DESIGN_RULES::FillListBoxWithNetNames( wxListCtrl* aListCtrl, const wxString& aNetClass ) void DIALOG_DESIGN_RULES::FillListBoxWithNetNames( NETS_LIST_CTRL* aListCtrl, const wxString& aNetClass ) { { aListCtrl->DeleteAllItems(); aListCtrl->ClearList(); PNETCUPS ptrList; PNETCUPS ptrList; Loading @@ -373,6 +412,7 @@ void DIALOG_DESIGN_RULES::FillListBoxWithNetNames( wxListCtrl* aListCtrl, const { { printf( "[%d]: %s %s\n", r, CONV_TO_UTF8( (*i)->net ), CONV_TO_UTF8( (*i)->clazz ) ); printf( "[%d]: %s %s\n", r, CONV_TO_UTF8( (*i)->net ), CONV_TO_UTF8( (*i)->clazz ) ); } } #endif #endif // to speed up inserting we hide the control temporarily // to speed up inserting we hide the control temporarily Loading @@ -381,9 +421,13 @@ void DIALOG_DESIGN_RULES::FillListBoxWithNetNames( wxListCtrl* aListCtrl, const int row = 0; int row = 0; for( PNETCUPS::iterator i = ptrList.begin(); i!=ptrList.end(); ++i, ++row ) for( PNETCUPS::iterator i = ptrList.begin(); i!=ptrList.end(); ++i, ++row ) { { setRowItem( aListCtrl, row, *i ); aListCtrl->setRowItems( row, (*i)->net, (*i)->clazz ); } } // recompute the column widths here, after setting texts aListCtrl->SetColumnWidth( 0, wxLIST_AUTOSIZE ); aListCtrl->SetColumnWidth( 1, wxLIST_AUTOSIZE ); aListCtrl->Show(); aListCtrl->Show(); } } Loading Loading @@ -444,6 +488,7 @@ static void class2gridRow( wxGrid* grid, int row, NETCLASS* nc, int units ) grid->SetCellValue( row, GRID_uVIADRILL, msg ); grid->SetCellValue( row, GRID_uVIADRILL, msg ); } } /** Function InitRulesList() /** Function InitRulesList() * Fill the grid showing current rules with values * Fill the grid showing current rules with values */ */ Loading Loading @@ -528,6 +573,7 @@ void DIALOG_DESIGN_RULES::CopyRulesListToBoard() m_Pcb->SynchronizeNetsAndNetClasses(); m_Pcb->SynchronizeNetsAndNetClasses(); } } /*************************************************/ /*************************************************/ void DIALOG_DESIGN_RULES::CopyGlobalRulesToBoard() void DIALOG_DESIGN_RULES::CopyGlobalRulesToBoard() /*************************************************/ /*************************************************/ Loading Loading @@ -555,6 +601,7 @@ void DIALOG_DESIGN_RULES::CopyGlobalRulesToBoard() ReturnValueFromTextCtrl( *m_SetTrackMinWidthCtrl, m_Parent->m_InternalUnits ); ReturnValueFromTextCtrl( *m_SetTrackMinWidthCtrl, m_Parent->m_InternalUnits ); } } /*******************************************************************/ /*******************************************************************/ void DIALOG_DESIGN_RULES::CopyDimensionsListsToBoard() void DIALOG_DESIGN_RULES::CopyDimensionsListsToBoard() /*******************************************************************/ /*******************************************************************/ Loading @@ -571,6 +618,7 @@ void DIALOG_DESIGN_RULES::CopyDimensionsListsToBoard( ) int value = ReturnValueFromString( g_UserUnit, msg, m_Parent->m_InternalUnits ); int value = ReturnValueFromString( g_UserUnit, msg, m_Parent->m_InternalUnits ); m_TracksWidthList.push_back( value ); m_TracksWidthList.push_back( value ); } } // Sort new list by by increasing value // Sort new list by by increasing value sort( m_TracksWidthList.begin(), m_TracksWidthList.end() ); sort( m_TracksWidthList.begin(), m_TracksWidthList.end() ); Loading @@ -592,6 +640,7 @@ void DIALOG_DESIGN_RULES::CopyDimensionsListsToBoard( ) } } m_ViasDimensionsList.push_back( via_dim ); m_ViasDimensionsList.push_back( via_dim ); } } // Sort new list by by increasing value // Sort new list by by increasing value sort( m_ViasDimensionsList.begin(), m_ViasDimensionsList.end() ); sort( m_ViasDimensionsList.begin(), m_ViasDimensionsList.end() ); Loading Loading @@ -657,6 +706,7 @@ void DIALOG_DESIGN_RULES::OnAddNetclassClick( wxCommandEvent& event ) wxString class_name; wxString class_name; wxTextEntryDialog dlg( this, _( "New Net Class Name:" ), wxEmptyString, class_name ); wxTextEntryDialog dlg( this, _( "New Net Class Name:" ), wxEmptyString, class_name ); if( dlg.ShowModal() != wxID_OK ) if( dlg.ShowModal() != wxID_OK ) return; // cancelled by user return; // cancelled by user Loading Loading @@ -695,25 +745,31 @@ void DIALOG_DESIGN_RULES::OnAddNetclassClick( wxCommandEvent& event ) InitializeRulesSelectionBoxes(); InitializeRulesSelectionBoxes(); } } // Sort function for wxArrayInt. Items (ints) are sorted by decreasing value // Sort function for wxArrayInt. Items (ints) are sorted by decreasing value // used in DIALOG_DESIGN_RULES::OnRemoveNetclassClick // used in DIALOG_DESIGN_RULES::OnRemoveNetclassClick int sort_int( int* first, int* second ) int sort_int( int* first, int* second ) { { return *second - *first; return *second - *first; } } /**************************************************************************/ /**************************************************************************/ void DIALOG_DESIGN_RULES::OnRemoveNetclassClick( wxCommandEvent& event ) void DIALOG_DESIGN_RULES::OnRemoveNetclassClick( wxCommandEvent& event ) /**************************************************************************/ /**************************************************************************/ { { wxArrayInt select = m_grid->GetSelectedRows(); wxArrayInt select = m_grid->GetSelectedRows(); // Sort selection by decreasing index order: // Sort selection by decreasing index order: select.Sort( sort_int ); select.Sort( sort_int ); bool reinit = false; bool reinit = false; // rows labels are not removed when deleting rows: they are not deleted. // rows labels are not removed when deleting rows: they are not deleted. // So we must store them, remove correponding labels and reinit them // So we must store them, remove correponding labels and reinit them wxArrayString labels; wxArrayString labels; for( int ii = 0; ii < m_grid->GetNumberRows(); ii++ ) for( int ii = 0; ii < m_grid->GetNumberRows(); ii++ ) labels.Add( m_grid->GetRowLabelValue( ii ) ); labels.Add( m_grid->GetRowLabelValue( ii ) ); // Delete rows from last to first (this is the order wxArrayInt select after sorting) ) // Delete rows from last to first (this is the order wxArrayInt select after sorting) ) // This order is Ok when removing rows // This order is Ok when removing rows for( unsigned ii = 0; ii < select.GetCount(); ii++ ) for( unsigned ii = 0; ii < select.GetCount(); ii++ ) Loading @@ -732,6 +788,7 @@ void DIALOG_DESIGN_RULES::OnRemoveNetclassClick( wxCommandEvent& event ) else else wxMessageBox( _( "The defaut Netclass cannot be removed" ) ); wxMessageBox( _( "The defaut Netclass cannot be removed" ) ); } } if( reinit ) if( reinit ) { { // Reinit labels : // Reinit labels : Loading @@ -742,6 +799,7 @@ void DIALOG_DESIGN_RULES::OnRemoveNetclassClick( wxCommandEvent& event ) } } } } /* /* * Called on "Move Up" button click * Called on "Move Up" button click * the selected(s) rules are moved up * the selected(s) rules are moved up Loading Loading @@ -770,6 +828,7 @@ void DIALOG_DESIGN_RULES::OnMoveUpSelectedNetClass( wxCommandEvent& event ) m_grid->SetCellValue( ii, icol, previous_value ); m_grid->SetCellValue( ii, icol, previous_value ); m_grid->SetCellValue( ii - 1, icol, curr_value ); m_grid->SetCellValue( ii - 1, icol, curr_value ); } } curr_value = m_grid->GetRowLabelValue( ii ); curr_value = m_grid->GetRowLabelValue( ii ); previous_value = m_grid->GetRowLabelValue( ii - 1 ); previous_value = m_grid->GetRowLabelValue( ii - 1 ); m_grid->SetRowLabelValue( ii, previous_value ); m_grid->SetRowLabelValue( ii, previous_value ); Loading Loading @@ -819,10 +878,11 @@ void DIALOG_DESIGN_RULES::OnRightCBSelection( wxCommandEvent& event ) } } void DIALOG_DESIGN_RULES::moveSelectedItems( wxListCtrl* src, const wxString& newClassName ) void DIALOG_DESIGN_RULES::moveSelectedItems( NETS_LIST_CTRL* src, const wxString& newClassName ) { { wxListItem item; wxListItem item; wxString netName; wxString netName; item.m_mask |= wxLIST_MASK_TEXT; // Validate the member m_text of the wxListItem item item.m_mask |= wxLIST_MASK_TEXT; // Validate the member m_text of the wxListItem item for( int row = 0; row < src->GetItemCount(); ++row ) for( int row = 0; row < src->GetItemCount(); ++row ) Loading Loading @@ -851,6 +911,7 @@ void DIALOG_DESIGN_RULES::OnRightToLeftCopyButton( wxCommandEvent& event ) FillListBoxWithNetNames( m_rightListCtrl, m_rightClassChoice->GetStringSelection() ); FillListBoxWithNetNames( m_rightListCtrl, m_rightClassChoice->GetStringSelection() ); } } void DIALOG_DESIGN_RULES::OnLeftToRightCopyButton( wxCommandEvent& event ) void DIALOG_DESIGN_RULES::OnLeftToRightCopyButton( wxCommandEvent& event ) { { wxString newClassName = m_rightClassChoice->GetStringSelection(); wxString newClassName = m_rightClassChoice->GetStringSelection(); Loading Loading @@ -908,11 +969,16 @@ bool DIALOG_DESIGN_RULES::TestDataValidity() wxString msg; wxString msg; int minViaDia = ReturnValueFromTextCtrl( *m_SetViasMinSizeCtrl, m_Parent->m_InternalUnits ); int minViaDia = ReturnValueFromTextCtrl( *m_SetViasMinSizeCtrl, int minViaDrill = ReturnValueFromTextCtrl( *m_SetViasMinDrillCtrl, m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits ); int minUViaDia = ReturnValueFromTextCtrl( *m_SetMicroViasMinSizeCtrl, m_Parent->m_InternalUnits ); int minViaDrill = ReturnValueFromTextCtrl( *m_SetViasMinDrillCtrl, int minUViaDrill = ReturnValueFromTextCtrl( *m_SetMicroViasMinDrillCtrl, m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits ); int minTrackWidth = ReturnValueFromTextCtrl( *m_SetTrackMinWidthCtrl, m_Parent->m_InternalUnits ); int minUViaDia = ReturnValueFromTextCtrl( *m_SetMicroViasMinSizeCtrl, m_Parent->m_InternalUnits ); int minUViaDrill = ReturnValueFromTextCtrl( *m_SetMicroViasMinDrillCtrl, m_Parent->m_InternalUnits ); int minTrackWidth = ReturnValueFromTextCtrl( *m_SetTrackMinWidthCtrl, m_Parent->m_InternalUnits ); for( int row = 0; row < m_grid->GetNumberRows(); row++ ) for( int row = 0; row < m_grid->GetNumberRows(); row++ ) Loading Loading @@ -1057,4 +1123,3 @@ bool DIALOG_DESIGN_RULES::TestDataValidity() return result; return result; } }
pcbnew/dialog_design_rules.h +2 −4 Original line number Original line Diff line number Diff line Loading @@ -76,7 +76,7 @@ private: void CopyGlobalRulesToBoard(); void CopyGlobalRulesToBoard(); void CopyDimensionsListsToBoard( ); void CopyDimensionsListsToBoard( ); void SetRoutableLayerStatus(); void SetRoutableLayerStatus(); void FillListBoxWithNetNames( wxListCtrl* aListCtrl, const wxString& aNetClass ); void FillListBoxWithNetNames( NETS_LIST_CTRL* aListCtrl, const wxString& aNetClass ); void PrintCurrentSettings( ); void PrintCurrentSettings( ); /** /** Loading @@ -96,9 +96,7 @@ private: void setNetClass( const wxString& aNetName, const wxString& aClassName ); void setNetClass( const wxString& aNetName, const wxString& aClassName ); static void setRowItem( wxListCtrl* aListCtrl, int aRow, NETCUP* aNetAndClass ); void moveSelectedItems( NETS_LIST_CTRL* src, const wxString& newClassName ); void moveSelectedItems( wxListCtrl* src, const wxString& newClassName ); public: public: Loading
pcbnew/dialog_design_rules_aux_helper_class.h 0 → 100644 +46 −0 Original line number Original line Diff line number Diff line /////////////////////////////////////////////////////////////////////////////// /// Class DIALOG_DESIGN_RULES /////////////////////////////////////////////////////////////////////////////// #ifndef __dialog_design_rules_aux_helper_class_h_ #define __dialog_design_rules_aux_helper_class_h_ #include <wx/listctrl.h> /* helper class to display lists of nets and associated netclasses * used in dialog design rules. * It s needed because the 2 wxListCtlr used to display lists of nets * use the wxLC_VIRTUAL option. * The virtual wxString OnGetItemText(long item, long column) const method * must be overlaid. */ class NETS_LIST_CTRL: public wxListCtrl { private: wxArrayString m_Netnames; ///< an array to store the list of nets (column 0) wxArrayString m_Classnames; ///< an array to store the list of netclasse (column 1) public: NETS_LIST_CTRL(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxLC_ICON): wxListCtrl( parent, id, pos, size, style ) { }; NETS_LIST_CTRL() { }; void setRowItems(unsigned aRow, const wxString & aNetname, const wxString & aNetclassName ); void ClearList() { SetItemCount(0); m_Netnames.Clear(); m_Classnames.Clear(); } virtual wxString OnGetItemText(long item, long column) const; }; #endif //__dialog_design_rules_aux_helper_class_h_
pcbnew/dialog_design_rules_base.cpp +421 −419 Original line number Original line Diff line number Diff line Loading @@ -5,6 +5,8 @@ // PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// #include "dialog_design_rules_aux_helper_class.h" #include "dialog_design_rules_base.h" #include "dialog_design_rules_base.h" /////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// Loading Loading @@ -99,7 +101,7 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID m_leftClassChoice->SetSelection( 0 ); m_leftClassChoice->SetSelection( 0 ); leftNetSelectBoxSizer->Add( m_leftClassChoice, 0, wxEXPAND, 5 ); leftNetSelectBoxSizer->Add( m_leftClassChoice, 0, wxEXPAND, 5 ); m_leftListCtrl = new wxListCtrl( m_panelNetClassesEditor, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_VRULES|wxSUNKEN_BORDER ); m_leftListCtrl = new NETS_LIST_CTRL( m_panelNetClassesEditor, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_VIRTUAL|wxLC_VRULES|wxSUNKEN_BORDER ); m_leftListCtrl->SetMinSize( wxSize( 220,200 ) ); m_leftListCtrl->SetMinSize( wxSize( 220,200 ) ); leftNetSelectBoxSizer->Add( m_leftListCtrl, 1, wxEXPAND|wxTOP, 5 ); leftNetSelectBoxSizer->Add( m_leftListCtrl, 1, wxEXPAND|wxTOP, 5 ); Loading Loading @@ -139,7 +141,7 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID m_rightClassChoice->SetSelection( 0 ); m_rightClassChoice->SetSelection( 0 ); rghtNetSelectBoxSizer->Add( m_rightClassChoice, 0, wxEXPAND, 5 ); rghtNetSelectBoxSizer->Add( m_rightClassChoice, 0, wxEXPAND, 5 ); m_rightListCtrl = new wxListCtrl( m_panelNetClassesEditor, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_VRULES|wxSUNKEN_BORDER ); m_rightListCtrl = new NETS_LIST_CTRL( m_panelNetClassesEditor, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_VIRTUAL|wxLC_VRULES|wxSUNKEN_BORDER ); m_rightListCtrl->SetMinSize( wxSize( 220,-1 ) ); m_rightListCtrl->SetMinSize( wxSize( 220,-1 ) ); rghtNetSelectBoxSizer->Add( m_rightListCtrl, 1, wxEXPAND|wxTOP, 5 ); rghtNetSelectBoxSizer->Add( m_rightListCtrl, 1, wxEXPAND|wxTOP, 5 ); Loading