From 92266a19867c043797b2bff2470944a8587db3db Mon Sep 17 00:00:00 2001 From: charras Date: Thu, 18 Jun 2009 13:30:52 +0000 Subject: [PATCH] Pcbnew: Added: in DRC tests: tests for vias min size and tracks min width. Eeschema: code cleaning --- CHANGELOG.txt | 6 +- common/drawtxt.cpp | 6 +- cvpcb/setvisu.cpp | 1 + eeschema/class_BodyItem_Text.cpp | 7 +- eeschema/class_libentry.cpp | 19 +- eeschema/class_libentry_fields.cpp | 11 +- eeschema/class_libentry_fields.h | 2 + eeschema/class_pin.cpp | 5 +- eeschema/classes_body_items.cpp | 103 +- eeschema/classes_body_items.h | 20 +- eeschema/component_class.cpp | 5 +- eeschema/eelibs_read_libraryfiles.cpp | 26 +- eeschema/libedit_onleftclick.cpp | 2 +- eeschema/libfield.cpp | 7 +- eeschema/pinedit.cpp | 2 +- eeschema/symbdraw.cpp | 81 +- include/pcbstruct.h | 165 +-- include/wxEeschemaStruct.h | 2 +- pcbnew/CMakeLists.txt | 3 +- pcbnew/class_drc_item.cpp | 6 + pcbnew/classpcb.cpp | 63 +- pcbnew/dialog_drc.cpp | 687 +-------- pcbnew/dialog_drc.h | 405 ++++-- pcbnew/dialog_drc.pjd | 1840 ------------------------- pcbnew/dialog_drc_base.cpp | 230 ++++ pcbnew/dialog_drc_base.fbp | 1462 ++++++++++++++++++++ pcbnew/dialog_drc_base.h | 103 ++ pcbnew/drc.cpp | 44 +- pcbnew/drc_stuff.h | 9 +- pcbnew/ioascii.cpp | 21 + 30 files changed, 2503 insertions(+), 2840 deletions(-) delete mode 100644 pcbnew/dialog_drc.pjd create mode 100644 pcbnew/dialog_drc_base.cpp create mode 100644 pcbnew/dialog_drc_base.fbp create mode 100644 pcbnew/dialog_drc_base.h diff --git a/CHANGELOG.txt b/CHANGELOG.txt index d574c433c4..7750c9c1af 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -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 +================================================================================ +++Pcbnew: + Added: in DRC tests: tests for vias min size and tracks min width. 2009-june-11 UPDATE Jean-Pierre Charras ================================================================================ @@ -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. diff --git a/common/drawtxt.cpp b/common/drawtxt.cpp index 6a389c8fb8..bdcc8eec88 100644 --- a/common/drawtxt.cpp +++ b/common/drawtxt.cpp @@ -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: diff --git a/cvpcb/setvisu.cpp b/cvpcb/setvisu.cpp index e685ca1779..1a9e41c573 100644 --- a/cvpcb/setvisu.cpp +++ b/cvpcb/setvisu.cpp @@ -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(); } diff --git a/eeschema/class_BodyItem_Text.cpp b/eeschema/class_BodyItem_Text.cpp index f3a7f2a3b2..3ce2751b64 100644 --- a/eeschema/class_BodyItem_Text.cpp +++ b/eeschema/class_BodyItem_Text.cpp @@ -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; diff --git a/eeschema/class_libentry.cpp b/eeschema/class_libentry.cpp index 800f900787..c63a6a6b0d 100644 --- a/eeschema/class_libentry.cpp +++ b/eeschema/class_libentry.cpp @@ -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 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 aFields for( LibDrawField* Field = CurrentLibEntry->m_Fields; Field; Field = Field->Next() ) { + Field->SetParent( this ); if( Field->m_FieldId >= FIELD1 ) { if( Field->m_Text.IsEmpty() ) diff --git a/eeschema/class_libentry_fields.cpp b/eeschema/class_libentry_fields.cpp index ce768ea46c..90b97d7194 100644 --- a/eeschema/class_libentry_fields.cpp +++ b/eeschema/class_libentry_fields.cpp @@ -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; diff --git a/eeschema/class_libentry_fields.h b/eeschema/class_libentry_fields.h index 42beb54cb8..6e6ae87f16 100644 --- a/eeschema/class_libentry_fields.h +++ b/eeschema/class_libentry_fields.h @@ -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; } }; diff --git a/eeschema/class_pin.cpp b/eeschema/class_pin.cpp index 7a00ead571..6e639c5d16 100644 --- a/eeschema/class_pin.cpp +++ b/eeschema/class_pin.cpp @@ -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; diff --git a/eeschema/classes_body_items.cpp b/eeschema/classes_body_items.cpp index 8e11f5d0cb..f73819de74 100644 --- a/eeschema/classes_body_items.cpp +++ b/eeschema/classes_body_items.cpp @@ -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; } diff --git a/eeschema/classes_body_items.h b/eeschema/classes_body_items.h index 6e6518c8ac..c985839485 100644 --- a/eeschema/classes_body_items.h +++ b/eeschema/classes_body_items.h @@ -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 m_PolyPoints; // list of points (>= 2) public: - LibDrawPolyline(); + LibDrawPolyline(EDA_LibComponentStruct * aParent); ~LibDrawPolyline() { } virtual wxString GetClass() const diff --git a/eeschema/component_class.cpp b/eeschema/component_class.cpp index 62d89c410a..3015756688 100644 --- a/eeschema/component_class.cpp +++ b/eeschema/component_class.cpp @@ -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( "??" ); diff --git a/eeschema/eelibs_read_libraryfiles.cpp b/eeschema/eelibs_read_libraryfiles.cpp index 042c6e00b0..5a3d539ff2 100644 --- a/eeschema/eelibs_read_libraryfiles.cpp +++ b/eeschema/eelibs_read_libraryfiles.cpp @@ -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 ); diff --git a/eeschema/libedit_onleftclick.cpp b/eeschema/libedit_onleftclick.cpp index 7dec982d54..029cdbf120 100644 --- a/eeschema/libedit_onleftclick.cpp +++ b/eeschema/libedit_onleftclick.cpp @@ -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 ) { diff --git a/eeschema/libfield.cpp b/eeschema/libfield.cpp index e2da5edd17..90b15e1e38 100644 --- a/eeschema/libfield.cpp +++ b/eeschema/libfield.cpp @@ -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() ) diff --git a/eeschema/pinedit.cpp b/eeschema/pinedit.cpp index 04f59151cc..c830db8ee3 100644 --- a/eeschema/pinedit.cpp +++ b/eeschema/pinedit.cpp @@ -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 ) diff --git a/eeschema/symbdraw.cpp b/eeschema/symbdraw.cpp index 03138d3d8b..78273407ad 100644 --- a/eeschema/symbdraw.cpp +++ b/eeschema/symbdraw.cpp @@ -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 ) { diff --git a/include/pcbstruct.h b/include/pcbstruct.h index 20099de98f..99cbe12412 100644 --- a/include/pcbstruct.h +++ b/include/pcbstruct.h @@ -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 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 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; }; diff --git a/include/wxEeschemaStruct.h b/include/wxEeschemaStruct.h index fff9cced14..77325c365c 100644 --- a/include/wxEeschemaStruct.h +++ b/include/wxEeschemaStruct.h @@ -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 ); diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt index 4ebc6f388f..aaadd37dca 100644 --- a/pcbnew/CMakeLists.txt +++ b/pcbnew/CMakeLists.txt @@ -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 diff --git a/pcbnew/class_drc_item.cpp b/pcbnew/class_drc_item.cpp index 5a9490aa5c..8e6b5120e0 100644 --- a/pcbnew/class_drc_item.cpp +++ b/pcbnew/class_drc_item.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: diff --git a/pcbnew/classpcb.cpp b/pcbnew/classpcb.cpp index 87aeb9b0d0..fc70d7c79c 100644 --- a/pcbnew/classpcb.cpp +++ b/pcbnew/classpcb.cpp @@ -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; + DisplayPadNum = true; + DisplayPadNoConn = true; + DisplayPadIsol = true; - DisplayModEdge = TRUE; - DisplayModText = TRUE; - DisplayPcbTrackFill = TRUE; /* FALSE = sketch , TRUE = rempli */ - DisplayTrackIsol = FALSE; + 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; + * 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; + 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]; diff --git a/pcbnew/dialog_drc.cpp b/pcbnew/dialog_drc.cpp index cbc9e5affa..d8d99a41c9 100644 --- a/pcbnew/dialog_drc.cpp +++ b/pcbnew/dialog_drc.cpp @@ -1,608 +1,68 @@ ///////////////////////////////////////////////////////////////////////////// // 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 -#include - -////@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 DIALOG_DRC_CONTROL: a dialog to set DRC parameters (clearance, min cooper size) + * and run DRC tests */ -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() {} - */ - - - //-------------------------------------------- - - 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(); - } - - //------------------------------------------- - -}; - - -/** - * 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() {} - */ - - - //-------------------------------------------- - - void DeleteAllItems() - { - if( m_vector ) - { - for( unsigned i=0; isize(); ++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; - } - - //------------------------------------------- - -}; - - - -/** - * 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& 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. + + // Set the initial "enabled" status of the browse button and the text + // field for report name + wxCommandEvent junk; + OnReportCheckBoxClicked( junk ); + + 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); } -/*! - * 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 -} - -/*! - * Get icon resources - */ - -wxIcon DrcDialog::GetIconResource( const wxString& name ) -{ - // Icon retrieval -////@begin DrcDialog icon retrieval - wxUnusedVar(name); - return wxNullIcon; -////@end DrcDialog icon retrieval -} - - /*! * 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(); } diff --git a/pcbnew/dialog_drc.h b/pcbnew/dialog_drc.h index c34042a58e..da3da242f8 100644 --- a/pcbnew/dialog_drc.h +++ b/pcbnew/dialog_drc.h @@ -1,126 +1,57 @@ ///////////////////////////////////////////////////////////////////////////// // 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 +#include -/*! - * Includes - */ - -////@begin includes -#include "wx/notebook.h" -////@end includes - - -/*! - * Forward declarations - */ - -////@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() {} + */ + + + //-------------------------------------------- + + 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(); + } + + //------------------------------------------- + +}; + + +/** + * 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() {} + */ + + + //-------------------------------------------- + + void DeleteAllItems() + { + if( m_vector ) + { + for( unsigned i=0; isize(); ++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; + } + + //------------------------------------------- + +}; + + + +/** + * 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_ diff --git a/pcbnew/dialog_drc.pjd b/pcbnew/dialog_drc.pjd deleted file mode 100644 index 562803b4f9..0000000000 --- a/pcbnew/dialog_drc.pjd +++ /dev/null @@ -1,1840 +0,0 @@ - - -
- 0 - "" - "" - "" - "" - "" - 0 - 0 - 0 - 1 - 1 - 1 - 1 - 0 - "jean-pierre Charras" - "License GNU" - "" - 0 - 0 - 0 - "<All platforms>" - "<Any>" - "///////////////////////////////////////////////////////////////////////////// -// Name: %HEADER-FILENAME% -// Purpose: -// Author: %AUTHOR% -// Modified by: -// Created: %DATE% -// RCS-ID: -// Copyright: %COPYRIGHT% -// Licence: -///////////////////////////////////////////////////////////////////////////// - -" - "///////////////////////////////////////////////////////////////////////////// -// Name: %SOURCE-FILENAME% -// Purpose: -// Author: %AUTHOR% -// Modified by: -// Created: %DATE% -// RCS-ID: -// Copyright: %COPYRIGHT% -// Licence: -///////////////////////////////////////////////////////////////////////////// - -" - "///////////////////////////////////////////////////////////////////////////// -// Name: %SYMBOLS-FILENAME% -// Purpose: Symbols file -// Author: %AUTHOR% -// Modified by: -// Created: %DATE% -// RCS-ID: -// Copyright: %COPYRIGHT% -// Licence: -///////////////////////////////////////////////////////////////////////////// - -" - "#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma interface "%HEADER-FILENAME%" -#endif - -" - "#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma implementation "%HEADER-FILENAME%" -#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 - -" - " /// %BODY% -" - " -/*! - * %BODY% - */ - -" - "app_resources.h" - "app_resources.cpp" - "AppResources" - "app.h" - "app.cpp" - "Application" - 0 - "" - "<None>" - "<System>" - "utf-8" - "<System>" - "" - 0 - 0 - 4 - " " - "" - 0 - 0 - 1 - 0 - 1 - 1 - 0 - 1 - 0 - 0 -
- - - "" - "data-document" - "" - "" - 0 - 1 - 0 - 0 - - "Configurations" - "config-data-document" - "" - "" - 0 - 1 - 0 - 0 - "" - 1 - 0 - "" - "Debug" - "ANSI" - "Static" - "Modular" - "GUI" - "wxMSW" - "Dynamic" - "Yes" - "No" - "No" - "%WXVERSION%" - "%EXECUTABLE%" - "" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - 0 - 1 - "" - - - - - - - "Projects" - "root-document" - "" - "project" - 1 - 1 - 0 - 1 - - "Windows" - "html-document" - "" - "dialogsfolder" - 1 - 1 - 0 - 1 - - "DRC Control" - "dialog-document" - "" - "dialog" - 0 - 1 - 0 - 0 - "27/4/2006" - "wbDialogProxy" - 10000 - 0 - "" - 0 - "" - 0 - 0 - "wxEVT_INIT_DIALOG|OnInitDialog|NONE||DrcDialog" - "ID_DIALOG" - 10000 - "DrcDialog" - "wxDialog" - "wxDialog" - "dialog_drc.cpp" - "dialog_drc.h" - "" - "DRC Control" - 1 - "" - 0 - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - "" - "" - "" - "" - "" - "" - "Tiled" - 1 - 0 - 1 - 1 - 0 - 0 - 1 - 1 - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 1 - 0 - "" - 0 - 1 - -1 - -1 - 400 - 300 - 0 - "" - - "wxBoxSizer V" - "dialog-control-document" - "" - "sizer" - 0 - 1 - 0 - 0 - "wbBoxSizerProxy" - "Vertical" - "m_MainSizer" - 0 - 0 - 0 - "<Any platform>" - - "wxBoxSizer H" - "dialog-control-document" - "" - "sizer" - 0 - 1 - 0 - 0 - "27/3/2006" - "wbBoxSizerProxy" - "Horizontal" - "m_CommandSizer" - "Expand" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "<Any platform>" - - "wxStaticBoxSizer H" - "dialog-control-document" - "" - "sizer" - 0 - 1 - 0 - 0 - "25/11/2007" - "wbStaticBoxSizerProxy" - "wxID_ANY" - -1 - "Options" - "" - "" - "" - "" - 0 - 1 - "wxStaticBox" - "Horizontal" - "Expand" - "Expand" - 3 - 8 - 0 - 0 - 1 - 1 - 0 - 0 - 0 - "<Any platform>" - - "wxBoxSizer V" - "dialog-control-document" - "" - "sizer" - 0 - 1 - 0 - 0 - "25/11/2007" - "wbBoxSizerProxy" - "Vertical" - "" - "Centre" - "Expand" - 2 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "<Any platform>" - - "wxBoxSizer H" - "dialog-control-document" - "" - "sizer" - 0 - 1 - 0 - 0 - "25/11/2007" - "wbBoxSizerProxy" - "Horizontal" - "" - "Left" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "<Any platform>" - - "wxStaticText: wxID_STATIC" - "dialog-control-document" - "" - "statictext" - 0 - 1 - 0 - 0 - "25/11/2007" - "wbStaticTextProxy" - "wxID_STATIC" - 5105 - "" - "wxStaticText" - "wxStaticText" - 0 - 0 - "" - "" - "m_ClearenceTitle" - "Clearance" - -1 - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - "" - "" - "" - "" - "" - "" - "" - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 1 - "" - -1 - -1 - -1 - -1 - "Expand" - "Top" - 0 - 5 - 1 - 1 - 1 - 0 - 0 - 1 - 0 - "" - "" - - - "wxTextCtrl: ID_TEXTCTRL1" - "dialog-control-document" - "" - "textctrl" - 0 - 1 - 0 - 0 - "25/11/2007" - "wbTextCtrlProxy" - "ID_TEXTCTRL1" - 10002 - "" - "wxTextCtrl" - "wxTextCtrl" - 1 - 0 - "" - "" - "m_SetClearance" - "" - 0 - "" - "In the clearance units, enter the clearance distance" - "" - "" - "" - 0 - 1 - "<Any platform>" - "" - "" - "" - "" - "" - "" - "" - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - 144 - -1 - "Expand" - "Top" - 1 - 5 - 1 - 1 - 0 - 1 - 0 - 1 - 0 - "" - "" - - - - "wxStaticBoxSizer H" - "dialog-control-document" - "" - "sizer" - 0 - 1 - 0 - 0 - "25/11/2007" - "wbStaticBoxSizerProxy" - "wxID_ANY" - -1 - "Create Report File" - "" - "" - "" - "" - 0 - 1 - "wxStaticBox" - "Horizontal" - "Expand" - "Centre" - 1 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "<Any platform>" - - "wxCheckBox: ID_CHECKBOX" - "dialog-control-document" - "" - "checkbox" - 0 - 1 - 0 - 0 - "25/11/2007" - "wbCheckBoxProxy" - "wxEVT_COMMAND_CHECKBOX_CLICKED|OnReportCheckBoxClicked|NONE||DrcDialog" - "ID_CHECKBOX" - 10004 - "" - "wxCheckBox" - "wxCheckBox" - 0 - 0 - "" - "" - "m_CreateRptCtrl" - "" - 0 - "" - "Enable writing report to this file" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Expand" - "Centre" - 0 - 5 - 1 - 0 - 1 - 1 - 0 - 0 - 0 - "" - "" - - - "wxTextCtrl: ID_TEXTCTRL3" - "dialog-control-document" - "" - "textctrl" - 0 - 1 - 0 - 0 - "25/11/2007" - "wbTextCtrlProxy" - "ID_TEXTCTRL3" - 10014 - "" - "wxTextCtrl" - "wxTextCtrl" - 1 - 0 - "" - "" - "m_RptFilenameCtrl" - "" - 0 - "" - "Enter the report filename" - "" - "" - "" - 0 - 1 - "<Any platform>" - "" - "" - "" - "" - "" - "" - "" - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - 250 - -1 - "Expand" - "Centre" - 2 - 5 - 0 - 1 - 1 - 1 - 0 - 0 - 0 - "" - "" - - - "wxButton: ID_BUTTON_BROWSE_RPT_FILE" - "dialog-control-document" - "" - "dialogcontrol" - 0 - 1 - 0 - 0 - "25/11/2007" - "wbButtonProxy" - "wxEVT_COMMAND_BUTTON_CLICKED|OnButtonBrowseRptFileClick|NONE||DrcDialog" - "ID_BUTTON_BROWSE_RPT_FILE" - 10018 - "" - "wxButton" - "wxButton" - 0 - 0 - "" - "" - "m_BrowseButton" - "..." - 0 - "" - "Pick a filename interactively" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - 35 - -1 - "Left" - "Centre" - 0 - 5 - 0 - 1 - 1 - 1 - 0 - 1 - 0 - "" - "" - - - - - "wxStaticBoxSizer V" - "dialog-control-document" - "" - "sizer" - 0 - 1 - 0 - 0 - "25/11/2007" - "wbStaticBoxSizerProxy" - "wxID_ANY" - -1 - "Include Tests For:" - "" - "" - "" - "" - 0 - 1 - "wxStaticBox" - "Vertical" - "Expand" - "Expand" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "<Any platform>" - - "wxCheckBox: ID_CHECKBOX2" - "dialog-control-document" - "" - "checkbox" - 0 - 1 - 0 - 0 - "25/11/2007" - "wbCheckBoxProxy" - "ID_CHECKBOX2" - 10019 - "" - "wxCheckBox" - "wxCheckBox" - 1 - 0 - "" - "" - "m_Pad2PadTestCtrl" - "Pad to pad" - 0 - "" - "Include tests for clearances between pad to pads" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Expand" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "" - "" - - - "wxCheckBox: ID_CHECKBOX7" - "dialog-control-document" - "" - "checkbox" - 0 - 1 - 0 - 0 - "25/11/2007" - "wbCheckBoxProxy" - "ID_CHECKBOX7" - 10021 - "" - "wxCheckBox" - "wxCheckBox" - 1 - 0 - "" - "" - "m_ZonesTestCtrl" - "Zones" - 0 - "" - "Include zones in clearance or unconnected tests" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Expand" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "" - "" - - - "wxCheckBox: ID_CHECKBOX3" - "dialog-control-document" - "" - "checkbox" - 0 - 1 - 0 - 0 - "30/11/2007" - "wbCheckBoxProxy" - "ID_CHECKBOX3" - 10011 - "" - "wxCheckBox" - "wxCheckBox" - 1 - 0 - "" - "" - "m_UnconnectedTestCtrl" - "Unconnected pads" - 0 - "" - "Find unconnected pads" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Expand" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "" - "" - - - - - "wxBoxSizer V" - "dialog-control-document" - "" - "sizer" - 0 - 1 - 0 - 0 - "30/7/2007" - "wbBoxSizerProxy" - "Vertical" - "" - "Centre" - "Top" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "<Any platform>" - - "wxButton: ID_STARTDRC" - "dialog-control-document" - "" - "dialogcontrol" - 0 - 1 - 0 - 0 - "25/11/2007" - "wbButtonProxy" - "wxEVT_COMMAND_BUTTON_CLICKED|OnStartdrcClick|||DrcDialog" - "ID_STARTDRC" - 10006 - "" - "wxButton" - "wxButton" - 1 - 0 - "" - "" - "" - "Start DRC" - 0 - "" - "Start the Design Rule Checker" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Expand" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "" - "" - - - "wxButton: ID_LIST_UNCONNECTED" - "dialog-control-document" - "" - "dialogcontrol" - 0 - 1 - 0 - 0 - "25/11/2007" - "wbButtonProxy" - "wxEVT_COMMAND_BUTTON_CLICKED|OnListUnconnectedClick|||DrcDialog" - "ID_LIST_UNCONNECTED" - 10003 - "" - "wxButton" - "wxButton" - 1 - 0 - "" - "" - "" - "List Unconnected" - 0 - "" - "List unconnected pads or tracks" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Expand" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "" - "" - - - "wxButton: ID_DELETE_ALL" - "dialog-control-document" - "" - "dialogcontrol" - 0 - 1 - 0 - 0 - "25/11/2007" - "wbButtonProxy" - "wxEVT_COMMAND_BUTTON_CLICKED|OnDeleteAllClick|||DrcDialog" - "ID_DELETE_ALL" - 10005 - "" - "wxButton" - "wxButton" - 1 - 0 - "" - "" - "m_DeleteAllButton" - "Delete All Markers" - 0 - "" - "Delete every marker" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Expand" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "" - "" - - - "wxButton: ID_DELETE_ONE" - "dialog-control-document" - "" - "dialogcontrol" - 0 - 1 - 0 - 0 - "25/11/2007" - "wbButtonProxy" - "wxEVT_COMMAND_BUTTON_CLICKED|OnDeleteOneClick|NONE||DrcDialog" - "ID_DELETE_ONE" - 10007 - "" - "wxButton" - "wxButton" - 1 - 0 - "" - "" - "m_DeleteCurrentMarkerButton" - "Delete Current Marker" - 0 - "" - "Delete the marker selected in the listBox below" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - 0 - 0 - "<Any platform>" - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Expand" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "" - "" - - - - - "wxStaticText: wxID_STATIC" - "dialog-control-document" - "" - "statictext" - 0 - 1 - 0 - 0 - "27/3/2006" - "wbStaticTextProxy" - "wxID_STATIC" - 5105 - "" - "wxStaticText" - "wxStaticText" - 1 - 0 - "" - "" - "" - "Error Messages:" - -1 - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - "" - "" - "" - "" - "" - "" - "" - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Expand" - "Centre" - 0 - 10 - 1 - 1 - 0 - 0 - 0 - 1 - 0 - "" - "" - - - "wxNotebook: ID_NOTEBOOK1" - "dialog-control-document" - "" - "notebook" - 0 - 1 - 0 - 0 - "25/11/2007" - "wbNotebookProxy" - "ID_NOTEBOOK1" - 10008 - "" - "wxNotebook" - "wxNotebook" - 1 - 0 - "" - "" - "m_Notebook" - 1 - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - "" - "" - "" - "" - "" - "" - "" - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 1 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Expand" - "Centre" - 5 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "" - "" - - "DRCLISTBOX: ID_CLEARANCE_LIST" - "dialog-control-document" - "" - "foreign" - 0 - 1 - 0 - 0 - "25/11/2007" - "wbForeignCtrlProxy" - "wxEVT_LEFT_DCLICK|OnLeftDClickClearance|NONE||DrcDialog" - "wxEVT_RIGHT_UP|OnRightUpClearance|NONE||DrcDialog" - "ID_CLEARANCE_LIST" - 10001 - "" - "DRCLISTBOX" - "wxListBox" - 1 - 0 - "" - "" - "m_ClearanceListBox" - "Distance Problem Markers" - "" - 1 - "" - "MARKERs, double click any to go there in PCB, right click for popup menu" - "" - "" - "" - 0 - 1 - "<Any platform>" - "" - "" - "" - "" - "" - "" - "" - 0 - 0 - 0 - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 1 - 1 - 0 - "" - -1 - -1 - 100 - 300 - "Centre" - "Centre" - 1 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "" - "" - "" - - - "DRCLISTBOX: ID_UNCONNECTED_LIST" - "dialog-control-document" - "" - "foreign" - 0 - 1 - 0 - 0 - "25/11/2007" - "wbForeignCtrlProxy" - "wxEVT_LEFT_DCLICK|OnLeftDClickUnconnected|NONE||DrcDialog" - "wxEVT_RIGHT_UP|OnRightUpUnconnected|NONE||DrcDialog" - "ID_UNCONNECTED_LIST" - 10009 - "" - "DRCLISTBOX" - "wxListBox" - 1 - 0 - "" - "" - "m_UnconnectedListBox" - "Unconnected" - "" - 1 - "" - "A list of unconnected pads, right click for popup menu" - "" - "" - "" - 0 - 1 - "<Any platform>" - "" - "" - "" - "" - "" - "" - "" - 0 - 0 - 0 - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 1 - 1 - 0 - "" - -1 - -1 - 100 - 100 - "Centre" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "" - "" - "" - - - - "wxStdDialogButtonSizer" - "dialog-control-document" - "" - "sizer" - 0 - 1 - 0 - 0 - "13/11/2007" - "wbStdDialogButtonSizerProxy" - 1 - 1 - 0 - 0 - 0 - 0 - 0 - 0 - "StdDialogButtonSizer" - "Expand" - "Centre" - 0 - 10 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "<Any platform>" - - "wxButton: wxID_CANCEL" - "dialog-control-document" - "" - "dialogcontrol" - 0 - 1 - 0 - 1 - "13/11/2007" - "wbButtonProxy" - "wxEVT_COMMAND_BUTTON_CLICKED|OnCancelClick|NONE||DrcDialog" - "wxID_CANCEL" - 5101 - "" - "wxButton" - "wxButton" - 1 - 0 - "" - "" - "" - "&Cancel" - 0 - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Centre" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "" - "" - - - "wxButton: wxID_OK" - "dialog-control-document" - "" - "dialogcontrol" - 0 - 1 - 0 - 1 - "26/11/2007" - "wbButtonProxy" - "wxEVT_COMMAND_BUTTON_CLICKED|OnOkClick|NONE||DrcDialog" - "wxID_OK" - 5100 - "" - "wxButton" - "wxButton" - 1 - 0 - "" - "" - "" - "&OK" - 1 - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Centre" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "" - "" - - - - - - - "Sources" - "html-document" - "" - "sourcesfolder" - 1 - 1 - 0 - 1 - - "erc_dialog.rc" - "source-editor-document" - "erc_dialog.rc" - "source-editor" - 0 - 0 - 1 - 0 - "27/4/2006" - "" - - - - "Images" - "html-document" - "" - "bitmapsfolder" - 1 - 1 - 0 - 1 - - - - -
diff --git a/pcbnew/dialog_drc_base.cpp b/pcbnew/dialog_drc_base.cpp new file mode 100644 index 0000000000..cdf574672b --- /dev/null +++ b/pcbnew/dialog_drc_base.cpp @@ -0,0 +1,230 @@ +/////////////////////////////////////////////////////////////////////////// +// 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 ); +} diff --git a/pcbnew/dialog_drc_base.fbp b/pcbnew/dialog_drc_base.fbp new file mode 100644 index 0000000000..8cbe5bf892 --- /dev/null +++ b/pcbnew/dialog_drc_base.fbp @@ -0,0 +1,1462 @@ + + + + + + C++ + 1 + UTF-8 + connect + dialog_drc_base + 1000 + none + 1 + dialog_drc_base + + . + + 1 + 0 + 0 + + + + + 1 + + + + 0 + wxID_ANY + + + DIALOG_DRC_CONTROL_BASE + + 678,508 + wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER + + DRC Control + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + m_MainSizer + wxVERTICAL + none + + 5 + wxEXPAND|wxTOP|wxBOTTOM + 0 + + + m_CommandSizer + wxHORIZONTAL + none + + 5 + + 1 + + wxID_ANY + Options + + sbSizerOptions + wxHORIZONTAL + none + + + 5 + wxEXPAND + 1 + + + bSizer7 + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + 4 + wxBOTH + + + 0 + + fgMinValuesSizer + wxFLEX_GROWMODE_SPECIFIED + none + 2 + 0 + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT|wxALIGN_RIGHT + 0 + + + + 1 + + + 0 + wxID_ANY + Clearance + + + m_ClearenceTitle + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + + + 1 + + + 0 + wxID_ANY + + 0 + + m_SetClearance + public + + + + + In the clearance units, enter the clearance distance + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT|wxALIGN_RIGHT + 0 + + + + 1 + + + 0 + wxID_ANY + Via Min Size + + + m_ViaMinTitle + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + + + 1 + + + 0 + wxID_ANY + + 0 + + m_SetViaMinSizeCtrl + public + + + + + In the clearance units, enter the clearance distance + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_RIGHT + 0 + + + + 1 + + + 0 + wxID_ANY + Track Min Width + + + m_TrackMinWidthTitle + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + + 1 + + + 0 + wxID_ANY + + 0 + + m_SetTrackMinWidthCtrl + public + + + + + In the clearance units, enter the clearance distance + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_RIGHT + 0 + + + + 1 + + + 0 + wxID_ANY + MicroVia Min Size + + + m_MicroViaMinTitle + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + + 1 + + + 0 + wxID_ANY + + 0 + + m_SetMicroViakMinSizeCtrl + public + + + + + In the clearance units, enter the clearance distance + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT + 1 + + wxID_ANY + Create Report File + + ReportFileSizer + wxHORIZONTAL + none + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + + 0 + + 1 + + + 0 + ID_CHECKBOX_RPT_FILE + + + + m_CreateRptCtrl + public + + + + + Enable writing report to this file + + + + + OnReportCheckBoxClicked + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL + 1 + + + + 1 + + + 0 + wxID_ANY + + 0 + 200,-1 + m_RptFilenameCtrl + public + + + + + Enter the report filename + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + + + 0 + 1 + + + 0 + ID_BUTTON_BROWSE_RPT_FILE + ... + + + m_BrowseButton + protected + + + + + + + + + OnButtonBrowseRptFileClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL + 0 + + wxID_ANY + Include Tests For: + + sbSizer3 + wxVERTICAL + none + + + 5 + wxALL + 0 + + + 1 + Include tests for clearances between pad to pads + 1 + + + 0 + wxID_ANY + Pad to pad + + + m_Pad2PadTestCtrl + public + + + + + Include tests for clearances between pad to pads + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + 0 + + 1 + + + 0 + wxID_ANY + Zones + + + m_ZonesTestCtrl + public + + + + + Include zones in clearance or unconnected tests + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + 1 + + 1 + + + 0 + wxID_ANY + Unconnected pads + + + m_UnconnectedTestCtrl + public + + + + + Find unconnected pads + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + + bSizer11 + wxVERTICAL + none + + 5 + wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_HORIZONTAL|wxEXPAND + 0 + + + + 1 + 1 + + + 0 + ID_STARTDRC + Start DRC + + + m_buttonRunDRC + protected + + + + + Start the Design Rule Checker + + + + OnStartdrcClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT + 0 + + + + 0 + 1 + + + 0 + ID_LIST_UNCONNECTED + List Unconnected + + + m_buttonListUnconnected + protected + + + + + List unconnected pads or tracks + + + + OnListUnconnectedClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT + 0 + + + + 0 + 1 + + + 0 + ID_DELETE_ALL + Delete All Markers + + + m_DeleteAllButton + protected + + + + + Delete every marker + + + + OnDeleteAllClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxALL + 0 + + + + 0 + 1 + + + 0 + wxID_ANY + Delete Current Marker + + + m_DeleteCurrentMarkerButton + protected + + + + + Delete the marker selected in the listBox below + + + + OnDeleteOneClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + + 1 + + + 0 + wxID_ANY + Error Messages: + + + m_staticTextErrMsg + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND | wxALL + 1 + + + + + 1 + + + 0 + ID_NOTEBOOK1 + + + m_Notebook + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Distance Problem Markers + 1 + + + + 1 + + + 0 + wxID_ANY + + + m_panelClearanceListBox + protected + + + ; + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + bSizeClearanceBox + wxVERTICAL + none + + 5 + wxALL|wxEXPAND + 1 + + + + + 1 + + + 0 + ID_CLEARANCE_LIST + + 450,300 + m_ClearanceListBox + public + + + + DRCLISTBOX; dialog_drc.h + MARKERs, double click any to go there in PCB, right click for popup menu + + + + + + + + + + + OnLeftDClickClearance + + + + + + + + + + + + + + OnRightUpClearance + + + + + + + + + + + Unconnected + 0 + + + + 1 + + + 0 + wxID_ANY + + + m_panelUnconnectedBox + protected + + + + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + bSizerUnconnectedBox + wxVERTICAL + none + + 5 + wxALL|wxEXPAND + 1 + + + + + 1 + + + 0 + ID_UNCONNECTED_LIST + + + m_UnconnectedListBox + public + + + + DRCLISTBOX; + A list of unconnected pads, right click for popup menu + + + + + + + + + + + OnLeftDClickUnconnected + + + + + + + + + + + + + + OnRightUpUnconnected + + + + + + + + + + + + 5 + wxALIGN_RIGHT|wxALL + 0 + + 0 + 1 + 0 + 0 + 0 + 1 + 0 + 0 + + m_sdbSizer1 + protected + + OnCancelClick + + + + OnOkClick + + + + + + + + diff --git a/pcbnew/dialog_drc_base.h b/pcbnew/dialog_drc_base.h new file mode 100644 index 0000000000..e196688b66 --- /dev/null +++ b/pcbnew/dialog_drc_base.h @@ -0,0 +1,103 @@ +/////////////////////////////////////////////////////////////////////////// +// 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 + +class DRCLISTBOX; + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + +#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__ diff --git a/pcbnew/drc.cpp b/pcbnew/drc.cpp index d0f76a92bc..87086bea5e 100644 --- a/pcbnew/drc.cpp +++ b/pcbnew/drc.cpp @@ -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 diff --git a/pcbnew/drc_stuff.h b/pcbnew/drc_stuff.h index c74d1ee96e..148cfccbef 100644 --- a/pcbnew/drc_stuff.h +++ b/pcbnew/drc_stuff.h @@ -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_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 diff --git a/pcbnew/ioascii.cpp b/pcbnew/ioascii.cpp index 3b894fa4e4..f44514ef9c 100644 --- a/pcbnew/ioascii.cpp +++ b/pcbnew/ioascii.cpp @@ -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",