kicad/pcbnew/dialog_drc.cpp

259 lines
7.1 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
////@begin includes
////@end includes
#include "dialog_drc.h"
////@begin XPM images
////@end XPM images
/*!
* 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_BUTTON( ID_DRC_RUN, WinEDA_DrcFrame::OnDrcRunClick )
EVT_BUTTON( ID_STOP_CONTROL_DRC, WinEDA_DrcFrame::OnStopControlDrcClick )
EVT_BUTTON( ID_ERASE_DRC_MARKERS, WinEDA_DrcFrame::OnEraseDrcMarkersClick )
EVT_BUTTON( ID_LIST_UNCONNECTED_PADS, WinEDA_DrcFrame::OnListUnconnectedPadsClick )
EVT_BUTTON( wxID_CLOSE, WinEDA_DrcFrame::OnCloseClick )
////@end WinEDA_DrcFrame event table entries
END_EVENT_TABLE()
/*!
* WinEDA_DrcFrame constructors
*/
WinEDA_DrcFrame::WinEDA_DrcFrame( )
{
}
WinEDA_DrcFrame::WinEDA_DrcFrame( WinEDA_PcbFrame* parent, wxDC * panelDC,
wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
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_logWindow = NULL;
////@end WinEDA_DrcFrame member initialisation
////@begin WinEDA_DrcFrame creation
SetExtraStyle(GetExtraStyle()|wxWS_EX_BLOCK_EVENTS);
wxDialog::Create( parent, id, caption, pos, size, style );
CreateControls();
GetSizer()->Fit(this);
GetSizer()->SetSizeHints(this);
Centre();
////@end WinEDA_DrcFrame creation
return true;
}
/*!
* Control creation for WinEDA_DrcFrame
*/
void WinEDA_DrcFrame::CreateControls()
{
SetFont(*g_DialogFont);
////@begin WinEDA_DrcFrame content construction
// Generated by DialogBlocks, 27/02/2006 21:15:33 (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, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxVERTICAL);
m_CommandSizer->Add(itemBoxSizer4, 0, wxGROW|wxALL, 5);
m_ClearenceTitle = new wxStaticText( itemDialog1, wxID_STATIC, _("Clearance"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer4->Add(m_ClearenceTitle, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
m_SetClearance = new wxTextCtrl( itemDialog1, ID_TEXTCTRL1, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer4->Add(m_SetClearance, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
wxBoxSizer* itemBoxSizer7 = new wxBoxSizer(wxHORIZONTAL);
m_CommandSizer->Add(itemBoxSizer7, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
wxBoxSizer* itemBoxSizer8 = new wxBoxSizer(wxVERTICAL);
itemBoxSizer7->Add(itemBoxSizer8, 0, wxGROW|wxALL, 5);
wxButton* itemButton9 = new wxButton( itemDialog1, ID_DRC_RUN, _("Test Drc"), wxDefaultPosition, wxDefaultSize, 0 );
itemButton9->SetForegroundColour(wxColour(202, 0, 0));
itemBoxSizer8->Add(itemButton9, 0, wxGROW|wxALL, 5);
wxButton* itemButton10 = new wxButton( itemDialog1, ID_STOP_CONTROL_DRC, _("Stop Drc"), wxDefaultPosition, wxDefaultSize, 0 );
itemButton10->SetForegroundColour(wxColour(0, 128, 128));
itemBoxSizer8->Add(itemButton10, 0, wxGROW|wxALL, 5);
wxBoxSizer* itemBoxSizer11 = new wxBoxSizer(wxVERTICAL);
itemBoxSizer7->Add(itemBoxSizer11, 0, wxGROW|wxALL, 5);
wxButton* itemButton12 = new wxButton( itemDialog1, ID_ERASE_DRC_MARKERS, _("Del Markers"), wxDefaultPosition, wxDefaultSize, 0 );
itemButton12->SetForegroundColour(wxColour(0, 128, 0));
itemBoxSizer11->Add(itemButton12, 0, wxGROW|wxALL, 5);
wxButton* itemButton13 = new wxButton( itemDialog1, ID_LIST_UNCONNECTED_PADS, _("List Unconn"), wxDefaultPosition, wxDefaultSize, 0 );
itemButton13->SetForegroundColour(wxColour(0, 0, 255));
itemBoxSizer11->Add(itemButton13, 0, wxGROW|wxALL, 5);
wxButton* itemButton14 = new wxButton( itemDialog1, wxID_CLOSE, _("&Close"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer11->Add(itemButton14, 0, wxGROW|wxALL, 5);
wxStaticText* itemStaticText15 = new wxStaticText( itemDialog1, wxID_STATIC, _("Messages:"), wxDefaultPosition, wxDefaultSize, 0 );
m_MainSizer->Add(itemStaticText15, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
m_logWindow = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T(""), wxDefaultPosition, wxSize(-1, 200), wxTE_MULTILINE|wxTE_READONLY );
m_MainSizer->Add(m_logWindow, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
////@end WinEDA_DrcFrame content construction
AddUnitSymbol(*m_ClearenceTitle);
}
/*!
* 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::OnDrcRunClick( 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::OnEraseDrcMarkersClick( wxCommandEvent& event )
{
DelDRCMarkers(event);
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_LIST_UNCONNECTED_PADS
*/
void WinEDA_DrcFrame::OnListUnconnectedPadsClick( wxCommandEvent& event )
{
ListUnconnectedPads(event);
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CLOSE
*/
void WinEDA_DrcFrame::OnCloseClick( wxCommandEvent& event )
{
Close();
}