From 62bf20271bac466b1bf330b5a14e31b3e9dbe460 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Wed, 27 Jul 2016 14:53:45 +0200 Subject: [PATCH] Pcbnew, dialog plot: add a button (Run DRC) to run the DRC from the plot dialog. --- pcbnew/dialogs/dialog_drc.cpp | 53 ++++++++-------- pcbnew/dialogs/dialog_drc.h | 4 +- pcbnew/dialogs/dialog_gendrill.cpp | 17 ++--- pcbnew/dialogs/dialog_plot.cpp | 17 +++++ pcbnew/dialogs/dialog_plot.h | 1 + pcbnew/dialogs/dialog_plot_base.cpp | 10 ++- pcbnew/dialogs/dialog_plot_base.fbp | 98 +++++++++++++++++++++++++++++ pcbnew/dialogs/dialog_plot_base.h | 4 +- pcbnew/drc.cpp | 58 ++++++++--------- pcbnew/drc_stuff.h | 10 +-- pcbnew/edit.cpp | 2 +- 11 files changed, 202 insertions(+), 72 deletions(-) diff --git a/pcbnew/dialogs/dialog_drc.cpp b/pcbnew/dialogs/dialog_drc.cpp index 2c3725d5dd..4ec69cc199 100644 --- a/pcbnew/dialogs/dialog_drc.cpp +++ b/pcbnew/dialogs/dialog_drc.cpp @@ -41,13 +41,14 @@ * and run DRC tests */ -DIALOG_DRC_CONTROL::DIALOG_DRC_CONTROL( DRC* aTester, PCB_EDIT_FRAME* parent ) : - DIALOG_DRC_CONTROL_BASE( parent ) +DIALOG_DRC_CONTROL::DIALOG_DRC_CONTROL( DRC* aTester, PCB_EDIT_FRAME* aEditorFrame, + wxWindow* aParent ) : + DIALOG_DRC_CONTROL_BASE( aParent ) { m_tester = aTester; - m_Parent = parent; - m_currentBoard = m_Parent->GetBoard(); - m_BrdSettings = m_Parent->GetBoard()->GetDesignSettings(); + m_brdEditor = aEditorFrame; + m_currentBoard = m_brdEditor->GetBoard(); + m_BrdSettings = m_brdEditor->GetBoard()->GetDesignSettings(); InitValues(); @@ -60,7 +61,7 @@ DIALOG_DRC_CONTROL::DIALOG_DRC_CONTROL( DRC* aTester, PCB_EDIT_FRAME* parent ) : void DIALOG_DRC_CONTROL::OnActivateDlg( wxActivateEvent& event ) { - if( m_currentBoard != m_Parent->GetBoard() ) + if( m_currentBoard != m_brdEditor->GetBoard() ) { // If m_currentBoard is not the current parent board, // (for instance because a new board was loaded), @@ -74,7 +75,7 @@ void DIALOG_DRC_CONTROL::OnActivateDlg( wxActivateEvent& event ) // updating data which can be modified outside the dialog (DRC parameters, units ...) // because the dialog is not modal - m_BrdSettings = m_Parent->GetBoard()->GetDesignSettings(); + m_BrdSettings = m_brdEditor->GetBoard()->GetDesignSettings(); DisplayDRCValues(); } @@ -129,7 +130,7 @@ void DIALOG_DRC_CONTROL::SetDrcParmeters( ) m_BrdSettings.m_ViasMinSize = ValueFromTextCtrl( *m_SetViaMinSizeCtrl ); m_BrdSettings.m_MicroViasMinSize = ValueFromTextCtrl( *m_SetMicroViakMinSizeCtrl ); - m_Parent->GetBoard()->SetDesignSettings( m_BrdSettings ); + m_brdEditor->GetBoard()->SetDesignSettings( m_BrdSettings ); } @@ -181,7 +182,7 @@ void DIALOG_DRC_CONTROL::OnStartdrcClick( wxCommandEvent& event ) // run all the tests, with no UI at this time. m_Messages->Clear(); wxSafeYield(); // Allows time slice to refresh the m_Messages window - m_Parent->GetBoard()->m_Status_Pcb = 0; // Force full connectivity and ratsnest recalculations + m_brdEditor->GetBoard()->m_Status_Pcb = 0; // Force full connectivity and ratsnest recalculations m_tester->RunTests(m_Messages); m_Notebook->ChangeSelection( 0 ); // display the 1at tab "...Markers ..." @@ -279,7 +280,7 @@ void DIALOG_DRC_CONTROL::OnListUnconnectedClick( wxCommandEvent& event ) void DIALOG_DRC_CONTROL::OnButtonBrowseRptFileClick( wxCommandEvent& event ) { - wxFileName fn = m_Parent->GetBoard()->GetFileName(); + wxFileName fn = m_brdEditor->GetBoard()->GetFileName(); fn.SetExt( ReportFileExtension ); wxString prj_path = Prj().GetProjectPath(); @@ -338,16 +339,16 @@ void DIALOG_DRC_CONTROL::OnLeftDClickClearance( wxMouseEvent& event ) if( item ) { - m_Parent->CursorGoto( item->GetPointA() ); - m_Parent->GetGalCanvas()->GetView()->SetCenter( VECTOR2D( item->GetPointA() ) ); + m_brdEditor->CursorGoto( item->GetPointA() ); + m_brdEditor->GetGalCanvas()->GetView()->SetCenter( VECTOR2D( item->GetPointA() ) ); - // turn control over to m_Parent, hide this DIALOG_DRC_CONTROL window, + // turn control over to m_brdEditor, hide this DIALOG_DRC_CONTROL window, // no destruction so we can preserve listbox cursor Show( false ); // We do not want the clarification popup window. // when releasing the left button in the main window - m_Parent->SkipNextLeftButtonReleaseEvent(); + m_brdEditor->SkipNextLeftButtonReleaseEvent(); } } } @@ -391,8 +392,8 @@ void DIALOG_DRC_CONTROL::OnPopupMenu( wxCommandEvent& event ) if( item ) { - m_Parent->CursorGoto( pos ); - m_Parent->GetGalCanvas()->GetView()->SetCenter( VECTOR2D( item->GetPointA() ) ); + m_brdEditor->CursorGoto( pos ); + m_brdEditor->GetGalCanvas()->GetView()->SetCenter( VECTOR2D( item->GetPointA() ) ); Show( false ); } @@ -471,14 +472,14 @@ void DIALOG_DRC_CONTROL::OnLeftDClickUnconnected( wxMouseEvent& event ) const DRC_ITEM* item = m_UnconnectedListBox->GetItem( selection ); if( item ) { - m_Parent->CursorGoto( item->GetPointA() ); - m_Parent->GetGalCanvas()->GetView()->SetCenter( VECTOR2D( item->GetPointA() ) ); + m_brdEditor->CursorGoto( item->GetPointA() ); + m_brdEditor->GetGalCanvas()->GetView()->SetCenter( VECTOR2D( item->GetPointA() ) ); Show( false ); // We do not want the clarification popup window. // when releasing the left button in the main window - m_Parent->SkipNextLeftButtonReleaseEvent(); + m_brdEditor->SkipNextLeftButtonReleaseEvent(); } } } @@ -507,8 +508,8 @@ void DIALOG_DRC_CONTROL::OnMarkerSelectionEvent( wxCommandEvent& event ) const DRC_ITEM* item = m_ClearanceListBox->GetItem( selection ); if( item ) { - m_Parent->CursorGoto( item->GetPointA(), false ); - m_Parent->GetGalCanvas()->GetView()->SetCenter( VECTOR2D( item->GetPointA() ) ); + m_brdEditor->CursorGoto( item->GetPointA(), false ); + m_brdEditor->GetGalCanvas()->GetView()->SetCenter( VECTOR2D( item->GetPointA() ) ); } } @@ -530,8 +531,8 @@ void DIALOG_DRC_CONTROL::OnUnconnectedSelectionEvent( wxCommandEvent& event ) const DRC_ITEM* item = m_UnconnectedListBox->GetItem( selection ); if( item ) { - m_Parent->CursorGoto( item->GetPointA(), false ); - m_Parent->GetGalCanvas()->GetView()->SetCenter( VECTOR2D( item->GetPointA() ) ); + m_brdEditor->CursorGoto( item->GetPointA(), false ); + m_brdEditor->GetGalCanvas()->GetView()->SetCenter( VECTOR2D( item->GetPointA() ) ); } } @@ -541,13 +542,13 @@ void DIALOG_DRC_CONTROL::OnUnconnectedSelectionEvent( wxCommandEvent& event ) void DIALOG_DRC_CONTROL::RedrawDrawPanel() { - m_Parent->GetCanvas()->Refresh(); + m_brdEditor->GetCanvas()->Refresh(); } void DIALOG_DRC_CONTROL::DelDRCMarkers() { - m_Parent->SetCurItem( NULL ); // clear curr item, because it could be a DRC marker + m_brdEditor->SetCurItem( NULL ); // clear curr item, because it could be a DRC marker m_ClearanceListBox->DeleteAllItems(); m_UnconnectedListBox->DeleteAllItems(); m_DeleteCurrentMarkerButton->Enable( false ); @@ -586,7 +587,7 @@ bool DIALOG_DRC_CONTROL::writeReport( const wxString& aFullFileName ) int count; fprintf( fp, "** Drc report for %s **\n", - TO_UTF8( m_Parent->GetBoard()->GetFileName() ) ); + TO_UTF8( m_brdEditor->GetBoard()->GetFileName() ) ); wxDateTime now = wxDateTime::Now(); diff --git a/pcbnew/dialogs/dialog_drc.h b/pcbnew/dialogs/dialog_drc.h index d370792282..1b85ee4b3c 100644 --- a/pcbnew/dialogs/dialog_drc.h +++ b/pcbnew/dialogs/dialog_drc.h @@ -57,7 +57,7 @@ public: BOARD_DESIGN_SETTINGS m_BrdSettings; /// Constructors - DIALOG_DRC_CONTROL( DRC* aTester, PCB_EDIT_FRAME* parent ); + DIALOG_DRC_CONTROL( DRC* aTester, PCB_EDIT_FRAME* aEditorFrame, wxWindow* aParent ); ~DIALOG_DRC_CONTROL(){}; /** @@ -143,7 +143,7 @@ private: BOARD* m_currentBoard; // the board currently on test DRC* m_tester; - PCB_EDIT_FRAME* m_Parent; + PCB_EDIT_FRAME* m_brdEditor; }; #endif // _DIALOG_DRC_H_ diff --git a/pcbnew/dialogs/dialog_gendrill.cpp b/pcbnew/dialogs/dialog_gendrill.cpp index 9714444025..6acf60ed36 100644 --- a/pcbnew/dialogs/dialog_gendrill.cpp +++ b/pcbnew/dialogs/dialog_gendrill.cpp @@ -299,18 +299,19 @@ void DIALOG_GENDRILL::OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) wxFileName dirName = wxFileName::DirName( dirDialog.GetPath() ); - wxMessageDialog dialog( this, _( "Use a relative path? " ), - _( "Plot Output Directory" ), + fn = Prj().AbsolutePath( m_parent->GetBoard()->GetFileName() ); + wxString defaultPath = fn.GetPathWithSep(); + wxString msg; + msg.Printf( _( "Do you want to use a path relative to\n'%s'" ), + GetChars( defaultPath ) ); + + wxMessageDialog dialog( this, msg, _( "Plot Output Directory" ), wxYES_NO | wxICON_QUESTION | wxYES_DEFAULT ); if( dialog.ShowModal() == wxID_YES ) { - wxString boardFilePath = Prj().AbsolutePath( m_parent->GetBoard()->GetFileName() ); - - boardFilePath = wxPathOnly( boardFilePath ); - - if( !dirName.MakeRelativeTo( boardFilePath ) ) - wxMessageBox( _( "Cannot make path relative. The target volume is different from board file volume!" ), + if( !dirName.MakeRelativeTo( defaultPath ) ) + wxMessageBox( _( "Cannot make path relative (target volume different from file volume)!" ), _( "Plot Output Directory" ), wxOK | wxICON_ERROR ); } diff --git a/pcbnew/dialogs/dialog_plot.cpp b/pcbnew/dialogs/dialog_plot.cpp index 378dfaa119..976e080190 100644 --- a/pcbnew/dialogs/dialog_plot.cpp +++ b/pcbnew/dialogs/dialog_plot.cpp @@ -813,3 +813,20 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event ) if( !m_plotOpts.GetLayerSelection().any() ) DisplayError( this, _( "No layer selected" ) ); } + +#include +void DIALOG_PLOT::onRunDRC( wxCommandEvent& event ) +{ + PCB_EDIT_FRAME* parent = dynamic_cast( GetParent() ); + + if( parent ) + { + // First close an existing dialog if open + // (low probability, but can happen) + parent->GetDrcController()->DestroyDialog( wxID_OK ); + + // Open a new drc dialod, with the right parent frame + parent->GetDrcController()->ShowDialog( this ); + } +} + diff --git a/pcbnew/dialogs/dialog_plot.h b/pcbnew/dialogs/dialog_plot.h index 47f4692ace..52d47a0961 100644 --- a/pcbnew/dialogs/dialog_plot.h +++ b/pcbnew/dialogs/dialog_plot.h @@ -68,6 +68,7 @@ private: void SetPlotFormat( wxCommandEvent& event ); void OnSetScaleOpt( wxCommandEvent& event ); void CreateDrillFile( wxCommandEvent& event ); + virtual void onRunDRC( wxCommandEvent& event ) override; // orther functions void applyPlotSettings(); diff --git a/pcbnew/dialogs/dialog_plot_base.cpp b/pcbnew/dialogs/dialog_plot_base.cpp index 1cffba831c..e273fdd4ec 100644 --- a/pcbnew/dialogs/dialog_plot_base.cpp +++ b/pcbnew/dialogs/dialog_plot_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jan 1 2016) +// C++ code generated with wxFormBuilder (version Jul 24 2016) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -355,6 +355,12 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr m_buttonDrill = new wxButton( this, ID_CREATE_DRILL_FILE, _("Generate Drill File"), wxDefaultPosition, wxDefaultSize, 0 ); bSizerButtons->Add( m_buttonDrill, 0, wxALL, 5 ); + + bSizerButtons->Add( 10, 0, 1, wxEXPAND, 5 ); + + m_buttonDRC = new wxButton( this, wxID_ANY, _("Run DRC"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerButtons->Add( m_buttonDRC, 0, wxALL, 5 ); + m_buttonQuit = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 ); bSizerButtons->Add( m_buttonQuit, 0, wxALL, 5 ); @@ -400,6 +406,7 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr m_scaleOpt->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnSetScaleOpt ), NULL, this ); m_plotButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::Plot ), NULL, this ); m_buttonDrill->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::CreateDrillFile ), NULL, this ); + m_buttonDRC->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::onRunDRC ), NULL, this ); m_buttonQuit->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnQuit ), NULL, this ); this->Connect( m_menuItem1->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnPopUpLayers ) ); this->Connect( m_menuItem2->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnPopUpLayers ) ); @@ -420,6 +427,7 @@ DIALOG_PLOT_BASE::~DIALOG_PLOT_BASE() m_scaleOpt->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnSetScaleOpt ), NULL, this ); m_plotButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::Plot ), NULL, this ); m_buttonDrill->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::CreateDrillFile ), NULL, this ); + m_buttonDRC->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::onRunDRC ), NULL, this ); m_buttonQuit->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnQuit ), NULL, this ); this->Disconnect( ID_LAYER_FAB, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnPopUpLayers ) ); this->Disconnect( ID_SELECT_COPPER_LAYERS, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnPopUpLayers ) ); diff --git a/pcbnew/dialogs/dialog_plot_base.fbp b/pcbnew/dialogs/dialog_plot_base.fbp index cc0ee4ac3b..04d243e1a5 100644 --- a/pcbnew/dialogs/dialog_plot_base.fbp +++ b/pcbnew/dialogs/dialog_plot_base.fbp @@ -4201,6 +4201,104 @@ + + 5 + wxEXPAND + 1 + + 0 + protected + 10 + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Run DRC + + 0 + + + 0 + + 1 + m_buttonDRC + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + onRunDRC + + + + + + + + + + + + + + + + + + + + + + + + + 5 wxALL diff --git a/pcbnew/dialogs/dialog_plot_base.h b/pcbnew/dialogs/dialog_plot_base.h index 57088bcfd2..358a74ff71 100644 --- a/pcbnew/dialogs/dialog_plot_base.h +++ b/pcbnew/dialogs/dialog_plot_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jan 1 2016) +// C++ code generated with wxFormBuilder (version Jul 24 2016) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -109,6 +109,7 @@ class DIALOG_PLOT_BASE : public DIALOG_SHIM WX_HTML_REPORT_PANEL* m_messagesPanel; wxButton* m_plotButton; wxButton* m_buttonDrill; + wxButton* m_buttonDRC; wxButton* m_buttonQuit; wxMenu* m_popMenu; @@ -121,6 +122,7 @@ class DIALOG_PLOT_BASE : public DIALOG_SHIM virtual void OnSetScaleOpt( wxCommandEvent& event ) { event.Skip(); } virtual void Plot( wxCommandEvent& event ) { event.Skip(); } virtual void CreateDrillFile( wxCommandEvent& event ) { event.Skip(); } + virtual void onRunDRC( wxCommandEvent& event ) { event.Skip(); } virtual void OnQuit( wxCommandEvent& event ) { event.Skip(); } virtual void OnPopUpLayers( wxCommandEvent& event ) { event.Skip(); } diff --git a/pcbnew/drc.cpp b/pcbnew/drc.cpp index 31ebc50457..84df89604b 100644 --- a/pcbnew/drc.cpp +++ b/pcbnew/drc.cpp @@ -53,12 +53,12 @@ #include -void DRC::ShowDialog() +void DRC::ShowDialog( wxWindow* aParent ) { if( !m_drcDialog ) { - m_mainWindow->GetToolManager()->RunAction( COMMON_ACTIONS::selectionClear, true ); - m_drcDialog = new DIALOG_DRC_CONTROL( this, m_mainWindow ); + m_pcbEditorFrame->GetToolManager()->RunAction( COMMON_ACTIONS::selectionClear, true ); + m_drcDialog = new DIALOG_DRC_CONTROL( this, m_pcbEditorFrame, aParent ); updatePointers(); m_drcDialog->SetRptSettings( m_doCreateRptFile, m_rptFilename); @@ -88,7 +88,7 @@ void DRC::DestroyDialog( int aReason ) DRC::DRC( PCB_EDIT_FRAME* aPcbWindow ) { - m_mainWindow = aPcbWindow; + m_pcbEditorFrame = aPcbWindow; m_pcb = aPcbWindow->GetBoard(); m_drcDialog = NULL; @@ -132,7 +132,7 @@ int DRC::Drc( TRACK* aRefSegm, TRACK* aList ) { wxASSERT( m_currentMarker ); - m_mainWindow->SetMsgPanel( m_currentMarker ); + m_pcbEditorFrame->SetMsgPanel( m_currentMarker ); return BAD_DRC; } @@ -140,7 +140,7 @@ int DRC::Drc( TRACK* aRefSegm, TRACK* aList ) { wxASSERT( m_currentMarker ); - m_mainWindow->SetMsgPanel( m_currentMarker ); + m_pcbEditorFrame->SetMsgPanel( m_currentMarker ); return BAD_DRC; } @@ -155,7 +155,7 @@ int DRC::Drc( ZONE_CONTAINER* aArea, int aCornerIndex ) if( !doEdgeZoneDrc( aArea, aCornerIndex ) ) { wxASSERT( m_currentMarker ); - m_mainWindow->SetMsgPanel( m_currentMarker ); + m_pcbEditorFrame->SetMsgPanel( m_currentMarker ); return BAD_DRC; } @@ -167,7 +167,7 @@ void DRC::RunTests( wxTextCtrl* aMessages ) { // be sure m_pcb is the current board, not a old one // ( the board can be reloaded ) - m_pcb = m_mainWindow->GetBoard(); + m_pcb = m_pcbEditorFrame->GetBoard(); // Ensure ratsnest is up to date: if( (m_pcb->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK) == 0 ) @@ -178,7 +178,7 @@ void DRC::RunTests( wxTextCtrl* aMessages ) wxSafeYield(); } - m_mainWindow->Compile_Ratsnest( NULL, true ); + m_pcbEditorFrame->Compile_Ratsnest( NULL, true ); } // someone should have cleared the two lists before calling this. @@ -217,7 +217,7 @@ void DRC::RunTests( wxTextCtrl* aMessages ) wxSafeYield(); } - testTracks( aMessages ? aMessages->GetParent() : m_mainWindow, true ); + testTracks( aMessages ? aMessages->GetParent() : m_pcbEditorFrame, true ); // Before testing segments and unconnected, refill all zones: // this is a good caution, because filled areas can be outdated. @@ -227,7 +227,7 @@ void DRC::RunTests( wxTextCtrl* aMessages ) wxSafeYield(); } - m_mainWindow->Fill_All_Zones( aMessages ? aMessages->GetParent() : m_mainWindow, + m_pcbEditorFrame->Fill_All_Zones( aMessages ? aMessages->GetParent() : m_pcbEditorFrame, false ); // test zone clearances to other zones @@ -295,8 +295,8 @@ void DRC::ListUnconnectedPads() void DRC::updatePointers() { - // update my pointers, m_mainWindow is the only unchangeable one - m_pcb = m_mainWindow->GetBoard(); + // update my pointers, m_pcbEditorFrame is the only unchangeable one + m_pcb = m_pcbEditorFrame->GetBoard(); if( m_drcDialog ) // Use diag list boxes only in DRC dialog { @@ -325,7 +325,7 @@ bool DRC::doNetClass( NETCLASSPTR nc, wxString& msg ) m_currentMarker = fillMarker( DRCE_NETCLASS_CLEARANCE, msg, m_currentMarker ); m_pcb->Add( m_currentMarker ); - m_mainWindow->GetGalCanvas()->GetView()->Add( m_currentMarker ); + m_pcbEditorFrame->GetGalCanvas()->GetView()->Add( m_currentMarker ); m_currentMarker = 0; ret = false; } @@ -341,7 +341,7 @@ bool DRC::doNetClass( NETCLASSPTR nc, wxString& msg ) m_currentMarker = fillMarker( DRCE_NETCLASS_TRACKWIDTH, msg, m_currentMarker ); m_pcb->Add( m_currentMarker ); - m_mainWindow->GetGalCanvas()->GetView()->Add( m_currentMarker ); + m_pcbEditorFrame->GetGalCanvas()->GetView()->Add( m_currentMarker ); m_currentMarker = 0; ret = false; } @@ -356,7 +356,7 @@ bool DRC::doNetClass( NETCLASSPTR nc, wxString& msg ) m_currentMarker = fillMarker( DRCE_NETCLASS_VIASIZE, msg, m_currentMarker ); m_pcb->Add( m_currentMarker ); - m_mainWindow->GetGalCanvas()->GetView()->Add( m_currentMarker ); + m_pcbEditorFrame->GetGalCanvas()->GetView()->Add( m_currentMarker ); m_currentMarker = 0; ret = false; } @@ -371,7 +371,7 @@ bool DRC::doNetClass( NETCLASSPTR nc, wxString& msg ) m_currentMarker = fillMarker( DRCE_NETCLASS_VIADRILLSIZE, msg, m_currentMarker ); m_pcb->Add( m_currentMarker ); - m_mainWindow->GetGalCanvas()->GetView()->Add( m_currentMarker ); + m_pcbEditorFrame->GetGalCanvas()->GetView()->Add( m_currentMarker ); m_currentMarker = 0; ret = false; } @@ -386,7 +386,7 @@ bool DRC::doNetClass( NETCLASSPTR nc, wxString& msg ) m_currentMarker = fillMarker( DRCE_NETCLASS_uVIASIZE, msg, m_currentMarker ); m_pcb->Add( m_currentMarker ); - m_mainWindow->GetGalCanvas()->GetView()->Add( m_currentMarker ); + m_pcbEditorFrame->GetGalCanvas()->GetView()->Add( m_currentMarker ); m_currentMarker = 0; ret = false; } @@ -401,7 +401,7 @@ bool DRC::doNetClass( NETCLASSPTR nc, wxString& msg ) m_currentMarker = fillMarker( DRCE_NETCLASS_uVIADRILLSIZE, msg, m_currentMarker ); m_pcb->Add( m_currentMarker ); - m_mainWindow->GetGalCanvas()->GetView()->Add( m_currentMarker ); + m_pcbEditorFrame->GetGalCanvas()->GetView()->Add( m_currentMarker ); m_currentMarker = 0; ret = false; } @@ -466,7 +466,7 @@ void DRC::testPad2Pad() { wxASSERT( m_currentMarker ); m_pcb->Add( m_currentMarker ); - m_mainWindow->GetGalCanvas()->GetView()->Add( m_currentMarker ); + m_pcbEditorFrame->GetGalCanvas()->GetView()->Add( m_currentMarker ); m_currentMarker = 0; } } @@ -519,7 +519,7 @@ void DRC::testTracks( wxWindow *aActiveWindow, bool aShowProgressBar ) { wxASSERT( m_currentMarker ); m_pcb->Add( m_currentMarker ); - m_mainWindow->GetGalCanvas()->GetView()->Add( m_currentMarker ); + m_pcbEditorFrame->GetGalCanvas()->GetView()->Add( m_currentMarker ); m_currentMarker = 0; } } @@ -533,8 +533,8 @@ void DRC::testUnconnected() { if( (m_pcb->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK) == 0 ) { - wxClientDC dc( m_mainWindow->GetCanvas() ); - m_mainWindow->Compile_Ratsnest( &dc, true ); + wxClientDC dc( m_pcbEditorFrame->GetCanvas() ); + m_pcbEditorFrame->Compile_Ratsnest( &dc, true ); } if( m_pcb->GetRatsnestsCount() == 0 ) @@ -594,7 +594,7 @@ void DRC::testZones() m_currentMarker = fillMarker( test_area, DRCE_SUSPICIOUS_NET_FOR_ZONE_OUTLINE, m_currentMarker ); m_pcb->Add( m_currentMarker ); - m_mainWindow->GetGalCanvas()->GetView()->Add( m_currentMarker ); + m_pcbEditorFrame->GetGalCanvas()->GetView()->Add( m_currentMarker ); m_currentMarker = NULL; } } @@ -630,7 +630,7 @@ void DRC::testKeepoutAreas() m_currentMarker = fillMarker( segm, NULL, DRCE_TRACK_INSIDE_KEEPOUT, m_currentMarker ); m_pcb->Add( m_currentMarker ); - m_mainWindow->GetGalCanvas()->GetView()->Add( m_currentMarker ); + m_pcbEditorFrame->GetGalCanvas()->GetView()->Add( m_currentMarker ); m_currentMarker = 0; } } @@ -647,7 +647,7 @@ void DRC::testKeepoutAreas() m_currentMarker = fillMarker( segm, NULL, DRCE_VIA_INSIDE_KEEPOUT, m_currentMarker ); m_pcb->Add( m_currentMarker ); - m_mainWindow->GetGalCanvas()->GetView()->Add( m_currentMarker ); + m_pcbEditorFrame->GetGalCanvas()->GetView()->Add( m_currentMarker ); m_currentMarker = 0; } } @@ -708,7 +708,7 @@ void DRC::testTexts() DRCE_TRACK_INSIDE_TEXT, m_currentMarker ); m_pcb->Add( m_currentMarker ); - m_mainWindow->GetGalCanvas()->GetView()->Add( m_currentMarker ); + m_pcbEditorFrame->GetGalCanvas()->GetView()->Add( m_currentMarker ); m_currentMarker = NULL; break; } @@ -727,7 +727,7 @@ void DRC::testTexts() m_currentMarker = fillMarker( track, text, DRCE_VIA_INSIDE_TEXT, m_currentMarker ); m_pcb->Add( m_currentMarker ); - m_mainWindow->GetGalCanvas()->GetView()->Add( m_currentMarker ); + m_pcbEditorFrame->GetGalCanvas()->GetView()->Add( m_currentMarker ); m_currentMarker = NULL; break; } @@ -777,7 +777,7 @@ void DRC::testTexts() m_currentMarker = fillMarker( pad, text, DRCE_PAD_INSIDE_TEXT, m_currentMarker ); m_pcb->Add( m_currentMarker ); - m_mainWindow->GetGalCanvas()->GetView()->Add( m_currentMarker ); + m_pcbEditorFrame->GetGalCanvas()->GetView()->Add( m_currentMarker ); m_currentMarker = NULL; break; } diff --git a/pcbnew/drc_stuff.h b/pcbnew/drc_stuff.h index 492f314396..a8d378ff5d 100644 --- a/pcbnew/drc_stuff.h +++ b/pcbnew/drc_stuff.h @@ -193,17 +193,17 @@ private: int m_xcliphi; int m_ycliphi; - PCB_EDIT_FRAME* m_mainWindow; + PCB_EDIT_FRAME* m_pcbEditorFrame; ///< The pcb frame editor which owns the board BOARD* m_pcb; DIALOG_DRC_CONTROL* m_drcDialog; - DRC_LIST m_unconnected; ///< list of unconnected pads, as DRC_ITEMs + DRC_LIST m_unconnected; ///< list of unconnected pads, as DRC_ITEMs /** * Function updatePointers * is a private helper function used to update needed pointers from the - * one pointer which is known not to change, m_mainWindow. + * one pointer which is known not to change, m_pcbEditorFrame. */ void updatePointers(); @@ -441,8 +441,10 @@ public: * opens a dialog and prompts the user, then if a test run button is * clicked, runs the test(s) and creates the MARKERS. The dialog is only * created if it is not already in existence. + * @param aParent is the parent window for wxWidgets. Usually the PCB editor frame + * but can be an other dialog */ - void ShowDialog(); + void ShowDialog( wxWindow* aParent ); /** * Function DestroyDialog diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index 524f7cbd8d..d74f033e41 100644 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -294,7 +294,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) break; case ID_DRC_CONTROL: - m_drc->ShowDialog(); + m_drc->ShowDialog( this ); break; case ID_GET_NETLIST: