660 lines
21 KiB
C++
660 lines
21 KiB
C++
/////////////////////////////////////////////////////////////////////////////
|
|
// Name: dialog_drc.cpp
|
|
// Purpose:
|
|
// Author: jean-pierre Charras
|
|
// Modified by:
|
|
// Created: 27/02/2006 20:42:00
|
|
// RCS-ID:
|
|
// Copyright: License GNU
|
|
// Licence:
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Generated by DialogBlocks (unregistered), 27/02/2006 20:42:00
|
|
|
|
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
|
|
#pragma implementation "dialog_drc.h"
|
|
#endif
|
|
|
|
// For compilers that support precompilation, includes "wx/wx.h".
|
|
#include "wx/wxprec.h"
|
|
|
|
#ifdef __BORLANDC__
|
|
#pragma hdrstop
|
|
#endif
|
|
|
|
#ifndef WX_PRECOMP
|
|
#include "wx/wx.h"
|
|
#endif
|
|
|
|
|
|
#include <wx/htmllbox.h>
|
|
#include <vector>
|
|
|
|
////@begin includes
|
|
////@end includes
|
|
|
|
#include "dialog_drc.h"
|
|
|
|
////@begin XPM images
|
|
////@end XPM images
|
|
|
|
|
|
/**
|
|
* Class DRCLISTBOX
|
|
* is used to display a DRC_LIST, which contains DRC_ITEM_OWNERs.
|
|
*/
|
|
class DRCLISTBOX : public wxHtmlListBox
|
|
{
|
|
private:
|
|
DRC_LIST* m_List; ///< wxHtmlListBox does not own the list items, we do
|
|
|
|
public:
|
|
DRCLISTBOX( wxWindow* parent, wxWindowID id = wxID_ANY,
|
|
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
|
long style = 0, const wxString& name = wxVListBoxNameStr)
|
|
: wxHtmlListBox( parent, id, pos, size, style, name )
|
|
{
|
|
}
|
|
|
|
|
|
/**
|
|
* 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
|
|
* displayed in the wxHtmlListBox
|
|
*/
|
|
void SetList( DRC_LIST* aList )
|
|
{
|
|
m_List = aList;
|
|
SetItemCount( aList->size() );
|
|
}
|
|
|
|
|
|
/**
|
|
* Function OnGetItem
|
|
* returns the html text associated with the given 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();
|
|
}
|
|
|
|
|
|
/**
|
|
* Function OnGetItem
|
|
* returns the html text associated with the given index 'n'.
|
|
* @param n An index into the list.
|
|
* @return wxString - the simply html text to show in the listbox.
|
|
*/
|
|
wxString OnGetItemMarkup( size_t n ) const
|
|
{
|
|
if( m_List )
|
|
return (*m_List)[n]->ShowHtml();
|
|
else
|
|
return wxString();
|
|
}
|
|
|
|
|
|
/**
|
|
* Function DeleteElement
|
|
* will delete one of the items in the list.
|
|
* @param ndx The index into the list to delete.
|
|
*/
|
|
void DeleteElmenent( int ndx )
|
|
{
|
|
if( m_List )
|
|
{
|
|
if( (size_t) ndx < m_List->size() )
|
|
{
|
|
m_List->erase( m_List->begin()+ndx );
|
|
SetItemCount( m_List->size() );
|
|
}
|
|
}
|
|
}
|
|
};
|
|
|
|
|
|
|
|
/*!
|
|
* WinEDA_DrcFrame type definition
|
|
*/
|
|
|
|
IMPLEMENT_DYNAMIC_CLASS( WinEDA_DrcFrame, wxDialog )
|
|
|
|
/*!
|
|
* WinEDA_DrcFrame event table definition
|
|
*/
|
|
|
|
BEGIN_EVENT_TABLE( WinEDA_DrcFrame, wxDialog )
|
|
|
|
////@begin WinEDA_DrcFrame event table entries
|
|
EVT_INIT_DIALOG( WinEDA_DrcFrame::OnInitDialog )
|
|
|
|
EVT_CHECKBOX( ID_CHECKBOX, WinEDA_DrcFrame::OnReportCheckBoxClicked )
|
|
|
|
EVT_BUTTON( ID_BUTTON_BROWSE_RPT_FILE, WinEDA_DrcFrame::OnButtonBrowseRptFileClick )
|
|
|
|
EVT_BUTTON( ID_STARTDRC, WinEDA_DrcFrame::OnStartdrcClick )
|
|
|
|
EVT_BUTTON( ID_LIST_UNCONNECTED, WinEDA_DrcFrame::OnListUnconnectedClick )
|
|
|
|
EVT_BUTTON( ID_DELETE_ALL, WinEDA_DrcFrame::OnDeleteAllClick )
|
|
|
|
EVT_BUTTON( wxID_CANCEL, WinEDA_DrcFrame::OnCancelClick )
|
|
|
|
EVT_BUTTON( wxID_OK, WinEDA_DrcFrame::OnOkClick )
|
|
|
|
////@end WinEDA_DrcFrame event table entries
|
|
|
|
|
|
// outside bracket: DialogBlocks does not know about the listbox events on a custom list box.
|
|
EVT_LISTBOX( ID_CLEARANCE_LIST, WinEDA_DrcFrame::OnMarkerSelectionEvent)
|
|
EVT_LISTBOX( ID_UNCONNECTED_LIST, WinEDA_DrcFrame::OnUnconnectedSelectionEvent)
|
|
|
|
END_EVENT_TABLE()
|
|
|
|
/*!
|
|
* WinEDA_DrcFrame constructors
|
|
*/
|
|
|
|
WinEDA_DrcFrame::WinEDA_DrcFrame( )
|
|
{
|
|
}
|
|
|
|
WinEDA_DrcFrame::WinEDA_DrcFrame( DRC_TESTER* aDrc_tester, WinEDA_PcbFrame* parent, wxDC * panelDC,
|
|
wxWindowID id,
|
|
const wxString& caption,
|
|
const wxPoint& pos,
|
|
const wxSize& size,
|
|
long style )
|
|
{
|
|
m_Tester = aDrc_tester;
|
|
|
|
m_Parent = parent;
|
|
m_DC = panelDC;
|
|
AbortDrc = FALSE;
|
|
|
|
Create(parent, id, caption, pos, size, style);
|
|
|
|
PutValueInLocalUnits( *m_SetClearance, g_DesignSettings.m_TrackClearence,
|
|
m_Parent->m_InternalUnits );
|
|
}
|
|
|
|
/*!
|
|
* WinEDA_DrcFrame creator
|
|
*/
|
|
|
|
bool WinEDA_DrcFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
|
|
{
|
|
////@begin WinEDA_DrcFrame member initialisation
|
|
m_MainSizer = NULL;
|
|
m_CommandSizer = NULL;
|
|
m_ClearenceTitle = NULL;
|
|
m_SetClearance = NULL;
|
|
m_CreateRptCtrl = NULL;
|
|
m_RptFilenameCtrl = NULL;
|
|
m_BrowseButton = NULL;
|
|
m_Pad2PadTestCtrl = NULL;
|
|
m_UnconnectedTestCtrl = NULL;
|
|
m_ZonesTestCtrl = NULL;
|
|
m_DeleteCurrentMarkerButton = NULL;
|
|
m_ClearanceListBox = NULL;
|
|
m_UnconnectedListBox = NULL;
|
|
StdDialogButtonSizer = NULL;
|
|
////@end WinEDA_DrcFrame member initialisation
|
|
|
|
|
|
////@begin WinEDA_DrcFrame creation
|
|
SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
|
|
wxDialog::Create( parent, id, caption, pos, size, style );
|
|
|
|
CreateControls();
|
|
if (GetSizer())
|
|
{
|
|
GetSizer()->SetSizeHints(this);
|
|
}
|
|
Centre();
|
|
////@end WinEDA_DrcFrame creation
|
|
|
|
|
|
// m_ClearanceListBox->SetList( &gList );
|
|
// m_UnconnectedListBox->SetList( &gList );
|
|
|
|
return true;
|
|
}
|
|
|
|
/*!
|
|
* Control creation for WinEDA_DrcFrame
|
|
*/
|
|
|
|
void WinEDA_DrcFrame::CreateControls()
|
|
{
|
|
SetFont( *g_DialogFont );
|
|
|
|
////@begin WinEDA_DrcFrame content construction
|
|
// Generated by DialogBlocks, Tue 27 Nov 2007 00:10:16 CST (unregistered)
|
|
|
|
WinEDA_DrcFrame* itemDialog1 = this;
|
|
|
|
m_MainSizer = new wxBoxSizer(wxVERTICAL);
|
|
itemDialog1->SetSizer(m_MainSizer);
|
|
|
|
m_CommandSizer = new wxBoxSizer(wxHORIZONTAL);
|
|
m_MainSizer->Add(m_CommandSizer, 0, wxGROW|wxALL, 5);
|
|
|
|
wxStaticBox* itemStaticBoxSizer4Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Options"));
|
|
wxStaticBoxSizer* itemStaticBoxSizer4 = new wxStaticBoxSizer(itemStaticBoxSizer4Static, wxHORIZONTAL);
|
|
m_CommandSizer->Add(itemStaticBoxSizer4, 20, wxGROW|wxTOP|wxBOTTOM, 8);
|
|
|
|
wxBoxSizer* itemBoxSizer5 = new wxBoxSizer(wxVERTICAL);
|
|
itemStaticBoxSizer4->Add(itemBoxSizer5, 2, wxGROW|wxALL, 5);
|
|
|
|
wxBoxSizer* itemBoxSizer6 = new wxBoxSizer(wxHORIZONTAL);
|
|
itemBoxSizer5->Add(itemBoxSizer6, 0, wxALIGN_LEFT|wxALL, 5);
|
|
|
|
m_ClearenceTitle = new wxStaticText( itemDialog1, wxID_STATIC, _("Clearance"), wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE );
|
|
itemBoxSizer6->Add(m_ClearenceTitle, 0, wxALIGN_TOP|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
|
|
|
|
itemBoxSizer6->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 10);
|
|
|
|
m_SetClearance = new wxTextCtrl( itemDialog1, ID_TEXTCTRL1, _T(""), wxDefaultPosition, wxSize(144, -1), 0 );
|
|
if (WinEDA_DrcFrame::ShowToolTips())
|
|
m_SetClearance->SetToolTip(_("In the clearance units, enter the clearance distance"));
|
|
itemBoxSizer6->Add(m_SetClearance, 1, wxALIGN_TOP|wxLEFT|wxRIGHT|wxBOTTOM|wxADJUST_MINSIZE, 5);
|
|
|
|
wxStaticBox* itemStaticBoxSizer10Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Create Report File"));
|
|
wxStaticBoxSizer* itemStaticBoxSizer10 = new wxStaticBoxSizer(itemStaticBoxSizer10Static, wxHORIZONTAL);
|
|
itemBoxSizer5->Add(itemStaticBoxSizer10, 1, wxGROW|wxALL, 5);
|
|
|
|
m_CreateRptCtrl = new wxCheckBox( itemDialog1, ID_CHECKBOX, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
|
|
m_CreateRptCtrl->SetValue(false);
|
|
if (WinEDA_DrcFrame::ShowToolTips())
|
|
m_CreateRptCtrl->SetToolTip(_("Enable writing report to this file"));
|
|
itemStaticBoxSizer10->Add(m_CreateRptCtrl, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
|
|
|
|
m_RptFilenameCtrl = new wxTextCtrl( itemDialog1, ID_TEXTCTRL3, _T(""), wxDefaultPosition, wxSize(250, -1), 0 );
|
|
if (WinEDA_DrcFrame::ShowToolTips())
|
|
m_RptFilenameCtrl->SetToolTip(_("Enter the report filename"));
|
|
itemStaticBoxSizer10->Add(m_RptFilenameCtrl, 2, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxTOP|wxBOTTOM, 5);
|
|
|
|
m_BrowseButton = new wxButton( itemDialog1, ID_BUTTON_BROWSE_RPT_FILE, _("..."), wxDefaultPosition, wxSize(35, -1), 0 );
|
|
if (WinEDA_DrcFrame::ShowToolTips())
|
|
m_BrowseButton->SetToolTip(_("Pick a filename interactively"));
|
|
itemStaticBoxSizer10->Add(m_BrowseButton, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxTOP|wxBOTTOM|wxADJUST_MINSIZE, 5);
|
|
|
|
wxStaticBox* itemStaticBoxSizer14Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Include Tests For:"));
|
|
wxStaticBoxSizer* itemStaticBoxSizer14 = new wxStaticBoxSizer(itemStaticBoxSizer14Static, wxVERTICAL);
|
|
itemStaticBoxSizer4->Add(itemStaticBoxSizer14, 0, wxGROW|wxALL, 5);
|
|
|
|
m_Pad2PadTestCtrl = new wxCheckBox( itemDialog1, ID_CHECKBOX2, _("Clearances"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
m_Pad2PadTestCtrl->SetValue(false);
|
|
if (WinEDA_DrcFrame::ShowToolTips())
|
|
m_Pad2PadTestCtrl->SetToolTip(_("Test pad to pad, pad to track, and track to track clearances"));
|
|
itemStaticBoxSizer14->Add(m_Pad2PadTestCtrl, 0, wxGROW|wxALL, 5);
|
|
|
|
m_UnconnectedTestCtrl = new wxCheckBox( itemDialog1, ID_CHECKBOX3, _("Unconnected"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
m_UnconnectedTestCtrl->SetValue(false);
|
|
if (WinEDA_DrcFrame::ShowToolTips())
|
|
m_UnconnectedTestCtrl->SetToolTip(_("Find unconnected pads and tracks"));
|
|
itemStaticBoxSizer14->Add(m_UnconnectedTestCtrl, 0, wxGROW|wxALL, 5);
|
|
|
|
m_ZonesTestCtrl = new wxCheckBox( itemDialog1, ID_CHECKBOX7, _("Zones"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
m_ZonesTestCtrl->SetValue(false);
|
|
if (WinEDA_DrcFrame::ShowToolTips())
|
|
m_ZonesTestCtrl->SetToolTip(_("Include zones in clearance or unconnected tests"));
|
|
itemStaticBoxSizer14->Add(m_ZonesTestCtrl, 0, wxGROW|wxALL, 5);
|
|
|
|
wxBoxSizer* itemBoxSizer18 = new wxBoxSizer(wxVERTICAL);
|
|
m_CommandSizer->Add(itemBoxSizer18, 0, wxALIGN_TOP|wxALL, 5);
|
|
|
|
wxButton* itemButton19 = new wxButton( itemDialog1, ID_STARTDRC, _("Start DRC"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
if (WinEDA_DrcFrame::ShowToolTips())
|
|
itemButton19->SetToolTip(_("Start the Design Rule Checker"));
|
|
itemButton19->SetForegroundColour(wxColour(202, 0, 0));
|
|
itemBoxSizer18->Add(itemButton19, 0, wxGROW|wxALL, 5);
|
|
|
|
wxButton* itemButton20 = new wxButton( itemDialog1, ID_LIST_UNCONNECTED, _("List Unconnected"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
if (WinEDA_DrcFrame::ShowToolTips())
|
|
itemButton20->SetToolTip(_("List unconnected pads or tracks"));
|
|
itemButton20->SetForegroundColour(wxColour(0, 0, 255));
|
|
itemBoxSizer18->Add(itemButton20, 0, wxGROW|wxALL, 5);
|
|
|
|
wxButton* itemButton21 = new wxButton( itemDialog1, ID_DELETE_ALL, _("Delete All Markers"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
if (WinEDA_DrcFrame::ShowToolTips())
|
|
itemButton21->SetToolTip(_("Delete every marker"));
|
|
itemButton21->SetForegroundColour(wxColour(0, 128, 0));
|
|
itemBoxSizer18->Add(itemButton21, 0, wxGROW|wxALL, 5);
|
|
|
|
m_DeleteCurrentMarkerButton = new wxButton( itemDialog1, ID_DELETE_ONE, _("Delete Current Marker"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
if (WinEDA_DrcFrame::ShowToolTips())
|
|
m_DeleteCurrentMarkerButton->SetToolTip(_("Delete the marker selected in the listBox below"));
|
|
m_DeleteCurrentMarkerButton->Enable(false);
|
|
itemBoxSizer18->Add(m_DeleteCurrentMarkerButton, 0, wxGROW|wxALL, 5);
|
|
|
|
wxStaticText* itemStaticText23 = new wxStaticText( itemDialog1, wxID_STATIC, _("Error Messages:"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
m_MainSizer->Add(itemStaticText23, 0, wxGROW|wxLEFT|wxRIGHT|wxADJUST_MINSIZE, 10);
|
|
|
|
wxNotebook* itemNotebook24 = new wxNotebook( itemDialog1, ID_NOTEBOOK1, wxDefaultPosition, wxDefaultSize, wxNB_DEFAULT|wxRAISED_BORDER );
|
|
#if !wxCHECK_VERSION(2,5,2)
|
|
wxNotebookSizer* itemNotebook24Sizer = new wxNotebookSizer(itemNotebook24);
|
|
#endif
|
|
|
|
m_ClearanceListBox = new DRCLISTBOX( itemNotebook24, ID_CLEARANCE_LIST, wxDefaultPosition, wxSize(100, 300), wxSUNKEN_BORDER|wxHSCROLL|wxVSCROLL );
|
|
if (WinEDA_DrcFrame::ShowToolTips())
|
|
m_ClearanceListBox->SetToolTip(_("MARKERs on the PCB, double click on any MARKER to go there in PCB"));
|
|
|
|
itemNotebook24->AddPage(m_ClearanceListBox, _("Distance Problem Markers"));
|
|
|
|
m_UnconnectedListBox = new DRCLISTBOX( itemNotebook24, ID_UNCONNECTED_LIST, wxDefaultPosition, wxSize(100, 100), wxSUNKEN_BORDER|wxHSCROLL|wxVSCROLL );
|
|
if (WinEDA_DrcFrame::ShowToolTips())
|
|
m_UnconnectedListBox->SetToolTip(_("Pad to pad, pad to track, and track to track clearance problems"));
|
|
|
|
itemNotebook24->AddPage(m_UnconnectedListBox, _("Unconnected"));
|
|
|
|
#if !wxCHECK_VERSION(2,5,2)
|
|
m_MainSizer->Add(itemNotebook24Sizer, 5, wxGROW|wxALL, 5);
|
|
#else
|
|
m_MainSizer->Add(itemNotebook24, 5, wxGROW|wxALL, 5);
|
|
#endif
|
|
|
|
StdDialogButtonSizer = new wxStdDialogButtonSizer;
|
|
|
|
m_MainSizer->Add(StdDialogButtonSizer, 0, wxGROW|wxALL, 10);
|
|
wxButton* itemButton28 = new wxButton( itemDialog1, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
itemButton28->SetForegroundColour(wxColour(0, 0, 255));
|
|
StdDialogButtonSizer->AddButton(itemButton28);
|
|
|
|
wxButton* itemButton29 = new wxButton( itemDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
itemButton29->SetDefault();
|
|
StdDialogButtonSizer->AddButton(itemButton29);
|
|
|
|
StdDialogButtonSizer->Realize();
|
|
|
|
// Set validators
|
|
m_CreateRptCtrl->SetValidator( wxGenericValidator(& s_CreateRptFileOpt) );
|
|
m_Pad2PadTestCtrl->SetValidator( wxGenericValidator(& s_Pad2PadTestOpt) );
|
|
m_UnconnectedTestCtrl->SetValidator( wxGenericValidator(& s_UnconnectedTestOpt) );
|
|
m_ZonesTestCtrl->SetValidator( wxGenericValidator(& s_ZonesTestOpt) );
|
|
// Connect events and objects
|
|
m_ClearanceListBox->Connect(ID_CLEARANCE_LIST, wxEVT_LEFT_DCLICK, wxMouseEventHandler(WinEDA_DrcFrame::OnLeftDClickClearance), NULL, this);
|
|
m_ClearanceListBox->Connect(ID_CLEARANCE_LIST, wxEVT_RIGHT_UP, wxMouseEventHandler(WinEDA_DrcFrame::OnRightUpClearance), NULL, this);
|
|
m_UnconnectedListBox->Connect(ID_UNCONNECTED_LIST, wxEVT_LEFT_DCLICK, wxMouseEventHandler(WinEDA_DrcFrame::OnLeftDClickUnconnected), NULL, this);
|
|
m_UnconnectedListBox->Connect(ID_UNCONNECTED_LIST, wxEVT_RIGHT_UP, wxMouseEventHandler(WinEDA_DrcFrame::OnRightUpUnconnected), NULL, this);
|
|
////@end WinEDA_DrcFrame content construction
|
|
}
|
|
|
|
/*!
|
|
* Should we show tooltips?
|
|
*/
|
|
|
|
bool WinEDA_DrcFrame::ShowToolTips()
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/*!
|
|
* Get bitmap resources
|
|
*/
|
|
|
|
wxBitmap WinEDA_DrcFrame::GetBitmapResource( const wxString& name )
|
|
{
|
|
// Bitmap retrieval
|
|
////@begin WinEDA_DrcFrame bitmap retrieval
|
|
wxUnusedVar(name);
|
|
return wxNullBitmap;
|
|
////@end WinEDA_DrcFrame bitmap retrieval
|
|
}
|
|
|
|
/*!
|
|
* Get icon resources
|
|
*/
|
|
|
|
wxIcon WinEDA_DrcFrame::GetIconResource( const wxString& name )
|
|
{
|
|
// Icon retrieval
|
|
////@begin WinEDA_DrcFrame icon retrieval
|
|
wxUnusedVar(name);
|
|
return wxNullIcon;
|
|
////@end WinEDA_DrcFrame icon retrieval
|
|
}
|
|
/*!
|
|
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DRC_RUN
|
|
*/
|
|
|
|
void WinEDA_DrcFrame::OnStartdrcClick( wxCommandEvent& event )
|
|
{
|
|
TestDrc(event);
|
|
}
|
|
|
|
/*!
|
|
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_STOP_CONTROL_DRC
|
|
*/
|
|
|
|
/*
|
|
void WinEDA_DrcFrame::OnStopControlDrcClick( wxCommandEvent& event )
|
|
{
|
|
if( DrcInProgress )
|
|
AbortDrc = TRUE;
|
|
else
|
|
wxBell();
|
|
}
|
|
*/
|
|
|
|
/*!
|
|
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_ERASE_DRC_MARKERS
|
|
*/
|
|
|
|
void WinEDA_DrcFrame::OnDeleteAllClick( wxCommandEvent& event )
|
|
{
|
|
DelDRCMarkers(event);
|
|
}
|
|
|
|
/*!
|
|
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_LIST_UNCONNECTED_PADS
|
|
*/
|
|
|
|
void WinEDA_DrcFrame::OnListUnconnectedClick( wxCommandEvent& event )
|
|
{
|
|
ListUnconnectedPads(event);
|
|
}
|
|
|
|
/*!
|
|
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON_BROWSE_RPT_FILE
|
|
*/
|
|
|
|
void WinEDA_DrcFrame::OnButtonBrowseRptFileClick( wxCommandEvent& event )
|
|
{
|
|
wxString FileName;
|
|
wxString Mask(wxT("*"));
|
|
wxString Ext(wxT(".rpt"));
|
|
|
|
FileName = m_Parent->m_CurrentScreen->m_FileName;
|
|
ChangeFileNameExt(FileName, wxT("-drc") + Ext);
|
|
Mask += Ext;
|
|
|
|
FileName = EDA_FileSelector( _("DRC Report file"),
|
|
wxEmptyString, /* Chemin par defaut */
|
|
FileName, /* nom fichier par defaut */
|
|
Ext, /* extension par defaut */
|
|
Mask, /* Masque d'affichage */
|
|
this,
|
|
wxFD_SAVE,
|
|
TRUE
|
|
);
|
|
if( FileName.IsEmpty() )
|
|
return;
|
|
|
|
m_RptFilenameCtrl->SetValue(FileName);
|
|
s_RptFilename = FileName;
|
|
}
|
|
|
|
|
|
/*!
|
|
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
|
|
*/
|
|
|
|
void WinEDA_DrcFrame::OnOkClick( wxCommandEvent& event )
|
|
{
|
|
s_Pad2PadTestOpt = m_Pad2PadTestCtrl->IsChecked();
|
|
s_UnconnectedTestOpt = m_UnconnectedTestCtrl->IsChecked();
|
|
s_ZonesTestOpt = m_ZonesTestCtrl->IsChecked();
|
|
s_CreateRptFileOpt = m_CreateRptCtrl->IsChecked();
|
|
event.Skip();
|
|
}
|
|
|
|
|
|
/*!
|
|
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
|
|
*/
|
|
|
|
void WinEDA_DrcFrame::OnCancelClick( wxCommandEvent& event )
|
|
{
|
|
////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in WinEDA_DrcFrame.
|
|
// Before editing this code, remove the block markers.
|
|
event.Skip();
|
|
////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in WinEDA_DrcFrame.
|
|
}
|
|
|
|
|
|
/*!
|
|
* wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_CHECKBOX1
|
|
*/
|
|
|
|
void WinEDA_DrcFrame::OnReportCheckBoxClicked( wxCommandEvent& event )
|
|
{
|
|
// @todo: see if the checkbox is selected, if so, enable the report name field
|
|
// and browse button, else disable them.
|
|
if( m_CreateRptCtrl->IsChecked() )
|
|
{
|
|
m_RptFilenameCtrl->Enable(true);
|
|
m_BrowseButton->Enable(true);
|
|
}
|
|
else
|
|
{
|
|
m_RptFilenameCtrl->Enable(false);
|
|
m_BrowseButton->Enable(false);
|
|
}
|
|
event.Skip();
|
|
}
|
|
|
|
|
|
/*!
|
|
* wxEVT_INIT_DIALOG event handler for ID_DIALOG
|
|
*/
|
|
|
|
void WinEDA_DrcFrame::OnInitDialog( wxInitDialogEvent& event )
|
|
{
|
|
wxCommandEvent junk;
|
|
|
|
// Set the initial status of the browse button and the text
|
|
// field for report name
|
|
OnReportCheckBoxClicked( junk );
|
|
|
|
AddUnitSymbol(*m_ClearenceTitle);
|
|
m_RptFilenameCtrl->SetValue(s_RptFilename);
|
|
|
|
m_SetClearance->SetFocus();
|
|
|
|
// deselect the existing text, seems SetFocus() wants to emulate
|
|
// Microsoft, which is not desireable here.
|
|
m_SetClearance->SetSelection(0,0);
|
|
|
|
event.Skip();
|
|
}
|
|
|
|
|
|
/*!
|
|
* wxEVT_LEFT_DCLICK event handler for ID_CLEARANCE_LIST
|
|
*/
|
|
|
|
void WinEDA_DrcFrame::OnLeftDClickClearance( wxMouseEvent& event )
|
|
{
|
|
int selection = m_ClearanceListBox->GetSelection();
|
|
|
|
if( selection != wxNOT_FOUND )
|
|
{
|
|
printf("get item number %d\n", selection );
|
|
|
|
// Find the selected MARKER in the PCB, position cursor there,
|
|
// and close this dialog.
|
|
EndModal( 0 );
|
|
}
|
|
|
|
event.Skip();
|
|
}
|
|
|
|
|
|
/*!
|
|
* wxEVT_RIGHT_UP event handler for ID_CLEARANCE_LIST
|
|
*/
|
|
|
|
void WinEDA_DrcFrame::OnRightUpUnconnected( wxMouseEvent& event )
|
|
{
|
|
event.Skip();
|
|
}
|
|
|
|
|
|
/*!
|
|
* wxEVT_RIGHT_UP event handler for ID_CLEARANCE_LIST
|
|
*/
|
|
|
|
void WinEDA_DrcFrame::OnRightUpClearance( wxMouseEvent& event )
|
|
{
|
|
////@begin wxEVT_RIGHT_UP event handler for ID_CLEARANCE_LIST in WinEDA_DrcFrame.
|
|
// Before editing this code, remove the block markers.
|
|
event.Skip();
|
|
////@end wxEVT_RIGHT_UP event handler for ID_CLEARANCE_LIST in WinEDA_DrcFrame.
|
|
}
|
|
|
|
|
|
/*!
|
|
* wxEVT_LEFT_DCLICK event handler for ID_UNCONNECTED_LIST
|
|
*/
|
|
|
|
void WinEDA_DrcFrame::OnLeftDClickUnconnected( wxMouseEvent& event )
|
|
{
|
|
int selection = m_UnconnectedListBox->GetSelection();
|
|
|
|
if( selection != wxNOT_FOUND )
|
|
{
|
|
printf("get item number %d\n", selection );
|
|
}
|
|
|
|
event.Skip();
|
|
}
|
|
|
|
|
|
void WinEDA_DrcFrame::OnMarkerSelectionEvent( wxCommandEvent& event )
|
|
{
|
|
int selection = event.GetSelection();
|
|
|
|
if( selection != wxNOT_FOUND )
|
|
{
|
|
// until a MARKER is selected, this button is not enabled.
|
|
m_DeleteCurrentMarkerButton->Enable(true);
|
|
printf("get Marker number %d\n", selection );
|
|
}
|
|
|
|
event.Skip();
|
|
}
|
|
|
|
void WinEDA_DrcFrame::OnUnconnectedSelectionEvent( wxCommandEvent& event )
|
|
{
|
|
int selection = event.GetSelection();
|
|
|
|
if( selection != wxNOT_FOUND )
|
|
{
|
|
printf("get Unconnected item number %d\n", selection );
|
|
}
|
|
|
|
event.Skip();
|
|
}
|
|
|