Loading cvpcb/cvframe.cpp +414 −377 Original line number Original line Diff line number Diff line Loading @@ -43,8 +43,10 @@ WinEDA_CvpcbFrame::WinEDA_CvpcbFrame(WinEDA_App *parent, const wxString & title, SetAutoLayout( TRUE ); SetAutoLayout( TRUE ); GetSettings(); GetSettings(); if ( m_FrameSize.x < FRAME_MIN_SIZE_X ) m_FrameSize.x = FRAME_MIN_SIZE_X; if( m_FrameSize.x < FRAME_MIN_SIZE_X ) if ( m_FrameSize.y < FRAME_MIN_SIZE_Y ) m_FrameSize.y = FRAME_MIN_SIZE_Y; m_FrameSize.x = FRAME_MIN_SIZE_X; if( m_FrameSize.y < FRAME_MIN_SIZE_Y ) m_FrameSize.y = FRAME_MIN_SIZE_Y; // create the status bar // create the status bar int dims[3] = { -1, -1, 250 }; int dims[3] = { -1, -1, 250 }; Loading @@ -59,22 +61,24 @@ int dims[3] = { -1, -1, 250}; BuildFootprintListBox(); BuildFootprintListBox(); /* Creation des contraintes de dimension de la fenetre d'affichage des composants /* Creation des contraintes de dimension de la fenetre d'affichage des composants du schema */ * du schema */ wxLayoutConstraints* linkpos = new wxLayoutConstraints; wxLayoutConstraints* linkpos = new wxLayoutConstraints; linkpos->top.SameAs( this, wxTop ); linkpos->top.SameAs( this, wxTop ); linkpos->bottom.SameAs( this, wxBottom ); linkpos->bottom.SameAs( this, wxBottom ); linkpos->left.SameAs( this, wxLeft ); linkpos->left.SameAs( this, wxLeft ); linkpos->width.PercentOf( this, wxWidth, 66 ); linkpos->width.PercentOf( this, wxWidth, 66 ); if ( m_ListCmp ) m_ListCmp->SetConstraints(linkpos); if( m_ListCmp ) m_ListCmp->SetConstraints( linkpos ); /* Creation des contraintes de dimension de la fenetre d'affichage des modules /* Creation des contraintes de dimension de la fenetre d'affichage des modules de la librairie */ * de la librairie */ linkpos = new wxLayoutConstraints; linkpos = new wxLayoutConstraints; linkpos->top.SameAs( m_ListCmp, wxTop ); linkpos->top.SameAs( m_ListCmp, wxTop ); linkpos->bottom.SameAs( m_ListCmp, wxBottom ); linkpos->bottom.SameAs( m_ListCmp, wxBottom ); linkpos->right.SameAs( this, wxRight ); linkpos->right.SameAs( this, wxRight ); linkpos->left.SameAs( m_ListCmp, wxRight ); linkpos->left.SameAs( m_ListCmp, wxRight ); if ( m_FootprintList ) m_FootprintList->SetConstraints(linkpos); if( m_FootprintList ) m_FootprintList->SetConstraints( linkpos ); SetSizeHints( FRAME_MIN_SIZE_X, FRAME_MIN_SIZE_Y, -1, -1, -1, -1 ); // Set minimal size to w,h SetSizeHints( FRAME_MIN_SIZE_X, FRAME_MIN_SIZE_Y, -1, -1, -1, -1 ); // Set minimal size to w,h SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); Loading @@ -92,6 +96,7 @@ WinEDA_CvpcbFrame::~WinEDA_CvpcbFrame() } } } } /************************************************/ /************************************************/ void WinEDA_CvpcbFrame::OnSize( wxSizeEvent& event ) void WinEDA_CvpcbFrame::OnSize( wxSizeEvent& event ) /************************************************/ /************************************************/ Loading @@ -99,6 +104,7 @@ void WinEDA_CvpcbFrame::OnSize(wxSizeEvent& event) event.Skip(); event.Skip(); } } /***************************************************************/ /***************************************************************/ /* Construction de la table des evenements pour WinEDA_CvpcbFrame */ /* Construction de la table des evenements pour WinEDA_CvpcbFrame */ /***************************************************************/ /***************************************************************/ Loading Loading @@ -156,6 +162,7 @@ void WinEDA_CvpcbFrame::OnQuit(wxCommandEvent& event) Close( TRUE ); Close( TRUE ); } } /**********************************************************/ /**********************************************************/ void WinEDA_CvpcbFrame::OnCloseWindow( wxCloseEvent& Event ) void WinEDA_CvpcbFrame::OnCloseWindow( wxCloseEvent& Event ) /**********************************************************/ /**********************************************************/ Loading @@ -166,8 +173,12 @@ int diag; { { unsigned ii; unsigned ii; wxMessageDialog dialog( this, _( "Netlist and Cmp list modified, Save before exit ?" ), wxMessageDialog dialog( this, _( "Netlist and Cmp list modified, Save before exit ?" ), _("Confirmation"), wxYES_NO | wxCANCEL | wxICON_EXCLAMATION | wxYES_DEFAULT); _( "Confirmation" ), wxYES_NO | wxCANCEL | wxICON_EXCLAMATION | wxYES_DEFAULT ); ii = dialog.ShowModal(); ii = dialog.ShowModal(); switch( ii ) switch( ii ) { { case wxID_CANCEL: case wxID_CANCEL: Loading @@ -180,7 +191,8 @@ int diag; case wxID_OK: case wxID_OK: case wxID_YES: case wxID_YES: diag = SaveNetList( wxEmptyString ); diag = SaveNetList( wxEmptyString ); if( diag > 0 ) modified = 0; if( diag > 0 ) modified = 0; else if( diag == 0 ) else if( diag == 0 ) { { if( !IsOK( this, _( "Problem when saving files, Exit anyway" ) ) ) if( !IsOK( this, _( "Problem when saving files, Exit anyway" ) ) ) Loading Loading @@ -223,7 +235,6 @@ void WinEDA_CvpcbFrame::OnChar(wxKeyEvent& event) } } /*******************************************************/ /*******************************************************/ void WinEDA_CvpcbFrame::ToFirstNA( wxCommandEvent& event ) void WinEDA_CvpcbFrame::ToFirstNA( wxCommandEvent& event ) /*******************************************************/ /*******************************************************/ Loading @@ -233,7 +244,8 @@ int ii, selection;; Composant = g_BaseListeCmp; Composant = g_BaseListeCmp; selection = m_ListCmp->GetSelection(); selection = m_ListCmp->GetSelection(); if(selection < 0) selection = 0; if( selection < 0 ) selection = 0; for( ii = 0; Composant != NULL; Composant = Composant->Pnext ) for( ii = 0; Composant != NULL; Composant = Composant->Pnext ) { { if( Composant->m_Module.IsEmpty() && (ii > selection) ) if( Composant->m_Module.IsEmpty() && (ii > selection) ) Loading @@ -246,9 +258,11 @@ int ii, selection;; wxBell(); ii = selection; wxBell(); ii = selection; } } if ( g_BaseListeCmp ) m_ListCmp->SetSelection(ii); if( g_BaseListeCmp ) m_ListCmp->SetSelection( ii ); } } /**********************************************************/ /**********************************************************/ void WinEDA_CvpcbFrame::ToPreviousNA( wxCommandEvent& event ) void WinEDA_CvpcbFrame::ToPreviousNA( wxCommandEvent& event ) /**********************************************************/ /**********************************************************/ Loading @@ -258,11 +272,13 @@ int ii, selection; Composant = g_BaseListeCmp; Composant = g_BaseListeCmp; selection = m_ListCmp->GetSelection(); selection = m_ListCmp->GetSelection(); if(selection < 0) selection = 0; if( selection < 0 ) selection = 0; for( ii = 0; Composant != NULL; Composant = Composant->Pnext ) for( ii = 0; Composant != NULL; Composant = Composant->Pnext ) { { if( ii == selection ) break; if( ii == selection ) break; ii++; ii++; } } Loading @@ -278,7 +294,8 @@ int ii, selection; wxBell(); ii = selection; wxBell(); ii = selection; } } if ( g_BaseListeCmp ) m_ListCmp->SetSelection(ii); if( g_BaseListeCmp ) m_ListCmp->SetSelection( ii ); } } Loading @@ -293,9 +310,11 @@ void WinEDA_CvpcbFrame::SaveQuitCvpcb(wxCommandEvent& event) } } } } /*************************************************************/ /*************************************************************/ void WinEDA_CvpcbFrame::DelAssociations( wxCommandEvent& event ) void WinEDA_CvpcbFrame::DelAssociations( wxCommandEvent& event ) /*************************************************************/ /*************************************************************/ /* Supprime toutes les associations deja faites /* Supprime toutes les associations deja faites */ */ { { Loading @@ -312,6 +331,7 @@ wxString Line; m_ListCmp->SetSelection( ii ); m_ListCmp->SetSelection( ii ); SetNewPkg( wxEmptyString ); SetNewPkg( wxEmptyString ); } } m_ListCmp->SetSelection( 0 ); m_ListCmp->SetSelection( 0 ); composants_non_affectes = nbcomp; composants_non_affectes = nbcomp; } } Loading @@ -324,8 +344,9 @@ wxString Line; /***********************************************************/ /***********************************************************/ void WinEDA_CvpcbFrame::LoadNetList( wxCommandEvent& event ) void WinEDA_CvpcbFrame::LoadNetList( wxCommandEvent& event ) /***********************************************************/ /***********************************************************/ /* Fonction liee au boutton "Load" /* Fonction liee au boutton "Load" Lit la netliste * Lit la netliste */ */ { { int id = event.GetId(); int id = event.GetId(); Loading Loading @@ -354,6 +375,7 @@ bool newfile; fullfilename = GetLastProject( id ); fullfilename = GetLastProject( id ); break; break; } } newfile = ReadInputNetList( fullfilename ); newfile = ReadInputNetList( fullfilename ); if( newfile && !oldfilename.IsEmpty() ) if( newfile && !oldfilename.IsEmpty() ) { { Loading @@ -366,18 +388,21 @@ bool newfile; /***********************************************************/ /***********************************************************/ void WinEDA_CvpcbFrame::ConfigCvpcb( wxCommandEvent& event ) void WinEDA_CvpcbFrame::ConfigCvpcb( wxCommandEvent& event ) /***********************************************************/ /***********************************************************/ /* Fonction liee au boutton "Config" /* Fonction liee au boutton "Config" Affiche le panneau de configuration * Affiche le panneau de configuration */ */ { { CreateConfigWindow(); CreateConfigWindow(); } } /************************************************************/ /************************************************************/ void WinEDA_CvpcbFrame::DisplayModule( wxCommandEvent& event ) void WinEDA_CvpcbFrame::DisplayModule( wxCommandEvent& event ) /************************************************************/ /************************************************************/ /* Fonction liee au boutton "Visu" /* Fonction liee au boutton "Visu" Affiche l'ecran de visualisation des modules * Affiche l'ecran de visualisation des modules */ */ { { CreateScreenCmp(); CreateScreenCmp(); Loading @@ -389,10 +414,12 @@ void WinEDA_CvpcbFrame::DisplayModule(wxCommandEvent& event) /****************************************************************/ /****************************************************************/ void WinEDA_CvpcbFrame::AddFontSelectionMenu( wxMenu* main_menu ) void WinEDA_CvpcbFrame::AddFontSelectionMenu( wxMenu* main_menu ) /*****************************************************************/ /*****************************************************************/ /* create the submenu for fonte selection and setup fonte size /* create the submenu for fonte selection and setup fonte size */ */ { { wxMenu* fontmenu = new wxMenu(); wxMenu* fontmenu = new wxMenu(); ADD_MENUITEM( fontmenu, ID_PREFERENCES_FONT_DIALOG, _( "font for dialog boxes" ), ADD_MENUITEM( fontmenu, ID_PREFERENCES_FONT_DIALOG, _( "font for dialog boxes" ), fonts_xpm ); fonts_xpm ); ADD_MENUITEM( fontmenu, ID_PREFERENCES_FONT_INFOSCREEN, _( "font for Lists" ), ADD_MENUITEM( fontmenu, ID_PREFERENCES_FONT_INFOSCREEN, _( "font for Lists" ), Loading @@ -401,7 +428,8 @@ wxMenu * fontmenu = new wxMenu(); fonts_xpm ); fonts_xpm ); ADD_MENUITEM_WITH_HELP_AND_SUBMENU( main_menu, fontmenu, ADD_MENUITEM_WITH_HELP_AND_SUBMENU( main_menu, fontmenu, ID_PREFERENCES_FONT, _( "&Font selection" ), ID_PREFERENCES_FONT, _( "&Font selection" ), _("Choose font type and size for dialogs, infos and status box"), _( "Choose font type and size for dialogs, infos and status box" ), fonts_xpm ); fonts_xpm ); } } Loading @@ -416,15 +444,18 @@ int id = event.GetId(); m_Parent->SetLanguage(); m_Parent->SetLanguage(); } } /*************************************************************/ /*************************************************************/ void WinEDA_CvpcbFrame::DisplayDocFile( wxCommandEvent& event ) void WinEDA_CvpcbFrame::DisplayDocFile( wxCommandEvent& event ) /*************************************************************/ /*************************************************************/ { { wxString msg = FindKicadHelpPath(); wxString msg = FindKicadHelpPath(); msg += wxT( "pcbnew/footprints.pdf" ); msg += wxT( "pcbnew/footprints.pdf" ); GetAssociatedDocument( this, wxEmptyString, msg ); GetAssociatedDocument( this, wxEmptyString, msg ); } } /********************************************************************/ /********************************************************************/ void WinEDA_CvpcbFrame::ProcessFontPreferences( wxCommandEvent& event ) void WinEDA_CvpcbFrame::ProcessFontPreferences( wxCommandEvent& event ) /********************************************************************/ /********************************************************************/ Loading @@ -434,7 +465,6 @@ wxFont font; switch( id ) switch( id ) { { case ID_PREFERENCES_FONT: case ID_PREFERENCES_FONT: case ID_PREFERENCES_FONT_DIALOG: case ID_PREFERENCES_FONT_DIALOG: case ID_PREFERENCES_FONT_STATUS: case ID_PREFERENCES_FONT_STATUS: Loading @@ -455,11 +485,14 @@ wxFont font; } } break; break; } } default: DisplayError(this, wxT("WinEDA_DrawFrame::ProcessFontPreferences Internal Error") ); default: DisplayError( this, wxT( "WinEDA_DrawFrame::ProcessFontPreferences Internal Error" ) ); break; break; } } } } /******************************************************/ /******************************************************/ void WinEDA_CvpcbFrame::OnLeftClick( wxListEvent& event ) void WinEDA_CvpcbFrame::OnLeftClick( wxListEvent& event ) /******************************************************/ /******************************************************/ Loading @@ -467,6 +500,7 @@ void WinEDA_CvpcbFrame::OnLeftClick(wxListEvent& event) m_FootprintList->OnLeftClick( event ); m_FootprintList->OnLeftClick( event ); } } /******************************************************/ /******************************************************/ void WinEDA_CvpcbFrame::OnLeftDClick( wxListEvent& event ) void WinEDA_CvpcbFrame::OnLeftDClick( wxListEvent& event ) /******************************************************/ /******************************************************/ Loading @@ -474,6 +508,7 @@ void WinEDA_CvpcbFrame::OnLeftDClick(wxListEvent& event) m_FootprintList->OnLeftDClick( event ); m_FootprintList->OnLeftDClick( event ); } } /*************************************************************/ /*************************************************************/ void WinEDA_CvpcbFrame::OnSelectComponent( wxListEvent& event ) void WinEDA_CvpcbFrame::OnSelectComponent( wxListEvent& event ) /*************************************************************/ /*************************************************************/ Loading @@ -497,7 +532,8 @@ int selection; Component = g_BaseListeCmp; Component = g_BaseListeCmp; for( int ii = 0; Component != NULL; Component = Component->Pnext ) for( int ii = 0; Component != NULL; Component = Component->Pnext ) { { if( ii == selection ) break; if( ii == selection ) break; ii++; ii++; } } Loading @@ -514,10 +550,11 @@ int selection; /************************************************************************/ /************************************************************************/ void WinEDA_CvpcbFrame::OnSelectFilteringFootprint( wxCommandEvent& event ) void WinEDA_CvpcbFrame::OnSelectFilteringFootprint( wxCommandEvent& event ) /************************************************************************/ /************************************************************************/ /* Select full/filtered footprint display on tool click /* Select full/filtered footprint display on tool click */ */ { { wxListEvent l_event; wxListEvent l_event; OnSelectComponent( l_event ); OnSelectComponent( l_event ); } } pcbnew/dialog_drc.cpp +166 −44 Original line number Original line Diff line number Diff line Loading @@ -97,6 +97,81 @@ public: }; }; /** * Class DRC_LIST_UNCONNECTED * is an implementation of the interface named DRC_ITEM_LIST which uses * a vector of pointers to DRC_ITEMs to fulfill the interface. No ownership is taken of the * vector, which will reside in class DRC */ class DRC_LIST_UNCONNECTED : public DRC_ITEM_LIST { DRC_LIST* m_vector; public: DRC_LIST_UNCONNECTED( DRC_LIST* aList ) : m_vector(aList) { } /* no destructor since we do not own anything to delete, not even the BOARD. ~DRC_LIST_UNCONNECTED() {} */ //-----<Interface DRC_ITEM_LIST>--------------------------------------- void DeleteAllItems() { if( m_vector ) { for( unsigned i=0; i<m_vector->size(); ++i ) delete (*m_vector)[i]; m_vector->clear(); } } const DRC_ITEM* GetItem( int aIndex ) { if( m_vector && (unsigned)aIndex < m_vector->size() ) { const DRC_ITEM* item = (*m_vector)[aIndex]; return item; } return NULL; } void DeleteItem( int aIndex ) { if( m_vector && (unsigned)aIndex < m_vector->size() ) { delete (*m_vector)[aIndex]; m_vector->erase( m_vector->begin()+aIndex ); } } /** * Function GetCount * returns the number of items in the list. */ int GetCount() { if( m_vector ) { return m_vector->size(); } return 0; } //-----</Interface DRC_ITEM_LIST>-------------------------------------- }; /** /** * Class DRCLISTBOX * Class DRCLISTBOX * is used to display a DRC_ITEM_LIST. * is used to display a DRC_ITEM_LIST. Loading Loading @@ -192,14 +267,15 @@ public: { { if( m_list ) if( m_list ) { { int selection = GetSelection(); m_list->DeleteItem( aIndex ); m_list->DeleteItem( aIndex ); int count = m_list->GetCount(); int count = m_list->GetCount(); SetItemCount( count ); SetItemCount( count ); if( aIndex < count ) // if old selection >= new count SetSelection( aIndex ); if( selection >= count ) else SetSelection( count-1 ); // -1 is "no selection" SetSelection( aIndex-1 ); // -1 is no selection Refresh(); Refresh(); } } } } Loading Loading @@ -283,9 +359,6 @@ DrcDialog::DrcDialog( DRC* aTester, WinEDA_PcbFrame* parent, m_Parent = parent; m_Parent = parent; Create(parent, id, caption, pos, size, style); Create(parent, id, caption, pos, size, style); PutValueInLocalUnits( *m_SetClearance, g_DesignSettings.m_TrackClearence, m_Parent->m_InternalUnits ); } } /*! /*! Loading Loading @@ -556,7 +629,7 @@ void DrcDialog::OnStartdrcClick( wxCommandEvent& event ) SetCursor( wxCursor( wxCURSOR_WAIT ) ); SetCursor( wxCursor( wxCURSOR_WAIT ) ); wxYield(); // process the cursor change event and the redraw. wxYield(); // attempt to process the cursor change // run all the tests, with no UI at this time. // run all the tests, with no UI at this time. m_tester->RunTests(); m_tester->RunTests(); Loading @@ -566,12 +639,19 @@ void DrcDialog::OnStartdrcClick( wxCommandEvent& event ) { { FILE* fp = wxFopen( reportName, wxT( "w" ) ); FILE* fp = wxFopen( reportName, wxT( "w" ) ); m_tester->WriteReport( fp ); writeReport( fp ); fclose(fp); fclose(fp); // @todo put up message box saying we created the report wxString msg; //msg.Printf( _( "Report file <%s> created\n" ), s_RptFilename.GetData() ); msg.Printf( _( "Report file \"%s\" created" ), reportName.GetData() ); wxString caption( _("Disk File Report Completed") ); wxMessageDialog popupWindow( this, msg, caption ); popupWindow.ShowModal(); } } SetCursor( wxCursor( wxCURSOR_ARROW ) ); SetCursor( wxCursor( wxCURSOR_ARROW ) ); Loading Loading @@ -624,9 +704,8 @@ void DrcDialog::OnListUnconnectedClick( wxCommandEvent& event ) SetCursor( wxCursor( wxCURSOR_WAIT ) ); SetCursor( wxCursor( wxCURSOR_WAIT ) ); wxYield(); wxYield(); // attempt to process the cursor change // run all the tests, with no UI at this time. m_tester->ListUnconnectedPads(); m_tester->ListUnconnectedPads(); // Generate the report // Generate the report Loading @@ -634,19 +713,26 @@ void DrcDialog::OnListUnconnectedClick( wxCommandEvent& event ) { { FILE* fp = wxFopen( reportName, wxT( "w" ) ); FILE* fp = wxFopen( reportName, wxT( "w" ) ); m_tester->WriteReport( fp ); writeReport( fp ); fclose(fp); fclose(fp); // @todo put up message box saying we created the report wxString msg; //msg.Printf( _( "Report file <%s> created\n" ), s_RptFilename.GetData() ); msg.Printf( _( "Report file \"%s\" created" ), reportName.GetData() ); wxString caption( _("Disk File Report Completed") ); wxMessageDialog popupWindow( this, msg, caption ); popupWindow.ShowModal(); } } SetCursor( wxCursor( wxCURSOR_ARROW ) ); SetCursor( wxCursor( wxCURSOR_ARROW ) ); // @todo set the list counts in the DRCLISTITEMS here. /* there is currently nothing visible on the DrawPanel for unconnected pads RedrawDrawPanel(); RedrawDrawPanel(); */ } } /*! /*! Loading Loading @@ -690,8 +776,7 @@ void DrcDialog::OnOkClick( wxCommandEvent& event ) #endif #endif SetReturnCode( wxID_OK ); SetReturnCode( wxID_OK ); m_tester->DestroyDialog(); m_tester->DestroyDialog( wxID_OK ); // event.Skip(); } } Loading @@ -706,8 +791,7 @@ void DrcDialog::OnCancelClick( wxCommandEvent& event ) #endif #endif SetReturnCode( wxID_CANCEL ); SetReturnCode( wxID_CANCEL ); m_tester->DestroyDialog(); m_tester->DestroyDialog( wxID_CANCEL ); // event.Skip(); } } Loading Loading @@ -759,6 +843,10 @@ void DrcDialog::OnInitDialog( wxInitDialogEvent& event ) void DrcDialog::OnLeftDClickClearance( wxMouseEvent& event ) void DrcDialog::OnLeftDClickClearance( wxMouseEvent& event ) { { event.Skip(); // I am assuming that the double click actually changed the selected item. // please verify this. int selection = m_ClearanceListBox->GetSelection(); int selection = m_ClearanceListBox->GetSelection(); if( selection != wxNOT_FOUND ) if( selection != wxNOT_FOUND ) Loading @@ -769,18 +857,20 @@ void DrcDialog::OnLeftDClickClearance( wxMouseEvent& event ) if( item ) if( item ) { { // after the goto, process a button OK command later. // after the goto, process a button OK command later. /* wxCommandEvent cmd( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ); wxCommandEvent cmd( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ); ::wxPostEvent( GetEventHandler(), cmd ); ::wxPostEvent( GetEventHandler(), cmd ); */ m_Parent->CursorGoto( item->GetPosition() ); m_Parent->CursorGoto( item->GetPosition() ); } } // On linux, the double click is being propagated to the parent. The // turn control over to m_Parent, hide this DrcDialog window, // call to StopPropagation was an attempt to prevent this. // no destruction so we can preserve listbox cursor Hide(); event.StopPropagation(); // we handled the double click event here. event.StopPropagation(); // still get the popup window. // well that didn't work, we still get a popup menu } } } } Loading Loading @@ -812,28 +902,28 @@ void DrcDialog::OnRightUpClearance( wxMouseEvent& event ) void DrcDialog::OnLeftDClickUnconnected( wxMouseEvent& event ) void DrcDialog::OnLeftDClickUnconnected( wxMouseEvent& event ) { { event.Skip(); // I am assuming that the double click actually changed the selected item. // please verify this. int selection = m_UnconnectedListBox->GetSelection(); int selection = m_UnconnectedListBox->GetSelection(); if( selection != wxNOT_FOUND ) if( selection != wxNOT_FOUND ) { { // Find the selected DRC_ITEM in the DRC, position cursor there. // Find the selected DRC_ITEM in the listbox, position cursor there, // Then close the dialog. // at the first of the two pads. // Then hide the dialog. const DRC_ITEM* item = m_UnconnectedListBox->GetItem( selection ); const DRC_ITEM* item = m_UnconnectedListBox->GetItem( selection ); if( item ) if( item ) { { // after the goto, process a button OK command later. wxCommandEvent cmd( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ); ::wxPostEvent( GetEventHandler(), cmd ); m_Parent->CursorGoto( item->GetPosition() ); m_Parent->CursorGoto( item->GetPosition() ); } } // On linux, the double click is being propagated to the parent. The Hide(); // call to StopPropagation was an attempt to prevent this. event.StopPropagation(); // we handled the double click event here. // intermittently, still get the popup window, even with this. // well that didn't work, we still get a popup menu event.StopPropagation(); } } } } Loading Loading @@ -879,6 +969,33 @@ void DrcDialog::DelDRCMarkers() } } void DrcDialog::writeReport( FILE* fp ) { int count; fprintf( fp, "** Drc report for %s **\n", CONV_TO_UTF8( m_Parent->GetScreen()->m_FileName ) ); char line[256]; fprintf( fp, "** Created on %s **\n", DateAndTime( line ) ); //@todo make DateAndTime use localtime, not gmtime count = m_ClearanceListBox->GetItemCount(); fprintf( fp, "\n** Found %d DRC errors **\n", count ); for( int i=0; i<count; ++i ) fprintf( fp, m_ClearanceListBox->GetItem(i)->ShowReport().mb_str() ); count = m_UnconnectedListBox->GetItemCount(); fprintf( fp, "\n** Found %d unconnected pads **\n", count ); for( int i=0; i<count; ++i ) fprintf( fp, m_UnconnectedListBox->GetItem(i)->ShowReport().mb_str() ); fprintf( fp, "\n** End of Report **\n" ); } /*! /*! * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DELETE_ONE * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DELETE_ONE Loading @@ -895,6 +1012,8 @@ void DrcDialog::OnDeleteOneClick( wxCommandEvent& event ) if( selectedIndex != wxNOT_FOUND ) if( selectedIndex != wxNOT_FOUND ) { { m_ClearanceListBox->DeleteItem( selectedIndex ); m_ClearanceListBox->DeleteItem( selectedIndex ); // redraw the pcb RedrawDrawPanel(); RedrawDrawPanel(); } } } } Loading @@ -905,7 +1024,10 @@ void DrcDialog::OnDeleteOneClick( wxCommandEvent& event ) if( selectedIndex != wxNOT_FOUND ) if( selectedIndex != wxNOT_FOUND ) { { m_UnconnectedListBox->DeleteItem( selectedIndex ); m_UnconnectedListBox->DeleteItem( selectedIndex ); /* these unconnected DRC_ITEMs are not currently visible on the pcb RedrawDrawPanel(); RedrawDrawPanel(); */ } } } } Loading pcbnew/dialog_drc.h +10 −0 Original line number Original line Diff line number Diff line Loading @@ -85,6 +85,16 @@ class DrcDialog: public wxDialog DECLARE_DYNAMIC_CLASS( DrcDialog ) DECLARE_DYNAMIC_CLASS( DrcDialog ) DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE() /** * Function writeReport * outputs the MARKER items and unconnecte DRC_ITEMs with commentary to an * open text file. * @param fpOut The text file to write the report to. */ void writeReport( FILE* fpOut ); public: public: /// Constructors /// Constructors DrcDialog( ); DrcDialog( ); Loading Loading
cvpcb/cvframe.cpp +414 −377 Original line number Original line Diff line number Diff line Loading @@ -43,8 +43,10 @@ WinEDA_CvpcbFrame::WinEDA_CvpcbFrame(WinEDA_App *parent, const wxString & title, SetAutoLayout( TRUE ); SetAutoLayout( TRUE ); GetSettings(); GetSettings(); if ( m_FrameSize.x < FRAME_MIN_SIZE_X ) m_FrameSize.x = FRAME_MIN_SIZE_X; if( m_FrameSize.x < FRAME_MIN_SIZE_X ) if ( m_FrameSize.y < FRAME_MIN_SIZE_Y ) m_FrameSize.y = FRAME_MIN_SIZE_Y; m_FrameSize.x = FRAME_MIN_SIZE_X; if( m_FrameSize.y < FRAME_MIN_SIZE_Y ) m_FrameSize.y = FRAME_MIN_SIZE_Y; // create the status bar // create the status bar int dims[3] = { -1, -1, 250 }; int dims[3] = { -1, -1, 250 }; Loading @@ -59,22 +61,24 @@ int dims[3] = { -1, -1, 250}; BuildFootprintListBox(); BuildFootprintListBox(); /* Creation des contraintes de dimension de la fenetre d'affichage des composants /* Creation des contraintes de dimension de la fenetre d'affichage des composants du schema */ * du schema */ wxLayoutConstraints* linkpos = new wxLayoutConstraints; wxLayoutConstraints* linkpos = new wxLayoutConstraints; linkpos->top.SameAs( this, wxTop ); linkpos->top.SameAs( this, wxTop ); linkpos->bottom.SameAs( this, wxBottom ); linkpos->bottom.SameAs( this, wxBottom ); linkpos->left.SameAs( this, wxLeft ); linkpos->left.SameAs( this, wxLeft ); linkpos->width.PercentOf( this, wxWidth, 66 ); linkpos->width.PercentOf( this, wxWidth, 66 ); if ( m_ListCmp ) m_ListCmp->SetConstraints(linkpos); if( m_ListCmp ) m_ListCmp->SetConstraints( linkpos ); /* Creation des contraintes de dimension de la fenetre d'affichage des modules /* Creation des contraintes de dimension de la fenetre d'affichage des modules de la librairie */ * de la librairie */ linkpos = new wxLayoutConstraints; linkpos = new wxLayoutConstraints; linkpos->top.SameAs( m_ListCmp, wxTop ); linkpos->top.SameAs( m_ListCmp, wxTop ); linkpos->bottom.SameAs( m_ListCmp, wxBottom ); linkpos->bottom.SameAs( m_ListCmp, wxBottom ); linkpos->right.SameAs( this, wxRight ); linkpos->right.SameAs( this, wxRight ); linkpos->left.SameAs( m_ListCmp, wxRight ); linkpos->left.SameAs( m_ListCmp, wxRight ); if ( m_FootprintList ) m_FootprintList->SetConstraints(linkpos); if( m_FootprintList ) m_FootprintList->SetConstraints( linkpos ); SetSizeHints( FRAME_MIN_SIZE_X, FRAME_MIN_SIZE_Y, -1, -1, -1, -1 ); // Set minimal size to w,h SetSizeHints( FRAME_MIN_SIZE_X, FRAME_MIN_SIZE_Y, -1, -1, -1, -1 ); // Set minimal size to w,h SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); Loading @@ -92,6 +96,7 @@ WinEDA_CvpcbFrame::~WinEDA_CvpcbFrame() } } } } /************************************************/ /************************************************/ void WinEDA_CvpcbFrame::OnSize( wxSizeEvent& event ) void WinEDA_CvpcbFrame::OnSize( wxSizeEvent& event ) /************************************************/ /************************************************/ Loading @@ -99,6 +104,7 @@ void WinEDA_CvpcbFrame::OnSize(wxSizeEvent& event) event.Skip(); event.Skip(); } } /***************************************************************/ /***************************************************************/ /* Construction de la table des evenements pour WinEDA_CvpcbFrame */ /* Construction de la table des evenements pour WinEDA_CvpcbFrame */ /***************************************************************/ /***************************************************************/ Loading Loading @@ -156,6 +162,7 @@ void WinEDA_CvpcbFrame::OnQuit(wxCommandEvent& event) Close( TRUE ); Close( TRUE ); } } /**********************************************************/ /**********************************************************/ void WinEDA_CvpcbFrame::OnCloseWindow( wxCloseEvent& Event ) void WinEDA_CvpcbFrame::OnCloseWindow( wxCloseEvent& Event ) /**********************************************************/ /**********************************************************/ Loading @@ -166,8 +173,12 @@ int diag; { { unsigned ii; unsigned ii; wxMessageDialog dialog( this, _( "Netlist and Cmp list modified, Save before exit ?" ), wxMessageDialog dialog( this, _( "Netlist and Cmp list modified, Save before exit ?" ), _("Confirmation"), wxYES_NO | wxCANCEL | wxICON_EXCLAMATION | wxYES_DEFAULT); _( "Confirmation" ), wxYES_NO | wxCANCEL | wxICON_EXCLAMATION | wxYES_DEFAULT ); ii = dialog.ShowModal(); ii = dialog.ShowModal(); switch( ii ) switch( ii ) { { case wxID_CANCEL: case wxID_CANCEL: Loading @@ -180,7 +191,8 @@ int diag; case wxID_OK: case wxID_OK: case wxID_YES: case wxID_YES: diag = SaveNetList( wxEmptyString ); diag = SaveNetList( wxEmptyString ); if( diag > 0 ) modified = 0; if( diag > 0 ) modified = 0; else if( diag == 0 ) else if( diag == 0 ) { { if( !IsOK( this, _( "Problem when saving files, Exit anyway" ) ) ) if( !IsOK( this, _( "Problem when saving files, Exit anyway" ) ) ) Loading Loading @@ -223,7 +235,6 @@ void WinEDA_CvpcbFrame::OnChar(wxKeyEvent& event) } } /*******************************************************/ /*******************************************************/ void WinEDA_CvpcbFrame::ToFirstNA( wxCommandEvent& event ) void WinEDA_CvpcbFrame::ToFirstNA( wxCommandEvent& event ) /*******************************************************/ /*******************************************************/ Loading @@ -233,7 +244,8 @@ int ii, selection;; Composant = g_BaseListeCmp; Composant = g_BaseListeCmp; selection = m_ListCmp->GetSelection(); selection = m_ListCmp->GetSelection(); if(selection < 0) selection = 0; if( selection < 0 ) selection = 0; for( ii = 0; Composant != NULL; Composant = Composant->Pnext ) for( ii = 0; Composant != NULL; Composant = Composant->Pnext ) { { if( Composant->m_Module.IsEmpty() && (ii > selection) ) if( Composant->m_Module.IsEmpty() && (ii > selection) ) Loading @@ -246,9 +258,11 @@ int ii, selection;; wxBell(); ii = selection; wxBell(); ii = selection; } } if ( g_BaseListeCmp ) m_ListCmp->SetSelection(ii); if( g_BaseListeCmp ) m_ListCmp->SetSelection( ii ); } } /**********************************************************/ /**********************************************************/ void WinEDA_CvpcbFrame::ToPreviousNA( wxCommandEvent& event ) void WinEDA_CvpcbFrame::ToPreviousNA( wxCommandEvent& event ) /**********************************************************/ /**********************************************************/ Loading @@ -258,11 +272,13 @@ int ii, selection; Composant = g_BaseListeCmp; Composant = g_BaseListeCmp; selection = m_ListCmp->GetSelection(); selection = m_ListCmp->GetSelection(); if(selection < 0) selection = 0; if( selection < 0 ) selection = 0; for( ii = 0; Composant != NULL; Composant = Composant->Pnext ) for( ii = 0; Composant != NULL; Composant = Composant->Pnext ) { { if( ii == selection ) break; if( ii == selection ) break; ii++; ii++; } } Loading @@ -278,7 +294,8 @@ int ii, selection; wxBell(); ii = selection; wxBell(); ii = selection; } } if ( g_BaseListeCmp ) m_ListCmp->SetSelection(ii); if( g_BaseListeCmp ) m_ListCmp->SetSelection( ii ); } } Loading @@ -293,9 +310,11 @@ void WinEDA_CvpcbFrame::SaveQuitCvpcb(wxCommandEvent& event) } } } } /*************************************************************/ /*************************************************************/ void WinEDA_CvpcbFrame::DelAssociations( wxCommandEvent& event ) void WinEDA_CvpcbFrame::DelAssociations( wxCommandEvent& event ) /*************************************************************/ /*************************************************************/ /* Supprime toutes les associations deja faites /* Supprime toutes les associations deja faites */ */ { { Loading @@ -312,6 +331,7 @@ wxString Line; m_ListCmp->SetSelection( ii ); m_ListCmp->SetSelection( ii ); SetNewPkg( wxEmptyString ); SetNewPkg( wxEmptyString ); } } m_ListCmp->SetSelection( 0 ); m_ListCmp->SetSelection( 0 ); composants_non_affectes = nbcomp; composants_non_affectes = nbcomp; } } Loading @@ -324,8 +344,9 @@ wxString Line; /***********************************************************/ /***********************************************************/ void WinEDA_CvpcbFrame::LoadNetList( wxCommandEvent& event ) void WinEDA_CvpcbFrame::LoadNetList( wxCommandEvent& event ) /***********************************************************/ /***********************************************************/ /* Fonction liee au boutton "Load" /* Fonction liee au boutton "Load" Lit la netliste * Lit la netliste */ */ { { int id = event.GetId(); int id = event.GetId(); Loading Loading @@ -354,6 +375,7 @@ bool newfile; fullfilename = GetLastProject( id ); fullfilename = GetLastProject( id ); break; break; } } newfile = ReadInputNetList( fullfilename ); newfile = ReadInputNetList( fullfilename ); if( newfile && !oldfilename.IsEmpty() ) if( newfile && !oldfilename.IsEmpty() ) { { Loading @@ -366,18 +388,21 @@ bool newfile; /***********************************************************/ /***********************************************************/ void WinEDA_CvpcbFrame::ConfigCvpcb( wxCommandEvent& event ) void WinEDA_CvpcbFrame::ConfigCvpcb( wxCommandEvent& event ) /***********************************************************/ /***********************************************************/ /* Fonction liee au boutton "Config" /* Fonction liee au boutton "Config" Affiche le panneau de configuration * Affiche le panneau de configuration */ */ { { CreateConfigWindow(); CreateConfigWindow(); } } /************************************************************/ /************************************************************/ void WinEDA_CvpcbFrame::DisplayModule( wxCommandEvent& event ) void WinEDA_CvpcbFrame::DisplayModule( wxCommandEvent& event ) /************************************************************/ /************************************************************/ /* Fonction liee au boutton "Visu" /* Fonction liee au boutton "Visu" Affiche l'ecran de visualisation des modules * Affiche l'ecran de visualisation des modules */ */ { { CreateScreenCmp(); CreateScreenCmp(); Loading @@ -389,10 +414,12 @@ void WinEDA_CvpcbFrame::DisplayModule(wxCommandEvent& event) /****************************************************************/ /****************************************************************/ void WinEDA_CvpcbFrame::AddFontSelectionMenu( wxMenu* main_menu ) void WinEDA_CvpcbFrame::AddFontSelectionMenu( wxMenu* main_menu ) /*****************************************************************/ /*****************************************************************/ /* create the submenu for fonte selection and setup fonte size /* create the submenu for fonte selection and setup fonte size */ */ { { wxMenu* fontmenu = new wxMenu(); wxMenu* fontmenu = new wxMenu(); ADD_MENUITEM( fontmenu, ID_PREFERENCES_FONT_DIALOG, _( "font for dialog boxes" ), ADD_MENUITEM( fontmenu, ID_PREFERENCES_FONT_DIALOG, _( "font for dialog boxes" ), fonts_xpm ); fonts_xpm ); ADD_MENUITEM( fontmenu, ID_PREFERENCES_FONT_INFOSCREEN, _( "font for Lists" ), ADD_MENUITEM( fontmenu, ID_PREFERENCES_FONT_INFOSCREEN, _( "font for Lists" ), Loading @@ -401,7 +428,8 @@ wxMenu * fontmenu = new wxMenu(); fonts_xpm ); fonts_xpm ); ADD_MENUITEM_WITH_HELP_AND_SUBMENU( main_menu, fontmenu, ADD_MENUITEM_WITH_HELP_AND_SUBMENU( main_menu, fontmenu, ID_PREFERENCES_FONT, _( "&Font selection" ), ID_PREFERENCES_FONT, _( "&Font selection" ), _("Choose font type and size for dialogs, infos and status box"), _( "Choose font type and size for dialogs, infos and status box" ), fonts_xpm ); fonts_xpm ); } } Loading @@ -416,15 +444,18 @@ int id = event.GetId(); m_Parent->SetLanguage(); m_Parent->SetLanguage(); } } /*************************************************************/ /*************************************************************/ void WinEDA_CvpcbFrame::DisplayDocFile( wxCommandEvent& event ) void WinEDA_CvpcbFrame::DisplayDocFile( wxCommandEvent& event ) /*************************************************************/ /*************************************************************/ { { wxString msg = FindKicadHelpPath(); wxString msg = FindKicadHelpPath(); msg += wxT( "pcbnew/footprints.pdf" ); msg += wxT( "pcbnew/footprints.pdf" ); GetAssociatedDocument( this, wxEmptyString, msg ); GetAssociatedDocument( this, wxEmptyString, msg ); } } /********************************************************************/ /********************************************************************/ void WinEDA_CvpcbFrame::ProcessFontPreferences( wxCommandEvent& event ) void WinEDA_CvpcbFrame::ProcessFontPreferences( wxCommandEvent& event ) /********************************************************************/ /********************************************************************/ Loading @@ -434,7 +465,6 @@ wxFont font; switch( id ) switch( id ) { { case ID_PREFERENCES_FONT: case ID_PREFERENCES_FONT: case ID_PREFERENCES_FONT_DIALOG: case ID_PREFERENCES_FONT_DIALOG: case ID_PREFERENCES_FONT_STATUS: case ID_PREFERENCES_FONT_STATUS: Loading @@ -455,11 +485,14 @@ wxFont font; } } break; break; } } default: DisplayError(this, wxT("WinEDA_DrawFrame::ProcessFontPreferences Internal Error") ); default: DisplayError( this, wxT( "WinEDA_DrawFrame::ProcessFontPreferences Internal Error" ) ); break; break; } } } } /******************************************************/ /******************************************************/ void WinEDA_CvpcbFrame::OnLeftClick( wxListEvent& event ) void WinEDA_CvpcbFrame::OnLeftClick( wxListEvent& event ) /******************************************************/ /******************************************************/ Loading @@ -467,6 +500,7 @@ void WinEDA_CvpcbFrame::OnLeftClick(wxListEvent& event) m_FootprintList->OnLeftClick( event ); m_FootprintList->OnLeftClick( event ); } } /******************************************************/ /******************************************************/ void WinEDA_CvpcbFrame::OnLeftDClick( wxListEvent& event ) void WinEDA_CvpcbFrame::OnLeftDClick( wxListEvent& event ) /******************************************************/ /******************************************************/ Loading @@ -474,6 +508,7 @@ void WinEDA_CvpcbFrame::OnLeftDClick(wxListEvent& event) m_FootprintList->OnLeftDClick( event ); m_FootprintList->OnLeftDClick( event ); } } /*************************************************************/ /*************************************************************/ void WinEDA_CvpcbFrame::OnSelectComponent( wxListEvent& event ) void WinEDA_CvpcbFrame::OnSelectComponent( wxListEvent& event ) /*************************************************************/ /*************************************************************/ Loading @@ -497,7 +532,8 @@ int selection; Component = g_BaseListeCmp; Component = g_BaseListeCmp; for( int ii = 0; Component != NULL; Component = Component->Pnext ) for( int ii = 0; Component != NULL; Component = Component->Pnext ) { { if( ii == selection ) break; if( ii == selection ) break; ii++; ii++; } } Loading @@ -514,10 +550,11 @@ int selection; /************************************************************************/ /************************************************************************/ void WinEDA_CvpcbFrame::OnSelectFilteringFootprint( wxCommandEvent& event ) void WinEDA_CvpcbFrame::OnSelectFilteringFootprint( wxCommandEvent& event ) /************************************************************************/ /************************************************************************/ /* Select full/filtered footprint display on tool click /* Select full/filtered footprint display on tool click */ */ { { wxListEvent l_event; wxListEvent l_event; OnSelectComponent( l_event ); OnSelectComponent( l_event ); } }
pcbnew/dialog_drc.cpp +166 −44 Original line number Original line Diff line number Diff line Loading @@ -97,6 +97,81 @@ public: }; }; /** * Class DRC_LIST_UNCONNECTED * is an implementation of the interface named DRC_ITEM_LIST which uses * a vector of pointers to DRC_ITEMs to fulfill the interface. No ownership is taken of the * vector, which will reside in class DRC */ class DRC_LIST_UNCONNECTED : public DRC_ITEM_LIST { DRC_LIST* m_vector; public: DRC_LIST_UNCONNECTED( DRC_LIST* aList ) : m_vector(aList) { } /* no destructor since we do not own anything to delete, not even the BOARD. ~DRC_LIST_UNCONNECTED() {} */ //-----<Interface DRC_ITEM_LIST>--------------------------------------- void DeleteAllItems() { if( m_vector ) { for( unsigned i=0; i<m_vector->size(); ++i ) delete (*m_vector)[i]; m_vector->clear(); } } const DRC_ITEM* GetItem( int aIndex ) { if( m_vector && (unsigned)aIndex < m_vector->size() ) { const DRC_ITEM* item = (*m_vector)[aIndex]; return item; } return NULL; } void DeleteItem( int aIndex ) { if( m_vector && (unsigned)aIndex < m_vector->size() ) { delete (*m_vector)[aIndex]; m_vector->erase( m_vector->begin()+aIndex ); } } /** * Function GetCount * returns the number of items in the list. */ int GetCount() { if( m_vector ) { return m_vector->size(); } return 0; } //-----</Interface DRC_ITEM_LIST>-------------------------------------- }; /** /** * Class DRCLISTBOX * Class DRCLISTBOX * is used to display a DRC_ITEM_LIST. * is used to display a DRC_ITEM_LIST. Loading Loading @@ -192,14 +267,15 @@ public: { { if( m_list ) if( m_list ) { { int selection = GetSelection(); m_list->DeleteItem( aIndex ); m_list->DeleteItem( aIndex ); int count = m_list->GetCount(); int count = m_list->GetCount(); SetItemCount( count ); SetItemCount( count ); if( aIndex < count ) // if old selection >= new count SetSelection( aIndex ); if( selection >= count ) else SetSelection( count-1 ); // -1 is "no selection" SetSelection( aIndex-1 ); // -1 is no selection Refresh(); Refresh(); } } } } Loading Loading @@ -283,9 +359,6 @@ DrcDialog::DrcDialog( DRC* aTester, WinEDA_PcbFrame* parent, m_Parent = parent; m_Parent = parent; Create(parent, id, caption, pos, size, style); Create(parent, id, caption, pos, size, style); PutValueInLocalUnits( *m_SetClearance, g_DesignSettings.m_TrackClearence, m_Parent->m_InternalUnits ); } } /*! /*! Loading Loading @@ -556,7 +629,7 @@ void DrcDialog::OnStartdrcClick( wxCommandEvent& event ) SetCursor( wxCursor( wxCURSOR_WAIT ) ); SetCursor( wxCursor( wxCURSOR_WAIT ) ); wxYield(); // process the cursor change event and the redraw. wxYield(); // attempt to process the cursor change // run all the tests, with no UI at this time. // run all the tests, with no UI at this time. m_tester->RunTests(); m_tester->RunTests(); Loading @@ -566,12 +639,19 @@ void DrcDialog::OnStartdrcClick( wxCommandEvent& event ) { { FILE* fp = wxFopen( reportName, wxT( "w" ) ); FILE* fp = wxFopen( reportName, wxT( "w" ) ); m_tester->WriteReport( fp ); writeReport( fp ); fclose(fp); fclose(fp); // @todo put up message box saying we created the report wxString msg; //msg.Printf( _( "Report file <%s> created\n" ), s_RptFilename.GetData() ); msg.Printf( _( "Report file \"%s\" created" ), reportName.GetData() ); wxString caption( _("Disk File Report Completed") ); wxMessageDialog popupWindow( this, msg, caption ); popupWindow.ShowModal(); } } SetCursor( wxCursor( wxCURSOR_ARROW ) ); SetCursor( wxCursor( wxCURSOR_ARROW ) ); Loading Loading @@ -624,9 +704,8 @@ void DrcDialog::OnListUnconnectedClick( wxCommandEvent& event ) SetCursor( wxCursor( wxCURSOR_WAIT ) ); SetCursor( wxCursor( wxCURSOR_WAIT ) ); wxYield(); wxYield(); // attempt to process the cursor change // run all the tests, with no UI at this time. m_tester->ListUnconnectedPads(); m_tester->ListUnconnectedPads(); // Generate the report // Generate the report Loading @@ -634,19 +713,26 @@ void DrcDialog::OnListUnconnectedClick( wxCommandEvent& event ) { { FILE* fp = wxFopen( reportName, wxT( "w" ) ); FILE* fp = wxFopen( reportName, wxT( "w" ) ); m_tester->WriteReport( fp ); writeReport( fp ); fclose(fp); fclose(fp); // @todo put up message box saying we created the report wxString msg; //msg.Printf( _( "Report file <%s> created\n" ), s_RptFilename.GetData() ); msg.Printf( _( "Report file \"%s\" created" ), reportName.GetData() ); wxString caption( _("Disk File Report Completed") ); wxMessageDialog popupWindow( this, msg, caption ); popupWindow.ShowModal(); } } SetCursor( wxCursor( wxCURSOR_ARROW ) ); SetCursor( wxCursor( wxCURSOR_ARROW ) ); // @todo set the list counts in the DRCLISTITEMS here. /* there is currently nothing visible on the DrawPanel for unconnected pads RedrawDrawPanel(); RedrawDrawPanel(); */ } } /*! /*! Loading Loading @@ -690,8 +776,7 @@ void DrcDialog::OnOkClick( wxCommandEvent& event ) #endif #endif SetReturnCode( wxID_OK ); SetReturnCode( wxID_OK ); m_tester->DestroyDialog(); m_tester->DestroyDialog( wxID_OK ); // event.Skip(); } } Loading @@ -706,8 +791,7 @@ void DrcDialog::OnCancelClick( wxCommandEvent& event ) #endif #endif SetReturnCode( wxID_CANCEL ); SetReturnCode( wxID_CANCEL ); m_tester->DestroyDialog(); m_tester->DestroyDialog( wxID_CANCEL ); // event.Skip(); } } Loading Loading @@ -759,6 +843,10 @@ void DrcDialog::OnInitDialog( wxInitDialogEvent& event ) void DrcDialog::OnLeftDClickClearance( wxMouseEvent& event ) void DrcDialog::OnLeftDClickClearance( wxMouseEvent& event ) { { event.Skip(); // I am assuming that the double click actually changed the selected item. // please verify this. int selection = m_ClearanceListBox->GetSelection(); int selection = m_ClearanceListBox->GetSelection(); if( selection != wxNOT_FOUND ) if( selection != wxNOT_FOUND ) Loading @@ -769,18 +857,20 @@ void DrcDialog::OnLeftDClickClearance( wxMouseEvent& event ) if( item ) if( item ) { { // after the goto, process a button OK command later. // after the goto, process a button OK command later. /* wxCommandEvent cmd( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ); wxCommandEvent cmd( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ); ::wxPostEvent( GetEventHandler(), cmd ); ::wxPostEvent( GetEventHandler(), cmd ); */ m_Parent->CursorGoto( item->GetPosition() ); m_Parent->CursorGoto( item->GetPosition() ); } } // On linux, the double click is being propagated to the parent. The // turn control over to m_Parent, hide this DrcDialog window, // call to StopPropagation was an attempt to prevent this. // no destruction so we can preserve listbox cursor Hide(); event.StopPropagation(); // we handled the double click event here. event.StopPropagation(); // still get the popup window. // well that didn't work, we still get a popup menu } } } } Loading Loading @@ -812,28 +902,28 @@ void DrcDialog::OnRightUpClearance( wxMouseEvent& event ) void DrcDialog::OnLeftDClickUnconnected( wxMouseEvent& event ) void DrcDialog::OnLeftDClickUnconnected( wxMouseEvent& event ) { { event.Skip(); // I am assuming that the double click actually changed the selected item. // please verify this. int selection = m_UnconnectedListBox->GetSelection(); int selection = m_UnconnectedListBox->GetSelection(); if( selection != wxNOT_FOUND ) if( selection != wxNOT_FOUND ) { { // Find the selected DRC_ITEM in the DRC, position cursor there. // Find the selected DRC_ITEM in the listbox, position cursor there, // Then close the dialog. // at the first of the two pads. // Then hide the dialog. const DRC_ITEM* item = m_UnconnectedListBox->GetItem( selection ); const DRC_ITEM* item = m_UnconnectedListBox->GetItem( selection ); if( item ) if( item ) { { // after the goto, process a button OK command later. wxCommandEvent cmd( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ); ::wxPostEvent( GetEventHandler(), cmd ); m_Parent->CursorGoto( item->GetPosition() ); m_Parent->CursorGoto( item->GetPosition() ); } } // On linux, the double click is being propagated to the parent. The Hide(); // call to StopPropagation was an attempt to prevent this. event.StopPropagation(); // we handled the double click event here. // intermittently, still get the popup window, even with this. // well that didn't work, we still get a popup menu event.StopPropagation(); } } } } Loading Loading @@ -879,6 +969,33 @@ void DrcDialog::DelDRCMarkers() } } void DrcDialog::writeReport( FILE* fp ) { int count; fprintf( fp, "** Drc report for %s **\n", CONV_TO_UTF8( m_Parent->GetScreen()->m_FileName ) ); char line[256]; fprintf( fp, "** Created on %s **\n", DateAndTime( line ) ); //@todo make DateAndTime use localtime, not gmtime count = m_ClearanceListBox->GetItemCount(); fprintf( fp, "\n** Found %d DRC errors **\n", count ); for( int i=0; i<count; ++i ) fprintf( fp, m_ClearanceListBox->GetItem(i)->ShowReport().mb_str() ); count = m_UnconnectedListBox->GetItemCount(); fprintf( fp, "\n** Found %d unconnected pads **\n", count ); for( int i=0; i<count; ++i ) fprintf( fp, m_UnconnectedListBox->GetItem(i)->ShowReport().mb_str() ); fprintf( fp, "\n** End of Report **\n" ); } /*! /*! * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DELETE_ONE * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DELETE_ONE Loading @@ -895,6 +1012,8 @@ void DrcDialog::OnDeleteOneClick( wxCommandEvent& event ) if( selectedIndex != wxNOT_FOUND ) if( selectedIndex != wxNOT_FOUND ) { { m_ClearanceListBox->DeleteItem( selectedIndex ); m_ClearanceListBox->DeleteItem( selectedIndex ); // redraw the pcb RedrawDrawPanel(); RedrawDrawPanel(); } } } } Loading @@ -905,7 +1024,10 @@ void DrcDialog::OnDeleteOneClick( wxCommandEvent& event ) if( selectedIndex != wxNOT_FOUND ) if( selectedIndex != wxNOT_FOUND ) { { m_UnconnectedListBox->DeleteItem( selectedIndex ); m_UnconnectedListBox->DeleteItem( selectedIndex ); /* these unconnected DRC_ITEMs are not currently visible on the pcb RedrawDrawPanel(); RedrawDrawPanel(); */ } } } } Loading
pcbnew/dialog_drc.h +10 −0 Original line number Original line Diff line number Diff line Loading @@ -85,6 +85,16 @@ class DrcDialog: public wxDialog DECLARE_DYNAMIC_CLASS( DrcDialog ) DECLARE_DYNAMIC_CLASS( DrcDialog ) DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE() /** * Function writeReport * outputs the MARKER items and unconnecte DRC_ITEMs with commentary to an * open text file. * @param fpOut The text file to write the report to. */ void writeReport( FILE* fpOut ); public: public: /// Constructors /// Constructors DrcDialog( ); DrcDialog( ); Loading