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;
......
This diff is collapsed.
......@@ -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 )
{
......
This diff is collapsed.
......@@ -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];
......
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 @@
#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