diff --git a/pcbnew/class_edge_mod.cpp b/pcbnew/class_edge_mod.cpp index c0d866fb22..54bc4e5fa7 100644 --- a/pcbnew/class_edge_mod.cpp +++ b/pcbnew/class_edge_mod.cpp @@ -460,7 +460,10 @@ int EDGE_MODULE::ReadDescr( char* Line, FILE* File, m_Width = MAX_WIDTH; // Check for a reasonnable layer: - if ( (m_Layer < FIRST_NON_COPPER_LAYER) || (m_Layer > LAST_NON_COPPER_LAYER) ) + // m_Layer must be >= FIRST_NON_COPPER_LAYER, but because microwave footprints + // can use the copper layers m_Layer < FIRST_NON_COPPER_LAYER is allowed. + // @todo: changes use of EDGE_MODULE these footprints and allows only m_Layer >= FIRST_NON_COPPER_LAYER + if ( (m_Layer < 0) || (m_Layer > LAST_NON_COPPER_LAYER) ) m_Layer = SILKSCREEN_N_CMP; return error; } diff --git a/pcbnew/zones_by_polygon.cpp b/pcbnew/zones_by_polygon.cpp index 4b4588ac2a..61865b6a43 100644 --- a/pcbnew/zones_by_polygon.cpp +++ b/pcbnew/zones_by_polygon.cpp @@ -154,9 +154,9 @@ void WinEDA_PcbFrame::Delete_Zone_Fill( wxDC* DC, SEGZONE* aZone, long aTimestam /*******************************************************/ int WinEDA_PcbFrame::Delete_LastCreatedCorner( wxDC* DC ) -/*****************************************************************************/ +/*******************************************************/ -/** Used only while creating a new zone outline +/** Used **only** while creating a new zone outline * Remove and delete the current outline segment in progress * @return 0 if no corner in list, or corner number * if no corner in list, close the outline creation @@ -170,13 +170,13 @@ int WinEDA_PcbFrame::Delete_LastCreatedCorner( wxDC* DC ) if( zone->GetNumCorners() == 0 ) return 0; - zone->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR ); + zone->DrawWhileCreateOutline( DrawPanel, DC, GR_XOR ); - if( zone->GetNumCorners() > 1 ) + if( zone->GetNumCorners() > 2 ) { zone->m_Poly->DeleteCorner( zone->GetNumCorners() - 1 ); - if( DrawPanel->ManageCurseur ) - DrawPanel->ManageCurseur( DrawPanel, DC, TRUE ); + if ( DrawPanel->ManageCurseur ) + DrawPanel->ManageCurseur(DrawPanel, DC, false); } else { @@ -184,6 +184,7 @@ int WinEDA_PcbFrame::Delete_LastCreatedCorner( wxDC* DC ) DrawPanel->ForceCloseManageCurseur = NULL; SetCurItem( NULL ); zone->RemoveAllContours(); + zone->m_Flags = 0; } return zone->GetNumCorners(); } @@ -542,7 +543,10 @@ int WinEDA_PcbFrame::Begin_Zone( wxDC* DC ) if( zone->GetCornerPosition( ii - 1 ) != zone->GetCornerPosition( ii ) ) { if( Drc_On && m_drc->Drc( zone, ii - 1 ) == OK_DRC ) // Ok, we can add a new corner + { zone->AppendCorner( GetScreen()->m_Curseur ); + SetCurItem( zone ); // calls Display_Infos(). + } } } diff --git a/polygon/PolyLine.cpp b/polygon/PolyLine.cpp index 8bf41caf79..b98b26d6c0 100644 --- a/polygon/PolyLine.cpp +++ b/polygon/PolyLine.cpp @@ -1038,25 +1038,8 @@ void CPolyLine::Hatch() min_a = (int)(min_y - slope*min_x); } min_a = (min_a/spacing)*spacing; - int offset = 0; - if( layer < (LAY_TOP_COPPER+2) ) - offset = 0; - else if( layer < (LAY_TOP_COPPER+4) ) - offset = spacing/2; - else if( layer < (LAY_TOP_COPPER+6) ) - offset = spacing/4; - else if( layer < (LAY_TOP_COPPER+8) ) - offset = 3*spacing/4; - else if( layer < (LAY_TOP_COPPER+10) ) - offset = 1*spacing/8; - else if( layer < (LAY_TOP_COPPER+12) ) - offset = 3*spacing/8; - else if( layer < (LAY_TOP_COPPER+14) ) - offset = 5*spacing/8; - else if( layer < (LAY_TOP_COPPER+16) ) - offset = 7*spacing/8; - else - wxASSERT(0); + // calculate an offset depending on layer number, for a better display of hatches on a multilayer board + int offset = (layer * 7) / 8; min_a += offset; // now calculate and draw hatch lines diff --git a/polygon/PolyLine2Kicad.h b/polygon/PolyLine2Kicad.h index 34c3cf016a..9332e1ffec 100644 --- a/polygon/PolyLine2Kicad.h +++ b/polygon/PolyLine2Kicad.h @@ -10,27 +10,17 @@ // // When used for copper areas, the first contour is the outer edge // of the area, subsequent ones are "holes" in the copper. -// -// If a CDisplayList pointer is provided, the polyline can draw itself #ifndef POLYLINE2KICAD_H #define POLYLINE2KICAD_H #define PCBU_PER_MIL 10 -#define MAX_LAYERS 32 #define NM_PER_MIL 10 // 25400 #include "pad_shapes.h" -#define LAY_SELECTION 0 -#define LAY_TOP_COPPER 0 - -#define CDC wxDC -class wxDC; - - class CRect { public: int left, right, top, bottom; diff --git a/polygon/math_for_graphics.cpp b/polygon/math_for_graphics.cpp index b59fceca3d..724a194fe9 100644 --- a/polygon/math_for_graphics.cpp +++ b/polygon/math_for_graphics.cpp @@ -241,7 +241,7 @@ int MakeEllipseFromArc( int xi, int yi, int xf, int yf, int style, EllipseKH * e yyf = yf; } // find center and radii of ellipse - double xo, yo; + double xo=0, yo=0; if( xxf > xxi && yyf > yyi ) { xo = xxf; @@ -1281,7 +1281,7 @@ int GetClearanceBetweenSegments( int x1i, int y1i, int x1f, int y1f, int style1, EllipseKH el1; EllipseKH el2; bool bArcs; - int xi, yi, xf, yf; + int xi=0, yi=0, xf=0, yf=0; if( style2 == CPolyLine::STRAIGHT ) { // style1 = arc, style2 = straight @@ -1601,7 +1601,7 @@ int GetArcIntersections( EllipseKH * el1, EllipseKH * el2, double yr = el2->yrad*yscale; // now test NSTEPS positions in arc, moving clockwise (ie. decreasing theta) double step = M_PI/((NSTEPS-1)*2.0); - double d_prev, th_prev; + double d_prev=0, th_prev; double th_interp; double th1; int n = 0; @@ -1676,7 +1676,7 @@ double GetArcClearance( EllipseKH * el1, EllipseKH * el2, double th_start2 = el2->theta1; double th_end2 = el2->theta2; double dmin = DBL_MAX; - double xmin, ymin, thmin, thmin2; + double xmin=0, ymin=0, thmin=0, thmin2=0; int nsteps = NSTEPS; int nsteps2 = NSTEPS; diff --git a/polygon/math_for_graphics.h b/polygon/math_for_graphics.h index 9bf4d7c5a4..5a0ae7278a 100644 --- a/polygon/math_for_graphics.h +++ b/polygon/math_for_graphics.h @@ -55,8 +55,11 @@ public: }; // math stuff for graphics -BOOL Quadratic( double a, double b, double c, double *x1, double *x2 ); +#if 0 void DrawArc( CDC * pDC, int shape, int xxi, int yyi, int xxf, int yyf, BOOL bMeta=FALSE ); +#endif + +BOOL Quadratic( double a, double b, double c, double *x1, double *x2 ); void RotatePoint( CPoint *p, int angle, CPoint org ); void RotateRect( CRect *r, int angle, CPoint org ); int TestLineHit( int xi, int yi, int xf, int yf, int x, int y, double dist );