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 ...@@ -4,6 +4,10 @@ KiCad ChangeLog 2009
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. 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> 2009-june-11 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================ ================================================================================
...@@ -22,7 +26,7 @@ email address. ...@@ -22,7 +26,7 @@ email address.
used for items that have a line thickness = 0, used for items that have a line thickness = 0,
and NOT the minimum thickness. and NOT the minimum thickness.
reasons: 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) (what you plot is NOT what you see)
- small texts are not readable with an minimum thickness value - small texts are not readable with an minimum thickness value
that could be good for others items. that could be good for others items.
......
...@@ -121,7 +121,8 @@ static const char* GetHersheyShapeDescription( int AsciiCode ) ...@@ -121,7 +121,8 @@ static const char* GetHersheyShapeDescription( int AsciiCode )
} }
#endif #endif
AsciiCode &= 0x7F; if ( AsciiCode > 0x7F )
AsciiCode = '?';
if( AsciiCode < 32 ) if( AsciiCode < 32 )
AsciiCode = 32; /* Clamp control chars */ AsciiCode = 32; /* Clamp control chars */
AsciiCode -= 32; AsciiCode -= 32;
...@@ -244,6 +245,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, ...@@ -244,6 +245,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
int overbars; // Number of ~ seen int overbars; // Number of ~ seen
int overbar_italic_comp; // Italic compensation for overbar int overbar_italic_comp; // Italic compensation for overbar
#define BUF_SIZE 100 #define BUF_SIZE 100
wxPoint coord[BUF_SIZE + 1]; // Buffer coordinate used to draw polylines (one char shape) wxPoint coord[BUF_SIZE + 1]; // Buffer coordinate used to draw polylines (one char shape)
bool sketch_mode = false; bool sketch_mode = false;
......
...@@ -68,6 +68,7 @@ void WinEDA_CvpcbFrame::CreateScreenCmp() ...@@ -68,6 +68,7 @@ void WinEDA_CvpcbFrame::CreateScreenCmp()
DrawFrame->GetBoard()->m_Modules.PushBack( mod ); DrawFrame->GetBoard()->m_Modules.PushBack( mod );
DrawFrame->Zoom_Automatique( FALSE ); DrawFrame->Zoom_Automatique( FALSE );
DrawFrame->UpdateStatusBar(); /* Display new cursor coordinates and zoom value */
if( DrawFrame->m_Draw3DFrame ) if( DrawFrame->m_Draw3DFrame )
DrawFrame->m_Draw3DFrame->NewDisplay(); DrawFrame->m_Draw3DFrame->NewDisplay();
} }
......
...@@ -22,8 +22,9 @@ ...@@ -22,8 +22,9 @@
LibDrawText::LibDrawText() : LibDrawText::LibDrawText(EDA_LibComponentStruct * aParent) :
LibEDA_BaseStruct( COMPONENT_GRAPHIC_TEXT_DRAW_TYPE ), EDA_TextStruct() LibEDA_BaseStruct( COMPONENT_GRAPHIC_TEXT_DRAW_TYPE, aParent ),
EDA_TextStruct()
{ {
m_Size = wxSize( 50, 50 ); m_Size = wxSize( 50, 50 );
m_typeName = _( "Text" ); m_typeName = _( "Text" );
...@@ -169,7 +170,7 @@ bool LibDrawText::HitTest( wxPoint aPosRef, int aThreshold, const int aTransMat[ ...@@ -169,7 +170,7 @@ bool LibDrawText::HitTest( wxPoint aPosRef, int aThreshold, const int aTransMat[
LibDrawText* LibDrawText::GenCopy() LibDrawText* LibDrawText::GenCopy()
{ {
LibDrawText* newitem = new LibDrawText(); LibDrawText* newitem = new LibDrawText(NULL);
newitem->m_Pos = m_Pos; newitem->m_Pos = m_Pos;
newitem->m_Orient = m_Orient; newitem->m_Orient = m_Orient;
......
...@@ -162,6 +162,7 @@ LibCmpEntry::LibCmpEntry( LibrEntryType CmpType, const wxChar* CmpName ) : ...@@ -162,6 +162,7 @@ LibCmpEntry::LibCmpEntry( LibrEntryType CmpType, const wxChar* CmpName ) :
{ {
Type = CmpType; Type = CmpType;
m_Name.m_FieldId = VALUE; m_Name.m_FieldId = VALUE;
m_Name.SetParent( this );
if( CmpName ) if( CmpName )
m_Name.m_Text = CmpName; m_Name.m_Text = CmpName;
} }
...@@ -220,6 +221,7 @@ EDA_LibComponentStruct:: EDA_LibComponentStruct( const wxChar* CmpName ) : ...@@ -220,6 +221,7 @@ EDA_LibComponentStruct:: EDA_LibComponentStruct( const wxChar* CmpName ) :
m_DrawPinNum = 1; m_DrawPinNum = 1;
m_DrawPinName = 1; m_DrawPinName = 1;
m_Prefix.m_FieldId = REFERENCE; m_Prefix.m_FieldId = REFERENCE;
m_Prefix.SetParent( this );
} }
...@@ -478,32 +480,32 @@ bool EDA_LibComponentStruct::LoadDrawEntries( FILE* f, char* line, ...@@ -478,32 +480,32 @@ bool EDA_LibComponentStruct::LoadDrawEntries( FILE* f, char* line,
switch( line[0] ) switch( line[0] )
{ {
case 'A': /* Arc */ case 'A': /* Arc */
newEntry = ( LibEDA_BaseStruct* ) new LibDrawArc(); newEntry = ( LibEDA_BaseStruct* ) new LibDrawArc(this);
entryLoaded = newEntry->Load( line, errorMsg ); entryLoaded = newEntry->Load( line, errorMsg );
break; break;
case 'C': /* Circle */ case 'C': /* Circle */
newEntry = ( LibEDA_BaseStruct* ) new LibDrawCircle(); newEntry = ( LibEDA_BaseStruct* ) new LibDrawCircle(this);
entryLoaded = newEntry->Load( line, errorMsg ); entryLoaded = newEntry->Load( line, errorMsg );
break; break;
case 'T': /* Text */ case 'T': /* Text */
newEntry = ( LibEDA_BaseStruct* ) new LibDrawText(); newEntry = ( LibEDA_BaseStruct* ) new LibDrawText(this);
entryLoaded = newEntry->Load( line, errorMsg ); entryLoaded = newEntry->Load( line, errorMsg );
break; break;
case 'S': /* Square */ case 'S': /* Square */
newEntry = ( LibEDA_BaseStruct* ) new LibDrawSquare(); newEntry = ( LibEDA_BaseStruct* ) new LibDrawSquare(this);
entryLoaded = newEntry->Load( line, errorMsg ); entryLoaded = newEntry->Load( line, errorMsg );
break; break;
case 'X': /* Pin Description */ case 'X': /* Pin Description */
newEntry = ( LibEDA_BaseStruct* ) new LibDrawPin(); newEntry = ( LibEDA_BaseStruct* ) new LibDrawPin(this);
entryLoaded = newEntry->Load( line, errorMsg ); entryLoaded = newEntry->Load( line, errorMsg );
break; break;
case 'P': /* Polyline */ case 'P': /* Polyline */
newEntry = ( LibEDA_BaseStruct* ) new LibDrawPolyline(); newEntry = ( LibEDA_BaseStruct* ) new LibDrawPolyline(this);
entryLoaded = newEntry->Load( line, errorMsg ); entryLoaded = newEntry->Load( line, errorMsg );
break; break;
...@@ -568,7 +570,7 @@ bool EDA_LibComponentStruct::LoadAliases( char* line, wxString& errorMsg ) ...@@ -568,7 +570,7 @@ bool EDA_LibComponentStruct::LoadAliases( char* line, wxString& errorMsg )
bool EDA_LibComponentStruct::LoadField( 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 ) ) if ( !field->Load( line, errorMsg ) )
{ {
...@@ -704,7 +706,7 @@ void EDA_LibComponentStruct::SetFields( const std::vector <LibDrawField> aFields ...@@ -704,7 +706,7 @@ void EDA_LibComponentStruct::SetFields( const std::vector <LibDrawField> aFields
create = TRUE; create = TRUE;
if( create ) if( create )
{ {
LibDrawField*Field = new LibDrawField( ii ); LibDrawField*Field = new LibDrawField( this, ii );
aFields[ii].Copy( Field ); aFields[ii].Copy( Field );
CurrentLibEntry->m_Fields.PushBack( Field ); CurrentLibEntry->m_Fields.PushBack( Field );
} }
...@@ -719,6 +721,7 @@ void EDA_LibComponentStruct::SetFields( const std::vector <LibDrawField> aFields ...@@ -719,6 +721,7 @@ void EDA_LibComponentStruct::SetFields( const std::vector <LibDrawField> aFields
for( LibDrawField* Field = CurrentLibEntry->m_Fields; Field; for( LibDrawField* Field = CurrentLibEntry->m_Fields; Field;
Field = Field->Next() ) Field = Field->Next() )
{ {
Field->SetParent( this );
if( Field->m_FieldId >= FIELD1 ) if( Field->m_FieldId >= FIELD1 )
{ {
if( Field->m_Text.IsEmpty() ) if( Field->m_Text.IsEmpty() )
......
...@@ -38,13 +38,19 @@ ...@@ -38,13 +38,19 @@
* *
* others = free fields * others = free fields
*/ */
LibDrawField::LibDrawField( int idfield ) : LibDrawField::LibDrawField(EDA_LibComponentStruct * aParent, int idfield ) :
LibEDA_BaseStruct( COMPONENT_FIELD_DRAW_TYPE ) LibEDA_BaseStruct( COMPONENT_FIELD_DRAW_TYPE, aParent )
{ {
m_FieldId = idfield; m_FieldId = idfield;
m_Size.x = m_Size.y = DEFAULT_SIZE_TEXT; 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() LibDrawField::~LibDrawField()
{ {
...@@ -318,6 +324,7 @@ LibDrawField* LibDrawField::GenCopy() ...@@ -318,6 +324,7 @@ LibDrawField* LibDrawField::GenCopy()
*/ */
void LibDrawField::Copy( LibDrawField* Target ) const void LibDrawField::Copy( LibDrawField* Target ) const
{ {
Target->SetParent( m_Parent );
Target->m_Pos = m_Pos; Target->m_Pos = m_Pos;
Target->m_Size = m_Size; Target->m_Size = m_Size;
Target->m_Width = m_Width; Target->m_Width = m_Width;
......
...@@ -35,6 +35,7 @@ public: ...@@ -35,6 +35,7 @@ public:
LibDrawField( int idfield = 2 ); LibDrawField( int idfield = 2 );
LibDrawField( EDA_LibComponentStruct * aParent, int idfield = 2 );
~LibDrawField(); ~LibDrawField();
virtual wxString GetClass() const virtual wxString GetClass() const
{ {
...@@ -96,6 +97,7 @@ public: ...@@ -96,6 +97,7 @@ public:
m_Bold = field.m_Bold; m_Bold = field.m_Bold;
m_HJustify = field.m_HJustify; m_HJustify = field.m_HJustify;
m_VJustify = field.m_VJustify; m_VJustify = field.m_VJustify;
m_Parent = field.m_Parent;
} }
}; };
......
...@@ -30,7 +30,8 @@ const wxChar* MsgPinElectricType[] = ...@@ -30,7 +30,8 @@ const wxChar* MsgPinElectricType[] =
wxT( "?????" ) 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_PinLen = 300; /* default Pin len */
m_Orient = PIN_RIGHT; /* Pin oprient: Up, Down, Left, Right */ m_Orient = PIN_RIGHT; /* Pin oprient: Up, Down, Left, Right */
...@@ -1005,7 +1006,7 @@ void LibDrawPin::SetPinNumFromString( wxString& buffer ) ...@@ -1005,7 +1006,7 @@ void LibDrawPin::SetPinNumFromString( wxString& buffer )
LibDrawPin* LibDrawPin::GenCopy() LibDrawPin* LibDrawPin::GenCopy()
/*************************************/ /*************************************/
{ {
LibDrawPin* newpin = new LibDrawPin(); LibDrawPin* newpin = new LibDrawPin( GetParent() );
newpin->m_Pos = m_Pos; newpin->m_Pos = m_Pos;
newpin->m_PinLen = m_PinLen; newpin->m_PinLen = m_PinLen;
......
This diff is collapsed.
...@@ -133,7 +133,7 @@ public: ...@@ -133,7 +133,7 @@ public:
} }
LibEDA_BaseStruct( KICAD_T struct_type ); LibEDA_BaseStruct( KICAD_T struct_type, EDA_LibComponentStruct * aParent );
virtual ~LibEDA_BaseStruct() { } virtual ~LibEDA_BaseStruct() { }
/** Function Draw (virtual pure) /** Function Draw (virtual pure)
...@@ -166,6 +166,10 @@ public: ...@@ -166,6 +166,10 @@ public:
virtual bool Save( FILE* aFile ) const = 0; virtual bool Save( FILE* aFile ) const = 0;
virtual bool Load( char* line, wxString& errorMsg ) = 0; virtual bool Load( char* line, wxString& errorMsg ) = 0;
EDA_LibComponentStruct * GetParent()
{
return (EDA_LibComponentStruct *)m_Parent;
}
/** /**
* Function HitTest * Function HitTest
...@@ -226,7 +230,7 @@ wxPoint m_Pos; /* Position or centre (Arc and Circle) or start ...@@ -226,7 +230,7 @@ wxPoint m_Pos; /* Position or centre (Arc and Circle) or start
int m_Width; /* Line width */ int m_Width; /* Line width */
public: public:
LibDrawPin(); LibDrawPin(EDA_LibComponentStruct * aParent);
~LibDrawPin() { } ~LibDrawPin() { }
LibDrawPin* Next() const { return (LibDrawPin*) Pnext; } LibDrawPin* Next() const { return (LibDrawPin*) Pnext; }
...@@ -311,7 +315,7 @@ public: ...@@ -311,7 +315,7 @@ public:
int m_Width; /* Line width */ int m_Width; /* Line width */
public: public:
LibDrawArc(); LibDrawArc(EDA_LibComponentStruct * aParent);
~LibDrawArc() { } ~LibDrawArc() { }
virtual wxString GetClass() const virtual wxString GetClass() const
{ {
...@@ -368,7 +372,7 @@ public: ...@@ -368,7 +372,7 @@ public:
int m_Width; /* Line width */ int m_Width; /* Line width */
public: public:
LibDrawCircle(); LibDrawCircle(EDA_LibComponentStruct * aParent);
~LibDrawCircle() { } ~LibDrawCircle() { }
virtual wxString GetClass() const virtual wxString GetClass() const
{ {
...@@ -422,7 +426,7 @@ public: ...@@ -422,7 +426,7 @@ public:
class LibDrawText : public LibEDA_BaseStruct, public EDA_TextStruct class LibDrawText : public LibEDA_BaseStruct, public EDA_TextStruct
{ {
public: public:
LibDrawText(); LibDrawText(EDA_LibComponentStruct * aParent);
~LibDrawText() { } ~LibDrawText() { }
virtual wxString GetClass() const virtual wxString GetClass() const
{ {
...@@ -489,7 +493,7 @@ public: ...@@ -489,7 +493,7 @@ public:
int m_Width; /* Line width */ int m_Width; /* Line width */
public: public:
LibDrawSquare(); LibDrawSquare(EDA_LibComponentStruct * aParent);
~LibDrawSquare() { } ~LibDrawSquare() { }
virtual wxString GetClass() const virtual wxString GetClass() const
{ {
...@@ -545,7 +549,7 @@ public: ...@@ -545,7 +549,7 @@ public:
int m_Width; /* Line width */ int m_Width; /* Line width */
public: public:
LibDrawSegment(); LibDrawSegment(EDA_LibComponentStruct * aParent);
~LibDrawSegment() { } ~LibDrawSegment() { }
virtual wxString GetClass() const virtual wxString GetClass() const
{ {
...@@ -599,7 +603,7 @@ public: ...@@ -599,7 +603,7 @@ public:
std::vector<wxPoint> m_PolyPoints; // list of points (>= 2) std::vector<wxPoint> m_PolyPoints; // list of points (>= 2)
public: public:
LibDrawPolyline(); LibDrawPolyline(EDA_LibComponentStruct * aParent);
~LibDrawPolyline() { } ~LibDrawPolyline() { }
virtual wxString GetClass() const virtual wxString GetClass() const
......
...@@ -42,13 +42,12 @@ void CreateDummyCmp() ...@@ -42,13 +42,12 @@ void CreateDummyCmp()
{ {
DummyCmp = new EDA_LibComponentStruct( NULL ); DummyCmp = new EDA_LibComponentStruct( NULL );
LibDrawSquare* Square = new LibDrawSquare(); LibDrawSquare* Square = new LibDrawSquare(DummyCmp);
Square->m_Pos = wxPoint( -200, 200 ); Square->m_Pos = wxPoint( -200, 200 );
Square->m_End = 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_Size.x = Text->m_Size.y = 150;
Text->m_Text = wxT( "??" ); Text->m_Text = wxT( "??" );
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#include "protos.h" #include "protos.h"
/* Local Functions */ /* Local Functions */
static LibEDA_BaseStruct* GetDrawEntry( WinEDA_DrawFrame* frame, FILE* f, static LibEDA_BaseStruct* ReadDrawEntryItemDescription( EDA_LibComponentStruct* aParent, FILE* f,
char* Line, int* LineNum ); char* Line, int* LineNum );
static bool AddAliasNames( EDA_LibComponentStruct* LibEntry, char* line ); static bool AddAliasNames( EDA_LibComponentStruct* LibEntry, char* line );
static void InsertAlias( PriorQue** PQ, EDA_LibComponentStruct* LibEntry, static void InsertAlias( PriorQue** PQ, EDA_LibComponentStruct* LibEntry,
...@@ -493,7 +493,7 @@ EDA_LibComponentStruct* Read_Component_Definition( WinEDA_DrawFrame* frame, ...@@ -493,7 +493,7 @@ EDA_LibComponentStruct* Read_Component_Definition( WinEDA_DrawFrame* frame,
} }
else if( strcmp( p, "DRAW" ) == 0 ) 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 ) else if( strncmp( p, "ALIAS", 5 ) == 0 )
{ {
...@@ -538,7 +538,7 @@ EDA_LibComponentStruct* Read_Component_Definition( WinEDA_DrawFrame* frame, ...@@ -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). * * 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) char* Line, int* LineNum)
{ {
wxString MsgLine, errorMsg; wxString MsgLine, errorMsg;
...@@ -551,7 +551,7 @@ static LibEDA_BaseStruct* GetDrawEntry (WinEDA_DrawFrame* frame, FILE* f, ...@@ -551,7 +551,7 @@ static LibEDA_BaseStruct* GetDrawEntry (WinEDA_DrawFrame* frame, FILE* f,
{ {
if( GetLine( f, Line, LineNum, 1024 ) == NULL ) if( GetLine( f, Line, LineNum, 1024 ) == NULL )
{ {
DisplayError( frame, wxT( "File ended prematurely" ) ); DisplayError( NULL, wxT( "File ended prematurely" ) );
return Head; return Head;
} }
...@@ -565,39 +565,39 @@ static LibEDA_BaseStruct* GetDrawEntry (WinEDA_DrawFrame* frame, FILE* f, ...@@ -565,39 +565,39 @@ static LibEDA_BaseStruct* GetDrawEntry (WinEDA_DrawFrame* frame, FILE* f,
switch( Line[0] ) switch( Line[0] )
{ {
case 'A': /* Arc */ case 'A': /* Arc */
New = ( LibEDA_BaseStruct* ) new LibDrawArc(); New = ( LibEDA_BaseStruct* ) new LibDrawArc(aParent);
entryLoaded = New->Load( Line, errorMsg ); entryLoaded = New->Load( Line, errorMsg );
break; break;
case 'C': /* Circle */ case 'C': /* Circle */
New = ( LibEDA_BaseStruct* ) new LibDrawCircle(); New = ( LibEDA_BaseStruct* ) new LibDrawCircle(aParent);
entryLoaded = New->Load( Line, errorMsg ); entryLoaded = New->Load( Line, errorMsg );
break; break;
case 'T': /* Text */ case 'T': /* Text */
New = ( LibEDA_BaseStruct* ) new LibDrawText(); New = ( LibEDA_BaseStruct* ) new LibDrawText(aParent);
entryLoaded = New->Load( Line, errorMsg ); entryLoaded = New->Load( Line, errorMsg );
break; break;
case 'S': /* Square */ case 'S': /* Square */
New = ( LibEDA_BaseStruct* ) new LibDrawSquare(); New = ( LibEDA_BaseStruct* ) new LibDrawSquare(aParent);
entryLoaded = New->Load( Line, errorMsg ); entryLoaded = New->Load( Line, errorMsg );
break; break;
case 'X': /* Pin Description */ case 'X': /* Pin Description */
New = ( LibEDA_BaseStruct* ) new LibDrawPin(); New = ( LibEDA_BaseStruct* ) new LibDrawPin(aParent);
entryLoaded = New->Load( Line, errorMsg ); entryLoaded = New->Load( Line, errorMsg );
break; break;
case 'P': /* Polyline */ case 'P': /* Polyline */
New = ( LibEDA_BaseStruct* ) new LibDrawPolyline(); New = ( LibEDA_BaseStruct* ) new LibDrawPolyline(aParent);
entryLoaded = New->Load( Line, errorMsg ); entryLoaded = New->Load( Line, errorMsg );
break; break;
default: default:
MsgLine.Printf( wxT( "Undefined DRAW command in line %d\n%s, aborted." ), MsgLine.Printf( wxT( "Undefined DRAW command in line %d\n%s, aborted." ),
*LineNum, Line ); *LineNum, Line );
DisplayError( frame, MsgLine ); DisplayError( NULL, MsgLine );
return Head; return Head;
} }
...@@ -606,7 +606,7 @@ static LibEDA_BaseStruct* GetDrawEntry (WinEDA_DrawFrame* frame, FILE* f, ...@@ -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." ), MsgLine.Printf( wxT( "Error <%s %s> in DRAW command %c in line %d, aborted." ),
errorMsg.c_str(), MsgLine.c_str(), errorMsg.c_str(), MsgLine.c_str(),
Line[0], *LineNum ); Line[0], *LineNum );
DisplayError( frame, MsgLine ); DisplayError( NULL, MsgLine );
SAFE_DELETE( New ); SAFE_DELETE( New );
/* FLush till end of draw: */ /* FLush till end of draw: */
...@@ -614,7 +614,7 @@ static LibEDA_BaseStruct* GetDrawEntry (WinEDA_DrawFrame* frame, FILE* f, ...@@ -614,7 +614,7 @@ static LibEDA_BaseStruct* GetDrawEntry (WinEDA_DrawFrame* frame, FILE* f,
{ {
if( GetLine( f, Line, LineNum, 1024 ) == NULL ) if( GetLine( f, Line, LineNum, 1024 ) == NULL )
{ {
DisplayError( frame, wxT( "File ended prematurely" ) ); DisplayError( NULL, wxT( "File ended prematurely" ) );
return Head; return Head;
} }
} while( strncmp( Line, "ENDDRAW", 7 ) != 0 ); } while( strncmp( Line, "ENDDRAW", 7 ) != 0 );
......
...@@ -111,7 +111,7 @@ void WinEDA_LibeditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -111,7 +111,7 @@ void WinEDA_LibeditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
case ID_LIBEDIT_BODY_TEXT_BUTT: case ID_LIBEDIT_BODY_TEXT_BUTT:
if( CurrentDrawItem == NULL || CurrentDrawItem->m_Flags == 0 ) if( CurrentDrawItem == NULL || CurrentDrawItem->m_Flags == 0 )
{ {
CurrentDrawItem = CreateGraphicItem( DC ); CurrentDrawItem = CreateGraphicItem( CurrentLibEntry, DC );
} }
else if( CurrentDrawItem ) else if( CurrentDrawItem )
{ {
......
...@@ -376,10 +376,7 @@ LibDrawField* WinEDA_LibeditFrame::LocateField( EDA_LibComponentStruct* LibEntry ...@@ -376,10 +376,7 @@ LibDrawField* WinEDA_LibeditFrame::LocateField( EDA_LibComponentStruct* LibEntry
* pointer on the field (or NULL ) * pointer on the field (or NULL )
*/ */
{ {
wxPoint refpos; wxPoint refpos = GetScreen()->m_Curseur;
refpos.x = GetScreen()->m_Curseur.x;
refpos.y = GetScreen()->m_Curseur.y; // Y axis is from bottom to top in library
/* Test reference */ /* Test reference */
if( LibEntry->m_Name.HitTest( refpos ) ) if( LibEntry->m_Name.HitTest( refpos ) )
return &LibEntry->m_Name; return &LibEntry->m_Name;
...@@ -388,7 +385,7 @@ LibDrawField* WinEDA_LibeditFrame::LocateField( EDA_LibComponentStruct* LibEntry ...@@ -388,7 +385,7 @@ LibDrawField* WinEDA_LibeditFrame::LocateField( EDA_LibComponentStruct* LibEntry
if( LibEntry->m_Prefix.HitTest( refpos ) ) if( LibEntry->m_Prefix.HitTest( refpos ) )
return &LibEntry->m_Prefix; return &LibEntry->m_Prefix;
/* Localisation des autres fields */ /* Test others fields */
for( LibDrawField* field = LibEntry->m_Fields; field; field = field->Next() ) for( LibDrawField* field = LibEntry->m_Fields; field; field = field->Next() )
{ {
if( field->m_Text.IsEmpty() ) if( field->m_Text.IsEmpty() )
......
...@@ -553,7 +553,7 @@ void WinEDA_LibeditFrame::CreatePin( wxDC* DC ) ...@@ -553,7 +553,7 @@ void WinEDA_LibeditFrame::CreatePin( wxDC* DC )
for( ; DrawItem != NULL; DrawItem = DrawItem->Next() ) for( ; DrawItem != NULL; DrawItem = DrawItem->Next() )
DrawItem->m_Flags = 0; DrawItem->m_Flags = 0;
CurrentPin = new LibDrawPin(); CurrentPin = new LibDrawPin(CurrentLibEntry);
CurrentDrawItem = CurrentPin; CurrentDrawItem = CurrentPin;
if( CurrentPin == NULL ) if( CurrentPin == NULL )
......
...@@ -38,8 +38,7 @@ static FILL_T FlSymbol_Fill = NO_FILL; ...@@ -38,8 +38,7 @@ static FILL_T FlSymbol_Fill = NO_FILL;
/************************************************************/ /************************************************************/
void WinEDA_bodygraphics_PropertiesFrame:: void WinEDA_bodygraphics_PropertiesFrame::bodygraphics_PropertiesAccept( wxCommandEvent& event )
bodygraphics_PropertiesAccept( wxCommandEvent& event )
/************************************************************/ /************************************************************/
/* Update the current draw item /* Update the current draw item
...@@ -184,15 +183,12 @@ static void AbortSymbolTraceOn( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -184,15 +183,12 @@ 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 /* Routine de creation d'un nouvel element type LibraryDrawStruct
* POLYLINE
* ARC
* PAD_CIRCLE
* PAD_RECTANGLE
*/ */
{ {
int DrawType; int DrawType;
...@@ -223,7 +219,7 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC ) ...@@ -223,7 +219,7 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC )
break; break;
default: default:
DisplayError( this, wxT( "SymbolBeginDrawItem Internal err: Id error" ) ); DisplayError( this, wxT( "WinEDA_LibeditFrame::CreateGraphicItem() error" ) );
return NULL; return NULL;
} }
...@@ -234,7 +230,7 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC ) ...@@ -234,7 +230,7 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC )
{ {
case COMPONENT_ARC_DRAW_TYPE: case COMPONENT_ARC_DRAW_TYPE:
{ {
LibDrawArc* Arc = new LibDrawArc(); LibDrawArc* Arc = new LibDrawArc( LibEntry );
CurrentDrawItem = Arc; CurrentDrawItem = Arc;
ArcStartX = ArcEndX = GetScreen()->m_Curseur.x; ArcStartX = ArcEndX = GetScreen()->m_Curseur.x;
...@@ -247,11 +243,11 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC ) ...@@ -247,11 +243,11 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC )
case COMPONENT_CIRCLE_DRAW_TYPE: case COMPONENT_CIRCLE_DRAW_TYPE:
{ {
LibDrawCircle* Circle = new LibDrawCircle(); LibDrawCircle* Circle = new LibDrawCircle( LibEntry );
CurrentDrawItem = Circle; CurrentDrawItem = Circle;
Circle->m_Pos.x = GetScreen()->m_Curseur.x; Circle->m_Pos = GetScreen()->m_Curseur;
Circle->m_Pos.y = -( GetScreen()->m_Curseur.y ); NEGATE( Circle->m_Pos.y );
Circle->m_Fill = FlSymbol_Fill; Circle->m_Fill = FlSymbol_Fill;
Circle->m_Width = g_LibSymbolDefaultLineWidth; Circle->m_Width = g_LibSymbolDefaultLineWidth;
} }
...@@ -259,11 +255,11 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC ) ...@@ -259,11 +255,11 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC )
case COMPONENT_RECT_DRAW_TYPE: case COMPONENT_RECT_DRAW_TYPE:
{ {
LibDrawSquare* Square = new LibDrawSquare(); LibDrawSquare* Square = new LibDrawSquare( LibEntry );
CurrentDrawItem = Square; CurrentDrawItem = Square;
Square->m_Pos.x = GetScreen()->m_Curseur.x; Square->m_Pos = GetScreen()->m_Curseur;
Square->m_Pos.y = -( GetScreen()->m_Curseur.y ); NEGATE( Square->m_Pos.y );
Square->m_End = Square->m_Pos; Square->m_End = Square->m_Pos;
Square->m_Fill = FlSymbol_Fill; Square->m_Fill = FlSymbol_Fill;
Square->m_Width = g_LibSymbolDefaultLineWidth; Square->m_Width = g_LibSymbolDefaultLineWidth;
...@@ -272,7 +268,7 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC ) ...@@ -272,7 +268,7 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC )
case COMPONENT_POLYLINE_DRAW_TYPE: case COMPONENT_POLYLINE_DRAW_TYPE:
{ {
LibDrawPolyline* polyline = new LibDrawPolyline(); LibDrawPolyline* polyline = new LibDrawPolyline( LibEntry );
CurrentDrawItem = polyline; CurrentDrawItem = polyline;
wxPoint point = GetScreen()->m_Curseur; wxPoint point = GetScreen()->m_Curseur;
NEGATE( point.y ); NEGATE( point.y );
...@@ -285,11 +281,11 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC ) ...@@ -285,11 +281,11 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC )
case COMPONENT_LINE_DRAW_TYPE: case COMPONENT_LINE_DRAW_TYPE:
{ {
LibDrawSegment* Segment = new LibDrawSegment(); LibDrawSegment* Segment = new LibDrawSegment( LibEntry );
CurrentDrawItem = Segment; CurrentDrawItem = Segment;
Segment->m_Pos.x = GetScreen()->m_Curseur.x; Segment->m_Pos = GetScreen()->m_Curseur;
Segment->m_Pos.y = -( GetScreen()->m_Curseur.y ); NEGATE( Segment->m_Pos.y );
Segment->m_End = Segment->m_Pos; Segment->m_End = Segment->m_Pos;
Segment->m_Width = g_LibSymbolDefaultLineWidth; Segment->m_Width = g_LibSymbolDefaultLineWidth;
} }
...@@ -297,13 +293,13 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC ) ...@@ -297,13 +293,13 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC )
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE: case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE:
{ {
LibDrawText* Text = new LibDrawText(); LibDrawText* Text = new LibDrawText( LibEntry );
CurrentDrawItem = Text; CurrentDrawItem = Text;
Text->m_Size.x = Text->m_Size.y = g_LastTextSize; Text->m_Size.x = Text->m_Size.y = g_LastTextSize;
Text->m_Orient = g_LastTextOrient; Text->m_Orient = g_LastTextOrient;
Text->m_Pos.x = GetScreen()->m_Curseur.x; Text->m_Pos = GetScreen()->m_Curseur;
Text->m_Pos.y = -( GetScreen()->m_Curseur.y ); NEGATE( Text->m_Pos.y );
EditSymbolText( NULL, Text ); EditSymbolText( NULL, Text );
if( Text->m_Text.IsEmpty() ) if( Text->m_Text.IsEmpty() )
{ {
...@@ -375,7 +371,7 @@ void WinEDA_LibeditFrame::GraphicItemBeginDraw( wxDC* DC ) ...@@ -375,7 +371,7 @@ void WinEDA_LibeditFrame::GraphicItemBeginDraw( wxDC* DC )
case COMPONENT_POLYLINE_DRAW_TYPE: case COMPONENT_POLYLINE_DRAW_TYPE:
{ {
wxPoint pos = GetScreen()->m_Curseur; wxPoint pos = GetScreen()->m_Curseur;
NEGATE(pos.y); NEGATE( pos.y );
( (LibDrawPolyline*) CurrentDrawItem )->AddPoint( pos ); ( (LibDrawPolyline*) CurrentDrawItem )->AddPoint( pos );
} }
break; break;
...@@ -421,7 +417,7 @@ static void RedrawWhileMovingCursor( WinEDA_DrawPanel* panel, ...@@ -421,7 +417,7 @@ static void RedrawWhileMovingCursor( WinEDA_DrawPanel* panel,
void MoveLibDrawItemAt( LibEDA_BaseStruct* DrawItem, wxPoint newpos ) void MoveLibDrawItemAt( LibEDA_BaseStruct* DrawItem, wxPoint newpos )
/*****************************************************************/ /*****************************************************************/
{ {
NEGATE(newpos.y); NEGATE( newpos.y );
wxPoint size; wxPoint size;
switch( DrawItem->Type() ) switch( DrawItem->Type() )
...@@ -440,7 +436,8 @@ void MoveLibDrawItemAt( LibEDA_BaseStruct* DrawItem, wxPoint newpos ) ...@@ -440,7 +436,8 @@ void MoveLibDrawItemAt( LibEDA_BaseStruct* DrawItem, wxPoint newpos )
break; break;
case COMPONENT_RECT_DRAW_TYPE: 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_Pos = newpos;
( (LibDrawSquare*) CurrentDrawItem )->m_End = newpos + size; ( (LibDrawSquare*) CurrentDrawItem )->m_End = newpos + size;
break; break;
...@@ -449,7 +446,7 @@ void MoveLibDrawItemAt( LibEDA_BaseStruct* DrawItem, wxPoint newpos ) ...@@ -449,7 +446,7 @@ void MoveLibDrawItemAt( LibEDA_BaseStruct* DrawItem, wxPoint newpos )
{ {
int ii, imax = ( (LibDrawPolyline*) CurrentDrawItem )->GetCornerCount(); int ii, imax = ( (LibDrawPolyline*) CurrentDrawItem )->GetCornerCount();
wxPoint offset = newpos - ( (LibDrawPolyline*) CurrentDrawItem )->m_PolyPoints[0]; 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; ( (LibDrawPolyline*) CurrentDrawItem )->m_PolyPoints[ii] += offset;
} }
break; break;
...@@ -526,7 +523,7 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) ...@@ -526,7 +523,7 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
BASE_SCREEN* Screen = panel->GetScreen(); BASE_SCREEN* Screen = panel->GetScreen();
wxPoint curr_pos = Screen->m_Curseur; wxPoint curr_pos = Screen->m_Curseur;
NEGATE(curr_pos.y); NEGATE( curr_pos.y );
GRSetDrawMode( DC, DrawMode ); GRSetDrawMode( DC, DrawMode );
...@@ -837,7 +834,7 @@ void WinEDA_LibeditFrame::DeleteDrawPoly( wxDC* DC ) ...@@ -837,7 +834,7 @@ void WinEDA_LibeditFrame::DeleteDrawPoly( wxDC* DC )
DrawLibraryDrawStruct( DrawPanel, DC, CurrentLibEntry, wxPoint( 0, 0 ), DrawLibraryDrawStruct( DrawPanel, DC, CurrentLibEntry, wxPoint( 0, 0 ),
CurrentDrawItem, g_XorMode ); 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(); Poly->m_PolyPoints.pop_back();
unsigned idx = Poly->GetCornerCount() - 1; unsigned idx = Poly->GetCornerCount() - 1;
......
...@@ -159,6 +159,9 @@ public: ...@@ -159,6 +159,9 @@ public:
int m_PcbTextWidth; // current Pcb (not module) Text width int m_PcbTextWidth; // current Pcb (not module) Text width
wxSize m_PcbTextSize; // current Pcb (not module) Text size wxSize m_PcbTextSize; // current Pcb (not module) Text size
int m_TrackClearence; // track to track and track to pads clearance 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 int m_MaskMargin; // Solder mask margin
// Color options for screen display of the Printed Board: // Color options for screen display of the Printed Board:
......
...@@ -484,7 +484,7 @@ private: ...@@ -484,7 +484,7 @@ private:
void PlaceAncre(); void PlaceAncre();
// Edition des graphismes: // Edition des graphismes:
LibEDA_BaseStruct* CreateGraphicItem( wxDC* DC ); LibEDA_BaseStruct* CreateGraphicItem( EDA_LibComponentStruct * LibEntry, wxDC* DC );
void GraphicItemBeginDraw( wxDC* DC ); void GraphicItemBeginDraw( wxDC* DC );
void StartMoveDrawSymbol( wxDC* DC ); void StartMoveDrawSymbol( wxDC* DC );
void EndDrawGraphicItem( wxDC* DC ); void EndDrawGraphicItem( wxDC* DC );
......
...@@ -33,7 +33,8 @@ set(PCBNEW_SRCS ...@@ -33,7 +33,8 @@ set(PCBNEW_SRCS
dialog_copper_zones.cpp dialog_copper_zones.cpp
dialog_copper_zones_base.cpp dialog_copper_zones_base.cpp
dialog_display_options_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.cpp
dialog_edit_module_text_base.cpp dialog_edit_module_text_base.cpp
# dialog_edit_module.cpp # dialog_edit_module.cpp
......
...@@ -77,6 +77,12 @@ wxString DRC_ITEM::GetErrorText() const ...@@ -77,6 +77,12 @@ wxString DRC_ITEM::GetErrorText() const
return wxString( _("Hole near pad")); return wxString( _("Hole near pad"));
case DRCE_HOLE_NEAR_TRACK: case DRCE_HOLE_NEAR_TRACK:
return wxString( _("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: default:
......
...@@ -21,7 +21,8 @@ ...@@ -21,7 +21,8 @@
* Also useful in Gerbview for this reason. * Also useful in Gerbview for this reason.
* Zoom 5 and 10 can create artefacts when drawing (integer overflow in low level graphic functions ) * 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, 5, 10, 15, 22, 30, 45, 70, 100, 150, 220, 350, 500, 800, 1200,
2000, 3500, 5000, 10000, 20000 2000, 3500, 5000, 10000, 20000
}; };
...@@ -31,7 +32,8 @@ static const int PcbZoomList[] = { ...@@ -31,7 +32,8 @@ static const int PcbZoomList[] = {
/* Default grid sizes for PCB editor screens. */ /* Default grid sizes for PCB editor screens. */
#define MM_TO_PCB_UNITS 10000.0 / 25.4 #define MM_TO_PCB_UNITS 10000.0 / 25.4
static GRID_TYPE PcbGridList[] = { static GRID_TYPE PcbGridList[] =
{
// predefined grid list in 0.0001 inches // predefined grid list in 0.0001 inches
{ ID_POPUP_GRID_LEVEL_1000, wxRealPoint( 1000, 1000 ) }, { ID_POPUP_GRID_LEVEL_1000, wxRealPoint( 1000, 1000 ) },
{ ID_POPUP_GRID_LEVEL_500, wxRealPoint( 500, 500 ) }, { ID_POPUP_GRID_LEVEL_500, wxRealPoint( 500, 500 ) },
...@@ -135,17 +137,18 @@ bool PCB_SCREEN::IsMicroViaAcceptable( void ) ...@@ -135,17 +137,18 @@ bool PCB_SCREEN::IsMicroViaAcceptable( void )
DISPLAY_OPTIONS::DISPLAY_OPTIONS() DISPLAY_OPTIONS::DISPLAY_OPTIONS()
{ {
DisplayPadFill = FILLED; DisplayPadFill = FILLED;
DisplayPadNum = TRUE; DisplayPadNum = true;
DisplayPadNoConn = TRUE; DisplayPadNoConn = true;
DisplayPadIsol = TRUE; DisplayPadIsol = true;
DisplayModEdge = TRUE; DisplayModEdge = true;
DisplayModText = TRUE; DisplayModText = true;
DisplayPcbTrackFill = TRUE; /* FALSE = sketch , TRUE = rempli */ DisplayPcbTrackFill = true; /* false = sketch , true = rempli */
DisplayTrackIsol = FALSE; DisplayTrackIsol = false;
m_DisplayViaMode = VIA_HOLE_NOT_SHOW; m_DisplayViaMode = VIA_HOLE_NOT_SHOW;
DisplayPolarCood = TRUE; DisplayPolarCood = false; /* false = display absolute coordinates,
* true = display polar cordinates */
DisplayZonesMode = 0; /* 0 = Show filled areas outlines in zones, DisplayZonesMode = 0; /* 0 = Show filled areas outlines in zones,
* 1 = do not show filled areas outlines * 1 = do not show filled areas outlines
* 2 = show outlines of filled areas */ * 2 = show outlines of filled areas */
...@@ -153,11 +156,11 @@ DISPLAY_OPTIONS::DISPLAY_OPTIONS() ...@@ -153,11 +156,11 @@ DISPLAY_OPTIONS::DISPLAY_OPTIONS()
* 1 show netnames on pads * 1 show netnames on pads
* 2 show netnames on tracks * 2 show netnames on tracks
* 3 show netnames on tracks and pads */ * 3 show netnames on tracks and pads */
Show_Modules_Cmp = TRUE; Show_Modules_Cmp = true;
Show_Modules_Cu = TRUE; Show_Modules_Cu = true;
DisplayDrawItems = TRUE; DisplayDrawItems = true;
ContrastModeDisplay = FALSE; ContrastModeDisplay = false;
} }
...@@ -169,7 +172,8 @@ EDA_BoardDesignSettings::EDA_BoardDesignSettings() ...@@ -169,7 +172,8 @@ EDA_BoardDesignSettings::EDA_BoardDesignSettings()
{ {
int ii; int ii;
static const int default_layer_color[32] = { static const int default_layer_color[32] =
{
GREEN, LIGHTGRAY, LIGHTGRAY, LIGHTGRAY, GREEN, LIGHTGRAY, LIGHTGRAY, LIGHTGRAY,
LIGHTGRAY, LIGHTGRAY, LIGHTGRAY, LIGHTGRAY, LIGHTGRAY, LIGHTGRAY, LIGHTGRAY, LIGHTGRAY,
LIGHTGRAY, LIGHTGRAY, LIGHTGRAY, LIGHTGRAY, LIGHTGRAY, LIGHTGRAY, LIGHTGRAY, LIGHTGRAY,
...@@ -209,6 +213,9 @@ EDA_BoardDesignSettings::EDA_BoardDesignSettings() ...@@ -209,6 +213,9 @@ EDA_BoardDesignSettings::EDA_BoardDesignSettings()
m_PcbTextWidth = 100; // current Pcb (not module) Text width m_PcbTextWidth = 100; // current Pcb (not module) Text width
m_PcbTextSize = wxSize( 500, 500 ); // current Pcb (not module) Text size m_PcbTextSize = wxSize( 500, 500 ); // current Pcb (not module) Text size
m_TrackClearence = 100; // track to track and track to pads clearance 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 m_MaskMargin = 150; // Solder mask margin
/* Color options for screen display of the Printed Board: */ /* Color options for screen display of the Printed Board: */
m_PcbGridColor = DARKGRAY; // Grid color m_PcbGridColor = DARKGRAY; // Grid color
......
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// 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 @@ ...@@ -41,7 +41,7 @@
#include "drc_stuff.h" #include "drc_stuff.h"
#include "dialog_drc.cpp" #include "dialog_drc.h"
/******************************************************/ /******************************************************/
...@@ -56,13 +56,19 @@ void DRC::ShowDialog() ...@@ -56,13 +56,19 @@ void DRC::ShowDialog()
{ {
if( !m_ui ) if( !m_ui )
{ {
m_ui = new DrcDialog( this, m_mainWindow ); m_ui = new DIALOG_DRC_CONTROL( this, m_mainWindow );
updatePointers(); updatePointers();
// copy data retained in this DRC object into the m_ui DrcPanel: // copy data retained in this DRC object into the m_ui DrcPanel:
PutValueInLocalUnits( *m_ui->m_SetClearance, g_DesignSettings.m_TrackClearence, PutValueInLocalUnits( *m_ui->m_SetClearance, g_DesignSettings.m_TrackClearence,
m_mainWindow->m_InternalUnits );; 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_Pad2PadTestCtrl->SetValue( m_doPad2PadTest );
m_ui->m_ZonesTestCtrl->SetValue( m_doZonesTest ); m_ui->m_ZonesTestCtrl->SetValue( m_doZonesTest );
...@@ -187,6 +193,11 @@ int DRC::Drc( ZONE_CONTAINER* aArea, int CornerIndex ) ...@@ -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() void DRC::RunTests()
{ {
// Ensure ratsnest is up to date: // Ensure ratsnest is up to date:
...@@ -521,6 +532,26 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads ) ...@@ -521,6 +532,26 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
/* Phase 0 : Test vias : */ /* Phase 0 : Test vias : */
if( aRefSeg->Type() == TYPE_VIA ) 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 // test if via's hole is bigger than its diameter
// This test is necessary since the via hole size and width can be modified // This test is necessary since the via hole size and width can be modified
// and an default via hole can be bigger than some vias sizes // and an default via hole can be bigger than some vias sizes
...@@ -555,6 +586,15 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads ) ...@@ -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 // for a non horizontal or vertical segment Compute the segment angle
// in tenths of degrees and its length // in tenths of degrees and its length
......
...@@ -60,6 +60,9 @@ ...@@ -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_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_PAD 25 ///< hole too close to pad
#define DRCE_HOLE_NEAR_TRACK 26 ///< hole too close to track #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 * Class DRC_ITEM
...@@ -257,7 +260,7 @@ public: ...@@ -257,7 +260,7 @@ public:
class WinEDA_DrawPanel; class WinEDA_DrawPanel;
class MARKER; class MARKER;
class DrcDialog; class DIALOG_DRC_CONTROL;
/** /**
...@@ -318,7 +321,7 @@ typedef std::vector<DRC_ITEM*> DRC_LIST; ...@@ -318,7 +321,7 @@ typedef std::vector<DRC_ITEM*> DRC_LIST;
*/ */
class DRC class DRC
{ {
friend class DrcDialog; friend class DIALOG_DRC_CONTROL;
private: private:
...@@ -353,7 +356,7 @@ private: ...@@ -353,7 +356,7 @@ private:
WinEDA_PcbFrame* m_mainWindow; WinEDA_PcbFrame* m_mainWindow;
WinEDA_DrawPanel* m_drawPanel; WinEDA_DrawPanel* m_drawPanel;
BOARD* m_pcb; BOARD* m_pcb;
DrcDialog* m_ui; DIALOG_DRC_CONTROL* m_ui;
DRC_LIST m_unconnected; ///< list of unconnected pads, as DRC_ITEMs DRC_LIST m_unconnected; ///< list of unconnected pads, as DRC_ITEMs
......
...@@ -355,6 +355,12 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum ) ...@@ -355,6 +355,12 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum )
continue; continue;
} }
if( stricmp( Line, "TrackMinWidth" ) == 0 )
{
g_DesignSettings.m_TrackMinWidth = atoi( data );
continue;
}
if( stricmp( Line, "ZoneClearence" ) == 0 ) if( stricmp( Line, "ZoneClearence" ) == 0 )
{ {
g_Zone_Default_Setting.m_ZoneClearance = atoi( data ); g_Zone_Default_Setting.m_ZoneClearance = atoi( data );
...@@ -387,12 +393,24 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum ) ...@@ -387,12 +393,24 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum )
continue; continue;
} }
if( stricmp( Line, "ViaMinSize" ) == 0 )
{
g_DesignSettings.m_ViasMinSize = atoi( data );
continue;
}
if( stricmp( Line, "MicroViaSize" ) == 0 ) if( stricmp( Line, "MicroViaSize" ) == 0 )
{ {
g_DesignSettings.m_CurrentMicroViaSize = atoi( data ); g_DesignSettings.m_CurrentMicroViaSize = atoi( data );
continue; continue;
} }
if( stricmp( Line, "MicroViaMinSize" ) == 0 )
{
g_DesignSettings.m_MicroViasMinSize = atoi( data );
continue;
}
if( stricmp( Line, "ViaSizeHistory" ) == 0 ) if( stricmp( Line, "ViaSizeHistory" ) == 0 )
{ {
int tmp = atoi( data ); int tmp = atoi( data );
...@@ -518,12 +536,14 @@ static int WriteSetup( FILE* aFile, WinEDA_BasePcbFrame* aFrame, BOARD* aBoard ) ...@@ -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, "TrackClearence %d\n", g_DesignSettings.m_TrackClearence );
fprintf( aFile, "ZoneClearence %d\n", g_Zone_Default_Setting.m_ZoneClearance ); 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, "DrawSegmWidth %d\n", g_DesignSettings.m_DrawSegmentWidth );
fprintf( aFile, "EdgeSegmWidth %d\n", g_DesignSettings.m_EdgeSegmentWidth ); fprintf( aFile, "EdgeSegmWidth %d\n", g_DesignSettings.m_EdgeSegmentWidth );
fprintf( aFile, "ViaSize %d\n", g_DesignSettings.m_CurrentViaSize ); fprintf( aFile, "ViaSize %d\n", g_DesignSettings.m_CurrentViaSize );
fprintf( aFile, "ViaDrill %d\n", g_DesignSettings.m_ViaDrill ); fprintf( aFile, "ViaDrill %d\n", g_DesignSettings.m_ViaDrill );
fprintf( aFile, "ViaAltDrill %d\n", g_DesignSettings.m_ViaDrillCustomValue ); 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++ ) for( ii = 0; ii < HISTORY_NUMBER; ii++ )
{ {
...@@ -535,6 +555,7 @@ static int WriteSetup( FILE* aFile, WinEDA_BasePcbFrame* aFrame, BOARD* aBoard ) ...@@ -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, "MicroViaSize %d\n", g_DesignSettings.m_CurrentMicroViaSize);
fprintf( aFile, "MicroViaDrill %d\n", g_DesignSettings.m_MicroViaDrill); fprintf( aFile, "MicroViaDrill %d\n", g_DesignSettings.m_MicroViaDrill);
fprintf( aFile, "MicroViasAllowed %d\n", g_DesignSettings.m_MicroViasAllowed); 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, "TextPcbWidth %d\n", g_DesignSettings.m_PcbTextWidth );
fprintf( aFile, "TextPcbSize %d %d\n", 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