Loading change_log.txt +9 −4 Original line number Original line Diff line number Diff line Loading @@ -4,6 +4,14 @@ Started 2007-June-11 Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with email address. email address. 2007-Dec-2 UPDATE Dick Hollenbeck <dick@softplc.com> ================================================================================ +pcbnew drc.cpp and dialog_drc.cpp intermediate update. More hours to go before completion. 2007-Nov-30 UPDATE Dick Hollenbeck <dick@softplc.com> 2007-Nov-30 UPDATE Dick Hollenbeck <dick@softplc.com> ================================================================================ ================================================================================ +pcbnew +pcbnew Loading @@ -15,8 +23,6 @@ email address. and testing is done. and testing is done. * Made the DRC dialog modeless, so it can sit off to the side while the MARKER * Made the DRC dialog modeless, so it can sit off to the side while the MARKER are inspected one by one. are inspected one by one. Need another 4-8 hours or so to finish the actual dialog display, remove debug statements and finish testing. 2007-Nov-29 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> 2007-Nov-29 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> Loading @@ -42,7 +48,6 @@ email address. * Revised BOARD::Visit() to know about BOARD::m_markers. * Revised BOARD::Visit() to know about BOARD::m_markers. * Revised pcbnew/find.cpp to know about BOARD::m_markers. * Revised pcbnew/find.cpp to know about BOARD::m_markers. * removed wxYield() from drc.cpp * removed wxYield() from drc.cpp Maybe finish the DRC rework tomorrow. 2007-Nov-26 UPDATE Dick Hollenbeck <dick@softplc.com> 2007-Nov-26 UPDATE Dick Hollenbeck <dick@softplc.com> Loading include/pcbstruct.h +10 −0 Original line number Original line Diff line number Diff line Loading @@ -201,6 +201,7 @@ class BOARD : public BOARD_ITEM friend class WinEDA_PcbFrame; friend class WinEDA_PcbFrame; private: private: std::vector<MARKER*> m_markers; ///< MARKERs for clearance problems, owned by pointer std::vector<MARKER*> m_markers; ///< MARKERs for clearance problems, owned by pointer // std::vector<MARKER*> m_markersUnconnected; ///< MARKERs for unconnected problems, owned by pointer // std::vector<MARKER*> m_markersUnconnected; ///< MARKERs for unconnected problems, owned by pointer Loading Loading @@ -269,6 +270,15 @@ public: */ */ void DeleteMARKERs(); void DeleteMARKERs(); /** * Function DeleteMARKER * deletes one MARKER from the board. * @param aIndex The index of the marker to delete. */ void DeleteMARKER( int aIndex ); /** /** * Function GetMARKER * Function GetMARKER * returns the MARKER at a given index. * returns the MARKER at a given index. Loading pcbnew/class_board.cpp +11 −2 Original line number Original line Diff line number Diff line Loading @@ -194,8 +194,7 @@ void BOARD::Delete( BOARD_ITEM* aBoardItem ) { { if( m_markers[i] == (MARKER*) aBoardItem ) if( m_markers[i] == (MARKER*) aBoardItem ) { { delete m_markers[i]; DeleteMARKER( i ); m_markers.erase( m_markers.begin() + i ); break; break; } } } } Loading @@ -208,6 +207,16 @@ void BOARD::Delete( BOARD_ITEM* aBoardItem ) } } void BOARD::DeleteMARKER( int aIndex ) { if( (unsigned) aIndex < m_markers.size() ) { delete m_markers[aIndex]; m_markers.erase( m_markers.begin() + aIndex ); } } void BOARD::DeleteMARKERs() void BOARD::DeleteMARKERs() { { // the vector does not know how to delete the MARKER, it holds pointers // the vector does not know how to delete the MARKER, it holds pointers Loading pcbnew/dialog_drc.cpp +283 −69 Original line number Original line Diff line number Diff line Loading @@ -39,14 +39,68 @@ ////@end XPM images ////@end XPM images class DRC_LIST_MARKERS : public DRC_ITEM_LIST { BOARD* m_board; public: DRC_LIST_MARKERS( BOARD* aBoard ) : m_board(aBoard) { } /* no destructor since we do not own anything to delete, not even the BOARD. ~DRC_LIST_MARKERS() {} */ //-----<Interface DRC_ITEM_LIST >--------------------------------------- void DeleteAllItems() { m_board->DeleteMARKERs(); } const DRC_ITEM* GetItem( int aIndex ) { const MARKER* marker = m_board->GetMARKER( aIndex ); if( marker ) return &marker->GetReporter(); return NULL; } void DeleteItem( int aIndex ) { m_board->DeleteMARKER( aIndex ); } /** * Function GetCount * returns the number of items in the list. */ int GetCount() { return m_board->GetMARKERCount(); } //-----</Interface DRC_ITEM_LIST >-------------------------------------- }; /** /** * Class DRCLISTBOX * Class DRCLISTBOX * is used to display a DRC_LIST, which contains DRC_ITEM_OWNERs. * is used to display a DRC_ITEM_LIST. */ */ class DRCLISTBOX : public wxHtmlListBox class DRCLISTBOX : public wxHtmlListBox { { private: private: DRC_LIST* m_List; ///< wxHtmlListBox does not own the list items, we do DRC_ITEM_LIST* m_list; ///< wxHtmlListBox does not own the list, I do public: public: DRCLISTBOX( wxWindow* parent, wxWindowID id = wxID_ANY, DRCLISTBOX( wxWindow* parent, wxWindowID id = wxID_ANY, Loading @@ -54,35 +108,47 @@ public: long style = 0, const wxString& name = wxVListBoxNameStr) long style = 0, const wxString& name = wxVListBoxNameStr) : wxHtmlListBox( parent, id, pos, size, style, name ) : wxHtmlListBox( parent, id, pos, size, style, name ) { { m_list = 0; } ~DRCLISTBOX() { delete m_list; // I own it, I destroy it. } } /** /** * Function SetList * Function SetList * sets the DRC_LIST for this listbox. However no ownership is * sets the DRC_LIST for this listbox. Ownership of the DRC_ITEM_LIST is * given, the caller still owns the list and is responsible * transfered to this DRCLISTBOX. * for deleting it. * @param aList The DRC_ITEM_LIST* containing the DRC_ITEMs which will be * @param aList The DRC_LIST containing the DRC_ITEMs which will be * displayed in the wxHtmlListBox * displayed in the wxHtmlListBox */ */ void SetList( DRC_LIST* aList ) void SetList( DRC_ITEM_LIST* aList ) { { m_List = aList; delete m_list; SetItemCount( aList->size() ); m_list = aList; SetItemCount( aList->GetCount() ); Refresh(); } } /** /** * Function OnGetItem * Function OnGetItem * returns the html text associated with the given index 'n'. * returns the html text associated with the DRC_ITEM given by index 'n'. * @param n An index into the list. * @param n An index into the list. * @return wxString - the simply html text to show in the listbox. * @return wxString - the simply html text to show in the listbox. */ */ wxString OnGetItem( size_t n ) const wxString OnGetItem( size_t n ) const { { if( m_List ) if( m_list ) return (*m_List)[n]->ShowHtml(); { else const DRC_ITEM* item = m_list->GetItem( (int) n ); if( item ) return item->ShowHtml(); } return wxString(); return wxString(); } } Loading @@ -95,28 +161,45 @@ public: */ */ wxString OnGetItemMarkup( size_t n ) const wxString OnGetItemMarkup( size_t n ) const { { if( m_List ) return OnGetItem( n ); return (*m_List)[n]->ShowHtml(); else return wxString(); } } /** /** * Function DeleteElement * Function DeleteElement * will delete one of the items in the list. * will delete one of the items in the list. * @param ndx The index into the list to delete. * @param aIndex The index into the list to delete. */ */ void DeleteElmenent( int ndx ) void DeleteItem( int aIndex ) { { if( m_List ) if( m_list ) { { if( (size_t) ndx < m_List->size() ) m_list->DeleteItem( aIndex ); { int count = m_list->GetCount(); m_List->erase( m_List->begin()+ndx ); SetItemCount( count ); SetItemCount( m_List->size() ); if( aIndex < count ) SetSelection( aIndex ); else SetSelection( aIndex-1 ); // -1 is no selection Refresh(); } } } } /** * Function DeleteAllItems * deletes all items in the list. */ void DeleteAllItems() { if( m_list ) { m_list->DeleteAllItems(); SetItemCount(0); SetSelection( -1 ); // -1 is no selection Refresh(); } } } }; }; Loading @@ -136,7 +219,6 @@ BEGIN_EVENT_TABLE( DrcDialog, wxDialog ) ////@begin DrcDialog event table entries ////@begin DrcDialog event table entries EVT_INIT_DIALOG( DrcDialog::OnInitDialog ) EVT_INIT_DIALOG( DrcDialog::OnInitDialog ) EVT_WINDOW_DESTROY( DrcDialog::OnDestroy ) EVT_CHECKBOX( ID_CHECKBOX, DrcDialog::OnReportCheckBoxClicked ) EVT_CHECKBOX( ID_CHECKBOX, DrcDialog::OnReportCheckBoxClicked ) Loading @@ -148,6 +230,8 @@ BEGIN_EVENT_TABLE( DrcDialog, wxDialog ) EVT_BUTTON( ID_DELETE_ALL, DrcDialog::OnDeleteAllClick ) EVT_BUTTON( ID_DELETE_ALL, DrcDialog::OnDeleteAllClick ) EVT_BUTTON( ID_DELETE_ONE, DrcDialog::OnDeleteOneClick ) EVT_BUTTON( wxID_CANCEL, DrcDialog::OnCancelClick ) EVT_BUTTON( wxID_CANCEL, DrcDialog::OnCancelClick ) EVT_BUTTON( wxID_OK, DrcDialog::OnOkClick ) EVT_BUTTON( wxID_OK, DrcDialog::OnOkClick ) Loading Loading @@ -205,6 +289,7 @@ bool DrcDialog::Create( wxWindow* parent, wxWindowID id, const wxString& caption m_UnconnectedTestCtrl = NULL; m_UnconnectedTestCtrl = NULL; m_DeleteAllButton = NULL; m_DeleteAllButton = NULL; m_DeleteCurrentMarkerButton = NULL; m_DeleteCurrentMarkerButton = NULL; m_Notebook = NULL; m_ClearanceListBox = NULL; m_ClearanceListBox = NULL; m_UnconnectedListBox = NULL; m_UnconnectedListBox = NULL; StdDialogButtonSizer = NULL; StdDialogButtonSizer = NULL; Loading @@ -223,10 +308,6 @@ bool DrcDialog::Create( wxWindow* parent, wxWindowID id, const wxString& caption Centre(); Centre(); ////@end DrcDialog creation ////@end DrcDialog creation // m_ClearanceListBox->SetList( &gList ); // m_UnconnectedListBox->SetList( &gList ); return true; return true; } } Loading @@ -239,7 +320,7 @@ void DrcDialog::CreateControls() SetFont( *g_DialogFont ); SetFont( *g_DialogFont ); ////@begin DrcDialog content construction ////@begin DrcDialog content construction // Generated by DialogBlocks, Fri 30 Nov 2007 18:52:20 CST (unregistered) // Generated by DialogBlocks, Sun 02 Dec 2007 22:18:27 CST (unregistered) DrcDialog* itemDialog1 = this; DrcDialog* itemDialog1 = this; Loading Loading @@ -339,27 +420,27 @@ void DrcDialog::CreateControls() wxStaticText* itemStaticText22 = new wxStaticText( itemDialog1, wxID_STATIC, _("Error Messages:"), wxDefaultPosition, wxDefaultSize, 0 ); wxStaticText* itemStaticText22 = new wxStaticText( itemDialog1, wxID_STATIC, _("Error Messages:"), wxDefaultPosition, wxDefaultSize, 0 ); m_MainSizer->Add(itemStaticText22, 0, wxGROW|wxLEFT|wxRIGHT|wxADJUST_MINSIZE, 10); m_MainSizer->Add(itemStaticText22, 0, wxGROW|wxLEFT|wxRIGHT|wxADJUST_MINSIZE, 10); wxNotebook* itemNotebook23 = new wxNotebook( itemDialog1, ID_NOTEBOOK1, wxDefaultPosition, wxDefaultSize, wxNB_DEFAULT|wxRAISED_BORDER ); m_Notebook = new wxNotebook( itemDialog1, ID_NOTEBOOK1, wxDefaultPosition, wxDefaultSize, wxNB_DEFAULT|wxRAISED_BORDER ); #if !wxCHECK_VERSION(2,5,2) #if !wxCHECK_VERSION(2,5,2) wxNotebookSizer* itemNotebook23Sizer = new wxNotebookSizer(itemNotebook23); wxNotebookSizer* m_NotebookSizer = new wxNotebookSizer(m_Notebook); #endif #endif m_ClearanceListBox = new DRCLISTBOX( itemNotebook23, ID_CLEARANCE_LIST, wxDefaultPosition, wxSize(100, 300), wxSUNKEN_BORDER|wxHSCROLL|wxVSCROLL ); m_ClearanceListBox = new DRCLISTBOX( m_Notebook, ID_CLEARANCE_LIST, wxDefaultPosition, wxSize(100, 300), wxSUNKEN_BORDER|wxHSCROLL|wxVSCROLL ); if (DrcDialog::ShowToolTips()) if (DrcDialog::ShowToolTips()) m_ClearanceListBox->SetToolTip(_("MARKERs on the PCB, double click on any MARKER to go there in PCB")); m_ClearanceListBox->SetToolTip(_("MARKERs on the PCB, double click on any MARKER to go there in PCB")); itemNotebook23->AddPage(m_ClearanceListBox, _("Distance Problem Markers")); m_Notebook->AddPage(m_ClearanceListBox, _("Distance Problem Markers")); m_UnconnectedListBox = new DRCLISTBOX( itemNotebook23, ID_UNCONNECTED_LIST, wxDefaultPosition, wxSize(100, 100), wxSUNKEN_BORDER|wxHSCROLL|wxVSCROLL ); m_UnconnectedListBox = new DRCLISTBOX( m_Notebook, ID_UNCONNECTED_LIST, wxDefaultPosition, wxSize(100, 100), wxSUNKEN_BORDER|wxHSCROLL|wxVSCROLL ); if (DrcDialog::ShowToolTips()) if (DrcDialog::ShowToolTips()) m_UnconnectedListBox->SetToolTip(_("Pad to pad, pad to track, and track to track clearance problems")); m_UnconnectedListBox->SetToolTip(_("Pad to pad, pad to track, and track to track clearance problems")); itemNotebook23->AddPage(m_UnconnectedListBox, _("Unconnected")); m_Notebook->AddPage(m_UnconnectedListBox, _("Unconnected")); #if !wxCHECK_VERSION(2,5,2) #if !wxCHECK_VERSION(2,5,2) m_MainSizer->Add(itemNotebook23Sizer, 5, wxGROW|wxALL, 5); m_MainSizer->Add(m_NotebookSizer, 5, wxGROW|wxALL, 5); #else #else m_MainSizer->Add(itemNotebook23, 5, wxGROW|wxALL, 5); m_MainSizer->Add(m_Notebook, 5, wxGROW|wxALL, 5); #endif #endif StdDialogButtonSizer = new wxStdDialogButtonSizer; StdDialogButtonSizer = new wxStdDialogButtonSizer; Loading @@ -376,7 +457,6 @@ void DrcDialog::CreateControls() StdDialogButtonSizer->Realize(); StdDialogButtonSizer->Realize(); // Connect events and objects // Connect events and objects itemDialog1->Connect(ID_DIALOG, wxEVT_DESTROY, wxWindowDestroyEventHandler(DrcDialog::OnDestroy), NULL, this); m_ClearanceListBox->Connect(ID_CLEARANCE_LIST, wxEVT_LEFT_DCLICK, wxMouseEventHandler(DrcDialog::OnLeftDClickClearance), NULL, this); m_ClearanceListBox->Connect(ID_CLEARANCE_LIST, wxEVT_LEFT_DCLICK, wxMouseEventHandler(DrcDialog::OnLeftDClickClearance), NULL, this); m_ClearanceListBox->Connect(ID_CLEARANCE_LIST, wxEVT_RIGHT_UP, wxMouseEventHandler(DrcDialog::OnRightUpClearance), NULL, this); m_ClearanceListBox->Connect(ID_CLEARANCE_LIST, wxEVT_RIGHT_UP, wxMouseEventHandler(DrcDialog::OnRightUpClearance), NULL, this); m_UnconnectedListBox->Connect(ID_UNCONNECTED_LIST, wxEVT_LEFT_DCLICK, wxMouseEventHandler(DrcDialog::OnLeftDClickUnconnected), NULL, this); m_UnconnectedListBox->Connect(ID_UNCONNECTED_LIST, wxEVT_LEFT_DCLICK, wxMouseEventHandler(DrcDialog::OnLeftDClickUnconnected), NULL, this); Loading Loading @@ -423,28 +503,68 @@ wxIcon DrcDialog::GetIconResource( const wxString& name ) return wxNullIcon; return wxNullIcon; ////@end DrcDialog icon retrieval ////@end DrcDialog icon retrieval } } /*! /*! * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DRC_RUN * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DRC_RUN */ */ void DrcDialog::OnStartdrcClick( wxCommandEvent& event ) void DrcDialog::OnStartdrcClick( wxCommandEvent& event ) { { CmdDrc(); wxString reportName; if( m_CreateRptCtrl->IsChecked() ) // Create a file rpt { reportName = m_RptFilenameCtrl->GetValue(); if( reportName.IsEmpty() ) { wxCommandEvent junk; OnButtonBrowseRptFileClick( junk ); } } /*! reportName = m_RptFilenameCtrl->GetValue(); * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_STOP_CONTROL_DRC } */ g_DesignSettings.m_TrackClearence = ReturnValueFromTextCtrl( *m_SetClearance, m_Parent->m_InternalUnits ); m_tester->SetSettings( m_Pad2PadTestCtrl->IsChecked(), m_UnconnectedTestCtrl->IsChecked(), m_ZonesTestCtrl->IsChecked(), reportName, m_CreateRptCtrl->IsChecked() ); /* m_Parent->Erase_Marqueurs(); void DrcDialog::OnStopControlDrcClick( wxCommandEvent& event ) m_Parent->ReDrawPanel(); SetCursor( wxCursor( wxCURSOR_WAIT ) ); // run all the tests, with no UI at this time. m_tester->RunTests(); // Generate the report if( !reportName.IsEmpty() ) { { if( DrcInProgress ) FILE* fp = wxFopen( reportName, wxT( "w" ) ); AbortDrc = TRUE; else m_tester->WriteReport( fp ); wxBell(); fclose(fp); // @todo put up message box saying we created the report //msg.Printf( _( "Report file <%s> created\n" ), s_RptFilename.GetData() ); } SetCursor( wxCursor( wxCURSOR_WATCH ) ); // @todo set the list counts in the DRCLISTITEMS here. m_Parent->ReDrawPanel(); // printf("done with tests\n"); } } */ /*! /*! * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_ERASE_DRC_MARKERS * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_ERASE_DRC_MARKERS Loading @@ -452,16 +572,67 @@ void DrcDialog::OnStopControlDrcClick( wxCommandEvent& event ) void DrcDialog::OnDeleteAllClick( wxCommandEvent& event ) void DrcDialog::OnDeleteAllClick( wxCommandEvent& event ) { { DelDRCMarkers(event); m_ClearanceListBox->DeleteAllItems(); m_UnconnectedListBox->DeleteAllItems(); m_Parent->ReDrawPanel(); } } /*! /*! * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_LIST_UNCONNECTED_PADS * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_LIST_UNCONNECTED_PADS */ */ void DrcDialog::OnListUnconnectedClick( wxCommandEvent& event ) void DrcDialog::OnListUnconnectedClick( wxCommandEvent& event ) { { ListUnconnectedPads(event); wxString reportName; if( m_CreateRptCtrl->IsChecked() ) // Create a file rpt { reportName = m_RptFilenameCtrl->GetValue(); if( reportName.IsEmpty() ) { wxCommandEvent junk; OnButtonBrowseRptFileClick( junk ); } reportName = m_RptFilenameCtrl->GetValue(); } g_DesignSettings.m_TrackClearence = ReturnValueFromTextCtrl( *m_SetClearance, m_Parent->m_InternalUnits ); m_tester->SetSettings( m_Pad2PadTestCtrl->IsChecked(), m_UnconnectedTestCtrl->IsChecked(), m_ZonesTestCtrl->IsChecked(), reportName, m_CreateRptCtrl->IsChecked() ); DelDRCMarkers(); SetCursor( wxCursor( wxCURSOR_WAIT ) ); // run all the tests, with no UI at this time. m_tester->ListUnconnectedPads(); // Generate the report if( !reportName.IsEmpty() ) { FILE* fp = wxFopen( reportName, wxT( "w" ) ); m_tester->WriteReport( fp ); fclose(fp); // @todo put up message box saying we created the report //msg.Printf( _( "Report file <%s> created\n" ), s_RptFilename.GetData() ); } SetCursor( wxCursor( wxCURSOR_WATCH ) ); // @todo set the list counts in the DRCLISTITEMS here. m_Parent->ReDrawPanel(); } } /*! /*! Loading Loading @@ -500,6 +671,12 @@ void DrcDialog::OnButtonBrowseRptFileClick( wxCommandEvent& event ) void DrcDialog::OnOkClick( wxCommandEvent& event ) void DrcDialog::OnOkClick( wxCommandEvent& event ) { { #if defined(DEBUG) printf("OK Button handler\n"); #endif SetReturnCode( wxID_OK ); m_tester->DestroyDialog(); event.Skip(); event.Skip(); } } Loading @@ -510,10 +687,13 @@ void DrcDialog::OnOkClick( wxCommandEvent& event ) void DrcDialog::OnCancelClick( wxCommandEvent& event ) void DrcDialog::OnCancelClick( wxCommandEvent& event ) { { ////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in WinEDA_DrcFrame. #if defined(DEBUG) // Before editing this code, remove the block markers. printf("Cancel Button handler\n"); #endif SetReturnCode( wxID_CANCEL ); m_tester->DestroyDialog(); event.Skip(); event.Skip(); ////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in WinEDA_DrcFrame. } } Loading Loading @@ -569,11 +749,10 @@ void DrcDialog::OnLeftDClickClearance( wxMouseEvent& event ) if( selection != wxNOT_FOUND ) if( selection != wxNOT_FOUND ) { { printf("get item number %d\n", selection ); //printf("get item number %d\n", selection ); // Find the selected MARKER in the PCB, position cursor there, // Find the selected MARKER in the PCB, position cursor there. // and close this dialog. // Do not close this dialog for users with dual screens. EndModal( 0 ); } } event.Skip(); event.Skip(); Loading Loading @@ -613,7 +792,7 @@ void DrcDialog::OnLeftDClickUnconnected( wxMouseEvent& event ) if( selection != wxNOT_FOUND ) if( selection != wxNOT_FOUND ) { { printf("get item number %d\n", selection ); //printf("get item number %d\n", selection ); } } event.Skip(); event.Skip(); Loading @@ -628,7 +807,7 @@ void DrcDialog::OnMarkerSelectionEvent( wxCommandEvent& event ) { { // until a MARKER is selected, this button is not enabled. // until a MARKER is selected, this button is not enabled. m_DeleteCurrentMarkerButton->Enable(true); m_DeleteCurrentMarkerButton->Enable(true); printf("get Marker number %d\n", selection ); //printf("get Marker number %d\n", selection ); } } event.Skip(); event.Skip(); Loading @@ -647,15 +826,50 @@ void DrcDialog::OnUnconnectedSelectionEvent( wxCommandEvent& event ) } } /*********************************************************/ void DrcDialog::DelDRCMarkers() /*********************************************************/ { m_Parent->Erase_Marqueurs(); m_Parent->ReDrawPanel(); } /*! /*! * wxEVT_DESTROY event handler for ID_DIALOG * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DELETE_ONE */ */ void DrcDialog::OnDestroy( wxWindowDestroyEvent& event ) void DrcDialog::OnDeleteOneClick( wxCommandEvent& event ) { int selectedIndex; int curTab = m_Notebook->GetSelection(); if( curTab == 0 ) { selectedIndex = m_ClearanceListBox->GetSelection(); if( selectedIndex != wxNOT_FOUND ) { m_ClearanceListBox->DeleteItem( selectedIndex ); m_Parent->ReDrawPanel(); } } else if( curTab == 1 ) { { ////@begin wxEVT_DESTROY event handler for ID_DIALOG in WinEDA_DrcFrame. selectedIndex = m_UnconnectedListBox->GetSelection(); if( selectedIndex != wxNOT_FOUND ) { m_UnconnectedListBox->DeleteItem( selectedIndex ); m_Parent->ReDrawPanel(); } } ////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DELETE_ONE in DrcDialog. // Before editing this code, remove the block markers. // Before editing this code, remove the block markers. event.Skip(); event.Skip(); ////@end wxEVT_DESTROY event handler for ID_DIALOG in WinEDA_DrcFrame. ////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DELETE_ONE in DrcDialog. } } pcbnew/dialog_drc.h +7 −7 Original line number Original line Diff line number Diff line Loading @@ -33,6 +33,7 @@ ////@begin forward declarations ////@begin forward declarations class wxBoxSizer; class wxBoxSizer; class wxNotebook; class DRCLISTBOX; class DRCLISTBOX; class wxStdDialogButtonSizer; class wxStdDialogButtonSizer; ////@end forward declarations ////@end forward declarations Loading @@ -58,7 +59,7 @@ class wxStdDialogButtonSizer; #define ID_NOTEBOOK1 10008 #define ID_NOTEBOOK1 10008 #define ID_CLEARANCE_LIST 10001 #define ID_CLEARANCE_LIST 10001 #define ID_UNCONNECTED_LIST 10009 #define ID_UNCONNECTED_LIST 10009 #define SYMBOL_DRCDIALOG_STYLE wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxMAXIMIZE_BOX|wxMINIMIZE_BOX #define SYMBOL_DRCDIALOG_STYLE wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxMAXIMIZE_BOX|wxMINIMIZE_BOX #define SYMBOL_DRCDIALOG_TITLE _("DRC Control") #define SYMBOL_DRCDIALOG_TITLE _("DRC Control") #define SYMBOL_DRCDIALOG_IDNAME ID_DIALOG #define SYMBOL_DRCDIALOG_IDNAME ID_DIALOG #define SYMBOL_DRCDIALOG_SIZE wxSize(400, 300) #define SYMBOL_DRCDIALOG_SIZE wxSize(400, 300) Loading Loading @@ -105,9 +106,6 @@ public: /// wxEVT_INIT_DIALOG event handler for ID_DIALOG /// wxEVT_INIT_DIALOG event handler for ID_DIALOG void OnInitDialog( wxInitDialogEvent& event ); void OnInitDialog( wxInitDialogEvent& event ); /// wxEVT_DESTROY event handler for ID_DIALOG void OnDestroy( wxWindowDestroyEvent& event ); /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_CHECKBOX /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_CHECKBOX void OnReportCheckBoxClicked( wxCommandEvent& event ); void OnReportCheckBoxClicked( wxCommandEvent& event ); Loading @@ -123,6 +121,9 @@ public: /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DELETE_ALL /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DELETE_ALL void OnDeleteAllClick( wxCommandEvent& event ); void OnDeleteAllClick( wxCommandEvent& event ); /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DELETE_ONE void OnDeleteOneClick( wxCommandEvent& event ); /// wxEVT_LEFT_DCLICK event handler for ID_CLEARANCE_LIST /// wxEVT_LEFT_DCLICK event handler for ID_CLEARANCE_LIST void OnLeftDClickClearance( wxMouseEvent& event ); void OnLeftDClickClearance( wxMouseEvent& event ); Loading Loading @@ -158,9 +159,7 @@ public: /// Should we show tooltips? /// Should we show tooltips? static bool ShowToolTips(); static bool ShowToolTips(); void CmdDrc(); void DelDRCMarkers(); void DelDRCMarkers(wxCommandEvent & event); void ListUnconnectedPads(wxCommandEvent & event); ////@begin DrcDialog member variables ////@begin DrcDialog member variables wxBoxSizer* m_MainSizer; wxBoxSizer* m_MainSizer; Loading @@ -175,6 +174,7 @@ public: wxCheckBox* m_UnconnectedTestCtrl; wxCheckBox* m_UnconnectedTestCtrl; wxButton* m_DeleteAllButton; wxButton* m_DeleteAllButton; wxButton* m_DeleteCurrentMarkerButton; wxButton* m_DeleteCurrentMarkerButton; wxNotebook* m_Notebook; DRCLISTBOX* m_ClearanceListBox; DRCLISTBOX* m_ClearanceListBox; DRCLISTBOX* m_UnconnectedListBox; DRCLISTBOX* m_UnconnectedListBox; wxStdDialogButtonSizer* StdDialogButtonSizer; wxStdDialogButtonSizer* StdDialogButtonSizer; Loading Loading
change_log.txt +9 −4 Original line number Original line Diff line number Diff line Loading @@ -4,6 +4,14 @@ Started 2007-June-11 Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with email address. email address. 2007-Dec-2 UPDATE Dick Hollenbeck <dick@softplc.com> ================================================================================ +pcbnew drc.cpp and dialog_drc.cpp intermediate update. More hours to go before completion. 2007-Nov-30 UPDATE Dick Hollenbeck <dick@softplc.com> 2007-Nov-30 UPDATE Dick Hollenbeck <dick@softplc.com> ================================================================================ ================================================================================ +pcbnew +pcbnew Loading @@ -15,8 +23,6 @@ email address. and testing is done. and testing is done. * Made the DRC dialog modeless, so it can sit off to the side while the MARKER * Made the DRC dialog modeless, so it can sit off to the side while the MARKER are inspected one by one. are inspected one by one. Need another 4-8 hours or so to finish the actual dialog display, remove debug statements and finish testing. 2007-Nov-29 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> 2007-Nov-29 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> Loading @@ -42,7 +48,6 @@ email address. * Revised BOARD::Visit() to know about BOARD::m_markers. * Revised BOARD::Visit() to know about BOARD::m_markers. * Revised pcbnew/find.cpp to know about BOARD::m_markers. * Revised pcbnew/find.cpp to know about BOARD::m_markers. * removed wxYield() from drc.cpp * removed wxYield() from drc.cpp Maybe finish the DRC rework tomorrow. 2007-Nov-26 UPDATE Dick Hollenbeck <dick@softplc.com> 2007-Nov-26 UPDATE Dick Hollenbeck <dick@softplc.com> Loading
include/pcbstruct.h +10 −0 Original line number Original line Diff line number Diff line Loading @@ -201,6 +201,7 @@ class BOARD : public BOARD_ITEM friend class WinEDA_PcbFrame; friend class WinEDA_PcbFrame; private: private: std::vector<MARKER*> m_markers; ///< MARKERs for clearance problems, owned by pointer std::vector<MARKER*> m_markers; ///< MARKERs for clearance problems, owned by pointer // std::vector<MARKER*> m_markersUnconnected; ///< MARKERs for unconnected problems, owned by pointer // std::vector<MARKER*> m_markersUnconnected; ///< MARKERs for unconnected problems, owned by pointer Loading Loading @@ -269,6 +270,15 @@ public: */ */ void DeleteMARKERs(); void DeleteMARKERs(); /** * Function DeleteMARKER * deletes one MARKER from the board. * @param aIndex The index of the marker to delete. */ void DeleteMARKER( int aIndex ); /** /** * Function GetMARKER * Function GetMARKER * returns the MARKER at a given index. * returns the MARKER at a given index. Loading
pcbnew/class_board.cpp +11 −2 Original line number Original line Diff line number Diff line Loading @@ -194,8 +194,7 @@ void BOARD::Delete( BOARD_ITEM* aBoardItem ) { { if( m_markers[i] == (MARKER*) aBoardItem ) if( m_markers[i] == (MARKER*) aBoardItem ) { { delete m_markers[i]; DeleteMARKER( i ); m_markers.erase( m_markers.begin() + i ); break; break; } } } } Loading @@ -208,6 +207,16 @@ void BOARD::Delete( BOARD_ITEM* aBoardItem ) } } void BOARD::DeleteMARKER( int aIndex ) { if( (unsigned) aIndex < m_markers.size() ) { delete m_markers[aIndex]; m_markers.erase( m_markers.begin() + aIndex ); } } void BOARD::DeleteMARKERs() void BOARD::DeleteMARKERs() { { // the vector does not know how to delete the MARKER, it holds pointers // the vector does not know how to delete the MARKER, it holds pointers Loading
pcbnew/dialog_drc.cpp +283 −69 Original line number Original line Diff line number Diff line Loading @@ -39,14 +39,68 @@ ////@end XPM images ////@end XPM images class DRC_LIST_MARKERS : public DRC_ITEM_LIST { BOARD* m_board; public: DRC_LIST_MARKERS( BOARD* aBoard ) : m_board(aBoard) { } /* no destructor since we do not own anything to delete, not even the BOARD. ~DRC_LIST_MARKERS() {} */ //-----<Interface DRC_ITEM_LIST >--------------------------------------- void DeleteAllItems() { m_board->DeleteMARKERs(); } const DRC_ITEM* GetItem( int aIndex ) { const MARKER* marker = m_board->GetMARKER( aIndex ); if( marker ) return &marker->GetReporter(); return NULL; } void DeleteItem( int aIndex ) { m_board->DeleteMARKER( aIndex ); } /** * Function GetCount * returns the number of items in the list. */ int GetCount() { return m_board->GetMARKERCount(); } //-----</Interface DRC_ITEM_LIST >-------------------------------------- }; /** /** * Class DRCLISTBOX * Class DRCLISTBOX * is used to display a DRC_LIST, which contains DRC_ITEM_OWNERs. * is used to display a DRC_ITEM_LIST. */ */ class DRCLISTBOX : public wxHtmlListBox class DRCLISTBOX : public wxHtmlListBox { { private: private: DRC_LIST* m_List; ///< wxHtmlListBox does not own the list items, we do DRC_ITEM_LIST* m_list; ///< wxHtmlListBox does not own the list, I do public: public: DRCLISTBOX( wxWindow* parent, wxWindowID id = wxID_ANY, DRCLISTBOX( wxWindow* parent, wxWindowID id = wxID_ANY, Loading @@ -54,35 +108,47 @@ public: long style = 0, const wxString& name = wxVListBoxNameStr) long style = 0, const wxString& name = wxVListBoxNameStr) : wxHtmlListBox( parent, id, pos, size, style, name ) : wxHtmlListBox( parent, id, pos, size, style, name ) { { m_list = 0; } ~DRCLISTBOX() { delete m_list; // I own it, I destroy it. } } /** /** * Function SetList * Function SetList * sets the DRC_LIST for this listbox. However no ownership is * sets the DRC_LIST for this listbox. Ownership of the DRC_ITEM_LIST is * given, the caller still owns the list and is responsible * transfered to this DRCLISTBOX. * for deleting it. * @param aList The DRC_ITEM_LIST* containing the DRC_ITEMs which will be * @param aList The DRC_LIST containing the DRC_ITEMs which will be * displayed in the wxHtmlListBox * displayed in the wxHtmlListBox */ */ void SetList( DRC_LIST* aList ) void SetList( DRC_ITEM_LIST* aList ) { { m_List = aList; delete m_list; SetItemCount( aList->size() ); m_list = aList; SetItemCount( aList->GetCount() ); Refresh(); } } /** /** * Function OnGetItem * Function OnGetItem * returns the html text associated with the given index 'n'. * returns the html text associated with the DRC_ITEM given by index 'n'. * @param n An index into the list. * @param n An index into the list. * @return wxString - the simply html text to show in the listbox. * @return wxString - the simply html text to show in the listbox. */ */ wxString OnGetItem( size_t n ) const wxString OnGetItem( size_t n ) const { { if( m_List ) if( m_list ) return (*m_List)[n]->ShowHtml(); { else const DRC_ITEM* item = m_list->GetItem( (int) n ); if( item ) return item->ShowHtml(); } return wxString(); return wxString(); } } Loading @@ -95,28 +161,45 @@ public: */ */ wxString OnGetItemMarkup( size_t n ) const wxString OnGetItemMarkup( size_t n ) const { { if( m_List ) return OnGetItem( n ); return (*m_List)[n]->ShowHtml(); else return wxString(); } } /** /** * Function DeleteElement * Function DeleteElement * will delete one of the items in the list. * will delete one of the items in the list. * @param ndx The index into the list to delete. * @param aIndex The index into the list to delete. */ */ void DeleteElmenent( int ndx ) void DeleteItem( int aIndex ) { { if( m_List ) if( m_list ) { { if( (size_t) ndx < m_List->size() ) m_list->DeleteItem( aIndex ); { int count = m_list->GetCount(); m_List->erase( m_List->begin()+ndx ); SetItemCount( count ); SetItemCount( m_List->size() ); if( aIndex < count ) SetSelection( aIndex ); else SetSelection( aIndex-1 ); // -1 is no selection Refresh(); } } } } /** * Function DeleteAllItems * deletes all items in the list. */ void DeleteAllItems() { if( m_list ) { m_list->DeleteAllItems(); SetItemCount(0); SetSelection( -1 ); // -1 is no selection Refresh(); } } } }; }; Loading @@ -136,7 +219,6 @@ BEGIN_EVENT_TABLE( DrcDialog, wxDialog ) ////@begin DrcDialog event table entries ////@begin DrcDialog event table entries EVT_INIT_DIALOG( DrcDialog::OnInitDialog ) EVT_INIT_DIALOG( DrcDialog::OnInitDialog ) EVT_WINDOW_DESTROY( DrcDialog::OnDestroy ) EVT_CHECKBOX( ID_CHECKBOX, DrcDialog::OnReportCheckBoxClicked ) EVT_CHECKBOX( ID_CHECKBOX, DrcDialog::OnReportCheckBoxClicked ) Loading @@ -148,6 +230,8 @@ BEGIN_EVENT_TABLE( DrcDialog, wxDialog ) EVT_BUTTON( ID_DELETE_ALL, DrcDialog::OnDeleteAllClick ) EVT_BUTTON( ID_DELETE_ALL, DrcDialog::OnDeleteAllClick ) EVT_BUTTON( ID_DELETE_ONE, DrcDialog::OnDeleteOneClick ) EVT_BUTTON( wxID_CANCEL, DrcDialog::OnCancelClick ) EVT_BUTTON( wxID_CANCEL, DrcDialog::OnCancelClick ) EVT_BUTTON( wxID_OK, DrcDialog::OnOkClick ) EVT_BUTTON( wxID_OK, DrcDialog::OnOkClick ) Loading Loading @@ -205,6 +289,7 @@ bool DrcDialog::Create( wxWindow* parent, wxWindowID id, const wxString& caption m_UnconnectedTestCtrl = NULL; m_UnconnectedTestCtrl = NULL; m_DeleteAllButton = NULL; m_DeleteAllButton = NULL; m_DeleteCurrentMarkerButton = NULL; m_DeleteCurrentMarkerButton = NULL; m_Notebook = NULL; m_ClearanceListBox = NULL; m_ClearanceListBox = NULL; m_UnconnectedListBox = NULL; m_UnconnectedListBox = NULL; StdDialogButtonSizer = NULL; StdDialogButtonSizer = NULL; Loading @@ -223,10 +308,6 @@ bool DrcDialog::Create( wxWindow* parent, wxWindowID id, const wxString& caption Centre(); Centre(); ////@end DrcDialog creation ////@end DrcDialog creation // m_ClearanceListBox->SetList( &gList ); // m_UnconnectedListBox->SetList( &gList ); return true; return true; } } Loading @@ -239,7 +320,7 @@ void DrcDialog::CreateControls() SetFont( *g_DialogFont ); SetFont( *g_DialogFont ); ////@begin DrcDialog content construction ////@begin DrcDialog content construction // Generated by DialogBlocks, Fri 30 Nov 2007 18:52:20 CST (unregistered) // Generated by DialogBlocks, Sun 02 Dec 2007 22:18:27 CST (unregistered) DrcDialog* itemDialog1 = this; DrcDialog* itemDialog1 = this; Loading Loading @@ -339,27 +420,27 @@ void DrcDialog::CreateControls() wxStaticText* itemStaticText22 = new wxStaticText( itemDialog1, wxID_STATIC, _("Error Messages:"), wxDefaultPosition, wxDefaultSize, 0 ); wxStaticText* itemStaticText22 = new wxStaticText( itemDialog1, wxID_STATIC, _("Error Messages:"), wxDefaultPosition, wxDefaultSize, 0 ); m_MainSizer->Add(itemStaticText22, 0, wxGROW|wxLEFT|wxRIGHT|wxADJUST_MINSIZE, 10); m_MainSizer->Add(itemStaticText22, 0, wxGROW|wxLEFT|wxRIGHT|wxADJUST_MINSIZE, 10); wxNotebook* itemNotebook23 = new wxNotebook( itemDialog1, ID_NOTEBOOK1, wxDefaultPosition, wxDefaultSize, wxNB_DEFAULT|wxRAISED_BORDER ); m_Notebook = new wxNotebook( itemDialog1, ID_NOTEBOOK1, wxDefaultPosition, wxDefaultSize, wxNB_DEFAULT|wxRAISED_BORDER ); #if !wxCHECK_VERSION(2,5,2) #if !wxCHECK_VERSION(2,5,2) wxNotebookSizer* itemNotebook23Sizer = new wxNotebookSizer(itemNotebook23); wxNotebookSizer* m_NotebookSizer = new wxNotebookSizer(m_Notebook); #endif #endif m_ClearanceListBox = new DRCLISTBOX( itemNotebook23, ID_CLEARANCE_LIST, wxDefaultPosition, wxSize(100, 300), wxSUNKEN_BORDER|wxHSCROLL|wxVSCROLL ); m_ClearanceListBox = new DRCLISTBOX( m_Notebook, ID_CLEARANCE_LIST, wxDefaultPosition, wxSize(100, 300), wxSUNKEN_BORDER|wxHSCROLL|wxVSCROLL ); if (DrcDialog::ShowToolTips()) if (DrcDialog::ShowToolTips()) m_ClearanceListBox->SetToolTip(_("MARKERs on the PCB, double click on any MARKER to go there in PCB")); m_ClearanceListBox->SetToolTip(_("MARKERs on the PCB, double click on any MARKER to go there in PCB")); itemNotebook23->AddPage(m_ClearanceListBox, _("Distance Problem Markers")); m_Notebook->AddPage(m_ClearanceListBox, _("Distance Problem Markers")); m_UnconnectedListBox = new DRCLISTBOX( itemNotebook23, ID_UNCONNECTED_LIST, wxDefaultPosition, wxSize(100, 100), wxSUNKEN_BORDER|wxHSCROLL|wxVSCROLL ); m_UnconnectedListBox = new DRCLISTBOX( m_Notebook, ID_UNCONNECTED_LIST, wxDefaultPosition, wxSize(100, 100), wxSUNKEN_BORDER|wxHSCROLL|wxVSCROLL ); if (DrcDialog::ShowToolTips()) if (DrcDialog::ShowToolTips()) m_UnconnectedListBox->SetToolTip(_("Pad to pad, pad to track, and track to track clearance problems")); m_UnconnectedListBox->SetToolTip(_("Pad to pad, pad to track, and track to track clearance problems")); itemNotebook23->AddPage(m_UnconnectedListBox, _("Unconnected")); m_Notebook->AddPage(m_UnconnectedListBox, _("Unconnected")); #if !wxCHECK_VERSION(2,5,2) #if !wxCHECK_VERSION(2,5,2) m_MainSizer->Add(itemNotebook23Sizer, 5, wxGROW|wxALL, 5); m_MainSizer->Add(m_NotebookSizer, 5, wxGROW|wxALL, 5); #else #else m_MainSizer->Add(itemNotebook23, 5, wxGROW|wxALL, 5); m_MainSizer->Add(m_Notebook, 5, wxGROW|wxALL, 5); #endif #endif StdDialogButtonSizer = new wxStdDialogButtonSizer; StdDialogButtonSizer = new wxStdDialogButtonSizer; Loading @@ -376,7 +457,6 @@ void DrcDialog::CreateControls() StdDialogButtonSizer->Realize(); StdDialogButtonSizer->Realize(); // Connect events and objects // Connect events and objects itemDialog1->Connect(ID_DIALOG, wxEVT_DESTROY, wxWindowDestroyEventHandler(DrcDialog::OnDestroy), NULL, this); m_ClearanceListBox->Connect(ID_CLEARANCE_LIST, wxEVT_LEFT_DCLICK, wxMouseEventHandler(DrcDialog::OnLeftDClickClearance), NULL, this); m_ClearanceListBox->Connect(ID_CLEARANCE_LIST, wxEVT_LEFT_DCLICK, wxMouseEventHandler(DrcDialog::OnLeftDClickClearance), NULL, this); m_ClearanceListBox->Connect(ID_CLEARANCE_LIST, wxEVT_RIGHT_UP, wxMouseEventHandler(DrcDialog::OnRightUpClearance), NULL, this); m_ClearanceListBox->Connect(ID_CLEARANCE_LIST, wxEVT_RIGHT_UP, wxMouseEventHandler(DrcDialog::OnRightUpClearance), NULL, this); m_UnconnectedListBox->Connect(ID_UNCONNECTED_LIST, wxEVT_LEFT_DCLICK, wxMouseEventHandler(DrcDialog::OnLeftDClickUnconnected), NULL, this); m_UnconnectedListBox->Connect(ID_UNCONNECTED_LIST, wxEVT_LEFT_DCLICK, wxMouseEventHandler(DrcDialog::OnLeftDClickUnconnected), NULL, this); Loading Loading @@ -423,28 +503,68 @@ wxIcon DrcDialog::GetIconResource( const wxString& name ) return wxNullIcon; return wxNullIcon; ////@end DrcDialog icon retrieval ////@end DrcDialog icon retrieval } } /*! /*! * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DRC_RUN * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DRC_RUN */ */ void DrcDialog::OnStartdrcClick( wxCommandEvent& event ) void DrcDialog::OnStartdrcClick( wxCommandEvent& event ) { { CmdDrc(); wxString reportName; if( m_CreateRptCtrl->IsChecked() ) // Create a file rpt { reportName = m_RptFilenameCtrl->GetValue(); if( reportName.IsEmpty() ) { wxCommandEvent junk; OnButtonBrowseRptFileClick( junk ); } } /*! reportName = m_RptFilenameCtrl->GetValue(); * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_STOP_CONTROL_DRC } */ g_DesignSettings.m_TrackClearence = ReturnValueFromTextCtrl( *m_SetClearance, m_Parent->m_InternalUnits ); m_tester->SetSettings( m_Pad2PadTestCtrl->IsChecked(), m_UnconnectedTestCtrl->IsChecked(), m_ZonesTestCtrl->IsChecked(), reportName, m_CreateRptCtrl->IsChecked() ); /* m_Parent->Erase_Marqueurs(); void DrcDialog::OnStopControlDrcClick( wxCommandEvent& event ) m_Parent->ReDrawPanel(); SetCursor( wxCursor( wxCURSOR_WAIT ) ); // run all the tests, with no UI at this time. m_tester->RunTests(); // Generate the report if( !reportName.IsEmpty() ) { { if( DrcInProgress ) FILE* fp = wxFopen( reportName, wxT( "w" ) ); AbortDrc = TRUE; else m_tester->WriteReport( fp ); wxBell(); fclose(fp); // @todo put up message box saying we created the report //msg.Printf( _( "Report file <%s> created\n" ), s_RptFilename.GetData() ); } SetCursor( wxCursor( wxCURSOR_WATCH ) ); // @todo set the list counts in the DRCLISTITEMS here. m_Parent->ReDrawPanel(); // printf("done with tests\n"); } } */ /*! /*! * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_ERASE_DRC_MARKERS * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_ERASE_DRC_MARKERS Loading @@ -452,16 +572,67 @@ void DrcDialog::OnStopControlDrcClick( wxCommandEvent& event ) void DrcDialog::OnDeleteAllClick( wxCommandEvent& event ) void DrcDialog::OnDeleteAllClick( wxCommandEvent& event ) { { DelDRCMarkers(event); m_ClearanceListBox->DeleteAllItems(); m_UnconnectedListBox->DeleteAllItems(); m_Parent->ReDrawPanel(); } } /*! /*! * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_LIST_UNCONNECTED_PADS * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_LIST_UNCONNECTED_PADS */ */ void DrcDialog::OnListUnconnectedClick( wxCommandEvent& event ) void DrcDialog::OnListUnconnectedClick( wxCommandEvent& event ) { { ListUnconnectedPads(event); wxString reportName; if( m_CreateRptCtrl->IsChecked() ) // Create a file rpt { reportName = m_RptFilenameCtrl->GetValue(); if( reportName.IsEmpty() ) { wxCommandEvent junk; OnButtonBrowseRptFileClick( junk ); } reportName = m_RptFilenameCtrl->GetValue(); } g_DesignSettings.m_TrackClearence = ReturnValueFromTextCtrl( *m_SetClearance, m_Parent->m_InternalUnits ); m_tester->SetSettings( m_Pad2PadTestCtrl->IsChecked(), m_UnconnectedTestCtrl->IsChecked(), m_ZonesTestCtrl->IsChecked(), reportName, m_CreateRptCtrl->IsChecked() ); DelDRCMarkers(); SetCursor( wxCursor( wxCURSOR_WAIT ) ); // run all the tests, with no UI at this time. m_tester->ListUnconnectedPads(); // Generate the report if( !reportName.IsEmpty() ) { FILE* fp = wxFopen( reportName, wxT( "w" ) ); m_tester->WriteReport( fp ); fclose(fp); // @todo put up message box saying we created the report //msg.Printf( _( "Report file <%s> created\n" ), s_RptFilename.GetData() ); } SetCursor( wxCursor( wxCURSOR_WATCH ) ); // @todo set the list counts in the DRCLISTITEMS here. m_Parent->ReDrawPanel(); } } /*! /*! Loading Loading @@ -500,6 +671,12 @@ void DrcDialog::OnButtonBrowseRptFileClick( wxCommandEvent& event ) void DrcDialog::OnOkClick( wxCommandEvent& event ) void DrcDialog::OnOkClick( wxCommandEvent& event ) { { #if defined(DEBUG) printf("OK Button handler\n"); #endif SetReturnCode( wxID_OK ); m_tester->DestroyDialog(); event.Skip(); event.Skip(); } } Loading @@ -510,10 +687,13 @@ void DrcDialog::OnOkClick( wxCommandEvent& event ) void DrcDialog::OnCancelClick( wxCommandEvent& event ) void DrcDialog::OnCancelClick( wxCommandEvent& event ) { { ////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in WinEDA_DrcFrame. #if defined(DEBUG) // Before editing this code, remove the block markers. printf("Cancel Button handler\n"); #endif SetReturnCode( wxID_CANCEL ); m_tester->DestroyDialog(); event.Skip(); event.Skip(); ////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in WinEDA_DrcFrame. } } Loading Loading @@ -569,11 +749,10 @@ void DrcDialog::OnLeftDClickClearance( wxMouseEvent& event ) if( selection != wxNOT_FOUND ) if( selection != wxNOT_FOUND ) { { printf("get item number %d\n", selection ); //printf("get item number %d\n", selection ); // Find the selected MARKER in the PCB, position cursor there, // Find the selected MARKER in the PCB, position cursor there. // and close this dialog. // Do not close this dialog for users with dual screens. EndModal( 0 ); } } event.Skip(); event.Skip(); Loading Loading @@ -613,7 +792,7 @@ void DrcDialog::OnLeftDClickUnconnected( wxMouseEvent& event ) if( selection != wxNOT_FOUND ) if( selection != wxNOT_FOUND ) { { printf("get item number %d\n", selection ); //printf("get item number %d\n", selection ); } } event.Skip(); event.Skip(); Loading @@ -628,7 +807,7 @@ void DrcDialog::OnMarkerSelectionEvent( wxCommandEvent& event ) { { // until a MARKER is selected, this button is not enabled. // until a MARKER is selected, this button is not enabled. m_DeleteCurrentMarkerButton->Enable(true); m_DeleteCurrentMarkerButton->Enable(true); printf("get Marker number %d\n", selection ); //printf("get Marker number %d\n", selection ); } } event.Skip(); event.Skip(); Loading @@ -647,15 +826,50 @@ void DrcDialog::OnUnconnectedSelectionEvent( wxCommandEvent& event ) } } /*********************************************************/ void DrcDialog::DelDRCMarkers() /*********************************************************/ { m_Parent->Erase_Marqueurs(); m_Parent->ReDrawPanel(); } /*! /*! * wxEVT_DESTROY event handler for ID_DIALOG * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DELETE_ONE */ */ void DrcDialog::OnDestroy( wxWindowDestroyEvent& event ) void DrcDialog::OnDeleteOneClick( wxCommandEvent& event ) { int selectedIndex; int curTab = m_Notebook->GetSelection(); if( curTab == 0 ) { selectedIndex = m_ClearanceListBox->GetSelection(); if( selectedIndex != wxNOT_FOUND ) { m_ClearanceListBox->DeleteItem( selectedIndex ); m_Parent->ReDrawPanel(); } } else if( curTab == 1 ) { { ////@begin wxEVT_DESTROY event handler for ID_DIALOG in WinEDA_DrcFrame. selectedIndex = m_UnconnectedListBox->GetSelection(); if( selectedIndex != wxNOT_FOUND ) { m_UnconnectedListBox->DeleteItem( selectedIndex ); m_Parent->ReDrawPanel(); } } ////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DELETE_ONE in DrcDialog. // Before editing this code, remove the block markers. // Before editing this code, remove the block markers. event.Skip(); event.Skip(); ////@end wxEVT_DESTROY event handler for ID_DIALOG in WinEDA_DrcFrame. ////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DELETE_ONE in DrcDialog. } }
pcbnew/dialog_drc.h +7 −7 Original line number Original line Diff line number Diff line Loading @@ -33,6 +33,7 @@ ////@begin forward declarations ////@begin forward declarations class wxBoxSizer; class wxBoxSizer; class wxNotebook; class DRCLISTBOX; class DRCLISTBOX; class wxStdDialogButtonSizer; class wxStdDialogButtonSizer; ////@end forward declarations ////@end forward declarations Loading @@ -58,7 +59,7 @@ class wxStdDialogButtonSizer; #define ID_NOTEBOOK1 10008 #define ID_NOTEBOOK1 10008 #define ID_CLEARANCE_LIST 10001 #define ID_CLEARANCE_LIST 10001 #define ID_UNCONNECTED_LIST 10009 #define ID_UNCONNECTED_LIST 10009 #define SYMBOL_DRCDIALOG_STYLE wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxMAXIMIZE_BOX|wxMINIMIZE_BOX #define SYMBOL_DRCDIALOG_STYLE wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxMAXIMIZE_BOX|wxMINIMIZE_BOX #define SYMBOL_DRCDIALOG_TITLE _("DRC Control") #define SYMBOL_DRCDIALOG_TITLE _("DRC Control") #define SYMBOL_DRCDIALOG_IDNAME ID_DIALOG #define SYMBOL_DRCDIALOG_IDNAME ID_DIALOG #define SYMBOL_DRCDIALOG_SIZE wxSize(400, 300) #define SYMBOL_DRCDIALOG_SIZE wxSize(400, 300) Loading Loading @@ -105,9 +106,6 @@ public: /// wxEVT_INIT_DIALOG event handler for ID_DIALOG /// wxEVT_INIT_DIALOG event handler for ID_DIALOG void OnInitDialog( wxInitDialogEvent& event ); void OnInitDialog( wxInitDialogEvent& event ); /// wxEVT_DESTROY event handler for ID_DIALOG void OnDestroy( wxWindowDestroyEvent& event ); /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_CHECKBOX /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_CHECKBOX void OnReportCheckBoxClicked( wxCommandEvent& event ); void OnReportCheckBoxClicked( wxCommandEvent& event ); Loading @@ -123,6 +121,9 @@ public: /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DELETE_ALL /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DELETE_ALL void OnDeleteAllClick( wxCommandEvent& event ); void OnDeleteAllClick( wxCommandEvent& event ); /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DELETE_ONE void OnDeleteOneClick( wxCommandEvent& event ); /// wxEVT_LEFT_DCLICK event handler for ID_CLEARANCE_LIST /// wxEVT_LEFT_DCLICK event handler for ID_CLEARANCE_LIST void OnLeftDClickClearance( wxMouseEvent& event ); void OnLeftDClickClearance( wxMouseEvent& event ); Loading Loading @@ -158,9 +159,7 @@ public: /// Should we show tooltips? /// Should we show tooltips? static bool ShowToolTips(); static bool ShowToolTips(); void CmdDrc(); void DelDRCMarkers(); void DelDRCMarkers(wxCommandEvent & event); void ListUnconnectedPads(wxCommandEvent & event); ////@begin DrcDialog member variables ////@begin DrcDialog member variables wxBoxSizer* m_MainSizer; wxBoxSizer* m_MainSizer; Loading @@ -175,6 +174,7 @@ public: wxCheckBox* m_UnconnectedTestCtrl; wxCheckBox* m_UnconnectedTestCtrl; wxButton* m_DeleteAllButton; wxButton* m_DeleteAllButton; wxButton* m_DeleteCurrentMarkerButton; wxButton* m_DeleteCurrentMarkerButton; wxNotebook* m_Notebook; DRCLISTBOX* m_ClearanceListBox; DRCLISTBOX* m_ClearanceListBox; DRCLISTBOX* m_UnconnectedListBox; DRCLISTBOX* m_UnconnectedListBox; wxStdDialogButtonSizer* StdDialogButtonSizer; wxStdDialogButtonSizer* StdDialogButtonSizer; Loading