kicad/pcbnew/dialog_drc.cpp

662 lines
20 KiB
C++
Raw Normal View History

2007-05-06 16:03:28 +00:00
/////////////////////////////////////////////////////////////////////////////
// Name: dialog_drc.cpp
2007-11-27 01:34:35 +00:00
// Purpose:
2007-05-06 16:03:28 +00:00
// Author: jean-pierre Charras
2007-11-27 01:34:35 +00:00
// Modified by:
2007-05-06 16:03:28 +00:00
// Created: 27/02/2006 20:42:00
2007-11-27 01:34:35 +00:00
// RCS-ID:
2007-05-06 16:03:28 +00:00
// Copyright: License GNU
2007-11-27 01:34:35 +00:00
// Licence:
2007-05-06 16:03:28 +00:00
/////////////////////////////////////////////////////////////////////////////
// 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
2007-11-27 01:34:35 +00:00
#include <wx/htmllbox.h>
#include <vector>
2007-05-06 16:03:28 +00:00
////@begin includes
////@end includes
#include "dialog_drc.h"
////@begin XPM images
////@end XPM images
2007-11-27 01:34:35 +00:00
/**
* Class DRCLISTBOX
2007-11-27 22:49:35 +00:00
* is used to display a DRC_LIST, which contains DRC_ITEM_OWNERs.
2007-11-27 01:34:35 +00:00
*/
class DRCLISTBOX : public wxHtmlListBox
{
private:
2007-11-27 22:49:35 +00:00
DRC_LIST* m_List; ///< wxHtmlListBox does not own the list items, we do
2007-11-27 01:34:35 +00:00
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 )
2007-11-27 22:49:35 +00:00
return (*m_List)[n]->ShowHtml();
2007-11-27 01:34:35 +00:00
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 )
2007-11-27 22:49:35 +00:00
return (*m_List)[n]->ShowHtml();
2007-11-27 01:34:35 +00:00
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() );
}
}
}
};
2007-05-06 16:03:28 +00:00
/*!
2007-12-01 03:42:52 +00:00
* DrcDialog type definition
2007-05-06 16:03:28 +00:00
*/
2007-12-01 03:42:52 +00:00
IMPLEMENT_DYNAMIC_CLASS( DrcDialog, wxDialog )
2007-05-06 16:03:28 +00:00
/*!
2007-12-01 03:42:52 +00:00
* DrcDialog event table definition
2007-05-06 16:03:28 +00:00
*/
2007-12-01 03:42:52 +00:00
BEGIN_EVENT_TABLE( DrcDialog, wxDialog )
2007-05-06 16:03:28 +00:00
2007-12-01 03:42:52 +00:00
////@begin DrcDialog event table entries
EVT_INIT_DIALOG( DrcDialog::OnInitDialog )
EVT_WINDOW_DESTROY( DrcDialog::OnDestroy )
2007-12-01 03:42:52 +00:00
EVT_CHECKBOX( ID_CHECKBOX, DrcDialog::OnReportCheckBoxClicked )
2007-12-01 03:42:52 +00:00
EVT_BUTTON( ID_BUTTON_BROWSE_RPT_FILE, DrcDialog::OnButtonBrowseRptFileClick )
2007-12-01 03:42:52 +00:00
EVT_BUTTON( ID_STARTDRC, DrcDialog::OnStartdrcClick )
2007-12-01 03:42:52 +00:00
EVT_BUTTON( ID_LIST_UNCONNECTED, DrcDialog::OnListUnconnectedClick )
2007-12-01 03:42:52 +00:00
EVT_BUTTON( ID_DELETE_ALL, DrcDialog::OnDeleteAllClick )
2007-11-13 09:35:39 +00:00
2007-12-01 03:42:52 +00:00
EVT_BUTTON( wxID_CANCEL, DrcDialog::OnCancelClick )
2007-11-13 09:35:39 +00:00
2007-12-01 03:42:52 +00:00
EVT_BUTTON( wxID_OK, DrcDialog::OnOkClick )
2007-11-27 01:34:35 +00:00
2007-12-01 03:42:52 +00:00
////@end DrcDialog event table entries
2007-05-06 16:03:28 +00:00
2007-11-27 01:34:35 +00:00
// outside bracket: DialogBlocks does not know about the listbox events on a custom list box.
2007-12-01 03:42:52 +00:00
EVT_LISTBOX( ID_CLEARANCE_LIST, DrcDialog::OnMarkerSelectionEvent)
EVT_LISTBOX( ID_UNCONNECTED_LIST, DrcDialog::OnUnconnectedSelectionEvent)
2007-11-27 01:34:35 +00:00
2007-05-06 16:03:28 +00:00
END_EVENT_TABLE()
/*!
2007-12-01 03:42:52 +00:00
* DrcDialog constructors
2007-05-06 16:03:28 +00:00
*/
2007-12-01 03:42:52 +00:00
DrcDialog::DrcDialog( )
2007-05-06 16:03:28 +00:00
{
}
2007-12-01 03:42:52 +00:00
DrcDialog::DrcDialog( DRC* aTester, WinEDA_PcbFrame* parent,
2007-11-13 09:35:39 +00:00
wxWindowID id,
const wxString& caption,
const wxPoint& pos,
const wxSize& size,
long style )
2007-05-06 16:03:28 +00:00
{
2007-12-01 03:42:52 +00:00
m_tester = aTester;
2007-11-27 22:49:35 +00:00
2007-11-13 09:35:39 +00:00
m_Parent = parent;
2007-05-06 16:03:28 +00:00
Create(parent, id, caption, pos, size, style);
2007-11-13 09:35:39 +00:00
PutValueInLocalUnits( *m_SetClearance, g_DesignSettings.m_TrackClearence,
m_Parent->m_InternalUnits );
2007-05-06 16:03:28 +00:00
}
/*!
* WinEDA_DrcFrame creator
*/
2007-12-01 03:42:52 +00:00
bool DrcDialog::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
2007-05-06 16:03:28 +00:00
{
2007-12-01 03:42:52 +00:00
////@begin DrcDialog member initialisation
m_MainSizer = NULL;
m_CommandSizer = NULL;
m_ClearenceTitle = NULL;
m_SetClearance = NULL;
2007-11-27 01:34:35 +00:00
m_CreateRptCtrl = NULL;
m_RptFilenameCtrl = NULL;
m_BrowseButton = NULL;
m_Pad2PadTestCtrl = NULL;
m_ZonesTestCtrl = NULL;
2007-12-01 03:42:52 +00:00
m_UnconnectedTestCtrl = NULL;
m_DeleteAllButton = NULL;
2007-11-27 01:34:35 +00:00
m_DeleteCurrentMarkerButton = NULL;
m_ClearanceListBox = NULL;
m_UnconnectedListBox = NULL;
2007-11-13 09:35:39 +00:00
StdDialogButtonSizer = NULL;
2007-12-01 03:42:52 +00:00
////@end DrcDialog member initialisation
2007-05-06 16:03:28 +00:00
2007-11-27 01:34:35 +00:00
2007-12-01 03:42:52 +00:00
////@begin DrcDialog creation
SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
wxDialog::Create( parent, id, caption, pos, size, style );
CreateControls();
2007-11-27 01:34:35 +00:00
if (GetSizer())
{
GetSizer()->SetSizeHints(this);
}
Centre();
2007-12-01 03:42:52 +00:00
////@end DrcDialog creation
2007-11-27 01:34:35 +00:00
2007-11-27 22:49:35 +00:00
// m_ClearanceListBox->SetList( &gList );
// m_UnconnectedListBox->SetList( &gList );
2007-11-27 01:34:35 +00:00
2007-05-06 16:03:28 +00:00
return true;
}
/*!
* Control creation for WinEDA_DrcFrame
*/
2007-12-01 03:42:52 +00:00
void DrcDialog::CreateControls()
2007-11-27 01:34:35 +00:00
{
2007-11-13 09:35:39 +00:00
SetFont( *g_DialogFont );
2007-11-27 01:34:35 +00:00
2007-12-01 03:42:52 +00:00
////@begin DrcDialog content construction
// Generated by DialogBlocks, Fri 30 Nov 2007 18:52:20 CST (unregistered)
2007-12-01 03:42:52 +00:00
DrcDialog* itemDialog1 = this;
m_MainSizer = new wxBoxSizer(wxVERTICAL);
itemDialog1->SetSizer(m_MainSizer);
m_CommandSizer = new wxBoxSizer(wxHORIZONTAL);
2007-11-13 09:35:39 +00:00
m_MainSizer->Add(m_CommandSizer, 0, wxGROW|wxALL, 5);
wxStaticBox* itemStaticBoxSizer4Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Options"));
2007-11-27 01:34:35 +00:00
wxStaticBoxSizer* itemStaticBoxSizer4 = new wxStaticBoxSizer(itemStaticBoxSizer4Static, wxHORIZONTAL);
2007-12-01 03:42:52 +00:00
m_CommandSizer->Add(itemStaticBoxSizer4, 3, wxGROW|wxTOP|wxBOTTOM, 8);
2007-11-27 01:34:35 +00:00
wxBoxSizer* itemBoxSizer5 = new wxBoxSizer(wxVERTICAL);
itemStaticBoxSizer4->Add(itemBoxSizer5, 2, wxGROW|wxALL, 5);
2007-11-27 01:34:35 +00:00
wxBoxSizer* itemBoxSizer6 = new wxBoxSizer(wxHORIZONTAL);
itemBoxSizer5->Add(itemBoxSizer6, 0, wxALIGN_LEFT|wxALL, 5);
2007-11-27 01:34:35 +00:00
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);
2007-11-27 01:34:35 +00:00
m_SetClearance = new wxTextCtrl( itemDialog1, ID_TEXTCTRL1, _T(""), wxDefaultPosition, wxSize(144, -1), 0 );
2007-12-01 03:42:52 +00:00
if (DrcDialog::ShowToolTips())
2007-11-27 01:34:35 +00:00
m_SetClearance->SetToolTip(_("In the clearance units, enter the clearance distance"));
itemBoxSizer6->Add(m_SetClearance, 1, wxALIGN_TOP|wxLEFT|wxRIGHT|wxBOTTOM|wxADJUST_MINSIZE, 5);
2007-12-01 03:42:52 +00:00
wxStaticBox* itemStaticBoxSizer9Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Create Report File"));
wxStaticBoxSizer* itemStaticBoxSizer9 = new wxStaticBoxSizer(itemStaticBoxSizer9Static, wxHORIZONTAL);
itemBoxSizer5->Add(itemStaticBoxSizer9, 1, wxGROW|wxALL, 5);
2007-11-27 01:34:35 +00:00
m_CreateRptCtrl = new wxCheckBox( itemDialog1, ID_CHECKBOX, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
m_CreateRptCtrl->SetValue(false);
2007-12-01 03:42:52 +00:00
if (DrcDialog::ShowToolTips())
2007-11-27 01:34:35 +00:00
m_CreateRptCtrl->SetToolTip(_("Enable writing report to this file"));
2007-12-01 03:42:52 +00:00
itemStaticBoxSizer9->Add(m_CreateRptCtrl, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
2007-11-27 01:34:35 +00:00
m_RptFilenameCtrl = new wxTextCtrl( itemDialog1, ID_TEXTCTRL3, _T(""), wxDefaultPosition, wxSize(250, -1), 0 );
2007-12-01 03:42:52 +00:00
if (DrcDialog::ShowToolTips())
2007-11-27 01:34:35 +00:00
m_RptFilenameCtrl->SetToolTip(_("Enter the report filename"));
2007-12-01 03:42:52 +00:00
itemStaticBoxSizer9->Add(m_RptFilenameCtrl, 2, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxTOP|wxBOTTOM, 5);
2007-11-27 01:34:35 +00:00
m_BrowseButton = new wxButton( itemDialog1, ID_BUTTON_BROWSE_RPT_FILE, _("..."), wxDefaultPosition, wxSize(35, -1), 0 );
2007-12-01 03:42:52 +00:00
if (DrcDialog::ShowToolTips())
2007-11-27 01:34:35 +00:00
m_BrowseButton->SetToolTip(_("Pick a filename interactively"));
2007-12-01 03:42:52 +00:00
itemStaticBoxSizer9->Add(m_BrowseButton, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxTOP|wxBOTTOM|wxADJUST_MINSIZE, 5);
2007-12-01 03:42:52 +00:00
wxStaticBox* itemStaticBoxSizer13Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Include Tests For:"));
wxStaticBoxSizer* itemStaticBoxSizer13 = new wxStaticBoxSizer(itemStaticBoxSizer13Static, wxVERTICAL);
itemStaticBoxSizer4->Add(itemStaticBoxSizer13, 0, wxGROW|wxALL, 5);
2007-12-01 03:42:52 +00:00
m_Pad2PadTestCtrl = new wxCheckBox( itemDialog1, ID_CHECKBOX2, _("Pad to pad"), wxDefaultPosition, wxDefaultSize, 0 );
2007-11-27 01:34:35 +00:00
m_Pad2PadTestCtrl->SetValue(false);
2007-12-01 03:42:52 +00:00
if (DrcDialog::ShowToolTips())
m_Pad2PadTestCtrl->SetToolTip(_("Include tests for clearances between pad to pads"));
itemStaticBoxSizer13->Add(m_Pad2PadTestCtrl, 0, wxGROW|wxALL, 5);
2007-11-27 01:34:35 +00:00
m_ZonesTestCtrl = new wxCheckBox( itemDialog1, ID_CHECKBOX7, _("Zones"), wxDefaultPosition, wxDefaultSize, 0 );
m_ZonesTestCtrl->SetValue(false);
2007-12-01 03:42:52 +00:00
if (DrcDialog::ShowToolTips())
2007-11-27 01:34:35 +00:00
m_ZonesTestCtrl->SetToolTip(_("Include zones in clearance or unconnected tests"));
2007-12-01 03:42:52 +00:00
itemStaticBoxSizer13->Add(m_ZonesTestCtrl, 0, wxGROW|wxALL, 5);
2007-11-27 01:34:35 +00:00
2007-12-01 03:42:52 +00:00
m_UnconnectedTestCtrl = new wxCheckBox( itemDialog1, ID_CHECKBOX3, _("Unconnected pads"), wxDefaultPosition, wxDefaultSize, 0 );
m_UnconnectedTestCtrl->SetValue(false);
if (DrcDialog::ShowToolTips())
m_UnconnectedTestCtrl->SetToolTip(_("Find unconnected pads"));
itemStaticBoxSizer13->Add(m_UnconnectedTestCtrl, 0, wxGROW|wxALL, 5);
wxBoxSizer* itemBoxSizer17 = new wxBoxSizer(wxVERTICAL);
m_CommandSizer->Add(itemBoxSizer17, 0, wxALIGN_TOP|wxALL, 5);
wxButton* itemButton18 = new wxButton( itemDialog1, ID_STARTDRC, _("Start DRC"), wxDefaultPosition, wxDefaultSize, 0 );
if (DrcDialog::ShowToolTips())
itemButton18->SetToolTip(_("Start the Design Rule Checker"));
itemButton18->SetForegroundColour(wxColour(202, 0, 0));
itemBoxSizer17->Add(itemButton18, 0, wxGROW|wxALL, 5);
wxButton* itemButton19 = new wxButton( itemDialog1, ID_LIST_UNCONNECTED, _("List Unconnected"), wxDefaultPosition, wxDefaultSize, 0 );
if (DrcDialog::ShowToolTips())
itemButton19->SetToolTip(_("List unconnected pads or tracks"));
itemButton19->SetForegroundColour(wxColour(0, 0, 255));
itemBoxSizer17->Add(itemButton19, 0, wxGROW|wxALL, 5);
m_DeleteAllButton = new wxButton( itemDialog1, ID_DELETE_ALL, _("Delete All Markers"), wxDefaultPosition, wxDefaultSize, 0 );
if (DrcDialog::ShowToolTips())
m_DeleteAllButton->SetToolTip(_("Delete every marker"));
m_DeleteAllButton->SetForegroundColour(wxColour(0, 128, 0));
itemBoxSizer17->Add(m_DeleteAllButton, 0, wxGROW|wxALL, 5);
2007-11-27 01:34:35 +00:00
m_DeleteCurrentMarkerButton = new wxButton( itemDialog1, ID_DELETE_ONE, _("Delete Current Marker"), wxDefaultPosition, wxDefaultSize, 0 );
2007-12-01 03:42:52 +00:00
if (DrcDialog::ShowToolTips())
2007-11-27 01:34:35 +00:00
m_DeleteCurrentMarkerButton->SetToolTip(_("Delete the marker selected in the listBox below"));
m_DeleteCurrentMarkerButton->Enable(false);
2007-12-01 03:42:52 +00:00
itemBoxSizer17->Add(m_DeleteCurrentMarkerButton, 0, wxGROW|wxALL, 5);
2007-11-27 01:34:35 +00:00
2007-12-01 03:42:52 +00:00
wxStaticText* itemStaticText22 = new wxStaticText( itemDialog1, wxID_STATIC, _("Error Messages:"), wxDefaultPosition, wxDefaultSize, 0 );
m_MainSizer->Add(itemStaticText22, 0, wxGROW|wxLEFT|wxRIGHT|wxADJUST_MINSIZE, 10);
2007-11-27 01:34:35 +00:00
2007-12-01 03:42:52 +00:00
wxNotebook* itemNotebook23 = new wxNotebook( itemDialog1, ID_NOTEBOOK1, wxDefaultPosition, wxDefaultSize, wxNB_DEFAULT|wxRAISED_BORDER );
2007-11-27 01:34:35 +00:00
#if !wxCHECK_VERSION(2,5,2)
2007-12-01 03:42:52 +00:00
wxNotebookSizer* itemNotebook23Sizer = new wxNotebookSizer(itemNotebook23);
2007-11-27 01:34:35 +00:00
#endif
2007-12-01 03:42:52 +00:00
m_ClearanceListBox = new DRCLISTBOX( itemNotebook23, ID_CLEARANCE_LIST, wxDefaultPosition, wxSize(100, 300), wxSUNKEN_BORDER|wxHSCROLL|wxVSCROLL );
if (DrcDialog::ShowToolTips())
2007-11-27 01:34:35 +00:00
m_ClearanceListBox->SetToolTip(_("MARKERs on the PCB, double click on any MARKER to go there in PCB"));
2007-12-01 03:42:52 +00:00
itemNotebook23->AddPage(m_ClearanceListBox, _("Distance Problem Markers"));
2007-12-01 03:42:52 +00:00
m_UnconnectedListBox = new DRCLISTBOX( itemNotebook23, ID_UNCONNECTED_LIST, wxDefaultPosition, wxSize(100, 100), wxSUNKEN_BORDER|wxHSCROLL|wxVSCROLL );
if (DrcDialog::ShowToolTips())
2007-11-27 01:34:35 +00:00
m_UnconnectedListBox->SetToolTip(_("Pad to pad, pad to track, and track to track clearance problems"));
2007-12-01 03:42:52 +00:00
itemNotebook23->AddPage(m_UnconnectedListBox, _("Unconnected"));
2007-11-13 09:35:39 +00:00
2007-11-27 01:34:35 +00:00
#if !wxCHECK_VERSION(2,5,2)
2007-12-01 03:42:52 +00:00
m_MainSizer->Add(itemNotebook23Sizer, 5, wxGROW|wxALL, 5);
2007-11-27 01:34:35 +00:00
#else
2007-12-01 03:42:52 +00:00
m_MainSizer->Add(itemNotebook23, 5, wxGROW|wxALL, 5);
2007-11-27 01:34:35 +00:00
#endif
2007-11-13 09:35:39 +00:00
StdDialogButtonSizer = new wxStdDialogButtonSizer;
m_MainSizer->Add(StdDialogButtonSizer, 0, wxGROW|wxALL, 10);
2007-12-01 03:42:52 +00:00
wxButton* itemButton27 = new wxButton( itemDialog1, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
itemButton27->SetForegroundColour(wxColour(0, 0, 255));
StdDialogButtonSizer->AddButton(itemButton27);
2007-11-27 01:34:35 +00:00
2007-12-01 03:42:52 +00:00
wxButton* itemButton28 = new wxButton( itemDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
itemButton28->SetDefault();
StdDialogButtonSizer->AddButton(itemButton28);
2007-11-13 09:35:39 +00:00
StdDialogButtonSizer->Realize();
2007-11-27 01:34:35 +00:00
// Connect events and objects
2007-12-01 03:42:52 +00:00
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);
m_UnconnectedListBox->Connect(ID_UNCONNECTED_LIST, wxEVT_RIGHT_UP, wxMouseEventHandler(DrcDialog::OnRightUpUnconnected), NULL, this);
////@end DrcDialog content construction
// @todo this is expanding the Clearance text, so we need to recalc sizers.
AddUnitSymbol(*m_ClearenceTitle);
Layout(); // adding the units above expanded Clearance text, now resize.
2007-05-06 16:03:28 +00:00
}
/*!
* Should we show tooltips?
*/
2007-12-01 03:42:52 +00:00
bool DrcDialog::ShowToolTips()
2007-05-06 16:03:28 +00:00
{
return true;
}
/*!
* Get bitmap resources
*/
2007-12-01 03:42:52 +00:00
wxBitmap DrcDialog::GetBitmapResource( const wxString& name )
2007-05-06 16:03:28 +00:00
{
// Bitmap retrieval
2007-12-01 03:42:52 +00:00
////@begin DrcDialog bitmap retrieval
wxUnusedVar(name);
return wxNullBitmap;
2007-12-01 03:42:52 +00:00
////@end DrcDialog bitmap retrieval
2007-05-06 16:03:28 +00:00
}
/*!
* Get icon resources
*/
2007-12-01 03:42:52 +00:00
wxIcon DrcDialog::GetIconResource( const wxString& name )
2007-05-06 16:03:28 +00:00
{
// Icon retrieval
2007-12-01 03:42:52 +00:00
////@begin DrcDialog icon retrieval
wxUnusedVar(name);
return wxNullIcon;
2007-12-01 03:42:52 +00:00
////@end DrcDialog icon retrieval
2007-05-06 16:03:28 +00:00
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DRC_RUN
*/
2007-12-01 03:42:52 +00:00
void DrcDialog::OnStartdrcClick( wxCommandEvent& event )
{
2007-12-01 03:42:52 +00:00
CmdDrc();
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_STOP_CONTROL_DRC
*/
2007-11-27 01:34:35 +00:00
/*
2007-12-01 03:42:52 +00:00
void DrcDialog::OnStopControlDrcClick( wxCommandEvent& event )
{
2007-11-13 09:35:39 +00:00
if( DrcInProgress )
AbortDrc = TRUE;
else
wxBell();
}
2007-11-27 01:34:35 +00:00
*/
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_ERASE_DRC_MARKERS
*/
2007-12-01 03:42:52 +00:00
void DrcDialog::OnDeleteAllClick( wxCommandEvent& event )
{
2007-11-13 09:35:39 +00:00
DelDRCMarkers(event);
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_LIST_UNCONNECTED_PADS
*/
2007-12-01 03:42:52 +00:00
void DrcDialog::OnListUnconnectedClick( wxCommandEvent& event )
{
2007-11-13 09:35:39 +00:00
ListUnconnectedPads(event);
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON_BROWSE_RPT_FILE
*/
2007-12-01 03:42:52 +00:00
void DrcDialog::OnButtonBrowseRptFileClick( wxCommandEvent& event )
{
2007-11-27 01:34:35 +00:00
wxString FileName;
wxString Mask(wxT("*"));
wxString Ext(wxT(".rpt"));
2007-11-13 09:35:39 +00:00
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);
}
/*!
2007-11-27 01:34:35 +00:00
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
*/
2007-12-01 03:42:52 +00:00
void DrcDialog::OnOkClick( wxCommandEvent& event )
{
2007-11-27 01:34:35 +00:00
event.Skip();
}
2007-11-27 01:34:35 +00:00
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
*/
2007-12-01 03:42:52 +00:00
void DrcDialog::OnCancelClick( wxCommandEvent& event )
2007-11-27 01:34:35 +00:00
{
////@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
*/
2007-12-01 03:42:52 +00:00
void DrcDialog::OnReportCheckBoxClicked( wxCommandEvent& event )
2007-11-27 01:34:35 +00:00
{
if( m_CreateRptCtrl->IsChecked() )
{
m_RptFilenameCtrl->Enable(true);
m_BrowseButton->Enable(true);
}
else
{
2007-11-27 01:34:35 +00:00
m_RptFilenameCtrl->Enable(false);
m_BrowseButton->Enable(false);
}
2007-11-27 01:34:35 +00:00
event.Skip();
}
2007-11-13 09:35:39 +00:00
/*!
2007-11-27 01:34:35 +00:00
* wxEVT_INIT_DIALOG event handler for ID_DIALOG
2007-11-13 09:35:39 +00:00
*/
2007-12-01 03:42:52 +00:00
void DrcDialog::OnInitDialog( wxInitDialogEvent& event )
2007-11-13 09:35:39 +00:00
{
2007-11-27 01:34:35 +00:00
wxCommandEvent junk;
2007-12-01 03:42:52 +00:00
// Set the initial "enabled" status of the browse button and the text
2007-11-27 01:34:35 +00:00
// field for report name
OnReportCheckBoxClicked( junk );
m_SetClearance->SetFocus();
// deselect the existing text, seems SetFocus() wants to emulate
2007-12-01 03:42:52 +00:00
// Microsoft and select all text, which is not desireable here.
2007-11-27 01:34:35 +00:00
m_SetClearance->SetSelection(0,0);
2007-11-13 09:35:39 +00:00
event.Skip();
}
/*!
2007-11-27 01:34:35 +00:00
* wxEVT_LEFT_DCLICK event handler for ID_CLEARANCE_LIST
2007-11-13 09:35:39 +00:00
*/
2007-12-01 03:42:52 +00:00
void DrcDialog::OnLeftDClickClearance( wxMouseEvent& event )
2007-11-13 09:35:39 +00:00
{
2007-11-27 01:34:35 +00:00
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
*/
2007-12-01 03:42:52 +00:00
void DrcDialog::OnRightUpUnconnected( wxMouseEvent& event )
2007-11-27 01:34:35 +00:00
{
event.Skip();
}
/*!
* wxEVT_RIGHT_UP event handler for ID_CLEARANCE_LIST
*/
2007-12-01 03:42:52 +00:00
void DrcDialog::OnRightUpClearance( wxMouseEvent& event )
2007-11-27 01:34:35 +00:00
{
////@begin wxEVT_RIGHT_UP event handler for ID_CLEARANCE_LIST in WinEDA_DrcFrame.
2007-11-13 09:35:39 +00:00
// Before editing this code, remove the block markers.
event.Skip();
2007-11-27 01:34:35 +00:00
////@end wxEVT_RIGHT_UP event handler for ID_CLEARANCE_LIST in WinEDA_DrcFrame.
2007-11-13 09:35:39 +00:00
}
2007-11-27 01:34:35 +00:00
/*!
* wxEVT_LEFT_DCLICK event handler for ID_UNCONNECTED_LIST
*/
2007-12-01 03:42:52 +00:00
void DrcDialog::OnLeftDClickUnconnected( wxMouseEvent& event )
2007-11-27 01:34:35 +00:00
{
int selection = m_UnconnectedListBox->GetSelection();
if( selection != wxNOT_FOUND )
{
printf("get item number %d\n", selection );
}
event.Skip();
}
2007-12-01 03:42:52 +00:00
void DrcDialog::OnMarkerSelectionEvent( wxCommandEvent& event )
2007-11-27 01:34:35 +00:00
{
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();
}
2007-12-01 03:42:52 +00:00
void DrcDialog::OnUnconnectedSelectionEvent( wxCommandEvent& event )
2007-11-27 01:34:35 +00:00
{
int selection = event.GetSelection();
if( selection != wxNOT_FOUND )
{
printf("get Unconnected item number %d\n", selection );
}
event.Skip();
}
2007-12-01 03:42:52 +00:00
/*!
* wxEVT_DESTROY event handler for ID_DIALOG
*/
void DrcDialog::OnDestroy( wxWindowDestroyEvent& event )
{
////@begin wxEVT_DESTROY event handler for ID_DIALOG in WinEDA_DrcFrame.
// Before editing this code, remove the block markers.
event.Skip();
////@end wxEVT_DESTROY event handler for ID_DIALOG in WinEDA_DrcFrame.
}