Commit 362b6b53 authored by dickelbeck's avatar dickelbeck

NETCLASS work, see CHANGELOG.txt

parent 8682a9fa
......@@ -4,6 +4,20 @@ KiCad ChangeLog 2009
Please add newer entries at the top, list the date and your name with
email address.
2009-Sep-10 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
++pcbnew
More NETCLASS work, started on the UI also. Almost done. Put NETCLASS support
into DRC. Fixed DRC dialog so progress during DRC is sensible and visible.
The specctra_export probably still needs a little work regarding VIAs.
Don't install this version of PCBNEW if you need stability. You can compile
and look but I would not install it quite yet. I compiled wxformbuilder
from source, so you may need to upgrade to load my *.fbp files.
Jean-Pierre @ todo: pcbnew/zones_test_and_combine_areas.cpp needs to
use NETCLASS and not g_DesignSettings.m_TrackClearance
2009-sept-10 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================
++pcbnew
......@@ -12,6 +26,7 @@ email address.
The Kbool's author, Klaas Holveda, is still working on these problems
Thanks to Klaas
2009-aug-23 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================
++pcbnew
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -267,15 +267,20 @@ public:
/**
* Function GetClearance
* returns the clearance in 1/10000 inches to aItem from this BOARD_CONNECTED_ITEM.
* returns the clearance in 1/10000 inches. If \a aItem is not NULL then the
* returned clearance is the greater of this object's NETCLASS clearance and
* aItem's NETCLASS clearance. If \a aItem is NULL, then this objects clearance
* is returned.
* @param aItem is another BOARD_CONNECTED_ITEM or NULL
* @return int - the clearance in 1/10000 inches.
*/
virtual int GetClearance( BOARD_CONNECTED_ITEM* aItem ) const;
virtual int GetClearance( BOARD_CONNECTED_ITEM* aItem = NULL ) const;
/**
* Function GetNetClass
* returns the NETCLASS for this item.
*/
virtual NETCLASS* GetNetClass() const;
NETCLASS* GetNetClass() const;
};
......
......@@ -25,6 +25,9 @@
#ifndef _CLASS_DRC_ITEM_H
#define _CLASS_DRC_ITEM_H
#include "macros.h"
/**
* Class DRC_ITEM
* is a holder for a DRC (in Pcbnew) or ERC (in Eeschema) error item.
......@@ -46,7 +49,7 @@ protected:
wxPoint m_MainPosition; ///< the location of the first (or main ) BOARD_ITEM or SCH_ITEM. This is also the position of the marker
wxPoint m_AuxiliaryPosition; ///< the location of the second BOARD_ITEM or SCH_ITEM
bool m_hasSecondItem; ///< true when 2 items create a DRC/ERC error, false if only one item
bool m_noCoordinate;
public:
......@@ -54,9 +57,9 @@ public:
{
m_ErrorCode = 0;
m_hasSecondItem = false;
m_noCoordinate = false;
}
DRC_ITEM( int aErrorCode,
const wxString& aMainText, const wxString& bAuxiliaryText,
const wxPoint& aMainPos, const wxPoint& bAuxiliaryPos )
......@@ -66,7 +69,6 @@ public:
aMainPos, bAuxiliaryPos );
}
DRC_ITEM( int aErrorCode,
const wxString& aText, const wxPoint& aPos )
{
......@@ -124,11 +126,14 @@ public:
bool HasSecondItem() const { return m_hasSecondItem; }
void SetShowNoCoordinate() { m_noCoordinate = true; }
/** acces to A and B texts
*/
wxString GetMainText() const { return m_MainText; }
wxString GetAuxiliaryText() const { return m_AuxiliaryText; }
/**
* Function ShowHtml
* translates this object into a fragment of HTML suitable for the
......@@ -139,22 +144,30 @@ public:
{
wxString ret;
if( m_hasSecondItem )
if( m_noCoordinate )
{
// omit the coordinate, a NETCLASS has no location
ret.Printf( _( "ErrType(%d): <b>%s</b><ul><li> %s </li></ul>" ),
m_ErrorCode,
GetChars( GetErrorText() ),
GetChars( m_MainText ) );
}
else if( m_hasSecondItem )
{
// an html fragment for the entire message in the listbox. feel free
// to add color if you want:
ret.Printf( _( "ErrType(%d): <b>%s</b><ul><li> %s: %s </li><li> %s: %s </li></ul>" ),
m_ErrorCode,
GetErrorText().GetData(),
ShowCoord( m_MainPosition ).GetData(), m_MainText.GetData(),
ShowCoord( m_AuxiliaryPosition ).GetData(), m_AuxiliaryText.GetData() );
GetChars( GetErrorText() ),
GetChars( ShowCoord( m_MainPosition )), GetChars( m_MainText ),
GetChars( ShowCoord( m_AuxiliaryPosition )), GetChars( m_AuxiliaryText ) );
}
else
{
ret.Printf( _( "ErrType(%d): <b>%s</b><ul><li> %s: %s </li></ul>" ),
m_ErrorCode,
GetErrorText().GetData(),
ShowCoord( m_MainPosition ).GetData(), m_MainText.GetData() );
GetChars( GetErrorText() ),
GetChars( ShowCoord( m_MainPosition ) ), GetChars( m_MainText ) );
}
return ret;
......
......@@ -135,7 +135,8 @@ public:
const wxString& aText, const wxPoint& aPos );
/** Function SetAuxiliaryData
/**
* Function SetAuxiliaryData
* initialize data for the second (auxiliary) item
* @param aAuxiliaryText = the second text (main text) concerning the second schematic or board item
* @param aAuxiliaryPos = position the second item
......@@ -145,6 +146,10 @@ public:
m_drc.SetAuxiliaryData( aAuxiliaryText, aAuxiliaryPos );
}
void SetShowNoCoordinate()
{
m_drc.SetShowNoCoordinate();
}
/**
* Function GetReporter
......
......@@ -155,13 +155,13 @@ public:
int m_EdgeSegmentWidth; // current graphic line width (EDGE layer only)
int m_PcbTextWidth; // current Pcb (not module) Text width
wxSize m_PcbTextSize; // current Pcb (not module) Text size
int m_TrackClearence; // track to track and track to pads clearance
int m_TrackClearenceHistory[HISTORY_NUMBER]; // Last HISTORY_NUMBER used track widths
int m_TrackClearance; // track to track and track to pads clearance
int m_TrackClearanceHistory[HISTORY_NUMBER]; // Last HISTORY_NUMBER used track widths
int m_TrackMinWidth; // track min value for width ((min copper size value
int m_ViasMinSize; // vias (not micro vias) min diameter
int m_MicroViasMinSize; // micro vias (not vias) min diameter
int m_MaskMargin; // Solder mask margin
int m_LayerThickness; // Layer Thickness for 3D viewer
int m_LayerThickness; // Layer Thickness for 3D viewer
// Color options for screen display of the Printed Board:
int m_PcbGridColor; // Grid color
......
......@@ -543,8 +543,11 @@ void WinEDA_PcbFrame::GenModuleOnBoard( MODULE* Module )
TraceFilledRectangle( GetBoard(), ox, oy, fx, fy, masque_layer,
CELL_is_MODULE, WRITE_OR_CELL );
int trackWidth = GetBoard()->m_NetClasses.GetDefault()->GetTrackWidth();
int clearance = GetBoard()->m_NetClasses.GetDefault()->GetClearance();
/* Trace des pads et leur surface de securite */
marge = g_DesignSettings.m_TrackClearence + g_DesignSettings.m_CurrentTrackWidth;
marge = trackWidth + clearance;
for( Pad = Module->m_Pads; Pad != NULL; Pad = Pad->Next() )
{
......
......@@ -178,12 +178,19 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
* si FORCE_PADS : tous les pads seront places meme ceux de meme net_code
*/
{
int ux0 = 0, uy0 = 0, ux1, uy1, dx, dy;
int marge, via_marge;
int masque_layer;
int ux0 = 0, uy0 = 0, ux1, uy1, dx, dy;
int marge, via_marge;
int masque_layer;
marge = g_DesignSettings.m_TrackClearence + (g_DesignSettings.m_CurrentTrackWidth / 2);
via_marge = g_DesignSettings.m_TrackClearence + (g_DesignSettings.m_CurrentViaSize / 2);
// use the default NETCLASS?
NETCLASS* nc = aPcb->m_NetClasses.GetDefault();
int trackWidth = nc->GetTrackWidth();
int clearance = nc->GetClearance();
int viaSize = nc->GetViaDiameter();
marge = clearance + (trackWidth / 2);
via_marge = clearance + (viaSize / 2);
/////////////////////////////////////
// Placement des PADS sur le board //
......@@ -275,14 +282,14 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
break;
case TYPE_TEXTE:
{
{
TEXTE_PCB* PtText;
PtText = (TEXTE_PCB*) item;
if( PtText->GetLength() == 0 )
break;
EDA_Rect textbox = PtText->GetTextBox(-1);
EDA_Rect textbox = PtText->GetTextBox(-1);
ux0 = textbox.GetX(); uy0 = textbox.GetY();
dx = textbox.GetWidth();
dy = textbox.GetHeight();
......@@ -307,7 +314,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
ux1 + via_marge, uy1 + via_marge,
(int) (PtText->m_Orient),
masque_layer, VIA_IMPOSSIBLE, WRITE_OR_CELL );
}
}
break;
default:
......
......@@ -31,12 +31,17 @@ BOARD::BOARD( EDA_BaseStruct* parent, WinEDA_BasePcbFrame* frame ) :
m_CurrentZoneContour = NULL; // This ZONE_CONTAINER handle the zone contour cuurently in progress
m_NetInfo = new NETINFO_LIST( this ); // handle nets info list (name, design constraints ..
for( int layer = 0; layer<NB_COPPER_LAYERS; ++layer )
{
m_Layer[layer].m_Name = ReturnPcbLayerName( layer, true );
m_Layer[layer].m_Type = LT_SIGNAL;
}
// Initial parameters for the default NETCLASS come from the global preferences
// within g_DesignSettings via the NETCLASS() constructor.
// Should user eventually load a board from a disk file, then these defaults
// will get overwritten during load.
m_NetClasses.GetDefault()->SetDescription( _("This is the default net class.") );
}
......@@ -829,16 +834,16 @@ NETINFO_ITEM* BOARD::FindNet( int anetcode ) const
// the first valid netcode is 1 and the last is m_NetInfo->GetCount()-1.
// zero is reserved for "no connection" and is not used.
// NULL is returned for non valid netcodes
NETINFO_ITEM* item = m_NetInfo->GetNetItem( anetcode );
NETINFO_ITEM* net = m_NetInfo->GetNetItem( anetcode );
#if defined(DEBUG)
if ( item ) // item can be NULL if anetcode is not valid
if( net ) // item can be NULL if anetcode is not valid
{
wxASSERT( anetcode == item->GetNet() );
wxASSERT( anetcode == net->GetNet() );
}
#endif
return item;
return net;
}
......
......@@ -99,7 +99,7 @@ public:
NETCLASSES m_NetClasses; ///< List of current netclasses. There is always the default netclass
ZONE_CONTAINER* m_CurrentZoneContour; // zone contour currently in progress
ZONE_CONTAINER* m_CurrentZoneContour; // zone contour currently in progress
BOARD( EDA_BaseStruct* aParent, WinEDA_BasePcbFrame* frame );
~BOARD();
......@@ -348,6 +348,7 @@ public:
*/
void SynchronizeNetsAndNetClasses();
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
......
......@@ -72,22 +72,29 @@ void BOARD_CONNECTED_ITEM::SetZoneSubNet( int aSubNetCode )
int BOARD_CONNECTED_ITEM::GetClearance( BOARD_CONNECTED_ITEM* aItem ) const
{
NETCLASS* hisclass = aItem->GetNetClass();
NETCLASS* myclass = GetNetClass();
wxASSERT( hisclass );
wxASSERT( myclass );
if( myclass )
{
if( hisclass )
return MAX( hisclass->GetClearance(), myclass->GetClearance() );
else
return myclass->GetClearance();
}
else if( hisclass )
{
return hisclass->GetClearance();
// @todo : after GetNetClass() is reliably not returning NULL, remove the
// tests for if( myclass ) and if( hisclass )
if( aItem )
{
NETCLASS* hisclass = aItem->GetNetClass();
wxASSERT( hisclass );
if( hisclass )
{
int hisClearance = hisclass->GetClearance();
int myClearance = myclass->GetClearance();
return max( hisClearance, myClearance );
}
}
return myclass->GetClearance();
}
return 0;
......
......@@ -84,6 +84,19 @@ wxString DRC_ITEM::GetErrorText() const
case DRCE_TOO_SMALL_MICROVIA:
return wxString( _("Too small micro via size"));
// use &lt; since this is text ultimately embedded in HTML
case DRCE_NETCLASS_TRACKWIDTH:
return wxString( _("NetClass Track Width &lt; global limit"));
case DRCE_NETCLASS_CLEARANCE:
return wxString( _("NetClass Clearance &lt; global limit"));
case DRCE_NETCLASS_VIASIZE:
return wxString( _("NetClass Via Dia &lt; global limit"));
case DRCE_NETCLASS_VIADRILLSIZE:
return wxString( _("NetClass Via Drill &lt; global limit"));
case DRCE_NETCLASS_uVIASIZE:
return wxString( _("NetClass uVia Dia &lt; global limit"));
case DRCE_NETCLASS_uVIADRILLSIZE:
return wxString( _("NetClass uVia Drill &lt; global limit"));
default:
return wxString( wxT("PROGRAM BUG, PLEASE LEAVE THE ROOM.") );
......
......@@ -28,7 +28,8 @@ public:
MARKER_PCB( int aErrorCode, const wxPoint& aMarkerPos,
const wxString& aText, const wxPoint& aPos,
const wxString& bText, const wxPoint& bPos );
/**
/**
* Constructor
* @param aErrorCode The categorizing identifier for an error
* @param aMarkerPos The position of the MARKER_PCB on the BOARD
......@@ -38,7 +39,6 @@ public:
MARKER_PCB( int aErrorCode, const wxPoint& aMarkerPos,
const wxString& aText, const wxPoint& aPos );
~MARKER_PCB();
/**
......
......@@ -782,7 +782,7 @@ EDA_Rect MODULE::GetBoundingBox()
// Add the Clearence shape size: (shape around the pads when the clearence is shown
// Not optimized, but the draw cost is small (perhaps smaller than optimization)
area.Inflate(g_DesignSettings.m_TrackClearence, g_DesignSettings.m_TrackClearence);
area.Inflate(g_DesignSettings.m_TrackClearance, g_DesignSettings.m_TrackClearance);
return area;
}
......
......@@ -31,25 +31,42 @@
#include "pcbnew.h"
// "kicad_default" is what we are using in the specctra_export.
const wxString NETCLASS::Default = wxT("kicad_default");
// This will get mapped to "kicad_default" in the specctra_export.
const wxString NETCLASS::Default = wxT("Default");
NETCLASS::NETCLASS( BOARD* aParent, const wxString& aName ) :
NETCLASS::NETCLASS( BOARD* aParent, const wxString& aName, const NETCLASS* initialParameters ) :
m_Parent( aParent ),
m_Name( aName )
{
m_TrackWidth = 160;
m_TrackMinWidth = 40;
m_ViaSize = 350;
m_ViaMinSize = 220;
// use initialParameters if not NULL, else set the initial
// parameters from g_DesignSettings
SetParams( initialParameters );
}
m_ViaDrillSize = 200;
m_Clearance = 140;
void NETCLASS::SetParams( const NETCLASS* defaults )
{
if( defaults )
{
SetClearance( defaults->GetClearance() );
SetTrackWidth( defaults->GetTrackWidth() );
SetViaDiameter( defaults->GetViaDiameter() );
SetViaDrill( defaults->GetViaDrill() );
SetuViaDiameter( defaults->GetuViaDiameter() );
SetuViaDrill( defaults->GetuViaDrill() );
}
else
{
const EDA_BoardDesignSettings& g = g_DesignSettings;
SetClearance( g.m_TrackClearance );
SetTrackWidth( g.m_TrackMinWidth );
SetViaDiameter( g.m_ViasMinSize );
SetViaDrill( g.m_ViaDrill );
SetuViaDiameter(g.m_MicroViasMinSize );
SetuViaDrill( g.m_MicroViaDrill );
}
}
......@@ -95,26 +112,33 @@ void NETCLASSES::Clear()
}
bool NETCLASSES::Add( const NETCLASS& aNetClass )
bool NETCLASSES::Add( NETCLASS* aNetClass )
{
const wxString& name = aNetClass.GetName();
const wxString& name = aNetClass->GetName();
if( name == NETCLASS::Default )
{
// invoke operator=(), which is currently generated by compiler.
m_Default = aNetClass;
m_Default = *aNetClass;
delete aNetClass; // we own aNetClass, must delete it since we copied it.
return true;
}
// Test for an existing netclass:
if( !Find( name ) )
{
// insert since name not found, invoke copy constructor.
m_NetClasses[name] = new NETCLASS( aNetClass );
// name not found, take ownership
m_NetClasses[name] = aNetClass;
return true;
}
return false; // name already exists
else
{
// name already exists
// do not "take ownership" and return false telling caller such.
return false;
}
}
......@@ -248,24 +272,26 @@ bool NETCLASS::Save( FILE* aFile ) const
{
bool result = true;
fprintf( aFile, "$NETCLASS\n" );
fprintf( aFile, "$" BRD_NETCLASS "\n" );
fprintf( aFile, "Name \"%s\"\n", CONV_TO_UTF8( m_Name ) );
fprintf( aFile, "Desc \"%s\"\n", CONV_TO_UTF8( GetDescription() ) );
// Write parameters
fprintf( aFile, "TrackWidth %d\n", GetTrackWidth() );
fprintf( aFile, "TrackMinWidth %d\n", GetTrackMinWidth() );
fprintf( aFile, "ViaSize %d\n", GetViaSize() );
fprintf( aFile, "ViaDrillSize %d\n", GetViaDrillSize() );
fprintf( aFile, "ViaMinSize %d\n", GetViaMinSize() );
fprintf( aFile, "Clearance %d\n", GetClearance() );
fprintf( aFile, "TrackWidth %d\n", GetTrackWidth() );
fprintf( aFile, "ViaDia %d\n", GetViaDiameter() );
fprintf( aFile, "ViaDrill %d\n", GetViaDrill() );
fprintf( aFile, "uViaDia %d\n", GetuViaDiameter() );
fprintf( aFile, "uViaDrill %d\n", GetuViaDrill() );
// Write members:
for( const_iterator i = begin(); i!=end(); ++i )
fprintf( aFile, "AddNet \"%s\"\n", CONV_TO_UTF8( *i ) );
fprintf( aFile, "$EndNETCLASS\n" );
fprintf( aFile, "$End" BRD_NETCLASS "\n" );
return result;
}
......@@ -311,43 +337,44 @@ bool NETCLASS::ReadDescr( FILE* aFile, int* aLineNum )
continue;
}
if( strnicmp( Line, "$endNETCLASS", 6 ) == 0 )
if( strnicmp( Line, "$end" BRD_NETCLASS, sizeof( "$end" BRD_NETCLASS)-1) == 0 )
{
result = true;
break;
}
if( strnicmp( Line, "TrackWidth", 10 ) == 0 )
if( strnicmp( Line, "Clearance", 9 ) == 0 )
{
SetTrackWidth( atoi( Line + 10 ) );
SetClearance( atoi( Line + 9 ) );
continue;
}
if( strnicmp( Line, "ViaSize", 7 ) == 0 )
if( strnicmp( Line, "TrackWidth", 10 ) == 0 )
{
SetViaSize( atoi( Line + 7 ) );
SetTrackWidth( atoi( Line + 10 ) );
continue;
}
if( strnicmp( Line, "ViaDrillSize", 12 ) == 0 )
if( strnicmp( Line, "ViaDia", 6 ) == 0 )
{
SetViaDrillSize( atoi( Line + 12 ) );
SetViaDiameter( atoi( Line + 6 ) );
continue;
}
if( strnicmp( Line, "Clearance", 9 ) == 0 )
if( strnicmp( Line, "ViaDrill", 8 ) == 0 )
{
SetClearance( atoi( Line + 9 ) );
SetViaDrill( atoi( Line + 8 ) );
continue;
}
if( strnicmp( Line, "TrackMinWidth", 13 ) == 0 )
if( strnicmp( Line, "uViaDia", 7 ) == 0 )
{
SetTrackMinWidth( atoi( Line + 13 ) );
SetuViaDiameter( atoi( Line + 7 ) );
continue;
}
if( strnicmp( Line, "ViaMinSize", 10 ) == 0 )
if( strnicmp( Line, "uViaDrill", 9 ) == 0 )
{
SetViaMinSize( atoi( Line + 10 ) );
SetuViaDrill( atoi( Line + 9 ) );
continue;
}
if( strnicmp( Line, "Name", 4 ) == 0 )
{
ReadDelimitedText( Buffer, Line + 4, sizeof(Buffer) );
......
......@@ -49,20 +49,38 @@ protected:
STRINGSET m_Members; ///< names of NET members of this class
/// The units on these parameters is 1/10000 of an inch.
/// The units on these parameters is 1/10000 of an inch, see #define PCB_INTERNAL_UNIT
int m_TrackWidth; ///< value for tracks thickness used to route this net
int m_TrackMinWidth; ///< minimum value for tracks thickness (used in DRC)
int m_ViaSize; ///< default via size used to route this net
int m_ViaDrillSize; ///< default via drill size used to create vias in this net
int m_ViaMinSize; ///< minimum size for vias (used in DRC)
int m_Clearance; ///< clearance when routing
int m_TrackWidth; ///< track width used to route NETs in this NETCLASS
int m_ViaDia; ///< via diameter
int m_ViaDrill; ///< via drill hole diameter
int m_uViaDia; ///< microvia diameter
int m_uViaDrill; ///< microvia drill hole diameter
public:
static const wxString Default; ///< the name of the default NETCLASS
NETCLASS( BOARD* aParent, const wxString& aName );
/**
* Name of identifier within BOARD file.
* 08-Sept-2009: changed the name from "NETCLASS" to this so we can
* toss any previous NETCLASSes in migratory BOARD files which will not have
* the proper parameters in the default netclass (from g_DesignSettings) in them.
* Spare the user from having to enter those defaults manually.
*/
#define BRD_NETCLASS "NCLASS"
/**
* Constructor
* stuffs a NETCLASS instance with aParent, aName, and optionally the initialParameters
* @param initialParameters is a NETCLASS to copy parameters from, or if
* NULL tells me to copy from g_DesignSettings.
*/
NETCLASS( BOARD* aParent, const wxString& aName, const NETCLASS* initialParameters = NULL );
~NETCLASS();
wxString GetClass() const
......@@ -134,24 +152,33 @@ public:
const wxString& GetDescription() const { return m_Description; }
void SetDescription( const wxString& aDesc ) { m_Description = aDesc; }
int GetClearance() const { return m_Clearance; }
void SetClearance( int aClearance ) { m_Clearance = aClearance; }
int GetTrackWidth() const { return m_TrackWidth; }
void SetTrackWidth( int aWidth ) { m_TrackWidth = aWidth; }
int GetTrackMinWidth() const { return m_TrackMinWidth; }
void SetTrackMinWidth( int aWidth ) { m_TrackMinWidth = aWidth; }
int GetViaDiameter() const { return m_ViaDia; }
void SetViaDiameter( int aDia ) { m_ViaDia = aDia; }
int GetViaSize() const { return m_ViaSize; }
void SetViaSize( int aSize ) { m_ViaSize = aSize; }
int GetViaDrill() const { return m_ViaDrill; }
void SetViaDrill( int aSize ) { m_ViaDrill = aSize; }
int GetViaDrillSize() const { return m_ViaDrillSize; }
void SetViaDrillSize( int aSize ) { m_ViaDrillSize = aSize; }
int GetuViaDiameter() const { return m_uViaDia; }
void SetuViaDiameter( int aSize ) { m_uViaDia = aSize; }
int GetViaMinSize() const { return m_ViaMinSize; }
void SetViaMinSize( int aSize ) { m_ViaMinSize = aSize; }
int GetuViaDrill() const { return m_uViaDrill; }
void SetuViaDrill( int aSize ) { m_uViaDrill = aSize; }
int GetClearance() const { return m_Clearance; }
void SetClearance( int aClearance ) { m_Clearance = aClearance; }
/**
* Function SetParams
* will set all the parameters by copying them from \a defaults.
* Parameters are the values like m_ViaSize, etc, but do not include m_Description.
* @param defaults is another NETCLASS to copy from. If NULL, then copy
* from global preferences instead.
*/
void SetParams( const NETCLASS* defaults = NULL );
/**
* Function Save
......@@ -236,14 +263,14 @@ public:
return (NETCLASS*) &m_Default;
}
/**
* Function Add
* takes ownership of \a aNetclass and puts it into this NETCLASSES container.
* @param aNetclass is netclass to add
* @return true if Ok, false if cannot be added (mainly because a
* netclass with the same name exists)
* @return true if the name within aNetclass is unique and it could be inserted OK,
* else false because the name was not unique and caller still owns aNetclass.
*/
bool Add( const NETCLASS& aNetclass );
bool Add( NETCLASS* aNetclass );
/**
* Function Remove
......
......@@ -208,7 +208,7 @@ public:
return m_NetClassName;
}
#if 0
/**
* Function GetTrackWidth
* returns the width of tracks used to route this net.
......@@ -221,10 +221,10 @@ public:
/**
* Function GetTrackMinWidth
* Function GetTrackWidth
* returns the Minimum value for tracks thickness (used in DRC)
*/
int GetTrackMinWidth()
int GetTrackWidth()
{
wxASSERT( m_NetClass );
return m_NetClass->GetTrackMinWidth();
......@@ -273,7 +273,7 @@ public:
wxASSERT( m_NetClass );
return m_NetClass->GetClearance();
}
#endif
/* Reading and writing data on files */
int ReadDescr( FILE* File, int* LineNum );
......
......@@ -11,7 +11,6 @@ class Pcb3D_GLCanvas;
class D_PAD : public BOARD_CONNECTED_ITEM
{
private:
int m_NetCode; // Net number for fast comparisons
wxString m_Netname; // Full net name like /mysheet/mysubsheet/vout used by eeschema
wxString m_ShortNetname; // short net name, like vout from /mysheet/mysubsheet/vout
......
......@@ -207,6 +207,8 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
SetAlpha(&color, 170);
int padClearance = GetClearance();
switch( GetShape() )
{
case PAD_CIRCLE:
......@@ -221,7 +223,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
DC,
xc,
yc,
dx + g_DesignSettings.m_TrackClearence,
dx + padClearance,
0,
color );
}
......@@ -259,7 +261,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
/* Trace de la marge d'isolement */
if( DisplayIsol )
{
rotdx = rotdx + g_DesignSettings.m_TrackClearence + g_DesignSettings.m_TrackClearence;
rotdx = rotdx + 2 * padClearance;
GRCSegm( &panel->m_ClipBox, DC, ux0 + delta_cx, uy0 + delta_cy,
ux0 - delta_cx, uy0 - delta_cy,
......@@ -297,8 +299,8 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
if( DisplayIsol )
{
dx += g_DesignSettings.m_TrackClearence;
dy += g_DesignSettings.m_TrackClearence;
dx += padClearance;
dy += padClearance;
coord[0].x = -dx - ddy;
coord[0].y = dy + ddx;
......@@ -481,7 +483,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
if( screen->Scale( tsize ) >= CHAR_SIZE_MIN ) // Not drawable in size too small.
{
if( !(!IsOnLayer( screen->m_Active_Layer )&& DisplayOpt.ContrastModeDisplay)){
if( !(!IsOnLayer( screen->m_Active_Layer )&& DisplayOpt.ContrastModeDisplay)){
tpos = tpos0;
if ( display_padnum )
......@@ -492,7 +494,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
DrawGraphicText( panel, DC, tpos,
WHITE, m_ShortNetname, t_angle, wxSize( tsize, tsize ),
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, tsize / 7,
false, false );
}
false, false );
}
}
}
......@@ -257,7 +257,7 @@ EDA_Rect TRACK::GetBoundingBox()
if( ShowClearance( this ) )
{
// + 1 is for the clearance line itself.
radius += g_DesignSettings.m_TrackClearence + 1;
radius += GetClearance() + 1;
}
ymax += radius;
......@@ -664,7 +664,7 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
{
GRCSegm( &panel->m_ClipBox, DC, m_Start.x, m_Start.y,
m_End.x, m_End.y,
m_Width + (g_DesignSettings.m_TrackClearence * 2), color );
m_Width + (GetClearance() * 2), color );
}
/* Display the short netname for tracks, not for zone segments.
......@@ -712,14 +712,14 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
angle = 900; // angle is in 0.1 degree
if( panel->GetScreen()->Scale( tsize ) >= 6 )
{
if( !(!IsOnLayer( curr_layer )&& DisplayOpt.ContrastModeDisplay)){
if( !(!IsOnLayer( curr_layer )&& DisplayOpt.ContrastModeDisplay)){
tsize = (tsize * 8) / 10; // small reduction to give a better look
DrawGraphicText( panel, DC, tpos,
WHITE, net->GetShortNetname(), angle, wxSize( tsize, tsize ),
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, tsize / 7,
false, false );
}
false, false );
}
}
}
}
......@@ -794,7 +794,7 @@ void SEGVIA::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoi
if( DisplayOpt.ShowTrackClearanceMode == SHOW_CLEARANCE_ALWAYS )
GRCircle( &panel->m_ClipBox, DC, m_Start.x, m_Start.y,
rayon + g_DesignSettings.m_TrackClearence, color );
rayon + GetClearance(), color );
// for Micro Vias, draw a partial cross :
// X on component layer, or + on copper layer
......@@ -871,7 +871,7 @@ void SEGVIA::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoi
DrawGraphicText( panel, DC, m_Start,
WHITE, net->GetShortNetname(), 0, wxSize( tsize, tsize ),
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, tsize / 7,
false, false);
false, false);
}
}
}
......
......@@ -206,7 +206,7 @@ EDA_BoardDesignSettings::EDA_BoardDesignSettings()
for( ii = 0; ii < HISTORY_NUMBER; ii++ )
{
m_TrackWidthHistory[ii] = 0; // Last HISTORY_NUMBER used track widths
m_TrackClearenceHistory[ii] = 0;
m_TrackClearanceHistory[ii] = 0;
m_ViaSizeHistory[ii] = 0; // Last HISTORY_NUMBER used via sizes
}
......@@ -214,7 +214,7 @@ EDA_BoardDesignSettings::EDA_BoardDesignSettings()
m_EdgeSegmentWidth = 100; // current graphic line width (EDGE layer only)
m_PcbTextWidth = 100; // current Pcb (not module) Text width
m_PcbTextSize = wxSize( 500, 500 ); // current Pcb (not module) Text size
m_TrackClearence = 100; // track to track and track to pads clearance
m_TrackClearance = 100; // track to track and track to pads clearance
m_TrackMinWidth = 80; // track min value for width ((min copper size value
m_ViasMinSize = 350; // vias (not micro vias) min diameter
m_MicroViasMinSize = 200; // micro vias (not vias) min diameter
......
......@@ -596,9 +596,7 @@ void WinEDA_PcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
// "as is", and let ShowNewTrackWhenMovingCursor figure out what to do.
if( !Drc_On || !g_CurrentTrackSegment
|| g_CurrentTrackSegment != this->GetCurItem()
|| !LocateIntrusion( m_Pcb->m_Track,
g_CurrentTrackSegment->GetNet(),
g_CurrentTrackSegment->m_Width ) )
|| !LocateIntrusion( m_Pcb->m_Track, g_CurrentTrackSegment ))
{
GetScreen()->m_Curseur = on_grid;
}
......
......@@ -18,17 +18,19 @@
#include "dialog_design_rules.h"
#include "wx/generic/gridctrl.h"
// Fields Positions on layer grid
#define LAYERS_GRID_ROUTABLE_POSITION 0
#define LAYERS_GRID_STATUS_POSITION 1
#define LAYERS_GRID_NAME_POSITION 2
// Fields Positions on rules grid
#define RULE_GRID_TRACKSIZE_POSITION 0
#define RULE_GRID_VIASIZE_POSITION 1
#define RULE_GRID_CLEARANCE_POSITION 2
#define RULE_GRID_MINTRACKSIZE_POSITION 3
#define RULE_GRID_MINVIASIZE_POSITION 4
// Field Positions on rules grid
enum {
GRID_CLEARANCE,
GRID_TRACKSIZE,
GRID_VIASIZE,
GRID_VIADRILL,
GRID_uVIASIZE,
GRID_uVIADRILL,
};
const wxString DIALOG_DESIGN_RULES::wildCard = _("* (Any)");
/***********************************************************************************/
DIALOG_DESIGN_RULES::DIALOG_DESIGN_RULES( WinEDA_PcbFrame* parent ) :
......@@ -37,6 +39,29 @@ DIALOG_DESIGN_RULES::DIALOG_DESIGN_RULES( WinEDA_PcbFrame* parent ) :
{
m_Parent = parent;
wxListItem column0;
wxListItem column1;
column0.Clear();
column1.Clear();
column0.SetImage( -1 );
column1.SetImage( -1 );
column0.SetText( _( "Net" ) );
column1.SetText( _( "Class" ) );
m_leftListCtrl->InsertColumn( 0, column0 );
m_leftListCtrl->InsertColumn( 1, column1 );
m_leftListCtrl->SetColumnWidth( 0, wxLIST_AUTOSIZE );
m_leftListCtrl->SetColumnWidth( 1, wxLIST_AUTOSIZE );
m_rightListCtrl->InsertColumn( 0, column0 );
m_rightListCtrl->InsertColumn( 1, column1 );
m_rightListCtrl->SetColumnWidth( 0, wxLIST_AUTOSIZE );
m_rightListCtrl->SetColumnWidth( 1, wxLIST_AUTOSIZE );
Init();
SetAutoLayout( true );
GetSizer()->Fit( this );
......@@ -52,105 +77,137 @@ void DIALOG_DESIGN_RULES::Init()
SetReturnCode( 0 );
// Initialize the layers grid:
m_ActivesLayersCount = g_DesignSettings.m_CopperLayerCount;
m_Pcb = m_Parent->GetBoard();
m_LayersCountSelection->SetSelection( m_ActivesLayersCount / 2 );
// Initialize the Rules List
InitRulesList();
// Initialize the Routable column
SetRoutableLayerStatus();
// copy all NETs into m_AllNets by adding them as NETCUPs.
// Initialize the Status column (layers attribute)
LAYER_T typelist[4] = { LT_SIGNAL, LT_POWER, LT_MIXED, LT_JUMPER };
for( int ii = 0; ii < 4; ii++ )
NETCLASS* netclass;
NETCLASSES& netclasses = m_Pcb->m_NetClasses;
netclass = netclasses.GetDefault();
for( NETCLASS::const_iterator name = netclass->begin(); name != netclass->end(); ++name )
{
m_LayersType[ii] = typelist[ii];
m_LayersTypeName[ii] = CONV_FROM_UTF8( LAYER::ShowType( typelist[ii] ) );
m_AllNets.push_back( NETCUP( *name, netclass->GetName() ) );
}
for( int ii = 0; ii < m_gridLayersProperties->GetNumberRows(); ii++ )
for( NETCLASSES::const_iterator nc = netclasses.begin(); nc != netclasses.end(); ++nc )
{
m_gridLayersProperties->SetCellEditor( ii, LAYERS_GRID_STATUS_POSITION,
new wxGridCellChoiceEditor( WXSIZEOF(
m_LayersTypeName ),
m_LayersTypeName ) );
int select = LT_SIGNAL;
for( int jj = 0; jj < 4; jj++ )
netclass = nc->second;
for( NETCLASS::const_iterator name = netclass->begin(); name != netclass->end(); ++name )
{
int layer = LAYER_CMP_N - ii;
if( m_Pcb->GetLayerType( layer ) == m_LayersType[jj] )
{
select = m_LayersType[jj];
break;
}
m_AllNets.push_back( NETCUP( *name, netclass->GetName() ) );
}
m_gridLayersProperties->SetCellValue( ii, LAYERS_GRID_STATUS_POSITION,
m_LayersTypeName[select] );
m_gridLayersProperties->SetCellOverflow( ii, LAYERS_GRID_STATUS_POSITION, false );
}
// Initialize the Name column
for( int ii = 0; ii < m_gridLayersProperties->GetNumberRows(); ii++ )
{
wxString layer_name = m_Pcb->GetLayerName( LAYER_CMP_N - ii );
m_gridLayersProperties->SetCellValue( ii, LAYERS_GRID_NAME_POSITION, layer_name );
}
InitializeRulesSelectionBoxes();
}
// Initialize the Rules List
InitRulesList();
// Sort comparison function
static bool sortByClassThenName( NETCUP* a, NETCUP* b )
{
// return a < b
if( a->clazz < b->clazz )
return true;
if( a->net < a->net )
return true;
/* Initialize the list of nets buffers
* (note the netcode 0 is not a real net, so it is not loaded)
*/
for( unsigned ii = 1; ; ii++ )
return false;
}
void DIALOG_DESIGN_RULES::makePointers( PNETCUPS* aList, const wxString& aNetClassName )
{
aList->clear();
if( wildCard == aNetClassName )
{
NETINFO_ITEM* net = m_Pcb->FindNet( ii );
if( net == NULL )
break;
m_StockNets.push_back( net );
for( NETCUPS::iterator n = m_AllNets.begin(); n != m_AllNets.end(); ++n )
{
aList->push_back( &*n );
}
// search the index in rules list for this net
int rules_idx = 0;
for( int jj = 0; jj < m_gridNetClassesProperties->GetNumberRows(); jj++ )
sort( aList->begin(), aList->end(), sortByClassThenName );
// could use a different sort order for wildCard case.
}
else
{
for( NETCUPS::iterator n = m_AllNets.begin(); n != m_AllNets.end(); ++n )
{
if( m_gridNetClassesProperties->GetRowLabelValue( jj ).CmpNoCase( net->GetClassName() )
== 0 )
{
rules_idx = jj;
break;
}
if( n->clazz == aNetClassName )
aList->push_back( &*n );
}
m_NetsLinkToClasses.push_back( rules_idx ); // All nets are set to default net class
sort( aList->begin(), aList->end(), sortByClassThenName );
}
}
InitializeRulesSelectionBoxes();
void DIALOG_DESIGN_RULES::setRowItem( wxListCtrl* aListCtrl, int aRow, NETCUP* aNetAndClass )
{
wxASSERT( aRow >= 0 );
// insert blanks if aRow is larger than existing count
while( aRow >= aListCtrl->GetItemCount() )
{
long ndx = aListCtrl->InsertItem( aListCtrl->GetItemCount(), wxEmptyString );
wxASSERT( ndx >= 0 );
aListCtrl->SetItem( ndx, 1, wxEmptyString );
}
aListCtrl->SetItem( aRow, 0, aNetAndClass->net );
aListCtrl->SetItem( aRow, 1, aNetAndClass->clazz );
// recompute the column widths here, after setting texts
aListCtrl->SetColumnWidth( 0, wxLIST_AUTOSIZE );
aListCtrl->SetColumnWidth( 1, wxLIST_AUTOSIZE );
}
/** Function FillListBoxWithNetsNames
* populates the aListBox with net names members of the aNetclassIndex net class
* the "Client Data pointer" is used to store the index of nets in ne nets lists
/**
* Function FillListBoxWithNetNames
* populates aListCtrl with net names members of the aNetclassIndex net class
* the "Client Data pointer" is used to store the index of nets in the net lists
*/
void DIALOG_DESIGN_RULES::FillListBoxWithNetsNames( wxListBox* aListBox, int aNetclassIndex )
void DIALOG_DESIGN_RULES::FillListBoxWithNetNames( wxListCtrl* aListCtrl, const wxString& aNetClass )
{
aListBox->Clear();
unsigned idx = 0;
for( unsigned ii = 0; ii < m_StockNets.size(); ii++ )
aListCtrl->ClearAll();
#if 1
PNETCUPS ptrList;
makePointers( &ptrList, aNetClass );
#if defined(DEBUG)
int r = 0;
for( PNETCUPS::iterator i = ptrList.begin(); i!=ptrList.end(); ++i, ++r )
{
if( aNetclassIndex == m_NetsLinkToClasses[ii] )
{
aListBox->Append( m_StockNets[ii]->GetNetname() );
// Store the index of this net
// This is a trick to get an unsigned integer index from a pointer value.
// Some compilers cannot accept to convert an unsigned to a pointer without complains
char * ptr = (char*)0 + ii;
aListBox->SetClientData( idx, ptr );
idx++;
}
printf("[%d]: %s %s\n", r, CONV_TO_UTF8( (*i)->net ), CONV_TO_UTF8( (*i)->clazz ) );
}
#endif
// to speed up inserting we hide the control temporarily
aListCtrl->Hide();
int row = 0;
for( PNETCUPS::iterator i = ptrList.begin(); i!=ptrList.end(); ++i, ++row )
{
setRowItem( aListCtrl, row, *i );
}
aListCtrl->Show();
#endif
}
......@@ -158,94 +215,94 @@ void DIALOG_DESIGN_RULES::FillListBoxWithNetsNames( wxListBox* aListBox, int aNe
*/
void DIALOG_DESIGN_RULES::InitializeRulesSelectionBoxes()
{
m_CBoxRightSelection->Clear();
m_CBoxLeftSelection->Clear();
for( int ii = 0; ii < m_gridNetClassesProperties->GetNumberRows(); ii++ )
m_rightClassChoice->Clear();
m_leftClassChoice->Clear();
m_rightClassChoice->Append( wildCard );
m_leftClassChoice->Append( wildCard );
for( int ii = 0; ii < m_grid->GetNumberRows(); ii++ )
{
m_CBoxRightSelection->Append( m_gridNetClassesProperties->GetRowLabelValue( ii ) );
m_CBoxLeftSelection->Append( m_gridNetClassesProperties->GetRowLabelValue( ii ) );
m_rightClassChoice->Append( m_grid->GetRowLabelValue( ii ) );
m_leftClassChoice->Append( m_grid->GetRowLabelValue( ii ) );
}
m_CBoxRightSelection->Select( 0 );
m_CBoxLeftSelection->Select( 0 );
m_rightClassChoice->Select( 0 );
m_leftClassChoice->Select( 0 );
m_buttonRightToLeft->Enable( false );
m_buttonLeftToRight->Enable( false );;
FillListBoxWithNetsNames( m_listBoxLeftNetSelect, m_CBoxLeftSelection->GetCurrentSelection() );
FillListBoxWithNetsNames( m_listBoxRightNetSelect, m_CBoxRightSelection->GetCurrentSelection() );
FillListBoxWithNetNames( m_leftListCtrl, m_leftClassChoice->GetStringSelection() );
FillListBoxWithNetNames( m_rightListCtrl, m_rightClassChoice->GetStringSelection() );
}
/* Initialize the Routable column, and the R/W property of some cells
/* Initialize the rules list from board
*/
void DIALOG_DESIGN_RULES::SetRoutableLayerStatus()
static void class2gridRow( wxGrid* grid, int row, NETCLASS* nc, int units )
{
m_gridLayersProperties->SetColFormatBool( LAYERS_GRID_ROUTABLE_POSITION );
for( int ii = 0; ii < m_gridLayersProperties->GetNumberRows(); ii++ )
{
int layer = LAYER_CMP_N - ii;
wxString value = layer < (m_ActivesLayersCount - 1) ? wxT( "1" ) : wxT( "0" );
if( m_ActivesLayersCount > 1 && layer == LAYER_CMP_N )
value = wxT( "1" );
if( layer == COPPER_LAYER_N )
value = wxT( "1" );
m_gridLayersProperties->SetCellValue( ii, LAYERS_GRID_ROUTABLE_POSITION, value );
m_gridLayersProperties->SetReadOnly( ii, LAYERS_GRID_ROUTABLE_POSITION );
// Set to Read Only cell for non existing copper layers:
m_gridLayersProperties->SetReadOnly( ii, LAYERS_GRID_STATUS_POSITION, value != wxT( "1" ) );
m_gridLayersProperties->SetReadOnly( ii, LAYERS_GRID_NAME_POSITION, value != wxT( "1" ) );
}
}
wxString msg;
// label is netclass name
grid->SetRowLabelValue( row, nc->GetName() );
msg = ReturnStringFromValue( g_UnitMetric, nc->GetClearance(), units );
grid->SetCellValue( row, GRID_CLEARANCE, msg );
msg = ReturnStringFromValue( g_UnitMetric, nc->GetTrackWidth(), units );
grid->SetCellValue( row, GRID_TRACKSIZE, msg );
msg = ReturnStringFromValue( g_UnitMetric, nc->GetViaDiameter(), units );
grid->SetCellValue( row, GRID_VIASIZE, msg );
msg = ReturnStringFromValue( g_UnitMetric, nc->GetViaDrill(), units );
grid->SetCellValue( row, GRID_VIADRILL, msg );
msg = ReturnStringFromValue( g_UnitMetric, nc->GetuViaDiameter(), units );
grid->SetCellValue( row, GRID_uVIASIZE, msg );
msg = ReturnStringFromValue( g_UnitMetric, nc->GetuViaDrill(), units );
grid->SetCellValue( row, GRID_uVIADRILL, msg );
}
/* Initialize the rules list from board
*/
void DIALOG_DESIGN_RULES::InitRulesList()
{
NETCLASSES& netclasses = m_Pcb->m_NetClasses;
int ii = 0;
for( NETCLASSES::iterator i=netclasses.begin(); i!=netclasses.end(); ++i, ++ii )
// the +1 is for the Default NETCLASS.
if( netclasses.GetCount()+1 > (unsigned) m_grid->GetNumberRows() )
{
m_grid->AppendRows( netclasses.GetCount()+1 - m_grid->GetNumberRows() );
}
class2gridRow( m_grid, 0, netclasses.GetDefault(), m_Parent->m_InternalUnits );
int row = 1;
for( NETCLASSES::iterator i=netclasses.begin(); i!=netclasses.end(); ++i, ++row )
{
NETCLASS* netclass = i->second;
// Creates one entry if needed
if( ii >= m_gridNetClassesProperties->GetNumberRows() )
m_gridNetClassesProperties->AppendRows();
// Init name
m_gridNetClassesProperties->SetRowLabelValue( ii, netclass->GetName() );
// Init data
wxString msg;
msg = ReturnStringFromValue( g_UnitMetric,
netclass->GetTrackWidth(),
m_Parent->m_InternalUnits, false );
m_gridNetClassesProperties->SetCellValue( ii, RULE_GRID_TRACKSIZE_POSITION, msg );
msg = ReturnStringFromValue( g_UnitMetric,
netclass->GetViaSize(),
m_Parent->m_InternalUnits, false );
m_gridNetClassesProperties->SetCellValue( ii, RULE_GRID_VIASIZE_POSITION, msg );
msg = ReturnStringFromValue( g_UnitMetric,
netclass->GetClearance(),
m_Parent->m_InternalUnits, false );
m_gridNetClassesProperties->SetCellValue( ii, RULE_GRID_CLEARANCE_POSITION, msg );
msg = ReturnStringFromValue( g_UnitMetric,
netclass->GetTrackMinWidth(),
m_Parent->m_InternalUnits, false );
m_gridNetClassesProperties->SetCellValue( ii, RULE_GRID_MINTRACKSIZE_POSITION, msg );
msg = ReturnStringFromValue( g_UnitMetric,
netclass->GetViaMinSize(),
m_Parent->m_InternalUnits, false );
m_gridNetClassesProperties->SetCellValue( ii, RULE_GRID_MINVIASIZE_POSITION, msg );
class2gridRow( m_grid, row, netclass, m_Parent->m_InternalUnits );
}
}
static void gridRow2class( wxGrid* grid, int row, NETCLASS* nc, int units )
{
#define MYCELL(col) \
ReturnValueFromString( g_UnitMetric, grid->GetCellValue( row, col ), units )
nc->SetClearance( MYCELL( GRID_CLEARANCE ) );
nc->SetTrackWidth( MYCELL( GRID_TRACKSIZE ) );
nc->SetViaDiameter( MYCELL( GRID_VIASIZE ) );
nc->SetViaDrill( MYCELL( GRID_VIADRILL ) );
nc->SetuViaDiameter( MYCELL( GRID_uVIASIZE ) );
nc->SetuViaDrill( MYCELL( GRID_uVIADRILL ) );
}
/* Copy the rules list to board
*/
void DIALOG_DESIGN_RULES::CopyRulesListToBoard()
......@@ -254,50 +311,30 @@ void DIALOG_DESIGN_RULES::CopyRulesListToBoard()
netclasses.Clear();
for( int ii = 0; ii < m_gridNetClassesProperties->GetNumberRows(); ii++ )
// gridRow2class( wxGrid* grid, int row, NETCLASS* nc, int units )
gridRow2class( m_grid, 0, netclasses.GetDefault(), m_Parent->m_InternalUnits );
for( int row = 1; row < m_grid->GetNumberRows(); ++row )
{
NETCLASS netclass( m_Pcb, m_gridNetClassesProperties->GetRowLabelValue( ii ) );
// Init data
netclass.SetTrackWidth(
ReturnValueFromString( g_UnitMetric,
m_gridNetClassesProperties->GetCellValue( ii,
RULE_GRID_TRACKSIZE_POSITION ),
m_Parent->m_InternalUnits ));
netclass.SetViaSize(
ReturnValueFromString( g_UnitMetric,
m_gridNetClassesProperties->GetCellValue( ii,
RULE_GRID_VIASIZE_POSITION ),
m_Parent->m_InternalUnits ));
netclass.SetClearance(
ReturnValueFromString( g_UnitMetric,
m_gridNetClassesProperties->GetCellValue( ii,
RULE_GRID_CLEARANCE_POSITION ),
m_Parent->m_InternalUnits ));
netclass.SetTrackMinWidth(
ReturnValueFromString( g_UnitMetric,
m_gridNetClassesProperties->GetCellValue( ii,
RULE_GRID_MINTRACKSIZE_POSITION ),
m_Parent->m_InternalUnits ));
netclass.SetViaMinSize(
ReturnValueFromString( g_UnitMetric,
m_gridNetClassesProperties->GetCellValue( ii,
RULE_GRID_MINVIASIZE_POSITION ),
m_Parent->m_InternalUnits ));
// Copy the list of nets associated to this netclass:
for( unsigned idx = 0; idx < m_StockNets.size(); idx++ )
NETCLASS* nc = new NETCLASS( m_Pcb, m_grid->GetRowLabelValue( row ) );
if( !m_Pcb->m_NetClasses.Add( nc ) )
{
if( m_NetsLinkToClasses[idx] == ii )
netclass.Add( m_StockNets[idx]->GetNetname() );
// @todo: put up an error message here.
delete nc;
continue;
}
// this calls copy constructor, so all data must be in 'netclass' before Add()ing.
m_Pcb->m_NetClasses.Add( netclass );
gridRow2class( m_grid, row, nc, m_Parent->m_InternalUnits );
}
for( NETCUPS::const_iterator netcup = m_AllNets.begin(); netcup != m_AllNets.end(); ++netcup )
{
NETCLASS* nc = netclasses.Find( netcup->clazz );
wxASSERT( nc );
nc->Add( netcup->net );
}
m_Pcb->SynchronizeNetsAndNetClasses();
......@@ -322,52 +359,12 @@ void DIALOG_DESIGN_RULES::OnOkButtonClick( wxCommandEvent& event )
return;
}
g_DesignSettings.m_CopperLayerCount = m_ActivesLayersCount;
// Initialize the new layer name
for( int ii = 0; ii < m_gridLayersProperties->GetNumberRows(); ii++ )
{
wxString layer_name = m_gridLayersProperties->GetCellValue( ii, LAYERS_GRID_NAME_POSITION );
if( layer_name != m_Pcb->GetLayerName( LAYER_CMP_N - ii ) )
{
m_Pcb->SetLayerName( LAYER_CMP_N - ii, layer_name );
}
}
// Initialize the layer type
for( int ii = 0; ii < m_gridLayersProperties->GetNumberRows(); ii++ )
{
wxString txt = m_gridLayersProperties->GetCellValue( ii, LAYERS_GRID_STATUS_POSITION );
int layer = LAYER_CMP_N - ii;
for( int jj = 0; jj < 3; jj++ )
{
if( m_LayersTypeName[jj] == txt )
{
m_Pcb->SetLayerType( layer, m_LayersType[jj] );
break;
}
}
}
CopyRulesListToBoard();
EndModal( wxID_OK );
}
/**************************************************************************/
void DIALOG_DESIGN_RULES::OnLayerCountClick( wxCommandEvent& event )
/**************************************************************************/
{
m_ActivesLayersCount = m_LayersCountSelection->GetSelection() * 2;
if( m_ActivesLayersCount <= 0 )
m_ActivesLayersCount = 1;
// Reinit the routable layers status
SetRoutableLayerStatus();
}
/**************************************************************************/
void DIALOG_DESIGN_RULES::OnAddNetclassClick( wxCommandEvent& event )
/**************************************************************************/
......@@ -381,10 +378,10 @@ void DIALOG_DESIGN_RULES::OnAddNetclassClick( wxCommandEvent& event )
return;
// The name must dot exists:
for( int ii = 0; ii < m_gridNetClassesProperties->GetNumberRows(); ii++ )
for( int ii = 0; ii < m_grid->GetNumberRows(); ii++ )
{
wxString value;
value = m_gridNetClassesProperties->GetRowLabelValue( ii );
value = m_grid->GetRowLabelValue( ii );
if( class_name.CmpNoCase( value ) == 0 ) // Already exists!
{
DisplayError( this, _( "This NetClass is already existing, cannot add it; Aborted" ) );
......@@ -392,18 +389,18 @@ void DIALOG_DESIGN_RULES::OnAddNetclassClick( wxCommandEvent& event )
}
}
m_gridNetClassesProperties->AppendRows();
m_gridNetClassesProperties->SetRowLabelValue(
m_gridNetClassesProperties->GetNumberRows() - 1,
m_grid->AppendRows();
m_grid->SetRowLabelValue(
m_grid->GetNumberRows() - 1,
class_name );
// Copy values of the previous class:
int irow = m_gridNetClassesProperties->GetNumberRows() - 1;
for( int icol = 0; icol < m_gridNetClassesProperties->GetNumberCols(); icol++ )
int irow = m_grid->GetNumberRows() - 1;
for( int icol = 0; icol < m_grid->GetNumberCols(); icol++ )
{
wxString value;
value = m_gridNetClassesProperties->GetCellValue( irow - 1, icol );
m_gridNetClassesProperties->SetCellValue( irow, icol, value );
value = m_grid->GetCellValue( irow - 1, icol );
m_grid->SetCellValue( irow, icol, value );
}
InitializeRulesSelectionBoxes();
......@@ -414,19 +411,18 @@ void DIALOG_DESIGN_RULES::OnAddNetclassClick( wxCommandEvent& event )
void DIALOG_DESIGN_RULES::OnRemoveNetclassClick( wxCommandEvent& event )
/**************************************************************************/
{
wxArrayInt select = m_gridNetClassesProperties->GetSelectedRows();
wxArrayInt select = m_grid->GetSelectedRows();
for( int ii = select.GetCount() - 1; ii >= 0; ii-- )
{
if( select[ii] != 0 ) // Do not remove the default class
{
m_gridNetClassesProperties->DeleteRows( select[ii] );
wxString classname = m_grid->GetRowLabelValue( ii );
// reset the net class to default for nets member of the removed net class
for( unsigned jj = 0; jj< m_NetsLinkToClasses.size(); jj++ )
if( m_NetsLinkToClasses[jj] == ii )
m_NetsLinkToClasses[jj] = 0; // Reset to default net class
m_grid->DeleteRows( select[ii] );
// reset the net class to default for members of the removed class
swapNetClass( classname, NETCLASS::Default );
}
}
......@@ -439,8 +435,8 @@ void DIALOG_DESIGN_RULES::OnRemoveNetclassClick( wxCommandEvent& event )
*/
void DIALOG_DESIGN_RULES::OnLeftCBSelection( wxCommandEvent& event )
{
FillListBoxWithNetsNames( m_listBoxLeftNetSelect, m_CBoxLeftSelection->GetCurrentSelection() );
if( m_CBoxLeftSelection->GetCurrentSelection() == m_CBoxRightSelection->GetCurrentSelection() )
FillListBoxWithNetNames( m_leftListCtrl, m_leftClassChoice->GetStringSelection() );
if( m_leftClassChoice->GetStringSelection() == m_rightClassChoice->GetStringSelection() )
{
m_buttonRightToLeft->Enable( false );
m_buttonLeftToRight->Enable( false );
......@@ -458,8 +454,8 @@ void DIALOG_DESIGN_RULES::OnLeftCBSelection( wxCommandEvent& event )
*/
void DIALOG_DESIGN_RULES::OnRightCBSelection( wxCommandEvent& event )
{
FillListBoxWithNetsNames( m_listBoxRightNetSelect, m_CBoxRightSelection->GetCurrentSelection() );
if( m_CBoxLeftSelection->GetCurrentSelection() == m_CBoxRightSelection->GetCurrentSelection() )
FillListBoxWithNetNames( m_rightListCtrl, m_rightClassChoice->GetStringSelection() );
if( m_leftClassChoice->GetStringSelection() == m_rightClassChoice->GetStringSelection() )
{
m_buttonRightToLeft->Enable( false );
m_buttonLeftToRight->Enable( false );;
......@@ -478,24 +474,27 @@ void DIALOG_DESIGN_RULES::OnRightCBSelection( wxCommandEvent& event )
void DIALOG_DESIGN_RULES::OnRightToLeftCopyButton( wxCommandEvent& event )
{
int idx_class = m_CBoxLeftSelection->GetCurrentSelection();
wxString oldClassName = m_leftClassChoice->GetStringSelection();
wxString newClassName = m_rightClassChoice->GetStringSelection();
if( idx_class == wxNOT_FOUND )
return;
for( unsigned ii = 0; ii < m_listBoxRightNetSelect->GetCount(); ii++ )
wxASSERT( oldClassName != wxEmptyString );
wxASSERT( newClassName != wxEmptyString );
for( int row = 0; row < m_rightListCtrl->GetItemCount(); ++row )
{
if( !m_listBoxRightNetSelect->IsSelected( ii ) )
if( !m_rightListCtrl->GetItemState( row, wxLIST_STATE_SELECTED ) )
continue;
// This is a trick to get an unsigned integer index from a pointer value.
// Some compilers cannot accept to convert a pointer to an unsigned without complains
char * ptr = (char*) m_listBoxRightNetSelect->GetClientData( ii );
unsigned idx = ptr - (char*)0;
m_NetsLinkToClasses[idx] = idx_class;
/*
@todo: get the netName, call setNetClass()
wxString netName = m_rightListCtrl->OnGetItemText( row, 0 );
setNetClass( netName, newClassName == wildCard ? NETCLASS::Default : newClassName );
*/
}
FillListBoxWithNetsNames( m_listBoxLeftNetSelect, m_CBoxLeftSelection->GetCurrentSelection() );
FillListBoxWithNetsNames( m_listBoxRightNetSelect, m_CBoxRightSelection->GetCurrentSelection() );
FillListBoxWithNetNames( m_leftListCtrl, m_leftClassChoice->GetStringSelection() );
FillListBoxWithNetNames( m_rightListCtrl, m_rightClassChoice->GetStringSelection() );
}
......@@ -504,24 +503,10 @@ void DIALOG_DESIGN_RULES::OnRightToLeftCopyButton( wxCommandEvent& event )
*/
void DIALOG_DESIGN_RULES::OnLeftToRightCopyButton( wxCommandEvent& event )
{
int idx_class = m_CBoxRightSelection->GetCurrentSelection();
// @todo factor code from above, or combine the two functions.
if( idx_class == wxNOT_FOUND )
return;
for( unsigned ii = 0; ii < m_listBoxLeftNetSelect->GetCount(); ii++ )
{
if( !m_listBoxLeftNetSelect->IsSelected( ii ) )
continue;
// This is a trick to get an unsigned integer index from a pointer value.
// Some compilers cannot accept to convert a pointer to an unsigned without complains
char * ptr = (char*) m_listBoxLeftNetSelect->GetClientData( ii );
unsigned idx = ptr - (char*)0 ;
m_NetsLinkToClasses[idx] = idx_class;
}
FillListBoxWithNetsNames( m_listBoxLeftNetSelect, m_CBoxLeftSelection->GetCurrentSelection() );
FillListBoxWithNetsNames( m_listBoxRightNetSelect, m_CBoxRightSelection->GetCurrentSelection() );
FillListBoxWithNetNames( m_leftListCtrl, m_leftClassChoice->GetStringSelection() );
FillListBoxWithNetNames( m_rightListCtrl, m_rightClassChoice->GetStringSelection() );
}
......@@ -530,8 +515,8 @@ void DIALOG_DESIGN_RULES::OnLeftToRightCopyButton( wxCommandEvent& event )
*/
void DIALOG_DESIGN_RULES::OnLeftSelectAllButton( wxCommandEvent& event )
{
for( unsigned ii = 0; ii < m_listBoxLeftNetSelect->GetCount(); ii++ )
m_listBoxLeftNetSelect->SetSelection( ii );
for( int ii = 0; ii < m_leftListCtrl->GetItemCount(); ii++ )
m_leftListCtrl->SetItemState( ii, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
}
......@@ -540,8 +525,21 @@ void DIALOG_DESIGN_RULES::OnLeftSelectAllButton( wxCommandEvent& event )
*/
void DIALOG_DESIGN_RULES::OnRightSelectAllButton( wxCommandEvent& event )
{
for( unsigned ii = 0; ii < m_listBoxRightNetSelect->GetCount(); ii++ )
m_listBoxRightNetSelect->SetSelection( ii );
for( int ii = 0; ii < m_rightListCtrl->GetItemCount(); ii++ )
m_rightListCtrl->SetItemState( ii, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
}
void DIALOG_DESIGN_RULES::setNetClass( const wxString& aNetName, const wxString& aClassName )
{
for( NETCUPS::iterator i = m_AllNets.begin(); i != m_AllNets.end(); ++i )
{
if( i->net == aNetName )
{
i->clazz = aClassName;
break;
}
}
}
......@@ -552,63 +550,32 @@ void DIALOG_DESIGN_RULES::OnRightSelectAllButton( wxCommandEvent& event )
*/
bool DIALOG_DESIGN_RULES::TestDataValidity()
{
bool success = true;
m_MessagesList->SetPage(wxEmptyString); // Clear message list
bool result = true;
// Test duplicate layers names
for( int ii = 0; ii < m_gridLayersProperties->GetNumberRows() - 1; ii++ )
{
wxString value = m_gridLayersProperties->GetCellValue( ii, LAYERS_GRID_NAME_POSITION );
for( int jj = ii+1; jj < m_gridLayersProperties->GetNumberRows(); jj++ )
{
wxString othervalue = m_gridLayersProperties->GetCellValue( ii,
LAYERS_GRID_NAME_POSITION );
othervalue = m_gridLayersProperties->GetCellValue( jj, LAYERS_GRID_NAME_POSITION );
if( value.CmpNoCase( othervalue ) == 0 ) // Already exists!
{
wxString text;
text.Printf( _(
"<small>This layer name <b>%s</b> is already existing<br>" ),
value.GetData() );
m_MessagesList->AppendToPage( text );
success = false;
}
}
}
m_MessagesList->SetPage(wxEmptyString); // Clear message list
int value;
int minvalue;
wxString msg;
for( int ii = 0; ii < m_gridNetClassesProperties->GetNumberRows(); ii++ )
for( int row = 0; row < m_grid->GetNumberRows(); row++ )
{
value = ReturnValueFromString( g_UnitMetric,
m_gridNetClassesProperties->GetCellValue(
ii, RULE_GRID_TRACKSIZE_POSITION ),
int viadia = ReturnValueFromString( g_UnitMetric,
m_grid->GetCellValue(
row, GRID_VIASIZE ),
m_Parent->m_InternalUnits );
minvalue = ReturnValueFromString( g_UnitMetric,
m_gridNetClassesProperties->GetCellValue( ii,
RULE_GRID_MINTRACKSIZE_POSITION ),
m_Parent->m_InternalUnits );
if( value < minvalue )
{
success = false;
m_MessagesList->AppendToPage( _( "The <b>track</b> minimum size is bigger than the size<br>" ) );
}
value = ReturnValueFromString( g_UnitMetric,
m_gridNetClassesProperties->GetCellValue(
ii, RULE_GRID_VIASIZE_POSITION ),
m_Parent->m_InternalUnits );
minvalue = ReturnValueFromString( g_UnitMetric,
m_gridNetClassesProperties->GetCellValue( ii,
RULE_GRID_MINVIASIZE_POSITION ),
int viadrill = ReturnValueFromString( g_UnitMetric,
m_grid->GetCellValue(
row, GRID_VIADRILL ),
m_Parent->m_InternalUnits );
if( value < minvalue )
if( viadrill && viadrill >= viadia )
{
success = false;
m_MessagesList->AppendToPage( _( "The <b>via</b> minimum size is bigger than the size<br>" ) );
result = false;
msg.Printf( _( "%s: <b>Via Drill</b> &ge; <b>Via Dia</b><br>" ),
GetChars( m_grid->GetRowLabelValue(row)) );
m_MessagesList->AppendToPage( msg );
}
}
return success;
return result;
}
......@@ -7,45 +7,80 @@
#include "dialog_design_rules_base.h"
struct NETCUP
{
NETCUP( const wxString& aNet, const wxString& aClass )
{
net = aNet;
clazz = aClass;
}
wxString net;
wxString clazz;
};
typedef std::vector<NETCUP> NETCUPS;
typedef std::vector<NETCUP*> PNETCUPS;
class DIALOG_DESIGN_RULES : public DIALOG_DESIGN_RULES_BASE
{
private:
WinEDA_PcbFrame * m_Parent;
int m_ActivesLayersCount;
BOARD * m_Pcb;
LAYER_T m_LayersType[4];
wxString m_LayersTypeName[4];
std::vector<NETINFO_ITEM*> m_StockNets; // full list of nets on board
std::vector<int> m_NetsLinkToClasses; // index to affect each net to an existing net class
private:
void OnLayerCountClick( wxCommandEvent& event );
void OnLayerGridLeftClick( wxGridEvent& event ){ event.Skip(); }
void OnLayerGridRighttClick( wxGridEvent& event ){ event.Skip(); }
void OnNetClassesGridLeftClick( wxGridEvent& event ){ event.Skip(); }
void OnNetClassesGridRightClick( wxGridEvent& event ){ event.Skip(); }
void OnCancelButtonClick( wxCommandEvent& event );
void OnOkButtonClick( wxCommandEvent& event );
void OnAddNetclassClick( wxCommandEvent& event );
void OnRemoveNetclassClick( wxCommandEvent& event );
void OnLeftCBSelection( wxCommandEvent& event );
void OnRightCBSelection( wxCommandEvent& event );
void OnRightToLeftCopyButton( wxCommandEvent& event );
void OnLeftToRightCopyButton( wxCommandEvent& event );
void OnLeftSelectAllButton( wxCommandEvent& event );
void OnRightSelectAllButton( wxCommandEvent& event );
bool TestDataValidity( );
private:
static const wxString wildCard;
WinEDA_PcbFrame* m_Parent;
BOARD* m_Pcb;
std::vector<wxString> m_NetClasses;
NETCUPS m_AllNets;
private:
void OnLayerCountClick( wxCommandEvent& event );
void OnLayerGridLeftClick( wxGridEvent& event ){ event.Skip(); }
void OnLayerGridRighttClick( wxGridEvent& event ){ event.Skip(); }
void OnNetClassesGridLeftClick( wxGridEvent& event ){ event.Skip(); }
void OnNetClassesGridRightClick( wxGridEvent& event ){ event.Skip(); }
void OnCancelButtonClick( wxCommandEvent& event );
void OnOkButtonClick( wxCommandEvent& event );
void OnAddNetclassClick( wxCommandEvent& event );
void OnRemoveNetclassClick( wxCommandEvent& event );
void OnLeftCBSelection( wxCommandEvent& event );
void OnRightCBSelection( wxCommandEvent& event );
void OnRightToLeftCopyButton( wxCommandEvent& event );
void OnLeftToRightCopyButton( wxCommandEvent& event );
void OnLeftSelectAllButton( wxCommandEvent& event );
void OnRightSelectAllButton( wxCommandEvent& event );
bool TestDataValidity( );
void Init();
void InitRulesList();
void InitializeRulesSelectionBoxes();
void CopyRulesListToBoard();
void SetRoutableLayerStatus( );
void FillListBoxWithNetsNames(wxListBox* aListBox, int aNetclassIndex);
void SetRoutableLayerStatus();
void FillListBoxWithNetNames( wxListCtrl* aListCtrl, const wxString& aNetClass );
/**
* Function swapNetClass
* replaces one net class name with another in the master list, m_AllNets.
*/
void swapNetClass( const wxString& oldClass, const wxString& newClass )
{
for( NETCUPS::iterator i = m_AllNets.begin(); i!=m_AllNets.end(); ++i )
{
if( i->clazz == oldClass )
i->clazz = newClass;
}
}
void makePointers( PNETCUPS* aList, const wxString& aNetClassName );
void setNetClass( const wxString& aNetName, const wxString& aClassName );
static void setRowItem( wxListCtrl* aListCtrl, int aRow, NETCUP* aNetAndClass );
public:
DIALOG_DESIGN_RULES( WinEDA_PcbFrame* parent );
~DIALOG_DESIGN_RULES( ) { };
public:
DIALOG_DESIGN_RULES( WinEDA_PcbFrame* parent );
~DIALOG_DESIGN_RULES( ) { };
};
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// C++ code generated with wxFormBuilder (version Sep 9 2009)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -16,199 +16,139 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID
wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxVERTICAL );
m_notebook = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
m_panelLayers = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bMainSizerLayers;
bMainSizerLayers = new wxBoxSizer( wxHORIZONTAL );
wxString m_LayersCountSelectionChoices[] = { _("1"), _("2"), _("4"), _("6"), _("8"), _("10"), _("12"), _("14"), _("16") };
int m_LayersCountSelectionNChoices = sizeof( m_LayersCountSelectionChoices ) / sizeof( wxString );
m_LayersCountSelection = new wxRadioBox( m_panelLayers, ID_LAYERS_COUNT_SELECTION, _("Layers Count"), wxDefaultPosition, wxDefaultSize, m_LayersCountSelectionNChoices, m_LayersCountSelectionChoices, 1, wxRA_SPECIFY_COLS );
m_LayersCountSelection->SetSelection( 1 );
bMainSizerLayers->Add( m_LayersCountSelection, 0, wxALL, 5 );
wxStaticBoxSizer* sbSizer1;
sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Net Classes:") ), wxVERTICAL );
m_gridLayersProperties = new wxGrid( m_panelLayers, ID_LAYERS_PROPERTIES, wxDefaultPosition, wxDefaultSize, 0 );
m_grid = new wxGrid( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxSIMPLE_BORDER|wxVSCROLL );
// Grid
m_gridLayersProperties->CreateGrid( 16, 3 );
m_gridLayersProperties->EnableEditing( true );
m_gridLayersProperties->EnableGridLines( true );
m_gridLayersProperties->EnableDragGridSize( false );
m_gridLayersProperties->SetMargins( 0, 0 );
m_grid->CreateGrid( 1, 6 );
m_grid->EnableEditing( true );
m_grid->EnableGridLines( true );
m_grid->EnableDragGridSize( false );
m_grid->SetMargins( 0, 0 );
// Columns
m_gridLayersProperties->SetColSize( 0, 100 );
m_gridLayersProperties->SetColSize( 1, 100 );
m_gridLayersProperties->SetColSize( 2, 150 );
m_gridLayersProperties->EnableDragColMove( false );
m_gridLayersProperties->EnableDragColSize( true );
m_gridLayersProperties->SetColLabelSize( 30 );
m_gridLayersProperties->SetColLabelValue( 0, _("Active") );
m_gridLayersProperties->SetColLabelValue( 1, _("Status") );
m_gridLayersProperties->SetColLabelValue( 2, _("Name") );
m_gridLayersProperties->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
m_grid->SetColSize( 0, 100 );
m_grid->SetColSize( 1, 100 );
m_grid->SetColSize( 2, 100 );
m_grid->SetColSize( 3, 100 );
m_grid->SetColSize( 4, 100 );
m_grid->EnableDragColMove( false );
m_grid->EnableDragColSize( true );
m_grid->SetColLabelSize( 40 );
m_grid->SetColLabelValue( 0, _("Clearance") );
m_grid->SetColLabelValue( 1, _("Track Width") );
m_grid->SetColLabelValue( 2, _("Via Dia") );
m_grid->SetColLabelValue( 3, _("Via Drill") );
m_grid->SetColLabelValue( 4, _("uVia Dia") );
m_grid->SetColLabelValue( 5, _("uVia Drill") );
m_grid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Rows
m_gridLayersProperties->AutoSizeRows();
m_gridLayersProperties->EnableDragRowSize( true );
m_gridLayersProperties->SetRowLabelSize( 80 );
m_gridLayersProperties->SetRowLabelValue( 0, _("Top Layer") );
m_gridLayersProperties->SetRowLabelValue( 1, _("Inner 14") );
m_gridLayersProperties->SetRowLabelValue( 2, _("Inner 13") );
m_gridLayersProperties->SetRowLabelValue( 3, _("Inner 12") );
m_gridLayersProperties->SetRowLabelValue( 4, _("Inner 11") );
m_gridLayersProperties->SetRowLabelValue( 5, _("Inner 10") );
m_gridLayersProperties->SetRowLabelValue( 6, _("Inner 9") );
m_gridLayersProperties->SetRowLabelValue( 7, _("Inner 8") );
m_gridLayersProperties->SetRowLabelValue( 8, _("Inner 7") );
m_gridLayersProperties->SetRowLabelValue( 9, _("Inner 6") );
m_gridLayersProperties->SetRowLabelValue( 10, _("Inner 5") );
m_gridLayersProperties->SetRowLabelValue( 11, _("Inner 4") );
m_gridLayersProperties->SetRowLabelValue( 12, _("Inner 3") );
m_gridLayersProperties->SetRowLabelValue( 13, _("Inner 2") );
m_gridLayersProperties->SetRowLabelValue( 14, _("Inner 1") );
m_gridLayersProperties->SetRowLabelValue( 15, _("Bottom Layer") );
m_gridLayersProperties->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
m_grid->AutoSizeRows();
m_grid->EnableDragRowSize( true );
m_grid->SetRowLabelSize( 120 );
m_grid->SetRowLabelValue( 0, _("Default") );
m_grid->SetRowLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTRE );
// Label Appearance
// Cell Defaults
m_gridLayersProperties->SetDefaultCellAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
bMainSizerLayers->Add( m_gridLayersProperties, 1, wxALL|wxEXPAND, 5 );
m_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
m_grid->SetToolTip( _("Net Class parameters") );
m_grid->SetMinSize( wxSize( -1,150 ) );
m_panelLayers->SetSizer( bMainSizerLayers );
m_panelLayers->Layout();
bMainSizerLayers->Fit( m_panelLayers );
m_notebook->AddPage( m_panelLayers, _("Layers"), true );
m_panelNetClasses = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bmainSizerNclasses;
bmainSizerNclasses = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbSizer1;
sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( m_panelNetClasses, wxID_ANY, _("Net classes:") ), wxHORIZONTAL );
m_gridNetClassesProperties = new wxGrid( m_panelNetClasses, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
// Grid
m_gridNetClassesProperties->CreateGrid( 1, 5 );
m_gridNetClassesProperties->EnableEditing( true );
m_gridNetClassesProperties->EnableGridLines( true );
m_gridNetClassesProperties->EnableDragGridSize( false );
m_gridNetClassesProperties->SetMargins( 0, 0 );
sbSizer1->Add( m_grid, 1, wxALL|wxEXPAND, 5 );
// Columns
m_gridNetClassesProperties->SetColSize( 0, 100 );
m_gridNetClassesProperties->SetColSize( 1, 100 );
m_gridNetClassesProperties->SetColSize( 2, 100 );
m_gridNetClassesProperties->SetColSize( 3, 100 );
m_gridNetClassesProperties->SetColSize( 4, 100 );
m_gridNetClassesProperties->EnableDragColMove( false );
m_gridNetClassesProperties->EnableDragColSize( true );
m_gridNetClassesProperties->SetColLabelSize( 30 );
m_gridNetClassesProperties->SetColLabelValue( 0, _("Track size") );
m_gridNetClassesProperties->SetColLabelValue( 1, _("Vias size") );
m_gridNetClassesProperties->SetColLabelValue( 2, _("Clearance") );
m_gridNetClassesProperties->SetColLabelValue( 3, _("Track Min Size") );
m_gridNetClassesProperties->SetColLabelValue( 4, _("Via Min Size") );
m_gridNetClassesProperties->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
wxBoxSizer* buttonBoxSizer;
buttonBoxSizer = new wxBoxSizer( wxHORIZONTAL );
// Rows
m_gridNetClassesProperties->AutoSizeRows();
m_gridNetClassesProperties->EnableDragRowSize( true );
m_gridNetClassesProperties->SetRowLabelSize( 80 );
m_gridNetClassesProperties->SetRowLabelValue( 0, _("Default") );
m_gridNetClassesProperties->SetRowLabelValue( 1, _("Special") );
m_gridNetClassesProperties->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
m_addButton = new wxButton( this, wxID_ADD_NETCLASS, _("Add"), wxDefaultPosition, wxDefaultSize, 0 );
m_addButton->SetToolTip( _("Add another Net Class") );
// Label Appearance
buttonBoxSizer->Add( m_addButton, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
// Cell Defaults
m_gridNetClassesProperties->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
m_gridNetClassesProperties->SetMinSize( wxSize( -1,150 ) );
m_removeButton = new wxButton( this, wxID_REMOVE_NETCLASS, _("Remove"), wxDefaultPosition, wxDefaultSize, 0 );
m_removeButton->SetToolTip( _("Remove the currently select Net Class") );
sbSizer1->Add( m_gridNetClassesProperties, 1, wxALL|wxEXPAND, 5 );
buttonBoxSizer->Add( m_removeButton, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
wxBoxSizer* bSizerButtons;
bSizerButtons = new wxBoxSizer( wxVERTICAL );
m_moveUpButton = new wxButton( this, wxID_ANY, _("Move Up"), wxDefaultPosition, wxDefaultSize, 0 );
m_moveUpButton->SetToolTip( _("Move the currently selected Net Class up one row") );
m_buttonADD = new wxButton( m_panelNetClasses, wxID_ADD_NETCLASS, _("Add"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerButtons->Add( m_buttonADD, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
buttonBoxSizer->Add( m_moveUpButton, 0, wxALL, 5 );
m_buttonRemove = new wxButton( m_panelNetClasses, wxID_REMOVE_NETCLASS, _("Remove"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerButtons->Add( m_buttonRemove, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
sbSizer1->Add( buttonBoxSizer, 0, wxALIGN_CENTER_HORIZONTAL|wxBOTTOM, 5 );
sbSizer1->Add( bSizerButtons, 0, wxALIGN_CENTER_VERTICAL, 5 );
bMainSizer->Add( sbSizer1, 1, wxALL|wxEXPAND, 5 );
bmainSizerNclasses->Add( sbSizer1, 0, wxEXPAND, 5 );
wxStaticBoxSizer* sbSizer4;
sbSizer4 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Membership:") ), wxHORIZONTAL );
wxBoxSizer* bSizerNetSelect;
bSizerNetSelect = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* leftNetSelectBoxSizer;
leftNetSelectBoxSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bLeftSizerNetSelect;
bLeftSizerNetSelect = new wxBoxSizer( wxVERTICAL );
wxArrayString m_leftClassChoiceChoices;
m_leftClassChoice = new wxChoice( this, ID_LEFT_CHOICE_CLICK, wxDefaultPosition, wxDefaultSize, m_leftClassChoiceChoices, 0 );
m_leftClassChoice->SetSelection( 0 );
leftNetSelectBoxSizer->Add( m_leftClassChoice, 0, wxALL|wxEXPAND, 5 );
wxArrayString m_CBoxLeftSelectionChoices;
m_CBoxLeftSelection = new wxChoice( m_panelNetClasses, ID_LEFT_CHOICE_CLICK, wxDefaultPosition, wxDefaultSize, m_CBoxLeftSelectionChoices, 0 );
m_CBoxLeftSelection->SetSelection( 0 );
bLeftSizerNetSelect->Add( m_CBoxLeftSelection, 0, wxALL|wxEXPAND, 5 );
m_leftListCtrl = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES );
m_leftListCtrl->SetMinSize( wxSize( 220,-1 ) );
m_listBoxLeftNetSelect = new wxListBox( m_panelNetClasses, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_EXTENDED );
bLeftSizerNetSelect->Add( m_listBoxLeftNetSelect, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 );
leftNetSelectBoxSizer->Add( m_leftListCtrl, 1, wxALL|wxEXPAND, 5 );
bSizerNetSelect->Add( bLeftSizerNetSelect, 1, wxEXPAND, 5 );
sbSizer4->Add( leftNetSelectBoxSizer, 1, wxALL|wxEXPAND, 5 );
wxBoxSizer* bmiddleSizerNetSelect;
bmiddleSizerNetSelect = new wxBoxSizer( wxVERTICAL );
m_buttonRightToLeft = new wxButton( m_panelNetClasses, ID_LEFT_TO_RIGHT_COPY, _("<<<"), wxDefaultPosition, wxDefaultSize, 0 );
bmiddleSizerNetSelect->Add( m_buttonRightToLeft, 0, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT, 5 );
m_buttonRightToLeft = new wxButton( this, ID_LEFT_TO_RIGHT_COPY, _("<<<"), wxDefaultPosition, wxDefaultSize, 0 );
bmiddleSizerNetSelect->Add( m_buttonRightToLeft, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 );
m_buttonLeftToRight = new wxButton( m_panelNetClasses, ID_RIGHT_TO_LEFT_COPY, _(">>>"), wxDefaultPosition, wxDefaultSize, 0 );
bmiddleSizerNetSelect->Add( m_buttonLeftToRight, 0, wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_buttonLeftToRight = new wxButton( this, ID_RIGHT_TO_LEFT_COPY, _(">>>"), wxDefaultPosition, wxDefaultSize, 0 );
bmiddleSizerNetSelect->Add( m_buttonLeftToRight, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 );
wxBoxSizer* bSizerButtonsSelecAll;
bSizerButtonsSelecAll = new wxBoxSizer( wxHORIZONTAL );
m_buttonLeftSelAll = new wxButton( m_panelNetClasses, wxID_ANY, _("<< Select All"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerButtonsSelecAll->Add( m_buttonLeftSelAll, 0, wxTOP|wxBOTTOM, 5 );
m_buttonLeftSelAll = new wxButton( this, wxID_ANY, _("<< Select All"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerButtonsSelecAll->Add( m_buttonLeftSelAll, 0, wxALL, 5 );
m_buttonRightSelAll = new wxButton( m_panelNetClasses, wxID_ANY, _("Select All >>"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerButtonsSelecAll->Add( m_buttonRightSelAll, 0, wxALIGN_RIGHT|wxALIGN_BOTTOM|wxTOP|wxBOTTOM, 5 );
m_buttonRightSelAll = new wxButton( this, wxID_ANY, _("Select All >>"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerButtonsSelecAll->Add( m_buttonRightSelAll, 0, wxALIGN_BOTTOM|wxALIGN_RIGHT|wxALL, 5 );
bmiddleSizerNetSelect->Add( bSizerButtonsSelecAll, 0, wxALIGN_CENTER_HORIZONTAL, 5 );
bSizerNetSelect->Add( bmiddleSizerNetSelect, 0, wxALIGN_CENTER_VERTICAL, 5 );
sbSizer4->Add( bmiddleSizerNetSelect, 0, wxALIGN_CENTER_VERTICAL, 5 );
wxBoxSizer* bLeftSizerNetSelect1;
bLeftSizerNetSelect1 = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* rghtNetSelectBoxSizer;
rghtNetSelectBoxSizer = new wxBoxSizer( wxVERTICAL );
wxArrayString m_CBoxRightSelectionChoices;
m_CBoxRightSelection = new wxChoice( m_panelNetClasses, ID_RIGHT_CHOICE_CLICK, wxDefaultPosition, wxDefaultSize, m_CBoxRightSelectionChoices, 0 );
m_CBoxRightSelection->SetSelection( 0 );
bLeftSizerNetSelect1->Add( m_CBoxRightSelection, 0, wxALL|wxEXPAND, 5 );
wxArrayString m_rightClassChoiceChoices;
m_rightClassChoice = new wxChoice( this, ID_RIGHT_CHOICE_CLICK, wxDefaultPosition, wxDefaultSize, m_rightClassChoiceChoices, 0 );
m_rightClassChoice->SetSelection( 0 );
rghtNetSelectBoxSizer->Add( m_rightClassChoice, 0, wxALL|wxEXPAND, 5 );
m_listBoxRightNetSelect = new wxListBox( m_panelNetClasses, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_EXTENDED );
bLeftSizerNetSelect1->Add( m_listBoxRightNetSelect, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_rightListCtrl = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES );
m_rightListCtrl->SetMinSize( wxSize( 220,-1 ) );
bSizerNetSelect->Add( bLeftSizerNetSelect1, 1, wxEXPAND, 5 );
rghtNetSelectBoxSizer->Add( m_rightListCtrl, 1, wxALL|wxEXPAND, 5 );
bmainSizerNclasses->Add( bSizerNetSelect, 1, wxEXPAND, 5 );
sbSizer4->Add( rghtNetSelectBoxSizer, 1, wxALL|wxEXPAND, 5 );
m_panelNetClasses->SetSizer( bmainSizerNclasses );
m_panelNetClasses->Layout();
bmainSizerNclasses->Fit( m_panelNetClasses );
m_notebook->AddPage( m_panelNetClasses, _("Net Classes"), false );
bMainSizer->Add( sbSizer4, 1, wxALL|wxEXPAND, 5 );
bMainSizer->Add( m_notebook, 1, wxALL|wxEXPAND, 5 );
m_staticTextMsg = new wxStaticText( this, wxID_ANY, _("Messages:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextMsg->Wrap( -1 );
bMainSizer->Add( m_staticTextMsg, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
wxStaticBoxSizer* sbSizer2;
sbSizer2 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Messages:") ), wxHORIZONTAL );
m_MessagesList = new wxHtmlWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO|wxSUNKEN_BORDER );
m_MessagesList->SetMinSize( wxSize( -1,100 ) );
bMainSizer->Add( m_MessagesList, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
sbSizer2->Add( m_MessagesList, 1, wxALL|wxEXPAND, 5 );
bMainSizer->Add( sbSizer2, 0, wxALL|wxEXPAND, 5 );
m_sdbSizer1 = new wxStdDialogButtonSizer();
m_sdbSizer1OK = new wxButton( this, wxID_OK );
......@@ -216,25 +156,22 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID
m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
m_sdbSizer1->Realize();
bMainSizer->Add( m_sdbSizer1, 0, wxALIGN_RIGHT, 5 );
bMainSizer->Add( m_sdbSizer1, 0, wxALIGN_RIGHT|wxALL|wxEXPAND, 5 );
this->SetSizer( bMainSizer );
this->Layout();
// Connect Events
m_LayersCountSelection->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnLayerCountClick ), NULL, this );
m_gridLayersProperties->Connect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_DESIGN_RULES_BASE::OnLayerGridLeftClick ), NULL, this );
m_gridLayersProperties->Connect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( DIALOG_DESIGN_RULES_BASE::OnLayerGridRighttClick ), NULL, this );
m_gridNetClassesProperties->Connect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_DESIGN_RULES_BASE::OnNetClassesGridLeftClick ), NULL, this );
m_gridNetClassesProperties->Connect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( DIALOG_DESIGN_RULES_BASE::OnNetClassesGridRightClick ), NULL, this );
m_buttonADD->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnAddNetclassClick ), NULL, this );
m_buttonRemove->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnRemoveNetclassClick ), NULL, this );
m_CBoxLeftSelection->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnLeftCBSelection ), NULL, this );
m_grid->Connect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_DESIGN_RULES_BASE::OnNetClassesGridLeftClick ), NULL, this );
m_grid->Connect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( DIALOG_DESIGN_RULES_BASE::OnNetClassesGridRightClick ), NULL, this );
m_addButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnAddNetclassClick ), NULL, this );
m_removeButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnRemoveNetclassClick ), NULL, this );
m_leftClassChoice->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnLeftCBSelection ), NULL, this );
m_buttonRightToLeft->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnRightToLeftCopyButton ), NULL, this );
m_buttonLeftToRight->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnLeftToRightCopyButton ), NULL, this );
m_buttonLeftSelAll->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnLeftSelectAllButton ), NULL, this );
m_buttonRightSelAll->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnRightSelectAllButton ), NULL, this );
m_CBoxRightSelection->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnRightCBSelection ), NULL, this );
m_rightClassChoice->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnRightCBSelection ), NULL, this );
m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnCancelButtonClick ), NULL, this );
m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnOkButtonClick ), NULL, this );
}
......@@ -242,19 +179,17 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID
DIALOG_DESIGN_RULES_BASE::~DIALOG_DESIGN_RULES_BASE()
{
// Disconnect Events
m_LayersCountSelection->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnLayerCountClick ), NULL, this );
m_gridLayersProperties->Disconnect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_DESIGN_RULES_BASE::OnLayerGridLeftClick ), NULL, this );
m_gridLayersProperties->Disconnect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( DIALOG_DESIGN_RULES_BASE::OnLayerGridRighttClick ), NULL, this );
m_gridNetClassesProperties->Disconnect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_DESIGN_RULES_BASE::OnNetClassesGridLeftClick ), NULL, this );
m_gridNetClassesProperties->Disconnect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( DIALOG_DESIGN_RULES_BASE::OnNetClassesGridRightClick ), NULL, this );
m_buttonADD->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnAddNetclassClick ), NULL, this );
m_buttonRemove->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnRemoveNetclassClick ), NULL, this );
m_CBoxLeftSelection->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnLeftCBSelection ), NULL, this );
m_grid->Disconnect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_DESIGN_RULES_BASE::OnNetClassesGridLeftClick ), NULL, this );
m_grid->Disconnect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( DIALOG_DESIGN_RULES_BASE::OnNetClassesGridRightClick ), NULL, this );
m_addButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnAddNetclassClick ), NULL, this );
m_removeButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnRemoveNetclassClick ), NULL, this );
m_leftClassChoice->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnLeftCBSelection ), NULL, this );
m_buttonRightToLeft->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnRightToLeftCopyButton ), NULL, this );
m_buttonLeftToRight->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnLeftToRightCopyButton ), NULL, this );
m_buttonLeftSelAll->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnLeftSelectAllButton ), NULL, this );
m_buttonRightSelAll->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnRightSelectAllButton ), NULL, this );
m_CBoxRightSelection->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnRightCBSelection ), NULL, this );
m_rightClassChoice->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnRightCBSelection ), NULL, this );
m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnCancelButtonClick ), NULL, this );
m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnOkButtonClick ), NULL, this );
}
This source diff could not be displayed because it is too large. You can view the blob instead.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// C++ code generated with wxFormBuilder (version Sep 9 2009)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -10,37 +10,28 @@
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/radiobox.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/string.h>
#include <wx/font.h>
#include <wx/grid.h>
#include <wx/sizer.h>
#include <wx/panel.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/gdicmn.h>
#include <wx/button.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/choice.h>
#include <wx/listbox.h>
#include <wx/notebook.h>
#include <wx/stattext.h>
#include <wx/listctrl.h>
#include <wx/html/htmlwin.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
#define ID_LAYERS_COUNT_SELECTION 1000
#define ID_LAYERS_PROPERTIES 1001
#define wxID_ADD_NETCLASS 1002
#define wxID_REMOVE_NETCLASS 1003
#define ID_LEFT_CHOICE_CLICK 1004
#define ID_LEFT_TO_RIGHT_COPY 1005
#define ID_RIGHT_TO_LEFT_COPY 1006
#define ID_RIGHT_CHOICE_CLICK 1007
#define wxID_ADD_NETCLASS 1000
#define wxID_REMOVE_NETCLASS 1001
#define ID_LEFT_CHOICE_CLICK 1002
#define ID_LEFT_TO_RIGHT_COPY 1003
#define ID_RIGHT_TO_LEFT_COPY 1004
#define ID_RIGHT_CHOICE_CLICK 1005
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_DESIGN_RULES_BASE
......@@ -50,48 +41,41 @@ class DIALOG_DESIGN_RULES_BASE : public wxDialog
private:
protected:
wxNotebook* m_notebook;
wxPanel* m_panelLayers;
wxRadioBox* m_LayersCountSelection;
wxGrid* m_gridLayersProperties;
wxPanel* m_panelNetClasses;
wxGrid* m_gridNetClassesProperties;
wxButton* m_buttonADD;
wxButton* m_buttonRemove;
wxChoice* m_CBoxLeftSelection;
wxListBox* m_listBoxLeftNetSelect;
wxGrid* m_grid;
wxButton* m_addButton;
wxButton* m_removeButton;
wxButton* m_moveUpButton;
wxChoice* m_leftClassChoice;
wxListCtrl* m_leftListCtrl;
wxButton* m_buttonRightToLeft;
wxButton* m_buttonLeftToRight;
wxButton* m_buttonLeftSelAll;
wxButton* m_buttonRightSelAll;
wxChoice* m_CBoxRightSelection;
wxListBox* m_listBoxRightNetSelect;
wxStaticText* m_staticTextMsg;
wxChoice* m_rightClassChoice;
wxListCtrl* m_rightListCtrl;
wxHtmlWindow* m_MessagesList;
wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Cancel;
// Virtual event handlers, overide them in your derived class
virtual void OnLayerCountClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnLayerGridLeftClick( wxGridEvent& event ){ event.Skip(); }
virtual void OnLayerGridRighttClick( wxGridEvent& event ){ event.Skip(); }
virtual void OnNetClassesGridLeftClick( wxGridEvent& event ){ event.Skip(); }
virtual void OnNetClassesGridRightClick( wxGridEvent& event ){ event.Skip(); }
virtual void OnAddNetclassClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnRemoveNetclassClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnLeftCBSelection( wxCommandEvent& event ){ event.Skip(); }
virtual void OnRightToLeftCopyButton( wxCommandEvent& event ){ event.Skip(); }
virtual void OnLeftToRightCopyButton( wxCommandEvent& event ){ event.Skip(); }
virtual void OnLeftSelectAllButton( wxCommandEvent& event ){ event.Skip(); }
virtual void OnRightSelectAllButton( wxCommandEvent& event ){ event.Skip(); }
virtual void OnRightCBSelection( wxCommandEvent& event ){ event.Skip(); }
virtual void OnCancelButtonClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnOkButtonClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnNetClassesGridLeftClick( wxGridEvent& event ) { event.Skip(); }
virtual void OnNetClassesGridRightClick( wxGridEvent& event ) { event.Skip(); }
virtual void OnAddNetclassClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnRemoveNetclassClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnLeftCBSelection( wxCommandEvent& event ) { event.Skip(); }
virtual void OnRightToLeftCopyButton( wxCommandEvent& event ) { event.Skip(); }
virtual void OnLeftToRightCopyButton( wxCommandEvent& event ) { event.Skip(); }
virtual void OnLeftSelectAllButton( wxCommandEvent& event ) { event.Skip(); }
virtual void OnRightSelectAllButton( wxCommandEvent& event ) { event.Skip(); }
virtual void OnRightCBSelection( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOkButtonClick( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Design Rules Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 684,568 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Design Rules Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 750,520 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_DESIGN_RULES_BASE();
};
......
......@@ -87,7 +87,7 @@ void DIALOG_DRC_CONTROL::OnStartdrcClick( wxCommandEvent& event )
reportName = m_RptFilenameCtrl->GetValue();
}
g_DesignSettings.m_TrackClearence =
g_DesignSettings.m_TrackClearance =
ReturnValueFromTextCtrl( *m_SetClearance, m_Parent->m_InternalUnits );
g_DesignSettings.m_TrackMinWidth =
ReturnValueFromTextCtrl( *m_SetTrackMinWidthCtrl, m_Parent->m_InternalUnits );
......@@ -101,15 +101,14 @@ void DIALOG_DRC_CONTROL::OnStartdrcClick( wxCommandEvent& event )
true, // DRC test for zones enabled
reportName, m_CreateRptCtrl->IsChecked() );
DelDRCMarkers();
wxBeginBusyCursor();
// run all the tests, with no UI at this time.
m_Messages->Clear();
wxSafeYield(); // Allows time slice to refresh the m_Messages window
m_tester->m_pcb->m_Status_Pcb = 0; // Force full connectivity and ratsnest recalculations
wxSafeYield(); // Allows time slice to refresh the m_Messages window
m_tester->m_pcb->m_Status_Pcb = 0; // Force full connectivity and ratsnest recalculations
m_tester->RunTests(m_Messages);
#if wxCHECK_VERSION( 2, 8, 0 )
......@@ -127,7 +126,7 @@ void DIALOG_DRC_CONTROL::OnStartdrcClick( wxCommandEvent& event )
fclose( fp );
wxString msg;
msg.Printf( _( "Report file \"%s\" created" ), reportName.GetData() );
msg.Printf( _( "Report file \"%s\" created" ), GetChars( reportName ) );
wxString caption( _( "Disk File Report Completed" ) );
wxMessageDialog popupWindow( this, msg, caption );
......@@ -173,7 +172,7 @@ void DIALOG_DRC_CONTROL::OnListUnconnectedClick( wxCommandEvent& event )
reportName = m_RptFilenameCtrl->GetValue();
}
g_DesignSettings.m_TrackClearence =
g_DesignSettings.m_TrackClearance =
ReturnValueFromTextCtrl( *m_SetClearance, m_Parent->m_InternalUnits );
g_DesignSettings.m_TrackMinWidth =
ReturnValueFromTextCtrl( *m_SetTrackMinWidthCtrl, m_Parent->m_InternalUnits );
......@@ -208,7 +207,7 @@ void DIALOG_DRC_CONTROL::OnListUnconnectedClick( wxCommandEvent& event )
fclose( fp );
wxString msg;
msg.Printf( _( "Report file \"%s\" created" ), reportName.GetData() );
msg.Printf( _( "Report file \"%s\" created" ), GetChars( reportName ) );
wxString caption( _( "Disk File Report Completed" ) );
wxMessageDialog popupWindow( this, msg, caption );
popupWindow.ShowModal();
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_drc.h"
#include "dialog_drc_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_DRC_CONTROL_BASE::DIALOG_DRC_CONTROL_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* m_MainSizer;
m_MainSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* m_CommandSizer;
m_CommandSizer = new wxBoxSizer( wxHORIZONTAL );
wxStaticBoxSizer* sbSizerOptions;
sbSizerOptions = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Options") ), wxHORIZONTAL );
wxBoxSizer* bSizer7;
bSizer7 = new wxBoxSizer( wxVERTICAL );
wxFlexGridSizer* fgMinValuesSizer;
fgMinValuesSizer = new wxFlexGridSizer( 2, 4, 0, 0 );
fgMinValuesSizer->SetFlexibleDirection( wxBOTH );
fgMinValuesSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_ClearenceTitle = new wxStaticText( this, wxID_ANY, _("Clearance"), wxDefaultPosition, wxDefaultSize, 0 );
m_ClearenceTitle->Wrap( -1 );
fgMinValuesSizer->Add( m_ClearenceTitle, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT|wxALIGN_RIGHT, 5 );
m_SetClearance = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_SetClearance->SetToolTip( _("In the clearance units, enter the clearance distance") );
fgMinValuesSizer->Add( m_SetClearance, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_ViaMinTitle = new wxStaticText( this, wxID_ANY, _("Via Min Size"), wxDefaultPosition, wxDefaultSize, 0 );
m_ViaMinTitle->Wrap( -1 );
fgMinValuesSizer->Add( m_ViaMinTitle, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT|wxALIGN_RIGHT, 5 );
m_SetViaMinSizeCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_SetViaMinSizeCtrl->SetToolTip( _("In the clearance units, enter the clearance distance") );
fgMinValuesSizer->Add( m_SetViaMinSizeCtrl, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_TrackMinWidthTitle
= new wxStaticText( this, wxID_ANY, _("Track Min Width"), wxDefaultPosition, wxDefaultSize, 0 );
m_TrackMinWidthTitle
->Wrap( -1 );
fgMinValuesSizer->Add( m_TrackMinWidthTitle
, 0, wxALIGN_RIGHT|wxTOP|wxBOTTOM|wxLEFT, 5 );
m_SetTrackMinWidthCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_SetTrackMinWidthCtrl->SetToolTip( _("In the clearance units, enter the clearance distance") );
fgMinValuesSizer->Add( m_SetTrackMinWidthCtrl, 0, wxALL, 5 );
m_MicroViaMinTitle = new wxStaticText( this, wxID_ANY, _("MicroVia Min Size"), wxDefaultPosition, wxDefaultSize, 0 );
m_MicroViaMinTitle->Wrap( -1 );
fgMinValuesSizer->Add( m_MicroViaMinTitle, 0, wxALIGN_RIGHT|wxTOP|wxBOTTOM|wxLEFT, 5 );
m_SetMicroViakMinSizeCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_SetMicroViakMinSizeCtrl->SetToolTip( _("In the clearance units, enter the clearance distance") );
fgMinValuesSizer->Add( m_SetMicroViakMinSizeCtrl, 0, wxALL, 5 );
bSizer7->Add( fgMinValuesSizer, 1, wxEXPAND, 5 );
wxStaticBoxSizer* ReportFileSizer;
ReportFileSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Create Report File") ), wxHORIZONTAL );
m_CreateRptCtrl = new wxCheckBox( this, ID_CHECKBOX_RPT_FILE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_CreateRptCtrl->SetToolTip( _("Enable writing report to this file") );
ReportFileSizer->Add( m_CreateRptCtrl, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_RptFilenameCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_RptFilenameCtrl->SetToolTip( _("Enter the report filename") );
m_RptFilenameCtrl->SetMinSize( wxSize( 250,-1 ) );
ReportFileSizer->Add( m_RptFilenameCtrl, 1, wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
m_BrowseButton = new wxButton( this, ID_BUTTON_BROWSE_RPT_FILE, _("..."), wxDefaultPosition, wxDefaultSize, 0 );
ReportFileSizer->Add( m_BrowseButton, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
bSizer7->Add( ReportFileSizer, 1, wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT, 5 );
sbSizerOptions->Add( bSizer7, 1, wxEXPAND, 5 );
m_CommandSizer->Add( sbSizerOptions, 0, 0, 5 );
wxBoxSizer* bSizerMessages;
bSizerMessages = new wxBoxSizer( wxVERTICAL );
m_staticText6 = new wxStaticText( this, wxID_ANY, _("Messages:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText6->Wrap( -1 );
bSizerMessages->Add( m_staticText6, 0, wxRIGHT|wxLEFT, 5 );
m_Messages = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxTE_MULTILINE|wxTE_READONLY );
m_Messages->SetMinSize( wxSize( 160,-1 ) );
bSizerMessages->Add( m_Messages, 1, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_CommandSizer->Add( bSizerMessages, 1, wxEXPAND, 5 );
wxBoxSizer* bSizer11;
bSizer11 = new wxBoxSizer( wxVERTICAL );
m_buttonRunDRC = new wxButton( this, ID_STARTDRC, _("Start DRC"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonRunDRC->SetDefault();
m_buttonRunDRC->SetToolTip( _("Start the Design Rule Checker") );
bSizer11->Add( m_buttonRunDRC, 0, wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
m_buttonListUnconnected = new wxButton( this, ID_LIST_UNCONNECTED, _("List Unconnected"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonListUnconnected->SetToolTip( _("List unconnected pads or tracks") );
bSizer11->Add( m_buttonListUnconnected, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
m_DeleteAllButton = new wxButton( this, ID_DELETE_ALL, _("Delete All Markers"), wxDefaultPosition, wxDefaultSize, 0 );
m_DeleteAllButton->SetToolTip( _("Delete every marker") );
bSizer11->Add( m_DeleteAllButton, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
m_DeleteCurrentMarkerButton = new wxButton( this, wxID_ANY, _("Delete Current Marker"), wxDefaultPosition, wxDefaultSize, 0 );
m_DeleteCurrentMarkerButton->SetToolTip( _("Delete the marker selected in the listBox below") );
bSizer11->Add( m_DeleteCurrentMarkerButton, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxALL, 5 );
m_CommandSizer->Add( bSizer11, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_MainSizer->Add( m_CommandSizer, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
m_staticTextErrMsg = new wxStaticText( this, wxID_ANY, _("Error Messages:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextErrMsg->Wrap( -1 );
m_MainSizer->Add( m_staticTextErrMsg, 0, wxALL, 5 );
m_Notebook = new wxNotebook( this, ID_NOTEBOOK1, wxDefaultPosition, wxDefaultSize, 0 );
m_panelClearanceListBox = new wxPanel( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizeClearanceBox;
bSizeClearanceBox = new wxBoxSizer( wxVERTICAL );
m_ClearanceListBox = new DRCLISTBOX( m_panelClearanceListBox, ID_CLEARANCE_LIST, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
m_ClearanceListBox->SetToolTip( _("MARKERs, double click any to go there in PCB, right click for popup menu") );
m_ClearanceListBox->SetMinSize( wxSize( 450,300 ) );
bSizeClearanceBox->Add( m_ClearanceListBox, 1, wxALL|wxEXPAND, 5 );
m_panelClearanceListBox->SetSizer( bSizeClearanceBox );
m_panelClearanceListBox->Layout();
bSizeClearanceBox->Fit( m_panelClearanceListBox );
m_Notebook->AddPage( m_panelClearanceListBox, _("Distance Problem Markers"), true );
m_panelUnconnectedBox = new wxPanel( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizerUnconnectedBox;
bSizerUnconnectedBox = new wxBoxSizer( wxVERTICAL );
m_UnconnectedListBox = new DRCLISTBOX( m_panelUnconnectedBox, ID_UNCONNECTED_LIST, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
m_UnconnectedListBox->SetToolTip( _("A list of unconnected pads, right click for popup menu") );
bSizerUnconnectedBox->Add( m_UnconnectedListBox, 1, wxALL|wxEXPAND, 5 );
m_panelUnconnectedBox->SetSizer( bSizerUnconnectedBox );
m_panelUnconnectedBox->Layout();
bSizerUnconnectedBox->Fit( m_panelUnconnectedBox );
m_Notebook->AddPage( m_panelUnconnectedBox, _("Unconnected"), false );
m_MainSizer->Add( m_Notebook, 1, wxEXPAND | wxALL, 5 );
m_sdbSizer1 = new wxStdDialogButtonSizer();
m_sdbSizer1OK = new wxButton( this, wxID_OK );
m_sdbSizer1->AddButton( m_sdbSizer1OK );
m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
m_sdbSizer1->Realize();
m_MainSizer->Add( m_sdbSizer1, 0, wxALIGN_RIGHT|wxALL, 5 );
this->SetSizer( m_MainSizer );
this->Layout();
// Connect Events
m_CreateRptCtrl->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnReportCheckBoxClicked ), NULL, this );
m_BrowseButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnButtonBrowseRptFileClick ), NULL, this );
m_buttonRunDRC->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnStartdrcClick ), NULL, this );
m_buttonListUnconnected->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnListUnconnectedClick ), NULL, this );
m_DeleteAllButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnDeleteAllClick ), NULL, this );
m_DeleteCurrentMarkerButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnDeleteOneClick ), NULL, this );
m_ClearanceListBox->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( DIALOG_DRC_CONTROL_BASE::OnLeftDClickClearance ), NULL, this );
m_ClearanceListBox->Connect( wxEVT_RIGHT_UP, wxMouseEventHandler( DIALOG_DRC_CONTROL_BASE::OnRightUpClearance ), NULL, this );
m_UnconnectedListBox->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( DIALOG_DRC_CONTROL_BASE::OnLeftDClickUnconnected ), NULL, this );
m_UnconnectedListBox->Connect( wxEVT_RIGHT_UP, wxMouseEventHandler( DIALOG_DRC_CONTROL_BASE::OnRightUpUnconnected ), NULL, this );
m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnCancelClick ), NULL, this );
m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnOkClick ), NULL, this );
}
DIALOG_DRC_CONTROL_BASE::~DIALOG_DRC_CONTROL_BASE()
{
// Disconnect Events
m_CreateRptCtrl->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnReportCheckBoxClicked ), NULL, this );
m_BrowseButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnButtonBrowseRptFileClick ), NULL, this );
m_buttonRunDRC->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnStartdrcClick ), NULL, this );
m_buttonListUnconnected->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnListUnconnectedClick ), NULL, this );
m_DeleteAllButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnDeleteAllClick ), NULL, this );
m_DeleteCurrentMarkerButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnDeleteOneClick ), NULL, this );
m_ClearanceListBox->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( DIALOG_DRC_CONTROL_BASE::OnLeftDClickClearance ), NULL, this );
m_ClearanceListBox->Disconnect( wxEVT_RIGHT_UP, wxMouseEventHandler( DIALOG_DRC_CONTROL_BASE::OnRightUpClearance ), NULL, this );
m_UnconnectedListBox->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( DIALOG_DRC_CONTROL_BASE::OnLeftDClickUnconnected ), NULL, this );
m_UnconnectedListBox->Disconnect( wxEVT_RIGHT_UP, wxMouseEventHandler( DIALOG_DRC_CONTROL_BASE::OnRightUpUnconnected ), NULL, this );
m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnCancelClick ), NULL, this );
m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnOkClick ), NULL, this );
}
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Sep 9 2009)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_drc.h"
#include "dialog_drc_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_DRC_CONTROL_BASE::DIALOG_DRC_CONTROL_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* m_MainSizer;
m_MainSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* m_CommandSizer;
m_CommandSizer = new wxBoxSizer( wxHORIZONTAL );
wxStaticBoxSizer* sbSizerOptions;
sbSizerOptions = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Options") ), wxHORIZONTAL );
wxBoxSizer* bSizer7;
bSizer7 = new wxBoxSizer( wxVERTICAL );
wxFlexGridSizer* fgMinValuesSizer;
fgMinValuesSizer = new wxFlexGridSizer( 2, 4, 0, 0 );
fgMinValuesSizer->SetFlexibleDirection( wxBOTH );
fgMinValuesSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_ClearenceTitle = new wxStaticText( this, wxID_ANY, _("Clearance"), wxDefaultPosition, wxDefaultSize, 0 );
m_ClearenceTitle->Wrap( -1 );
fgMinValuesSizer->Add( m_ClearenceTitle, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT|wxALIGN_RIGHT, 5 );
m_SetClearance = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_SetClearance->SetToolTip( _("In the clearance units, enter the clearance distance") );
fgMinValuesSizer->Add( m_SetClearance, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_ViaMinTitle = new wxStaticText( this, wxID_ANY, _("Via Min Size"), wxDefaultPosition, wxDefaultSize, 0 );
m_ViaMinTitle->Wrap( -1 );
fgMinValuesSizer->Add( m_ViaMinTitle, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT|wxALIGN_RIGHT, 5 );
m_SetViaMinSizeCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_SetViaMinSizeCtrl->SetToolTip( _("In the clearance units, enter the clearance distance") );
fgMinValuesSizer->Add( m_SetViaMinSizeCtrl, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_TrackMinWidthTitle
= new wxStaticText( this, wxID_ANY, _("Track Min Width"), wxDefaultPosition, wxDefaultSize, 0 );
m_TrackMinWidthTitle
->Wrap( -1 );
fgMinValuesSizer->Add( m_TrackMinWidthTitle
, 0, wxALIGN_RIGHT|wxTOP|wxBOTTOM|wxLEFT, 5 );
m_SetTrackMinWidthCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_SetTrackMinWidthCtrl->SetToolTip( _("In the clearance units, enter the clearance distance") );
fgMinValuesSizer->Add( m_SetTrackMinWidthCtrl, 0, wxALL, 5 );
m_MicroViaMinTitle = new wxStaticText( this, wxID_ANY, _("MicroVia Min Size"), wxDefaultPosition, wxDefaultSize, 0 );
m_MicroViaMinTitle->Wrap( -1 );
fgMinValuesSizer->Add( m_MicroViaMinTitle, 0, wxALIGN_RIGHT|wxTOP|wxBOTTOM|wxLEFT, 5 );
m_SetMicroViakMinSizeCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_SetMicroViakMinSizeCtrl->SetToolTip( _("In the clearance units, enter the clearance distance") );
fgMinValuesSizer->Add( m_SetMicroViakMinSizeCtrl, 0, wxALL, 5 );
bSizer7->Add( fgMinValuesSizer, 1, wxEXPAND, 5 );
wxStaticBoxSizer* ReportFileSizer;
ReportFileSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Create Report File") ), wxHORIZONTAL );
m_CreateRptCtrl = new wxCheckBox( this, ID_CHECKBOX_RPT_FILE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_CreateRptCtrl->SetToolTip( _("Enable writing report to this file") );
ReportFileSizer->Add( m_CreateRptCtrl, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_RptFilenameCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_RptFilenameCtrl->SetToolTip( _("Enter the report filename") );
m_RptFilenameCtrl->SetMinSize( wxSize( 250,-1 ) );
ReportFileSizer->Add( m_RptFilenameCtrl, 1, wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
m_BrowseButton = new wxButton( this, ID_BUTTON_BROWSE_RPT_FILE, _("..."), wxDefaultPosition, wxDefaultSize, 0 );
ReportFileSizer->Add( m_BrowseButton, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
bSizer7->Add( ReportFileSizer, 1, wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT, 5 );
sbSizerOptions->Add( bSizer7, 1, wxEXPAND, 5 );
m_CommandSizer->Add( sbSizerOptions, 0, 0, 5 );
wxBoxSizer* bSizerMessages;
bSizerMessages = new wxBoxSizer( wxVERTICAL );
m_staticText6 = new wxStaticText( this, wxID_ANY, _("Messages:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText6->Wrap( -1 );
bSizerMessages->Add( m_staticText6, 0, wxRIGHT|wxLEFT, 5 );
m_Messages = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxTE_MULTILINE|wxTE_READONLY );
m_Messages->SetMinSize( wxSize( 160,-1 ) );
bSizerMessages->Add( m_Messages, 1, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_CommandSizer->Add( bSizerMessages, 1, wxEXPAND, 5 );
wxBoxSizer* bSizer11;
bSizer11 = new wxBoxSizer( wxVERTICAL );
m_buttonRunDRC = new wxButton( this, ID_STARTDRC, _("Start DRC"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonRunDRC->SetDefault();
m_buttonRunDRC->SetToolTip( _("Start the Design Rule Checker") );
bSizer11->Add( m_buttonRunDRC, 0, wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
m_buttonListUnconnected = new wxButton( this, ID_LIST_UNCONNECTED, _("List Unconnected"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonListUnconnected->SetToolTip( _("List unconnected pads or tracks") );
bSizer11->Add( m_buttonListUnconnected, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
m_DeleteAllButton = new wxButton( this, ID_DELETE_ALL, _("Delete All Markers"), wxDefaultPosition, wxDefaultSize, 0 );
m_DeleteAllButton->SetToolTip( _("Delete every marker") );
bSizer11->Add( m_DeleteAllButton, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
m_DeleteCurrentMarkerButton = new wxButton( this, wxID_ANY, _("Delete Current Marker"), wxDefaultPosition, wxDefaultSize, 0 );
m_DeleteCurrentMarkerButton->SetToolTip( _("Delete the marker selected in the listBox below") );
bSizer11->Add( m_DeleteCurrentMarkerButton, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxALL, 5 );
m_CommandSizer->Add( bSizer11, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_MainSizer->Add( m_CommandSizer, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
m_staticTextErrMsg = new wxStaticText( this, wxID_ANY, _("Error Messages:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextErrMsg->Wrap( -1 );
m_MainSizer->Add( m_staticTextErrMsg, 0, wxALL, 5 );
m_Notebook = new wxNotebook( this, ID_NOTEBOOK1, wxDefaultPosition, wxDefaultSize, 0 );
m_panelClearanceListBox = new wxPanel( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizeClearanceBox;
bSizeClearanceBox = new wxBoxSizer( wxVERTICAL );
m_ClearanceListBox = new DRCLISTBOX( m_panelClearanceListBox, ID_CLEARANCE_LIST, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
m_ClearanceListBox->SetToolTip( _("MARKERs, double click any to go there in PCB, right click for popup menu") );
m_ClearanceListBox->SetMinSize( wxSize( 450,300 ) );
bSizeClearanceBox->Add( m_ClearanceListBox, 1, wxALL|wxEXPAND, 5 );
m_panelClearanceListBox->SetSizer( bSizeClearanceBox );
m_panelClearanceListBox->Layout();
bSizeClearanceBox->Fit( m_panelClearanceListBox );
m_Notebook->AddPage( m_panelClearanceListBox, _("Problems / Markers"), true );
m_panelUnconnectedBox = new wxPanel( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizerUnconnectedBox;
bSizerUnconnectedBox = new wxBoxSizer( wxVERTICAL );
m_UnconnectedListBox = new DRCLISTBOX( m_panelUnconnectedBox, ID_UNCONNECTED_LIST, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
m_UnconnectedListBox->SetToolTip( _("A list of unconnected pads, right click for popup menu") );
bSizerUnconnectedBox->Add( m_UnconnectedListBox, 1, wxALL|wxEXPAND, 5 );
m_panelUnconnectedBox->SetSizer( bSizerUnconnectedBox );
m_panelUnconnectedBox->Layout();
bSizerUnconnectedBox->Fit( m_panelUnconnectedBox );
m_Notebook->AddPage( m_panelUnconnectedBox, _("Unconnected"), false );
m_MainSizer->Add( m_Notebook, 1, wxEXPAND | wxALL, 5 );
m_sdbSizer1 = new wxStdDialogButtonSizer();
m_sdbSizer1OK = new wxButton( this, wxID_OK );
m_sdbSizer1->AddButton( m_sdbSizer1OK );
m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
m_sdbSizer1->Realize();
m_MainSizer->Add( m_sdbSizer1, 0, wxALIGN_RIGHT|wxALL, 5 );
this->SetSizer( m_MainSizer );
this->Layout();
// Connect Events
m_CreateRptCtrl->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnReportCheckBoxClicked ), NULL, this );
m_BrowseButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnButtonBrowseRptFileClick ), NULL, this );
m_buttonRunDRC->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnStartdrcClick ), NULL, this );
m_buttonListUnconnected->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnListUnconnectedClick ), NULL, this );
m_DeleteAllButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnDeleteAllClick ), NULL, this );
m_DeleteCurrentMarkerButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnDeleteOneClick ), NULL, this );
m_ClearanceListBox->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( DIALOG_DRC_CONTROL_BASE::OnLeftDClickClearance ), NULL, this );
m_ClearanceListBox->Connect( wxEVT_RIGHT_UP, wxMouseEventHandler( DIALOG_DRC_CONTROL_BASE::OnRightUpClearance ), NULL, this );
m_UnconnectedListBox->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( DIALOG_DRC_CONTROL_BASE::OnLeftDClickUnconnected ), NULL, this );
m_UnconnectedListBox->Connect( wxEVT_RIGHT_UP, wxMouseEventHandler( DIALOG_DRC_CONTROL_BASE::OnRightUpUnconnected ), NULL, this );
m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnCancelClick ), NULL, this );
m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnOkClick ), NULL, this );
}
DIALOG_DRC_CONTROL_BASE::~DIALOG_DRC_CONTROL_BASE()
{
// Disconnect Events
m_CreateRptCtrl->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnReportCheckBoxClicked ), NULL, this );
m_BrowseButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnButtonBrowseRptFileClick ), NULL, this );
m_buttonRunDRC->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnStartdrcClick ), NULL, this );
m_buttonListUnconnected->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnListUnconnectedClick ), NULL, this );
m_DeleteAllButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnDeleteAllClick ), NULL, this );
m_DeleteCurrentMarkerButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnDeleteOneClick ), NULL, this );
m_ClearanceListBox->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( DIALOG_DRC_CONTROL_BASE::OnLeftDClickClearance ), NULL, this );
m_ClearanceListBox->Disconnect( wxEVT_RIGHT_UP, wxMouseEventHandler( DIALOG_DRC_CONTROL_BASE::OnRightUpClearance ), NULL, this );
m_UnconnectedListBox->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( DIALOG_DRC_CONTROL_BASE::OnLeftDClickUnconnected ), NULL, this );
m_UnconnectedListBox->Disconnect( wxEVT_RIGHT_UP, wxMouseEventHandler( DIALOG_DRC_CONTROL_BASE::OnRightUpUnconnected ), NULL, this );
m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnCancelClick ), NULL, this );
m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnOkClick ), NULL, this );
}
This source diff could not be displayed because it is too large. You can view the blob instead.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_drc_base__
#define __dialog_drc_base__
#include <wx/intl.h>
class DRCLISTBOX;
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/checkbox.h>
#include <wx/button.h>
#include <wx/statbox.h>
#include <wx/listbox.h>
#include <wx/panel.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/notebook.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
#define ID_CHECKBOX_RPT_FILE 1000
#define ID_BUTTON_BROWSE_RPT_FILE 1001
#define ID_STARTDRC 1002
#define ID_LIST_UNCONNECTED 1003
#define ID_DELETE_ALL 1004
#define ID_NOTEBOOK1 1005
#define ID_CLEARANCE_LIST 1006
#define ID_UNCONNECTED_LIST 1007
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_DRC_CONTROL_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_DRC_CONTROL_BASE : public wxDialog
{
private:
protected:
wxStaticText* m_ClearenceTitle;
wxStaticText* m_ViaMinTitle;
wxStaticText* m_TrackMinWidthTitle
;
wxStaticText* m_MicroViaMinTitle;
wxButton* m_BrowseButton;
wxStaticText* m_staticText6;
wxTextCtrl* m_Messages;
wxButton* m_buttonRunDRC;
wxButton* m_buttonListUnconnected;
wxButton* m_DeleteAllButton;
wxButton* m_DeleteCurrentMarkerButton;
wxStaticText* m_staticTextErrMsg;
wxNotebook* m_Notebook;
wxPanel* m_panelClearanceListBox;
wxPanel* m_panelUnconnectedBox;
wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Cancel;
// Virtual event handlers, overide them in your derived class
virtual void OnReportCheckBoxClicked( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonBrowseRptFileClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnStartdrcClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnListUnconnectedClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnDeleteAllClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnDeleteOneClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnLeftDClickClearance( wxMouseEvent& event ){ event.Skip(); }
virtual void OnRightUpClearance( wxMouseEvent& event ){ event.Skip(); }
virtual void OnLeftDClickUnconnected( wxMouseEvent& event ){ event.Skip(); }
virtual void OnRightUpUnconnected( wxMouseEvent& event ){ event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ){ event.Skip(); }
public:
wxTextCtrl* m_SetClearance;
wxTextCtrl* m_SetViaMinSizeCtrl;
wxTextCtrl* m_SetTrackMinWidthCtrl;
wxTextCtrl* m_SetMicroViakMinSizeCtrl;
wxCheckBox* m_CreateRptCtrl;
wxTextCtrl* m_RptFilenameCtrl;
DRCLISTBOX* m_ClearanceListBox;
DRCLISTBOX* m_UnconnectedListBox;
DIALOG_DRC_CONTROL_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("DRC Control"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 683,508 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_DRC_CONTROL_BASE();
};
#endif //__dialog_drc_base__
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Sep 9 2009)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_drc_base__
#define __dialog_drc_base__
#include <wx/intl.h>
class DRCLISTBOX;
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/checkbox.h>
#include <wx/button.h>
#include <wx/statbox.h>
#include <wx/listbox.h>
#include <wx/panel.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/notebook.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
#define ID_CHECKBOX_RPT_FILE 1000
#define ID_BUTTON_BROWSE_RPT_FILE 1001
#define ID_STARTDRC 1002
#define ID_LIST_UNCONNECTED 1003
#define ID_DELETE_ALL 1004
#define ID_NOTEBOOK1 1005
#define ID_CLEARANCE_LIST 1006
#define ID_UNCONNECTED_LIST 1007
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_DRC_CONTROL_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_DRC_CONTROL_BASE : public wxDialog
{
private:
protected:
wxStaticText* m_ClearenceTitle;
wxStaticText* m_ViaMinTitle;
wxStaticText* m_TrackMinWidthTitle
;
wxStaticText* m_MicroViaMinTitle;
wxButton* m_BrowseButton;
wxStaticText* m_staticText6;
wxTextCtrl* m_Messages;
wxButton* m_buttonRunDRC;
wxButton* m_buttonListUnconnected;
wxButton* m_DeleteAllButton;
wxButton* m_DeleteCurrentMarkerButton;
wxStaticText* m_staticTextErrMsg;
wxNotebook* m_Notebook;
wxPanel* m_panelClearanceListBox;
wxPanel* m_panelUnconnectedBox;
wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Cancel;
// Virtual event handlers, overide them in your derived class
virtual void OnReportCheckBoxClicked( wxCommandEvent& event ) { event.Skip(); }
virtual void OnButtonBrowseRptFileClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnStartdrcClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnListUnconnectedClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnDeleteAllClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnDeleteOneClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnLeftDClickClearance( wxMouseEvent& event ) { event.Skip(); }
virtual void OnRightUpClearance( wxMouseEvent& event ) { event.Skip(); }
virtual void OnLeftDClickUnconnected( wxMouseEvent& event ) { event.Skip(); }
virtual void OnRightUpUnconnected( wxMouseEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
public:
wxTextCtrl* m_SetClearance;
wxTextCtrl* m_SetViaMinSizeCtrl;
wxTextCtrl* m_SetTrackMinWidthCtrl;
wxTextCtrl* m_SetMicroViakMinSizeCtrl;
wxCheckBox* m_CreateRptCtrl;
wxTextCtrl* m_RptFilenameCtrl;
DRCLISTBOX* m_ClearanceListBox;
DRCLISTBOX* m_UnconnectedListBox;
DIALOG_DRC_CONTROL_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("DRC Control"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 800,508 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_DRC_CONTROL_BASE();
};
#endif //__dialog_drc_base__
......@@ -70,7 +70,7 @@ void DIALOG_TRACKS_OPTIONS::SetDisplayValue()
g_DesignSettings.m_ViaDrillCustomValue,
Internal_Unit );
PutValueInLocalUnits( *m_OptTrackWidth, g_DesignSettings.m_CurrentTrackWidth, Internal_Unit );
PutValueInLocalUnits( *m_OptTrackClearance, g_DesignSettings.m_TrackClearence, Internal_Unit );
PutValueInLocalUnits( *m_OptTrackClearance, g_DesignSettings.m_TrackClearance, Internal_Unit );
PutValueInLocalUnits( *m_OptMaskMargin, g_DesignSettings.m_MaskMargin, Internal_Unit );
if( g_DesignSettings.m_CurrentViaType != VIA_THROUGH )
m_OptViaType->SetSelection( 1 );
......@@ -109,7 +109,7 @@ void DIALOG_TRACKS_OPTIONS::OnButtonOkClick( wxCommandEvent& event )
g_DesignSettings.m_CurrentTrackWidth =
ReturnValueFromTextCtrl( *m_OptTrackWidth, m_Parent->m_InternalUnits );
g_DesignSettings.m_TrackClearence =
g_DesignSettings.m_TrackClearance =
ReturnValueFromTextCtrl( *m_OptTrackClearance, m_Parent->m_InternalUnits );
g_DesignSettings.m_MaskMargin =
......@@ -119,7 +119,7 @@ void DIALOG_TRACKS_OPTIONS::OnButtonOkClick( wxCommandEvent& event )
m_Parent->AddHistory( g_DesignSettings.m_CurrentViaSize, TYPE_VIA );
m_Parent->AddHistory( g_DesignSettings.m_CurrentTrackWidth, TYPE_TRACK );
m_Parent->AddHistory( g_DesignSettings.m_TrackClearence, TYPE_CLEARANCE );
m_Parent->AddHistory( g_DesignSettings.m_TrackClearance, TYPE_CLEARANCE );
EndModal( 1 );
}
......@@ -169,12 +169,12 @@ void WinEDA_BasePcbFrame::AddHistory( int value, KICAD_T type )
g_DesignSettings.m_TrackWidthHistory[ii + 1] );
}
}
break;
case TYPE_CLEARANCE:
for( ii = 0; ii < HISTORY_NUMBER; ii++ )
{
if( g_DesignSettings.m_TrackClearenceHistory[ii] == value )
if( g_DesignSettings.m_TrackClearanceHistory[ii] == value )
{
addhistory = FALSE;
break;
......@@ -186,27 +186,27 @@ void WinEDA_BasePcbFrame::AddHistory( int value, KICAD_T type )
for( ii = HISTORY_NUMBER - 1; ii > 0; ii-- )
{
g_DesignSettings.m_TrackClearenceHistory[ii] =
g_DesignSettings.m_TrackClearenceHistory[ii - 1];
g_DesignSettings.m_TrackClearanceHistory[ii] =
g_DesignSettings.m_TrackClearanceHistory[ii - 1];
}
g_DesignSettings.m_TrackClearenceHistory[0] = value;
g_DesignSettings.m_TrackClearanceHistory[0] = value;
// Reclassement par valeur croissante
for( ii = 0; ii < HISTORY_NUMBER - 1; ii++ )
{
if( g_DesignSettings.m_TrackClearenceHistory[ii + 1] == 0 )
if( g_DesignSettings.m_TrackClearanceHistory[ii + 1] == 0 )
break; // Fin de liste
if( g_DesignSettings.m_TrackClearenceHistory[ii] >
g_DesignSettings.m_TrackClearenceHistory[ii + 1] )
if( g_DesignSettings.m_TrackClearanceHistory[ii] >
g_DesignSettings.m_TrackClearanceHistory[ii + 1] )
{
EXCHG( g_DesignSettings.m_TrackClearenceHistory[ii],
g_DesignSettings.m_TrackClearenceHistory[ii + 1] );
EXCHG( g_DesignSettings.m_TrackClearanceHistory[ii],
g_DesignSettings.m_TrackClearanceHistory[ii + 1] );
}
}
break;
case TYPE_VIA:
for( ii = 0; ii < HISTORY_NUMBER; ii++ )
{
......
......@@ -62,7 +62,7 @@ void DRC::ShowDialog()
// copy data retained in this DRC object into the m_ui DrcPanel:
PutValueInLocalUnits( *m_ui->m_SetClearance, g_DesignSettings.m_TrackClearence,
PutValueInLocalUnits( *m_ui->m_SetClearance, g_DesignSettings.m_TrackClearance,
m_mainWindow->m_InternalUnits );;
PutValueInLocalUnits( *m_ui->m_SetTrackMinWidthCtrl, g_DesignSettings.m_TrackMinWidth,
m_mainWindow->m_InternalUnits );;
......@@ -192,62 +192,97 @@ int DRC::Drc( ZONE_CONTAINER* aArea, int CornerIndex )
* will actually run all the tests specified with a previous call to
* SetSettings()
*/
void DRC::RunTests(wxTextCtrl * aMessages)
void DRC::RunTests( wxTextCtrl * aMessages )
{
// Ensure ratsnest is up to date:
if( (m_pcb->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK) == 0 )
{
if ( aMessages )
aMessages->AppendText( _("Compile Ratsnest") );
if( aMessages )
{
aMessages->AppendText( _("Compile ratsnest...\n") );
wxSafeYield();
}
m_mainWindow->Compile_Ratsnest( NULL, true );
if ( aMessages )
aMessages->AppendText( _(" Ok\n"));
}
// someone should have cleared the two lists before calling this.
if( !testNetClasses() )
{
// testing the netclasses is a special case because if the netclasses
// do not pass the g_DesignSettings checks, then every member of a net
// class (a NET) will cause its items such as tracks, vias, and pads
// to also fail. So quit after *all* netclass errors have been reported.
if( aMessages )
aMessages->AppendText( _("Aborting\n") );
// update the m_ui listboxes
updatePointers();
return;
}
// test pad to pad clearances, nothing to do with tracks, vias or zones.
if( m_doPad2PadTest )
{
if ( aMessages )
aMessages->AppendText( _("Test pads to pads clearance") );
if( aMessages )
{
aMessages->AppendText( _("Pad clearances...\n") );
wxSafeYield();
}
testPad2Pad();
if ( aMessages )
aMessages->AppendText( _("\n"));
}
// test track and via clearances to other tracks, pads, and vias
if( aMessages )
{
aMessages->AppendText( _("Track clearances...\n") );
wxSafeYield();
}
testTracks();
// Before testing segments and unconnected, refill all zones:
// this is a good caution, because filled areas can be outdated.
if ( aMessages )
aMessages->AppendText( _("Fill zones") );
if( aMessages )
{
aMessages->AppendText( _("Fill zones...\n") );
wxSafeYield();
}
m_mainWindow->Fill_All_Zones( false );
if ( aMessages )
aMessages->AppendText( _(" Ok\n"));
// test zone clearances to other zones, pads, tracks, and vias
if ( aMessages && m_doZonesTest)
aMessages->AppendText( _("Test zones") );
if( aMessages && m_doZonesTest)
{
aMessages->AppendText( _("Test zones...\n") );
wxSafeYield();
}
testZones( m_doZonesTest );
if ( aMessages && m_doZonesTest)
aMessages->AppendText( _("\n"));
// find and gather unconnected pads.
if( m_doUnconnectedTest )
{
if ( aMessages )
aMessages->AppendText( _("List unconnected pads") );
if( aMessages )
{
aMessages->AppendText( _("Unconnected pads...\n") );
wxSafeYield();
}
testUnconnected();
if ( aMessages )
aMessages->AppendText( _("\n"));
}
// update the m_ui listboxes
updatePointers();
if ( aMessages )
aMessages->AppendText( _("Finished\n") );
if( aMessages )
{
// no newline on this one because it is last, don't want the window
// to unnecessarily scroll.
aMessages->AppendText( _("Finished") );
}
}
......@@ -277,6 +312,125 @@ void DRC::updatePointers()
}
bool DRC::doNetClass( NETCLASS* nc, wxString& msg )
{
bool ret = true;
const EDA_BoardDesignSettings& g = g_DesignSettings;
#define FmtVal( x ) GetChars( ReturnStringFromValue( g_UnitMetric, x, PCB_INTERNAL_UNIT ) )
if( nc->GetClearance() < g.m_TrackClearance )
{
msg.Printf( _("NETCLASS: '%s' has Clearance:%s which is less than global:%s"),
GetChars( nc->GetName() ),
FmtVal( nc->GetClearance() ),
FmtVal( g.m_TrackClearance )
);
m_currentMarker = fillMarker( DRCE_NETCLASS_CLEARANCE, msg, m_currentMarker );
m_pcb->Add( m_currentMarker );
m_currentMarker = 0;
ret = false;
}
if( nc->GetTrackWidth() < g.m_TrackMinWidth )
{
msg.Printf( _("NETCLASS: '%s' has TrackWidth:%s which is less than global:%s"),
GetChars( nc->GetName() ),
FmtVal( nc->GetTrackWidth() ),
FmtVal( g.m_TrackMinWidth )
);
m_currentMarker = fillMarker( DRCE_NETCLASS_TRACKWIDTH, msg, m_currentMarker );
m_pcb->Add( m_currentMarker );
m_currentMarker = 0;
ret = false;
}
if( nc->GetViaDiameter() < g.m_ViasMinSize )
{
msg.Printf( _("NETCLASS: '%s' has Via Dia:%s which is less than global:%s"),
GetChars( nc->GetName() ),
FmtVal( nc->GetViaDiameter() ),
FmtVal( g.m_ViasMinSize )
);
m_currentMarker = fillMarker( DRCE_NETCLASS_VIASIZE, msg, m_currentMarker );
m_pcb->Add( m_currentMarker );
m_currentMarker = 0;
ret = false;
}
if( nc->GetViaDrill() < g.m_ViaDrill )
{
msg.Printf( _("NETCLASS: '%s' has Via Drill:%s which is less than global:%s"),
GetChars( nc->GetName() ),
FmtVal( nc->GetViaDrill() ),
FmtVal( g.m_ViaDrill )
);
m_currentMarker = fillMarker( DRCE_NETCLASS_VIADRILLSIZE, msg, m_currentMarker );
m_pcb->Add( m_currentMarker );
m_currentMarker = 0;
ret = false;
}
if( nc->GetuViaDiameter() < g.m_MicroViasMinSize )
{
msg.Printf( _("NETCLASS: '%s' has uVia Dia:%s which is less than global:%s"),
GetChars( nc->GetName() ),
FmtVal( nc->GetuViaDiameter() ),
FmtVal( g.m_MicroViasMinSize )
);
m_currentMarker = fillMarker( DRCE_NETCLASS_uVIASIZE, msg, m_currentMarker );
m_pcb->Add( m_currentMarker );
m_currentMarker = 0;
ret = false;
}
if( nc->GetuViaDrill() < g.m_MicroViaDrill )
{
msg.Printf( _("NETCLASS: '%s' has uVia Drill:%s which is less than global:%s"),
GetChars( nc->GetName() ),
FmtVal( nc->GetuViaDrill() ),
FmtVal( g.m_MicroViaDrill )
);
m_currentMarker = fillMarker( DRCE_NETCLASS_uVIADRILLSIZE, msg, m_currentMarker );
m_pcb->Add( m_currentMarker );
m_currentMarker = 0;
ret = false;
}
return ret;
}
bool DRC::testNetClasses()
{
bool ret = true;
NETCLASSES& netclasses = m_pcb->m_NetClasses;
wxString msg; // construct this only once here, not in a loop, since somewhat expensive.
if( !doNetClass( netclasses.GetDefault(), msg ) )
ret = false;
for( NETCLASSES::const_iterator i = netclasses.begin(); i != netclasses.end(); ++i )
{
NETCLASS* nc = i->second;
if( !doNetClass( nc, msg ) )
ret = false;
}
return ret;
}
void DRC::testTracks()
{
for( TRACK* segm = m_pcb->m_Track; segm && segm->Next(); segm = segm->Next() )
......@@ -317,7 +471,10 @@ void DRC::testPad2Pad()
{
D_PAD* pad = sortedPads[i];
if( !doPadToPadsDrc( pad, &sortedPads[i], listEnd, max_size ) )
int x_limit = max_size + pad->GetClearance() +
pad->m_Rayon + pad->GetPosition().x;
if( !doPadToPadsDrc( pad, &sortedPads[i], listEnd, x_limit ) )
{
wxASSERT( m_currentMarker );
m_pcb->Add( m_currentMarker );
......@@ -450,7 +607,6 @@ MARKER_PCB* DRC::fillMarker( TRACK* aTrack, BOARD_ITEM* aItem, int aErrorCode, M
else
position = aTrack->GetPosition();
if( fillMe )
{
if( aItem )
......@@ -526,21 +682,38 @@ MARKER_PCB* DRC::fillMarker( const ZONE_CONTAINER* aArea,
}
MARKER_PCB* DRC::fillMarker( int aErrorCode, const wxString& aMessage, MARKER_PCB* fillMe )
{
wxPoint posA; // not displayed
if( fillMe )
fillMe->SetData( aErrorCode, posA, aMessage, posA );
else
fillMe = new MARKER_PCB( aErrorCode, posA, aMessage, posA );
fillMe->SetShowNoCoordinate();
return fillMe;
}
/***********************************************************************/
bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
/***********************************************************************/
{
TRACK* track;
int dx, dy; // utilise pour calcul des dim x et dim y des segments
int w_dist;
int layerMask;
int net_code_ref;
int org_X, org_Y; // Origine sur le PCB des axes du repere centre sur
// l'origine du segment de reference
wxPoint shape_pos;
TRACK* track;
int dx, dy; // utilise pour calcul des dim x et dim y des segments
int w_dist;
int layerMask;
int net_code_ref;
wxPoint shape_pos;
NETCLASS* netclass = aRefSeg->GetNetClass();
org_X = aRefSeg->m_Start.x;
org_Y = aRefSeg->m_Start.y;
// Origine sur le PCB des axes du repere centre sur
// l'origine du segment de reference
int org_X = aRefSeg->m_Start.x;
int org_Y = aRefSeg->m_Start.y;
m_finx = dx = aRefSeg->m_End.x - org_X;
m_finy = dy = aRefSeg->m_End.y - org_Y;
......@@ -550,33 +723,32 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
m_segmAngle = 0;
/* Phase 0 : Test vias : */
// Phase 0 : Test vias
if( aRefSeg->Type() == TYPE_VIA )
{
// test if the via size is bigger thn min size allowed
// test if the via size is smaller than minimum
if( aRefSeg->Shape() == VIA_MICROVIA )
{
if(aRefSeg->m_Width < g_DesignSettings.m_MicroViasMinSize)
if( aRefSeg->m_Width < netclass->GetuViaDiameter() )
{
m_currentMarker = fillMarker( aRefSeg, NULL,
DRCE_TOO_SMALL_MICROVIA, m_currentMarker );
return false;
}
}
}
else
{
if(aRefSeg->m_Width < g_DesignSettings.m_ViasMinSize)
if( aRefSeg->m_Width < netclass->GetViaDiameter() )
{
m_currentMarker = fillMarker( aRefSeg, NULL,
DRCE_TOO_SMALL_VIA, m_currentMarker );
return false;
}
}
// test if via's hole is bigger than its diameter
// This test is necessary since the via hole size and width can be modified
// and an default via hole can be bigger than some vias sizes
// and a default via hole can be bigger than some vias sizes
if( aRefSeg->GetDrillValue() > aRefSeg->m_Width )
{
m_currentMarker = fillMarker( aRefSeg, NULL,
......@@ -591,6 +763,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
{
int layer1, layer2;
bool err = true;
( (SEGVIA*) aRefSeg )->ReturnLayerPair( &layer1, &layer2 );
if( layer1> layer2 )
EXCHG( layer1, layer2 );
......@@ -610,7 +783,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
}
else // This is a track segment
{
if(aRefSeg->m_Width < g_DesignSettings.m_TrackMinWidth)
if( aRefSeg->m_Width < netclass->GetTrackWidth() )
{
m_currentMarker = fillMarker( aRefSeg, NULL,
DRCE_TOO_SMALL_TRACK_WIDTH, m_currentMarker );
......@@ -668,8 +841,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
m_spotcx = pseudo_pad.GetPosition().x - org_X;
m_spotcy = pseudo_pad.GetPosition().y - org_Y;
if( !checkClearanceSegmToPad( &pseudo_pad, w_dist,
g_DesignSettings.m_TrackClearence ) )
if( !checkClearanceSegmToPad( &pseudo_pad, w_dist, netclass->GetClearance() ))
{
m_currentMarker = fillMarker( aRefSeg, pad,
DRCE_TRACK_NEAR_THROUGH_HOLE, m_currentMarker );
......@@ -689,7 +861,8 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
shape_pos = pad->ReturnShapePos();
m_spotcx = shape_pos.x - org_X;
m_spotcy = shape_pos.y - org_Y;
if( !checkClearanceSegmToPad( pad, w_dist, g_DesignSettings.m_TrackClearence ) )
if( !checkClearanceSegmToPad( pad, w_dist, aRefSeg->GetClearance( pad ) ) )
{
m_currentMarker = fillMarker( aRefSeg, pad,
DRCE_TRACK_NEAR_PAD, m_currentMarker );
......@@ -723,9 +896,8 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
// the minimum distance = clearance plus half the reference track
// width plus half the other track's width
w_dist = aRefSeg->m_Width >> 1;
w_dist += track->m_Width >> 1;
w_dist += g_DesignSettings.m_TrackClearence;
w_dist = aRefSeg->GetClearance( track );
w_dist += (aRefSeg->m_Width + track->m_Width)/2;
// If the reference segment is a via, we test it here
if( aRefSeg->Type() == TYPE_VIA )
......@@ -794,7 +966,6 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
return false;
}
/* We have changed axis:
* the reference segment is Horizontal.
* 3 cases : the segment to test can be parallel, perpendicular or have an other direction
......@@ -876,7 +1047,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
return false;
}
}
else // segments quelconques entre eux */
else // segments quelconques entre eux
{
// calcul de la "surface de securite du segment de reference
// First rought 'and fast) test : the track segment is like a rectangle
......@@ -955,14 +1126,11 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
/*****************************************************************************/
bool DRC::doPadToPadsDrc( D_PAD* aRefPad, LISTE_PAD* aStart, LISTE_PAD* aEnd,
int max_size )
int x_limit )
/*****************************************************************************/
{
int layerMask = aRefPad->m_Masque_Layer & ALL_CU_LAYERS;
int x_limite = max_size + g_DesignSettings.m_TrackClearence +
aRefPad->m_Rayon + aRefPad->GetPosition().x;
static D_PAD dummypad( (MODULE*) NULL ); // used to test DRC pad to holes: this dummypad is the hole to test
dummypad.m_Masque_Layer = ALL_CU_LAYERS;
......@@ -974,18 +1142,18 @@ bool DRC::doPadToPadsDrc( D_PAD* aRefPad, LISTE_PAD* aStart, LISTE_PAD* aEnd,
if( pad == aRefPad )
continue;
/* We can stop the test when pad->m_Pos.x > x_limite
* because the list is sorted by X values */
if( pad->m_Pos.x > x_limite )
// We can stop the test when pad->m_Pos.x > x_limit
// because the list is sorted by X values
if( pad->m_Pos.x > x_limit )
break;
/* No problem if pads are on different copper layers,
* but their hole (if any ) can create RDC error because they are on all copper layers, so we test them
*/
// No problem if pads are on different copper layers,
// but their hole (if any ) can create RDC error because they are on all
// copper layers, so we test them
if( (pad->m_Masque_Layer & layerMask ) == 0 )
{
/* if holes are in the same location and have the same size and shape, this can be accepted */
// if holes are in the same location and have the same size and shape,
// this can be accepted
if( pad->GetPosition() == aRefPad->GetPosition()
&& pad->m_Drill == aRefPad->m_Drill
&& pad->m_DrillShape == aRefPad->m_DrillShape )
......@@ -1005,7 +1173,7 @@ bool DRC::doPadToPadsDrc( D_PAD* aRefPad, LISTE_PAD* aStart, LISTE_PAD* aEnd,
dummypad.m_Size = pad->m_Drill;
dummypad.m_PadShape = pad->m_DrillShape == PAD_OVAL ? PAD_OVAL : PAD_CIRCLE;
dummypad.m_Orient = pad->m_Orient;
if( !checkClearancePadToPad( aRefPad, &dummypad, g_DesignSettings.m_TrackClearence ) )
if( !checkClearancePadToPad( aRefPad, &dummypad ) )
{
// here we have a drc error on pad!
m_currentMarker = fillMarker( pad, aRefPad,
......@@ -1013,13 +1181,14 @@ bool DRC::doPadToPadsDrc( D_PAD* aRefPad, LISTE_PAD* aStart, LISTE_PAD* aEnd,
return false;
}
}
if( aRefPad->m_Drill.x ) // pad reference has a hole
{
dummypad.SetPosition( aRefPad->GetPosition() );
dummypad.m_Size = aRefPad->m_Drill;
dummypad.m_PadShape = aRefPad->m_DrillShape == PAD_OVAL ? PAD_OVAL : PAD_CIRCLE;
dummypad.m_Orient = aRefPad->m_Orient;
if( !checkClearancePadToPad( pad, &dummypad, g_DesignSettings.m_TrackClearence ) )
if( !checkClearancePadToPad( pad, &dummypad ) )
{
// here we have a drc erroron aRefPad!
m_currentMarker = fillMarker( aRefPad, pad,
......@@ -1030,18 +1199,24 @@ bool DRC::doPadToPadsDrc( D_PAD* aRefPad, LISTE_PAD* aStart, LISTE_PAD* aEnd,
continue;
}
/* The pad must be in a net (i.e pt_pad->GetNet() != 0 ),
* But no problem if pads have the same netcode (same net)*/
// The pad must be in a net (i.e pt_pad->GetNet() != 0 ),
// But no problem if pads have the same netcode (same net)
if( pad->GetNet() && ( aRefPad->GetNet() == pad->GetNet() ) )
continue;
/* No problem if pads are from the same footprint
* and have the same pad number ( equivalent pads ) */
if( ( pad->GetParent() == aRefPad->GetParent() )
&& (pad->m_NumPadName == aRefPad->m_NumPadName) )
continue;
// if pads are from the same footprint
if( pad->GetParent() == aRefPad->GetParent() )
{
// and have the same pad number ( equivalent pads )
// one can argue that this 2nd test is not necessary, that any
// two pads from a single module are acceptable. This 2nd test
// should eventually be a configuration option.
if( pad->m_NumPadName == aRefPad->m_NumPadName )
continue;
}
if( !checkClearancePadToPad( aRefPad, pad, g_DesignSettings.m_TrackClearence ) )
if( !checkClearancePadToPad( aRefPad, pad ) )
{
// here we have a drc error!
m_currentMarker = fillMarker( aRefPad, pad,
......@@ -1055,7 +1230,8 @@ bool DRC::doPadToPadsDrc( D_PAD* aRefPad, LISTE_PAD* aStart, LISTE_PAD* aEnd,
// Rotate a vector by an angle
wxPoint rotate(wxPoint p, int angle){
wxPoint rotate( wxPoint p, int angle )
{
wxPoint n;
float theta = M_PI * angle/1800;
n.x = float(p.x) * cos(theta) - float(p.y) * sin(theta);
......@@ -1064,7 +1240,7 @@ wxPoint rotate(wxPoint p, int angle){
}
/**************************************************************************************/
bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad, const int dist_min )
bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad )
/***************************************************************************************/
{
wxPoint rel_pos;
......@@ -1073,6 +1249,8 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad, const int dist_mi
wxPoint shape_pos;
int pad_angle;
int dist_min = aRefPad->GetClearance( aPad );
rel_pos = aPad->ReturnShapePos();
shape_pos = aRefPad->ReturnShapePos();
......@@ -1083,7 +1261,7 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad, const int dist_mi
bool diag = true;
/* Quick test: Clearance is OK if the bounding circles are further away than dist_min.*/
// Quick test: Clearance is OK if the bounding circles are further away than "dist_min"
if( (dist - aRefPad->m_Rayon - aPad->m_Rayon) >= dist_min )
goto exit;
......@@ -1124,7 +1302,7 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad, const int dist_mi
if( aPad->m_PadShape == PAD_RECT )
{
wxSize size = aPad->m_Size;
// The trivial case is if both rects are rotated by multiple of 90°
// The trivial case is if both rects are rotated by multiple of 90°
if( ((aRefPad->m_Orient == 0) || (aRefPad->m_Orient == 900) || (aRefPad->m_Orient == 1800)
|| (aRefPad->m_Orient == 2700)) &&
((aPad->m_Orient == 0) || (aPad->m_Orient == 900) || (aPad->m_Orient == 1800)
......@@ -1150,12 +1328,12 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad, const int dist_mi
else // Any other orient
{
/* Use TestForIntersectionOfStraightLineSegments() for all 4 edges (segments).*/
/* Test if one center point is contained in the other and thus the pads overlap.
/* Test if one center point is contained in the other and thus the pads overlap.
* This case is not covered by the following check if one pad is
* completely contained in the other (because edges don't intersect)!
*/
if ( ( (dist < aPad->m_Size.x) && (dist < aPad->m_Size.y) )||
if( ( (dist < aPad->m_Size.x) && (dist < aPad->m_Size.y) )||
( (dist < aRefPad->m_Size.x) && (dist < aRefPad->m_Size.y) )){
diag = false;
}
......@@ -1167,30 +1345,31 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad, const int dist_mi
for (int i=0; i<4; i++){ // for all edges in aPad
wxPoint p11 = aPad->ReturnShapePos() + rotate(aPad_c2c, aPad->m_Orient);
// flip the center-to-corner vector
if (i%2 == 0){
if(i%2 == 0){
aPad_c2c.x = -aPad_c2c.x;
}else{
aPad_c2c.y = -aPad_c2c.y;
}
wxPoint p12 = aPad->ReturnShapePos() + rotate(aPad_c2c, aPad->m_Orient);
for (int j=0; j<4; j++){// for all edges in aRefPad
wxPoint p21 = aRefPad->ReturnShapePos() + rotate(aRefPad_c2c, aRefPad->m_Orient);
// flip the center-to-corner vector
if (j%2 == 0){
if(j%2 == 0){
aRefPad_c2c.x = -aRefPad_c2c.x;
}else{
aRefPad_c2c.y = -aRefPad_c2c.y;
}
wxPoint p22 = aRefPad->ReturnShapePos() + rotate(aRefPad_c2c, aRefPad->m_Orient);
int x,y;
double d;
int intersect = TestForIntersectionOfStraightLineSegments( p11.x, p11.y, p12.x, p12.y,
p21.x, p21.y, p22.x, p22.y,
&x, &y, &d);
;
if (intersect || (d< dist_min)){
if( intersect || (d< dist_min) )
{
diag=false;
}
}
......
......@@ -64,6 +64,12 @@
#define DRCE_TOO_SMALL_TRACK_WIDTH 27 ///< Too small track width
#define DRCE_TOO_SMALL_VIA 28 ///< Too small via size
#define DRCE_TOO_SMALL_MICROVIA 29 ///< Too small micro via size
#define DRCE_NETCLASS_TRACKWIDTH 30 ///< netclass has TrackWidth < g_DesignSettings.m_TrackMinWidth
#define DRCE_NETCLASS_CLEARANCE 31 ///< netclass has Clearance < g_DesignSettings.m_TrackClearance
#define DRCE_NETCLASS_VIASIZE 32 ///< netclass has ViaSize < g_DesignSettings.m_ViasMinSize
#define DRCE_NETCLASS_VIADRILLSIZE 33 ///< netclass has ViaDrillSize < g_DesignSettings.m_ViaDrill
#define DRCE_NETCLASS_uVIASIZE 34
#define DRCE_NETCLASS_uVIADRILLSIZE 35
class WinEDA_DrawPanel;
......@@ -144,7 +150,7 @@ private:
// int m_errorCount;
MARKER_PCB* m_currentMarker;
MARKER_PCB* m_currentMarker;
bool m_aboartDRC;
bool m_drcInProgress;
......@@ -211,8 +217,27 @@ private:
*/
MARKER_PCB* fillMarker( const ZONE_CONTAINER * aArea, const wxPoint & aPos, int aErrorCode, MARKER_PCB* fillMe );
/**
* Function fillMarker
* fills a MARKER which will report on a generic problem with the board which is
* not geographically locatable.
*/
MARKER_PCB* fillMarker( int aErrorCode, const wxString& aMessage, MARKER_PCB* fillMe );
//-----<categorical group tests>-----------------------------------------
/**
* Function testNetClasses
* goes through each NETCLASS and verifies that its clearance, via size,
* track width, and track clearance are larger than those in g_DesignSettings.
* This is necessary because the actual DRC checks are run against the NETCLASS
* limits, so in order enforce global limits, we first check the NETCLASSes against
* the global limits.
* @return bool - true if succes, else false but only after
* reporting _all_ NETCLASS violations.
*/
bool testNetClasses();
void testTracks();
void testPad2Pad();
......@@ -224,6 +249,8 @@ private:
//-----<single "item" tests>-----------------------------------------
bool doNetClass( NETCLASS* aNetClass, wxString& msg );
/**
* Function doPadToPadsDrc
* tests the clearance between aRefPad and other pads.
......@@ -231,10 +258,10 @@ private:
* @param aRefPad The pad to test
* @param aStart The start of the pad list to test against
* @param aEnd Marks the end of the list and is not included
* @param max_size The size of the biggest pad (used to stop the test when the X distance is > max_size)
* @param x_limit is used to stop the test (when the any pad's X coord exceeds this)
*/
bool doPadToPadsDrc( D_PAD* aRefPad, LISTE_PAD* aStart,
LISTE_PAD* aEnd, int max_size );
LISTE_PAD* aEnd, int x_limit );
/**
* Function DoTrackDrc
......@@ -267,7 +294,7 @@ private:
* @param aPad Another pad to check against
* @return bool - true if clearance between aRefPad and pad is >= dist_min, else false
*/
bool checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad, const int dist_min );
bool checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad );
/**
......@@ -358,7 +385,6 @@ public:
return doTrackDrc( aRefSeg, aList ) ? OK_DRC : BAD_DRC;
}
/**
* Function ShowDialog
* opens a dialog and prompts the user, then if a test run button is
......@@ -367,7 +393,6 @@ public:
*/
void ShowDialog();
/**
* Function DestroyDialog
* deletes this ui dialog box and zeros out its pointer to remember
......@@ -396,7 +421,6 @@ public:
m_doCreateRptFile = aSaveReport;
}
/**
* Function RunTests
* will actually run all the tests specified with a previous call to
......@@ -405,7 +429,6 @@ public:
*/
void RunTests(wxTextCtrl * aMessages = NULL);
/**
* Function ListUnconnectedPad
* gathers a list of all the unconnected pads and shows them in the
......
......@@ -1007,8 +1007,8 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_AUX_TOOLBAR_PCB_CLR_WIDTH:
{
int ii = m_SelClrWidthBox->GetChoice();
g_DesignSettings.m_TrackClearence =
g_DesignSettings.m_TrackClearenceHistory[ii];
g_DesignSettings.m_TrackClearance =
g_DesignSettings.m_TrackClearanceHistory[ii];
DisplayTrackSettings();
m_SelTrackWidthBox_Changed = false;
m_SelClrWidthBox_Changed = false;
......
......@@ -549,15 +549,17 @@ void WinEDA_PcbFrame::End_Route( TRACK* aTrack, wxDC* DC )
}
TRACK* LocateIntrusion( TRACK* start, int net, int width )
TRACK* LocateIntrusion( TRACK* listStart, TRACK* aTrack )
{
int net = aTrack->GetNet();
int width = aTrack->m_Width;
int layer = ( (PCB_SCREEN*) ActiveScreen )->m_Active_Layer;
wxPoint ref = ActiveScreen->RefPos( true );
TRACK* found = NULL;
for( TRACK* track = start; track; track = track->Next() )
for( TRACK* track = listStart; track; track = track->Next() )
{
if( track->Type() == TYPE_TRACK ) // skip vias
{
......@@ -571,7 +573,7 @@ TRACK* LocateIntrusion( TRACK* start, int net, int width )
continue;
/* TRACK::HitTest */
int dist = width / 2 + track->m_Width / 2 + g_DesignSettings.m_TrackClearence;
int dist = (width + track->m_Width) / 2 + aTrack->GetClearance( track );
wxPoint pos = ref - track->m_Start;
wxPoint vec = track->m_End - track->m_Start;
......@@ -619,7 +621,7 @@ static void PushTrack( WinEDA_DrawPanel* panel )
int dist;
double f;
other = LocateIntrusion( pcb->m_Track, track->GetNet(), track->m_Width );
other = LocateIntrusion( pcb->m_Track, track );
/* are we currently pointing into a conflicting trace ? */
if( !other )
......@@ -637,8 +639,7 @@ static void PushTrack( WinEDA_DrawPanel* panel )
if( !det )
return;
dist = (track->m_Width + 1) / 2 + (other->m_Width + 1) / 2 +
g_DesignSettings.m_TrackClearence + 2;
dist = (track->m_Width + 1) / 2 + (other->m_Width + 1) / 2 + track->GetClearance( other ) + 2;
/*
* DRC wants >, so +1.
......@@ -683,6 +684,8 @@ void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel, wxDC* DC, bool erase
DisplayOpt.DisplayPcbTrackFill = true;
int showTrackClearanceMode = DisplayOpt.ShowTrackClearanceMode;
NETCLASS* netclass = g_FirstTrackSegment->GetNetClass();
if( showTrackClearanceMode != DO_NOT_SHOW_CLEARANCE )
DisplayOpt.ShowTrackClearanceMode = SHOW_CLEARANCE_ALWAYS;
......@@ -690,13 +693,16 @@ void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel, wxDC* DC, bool erase
if( erase )
{
Trace_Une_Piste( panel, DC, g_FirstTrackSegment, g_CurrentTrackList.GetCount(), GR_XOR );
( (WinEDA_BasePcbFrame*)(panel->m_Parent) )->trace_ratsnest_pad( DC );
if( showTrackClearanceMode >= SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS ) // Show the via area
{
int color = g_DesignSettings.m_LayerColor[g_CurrentTrackSegment->GetLayer()];
GRCircle( &panel->m_ClipBox, DC, g_CurrentTrackSegment->m_End.x,
g_CurrentTrackSegment->m_End.y,
(g_DesignSettings.m_CurrentViaSize / 2) + g_DesignSettings.m_TrackClearence,
(netclass->GetViaDiameter() / 2) + netclass->GetClearance(),
color );
}
}
......@@ -708,7 +714,7 @@ void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel, wxDC* DC, bool erase
/* dessin de la nouvelle piste : mise a jour du point d'arrivee */
g_CurrentTrackSegment->SetLayer( screen->m_Active_Layer );
if( !g_DesignSettings.m_UseConnectedTrackWidth )
g_CurrentTrackSegment->m_Width = g_DesignSettings.m_CurrentTrackWidth;
g_CurrentTrackSegment->m_Width = netclass->GetTrackWidth();
if( g_TwoSegmentTrackBuild )
{
......@@ -716,8 +722,9 @@ void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel, wxDC* DC, bool erase
if( previous_track && previous_track->Type()==TYPE_TRACK )
{
previous_track->SetLayer( screen->m_Active_Layer );
if( !g_DesignSettings.m_UseConnectedTrackWidth )
previous_track->m_Width = g_DesignSettings.m_CurrentTrackWidth;
previous_track->m_Width = netclass->GetTrackWidth();
}
}
......@@ -751,12 +758,14 @@ void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel, wxDC* DC, bool erase
D( g_CurrentTrackList.VerifyListIntegrity(); );
Trace_Une_Piste( panel, DC, g_FirstTrackSegment, g_CurrentTrackList.GetCount(), GR_XOR );
if( showTrackClearanceMode >= SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS ) // Show the via area
{
int color = g_DesignSettings.m_LayerColor[g_CurrentTrackSegment->GetLayer()];
GRCircle( &panel->m_ClipBox, DC, g_CurrentTrackSegment->m_End.x,
g_CurrentTrackSegment->m_End.y,
(g_DesignSettings.m_CurrentViaSize / 2) + g_DesignSettings.m_TrackClearence,
(netclass->GetViaDiameter() / 2) + netclass->GetClearance(),
color );
}
......
......@@ -180,12 +180,12 @@ bool WinEDA_PcbFrame::Clear_Pcb( bool aQuery )
{
g_DesignSettings.m_ViaSizeHistory[ii] =
g_DesignSettings.m_TrackWidthHistory[ii] = 0;
g_DesignSettings.m_TrackClearenceHistory[ii] = 0;
g_DesignSettings.m_TrackClearanceHistory[ii] = 0;
}
g_DesignSettings.m_TrackWidthHistory[0] = g_DesignSettings.m_CurrentTrackWidth;
g_DesignSettings.m_TrackClearenceHistory[0] = g_DesignSettings.m_TrackClearence;
g_DesignSettings.m_ViaSizeHistory[0] = g_DesignSettings.m_CurrentViaSize;
g_DesignSettings.m_TrackClearanceHistory[0] = g_DesignSettings.m_TrackClearance;
g_DesignSettings.m_ViaSizeHistory[0] = g_DesignSettings.m_CurrentViaSize;
g_DesignSettings.m_CopperLayerCount = 2; // Default copper layers count set to 2: double layer board
Zoom_Automatique( true );
......
......@@ -285,7 +285,8 @@ int WinEDA_BasePcbFrame::ReadGeneralDescrPcb( FILE* File, int* LineNum )
int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum )
/*************************************************************/
{
char Line[1024], * data;
char Line[1024];
char* data;
while( GetLine( File, Line, LineNum ) != NULL )
{
......@@ -294,6 +295,17 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum )
if( stricmp( Line, "$EndSETUP" ) == 0 )
{
// Until such time as the *.brd file does not have the global parameters:
// "TrackWidth", "TrackMinWidth", "ViaSize", "ViaDrill", "ViaMinSize", and "TrackClearence",
// put those same global values into the default NETCLASS until later board load
// code should override them. *.brd files which have been saved with knowledge of
// NETCLASSes will override these defaults, old boards will not.
// @todo: I expect that at some point we can remove said global
// parameters from the *.brd file since the ones in the default
// netclass serve the same purpose. If needed at all, the global defaults should go into
// a preferences file instead so they are there to start new board projects.
GetBoard()->m_NetClasses.GetDefault()->SetParams();
return 0;
}
......@@ -358,7 +370,7 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum )
if( stricmp( Line, "TrackClearence" ) == 0 )
{
g_DesignSettings.m_TrackClearence = atoi( data );
g_DesignSettings.m_TrackClearance = atoi( data );
continue;
}
......@@ -367,12 +379,13 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum )
g_DesignSettings.m_TrackMinWidth = atoi( data );
continue;
}
if( stricmp( Line, "TrackClearenceHistory" ) == 0 )
{
int tmp = atoi( data );
AddHistory( tmp, TYPE_CLEARANCE );
continue;
}
{
int tmp = atoi( data );
AddHistory( tmp, TYPE_CLEARANCE );
continue;
}
if( stricmp( Line, "ZoneClearence" ) == 0 )
{
......@@ -386,7 +399,6 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum )
continue;
}
if( stricmp( Line, "DrawSegmWidth" ) == 0 )
{
g_DesignSettings.m_DrawSegmentWidth = atoi( data );
......@@ -548,13 +560,13 @@ static int WriteSetup( FILE* aFile, WinEDA_BasePcbFrame* aFrame, BOARD* aBoard )
}
fprintf( aFile, "TrackClearence %d\n", g_DesignSettings.m_TrackClearence );
fprintf( aFile, "TrackClearence %d\n", g_DesignSettings.m_TrackClearance );
for( int ii = 0; ii < HISTORY_NUMBER; ii++ )
{
if( g_DesignSettings.m_TrackClearenceHistory[ii] == 0 )
if( g_DesignSettings.m_TrackClearanceHistory[ii] == 0 )
break;
fprintf( aFile, "TrackClearenceHistory %d\n",
g_DesignSettings.m_TrackClearenceHistory[ii] );
g_DesignSettings.m_TrackClearanceHistory[ii] );
}
fprintf( aFile, "ZoneClearence %d\n", g_Zone_Default_Setting.m_ZoneClearance );
fprintf( aFile, "TrackMinWidth %d\n" , g_DesignSettings.m_TrackMinWidth );
......@@ -796,39 +808,35 @@ int WinEDA_PcbFrame::ReadPcbFile( FILE* File, bool Append )
board->m_Status_Pcb = 0;
board->m_NetClasses.Clear();
// Put a dollar sign in front, and test for a specific length of characters
// The -1 is to omit the trailing \0 which is included in sizeof() on a string.
#define TESTLINE(x) (strncmp(Line, "$" x, sizeof("$" x)-1) == 0)
while( GetLine( File, Line, &LineNum ) != NULL )
{
if( strnicmp( Line, "$EndPCB", 6 ) == 0 )
break;
// put the more frequent ones at the top
if( strnicmp( Line, "$GENERAL", 8 ) == 0 )
if( TESTLINE( "MODULE" ) )
{
ReadGeneralDescrPcb( File, &LineNum );
continue;
}
MODULE* Module = new MODULE( board );
if( strnicmp( Line, "$SHEETDESCR", 11 ) == 0 )
{
ReadSheetDescr( GetScreen(), File, &LineNum );
if( Module == NULL )
continue;
board->Add( Module, ADD_APPEND );
Module->ReadDescr( File, &LineNum );
continue;
}
if( strnicmp( Line, "$SETUP", 6 ) == 0 )
if( TESTLINE( "DRAWSEGMENT" ) )
{
if( !Append )
{
ReadSetup( File, &LineNum );
}
else
{
while( GetLine( File, Line, &LineNum ) != NULL )
if( strnicmp( Line, "$EndSETUP", 6 ) == 0 )
break;
}
DRAWSEGMENT* DrawSegm = new DRAWSEGMENT( board );
board->Add( DrawSegm, ADD_APPEND );
DrawSegm->ReadDrawSegmentDescr( File, &LineNum );
continue;
}
if( strnicmp( Line, "$EQUIPOT", 7 ) == 0 )
if( TESTLINE( "EQUIPOT" ) )
{
NETINFO_ITEM* net = new NETINFO_ITEM( board );
board->m_NetInfo->AppendNet( net );
......@@ -836,55 +844,56 @@ int WinEDA_PcbFrame::ReadPcbFile( FILE* File, bool Append )
continue;
}
if( strnicmp( Line, "$NETCLASS", 8 ) == 0 )
if( TESTLINE( "TEXTPCB" ) )
{
NETCLASS netclass( board, wxEmptyString );
netclass.ReadDescr( File, &LineNum );
board->m_NetClasses.Add( netclass );
TEXTE_PCB* pcbtxt = new TEXTE_PCB( board );
board->Add( pcbtxt, ADD_APPEND );
pcbtxt->ReadTextePcbDescr( File, &LineNum );
continue;
}
if( strnicmp( Line, "$CZONE_OUTLINE", 7 ) == 0 )
if( TESTLINE( "TRACK" ) )
{
ZONE_CONTAINER * zone_descr = new ZONE_CONTAINER(board);
zone_descr->ReadDescr( File, &LineNum );
if ( zone_descr->GetNumCorners( ) > 2 ) // should always occur
board->Add(zone_descr);
else delete zone_descr;
#ifdef PCBNEW
TRACK* insertBeforeMe = Append ? NULL : board->m_Track.GetFirst();
ReadListeSegmentDescr( File, insertBeforeMe, TYPE_TRACK,
&LineNum, NbTrack );
#endif
continue;
}
if( strnicmp( Line, "$MODULE", 7 ) == 0 )
if( TESTLINE( BRD_NETCLASS ) )
{
MODULE* Module = new MODULE( board );
// create an empty NETCLASS without a name.
NETCLASS* netclass = new NETCLASS( board, wxEmptyString );
if( Module == NULL )
continue;
// fill it from the *.brd file, and establish its name.
netclass->ReadDescr( File, &LineNum );
board->Add( Module, ADD_APPEND );
Module->ReadDescr( File, &LineNum );
continue;
}
if( !board->m_NetClasses.Add( netclass ) )
{
// Must have been a name conflict, this is a bad board file.
// User may have done a hand edit to the file.
// Delete netclass if board could not take ownership of it.
delete netclass;
// @todo: throw an exception here, this is a bad board file.
}
if( strnicmp( Line, "$TEXTPCB", 8 ) == 0 )
{
TEXTE_PCB* pcbtxt = new TEXTE_PCB( board );
board->Add( pcbtxt, ADD_APPEND );
pcbtxt->ReadTextePcbDescr( File, &LineNum );
continue;
}
if( strnicmp( Line, "$DRAWSEGMENT", 10 ) == 0 )
if( TESTLINE( "CZONE_OUTLINE" ) )
{
DRAWSEGMENT* DrawSegm = new DRAWSEGMENT( board );
board->Add( DrawSegm, ADD_APPEND );
DrawSegm->ReadDrawSegmentDescr( File, &LineNum );
ZONE_CONTAINER * zone_descr = new ZONE_CONTAINER(board);
zone_descr->ReadDescr( File, &LineNum );
if ( zone_descr->GetNumCorners( ) > 2 ) // should always occur
board->Add(zone_descr);
else delete zone_descr;
continue;
}
if( strnicmp( Line, "$COTATION", 9 ) == 0 )
if( TESTLINE( "COTATION" ) )
{
COTATION* Cotation = new COTATION( board );
board->Add( Cotation, ADD_APPEND );
......@@ -892,7 +901,7 @@ int WinEDA_PcbFrame::ReadPcbFile( FILE* File, bool Append )
continue;
}
if( strnicmp( Line, "$MIREPCB", 8 ) == 0 )
if( TESTLINE( "MIREPCB" ) )
{
MIREPCB* Mire = new MIREPCB( board );
board->Add( Mire, ADD_APPEND );
......@@ -900,26 +909,46 @@ int WinEDA_PcbFrame::ReadPcbFile( FILE* File, bool Append )
continue;
}
if( strnicmp( Line, "$TRACK", 6 ) == 0 )
if( TESTLINE( "ZONE" ) )
{
#ifdef PCBNEW
TRACK* insertBeforeMe = Append ? NULL : board->m_Track.GetFirst();
ReadListeSegmentDescr( File, insertBeforeMe, TYPE_TRACK,
&LineNum, NbTrack );
SEGZONE* insertBeforeMe = Append ? NULL : board->m_Zone.GetFirst();
ReadListeSegmentDescr( File, insertBeforeMe, TYPE_ZONE,
&LineNum, NbZone );
#endif
continue;
}
if( strnicmp( Line, "$ZONE", 5 ) == 0 )
if( TESTLINE( "GENERAL" ) )
{
#ifdef PCBNEW
SEGZONE* insertBeforeMe = Append ? NULL : board->m_Zone.GetFirst();
ReadGeneralDescrPcb( File, &LineNum );
continue;
}
ReadListeSegmentDescr( File, insertBeforeMe, TYPE_ZONE,
&LineNum, NbZone );
#endif
if( TESTLINE( "SHEETDESCR" ) )
{
ReadSheetDescr( GetScreen(), File, &LineNum );
continue;
}
if( TESTLINE( "SETUP" ) )
{
if( !Append )
{
ReadSetup( File, &LineNum );
}
else
{
while( GetLine( File, Line, &LineNum ) != NULL )
if( TESTLINE( "EndSETUP" ) )
break;
}
continue;
}
if( TESTLINE( "EndPCB" ) )
break;
}
SetLocaleTo_Default( ); // revert to the current locale
......
......@@ -178,15 +178,15 @@ bool Read_Config( const wxString& projectFileName )
/* User library path takes precedent over default library search paths. */
wxGetApp().InsertLibraryPath( g_UserLibDirBuffer, 1 );
/* Some parameters must be reinitialize after loading a new board or config: */
// Some parameters must be reinitialized after loading a new board or config
g_DesignSettings.m_TrackWidthHistory[0] = g_DesignSettings.m_CurrentTrackWidth;
g_DesignSettings.m_TrackClearenceHistory[0] = g_DesignSettings.m_TrackClearence;
g_DesignSettings.m_TrackClearanceHistory[0] = g_DesignSettings.m_TrackClearance;
g_DesignSettings.m_ViaSizeHistory[0] = g_DesignSettings.m_CurrentViaSize;
for( ii = 1; ii < HISTORY_NUMBER; ii++ )
{
g_DesignSettings.m_TrackWidthHistory[ii] = 0;
g_DesignSettings.m_TrackClearenceHistory[ii] = 0;
g_DesignSettings.m_TrackClearanceHistory[ii] = 0;
g_DesignSettings.m_ViaSizeHistory[ii] = 0;
}
......
......@@ -126,7 +126,7 @@ static PARAM_CFG_INT ShowNetNamesModeCfg
static PARAM_CFG_INT TrackClearenceCfg
(
wxT( "Isol" ), /* Keyword */
&g_DesignSettings.m_TrackClearence, /* Parameter address */
&g_DesignSettings.m_TrackClearance, /* Parameter address */
120, /* Default value */
0, 0xFFFF /* Min and max values*/
);
......
......@@ -475,9 +475,9 @@ void WinEDA_PcbFrame::SetToolbars()
_( "Normal Contrast Mode Display" ) :
_( "High Contrast Mode Display" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_INVISIBLE_TEXT_MODE,
g_ModuleTextNOVColor & ITEM_NOT_SHOW );
g_ModuleTextNOVColor & ITEM_NOT_SHOW );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_INVISIBLE_TEXT_MODE,
g_ModuleTextNOVColor & (ITEM_NOT_SHOW) ?
g_ModuleTextNOVColor & (ITEM_NOT_SHOW) ?
_( "Show Invisible Text" ) :
_( "Hide Invisible Text" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR1, m_AuxVToolBar ? true : false );
......@@ -521,36 +521,36 @@ void WinEDA_PcbFrame::SetToolbars()
}
if( m_SelClrWidthBox && m_SelClrWidthBox_Changed )
{
m_SelClrWidthBox_Changed = FALSE;
m_SelClrWidthBox->Clear();
wxString format = _( "Clearance" );
if( g_UnitMetric == INCHES )
format += wxT( " %.1f" );
else
format += wxT( " %.3f" );
for( ii = 0; ii < HISTORY_NUMBER; ii++ )
{
if( g_DesignSettings.m_TrackClearenceHistory[ii] == 0 )
break; // Fin de liste
double value = To_User_Unit( g_UnitMetric,
g_DesignSettings.m_TrackClearenceHistory[ii],
PCB_INTERNAL_UNIT );
if( g_UnitMetric == INCHES )
msg.Printf( format.GetData(), value * 1000 );
else
msg.Printf( format.GetData(), value );
m_SelClrWidthBox->Append( msg );
if( g_DesignSettings.m_TrackClearenceHistory[ii] ==
g_DesignSettings.m_TrackClearence )
m_SelClrWidthBox->SetSelection( ii );
}
}
{
m_SelClrWidthBox_Changed = FALSE;
m_SelClrWidthBox->Clear();
wxString format = _( "Clearance" );
if( g_UnitMetric == INCHES )
format += wxT( " %.1f" );
else
format += wxT( " %.3f" );
for( ii = 0; ii < HISTORY_NUMBER; ii++ )
{
if( g_DesignSettings.m_TrackClearanceHistory[ii] == 0 )
break; // Fin de liste
double value = To_User_Unit( g_UnitMetric,
g_DesignSettings.m_TrackClearanceHistory[ii],
PCB_INTERNAL_UNIT );
if( g_UnitMetric == INCHES )
msg.Printf( format.GetData(), value * 1000 );
else
msg.Printf( format.GetData(), value );
m_SelClrWidthBox->Append( msg );
if( g_DesignSettings.m_TrackClearanceHistory[ii] ==
g_DesignSettings.m_TrackClearance )
m_SelClrWidthBox->SetSelection( ii );
}
}
if( m_SelViaSizeBox && m_SelViaSizeBox_Changed )
{
......
......@@ -248,7 +248,7 @@ MODULE* Load_Module_From_Library( WinEDA_DrawFrame* frame, wxDC* DC );
/* EDITRACK.C : */
/****************/
TRACK* LocateIntrusion( TRACK* start, int net, int width );
TRACK* LocateIntrusion( TRACK* listStart, TRACK* aTrack );
void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel,
wxDC* DC, bool erase );
......
......@@ -99,9 +99,9 @@ void WinEDA_PcbFrame::GlobalRoute( wxDC* DC )
fprintf( outfile, " %d", g_GridRoutingSize / PSCALE );
fprintf( outfile, " %d %d %d", /* isolation Pad, track, via */
g_DesignSettings.m_TrackClearence / PSCALE,
g_DesignSettings.m_TrackClearence / PSCALE,
g_DesignSettings.m_TrackClearence / PSCALE );
g_DesignSettings.m_TrackClearance / PSCALE,
g_DesignSettings.m_TrackClearance / PSCALE,
g_DesignSettings.m_TrackClearance / PSCALE );
fprintf( outfile, " 0" ); /* via type */
......
......@@ -195,8 +195,8 @@ static long newmask[8] = { /* patterns to mask out in neighbor cells */
/* Macro d'affichage de l'activite du routeur; */
#define AFFICHE_ACTIVITE_ROUTE \
msg.Printf( wxT("Activity: Open %d Closed %d Moved %d"), OpenNodes, ClosNodes, MoveNodes); \
pcbframe->Affiche_Message(msg);
msg.Printf( wxT("Activity: Open %d Closed %d Moved %d"), OpenNodes, ClosNodes, MoveNodes); \
pcbframe->Affiche_Message(msg);
/********************************************************/
int WinEDA_PcbFrame::Solve( wxDC* DC, int two_sides )
......@@ -355,8 +355,8 @@ static int Autoroute_One_Track( WinEDA_PcbFrame* pcbframe, wxDC* DC,
result = NOSUCCESS;
marge = g_DesignSettings.m_TrackClearence + (g_DesignSettings.m_CurrentTrackWidth / 2);
via_marge = g_DesignSettings.m_TrackClearence + (g_DesignSettings.m_CurrentViaSize / 2);
marge = g_DesignSettings.m_TrackClearance + (g_DesignSettings.m_CurrentTrackWidth / 2);
via_marge = g_DesignSettings.m_TrackClearance + (g_DesignSettings.m_CurrentViaSize / 2);
/* clear direction flags */
i = Nrows * Ncols * sizeof(char);
......@@ -538,15 +538,15 @@ static int Autoroute_One_Track( WinEDA_PcbFrame* pcbframe, wxDC* DC,
result = STOP_FROM_ESC; break;
}
/* report every COUNT new nodes or so */
/* report every COUNT new nodes or so */
#define COUNT 20000
if( (OpenNodes-lastopen > COUNT) || (ClosNodes-lastclos > COUNT) || (MoveNodes - lastmove > COUNT))
{
lastopen = OpenNodes;
if( (OpenNodes-lastopen > COUNT) || (ClosNodes-lastclos > COUNT) || (MoveNodes - lastmove > COUNT))
{
lastopen = OpenNodes;
lastclos = ClosNodes;
lastmove = MoveNodes;
AFFICHE_ACTIVITE_ROUTE;
}
lastmove = MoveNodes;
AFFICHE_ACTIVITE_ROUTE;
}
_self = 0;
if( curcell & HOLE )
......@@ -700,7 +700,7 @@ end_of_route:
Place_1_Pad_Board(
pcbframe->GetBoard(), pt_cur_ch->m_PadEnd, ~CURRENT_PAD, marge, WRITE_AND_CELL );
AFFICHE_ACTIVITE_ROUTE;
AFFICHE_ACTIVITE_ROUTE;
return result;
}
......@@ -1048,8 +1048,8 @@ static void Place_Piste_en_Buffer( WinEDA_PcbFrame* pcbframe, wxDC* DC )
int marge, via_marge;
WinEDA_DrawPanel* panel = pcbframe->DrawPanel;
marge = g_DesignSettings.m_TrackClearence + (g_DesignSettings.m_CurrentTrackWidth / 2);
via_marge = g_DesignSettings.m_TrackClearence + (g_DesignSettings.m_CurrentViaSize / 2);
marge = g_DesignSettings.m_TrackClearance + (g_DesignSettings.m_CurrentTrackWidth / 2);
via_marge = g_DesignSettings.m_TrackClearance + (g_DesignSettings.m_CurrentViaSize / 2);
/* tst point d'arrivee : doit etre sur pad start */
......
......@@ -3924,6 +3924,15 @@ class SPECCTRA_DB : public OUTPUTFORMATTER
nets.clear();
}
/**
* Function exportNETCLASS
* exports \a aNetClass to the DSN file.
*/
void exportNETCLASS( NETCLASS* aNetClass );
//-----</FromBOARD>------------------------------------------------------
//-----<FromSESSION>-----------------------------------------------------
......
......@@ -49,6 +49,17 @@
using namespace DSN;
// Add .1 mil to the requested clearances as a safety margin.
// There has been disagreement about interpretation of clearance in the past
// between Kicad and Freerouter, so keep this safetyMargin until the
// disagreement is resolved and stable. Freerouter seems to be moving
// (protected) traces upon loading the DSN file, and even though it seems to sometimes
// add its own 0.1 to the clearances, I believe this is happening after
// the load process (and moving traces) so I am of the opinion this is
// still needed.
static const double safetyMargin = 0.1;
// see wxPcbStruct.h
void WinEDA_PcbFrame::ExportToSpecctra( wxCommandEvent& event )
{
......@@ -93,6 +104,7 @@ void WinEDA_PcbFrame::ExportToSpecctra( wxCommandEvent& event )
try
{
GetBoard()->SynchronizeNetsAndNetClasses();
db.FromBOARD( GetBoard() );
db.ExportPCB( fullFileName, true );
......@@ -258,7 +270,6 @@ static PATH* makePath( const POINT& aStart, const POINT& aEnd, const std::string
/**
* Struct wxString_less_than
* is used by std:set<> and std::map<> instantiations which use wxString as their key.
*/
struct wxString_less_than
{
// a "less than" test on two wxStrings
......@@ -267,6 +278,7 @@ struct wxString_less_than
return s1.Cmp( s2 ) < 0; // case specific wxString compare
}
};
*/
/**
......@@ -454,7 +466,8 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, D_PAD* aPad )
/// data type used to ensure unique-ness of pin names, holding (wxString and int)
typedef std::map<wxString, int, wxString_less_than> PINMAP;
//typedef std::map<wxString, int, wxString_less_than> PINMAP;
typedef std::map<wxString, int> PINMAP;
IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, MODULE* aModule )
......@@ -952,27 +965,16 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IOError )
//-----<rules>--------------------------------------------------------
{
// put out these rules, the user can then edit them with a text editor
char rule[80];
int curTrackWidth = aBoard->m_BoardSettings->m_CurrentTrackWidth;
int curTrackClear = aBoard->m_BoardSettings->m_TrackClearence;
// Add .1 mil to the requested clearances as a safety margin.
// There has been disagreement about interpretation of clearance in the past
// between Kicad and Freerouter, so keep this safetyMargin until the
// disagreement is resolved and stable. Freerouter seems to be moving
// (protected) traces upon loading the DSN file, and even though it seems to sometimes
// add its own 0.1 to the clearances, I believe this is happening after
// the load process (and moving traces) so I am of the opinion this is
// still needed.
const double safetyMargin = 0.1;
int defaultTrackWidth = aBoard->m_NetClasses.GetDefault()->GetTrackWidth();
int defaultClearance = aBoard->m_NetClasses.GetDefault()->GetClearance();
double clearance = scale(curTrackClear);
double clearance = scale( defaultClearance );
STRINGS& rules = pcb->structure->rules->rules;
sprintf( rule, "(width %.6g)", scale( curTrackWidth ) );
sprintf( rule, "(width %.6g)", scale( defaultTrackWidth ) );
rules.push_back( rule );
sprintf( rule, "(clearance %.6g)", clearance+safetyMargin );
......@@ -1017,7 +1019,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IOError )
// Pad to pad spacing on a single SMT part can be closer than our
// clearance, we don't want freerouter complaining about that, so
// output a significantly smaller pad to pad clearance to freerouter.
clearance = scale(curTrackClear)/4;
clearance = scale( defaultClearance )/4;
sprintf( rule, "(clearance %.6g (type smd_smd))", clearance );
rules.push_back( rule );
......@@ -1401,46 +1403,58 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IOError )
}
//-----<output a default class with all nets and the via and track size>--
//-----<output NETCLASSs>----------------------------------------------------
NETCLASSES& nclasses = aBoard->m_NetClasses;
exportNETCLASS( nclasses.GetDefault() );
for( NETCLASSES::iterator nc = nclasses.begin(); nc != nclasses.end(); ++nc )
{
char text[80];
STRINGSET netIds; // sort the net names in here
CLASS* clazz = new CLASS( pcb->network );
pcb->network->classes.push_back( clazz );
// freerouter creates a class named 'default' anyway, and if we
// try and use that, we end up with two 'default' via rules so use
// something else as the name of our default class. Someday we may support
// additional classes. Until then the user can text edit the exported
// DSN file and use this class as a template, copying it and giving the
// copy a different class_id and splitting out some of the nets.
clazz->class_id = "kicad_default";
NETCLASS* netclass = nc->second;
exportNETCLASS( netclass );
}
}
// Insert all the net_ids into the set. They are unique, but even if
// they were not the duplicated name is not our error, but the BOARD's.
// A duplicate would be removed here.
NETS& nets = pcb->network->nets;
for( NETS::iterator i=nets.begin(); i!=nets.end(); ++i )
netIds.insert( i->net_id );
// netIds is now sorted, put them into clazz->net_ids
for( STRINGSET::iterator i=netIds.begin(); i!=netIds.end(); ++i )
clazz->net_ids.push_back( *i );
void SPECCTRA_DB::exportNETCLASS( NETCLASS* aNetClass )
{
char text[80];
// output the via and track dimensions, the whole reason for this scope.
int curTrackWidth = aBoard->m_BoardSettings->m_CurrentTrackWidth;
CLASS* clazz = new CLASS( pcb->network );
pcb->network->classes.push_back( clazz );
clazz->rules = new RULE( clazz, T_rule );
// freerouter creates a class named 'default' anyway, and if we
// try and use that, we end up with two 'default' via rules so use
// something else as the name of our default class.
clazz->class_id = CONV_TO_UTF8( aNetClass->GetName() );
sprintf( text, "(width %.6g)", scale( curTrackWidth ) );
clazz->rules->rules.push_back( text );
for( NETCLASS::iterator net = aNetClass->begin(); net != aNetClass->end(); ++net )
clazz->net_ids.push_back( CONV_TO_UTF8( *net ) );
int viaNdx = pcb->library->via_start_index;
clazz->rules = new RULE( clazz, T_rule );
// output the track width.
int trackWidth = aNetClass->GetTrackWidth();
sprintf( text, "(width %.6g)", scale( trackWidth ) );
clazz->rules->rules.push_back( text );
// output the clearance.
int clearance = aNetClass->GetClearance();
sprintf( text, "(clearance %.6g)", scale( clearance ) + safetyMargin );
clazz->rules->rules.push_back( text );
if( aNetClass->GetName() == NETCLASS::Default )
{
clazz->class_id = "kicad_default";
int viaNdx = pcb->library->via_start_index;
sprintf( text, "(use_via %s)", pcb->library->padstacks[viaNdx].padstack_id.c_str() );
clazz->circuit.push_back( text );
}
else
{
// @todo
}
}
......
......@@ -186,7 +186,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
CopyPolygonsFromFilledPolysListToBoolengine( booleng, GROUP_A );
// Calculates the clearance value that meet DRC requirements
int clearance = max( m_ZoneClearance, g_DesignSettings.m_TrackClearence );
int clearance = max( m_ZoneClearance, g_DesignSettings.m_TrackClearance );
clearance += m_ZoneMinThickness / 2;
......@@ -260,7 +260,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
}
// Draw graphic items (copper texts) and board edges
// zone clearance is used here regardless of the g_DesignSettings.m_TrackClearence value
// zone clearance is used here regardless of the g_DesignSettings.m_TrackClearance value
for( BOARD_ITEM* item = aPcb->m_Drawings; item; item = item->Next() )
{
if( item->GetLayer() != GetLayer() && item->GetLayer() != EDGE_N )
......@@ -288,7 +288,6 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
break;
default:
AddRoundedEndsSegmentPolygon( booleng,
( (DRAWSEGMENT*) item )->m_Start,
( (DRAWSEGMENT*) item )->m_End,
......@@ -297,7 +296,6 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
have_poly_to_substract = true;
break;
}
break;
case TYPE_TEXTE:
......
......@@ -952,16 +952,19 @@ int BOARD::Test_Drc_Areas_Outlines_To_Areas_Outlines( ZONE_CONTAINER* aArea_To_E
}
int bstyle = Area_To_Test->m_Poly->GetSideStyle( ic2 );
int x, y;
int d = GetClearanceBetweenSegments(
bx1, by1, bx2, by2, bstyle,
0,
ax1, ay1, ax2,
ay2, astyle,
0,
g_DesignSettings.
m_TrackClearence,
// @todo: decide what to use here.
g_DesignSettings.m_TrackClearance,
&x, &y );
if( d < g_DesignSettings.m_TrackClearence )
if( d < g_DesignSettings.m_TrackClearance )
{
// COPPERAREA_COPPERAREA error : intersect or too close
if( aCreate_Markers )
......
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