Commit fe10a993 authored by charras's avatar charras

Removed global default clearance, track size and vias drill. Use netclasses values only.

parent dbc736b3
......@@ -4,6 +4,29 @@ KiCad ChangeLog 2009
Please add newer entries at the top, list the date and your name with
email address.
2009-oct-20 UPDATE Wayne Stambaugh <stambaughw@verizon.net>
================================================================================
Replace component library editor draw item dialog box.
* Created new component library editor draw item dialog box with
wxFormBuilder.
* Removed previous DialogBlocks version of the draw item dialog box.
* Removed some additional global variables used in component library
editor.
* Add IsFillable() method to draw item base object.
wxWidgets 2.9 string fixes and other minor updates.
* Replace all known instances of (const wxChar*) casts to GetChars() for
wxWidgets 2.9 compatibility.
* Cleaned up get component dialog so last part gets saved on wild card
selections.
* Remove redundant schematic component drawing code.
* Added SCH_COMPONENT constructor to create new component from library
component object.
* Add message panel helpers to WinEDA_DrawFrame and update old message
panel access code.
* Using library viewer to add component to schematic now respects unit
and body style selection.
2009-oct-14 UPDATE Wayne Stambaugh <stambaughw@verizon.net>
================================================================================
Fix save last grid size and other minor updates.
......
......@@ -526,6 +526,21 @@ bool EDA_Rect::Intersects( const EDA_Rect aRect ) const
}
/**************************************************/
EDA_Rect& EDA_Rect::Inflate( int aDelta )
/**************************************************/
/** Function Inflate
* Inflate "this": move each horizontal edgeand each vertical edge by aDelta
* toward rect outside
* if aDelta is negative, move toward rect inside (deflate)
* Works for positive and negative rect size
*
*/
{
Inflate( aDelta, aDelta );
}
/**************************************************/
EDA_Rect& EDA_Rect::Inflate( wxCoord dx, wxCoord dy )
/**************************************************/
......
......@@ -12,7 +12,7 @@ may choose to document this corresponding work in the CHANGELOG.txt file.
/*
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 1992-2008 Jean-Pierre Charras, jean-pierre.charras@inpg.fr
* Copyright (C) 1992-2008 Jean-Pierre Charras, jean-pierre.charras@gipsa-lab.inpg.fr
* Copyright (C) 1992-2008 Kicad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
......
......@@ -207,8 +207,22 @@ public:
*/
operator wxRect() const { return wxRect( m_Pos, m_Size ); }
/** Inflate
* Inflate this object: move each horizontal edge by dx and each vertical edge by dy
* toward rect outside
* if dx and/or dy is negative, move toward rect inside (deflate)
* Works for positive and negative rect size
*/
EDA_Rect& Inflate( wxCoord dx, wxCoord dy );
/** Inflate
* Inflate this object: move each horizontal edge and each vertical edge by aDelta
* toward rect outside
* if aDelta is negative, move toward rect inside (deflate)
* Works for positive and negative rect size
*/
EDA_Rect& Inflate( int aDelta );
/** Function Merge
* Modify Position and Size of this in order to contain the given rect
* mainly used to calculate bounding boxes
......
......@@ -224,7 +224,8 @@ class NETCLASS;
/**
* Class BOARD_CONNECTED_ITEM
* This is a base class derived from BOARD_ITEM for items that can be connected
* mainly: tracks and pads
* and have a net, a netname, a clearance ...
* mainly: tracks, pads and zones
* Handle connection info
*/
class BOARD_CONNECTED_ITEM : public BOARD_ITEM
......@@ -248,7 +249,7 @@ public:
* @return int - the net code.
*/
int GetNet() const;
void SetNet( int aNetCode );
virtual void SetNet( int aNetCode );
/**
* Function GetSubNet
......@@ -289,6 +290,10 @@ public:
};
/*
* class BOARD_ITEM_LIST
* Handles a collection of BOARD_ITEM elements
*/
class BOARD_ITEM_LIST : public BOARD_ITEM
{
typedef boost::ptr_vector<BOARD_ITEM> ITEM_ARRAY;
......
......@@ -7,7 +7,7 @@
#include "base_struct.h"
#include "class_base_screen.h"
#include "board_item_struct.h"
#include "class_board_item.h"
// Definitions relatives aux libariries
#define ENTETE_LIBRAIRIE "PCBNEW-LibModule-V1"
......@@ -148,7 +148,7 @@ enum ELEMENTS_NUMBERS
PAD_CU_VISIBLE,
PAD_CMP_VISIBLE
};
/**
* Function IsValidLayerIndex
* tests whether a given integer is a valid layer index
......@@ -170,7 +170,7 @@ inline bool IsValidCopperLayerIndex( int aLayerIndex )
{
return aLayerIndex >= FIRST_COPPER_LAYER && aLayerIndex <= LAST_COPPER_LAYER;
}
/**
* Function IsValidNonCopperLayerIndex
* tests whether an integer is a valid non copper layer index
......@@ -181,15 +181,13 @@ inline bool IsValidNonCopperLayerIndex( int aLayerIndex )
{
return aLayerIndex >= FIRST_NO_COPPER_LAYER && aLayerIndex <= LAST_NO_COPPER_LAYER;
}
// Class for handle current printed board design settings
class EDA_BoardDesignSettings
{
public:
int m_CopperLayerCount; // Number of copper layers for this design
int m_ViaDrill; // via drill (for the entire board)
int m_ViaDrillCustomValue; // via drill for vias which must have a defined drill value
int m_MicroViaDrill; // micro via drill (for the entire board)
int m_ViaDrillCustomValue; // via drill for vias that have a specific drill value
int m_CurrentViaSize; // Current via size
int m_CurrentMicroViaSize; // Current micro via size
bool m_MicroViasAllowed; // true to allow micro vias
......@@ -200,10 +198,11 @@ 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_TrackClearance; // track to track and track to pads clearance
int m_TrackMinWidth; // track min value for width ((min copper size value
int m_ViasMinSize; // vias (not micro vias) min diameter
int m_ViasMinDrill; // vias (not micro vias) min drill diameter
int m_MicroViasMinSize; // micro vias (not vias) min diameter
int m_MicroViasMinDrill; // micro vias (not vias) min drill diameter
int m_MaskMargin; // Solder mask margin
int m_LayerThickness; // Layer Thickness for 3D viewer
......@@ -239,7 +238,7 @@ public:
* @param aMask = The new bit-mask of visible layers
*/
void SetVisibleLayers( int aMask );
/**
* Function IsLayerVisible
* tests whether a given layer is visible
......@@ -281,7 +280,7 @@ public:
{
m_VisibleElements = aMask;
}
/**
* Function IsElementVisible
* tests whether a given element category is visible
......
......@@ -87,6 +87,15 @@ public:
void InstallConfigFrame( const wxPoint& pos );
void Process_Config( wxCommandEvent& event );
void Update_config( wxWindow* displayframe );
/** Function Read_Config
* Read the project configuration file
* @param projectFileName = the config filename
* if not found use kicad.pro
* if not found : initialize default values
* @return true if the current config is modified, false if no change
*/
bool Read_Config( const wxString& projectFileName );
void OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct );
bool OnHotkeyDeleteItem( wxDC* DC, EDA_BaseStruct* DrawStruct );
......
No preview for this file type
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -127,6 +127,22 @@ BOARD::~BOARD()
return lists_sizes_modified;
}
/** function GetBiggestClearanceValue
* @return the biggest clerance value found in NetClasses list
*/
int BOARD::GetBiggestClearanceValue()
{
int clearance = m_NetClasses.GetDefault()->GetClearance();
//Read list of Net Classes
for( NETCLASSES::const_iterator nc = m_NetClasses.begin(); nc != m_NetClasses.end(); nc++ )
{
NETCLASS* netclass = nc->second;
clearance = MAX( clearance, netclass->GetClearance() );
}
return clearance;
}
wxString BOARD::GetLayerName( int aLayerIndex ) const
{
if( ! IsValidLayerIndex( aLayerIndex ))
......
......@@ -297,7 +297,7 @@ public:
bool SetLayerType( int aLayerIndex, LAYER_T aLayerType );
/* Routines de calcul des nombres de segments pistes et zones */
/* Functions to get some items count */
int GetNumSegmTrack();
int GetNumSegmZone();
unsigned GetNoconnectCount(); // retourne le nombre de connexions manquantes
......@@ -404,6 +404,7 @@ public:
*/
int ReturnSortedNetnamesList( wxArrayString& aNames, bool aSortbyPadsCount );
/****** function relative to NetClasses: */
/**
* Function SynchronizeNetsAndNetClasses
* copies NETCLASS info to each NET, based on NET membership in a NETCLASS.
......@@ -425,6 +426,13 @@ public:
*/
bool SetCurrentNetClass( const wxString& aNetClassName );
/** function GetBiggestClearanceValue
* @return the biggest clerance value found in NetClasses list
*/
int GetBiggestClearanceValue();
/***************************************************************************/
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
......@@ -714,6 +722,7 @@ public:
* @param aNetcode = netcode to analyse. if -1, analyse all nets
*/
void Test_Connections_To_Copper_Areas( int aNetcode = -1 );
};
#endif // #ifndef CLASS_BOARD_H
......@@ -111,6 +111,11 @@ int BOARD_CONNECTED_ITEM::GetClearance( BOARD_CONNECTED_ITEM* aItem ) const
}
/** return a pointer to the netclass of the zone
* if the net is not found (can happen when a netlist is reread,
* and the net name is not existant, return the default net class
* So should not return a null pointer
*/
NETCLASS* BOARD_CONNECTED_ITEM::GetNetClass() const
{
// It is important that this be implemented without any sequential searching.
......@@ -118,33 +123,35 @@ NETCLASS* BOARD_CONNECTED_ITEM::GetNetClass() const
BOARD* board = GetBoard();
// DO NOT use wxASSERT, because GetNetClass is called inside an OnPaint event
// and a call to wxASSERT can crash the application.
if( board )
if( board == NULL ) // Should not occurs
{
NETINFO_ITEM* net = board->FindNet( GetNet() );
if( net )
{
NETCLASS* netclass = net->GetNetClass();
#ifdef __WXDEBUG__
if( netclass == NULL )
wxLogWarning(wxT("BOARD_CONNECTED_ITEM::GetNetClass(): NULL netclass") );
wxLogWarning(wxT("BOARD_CONNECTED_ITEM::GetNetClass(): NULL board, type %d"), Type() );
#endif
return netclass;
}
else
{
return NULL;
}
NETCLASS* netclass = NULL;
NETINFO_ITEM* net = board->FindNet( GetNet() );
if( net )
{
netclass = net->GetNetClass();
#ifdef __WXDEBUG__
wxLogWarning(wxT("BOARD_CONNECTED_ITEM::GetNetClass(): NULL net") );
if( netclass == NULL )
wxLogWarning(wxT("BOARD_CONNECTED_ITEM::GetNetClass(): NULL netclass") );
#endif
}
}
else
{
#ifdef __WXDEBUG__
wxLogWarning(wxT("BOARD_CONNECTED_ITEM::GetNetClass(): NULL board, type %d"), Type() );
wxLogWarning(wxT("BOARD_CONNECTED_ITEM::GetNetClass(): NULL net") );
#endif
}
return NULL;
if( netclass )
return netclass;
else
return board->m_NetClasses.GetDefault();
}
/** function GetNetClassName
......
......@@ -782,7 +782,8 @@ 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_TrackClearance, g_DesignSettings.m_TrackClearance);
int biggest_clearance = GetBoard()->GetBiggestClearanceValue();
area.Inflate(biggest_clearance);
return area;
}
......
......@@ -33,6 +33,10 @@
// This will get mapped to "kicad_default" in the specctra_export.
const wxString NETCLASS::Default = wxT("Default");
// Initial values for netclass initialization
int NETCLASS::DEFAULT_CLEARANCE = 100; // track to track and track to pads clearance
int NETCLASS::DEFAULT_VIA_DRILL = 250; // default via drill
int NETCLASS::DEFAULT_UVIA_DRILL = 50; // micro via drill
NETCLASS::NETCLASS( BOARD* aParent, const wxString& aName, const NETCLASS* initialParameters ) :
......@@ -60,12 +64,13 @@ void NETCLASS::SetParams( const NETCLASS* defaults )
{
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 );
// Use default values for next parameters:
SetClearance( DEFAULT_CLEARANCE );
SetViaDrill( DEFAULT_VIA_DRILL );
SetuViaDrill( DEFAULT_UVIA_DRILL );
}
}
......
......@@ -37,8 +37,15 @@
* handles a collection of nets and the parameters used to route or
* test these nets.
*/
class NETCLASS
{
private:
// Default values used to init a NETCLASS
static int DEFAULT_CLEARANCE;
static int DEFAULT_VIA_DRILL;
static int DEFAULT_UVIA_DRILL;
protected:
BOARD* m_Parent;
......@@ -213,7 +220,7 @@ public:
/**
* Class NETCLASSES
* is a containter for NETCLASS instances. It owns all its NETCLASSes
* is a container for NETCLASS instances. It owns all its NETCLASSes
* (=> it will delete them at time of destruction). This container will always have
* a default NETCLASS with the name given by const NETCLASS::Default.
*/
......
......@@ -14,7 +14,8 @@
/*******************************************************************************************/
void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoint& offset )
void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode,
const wxPoint& offset )
/*******************************************************************************************/
/** Draw a pad:
......@@ -34,6 +35,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
wxPoint coord[4];
int fillpad = 0;
wxPoint shape_pos;
int mask_margin = 0; // margin (clearance) used for some non copper layers
if( m_Flags & DO_NOT_DRAW )
return;
......@@ -56,6 +58,8 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
if( color == 0 ) /* Not on copper layer */
{
// If the pad in on only one tech layer, use the layer color
// else use DARKGRAY
switch( m_Masque_Layer & ~ALL_CU_LAYERS )
{
case ADHESIVE_LAYER_CU:
......@@ -160,12 +164,26 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
}
}
// if Contrast mode and a technical layer active, show pads on this layer
// if Contrast mode is ON and a technical layer active, show pads on this layer
// so we can see pads on paste or solder layer
if( DisplayOpt.ContrastModeDisplay && screen->m_Active_Layer > LAST_COPPER_LAYER )
{
if( IsOnLayer( screen->m_Active_Layer ) )
{
color = g_DesignSettings.m_LayerColor[screen->m_Active_Layer];
// In hight contrast mode, and if the active layer is the mask layer
// shows the pad size with the mask clearance
switch( screen->m_Active_Layer )
{
case SOLDERMASK_N_CU:
case SOLDERMASK_N_CMP:
mask_margin = g_DesignSettings.m_MaskMargin;
break;
default:
break;
}
}
else
color = DARKDARKGRAY;
}
......@@ -191,8 +209,6 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
xc = ux0;
yc = uy0;
/* le trace depend de la rotation de l'empreinte */
dx = dx0 = m_Size.x >> 1;
dy = dy0 = m_Size.y >> 1; /* demi dim dx et dy */
......@@ -209,15 +225,15 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
* net classes so a call to GetClearance() is made only when needed
* (never needed in Cvpcb nor in Gerbview)
*/
int padClearance = DisplayIsol ? GetClearance() : 0;
int padClearance = DisplayIsol ? GetClearance() : 0;
switch( GetShape() )
{
case PAD_CIRCLE:
if( fillpad )
GRFilledCircle( &panel->m_ClipBox, DC, xc, yc, dx, 0, color, color );
GRFilledCircle( &panel->m_ClipBox, DC, xc, yc, dx + mask_margin, 0, color, color );
else
GRCircle( &panel->m_ClipBox, DC, xc, yc, dx, 0, color );
GRCircle( &panel->m_ClipBox, DC, xc, yc, dx + mask_margin, 0, color );
if( DisplayIsol )
{
......@@ -249,14 +265,16 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
if( fillpad )
{
GRFillCSegm( &panel->m_ClipBox, DC, ux0 + delta_cx, uy0 + delta_cy,
ux0 - delta_cx, uy0 - delta_cy,
GRFillCSegm( &panel->m_ClipBox, DC,
ux0 + delta_cx + mask_margin, uy0 + delta_cy + mask_margin,
ux0 - delta_cx - mask_margin, uy0 - delta_cy - mask_margin,
rotdx, color );
}
else
{
GRCSegm( &panel->m_ClipBox, DC, ux0 + delta_cx, uy0 + delta_cy,
ux0 - delta_cx, uy0 - delta_cy,
GRCSegm( &panel->m_ClipBox, DC,
ux0 + delta_cx + mask_margin, uy0 + delta_cy + mask_margin,
ux0 - delta_cx - mask_margin, uy0 - delta_cy - mask_margin,
rotdx, color );
}
......@@ -275,8 +293,8 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
case PAD_TRAPEZOID:
{
int ddx, ddy;
ddx = m_DeltaSize.x >> 1;
ddy = m_DeltaSize.y >> 1; /* demi dim dx et dy */
ddx = (m_DeltaSize.x >> 1) + mask_margin;
ddy = (m_DeltaSize.y >> 1) + mask_margin; /* demi dim dx et dy */
coord[0].x = -dx - ddy;
coord[0].y = +dy + ddx;
......@@ -301,8 +319,8 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
if( DisplayIsol )
{
dx += padClearance;
dy += padClearance;
dx += padClearance - mask_margin;
dy += padClearance - mask_margin;
coord[0].x = -dx - ddy;
coord[0].y = dy + ddx;
......
......@@ -108,7 +108,7 @@ TRACK* TRACK::Copy() const
/**
* Function GetDrillValue
* calculate the drill value for vias (m-Drill if > 0, or default drill value for the board
* calculate the drill value for vias (m_Drill if > 0, or default drill value for the Netclass
* @return real drill_value
*/
int TRACK::GetDrillValue() const
......@@ -116,25 +116,18 @@ int TRACK::GetDrillValue() const
if( Type() != TYPE_VIA )
return 0;
if( m_Drill >= 0 )
if( m_Drill > 0 ) // Use the specific value.
return m_Drill;
// Use the default value from the Netclass
NETCLASS* netclass = GetNetClass();
if( m_Shape == VIA_MICROVIA )
return g_DesignSettings.m_MicroViaDrill;
return netclass->GetuViaDrill();
return g_DesignSettings.m_ViaDrill;
return netclass->GetViaDrill();
}
/**
* Function GetLength
* returns the position of this object.
* @return the length of the track segment (0 for a via).
*/
double TRACK::GetLength()
{
wxPoint delta = m_End - m_Start;
return sqrt( ((double)delta.x*delta.x) + ((double)delta.y*delta.y ) );
}
/***********************/
bool TRACK::IsNull()
......
......@@ -96,12 +96,6 @@ public:
return m_Start; // it had to be start or end.
}
/**
* Function GetLength
* returns the position of this object.
* @return the length of the track segment (0 for a via).
*/
double GetLength();
EDA_Rect GetBoundingBox();
......
......@@ -22,7 +22,7 @@
/************************/
ZONE_CONTAINER::ZONE_CONTAINER( BOARD* parent ) :
BOARD_ITEM( parent, TYPE_ZONE_CONTAINER )
BOARD_CONNECTED_ITEM( parent, TYPE_ZONE_CONTAINER )
{
m_NetCode = -1; // Net number for fast comparisons
......@@ -42,6 +42,7 @@ ZONE_CONTAINER::~ZONE_CONTAINER()
}
/** virtual function GetPosition
* @return a wxPoint, position of the first point of the outline
*/
......@@ -71,21 +72,14 @@ void ZONE_CONTAINER::SetNet( int anet_code )
if( anet_code < 0 )
return;
if( m_Parent )
BOARD* board = GetBoard();
if( board )
{
BOARD* board = (BOARD*) m_Parent;
NETINFO_ITEM* net = board->FindNet( anet_code );
if( net )
m_Netname = net->GetNetname();
else
m_Netname.Empty();
// Set corresponding SEGZONE items if this zone uses fill areas by segments
for( SEGZONE* zseg = board->m_Zone; zseg; zseg = zseg->Next() )
{
if ( zseg->m_TimeStamp == m_TimeStamp )
zseg->SetNet(GetNet());
}
}
else
m_Netname.Empty();
......
......@@ -33,7 +33,7 @@ public:
* others polygons inside this main polygon are holes.
*/
class ZONE_CONTAINER : public BOARD_ITEM
class ZONE_CONTAINER : public BOARD_CONNECTED_ITEM
{
public:
wxString m_Netname; // Net Name
......@@ -60,10 +60,6 @@ public:
* in this case segments have m_ZoneMinThickness width
*/
private:
int m_NetCode; // Net number for fast comparisons
int m_ZoneSubnet; // variable used in rastnest computations:handle block number in zone connection calculations
public:
ZONE_CONTAINER( BOARD* parent );
~ZONE_CONTAINER();
......@@ -154,21 +150,7 @@ public:
return ( GetLayer() < FIRST_NO_COPPER_LAYER ) ? true : false;
}
/**
* Function GetZoneSubNet
* @return int - the sub net code in zone connections.
*/
int GetZoneSubNet() const { return m_ZoneSubnet; }
void SetZoneSubNet( int aSubNetCode ) { m_ZoneSubnet = aSubNetCode; }
int GetNet( void ) const
{
return m_NetCode;
}
void SetNet( int anet_code );
virtual void SetNet( int anet_code );
/**
* Function SetNetNameFromNetCode
......
......@@ -199,23 +199,22 @@ EDA_BoardDesignSettings::EDA_BoardDesignSettings()
};
m_CopperLayerCount = 2; // Default design is a double sided board
m_ViaDrill = 250; // defualt via drill (for the entire board)
m_ViaDrillCustomValue = 250; // via drill for vias which must have a defined drill value
m_CurrentViaSize = 450; // Current via size
m_CurrentViaType = VIA_THROUGH; // via type (VIA_BLIND_BURIED, VIA_THROUGH VIA_MICROVIA)
m_CurrentTrackWidth = 170; // current track width
m_UseConnectedTrackWidth = false; // if true, when creating a new track starting on an existing track, use this track width
m_MicroViaDrill = 50; // micro via drill (for the entire board)
m_CurrentMicroViaSize = 150; // Current micro via size
m_MicroViasAllowed = false; // true to allow micro vias
m_DrawSegmentWidth = 100; // current graphic line width (not EDGE layer)
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_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_ViasMinDrill = 200; // vias (not micro vias) min drill diameter
m_MicroViasMinSize = 200; // micro vias (not vias) min diameter
m_MicroViasMinDrill = 80; // micro vias (not vias) min drill diameter
m_MaskMargin = 150; // Solder mask margin
/* Color options for screen display of the Printed Board: */
......
......@@ -5,7 +5,7 @@
/*
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 2004-2009 Jean-Pierre Charras, jean-pierre.charras@inpg.fr
* Copyright (C) 2004-2009 Jean-Pierre Charras, jean-pierre.charras@gpisa-lab.inpg.fr
* Copyright (C) 2009 Dick Hollenbeck, dick@softplc.com
* Copyright (C) 2009 Kicad Developers, see change_log.txt for contributors.
*
......@@ -62,6 +62,7 @@ DIALOG_DESIGN_RULES::DIALOG_DESIGN_RULES( WinEDA_PcbFrame* parent ) :
/***********************************************************************************/
{
m_Parent = parent;
SetAutoLayout( true );
wxListItem column0;
wxListItem column1;
......@@ -87,7 +88,7 @@ DIALOG_DESIGN_RULES::DIALOG_DESIGN_RULES( WinEDA_PcbFrame* parent ) :
InitDialogRules();
SetAutoLayout( true );
Layout();
GetSizer()->Fit( this );
GetSizer()->SetSizeHints( this );
}
......@@ -161,11 +162,37 @@ void DIALOG_DESIGN_RULES::InitDialogRules()
}
InitializeRulesSelectionBoxes();
InitGlobalRules();
PrintCurrentSettings( );
}
// Sort comparison function
/*******************************************/
void DIALOG_DESIGN_RULES::InitGlobalRules()
/*******************************************/
{
AddUnitSymbol( *m_ViaMinTitle );
AddUnitSymbol( *m_ViaMinDrillTitle );
AddUnitSymbol( *m_MicroViaMinSizeTitle );
AddUnitSymbol( *m_MicroViaMinDrillTitle );
AddUnitSymbol( *m_TrackMinWidthTitle );
int Internal_Unit = m_Parent->m_InternalUnits;
PutValueInLocalUnits( *m_SetViasMinSizeCtrl, g_DesignSettings.m_ViasMinSize, Internal_Unit );
PutValueInLocalUnits( *m_SetViasMinDrillCtrl, g_DesignSettings.m_ViasMinDrill, Internal_Unit );
if( g_DesignSettings.m_CurrentViaType != VIA_THROUGH )
m_OptViaType->SetSelection( 1 );
m_AllowMicroViaCtrl->SetSelection( g_DesignSettings.m_MicroViasAllowed ? 1 : 0);
PutValueInLocalUnits( *m_SetMicroViasMinSizeCtrl, g_DesignSettings.m_MicroViasMinSize, Internal_Unit );
PutValueInLocalUnits( *m_SetMicroViasMinDrillCtrl, g_DesignSettings.m_MicroViasMinDrill, Internal_Unit );
PutValueInLocalUnits( *m_SetTrackMinWidthCtrl, g_DesignSettings.m_TrackMinWidth, Internal_Unit );
}
// Sort comparison function (helper for makePointers() )
static bool sortByClassThenName( NETCUP* a, NETCUP* b )
{
// return a < b
......@@ -404,6 +431,35 @@ void DIALOG_DESIGN_RULES::CopyRulesListToBoard()
m_Pcb->SynchronizeNetsAndNetClasses();
}
/*************************************************/
bool DIALOG_DESIGN_RULES::CopyGlobalRulesToBoard()
/*************************************************/
{
g_DesignSettings.m_CurrentViaType = VIA_THROUGH;
if( m_OptViaType->GetSelection() > 0 )
g_DesignSettings.m_CurrentViaType = VIA_BLIND_BURIED;
// Update vias minimum values for DRC
g_DesignSettings.m_ViasMinSize =
ReturnValueFromTextCtrl( *m_SetViasMinSizeCtrl, m_Parent->m_InternalUnits );
g_DesignSettings.m_ViasMinDrill =
ReturnValueFromTextCtrl( *m_SetViasMinDrillCtrl, m_Parent->m_InternalUnits );
g_DesignSettings.m_MicroViasAllowed = m_AllowMicroViaCtrl->GetSelection() == 1;
// Update microvias minimum values for DRC
g_DesignSettings.m_MicroViasMinSize =
ReturnValueFromTextCtrl( *m_SetMicroViasMinSizeCtrl, m_Parent->m_InternalUnits );
g_DesignSettings.m_MicroViasMinDrill =
ReturnValueFromTextCtrl( *m_SetMicroViasMinDrillCtrl, m_Parent->m_InternalUnits );
// Update tracks minimum values for DRC
g_DesignSettings.m_TrackMinWidth =
ReturnValueFromTextCtrl( *m_SetTrackMinWidthCtrl, m_Parent->m_InternalUnits );
return true;
}
/*****************************************************************/
void DIALOG_DESIGN_RULES::OnCancelButtonClick( wxCommandEvent& event )
......@@ -424,8 +480,11 @@ void DIALOG_DESIGN_RULES::OnOkButtonClick( wxCommandEvent& event )
}
CopyRulesListToBoard();
CopyGlobalRulesToBoard();
EndModal( wxID_OK );
m_Parent->AuxiliaryToolBar_Update_UI();
}
......@@ -458,19 +517,19 @@ void DIALOG_DESIGN_RULES::OnAddNetclassClick( wxCommandEvent& event )
m_grid->GetNumberRows() - 1,
class_name );
// Copy values of the previous class:
// Copy values of the default class:
int irow = m_grid->GetNumberRows() - 1;
for( int icol = 0; icol < m_grid->GetNumberCols(); icol++ )
{
wxString value;
value = m_grid->GetCellValue( irow - 1, icol );
value = m_grid->GetCellValue( 0, icol );
m_grid->SetCellValue( irow, icol, value );
}
InitializeRulesSelectionBoxes();
}
// Sort function for wxArrayInt. Itelms (ints) are sorted by decreasing value
// Sort function for wxArrayInt. Items (ints) are sorted by decreasing value
// used in DIALOG_DESIGN_RULES::OnRemoveNetclassClick
int sort_int(int *first, int *second)
{
......@@ -683,12 +742,17 @@ bool DIALOG_DESIGN_RULES::TestDataValidity()
wxString msg;
int minViaDrill = ReturnValueFromTextCtrl( *m_SetViasMinDrillCtrl, m_Parent->m_InternalUnits );
int minUViaDrill = ReturnValueFromTextCtrl( *m_SetMicroViasMinDrillCtrl, m_Parent->m_InternalUnits );
int minTrackWidth = ReturnValueFromTextCtrl( *m_SetTrackMinWidthCtrl, m_Parent->m_InternalUnits );
for( int row = 0; row < m_grid->GetNumberRows(); row++ )
{
int tracksize = ReturnValueFromString( g_UnitMetric,
m_grid->GetCellValue( row, GRID_TRACKSIZE ),
m_Parent->m_InternalUnits );
if( tracksize < g_DesignSettings.m_TrackMinWidth )
if( tracksize < minTrackWidth )
{
result = false;
msg.Printf( _( "%s: <b>Track Size</b> &lt; <b>Min Track Size</b><br>" ),
......@@ -714,7 +778,7 @@ bool DIALOG_DESIGN_RULES::TestDataValidity()
int viadrill = ReturnValueFromString( g_UnitMetric,
m_grid->GetCellValue( row, GRID_VIADRILL ),
m_Parent->m_InternalUnits );
if( viadrill && viadrill >= viadia )
if( viadrill >= viadia )
{
result = false;
msg.Printf( _( "%s: <b>Via Drill</b> &ge; <b>Via Dia</b><br>" ),
......@@ -723,6 +787,15 @@ bool DIALOG_DESIGN_RULES::TestDataValidity()
m_MessagesList->AppendToPage( msg );
}
if( viadrill < minViaDrill )
{
result = false;
msg.Printf( _( "%s: <b>Via Drill</b> &lt; <b>Min Via Drill</b><br>" ),
GetChars( m_grid->GetRowLabelValue(row)) );
m_MessagesList->AppendToPage( msg );
}
// Test Micro vias
int muviadia = ReturnValueFromString( g_UnitMetric,
m_grid->GetCellValue( row, GRID_uVIASIZE ),
......@@ -731,7 +804,7 @@ bool DIALOG_DESIGN_RULES::TestDataValidity()
if( muviadia < g_DesignSettings.m_MicroViasMinSize )
{
result = false;
msg.Printf( _( "%s: <b>MicroVia Diameter</b> &lt; <b>Minimun MicroVia Diameter</b><br>" ),
msg.Printf( _( "%s: <b>MicroVia Diameter</b> &lt; <b>MicroVia Min Diameter</b><br>" ),
GetChars( m_grid->GetRowLabelValue(row)) );
m_MessagesList->AppendToPage( msg );
......@@ -740,7 +813,7 @@ bool DIALOG_DESIGN_RULES::TestDataValidity()
int muviadrill = ReturnValueFromString( g_UnitMetric,
m_grid->GetCellValue( row, GRID_uVIADRILL ),
m_Parent->m_InternalUnits );
if( muviadrill && muviadrill >= muviadia )
if( muviadrill >= muviadia )
{
result = false;
msg.Printf( _( "%s: <b>MicroVia Drill</b> &ge; <b>MicroVia Dia</b><br>" ),
......@@ -748,6 +821,15 @@ bool DIALOG_DESIGN_RULES::TestDataValidity()
m_MessagesList->AppendToPage( msg );
}
if( muviadrill < minUViaDrill )
{
result = false;
msg.Printf( _( "%s: <b>MicroVia Drill</b> &ge; <b>MicroVia Min Drill</b><br>" ),
GetChars( m_grid->GetRowLabelValue(row)) );
m_MessagesList->AppendToPage( msg );
}
}
return result;
......
......@@ -58,9 +58,11 @@ private:
void OnRightSelectAllButton( wxCommandEvent& event );
bool TestDataValidity( );
void InitDialogRules();
void InitGlobalRules();
void InitRulesList();
void InitializeRulesSelectionBoxes();
void CopyRulesListToBoard();
bool CopyGlobalRulesToBoard();
void SetRoutableLayerStatus();
void FillListBoxWithNetNames( wxListCtrl* aListCtrl, const wxString& aNetClass );
void PrintCurrentSettings( );
......
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -21,6 +21,14 @@
#include <wx/statbox.h>
#include <wx/choice.h>
#include <wx/listctrl.h>
#include <wx/panel.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/radiobox.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/notebook.h>
#include <wx/html/htmlwin.h>
#include <wx/dialog.h>
......@@ -44,6 +52,8 @@ class DIALOG_DESIGN_RULES_BASE : public wxDialog
ID_RIGHT_CHOICE_CLICK,
};
wxNotebook* m_DRnotebook;
wxPanel* m_panelNetClassesEditor;
wxGrid* m_grid;
wxButton* m_addButton;
wxButton* m_removeButton;
......@@ -56,6 +66,19 @@ class DIALOG_DESIGN_RULES_BASE : public wxDialog
wxButton* m_buttonRightSelAll;
wxChoice* m_rightClassChoice;
wxListCtrl* m_rightListCtrl;
wxPanel* m_panelGolbalDesignRules;
wxRadioBox* m_OptViaType;
wxStaticText* m_ViaMinTitle;
wxTextCtrl* m_SetViasMinSizeCtrl;
wxStaticText* m_ViaMinDrillTitle;
wxTextCtrl* m_SetViasMinDrillCtrl;
wxRadioBox* m_AllowMicroViaCtrl;
wxStaticText* m_MicroViaMinSizeTitle;
wxTextCtrl* m_SetMicroViasMinSizeCtrl;
wxStaticText* m_MicroViaMinDrillTitle;
wxTextCtrl* m_SetMicroViasMinDrillCtrl;
wxStaticText* m_TrackMinWidthTitle;
wxTextCtrl* m_SetTrackMinWidthCtrl;
wxHtmlWindow* m_MessagesList;
wxStdDialogButtonSizer* m_sdbButtonsSizer;
wxButton* m_sdbButtonsSizerOK;
......@@ -78,7 +101,7 @@ class DIALOG_DESIGN_RULES_BASE : public wxDialog
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( 750,692 ), 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( 792,692 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_DESIGN_RULES_BASE();
};
......
......@@ -22,7 +22,7 @@ DIALOG_DRC_CONTROL::DIALOG_DRC_CONTROL( DRC* aTester, WinEDA_PcbFrame* parent )
m_tester = aTester;
m_Parent = parent;
Init();
InitValues();
if( GetSizer() )
{
GetSizer()->SetSizeHints( this );
......@@ -30,7 +30,7 @@ DIALOG_DRC_CONTROL::DIALOG_DRC_CONTROL( DRC* aTester, WinEDA_PcbFrame* parent )
}
void DIALOG_DRC_CONTROL::Init()
void DIALOG_DRC_CONTROL::InitValues()
{
// Connect events and objects
m_ClearanceListBox->Connect( ID_CLEARANCE_LIST, wxEVT_LEFT_DCLICK,
......@@ -46,10 +46,10 @@ void DIALOG_DRC_CONTROL::Init()
wxMouseEventHandler(
DIALOG_DRC_CONTROL::OnRightUpUnconnected ), NULL, this );
AddUnitSymbol( *m_ClearenceTitle );
AddUnitSymbol( *m_TrackMinWidthTitle );
AddUnitSymbol( *m_ViaMinTitle );
AddUnitSymbol( *m_MicroViaMinTitle );
m_SetClearance->SetValue( _("Use netclasses values"));
Layout(); // adding the units above expanded Clearance text, now resize.
......@@ -69,8 +69,6 @@ void DIALOG_DRC_CONTROL::Init()
*/
void DIALOG_DRC_CONTROL::SetDrcParmeters( )
{
g_DesignSettings.m_TrackClearance =
ReturnValueFromTextCtrl( *m_SetClearance, m_Parent->m_InternalUnits );
g_DesignSettings.m_TrackMinWidth =
ReturnValueFromTextCtrl( *m_SetTrackMinWidthCtrl, m_Parent->m_InternalUnits );
g_DesignSettings.m_ViasMinSize =
......
......@@ -51,7 +51,7 @@ private:
*/
void writeReport( FILE* fpOut );
void Init( );
void InitValues( );
void SetDrcParmeters( );
......
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 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__
///////////////////////////////////////////////////////////////////////////
// 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_ClearanceTitle;
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__
......@@ -38,15 +38,10 @@ void DIALOG_TRACKS_OPTIONS::MyInit()
AddUnitSymbol( *m_MaskClearanceTitle );
int Internal_Unit = m_Parent->m_InternalUnits;
PutValueInLocalUnits( *m_OptViaDrill, g_DesignSettings.m_ViaDrill, Internal_Unit );
PutValueInLocalUnits( *m_OptCustomViaDrill,
g_DesignSettings.m_ViaDrillCustomValue,
Internal_Unit );
PutValueInLocalUnits( *m_OptMaskMargin, g_DesignSettings.m_MaskMargin, Internal_Unit );
if( g_DesignSettings.m_CurrentViaType != VIA_THROUGH )
m_OptViaType->SetSelection( 1 );
m_AllowMicroViaCtrl->SetSelection( g_DesignSettings.m_MicroViasAllowed ? 1 : 0);
// Vias and Tracks sizes values.
// note we display only extra values, never the current netclass value.
......@@ -200,15 +195,8 @@ void DIALOG_TRACKS_OPTIONS::InitDimensionsLists()
void DIALOG_TRACKS_OPTIONS::OnButtonOkClick( wxCommandEvent& event )
/*******************************************************************/
{
g_DesignSettings.m_CurrentViaType = VIA_THROUGH;
if( m_OptViaType->GetSelection() > 0 )
g_DesignSettings.m_CurrentViaType = VIA_BLIND_BURIED;
g_DesignSettings.m_ViaDrill =
ReturnValueFromTextCtrl( *m_OptViaDrill, m_Parent->m_InternalUnits );
g_DesignSettings.m_ViaDrillCustomValue =
ReturnValueFromTextCtrl( *m_OptCustomViaDrill, m_Parent->m_InternalUnits );
g_DesignSettings.m_MicroViasAllowed = m_AllowMicroViaCtrl->GetSelection() == 1;
g_DesignSettings.m_MaskMargin =
ReturnValueFromTextCtrl( *m_OptMaskMargin, m_Parent->m_InternalUnits );
......
......@@ -35,7 +35,7 @@ DIALOG_TRACKS_OPTIONS_BASE::DIALOG_TRACKS_OPTIONS_BASE( wxWindow* parent, wxWind
sViaSizeBox = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Vias Custom Sizes List:") ), wxHORIZONTAL );
m_ViaSizeListCtrl = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
sViaSizeBox->Add( m_ViaSizeListCtrl, 1, wxALL|wxEXPAND, 5 );
sViaSizeBox->Add( m_ViaSizeListCtrl, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bSizeViasListButtons;
bSizeViasListButtons = new wxBoxSizer( wxVERTICAL );
......@@ -50,15 +50,6 @@ DIALOG_TRACKS_OPTIONS_BASE::DIALOG_TRACKS_OPTIONS_BASE( wxWindow* parent, wxWind
sbLeftSizer->Add( sViaSizeBox, 1, wxEXPAND, 5 );
m_ViaDefaultDrillValueTitle = new wxStaticText( this, wxID_ANY, _("Default Via Drill"), wxDefaultPosition, wxDefaultSize, 0 );
m_ViaDefaultDrillValueTitle->Wrap( -1 );
sbLeftSizer->Add( m_ViaDefaultDrillValueTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_OptViaDrill = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_OptViaDrill->SetToolTip( _("Enter the default via drill diameter\nAll vias drills not set to a specific drill value will have this drill value.") );
sbLeftSizer->Add( m_OptViaDrill, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_ViaAltDrillValueTitle = new wxStaticText( this, wxID_ANY, _("Specific Via Drill"), wxDefaultPosition, wxDefaultSize, 0 );
m_ViaAltDrillValueTitle->Wrap( -1 );
sbLeftSizer->Add( m_ViaAltDrillValueTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
......@@ -70,30 +61,6 @@ DIALOG_TRACKS_OPTIONS_BASE::DIALOG_TRACKS_OPTIONS_BASE( wxWindow* parent, wxWind
bMainUpperSizer->Add( sbLeftSizer, 1, wxEXPAND, 5 );
wxStaticBoxSizer* sbMiddleLeftSizer;
sbMiddleLeftSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Vias Options:") ), wxVERTICAL );
wxString m_OptViaTypeChoices[] = { _("Through via"), _("Blind or buried via") };
int m_OptViaTypeNChoices = sizeof( m_OptViaTypeChoices ) / sizeof( wxString );
m_OptViaType = new wxRadioBox( this, wxID_ANY, _("Default Via Type"), wxDefaultPosition, wxDefaultSize, m_OptViaTypeNChoices, m_OptViaTypeChoices, 1, wxRA_SPECIFY_COLS );
m_OptViaType->SetSelection( 0 );
m_OptViaType->SetToolTip( _("Select the current via type.\nTrough via is the usual selection") );
sbMiddleLeftSizer->Add( m_OptViaType, 0, wxALL|wxEXPAND, 5 );
sbMiddleLeftSizer->Add( 10, 10, 0, 0, 5 );
wxString m_AllowMicroViaCtrlChoices[] = { _("Do not allow micro vias"), _("Allow micro vias") };
int m_AllowMicroViaCtrlNChoices = sizeof( m_AllowMicroViaCtrlChoices ) / sizeof( wxString );
m_AllowMicroViaCtrl = new wxRadioBox( this, wxID_ALLOW_MICROVIA, _("Micro Vias:"), wxDefaultPosition, wxDefaultSize, m_AllowMicroViaCtrlNChoices, m_AllowMicroViaCtrlChoices, 1, wxRA_SPECIFY_COLS );
m_AllowMicroViaCtrl->SetSelection( 0 );
m_AllowMicroViaCtrl->SetToolTip( _("Allows or do not allow use of micro vias\nThey are very small vias only from an external copper layer to its near neightbour") );
sbMiddleLeftSizer->Add( m_AllowMicroViaCtrl, 0, wxALL, 5 );
bMainUpperSizer->Add( sbMiddleLeftSizer, 0, wxEXPAND, 5 );
wxStaticBoxSizer* sbMiddleRightSizer;
sbMiddleRightSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Dimensions:") ), wxVERTICAL );
......@@ -101,7 +68,7 @@ DIALOG_TRACKS_OPTIONS_BASE::DIALOG_TRACKS_OPTIONS_BASE( wxWindow* parent, wxWind
sbTracksListSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Tracks Custom Widths List:") ), wxHORIZONTAL );
m_TrackWidthListCtrl = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
sbTracksListSizer->Add( m_TrackWidthListCtrl, 1, wxALL|wxEXPAND, 5 );
sbTracksListSizer->Add( m_TrackWidthListCtrl, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bSizerTacksButtSizer;
bSizerTacksButtSizer = new wxBoxSizer( wxVERTICAL );
......
This diff is collapsed.
......@@ -21,7 +21,6 @@
#include <wx/statbox.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/radiobox.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
......@@ -48,7 +47,6 @@ class DIALOG_TRACKS_OPTIONS_BASE : public wxDialog
{
wxID_ADD_VIA_SIZE = 1000,
wxID_DELETED_WIA_SIEZ,
wxID_ALLOW_MICROVIA,
wxID_ADD_TRACK_WIDTH,
wxID_DELETED_TRACK_WIDTH,
};
......@@ -56,13 +54,8 @@ class DIALOG_TRACKS_OPTIONS_BASE : public wxDialog
wxListBox* m_ViaSizeListCtrl;
wxButton* m_buttonAddViasSize;
wxButton* m_button4;
wxStaticText* m_ViaDefaultDrillValueTitle;
wxTextCtrl* m_OptViaDrill;
wxStaticText* m_ViaAltDrillValueTitle;
wxTextCtrl* m_OptCustomViaDrill;
wxRadioBox* m_OptViaType;
wxRadioBox* m_AllowMicroViaCtrl;
wxListBox* m_TrackWidthListCtrl;
wxButton* m_buttonAddTrackSize;
wxButton* m_buttonDeleteTrackWidth;
......@@ -83,7 +76,7 @@ class DIALOG_TRACKS_OPTIONS_BASE : public wxDialog
public:
DIALOG_TRACKS_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Tracks and Vias Sizes"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 627,351 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
DIALOG_TRACKS_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Tracks and Vias Sizes"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,351 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_TRACKS_OPTIONS_BASE();
};
......
......@@ -62,8 +62,6 @@ void DRC::ShowDialog()
// copy data retained in this DRC object into the m_ui DrcPanel:
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 );;
PutValueInLocalUnits( *m_ui->m_SetViaMinSizeCtrl, g_DesignSettings.m_ViasMinSize,
......@@ -320,7 +318,8 @@ bool DRC::doNetClass( NETCLASS* nc, wxString& msg )
#define FmtVal( x ) GetChars( ReturnStringFromValue( g_UnitMetric, x, PCB_INTERNAL_UNIT ) )
if( nc->GetClearance() < g.m_TrackClearance )
#if 0 // set to 1 when (if...) EDA_BoardDesignSettings has a m_MinClearance value
if( nc->GetClearance() < g.m_MinClearance )
{
msg.Printf( _("NETCLASS: '%s' has Clearance:%s which is less than global:%s"),
GetChars( nc->GetName() ),
......@@ -333,6 +332,7 @@ bool DRC::doNetClass( NETCLASS* nc, wxString& msg )
m_currentMarker = 0;
ret = false;
}
#endif
if( nc->GetTrackWidth() < g.m_TrackMinWidth )
{
......@@ -362,12 +362,12 @@ bool DRC::doNetClass( NETCLASS* nc, wxString& msg )
ret = false;
}
if( nc->GetViaDrill() < g.m_ViaDrill )
if( nc->GetViaDrill() < g.m_ViasMinDrill )
{
msg.Printf( _("NETCLASS: '%s' has Via Drill:%s which is less than global:%s"),
GetChars( nc->GetName() ),
FmtVal( nc->GetViaDrill() ),
FmtVal( g.m_ViaDrill )
FmtVal( g.m_ViasMinDrill )
);
m_currentMarker = fillMarker( DRCE_NETCLASS_VIADRILLSIZE, msg, m_currentMarker );
......@@ -390,12 +390,12 @@ bool DRC::doNetClass( NETCLASS* nc, wxString& msg )
ret = false;
}
if( nc->GetuViaDrill() < g.m_MicroViaDrill )
if( nc->GetuViaDrill() < g.m_MicroViasMinDrill )
{
msg.Printf( _("NETCLASS: '%s' has uVia Drill:%s which is less than global:%s"),
GetChars( nc->GetName() ),
FmtVal( nc->GetuViaDrill() ),
FmtVal( g.m_MicroViaDrill )
FmtVal( g.m_MicroViasMinDrill )
);
m_currentMarker = fillMarker( DRCE_NETCLASS_uVIADRILLSIZE, msg, m_currentMarker );
......
......@@ -619,7 +619,7 @@ void CreateRoutesSection( FILE* file, BOARD* pcb )
fprintf( file, "VIA viapad%d %d %d ALL %d via%d\n",
track->m_Width,
mapXto( track->m_Start.x ), mapYto( track->m_Start.y ),
g_DesignSettings.m_ViaDrill, vianum++ );
track->GetDrillValue(), vianum++ );
}
}
......
......@@ -80,27 +80,19 @@ void WinEDA_DrillFrame::InitDisplayParams( void )
{
wxString msg;
if( s_Zeros_Format==DECIMAL_FORMAT )
if( s_Zeros_Format == DECIMAL_FORMAT )
m_Choice_Precision->Enable( false );
if( DrillOriginIsAuxAxis )
m_Choice_Drill_Offset->SetSelection( 1 );
msg << s_Precision.m_lhs << wxT( ":" ) << s_Precision.m_rhs;
m_Choice_Precision->SetStringSelection( msg );
if( s_Zeros_Format==DECIMAL_FORMAT )
if( s_Zeros_Format == DECIMAL_FORMAT )
m_Choice_Precision->Enable( false );
msg = ReturnStringFromValue( g_UnitMetric,
g_DesignSettings.m_ViaDrill,
m_Parent->m_InternalUnits );
msg += ReturnUnitSymbol( g_UnitMetric );
m_ViaDrillValue->SetLabel( msg );
m_ViaDrillValue->SetLabel( _( "Use Netclasses values" ) );
msg = ReturnStringFromValue( g_UnitMetric,
g_DesignSettings.m_MicroViaDrill,
m_Parent->m_InternalUnits );
msg += ReturnUnitSymbol( g_UnitMetric );
m_MicroViaDrillValue->SetLabel( msg );
m_MicroViaDrillValue->SetLabel( _( "Use Netclasses values" ) );
msg.Empty();
msg << g_pcb_plot_options.HPGL_Pen_Num;
......@@ -141,8 +133,8 @@ void WinEDA_DrillFrame::InitDisplayParams( void )
m_PadsHoleCount++;
}
else
if( MIN( pad->m_Drill.x, pad->m_Drill.y ) != 0 )
m_PadsHoleCount++;
if( MIN( pad->m_Drill.x, pad->m_Drill.y ) != 0 )
m_PadsHoleCount++;
}
}
......@@ -270,21 +262,21 @@ void WinEDA_DrillFrame::GenDrillFiles( wxCommandEvent& event )
*/
{
wxFileName fn;
wxString layer_extend; // added to the Board FileName to create FullFileName (= Board FileName + layer pair names)
wxString msg;
bool ExistsBuriedVias = false; // If true, drill files are created layer pair by layer pair for buried vias
int layer1 = COPPER_LAYER_N;
int layer2 = LAYER_CMP_N;
bool gen_through_holes = true;
wxString layer_extend; // added to the Board FileName to create FullFileName (= Board FileName + layer pair names)
wxString msg;
bool ExistsBuriedVias = false; // If true, drill files are created layer pair by layer pair for buried vias
int layer1 = COPPER_LAYER_N;
int layer2 = LAYER_CMP_N;
bool gen_through_holes = true;
UpdateConfig(); /* set params and Save drill options */
m_Parent->MsgPanel->EraseMsgBox();
/* Set conversion scale depending on drill file units */
s_ConversionUnits = 0.0001f; /* unites = INCHES */
s_ConversionUnits = 0.0001f; /* unites = INCHES */
if( !s_Unit_Drill_is_Inch )
s_ConversionUnits = 0.000254f; /* unites = mm */
s_ConversionUnits = 0.000254f; /* unites = mm */
if( m_MicroViasCount || m_BlindOrBuriedViasCount )
ExistsBuriedVias = true;
......@@ -322,7 +314,7 @@ void WinEDA_DrillFrame::GenDrillFiles( wxCommandEvent& event )
if( dlg.ShowModal() == wxID_CANCEL )
break;
FILE *excellon_dest = wxFopen( dlg.GetPath(), wxT( "w" ) );
FILE* excellon_dest = wxFopen( dlg.GetPath(), wxT( "w" ) );
if( excellon_dest == 0 )
{
......@@ -332,7 +324,7 @@ void WinEDA_DrillFrame::GenDrillFiles( wxCommandEvent& event )
return;
}
Create_Drill_File_EXCELLON(excellon_dest, s_HoleListBuffer, s_ToolListBuffer );
Create_Drill_File_EXCELLON( excellon_dest, s_HoleListBuffer, s_ToolListBuffer );
switch( m_Choice_Drill_Map->GetSelection() )
{
......@@ -393,7 +385,8 @@ void WinEDA_DrillFrame::UpdatePrecisionOptions( wxCommandEvent& event )
/********************************************************************/
{
if( m_Choice_Unit->GetSelection()==1 )
{ /* inch options */
{
/* inch options */
m_Choice_Precision->SetString( 0, _( "2:3" ) );
m_Choice_Precision->SetString( 1, _( "2:4" ) );
}
......@@ -411,8 +404,8 @@ void WinEDA_DrillFrame::UpdatePrecisionOptions( wxCommandEvent& event )
/**********************************************************************************/
int WinEDA_DrillFrame::Create_Drill_File_EXCELLON(FILE *excellon_dest,
std::vector<HOLE_INFO>& aHoleListBuffer,
int WinEDA_DrillFrame::Create_Drill_File_EXCELLON( FILE* excellon_dest,
std::vector<HOLE_INFO>& aHoleListBuffer,
std::vector<DRILL_TOOL>& aToolListBuffer )
/**********************************************************************************/
......@@ -440,22 +433,22 @@ int WinEDA_DrillFrame::Create_Drill_File_EXCELLON(FILE *excellon_dest,
{
if( s_Unit_Drill_is_Inch ) /* does it need T01, T02 or is T1,T2 ok?*/
fprintf( excellon_dest, "T%dC%.3f\n", ii + 1,
float (aToolListBuffer[ii].m_Diameter) * s_ConversionUnits );
float (aToolListBuffer[ii].m_Diameter) * s_ConversionUnits );
else
fprintf( excellon_dest, "T%dC%.3f\n", ii + 1,
float (aToolListBuffer[ii].m_Diameter) * s_ConversionUnits * 10.0 );
float (aToolListBuffer[ii].m_Diameter) * s_ConversionUnits * 10.0 );
}
fputs( "%\n", excellon_dest );
if( !Minimal )
fputs( "M47\n", excellon_dest ); /* Operator message */
fputs( "G05\n", excellon_dest ); /* Drill mode */
fputs( "M47\n", excellon_dest ); /* Operator message */
fputs( "G05\n", excellon_dest ); /* Drill mode */
/* Units : */
if( s_Unit_Drill_is_Inch && !Minimal )
fputs( "M72\n", excellon_dest ); /* M72 = inch mode */
fputs( "M72\n", excellon_dest ); /* M72 = inch mode */
else if( !Minimal )
fputs( "M71\n", excellon_dest ); /* M71 = metric mode */
fputs( "M71\n", excellon_dest ); /* M71 = metric mode */
/* Read the hole file and generate lines for normal holes (oblong holes will be created later) */
for( unsigned ii = 0; ii < aHoleListBuffer.size(); ii++ )
......@@ -541,7 +534,7 @@ int WinEDA_DrillFrame::Create_Drill_File_EXCELLON(FILE *excellon_dest,
fputs( line, excellon_dest );
fputs( "G85",excellon_dest ); // add the "G85" command
fputs( "G85", excellon_dest ); // add the "G85" command
xt = float (xf) * s_ConversionUnits; yt = float (yf) * s_ConversionUnits;
if( s_Unit_Drill_is_Inch )
......@@ -661,17 +654,19 @@ void WinEDA_DrillFrame::Write_Excellon_Header( FILE* aFile )
if( !Minimal )
{
int ii = m_Choice_Zeros_Format->GetSelection();
int ii = m_Choice_Zeros_Format->GetSelection();
DateAndTime( Line );
// The next 2 lines in EXCELLON files are comments:
wxString msg = wxGetApp().GetTitle() + wxT( " " ) + GetBuildVersion();
fprintf( aFile, ";DRILL file {%s} date %s\n", CONV_TO_UTF8( msg ), Line );
msg = wxT( ";FORMAT={" );
// Print precision:
if ( ii > 0 )
if( ii > 0 )
msg << m_Choice_Precision->GetStringSelection();
else
msg << wxT("-.-"); // in decimal format the precision is irrelevant
msg << wxT( "-.-" ); // in decimal format the precision is irrelevant
msg << wxT( "/ absolute / " );
msg << ( s_Unit_Drill_is_Inch ? wxT( "inch" ) : wxT( "metric" ) );
......@@ -684,7 +679,7 @@ void WinEDA_DrillFrame::Write_Excellon_Header( FILE* aFile )
msg << wxT( " / " );
const wxString zero_fmt[5] =
{
wxT( "decimal" ), wxT( "suppress leading zeros" ),
wxT( "decimal" ), wxT( "suppress leading zeros" ),
wxT( "suppress trailing zeros" ), wxT( "keep zeros" ),
wxT( "???" )
};
......@@ -739,8 +734,8 @@ void WinEDA_DrillFrame::GenDrillMap( const wxString aFileName,
*/
{
wxFileName fn;
wxString ext, wildcard;
wxString msg;
wxString ext, wildcard;
wxString msg;
/* Init extension */
switch( format )
......@@ -782,7 +777,7 @@ void WinEDA_DrillFrame::GenDrillMap( const wxString aFileName,
if( dlg.ShowModal() == wxID_CANCEL )
return;
FILE *drillplot_dest = wxFopen( dlg.GetPath(), wxT( "wt" ) );
FILE* drillplot_dest = wxFopen( dlg.GetPath(), wxT( "wt" ) );
if( drillplot_dest == 0 )
{
......@@ -812,21 +807,21 @@ void WinEDA_DrillFrame::GenDrillReport( const wxString aFileName )
*/
{
wxFileName fn;
wxString msg;
wxString wildcard = _( "Drill report files (.rpt)|*.rpt" );
wxString msg;
wxString wildcard = _( "Drill report files (.rpt)|*.rpt" );
fn = aFileName;
fn.SetName( fn.GetName() + wxT( "-drl" ) );
fn.SetExt( wxT( "rpt" ) );
wxFileDialog dlg( this, _( "Save Drill Report File" ), fn.GetPath(),
wxFileDialog dlg( this, _( "Save Drill Report File" ), fn.GetPath(),
fn.GetFullName(), wildcard,
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( dlg.ShowModal() == wxID_CANCEL )
return;
FILE *report_dest = wxFopen( dlg.GetPath(), wxT( "w" ) );
FILE* report_dest = wxFopen( dlg.GetPath(), wxT( "w" ) );
if( report_dest == 0 )
{
......
......@@ -324,6 +324,8 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum )
char Line[1024];
char* data;
NETCLASS * netclass_default = GetBoard()->m_NetClasses.GetDefault();
while( GetLine( File, Line, LineNum ) != NULL )
{
strtok( Line, " =\n\r" );
......@@ -405,7 +407,7 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum )
if( stricmp( Line, "TrackClearence" ) == 0 )
{
g_DesignSettings.m_TrackClearance = atoi( data );
netclass_default->SetClearance( atoi( data ) );
continue;
}
......@@ -421,12 +423,6 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum )
continue;
}
if( stricmp( Line, "ZoneGridSize" ) == 0 )
{
g_GridRoutingSize = atoi( data );
continue;
}
if( stricmp( Line, "DrawSegmWidth" ) == 0 )
{
g_DesignSettings.m_DrawSegmentWidth = atoi( data );
......@@ -472,7 +468,8 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum )
if( stricmp( Line, "ViaDrill" ) == 0 )
{
g_DesignSettings.m_ViaDrill = atoi( data );
int diameter = atoi( data );
netclass_default->SetViaDrill( diameter );
continue;
}
......@@ -482,9 +479,23 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum )
continue;
}
if( stricmp( Line, "ViaMinDrill" ) == 0 )
{
g_DesignSettings.m_ViasMinDrill = atoi( data );
continue;
}
if( stricmp( Line, "MicroViaDrill" ) == 0 )
{
g_DesignSettings.m_MicroViaDrill = atoi( data );
int diameter = atoi( data );
netclass_default->SetuViaDrill( diameter );
continue;
}
if( stricmp( Line, "MicroViaMinDrill" ) == 0 )
{
int diameter = atoi( data );
g_DesignSettings.m_MicroViasMinDrill = diameter;
continue;
}
......@@ -582,6 +593,7 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum )
static int WriteSetup( FILE* aFile, WinEDA_BasePcbFrame* aFrame, BOARD* aBoard )
/******************************************************************************/
{
NETCLASS * netclass_default = aFrame->GetBoard()->m_NetClasses.GetDefault();
char text[1024];
fprintf( aFile, "$SETUP\n" );
......@@ -610,25 +622,27 @@ static int WriteSetup( FILE* aFile, WinEDA_BasePcbFrame* aFrame, BOARD* aBoard )
fprintf( aFile, "TrackWidthList %d\n", aBoard->m_TrackWidthList[ii] );
fprintf( aFile, "TrackClearence %d\n", g_DesignSettings.m_TrackClearance );
fprintf( aFile, "TrackClearence %d\n", netclass_default->GetClearance() );
fprintf( aFile, "ZoneClearence %d\n", g_Zone_Default_Setting.m_ZoneClearance );
fprintf( aFile, "TrackMinWidth %d\n" , g_DesignSettings.m_TrackMinWidth );
fprintf( aFile, "DrawSegmWidth %d\n", g_DesignSettings.m_DrawSegmentWidth );
fprintf( aFile, "EdgeSegmWidth %d\n", g_DesignSettings.m_EdgeSegmentWidth );
fprintf( aFile, "ViaSize %d\n", g_DesignSettings.m_CurrentViaSize );
fprintf( aFile, "ViaDrill %d\n", g_DesignSettings.m_ViaDrill );
fprintf( aFile, "ViaDrill %d\n", netclass_default->GetViaDrill() );
fprintf( aFile, "ViaAltDrill %d\n", g_DesignSettings.m_ViaDrillCustomValue );
fprintf( aFile, "ViaMinSize %d\n", g_DesignSettings.m_ViasMinSize );
fprintf( aFile, "ViaMinDrill %d\n", g_DesignSettings.m_ViasMinDrill );
// Save custom vias diameters list (the first is not saved here: this is the netclass value
for( unsigned ii = 1; ii < aBoard->m_ViaSizeList.size(); ii++ )
fprintf( aFile, "ViaSizeList %d\n", aBoard->m_ViaSizeList[ii] );
fprintf( aFile, "MicroViaSize %d\n", g_DesignSettings.m_CurrentMicroViaSize);
fprintf( aFile, "MicroViaDrill %d\n", g_DesignSettings.m_MicroViaDrill);
fprintf( aFile, "MicroViaDrill %d\n", netclass_default->GetuViaDrill());
fprintf( aFile, "MicroViasAllowed %d\n", g_DesignSettings.m_MicroViasAllowed);
fprintf( aFile, "MicroViaMinSize %d\n" , g_DesignSettings.m_MicroViasMinSize );
fprintf( aFile, "MicroViaMinDrill %d\n", g_DesignSettings.m_MicroViasMinDrill );
fprintf( aFile, "TextPcbWidth %d\n", g_DesignSettings.m_PcbTextWidth );
fprintf( aFile, "TextPcbSize %d %d\n",
......
......@@ -49,15 +49,6 @@ void WinEDA_PcbFrame::Process_Config( wxCommandEvent& event )
DisplayColorSetupFrame( this, pos );
break;
/*
case ID_PCB_COPPER_LAYERS_SETUP:
{
DIALOG_COPPER_LAYERS_SETUP dialog( this );
dialog.ShowModal();
}
break;
*/
case ID_PCB_LAYERS_SETUP:
DisplayDialogLayerSetup( this );
break;
......@@ -163,17 +154,14 @@ bool Read_Hotkey_Config( WinEDA_DrawFrame* frame, bool verbose )
}
/**************************************************************************/
bool Read_Config( const wxString& projectFileName )
/*************************************************************************/
/* lit la configuration, si elle n'a pas deja ete lue
* 1 - lit <nom fichier brd>.pro
* 2 - si non trouve lit <chemin de *.exe>/kicad.pro
* 3 - si non trouve: init des variables aux valeurs par defaut
*
* Retourne TRUE si lu, FALSE si config non lue ou non modifie
/** Function Read_Config
* Read the project configuration file
* @param projectFileName = the config filename
* if not found use kicad.pro
* if not found : initialize default values
* @return true if the current config is modified, false if no change
*/
bool WinEDA_PcbFrame::Read_Config( const wxString& projectFileName )
{
wxFileName fn = projectFileName;
int ii;
......@@ -192,7 +180,7 @@ bool Read_Config( const wxString& projectFileName )
/* User library path takes precedent over default library search paths. */
wxGetApp().InsertLibraryPath( g_UserLibDirBuffer, 1 );
/* Reset the ITEM*NOT*SHOW flag when loading a new config
/* Reset the items visibility flag when loading a new config
* Because it could creates SERIOUS mistakes for the user,
* if some items are not visible after loading a board...
*/
......@@ -201,10 +189,6 @@ bool Read_Config( const wxString& projectFileName )
DisplayOpt.Show_Modules_Cmp = true;
DisplayOpt.Show_Modules_Cu = true;
// These parameters could be left in their previous state, or resetted
// Comment or uncomment to keep or reset this option after loading a board
g_DesignSettings.SetElementVisibility( MODULE_TEXT_NOV_VISIBLE, true );
g_DesignSettings.SetElementVisibility( MODULE_TEXT_CMP_VISIBLE, true );
g_DesignSettings.SetElementVisibility( MODULE_TEXT_CU_VISIBLE, true );
......@@ -213,6 +197,8 @@ bool Read_Config( const wxString& projectFileName )
g_DesignSettings.SetElementVisibility( VIA_THROUGH_VISIBLE, true );
g_DesignSettings.SetElementVisibility( VIA_BLIND_BURIED_VISIBLE, true );
g_DesignSettings.SetElementVisibility( VIA_MICROVIA_VISIBLE, true );
// Items that can remain not visible: comment them if you want.
g_DesignSettings.SetElementVisibility( ANCHOR_VISIBLE, true );
DisplayOpt.DisplayPadNoConn = true;
......
......@@ -64,21 +64,6 @@ static PARAM_CFG_INT ViaDiametreCfg
0, 0xFFFF /* Min and max values*/
);
static PARAM_CFG_INT ViaDrillCfg
(
wxT( "ViaDril" ), /* Keyword */
&g_DesignSettings.m_ViaDrill, /* Parameter address */
250, /* Default value */
0, 0xFFFF /* Min and max values*/
);
static PARAM_CFG_INT ViaAltDrillCfg
(
wxT( "ViaAltD" ), /* Keyword */
&g_DesignSettings.m_ViaDrillCustomValue, /* Parameter address */
250, /* Default value */
0, 0xFFFF /* Min and max values*/
);
static PARAM_CFG_INT LayerThicknessCfg
(
wxT( "LayerThickness" ), /* Keyword */
......@@ -95,14 +80,6 @@ static PARAM_CFG_INT MicroViaDiametreCfg
0, 1000 /* Min and max values*/
);
static PARAM_CFG_INT MicroViaDrillCfg
(
wxT( "MViaDrl" ), /* Keyword */
&g_DesignSettings.m_MicroViaDrill, /* Parameter address */
80, /* Default value */
0, 800 /* Min and max values*/
);
static PARAM_CFG_INT ViaShowHoleCfg
(
INSETUP,
......@@ -123,30 +100,6 @@ static PARAM_CFG_INT ShowNetNamesModeCfg
3 /* Min and max values*/
);
static PARAM_CFG_INT TrackClearenceCfg
(
wxT( "Isol" ), /* Keyword */
&g_DesignSettings.m_TrackClearance, /* Parameter address */
120, /* Default value */
0, 0xFFFF /* Min and max values*/
);
static PARAM_CFG_INT LayerCountCfg // Mask Working Layers
(
wxT( "Countlayer" ), /* Keyword */
&g_DesignSettings.m_CopperLayerCount, /* Parameter address */
2, /* Default value */
1, NB_COPPER_LAYERS /* Min and max values*/
);
static PARAM_CFG_INT TrackWidthCfg
(
wxT( "Lpiste" ), /* Keyword */
&g_DesignSettings.m_CurrentTrackWidth, /* Parameter address */
170, /* Default value */
2, 0xFFFF /* Min and max values*/
);
static PARAM_CFG_INT RouteLayTopCfg // First current working layer
(
wxT( "RouteTo" ), /* Keyword */
......@@ -163,14 +116,6 @@ static PARAM_CFG_INT RouteLayBotCfg // second current working layer
0, 15 /* Min and max values*/
);
static PARAM_CFG_INT TypeViaCfg
(
wxT( "TypeVia" ), /* Keyword */
&g_DesignSettings.m_CurrentViaType, /* Parameter address */
VIA_THROUGH, /* Default value */
0, 3 /* Min and max values*/
);
static PARAM_CFG_BOOL Segm45Cfg // Segm Pistes a 0, 45, 90 degres uniquement
(
wxT( "Segm45" ), /* Keyword */
......@@ -801,26 +746,19 @@ PARAM_CFG_BASE* ParamCfgList[] =
&PadDimHCfg,
&PadDimVCfg,
&ViaDiametreCfg,
&ViaDrillCfg,
&ViaAltDrillCfg,
&MicroViaDiametreCfg,
&MicroViaDrillCfg,
&ViaShowHoleCfg,
&ShowNetNamesModeCfg,
&TrackClearenceCfg,
&LayerThicknessCfg,
&LayerCountCfg,
&TrackWidthCfg,
&RouteLayTopCfg,
&RouteLayBotCfg,
&TypeViaCfg,
&Segm45Cfg,
&Raccord45Cfg,
&UnitCfg,
&SegmFillCfg,
&TrackDisplayClearanceCfg,
&PadFillCfg,
&ViaFillCfg, //TODO: Will adding this line break tha pcbnew file compatibility?
&ViaFillCfg,
&PadAfficheGardeCfg,
&PadShowNumCfg,
&AfficheContourModuleCfg,
......
......@@ -123,7 +123,7 @@ Changing extension to .brd." ),
SetupServerFunction( RemoteCommand );
}
Read_Config( fn.GetFullPath() );
frame->Read_Config( fn.GetFullPath() );
frame->Zoom_Automatique( true );
......
......@@ -147,7 +147,7 @@ void WinEDA_DrawPanel::PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref, int aPrintMa
continue;
if( pt_piste->Type() == TYPE_VIA ) /* VIA rencontree */
{
int rayon = g_DesignSettings.m_ViaDrill / 2;
int rayon = pt_piste->GetDrillValue() / 2;
GRFilledCircle( &m_ClipBox, aDC, pt_piste->m_Start.x, pt_piste->m_Start.y,
rayon, 0, color, color );
}
......
......@@ -50,7 +50,6 @@ void CreateSortedPadListByXCoord( BOARD* aBoard, std::vector<D_PAD*>* aVector );
/**************/
/* PCBCFG.CPP */
/**************/
bool Read_Config( const wxString& project_name );
bool Read_Hotkey_Config( WinEDA_DrawFrame* frame, bool verbose );
......
......@@ -31,6 +31,7 @@ static int segm_oX, segm_oY;
static int segm_fX, segm_fY; /* Origine et fin de la piste en cours de trace */
static RATSNEST_ITEM* pt_cur_ch;
static int Ncurrent; /* measures of progress */
static int s_Clearance; // Clerance value used in autorouter
#define NOSUCCESS 0
......@@ -219,6 +220,8 @@ int WinEDA_PcbFrame::Solve( wxDC* DC, int two_sides )
DrawPanel->m_AbortRequest = FALSE;
DrawPanel->m_AbortEnable = TRUE;
s_Clearance = GetBoard()->m_NetClasses.GetDefault()->GetClearance();
Ncurrent = 0;
MsgPanel->EraseMsgBox();
msg.Printf( wxT( "%d " ), GetBoard()->m_NbNoconnect );
......@@ -355,8 +358,8 @@ static int Autoroute_One_Track( WinEDA_PcbFrame* pcbframe, wxDC* DC,
result = NOSUCCESS;
marge = g_DesignSettings.m_TrackClearance + (g_DesignSettings.m_CurrentTrackWidth / 2);
via_marge = g_DesignSettings.m_TrackClearance + (g_DesignSettings.m_CurrentViaSize / 2);
marge = s_Clearance + (g_DesignSettings.m_CurrentTrackWidth / 2);
via_marge = s_Clearance + (g_DesignSettings.m_CurrentViaSize / 2);
/* clear direction flags */
i = Nrows * Ncols * sizeof(char);
......@@ -1048,8 +1051,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_TrackClearance + (g_DesignSettings.m_CurrentTrackWidth / 2);
via_marge = g_DesignSettings.m_TrackClearance + (g_DesignSettings.m_CurrentViaSize / 2);
marge = s_Clearance + (g_DesignSettings.m_CurrentTrackWidth / 2);
via_marge = s_Clearance + (g_DesignSettings.m_CurrentViaSize / 2);
/* tst point d'arrivee : doit etre sur pad start */
......
......@@ -1113,10 +1113,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IOError )
std::string componentId;
// find the highest numbered netCode within the board.
int highestNetCode = -1;
// for( EQUIPOT* equipot = aBoard->m_Equipots; equipot; equipot = equipot->Next() )
// highestNetCode = MAX( highestNetCode, equipot->GetNet() );
highestNetCode = aBoard->m_NetInfo->GetCount() - 1;
int highestNetCode = aBoard->m_NetInfo->GetCount() - 1;
deleteNETs();
// expand the net vector to highestNetCode+1, setting empty to NULL
......@@ -1236,12 +1233,15 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IOError )
// Next we add the via's which may be used.
int defaultViaSize = aBoard->m_BoardSettings->m_CurrentViaSize;
// TODO: output vias sizes in NetClasses
int defaultViaDrill = aBoard->m_NetClasses.GetDefault()->GetViaDrill();
/**
*@todo: *** output vias sizes and drill in NetClasses ***
*/
/* I need at least one via for the (class...) scope below
if( defaultViaSize )
*/
{
PADSTACK* padstack = makeVia( defaultViaSize, g_DesignSettings.m_ViaDrill,
PADSTACK* padstack = makeVia( defaultViaSize, defaultViaDrill,
0, aBoard->GetCopperLayerCount()-1 );
pcb->library->AddPadstack( padstack );
......@@ -1258,7 +1258,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IOError )
if( viaSize == defaultViaSize )
continue;
PADSTACK* padstack = makeVia( viaSize, g_DesignSettings.m_ViaDrill,
PADSTACK* padstack = makeVia( viaSize, defaultViaDrill,
0, aBoard->GetCopperLayerCount()-1 );
pcb->library->AddPadstack( padstack );
}
......
......@@ -242,9 +242,9 @@ SEGVIA* SPECCTRA_DB::makeVIA( PADSTACK* aPadstack, const POINT& aPoint, int aNet
// drillMils is not in the session units, but actual mils so we don't use scale()
drillDiam = (int) (drillMils * 10);
if( drillDiam == g_DesignSettings.m_ViaDrill ) // default
drillDiam = -1; // import as default
/** @todo: see if we use default netclass or specific value
*/
drillDiam = -1; // import as default: real drill is the netclass value
}
}
......
......@@ -193,23 +193,35 @@ 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_TrackClearance );
clearance += m_ZoneMinThickness / 2;
/* Calculates the clearance value that meet DRC requirements
* from m_ZoneClearance and clearance from the corresponding netclass
* We have a "local" clearance in zones because most of time
* clearance between a zone and others items is bigger than the netclass clearance
* this is more true for small clearance values
* Note also the "local" clearance is used for clearance between non copper items
* or items like texts on copper layers
*/
int zone_clearance = max( m_ZoneClearance, GetClearance() );
zone_clearance += m_ZoneMinThickness / 2;
/* Add holes (i.e. tracks and pads areas as polygons outlines)
* in GroupB in Bool_Engine
*/
/* items ouside the zone bounding box are skipped */
/* items ouside the zone bounding box are skipped
* the bounding box is the zone bounding box + the biigest clearance found in Netclass list
*/
EDA_Rect item_boundingbox;
EDA_Rect zone_boundingbox = GetBoundingBox();
zone_boundingbox.Inflate( m_ZoneClearance, clearance );
int biggest_clearance = aPcb->GetBiggestClearanceValue();
biggest_clearance = MAX( biggest_clearance, zone_clearance );
zone_boundingbox.Inflate( biggest_clearance, biggest_clearance );
/*
* First : Add pads. Note: pads having the same net as zone are left in zone.
* Thermal shapes will be created later if necessary
*/
int item_clearance;
have_poly_to_substract = false;
for( MODULE* module = aPcb->m_Modules; module; module = module->Next() )
{
......@@ -220,18 +232,19 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
if( pad->GetNet() != GetNet() )
{
item_clearance = pad->GetClearance() + (m_ZoneMinThickness / 2);
item_boundingbox = pad->GetBoundingBox();
if( item_boundingbox.Intersects( zone_boundingbox ) )
{
AddPadWithClearancePolygon( booleng, *pad, clearance );
AddPadWithClearancePolygon( booleng, *pad, MAX(zone_clearance,item_clearance) );
have_poly_to_substract = true;
}
continue;
}
int gap = clearance;
int gap = zone_clearance;
#ifdef USE_STUBS_FOR_THERMAL
gap = MAX( clearance, m_ThermalReliefGapValue );
gap = MAX( zone_clearance, m_ThermalReliefGapValue );
#else
if( (m_PadOption == PAD_NOT_IN_ZONE)
|| (GetNet() == 0) || pad->m_PadShape == PAD_TRAPEZOID )
......@@ -259,10 +272,12 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
continue;
if( track->GetNet() == GetNet() && (GetNet() != 0) )
continue;
item_clearance = track->GetClearance() + (m_ZoneMinThickness / 2);
item_boundingbox = track->GetBoundingBox();
if( item_boundingbox.Intersects( zone_boundingbox ) )
{
AddTrackWithClearancePolygon( booleng, *track, clearance );
AddTrackWithClearancePolygon( booleng, *track, MAX(zone_clearance,item_clearance) );
have_poly_to_substract = true;
}
}
......@@ -1338,13 +1353,13 @@ void AddRoundedEndsSegmentPolygon( Bool_Engine* aBooleng,
int delta = 3600 / s_CircleToSegmentsCount; // rot angle in 0.1 degree
#ifdef CREATE_KBOOL_KEY_FILES
if( s_GenDataForKbool )
StartPolygon(s_CircleToSegmentsCount+4, 1);
#endif
// Compute the outlines of the segment, and creates a polygon
corner = wxPoint( 0, rayon );
RotatePoint( &corner, -delta_angle );
......
......@@ -846,6 +846,7 @@ int BOARD::Test_Drc_Areas_Outlines_To_Areas_Outlines( ZONE_CONTAINER* aArea_To_E
{
wxString str;
long nerrors = 0;
int zone2zoneClearance;
// iterate through all areas
for( int ia = 0; ia < GetAreaCount(); ia++ )
......@@ -856,6 +857,7 @@ int BOARD::Test_Drc_Areas_Outlines_To_Areas_Outlines( ZONE_CONTAINER* aArea_To_E
if( aArea_To_Examine && (aArea_To_Examine != Area_Ref) )
continue;
for( int ia2 = 0; ia2 < GetAreaCount(); ia2++ )
{
ZONE_CONTAINER* Area_To_Test = GetArea( ia2 );
......@@ -871,6 +873,14 @@ int BOARD::Test_Drc_Areas_Outlines_To_Areas_Outlines( ZONE_CONTAINER* aArea_To_E
if( Area_Ref->GetNet() == Area_To_Test->GetNet() && Area_Ref->GetNet() >= 0 )
continue;
/* Examine a candidate zone: compare Area_To_Test to Area_Ref
*/
// Calculate the clearance used in zone to zone test:
zone2zoneClearance = Area_Ref->GetClearance(Area_To_Test);
zone2zoneClearance = MAX( zone2zoneClearance, Area_Ref->m_ZoneClearance );
zone2zoneClearance = MAX( zone2zoneClearance, Area_To_Test->m_ZoneClearance );
// test for some corners of Area_Ref inside Area_To_Test
for( int ic = 0; ic < Area_Ref->m_Poly->GetNumCorners(); ic++ )
{
......@@ -962,12 +972,10 @@ int BOARD::Test_Drc_Areas_Outlines_To_Areas_Outlines( ZONE_CONTAINER* aArea_To_E
ax1, ay1, ax2,
ay2, astyle,
0,
// @todo: decide what to use here.
g_DesignSettings.m_TrackClearance,
zone2zoneClearance,
&x, &y );
if( d < g_DesignSettings.m_TrackClearance )
if( d < zone2zoneClearance )
{
// 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