Commit 08033923 authored by dickelbeck's avatar dickelbeck

another DRC progress update

parent 4fd9325f
......@@ -4,6 +4,14 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
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>
================================================================================
+pcbnew
......@@ -15,10 +23,8 @@ email address.
and testing is done.
* Made the DRC dialog modeless, so it can sit off to the side while the MARKER
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>
================================================================================
+pcbnew:
......@@ -42,7 +48,6 @@ email address.
* Revised BOARD::Visit() to know about BOARD::m_markers.
* Revised pcbnew/find.cpp to know about BOARD::m_markers.
* removed wxYield() from drc.cpp
Maybe finish the DRC rework tomorrow.
2007-Nov-26 UPDATE Dick Hollenbeck <dick@softplc.com>
......
......@@ -201,6 +201,7 @@ class BOARD : public BOARD_ITEM
friend class WinEDA_PcbFrame;
private:
std::vector<MARKER*> m_markers; ///< MARKERs for clearance problems, owned by pointer
// std::vector<MARKER*> m_markersUnconnected; ///< MARKERs for unconnected problems, owned by pointer
......@@ -269,6 +270,15 @@ public:
*/
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
* returns the MARKER at a given index.
......
......@@ -194,8 +194,7 @@ void BOARD::Delete( BOARD_ITEM* aBoardItem )
{
if( m_markers[i] == (MARKER*) aBoardItem )
{
delete m_markers[i];
m_markers.erase( m_markers.begin() + i );
DeleteMARKER( i );
break;
}
}
......@@ -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()
{
// the vector does not know how to delete the MARKER, it holds pointers
......
......@@ -39,14 +39,68 @@
////@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
* is used to display a DRC_LIST, which contains DRC_ITEM_OWNERs.
* is used to display a DRC_ITEM_LIST.
*/
class DRCLISTBOX : public wxHtmlListBox
{
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:
DRCLISTBOX( wxWindow* parent, wxWindowID id = wxID_ANY,
......@@ -54,36 +108,48 @@ public:
long style = 0, const wxString& name = wxVListBoxNameStr)
: wxHtmlListBox( parent, id, pos, size, style, name )
{
m_list = 0;
}
~DRCLISTBOX()
{
delete m_list; // I own it, I destroy it.
}
/**
* Function SetList
* sets the DRC_LIST for this listbox. However no ownership is
* given, the caller still owns the list and is responsible
* for deleting it.
* @param aList The DRC_LIST containing the DRC_ITEMs which will be
* sets the DRC_LIST for this listbox. Ownership of the DRC_ITEM_LIST is
* transfered to this DRCLISTBOX.
* @param aList The DRC_ITEM_LIST* containing the DRC_ITEMs which will be
* displayed in the wxHtmlListBox
*/
void SetList( DRC_LIST* aList )
void SetList( DRC_ITEM_LIST* aList )
{
m_List = aList;
SetItemCount( aList->size() );
delete m_list;
m_list = aList;
SetItemCount( aList->GetCount() );
Refresh();
}
/**
* 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.
* @return wxString - the simply html text to show in the listbox.
*/
wxString OnGetItem( size_t n ) const
{
if( m_List )
return (*m_List)[n]->ShowHtml();
else
return wxString();
if( m_list )
{
const DRC_ITEM* item = m_list->GetItem( (int) n );
if( item )
return item->ShowHtml();
}
return wxString();
}
......@@ -95,27 +161,44 @@ public:
*/
wxString OnGetItemMarkup( size_t n ) const
{
if( m_List )
return (*m_List)[n]->ShowHtml();
else
return wxString();
return OnGetItem( n );
}
/**
* Function DeleteElement
* 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 DeleteItem( int aIndex )
{
if( m_list )
{
m_list->DeleteItem( aIndex );
int count = m_list->GetCount();
SetItemCount( count );
if( aIndex < count )
SetSelection( aIndex );
else
SetSelection( aIndex-1 ); // -1 is no selection
Refresh();
}
}
/**
* Function DeleteAllItems
* deletes all items in the list.
*/
void DeleteElmenent( int ndx )
void DeleteAllItems()
{
if( m_List )
if( m_list )
{
if( (size_t) ndx < m_List->size() )
{
m_List->erase( m_List->begin()+ndx );
SetItemCount( m_List->size() );
}
m_list->DeleteAllItems();
SetItemCount(0);
SetSelection( -1 ); // -1 is no selection
Refresh();
}
}
};
......@@ -136,7 +219,6 @@ BEGIN_EVENT_TABLE( DrcDialog, wxDialog )
////@begin DrcDialog event table entries
EVT_INIT_DIALOG( DrcDialog::OnInitDialog )
EVT_WINDOW_DESTROY( DrcDialog::OnDestroy )
EVT_CHECKBOX( ID_CHECKBOX, DrcDialog::OnReportCheckBoxClicked )
......@@ -148,6 +230,8 @@ BEGIN_EVENT_TABLE( DrcDialog, wxDialog )
EVT_BUTTON( ID_DELETE_ALL, DrcDialog::OnDeleteAllClick )
EVT_BUTTON( ID_DELETE_ONE, DrcDialog::OnDeleteOneClick )
EVT_BUTTON( wxID_CANCEL, DrcDialog::OnCancelClick )
EVT_BUTTON( wxID_OK, DrcDialog::OnOkClick )
......@@ -205,6 +289,7 @@ bool DrcDialog::Create( wxWindow* parent, wxWindowID id, const wxString& caption
m_UnconnectedTestCtrl = NULL;
m_DeleteAllButton = NULL;
m_DeleteCurrentMarkerButton = NULL;
m_Notebook = NULL;
m_ClearanceListBox = NULL;
m_UnconnectedListBox = NULL;
StdDialogButtonSizer = NULL;
......@@ -223,10 +308,6 @@ bool DrcDialog::Create( wxWindow* parent, wxWindowID id, const wxString& caption
Centre();
////@end DrcDialog creation
// m_ClearanceListBox->SetList( &gList );
// m_UnconnectedListBox->SetList( &gList );
return true;
}
......@@ -239,7 +320,7 @@ void DrcDialog::CreateControls()
SetFont( *g_DialogFont );
////@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;
......@@ -339,27 +420,27 @@ void DrcDialog::CreateControls()
wxStaticText* itemStaticText22 = new wxStaticText( itemDialog1, wxID_STATIC, _("Error Messages:"), wxDefaultPosition, wxDefaultSize, 0 );
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)
wxNotebookSizer* itemNotebook23Sizer = new wxNotebookSizer(itemNotebook23);
wxNotebookSizer* m_NotebookSizer = new wxNotebookSizer(m_Notebook);
#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())
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())
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)
m_MainSizer->Add(itemNotebook23Sizer, 5, wxGROW|wxALL, 5);
m_MainSizer->Add(m_NotebookSizer, 5, wxGROW|wxALL, 5);
#else
m_MainSizer->Add(itemNotebook23, 5, wxGROW|wxALL, 5);
m_MainSizer->Add(m_Notebook, 5, wxGROW|wxALL, 5);
#endif
StdDialogButtonSizer = new wxStdDialogButtonSizer;
......@@ -376,7 +457,6 @@ void DrcDialog::CreateControls()
StdDialogButtonSizer->Realize();
// 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_RIGHT_UP, wxMouseEventHandler(DrcDialog::OnRightUpClearance), NULL, this);
m_UnconnectedListBox->Connect(ID_UNCONNECTED_LIST, wxEVT_LEFT_DCLICK, wxMouseEventHandler(DrcDialog::OnLeftDClickUnconnected), NULL, this);
......@@ -423,28 +503,68 @@ wxIcon DrcDialog::GetIconResource( const wxString& name )
return wxNullIcon;
////@end DrcDialog icon retrieval
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DRC_RUN
*/
void DrcDialog::OnStartdrcClick( wxCommandEvent& event )
{
CmdDrc();
}
wxString reportName;
if( m_CreateRptCtrl->IsChecked() ) // Create a file rpt
{
reportName = m_RptFilenameCtrl->GetValue();
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_STOP_CONTROL_DRC
*/
if( reportName.IsEmpty() )
{
wxCommandEvent junk;
OnButtonBrowseRptFileClick( junk );
}
/*
void DrcDialog::OnStopControlDrcClick( wxCommandEvent& event )
{
if( DrcInProgress )
AbortDrc = TRUE;
else
wxBell();
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() );
m_Parent->Erase_Marqueurs();
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() )
{
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();
// printf("done with tests\n");
}
*/
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_ERASE_DRC_MARKERS
......@@ -452,16 +572,67 @@ void DrcDialog::OnStopControlDrcClick( 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
*/
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();
}
/*!
......@@ -500,6 +671,12 @@ void DrcDialog::OnButtonBrowseRptFileClick( wxCommandEvent& event )
void DrcDialog::OnOkClick( wxCommandEvent& event )
{
#if defined(DEBUG)
printf("OK Button handler\n");
#endif
SetReturnCode( wxID_OK );
m_tester->DestroyDialog();
event.Skip();
}
......@@ -510,10 +687,13 @@ void DrcDialog::OnOkClick( wxCommandEvent& event )
void DrcDialog::OnCancelClick( wxCommandEvent& event )
{
////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in WinEDA_DrcFrame.
// Before editing this code, remove the block markers.
#if defined(DEBUG)
printf("Cancel Button handler\n");
#endif
SetReturnCode( wxID_CANCEL );
m_tester->DestroyDialog();
event.Skip();
////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in WinEDA_DrcFrame.
}
......@@ -569,11 +749,10 @@ void DrcDialog::OnLeftDClickClearance( wxMouseEvent& event )
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,
// and close this dialog.
EndModal( 0 );
// Find the selected MARKER in the PCB, position cursor there.
// Do not close this dialog for users with dual screens.
}
event.Skip();
......@@ -613,7 +792,7 @@ void DrcDialog::OnLeftDClickUnconnected( wxMouseEvent& event )
if( selection != wxNOT_FOUND )
{
printf("get item number %d\n", selection );
//printf("get item number %d\n", selection );
}
event.Skip();
......@@ -628,7 +807,7 @@ void DrcDialog::OnMarkerSelectionEvent( wxCommandEvent& event )
{
// until a MARKER is selected, this button is not enabled.
m_DeleteCurrentMarkerButton->Enable(true);
printf("get Marker number %d\n", selection );
//printf("get Marker number %d\n", selection );
}
event.Skip();
......@@ -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 )
{
////@begin wxEVT_DESTROY event handler for ID_DIALOG in WinEDA_DrcFrame.
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 )
{
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.
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.
}
......@@ -33,6 +33,7 @@
////@begin forward declarations
class wxBoxSizer;
class wxNotebook;
class DRCLISTBOX;
class wxStdDialogButtonSizer;
////@end forward declarations
......@@ -58,7 +59,7 @@ class wxStdDialogButtonSizer;
#define ID_NOTEBOOK1 10008
#define ID_CLEARANCE_LIST 10001
#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_IDNAME ID_DIALOG
#define SYMBOL_DRCDIALOG_SIZE wxSize(400, 300)
......@@ -105,9 +106,6 @@ public:
/// wxEVT_INIT_DIALOG event handler for ID_DIALOG
void OnInitDialog( wxInitDialogEvent& event );
/// wxEVT_DESTROY event handler for ID_DIALOG
void OnDestroy( wxWindowDestroyEvent& event );
/// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_CHECKBOX
void OnReportCheckBoxClicked( wxCommandEvent& event );
......@@ -123,6 +121,9 @@ public:
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DELETE_ALL
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
void OnLeftDClickClearance( wxMouseEvent& event );
......@@ -158,9 +159,7 @@ public:
/// Should we show tooltips?
static bool ShowToolTips();
void CmdDrc();
void DelDRCMarkers(wxCommandEvent & event);
void ListUnconnectedPads(wxCommandEvent & event);
void DelDRCMarkers();
////@begin DrcDialog member variables
wxBoxSizer* m_MainSizer;
......@@ -175,6 +174,7 @@ public:
wxCheckBox* m_UnconnectedTestCtrl;
wxButton* m_DeleteAllButton;
wxButton* m_DeleteCurrentMarkerButton;
wxNotebook* m_Notebook;
DRCLISTBOX* m_ClearanceListBox;
DRCLISTBOX* m_UnconnectedListBox;
wxStdDialogButtonSizer* StdDialogButtonSizer;
......
......@@ -219,7 +219,6 @@
<long name="use-xrc">0</long>
<long name="working-mode">0</long>
<string name="event-handler-0">"wxEVT_INIT_DIALOG|OnInitDialog|NONE||DrcDialog"</string>
<string name="event-handler-1">"wxEVT_DESTROY|OnDestroy|NONE||DrcDialog"</string>
<string name="proxy-Id name">"ID_DIALOG"</string>
<long name="proxy-Id value">10000</long>
<string name="proxy-Class">"DrcDialog"</string>
......@@ -250,10 +249,10 @@
<bool name="proxy-wxDEFAULT_DIALOG_STYLE">1</bool>
<bool name="proxy-wxCAPTION">0</bool>
<bool name="proxy-wxRESIZE_BORDER">1</bool>
<bool name="proxy-wxSYSTEM_MENU">0</bool>
<bool name="proxy-wxSYSTEM_MENU">1</bool>
<bool name="proxy-wxSTAY_ON_TOP">0</bool>
<bool name="proxy-wxDIALOG_NO_PARENT">0</bool>
<bool name="proxy-wxCLOSE_BOX">0</bool>
<bool name="proxy-wxCLOSE_BOX">1</bool>
<bool name="proxy-wxMAXIMIZE_BOX">1</bool>
<bool name="proxy-wxMINIMIZE_BOX">1</bool>
<bool name="proxy-wxDIALOG_MODAL">0</bool>
......@@ -1273,6 +1272,7 @@
<long name="locked">0</long>
<string name="created">"25/11/2007"</string>
<string name="proxy-type">"wbButtonProxy"</string>
<string name="event-handler-0">"wxEVT_COMMAND_BUTTON_CLICKED|OnDeleteOneClick|NONE||DrcDialog"</string>
<string name="proxy-Id name">"ID_DELETE_ONE"</string>
<long name="proxy-Id value">10007</long>
<string name="proxy-Name">""</string>
......@@ -1420,7 +1420,7 @@
<bool name="proxy-Separate files">0</bool>
<string name="proxy-Implementation filename">""</string>
<string name="proxy-Header filename">""</string>
<string name="proxy-Member variable name">""</string>
<string name="proxy-Member variable name">"m_Notebook"</string>
<bool name="proxy-Notebook sizer">1</bool>
<string name="proxy-Help text">""</string>
<string name="proxy-Tooltip text">""</string>
......
......@@ -60,100 +60,30 @@ void WinEDA_PcbFrame::Install_Test_DRC_Frame( wxDC* DC )
void DRC::ShowDialog()
{
updatePointers();
bool isNew = false;
if( !m_ui )
{
m_ui = new DrcDialog( this, m_mainWindow );
isNew = true;
}
updatePointers();
// @todo enter retentitive member data into the DrcDialog here
if( isNew )
m_ui->Show(true);
else
m_ui->Raise();
m_ui->Show(true);
// @todo capture the UI entered data into this DRC object. BUT in the OK handler
}
/*********************************************************/
void DrcDialog::DelDRCMarkers( wxCommandEvent& event )
/*********************************************************/
{
m_Parent->Erase_Marqueurs();
m_Parent->ReDrawPanel();
}
/****************************************************/
void DrcDialog::CmdDrc()
/****************************************************/
void DRC::DestroyDialog()
{
wxString reportName;
if( m_CreateRptCtrl->IsChecked() ) // Create a file rpt
if( m_ui )
{
reportName = m_RptFilenameCtrl->GetValue();
if( reportName.IsEmpty() )
{
wxCommandEvent junk;
OnButtonBrowseRptFileClick( junk );
}
reportName = m_RptFilenameCtrl->GetValue();
m_ui->Destroy();
m_ui = 0;
}
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();
m_Parent->ReDrawPanel();
SetCursor( wxCursor( wxCURSOR_WATCH ) );
// run all the tests, with no UI at this time.
m_tester->RunTests();
// 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.
// printf("done with tests\n");
}
/***************************************************************/
void DrcDialog::ListUnconnectedPads( wxCommandEvent& event )
/***************************************************************/
{
m_tester->testUnconnected();
// @todo do report here
}
......@@ -256,9 +186,35 @@ void DRC::RunTests()
// find and gather unconnected pads.
if( m_doUnconnectedTest )
testUnconnected();
// update the listboxes
updatePointers();
}
/***************************************************************/
void DRC::ListUnconnectedPads()
/***************************************************************/
{
// erase the MARKERs here.
m_pcb->DeleteMARKERs();
testUnconnected();
}
void DRC::updatePointers()
{
// update my pointers, m_mainWindow is the only unchangable one
m_drawPanel = m_mainWindow->DrawPanel;
m_pcb = m_mainWindow->m_Pcb;
m_ui->m_ClearanceListBox->SetList( new DRC_LIST_MARKERS( m_pcb ) );
}
void DRC::testTracks()
{
for( TRACK* segm = m_pcb->m_Track; segm && segm->Next(); segm=segm->Next() )
......
......@@ -204,7 +204,55 @@ class WinEDA_DrawPanel;
class MARKER;
class DrcDialog;
typedef std::vector<DRC_ITEM*> DRC_LIST;
/**
* Class DRC_ITEM_LIST
* provides an abstract interface of a DRC_ITEM* list manager. The details
* of the actual list architecture are hidden from the caller. Any class
* that implements this interface can then be used by a DRCLISTBOX class without
* it knowing the actual architecture of the list.
*/
class DRC_ITEM_LIST
{
public:
/**
* Function DeleteAllItems
* removes and deletes all the items in the list.
*/
virtual void DeleteAllItems() = 0;
/**
* Function GetItem
* retrieves a DRC_ITEM by pointer. The actual item remains owned by the
* list container.
* @param aIndex The 0 based index into the list of the desired item.
* @return const DRC_ITEM* - the desired item or NULL if aIndex is out of range.
*/
virtual const DRC_ITEM* GetItem( int aIndex ) = 0;
/**
* Function DeleteAllItems
* removes and deletes desired item from the list.
* @param aIndex The 0 based index into the list of the desired item which
* is to be deleted.
*/
virtual void DeleteItem( int aIndex ) = 0;
/**
* Function GetCount
* returns the number of items in the list.
*/
virtual int GetCount() = 0;
virtual ~DRC_ITEM_LIST() {}
};
/**
......@@ -261,12 +309,7 @@ private:
* is a private helper function used to update needed pointers from the
* one pointer which is known not to change, m_mainWindow.
*/
void updatePointers()
{
// update my pointers, m_mainWindow is the only unchangable one
m_drawPanel = m_mainWindow->DrawPanel;
m_pcb = m_mainWindow->m_Pcb;
}
void updatePointers();
/**
......@@ -415,10 +458,19 @@ public:
/**
* Function ShowDialog
* opens a dialog and prompts the user, then if a test run button is
* clicked, runs the test(s) and creates the MARKERS.
* clicked, runs the test(s) and creates the MARKERS. The dialog is only
* created if it is not already in existence.
*/
void ShowDialog();
/**
* Function DestroyDialog
* deletes this ui dialog box and zeros out its pointer to remember
* the state of the dialog's existence.
*/
void DestroyDialog();
/**
* Function SetSettings
......@@ -447,6 +499,14 @@ public:
*/
void RunTests();
/**
* Function ListUnconnectedPad
* gathers a list of all the unconnected pads and shows them in the
* dialog, and optionally prints a report of such.
*/
void ListUnconnectedPads();
/**
* Function WriteReport
......
......@@ -350,7 +350,6 @@ void WinEDA_PcbFrame::Erase_Marqueurs()
/*******************************************/
{
m_Pcb->DeleteMARKERs();
GetScreen()->SetModify();
GetScreen()->SetModify(); // @todo : why mark this if MARKERs are not saved in the *.brd file?
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment