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;
}
......
This diff is collapsed.
......@@ -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( ) { };
};
......
This diff is collapsed.
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();
......
This diff is collapsed.
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////
// 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++ )
{
......
This diff is collapsed.
......@@ -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 );
......
This diff is collapsed.
......@@ -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