Commit 514c63c7 authored by dickelbeck's avatar dickelbeck

DRC rework start

parent 699eaf4a
......@@ -4,6 +4,12 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
email address.
2007-Nov-26 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
+pcbnew
DRC code and dialog rework start. This breaks DRC, until I get out the
other end of the tunnel.
2007-Nov-24 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
......
This diff is collapsed.
/////////////////////////////////////////////////////////////////////////////
// Name: dialog_drc.h
// Purpose:
// Purpose:
// Author: jean-pierre Charras
// Modified by:
// Modified by:
// Created: 27/02/2006 20:42:00
// RCS-ID:
// RCS-ID:
// Copyright: License GNU
// Licence:
// Licence:
/////////////////////////////////////////////////////////////////////////////
// Generated by DialogBlocks (unregistered), 27/02/2006 20:42:00
......@@ -24,38 +24,41 @@
////@begin includes
#include "wx/valgen.h"
#include "wx/statline.h"
#include "wx/notebook.h"
////@end includes
/*!
* Forward declarations
*/
////@begin forward declarations
class wxBoxSizer;
class wxStaticLine;
class DRCLISTBOX;
class wxStdDialogButtonSizer;
////@end forward declarations
/*!
* Control identifiers
*/
////@begin control identifiers
#define ID_DIALOG 10000
#define ID_TEXTCTRL_CLEARANCE 10002
#define ID_CHECKBOX_PAD2PAD 10009
#define ID_CHECKBOX_UNCONNECTED 10008
#define ID_CHECKBOX_TEST_ZONES 10007
#define ID_CHECKBOX_CREATE_FILE 10012
#define ID_DRC_RUN 10003
#define ID_STOP_CONTROL_DRC 10004
#define ID_ERASE_DRC_MARKERS 10005
#define ID_LIST_UNCONNECTED_PADS 10006
#define ID_BUTTON_BROWSE_RPT_FILE 10011
#define ID_TEXTCTRL_GET_RPT_FILENAME 10010
#define ID_TEXTCTRL 10001
#define ID_STATICLINE 10013
#define ID_TEXTCTRL1 10002
#define ID_CHECKBOX 10004
#define ID_TEXTCTRL3 10014
#define ID_BUTTON_BROWSE_RPT_FILE 10018
#define ID_CHECKBOX2 10019
#define ID_CHECKBOX3 10020
#define ID_CHECKBOX7 10021
#define ID_STARTDRC 10006
#define ID_LIST_UNCONNECTED 10003
#define ID_DELETE_ALL 10005
#define ID_DELETE_ONE 10007
#define ID_NOTEBOOK1 10008
#define ID_CLEARANCE_LIST 10001
#define ID_UNCONNECTED_LIST 10009
#define SYMBOL_WINEDA_DRCFRAME_STYLE wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER
#define SYMBOL_WINEDA_DRCFRAME_TITLE _("DRC Control")
#define SYMBOL_WINEDA_DRCFRAME_IDNAME ID_DIALOG
......@@ -63,6 +66,8 @@ class wxStdDialogButtonSizer;
#define SYMBOL_WINEDA_DRCFRAME_POSITION wxDefaultPosition
////@end control identifiers
#define ID_DRCLISTCTRL 10001 // outside @end control identifiers since DialogBlocks knows not DRCLISTBOX
/*!
* Compatibility
*/
......@@ -76,7 +81,7 @@ class wxStdDialogButtonSizer;
*/
class WinEDA_DrcFrame: public wxDialog
{
{
DECLARE_DYNAMIC_CLASS( WinEDA_DrcFrame )
DECLARE_EVENT_TABLE()
......@@ -96,32 +101,44 @@ public:
/// Creates the controls and sizers
void CreateControls();
/// Override the event handler so we can direct the m_lowWindows events here initially
virtual bool ProcessEvent( wxEvent& event );
////@begin WinEDA_DrcFrame event handler declarations
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DRC_RUN
void OnDrcRunClick( wxCommandEvent& event );
/// wxEVT_INIT_DIALOG event handler for ID_DIALOG
void OnInitDialog( wxInitDialogEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_STOP_CONTROL_DRC
void OnStopControlDrcClick( wxCommandEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_ERASE_DRC_MARKERS
void OnEraseDrcMarkersClick( wxCommandEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_LIST_UNCONNECTED_PADS
void OnListUnconnectedPadsClick( wxCommandEvent& event );
/// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_CHECKBOX
void OnReportCheckBoxClicked( wxCommandEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON_BROWSE_RPT_FILE
void OnButtonBrowseRptFileClick( wxCommandEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
void OnOkClick( wxCommandEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_STARTDRC
void OnStartdrcClick( wxCommandEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_LIST_UNCONNECTED
void OnListUnconnectedClick( wxCommandEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DELETE_ALL
void OnDeleteAllClick( wxCommandEvent& event );
/// wxEVT_LEFT_DCLICK event handler for ID_CLEARANCE_LIST
void OnLeftDClickClearance( wxMouseEvent& event );
/// wxEVT_RIGHT_UP event handler for ID_CLEARANCE_LIST
void OnRightUpClearance( wxMouseEvent& event );
/// wxEVT_LEFT_DCLICK event handler for ID_UNCONNECTED_LIST
void OnLeftDClickUnconnected( wxMouseEvent& event );
/// wxEVT_RIGHT_UP event handler for ID_UNCONNECTED_LIST
void OnRightUpUnconnected( wxMouseEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
void OnCancelClick( wxCommandEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
void OnOkClick( wxCommandEvent& event );
////@end WinEDA_DrcFrame event handler declarations
////@begin WinEDA_DrcFrame member function declarations
......@@ -133,6 +150,9 @@ public:
wxIcon GetIconResource( const wxString& name );
////@end WinEDA_DrcFrame member function declarations
void OnMarkerSelectionEvent( wxCommandEvent& event );
void OnUnconnectedSelectionEvent( wxCommandEvent& event );
/// Should we show tooltips?
static bool ShowToolTips();
......@@ -145,19 +165,22 @@ public:
wxBoxSizer* m_CommandSizer;
wxStaticText* m_ClearenceTitle;
wxTextCtrl* m_SetClearance;
wxCheckBox* m_CreateRptCtrl;
wxTextCtrl* m_RptFilenameCtrl;
wxButton* m_BrowseButton;
wxCheckBox* m_Pad2PadTestCtrl;
wxCheckBox* m_UnconnectedTestCtrl;
wxCheckBox* m_ZonesTestCtrl;
wxCheckBox* m_CreateRptCtrl;
wxTextCtrl* m_RptFilenameCtrl;
wxTextCtrl* m_logWindow;
wxStaticLine* Line;
wxButton* m_DeleteCurrentMarkerButton;
DRCLISTBOX* m_ClearanceListBox;
DRCLISTBOX* m_UnconnectedListBox;
wxStdDialogButtonSizer* StdDialogButtonSizer;
////@end WinEDA_DrcFrame member variables
WinEDA_PcbFrame * m_Parent;
wxDC * m_DC;
int m_UnconnectedCount;
};
#endif
// _DIALOG_DRC_H_
#endif // _DIALOG_DRC_H_
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -162,12 +162,14 @@ bool WinEDA_GraphicItemsOptionsDialog::Create( wxWindow* parent, wxWindowID id,
////@end WinEDA_GraphicItemsOptionsDialog member initialisation
////@begin WinEDA_GraphicItemsOptionsDialog creation
SetExtraStyle(GetExtraStyle()|wxWS_EX_BLOCK_EVENTS);
SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
wxDialog::Create( parent, id, caption, pos, size, style );
CreateControls();
GetSizer()->Fit(this);
GetSizer()->SetSizeHints(this);
if (GetSizer())
{
GetSizer()->SetSizeHints(this);
}
Centre();
////@end WinEDA_GraphicItemsOptionsDialog creation
return true;
......@@ -182,7 +184,7 @@ void WinEDA_GraphicItemsOptionsDialog::CreateControls()
SetFont(*g_DialogFont);
////@begin WinEDA_GraphicItemsOptionsDialog content construction
// Generated by DialogBlocks, 25/02/2006 10:43:53 (unregistered)
// Generated by DialogBlocks, Mon 26 Nov 2007 18:58:29 CST (unregistered)
WinEDA_GraphicItemsOptionsDialog* itemDialog1 = this;
......
......@@ -34,11 +34,6 @@
////@begin control identifiers
#define ID_DIALOG 10000
#define SYMBOL_WINEDA_GRAPHICITEMSOPTIONSDIALOG_STYLE wxCAPTION|wxSYSTEM_MENU|wxCLOSE_BOX|MAYBE_RESIZE_BORDER
#define SYMBOL_WINEDA_GRAPHICITEMSOPTIONSDIALOG_TITLE _("Texts and Drawings")
#define SYMBOL_WINEDA_GRAPHICITEMSOPTIONSDIALOG_IDNAME ID_DIALOG
#define SYMBOL_WINEDA_GRAPHICITEMSOPTIONSDIALOG_SIZE wxSize(400, 300)
#define SYMBOL_WINEDA_GRAPHICITEMSOPTIONSDIALOG_POSITION wxDefaultPosition
#define ID_TEXTCTRL_SEGW 10001
#define ID_TEXTCTRL_EDGES 10002
#define ID_TEXTCTRL_TEXTW 10003
......@@ -48,6 +43,11 @@
#define ID_TEXTCTRL_TXTMOD_W 10007
#define ID_TEXTCTRL_TXTMOD_V 10008
#define ID_TEXTCTRL_TXTMOD_H 10009
#define SYMBOL_WINEDA_GRAPHICITEMSOPTIONSDIALOG_STYLE wxCAPTION|wxSYSTEM_MENU|wxCLOSE_BOX|MAYBE_RESIZE_BORDER
#define SYMBOL_WINEDA_GRAPHICITEMSOPTIONSDIALOG_TITLE _("Texts and Drawings")
#define SYMBOL_WINEDA_GRAPHICITEMSOPTIONSDIALOG_IDNAME ID_DIALOG
#define SYMBOL_WINEDA_GRAPHICITEMSOPTIONSDIALOG_SIZE wxSize(400, 300)
#define SYMBOL_WINEDA_GRAPHICITEMSOPTIONSDIALOG_POSITION wxDefaultPosition
////@end control identifiers
/*!
......
This diff is collapsed.
This diff is collapsed.
/*
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 2007 Dick Hollenbeck, dick@softplc.com
* Copyright (C) 2007 Kicad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef _DRC_STUFF_H
#define _DRC_STUFF_H
#include "fctsys.h"
/// DRC error codes:
#define DRCE_ 1
/**
* Class DRC_ITEM
* is a holder for a DRC error item. It is generated when two objects are
* too close. There are holders for information on two items. The
* information held is the board coordinate and the MenuText for each item.
* Also held is the type of error by number and the location of the MARQUEUR.
* A function is provided to translate that number into text.
*/
class DRC_ITEM
{
protected:
int m_ErrorCode; ///< the error code's numeric value
wxPoint m_MarkerPos; ///< position of the MARKER
wxString m_AText; ///< text for the first BOARD_ITEM
wxString m_BText; ///< text for the second BOARD_ITEM
wxPoint m_APos; ///< the location of the first BOARD_ITEM
wxPoint m_BPos; ///< the location of the first BOARD_ITEM
public:
DRC_ITEM( int aErrorCode, const wxString& aText, const wxString& bText,
const wxPoint& aPos, const wxPoint& bPos )
{
m_ErrorCode = aErrorCode;
m_AText = aText;
m_BText = bText;
m_APos = aPos;
m_BPos = bPos;
}
/**
* Function ShowHtml
* translates this object into a fragment of HTML suitable for the
* wxWidget's wxHtmlListBox class.
* @return wxString - the html text.
*/
wxString ShowHtml() const
{
wxString ret;
ret.Printf( wxT("<b>%s</b> <ul><li> %s: %s </li> <li> %s: %s </li> </ul>"),
GetErrorText().GetData(),
ShowCoord( m_APos ).GetData(), m_AText.GetData(),
ShowCoord( m_BPos ).GetData(), m_BText.GetData() );
return ret;
}
/**
* Function ShowText
* translates this object into a text string suitable for saving
* to disk in a report. Change this as needed to format the report.
* @return wxString - the simple non-html text.
*/
wxString ShowText() const
{
wxString ret;
ret.Printf( wxT("%s\n %s: %s\n %s: %s\n"),
GetErrorText().GetData(),
ShowCoord( m_APos ).GetData(), m_AText.GetData(),
ShowCoord( m_BPos ).GetData(), m_BText.GetData() );
return ret;
}
/**
* Function GetErrorText
* returns the string form of a drc error code.
*/
const wxString& GetErrorText() const;
/**
* Function ShowCoord
* formats a coordinate or position to text.
* @param aPos The position to format
* @return wxString - The formated string
*/
static wxString ShowCoord( const wxPoint& aPos );
};
class WinEDA_DrawPanel;
class MARQUEUR;
typedef std::vector<DRC_ITEM> DRC_LIST;
/**
* Class DRC_TESTER
* performs all the DRC tests, and can optionally generate a DRC test report
* to a disk file. This class is given access to the windows and the BOARD
* that it needs via its constructor or access functions.
*/
class DRC_TESTER
{
protected:
bool doPad2PadTest;
bool doUnconnectedTest;
bool doZonesTest;
bool doCreateRptFile;
FILE* rptFile;
wxString rptFilename;
int errorCount;
MARQUEUR* currentMarker;
bool abortDrc;
bool drcInProgress;
int spot_cX;
int spot_cY;
int finx;
int finy; // coord relatives de l'extremite du segm de reference
int segmAngle; // angle d'inclinaison du segment de reference en 0,1 degre
int segmLong; // longueur du segment de reference
int xcliplo;
int ycliplo;
int xcliphi;
int ycliphi; // coord de la surface de securite du segment a comparer
DRC_LIST drcList;
WinEDA_DrawPanel* drawPanel;
public:
DRC_TESTER()
{
doPad2PadTest = true;
doUnconnectedTest = true;
doZonesTest = false;
doCreateRptFile = false;
}
/**
* Function SetTests
* sets all the test flags and may be called before running the tests.
* @param aPad2PadTest Tells whether to test pad to pad distances.
* @param aUnconnectedTest Tells whether to list unconnected pads.
* @param aZonesTest Tells whether to test zones.
* @param aRptFilename If non-Empty, is the name of the file to
* save the report to. If Empty, means save no report.
*/
void SetTests( bool aPad2PadTest, bool aUnconnectedTest, bool aZonesTest, const wxString& aRptFilename )
{
doPad2PadTest = aPad2PadTest;
doUnconnectedTest = aUnconnectedTest;
doZonesTest = aZonesTest;
rptFilename = aRptFilename;
if( rptFilename.IsEmpty() )
doCreateRptFile = false;
else
doCreateRptFile = true;
}
};
#endif // _DRC_STUFF_H
//EOF
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