Commit 92266a19 authored by charras's avatar charras

Pcbnew: Added: in DRC tests: tests for vias min size and tracks min width.

Eeschema: code cleaning
parent eebc4ff2
......@@ -4,6 +4,10 @@ KiCad ChangeLog 2009
Please add newer entries at the top, list the date and your name with
email address.
2009-june-18 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================
++Pcbnew:
Added: in DRC tests: tests for vias min size and tracks min width.
2009-june-11 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================
......@@ -22,7 +26,7 @@ email address.
used for items that have a line thickness = 0,
and NOT the minimum thickness.
reasons:
- Obviously, differents parameters to draw and plot and bad.
- Obviously, differents parameters to draw and plot are bad.
(what you plot is NOT what you see)
- small texts are not readable with an minimum thickness value
that could be good for others items.
......
......@@ -121,7 +121,8 @@ static const char* GetHersheyShapeDescription( int AsciiCode )
}
#endif
AsciiCode &= 0x7F;
if ( AsciiCode > 0x7F )
AsciiCode = '?';
if( AsciiCode < 32 )
AsciiCode = 32; /* Clamp control chars */
AsciiCode -= 32;
......@@ -244,6 +245,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
int overbars; // Number of ~ seen
int overbar_italic_comp; // Italic compensation for overbar
#define BUF_SIZE 100
wxPoint coord[BUF_SIZE + 1]; // Buffer coordinate used to draw polylines (one char shape)
bool sketch_mode = false;
......@@ -329,7 +331,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
break;
case GR_TEXT_VJUSTIFY_TOP:
current_char_pos.y += dy;
current_char_pos.y += dy;
break;
case GR_TEXT_VJUSTIFY_BOTTOM:
......
......@@ -68,6 +68,7 @@ void WinEDA_CvpcbFrame::CreateScreenCmp()
DrawFrame->GetBoard()->m_Modules.PushBack( mod );
DrawFrame->Zoom_Automatique( FALSE );
DrawFrame->UpdateStatusBar(); /* Display new cursor coordinates and zoom value */
if( DrawFrame->m_Draw3DFrame )
DrawFrame->m_Draw3DFrame->NewDisplay();
}
......
......@@ -22,8 +22,9 @@
LibDrawText::LibDrawText() :
LibEDA_BaseStruct( COMPONENT_GRAPHIC_TEXT_DRAW_TYPE ), EDA_TextStruct()
LibDrawText::LibDrawText(EDA_LibComponentStruct * aParent) :
LibEDA_BaseStruct( COMPONENT_GRAPHIC_TEXT_DRAW_TYPE, aParent ),
EDA_TextStruct()
{
m_Size = wxSize( 50, 50 );
m_typeName = _( "Text" );
......@@ -169,7 +170,7 @@ bool LibDrawText::HitTest( wxPoint aPosRef, int aThreshold, const int aTransMat[
LibDrawText* LibDrawText::GenCopy()
{
LibDrawText* newitem = new LibDrawText();
LibDrawText* newitem = new LibDrawText(NULL);
newitem->m_Pos = m_Pos;
newitem->m_Orient = m_Orient;
......
......@@ -162,6 +162,7 @@ LibCmpEntry::LibCmpEntry( LibrEntryType CmpType, const wxChar* CmpName ) :
{
Type = CmpType;
m_Name.m_FieldId = VALUE;
m_Name.SetParent( this );
if( CmpName )
m_Name.m_Text = CmpName;
}
......@@ -220,6 +221,7 @@ EDA_LibComponentStruct:: EDA_LibComponentStruct( const wxChar* CmpName ) :
m_DrawPinNum = 1;
m_DrawPinName = 1;
m_Prefix.m_FieldId = REFERENCE;
m_Prefix.SetParent( this );
}
......@@ -478,32 +480,32 @@ bool EDA_LibComponentStruct::LoadDrawEntries( FILE* f, char* line,
switch( line[0] )
{
case 'A': /* Arc */
newEntry = ( LibEDA_BaseStruct* ) new LibDrawArc();
newEntry = ( LibEDA_BaseStruct* ) new LibDrawArc(this);
entryLoaded = newEntry->Load( line, errorMsg );
break;
case 'C': /* Circle */
newEntry = ( LibEDA_BaseStruct* ) new LibDrawCircle();
newEntry = ( LibEDA_BaseStruct* ) new LibDrawCircle(this);
entryLoaded = newEntry->Load( line, errorMsg );
break;
case 'T': /* Text */
newEntry = ( LibEDA_BaseStruct* ) new LibDrawText();
newEntry = ( LibEDA_BaseStruct* ) new LibDrawText(this);
entryLoaded = newEntry->Load( line, errorMsg );
break;
case 'S': /* Square */
newEntry = ( LibEDA_BaseStruct* ) new LibDrawSquare();
newEntry = ( LibEDA_BaseStruct* ) new LibDrawSquare(this);
entryLoaded = newEntry->Load( line, errorMsg );
break;
case 'X': /* Pin Description */
newEntry = ( LibEDA_BaseStruct* ) new LibDrawPin();
newEntry = ( LibEDA_BaseStruct* ) new LibDrawPin(this);
entryLoaded = newEntry->Load( line, errorMsg );
break;
case 'P': /* Polyline */
newEntry = ( LibEDA_BaseStruct* ) new LibDrawPolyline();
newEntry = ( LibEDA_BaseStruct* ) new LibDrawPolyline(this);
entryLoaded = newEntry->Load( line, errorMsg );
break;
......@@ -568,7 +570,7 @@ bool EDA_LibComponentStruct::LoadAliases( char* line, wxString& errorMsg )
bool EDA_LibComponentStruct::LoadField( char* line, wxString& errorMsg )
{
LibDrawField* field = new LibDrawField();
LibDrawField* field = new LibDrawField(this);
if ( !field->Load( line, errorMsg ) )
{
......@@ -704,7 +706,7 @@ void EDA_LibComponentStruct::SetFields( const std::vector <LibDrawField> aFields
create = TRUE;
if( create )
{
LibDrawField*Field = new LibDrawField( ii );
LibDrawField*Field = new LibDrawField( this, ii );
aFields[ii].Copy( Field );
CurrentLibEntry->m_Fields.PushBack( Field );
}
......@@ -719,6 +721,7 @@ void EDA_LibComponentStruct::SetFields( const std::vector <LibDrawField> aFields
for( LibDrawField* Field = CurrentLibEntry->m_Fields; Field;
Field = Field->Next() )
{
Field->SetParent( this );
if( Field->m_FieldId >= FIELD1 )
{
if( Field->m_Text.IsEmpty() )
......
......@@ -38,13 +38,19 @@
*
* others = free fields
*/
LibDrawField::LibDrawField( int idfield ) :
LibEDA_BaseStruct( COMPONENT_FIELD_DRAW_TYPE )
LibDrawField::LibDrawField(EDA_LibComponentStruct * aParent, int idfield ) :
LibEDA_BaseStruct( COMPONENT_FIELD_DRAW_TYPE, aParent )
{
m_FieldId = idfield;
m_Size.x = m_Size.y = DEFAULT_SIZE_TEXT;
}
LibDrawField::LibDrawField( int idfield ) :
LibEDA_BaseStruct( COMPONENT_FIELD_DRAW_TYPE, NULL )
{
m_FieldId = idfield;
m_Size.x = m_Size.y = DEFAULT_SIZE_TEXT;
}
LibDrawField::~LibDrawField()
{
......@@ -318,6 +324,7 @@ LibDrawField* LibDrawField::GenCopy()
*/
void LibDrawField::Copy( LibDrawField* Target ) const
{
Target->SetParent( m_Parent );
Target->m_Pos = m_Pos;
Target->m_Size = m_Size;
Target->m_Width = m_Width;
......
......@@ -35,6 +35,7 @@ public:
LibDrawField( int idfield = 2 );
LibDrawField( EDA_LibComponentStruct * aParent, int idfield = 2 );
~LibDrawField();
virtual wxString GetClass() const
{
......@@ -96,6 +97,7 @@ public:
m_Bold = field.m_Bold;
m_HJustify = field.m_HJustify;
m_VJustify = field.m_VJustify;
m_Parent = field.m_Parent;
}
};
......
......@@ -30,7 +30,8 @@ const wxChar* MsgPinElectricType[] =
wxT( "?????" )
};
LibDrawPin::LibDrawPin() : LibEDA_BaseStruct( COMPONENT_PIN_DRAW_TYPE )
LibDrawPin::LibDrawPin(EDA_LibComponentStruct * aParent) :
LibEDA_BaseStruct( COMPONENT_PIN_DRAW_TYPE, aParent )
{
m_PinLen = 300; /* default Pin len */
m_Orient = PIN_RIGHT; /* Pin oprient: Up, Down, Left, Right */
......@@ -1005,7 +1006,7 @@ void LibDrawPin::SetPinNumFromString( wxString& buffer )
LibDrawPin* LibDrawPin::GenCopy()
/*************************************/
{
LibDrawPin* newpin = new LibDrawPin();
LibDrawPin* newpin = new LibDrawPin( GetParent() );
newpin->m_Pos = m_Pos;
newpin->m_PinLen = m_PinLen;
......
......@@ -15,13 +15,13 @@
#include "protos.h"
static int fill_tab[3] = { 'N', 'F', 'f' };
static int fill_tab[3] = { 'N', 'F', 'f' };
//#define DRAW_ARC_WITH_ANGLE // Used to draw arcs
/* Base class (abstract) for components bodies items */
LibEDA_BaseStruct::LibEDA_BaseStruct( KICAD_T struct_type ) :
LibEDA_BaseStruct::LibEDA_BaseStruct( KICAD_T struct_type, EDA_LibComponentStruct* aParent ) :
EDA_BaseStruct( struct_type )
{
m_Unit = 0; /* Unit identification (for multi part per package)
......@@ -30,6 +30,7 @@ LibEDA_BaseStruct::LibEDA_BaseStruct( KICAD_T struct_type ) :
* shape) 0 if the item is common to all shapes */
m_Fill = NO_FILL;
m_Parent = aParent;
m_typeName = _( "Undefined" );
}
......@@ -68,12 +69,12 @@ void LibEDA_BaseStruct::DisplayInfo( WinEDA_DrawFrame* frame )
}
/**********************/
/** class LibDrawArc **/
/**********************/
LibDrawArc::LibDrawArc() : LibEDA_BaseStruct( COMPONENT_ARC_DRAW_TYPE )
LibDrawArc::LibDrawArc( EDA_LibComponentStruct* aParent ) :
LibEDA_BaseStruct( COMPONENT_ARC_DRAW_TYPE, aParent )
{
m_Rayon = 0;
t1 = t2 = 0;
......@@ -159,6 +160,7 @@ bool LibDrawArc::Load( char* line, wxString& errorMsg )
return true;
}
/**
* Function HitTest
* tests if the given wxPoint is within the bounds of this object.
......@@ -167,14 +169,16 @@ bool LibDrawArc::Load( char* line, wxString& errorMsg )
*/
bool LibDrawArc::HitTest( const wxPoint& aRefPoint )
{
int mindist = m_Width ? m_Width /2 : g_DrawDefaultLineThickness / 2;
int mindist = m_Width ? m_Width / 2 : g_DrawDefaultLineThickness / 2;
// Have a minimal tolerance for hit test
if ( mindist < 3 )
if( mindist < 3 )
mindist = 3; // = 3 mils
return HitTest( aRefPoint, mindist, DefaultTransformMatrix );
}
/** Function HitTest
* @return true if the point aPosRef is near this object
* @param aRefPoint = a wxPoint to test
......@@ -185,7 +189,8 @@ bool LibDrawArc::HitTest( wxPoint aRefPoint, int aThreshold, const int aTransMat
{
// TODO: use aTransMat to calculmates parameters
wxPoint relpos = aRefPoint;
NEGATE(relpos.y); // reverse Y axis
NEGATE( relpos.y ); // reverse Y axis
relpos -= m_Pos;
int dist = wxRound( sqrt( ( (double) relpos.x * relpos.x ) + ( (double) relpos.y * relpos.y ) ) );
......@@ -195,14 +200,14 @@ bool LibDrawArc::HitTest( wxPoint aRefPoint, int aThreshold, const int aTransMat
// We are on the circle, ensure we are only on the arc, i.e. between m_ArcStart and m_ArcEnd
int astart = t1; // arc starting point ( in 0.1 degree)
int aend = t2; // arc ending point ( in 0.1 degree)
int atest = wxRound( atan2(relpos.y, relpos.x) * 1800.0 / M_PI );
NORMALIZE_ANGLE_180(atest);
NORMALIZE_ANGLE_180(astart);
NORMALIZE_ANGLE_180(aend);
int aend = t2; // arc ending point ( in 0.1 degree)
int atest = wxRound( atan2( relpos.y, relpos.x ) * 1800.0 / M_PI );
NORMALIZE_ANGLE_180( atest );
NORMALIZE_ANGLE_180( astart );
NORMALIZE_ANGLE_180( aend );
if ( astart > aend )
EXCHG(astart, aend);
if( astart > aend )
EXCHG( astart, aend );
if( atest >= astart && atest <= aend )
return true;
......@@ -213,7 +218,7 @@ bool LibDrawArc::HitTest( wxPoint aRefPoint, int aThreshold, const int aTransMat
LibDrawArc* LibDrawArc::GenCopy()
{
LibDrawArc* newitem = new LibDrawArc();
LibDrawArc* newitem = new LibDrawArc( GetParent() );
newitem->m_Pos = m_Pos;
newitem->m_ArcStart = m_ArcStart;
......@@ -383,7 +388,8 @@ void LibDrawArc::DisplayInfo( WinEDA_DrawFrame* frame )
/** class LibDrawCircle **/
/*************************/
LibDrawCircle::LibDrawCircle() : LibEDA_BaseStruct( COMPONENT_CIRCLE_DRAW_TYPE )
LibDrawCircle::LibDrawCircle( EDA_LibComponentStruct* aParent ) :
LibEDA_BaseStruct( COMPONENT_CIRCLE_DRAW_TYPE, aParent )
{
m_Rayon = 0;
m_Fill = NO_FILL;
......@@ -422,6 +428,7 @@ bool LibDrawCircle::Load( char* line, wxString& errorMsg )
return true;
}
/**
* Function HitTest
* tests if the given wxPoint is within the bounds of this object.
......@@ -430,14 +437,16 @@ bool LibDrawCircle::Load( char* line, wxString& errorMsg )
*/
bool LibDrawCircle::HitTest( const wxPoint& aPosRef )
{
int mindist = m_Width ? m_Width /2 : g_DrawDefaultLineThickness / 2;
int mindist = m_Width ? m_Width / 2 : g_DrawDefaultLineThickness / 2;
// Have a minimal tolerance for hit test
if ( mindist < 3 )
if( mindist < 3 )
mindist = 3; // = 3 mils
return HitTest( aPosRef, mindist, DefaultTransformMatrix );
}
/** Function HitTest
* @return true if the point aPosRef is near this object
* @param aPosRef = a wxPoint to test
......@@ -448,7 +457,9 @@ bool LibDrawCircle::HitTest( wxPoint aPosRef, int aThreshold, const int aTransMa
{
wxPoint relpos = aPosRef - TransformCoordinate( aTransMat, m_Pos );
int dist = wxRound( sqrt( ( (double) relpos.x * relpos.x ) + ( (double) relpos.y * relpos.y ) ) );
int dist =
wxRound( sqrt( ( (double) relpos.x * relpos.x ) + ( (double) relpos.y * relpos.y ) ) );
if( abs( dist - m_Rayon ) <= aThreshold )
return true;
return false;
......@@ -457,7 +468,7 @@ bool LibDrawCircle::HitTest( wxPoint aPosRef, int aThreshold, const int aTransMa
LibDrawCircle* LibDrawCircle::GenCopy()
{
LibDrawCircle* newitem = new LibDrawCircle();
LibDrawCircle* newitem = new LibDrawCircle( GetParent() );
newitem->m_Pos = m_Pos;
newitem->m_Rayon = m_Rayon;
......@@ -542,12 +553,12 @@ void LibDrawCircle::DisplayInfo( WinEDA_DrawFrame* frame )
}
/*************************/
/** class LibDrawSquare **/
/*************************/
LibDrawSquare::LibDrawSquare() : LibEDA_BaseStruct( COMPONENT_RECT_DRAW_TYPE )
LibDrawSquare::LibDrawSquare( EDA_LibComponentStruct* aParent ) :
LibEDA_BaseStruct( COMPONENT_RECT_DRAW_TYPE, aParent )
{
m_Width = 0;
m_Fill = NO_FILL;
......@@ -590,7 +601,7 @@ bool LibDrawSquare::Load( char* line, wxString& errorMsg )
LibDrawSquare* LibDrawSquare::GenCopy()
{
LibDrawSquare* newitem = new LibDrawSquare();
LibDrawSquare* newitem = new LibDrawSquare( GetParent() );
newitem->m_Pos = m_Pos;
newitem->m_End = m_End;
......@@ -663,6 +674,7 @@ EDA_Rect LibDrawSquare::GetBoundingBox()
return rect;
}
/**
* Function HitTest
* tests if the given wxPoint is within the bounds of this object.
......@@ -671,15 +683,16 @@ EDA_Rect LibDrawSquare::GetBoundingBox()
*/
bool LibDrawSquare::HitTest( const wxPoint& aRefPoint )
{
int mindist = (m_Width ? m_Width / 2 : g_DrawDefaultLineThickness / 2) + 1;
int mindist = (m_Width ? m_Width /2 : g_DrawDefaultLineThickness / 2) + 1;
// Have a minimal tolerance for hit test
if ( mindist < 3 )
if( mindist < 3 )
mindist = 3; // = 3 mils
return HitTest( aRefPoint, mindist, DefaultTransformMatrix );
}
/** Function HitTest
* @return true if the point aPosRef is near this object
* @param aRefPoint = a wxPoint to test
......@@ -688,14 +701,15 @@ bool LibDrawSquare::HitTest( const wxPoint& aRefPoint )
*/
bool LibDrawSquare::HitTest( wxPoint aRefPoint, int aThreshold, const int aTransMat[2][2] )
{
wxPoint actualStart = TransformCoordinate( aTransMat, m_Pos);
wxPoint actualEnd = TransformCoordinate( aTransMat, m_End);
wxPoint actualStart = TransformCoordinate( aTransMat, m_Pos );
wxPoint actualEnd = TransformCoordinate( aTransMat, m_End );
// locate lower segment
wxPoint start, end;
start = actualStart;
end.x = actualEnd.x;
end.y = actualStart.y;
end.x = actualEnd.x;
end.y = actualStart.y;
if( TestSegmentHit( aRefPoint, start, end, aThreshold ) )
return true;
......@@ -720,10 +734,12 @@ bool LibDrawSquare::HitTest( wxPoint aRefPoint, int aThreshold, const int aTrans
return false;
}
/**************************/
/** class LibDrawSegment **/
/**************************/
LibDrawSegment::LibDrawSegment() : LibEDA_BaseStruct( COMPONENT_LINE_DRAW_TYPE )
LibDrawSegment::LibDrawSegment( EDA_LibComponentStruct* aParent ) :
LibEDA_BaseStruct( COMPONENT_LINE_DRAW_TYPE, aParent )
{
m_Width = 0;
m_typeName = _( "Segment" );
......@@ -746,7 +762,7 @@ bool LibDrawSegment::Load( char* line, wxString& errorMsg )
LibDrawSegment* LibDrawSegment::GenCopy()
{
LibDrawSegment* newitem = new LibDrawSegment();
LibDrawSegment* newitem = new LibDrawSegment( GetParent() );
newitem->m_Pos = m_Pos;
newitem->m_End = m_End;
......@@ -801,7 +817,8 @@ void LibDrawSegment::DisplayInfo( WinEDA_DrawFrame* frame )
frame->MsgPanel->Affiche_1_Parametre( 60, _( "Bounding box" ), msg, BROWN );
}
/**
/**
* Function HitTest
* tests if the given wxPoint is within the bounds of this object.
* @param aRefPos A wxPoint to test
......@@ -809,14 +826,16 @@ void LibDrawSegment::DisplayInfo( WinEDA_DrawFrame* frame )
*/
bool LibDrawSegment::HitTest( const wxPoint& aPosRef )
{
int mindist = m_Width ? m_Width /2 : g_DrawDefaultLineThickness / 2;
int mindist = m_Width ? m_Width / 2 : g_DrawDefaultLineThickness / 2;
// Have a minimal tolerance for hit test
if ( mindist < 3 )
if( mindist < 3 )
mindist = 3; // = 3 mils
return HitTest( aPosRef, mindist, DefaultTransformMatrix );
}
/** Function HitTest
* @return true if the point aPosRef is near this object
* @param aPosRef = a wxPoint to test
......@@ -826,7 +845,7 @@ bool LibDrawSegment::HitTest( const wxPoint& aPosRef )
bool LibDrawSegment::HitTest( wxPoint aPosRef, int aThreshold, const int aTransMat[2][2] )
{
wxPoint start = TransformCoordinate( aTransMat, m_Pos );
wxPoint end = TransformCoordinate( aTransMat, m_End );
wxPoint end = TransformCoordinate( aTransMat, m_End );
return TestSegmentHit( aPosRef, start, end, aThreshold );
}
......@@ -835,8 +854,8 @@ bool LibDrawSegment::HitTest( wxPoint aPosRef, int aThreshold, const int aTransM
/***************************/
/** class LibDrawPolyline **/
/***************************/
LibDrawPolyline::LibDrawPolyline() :
LibEDA_BaseStruct( COMPONENT_POLYLINE_DRAW_TYPE )
LibDrawPolyline::LibDrawPolyline( EDA_LibComponentStruct* aParent ) :
LibEDA_BaseStruct( COMPONENT_POLYLINE_DRAW_TYPE, aParent )
{
m_Fill = NO_FILL;
m_Width = 0;
......@@ -923,7 +942,7 @@ bool LibDrawPolyline::Load( char* line, wxString& errorMsg )
LibDrawPolyline* LibDrawPolyline::GenCopy()
{
LibDrawPolyline* newitem = new LibDrawPolyline();
LibDrawPolyline* newitem = new LibDrawPolyline( GetParent() );
newitem->m_PolyPoints = m_PolyPoints; // Vector copy
newitem->m_Width = m_Width;
......@@ -1008,13 +1027,15 @@ void LibDrawPolyline::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
*/
bool LibDrawPolyline::HitTest( const wxPoint& aRefPos )
{
int mindist = m_Width ? m_Width /2 : g_DrawDefaultLineThickness / 2;
int mindist = m_Width ? m_Width / 2 : g_DrawDefaultLineThickness / 2;
// Have a minimal tolerance for hit test
if ( mindist < 3 )
if( mindist < 3 )
mindist = 3; // = 3 mils
return HitTest( aRefPos, mindist, DefaultTransformMatrix );
}
/** Function HitTest
* @return true if the point aPosRef is near a segment
* @param aPosRef = a wxPoint to test
......@@ -1031,7 +1052,7 @@ bool LibDrawPolyline::HitTest( wxPoint aPosRef, int aThreshold,
start = TransformCoordinate( aTransMat, m_PolyPoints[ii - 1] );
end = TransformCoordinate( aTransMat, m_PolyPoints[ii] );
if ( TestSegmentHit( aPosRef, start, end, aThreshold ) )
if( TestSegmentHit( aPosRef, start, end, aThreshold ) )
return true;
}
......
......@@ -133,7 +133,7 @@ public:
}
LibEDA_BaseStruct( KICAD_T struct_type );
LibEDA_BaseStruct( KICAD_T struct_type, EDA_LibComponentStruct * aParent );
virtual ~LibEDA_BaseStruct() { }
/** Function Draw (virtual pure)
......@@ -166,6 +166,10 @@ public:
virtual bool Save( FILE* aFile ) const = 0;
virtual bool Load( char* line, wxString& errorMsg ) = 0;
EDA_LibComponentStruct * GetParent()
{
return (EDA_LibComponentStruct *)m_Parent;
}
/**
* Function HitTest
......@@ -226,7 +230,7 @@ wxPoint m_Pos; /* Position or centre (Arc and Circle) or start
int m_Width; /* Line width */
public:
LibDrawPin();
LibDrawPin(EDA_LibComponentStruct * aParent);
~LibDrawPin() { }
LibDrawPin* Next() const { return (LibDrawPin*) Pnext; }
......@@ -311,7 +315,7 @@ public:
int m_Width; /* Line width */
public:
LibDrawArc();
LibDrawArc(EDA_LibComponentStruct * aParent);
~LibDrawArc() { }
virtual wxString GetClass() const
{
......@@ -368,7 +372,7 @@ public:
int m_Width; /* Line width */
public:
LibDrawCircle();
LibDrawCircle(EDA_LibComponentStruct * aParent);
~LibDrawCircle() { }
virtual wxString GetClass() const
{
......@@ -422,7 +426,7 @@ public:
class LibDrawText : public LibEDA_BaseStruct, public EDA_TextStruct
{
public:
LibDrawText();
LibDrawText(EDA_LibComponentStruct * aParent);
~LibDrawText() { }
virtual wxString GetClass() const
{
......@@ -489,7 +493,7 @@ public:
int m_Width; /* Line width */
public:
LibDrawSquare();
LibDrawSquare(EDA_LibComponentStruct * aParent);
~LibDrawSquare() { }
virtual wxString GetClass() const
{
......@@ -545,7 +549,7 @@ public:
int m_Width; /* Line width */
public:
LibDrawSegment();
LibDrawSegment(EDA_LibComponentStruct * aParent);
~LibDrawSegment() { }
virtual wxString GetClass() const
{
......@@ -599,7 +603,7 @@ public:
std::vector<wxPoint> m_PolyPoints; // list of points (>= 2)
public:
LibDrawPolyline();
LibDrawPolyline(EDA_LibComponentStruct * aParent);
~LibDrawPolyline() { }
virtual wxString GetClass() const
......
......@@ -42,13 +42,12 @@ void CreateDummyCmp()
{
DummyCmp = new EDA_LibComponentStruct( NULL );
LibDrawSquare* Square = new LibDrawSquare();
LibDrawSquare* Square = new LibDrawSquare(DummyCmp);
Square->m_Pos = wxPoint( -200, 200 );
Square->m_End = wxPoint( 200, -200 );
Square->m_Width = 4;
LibDrawText* Text = new LibDrawText();
LibDrawText* Text = new LibDrawText(DummyCmp);
Text->m_Size.x = Text->m_Size.y = 150;
Text->m_Text = wxT( "??" );
......
......@@ -17,7 +17,7 @@
#include "protos.h"
/* Local Functions */
static LibEDA_BaseStruct* GetDrawEntry( WinEDA_DrawFrame* frame, FILE* f,
static LibEDA_BaseStruct* ReadDrawEntryItemDescription( EDA_LibComponentStruct* aParent, FILE* f,
char* Line, int* LineNum );
static bool AddAliasNames( EDA_LibComponentStruct* LibEntry, char* line );
static void InsertAlias( PriorQue** PQ, EDA_LibComponentStruct* LibEntry,
......@@ -493,7 +493,7 @@ EDA_LibComponentStruct* Read_Component_Definition( WinEDA_DrawFrame* frame,
}
else if( strcmp( p, "DRAW" ) == 0 )
{
LibEntry->m_Drawings = GetDrawEntry( frame, f, Line, LineNum );
LibEntry->m_Drawings = ReadDrawEntryItemDescription( LibEntry, f, Line, LineNum );
}
else if( strncmp( p, "ALIAS", 5 ) == 0 )
{
......@@ -538,7 +538,7 @@ EDA_LibComponentStruct* Read_Component_Definition( WinEDA_DrawFrame* frame,
* been read already. Reads upto and include ENDDRAW, or an error (NULL ret). *
*****************************************************************************/
static LibEDA_BaseStruct* GetDrawEntry (WinEDA_DrawFrame* frame, FILE* f,
static LibEDA_BaseStruct* ReadDrawEntryItemDescription (EDA_LibComponentStruct* aParent, FILE* f,
char* Line, int* LineNum)
{
wxString MsgLine, errorMsg;
......@@ -551,7 +551,7 @@ static LibEDA_BaseStruct* GetDrawEntry (WinEDA_DrawFrame* frame, FILE* f,
{
if( GetLine( f, Line, LineNum, 1024 ) == NULL )
{
DisplayError( frame, wxT( "File ended prematurely" ) );
DisplayError( NULL, wxT( "File ended prematurely" ) );
return Head;
}
......@@ -565,39 +565,39 @@ static LibEDA_BaseStruct* GetDrawEntry (WinEDA_DrawFrame* frame, FILE* f,
switch( Line[0] )
{
case 'A': /* Arc */
New = ( LibEDA_BaseStruct* ) new LibDrawArc();
New = ( LibEDA_BaseStruct* ) new LibDrawArc(aParent);
entryLoaded = New->Load( Line, errorMsg );
break;
case 'C': /* Circle */
New = ( LibEDA_BaseStruct* ) new LibDrawCircle();
New = ( LibEDA_BaseStruct* ) new LibDrawCircle(aParent);
entryLoaded = New->Load( Line, errorMsg );
break;
case 'T': /* Text */
New = ( LibEDA_BaseStruct* ) new LibDrawText();
New = ( LibEDA_BaseStruct* ) new LibDrawText(aParent);
entryLoaded = New->Load( Line, errorMsg );
break;
case 'S': /* Square */
New = ( LibEDA_BaseStruct* ) new LibDrawSquare();
New = ( LibEDA_BaseStruct* ) new LibDrawSquare(aParent);
entryLoaded = New->Load( Line, errorMsg );
break;
case 'X': /* Pin Description */
New = ( LibEDA_BaseStruct* ) new LibDrawPin();
New = ( LibEDA_BaseStruct* ) new LibDrawPin(aParent);
entryLoaded = New->Load( Line, errorMsg );
break;
case 'P': /* Polyline */
New = ( LibEDA_BaseStruct* ) new LibDrawPolyline();
New = ( LibEDA_BaseStruct* ) new LibDrawPolyline(aParent);
entryLoaded = New->Load( Line, errorMsg );
break;
default:
MsgLine.Printf( wxT( "Undefined DRAW command in line %d\n%s, aborted." ),
*LineNum, Line );
DisplayError( frame, MsgLine );
DisplayError( NULL, MsgLine );
return Head;
}
......@@ -606,7 +606,7 @@ static LibEDA_BaseStruct* GetDrawEntry (WinEDA_DrawFrame* frame, FILE* f,
MsgLine.Printf( wxT( "Error <%s %s> in DRAW command %c in line %d, aborted." ),
errorMsg.c_str(), MsgLine.c_str(),
Line[0], *LineNum );
DisplayError( frame, MsgLine );
DisplayError( NULL, MsgLine );
SAFE_DELETE( New );
/* FLush till end of draw: */
......@@ -614,7 +614,7 @@ static LibEDA_BaseStruct* GetDrawEntry (WinEDA_DrawFrame* frame, FILE* f,
{
if( GetLine( f, Line, LineNum, 1024 ) == NULL )
{
DisplayError( frame, wxT( "File ended prematurely" ) );
DisplayError( NULL, wxT( "File ended prematurely" ) );
return Head;
}
} while( strncmp( Line, "ENDDRAW", 7 ) != 0 );
......
......@@ -111,7 +111,7 @@ void WinEDA_LibeditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
case ID_LIBEDIT_BODY_TEXT_BUTT:
if( CurrentDrawItem == NULL || CurrentDrawItem->m_Flags == 0 )
{
CurrentDrawItem = CreateGraphicItem( DC );
CurrentDrawItem = CreateGraphicItem( CurrentLibEntry, DC );
}
else if( CurrentDrawItem )
{
......
......@@ -376,10 +376,7 @@ LibDrawField* WinEDA_LibeditFrame::LocateField( EDA_LibComponentStruct* LibEntry
* pointer on the field (or NULL )
*/
{
wxPoint refpos;
refpos.x = GetScreen()->m_Curseur.x;
refpos.y = GetScreen()->m_Curseur.y; // Y axis is from bottom to top in library
wxPoint refpos = GetScreen()->m_Curseur;
/* Test reference */
if( LibEntry->m_Name.HitTest( refpos ) )
return &LibEntry->m_Name;
......@@ -388,7 +385,7 @@ LibDrawField* WinEDA_LibeditFrame::LocateField( EDA_LibComponentStruct* LibEntry
if( LibEntry->m_Prefix.HitTest( refpos ) )
return &LibEntry->m_Prefix;
/* Localisation des autres fields */
/* Test others fields */
for( LibDrawField* field = LibEntry->m_Fields; field; field = field->Next() )
{
if( field->m_Text.IsEmpty() )
......
......@@ -553,7 +553,7 @@ void WinEDA_LibeditFrame::CreatePin( wxDC* DC )
for( ; DrawItem != NULL; DrawItem = DrawItem->Next() )
DrawItem->m_Flags = 0;
CurrentPin = new LibDrawPin();
CurrentPin = new LibDrawPin(CurrentLibEntry);
CurrentDrawItem = CurrentPin;
if( CurrentPin == NULL )
......
......@@ -38,8 +38,7 @@ static FILL_T FlSymbol_Fill = NO_FILL;
/************************************************************/
void WinEDA_bodygraphics_PropertiesFrame::
bodygraphics_PropertiesAccept( wxCommandEvent& event )
void WinEDA_bodygraphics_PropertiesFrame::bodygraphics_PropertiesAccept( wxCommandEvent& event )
/************************************************************/
/* Update the current draw item
......@@ -98,7 +97,7 @@ bodygraphics_PropertiesAccept( wxCommandEvent& event )
m_GraphicShapeWidthCtrl->GetValue();
break;
case COMPONENT_POLYLINE_DRAW_TYPE:
case COMPONENT_POLYLINE_DRAW_TYPE:
( (LibDrawPolyline*) CurrentDrawItem )->m_Fill =
FlSymbol_Fill;
( (LibDrawPolyline*) CurrentDrawItem )->m_Width =
......@@ -184,18 +183,15 @@ static void AbortSymbolTraceOn( WinEDA_DrawPanel* Panel, wxDC* DC )
}
/*********************************************************************/
LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC )
/*********************************************************************/
/*******************************************************************************************/
LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( EDA_LibComponentStruct* LibEntry,
wxDC* DC )
/*******************************************************************************************/
/* Routine de creation d'un nouvel element type LibraryDrawStruct
* POLYLINE
* ARC
* PAD_CIRCLE
* PAD_RECTANGLE
*/
{
int DrawType;
int DrawType;
DrawPanel->m_IgnoreMouseEvents = TRUE;
......@@ -223,7 +219,7 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC )
break;
default:
DisplayError( this, wxT( "SymbolBeginDrawItem Internal err: Id error" ) );
DisplayError( this, wxT( "WinEDA_LibeditFrame::CreateGraphicItem() error" ) );
return NULL;
}
......@@ -234,7 +230,7 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC )
{
case COMPONENT_ARC_DRAW_TYPE:
{
LibDrawArc* Arc = new LibDrawArc();
LibDrawArc* Arc = new LibDrawArc( LibEntry );
CurrentDrawItem = Arc;
ArcStartX = ArcEndX = GetScreen()->m_Curseur.x;
......@@ -247,11 +243,11 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC )
case COMPONENT_CIRCLE_DRAW_TYPE:
{
LibDrawCircle* Circle = new LibDrawCircle();
LibDrawCircle* Circle = new LibDrawCircle( LibEntry );
CurrentDrawItem = Circle;
Circle->m_Pos.x = GetScreen()->m_Curseur.x;
Circle->m_Pos.y = -( GetScreen()->m_Curseur.y );
Circle->m_Pos = GetScreen()->m_Curseur;
NEGATE( Circle->m_Pos.y );
Circle->m_Fill = FlSymbol_Fill;
Circle->m_Width = g_LibSymbolDefaultLineWidth;
}
......@@ -259,11 +255,11 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC )
case COMPONENT_RECT_DRAW_TYPE:
{
LibDrawSquare* Square = new LibDrawSquare();
LibDrawSquare* Square = new LibDrawSquare( LibEntry );
CurrentDrawItem = Square;
Square->m_Pos.x = GetScreen()->m_Curseur.x;
Square->m_Pos.y = -( GetScreen()->m_Curseur.y );
Square->m_Pos = GetScreen()->m_Curseur;
NEGATE( Square->m_Pos.y );
Square->m_End = Square->m_Pos;
Square->m_Fill = FlSymbol_Fill;
Square->m_Width = g_LibSymbolDefaultLineWidth;
......@@ -272,9 +268,9 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC )
case COMPONENT_POLYLINE_DRAW_TYPE:
{
LibDrawPolyline* polyline = new LibDrawPolyline();
LibDrawPolyline* polyline = new LibDrawPolyline( LibEntry );
CurrentDrawItem = polyline;
wxPoint point = GetScreen()->m_Curseur;
wxPoint point = GetScreen()->m_Curseur;
NEGATE( point.y );
polyline->AddPoint( point ); // Start point of the current segment
polyline->AddPoint( point ); // End point of the current segment
......@@ -285,11 +281,11 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC )
case COMPONENT_LINE_DRAW_TYPE:
{
LibDrawSegment* Segment = new LibDrawSegment();
LibDrawSegment* Segment = new LibDrawSegment( LibEntry );
CurrentDrawItem = Segment;
Segment->m_Pos.x = GetScreen()->m_Curseur.x;
Segment->m_Pos.y = -( GetScreen()->m_Curseur.y );
CurrentDrawItem = Segment;
Segment->m_Pos = GetScreen()->m_Curseur;
NEGATE( Segment->m_Pos.y );
Segment->m_End = Segment->m_Pos;
Segment->m_Width = g_LibSymbolDefaultLineWidth;
}
......@@ -297,13 +293,13 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC )
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE:
{
LibDrawText* Text = new LibDrawText();
LibDrawText* Text = new LibDrawText( LibEntry );
CurrentDrawItem = Text;
Text->m_Size.x = Text->m_Size.y = g_LastTextSize;
Text->m_Orient = g_LastTextOrient;
Text->m_Pos.x = GetScreen()->m_Curseur.x;
Text->m_Pos.y = -( GetScreen()->m_Curseur.y );
Text->m_Pos = GetScreen()->m_Curseur;
NEGATE( Text->m_Pos.y );
EditSymbolText( NULL, Text );
if( Text->m_Text.IsEmpty() )
{
......@@ -375,7 +371,7 @@ void WinEDA_LibeditFrame::GraphicItemBeginDraw( wxDC* DC )
case COMPONENT_POLYLINE_DRAW_TYPE:
{
wxPoint pos = GetScreen()->m_Curseur;
NEGATE(pos.y);
NEGATE( pos.y );
( (LibDrawPolyline*) CurrentDrawItem )->AddPoint( pos );
}
break;
......@@ -421,7 +417,7 @@ static void RedrawWhileMovingCursor( WinEDA_DrawPanel* panel,
void MoveLibDrawItemAt( LibEDA_BaseStruct* DrawItem, wxPoint newpos )
/*****************************************************************/
{
NEGATE(newpos.y);
NEGATE( newpos.y );
wxPoint size;
switch( DrawItem->Type() )
......@@ -440,16 +436,17 @@ void MoveLibDrawItemAt( LibEDA_BaseStruct* DrawItem, wxPoint newpos )
break;
case COMPONENT_RECT_DRAW_TYPE:
size = ( (LibDrawSquare*) CurrentDrawItem )->m_End - ( (LibDrawSquare*) CurrentDrawItem )->m_Pos;
size = ( (LibDrawSquare*) CurrentDrawItem )->m_End -
( (LibDrawSquare*) CurrentDrawItem )->m_Pos;
( (LibDrawSquare*) CurrentDrawItem )->m_Pos = newpos;
( (LibDrawSquare*) CurrentDrawItem )->m_End = newpos + size;
break;
case COMPONENT_POLYLINE_DRAW_TYPE:
{
int ii, imax = ( (LibDrawPolyline*) CurrentDrawItem )->GetCornerCount();
int ii, imax = ( (LibDrawPolyline*) CurrentDrawItem )->GetCornerCount();
wxPoint offset = newpos - ( (LibDrawPolyline*) CurrentDrawItem )->m_PolyPoints[0];
for( ii = 0; ii < imax; ii ++ )
for( ii = 0; ii < imax; ii++ )
( (LibDrawPolyline*) CurrentDrawItem )->m_PolyPoints[ii] += offset;
}
break;
......@@ -523,10 +520,10 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
{
int DrawMode = g_XorMode;
int dx, dy;
BASE_SCREEN* Screen = panel->GetScreen();
wxPoint curr_pos = Screen->m_Curseur;
BASE_SCREEN* Screen = panel->GetScreen();
wxPoint curr_pos = Screen->m_Curseur;
NEGATE(curr_pos.y);
NEGATE( curr_pos.y );
GRSetDrawMode( DC, DrawMode );
......@@ -587,8 +584,8 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
break;
case COMPONENT_RECT_DRAW_TYPE:
( (LibDrawSquare*) CurrentDrawItem )->m_End = curr_pos;
( (LibDrawSquare*) CurrentDrawItem )->m_Fill = FlSymbol_Fill;
( (LibDrawSquare*) CurrentDrawItem )->m_End = curr_pos;
( (LibDrawSquare*) CurrentDrawItem )->m_Fill = FlSymbol_Fill;
break;
case COMPONENT_POLYLINE_DRAW_TYPE:
......@@ -597,7 +594,7 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
( (LibDrawPolyline*) CurrentDrawItem )->m_PolyPoints[idx] = curr_pos;
( (LibDrawPolyline*) CurrentDrawItem )->m_Fill = FlSymbol_Fill;
}
break;
break;
case COMPONENT_LINE_DRAW_TYPE:
( (LibDrawSegment*) CurrentDrawItem )->m_End = curr_pos;
......@@ -837,11 +834,11 @@ void WinEDA_LibeditFrame::DeleteDrawPoly( wxDC* DC )
DrawLibraryDrawStruct( DrawPanel, DC, CurrentLibEntry, wxPoint( 0, 0 ),
CurrentDrawItem, g_XorMode );
while ( Poly->GetCornerCount() > 2 ) // First segment is kept, only its end point is changed
while( Poly->GetCornerCount() > 2 ) // First segment is kept, only its end point is changed
{
Poly->m_PolyPoints.pop_back();
unsigned idx = Poly->GetCornerCount() - 1;
wxPoint point = GetScreen()->m_Curseur;
unsigned idx = Poly->GetCornerCount() - 1;
wxPoint point = GetScreen()->m_Curseur;
NEGATE( point.y );
if( Poly->m_PolyPoints[idx] != point )
{
......
......@@ -28,35 +28,35 @@
* et mises en chaine "DELETED" */
#define NO_TRACE (1 << 7) /* l'element ne doit pas etre affiche */
#define SURBRILL (1 << 5) /* element en surbrillance */
#define DRAG (1 << 4) /* segment en mode drag */
#define EDIT (1 << 3) /* element en cours d'edition */
#define SEGM_FIXE (1 << 2) /* segment FIXE ( pas d'effacement global ) */
#define SEGM_AR (1 << 1) /* segment Auto_Route */
#define CHAIN (1 << 0) /* segment marque */
#define SURBRILL (1 << 5) /* element en surbrillance */
#define DRAG (1 << 4) /* segment en mode drag */
#define EDIT (1 << 3) /* element en cours d'edition */
#define SEGM_FIXE (1 << 2) /* segment FIXE ( pas d'effacement global ) */
#define SEGM_AR (1 << 1) /* segment Auto_Route */
#define CHAIN (1 << 0) /* segment marque */
/* Layer identification (layer number) */
#define FIRST_COPPER_LAYER 0
#define COPPER_LAYER_N 0
#define LAYER_N_2 1 /* Numero layer 2 */
#define LAYER_N_3 2 /* Numero layer 3 */
#define LAYER_N_4 3 /* Numero layer 4 */
#define LAYER_N_5 4 /* Numero layer 5 */
#define LAYER_N_6 5 /* Numero layer 6 */
#define LAYER_N_7 6 /* Numero layer 7 */
#define LAYER_N_8 7 /* Numero layer 8 */
#define LAYER_N_9 8 /* Numero layer 9 */
#define LAYER_N_10 9 /* Numero layer 10 */
#define LAYER_N_11 10 /* Numero layer 11 */
#define LAYER_N_12 11 /* Numero layer 12 */
#define LAYER_N_13 12 /* Numero layer 13 */
#define LAYER_N_14 13 /* Numero layer 14 */
#define LAYER_N_15 14 /* Numero layer 15 */
#define LAYER_CMP_N 15
#define CMP_N 15
#define LAST_COPPER_LAYER 15
#define NB_COPPER_LAYERS (LAST_COPPER_LAYER + 1)
#define FIRST_COPPER_LAYER 0
#define COPPER_LAYER_N 0
#define LAYER_N_2 1 /* Numero layer 2 */
#define LAYER_N_3 2 /* Numero layer 3 */
#define LAYER_N_4 3 /* Numero layer 4 */
#define LAYER_N_5 4 /* Numero layer 5 */
#define LAYER_N_6 5 /* Numero layer 6 */
#define LAYER_N_7 6 /* Numero layer 7 */
#define LAYER_N_8 7 /* Numero layer 8 */
#define LAYER_N_9 8 /* Numero layer 9 */
#define LAYER_N_10 9 /* Numero layer 10 */
#define LAYER_N_11 10 /* Numero layer 11 */
#define LAYER_N_12 11 /* Numero layer 12 */
#define LAYER_N_13 12 /* Numero layer 13 */
#define LAYER_N_14 13 /* Numero layer 14 */
#define LAYER_N_15 14 /* Numero layer 15 */
#define LAYER_CMP_N 15
#define CMP_N 15
#define LAST_COPPER_LAYER 15
#define NB_COPPER_LAYERS (LAST_COPPER_LAYER + 1)
#define FIRST_NO_COPPER_LAYER 16
#define ADHESIVE_N_CU 16
......@@ -75,52 +75,52 @@
#define LAST_NO_COPPER_LAYER 28
#define NB_LAYERS (LAST_NO_COPPER_LAYER + 1)
#define LAYER_COUNT 32
#define LAYER_COUNT 32
/*************************************/
/* constantes de gestion des couches */
/*************************************/
#define CUIVRE_LAYER (1 << COPPER_LAYER_N) ///< bit mask for copper layer
#define LAYER_2 (1 << LAYER_N_2) ///< bit mask for layer 2
#define LAYER_3 (1 << LAYER_N_3) ///< bit mask for layer 3
#define LAYER_4 (1 << LAYER_N_4) ///< bit mask for layer 4
#define LAYER_5 (1 << LAYER_N_5) ///< bit mask for layer 5
#define LAYER_6 (1 << LAYER_N_6) ///< bit mask for layer 6
#define LAYER_7 (1 << LAYER_N_7) ///< bit mask for layer 7
#define LAYER_8 (1 << LAYER_N_8) ///< bit mask for layer 8
#define LAYER_9 (1 << LAYER_N_9) ///< bit mask for layer 9
#define LAYER_10 (1 << LAYER_N_10) ///< bit mask for layer 10
#define LAYER_11 (1 << LAYER_N_11) ///< bit mask for layer 11
#define LAYER_12 (1 << LAYER_N_12) ///< bit mask for layer 12
#define LAYER_13 (1 << LAYER_N_13) ///< bit mask for layer 13
#define LAYER_14 (1 << LAYER_N_14) ///< bit mask for layer 14
#define LAYER_15 (1 << LAYER_N_15) ///< bit mask for layer 15
#define CMP_LAYER (1 << LAYER_CMP_N) ///< bit mask for component layer
#define ADHESIVE_LAYER_CU (1 << ADHESIVE_N_CU)
#define ADHESIVE_LAYER_CMP (1 << ADHESIVE_N_CMP)
#define SOLDERPASTE_LAYER_CU (1 << SOLDERPASTE_N_CU)
#define SOLDERPASTE_LAYER_CMP (1 << SOLDERPASTE_N_CMP)
#define SILKSCREEN_LAYER_CU (1 << SILKSCREEN_N_CU)
#define SILKSCREEN_LAYER_CMP (1 << SILKSCREEN_N_CMP)
#define SOLDERMASK_LAYER_CU (1 << SOLDERMASK_N_CU)
#define SOLDERMASK_LAYER_CMP (1 << SOLDERMASK_N_CMP)
#define DRAW_LAYER (1 << DRAW_N)
#define COMMENT_LAYER (1 << COMMENT_N)
#define ECO1_LAYER (1 << ECO1_N)
#define ECO2_LAYER (1 << ECO2_N)
#define EDGE_LAYER (1 << EDGE_N)
#define FIRST_NON_COPPER_LAYER ADHESIVE_N_CU
#define CUIVRE_LAYER (1 << COPPER_LAYER_N) ///< bit mask for copper layer
#define LAYER_2 (1 << LAYER_N_2) ///< bit mask for layer 2
#define LAYER_3 (1 << LAYER_N_3) ///< bit mask for layer 3
#define LAYER_4 (1 << LAYER_N_4) ///< bit mask for layer 4
#define LAYER_5 (1 << LAYER_N_5) ///< bit mask for layer 5
#define LAYER_6 (1 << LAYER_N_6) ///< bit mask for layer 6
#define LAYER_7 (1 << LAYER_N_7) ///< bit mask for layer 7
#define LAYER_8 (1 << LAYER_N_8) ///< bit mask for layer 8
#define LAYER_9 (1 << LAYER_N_9) ///< bit mask for layer 9
#define LAYER_10 (1 << LAYER_N_10) ///< bit mask for layer 10
#define LAYER_11 (1 << LAYER_N_11) ///< bit mask for layer 11
#define LAYER_12 (1 << LAYER_N_12) ///< bit mask for layer 12
#define LAYER_13 (1 << LAYER_N_13) ///< bit mask for layer 13
#define LAYER_14 (1 << LAYER_N_14) ///< bit mask for layer 14
#define LAYER_15 (1 << LAYER_N_15) ///< bit mask for layer 15
#define CMP_LAYER (1 << LAYER_CMP_N) ///< bit mask for component layer
#define ADHESIVE_LAYER_CU (1 << ADHESIVE_N_CU)
#define ADHESIVE_LAYER_CMP (1 << ADHESIVE_N_CMP)
#define SOLDERPASTE_LAYER_CU (1 << SOLDERPASTE_N_CU)
#define SOLDERPASTE_LAYER_CMP (1 << SOLDERPASTE_N_CMP)
#define SILKSCREEN_LAYER_CU (1 << SILKSCREEN_N_CU)
#define SILKSCREEN_LAYER_CMP (1 << SILKSCREEN_N_CMP)
#define SOLDERMASK_LAYER_CU (1 << SOLDERMASK_N_CU)
#define SOLDERMASK_LAYER_CMP (1 << SOLDERMASK_N_CMP)
#define DRAW_LAYER (1 << DRAW_N)
#define COMMENT_LAYER (1 << COMMENT_N)
#define ECO1_LAYER (1 << ECO1_N)
#define ECO2_LAYER (1 << ECO2_N)
#define EDGE_LAYER (1 << EDGE_N)
#define FIRST_NON_COPPER_LAYER ADHESIVE_N_CU
#define LAST_NON_COPPER_LAYER EDGE_N
// extra bits 0xE0000000
/* masques generaux : */
#define ALL_LAYERS 0x1FFFFFFF
#define ALL_NO_CU_LAYERS 0x1FFF0000
#define ALL_CU_LAYERS 0x0000FFFF
#define INTERNAL_LAYERS 0x00007FFE /* Bits layers internes */
#define EXTERNAL_LAYERS 0x00008001
#define ALL_LAYERS 0x1FFFFFFF
#define ALL_NO_CU_LAYERS 0x1FFF0000
#define ALL_CU_LAYERS 0x0000FFFF
#define INTERNAL_LAYERS 0x00007FFE /* Bits layers internes */
#define EXTERNAL_LAYERS 0x00008001
/* Forward declaration */
class NETINFO_ITEM;
......@@ -142,24 +142,27 @@ class RATSNEST_ITEM;
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_CurrentViaSize; // Current via size
int m_CurrentMicroViaSize; // Current micro via size
bool m_MicroViasAllowed; // true to allow micro vias
int m_ViaSizeHistory[HISTORY_NUMBER]; // Last HISTORY_NUMBER used via sizes
int m_CurrentViaType; // via type (VIA_BLIND_BURIED, VIA_TROUGHT VIA_MICROVIA)
int m_CurrentTrackWidth; // current track width
bool m_UseConnectedTrackWidth; // if true, when creating a new track starting on an existing track, use this track width
int m_TrackWidthHistory[HISTORY_NUMBER]; // Last HISTORY_NUMBER used track widths
int m_DrawSegmentWidth; // current graphic line width (not EDGE layer)
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_MaskMargin; // Solder mask margin
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_CurrentViaSize; // Current via size
int m_CurrentMicroViaSize; // Current micro via size
bool m_MicroViasAllowed; // true to allow micro vias
int m_ViaSizeHistory[HISTORY_NUMBER]; // Last HISTORY_NUMBER used via sizes
int m_CurrentViaType; // via type (VIA_BLIND_BURIED, VIA_TROUGHT VIA_MICROVIA)
int m_CurrentTrackWidth; // current track width
bool m_UseConnectedTrackWidth; // if true, when creating a new track starting on an existing track, use this track width
int m_TrackWidthHistory[HISTORY_NUMBER]; // Last HISTORY_NUMBER used track widths
int m_DrawSegmentWidth; // current graphic line width (not EDGE layer)
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_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
// Color options for screen display of the Printed Board:
int m_PcbGridColor; // Grid color
......@@ -186,7 +189,7 @@ public:
* returns a bit-map of all the layers that are visible.
* @return int - the visible layers in bit-mapped form.
*/
int GetVisibleLayers() const;
int GetVisibleLayers() const;
};
......
......@@ -484,7 +484,7 @@ private:
void PlaceAncre();
// Edition des graphismes:
LibEDA_BaseStruct* CreateGraphicItem( wxDC* DC );
LibEDA_BaseStruct* CreateGraphicItem( EDA_LibComponentStruct * LibEntry, wxDC* DC );
void GraphicItemBeginDraw( wxDC* DC );
void StartMoveDrawSymbol( wxDC* DC );
void EndDrawGraphicItem( wxDC* DC );
......
......@@ -33,7 +33,8 @@ set(PCBNEW_SRCS
dialog_copper_zones.cpp
dialog_copper_zones_base.cpp
dialog_display_options_base.cpp
# dialog_drc.cpp
dialog_drc_base.cpp
dialog_drc.cpp
dialog_edit_module_text.cpp
dialog_edit_module_text_base.cpp
# dialog_edit_module.cpp
......
......@@ -77,6 +77,12 @@ wxString DRC_ITEM::GetErrorText() const
return wxString( _("Hole near pad"));
case DRCE_HOLE_NEAR_TRACK:
return wxString( _("Hole near track"));
case DRCE_TOO_SMALL_TRACK_WIDTH:
return wxString( _("Too small track width"));
case DRCE_TOO_SMALL_VIA:
return wxString( _("Too small via size"));
case DRCE_TOO_SMALL_MICROVIA:
return wxString( _("Too small micro via size"));
default:
......
......@@ -21,7 +21,8 @@
* Also useful in Gerbview for this reason.
* Zoom 5 and 10 can create artefacts when drawing (integer overflow in low level graphic functions )
*/
static const int PcbZoomList[] = {
static const int PcbZoomList[] =
{
5, 10, 15, 22, 30, 45, 70, 100, 150, 220, 350, 500, 800, 1200,
2000, 3500, 5000, 10000, 20000
};
......@@ -31,7 +32,8 @@ static const int PcbZoomList[] = {
/* Default grid sizes for PCB editor screens. */
#define MM_TO_PCB_UNITS 10000.0 / 25.4
static GRID_TYPE PcbGridList[] = {
static GRID_TYPE PcbGridList[] =
{
// predefined grid list in 0.0001 inches
{ ID_POPUP_GRID_LEVEL_1000, wxRealPoint( 1000, 1000 ) },
{ ID_POPUP_GRID_LEVEL_500, wxRealPoint( 500, 500 ) },
......@@ -135,29 +137,30 @@ bool PCB_SCREEN::IsMicroViaAcceptable( void )
DISPLAY_OPTIONS::DISPLAY_OPTIONS()
{
DisplayPadFill = FILLED;
DisplayPadNum = TRUE;
DisplayPadNoConn = TRUE;
DisplayPadIsol = TRUE;
DisplayModEdge = TRUE;
DisplayModText = TRUE;
DisplayPcbTrackFill = TRUE; /* FALSE = sketch , TRUE = rempli */
DisplayTrackIsol = FALSE;
DisplayPadNum = true;
DisplayPadNoConn = true;
DisplayPadIsol = true;
DisplayModEdge = true;
DisplayModText = true;
DisplayPcbTrackFill = true; /* false = sketch , true = rempli */
DisplayTrackIsol = false;
m_DisplayViaMode = VIA_HOLE_NOT_SHOW;
DisplayPolarCood = TRUE;
DisplayZonesMode = 0; /* 0 = Show filled areas outlines in zones,
* 1 = do not show filled areas outlines
* 2 = show outlines of filled areas */
DisplayPolarCood = false; /* false = display absolute coordinates,
* true = display polar cordinates */
DisplayZonesMode = 0; /* 0 = Show filled areas outlines in zones,
* 1 = do not show filled areas outlines
* 2 = show outlines of filled areas */
DisplayNetNamesMode = 3; /* 0 do not show netnames,
* 1 show netnames on pads
* 2 show netnames on tracks
* 3 show netnames on tracks and pads */
Show_Modules_Cmp = TRUE;
Show_Modules_Cu = TRUE;
DisplayDrawItems = TRUE;
ContrastModeDisplay = FALSE;
* 1 show netnames on pads
* 2 show netnames on tracks
* 3 show netnames on tracks and pads */
Show_Modules_Cmp = true;
Show_Modules_Cu = true;
DisplayDrawItems = true;
ContrastModeDisplay = false;
}
......@@ -169,7 +172,8 @@ EDA_BoardDesignSettings::EDA_BoardDesignSettings()
{
int ii;
static const int default_layer_color[32] = {
static const int default_layer_color[32] =
{
GREEN, LIGHTGRAY, LIGHTGRAY, LIGHTGRAY,
LIGHTGRAY, LIGHTGRAY, LIGHTGRAY, LIGHTGRAY,
LIGHTGRAY, LIGHTGRAY, LIGHTGRAY, LIGHTGRAY,
......@@ -204,14 +208,17 @@ EDA_BoardDesignSettings::EDA_BoardDesignSettings()
m_ViaSizeHistory[ii] = 0; // Last HISTORY_NUMBER used via sizes
}
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_TrackClearence = 100; // track to track and track to pads clearance
m_MaskMargin = 150; // Solder mask margin
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_TrackClearence = 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
m_MaskMargin = 150; // Solder mask margin
/* Color options for screen display of the Printed Board: */
m_PcbGridColor = DARKGRAY; // Grid color
m_PcbGridColor = DARKGRAY; // Grid color
for( ii = 0; ii < 32; ii++ )
m_LayerColor[ii] = default_layer_color[ii];
......
/////////////////////////////////////////////////////////////////////////////
// Name: dialog_drc.cpp
// Purpose:
// Author: jean-pierre Charras
// Modified by:
// Created: 27/02/2006 20:42:00
// RCS-ID:
// Copyright: License GNU
// Licence:
// Licence: GPL
/////////////////////////////////////////////////////////////////////////////
// Generated by DialogBlocks (unregistered), 27/02/2006 20:42:00
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "dialog_drc.h"
#endif
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#include <wx/htmllbox.h>
#include <vector>
////@begin includes
////@end includes
#include "fctsys.h"
#include "wxstruct.h"
#include "dialog_drc.h"
#include "common.h"
////@begin XPM images
////@end XPM images
/**
* Class DRC_LIST_MARKERS
* is an implementation of the interface named DRC_ITEM_LIST which uses
* a BOARD instance to fulfill the interface. No ownership is taken of the
* BOARD.
*/
class DRC_LIST_MARKERS : public DRC_ITEM_LIST
{
BOARD* m_board;
public:
DRC_LIST_MARKERS( BOARD* aBoard ) :
m_board(aBoard)
{
}
/* no destructor since we do not own anything to delete, not even the BOARD.
~DRC_LIST_MARKERS() {}
*/
//-----<Interface DRC_ITEM_LIST>---------------------------------------
void DeleteAllItems()
{
m_board->DeleteMARKERs();
}
const DRC_ITEM* GetItem( int aIndex )
{
const MARKER* marker = m_board->GetMARKER( aIndex );
if( marker )
return &marker->GetReporter();
return NULL;
}
void DeleteItem( int aIndex )
{
MARKER* marker = m_board->GetMARKER( aIndex );
if( marker )
m_board->Delete( marker );
}
/**
* Function GetCount
* returns the number of items in the list.
*/
int GetCount()
{
return m_board->GetMARKERCount();
}
//-----</Interface DRC_ITEM_LIST>--------------------------------------
};
/**
* Class DRC_LIST_UNCONNECTED
* is an implementation of the interface named DRC_ITEM_LIST which uses
* a vector of pointers to DRC_ITEMs to fulfill the interface. No ownership is taken of the
* vector, which will reside in class DRC
*/
class DRC_LIST_UNCONNECTED : public DRC_ITEM_LIST
{
DRC_LIST* m_vector;
public:
DRC_LIST_UNCONNECTED( DRC_LIST* aList ) :
m_vector(aList)
{
}
/* no destructor since we do not own anything to delete, not even the BOARD.
~DRC_LIST_UNCONNECTED() {}
*/
//-----<Interface DRC_ITEM_LIST>---------------------------------------
void DeleteAllItems()
{
if( m_vector )
{
for( unsigned i=0; i<m_vector->size(); ++i )
delete (*m_vector)[i];
m_vector->clear();
}
}
const DRC_ITEM* GetItem( int aIndex )
{
if( m_vector && (unsigned)aIndex < m_vector->size() )
{
const DRC_ITEM* item = (*m_vector)[aIndex];
return item;
}
return NULL;
}
void DeleteItem( int aIndex )
{
if( m_vector && (unsigned)aIndex < m_vector->size() )
{
delete (*m_vector)[aIndex];
m_vector->erase( m_vector->begin()+aIndex );
}
}
/**
* Function GetCount
* returns the number of items in the list.
*/
int GetCount()
{
if( m_vector )
{
return m_vector->size();
}
return 0;
}
//-----</Interface DRC_ITEM_LIST>--------------------------------------
};
/**
* Class DRCLISTBOX
* is used to display a DRC_ITEM_LIST.
/* class DIALOG_DRC_CONTROL: a dialog to set DRC parameters (clearance, min cooper size)
* and run DRC tests
*/
class DRCLISTBOX : public wxHtmlListBox
{
private:
DRC_ITEM_LIST* m_list; ///< wxHtmlListBox does not own the list, I do
public:
DRCLISTBOX( wxWindow* parent, wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = 0, const wxString& name = wxVListBoxNameStr)
: wxHtmlListBox( parent, id, pos, size, style, name )
{
m_list = 0;
}
~DRCLISTBOX()
{
delete m_list; // I own it, I destroy it.
}
/**
* Function SetList
* sets the DRC_ITEM_LIST for this listbox. Ownership of the DRC_ITEM_LIST is
* transfered to this DRCLISTBOX.
* @param aList The DRC_ITEM_LIST* containing the DRC_ITEMs which will be
* displayed in the wxHtmlListBox
*/
void SetList( DRC_ITEM_LIST* aList )
{
delete m_list;
m_list = aList;
SetItemCount( aList->GetCount() );
Refresh();
}
/**
* Function GetItem
* returns a requested DRC_ITEM* or NULL.
*/
const DRC_ITEM* GetItem( int aIndex )
{
if( m_list )
{
return m_list->GetItem( aIndex );
}
return NULL;
}
/**
* Function OnGetItem
* returns the html text associated with the DRC_ITEM given by index 'n'.
* @param n An index into the list.
* @return wxString - the simple html text to show in the listbox.
*/
wxString OnGetItem( size_t n ) const
{
if( m_list )
{
const DRC_ITEM* item = m_list->GetItem( (int) n );
if( item )
return item->ShowHtml();
}
return wxString();
}
/**
* Function OnGetItem
* returns the html text associated with the given index 'n'.
* @param n An index into the list.
* @return wxString - the simple html text to show in the listbox.
*/
wxString OnGetItemMarkup( size_t n ) const
{
return OnGetItem( n );
}
/**
* Function DeleteElement
* will delete one of the items in the list.
* @param aIndex The index into the list to delete.
*/
void DeleteItem( int aIndex )
{
if( m_list )
{
int selection = GetSelection();
m_list->DeleteItem( aIndex );
int count = m_list->GetCount();
SetItemCount( count );
// if old selection >= new count
if( selection >= count )
SetSelection( count-1 ); // -1 is "no selection"
Refresh();
}
}
/**
* Function DeleteAllItems
* deletes all items in the list.
*/
void DeleteAllItems()
{
if( m_list )
{
m_list->DeleteAllItems();
SetItemCount(0);
SetSelection( -1 ); // -1 is no selection
Refresh();
}
}
};
/*!
* DrcDialog type definition
*/
IMPLEMENT_DYNAMIC_CLASS( DrcDialog, wxDialog )
/*!
* DrcDialog event table definition
*/
BEGIN_EVENT_TABLE( DrcDialog, wxDialog )
////@begin DrcDialog event table entries
EVT_INIT_DIALOG( DrcDialog::OnInitDialog )
EVT_CHECKBOX( ID_CHECKBOX, DrcDialog::OnReportCheckBoxClicked )
EVT_BUTTON( ID_BUTTON_BROWSE_RPT_FILE, DrcDialog::OnButtonBrowseRptFileClick )
EVT_BUTTON( ID_STARTDRC, DrcDialog::OnStartdrcClick )
EVT_BUTTON( ID_LIST_UNCONNECTED, DrcDialog::OnListUnconnectedClick )
EVT_BUTTON( ID_DELETE_ALL, DrcDialog::OnDeleteAllClick )
EVT_BUTTON( ID_DELETE_ONE, DrcDialog::OnDeleteOneClick )
EVT_BUTTON( wxID_CANCEL, DrcDialog::OnCancelClick )
EVT_BUTTON( wxID_OK, DrcDialog::OnOkClick )
////@end DrcDialog event table entries
// outside bracket: DialogBlocks does not know about the listbox events on a custom list box.
EVT_LISTBOX( ID_CLEARANCE_LIST, DrcDialog::OnMarkerSelectionEvent)
EVT_LISTBOX( ID_UNCONNECTED_LIST, DrcDialog::OnUnconnectedSelectionEvent)
EVT_MENU( ID_POPUP_UNCONNECTED_A, DrcDialog::OnPopupMenu )
EVT_MENU( ID_POPUP_UNCONNECTED_B, DrcDialog::OnPopupMenu )
EVT_MENU( ID_POPUP_MARKERS_A, DrcDialog::OnPopupMenu )
EVT_MENU( ID_POPUP_MARKERS_B, DrcDialog::OnPopupMenu )
END_EVENT_TABLE()
/*!
* DrcDialog constructors
*/
DrcDialog::DrcDialog( )
{
}
DrcDialog::DrcDialog( DRC* aTester, WinEDA_PcbFrame* parent,
wxWindowID id,
const wxString& caption,
const wxPoint& pos,
const wxSize& size,
long style )
DIALOG_DRC_CONTROL::DIALOG_DRC_CONTROL( DRC* aTester, WinEDA_PcbFrame* parent ) :
DIALOG_DRC_CONTROL_BASE(parent)
{
m_tester = aTester;
m_Parent = parent;
Create(parent, id, caption, pos, size, style);
}
/*!
* WinEDA_DrcFrame creator
*/
bool DrcDialog::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
////@begin DrcDialog member initialisation
m_MainSizer = NULL;
m_CommandSizer = NULL;
m_ClearenceTitle = NULL;
m_SetClearance = NULL;
m_CreateRptCtrl = NULL;
m_RptFilenameCtrl = NULL;
m_BrowseButton = NULL;
m_Pad2PadTestCtrl = NULL;
m_ZonesTestCtrl = NULL;
m_UnconnectedTestCtrl = NULL;
m_DeleteAllButton = NULL;
m_DeleteCurrentMarkerButton = NULL;
m_Notebook = NULL;
m_ClearanceListBox = NULL;
m_UnconnectedListBox = NULL;
StdDialogButtonSizer = NULL;
////@end DrcDialog member initialisation
////@begin DrcDialog creation
SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
wxDialog::Create( parent, id, caption, pos, size, style );
CreateControls();
Init( );
if (GetSizer())
{
GetSizer()->SetSizeHints(this);
}
Centre();
////@end DrcDialog creation
return true;
}
/*!
* Control creation for WinEDA_DrcFrame
*/
void DrcDialog::CreateControls()
void DIALOG_DRC_CONTROL::Init()
{
////@begin DrcDialog content construction
// Generated by DialogBlocks, 29/04/2009 15:13:47 (unregistered)
DrcDialog* itemDialog1 = this;
m_MainSizer = new wxBoxSizer(wxVERTICAL);
itemDialog1->SetSizer(m_MainSizer);
m_CommandSizer = new wxBoxSizer(wxHORIZONTAL);
m_MainSizer->Add(m_CommandSizer, 0, wxGROW|wxALL, 5);
wxStaticBox* itemStaticBoxSizer4Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Options"));
wxStaticBoxSizer* itemStaticBoxSizer4 = new wxStaticBoxSizer(itemStaticBoxSizer4Static, wxHORIZONTAL);
m_CommandSizer->Add(itemStaticBoxSizer4, 3, wxGROW|wxTOP|wxBOTTOM, 8);
wxBoxSizer* itemBoxSizer5 = new wxBoxSizer(wxVERTICAL);
itemStaticBoxSizer4->Add(itemBoxSizer5, 2, wxGROW|wxALL, 5);
wxBoxSizer* itemBoxSizer6 = new wxBoxSizer(wxHORIZONTAL);
itemBoxSizer5->Add(itemBoxSizer6, 0, wxALIGN_LEFT|wxALL, 5);
m_ClearenceTitle = new wxStaticText( itemDialog1, wxID_STATIC, _("Clearance"), wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE );
itemBoxSizer6->Add(m_ClearenceTitle, 0, wxALIGN_TOP|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
m_SetClearance = new wxTextCtrl( itemDialog1, ID_TEXTCTRL1, _T(""), wxDefaultPosition, wxSize(144, -1), 0 );
if (DrcDialog::ShowToolTips())
m_SetClearance->SetToolTip(_("In the clearance units, enter the clearance distance"));
itemBoxSizer6->Add(m_SetClearance, 1, wxALIGN_TOP|wxLEFT|wxRIGHT|wxBOTTOM|wxADJUST_MINSIZE, 5);
wxStaticBox* itemStaticBoxSizer9Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Create Report File"));
wxStaticBoxSizer* itemStaticBoxSizer9 = new wxStaticBoxSizer(itemStaticBoxSizer9Static, wxHORIZONTAL);
itemBoxSizer5->Add(itemStaticBoxSizer9, 1, wxGROW|wxALL, 5);
m_CreateRptCtrl = new wxCheckBox( itemDialog1, ID_CHECKBOX, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
m_CreateRptCtrl->SetValue(false);
if (DrcDialog::ShowToolTips())
m_CreateRptCtrl->SetToolTip(_("Enable writing report to this file"));
itemStaticBoxSizer9->Add(m_CreateRptCtrl, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
m_RptFilenameCtrl = new wxTextCtrl( itemDialog1, ID_TEXTCTRL3, _T(""), wxDefaultPosition, wxSize(250, -1), 0 );
if (DrcDialog::ShowToolTips())
m_RptFilenameCtrl->SetToolTip(_("Enter the report filename"));
itemStaticBoxSizer9->Add(m_RptFilenameCtrl, 2, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxTOP|wxBOTTOM, 5);
m_BrowseButton = new wxButton( itemDialog1, ID_BUTTON_BROWSE_RPT_FILE, _("..."), wxDefaultPosition, wxSize(35, -1), 0 );
if (DrcDialog::ShowToolTips())
m_BrowseButton->SetToolTip(_("Pick a filename interactively"));
itemStaticBoxSizer9->Add(m_BrowseButton, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxTOP|wxBOTTOM|wxADJUST_MINSIZE, 5);
wxStaticBox* itemStaticBoxSizer13Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Include Tests For:"));
wxStaticBoxSizer* itemStaticBoxSizer13 = new wxStaticBoxSizer(itemStaticBoxSizer13Static, wxVERTICAL);
itemStaticBoxSizer4->Add(itemStaticBoxSizer13, 0, wxGROW|wxALL, 5);
m_Pad2PadTestCtrl = new wxCheckBox( itemDialog1, ID_CHECKBOX2, _("Pad to pad"), wxDefaultPosition, wxDefaultSize, 0 );
m_Pad2PadTestCtrl->SetValue(false);
if (DrcDialog::ShowToolTips())
m_Pad2PadTestCtrl->SetToolTip(_("Include tests for clearances between pad to pads"));
itemStaticBoxSizer13->Add(m_Pad2PadTestCtrl, 0, wxGROW|wxALL, 5);
m_ZonesTestCtrl = new wxCheckBox( itemDialog1, ID_CHECKBOX7, _("Zones"), wxDefaultPosition, wxDefaultSize, 0 );
m_ZonesTestCtrl->SetValue(false);
if (DrcDialog::ShowToolTips())
m_ZonesTestCtrl->SetToolTip(_("Include zones in clearance or unconnected tests"));
itemStaticBoxSizer13->Add(m_ZonesTestCtrl, 0, wxGROW|wxALL, 5);
m_UnconnectedTestCtrl = new wxCheckBox( itemDialog1, ID_CHECKBOX3, _("Unconnected pads"), wxDefaultPosition, wxDefaultSize, 0 );
m_UnconnectedTestCtrl->SetValue(false);
if (DrcDialog::ShowToolTips())
m_UnconnectedTestCtrl->SetToolTip(_("Find unconnected pads"));
itemStaticBoxSizer13->Add(m_UnconnectedTestCtrl, 0, wxGROW|wxALL, 5);
wxBoxSizer* itemBoxSizer17 = new wxBoxSizer(wxVERTICAL);
m_CommandSizer->Add(itemBoxSizer17, 0, wxALIGN_TOP|wxALL, 5);
wxButton* itemButton18 = new wxButton( itemDialog1, ID_STARTDRC, _("Start DRC"), wxDefaultPosition, wxDefaultSize, 0 );
if (DrcDialog::ShowToolTips())
itemButton18->SetToolTip(_("Start the Design Rule Checker"));
itemBoxSizer17->Add(itemButton18, 0, wxGROW|wxALL, 5);
wxButton* itemButton19 = new wxButton( itemDialog1, ID_LIST_UNCONNECTED, _("List Unconnected"), wxDefaultPosition, wxDefaultSize, 0 );
if (DrcDialog::ShowToolTips())
itemButton19->SetToolTip(_("List unconnected pads or tracks"));
itemBoxSizer17->Add(itemButton19, 0, wxGROW|wxALL, 5);
m_DeleteAllButton = new wxButton( itemDialog1, ID_DELETE_ALL, _("Delete All Markers"), wxDefaultPosition, wxDefaultSize, 0 );
if (DrcDialog::ShowToolTips())
m_DeleteAllButton->SetToolTip(_("Delete every marker"));
itemBoxSizer17->Add(m_DeleteAllButton, 0, wxGROW|wxALL, 5);
m_DeleteCurrentMarkerButton = new wxButton( itemDialog1, ID_DELETE_ONE, _("Delete Current Marker"), wxDefaultPosition, wxDefaultSize, 0 );
if (DrcDialog::ShowToolTips())
m_DeleteCurrentMarkerButton->SetToolTip(_("Delete the marker selected in the listBox below"));
m_DeleteCurrentMarkerButton->Enable(false);
itemBoxSizer17->Add(m_DeleteCurrentMarkerButton, 0, wxGROW|wxALL, 5);
wxStaticText* itemStaticText22 = new wxStaticText( itemDialog1, wxID_STATIC, _("Error Messages:"), wxDefaultPosition, wxDefaultSize, 0 );
m_MainSizer->Add(itemStaticText22, 0, wxGROW|wxLEFT|wxRIGHT|wxADJUST_MINSIZE, 10);
m_Notebook = new wxNotebook( itemDialog1, ID_NOTEBOOK1, wxDefaultPosition, wxDefaultSize, wxNB_DEFAULT|wxRAISED_BORDER );
#if !wxCHECK_VERSION(2,5,2)
wxNotebookSizer* m_NotebookSizer = new wxNotebookSizer(m_Notebook);
#endif
m_ClearanceListBox = new DRCLISTBOX( m_Notebook, ID_CLEARANCE_LIST, wxDefaultPosition, wxSize(100, 300), wxSUNKEN_BORDER|wxHSCROLL|wxVSCROLL );
if (DrcDialog::ShowToolTips())
m_ClearanceListBox->SetToolTip(_("MARKERs, double click any to go there in PCB, right click for popup menu"));
m_Notebook->AddPage(m_ClearanceListBox, _("Distance Problem Markers"));
m_UnconnectedListBox = new DRCLISTBOX( m_Notebook, ID_UNCONNECTED_LIST, wxDefaultPosition, wxSize(100, 100), wxSUNKEN_BORDER|wxHSCROLL|wxVSCROLL );
if (DrcDialog::ShowToolTips())
m_UnconnectedListBox->SetToolTip(_("A list of unconnected pads, right click for popup menu"));
m_Notebook->AddPage(m_UnconnectedListBox, _("Unconnected"));
#if !wxCHECK_VERSION(2,5,2)
m_MainSizer->Add(m_NotebookSizer, 5, wxGROW|wxALL, 5);
#else
m_MainSizer->Add(m_Notebook, 5, wxGROW|wxALL, 5);
#endif
StdDialogButtonSizer = new wxStdDialogButtonSizer;
m_MainSizer->Add(StdDialogButtonSizer, 0, wxGROW|wxALL, 10);
wxButton* itemButton27 = new wxButton( itemDialog1, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
StdDialogButtonSizer->AddButton(itemButton27);
wxButton* itemButton28 = new wxButton( itemDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
itemButton28->SetDefault();
StdDialogButtonSizer->AddButton(itemButton28);
StdDialogButtonSizer->Realize();
// Connect events and objects
m_ClearanceListBox->Connect(ID_CLEARANCE_LIST, wxEVT_LEFT_DCLICK, wxMouseEventHandler(DrcDialog::OnLeftDClickClearance), NULL, this);
m_ClearanceListBox->Connect(ID_CLEARANCE_LIST, wxEVT_RIGHT_UP, wxMouseEventHandler(DrcDialog::OnRightUpClearance), NULL, this);
m_UnconnectedListBox->Connect(ID_UNCONNECTED_LIST, wxEVT_LEFT_DCLICK, wxMouseEventHandler(DrcDialog::OnLeftDClickUnconnected), NULL, this);
m_UnconnectedListBox->Connect(ID_UNCONNECTED_LIST, wxEVT_RIGHT_UP, wxMouseEventHandler(DrcDialog::OnRightUpUnconnected), NULL, this);
////@end DrcDialog content construction
m_ClearanceListBox->Connect(ID_CLEARANCE_LIST, wxEVT_LEFT_DCLICK, wxMouseEventHandler(DIALOG_DRC_CONTROL::OnLeftDClickClearance), NULL, this);
m_ClearanceListBox->Connect(ID_CLEARANCE_LIST, wxEVT_RIGHT_UP, wxMouseEventHandler(DIALOG_DRC_CONTROL::OnRightUpClearance), NULL, this);
m_UnconnectedListBox->Connect(ID_UNCONNECTED_LIST, wxEVT_LEFT_DCLICK, wxMouseEventHandler(DIALOG_DRC_CONTROL::OnLeftDClickUnconnected), NULL, this);
m_UnconnectedListBox->Connect(ID_UNCONNECTED_LIST, wxEVT_RIGHT_UP, wxMouseEventHandler(DIALOG_DRC_CONTROL::OnRightUpUnconnected), NULL, this);
AddUnitSymbol(*m_ClearenceTitle);
AddUnitSymbol(*m_TrackMinWidthTitle);
AddUnitSymbol(*m_ViaMinTitle);
AddUnitSymbol(*m_MicroViaMinTitle);
Layout(); // adding the units above expanded Clearance text, now resize.
}
/*!
* Should we show tooltips?
*/
bool DrcDialog::ShowToolTips()
{
return true;
}
/*!
* Get bitmap resources
*/
wxBitmap DrcDialog::GetBitmapResource( const wxString& name )
{
// Bitmap retrieval
////@begin DrcDialog bitmap retrieval
wxUnusedVar(name);
return wxNullBitmap;
////@end DrcDialog bitmap retrieval
}
// Set the initial "enabled" status of the browse button and the text
// field for report name
wxCommandEvent junk;
OnReportCheckBoxClicked( junk );
/*!
* Get icon resources
*/
SetFocus();
wxIcon DrcDialog::GetIconResource( const wxString& name )
{
// Icon retrieval
////@begin DrcDialog icon retrieval
wxUnusedVar(name);
return wxNullIcon;
////@end DrcDialog icon retrieval
// deselect the existing text, seems SetFocus() wants to emulate
// Microsoft and select all text, which is not desireable here.
// m_SetClearance->SetSelection(0,0);
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DRC_RUN
*/
void DrcDialog::OnStartdrcClick( wxCommandEvent& event )
void DIALOG_DRC_CONTROL::OnStartdrcClick( wxCommandEvent& event )
{
wxString reportName;
......@@ -621,6 +81,12 @@ void DrcDialog::OnStartdrcClick( wxCommandEvent& event )
g_DesignSettings.m_TrackClearence =
ReturnValueFromTextCtrl( *m_SetClearance, m_Parent->m_InternalUnits );
g_DesignSettings.m_TrackMinWidth =
ReturnValueFromTextCtrl( *m_SetTrackMinWidthCtrl, m_Parent->m_InternalUnits );
g_DesignSettings.m_ViasMinSize =
ReturnValueFromTextCtrl( *m_SetViaMinSizeCtrl, m_Parent->m_InternalUnits );
g_DesignSettings.m_MicroViasMinSize =
ReturnValueFromTextCtrl( *m_SetMicroViakMinSizeCtrl, m_Parent->m_InternalUnits );
m_tester->SetSettings( m_Pad2PadTestCtrl->IsChecked(),
m_UnconnectedTestCtrl->IsChecked(),
......@@ -645,17 +111,13 @@ void DrcDialog::OnStartdrcClick( wxCommandEvent& event )
if( !reportName.IsEmpty() )
{
FILE* fp = wxFopen( reportName, wxT( "w" ) );
writeReport( fp );
fclose(fp);
wxString msg;
msg.Printf( _( "Report file \"%s\" created" ), reportName.GetData() );
wxString caption( _("Disk File Report Completed") );
wxMessageDialog popupWindow( this, msg, caption );
popupWindow.ShowModal();
......@@ -671,7 +133,7 @@ void DrcDialog::OnStartdrcClick( wxCommandEvent& event )
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_ERASE_DRC_MARKERS
*/
void DrcDialog::OnDeleteAllClick( wxCommandEvent& event )
void DIALOG_DRC_CONTROL::OnDeleteAllClick( wxCommandEvent& event )
{
DelDRCMarkers();
RedrawDrawPanel();
......@@ -682,7 +144,7 @@ void DrcDialog::OnDeleteAllClick( wxCommandEvent& event )
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_LIST_UNCONNECTED_PADS
*/
void DrcDialog::OnListUnconnectedClick( wxCommandEvent& event )
void DIALOG_DRC_CONTROL::OnListUnconnectedClick( wxCommandEvent& event )
{
wxString reportName;
......@@ -701,6 +163,12 @@ void DrcDialog::OnListUnconnectedClick( wxCommandEvent& event )
g_DesignSettings.m_TrackClearence =
ReturnValueFromTextCtrl( *m_SetClearance, m_Parent->m_InternalUnits );
g_DesignSettings.m_TrackMinWidth =
ReturnValueFromTextCtrl( *m_SetTrackMinWidthCtrl, m_Parent->m_InternalUnits );
g_DesignSettings.m_ViasMinSize =
ReturnValueFromTextCtrl( *m_SetViaMinSizeCtrl, m_Parent->m_InternalUnits );
g_DesignSettings.m_MicroViasMinSize =
ReturnValueFromTextCtrl( *m_SetMicroViakMinSizeCtrl, m_Parent->m_InternalUnits );
m_tester->SetSettings( m_Pad2PadTestCtrl->IsChecked(),
m_UnconnectedTestCtrl->IsChecked(),
......@@ -723,19 +191,13 @@ void DrcDialog::OnListUnconnectedClick( wxCommandEvent& event )
if( !reportName.IsEmpty() )
{
FILE* fp = wxFopen( reportName, wxT( "w" ) );
writeReport( fp );
fclose(fp);
wxString msg;
msg.Printf( _( "Report file \"%s\" created" ), reportName.GetData() );
wxString caption( _("Disk File Report Completed") );
wxMessageDialog popupWindow( this, msg, caption );
popupWindow.ShowModal();
}
......@@ -750,7 +212,7 @@ void DrcDialog::OnListUnconnectedClick( wxCommandEvent& event )
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON_BROWSE_RPT_FILE
*/
void DrcDialog::OnButtonBrowseRptFileClick( wxCommandEvent& event )
void DIALOG_DRC_CONTROL::OnButtonBrowseRptFileClick( wxCommandEvent& event )
{
wxFileName fn;
wxString wildcard( _( "DRC report files (.rpt)|*.rpt" ) );
......@@ -774,12 +236,8 @@ void DrcDialog::OnButtonBrowseRptFileClick( wxCommandEvent& event )
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
*/
void DrcDialog::OnOkClick( wxCommandEvent& event )
void DIALOG_DRC_CONTROL::OnOkClick( wxCommandEvent& event )
{
#if defined(DEBUG)
printf("OK Button handler\n");
#endif
SetReturnCode( wxID_OK );
m_tester->DestroyDialog( wxID_OK );
}
......@@ -789,12 +247,8 @@ void DrcDialog::OnOkClick( wxCommandEvent& event )
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
*/
void DrcDialog::OnCancelClick( wxCommandEvent& event )
void DIALOG_DRC_CONTROL::OnCancelClick( wxCommandEvent& event )
{
#if defined(DEBUG)
printf("Cancel Button handler\n");
#endif
SetReturnCode( wxID_CANCEL );
m_tester->DestroyDialog( wxID_CANCEL );
}
......@@ -804,7 +258,7 @@ void DrcDialog::OnCancelClick( wxCommandEvent& event )
* wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_CHECKBOX1
*/
void DrcDialog::OnReportCheckBoxClicked( wxCommandEvent& event )
void DIALOG_DRC_CONTROL::OnReportCheckBoxClicked( wxCommandEvent& event )
{
if( m_CreateRptCtrl->IsChecked() )
{
......@@ -820,33 +274,12 @@ void DrcDialog::OnReportCheckBoxClicked( wxCommandEvent& event )
}
/*!
* wxEVT_INIT_DIALOG event handler for ID_DIALOG
*/
void DrcDialog::OnInitDialog( wxInitDialogEvent& event )
{
wxCommandEvent junk;
// Set the initial "enabled" status of the browse button and the text
// field for report name
OnReportCheckBoxClicked( junk );
m_SetClearance->SetFocus();
// deselect the existing text, seems SetFocus() wants to emulate
// Microsoft and select all text, which is not desireable here.
m_SetClearance->SetSelection(0,0);
event.Skip();
}
/*!
* wxEVT_LEFT_DCLICK event handler for ID_CLEARANCE_LIST
*/
void DrcDialog::OnLeftDClickClearance( wxMouseEvent& event )
void DIALOG_DRC_CONTROL::OnLeftDClickClearance( wxMouseEvent& event )
{
event.Skip();
......@@ -869,7 +302,7 @@ void DrcDialog::OnLeftDClickClearance( wxMouseEvent& event )
m_Parent->CursorGoto( item->GetPosition() );
// turn control over to m_Parent, hide this DrcDialog window,
// turn control over to m_Parent, hide this DIALOG_DRC_CONTROL window,
// no destruction so we can preserve listbox cursor
Hide();
......@@ -879,7 +312,7 @@ void DrcDialog::OnLeftDClickClearance( wxMouseEvent& event )
}
void DrcDialog::OnPopupMenu( wxCommandEvent& event )
void DIALOG_DRC_CONTROL::OnPopupMenu( wxCommandEvent& event )
{
int source = event.GetId();
......@@ -925,7 +358,7 @@ void DrcDialog::OnPopupMenu( wxCommandEvent& event )
* wxEVT_RIGHT_UP event handler for ID_CLEARANCE_LIST
*/
void DrcDialog::OnRightUpUnconnected( wxMouseEvent& event )
void DIALOG_DRC_CONTROL::OnRightUpUnconnected( wxMouseEvent& event )
{
event.Skip();
......@@ -957,7 +390,7 @@ void DrcDialog::OnRightUpUnconnected( wxMouseEvent& event )
* wxEVT_RIGHT_UP event handler for ID_CLEARANCE_LIST
*/
void DrcDialog::OnRightUpClearance( wxMouseEvent& event )
void DIALOG_DRC_CONTROL::OnRightUpClearance( wxMouseEvent& event )
{
event.Skip();
......@@ -989,7 +422,7 @@ void DrcDialog::OnRightUpClearance( wxMouseEvent& event )
* wxEVT_LEFT_DCLICK event handler for ID_UNCONNECTED_LIST
*/
void DrcDialog::OnLeftDClickUnconnected( wxMouseEvent& event )
void DIALOG_DRC_CONTROL::OnLeftDClickUnconnected( wxMouseEvent& event )
{
event.Skip();
......@@ -1016,7 +449,7 @@ void DrcDialog::OnLeftDClickUnconnected( wxMouseEvent& event )
}
void DrcDialog::OnMarkerSelectionEvent( wxCommandEvent& event )
void DIALOG_DRC_CONTROL::OnMarkerSelectionEvent( wxCommandEvent& event )
{
int selection = event.GetSelection();
......@@ -1029,7 +462,7 @@ void DrcDialog::OnMarkerSelectionEvent( wxCommandEvent& event )
event.Skip();
}
void DrcDialog::OnUnconnectedSelectionEvent( wxCommandEvent& event )
void DIALOG_DRC_CONTROL::OnUnconnectedSelectionEvent( wxCommandEvent& event )
{
int selection = event.GetSelection();
......@@ -1043,14 +476,14 @@ void DrcDialog::OnUnconnectedSelectionEvent( wxCommandEvent& event )
}
void DrcDialog::RedrawDrawPanel()
void DIALOG_DRC_CONTROL::RedrawDrawPanel()
{
m_Parent->DrawPanel->Refresh();
}
/*********************************************************/
void DrcDialog::DelDRCMarkers()
void DIALOG_DRC_CONTROL::DelDRCMarkers()
/*********************************************************/
{
m_ClearanceListBox->DeleteAllItems();
......@@ -1058,7 +491,7 @@ void DrcDialog::DelDRCMarkers()
}
void DrcDialog::writeReport( FILE* fp )
void DIALOG_DRC_CONTROL::writeReport( FILE* fp )
{
int count;
......@@ -1091,7 +524,7 @@ void DrcDialog::writeReport( FILE* fp )
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DELETE_ONE
*/
void DrcDialog::OnDeleteOneClick( wxCommandEvent& event )
void DIALOG_DRC_CONTROL::OnDeleteOneClick( wxCommandEvent& event )
{
int selectedIndex;
int curTab = m_Notebook->GetSelection();
......@@ -1120,7 +553,5 @@ void DrcDialog::OnDeleteOneClick( wxCommandEvent& event )
*/
}
}
// event.Skip();
}
/////////////////////////////////////////////////////////////////////////////
// Name: dialog_drc.h
// Purpose:
// Author: jean-pierre Charras
// Modified by:
// Created: 27/02/2006 20:42:00
// RCS-ID:
// Copyright: License GNU
// Licence:
// Licence: GPL
/////////////////////////////////////////////////////////////////////////////
// Generated by DialogBlocks (unregistered), 27/02/2006 20:42:00
#ifndef _DIALOG_DRC_H_
#define _DIALOG_DRC_H_
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma interface "dialog_drc.h"
#endif
/*!
* Includes
*/
////@begin includes
#include "wx/notebook.h"
////@end includes
/*!
* Forward declarations
*/
#include <wx/htmllbox.h>
////@begin forward declarations
class wxBoxSizer;
class wxNotebook;
// forward declarations
class DRCLISTBOX;
class wxStdDialogButtonSizer;
////@end forward declarations
//end forward declarations
#include "fctsys.h"
#include "pcbnew.h"
#include "class_drawpanel.h"
#include "wxstruct.h"
#include "drc_stuff.h"
/*!
* Control identifiers
*/
////@begin control identifiers
#define ID_DIALOG 10000
#define ID_TEXTCTRL1 10002
#define ID_CHECKBOX 10004
#define ID_TEXTCTRL3 10014
#define ID_BUTTON_BROWSE_RPT_FILE 10018
#define ID_CHECKBOX2 10019
#define ID_CHECKBOX7 10021
#define ID_CHECKBOX3 10011
#define ID_STARTDRC 10006
#define ID_LIST_UNCONNECTED 10003
#define ID_DELETE_ALL 10005
#define ID_DELETE_ONE 10007
#define ID_NOTEBOOK1 10008
#define ID_CLEARANCE_LIST 10001
#define ID_UNCONNECTED_LIST 10009
#define SYMBOL_DRCDIALOG_STYLE wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxMAXIMIZE_BOX|wxMINIMIZE_BOX
#define SYMBOL_DRCDIALOG_TITLE _("DRC Control")
#define SYMBOL_DRCDIALOG_IDNAME ID_DIALOG
#define SYMBOL_DRCDIALOG_SIZE wxSize(400, 300)
#define SYMBOL_DRCDIALOG_POSITION wxDefaultPosition
////@end control identifiers
#define ID_DRCLISTCTRL 14000 // outside @end control identifiers since DialogBlocks knows not DRCLISTBOX
#include "dialog_drc_base.h"
// outside @end control identifiers since wxFormBuilder knows not DRCLISTBOX
#define ID_DRCLISTCTRL 14000
#define ID_POPUP_UNCONNECTED_A 14001
#define ID_POPUP_UNCONNECTED_B 14002
#define ID_POPUP_MARKERS_A 14003
#define ID_POPUP_MARKERS_B 14004
/*!
* Compatibility
*/
#ifndef wxCLOSE_BOX
#define wxCLOSE_BOX 0x1000
#endif
/*!
* DrcDialog class declaration
*/
class DrcDialog: public wxDialog
class DIALOG_DRC_CONTROL: public DIALOG_DRC_CONTROL_BASE
{
DECLARE_DYNAMIC_CLASS( DrcDialog )
DECLARE_EVENT_TABLE()
public:
/// Constructors
DIALOG_DRC_CONTROL( DRC* aTester, WinEDA_PcbFrame* parent );
~DIALOG_DRC_CONTROL(){};
private:
/**
* Function writeReport
* outputs the MARKER items and unconnecte DRC_ITEMs with commentary to an
* outputs the MARKER items and unconnecte DRC_ITEMs with commentary to an
* open text file.
* @param fpOut The text file to write the report to.
*/
void writeReport( FILE* fpOut );
public:
/// Constructors
DrcDialog( );
DrcDialog( DRC* aTester, WinEDA_PcbFrame* parent,
wxWindowID id = SYMBOL_DRCDIALOG_IDNAME,
const wxString& caption = SYMBOL_DRCDIALOG_TITLE,
const wxPoint& pos = SYMBOL_DRCDIALOG_POSITION,
const wxSize& size = SYMBOL_DRCDIALOG_SIZE,
long style = SYMBOL_DRCDIALOG_STYLE );
/// Creation
bool Create( wxWindow* parent, wxWindowID id = SYMBOL_DRCDIALOG_IDNAME, const wxString& caption = SYMBOL_DRCDIALOG_TITLE, const wxPoint& pos = SYMBOL_DRCDIALOG_POSITION, const wxSize& size = SYMBOL_DRCDIALOG_SIZE, long style = SYMBOL_DRCDIALOG_STYLE );
/// Creates the controls and sizers
void CreateControls();
////@begin DrcDialog event handler declarations
/// wxEVT_INIT_DIALOG event handler for ID_DIALOG
void OnInitDialog( wxInitDialogEvent& event );
void Init( );
/// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_CHECKBOX
void OnReportCheckBoxClicked( wxCommandEvent& event );
......@@ -158,48 +89,13 @@ public:
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
void OnOkClick( wxCommandEvent& event );
////@end DrcDialog event handler declarations
////@begin DrcDialog member function declarations
/// Retrieves bitmap resources
wxBitmap GetBitmapResource( const wxString& name );
/// Retrieves icon resources
wxIcon GetIconResource( const wxString& name );
////@end DrcDialog member function declarations
void OnMarkerSelectionEvent( wxCommandEvent& event );
void OnUnconnectedSelectionEvent( wxCommandEvent& event );
/// Should we show tooltips?
static bool ShowToolTips();
void DelDRCMarkers();
void RedrawDrawPanel();
void OnPopupMenu( wxCommandEvent& event );
////@begin DrcDialog member variables
wxBoxSizer* m_MainSizer;
wxBoxSizer* m_CommandSizer;
wxStaticText* m_ClearenceTitle;
wxTextCtrl* m_SetClearance;
wxCheckBox* m_CreateRptCtrl;
wxTextCtrl* m_RptFilenameCtrl;
wxButton* m_BrowseButton;
wxCheckBox* m_Pad2PadTestCtrl;
wxCheckBox* m_ZonesTestCtrl;
wxCheckBox* m_UnconnectedTestCtrl;
wxButton* m_DeleteAllButton;
wxButton* m_DeleteCurrentMarkerButton;
wxNotebook* m_Notebook;
DRCLISTBOX* m_ClearanceListBox;
DRCLISTBOX* m_UnconnectedListBox;
wxStdDialogButtonSizer* StdDialogButtonSizer;
////@end DrcDialog member variables
DRC* m_tester;
......@@ -207,5 +103,266 @@ public:
int m_UnconnectedCount;
};
/**
* Class DRC_LIST_MARKERS
* is an implementation of the interface named DRC_ITEM_LIST which uses
* a BOARD instance to fulfill the interface. No ownership is taken of the
* BOARD.
*/
class DRC_LIST_MARKERS : public DRC_ITEM_LIST
{
BOARD* m_board;
public:
DRC_LIST_MARKERS( BOARD* aBoard ) :
m_board(aBoard)
{
}
/* no destructor since we do not own anything to delete, not even the BOARD.
~DRC_LIST_MARKERS() {}
*/
//-----<Interface DRC_ITEM_LIST>---------------------------------------
void DeleteAllItems()
{
m_board->DeleteMARKERs();
}
const DRC_ITEM* GetItem( int aIndex )
{
const MARKER* marker = m_board->GetMARKER( aIndex );
if( marker )
return &marker->GetReporter();
return NULL;
}
void DeleteItem( int aIndex )
{
MARKER* marker = m_board->GetMARKER( aIndex );
if( marker )
m_board->Delete( marker );
}
/**
* Function GetCount
* returns the number of items in the list.
*/
int GetCount()
{
return m_board->GetMARKERCount();
}
//-----</Interface DRC_ITEM_LIST>--------------------------------------
};
/**
* Class DRC_LIST_UNCONNECTED
* is an implementation of the interface named DRC_ITEM_LIST which uses
* a vector of pointers to DRC_ITEMs to fulfill the interface. No ownership is taken of the
* vector, which will reside in class DRC
*/
class DRC_LIST_UNCONNECTED : public DRC_ITEM_LIST
{
DRC_LIST* m_vector;
public:
DRC_LIST_UNCONNECTED( DRC_LIST* aList ) :
m_vector(aList)
{
}
/* no destructor since we do not own anything to delete, not even the BOARD.
~DRC_LIST_UNCONNECTED() {}
*/
//-----<Interface DRC_ITEM_LIST>---------------------------------------
void DeleteAllItems()
{
if( m_vector )
{
for( unsigned i=0; i<m_vector->size(); ++i )
delete (*m_vector)[i];
m_vector->clear();
}
}
const DRC_ITEM* GetItem( int aIndex )
{
if( m_vector && (unsigned)aIndex < m_vector->size() )
{
const DRC_ITEM* item = (*m_vector)[aIndex];
return item;
}
return NULL;
}
void DeleteItem( int aIndex )
{
if( m_vector && (unsigned)aIndex < m_vector->size() )
{
delete (*m_vector)[aIndex];
m_vector->erase( m_vector->begin()+aIndex );
}
}
/**
* Function GetCount
* returns the number of items in the list.
*/
int GetCount()
{
if( m_vector )
{
return m_vector->size();
}
return 0;
}
//-----</Interface DRC_ITEM_LIST>--------------------------------------
};
/**
* Class DRCLISTBOX
* is used to display a DRC_ITEM_LIST.
*/
class DRCLISTBOX : public wxHtmlListBox
{
private:
DRC_ITEM_LIST* m_list; ///< wxHtmlListBox does not own the list, I do
public:
DRCLISTBOX( wxWindow* parent, wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = 0, const wxString choices[] = NULL, int unused = 0)
: wxHtmlListBox( parent, id, pos, size, style )
{
m_list = 0;
}
~DRCLISTBOX()
{
delete m_list; // I own it, I destroy it.
}
/**
* Function SetList
* sets the DRC_ITEM_LIST for this listbox. Ownership of the DRC_ITEM_LIST is
* transfered to this DRCLISTBOX.
* @param aList The DRC_ITEM_LIST* containing the DRC_ITEMs which will be
* displayed in the wxHtmlListBox
*/
void SetList( DRC_ITEM_LIST* aList )
{
delete m_list;
m_list = aList;
SetItemCount( aList->GetCount() );
Refresh();
}
/**
* Function GetItem
* returns a requested DRC_ITEM* or NULL.
*/
const DRC_ITEM* GetItem( int aIndex )
{
if( m_list )
{
return m_list->GetItem( aIndex );
}
return NULL;
}
/**
* Function OnGetItem
* returns the html text associated with the DRC_ITEM given by index 'n'.
* @param n An index into the list.
* @return wxString - the simple html text to show in the listbox.
*/
wxString OnGetItem( size_t n ) const
{
if( m_list )
{
const DRC_ITEM* item = m_list->GetItem( (int) n );
if( item )
return item->ShowHtml();
}
return wxString();
}
/**
* Function OnGetItem
* returns the html text associated with the given index 'n'.
* @param n An index into the list.
* @return wxString - the simple html text to show in the listbox.
*/
wxString OnGetItemMarkup( size_t n ) const
{
return OnGetItem( n );
}
/**
* Function DeleteElement
* will delete one of the items in the list.
* @param aIndex The index into the list to delete.
*/
void DeleteItem( int aIndex )
{
if( m_list )
{
int selection = GetSelection();
m_list->DeleteItem( aIndex );
int count = m_list->GetCount();
SetItemCount( count );
// if old selection >= new count
if( selection >= count )
SetSelection( count-1 ); // -1 is "no selection"
Refresh();
}
}
/**
* Function DeleteAllItems
* deletes all items in the list.
*/
void DeleteAllItems()
{
if( m_list )
{
m_list->DeleteAllItems();
SetItemCount(0);
SetSelection( -1 ); // -1 is no selection
Refresh();
}
}
};
#endif // _DIALOG_DRC_H_
This source diff could not be displayed because it is too large. You can view the blob instead.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_drc.h"
#include "dialog_drc_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_DRC_CONTROL_BASE::DIALOG_DRC_CONTROL_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* m_MainSizer;
m_MainSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* m_CommandSizer;
m_CommandSizer = new wxBoxSizer( wxHORIZONTAL );
wxStaticBoxSizer* sbSizerOptions;
sbSizerOptions = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Options") ), wxHORIZONTAL );
wxBoxSizer* bSizer7;
bSizer7 = new wxBoxSizer( wxVERTICAL );
wxFlexGridSizer* fgMinValuesSizer;
fgMinValuesSizer = new wxFlexGridSizer( 2, 4, 0, 0 );
fgMinValuesSizer->SetFlexibleDirection( wxBOTH );
fgMinValuesSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_ClearenceTitle = new wxStaticText( this, wxID_ANY, _("Clearance"), wxDefaultPosition, wxDefaultSize, 0 );
m_ClearenceTitle->Wrap( -1 );
fgMinValuesSizer->Add( m_ClearenceTitle, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT|wxALIGN_RIGHT, 5 );
m_SetClearance = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_SetClearance->SetToolTip( _("In the clearance units, enter the clearance distance") );
fgMinValuesSizer->Add( m_SetClearance, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_ViaMinTitle = new wxStaticText( this, wxID_ANY, _("Via Min Size"), wxDefaultPosition, wxDefaultSize, 0 );
m_ViaMinTitle->Wrap( -1 );
fgMinValuesSizer->Add( m_ViaMinTitle, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT|wxALIGN_RIGHT, 5 );
m_SetViaMinSizeCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_SetViaMinSizeCtrl->SetToolTip( _("In the clearance units, enter the clearance distance") );
fgMinValuesSizer->Add( m_SetViaMinSizeCtrl, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_TrackMinWidthTitle
= new wxStaticText( this, wxID_ANY, _("Track Min Width"), wxDefaultPosition, wxDefaultSize, 0 );
m_TrackMinWidthTitle
->Wrap( -1 );
fgMinValuesSizer->Add( m_TrackMinWidthTitle
, 0, wxALL|wxALIGN_RIGHT, 5 );
m_SetTrackMinWidthCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_SetTrackMinWidthCtrl->SetToolTip( _("In the clearance units, enter the clearance distance") );
fgMinValuesSizer->Add( m_SetTrackMinWidthCtrl, 0, wxALL, 5 );
m_MicroViaMinTitle = new wxStaticText( this, wxID_ANY, _("MicroVia Min Size"), wxDefaultPosition, wxDefaultSize, 0 );
m_MicroViaMinTitle->Wrap( -1 );
fgMinValuesSizer->Add( m_MicroViaMinTitle, 0, wxALL|wxALIGN_RIGHT, 5 );
m_SetMicroViakMinSizeCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_SetMicroViakMinSizeCtrl->SetToolTip( _("In the clearance units, enter the clearance distance") );
fgMinValuesSizer->Add( m_SetMicroViakMinSizeCtrl, 0, wxALL, 5 );
bSizer7->Add( fgMinValuesSizer, 1, wxEXPAND, 5 );
wxStaticBoxSizer* ReportFileSizer;
ReportFileSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Create Report File") ), wxHORIZONTAL );
m_CreateRptCtrl = new wxCheckBox( this, ID_CHECKBOX_RPT_FILE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_CreateRptCtrl->SetToolTip( _("Enable writing report to this file") );
ReportFileSizer->Add( m_CreateRptCtrl, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_RptFilenameCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_RptFilenameCtrl->SetToolTip( _("Enter the report filename") );
m_RptFilenameCtrl->SetMinSize( wxSize( 200,-1 ) );
ReportFileSizer->Add( m_RptFilenameCtrl, 1, wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
m_BrowseButton = new wxButton( this, ID_BUTTON_BROWSE_RPT_FILE, _("..."), wxDefaultPosition, wxDefaultSize, 0 );
ReportFileSizer->Add( m_BrowseButton, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
bSizer7->Add( ReportFileSizer, 1, wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT, 5 );
sbSizerOptions->Add( bSizer7, 1, wxEXPAND, 5 );
wxStaticBoxSizer* sbSizer3;
sbSizer3 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Include Tests For:") ), wxVERTICAL );
m_Pad2PadTestCtrl = new wxCheckBox( this, wxID_ANY, _("Pad to pad"), wxDefaultPosition, wxDefaultSize, 0 );
m_Pad2PadTestCtrl->SetValue(true);
m_Pad2PadTestCtrl->SetToolTip( _("Include tests for clearances between pad to pads") );
m_Pad2PadTestCtrl->SetHelpText( _("Include tests for clearances between pad to pads") );
sbSizer3->Add( m_Pad2PadTestCtrl, 0, wxALL, 5 );
m_ZonesTestCtrl = new wxCheckBox( this, wxID_ANY, _("Zones"), wxDefaultPosition, wxDefaultSize, 0 );
m_ZonesTestCtrl->SetToolTip( _("Include zones in clearance or unconnected tests") );
sbSizer3->Add( m_ZonesTestCtrl, 0, wxALL, 5 );
m_UnconnectedTestCtrl = new wxCheckBox( this, wxID_ANY, _("Unconnected pads"), wxDefaultPosition, wxDefaultSize, 0 );
m_UnconnectedTestCtrl->SetValue(true);
m_UnconnectedTestCtrl->SetToolTip( _("Find unconnected pads") );
sbSizer3->Add( m_UnconnectedTestCtrl, 0, wxALL, 5 );
sbSizerOptions->Add( sbSizer3, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_CommandSizer->Add( sbSizerOptions, 1, 0, 5 );
wxBoxSizer* bSizer11;
bSizer11 = new wxBoxSizer( wxVERTICAL );
m_buttonRunDRC = new wxButton( this, ID_STARTDRC, _("Start DRC"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonRunDRC->SetDefault();
m_buttonRunDRC->SetToolTip( _("Start the Design Rule Checker") );
bSizer11->Add( m_buttonRunDRC, 0, wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
m_buttonListUnconnected = new wxButton( this, ID_LIST_UNCONNECTED, _("List Unconnected"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonListUnconnected->SetToolTip( _("List unconnected pads or tracks") );
bSizer11->Add( m_buttonListUnconnected, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
m_DeleteAllButton = new wxButton( this, ID_DELETE_ALL, _("Delete All Markers"), wxDefaultPosition, wxDefaultSize, 0 );
m_DeleteAllButton->SetToolTip( _("Delete every marker") );
bSizer11->Add( m_DeleteAllButton, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
m_DeleteCurrentMarkerButton = new wxButton( this, wxID_ANY, _("Delete Current Marker"), wxDefaultPosition, wxDefaultSize, 0 );
m_DeleteCurrentMarkerButton->SetToolTip( _("Delete the marker selected in the listBox below") );
bSizer11->Add( m_DeleteCurrentMarkerButton, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxALL, 5 );
m_CommandSizer->Add( bSizer11, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_MainSizer->Add( m_CommandSizer, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
m_staticTextErrMsg = new wxStaticText( this, wxID_ANY, _("Error Messages:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextErrMsg->Wrap( -1 );
m_MainSizer->Add( m_staticTextErrMsg, 0, wxALL, 5 );
m_Notebook = new wxNotebook( this, ID_NOTEBOOK1, wxDefaultPosition, wxDefaultSize, 0 );
m_panelClearanceListBox = new wxPanel( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizeClearanceBox;
bSizeClearanceBox = new wxBoxSizer( wxVERTICAL );
m_ClearanceListBox = new DRCLISTBOX( m_panelClearanceListBox, ID_CLEARANCE_LIST, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
m_ClearanceListBox->SetToolTip( _("MARKERs, double click any to go there in PCB, right click for popup menu") );
m_ClearanceListBox->SetMinSize( wxSize( 450,300 ) );
bSizeClearanceBox->Add( m_ClearanceListBox, 1, wxALL|wxEXPAND, 5 );
m_panelClearanceListBox->SetSizer( bSizeClearanceBox );
m_panelClearanceListBox->Layout();
bSizeClearanceBox->Fit( m_panelClearanceListBox );
m_Notebook->AddPage( m_panelClearanceListBox, _("Distance Problem Markers"), true );
m_panelUnconnectedBox = new wxPanel( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizerUnconnectedBox;
bSizerUnconnectedBox = new wxBoxSizer( wxVERTICAL );
m_UnconnectedListBox = new DRCLISTBOX( m_panelUnconnectedBox, ID_UNCONNECTED_LIST, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
m_UnconnectedListBox->SetToolTip( _("A list of unconnected pads, right click for popup menu") );
bSizerUnconnectedBox->Add( m_UnconnectedListBox, 1, wxALL|wxEXPAND, 5 );
m_panelUnconnectedBox->SetSizer( bSizerUnconnectedBox );
m_panelUnconnectedBox->Layout();
bSizerUnconnectedBox->Fit( m_panelUnconnectedBox );
m_Notebook->AddPage( m_panelUnconnectedBox, _("Unconnected"), false );
m_MainSizer->Add( m_Notebook, 1, wxEXPAND | wxALL, 5 );
m_sdbSizer1 = new wxStdDialogButtonSizer();
m_sdbSizer1OK = new wxButton( this, wxID_OK );
m_sdbSizer1->AddButton( m_sdbSizer1OK );
m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
m_sdbSizer1->Realize();
m_MainSizer->Add( m_sdbSizer1, 0, wxALIGN_RIGHT|wxALL, 5 );
this->SetSizer( m_MainSizer );
this->Layout();
// Connect Events
m_CreateRptCtrl->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnReportCheckBoxClicked ), NULL, this );
m_BrowseButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnButtonBrowseRptFileClick ), NULL, this );
m_buttonRunDRC->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnStartdrcClick ), NULL, this );
m_buttonListUnconnected->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnListUnconnectedClick ), NULL, this );
m_DeleteAllButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnDeleteAllClick ), NULL, this );
m_DeleteCurrentMarkerButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnDeleteOneClick ), NULL, this );
m_ClearanceListBox->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( DIALOG_DRC_CONTROL_BASE::OnLeftDClickClearance ), NULL, this );
m_ClearanceListBox->Connect( wxEVT_RIGHT_UP, wxMouseEventHandler( DIALOG_DRC_CONTROL_BASE::OnRightUpClearance ), NULL, this );
m_UnconnectedListBox->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( DIALOG_DRC_CONTROL_BASE::OnLeftDClickUnconnected ), NULL, this );
m_UnconnectedListBox->Connect( wxEVT_RIGHT_UP, wxMouseEventHandler( DIALOG_DRC_CONTROL_BASE::OnRightUpUnconnected ), NULL, this );
m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnCancelClick ), NULL, this );
m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnOkClick ), NULL, this );
}
DIALOG_DRC_CONTROL_BASE::~DIALOG_DRC_CONTROL_BASE()
{
// Disconnect Events
m_CreateRptCtrl->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnReportCheckBoxClicked ), NULL, this );
m_BrowseButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnButtonBrowseRptFileClick ), NULL, this );
m_buttonRunDRC->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnStartdrcClick ), NULL, this );
m_buttonListUnconnected->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnListUnconnectedClick ), NULL, this );
m_DeleteAllButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnDeleteAllClick ), NULL, this );
m_DeleteCurrentMarkerButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnDeleteOneClick ), NULL, this );
m_ClearanceListBox->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( DIALOG_DRC_CONTROL_BASE::OnLeftDClickClearance ), NULL, this );
m_ClearanceListBox->Disconnect( wxEVT_RIGHT_UP, wxMouseEventHandler( DIALOG_DRC_CONTROL_BASE::OnRightUpClearance ), NULL, this );
m_UnconnectedListBox->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( DIALOG_DRC_CONTROL_BASE::OnLeftDClickUnconnected ), NULL, this );
m_UnconnectedListBox->Disconnect( wxEVT_RIGHT_UP, wxMouseEventHandler( DIALOG_DRC_CONTROL_BASE::OnRightUpUnconnected ), NULL, this );
m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnCancelClick ), NULL, this );
m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnOkClick ), NULL, this );
}
This source diff could not be displayed because it is too large. You can view the blob instead.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_drc_base__
#define __dialog_drc_base__
#include <wx/intl.h>
class DRCLISTBOX;
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/checkbox.h>
#include <wx/button.h>
#include <wx/statbox.h>
#include <wx/listbox.h>
#include <wx/panel.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/notebook.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
#define ID_CHECKBOX_RPT_FILE 1000
#define ID_BUTTON_BROWSE_RPT_FILE 1001
#define ID_STARTDRC 1002
#define ID_LIST_UNCONNECTED 1003
#define ID_DELETE_ALL 1004
#define ID_NOTEBOOK1 1005
#define ID_CLEARANCE_LIST 1006
#define ID_UNCONNECTED_LIST 1007
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_DRC_CONTROL_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_DRC_CONTROL_BASE : public wxDialog
{
private:
protected:
wxStaticText* m_ClearenceTitle;
wxStaticText* m_ViaMinTitle;
wxStaticText* m_TrackMinWidthTitle
;
wxStaticText* m_MicroViaMinTitle;
wxButton* m_BrowseButton;
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;
wxCheckBox* m_Pad2PadTestCtrl;
wxCheckBox* m_ZonesTestCtrl;
wxCheckBox* m_UnconnectedTestCtrl;
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( 678,508 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_DRC_CONTROL_BASE();
};
#endif //__dialog_drc_base__
......@@ -41,7 +41,7 @@
#include "drc_stuff.h"
#include "dialog_drc.cpp"
#include "dialog_drc.h"
/******************************************************/
......@@ -56,13 +56,19 @@ void DRC::ShowDialog()
{
if( !m_ui )
{
m_ui = new DrcDialog( this, m_mainWindow );
m_ui = new DIALOG_DRC_CONTROL( this, m_mainWindow );
updatePointers();
// copy data retained in this DRC object into the m_ui DrcPanel:
PutValueInLocalUnits( *m_ui->m_SetClearance, g_DesignSettings.m_TrackClearence,
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,
m_mainWindow->m_InternalUnits );;
PutValueInLocalUnits( *m_ui->m_SetMicroViakMinSizeCtrl, g_DesignSettings.m_MicroViasMinSize,
m_mainWindow->m_InternalUnits );;
m_ui->m_Pad2PadTestCtrl->SetValue( m_doPad2PadTest );
m_ui->m_ZonesTestCtrl->SetValue( m_doZonesTest );
......@@ -187,6 +193,11 @@ int DRC::Drc( ZONE_CONTAINER* aArea, int CornerIndex )
}
/**
* Function RunTests
* will actually run all the tests specified with a previous call to
* SetSettings()
*/
void DRC::RunTests()
{
// Ensure ratsnest is up to date:
......@@ -521,6 +532,26 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
/* Phase 0 : Test vias : */
if( aRefSeg->Type() == TYPE_VIA )
{
// test if the via size is bigger thn min size allowed
if( aRefSeg->Shape() == VIA_MICROVIA )
{
if(aRefSeg->m_Width < g_DesignSettings.m_MicroViasMinSize)
{
m_currentMarker = fillMarker( aRefSeg, NULL,
DRCE_TOO_SMALL_MICROVIA, m_currentMarker );
return false;
}
}
else
{
if(aRefSeg->m_Width < g_DesignSettings.m_ViasMinSize)
{
m_currentMarker = fillMarker( aRefSeg, NULL,
DRCE_TOO_SMALL_VIA, m_currentMarker );
return false;
}
}
// test if via's hole is bigger than its diameter
// This test is necessary since the via hole size and width can be modified
// and an default via hole can be bigger than some vias sizes
......@@ -555,6 +586,15 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
}
}
}
else // This is a track segment
{
if(aRefSeg->m_Width < g_DesignSettings.m_TrackMinWidth)
{
m_currentMarker = fillMarker( aRefSeg, NULL,
DRCE_TOO_SMALL_TRACK_WIDTH, m_currentMarker );
return false;
}
}
// for a non horizontal or vertical segment Compute the segment angle
// in tenths of degrees and its length
......
......@@ -60,6 +60,9 @@
#define DRCE_NON_EXISTANT_NET_FOR_ZONE_OUTLINE 24 ///< copper area outline has an incorrect netcode due to a netname not found
#define DRCE_HOLE_NEAR_PAD 25 ///< hole too close to pad
#define DRCE_HOLE_NEAR_TRACK 26 ///< hole too close to track
#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
/**
* Class DRC_ITEM
......@@ -257,7 +260,7 @@ public:
class WinEDA_DrawPanel;
class MARKER;
class DrcDialog;
class DIALOG_DRC_CONTROL;
/**
......@@ -318,7 +321,7 @@ typedef std::vector<DRC_ITEM*> DRC_LIST;
*/
class DRC
{
friend class DrcDialog;
friend class DIALOG_DRC_CONTROL;
private:
......@@ -353,7 +356,7 @@ private:
WinEDA_PcbFrame* m_mainWindow;
WinEDA_DrawPanel* m_drawPanel;
BOARD* m_pcb;
DrcDialog* m_ui;
DIALOG_DRC_CONTROL* m_ui;
DRC_LIST m_unconnected; ///< list of unconnected pads, as DRC_ITEMs
......
......@@ -355,6 +355,12 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum )
continue;
}
if( stricmp( Line, "TrackMinWidth" ) == 0 )
{
g_DesignSettings.m_TrackMinWidth = atoi( data );
continue;
}
if( stricmp( Line, "ZoneClearence" ) == 0 )
{
g_Zone_Default_Setting.m_ZoneClearance = atoi( data );
......@@ -387,12 +393,24 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum )
continue;
}
if( stricmp( Line, "ViaMinSize" ) == 0 )
{
g_DesignSettings.m_ViasMinSize = atoi( data );
continue;
}
if( stricmp( Line, "MicroViaSize" ) == 0 )
{
g_DesignSettings.m_CurrentMicroViaSize = atoi( data );
continue;
}
if( stricmp( Line, "MicroViaMinSize" ) == 0 )
{
g_DesignSettings.m_MicroViasMinSize = atoi( data );
continue;
}
if( stricmp( Line, "ViaSizeHistory" ) == 0 )
{
int tmp = atoi( data );
......@@ -518,12 +536,14 @@ static int WriteSetup( FILE* aFile, WinEDA_BasePcbFrame* aFrame, BOARD* aBoard )
fprintf( aFile, "TrackClearence %d\n", g_DesignSettings.m_TrackClearence );
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, "ViaAltDrill %d\n", g_DesignSettings.m_ViaDrillCustomValue );
fprintf( aFile, "ViaMinSize %d\n", g_DesignSettings.m_ViasMinSize );
for( ii = 0; ii < HISTORY_NUMBER; ii++ )
{
......@@ -535,6 +555,7 @@ static int WriteSetup( FILE* aFile, WinEDA_BasePcbFrame* aFrame, BOARD* aBoard )
fprintf( aFile, "MicroViaSize %d\n", g_DesignSettings.m_CurrentMicroViaSize);
fprintf( aFile, "MicroViaDrill %d\n", g_DesignSettings.m_MicroViaDrill);
fprintf( aFile, "MicroViasAllowed %d\n", g_DesignSettings.m_MicroViasAllowed);
fprintf( aFile, "MicroViaMinSize %d\n" , g_DesignSettings.m_MicroViasMinSize );
fprintf( aFile, "TextPcbWidth %d\n", g_DesignSettings.m_PcbTextWidth );
fprintf( aFile, "TextPcbSize %d %d\n",
......
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