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
......
This diff is collapsed.
......@@ -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