Lots and lots of PCBNew code cleaning and fix build bug introduced in r3108.
* Changed <wx-2.8/xml/xml.h> to "xnode.h" in pcbnew_config.cpp to fix bug when building against wxWidgets 2.9 and above. * Convert broken wxXmlNode code to use XNODE. * Overloaded XNODE constructor for creating child nodes. * Translate French naming conventions. * Translate French comments. * Remove tabs from several source files. * Coding style policy and Doxygen comment fixes.
This commit is contained in:
parent
c7dee03967
commit
0c44335795
|
@ -92,7 +92,9 @@ void Pcb3D_GLCanvas::Redraw( bool finish )
|
||||||
glRotatef( g_Parm_3D_Visu.m_Rot[2], 0.0, 0.0, 1.0 );
|
glRotatef( g_Parm_3D_Visu.m_Rot[2], 0.0, 0.0, 1.0 );
|
||||||
|
|
||||||
if( m_gllist )
|
if( m_gllist )
|
||||||
|
{
|
||||||
glCallList( m_gllist );
|
glCallList( m_gllist );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CreateDrawGL_List();
|
CreateDrawGL_List();
|
||||||
|
@ -146,8 +148,7 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
|
||||||
for( ii = 0; ii < 32; ii++ )
|
for( ii = 0; ii < 32; ii++ )
|
||||||
{
|
{
|
||||||
if( ii < g_Parm_3D_Visu.m_Layers )
|
if( ii < g_Parm_3D_Visu.m_Layers )
|
||||||
g_Parm_3D_Visu.m_LayerZcoord[ii] =
|
g_Parm_3D_Visu.m_LayerZcoord[ii] = g_Parm_3D_Visu.m_Epoxy_Width
|
||||||
g_Parm_3D_Visu.m_Epoxy_Width
|
|
||||||
* ii / (g_Parm_3D_Visu.m_Layers - 1);
|
* ii / (g_Parm_3D_Visu.m_Layers - 1);
|
||||||
else
|
else
|
||||||
g_Parm_3D_Visu.m_LayerZcoord[ii] = g_Parm_3D_Visu.m_Epoxy_Width;
|
g_Parm_3D_Visu.m_LayerZcoord[ii] = g_Parm_3D_Visu.m_Epoxy_Width;
|
||||||
|
@ -277,16 +278,20 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
|
||||||
for( ii = 0; ii < pcb->GetAreaCount(); ii++ )
|
for( ii = 0; ii < pcb->GetAreaCount(); ii++ )
|
||||||
{
|
{
|
||||||
ZONE_CONTAINER* zone = pcb->GetArea( ii );
|
ZONE_CONTAINER* zone = pcb->GetArea( ii );
|
||||||
|
|
||||||
if( zone->m_FilledPolysList.size() == 0 )
|
if( zone->m_FilledPolysList.size() == 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( zone->m_ZoneMinThickness <= 1 )
|
if( zone->m_ZoneMinThickness <= 1 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int imax = zone->m_FilledPolysList.size() - 1;
|
int imax = zone->m_FilledPolysList.size() - 1;
|
||||||
CPolyPt* firstcorner = &zone->m_FilledPolysList[0];
|
CPolyPt* firstcorner = &zone->m_FilledPolysList[0];
|
||||||
CPolyPt* begincorner = firstcorner;
|
CPolyPt* begincorner = firstcorner;
|
||||||
SEGZONE dummysegment( pcb );
|
SEGZONE dummysegment( pcb );
|
||||||
dummysegment.SetLayer( zone->GetLayer() );
|
dummysegment.SetLayer( zone->GetLayer() );
|
||||||
dummysegment.m_Width = zone->m_ZoneMinThickness;
|
dummysegment.m_Width = zone->m_ZoneMinThickness;
|
||||||
|
|
||||||
for( int ic = 1; ic <= imax; ic++ )
|
for( int ic = 1; ic <= imax; ic++ )
|
||||||
{
|
{
|
||||||
CPolyPt* endcorner = &zone->m_FilledPolysList[ic];
|
CPolyPt* endcorner = &zone->m_FilledPolysList[ic];
|
||||||
|
@ -312,16 +317,19 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
|
||||||
|
|
||||||
Draw3D_Track( &dummysegment );
|
Draw3D_Track( &dummysegment );
|
||||||
}
|
}
|
||||||
|
|
||||||
ic++;
|
ic++;
|
||||||
|
|
||||||
if( ic < imax - 1 )
|
if( ic < imax - 1 )
|
||||||
begincorner = firstcorner =
|
begincorner = firstcorner = &zone->m_FilledPolysList[ic];
|
||||||
&zone->m_FilledPolysList[ic];
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
begincorner = endcorner;
|
begincorner = endcorner;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* draw graphic items */
|
/* draw graphic items */
|
||||||
EDA_ITEM* PtStruct;
|
EDA_ITEM* PtStruct;
|
||||||
|
@ -345,6 +353,7 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
|
||||||
|
|
||||||
/* draw footprints */
|
/* draw footprints */
|
||||||
MODULE* Module = pcb->m_Modules;
|
MODULE* Module = pcb->m_Modules;
|
||||||
|
|
||||||
for( ; Module != NULL; Module = Module->Next() )
|
for( ; Module != NULL; Module = Module->Next() )
|
||||||
{
|
{
|
||||||
Module->Draw3D( this );
|
Module->Draw3D( this );
|
||||||
|
@ -373,6 +382,7 @@ void Pcb3D_GLCanvas::Draw3D_Track( TRACK* track )
|
||||||
|
|
||||||
if( layer == LAST_COPPER_LAYER )
|
if( layer == LAST_COPPER_LAYER )
|
||||||
layer = g_Parm_3D_Visu.m_Layers - 1;
|
layer = g_Parm_3D_Visu.m_Layers - 1;
|
||||||
|
|
||||||
zpos = g_Parm_3D_Visu.m_LayerZcoord[layer];
|
zpos = g_Parm_3D_Visu.m_LayerZcoord[layer];
|
||||||
|
|
||||||
SetGLColor( color );
|
SetGLColor( color );
|
||||||
|
@ -404,6 +414,7 @@ void Pcb3D_GLCanvas::Draw3D_SolidPolygonsInZones( ZONE_CONTAINER* aZone )
|
||||||
|
|
||||||
if( layer == LAST_COPPER_LAYER )
|
if( layer == LAST_COPPER_LAYER )
|
||||||
layer = g_Parm_3D_Visu.m_Layers - 1;
|
layer = g_Parm_3D_Visu.m_Layers - 1;
|
||||||
|
|
||||||
zpos = g_Parm_3D_Visu.m_LayerZcoord[layer];
|
zpos = g_Parm_3D_Visu.m_LayerZcoord[layer];
|
||||||
g_Parm_3D_Visu.m_ActZpos = zpos;
|
g_Parm_3D_Visu.m_ActZpos = zpos;
|
||||||
|
|
||||||
|
@ -471,16 +482,16 @@ void Pcb3D_GLCanvas::Draw3D_Via( SEGVIA* via )
|
||||||
zpos = g_Parm_3D_Visu.m_LayerZcoord[layer];
|
zpos = g_Parm_3D_Visu.m_LayerZcoord[layer];
|
||||||
if( layer < g_Parm_3D_Visu.m_Layers - 1 )
|
if( layer < g_Parm_3D_Visu.m_Layers - 1 )
|
||||||
{
|
{
|
||||||
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) ==
|
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) == false )
|
||||||
false )
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
color = g_ColorsSettings.GetLayerColor( layer );
|
color = g_ColorsSettings.GetLayerColor( layer );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( LAYER_N_FRONT ) ==
|
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( LAYER_N_FRONT ) == false )
|
||||||
false )
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
color = g_ColorsSettings.GetLayerColor( LAYER_N_FRONT );
|
color = g_ColorsSettings.GetLayerColor( LAYER_N_FRONT );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -488,11 +499,14 @@ void Pcb3D_GLCanvas::Draw3D_Via( SEGVIA* via )
|
||||||
|
|
||||||
// SetGLColor( LIGHTGRAY );
|
// SetGLColor( LIGHTGRAY );
|
||||||
glNormal3f( 0.0, 0.0, (layer == LAYER_N_BACK) ? -1.0 : 1.0 );
|
glNormal3f( 0.0, 0.0, (layer == LAYER_N_BACK) ? -1.0 : 1.0 );
|
||||||
|
|
||||||
if( layer == LAYER_N_BACK )
|
if( layer == LAYER_N_BACK )
|
||||||
zpos = zpos - 5 * g_Parm_3D_Visu.m_BoardScale;
|
zpos = zpos - 5 * g_Parm_3D_Visu.m_BoardScale;
|
||||||
else
|
else
|
||||||
zpos = zpos + 5 * g_Parm_3D_Visu.m_BoardScale;
|
zpos = zpos + 5 * g_Parm_3D_Visu.m_BoardScale;
|
||||||
|
|
||||||
Draw3D_FilledCircle( x, -y, r, hole, zpos );
|
Draw3D_FilledCircle( x, -y, r, hole, zpos );
|
||||||
|
|
||||||
if( layer >= top_layer )
|
if( layer >= top_layer )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -500,10 +514,8 @@ void Pcb3D_GLCanvas::Draw3D_Via( SEGVIA* via )
|
||||||
// Drawing hole:
|
// Drawing hole:
|
||||||
color = g_ColorsSettings.GetItemColor( VIAS_VISIBLE + via->m_Shape );
|
color = g_ColorsSettings.GetItemColor( VIAS_VISIBLE + via->m_Shape );
|
||||||
SetGLColor( color );
|
SetGLColor( color );
|
||||||
height = g_Parm_3D_Visu.m_LayerZcoord[top_layer] -
|
height = g_Parm_3D_Visu.m_LayerZcoord[top_layer] - g_Parm_3D_Visu.m_LayerZcoord[bottom_layer];
|
||||||
g_Parm_3D_Visu.m_LayerZcoord[bottom_layer];
|
Draw3D_FilledCylinder( x, -y, hole, height, g_Parm_3D_Visu.m_LayerZcoord[bottom_layer] );
|
||||||
Draw3D_FilledCylinder( x, -y, hole, height,
|
|
||||||
g_Parm_3D_Visu.m_LayerZcoord[bottom_layer] );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -553,6 +565,7 @@ void Pcb3D_GLCanvas::Draw3D_DrawSegment( DRAWSEGMENT* segment )
|
||||||
{
|
{
|
||||||
glNormal3f( 0.0, 0.0, Get3DLayerSide( layer ) );
|
glNormal3f( 0.0, 0.0, Get3DLayerSide( layer ) );
|
||||||
zpos = g_Parm_3D_Visu.m_LayerZcoord[layer];
|
zpos = g_Parm_3D_Visu.m_LayerZcoord[layer];
|
||||||
|
|
||||||
if( Get3DLayerEnable( layer ) )
|
if( Get3DLayerEnable( layer ) )
|
||||||
{
|
{
|
||||||
switch( segment->m_Shape )
|
switch( segment->m_Shape )
|
||||||
|
@ -591,8 +604,7 @@ static void Draw3dTextSegm( int x0, int y0, int xf, int yf )
|
||||||
double endx = xf * g_Parm_3D_Visu.m_BoardScale;
|
double endx = xf * g_Parm_3D_Visu.m_BoardScale;
|
||||||
double endy = yf * g_Parm_3D_Visu.m_BoardScale;
|
double endy = yf * g_Parm_3D_Visu.m_BoardScale;
|
||||||
|
|
||||||
Draw3D_FilledSegment( startx, -starty, endx, -endy,
|
Draw3D_FilledSegment( startx, -starty, endx, -endy, s_Text3DWidth, s_Text3DZPos );
|
||||||
s_Text3DWidth, s_Text3DZPos );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -605,14 +617,15 @@ void Pcb3D_GLCanvas::Draw3D_DrawText( TEXTE_PCB* text )
|
||||||
|
|
||||||
int color = g_ColorsSettings.GetLayerColor( layer );
|
int color = g_ColorsSettings.GetLayerColor( layer );
|
||||||
|
|
||||||
|
|
||||||
SetGLColor( color );
|
SetGLColor( color );
|
||||||
s_Text3DZPos = g_Parm_3D_Visu.m_LayerZcoord[layer];
|
s_Text3DZPos = g_Parm_3D_Visu.m_LayerZcoord[layer];
|
||||||
s_Text3DWidth = text->m_Thickness * g_Parm_3D_Visu.m_BoardScale;
|
s_Text3DWidth = text->m_Thickness * g_Parm_3D_Visu.m_BoardScale;
|
||||||
glNormal3f( 0.0, 0.0, Get3DLayerSide( layer ) );
|
glNormal3f( 0.0, 0.0, Get3DLayerSide( layer ) );
|
||||||
wxSize size = text->m_Size;
|
wxSize size = text->m_Size;
|
||||||
|
|
||||||
if( text->m_Mirror )
|
if( text->m_Mirror )
|
||||||
NEGATE( size.x );
|
NEGATE( size.x );
|
||||||
|
|
||||||
if( text->m_MultilineAllowed )
|
if( text->m_MultilineAllowed )
|
||||||
{
|
{
|
||||||
wxPoint pos = text->m_Pos;
|
wxPoint pos = text->m_Pos;
|
||||||
|
@ -622,6 +635,7 @@ void Pcb3D_GLCanvas::Draw3D_DrawText( TEXTE_PCB* text )
|
||||||
offset.y = text->GetInterline();
|
offset.y = text->GetInterline();
|
||||||
|
|
||||||
RotatePoint( &offset, text->m_Orient );
|
RotatePoint( &offset, text->m_Orient );
|
||||||
|
|
||||||
for( unsigned i = 0; i<list->Count(); i++ )
|
for( unsigned i = 0; i<list->Count(); i++ )
|
||||||
{
|
{
|
||||||
wxString txt = list->Item( i );
|
wxString txt = list->Item( i );
|
||||||
|
@ -636,6 +650,7 @@ void Pcb3D_GLCanvas::Draw3D_DrawText( TEXTE_PCB* text )
|
||||||
delete (list);
|
delete (list);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
DrawGraphicText( NULL, NULL, text->m_Pos, (EDA_Colors) color,
|
DrawGraphicText( NULL, NULL, text->m_Pos, (EDA_Colors) color,
|
||||||
text->m_Text, text->m_Orient, size,
|
text->m_Text, text->m_Orient, size,
|
||||||
text->m_HJustify, text->m_VJustify,
|
text->m_HJustify, text->m_VJustify,
|
||||||
|
@ -643,6 +658,7 @@ void Pcb3D_GLCanvas::Draw3D_DrawText( TEXTE_PCB* text )
|
||||||
true,
|
true,
|
||||||
Draw3dTextSegm );
|
Draw3dTextSegm );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas )
|
void MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas )
|
||||||
|
@ -652,6 +668,7 @@ void MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas )
|
||||||
/* Draw pads */
|
/* Draw pads */
|
||||||
glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
|
glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
|
||||||
glNormal3f( 0.0, 0.0, 1.0 ); // Normal is Z axis
|
glNormal3f( 0.0, 0.0, 1.0 ); // Normal is Z axis
|
||||||
|
|
||||||
for( ; pad != NULL; pad = pad->Next() )
|
for( ; pad != NULL; pad = pad->Next() )
|
||||||
{
|
{
|
||||||
pad->Draw3D( glcanvas );
|
pad->Draw3D( glcanvas );
|
||||||
|
@ -679,6 +696,7 @@ void MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas )
|
||||||
glRotatef( 180.0, 0.0, 1.0, 0.0 );
|
glRotatef( 180.0, 0.0, 1.0, 0.0 );
|
||||||
glRotatef( 180.0, 0.0, 0.0, 1.0 );
|
glRotatef( 180.0, 0.0, 0.0, 1.0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
DataScale3D = g_Parm_3D_Visu.m_BoardScale * UNITS3D_TO_UNITSPCB;
|
DataScale3D = g_Parm_3D_Visu.m_BoardScale * UNITS3D_TO_UNITSPCB;
|
||||||
|
|
||||||
for( ; Struct3D != NULL; Struct3D = Struct3D->Next() )
|
for( ; Struct3D != NULL; Struct3D = Struct3D->Next() )
|
||||||
|
@ -889,8 +907,8 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
|
||||||
|
|
||||||
glNormal3f( 0.0, 0.0, 1.0 ); // Normal is Z axis
|
glNormal3f( 0.0, 0.0, 1.0 ); // Normal is Z axis
|
||||||
nlmax = g_Parm_3D_Visu.m_Layers - 1;
|
nlmax = g_Parm_3D_Visu.m_Layers - 1;
|
||||||
Oncu = (m_Masque_Layer & LAYER_BACK) ? TRUE : FALSE;
|
Oncu = (m_layerMask & LAYER_BACK) ? TRUE : FALSE;
|
||||||
Oncmp = (m_Masque_Layer & LAYER_FRONT) ? TRUE : FALSE;
|
Oncmp = (m_layerMask & LAYER_FRONT) ? TRUE : FALSE;
|
||||||
Both = Oncu && Oncmp;
|
Both = Oncu && Oncmp;
|
||||||
|
|
||||||
switch( m_PadShape & 0x7F )
|
switch( m_PadShape & 0x7F )
|
||||||
|
@ -899,29 +917,35 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
|
||||||
x = xc * scale;
|
x = xc * scale;
|
||||||
y = yc * scale;
|
y = yc * scale;
|
||||||
r = (double) dx * scale;
|
r = (double) dx * scale;
|
||||||
|
|
||||||
for( layer = FIRST_COPPER_LAYER; layer <= LAST_COPPER_LAYER; layer++ )
|
for( layer = FIRST_COPPER_LAYER; layer <= LAST_COPPER_LAYER; layer++ )
|
||||||
{
|
{
|
||||||
if( layer && (layer == nlmax) )
|
if( layer && (layer == nlmax) )
|
||||||
layer = LAYER_N_FRONT;
|
layer = LAYER_N_FRONT;
|
||||||
|
|
||||||
if( (layer == LAYER_N_FRONT) && !Oncmp )
|
if( (layer == LAYER_N_FRONT) && !Oncmp )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( (layer == LAYER_N_BACK) && !Oncu )
|
if( (layer == LAYER_N_BACK) && !Oncu )
|
||||||
continue;
|
continue;
|
||||||
if( (layer > FIRST_COPPER_LAYER) && (layer < LAST_COPPER_LAYER)
|
|
||||||
&& !Both )
|
if( (layer > FIRST_COPPER_LAYER) && (layer < LAST_COPPER_LAYER) && !Both )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
color = g_ColorsSettings.GetLayerColor( layer );
|
color = g_ColorsSettings.GetLayerColor( layer );
|
||||||
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) ==
|
|
||||||
false )
|
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) == false )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
SetGLColor( color );
|
SetGLColor( color );
|
||||||
glNormal3f( 0.0, 0.0, (layer == LAYER_N_BACK) ? -1.0 : 1.0 );
|
glNormal3f( 0.0, 0.0, (layer == LAYER_N_BACK) ? -1.0 : 1.0 );
|
||||||
zpos = g_Parm_3D_Visu.m_LayerZcoord[layer];
|
zpos = g_Parm_3D_Visu.m_LayerZcoord[layer];
|
||||||
|
|
||||||
if( layer == LAYER_N_BACK )
|
if( layer == LAYER_N_BACK )
|
||||||
zpos = zpos - 5 * g_Parm_3D_Visu.m_BoardScale;
|
zpos = zpos - 5 * g_Parm_3D_Visu.m_BoardScale;
|
||||||
else
|
else
|
||||||
zpos = zpos + 5 * g_Parm_3D_Visu.m_BoardScale;
|
zpos = zpos + 5 * g_Parm_3D_Visu.m_BoardScale;
|
||||||
|
|
||||||
Draw3D_FilledCircle( x, -y, r, hole, zpos );
|
Draw3D_FilledCircle( x, -y, r, hole, zpos );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -940,42 +964,48 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
|
||||||
delta_cy = dy - dx;
|
delta_cy = dy - dx;
|
||||||
w = m_Size.x * scale;
|
w = m_Size.x * scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
RotatePoint( &delta_cx, &delta_cy, angle );
|
RotatePoint( &delta_cx, &delta_cy, angle );
|
||||||
|
|
||||||
{
|
{
|
||||||
double ox, oy, fx, fy;
|
double ox, oy, fx, fy;
|
||||||
ox = (double) ( ux0 + delta_cx ) * scale;
|
ox = (double) ( ux0 + delta_cx ) * scale;
|
||||||
oy = (double) ( uy0 + delta_cy ) * scale;
|
oy = (double) ( uy0 + delta_cy ) * scale;
|
||||||
fx = (double) ( ux0 - delta_cx ) * scale;
|
fx = (double) ( ux0 - delta_cx ) * scale;
|
||||||
fy = (double) ( uy0 - delta_cy ) * scale;
|
fy = (double) ( uy0 - delta_cy ) * scale;
|
||||||
for( layer = FIRST_COPPER_LAYER;
|
|
||||||
layer <= LAST_COPPER_LAYER;
|
for( layer = FIRST_COPPER_LAYER; layer <= LAST_COPPER_LAYER; layer++ )
|
||||||
layer++ )
|
|
||||||
{
|
{
|
||||||
if( layer && (layer == nlmax) )
|
if( layer && (layer == nlmax) )
|
||||||
layer = LAYER_N_FRONT;
|
layer = LAYER_N_FRONT;
|
||||||
|
|
||||||
if( (layer == LAYER_N_FRONT) && !Oncmp )
|
if( (layer == LAYER_N_FRONT) && !Oncmp )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( (layer == LAYER_N_BACK) && !Oncu )
|
if( (layer == LAYER_N_BACK) && !Oncu )
|
||||||
continue;
|
continue;
|
||||||
if( (layer > FIRST_COPPER_LAYER)
|
|
||||||
&& (layer < LAST_COPPER_LAYER) && !Both )
|
if( (layer > FIRST_COPPER_LAYER) && (layer < LAST_COPPER_LAYER) && !Both )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
color = g_ColorsSettings.GetLayerColor( layer );
|
color = g_ColorsSettings.GetLayerColor( layer );
|
||||||
glNormal3f( 0.0, 0.0, (layer == LAYER_N_BACK) ? -1.0 : 1.0 );
|
glNormal3f( 0.0, 0.0, (layer == LAYER_N_BACK) ? -1.0 : 1.0 );
|
||||||
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) ==
|
|
||||||
false )
|
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) == false )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
SetGLColor( color );
|
SetGLColor( color );
|
||||||
zpos = g_Parm_3D_Visu.m_LayerZcoord[layer];
|
zpos = g_Parm_3D_Visu.m_LayerZcoord[layer];
|
||||||
|
|
||||||
if( layer == LAYER_N_BACK )
|
if( layer == LAYER_N_BACK )
|
||||||
zpos = zpos - 5 * g_Parm_3D_Visu.m_BoardScale;
|
zpos = zpos - 5 * g_Parm_3D_Visu.m_BoardScale;
|
||||||
else
|
else
|
||||||
zpos = zpos + 5 * g_Parm_3D_Visu.m_BoardScale;
|
zpos = zpos + 5 * g_Parm_3D_Visu.m_BoardScale;
|
||||||
Draw3D_FilledSegmentWithHole( ox, -oy, fx, -fy, w, drillx,
|
|
||||||
-drilly, hole, zpos );
|
Draw3D_FilledSegmentWithHole( ox, -oy, fx, -fy, w, drillx, -drilly, hole, zpos );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PAD_RECT:
|
case PAD_RECT:
|
||||||
|
@ -984,6 +1014,7 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
|
||||||
wxPoint coord[5];
|
wxPoint coord[5];
|
||||||
wxRealPoint fcoord[8], f_hole_coord[8];
|
wxRealPoint fcoord[8], f_hole_coord[8];
|
||||||
BuildPadPolygon( coord, wxSize(0,0), angle );
|
BuildPadPolygon( coord, wxSize(0,0), angle );
|
||||||
|
|
||||||
for( ii = 0; ii < 4; ii++ )
|
for( ii = 0; ii < 4; ii++ )
|
||||||
{
|
{
|
||||||
coord[ii].x += ux0;
|
coord[ii].x += ux0;
|
||||||
|
@ -996,8 +1027,10 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
|
||||||
for( ii = 0; ii < 7; ii += 2 )
|
for( ii = 0; ii < 7; ii += 2 )
|
||||||
{
|
{
|
||||||
ll = ii + 2;
|
ll = ii + 2;
|
||||||
|
|
||||||
if( ll > 7 )
|
if( ll > 7 )
|
||||||
ll -= 8;
|
ll -= 8;
|
||||||
|
|
||||||
fcoord[ii + 1].x = (fcoord[ii].x + fcoord[ll].x) / 2;
|
fcoord[ii + 1].x = (fcoord[ii].x + fcoord[ll].x) / 2;
|
||||||
fcoord[ii + 1].y = (fcoord[ii].y + fcoord[ll].y) / 2;
|
fcoord[ii + 1].y = (fcoord[ii].y + fcoord[ll].y) / 2;
|
||||||
}
|
}
|
||||||
|
@ -1015,26 +1048,32 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
|
||||||
{
|
{
|
||||||
if( layer && (layer == nlmax) )
|
if( layer && (layer == nlmax) )
|
||||||
layer = LAYER_N_FRONT;
|
layer = LAYER_N_FRONT;
|
||||||
|
|
||||||
if( (layer == LAYER_N_FRONT) && !Oncmp )
|
if( (layer == LAYER_N_FRONT) && !Oncmp )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( (layer == LAYER_N_BACK) && !Oncu )
|
if( (layer == LAYER_N_BACK) && !Oncu )
|
||||||
continue;
|
continue;
|
||||||
if( (layer > FIRST_COPPER_LAYER) && (layer < LAST_COPPER_LAYER)
|
|
||||||
&& !Both )
|
if( (layer > FIRST_COPPER_LAYER) && (layer < LAST_COPPER_LAYER) && !Both )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
color = g_ColorsSettings.GetLayerColor( layer );
|
color = g_ColorsSettings.GetLayerColor( layer );
|
||||||
glNormal3f( 0.0, 0.0, (layer == LAYER_N_BACK) ? -1.0 : 1.0 );
|
glNormal3f( 0.0, 0.0, (layer == LAYER_N_BACK) ? -1.0 : 1.0 );
|
||||||
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) ==
|
|
||||||
false )
|
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) == false )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
SetGLColor( color );
|
SetGLColor( color );
|
||||||
zpos = g_Parm_3D_Visu.m_LayerZcoord[layer];
|
zpos = g_Parm_3D_Visu.m_LayerZcoord[layer];
|
||||||
|
|
||||||
if( layer == LAYER_N_BACK )
|
if( layer == LAYER_N_BACK )
|
||||||
zpos = zpos - 5 * g_Parm_3D_Visu.m_BoardScale;
|
zpos = zpos - 5 * g_Parm_3D_Visu.m_BoardScale;
|
||||||
else
|
else
|
||||||
zpos = zpos + 5 * g_Parm_3D_Visu.m_BoardScale;
|
zpos = zpos + 5 * g_Parm_3D_Visu.m_BoardScale;
|
||||||
|
|
||||||
glBegin( GL_QUAD_STRIP );
|
glBegin( GL_QUAD_STRIP );
|
||||||
|
|
||||||
for( ii = 0; ii < 8; ii++ )
|
for( ii = 0; ii < 8; ii++ )
|
||||||
{
|
{
|
||||||
glVertex3f( f_hole_coord[ii].x, -f_hole_coord[ii].y, zpos );
|
glVertex3f( f_hole_coord[ii].x, -f_hole_coord[ii].y, zpos );
|
||||||
|
@ -1073,6 +1112,7 @@ static void Draw3D_FilledCircle( double posx, double posy,
|
||||||
double x, y;
|
double x, y;
|
||||||
|
|
||||||
glBegin( GL_QUAD_STRIP );
|
glBegin( GL_QUAD_STRIP );
|
||||||
|
|
||||||
for( ii = 0; ii <= slice; ii++ )
|
for( ii = 0; ii <= slice; ii++ )
|
||||||
{
|
{
|
||||||
x = hole;
|
x = hole;
|
||||||
|
@ -1151,6 +1191,7 @@ static void Draw3D_FilledSegment( double startx, double starty, double endx,
|
||||||
x += dx;
|
x += dx;
|
||||||
RotatePoint( &x, &y, -angle );
|
RotatePoint( &x, &y, -angle );
|
||||||
glVertex3f( startx + x, starty + y, zpos );
|
glVertex3f( startx + x, starty + y, zpos );
|
||||||
|
|
||||||
if( ii == 0 )
|
if( ii == 0 )
|
||||||
{
|
{
|
||||||
firstx = startx + x;
|
firstx = startx + x;
|
||||||
|
@ -1217,6 +1258,7 @@ static void Draw3D_FilledSegmentWithHole( double startx, double starty,
|
||||||
RotatePoint( &xin, &yin, -angle );
|
RotatePoint( &xin, &yin, -angle );
|
||||||
glVertex3f( startx + xin, starty + yin, zpos );
|
glVertex3f( startx + xin, starty + yin, zpos );
|
||||||
glVertex3f( startx + x, starty + y, zpos );
|
glVertex3f( startx + x, starty + y, zpos );
|
||||||
|
|
||||||
if( ii == 0 )
|
if( ii == 0 )
|
||||||
{
|
{
|
||||||
firstx = startx + x;
|
firstx = startx + x;
|
||||||
|
@ -1263,8 +1305,10 @@ static void Draw3D_ArcSegment( double startx, double starty, double centrex,
|
||||||
|
|
||||||
// Calculate the number of segments to approximate this arc
|
// Calculate the number of segments to approximate this arc
|
||||||
int imax = (int) ( (double) arc_angle * slice / 3600.0 );
|
int imax = (int) ( (double) arc_angle * slice / 3600.0 );
|
||||||
|
|
||||||
if( imax < 0 )
|
if( imax < 0 )
|
||||||
imax = -imax;
|
imax = -imax;
|
||||||
|
|
||||||
if( imax == 0 )
|
if( imax == 0 )
|
||||||
imax = 1;
|
imax = 1;
|
||||||
|
|
||||||
|
@ -1273,6 +1317,7 @@ static void Draw3D_ArcSegment( double startx, double starty, double centrex,
|
||||||
double delta_angle = (double) arc_angle / imax;
|
double delta_angle = (double) arc_angle / imax;
|
||||||
|
|
||||||
glBegin( GL_QUAD_STRIP );
|
glBegin( GL_QUAD_STRIP );
|
||||||
|
|
||||||
for( ii = 0; ii <= imax; ii++ )
|
for( ii = 0; ii <= imax; ii++ )
|
||||||
{
|
{
|
||||||
double angle = (double) ii * delta_angle;
|
double angle = (double) ii * delta_angle;
|
||||||
|
@ -1301,6 +1346,7 @@ static void Draw3D_CircleSegment( double startx, double starty, double endx,
|
||||||
hole = rayon - width;
|
hole = rayon - width;
|
||||||
|
|
||||||
glBegin( GL_QUAD_STRIP );
|
glBegin( GL_QUAD_STRIP );
|
||||||
|
|
||||||
for( ii = 0; ii <= slice; ii++ )
|
for( ii = 0; ii <= slice; ii++ )
|
||||||
{
|
{
|
||||||
x = hole; y = 0.0;
|
x = hole; y = 0.0;
|
||||||
|
@ -1339,6 +1385,7 @@ void Pcb3D_GLCanvas::Draw3D_Polygon( std::vector<wxPoint>& aCornersList, double
|
||||||
// Draw solid polygon
|
// Draw solid polygon
|
||||||
gluTessBeginPolygon( tess, NULL );
|
gluTessBeginPolygon( tess, NULL );
|
||||||
gluTessBeginContour( tess );
|
gluTessBeginContour( tess );
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < aCornersList.size(); ii++ )
|
for( unsigned ii = 0; ii < aCornersList.size(); ii++ )
|
||||||
{
|
{
|
||||||
v_data[0] = aCornersList[ii].x * g_Parm_3D_Visu.m_BoardScale;
|
v_data[0] = aCornersList[ii].x * g_Parm_3D_Visu.m_BoardScale;
|
||||||
|
@ -1361,12 +1408,16 @@ static int Get3DLayerEnable( int act_layer )
|
||||||
bool enablelayer;
|
bool enablelayer;
|
||||||
|
|
||||||
enablelayer = TRUE;
|
enablelayer = TRUE;
|
||||||
|
|
||||||
if( act_layer == DRAW_N && !g_Parm_3D_Visu.m_Draw3DDrawings )
|
if( act_layer == DRAW_N && !g_Parm_3D_Visu.m_Draw3DDrawings )
|
||||||
enablelayer = FALSE;
|
enablelayer = FALSE;
|
||||||
|
|
||||||
if( act_layer == COMMENT_N && !g_Parm_3D_Visu.m_Draw3DComments )
|
if( act_layer == COMMENT_N && !g_Parm_3D_Visu.m_Draw3DComments )
|
||||||
enablelayer = FALSE;
|
enablelayer = FALSE;
|
||||||
|
|
||||||
if( act_layer == ECO1_N && !g_Parm_3D_Visu.m_Draw3DEco1 )
|
if( act_layer == ECO1_N && !g_Parm_3D_Visu.m_Draw3DEco1 )
|
||||||
enablelayer = FALSE;
|
enablelayer = FALSE;
|
||||||
|
|
||||||
if( act_layer == ECO2_N && !g_Parm_3D_Visu.m_Draw3DEco2 )
|
if( act_layer == ECO2_N && !g_Parm_3D_Visu.m_Draw3DEco2 )
|
||||||
enablelayer = FALSE;
|
enablelayer = FALSE;
|
||||||
|
|
||||||
|
@ -1379,6 +1430,7 @@ static GLfloat Get3DLayerSide( int act_layer )
|
||||||
GLfloat nZ;
|
GLfloat nZ;
|
||||||
|
|
||||||
nZ = 1.0;
|
nZ = 1.0;
|
||||||
|
|
||||||
if( ( act_layer <= LAST_COPPER_LAYER - 1 )
|
if( ( act_layer <= LAST_COPPER_LAYER - 1 )
|
||||||
|| ( act_layer == ADHESIVE_N_BACK )
|
|| ( act_layer == ADHESIVE_N_BACK )
|
||||||
|| ( act_layer == SOLDERPASTE_N_BACK )
|
|| ( act_layer == SOLDERPASTE_N_BACK )
|
||||||
|
|
|
@ -136,7 +136,7 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoin
|
||||||
* but they must exist because they appear in some classes.
|
* but they must exist because they appear in some classes.
|
||||||
* Do nothing in CvPcb.
|
* Do nothing in CvPcb.
|
||||||
*/
|
*/
|
||||||
TRACK* Marque_Une_Piste( BOARD* aPcb,
|
TRACK* MarkTrace( BOARD* aPcb,
|
||||||
TRACK* aStartSegm,
|
TRACK* aStartSegm,
|
||||||
int* aSegmCount,
|
int* aSegmCount,
|
||||||
int* aTrackLen,
|
int* aTrackLen,
|
||||||
|
|
|
@ -420,7 +420,7 @@ void PCB_SCREEN::ClearUndoORRedoList( UNDO_REDO_CONTAINER&, int )
|
||||||
* but they must exist because they appear in some classes, and here, no nothing.
|
* but they must exist because they appear in some classes, and here, no nothing.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
TRACK* Marque_Une_Piste( BOARD* aPcb,
|
TRACK* MarkTrace( BOARD* aPcb,
|
||||||
TRACK* aStartSegm,
|
TRACK* aStartSegm,
|
||||||
int* aSegmCount,
|
int* aSegmCount,
|
||||||
int* aTrackLen,
|
int* aTrackLen,
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/*********************************************************************/
|
/**
|
||||||
/* base_struct.h : Basic classes for most kicad item descriptions */
|
* @file base_struct.h
|
||||||
/*********************************************************************/
|
* @brief Basic classes for most kicad items.
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef BASE_STRUCT_H
|
#ifndef BASE_STRUCT_H
|
||||||
#define BASE_STRUCT_H
|
#define BASE_STRUCT_H
|
||||||
|
@ -41,7 +42,7 @@ enum KICAD_T {
|
||||||
// copper layer)
|
// copper layer)
|
||||||
TYPE_MARKER_PCB, // a marker used to show something
|
TYPE_MARKER_PCB, // a marker used to show something
|
||||||
TYPE_DIMENSION, // a dimension (graphic item)
|
TYPE_DIMENSION, // a dimension (graphic item)
|
||||||
TYPE_MIRE, // a target (graphic item)
|
PCB_TARGET_T, // a target (graphic item)
|
||||||
TYPE_ZONE_EDGE_CORNER, // in zone outline: a point to define an outline
|
TYPE_ZONE_EDGE_CORNER, // in zone outline: a point to define an outline
|
||||||
TYPE_ZONE_CONTAINER, // a zone area
|
TYPE_ZONE_CONTAINER, // a zone area
|
||||||
TYPE_BOARD_ITEM_LIST, // a list of board items
|
TYPE_BOARD_ITEM_LIST, // a list of board items
|
||||||
|
|
|
@ -28,7 +28,7 @@ class SEGZONE;
|
||||||
class SEGVIA;
|
class SEGVIA;
|
||||||
class D_PAD;
|
class D_PAD;
|
||||||
class TEXTE_MODULE;
|
class TEXTE_MODULE;
|
||||||
class MIREPCB;
|
class PCB_TARGET;
|
||||||
class DIMENSION;
|
class DIMENSION;
|
||||||
class EDGE_MODULE;
|
class EDGE_MODULE;
|
||||||
class DRC;
|
class DRC;
|
||||||
|
@ -830,8 +830,8 @@ public:
|
||||||
* the case where DRC would not allow a via.
|
* the case where DRC would not allow a via.
|
||||||
*/
|
*/
|
||||||
bool Other_Layer_Route( TRACK* track, wxDC* DC );
|
bool Other_Layer_Route( TRACK* track, wxDC* DC );
|
||||||
void Affiche_PadsNoConnect( wxDC* DC );
|
void HighlightUnconnectedPads( wxDC* DC );
|
||||||
void Affiche_Status_Net( wxDC* DC );
|
void DisplayNetStatus( wxDC* DC );
|
||||||
TRACK* Delete_Segment( wxDC* DC, TRACK* Track );
|
TRACK* Delete_Segment( wxDC* DC, TRACK* Track );
|
||||||
void Delete_Track( wxDC* DC, TRACK* Track );
|
void Delete_Track( wxDC* DC, TRACK* Track );
|
||||||
void Delete_net( wxDC* DC, TRACK* Track );
|
void Delete_net( wxDC* DC, TRACK* Track );
|
||||||
|
@ -910,7 +910,6 @@ public:
|
||||||
void Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC );
|
void Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC );
|
||||||
void SwitchLayer( wxDC* DC, int layer );
|
void SwitchLayer( wxDC* DC, int layer );
|
||||||
bool Add_45_degrees_Segment( wxDC* DC );
|
bool Add_45_degrees_Segment( wxDC* DC );
|
||||||
bool Genere_Pad_Connexion( wxDC* DC, int layer );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function EraseRedundantTrack
|
* Function EraseRedundantTrack
|
||||||
|
@ -1085,11 +1084,11 @@ public:
|
||||||
void Start_Move_Zone_Outlines( wxDC* DC, ZONE_CONTAINER* zone_container );
|
void Start_Move_Zone_Outlines( wxDC* DC, ZONE_CONTAINER* zone_container );
|
||||||
|
|
||||||
// Target handling
|
// Target handling
|
||||||
MIREPCB* Create_Mire( wxDC* DC );
|
PCB_TARGET* CreateTarget( wxDC* DC );
|
||||||
void Delete_Mire( MIREPCB* MirePcb, wxDC* DC );
|
void DeleteTarget( PCB_TARGET* aTarget, wxDC* DC );
|
||||||
void StartMove_Mire( MIREPCB* MirePcb, wxDC* DC );
|
void BeginMoveTarget( PCB_TARGET* aTarget, wxDC* DC );
|
||||||
void Place_Mire( MIREPCB* MirePcb, wxDC* DC );
|
void PlaceTarget( PCB_TARGET* aTarget, wxDC* DC );
|
||||||
void InstallMireOptionsFrame( MIREPCB* MirePcb, wxDC* DC );
|
void ShowTargetOptionsDialog( PCB_TARGET* aTarget, wxDC* DC );
|
||||||
|
|
||||||
// Graphic segments type DRAWSEGMENT handling:
|
// Graphic segments type DRAWSEGMENT handling:
|
||||||
DRAWSEGMENT* Begin_DrawSegment( DRAWSEGMENT* Segment, int shape, wxDC* DC );
|
DRAWSEGMENT* Begin_DrawSegment( DRAWSEGMENT* Segment, int shape, wxDC* DC );
|
||||||
|
|
|
@ -53,6 +53,12 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
XNODE( XNODE* aParent, wxXmlNodeType aType, const wxString& aName,
|
||||||
|
const wxString& aContent = wxEmptyString, wxXmlProperty* aProperties = NULL ) :
|
||||||
|
wxXmlNode( aParent, aType, aName, aContent, aProperties )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Format
|
* Function Format
|
||||||
* writes this object as UTF8 out to an OUTPUTFORMATTER as an S-expression.
|
* writes this object as UTF8 out to an OUTPUTFORMATTER as an S-expression.
|
||||||
|
|
|
@ -39,8 +39,8 @@ void PCB_EDIT_FRAME::Attribut_Track( TRACK* track, wxDC* DC, bool Flag_On )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
DrawPanel->CrossHairOff( DC ); // Erase cursor shape
|
DrawPanel->CrossHairOff( DC ); // Erase cursor shape
|
||||||
Track = Marque_Une_Piste( GetBoard(), track, &nb_segm, NULL, NULL, true );
|
Track = MarkTrace( GetBoard(), track, &nb_segm, NULL, NULL, true );
|
||||||
Trace_Une_Piste( DrawPanel, DC, Track, nb_segm, GR_OR | GR_SURBRILL );
|
DrawTraces( DrawPanel, DC, Track, nb_segm, GR_OR | GR_SURBRILL );
|
||||||
|
|
||||||
for( ; (Track != NULL) && (nb_segm > 0); nb_segm-- )
|
for( ; (Track != NULL) && (nb_segm > 0); nb_segm-- )
|
||||||
{
|
{
|
||||||
|
@ -74,6 +74,7 @@ void PCB_EDIT_FRAME::Attribut_net( wxDC* DC, int net_code, bool Flag_On )
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawPanel->CrossHairOff( DC ); // Erase cursor shape
|
DrawPanel->CrossHairOff( DC ); // Erase cursor shape
|
||||||
|
|
||||||
while( Track ) /* Flag change */
|
while( Track ) /* Flag change */
|
||||||
{
|
{
|
||||||
if( (net_code >= 0 ) && (net_code != Track->GetNet()) )
|
if( (net_code >= 0 ) && (net_code != Track->GetNet()) )
|
||||||
|
|
|
@ -46,24 +46,32 @@ void PCB_EDIT_FRAME::AutoPlace( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
case ID_TOOLBARH_PCB_MODE_MODULE:
|
case ID_TOOLBARH_PCB_MODE_MODULE:
|
||||||
on_state = m_HToolBar->GetToolState( ID_TOOLBARH_PCB_MODE_MODULE );
|
on_state = m_HToolBar->GetToolState( ID_TOOLBARH_PCB_MODE_MODULE );
|
||||||
|
|
||||||
if( on_state )
|
if( on_state )
|
||||||
{
|
{
|
||||||
m_HToolBar->ToggleTool( ID_TOOLBARH_PCB_MODE_TRACKS, FALSE );
|
m_HToolBar->ToggleTool( ID_TOOLBARH_PCB_MODE_TRACKS, false );
|
||||||
m_HTOOL_current_state = ID_TOOLBARH_PCB_MODE_MODULE;
|
m_HTOOL_current_state = ID_TOOLBARH_PCB_MODE_MODULE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
m_HTOOL_current_state = 0;
|
m_HTOOL_current_state = 0;
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case ID_TOOLBARH_PCB_MODE_TRACKS:
|
case ID_TOOLBARH_PCB_MODE_TRACKS:
|
||||||
on_state = m_HToolBar->GetToolState( ID_TOOLBARH_PCB_MODE_TRACKS );
|
on_state = m_HToolBar->GetToolState( ID_TOOLBARH_PCB_MODE_TRACKS );
|
||||||
|
|
||||||
if( on_state )
|
if( on_state )
|
||||||
{
|
{
|
||||||
m_HToolBar->ToggleTool( ID_TOOLBARH_PCB_MODE_MODULE, FALSE );
|
m_HToolBar->ToggleTool( ID_TOOLBARH_PCB_MODE_MODULE, false );
|
||||||
m_HTOOL_current_state = ID_TOOLBARH_PCB_MODE_TRACKS;
|
m_HTOOL_current_state = ID_TOOLBARH_PCB_MODE_TRACKS;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
m_HTOOL_current_state = 0;
|
m_HTOOL_current_state = 0;
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
@ -75,11 +83,11 @@ void PCB_EDIT_FRAME::AutoPlace( wxCommandEvent& event )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case ID_POPUP_PCB_AUTOPLACE_FREE_MODULE:
|
case ID_POPUP_PCB_AUTOPLACE_FREE_MODULE:
|
||||||
LockModule( (MODULE*) GetScreen()->GetCurItem(), FALSE );
|
LockModule( (MODULE*) GetScreen()->GetCurItem(), false );
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case ID_POPUP_PCB_AUTOPLACE_FREE_ALL_MODULES:
|
case ID_POPUP_PCB_AUTOPLACE_FREE_ALL_MODULES:
|
||||||
LockModule( NULL, FALSE );
|
LockModule( NULL, false );
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case ID_POPUP_PCB_AUTOPLACE_FIXE_ALL_MODULES:
|
case ID_POPUP_PCB_AUTOPLACE_FIXE_ALL_MODULES:
|
||||||
|
@ -91,6 +99,7 @@ void PCB_EDIT_FRAME::AutoPlace( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
DrawPanel->m_endMouseCaptureCallback( DrawPanel, &dc );
|
DrawPanel->m_endMouseCaptureCallback( DrawPanel, &dc );
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: // Abort a current command (if any)
|
default: // Abort a current command (if any)
|
||||||
|
@ -101,13 +110,13 @@ void PCB_EDIT_FRAME::AutoPlace( wxCommandEvent& event )
|
||||||
/* Erase ratsnest if needed */
|
/* Erase ratsnest if needed */
|
||||||
if( GetBoard()->IsElementVisible(RATSNEST_VISIBLE) )
|
if( GetBoard()->IsElementVisible(RATSNEST_VISIBLE) )
|
||||||
DrawGeneralRatsnest( &dc );
|
DrawGeneralRatsnest( &dc );
|
||||||
|
|
||||||
GetBoard()->m_Status_Pcb |= DO_NOT_SHOW_GENERAL_RASTNEST;
|
GetBoard()->m_Status_Pcb |= DO_NOT_SHOW_GENERAL_RASTNEST;
|
||||||
|
|
||||||
switch( id )
|
switch( id )
|
||||||
{
|
{
|
||||||
case ID_POPUP_PCB_AUTOPLACE_CURRENT_MODULE:
|
case ID_POPUP_PCB_AUTOPLACE_CURRENT_MODULE:
|
||||||
AutoPlaceModule( (MODULE*) GetScreen()->GetCurItem(),
|
AutoPlaceModule( (MODULE*) GetScreen()->GetCurItem(), PLACE_1_MODULE, &dc );
|
||||||
PLACE_1_MODULE, &dc );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_PCB_AUTOPLACE_ALL_MODULES:
|
case ID_POPUP_PCB_AUTOPLACE_ALL_MODULES:
|
||||||
|
@ -123,7 +132,7 @@ void PCB_EDIT_FRAME::AutoPlace( wxCommandEvent& event )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_PCB_AUTOMOVE_ALL_MODULES:
|
case ID_POPUP_PCB_AUTOMOVE_ALL_MODULES:
|
||||||
AutoMoveModulesOnPcb( FALSE );
|
AutoMoveModulesOnPcb( false );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_PCB_AUTOMOVE_NEW_MODULES:
|
case ID_POPUP_PCB_AUTOMOVE_NEW_MODULES:
|
||||||
|
@ -194,11 +203,13 @@ void PCB_EDIT_FRAME::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb )
|
||||||
|
|
||||||
// Build sorted footprints list (sort by decreasing size )
|
// Build sorted footprints list (sort by decreasing size )
|
||||||
MODULE* Module = GetBoard()->m_Modules;
|
MODULE* Module = GetBoard()->m_Modules;
|
||||||
|
|
||||||
for( ; Module != NULL; Module = Module->Next() )
|
for( ; Module != NULL; Module = Module->Next() )
|
||||||
{
|
{
|
||||||
Module->Set_Rectangle_Encadrement();
|
Module->CalculateBoundingBox();
|
||||||
moduleList.push_back(Module);
|
moduleList.push_back(Module);
|
||||||
}
|
}
|
||||||
|
|
||||||
sort( moduleList.begin(), moduleList.end(), sortModulesbySize );
|
sort( moduleList.begin(), moduleList.end(), sortModulesbySize );
|
||||||
|
|
||||||
/* to move modules outside the board, the cursor is placed below
|
/* to move modules outside the board, the cursor is placed below
|
||||||
|
@ -216,14 +227,17 @@ void PCB_EDIT_FRAME::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb )
|
||||||
|
|
||||||
/* calculate the area needed by footprints */
|
/* calculate the area needed by footprints */
|
||||||
surface = 0.0;
|
surface = 0.0;
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < moduleList.size(); ii++ )
|
for( unsigned ii = 0; ii < moduleList.size(); ii++ )
|
||||||
{
|
{
|
||||||
Module = moduleList[ii];
|
Module = moduleList[ii];
|
||||||
|
|
||||||
if( PlaceModulesHorsPcb && edgesExists )
|
if( PlaceModulesHorsPcb && edgesExists )
|
||||||
{
|
{
|
||||||
if( GetBoard()->m_BoundaryBox.Contains( Module->m_Pos ) )
|
if( GetBoard()->m_BoundaryBox.Contains( Module->m_Pos ) )
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
surface += Module->m_Surface;
|
surface += Module->m_Surface;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,6 +249,7 @@ void PCB_EDIT_FRAME::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb )
|
||||||
for( unsigned ii = 0; ii < moduleList.size(); ii++ )
|
for( unsigned ii = 0; ii < moduleList.size(); ii++ )
|
||||||
{
|
{
|
||||||
Module = moduleList[ii];
|
Module = moduleList[ii];
|
||||||
|
|
||||||
if( Module->IsLocked() )
|
if( Module->IsLocked() )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -253,6 +268,7 @@ void PCB_EDIT_FRAME::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb )
|
||||||
|
|
||||||
GetScreen()->SetCrossHairPosition( current + Module->m_Pos -
|
GetScreen()->SetCrossHairPosition( current + Module->m_Pos -
|
||||||
Module->m_BoundaryBox.GetPosition() );
|
Module->m_BoundaryBox.GetPosition() );
|
||||||
|
|
||||||
Ymax_size = MAX( Ymax_size, Module->m_BoundaryBox.GetHeight() );
|
Ymax_size = MAX( Ymax_size, Module->m_BoundaryBox.GetHeight() );
|
||||||
|
|
||||||
Place_Module( Module, NULL, true );
|
Place_Module( Module, NULL, true );
|
||||||
|
@ -264,8 +280,7 @@ void PCB_EDIT_FRAME::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Set or reset (true or FALSE) Lock attribute of aModule
|
/* Set or reset (true or false) Lock attribute of aModule or all modules if aModule == NULL
|
||||||
* or all modules if aModule == NULL
|
|
||||||
*/
|
*/
|
||||||
void PCB_EDIT_FRAME::LockModule( MODULE* aModule, bool aLocked )
|
void PCB_EDIT_FRAME::LockModule( MODULE* aModule, bool aLocked )
|
||||||
{
|
{
|
||||||
|
@ -279,10 +294,10 @@ void PCB_EDIT_FRAME::LockModule( MODULE* aModule, bool aLocked )
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
aModule = GetBoard()->m_Modules;
|
aModule = GetBoard()->m_Modules;
|
||||||
|
|
||||||
for( ; aModule != NULL; aModule = aModule->Next() )
|
for( ; aModule != NULL; aModule = aModule->Next() )
|
||||||
{
|
{
|
||||||
if( WildCompareString( ModulesMaskSelection,
|
if( WildCompareString( ModulesMaskSelection, aModule->m_Reference->m_Text ) )
|
||||||
aModule->m_Reference->m_Text ) )
|
|
||||||
{
|
{
|
||||||
aModule->SetLocked( aLocked );
|
aModule->SetLocked( aLocked );
|
||||||
OnModify();
|
OnModify();
|
||||||
|
@ -296,4 +311,3 @@ static bool sortModulesbySize( MODULE* ref, MODULE* compare )
|
||||||
{
|
{
|
||||||
return compare->m_Surface < ref->m_Surface;
|
return compare->m_Surface < ref->m_Surface;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ static void TracePenaliteRectangle( BOARD* Pcb,
|
||||||
int uy1,
|
int uy1,
|
||||||
int marge,
|
int marge,
|
||||||
int Penalite,
|
int Penalite,
|
||||||
int masque_layer );
|
int aLayerMask );
|
||||||
static MODULE* PickModule( PCB_EDIT_FRAME* pcbframe, wxDC* DC );
|
static MODULE* PickModule( PCB_EDIT_FRAME* pcbframe, wxDC* DC );
|
||||||
|
|
||||||
|
|
||||||
|
@ -86,8 +86,10 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
|
||||||
{
|
{
|
||||||
case PLACE_1_MODULE:
|
case PLACE_1_MODULE:
|
||||||
ThisModule = Module;
|
ThisModule = Module;
|
||||||
|
|
||||||
if( ThisModule == NULL )
|
if( ThisModule == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ThisModule->m_ModuleStatus &= ~(MODULE_is_PLACED | MODULE_to_PLACE);
|
ThisModule->m_ModuleStatus &= ~(MODULE_is_PLACED | MODULE_to_PLACE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -97,11 +99,13 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
|
||||||
case PLACE_ALL:
|
case PLACE_ALL:
|
||||||
if( !IsOK( this, _( "Footprints NOT LOCKED will be moved" ) ) )
|
if( !IsOK( this, _( "Footprints NOT LOCKED will be moved" ) ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PLACE_INCREMENTAL:
|
case PLACE_INCREMENTAL:
|
||||||
if( !IsOK( this, _( "Footprints NOT PLACED will be moved" ) ) )
|
if( !IsOK( this, _( "Footprints NOT PLACED will be moved" ) ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,9 +122,10 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
|
||||||
/* Compute module parmeters used in auto place */
|
/* Compute module parmeters used in auto place */
|
||||||
Module = GetBoard()->m_Modules;
|
Module = GetBoard()->m_Modules;
|
||||||
NbTotalModules = 0;
|
NbTotalModules = 0;
|
||||||
|
|
||||||
for( ; Module != NULL; Module = Module->Next() )
|
for( ; Module != NULL; Module = Module->Next() )
|
||||||
{
|
{
|
||||||
Module->Set_Rectangle_Encadrement();
|
Module->CalculateBoundingBox();
|
||||||
NbTotalModules ++;
|
NbTotalModules ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,6 +133,7 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Module = GetBoard()->m_Modules;
|
Module = GetBoard()->m_Modules;
|
||||||
|
|
||||||
for( ; Module != NULL; Module = Module->Next() )
|
for( ; Module != NULL; Module = Module->Next() )
|
||||||
{
|
{
|
||||||
Module->m_ModuleStatus &= ~MODULE_to_PLACE;
|
Module->m_ModuleStatus &= ~MODULE_to_PLACE;
|
||||||
|
@ -141,16 +147,21 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
|
||||||
|
|
||||||
case PLACE_OUT_OF_BOARD:
|
case PLACE_OUT_OF_BOARD:
|
||||||
Module->m_ModuleStatus &= ~MODULE_is_PLACED;
|
Module->m_ModuleStatus &= ~MODULE_is_PLACED;
|
||||||
|
|
||||||
if( Module->m_ModuleStatus & MODULE_is_LOCKED )
|
if( Module->m_ModuleStatus & MODULE_is_LOCKED )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if( !GetBoard()->m_BoundaryBox.Contains( Module->m_Pos ) )
|
if( !GetBoard()->m_BoundaryBox.Contains( Module->m_Pos ) )
|
||||||
Module->m_ModuleStatus |= MODULE_to_PLACE;
|
Module->m_ModuleStatus |= MODULE_to_PLACE;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PLACE_ALL:
|
case PLACE_ALL:
|
||||||
Module->m_ModuleStatus &= ~MODULE_is_PLACED;
|
Module->m_ModuleStatus &= ~MODULE_is_PLACED;
|
||||||
|
|
||||||
if( Module->m_ModuleStatus & MODULE_is_LOCKED )
|
if( Module->m_ModuleStatus & MODULE_is_LOCKED )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
Module->m_ModuleStatus |= MODULE_to_PLACE;
|
Module->m_ModuleStatus |= MODULE_to_PLACE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -159,8 +170,10 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
|
||||||
{
|
{
|
||||||
Module->m_ModuleStatus &= ~MODULE_is_PLACED; break;
|
Module->m_ModuleStatus &= ~MODULE_is_PLACED; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !(Module->m_ModuleStatus & MODULE_is_PLACED) )
|
if( !(Module->m_ModuleStatus & MODULE_is_PLACED) )
|
||||||
Module->m_ModuleStatus |= MODULE_to_PLACE;
|
Module->m_ModuleStatus |= MODULE_to_PLACE;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,6 +194,7 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
|
||||||
|
|
||||||
if( NbModules )
|
if( NbModules )
|
||||||
Pas = 100.0 / (float) NbModules;
|
Pas = 100.0 / (float) NbModules;
|
||||||
|
|
||||||
while( ( Module = PickModule( this, DC ) ) != NULL )
|
while( ( Module = PickModule( this, DC ) ) != NULL )
|
||||||
{
|
{
|
||||||
float BestScore;
|
float BestScore;
|
||||||
|
@ -192,6 +206,7 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
|
||||||
error = RecherchePlacementModule( Module, DC );
|
error = RecherchePlacementModule( Module, DC );
|
||||||
BestScore = MinCout;
|
BestScore = MinCout;
|
||||||
PosOK = CurrPosition;
|
PosOK = CurrPosition;
|
||||||
|
|
||||||
if( error == ESC )
|
if( error == ESC )
|
||||||
goto end_of_tst;
|
goto end_of_tst;
|
||||||
|
|
||||||
|
@ -202,9 +217,10 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
|
||||||
{
|
{
|
||||||
int Angle_Rot_Module = 1800;
|
int Angle_Rot_Module = 1800;
|
||||||
Rotate_Module( DC, Module, Angle_Rot_Module, false );
|
Rotate_Module( DC, Module, Angle_Rot_Module, false );
|
||||||
Module->Set_Rectangle_Encadrement();
|
Module->CalculateBoundingBox();
|
||||||
error = RecherchePlacementModule( Module, DC );
|
error = RecherchePlacementModule( Module, DC );
|
||||||
MinCout *= OrientPenality[ii];
|
MinCout *= OrientPenality[ii];
|
||||||
|
|
||||||
if( BestScore > MinCout ) /* This orientation is best. */
|
if( BestScore > MinCout ) /* This orientation is best. */
|
||||||
{
|
{
|
||||||
PosOK = CurrPosition;
|
PosOK = CurrPosition;
|
||||||
|
@ -215,18 +231,21 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
|
||||||
Angle_Rot_Module = -1800;
|
Angle_Rot_Module = -1800;
|
||||||
Rotate_Module( DC, Module, Angle_Rot_Module, false );
|
Rotate_Module( DC, Module, Angle_Rot_Module, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( error == ESC )
|
if( error == ESC )
|
||||||
goto end_of_tst;
|
goto end_of_tst;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Determine if the best orientation of a module is 90. */
|
/* Determine if the best orientation of a module is 90. */
|
||||||
ii = Module->m_CntRot90 & 0x0F;
|
ii = Module->m_CntRot90 & 0x0F;
|
||||||
|
|
||||||
if( ii != 0 )
|
if( ii != 0 )
|
||||||
{
|
{
|
||||||
int Angle_Rot_Module = 900;
|
int Angle_Rot_Module = 900;
|
||||||
Rotate_Module( DC, Module, Angle_Rot_Module, false );
|
Rotate_Module( DC, Module, Angle_Rot_Module, false );
|
||||||
error = RecherchePlacementModule( Module, DC );
|
error = RecherchePlacementModule( Module, DC );
|
||||||
MinCout *= OrientPenality[ii];
|
MinCout *= OrientPenality[ii];
|
||||||
|
|
||||||
if( BestScore > MinCout ) /* This orientation is best. */
|
if( BestScore > MinCout ) /* This orientation is best. */
|
||||||
{
|
{
|
||||||
PosOK = CurrPosition;
|
PosOK = CurrPosition;
|
||||||
|
@ -237,18 +256,21 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
|
||||||
Angle_Rot_Module = -900;
|
Angle_Rot_Module = -900;
|
||||||
Rotate_Module( DC, Module, Angle_Rot_Module, false );
|
Rotate_Module( DC, Module, Angle_Rot_Module, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( error == ESC )
|
if( error == ESC )
|
||||||
goto end_of_tst;
|
goto end_of_tst;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Determine if the best orientation of a module is 270. */
|
/* Determine if the best orientation of a module is 270. */
|
||||||
ii = (Module->m_CntRot90 >> 4 ) & 0x0F;
|
ii = (Module->m_CntRot90 >> 4 ) & 0x0F;
|
||||||
|
|
||||||
if( ii != 0 )
|
if( ii != 0 )
|
||||||
{
|
{
|
||||||
int Angle_Rot_Module = 2700;
|
int Angle_Rot_Module = 2700;
|
||||||
Rotate_Module( DC, Module, Angle_Rot_Module, false );
|
Rotate_Module( DC, Module, Angle_Rot_Module, false );
|
||||||
error = RecherchePlacementModule( Module, DC );
|
error = RecherchePlacementModule( Module, DC );
|
||||||
MinCout *= OrientPenality[ii];
|
MinCout *= OrientPenality[ii];
|
||||||
|
|
||||||
if( BestScore > MinCout ) /* This orientation is best. */
|
if( BestScore > MinCout ) /* This orientation is best. */
|
||||||
{
|
{
|
||||||
PosOK = CurrPosition;
|
PosOK = CurrPosition;
|
||||||
|
@ -259,6 +281,7 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
|
||||||
Angle_Rot_Module = -2700;
|
Angle_Rot_Module = -2700;
|
||||||
Rotate_Module( DC, Module, Angle_Rot_Module, false );
|
Rotate_Module( DC, Module, Angle_Rot_Module, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( error == ESC )
|
if( error == ESC )
|
||||||
goto end_of_tst;
|
goto end_of_tst;
|
||||||
}
|
}
|
||||||
|
@ -274,7 +297,7 @@ end_of_tst:
|
||||||
Place_Module( Module, DC );
|
Place_Module( Module, DC );
|
||||||
GetScreen()->SetCrossHairPosition( CurrPosition );
|
GetScreen()->SetCrossHairPosition( CurrPosition );
|
||||||
|
|
||||||
Module->Set_Rectangle_Encadrement();
|
Module->CalculateBoundingBox();
|
||||||
|
|
||||||
GenModuleOnBoard( Module );
|
GenModuleOnBoard( Module );
|
||||||
Module->m_ModuleStatus |= MODULE_is_PLACED;
|
Module->m_ModuleStatus |= MODULE_is_PLACED;
|
||||||
|
@ -289,15 +312,15 @@ end_of_tst:
|
||||||
Route_Layer_BOTTOM = lay_tmp_BOTTOM;
|
Route_Layer_BOTTOM = lay_tmp_BOTTOM;
|
||||||
|
|
||||||
Module = GetBoard()->m_Modules;
|
Module = GetBoard()->m_Modules;
|
||||||
|
|
||||||
for( ; Module != NULL; Module = Module->Next() )
|
for( ; Module != NULL; Module = Module->Next() )
|
||||||
{
|
{
|
||||||
Module->Set_Rectangle_Encadrement();
|
Module->CalculateBoundingBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
GetBoard()->m_Status_Pcb = 0;
|
GetBoard()->m_Status_Pcb = 0;
|
||||||
Compile_Ratsnest( DC, true );
|
Compile_Ratsnest( DC, true );
|
||||||
DrawPanel->ReDraw( DC, true );
|
DrawPanel->ReDraw( DC, true );
|
||||||
|
|
||||||
DrawPanel->m_AbortEnable = false;
|
DrawPanel->m_AbortEnable = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -309,14 +332,14 @@ void PCB_EDIT_FRAME::DrawInfoPlace( wxDC* DC )
|
||||||
MATRIX_CELL top_state, bottom_state;
|
MATRIX_CELL top_state, bottom_state;
|
||||||
|
|
||||||
GRSetDrawMode( DC, GR_COPY );
|
GRSetDrawMode( DC, GR_COPY );
|
||||||
|
|
||||||
for( ii = 0; ii < Board.m_Nrows; ii++ )
|
for( ii = 0; ii < Board.m_Nrows; ii++ )
|
||||||
{
|
{
|
||||||
oy = GetBoard()->m_BoundaryBox.m_Pos.y + ( ii * Board.m_GridRouting );
|
oy = GetBoard()->m_BoundaryBox.m_Pos.y + ( ii * Board.m_GridRouting );
|
||||||
|
|
||||||
for( jj = 0; jj < Board.m_Ncols; jj++ )
|
for( jj = 0; jj < Board.m_Ncols; jj++ )
|
||||||
{
|
{
|
||||||
ox = GetBoard()->m_BoundaryBox.m_Pos.x +
|
ox = GetBoard()->m_BoundaryBox.m_Pos.x + (jj * Board.m_GridRouting);
|
||||||
(jj * Board.m_GridRouting);
|
|
||||||
color = BLACK;
|
color = BLACK;
|
||||||
|
|
||||||
top_state = GetCell( ii, jj, TOP );
|
top_state = GetCell( ii, jj, TOP );
|
||||||
|
@ -328,12 +351,10 @@ void PCB_EDIT_FRAME::DrawInfoPlace( wxDC* DC )
|
||||||
/* obstacles */
|
/* obstacles */
|
||||||
if( ( top_state & CELL_is_EDGE ) || ( bottom_state & CELL_is_EDGE ) )
|
if( ( top_state & CELL_is_EDGE ) || ( bottom_state & CELL_is_EDGE ) )
|
||||||
color = WHITE;
|
color = WHITE;
|
||||||
|
|
||||||
else if( top_state & ( HOLE | CELL_is_MODULE ) )
|
else if( top_state & ( HOLE | CELL_is_MODULE ) )
|
||||||
color = LIGHTRED;
|
color = LIGHTRED;
|
||||||
else if( bottom_state & (HOLE | CELL_is_MODULE) )
|
else if( bottom_state & (HOLE | CELL_is_MODULE) )
|
||||||
color = LIGHTGREEN;
|
color = LIGHTGREEN;
|
||||||
|
|
||||||
else /* Display the filling and keep out regions. */
|
else /* Display the filling and keep out regions. */
|
||||||
{
|
{
|
||||||
if( GetDist( ii, jj, TOP ) || GetDist( ii, jj, BOTTOM ) )
|
if( GetDist( ii, jj, TOP ) || GetDist( ii, jj, BOTTOM ) )
|
||||||
|
@ -419,8 +440,10 @@ int PCB_EDIT_FRAME::GenPlaceBoard()
|
||||||
MsgPanel->SetMessage( 24, wxT( "Mem(Kb)" ), msg, CYAN );
|
MsgPanel->SetMessage( 24, wxT( "Mem(Kb)" ), msg, CYAN );
|
||||||
|
|
||||||
Route_Layer_BOTTOM = LAYER_N_FRONT;
|
Route_Layer_BOTTOM = LAYER_N_FRONT;
|
||||||
|
|
||||||
if( Nb_Sides == TWO_SIDES )
|
if( Nb_Sides == TWO_SIDES )
|
||||||
Route_Layer_BOTTOM = LAYER_N_BACK;
|
Route_Layer_BOTTOM = LAYER_N_BACK;
|
||||||
|
|
||||||
Route_Layer_TOP = LAYER_N_FRONT;
|
Route_Layer_TOP = LAYER_N_FRONT;
|
||||||
|
|
||||||
/* Place the edge layer segments */
|
/* Place the edge layer segments */
|
||||||
|
@ -430,6 +453,7 @@ int PCB_EDIT_FRAME::GenPlaceBoard()
|
||||||
TmpSegm.SetLayer( -1 );
|
TmpSegm.SetLayer( -1 );
|
||||||
TmpSegm.SetNet( -1 );
|
TmpSegm.SetNet( -1 );
|
||||||
TmpSegm.m_Width = Board.m_GridRouting / 2;
|
TmpSegm.m_Width = Board.m_GridRouting / 2;
|
||||||
|
|
||||||
for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
|
for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
|
||||||
{
|
{
|
||||||
DRAWSEGMENT* DrawSegm;
|
DRAWSEGMENT* DrawSegm;
|
||||||
|
@ -438,6 +462,7 @@ int PCB_EDIT_FRAME::GenPlaceBoard()
|
||||||
{
|
{
|
||||||
case TYPE_DRAWSEGMENT:
|
case TYPE_DRAWSEGMENT:
|
||||||
DrawSegm = (DRAWSEGMENT*) PtStruct;
|
DrawSegm = (DRAWSEGMENT*) PtStruct;
|
||||||
|
|
||||||
if( DrawSegm->GetLayer() != EDGE_N )
|
if( DrawSegm->GetLayer() != EDGE_N )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -485,7 +510,7 @@ void PCB_EDIT_FRAME::GenModuleOnBoard( MODULE* Module )
|
||||||
{
|
{
|
||||||
int ox, oy, fx, fy, Penalite;
|
int ox, oy, fx, fy, Penalite;
|
||||||
int marge = Board.m_GridRouting / 2;
|
int marge = Board.m_GridRouting / 2;
|
||||||
int masque_layer;
|
int layerMask;
|
||||||
D_PAD* Pad;
|
D_PAD* Pad;
|
||||||
|
|
||||||
ox = Module->m_BoundaryBox.m_Pos.x - marge;
|
ox = Module->m_BoundaryBox.m_Pos.x - marge;
|
||||||
|
@ -495,31 +520,37 @@ void PCB_EDIT_FRAME::GenModuleOnBoard( MODULE* Module )
|
||||||
|
|
||||||
if( ox < GetBoard()->m_BoundaryBox.m_Pos.x )
|
if( ox < GetBoard()->m_BoundaryBox.m_Pos.x )
|
||||||
ox = GetBoard()->m_BoundaryBox.m_Pos.x;
|
ox = GetBoard()->m_BoundaryBox.m_Pos.x;
|
||||||
|
|
||||||
if( ox > GetBoard()->m_BoundaryBox.GetRight() )
|
if( ox > GetBoard()->m_BoundaryBox.GetRight() )
|
||||||
ox = GetBoard()->m_BoundaryBox.GetRight();
|
ox = GetBoard()->m_BoundaryBox.GetRight();
|
||||||
|
|
||||||
if( fx < GetBoard()->m_BoundaryBox.m_Pos.x )
|
if( fx < GetBoard()->m_BoundaryBox.m_Pos.x )
|
||||||
fx = GetBoard()->m_BoundaryBox.m_Pos.x;
|
fx = GetBoard()->m_BoundaryBox.m_Pos.x;
|
||||||
|
|
||||||
if( fx > GetBoard()->m_BoundaryBox.GetRight() )
|
if( fx > GetBoard()->m_BoundaryBox.GetRight() )
|
||||||
fx = GetBoard()->m_BoundaryBox.GetRight();
|
fx = GetBoard()->m_BoundaryBox.GetRight();
|
||||||
|
|
||||||
if( oy < GetBoard()->m_BoundaryBox.m_Pos.y )
|
if( oy < GetBoard()->m_BoundaryBox.m_Pos.y )
|
||||||
oy = GetBoard()->m_BoundaryBox.m_Pos.y;
|
oy = GetBoard()->m_BoundaryBox.m_Pos.y;
|
||||||
|
|
||||||
if( oy > GetBoard()->m_BoundaryBox.GetBottom() )
|
if( oy > GetBoard()->m_BoundaryBox.GetBottom() )
|
||||||
oy = GetBoard()->m_BoundaryBox.GetBottom();
|
oy = GetBoard()->m_BoundaryBox.GetBottom();
|
||||||
|
|
||||||
if( fy < GetBoard()->m_BoundaryBox.m_Pos.y )
|
if( fy < GetBoard()->m_BoundaryBox.m_Pos.y )
|
||||||
fy = GetBoard()->m_BoundaryBox.m_Pos.y;
|
fy = GetBoard()->m_BoundaryBox.m_Pos.y;
|
||||||
|
|
||||||
if( fy > GetBoard()->m_BoundaryBox.GetBottom() )
|
if( fy > GetBoard()->m_BoundaryBox.GetBottom() )
|
||||||
fy = GetBoard()->m_BoundaryBox.GetBottom();
|
fy = GetBoard()->m_BoundaryBox.GetBottom();
|
||||||
|
|
||||||
masque_layer = 0;
|
layerMask = 0;
|
||||||
if( Module->GetLayer() == LAYER_N_FRONT )
|
|
||||||
masque_layer = LAYER_FRONT;
|
|
||||||
if( Module->GetLayer() == LAYER_N_BACK )
|
|
||||||
masque_layer = LAYER_BACK;
|
|
||||||
|
|
||||||
TraceFilledRectangle( GetBoard(), ox, oy, fx, fy, masque_layer,
|
if( Module->GetLayer() == LAYER_N_FRONT )
|
||||||
|
layerMask = LAYER_FRONT;
|
||||||
|
|
||||||
|
if( Module->GetLayer() == LAYER_N_BACK )
|
||||||
|
layerMask = LAYER_BACK;
|
||||||
|
|
||||||
|
TraceFilledRectangle( GetBoard(), ox, oy, fx, fy, layerMask,
|
||||||
CELL_is_MODULE, WRITE_OR_CELL );
|
CELL_is_MODULE, WRITE_OR_CELL );
|
||||||
|
|
||||||
int trackWidth = GetBoard()->m_NetClasses.GetDefault()->GetTrackWidth();
|
int trackWidth = GetBoard()->m_NetClasses.GetDefault()->GetTrackWidth();
|
||||||
|
@ -530,15 +561,13 @@ void PCB_EDIT_FRAME::GenModuleOnBoard( MODULE* Module )
|
||||||
|
|
||||||
for( Pad = Module->m_Pads; Pad != NULL; Pad = Pad->Next() )
|
for( Pad = Module->m_Pads; Pad != NULL; Pad = Pad->Next() )
|
||||||
{
|
{
|
||||||
Place_1_Pad_Board( GetBoard(), Pad, CELL_is_MODULE, marge,
|
Place_1_Pad_Board( GetBoard(), Pad, CELL_is_MODULE, marge, WRITE_OR_CELL );
|
||||||
WRITE_OR_CELL );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Trace clearance. */
|
/* Trace clearance. */
|
||||||
marge = ( Board.m_GridRouting * Module->m_PadNum ) / GAIN;
|
marge = ( Board.m_GridRouting * Module->m_PadNum ) / GAIN;
|
||||||
Penalite = PENALITE;
|
Penalite = PENALITE;
|
||||||
TracePenaliteRectangle( GetBoard(), ox, oy, fx, fy, marge, Penalite,
|
TracePenaliteRectangle( GetBoard(), ox, oy, fx, fy, marge, Penalite, layerMask );
|
||||||
masque_layer );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -588,23 +617,25 @@ int PCB_EDIT_FRAME::RecherchePlacementModule( MODULE* Module, wxDC* DC )
|
||||||
* appearing on the other side.
|
* appearing on the other side.
|
||||||
*/
|
*/
|
||||||
TstOtherSide = false;
|
TstOtherSide = false;
|
||||||
|
|
||||||
if( Nb_Sides == TWO_SIDES )
|
if( Nb_Sides == TWO_SIDES )
|
||||||
{
|
{
|
||||||
D_PAD* Pad; int masque_otherlayer;
|
D_PAD* Pad;
|
||||||
masque_otherlayer = LAYER_BACK;
|
int otherLayerMask = LAYER_BACK;
|
||||||
|
|
||||||
if( Module->GetLayer() == LAYER_N_BACK )
|
if( Module->GetLayer() == LAYER_N_BACK )
|
||||||
masque_otherlayer = LAYER_FRONT;
|
otherLayerMask = LAYER_FRONT;
|
||||||
|
|
||||||
for( Pad = Module->m_Pads; Pad != NULL; Pad = Pad->Next() )
|
for( Pad = Module->m_Pads; Pad != NULL; Pad = Pad->Next() )
|
||||||
{
|
{
|
||||||
if( ( Pad->m_Masque_Layer & masque_otherlayer ) == 0 )
|
if( ( Pad->m_layerMask & otherLayerMask ) == 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
TstOtherSide = true;
|
TstOtherSide = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DrawModuleOutlines( DrawPanel, DC, Module );
|
DrawModuleOutlines( DrawPanel, DC, Module );
|
||||||
|
|
||||||
mincout = -1.0;
|
mincout = -1.0;
|
||||||
|
@ -614,6 +645,7 @@ int PCB_EDIT_FRAME::RecherchePlacementModule( MODULE* Module, wxDC* DC )
|
||||||
CurrPosition.x += Board.m_GridRouting )
|
CurrPosition.x += Board.m_GridRouting )
|
||||||
{
|
{
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
if( DrawPanel->m_AbortRequest )
|
if( DrawPanel->m_AbortRequest )
|
||||||
{
|
{
|
||||||
if( IsOK( this, _( "Ok to abort?" ) ) )
|
if( IsOK( this, _( "Ok to abort?" ) ) )
|
||||||
|
@ -640,8 +672,10 @@ int PCB_EDIT_FRAME::RecherchePlacementModule( MODULE* Module, wxDC* DC )
|
||||||
{
|
{
|
||||||
/* Erase traces. */
|
/* Erase traces. */
|
||||||
DrawModuleOutlines( DrawPanel, DC, Module );
|
DrawModuleOutlines( DrawPanel, DC, Module );
|
||||||
|
|
||||||
if( DisplayChevelu )
|
if( DisplayChevelu )
|
||||||
Compute_Ratsnest_PlaceModule( DC );
|
Compute_Ratsnest_PlaceModule( DC );
|
||||||
|
|
||||||
DisplayChevelu = 0;
|
DisplayChevelu = 0;
|
||||||
Module->m_BoundaryBox.m_Pos.x = ox + CurrPosition.x;
|
Module->m_BoundaryBox.m_Pos.x = ox + CurrPosition.x;
|
||||||
Module->m_BoundaryBox.m_Pos.y = oy + CurrPosition.y;
|
Module->m_BoundaryBox.m_Pos.y = oy + CurrPosition.y;
|
||||||
|
@ -649,6 +683,7 @@ int PCB_EDIT_FRAME::RecherchePlacementModule( MODULE* Module, wxDC* DC )
|
||||||
g_Offset_Module.y = cy - CurrPosition.y;
|
g_Offset_Module.y = cy - CurrPosition.y;
|
||||||
DrawModuleOutlines( DrawPanel, DC, Module );
|
DrawModuleOutlines( DrawPanel, DC, Module );
|
||||||
Penalite = TstModuleOnBoard( GetBoard(), Module, TstOtherSide );
|
Penalite = TstModuleOnBoard( GetBoard(), Module, TstOtherSide );
|
||||||
|
|
||||||
if( Penalite >= 0 ) /* c a d if the module can be placed. */
|
if( Penalite >= 0 ) /* c a d if the module can be placed. */
|
||||||
{
|
{
|
||||||
error = 0;
|
error = 0;
|
||||||
|
@ -669,13 +704,16 @@ int PCB_EDIT_FRAME::RecherchePlacementModule( MODULE* Module, wxDC* DC )
|
||||||
SetStatusText( msg );
|
SetStatusText( msg );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( DisplayChevelu )
|
if( DisplayChevelu )
|
||||||
Compute_Ratsnest_PlaceModule( DC );
|
Compute_Ratsnest_PlaceModule( DC );
|
||||||
|
|
||||||
DisplayChevelu = 0;
|
DisplayChevelu = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawModuleOutlines( DrawPanel, DC, Module ); /* erasing the last traces */
|
DrawModuleOutlines( DrawPanel, DC, Module ); /* erasing the last traces */
|
||||||
|
|
||||||
if( DisplayChevelu )
|
if( DisplayChevelu )
|
||||||
Compute_Ratsnest_PlaceModule( DC );
|
Compute_Ratsnest_PlaceModule( DC );
|
||||||
|
|
||||||
|
@ -711,18 +749,24 @@ int TstRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1, int side )
|
||||||
row_max = uy1 / Board.m_GridRouting;
|
row_max = uy1 / Board.m_GridRouting;
|
||||||
col_max = ux1 / Board.m_GridRouting;
|
col_max = ux1 / Board.m_GridRouting;
|
||||||
row_min = uy0 / Board.m_GridRouting;
|
row_min = uy0 / Board.m_GridRouting;
|
||||||
|
|
||||||
if( uy0 > row_min * Board.m_GridRouting )
|
if( uy0 > row_min * Board.m_GridRouting )
|
||||||
row_min++;
|
row_min++;
|
||||||
|
|
||||||
col_min = ux0 / Board.m_GridRouting;
|
col_min = ux0 / Board.m_GridRouting;
|
||||||
|
|
||||||
if( ux0 > col_min * Board.m_GridRouting )
|
if( ux0 > col_min * Board.m_GridRouting )
|
||||||
col_min++;
|
col_min++;
|
||||||
|
|
||||||
if( row_min < 0 )
|
if( row_min < 0 )
|
||||||
row_min = 0;
|
row_min = 0;
|
||||||
|
|
||||||
if( row_max >= ( Nrows - 1 ) )
|
if( row_max >= ( Nrows - 1 ) )
|
||||||
row_max = Nrows - 1;
|
row_max = Nrows - 1;
|
||||||
|
|
||||||
if( col_min < 0 )
|
if( col_min < 0 )
|
||||||
col_min = 0;
|
col_min = 0;
|
||||||
|
|
||||||
if( col_max >= ( Ncols - 1 ) )
|
if( col_max >= ( Ncols - 1 ) )
|
||||||
col_max = Ncols - 1;
|
col_max = Ncols - 1;
|
||||||
|
|
||||||
|
@ -731,8 +775,10 @@ int TstRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1, int side )
|
||||||
for( col = col_min; col <= col_max; col++ )
|
for( col = col_min; col <= col_max; col++ )
|
||||||
{
|
{
|
||||||
data = GetCell( row, col, side );
|
data = GetCell( row, col, side );
|
||||||
|
|
||||||
if( ( data & CELL_is_ZONE ) == 0 )
|
if( ( data & CELL_is_ZONE ) == 0 )
|
||||||
return OUT_OF_BOARD;
|
return OUT_OF_BOARD;
|
||||||
|
|
||||||
if( data & CELL_is_MODULE )
|
if( data & CELL_is_MODULE )
|
||||||
return OCCUPED_By_MODULE;
|
return OCCUPED_By_MODULE;
|
||||||
}
|
}
|
||||||
|
@ -761,22 +807,29 @@ unsigned int CalculePenaliteRectangle( BOARD* Pcb, int ux0, int uy0,
|
||||||
row_max = uy1 / Board.m_GridRouting;
|
row_max = uy1 / Board.m_GridRouting;
|
||||||
col_max = ux1 / Board.m_GridRouting;
|
col_max = ux1 / Board.m_GridRouting;
|
||||||
row_min = uy0 / Board.m_GridRouting;
|
row_min = uy0 / Board.m_GridRouting;
|
||||||
|
|
||||||
if( uy0 > row_min * Board.m_GridRouting )
|
if( uy0 > row_min * Board.m_GridRouting )
|
||||||
row_min++;
|
row_min++;
|
||||||
|
|
||||||
col_min = ux0 / Board.m_GridRouting;
|
col_min = ux0 / Board.m_GridRouting;
|
||||||
|
|
||||||
if( ux0 > col_min * Board.m_GridRouting )
|
if( ux0 > col_min * Board.m_GridRouting )
|
||||||
col_min++;
|
col_min++;
|
||||||
|
|
||||||
if( row_min < 0 )
|
if( row_min < 0 )
|
||||||
row_min = 0;
|
row_min = 0;
|
||||||
|
|
||||||
if( row_max >= ( Nrows - 1 ) )
|
if( row_max >= ( Nrows - 1 ) )
|
||||||
row_max = Nrows - 1;
|
row_max = Nrows - 1;
|
||||||
|
|
||||||
if( col_min < 0 )
|
if( col_min < 0 )
|
||||||
col_min = 0;
|
col_min = 0;
|
||||||
|
|
||||||
if( col_max >= ( Ncols - 1 ) )
|
if( col_max >= ( Ncols - 1 ) )
|
||||||
col_max = Ncols - 1;
|
col_max = Ncols - 1;
|
||||||
|
|
||||||
Penalite = 0;
|
Penalite = 0;
|
||||||
|
|
||||||
for( row = row_min; row <= row_max; row++ )
|
for( row = row_min; row <= row_max; row++ )
|
||||||
{
|
{
|
||||||
for( col = col_min; col <= col_max; col++ )
|
for( col = col_min; col <= col_max; col++ )
|
||||||
|
@ -799,6 +852,7 @@ int TstModuleOnBoard( BOARD* Pcb, MODULE* Module, bool TstOtherSide )
|
||||||
int error, Penalite, marge, side, otherside;
|
int error, Penalite, marge, side, otherside;
|
||||||
|
|
||||||
side = TOP; otherside = BOTTOM;
|
side = TOP; otherside = BOTTOM;
|
||||||
|
|
||||||
if( Module->GetLayer() == LAYER_N_BACK )
|
if( Module->GetLayer() == LAYER_N_BACK )
|
||||||
{
|
{
|
||||||
side = BOTTOM; otherside = TOP;
|
side = BOTTOM; otherside = TOP;
|
||||||
|
@ -810,12 +864,14 @@ int TstModuleOnBoard( BOARD* Pcb, MODULE* Module, bool TstOtherSide )
|
||||||
fy = Module->m_BoundaryBox.GetBottom();
|
fy = Module->m_BoundaryBox.GetBottom();
|
||||||
|
|
||||||
error = TstRectangle( Pcb, ox, oy, fx, fy, side );
|
error = TstRectangle( Pcb, ox, oy, fx, fy, side );
|
||||||
|
|
||||||
if( error < 0 )
|
if( error < 0 )
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
if( TstOtherSide )
|
if( TstOtherSide )
|
||||||
{
|
{
|
||||||
error = TstRectangle( Pcb, ox, oy, fx, fy, otherside );
|
error = TstRectangle( Pcb, ox, oy, fx, fy, otherside );
|
||||||
|
|
||||||
if( error < 0 )
|
if( error < 0 )
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
@ -843,15 +899,18 @@ float PCB_EDIT_FRAME::Compute_Ratsnest_PlaceModule( wxDC* DC )
|
||||||
|
|
||||||
if( ( GetBoard()->m_Status_Pcb & RATSNEST_ITEM_LOCAL_OK ) == 0 )
|
if( ( GetBoard()->m_Status_Pcb & RATSNEST_ITEM_LOCAL_OK ) == 0 )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
cout = 0;
|
cout = 0;
|
||||||
|
|
||||||
int color = g_ColorsSettings.GetItemColor(RATSNEST_VISIBLE);
|
int color = g_ColorsSettings.GetItemColor(RATSNEST_VISIBLE);
|
||||||
|
|
||||||
if( AutoPlaceShowAll )
|
if( AutoPlaceShowAll )
|
||||||
GRSetDrawMode( DC, GR_XOR );
|
GRSetDrawMode( DC, GR_XOR );
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < GetBoard()->m_LocalRatsnest.size(); ii++ )
|
for( unsigned ii = 0; ii < GetBoard()->m_LocalRatsnest.size(); ii++ )
|
||||||
{
|
{
|
||||||
RATSNEST_ITEM* pt_local_chevelu = &GetBoard()->m_LocalRatsnest[ii];
|
RATSNEST_ITEM* pt_local_chevelu = &GetBoard()->m_LocalRatsnest[ii];
|
||||||
|
|
||||||
if( !( pt_local_chevelu->m_Status & LOCAL_RATSNEST_ITEM ) )
|
if( !( pt_local_chevelu->m_Status & LOCAL_RATSNEST_ITEM ) )
|
||||||
{
|
{
|
||||||
ox = pt_local_chevelu->m_PadStart->GetPosition().x -
|
ox = pt_local_chevelu->m_PadStart->GetPosition().x -
|
||||||
|
@ -863,8 +922,7 @@ float PCB_EDIT_FRAME::Compute_Ratsnest_PlaceModule( wxDC* DC )
|
||||||
|
|
||||||
if( AutoPlaceShowAll )
|
if( AutoPlaceShowAll )
|
||||||
{
|
{
|
||||||
GRLine( &DrawPanel->m_ClipBox, DC, ox, oy, fx, fy,
|
GRLine( &DrawPanel->m_ClipBox, DC, ox, oy, fx, fy, 0, color );
|
||||||
0, color );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Cost of the ratsnest. */
|
/* Cost of the ratsnest. */
|
||||||
|
@ -901,7 +959,7 @@ float PCB_EDIT_FRAME::Compute_Ratsnest_PlaceModule( wxDC* DC )
|
||||||
* Cell outside this rectangle, but inside the rectangle
|
* Cell outside this rectangle, but inside the rectangle
|
||||||
* x0,y0 -marge to x1,y1 + marge sont incrementede by a decreasing value
|
* x0,y0 -marge to x1,y1 + marge sont incrementede by a decreasing value
|
||||||
* (Penalite ... 0). The decreasing value de pends on the distance to the first rectangle
|
* (Penalite ... 0). The decreasing value de pends on the distance to the first rectangle
|
||||||
* Therefore the cost is hight in rect x0,y0 a x1,y1, and decrease outside this rectangle
|
* Therefore the cost is high in rect x0,y0 a x1,y1, and decrease outside this rectangle
|
||||||
*/
|
*/
|
||||||
static void TracePenaliteRectangle( BOARD* Pcb,
|
static void TracePenaliteRectangle( BOARD* Pcb,
|
||||||
int ux0,
|
int ux0,
|
||||||
|
@ -910,7 +968,7 @@ static void TracePenaliteRectangle( BOARD* Pcb,
|
||||||
int uy1,
|
int uy1,
|
||||||
int marge,
|
int marge,
|
||||||
int Penalite,
|
int Penalite,
|
||||||
int masque_layer )
|
int aLayerMask )
|
||||||
{
|
{
|
||||||
int row, col;
|
int row, col;
|
||||||
int row_min, row_max, col_min, col_max, pmarge;
|
int row_min, row_max, col_min, col_max, pmarge;
|
||||||
|
@ -918,10 +976,10 @@ static void TracePenaliteRectangle( BOARD* Pcb,
|
||||||
DIST_CELL data, LocalPenalite;
|
DIST_CELL data, LocalPenalite;
|
||||||
int lgain, cgain;
|
int lgain, cgain;
|
||||||
|
|
||||||
if( masque_layer & g_TabOneLayerMask[Route_Layer_BOTTOM] )
|
if( aLayerMask & g_TabOneLayerMask[Route_Layer_BOTTOM] )
|
||||||
trace = 1; /* Trace on bottom layer. */
|
trace = 1; /* Trace on bottom layer. */
|
||||||
|
|
||||||
if( ( masque_layer & g_TabOneLayerMask[Route_Layer_TOP] ) && Nb_Sides )
|
if( ( aLayerMask & g_TabOneLayerMask[Route_Layer_TOP] ) && Nb_Sides )
|
||||||
trace |= 2; /* Trace on top layer. */
|
trace |= 2; /* Trace on top layer. */
|
||||||
|
|
||||||
if( trace == 0 )
|
if( trace == 0 )
|
||||||
|
@ -942,24 +1000,31 @@ static void TracePenaliteRectangle( BOARD* Pcb,
|
||||||
row_max = uy1 / Board.m_GridRouting;
|
row_max = uy1 / Board.m_GridRouting;
|
||||||
col_max = ux1 / Board.m_GridRouting;
|
col_max = ux1 / Board.m_GridRouting;
|
||||||
row_min = uy0 / Board.m_GridRouting;
|
row_min = uy0 / Board.m_GridRouting;
|
||||||
|
|
||||||
if( uy0 > row_min * Board.m_GridRouting )
|
if( uy0 > row_min * Board.m_GridRouting )
|
||||||
row_min++;
|
row_min++;
|
||||||
|
|
||||||
col_min = ux0 / Board.m_GridRouting;
|
col_min = ux0 / Board.m_GridRouting;
|
||||||
|
|
||||||
if( ux0 > col_min * Board.m_GridRouting )
|
if( ux0 > col_min * Board.m_GridRouting )
|
||||||
col_min++;
|
col_min++;
|
||||||
|
|
||||||
if( row_min < 0 )
|
if( row_min < 0 )
|
||||||
row_min = 0;
|
row_min = 0;
|
||||||
|
|
||||||
if( row_max >= (Nrows - 1) )
|
if( row_max >= (Nrows - 1) )
|
||||||
row_max = Nrows - 1;
|
row_max = Nrows - 1;
|
||||||
|
|
||||||
if( col_min < 0 )
|
if( col_min < 0 )
|
||||||
col_min = 0;
|
col_min = 0;
|
||||||
|
|
||||||
if( col_max >= (Ncols - 1) )
|
if( col_max >= (Ncols - 1) )
|
||||||
col_max = Ncols - 1;
|
col_max = Ncols - 1;
|
||||||
|
|
||||||
for( row = row_min; row <= row_max; row++ )
|
for( row = row_min; row <= row_max; row++ )
|
||||||
{
|
{
|
||||||
lgain = 256;
|
lgain = 256;
|
||||||
|
|
||||||
if( row < pmarge )
|
if( row < pmarge )
|
||||||
lgain = ( 256 * row ) / pmarge;
|
lgain = ( 256 * row ) / pmarge;
|
||||||
else if( row > row_max - pmarge )
|
else if( row > row_max - pmarge )
|
||||||
|
@ -969,19 +1034,23 @@ static void TracePenaliteRectangle( BOARD* Pcb,
|
||||||
{
|
{
|
||||||
cgain = 256;
|
cgain = 256;
|
||||||
LocalPenalite = Penalite;
|
LocalPenalite = Penalite;
|
||||||
|
|
||||||
if( col < pmarge )
|
if( col < pmarge )
|
||||||
cgain = ( 256 * col ) / pmarge;
|
cgain = ( 256 * col ) / pmarge;
|
||||||
else if( col > col_max - pmarge )
|
else if( col > col_max - pmarge )
|
||||||
cgain = ( 256 * ( col_max - col ) ) / pmarge;
|
cgain = ( 256 * ( col_max - col ) ) / pmarge;
|
||||||
|
|
||||||
cgain = ( cgain * lgain ) / 256;
|
cgain = ( cgain * lgain ) / 256;
|
||||||
|
|
||||||
if( cgain != 256 )
|
if( cgain != 256 )
|
||||||
LocalPenalite = ( LocalPenalite * cgain ) / 256;
|
LocalPenalite = ( LocalPenalite * cgain ) / 256;
|
||||||
|
|
||||||
if( trace & 1 )
|
if( trace & 1 )
|
||||||
{
|
{
|
||||||
data = GetDist( row, col, BOTTOM ) + LocalPenalite;
|
data = GetDist( row, col, BOTTOM ) + LocalPenalite;
|
||||||
SetDist( row, col, BOTTOM, data );
|
SetDist( row, col, BOTTOM, data );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( trace & 2 )
|
if( trace & 2 )
|
||||||
{
|
{
|
||||||
data = GetDist( row, col, TOP );
|
data = GetDist( row, col, TOP );
|
||||||
|
@ -1025,27 +1094,29 @@ static MODULE* PickModule( PCB_EDIT_FRAME* pcbframe, wxDC* DC )
|
||||||
|
|
||||||
// Build sorted footprints list (sort by decreasing size )
|
// Build sorted footprints list (sort by decreasing size )
|
||||||
Module = pcbframe->GetBoard()->m_Modules;
|
Module = pcbframe->GetBoard()->m_Modules;
|
||||||
|
|
||||||
for( ; Module != NULL; Module = Module->Next() )
|
for( ; Module != NULL; Module = Module->Next() )
|
||||||
{
|
{
|
||||||
Module->Set_Rectangle_Encadrement();
|
Module->CalculateBoundingBox();
|
||||||
moduleList.push_back(Module);
|
moduleList.push_back(Module);
|
||||||
}
|
}
|
||||||
|
|
||||||
sort( moduleList.begin(), moduleList.end(), Tri_PlaceModules );
|
sort( moduleList.begin(), moduleList.end(), Tri_PlaceModules );
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < moduleList.size(); ii++ )
|
for( unsigned ii = 0; ii < moduleList.size(); ii++ )
|
||||||
{
|
{
|
||||||
Module = moduleList[ii];
|
Module = moduleList[ii];
|
||||||
Module->flag = 0;
|
Module->flag = 0;
|
||||||
|
|
||||||
if( !( Module->m_ModuleStatus & MODULE_to_PLACE ) )
|
if( !( Module->m_ModuleStatus & MODULE_to_PLACE ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
pcbframe->GetBoard()->m_Status_Pcb &= ~RATSNEST_ITEM_LOCAL_OK;
|
pcbframe->GetBoard()->m_Status_Pcb &= ~RATSNEST_ITEM_LOCAL_OK;
|
||||||
Module->DisplayInfo( pcbframe );
|
Module->DisplayInfo( pcbframe );
|
||||||
pcbframe->build_ratsnest_module( Module );
|
pcbframe->build_ratsnest_module( Module );
|
||||||
|
|
||||||
/* Calculate external ratsnet. */
|
/* Calculate external ratsnet. */
|
||||||
for( unsigned ii = 0;
|
for( unsigned ii = 0; ii < pcbframe->GetBoard()->m_LocalRatsnest.size(); ii++ )
|
||||||
ii < pcbframe->GetBoard()->m_LocalRatsnest.size();
|
|
||||||
ii++ )
|
|
||||||
{
|
{
|
||||||
if( ( pcbframe->GetBoard()->m_LocalRatsnest[ii].m_Status &
|
if( ( pcbframe->GetBoard()->m_LocalRatsnest[ii].m_Status &
|
||||||
LOCAL_RATSNEST_ITEM ) == 0 )
|
LOCAL_RATSNEST_ITEM ) == 0 )
|
||||||
|
@ -1060,14 +1131,19 @@ static MODULE* PickModule( PCB_EDIT_FRAME* pcbframe, wxDC* DC )
|
||||||
/* Search for "best" module. */
|
/* Search for "best" module. */
|
||||||
MODULE* bestModule = NULL;
|
MODULE* bestModule = NULL;
|
||||||
MODULE* altModule = NULL;
|
MODULE* altModule = NULL;
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < moduleList.size(); ii++ )
|
for( unsigned ii = 0; ii < moduleList.size(); ii++ )
|
||||||
{
|
{
|
||||||
Module = moduleList[ii];
|
Module = moduleList[ii];
|
||||||
|
|
||||||
if( !( Module->m_ModuleStatus & MODULE_to_PLACE ) )
|
if( !( Module->m_ModuleStatus & MODULE_to_PLACE ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
altModule = Module;
|
altModule = Module;
|
||||||
|
|
||||||
if( Module->flag == 0 )
|
if( Module->flag == 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
bestModule = Module;
|
bestModule = Module;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1079,10 +1155,6 @@ static MODULE* PickModule( PCB_EDIT_FRAME* pcbframe, wxDC* DC )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************************/
|
|
||||||
int Propagation( PCB_EDIT_FRAME* frame )
|
|
||||||
/********************************************/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Propagation
|
* Function Propagation
|
||||||
* Used now only in autoplace calculations
|
* Used now only in autoplace calculations
|
||||||
|
@ -1107,6 +1179,7 @@ int Propagation( PCB_EDIT_FRAME* frame )
|
||||||
* Iterations are made until no cell is added to the zone.
|
* Iterations are made until no cell is added to the zone.
|
||||||
* @return: added cells count (i.e. which the attribute CELL_is_ZONE is set)
|
* @return: added cells count (i.e. which the attribute CELL_is_ZONE is set)
|
||||||
*/
|
*/
|
||||||
|
int Propagation( PCB_EDIT_FRAME* frame )
|
||||||
{
|
{
|
||||||
int row, col, nn;
|
int row, col, nn;
|
||||||
long current_cell, old_cell_H;
|
long current_cell, old_cell_H;
|
||||||
|
@ -1125,22 +1198,25 @@ int Propagation( PCB_EDIT_FRAME* frame )
|
||||||
|
|
||||||
/* search 1 : from left to right and top to bottom */
|
/* search 1 : from left to right and top to bottom */
|
||||||
memset( pt_cell_V, 0, nn );
|
memset( pt_cell_V, 0, nn );
|
||||||
|
|
||||||
for( row = 0; row < Nrows; row++ )
|
for( row = 0; row < Nrows; row++ )
|
||||||
{
|
{
|
||||||
old_cell_H = 0;
|
old_cell_H = 0;
|
||||||
|
|
||||||
for( col = 0; col < Ncols; col++ )
|
for( col = 0; col < Ncols; col++ )
|
||||||
{
|
{
|
||||||
current_cell = GetCell( row, col, BOTTOM ) & NO_CELL_ZONE;
|
current_cell = GetCell( row, col, BOTTOM ) & NO_CELL_ZONE;
|
||||||
|
|
||||||
if( current_cell == 0 ) /* a free cell is found */
|
if( current_cell == 0 ) /* a free cell is found */
|
||||||
{
|
{
|
||||||
if( (old_cell_H & CELL_is_ZONE)
|
if( (old_cell_H & CELL_is_ZONE) || (pt_cell_V[col] & CELL_is_ZONE) )
|
||||||
|| (pt_cell_V[col] & CELL_is_ZONE) )
|
|
||||||
{
|
{
|
||||||
OrCell( row, col, BOTTOM, CELL_is_ZONE );
|
OrCell( row, col, BOTTOM, CELL_is_ZONE );
|
||||||
current_cell = CELL_is_ZONE;
|
current_cell = CELL_is_ZONE;
|
||||||
nbpoints++;
|
nbpoints++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pt_cell_V[col] = old_cell_H = current_cell;
|
pt_cell_V[col] = old_cell_H = current_cell;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1148,22 +1224,24 @@ int Propagation( PCB_EDIT_FRAME* frame )
|
||||||
/* search 2 : from right to left and top to bottom */
|
/* search 2 : from right to left and top to bottom */
|
||||||
frame->MsgPanel->SetMessage( -1, wxEmptyString, wxT( "2" ), CYAN );
|
frame->MsgPanel->SetMessage( -1, wxEmptyString, wxT( "2" ), CYAN );
|
||||||
memset( pt_cell_V, 0, nn );
|
memset( pt_cell_V, 0, nn );
|
||||||
|
|
||||||
for( row = 0; row < Nrows; row++ )
|
for( row = 0; row < Nrows; row++ )
|
||||||
{
|
{
|
||||||
old_cell_H = 0;
|
old_cell_H = 0;
|
||||||
for( col = Ncols - 1; col >= 0; col-- )
|
for( col = Ncols - 1; col >= 0; col-- )
|
||||||
{
|
{
|
||||||
current_cell = GetCell( row, col, BOTTOM ) & NO_CELL_ZONE;
|
current_cell = GetCell( row, col, BOTTOM ) & NO_CELL_ZONE;
|
||||||
|
|
||||||
if( current_cell == 0 ) /* a free cell is found */
|
if( current_cell == 0 ) /* a free cell is found */
|
||||||
{
|
{
|
||||||
if( (old_cell_H & CELL_is_ZONE)
|
if( (old_cell_H & CELL_is_ZONE) || (pt_cell_V[col] & CELL_is_ZONE) )
|
||||||
|| (pt_cell_V[col] & CELL_is_ZONE) )
|
|
||||||
{
|
{
|
||||||
OrCell( row, col, BOTTOM, CELL_is_ZONE );
|
OrCell( row, col, BOTTOM, CELL_is_ZONE );
|
||||||
current_cell = CELL_is_ZONE;
|
current_cell = CELL_is_ZONE;
|
||||||
nbpoints++;
|
nbpoints++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pt_cell_V[col] = old_cell_H = current_cell;
|
pt_cell_V[col] = old_cell_H = current_cell;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1171,22 +1249,25 @@ int Propagation( PCB_EDIT_FRAME* frame )
|
||||||
/* search 3 : from bottom to top and right to left balayage */
|
/* search 3 : from bottom to top and right to left balayage */
|
||||||
frame->MsgPanel->SetMessage( -1, wxEmptyString, wxT( "3" ), CYAN );
|
frame->MsgPanel->SetMessage( -1, wxEmptyString, wxT( "3" ), CYAN );
|
||||||
memset( pt_cell_V, 0, nn );
|
memset( pt_cell_V, 0, nn );
|
||||||
|
|
||||||
for( col = Ncols - 1; col >= 0; col-- )
|
for( col = Ncols - 1; col >= 0; col-- )
|
||||||
{
|
{
|
||||||
old_cell_H = 0;
|
old_cell_H = 0;
|
||||||
|
|
||||||
for( row = Nrows - 1; row >= 0; row-- )
|
for( row = Nrows - 1; row >= 0; row-- )
|
||||||
{
|
{
|
||||||
current_cell = GetCell( row, col, BOTTOM ) & NO_CELL_ZONE;
|
current_cell = GetCell( row, col, BOTTOM ) & NO_CELL_ZONE;
|
||||||
|
|
||||||
if( current_cell == 0 ) /* a free cell is found */
|
if( current_cell == 0 ) /* a free cell is found */
|
||||||
{
|
{
|
||||||
if( (old_cell_H & CELL_is_ZONE)
|
if( (old_cell_H & CELL_is_ZONE) || (pt_cell_V[row] & CELL_is_ZONE) )
|
||||||
|| (pt_cell_V[row] & CELL_is_ZONE) )
|
|
||||||
{
|
{
|
||||||
OrCell( row, col, BOTTOM, CELL_is_ZONE );
|
OrCell( row, col, BOTTOM, CELL_is_ZONE );
|
||||||
current_cell = CELL_is_ZONE;
|
current_cell = CELL_is_ZONE;
|
||||||
nbpoints++;
|
nbpoints++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pt_cell_V[row] = old_cell_H = current_cell;
|
pt_cell_V[row] = old_cell_H = current_cell;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1198,19 +1279,21 @@ int Propagation( PCB_EDIT_FRAME* frame )
|
||||||
for( col = 0; col < Ncols; col++ )
|
for( col = 0; col < Ncols; col++ )
|
||||||
{
|
{
|
||||||
old_cell_H = 0;
|
old_cell_H = 0;
|
||||||
|
|
||||||
for( row = Nrows - 1; row >= 0; row-- )
|
for( row = Nrows - 1; row >= 0; row-- )
|
||||||
{
|
{
|
||||||
current_cell = GetCell( row, col, BOTTOM ) & NO_CELL_ZONE;
|
current_cell = GetCell( row, col, BOTTOM ) & NO_CELL_ZONE;
|
||||||
|
|
||||||
if( current_cell == 0 ) /* a free cell is found */
|
if( current_cell == 0 ) /* a free cell is found */
|
||||||
{
|
{
|
||||||
if( (old_cell_H & CELL_is_ZONE)
|
if( (old_cell_H & CELL_is_ZONE) || (pt_cell_V[row] & CELL_is_ZONE) )
|
||||||
|| (pt_cell_V[row] & CELL_is_ZONE) )
|
|
||||||
{
|
{
|
||||||
OrCell( row, col, BOTTOM, CELL_is_ZONE );
|
OrCell( row, col, BOTTOM, CELL_is_ZONE );
|
||||||
current_cell = CELL_is_ZONE;
|
current_cell = CELL_is_ZONE;
|
||||||
nbpoints++;
|
nbpoints++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pt_cell_V[row] = old_cell_H = current_cell;
|
pt_cell_V[row] = old_cell_H = current_cell;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1219,4 +1302,3 @@ int Propagation( PCB_EDIT_FRAME* frame )
|
||||||
|
|
||||||
return nbpoints;
|
return nbpoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ PCB_BASE_FRAME::PCB_BASE_FRAME( wxWindow* father,
|
||||||
|
|
||||||
m_DisplayModEdge = FILLED; // How to display module drawings (line/ filled / sketch)
|
m_DisplayModEdge = FILLED; // How to display module drawings (line/ filled / sketch)
|
||||||
m_DisplayModText = FILLED; // How to display module texts (line/ filled / sketch)
|
m_DisplayModText = FILLED; // How to display module texts (line/ filled / sketch)
|
||||||
m_DisplayPcbTrackFill = true; /* FALSE = sketch , true = filled */
|
m_DisplayPcbTrackFill = true; /* false = sketch , true = filled */
|
||||||
m_Draw3DFrame = NULL; // Display Window in 3D mode (OpenGL)
|
m_Draw3DFrame = NULL; // Display Window in 3D mode (OpenGL)
|
||||||
m_ModuleEditFrame = NULL; // Frame for footprint edition
|
m_ModuleEditFrame = NULL; // Frame for footprint edition
|
||||||
|
|
||||||
|
|
|
@ -378,7 +378,7 @@ bool PCB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
|
||||||
*/
|
*/
|
||||||
void PCB_EDIT_FRAME::Block_SelectItems()
|
void PCB_EDIT_FRAME::Block_SelectItems()
|
||||||
{
|
{
|
||||||
int masque_layer;
|
int layerMask;
|
||||||
|
|
||||||
GetScreen()->m_BlockLocate.Normalize();
|
GetScreen()->m_BlockLocate.Normalize();
|
||||||
|
|
||||||
|
@ -388,8 +388,7 @@ void PCB_EDIT_FRAME::Block_SelectItems()
|
||||||
// Add modules
|
// Add modules
|
||||||
if( blockIncludeModules )
|
if( blockIncludeModules )
|
||||||
{
|
{
|
||||||
for( MODULE* module = m_Pcb->m_Modules; module != NULL;
|
for( MODULE* module = m_Pcb->m_Modules; module != NULL; module = module->Next() )
|
||||||
module = module->Next() )
|
|
||||||
{
|
{
|
||||||
int layer = module->GetLayer();
|
int layer = module->GetLayer();
|
||||||
|
|
||||||
|
@ -409,8 +408,7 @@ void PCB_EDIT_FRAME::Block_SelectItems()
|
||||||
// Add tracks and vias
|
// Add tracks and vias
|
||||||
if( blockIncludeTracks )
|
if( blockIncludeTracks )
|
||||||
{
|
{
|
||||||
for( TRACK* pt_segm = m_Pcb->m_Track; pt_segm != NULL;
|
for( TRACK* pt_segm = m_Pcb->m_Track; pt_segm != NULL; pt_segm = pt_segm->Next() )
|
||||||
pt_segm = pt_segm->Next() )
|
|
||||||
{
|
{
|
||||||
if( pt_segm->HitTest( GetScreen()->m_BlockLocate ) )
|
if( pt_segm->HitTest( GetScreen()->m_BlockLocate ) )
|
||||||
{
|
{
|
||||||
|
@ -425,16 +423,15 @@ void PCB_EDIT_FRAME::Block_SelectItems()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add graphic items
|
// Add graphic items
|
||||||
masque_layer = EDGE_LAYER;
|
layerMask = EDGE_LAYER;
|
||||||
|
|
||||||
if( blockIncludeItemsOnTechLayers )
|
if( blockIncludeItemsOnTechLayers )
|
||||||
masque_layer = ALL_LAYERS;
|
layerMask = ALL_LAYERS;
|
||||||
|
|
||||||
if( !blockIncludeBoardOutlineLayer )
|
if( !blockIncludeBoardOutlineLayer )
|
||||||
masque_layer &= ~EDGE_LAYER;
|
layerMask &= ~EDGE_LAYER;
|
||||||
|
|
||||||
for( BOARD_ITEM* PtStruct = m_Pcb->m_Drawings; PtStruct != NULL;
|
for( BOARD_ITEM* PtStruct = m_Pcb->m_Drawings; PtStruct != NULL; PtStruct = PtStruct->Next() )
|
||||||
PtStruct = PtStruct->Next() )
|
|
||||||
{
|
{
|
||||||
if( !m_Pcb->IsLayerVisible( PtStruct->GetLayer() ) && ! blockIncludeItemsOnInvisibleLayers)
|
if( !m_Pcb->IsLayerVisible( PtStruct->GetLayer() ) && ! blockIncludeItemsOnInvisibleLayers)
|
||||||
continue;
|
continue;
|
||||||
|
@ -442,7 +439,7 @@ void PCB_EDIT_FRAME::Block_SelectItems()
|
||||||
switch( PtStruct->Type() )
|
switch( PtStruct->Type() )
|
||||||
{
|
{
|
||||||
case TYPE_DRAWSEGMENT:
|
case TYPE_DRAWSEGMENT:
|
||||||
if( (g_TabOneLayerMask[PtStruct->GetLayer()] & masque_layer) == 0 )
|
if( (g_TabOneLayerMask[PtStruct->GetLayer()] & layerMask) == 0 )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if( !PtStruct->HitTest( GetScreen()->m_BlockLocate ) )
|
if( !PtStruct->HitTest( GetScreen()->m_BlockLocate ) )
|
||||||
|
@ -459,21 +456,23 @@ void PCB_EDIT_FRAME::Block_SelectItems()
|
||||||
select_me = true; // This item is in bloc: select it
|
select_me = true; // This item is in bloc: select it
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_MIRE:
|
case PCB_TARGET_T:
|
||||||
if( ( g_TabOneLayerMask[PtStruct->GetLayer()] & masque_layer ) == 0 )
|
if( ( g_TabOneLayerMask[PtStruct->GetLayer()] & layerMask ) == 0 )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if( !PtStruct->HitTest( GetScreen()->m_BlockLocate ) )
|
if( !PtStruct->HitTest( GetScreen()->m_BlockLocate ) )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
select_me = true; // This item is in bloc: select it
|
select_me = true; // This item is in bloc: select it
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_DIMENSION:
|
case TYPE_DIMENSION:
|
||||||
if( ( g_TabOneLayerMask[PtStruct->GetLayer()] & masque_layer ) == 0 )
|
if( ( g_TabOneLayerMask[PtStruct->GetLayer()] & layerMask ) == 0 )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if( !PtStruct->HitTest( GetScreen()->m_BlockLocate ) )
|
if( !PtStruct->HitTest( GetScreen()->m_BlockLocate ) )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
select_me = true; // This item is in bloc: select it
|
select_me = true; // This item is in bloc: select it
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -517,9 +516,11 @@ static void drawPickedItems( EDA_DRAW_PANEL* aPanel, wxDC* aDC, wxPoint aOffset
|
||||||
PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) aPanel->GetParent();
|
PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) aPanel->GetParent();
|
||||||
|
|
||||||
g_Offset_Module = -aOffset;
|
g_Offset_Module = -aOffset;
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < itemsList->GetCount(); ii++ )
|
for( unsigned ii = 0; ii < itemsList->GetCount(); ii++ )
|
||||||
{
|
{
|
||||||
BOARD_ITEM* item = (BOARD_ITEM*) itemsList->GetPickedItem( ii );
|
BOARD_ITEM* item = (BOARD_ITEM*) itemsList->GetPickedItem( ii );
|
||||||
|
|
||||||
switch( item->Type() )
|
switch( item->Type() )
|
||||||
{
|
{
|
||||||
case TYPE_MODULE:
|
case TYPE_MODULE:
|
||||||
|
@ -531,7 +532,7 @@ static void drawPickedItems( EDA_DRAW_PANEL* aPanel, wxDC* aDC, wxPoint aOffset
|
||||||
case TYPE_TEXTE:
|
case TYPE_TEXTE:
|
||||||
case TYPE_TRACK:
|
case TYPE_TRACK:
|
||||||
case TYPE_VIA:
|
case TYPE_VIA:
|
||||||
case TYPE_MIRE:
|
case PCB_TARGET_T:
|
||||||
case TYPE_DIMENSION: // Currently markers are not affected by block commands
|
case TYPE_DIMENSION: // Currently markers are not affected by block commands
|
||||||
case TYPE_MARKER_PCB:
|
case TYPE_MARKER_PCB:
|
||||||
item->Draw( aPanel, aDC, GR_XOR, aOffset );
|
item->Draw( aPanel, aDC, GR_XOR, aOffset );
|
||||||
|
@ -600,6 +601,7 @@ void PCB_EDIT_FRAME::Block_Delete()
|
||||||
{
|
{
|
||||||
BOARD_ITEM* item = (BOARD_ITEM*) itemsList->GetPickedItem( ii );
|
BOARD_ITEM* item = (BOARD_ITEM*) itemsList->GetPickedItem( ii );
|
||||||
itemsList->SetPickedItemStatus( UR_DELETED, ii );
|
itemsList->SetPickedItemStatus( UR_DELETED, ii );
|
||||||
|
|
||||||
switch( item->Type() )
|
switch( item->Type() )
|
||||||
{
|
{
|
||||||
case TYPE_MODULE:
|
case TYPE_MODULE:
|
||||||
|
@ -620,7 +622,7 @@ void PCB_EDIT_FRAME::Block_Delete()
|
||||||
case TYPE_TRACK: // a track segment (segment on a copper layer)
|
case TYPE_TRACK: // a track segment (segment on a copper layer)
|
||||||
case TYPE_VIA: // a via (like atrack segment on a copper layer)
|
case TYPE_VIA: // a via (like atrack segment on a copper layer)
|
||||||
case TYPE_DIMENSION: // a dimension (graphic item)
|
case TYPE_DIMENSION: // a dimension (graphic item)
|
||||||
case TYPE_MIRE: // a target (graphic item)
|
case PCB_TARGET_T: // a target (graphic item)
|
||||||
item->UnLink();
|
item->UnLink();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -671,6 +673,7 @@ void PCB_EDIT_FRAME::Block_Rotate()
|
||||||
wxASSERT( item );
|
wxASSERT( item );
|
||||||
itemsList->SetPickedItemStatus( UR_ROTATED, ii );
|
itemsList->SetPickedItemStatus( UR_ROTATED, ii );
|
||||||
item->Rotate( centre, rotAngle );
|
item->Rotate( centre, rotAngle );
|
||||||
|
|
||||||
switch( item->Type() )
|
switch( item->Type() )
|
||||||
{
|
{
|
||||||
case TYPE_MODULE:
|
case TYPE_MODULE:
|
||||||
|
@ -687,7 +690,7 @@ void PCB_EDIT_FRAME::Block_Rotate()
|
||||||
case TYPE_ZONE_CONTAINER:
|
case TYPE_ZONE_CONTAINER:
|
||||||
case TYPE_DRAWSEGMENT:
|
case TYPE_DRAWSEGMENT:
|
||||||
case TYPE_TEXTE:
|
case TYPE_TEXTE:
|
||||||
case TYPE_MIRE:
|
case PCB_TARGET_T:
|
||||||
case TYPE_DIMENSION:
|
case TYPE_DIMENSION:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -736,6 +739,7 @@ void PCB_EDIT_FRAME::Block_Flip()
|
||||||
wxASSERT( item );
|
wxASSERT( item );
|
||||||
itemsList->SetPickedItemStatus( UR_FLIPPED, ii );
|
itemsList->SetPickedItemStatus( UR_FLIPPED, ii );
|
||||||
item->Flip( center );
|
item->Flip( center );
|
||||||
|
|
||||||
switch( item->Type() )
|
switch( item->Type() )
|
||||||
{
|
{
|
||||||
case TYPE_MODULE:
|
case TYPE_MODULE:
|
||||||
|
@ -752,7 +756,7 @@ void PCB_EDIT_FRAME::Block_Flip()
|
||||||
case TYPE_ZONE_CONTAINER:
|
case TYPE_ZONE_CONTAINER:
|
||||||
case TYPE_DRAWSEGMENT:
|
case TYPE_DRAWSEGMENT:
|
||||||
case TYPE_TEXTE:
|
case TYPE_TEXTE:
|
||||||
case TYPE_MIRE:
|
case PCB_TARGET_T:
|
||||||
case TYPE_DIMENSION:
|
case TYPE_DIMENSION:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -812,7 +816,7 @@ void PCB_EDIT_FRAME::Block_Move()
|
||||||
case TYPE_ZONE_CONTAINER:
|
case TYPE_ZONE_CONTAINER:
|
||||||
case TYPE_DRAWSEGMENT:
|
case TYPE_DRAWSEGMENT:
|
||||||
case TYPE_TEXTE:
|
case TYPE_TEXTE:
|
||||||
case TYPE_MIRE:
|
case PCB_TARGET_T:
|
||||||
case TYPE_DIMENSION:
|
case TYPE_DIMENSION:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -890,8 +894,7 @@ void PCB_EDIT_FRAME::Block_Duplicate()
|
||||||
|
|
||||||
case TYPE_ZONE_CONTAINER:
|
case TYPE_ZONE_CONTAINER:
|
||||||
{
|
{
|
||||||
ZONE_CONTAINER* new_zone =
|
ZONE_CONTAINER* new_zone = new ZONE_CONTAINER( (BOARD*) item->GetParent() );
|
||||||
new ZONE_CONTAINER( (BOARD*) item->GetParent() );
|
|
||||||
new_zone->Copy( (ZONE_CONTAINER*) item );
|
new_zone->Copy( (ZONE_CONTAINER*) item );
|
||||||
new_zone->m_TimeStamp = GetTimeStamp();
|
new_zone->m_TimeStamp = GetTimeStamp();
|
||||||
newitem = new_zone;
|
newitem = new_zone;
|
||||||
|
@ -917,12 +920,12 @@ void PCB_EDIT_FRAME::Block_Duplicate()
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_MIRE:
|
case PCB_TARGET_T:
|
||||||
{
|
{
|
||||||
MIREPCB* new_mire = new MIREPCB( m_Pcb );
|
PCB_TARGET* target = new PCB_TARGET( m_Pcb );
|
||||||
new_mire->Copy( (MIREPCB*) item );
|
target->Copy( (PCB_TARGET*) item );
|
||||||
m_Pcb->Add( new_mire );
|
m_Pcb->Add( target );
|
||||||
newitem = new_mire;
|
newitem = target;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -114,13 +114,13 @@ bool FOOTPRINT_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
|
||||||
|
|
||||||
if( DrawPanel->IsMouseCaptured() )
|
if( DrawPanel->IsMouseCaptured() )
|
||||||
{
|
{
|
||||||
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, FALSE );
|
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
|
||||||
DrawPanel->m_mouseCaptureCallback = DrawMovingBlockOutlines;
|
DrawPanel->m_mouseCaptureCallback = DrawMovingBlockOutlines;
|
||||||
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, FALSE );
|
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE;
|
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE;
|
||||||
DrawPanel->Refresh( TRUE );
|
DrawPanel->Refresh( true );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -215,7 +215,7 @@ void FOOTPRINT_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
|
||||||
GetScreen()->m_BlockLocate.ClearItemsList();
|
GetScreen()->m_BlockLocate.ClearItemsList();
|
||||||
SaveCopyInUndoList( currentModule, UR_MODEDIT );
|
SaveCopyInUndoList( currentModule, UR_MODEDIT );
|
||||||
MoveMarkedItems( currentModule, GetScreen()->m_BlockLocate.m_MoveVector );
|
MoveMarkedItems( currentModule, GetScreen()->m_BlockLocate.m_MoveVector );
|
||||||
DrawPanel->Refresh( TRUE );
|
DrawPanel->Refresh( true );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_COPY: /* Copy */
|
case BLOCK_COPY: /* Copy */
|
||||||
|
@ -366,6 +366,7 @@ void CopyMarkedItems( MODULE* module, wxPoint offset )
|
||||||
{
|
{
|
||||||
if( pad->m_Selected == 0 )
|
if( pad->m_Selected == 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
pad->m_Selected = 0;
|
pad->m_Selected = 0;
|
||||||
D_PAD* NewPad = new D_PAD( module );
|
D_PAD* NewPad = new D_PAD( module );
|
||||||
NewPad->Copy( pad );
|
NewPad->Copy( pad );
|
||||||
|
|
|
@ -81,16 +81,19 @@ int MATRIX_ROUTING_HEAD::InitBoard()
|
||||||
|
|
||||||
/* allocate Board & initialize everything to empty */
|
/* allocate Board & initialize everything to empty */
|
||||||
m_BoardSide[kk] = (MATRIX_CELL*) MyZMalloc( ii * sizeof(MATRIX_CELL) );
|
m_BoardSide[kk] = (MATRIX_CELL*) MyZMalloc( ii * sizeof(MATRIX_CELL) );
|
||||||
|
|
||||||
if( m_BoardSide[kk] == NULL )
|
if( m_BoardSide[kk] == NULL )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/***** allocate Distances *****/
|
/***** allocate Distances *****/
|
||||||
m_DistSide[kk] = (DIST_CELL*) MyZMalloc( ii * sizeof(DIST_CELL) );
|
m_DistSide[kk] = (DIST_CELL*) MyZMalloc( ii * sizeof(DIST_CELL) );
|
||||||
|
|
||||||
if( m_DistSide[kk] == NULL )
|
if( m_DistSide[kk] == NULL )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/***** allocate Dir (chars) *****/
|
/***** allocate Dir (chars) *****/
|
||||||
m_DirSide[kk] = (char*) MyZMalloc( ii );
|
m_DirSide[kk] = (char*) MyZMalloc( ii );
|
||||||
|
|
||||||
if( m_DirSide[kk] == NULL )
|
if( m_DirSide[kk] == NULL )
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -146,7 +149,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
|
||||||
{
|
{
|
||||||
int ux0 = 0, uy0 = 0, ux1, uy1, dx, dy;
|
int ux0 = 0, uy0 = 0, ux1, uy1, dx, dy;
|
||||||
int marge, via_marge;
|
int marge, via_marge;
|
||||||
int masque_layer;
|
int layerMask;
|
||||||
|
|
||||||
// use the default NETCLASS?
|
// use the default NETCLASS?
|
||||||
NETCLASS* nc = aPcb->m_NetClasses.GetDefault();
|
NETCLASS* nc = aPcb->m_NetClasses.GetDefault();
|
||||||
|
@ -167,12 +170,14 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
|
||||||
{
|
{
|
||||||
Place_1_Pad_Board( aPcb, pad, HOLE, marge, WRITE_CELL );
|
Place_1_Pad_Board( aPcb, pad, HOLE, marge, WRITE_CELL );
|
||||||
}
|
}
|
||||||
|
|
||||||
Place_1_Pad_Board( aPcb, pad, VIA_IMPOSSIBLE, via_marge, WRITE_OR_CELL );
|
Place_1_Pad_Board( aPcb, pad, VIA_IMPOSSIBLE, via_marge, WRITE_OR_CELL );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Place outlines of modules on matrix routing, if they are on a copper layer
|
// Place outlines of modules on matrix routing, if they are on a copper layer
|
||||||
// or on the edge layer
|
// or on the edge layer
|
||||||
TRACK tmpSegm( NULL ); // A dummy track used to create segments.
|
TRACK tmpSegm( NULL ); // A dummy track used to create segments.
|
||||||
|
|
||||||
for( MODULE* module = aPcb->m_Modules; module; module = module->Next() )
|
for( MODULE* module = aPcb->m_Modules; module; module = module->Next() )
|
||||||
{
|
{
|
||||||
for( BOARD_ITEM* item = module->m_Drawings; item; item = item->Next() )
|
for( BOARD_ITEM* item = module->m_Drawings; item; item = item->Next() )
|
||||||
|
@ -184,6 +189,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
|
||||||
EDGE_MODULE* edge = (EDGE_MODULE*) item;
|
EDGE_MODULE* edge = (EDGE_MODULE*) item;
|
||||||
|
|
||||||
tmpSegm.SetLayer( edge->GetLayer() );
|
tmpSegm.SetLayer( edge->GetLayer() );
|
||||||
|
|
||||||
if( tmpSegm.GetLayer() == EDGE_N )
|
if( tmpSegm.GetLayer() == EDGE_N )
|
||||||
tmpSegm.SetLayer( -1 );
|
tmpSegm.SetLayer( -1 );
|
||||||
|
|
||||||
|
@ -195,8 +201,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
|
||||||
tmpSegm.SetNet( -1 );
|
tmpSegm.SetNet( -1 );
|
||||||
|
|
||||||
TraceSegmentPcb( aPcb, &tmpSegm, HOLE, marge, WRITE_CELL );
|
TraceSegmentPcb( aPcb, &tmpSegm, HOLE, marge, WRITE_CELL );
|
||||||
TraceSegmentPcb( aPcb, &tmpSegm, VIA_IMPOSSIBLE, via_marge,
|
TraceSegmentPcb( aPcb, &tmpSegm, VIA_IMPOSSIBLE, via_marge, WRITE_OR_CELL );
|
||||||
WRITE_OR_CELL );
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -218,6 +223,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
|
||||||
int type_cell = HOLE;
|
int type_cell = HOLE;
|
||||||
DrawSegm = (DRAWSEGMENT*) item;
|
DrawSegm = (DRAWSEGMENT*) item;
|
||||||
tmpSegm.SetLayer( DrawSegm->GetLayer() );
|
tmpSegm.SetLayer( DrawSegm->GetLayer() );
|
||||||
|
|
||||||
if( DrawSegm->GetLayer() == EDGE_N )
|
if( DrawSegm->GetLayer() == EDGE_N )
|
||||||
{
|
{
|
||||||
tmpSegm.SetLayer( -1 );
|
tmpSegm.SetLayer( -1 );
|
||||||
|
@ -258,16 +264,16 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
|
||||||
ux0 -= dx;
|
ux0 -= dx;
|
||||||
uy0 -= dy;
|
uy0 -= dy;
|
||||||
|
|
||||||
masque_layer = g_TabOneLayerMask[PtText->GetLayer()];
|
layerMask = g_TabOneLayerMask[PtText->GetLayer()];
|
||||||
|
|
||||||
TraceFilledRectangle( aPcb, ux0 - marge, uy0 - marge, ux1 + marge,
|
TraceFilledRectangle( aPcb, ux0 - marge, uy0 - marge, ux1 + marge,
|
||||||
uy1 + marge, (int) (PtText->m_Orient),
|
uy1 + marge, (int) (PtText->m_Orient),
|
||||||
masque_layer, HOLE, WRITE_CELL );
|
layerMask, HOLE, WRITE_CELL );
|
||||||
|
|
||||||
TraceFilledRectangle( aPcb, ux0 - via_marge, uy0 - via_marge,
|
TraceFilledRectangle( aPcb, ux0 - via_marge, uy0 - via_marge,
|
||||||
ux1 + via_marge, uy1 + via_marge,
|
ux1 + via_marge, uy1 + via_marge,
|
||||||
(int) (PtText->m_Orient),
|
(int) (PtText->m_Orient),
|
||||||
masque_layer, VIA_IMPOSSIBLE, WRITE_OR_CELL );
|
layerMask, VIA_IMPOSSIBLE, WRITE_OR_CELL );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -299,6 +305,7 @@ int Build_Work( BOARD* Pcb )
|
||||||
|
|
||||||
InitWork(); /* clear work list */
|
InitWork(); /* clear work list */
|
||||||
Ntotal = 0;
|
Ntotal = 0;
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < Pcb->GetRatsnestsCount(); ii++ )
|
for( unsigned ii = 0; ii < Pcb->GetRatsnestsCount(); ii++ )
|
||||||
{
|
{
|
||||||
pt_rats = &Pcb->m_FullRatsnest[ii];
|
pt_rats = &Pcb->m_FullRatsnest[ii];
|
||||||
|
@ -308,10 +315,13 @@ int Build_Work( BOARD* Pcb )
|
||||||
*/
|
*/
|
||||||
if( (pt_rats->m_Status & CH_ACTIF) == 0 )
|
if( (pt_rats->m_Status & CH_ACTIF) == 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( pt_rats->m_Status & CH_UNROUTABLE )
|
if( pt_rats->m_Status & CH_UNROUTABLE )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( (pt_rats->m_Status & CH_ROUTE_REQ) == 0 )
|
if( (pt_rats->m_Status & CH_ROUTE_REQ) == 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
pt_pad = pt_rats->m_PadStart;
|
pt_pad = pt_rats->m_PadStart;
|
||||||
|
|
||||||
current_net_code = pt_pad->GetNet();
|
current_net_code = pt_pad->GetNet();
|
||||||
|
@ -319,6 +329,7 @@ int Build_Work( BOARD* Pcb )
|
||||||
|
|
||||||
r1 = ( pt_pad->GetPosition().y - Pcb->m_BoundaryBox.m_Pos.y
|
r1 = ( pt_pad->GetPosition().y - Pcb->m_BoundaryBox.m_Pos.y
|
||||||
+ demi_pas ) / Board.m_GridRouting;
|
+ demi_pas ) / Board.m_GridRouting;
|
||||||
|
|
||||||
if( r1 < 0 || r1 >= Nrows )
|
if( r1 < 0 || r1 >= Nrows )
|
||||||
{
|
{
|
||||||
msg.Printf( wxT( "error : row = %d ( padY %d pcbY %d) " ), r1,
|
msg.Printf( wxT( "error : row = %d ( padY %d pcbY %d) " ), r1,
|
||||||
|
@ -326,8 +337,10 @@ int Build_Work( BOARD* Pcb )
|
||||||
wxMessageBox( msg );
|
wxMessageBox( msg );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
c1 = ( pt_pad->GetPosition().x - Pcb->m_BoundaryBox.m_Pos.x
|
c1 = ( pt_pad->GetPosition().x - Pcb->m_BoundaryBox.m_Pos.x
|
||||||
+ demi_pas ) / Board.m_GridRouting;
|
+ demi_pas ) / Board.m_GridRouting;
|
||||||
|
|
||||||
if( c1 < 0 || c1 >= Ncols )
|
if( c1 < 0 || c1 >= Ncols )
|
||||||
{
|
{
|
||||||
msg.Printf( wxT( "error : col = %d ( padX %d pcbX %d) " ), c1,
|
msg.Printf( wxT( "error : col = %d ( padX %d pcbX %d) " ), c1,
|
||||||
|
@ -340,6 +353,7 @@ int Build_Work( BOARD* Pcb )
|
||||||
|
|
||||||
r2 = ( pt_pad->GetPosition().y - Pcb->m_BoundaryBox.m_Pos.y
|
r2 = ( pt_pad->GetPosition().y - Pcb->m_BoundaryBox.m_Pos.y
|
||||||
+ demi_pas ) / Board.m_GridRouting;
|
+ demi_pas ) / Board.m_GridRouting;
|
||||||
|
|
||||||
if( r2 < 0 || r2 >= Nrows )
|
if( r2 < 0 || r2 >= Nrows )
|
||||||
{
|
{
|
||||||
msg.Printf( wxT( "error : row = %d ( padY %d pcbY %d) " ), r2,
|
msg.Printf( wxT( "error : row = %d ( padY %d pcbY %d) " ), r2,
|
||||||
|
@ -347,8 +361,10 @@ int Build_Work( BOARD* Pcb )
|
||||||
wxMessageBox( msg );
|
wxMessageBox( msg );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
c2 = ( pt_pad->GetPosition().x - Pcb->m_BoundaryBox.m_Pos.x
|
c2 = ( pt_pad->GetPosition().x - Pcb->m_BoundaryBox.m_Pos.x
|
||||||
+ demi_pas ) / Board.m_GridRouting;
|
+ demi_pas ) / Board.m_GridRouting;
|
||||||
|
|
||||||
if( c2 < 0 || c2 >= Ncols )
|
if( c2 < 0 || c2 >= Ncols )
|
||||||
{
|
{
|
||||||
msg.Printf( wxT( "error : col = %d ( padX %d pcbX %d) " ), c2,
|
msg.Printf( wxT( "error : col = %d ( padX %d pcbX %d) " ), c2,
|
||||||
|
|
|
@ -46,9 +46,10 @@ void TransformArcToPolygon( std::vector <CPolyPt>& aCornerBuffer,
|
||||||
int aCircleToSegmentsCount, int aWidth )
|
int aCircleToSegmentsCount, int aWidth )
|
||||||
{
|
{
|
||||||
wxPoint arc_start, arc_end;
|
wxPoint arc_start, arc_end;
|
||||||
int delta = 3600 / aCircleToSegmentsCount; // rot angle in 0.1 degree
|
int delta = 3600 / aCircleToSegmentsCount; // rotate angle in 0.1 degree
|
||||||
|
|
||||||
arc_end = arc_start = aStart;
|
arc_end = arc_start = aStart;
|
||||||
|
|
||||||
if( aArcAngle != 3600 )
|
if( aArcAngle != 3600 )
|
||||||
{
|
{
|
||||||
RotatePoint( &arc_end, aCentre, -aArcAngle );
|
RotatePoint( &arc_end, aCentre, -aArcAngle );
|
||||||
|
@ -63,12 +64,13 @@ void TransformArcToPolygon( std::vector <CPolyPt>& aCornerBuffer,
|
||||||
// Compute the ends of segments and creates poly
|
// Compute the ends of segments and creates poly
|
||||||
wxPoint curr_end = arc_start;
|
wxPoint curr_end = arc_start;
|
||||||
wxPoint curr_start = arc_start;
|
wxPoint curr_start = arc_start;
|
||||||
|
|
||||||
for( int ii = delta; ii < aArcAngle; ii += delta )
|
for( int ii = delta; ii < aArcAngle; ii += delta )
|
||||||
{
|
{
|
||||||
curr_end = arc_start;
|
curr_end = arc_start;
|
||||||
RotatePoint( &curr_end, aCentre, -ii );
|
RotatePoint( &curr_end, aCentre, -ii );
|
||||||
TransformRoundedEndsSegmentToPolygon( aCornerBuffer,
|
TransformRoundedEndsSegmentToPolygon( aCornerBuffer, curr_start, curr_end,
|
||||||
curr_start, curr_end, aCircleToSegmentsCount, aWidth );
|
aCircleToSegmentsCount, aWidth );
|
||||||
curr_start = curr_end;
|
curr_start = curr_end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,8 +92,7 @@ void TransformArcToPolygon( std::vector <CPolyPt>& aCornerBuffer,
|
||||||
* clearance when the circle is approximated by segment bigger or equal
|
* clearance when the circle is approximated by segment bigger or equal
|
||||||
* to the real clearance value (usually near from 1.0)
|
* to the real clearance value (usually near from 1.0)
|
||||||
*/
|
*/
|
||||||
void TEXTE_PCB::TransformShapeWithClearanceToPolygon(
|
void TEXTE_PCB::TransformShapeWithClearanceToPolygon( std::vector <CPolyPt>& aCornerBuffer,
|
||||||
std::vector <CPolyPt>& aCornerBuffer,
|
|
||||||
int aClearanceValue,
|
int aClearanceValue,
|
||||||
int aCircleToSegmentsCount,
|
int aCircleToSegmentsCount,
|
||||||
double aCorrectionFactor )
|
double aCorrectionFactor )
|
||||||
|
@ -115,9 +116,7 @@ void TEXTE_PCB::TransformShapeWithClearanceToPolygon(
|
||||||
for( int ii = 0; ii < 4; ii++ )
|
for( int ii = 0; ii < 4; ii++ )
|
||||||
{
|
{
|
||||||
// Rotate polygon
|
// Rotate polygon
|
||||||
RotatePoint( &corners[ii].x, &corners[ii].y,
|
RotatePoint( &corners[ii].x, &corners[ii].y, m_Pos.x, m_Pos.y, m_Orient );
|
||||||
m_Pos.x, m_Pos.y,
|
|
||||||
m_Orient );
|
|
||||||
aCornerBuffer.push_back( corners[ii] );
|
aCornerBuffer.push_back( corners[ii] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,8 +136,7 @@ void TEXTE_PCB::TransformShapeWithClearanceToPolygon(
|
||||||
* clearance when the circle is approxiamted by segment bigger or equal
|
* clearance when the circle is approxiamted by segment bigger or equal
|
||||||
* to the real clearance value (usually near from 1.0)
|
* to the real clearance value (usually near from 1.0)
|
||||||
*/
|
*/
|
||||||
void DRAWSEGMENT::TransformShapeWithClearanceToPolygon(
|
void DRAWSEGMENT::TransformShapeWithClearanceToPolygon( std::vector <CPolyPt>& aCornerBuffer,
|
||||||
std::vector <CPolyPt>& aCornerBuffer,
|
|
||||||
int aClearanceValue,
|
int aClearanceValue,
|
||||||
int aCircleToSegmentsCount,
|
int aCircleToSegmentsCount,
|
||||||
double aCorrectionFactor )
|
double aCorrectionFactor )
|
||||||
|
@ -160,9 +158,9 @@ void DRAWSEGMENT::TransformShapeWithClearanceToPolygon(
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
TransformRoundedEndsSegmentToPolygon(
|
TransformRoundedEndsSegmentToPolygon( aCornerBuffer, m_Start, m_End,
|
||||||
aCornerBuffer, m_Start, m_End,
|
aCircleToSegmentsCount,
|
||||||
aCircleToSegmentsCount, m_Width + (2 * aClearanceValue) );
|
m_Width + (2 * aClearanceValue) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -194,11 +192,11 @@ void TRACK:: TransformShapeWithClearanceToPolygon( std:: vector < CPolyPt>& aCor
|
||||||
{
|
{
|
||||||
case TYPE_VIA:
|
case TYPE_VIA:
|
||||||
dx = (int) ( dx * aCorrectionFactor );
|
dx = (int) ( dx * aCorrectionFactor );
|
||||||
|
|
||||||
for( ii = 0; ii < aCircleToSegmentsCount; ii++ )
|
for( ii = 0; ii < aCircleToSegmentsCount; ii++ )
|
||||||
{
|
{
|
||||||
corner_position = wxPoint( dx, 0 );
|
corner_position = wxPoint( dx, 0 );
|
||||||
RotatePoint( &corner_position.x, &corner_position.y,
|
RotatePoint( &corner_position.x, &corner_position.y, (1800 / aCircleToSegmentsCount) );
|
||||||
(1800 / aCircleToSegmentsCount) );
|
|
||||||
angle = ii * delta;
|
angle = ii * delta;
|
||||||
RotatePoint( &corner_position.x, &corner_position.y, angle );
|
RotatePoint( &corner_position.x, &corner_position.y, angle );
|
||||||
corner_position.x += m_Start.x;
|
corner_position.x += m_Start.x;
|
||||||
|
@ -211,8 +209,7 @@ void TRACK:: TransformShapeWithClearanceToPolygon( std:: vector < CPolyPt>& aCor
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
TransformRoundedEndsSegmentToPolygon(
|
TransformRoundedEndsSegmentToPolygon( aCornerBuffer,
|
||||||
aCornerBuffer,
|
|
||||||
m_Start, m_End,
|
m_Start, m_End,
|
||||||
aCircleToSegmentsCount,
|
aCircleToSegmentsCount,
|
||||||
m_Width + ( 2 * aClearanceValue) );
|
m_Width + ( 2 * aClearanceValue) );
|
||||||
|
@ -228,7 +225,7 @@ void TransformRoundedEndsSegmentToPolygon( std::vector <CPolyPt>& aCornerBuffer,
|
||||||
int aCircleToSegmentsCount,
|
int aCircleToSegmentsCount,
|
||||||
int aWidth )
|
int aWidth )
|
||||||
{
|
{
|
||||||
int rayon = aWidth / 2;
|
int radius = aWidth / 2;
|
||||||
wxPoint endp = aEnd - aStart; // end point coordinate for the same segment starting at (0,0)
|
wxPoint endp = aEnd - aStart; // end point coordinate for the same segment starting at (0,0)
|
||||||
wxPoint startp = aStart;
|
wxPoint startp = aStart;
|
||||||
wxPoint corner;
|
wxPoint corner;
|
||||||
|
@ -241,20 +238,21 @@ void TransformRoundedEndsSegmentToPolygon( std::vector <CPolyPt>& aCornerBuffer,
|
||||||
endp = aStart - aEnd;
|
endp = aStart - aEnd;
|
||||||
startp = aEnd;
|
startp = aEnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
int delta_angle = ArcTangente( endp.y, endp.x ); // delta_angle is in 0.1 degrees
|
int delta_angle = ArcTangente( endp.y, endp.x ); // delta_angle is in 0.1 degrees
|
||||||
seg_len = (int) sqrt( ( (double) endp.y * endp.y ) + ( (double) endp.x * endp.x ) );
|
seg_len = (int) sqrt( ( (double) endp.y * endp.y ) + ( (double) endp.x * endp.x ) );
|
||||||
|
|
||||||
int delta = 3600 / aCircleToSegmentsCount; // rot angle in 0.1 degree
|
int delta = 3600 / aCircleToSegmentsCount; // rot angle in 0.1 degree
|
||||||
|
|
||||||
// Compute the outlines of the segment, and creates a polygon
|
// Compute the outlines of the segment, and creates a polygon
|
||||||
corner = wxPoint( 0, rayon );
|
corner = wxPoint( 0, radius );
|
||||||
RotatePoint( &corner, -delta_angle );
|
RotatePoint( &corner, -delta_angle );
|
||||||
corner += startp;
|
corner += startp;
|
||||||
polypoint.x = corner.x;
|
polypoint.x = corner.x;
|
||||||
polypoint.y = corner.y;
|
polypoint.y = corner.y;
|
||||||
aCornerBuffer.push_back( polypoint );
|
aCornerBuffer.push_back( polypoint );
|
||||||
|
|
||||||
corner = wxPoint( seg_len, rayon );
|
corner = wxPoint( seg_len, radius );
|
||||||
RotatePoint( &corner, -delta_angle );
|
RotatePoint( &corner, -delta_angle );
|
||||||
corner += startp;
|
corner += startp;
|
||||||
polypoint.x = corner.x;
|
polypoint.x = corner.x;
|
||||||
|
@ -264,7 +262,7 @@ void TransformRoundedEndsSegmentToPolygon( std::vector <CPolyPt>& aCornerBuffer,
|
||||||
// add right rounded end:
|
// add right rounded end:
|
||||||
for( int ii = delta; ii < 1800; ii += delta )
|
for( int ii = delta; ii < 1800; ii += delta )
|
||||||
{
|
{
|
||||||
corner = wxPoint( 0, rayon );
|
corner = wxPoint( 0, radius );
|
||||||
RotatePoint( &corner, ii );
|
RotatePoint( &corner, ii );
|
||||||
corner.x += seg_len;
|
corner.x += seg_len;
|
||||||
RotatePoint( &corner, -delta_angle );
|
RotatePoint( &corner, -delta_angle );
|
||||||
|
@ -274,14 +272,14 @@ void TransformRoundedEndsSegmentToPolygon( std::vector <CPolyPt>& aCornerBuffer,
|
||||||
aCornerBuffer.push_back( polypoint );
|
aCornerBuffer.push_back( polypoint );
|
||||||
}
|
}
|
||||||
|
|
||||||
corner = wxPoint( seg_len, -rayon );
|
corner = wxPoint( seg_len, -radius );
|
||||||
RotatePoint( &corner, -delta_angle );
|
RotatePoint( &corner, -delta_angle );
|
||||||
corner += startp;
|
corner += startp;
|
||||||
polypoint.x = corner.x;
|
polypoint.x = corner.x;
|
||||||
polypoint.y = corner.y;
|
polypoint.y = corner.y;
|
||||||
aCornerBuffer.push_back( polypoint );
|
aCornerBuffer.push_back( polypoint );
|
||||||
|
|
||||||
corner = wxPoint( 0, -rayon );
|
corner = wxPoint( 0, -radius );
|
||||||
RotatePoint( &corner, -delta_angle );
|
RotatePoint( &corner, -delta_angle );
|
||||||
corner += startp;
|
corner += startp;
|
||||||
polypoint.x = corner.x;
|
polypoint.x = corner.x;
|
||||||
|
@ -291,7 +289,7 @@ void TransformRoundedEndsSegmentToPolygon( std::vector <CPolyPt>& aCornerBuffer,
|
||||||
// add left rounded end:
|
// add left rounded end:
|
||||||
for( int ii = delta; ii < 1800; ii += delta )
|
for( int ii = delta; ii < 1800; ii += delta )
|
||||||
{
|
{
|
||||||
corner = wxPoint( 0, -rayon );
|
corner = wxPoint( 0, -radius );
|
||||||
RotatePoint( &corner, ii );
|
RotatePoint( &corner, ii );
|
||||||
RotatePoint( &corner, -delta_angle );
|
RotatePoint( &corner, -delta_angle );
|
||||||
corner += startp;
|
corner += startp;
|
||||||
|
@ -330,13 +328,14 @@ void D_PAD:: TransformShapeWithClearanceToPolygon( std:: vector < CPolyPt>& aCor
|
||||||
wxPoint PadShapePos = ReturnShapePos(); /* Note: for pad having a shape offset,
|
wxPoint PadShapePos = ReturnShapePos(); /* Note: for pad having a shape offset,
|
||||||
* the pad position is NOT the shape position */
|
* the pad position is NOT the shape position */
|
||||||
wxSize psize = m_Size; /* pad size unsed in RECT and TRAPEZOIDAL pads
|
wxSize psize = m_Size; /* pad size unsed in RECT and TRAPEZOIDAL pads
|
||||||
* trapezoidal pads are considered as rect pad shape having they boudary box size
|
* trapezoidal pads are considered as rect
|
||||||
*/
|
* pad shape having they boudary box size */
|
||||||
|
|
||||||
switch( m_PadShape )
|
switch( m_PadShape )
|
||||||
{
|
{
|
||||||
case PAD_CIRCLE:
|
case PAD_CIRCLE:
|
||||||
dx = (int) ( dx * aCorrectionFactor );
|
dx = (int) ( dx * aCorrectionFactor );
|
||||||
|
|
||||||
for( ii = 0; ii < aCircleToSegmentsCount; ii++ )
|
for( ii = 0; ii < aCircleToSegmentsCount; ii++ )
|
||||||
{
|
{
|
||||||
corner_position = wxPoint( dx, 0 );
|
corner_position = wxPoint( dx, 0 );
|
||||||
|
@ -360,6 +359,7 @@ void D_PAD:: TransformShapeWithClearanceToPolygon( std:: vector < CPolyPt>& aCor
|
||||||
dy = (int) ( dy * aCorrectionFactor );
|
dy = (int) ( dy * aCorrectionFactor );
|
||||||
int angle_pg; // Polygon angle
|
int angle_pg; // Polygon angle
|
||||||
wxPoint shape_offset = wxPoint( 0, dy - dx );
|
wxPoint shape_offset = wxPoint( 0, dy - dx );
|
||||||
|
|
||||||
RotatePoint( &shape_offset, angle ); // Rotating shape offset vector with component
|
RotatePoint( &shape_offset, angle ); // Rotating shape offset vector with component
|
||||||
|
|
||||||
for( ii = 0; ii < aCircleToSegmentsCount / 2 + 1; ii++ ) // Half circle end cap...
|
for( ii = 0; ii < aCircleToSegmentsCount / 2 + 1; ii++ ) // Half circle end cap...
|
||||||
|
@ -434,9 +434,12 @@ void D_PAD:: TransformShapeWithClearanceToPolygon( std:: vector < CPolyPt>& aCor
|
||||||
psize.y += ABS( m_DeltaSize.x );
|
psize.y += ABS( m_DeltaSize.x );
|
||||||
|
|
||||||
// fall through
|
// fall through
|
||||||
case PAD_RECT: // Easy implementation for rectangular cutouts with rounded corners // Easy implementation for rectangular cutouts with rounded corners
|
case PAD_RECT:
|
||||||
|
// Easy implementation for rectangular cutouts with rounded corners
|
||||||
angle = m_Orient;
|
angle = m_Orient;
|
||||||
int rounding_radius = (int) ( aClearanceValue * aCorrectionFactor ); // Corner rounding radius
|
|
||||||
|
// Corner rounding radius
|
||||||
|
int rounding_radius = (int) ( aClearanceValue * aCorrectionFactor );
|
||||||
int angle_pg; // Polygon increment angle
|
int angle_pg; // Polygon increment angle
|
||||||
|
|
||||||
for( int i = 0; i < aCircleToSegmentsCount / 4 + 1; i++ )
|
for( int i = 0; i < aCircleToSegmentsCount / 4 + 1; i++ )
|
||||||
|
@ -471,9 +474,7 @@ void D_PAD:: TransformShapeWithClearanceToPolygon( std:: vector < CPolyPt>& aCor
|
||||||
aCornerBuffer.push_back( polypoint );
|
aCornerBuffer.push_back( polypoint );
|
||||||
}
|
}
|
||||||
|
|
||||||
for( int i = 0;
|
for( int i = 0; i < aCircleToSegmentsCount / 4 + 1; i++ )
|
||||||
i < aCircleToSegmentsCount / 4 + 1;
|
|
||||||
i++ )
|
|
||||||
{
|
{
|
||||||
corner_position = wxPoint( 0, rounding_radius );
|
corner_position = wxPoint( 0, rounding_radius );
|
||||||
RotatePoint( &corner_position, (1800 / aCircleToSegmentsCount) );
|
RotatePoint( &corner_position, (1800 / aCircleToSegmentsCount) );
|
||||||
|
@ -533,7 +534,8 @@ void D_PAD:: TransformShapeWithClearanceToPolygon( std:: vector < CPolyPt>& aCor
|
||||||
* And
|
* And
|
||||||
* nothing else between holes
|
* nothing else between holes
|
||||||
* And
|
* And
|
||||||
* angles less than 90 deg between 2 consecutive lines in hole outline (sometime occurs without this condition)
|
* angles less than 90 deg between 2 consecutive lines in hole outline (sometime occurs without
|
||||||
|
* this condition)
|
||||||
* And
|
* And
|
||||||
* a hole above the identical holes
|
* a hole above the identical holes
|
||||||
*
|
*
|
||||||
|
@ -547,8 +549,8 @@ void D_PAD:: TransformShapeWithClearanceToPolygon( std:: vector < CPolyPt>& aCor
|
||||||
*
|
*
|
||||||
* Note 2:
|
* Note 2:
|
||||||
* Trapezoidal pads are not considered here because they are very special case
|
* Trapezoidal pads are not considered here because they are very special case
|
||||||
* and are used in microwave applications and they *DO NOT* have a thermal relief that change the shape
|
* and are used in microwave applications and they *DO NOT* have a thermal relief that
|
||||||
* by creating stubs and destroy their properties.
|
* change the shape by creating stubs and destroy their properties.
|
||||||
*/
|
*/
|
||||||
void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer,
|
void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer,
|
||||||
D_PAD& aPad,
|
D_PAD& aPad,
|
||||||
|
@ -579,6 +581,7 @@ void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer,
|
||||||
* with a thickness of aMinThicknessValue will increase real thickness by aMinThicknessValue
|
* with a thickness of aMinThicknessValue will increase real thickness by aMinThicknessValue
|
||||||
*/
|
*/
|
||||||
aCopperThickness -= aMinThicknessValue;
|
aCopperThickness -= aMinThicknessValue;
|
||||||
|
|
||||||
if( aCopperThickness < 0 )
|
if( aCopperThickness < 0 )
|
||||||
aCopperThickness = 0;
|
aCopperThickness = 0;
|
||||||
|
|
||||||
|
@ -611,17 +614,20 @@ void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer,
|
||||||
// Crosspoint of thermal spoke sides, the first point of polygon buffer
|
// Crosspoint of thermal spoke sides, the first point of polygon buffer
|
||||||
corners_buffer.push_back( wxPoint( copper_thickness.x / 2, copper_thickness.y / 2 ) );
|
corners_buffer.push_back( wxPoint( copper_thickness.x / 2, copper_thickness.y / 2 ) );
|
||||||
|
|
||||||
// Add an intermediate point on spoke sides, to allow a > 90 deg angle between side and first seg of arc approx
|
// Add an intermediate point on spoke sides, to allow a > 90 deg angle between side
|
||||||
|
// and first seg of arc approx
|
||||||
corner.x = copper_thickness.x / 2;
|
corner.x = copper_thickness.x / 2;
|
||||||
int y = outer_radius - (aThermalGap / 4);
|
int y = outer_radius - (aThermalGap / 4);
|
||||||
corner.y = (int) sqrt( ( ( (double) y * y ) - (double) corner.x * corner.x ) );
|
corner.y = (int) sqrt( ( ( (double) y * y ) - (double) corner.x * corner.x ) );
|
||||||
|
|
||||||
if( aThermalRot != 0 )
|
if( aThermalRot != 0 )
|
||||||
corners_buffer.push_back( corner );
|
corners_buffer.push_back( corner );
|
||||||
|
|
||||||
// calculate the starting point of the outter arc
|
// calculate the starting point of the outter arc
|
||||||
corner.x = copper_thickness.x / 2;
|
corner.x = copper_thickness.x / 2;
|
||||||
double dtmp =
|
|
||||||
sqrt( ( (double) outer_radius * outer_radius ) - ( (double) corner.x * corner.x ) );
|
double dtmp = sqrt( ( (double) outer_radius * outer_radius ) -
|
||||||
|
( (double) corner.x * corner.x ) );
|
||||||
corner.y = (int) dtmp;
|
corner.y = (int) dtmp;
|
||||||
RotatePoint( &corner, 90 );
|
RotatePoint( &corner, 90 );
|
||||||
|
|
||||||
|
@ -638,7 +644,8 @@ void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer,
|
||||||
|
|
||||||
corners_buffer.push_back( corner_end );
|
corners_buffer.push_back( corner_end );
|
||||||
|
|
||||||
/* add an intermediate point, to avoid angles < 90 deg between last arc approx line and radius line
|
/* add an intermediate point, to avoid angles < 90 deg between last arc approx line
|
||||||
|
* and radius line
|
||||||
*/
|
*/
|
||||||
corner.x = corners_buffer[1].y;
|
corner.x = corners_buffer[1].y;
|
||||||
corner.y = corners_buffer[1].x;
|
corner.y = corners_buffer[1].x;
|
||||||
|
@ -649,10 +656,12 @@ void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer,
|
||||||
// bad filled polygon on some cases, when pads are on a same vertical line
|
// bad filled polygon on some cases, when pads are on a same vertical line
|
||||||
// this seems a bug in kbool polygon (exists in 2.0 kbool version)
|
// this seems a bug in kbool polygon (exists in 2.0 kbool version)
|
||||||
// aThermalRot = 450 (45.0 degrees orientation) seems work fine.
|
// aThermalRot = 450 (45.0 degrees orientation) seems work fine.
|
||||||
// aThermalRot = 0 with thermal shapes without angle < 90 deg has problems in rare circumstances
|
// aThermalRot = 0 with thermal shapes without angle < 90 deg has problems in rare
|
||||||
|
// circumstances.
|
||||||
// Note: with the 2 step build ( thermal shapes added after areas are built), 0 seems work
|
// Note: with the 2 step build ( thermal shapes added after areas are built), 0 seems work
|
||||||
int angle_pad = aPad.m_Orient; // Pad orientation
|
int angle_pad = aPad.m_Orient; // Pad orientation
|
||||||
int th_angle = aThermalRot;
|
int th_angle = aThermalRot;
|
||||||
|
|
||||||
for( unsigned ihole = 0; ihole < 4; ihole++ )
|
for( unsigned ihole = 0; ihole < 4; ihole++ )
|
||||||
{
|
{
|
||||||
for( unsigned ii = 0; ii < corners_buffer.size(); ii++ )
|
for( unsigned ii = 0; ii < corners_buffer.size(); ii++ )
|
||||||
|
@ -682,12 +691,14 @@ void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer,
|
||||||
// We want to calculate an oval shape with dx > dy.
|
// We want to calculate an oval shape with dx > dy.
|
||||||
// if this is not the case, exchange dx and dy, and rotate the shape 90 deg.
|
// if this is not the case, exchange dx and dy, and rotate the shape 90 deg.
|
||||||
int supp_angle = 0;
|
int supp_angle = 0;
|
||||||
|
|
||||||
if( dx < dy )
|
if( dx < dy )
|
||||||
{
|
{
|
||||||
EXCHG( dx, dy );
|
EXCHG( dx, dy );
|
||||||
supp_angle = 900;
|
supp_angle = 900;
|
||||||
EXCHG( copper_thickness.x, copper_thickness.y );
|
EXCHG( copper_thickness.x, copper_thickness.y );
|
||||||
}
|
}
|
||||||
|
|
||||||
int deltasize = dx - dy; // = distance between shape position and the 2 demi-circle ends centre
|
int deltasize = dx - dy; // = distance between shape position and the 2 demi-circle ends centre
|
||||||
// here we have dx > dy
|
// here we have dx > dy
|
||||||
// Radius of outer arcs of the shape:
|
// Radius of outer arcs of the shape:
|
||||||
|
@ -703,8 +714,7 @@ void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer,
|
||||||
if( copper_thickness.x > deltasize ) // If copper thickness is more than shape offset, we need to calculate arc intercept point.
|
if( copper_thickness.x > deltasize ) // If copper thickness is more than shape offset, we need to calculate arc intercept point.
|
||||||
{
|
{
|
||||||
corner.x = copper_thickness.x / 2;
|
corner.x = copper_thickness.x / 2;
|
||||||
corner.y =
|
corner.y = (int) sqrt( ( (double) outer_radius * outer_radius ) -
|
||||||
(int) sqrt( ( (double) outer_radius * outer_radius ) -
|
|
||||||
( (double) ( corner.x - delta ) * ( corner.x - deltasize ) ) );
|
( (double) ( corner.x - delta ) * ( corner.x - deltasize ) ) );
|
||||||
corner.x -= deltasize;
|
corner.x -= deltasize;
|
||||||
|
|
||||||
|
@ -724,7 +734,8 @@ void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer,
|
||||||
corner.x = ( deltasize - copper_thickness.x ) / 2;
|
corner.x = ( deltasize - copper_thickness.x ) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add an intermediate point on spoke sides, to allow a > 90 deg angle between side and first seg of arc approx
|
// Add an intermediate point on spoke sides, to allow a > 90 deg angle between side
|
||||||
|
// and first seg of arc approx
|
||||||
wxPoint last_corner;
|
wxPoint last_corner;
|
||||||
last_corner.y = copper_thickness.y / 2;
|
last_corner.y = copper_thickness.y / 2;
|
||||||
int px = outer_radius - (aThermalGap / 4);
|
int px = outer_radius - (aThermalGap / 4);
|
||||||
|
@ -752,6 +763,7 @@ void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer,
|
||||||
/* Create 2 holes, rotated by pad rotation.
|
/* Create 2 holes, rotated by pad rotation.
|
||||||
*/
|
*/
|
||||||
int angle = aPad.m_Orient + supp_angle;
|
int angle = aPad.m_Orient + supp_angle;
|
||||||
|
|
||||||
for( int irect = 0; irect < 2; irect++ )
|
for( int irect = 0; irect < 2; irect++ )
|
||||||
{
|
{
|
||||||
for( unsigned ic = 0; ic < corners_buffer.size(); ic++ )
|
for( unsigned ic = 0; ic < corners_buffer.size(); ic++ )
|
||||||
|
@ -764,6 +776,7 @@ void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer,
|
||||||
|
|
||||||
aCornerBuffer.back().end_contour = true;
|
aCornerBuffer.back().end_contour = true;
|
||||||
angle += 1800; // this is calculate hole 3
|
angle += 1800; // this is calculate hole 3
|
||||||
|
|
||||||
if( angle >= 3600 )
|
if( angle >= 3600 )
|
||||||
angle -= 3600;
|
angle -= 3600;
|
||||||
}
|
}
|
||||||
|
@ -778,6 +791,7 @@ void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer,
|
||||||
|
|
||||||
// Now add corner 4 and 2 (2 is the corner 4 rotated by 180 deg
|
// Now add corner 4 and 2 (2 is the corner 4 rotated by 180 deg
|
||||||
angle = aPad.m_Orient + supp_angle;
|
angle = aPad.m_Orient + supp_angle;
|
||||||
|
|
||||||
for( int irect = 0; irect < 2; irect++ )
|
for( int irect = 0; irect < 2; irect++ )
|
||||||
{
|
{
|
||||||
for( unsigned ic = 0; ic < corners_buffer.size(); ic++ )
|
for( unsigned ic = 0; ic < corners_buffer.size(); ic++ )
|
||||||
|
@ -790,6 +804,7 @@ void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer,
|
||||||
|
|
||||||
aCornerBuffer.back().end_contour = true;
|
aCornerBuffer.back().end_contour = true;
|
||||||
angle += 1800;
|
angle += 1800;
|
||||||
|
|
||||||
if( angle >= 3600 )
|
if( angle >= 3600 )
|
||||||
angle -= 3600;
|
angle -= 3600;
|
||||||
}
|
}
|
||||||
|
@ -818,15 +833,17 @@ void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer,
|
||||||
// | |
|
// | |
|
||||||
// 1 -------4
|
// 1 -------4
|
||||||
|
|
||||||
// Modified rectangles with one corner rounded. TODO: merging with oval thermals and possibly round too.
|
// Modified rectangles with one corner rounded. TODO: merging with oval thermals
|
||||||
|
// and possibly round too.
|
||||||
|
|
||||||
std::vector <wxPoint> corners_buffer; // Polygon buffer as vector
|
std::vector <wxPoint> corners_buffer; // Polygon buffer as vector
|
||||||
|
|
||||||
int dx = (aPad.m_Size.x / 2) + aThermalGap; // Cutout radius x
|
int dx = (aPad.m_Size.x / 2) + aThermalGap; // Cutout radius x
|
||||||
int dy = (aPad.m_Size.y / 2) + aThermalGap; // Cutout radius y
|
int dy = (aPad.m_Size.y / 2) + aThermalGap; // Cutout radius y
|
||||||
|
|
||||||
// The first point of polygon buffer is left lower corner, second the crosspoint of thermal spoke sides,
|
// The first point of polygon buffer is left lower corner, second the crosspoint of
|
||||||
// the third is upper right corner and the rest are rounding vertices going anticlockwise. Note the inveted Y-axis in CG.
|
// thermal spoke sides, the third is upper right corner and the rest are rounding
|
||||||
|
// vertices going anticlockwise. Note the inveted Y-axis in CG.
|
||||||
corners_buffer.push_back( wxPoint( -dx, -(aThermalGap / 4 + copper_thickness.y / 2) ) ); // Adds small miters to zone
|
corners_buffer.push_back( wxPoint( -dx, -(aThermalGap / 4 + copper_thickness.y / 2) ) ); // Adds small miters to zone
|
||||||
corners_buffer.push_back( wxPoint( -(dx - aThermalGap / 4), -copper_thickness.y / 2 ) ); // fill and spoke corner
|
corners_buffer.push_back( wxPoint( -(dx - aThermalGap / 4), -copper_thickness.y / 2 ) ); // fill and spoke corner
|
||||||
corners_buffer.push_back( wxPoint( -copper_thickness.x / 2, -copper_thickness.y / 2 ) );
|
corners_buffer.push_back( wxPoint( -copper_thickness.x / 2, -copper_thickness.y / 2 ) );
|
||||||
|
@ -859,6 +876,7 @@ void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer,
|
||||||
|
|
||||||
aCornerBuffer.back().end_contour = true;
|
aCornerBuffer.back().end_contour = true;
|
||||||
angle += 1800; // this is calculate hole 3
|
angle += 1800; // this is calculate hole 3
|
||||||
|
|
||||||
if( angle >= 3600 )
|
if( angle >= 3600 )
|
||||||
angle -= 3600;
|
angle -= 3600;
|
||||||
}
|
}
|
||||||
|
@ -884,6 +902,7 @@ void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer,
|
||||||
|
|
||||||
aCornerBuffer.back().end_contour = true;
|
aCornerBuffer.back().end_contour = true;
|
||||||
angle += 1800;
|
angle += 1800;
|
||||||
|
|
||||||
if( angle >= 3600 )
|
if( angle >= 3600 )
|
||||||
angle -= 3600;
|
angle -= 3600;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,8 @@
|
||||||
* Each PICKED_ITEMS_LIST handle a std::vector of pickers (class ITEM_PICKER),
|
* Each PICKED_ITEMS_LIST handle a std::vector of pickers (class ITEM_PICKER),
|
||||||
* that store the list of schematic items that are concerned by the command to undo or redo
|
* that store the list of schematic items that are concerned by the command to undo or redo
|
||||||
* and is created for each command to undo (handle also a command to redo).
|
* and is created for each command to undo (handle also a command to redo).
|
||||||
* each picker has a pointer pointing to an item to undo or redo (in fact: deleted, added or modified),
|
* each picker has a pointer pointing to an item to undo or redo (in fact: deleted, added or
|
||||||
|
* modified),
|
||||||
* and has a pointer to a copy of this item, when this item has been modified
|
* and has a pointer to a copy of this item, when this item has been modified
|
||||||
* (the old values of parameters are therefore saved)
|
* (the old values of parameters are therefore saved)
|
||||||
*
|
*
|
||||||
|
@ -49,9 +50,11 @@
|
||||||
* => the copy of item(s) is moved in Undo list
|
* => the copy of item(s) is moved in Undo list
|
||||||
*
|
*
|
||||||
* - add item(s) command
|
* - add item(s) command
|
||||||
* => The list of item(s) is used to create a deleted list in undo list(same as a delete command)
|
* => The list of item(s) is used to create a deleted list in undo list(same as a delete
|
||||||
|
* command)
|
||||||
*
|
*
|
||||||
* Some block operations that change items can be undoed without memorise items, just the coordiantes of the transform:
|
* Some block operations that change items can be undoed without memorise items, just the
|
||||||
|
* coordiantes of the transform:
|
||||||
* move list of items (undo/redo is made by moving with the opposite move vector)
|
* move list of items (undo/redo is made by moving with the opposite move vector)
|
||||||
* mirror (Y) and flip list of items (undo/redo is made by mirror or flip items)
|
* mirror (Y) and flip list of items (undo/redo is made by mirror or flip items)
|
||||||
* so they are handled specifically.
|
* so they are handled specifically.
|
||||||
|
@ -106,10 +109,6 @@ static bool TestForExistingItem( BOARD* aPcb, BOARD_ITEM* aItem )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************/
|
|
||||||
void SwapData( BOARD_ITEM* aItem, BOARD_ITEM* aImage )
|
|
||||||
/***************************************************************/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function SwapData
|
* Function SwapData
|
||||||
* Used in undo / redo command:
|
* Used in undo / redo command:
|
||||||
|
@ -119,6 +118,7 @@ void SwapData( BOARD_ITEM* aItem, BOARD_ITEM* aImage )
|
||||||
* @param aItem = the item
|
* @param aItem = the item
|
||||||
* @param aImage = a copy of the item
|
* @param aImage = a copy of the item
|
||||||
*/
|
*/
|
||||||
|
void SwapData( BOARD_ITEM* aItem, BOARD_ITEM* aImage )
|
||||||
{
|
{
|
||||||
if( aItem == NULL || aImage == NULL )
|
if( aItem == NULL || aImage == NULL )
|
||||||
{
|
{
|
||||||
|
@ -173,16 +173,22 @@ void SwapData( BOARD_ITEM* aItem, BOARD_ITEM* aImage )
|
||||||
EXCHG( track->m_Width, image->m_Width );
|
EXCHG( track->m_Width, image->m_Width );
|
||||||
EXCHG( track->m_Shape, image->m_Shape );
|
EXCHG( track->m_Shape, image->m_Shape );
|
||||||
int atmp = track->GetDrillValue();
|
int atmp = track->GetDrillValue();
|
||||||
|
|
||||||
if( track->IsDrillDefault() )
|
if( track->IsDrillDefault() )
|
||||||
atmp = -1;
|
atmp = -1;
|
||||||
|
|
||||||
int itmp = image->GetDrillValue();
|
int itmp = image->GetDrillValue();
|
||||||
|
|
||||||
if( image->IsDrillDefault() )
|
if( image->IsDrillDefault() )
|
||||||
itmp = -1;
|
itmp = -1;
|
||||||
|
|
||||||
EXCHG(itmp, atmp );
|
EXCHG(itmp, atmp );
|
||||||
|
|
||||||
if( atmp > 0 )
|
if( atmp > 0 )
|
||||||
track->SetDrillValue( atmp );
|
track->SetDrillValue( atmp );
|
||||||
else
|
else
|
||||||
track->SetDrillDefault();
|
track->SetDrillDefault();
|
||||||
|
|
||||||
if( itmp > 0 )
|
if( itmp > 0 )
|
||||||
image->SetDrillValue( itmp );
|
image->SetDrillValue( itmp );
|
||||||
else
|
else
|
||||||
|
@ -203,11 +209,11 @@ void SwapData( BOARD_ITEM* aItem, BOARD_ITEM* aImage )
|
||||||
EXCHG( ( (TEXTE_PCB*) aItem )->m_VJustify, ( (TEXTE_PCB*) aImage )->m_VJustify );
|
EXCHG( ( (TEXTE_PCB*) aItem )->m_VJustify, ( (TEXTE_PCB*) aImage )->m_VJustify );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_MIRE:
|
case PCB_TARGET_T:
|
||||||
EXCHG( ( (MIREPCB*) aItem )->m_Pos, ( (MIREPCB*) aImage )->m_Pos );
|
EXCHG( ( (PCB_TARGET*) aItem )->m_Pos, ( (PCB_TARGET*) aImage )->m_Pos );
|
||||||
EXCHG( ( (MIREPCB*) aItem )->m_Width, ( (MIREPCB*) aImage )->m_Width );
|
EXCHG( ( (PCB_TARGET*) aItem )->m_Width, ( (PCB_TARGET*) aImage )->m_Width );
|
||||||
EXCHG( ( (MIREPCB*) aItem )->m_Size, ( (MIREPCB*) aImage )->m_Size );
|
EXCHG( ( (PCB_TARGET*) aItem )->m_Size, ( (PCB_TARGET*) aImage )->m_Size );
|
||||||
EXCHG( ( (MIREPCB*) aItem )->m_Shape, ( (MIREPCB*) aImage )->m_Shape );
|
EXCHG( ( (PCB_TARGET*) aItem )->m_Shape, ( (PCB_TARGET*) aImage )->m_Shape );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_DIMENSION:
|
case TYPE_DIMENSION:
|
||||||
|
@ -217,8 +223,10 @@ void SwapData( BOARD_ITEM* aItem, BOARD_ITEM* aImage )
|
||||||
( (DIMENSION*) aImage )->SetText( txt );
|
( (DIMENSION*) aImage )->SetText( txt );
|
||||||
EXCHG( ( (DIMENSION*) aItem )->m_Width, ( (DIMENSION*) aImage )->m_Width );
|
EXCHG( ( (DIMENSION*) aItem )->m_Width, ( (DIMENSION*) aImage )->m_Width );
|
||||||
EXCHG( ( (DIMENSION*) aItem )->m_Text->m_Size, ( (DIMENSION*) aImage )->m_Text->m_Size );
|
EXCHG( ( (DIMENSION*) aItem )->m_Text->m_Size, ( (DIMENSION*) aImage )->m_Text->m_Size );
|
||||||
EXCHG( ( (DIMENSION*) aItem )->m_Text->m_Thickness, ( (DIMENSION*) aImage )->m_Text->m_Thickness );
|
EXCHG( ( (DIMENSION*) aItem )->m_Text->m_Thickness,
|
||||||
EXCHG( ( (DIMENSION*) aItem )->m_Text->m_Mirror, ( (DIMENSION*) aImage )->m_Text->m_Mirror );
|
( (DIMENSION*) aImage )->m_Text->m_Thickness );
|
||||||
|
EXCHG( ( (DIMENSION*) aItem )->m_Text->m_Mirror,
|
||||||
|
( (DIMENSION*) aImage )->m_Text->m_Mirror );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -230,13 +238,10 @@ void SwapData( BOARD_ITEM* aItem, BOARD_ITEM* aImage )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************/
|
|
||||||
BOARD_ITEM* DuplicateStruct( BOARD_ITEM* aItem )
|
|
||||||
/************************************************************/
|
|
||||||
|
|
||||||
/* Routine to create a new copy of given struct.
|
/* Routine to create a new copy of given struct.
|
||||||
* The new object is not put in list (not linked)
|
* The new object is not put in list (not linked)
|
||||||
*/
|
*/
|
||||||
|
BOARD_ITEM* DuplicateStruct( BOARD_ITEM* aItem )
|
||||||
{
|
{
|
||||||
if( aItem == NULL )
|
if( aItem == NULL )
|
||||||
{
|
{
|
||||||
|
@ -295,11 +300,11 @@ BOARD_ITEM* DuplicateStruct( BOARD_ITEM* aItem )
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_MIRE:
|
case PCB_TARGET_T:
|
||||||
{
|
{
|
||||||
MIREPCB* new_mire = new MIREPCB( aItem->GetParent() );
|
PCB_TARGET* target = new PCB_TARGET( aItem->GetParent() );
|
||||||
new_mire->Copy( (MIREPCB*) aItem );
|
target->Copy( (PCB_TARGET*) aItem );
|
||||||
return new_mire;
|
return target;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -413,6 +418,7 @@ void PCB_EDIT_FRAME::SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList,
|
||||||
{
|
{
|
||||||
BOARD_ITEM* item = (BOARD_ITEM*) commandToUndo->GetPickedItem( ii );
|
BOARD_ITEM* item = (BOARD_ITEM*) commandToUndo->GetPickedItem( ii );
|
||||||
UNDO_REDO_T command = commandToUndo->GetPickedItemStatus( ii );
|
UNDO_REDO_T command = commandToUndo->GetPickedItemStatus( ii );
|
||||||
|
|
||||||
if( command == UR_UNSPECIFIED )
|
if( command == UR_UNSPECIFIED )
|
||||||
{
|
{
|
||||||
command = aTypeCommand;
|
command = aTypeCommand;
|
||||||
|
@ -461,8 +467,10 @@ void PCB_EDIT_FRAME::SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList,
|
||||||
GetScreen()->ClearUndoORRedoList( GetScreen()->m_RedoList );
|
GetScreen()->ClearUndoORRedoList( GetScreen()->m_RedoList );
|
||||||
}
|
}
|
||||||
else // Should not occur
|
else // Should not occur
|
||||||
|
{
|
||||||
delete commandToUndo;
|
delete commandToUndo;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -555,8 +563,7 @@ void PCB_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRed
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
msg.Printf( wxT(
|
msg.Printf( wxT( "PutDataInPreviousState() error (unknown code %X)" ),
|
||||||
"PutDataInPreviousState() error (unknown code %X)" ),
|
|
||||||
aList->GetPickedItemStatus( ii ) );
|
aList->GetPickedItemStatus( ii ) );
|
||||||
wxMessageBox( msg );
|
wxMessageBox( msg );
|
||||||
}
|
}
|
||||||
|
@ -573,10 +580,6 @@ void PCB_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************/
|
|
||||||
void PCB_EDIT_FRAME::GetBoardFromUndoList( wxCommandEvent& event )
|
|
||||||
/**********************************************************/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetBoardFromUndoList
|
* Function GetBoardFromUndoList
|
||||||
* Undo the last edition:
|
* Undo the last edition:
|
||||||
|
@ -584,6 +587,7 @@ void PCB_EDIT_FRAME::GetBoardFromUndoList( wxCommandEvent& event )
|
||||||
* - Get an old version of the board state from Undo list
|
* - Get an old version of the board state from Undo list
|
||||||
* @return none
|
* @return none
|
||||||
*/
|
*/
|
||||||
|
void PCB_EDIT_FRAME::GetBoardFromUndoList( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
if( GetScreen()->GetUndoCommandCount() <= 0 )
|
if( GetScreen()->GetUndoCommandCount() <= 0 )
|
||||||
return;
|
return;
|
||||||
|
@ -630,10 +634,6 @@ void PCB_EDIT_FRAME::GetBoardFromRedoList( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************************/
|
|
||||||
void PCB_SCREEN::ClearUndoORRedoList( UNDO_REDO_CONTAINER& aList, int aItemCount )
|
|
||||||
/**********************************************************************************/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function ClearUndoORRedoList
|
* Function ClearUndoORRedoList
|
||||||
* free the undo or redo list from List element
|
* free the undo or redo list from List element
|
||||||
|
@ -645,11 +645,13 @@ void PCB_SCREEN::ClearUndoORRedoList( UNDO_REDO_CONTAINER& aList, int aItemCount
|
||||||
* items (commands stored in list) are removed from the beginning of the list.
|
* items (commands stored in list) are removed from the beginning of the list.
|
||||||
* So this function can be called to remove old commands
|
* So this function can be called to remove old commands
|
||||||
*/
|
*/
|
||||||
|
void PCB_SCREEN::ClearUndoORRedoList( UNDO_REDO_CONTAINER& aList, int aItemCount )
|
||||||
{
|
{
|
||||||
if( aItemCount == 0 )
|
if( aItemCount == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
unsigned icnt = aList.m_CommandsList.size();
|
unsigned icnt = aList.m_CommandsList.size();
|
||||||
|
|
||||||
if( aItemCount > 0 )
|
if( aItemCount > 0 )
|
||||||
icnt = aItemCount;
|
icnt = aItemCount;
|
||||||
|
|
||||||
|
@ -657,6 +659,7 @@ void PCB_SCREEN::ClearUndoORRedoList( UNDO_REDO_CONTAINER& aList, int aItemCount
|
||||||
{
|
{
|
||||||
if( aList.m_CommandsList.size() == 0 )
|
if( aList.m_CommandsList.size() == 0 )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
PICKED_ITEMS_LIST* curr_cmd = aList.m_CommandsList[0];
|
PICKED_ITEMS_LIST* curr_cmd = aList.m_CommandsList[0];
|
||||||
aList.m_CommandsList.erase( aList.m_CommandsList.begin() );
|
aList.m_CommandsList.erase( aList.m_CommandsList.begin() );
|
||||||
|
|
||||||
|
|
|
@ -39,8 +39,7 @@ BOARD::BOARD( EDA_ITEM* parent, PCB_BASE_FRAME* frame ) :
|
||||||
// progress
|
// progress
|
||||||
m_NetInfo = new NETINFO_LIST( this ); // handle nets info list (name,
|
m_NetInfo = new NETINFO_LIST( this ); // handle nets info list (name,
|
||||||
// design constraints ..
|
// design constraints ..
|
||||||
m_NetInfo->BuildListOfNets(); // prepare pads and nets lists
|
m_NetInfo->BuildListOfNets(); // prepare pads and nets lists containers.
|
||||||
// containers.
|
|
||||||
|
|
||||||
for( int layer = 0; layer < NB_COPPER_LAYERS; ++layer )
|
for( int layer = 0; layer < NB_COPPER_LAYERS; ++layer )
|
||||||
{
|
{
|
||||||
|
@ -54,8 +53,7 @@ BOARD::BOARD( EDA_ITEM* parent, PCB_BASE_FRAME* frame ) :
|
||||||
// Should user eventually load a board from a disk file, then these
|
// Should user eventually load a board from a disk file, then these
|
||||||
// defaults
|
// defaults
|
||||||
// will get overwritten during load.
|
// will get overwritten during load.
|
||||||
m_NetClasses.GetDefault()->SetDescription(
|
m_NetClasses.GetDefault()->SetDescription( _( "This is the default net class." ) );
|
||||||
_( "This is the default net class." ) );
|
|
||||||
m_ViaSizeSelector = 0;
|
m_ViaSizeSelector = 0;
|
||||||
m_TrackWidthSelector = 0;
|
m_TrackWidthSelector = 0;
|
||||||
|
|
||||||
|
@ -88,6 +86,7 @@ BOARD::~BOARD()
|
||||||
delete m_NetInfo;
|
delete m_NetInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Function PushHightLight
|
* Function PushHightLight
|
||||||
* save current hight light info for later use
|
* save current hight light info for later use
|
||||||
|
@ -97,6 +96,7 @@ void BOARD::PushHightLight()
|
||||||
m_hightLightPrevious = m_hightLight;
|
m_hightLightPrevious = m_hightLight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Function PopHightLight
|
* Function PopHightLight
|
||||||
* retrieve a previously saved hight light info
|
* retrieve a previously saved hight light info
|
||||||
|
@ -107,6 +107,7 @@ void BOARD::PopHightLight()
|
||||||
m_hightLightPrevious.Clear();
|
m_hightLightPrevious.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function SetCurrentNetClass
|
* Function SetCurrentNetClass
|
||||||
* Must be called after a netclass selection (or after a netclass parameter
|
* Must be called after a netclass selection (or after a netclass parameter
|
||||||
|
@ -134,6 +135,7 @@ bool BOARD::SetCurrentNetClass( const wxString& aNetClassName )
|
||||||
lists_sizes_modified = true;
|
lists_sizes_modified = true;
|
||||||
m_ViasDimensionsList.push_back( viadim );
|
m_ViasDimensionsList.push_back( viadim );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_TrackWidthList.size() == 0 )
|
if( m_TrackWidthList.size() == 0 )
|
||||||
{
|
{
|
||||||
lists_sizes_modified = true;
|
lists_sizes_modified = true;
|
||||||
|
@ -145,14 +147,17 @@ bool BOARD::SetCurrentNetClass( const wxString& aNetClassName )
|
||||||
*/
|
*/
|
||||||
if( m_ViasDimensionsList[0].m_Diameter != netClass->GetViaDiameter() )
|
if( m_ViasDimensionsList[0].m_Diameter != netClass->GetViaDiameter() )
|
||||||
lists_sizes_modified = true;
|
lists_sizes_modified = true;
|
||||||
|
|
||||||
m_ViasDimensionsList[0].m_Diameter = netClass->GetViaDiameter();
|
m_ViasDimensionsList[0].m_Diameter = netClass->GetViaDiameter();
|
||||||
|
|
||||||
if( m_TrackWidthList[0] != netClass->GetTrackWidth() )
|
if( m_TrackWidthList[0] != netClass->GetTrackWidth() )
|
||||||
lists_sizes_modified = true;
|
lists_sizes_modified = true;
|
||||||
|
|
||||||
m_TrackWidthList[0] = netClass->GetTrackWidth();
|
m_TrackWidthList[0] = netClass->GetTrackWidth();
|
||||||
|
|
||||||
if( m_ViaSizeSelector >= m_ViasDimensionsList.size() )
|
if( m_ViaSizeSelector >= m_ViasDimensionsList.size() )
|
||||||
m_ViaSizeSelector = m_ViasDimensionsList.size();
|
m_ViaSizeSelector = m_ViasDimensionsList.size();
|
||||||
|
|
||||||
if( m_TrackWidthSelector >= m_TrackWidthList.size() )
|
if( m_TrackWidthSelector >= m_TrackWidthList.size() )
|
||||||
m_TrackWidthSelector = m_TrackWidthList.size();
|
m_TrackWidthSelector = m_TrackWidthList.size();
|
||||||
|
|
||||||
|
@ -169,9 +174,7 @@ int BOARD::GetBiggestClearanceValue()
|
||||||
int clearance = m_NetClasses.GetDefault()->GetClearance();
|
int clearance = m_NetClasses.GetDefault()->GetClearance();
|
||||||
|
|
||||||
//Read list of Net Classes
|
//Read list of Net Classes
|
||||||
for( NETCLASSES::const_iterator nc = m_NetClasses.begin();
|
for( NETCLASSES::const_iterator nc = m_NetClasses.begin(); nc != m_NetClasses.end(); nc++ )
|
||||||
nc != m_NetClasses.end();
|
|
||||||
nc++ )
|
|
||||||
{
|
{
|
||||||
NETCLASS* netclass = nc->second;
|
NETCLASS* netclass = nc->second;
|
||||||
clearance = MAX( clearance, netclass->GetClearance() );
|
clearance = MAX( clearance, netclass->GetClearance() );
|
||||||
|
@ -291,8 +294,7 @@ bool BOARD::SetLayerName( int aLayerIndex, const wxString& aLayerName )
|
||||||
{
|
{
|
||||||
for( int i = 0; i < NB_COPPER_LAYERS; i++ )
|
for( int i = 0; i < NB_COPPER_LAYERS; i++ )
|
||||||
{
|
{
|
||||||
if( i != aLayerIndex && IsLayerEnabled( i )
|
if( i != aLayerIndex && IsLayerEnabled( i ) && NameTemp == m_Layer[i].m_Name )
|
||||||
&& NameTemp == m_Layer[i].m_Name )
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -314,6 +316,7 @@ LAYER_T BOARD::GetLayerType( int aLayerIndex ) const
|
||||||
// in the layer sequence.
|
// in the layer sequence.
|
||||||
if( IsLayerEnabled( aLayerIndex ) )
|
if( IsLayerEnabled( aLayerIndex ) )
|
||||||
return m_Layer[aLayerIndex].m_Type;
|
return m_Layer[aLayerIndex].m_Type;
|
||||||
|
|
||||||
return LT_SIGNAL;
|
return LT_SIGNAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -330,6 +333,7 @@ bool BOARD::SetLayerType( int aLayerIndex, LAYER_T aLayerType )
|
||||||
m_Layer[aLayerIndex].m_Type = aLayerType;
|
m_Layer[aLayerIndex].m_Type = aLayerType;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -430,6 +434,7 @@ void BOARD::SetVisibleElements( int aMask )
|
||||||
void BOARD::SetVisibleAlls( )
|
void BOARD::SetVisibleAlls( )
|
||||||
{
|
{
|
||||||
SetVisibleLayers( FULL_LAYERS );
|
SetVisibleLayers( FULL_LAYERS );
|
||||||
|
|
||||||
/* Call SetElementVisibility for each item,
|
/* Call SetElementVisibility for each item,
|
||||||
* to ensure specific calculations that can be needed by some items
|
* to ensure specific calculations that can be needed by some items
|
||||||
*/
|
*/
|
||||||
|
@ -469,6 +474,7 @@ void BOARD::SetElementVisibility( int aPCB_VISIBLE, bool isEnabled )
|
||||||
for( unsigned ii = 0; ii < GetRatsnestsCount(); ii++ )
|
for( unsigned ii = 0; ii < GetRatsnestsCount(); ii++ )
|
||||||
m_FullRatsnest[ii].m_Status &= ~CH_VISIBLE;
|
m_FullRatsnest[ii].m_Status &= ~CH_VISIBLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
@ -541,6 +547,7 @@ int BOARD::GetLayerColor( int aLayer )
|
||||||
return GetColorsSettings()->GetLayerColor( aLayer );
|
return GetColorsSettings()->GetLayerColor( aLayer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function IsModuleLayerVisible
|
* Function IsModuleLayerVisible
|
||||||
* expects either of the two layers on which a module can reside, and returns
|
* expects either of the two layers on which a module can reside, and returns
|
||||||
|
@ -552,10 +559,8 @@ bool BOARD::IsModuleLayerVisible( int layer )
|
||||||
{
|
{
|
||||||
if( layer==LAYER_N_FRONT )
|
if( layer==LAYER_N_FRONT )
|
||||||
return IsElementVisible( PCB_VISIBLE(MOD_FR_VISIBLE) );
|
return IsElementVisible( PCB_VISIBLE(MOD_FR_VISIBLE) );
|
||||||
|
|
||||||
else if( layer==LAYER_N_BACK )
|
else if( layer==LAYER_N_BACK )
|
||||||
return IsElementVisible( PCB_VISIBLE(MOD_BK_VISIBLE) );
|
return IsElementVisible( PCB_VISIBLE(MOD_BK_VISIBLE) );
|
||||||
|
|
||||||
else
|
else
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -612,6 +617,7 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, int aControl )
|
||||||
m_Modules.PushBack( (MODULE*) aBoardItem );
|
m_Modules.PushBack( (MODULE*) aBoardItem );
|
||||||
else
|
else
|
||||||
m_Modules.PushFront( (MODULE*) aBoardItem );
|
m_Modules.PushFront( (MODULE*) aBoardItem );
|
||||||
|
|
||||||
aBoardItem->SetParent( this );
|
aBoardItem->SetParent( this );
|
||||||
|
|
||||||
// Because the list of pads has changed, reset the status
|
// Because the list of pads has changed, reset the status
|
||||||
|
@ -624,11 +630,12 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, int aControl )
|
||||||
case TYPE_DRAWSEGMENT:
|
case TYPE_DRAWSEGMENT:
|
||||||
case TYPE_TEXTE:
|
case TYPE_TEXTE:
|
||||||
case TYPE_EDGE_MODULE:
|
case TYPE_EDGE_MODULE:
|
||||||
case TYPE_MIRE:
|
case PCB_TARGET_T:
|
||||||
if( aControl & ADD_APPEND )
|
if( aControl & ADD_APPEND )
|
||||||
m_Drawings.PushBack( aBoardItem );
|
m_Drawings.PushBack( aBoardItem );
|
||||||
else
|
else
|
||||||
m_Drawings.PushFront( aBoardItem );
|
m_Drawings.PushFront( aBoardItem );
|
||||||
|
|
||||||
aBoardItem->SetParent( this );
|
aBoardItem->SetParent( this );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -636,8 +643,7 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, int aControl )
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
msg.Printf(
|
msg.Printf( wxT( "BOARD::Add() needs work: BOARD_ITEM type (%d) not handled" ),
|
||||||
wxT( "BOARD::Add() needs work: BOARD_ITEM type (%d) not handled" ),
|
|
||||||
aBoardItem->Type() );
|
aBoardItem->Type() );
|
||||||
wxFAIL_MSG( msg );
|
wxFAIL_MSG( msg );
|
||||||
}
|
}
|
||||||
|
@ -697,7 +703,7 @@ BOARD_ITEM* BOARD::Remove( BOARD_ITEM* aBoardItem )
|
||||||
case TYPE_DRAWSEGMENT:
|
case TYPE_DRAWSEGMENT:
|
||||||
case TYPE_TEXTE:
|
case TYPE_TEXTE:
|
||||||
case TYPE_EDGE_MODULE:
|
case TYPE_EDGE_MODULE:
|
||||||
case TYPE_MIRE:
|
case PCB_TARGET_T:
|
||||||
m_Drawings.Remove( aBoardItem );
|
m_Drawings.Remove( aBoardItem );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -774,6 +780,7 @@ bool BOARD::ComputeBoundingBox( bool aBoardEdgesOnly )
|
||||||
area = item->GetBoundingBox();
|
area = item->GetBoundingBox();
|
||||||
else
|
else
|
||||||
area.Merge( item->GetBoundingBox() );
|
area.Merge( item->GetBoundingBox() );
|
||||||
|
|
||||||
hasItems = true;
|
hasItems = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -786,6 +793,7 @@ bool BOARD::ComputeBoundingBox( bool aBoardEdgesOnly )
|
||||||
area = module->GetBoundingBox();
|
area = module->GetBoundingBox();
|
||||||
else
|
else
|
||||||
area.Merge( module->GetBoundingBox() );
|
area.Merge( module->GetBoundingBox() );
|
||||||
|
|
||||||
hasItems = true;
|
hasItems = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -796,6 +804,7 @@ bool BOARD::ComputeBoundingBox( bool aBoardEdgesOnly )
|
||||||
area = track->GetBoundingBox();
|
area = track->GetBoundingBox();
|
||||||
else
|
else
|
||||||
area.Merge( track->GetBoundingBox() );
|
area.Merge( track->GetBoundingBox() );
|
||||||
|
|
||||||
hasItems = true;
|
hasItems = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -806,6 +815,7 @@ bool BOARD::ComputeBoundingBox( bool aBoardEdgesOnly )
|
||||||
area = track->GetBoundingBox();
|
area = track->GetBoundingBox();
|
||||||
else
|
else
|
||||||
area.Merge( track->GetBoundingBox() );
|
area.Merge( track->GetBoundingBox() );
|
||||||
|
|
||||||
hasItems = true;
|
hasItems = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -818,6 +828,7 @@ bool BOARD::ComputeBoundingBox( bool aBoardEdgesOnly )
|
||||||
area = aZone->GetBoundingBox();
|
area = aZone->GetBoundingBox();
|
||||||
else
|
else
|
||||||
area.Merge( aZone->GetBoundingBox() );
|
area.Merge( aZone->GetBoundingBox() );
|
||||||
|
|
||||||
area.Merge( aZone->GetBoundingBox() );
|
area.Merge( aZone->GetBoundingBox() );
|
||||||
hasItems = true;
|
hasItems = true;
|
||||||
}
|
}
|
||||||
|
@ -858,6 +869,7 @@ void BOARD::DisplayInfo( EDA_DRAW_FRAME* frame )
|
||||||
|
|
||||||
int viasCount = 0;
|
int viasCount = 0;
|
||||||
int trackSegmentsCount = 0;
|
int trackSegmentsCount = 0;
|
||||||
|
|
||||||
for( BOARD_ITEM* item = m_Track; item; item = item->Next() )
|
for( BOARD_ITEM* item = m_Track; item; item = item->Next() )
|
||||||
{
|
{
|
||||||
if( item->Type() == TYPE_VIA )
|
if( item->Type() == TYPE_VIA )
|
||||||
|
@ -914,6 +926,7 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData,
|
||||||
while( !done )
|
while( !done )
|
||||||
{
|
{
|
||||||
stype = *p;
|
stype = *p;
|
||||||
|
|
||||||
switch( stype )
|
switch( stype )
|
||||||
{
|
{
|
||||||
case TYPE_PCB:
|
case TYPE_PCB:
|
||||||
|
@ -960,7 +973,7 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData,
|
||||||
case TYPE_DRAWSEGMENT:
|
case TYPE_DRAWSEGMENT:
|
||||||
case TYPE_TEXTE:
|
case TYPE_TEXTE:
|
||||||
case TYPE_DIMENSION:
|
case TYPE_DIMENSION:
|
||||||
case TYPE_MIRE:
|
case PCB_TARGET_T:
|
||||||
result = IterateForward( m_Drawings, inspector, testData, p );
|
result = IterateForward( m_Drawings, inspector, testData, p );
|
||||||
|
|
||||||
// skip over any types handled in the above call.
|
// skip over any types handled in the above call.
|
||||||
|
@ -971,7 +984,7 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData,
|
||||||
case TYPE_DRAWSEGMENT:
|
case TYPE_DRAWSEGMENT:
|
||||||
case TYPE_TEXTE:
|
case TYPE_TEXTE:
|
||||||
case TYPE_DIMENSION:
|
case TYPE_DIMENSION:
|
||||||
case TYPE_MIRE:
|
case PCB_TARGET_T:
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -1041,6 +1054,7 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData,
|
||||||
for( unsigned i = 0; i<m_markers.size(); ++i )
|
for( unsigned i = 0; i<m_markers.size(); ++i )
|
||||||
{
|
{
|
||||||
result = m_markers[i]->Visit( inspector, testData, p );
|
result = m_markers[i]->Visit( inspector, testData, p );
|
||||||
|
|
||||||
if( result == SEARCH_QUIT )
|
if( result == SEARCH_QUIT )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1053,9 +1067,8 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData,
|
||||||
// TYPE_ZONE_CONTAINER are in the m_ZoneDescriptorList std::vector
|
// TYPE_ZONE_CONTAINER are in the m_ZoneDescriptorList std::vector
|
||||||
for( unsigned i = 0; i< m_ZoneDescriptorList.size(); ++i )
|
for( unsigned i = 0; i< m_ZoneDescriptorList.size(); ++i )
|
||||||
{
|
{
|
||||||
result = m_ZoneDescriptorList[i]->Visit( inspector,
|
result = m_ZoneDescriptorList[i]->Visit( inspector, testData, p );
|
||||||
testData,
|
|
||||||
p );
|
|
||||||
if( result == SEARCH_QUIT )
|
if( result == SEARCH_QUIT )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1108,7 +1121,7 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData,
|
||||||
* D_PAD* pad = (D_PAD*) item;
|
* D_PAD* pad = (D_PAD*) item;
|
||||||
* if( pad->HitTest( refPos ) )
|
* if( pad->HitTest( refPos ) )
|
||||||
* {
|
* {
|
||||||
* if( layer_mask & pad->m_Masque_Layer )
|
* if( layer_mask & pad->m_layerMask )
|
||||||
* {
|
* {
|
||||||
* found = item;
|
* found = item;
|
||||||
* return SEARCH_QUIT;
|
* return SEARCH_QUIT;
|
||||||
|
@ -1211,6 +1224,7 @@ NETINFO_ITEM* BOARD::FindNet( const wxString& aNetname ) const
|
||||||
for( int ii = 1; ii < ncount; ii++ )
|
for( int ii = 1; ii < ncount; ii++ )
|
||||||
{
|
{
|
||||||
NETINFO_ITEM* item = m_NetInfo->GetNetItem( ii );
|
NETINFO_ITEM* item = m_NetInfo->GetNetItem( ii );
|
||||||
|
|
||||||
if( item && item->GetNetname() == aNetname )
|
if( item && item->GetNetname() == aNetname )
|
||||||
{
|
{
|
||||||
return item;
|
return item;
|
||||||
|
@ -1225,6 +1239,7 @@ NETINFO_ITEM* BOARD::FindNet( const wxString& aNetname ) const
|
||||||
// NETINFO_LIST::Build_Pads_Full_List()
|
// NETINFO_LIST::Build_Pads_Full_List()
|
||||||
int imax = ncount - 1;
|
int imax = ncount - 1;
|
||||||
int index = imax;
|
int index = imax;
|
||||||
|
|
||||||
while( ncount > 0 )
|
while( ncount > 0 )
|
||||||
{
|
{
|
||||||
int ii = ncount;
|
int ii = ncount;
|
||||||
|
@ -1234,26 +1249,34 @@ NETINFO_ITEM* BOARD::FindNet( const wxString& aNetname ) const
|
||||||
ncount++;
|
ncount++;
|
||||||
|
|
||||||
NETINFO_ITEM* item = m_NetInfo->GetNetItem( index );
|
NETINFO_ITEM* item = m_NetInfo->GetNetItem( index );
|
||||||
|
|
||||||
if( item == NULL )
|
if( item == NULL )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
int icmp = item->GetNetname().Cmp( aNetname );
|
int icmp = item->GetNetname().Cmp( aNetname );
|
||||||
|
|
||||||
if( icmp == 0 ) // found !
|
if( icmp == 0 ) // found !
|
||||||
{
|
{
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( icmp < 0 ) // must search after item
|
if( icmp < 0 ) // must search after item
|
||||||
{
|
{
|
||||||
index += ncount;
|
index += ncount;
|
||||||
|
|
||||||
if( index > imax )
|
if( index > imax )
|
||||||
index = imax;
|
index = imax;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( icmp > 0 ) // must search before item
|
if( icmp > 0 ) // must search before item
|
||||||
{
|
{
|
||||||
index -= ncount;
|
index -= ncount;
|
||||||
|
|
||||||
if( index < 1 )
|
if( index < 1 )
|
||||||
index = 1;
|
index = 1;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1281,6 +1304,7 @@ MODULE* BOARD::FindModuleByReference( const wxString& aReference ) const
|
||||||
found = module;
|
found = module;
|
||||||
return SEARCH_QUIT;
|
return SEARCH_QUIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
return SEARCH_CONTINUE;
|
return SEARCH_CONTINUE;
|
||||||
}
|
}
|
||||||
} inspector;
|
} inspector;
|
||||||
|
@ -1310,8 +1334,7 @@ static bool s_SortByNodes( const NETINFO_ITEM* a, const NETINFO_ITEM* b )
|
||||||
* (i.e. leave the sort by net names)
|
* (i.e. leave the sort by net names)
|
||||||
* @return int - net names count.
|
* @return int - net names count.
|
||||||
*/
|
*/
|
||||||
int BOARD::ReturnSortedNetnamesList( wxArrayString& aNames,
|
int BOARD::ReturnSortedNetnamesList( wxArrayString& aNames, bool aSortbyPadsCount )
|
||||||
bool aSortbyPadsCount )
|
|
||||||
{
|
{
|
||||||
if( m_NetInfo->GetCount() == 0 )
|
if( m_NetInfo->GetCount() == 0 )
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1362,18 +1385,18 @@ bool BOARD::Save( FILE* aFile ) const
|
||||||
{
|
{
|
||||||
case TYPE_TEXTE:
|
case TYPE_TEXTE:
|
||||||
case TYPE_DRAWSEGMENT:
|
case TYPE_DRAWSEGMENT:
|
||||||
case TYPE_MIRE:
|
case PCB_TARGET_T:
|
||||||
case TYPE_DIMENSION:
|
case TYPE_DIMENSION:
|
||||||
if( !item->Save( aFile ) )
|
if( !item->Save( aFile ) )
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
// future: throw exception here
|
// future: throw exception here
|
||||||
#if defined(DEBUG)
|
#if defined(DEBUG)
|
||||||
printf( "BOARD::Save() ignoring m_Drawings type %d\n",
|
printf( "BOARD::Save() ignoring m_Drawings type %d\n", item->Type() );
|
||||||
item->Type() );
|
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1391,6 +1414,7 @@ bool BOARD::Save( FILE* aFile ) const
|
||||||
|
|
||||||
// save the zones
|
// save the zones
|
||||||
fprintf( aFile, "$ZONE\n" );
|
fprintf( aFile, "$ZONE\n" );
|
||||||
|
|
||||||
for( item = m_Zone; item; item = item->Next() )
|
for( item = m_Zone; item; item = item->Next() )
|
||||||
if( !item->Save( aFile ) )
|
if( !item->Save( aFile ) )
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -1427,6 +1451,7 @@ void BOARD::RedrawAreasOutlines( EDA_DRAW_PANEL* panel, wxDC* aDC, int aDrawMode
|
||||||
for( int ii = 0; ii < GetAreaCount(); ii++ )
|
for( int ii = 0; ii < GetAreaCount(); ii++ )
|
||||||
{
|
{
|
||||||
ZONE_CONTAINER* edge_zone = GetArea( ii );
|
ZONE_CONTAINER* edge_zone = GetArea( ii );
|
||||||
|
|
||||||
if( (aLayer < 0) || ( aLayer == edge_zone->GetLayer() ) )
|
if( (aLayer < 0) || ( aLayer == edge_zone->GetLayer() ) )
|
||||||
edge_zone->Draw( panel, aDC, aDrawMode );
|
edge_zone->Draw( panel, aDC, aDrawMode );
|
||||||
}
|
}
|
||||||
|
@ -1445,6 +1470,7 @@ void BOARD::RedrawFilledAreas( EDA_DRAW_PANEL* panel, wxDC* aDC, int aDrawMode,
|
||||||
for( int ii = 0; ii < GetAreaCount(); ii++ )
|
for( int ii = 0; ii < GetAreaCount(); ii++ )
|
||||||
{
|
{
|
||||||
ZONE_CONTAINER* edge_zone = GetArea( ii );
|
ZONE_CONTAINER* edge_zone = GetArea( ii );
|
||||||
|
|
||||||
if( (aLayer < 0) || ( aLayer == edge_zone->GetLayer() ) )
|
if( (aLayer < 0) || ( aLayer == edge_zone->GetLayer() ) )
|
||||||
edge_zone->DrawFilledArea( panel, aDC, aDrawMode );
|
edge_zone->DrawFilledArea( panel, aDC, aDrawMode );
|
||||||
}
|
}
|
||||||
|
@ -1469,6 +1495,7 @@ ZONE_CONTAINER* BOARD::HitTestForAnyFilledArea( const wxPoint& aRefPos,
|
||||||
{
|
{
|
||||||
if( aEndLayer < 0 )
|
if( aEndLayer < 0 )
|
||||||
aEndLayer = aStartLayer;
|
aEndLayer = aStartLayer;
|
||||||
|
|
||||||
if( aEndLayer < aStartLayer )
|
if( aEndLayer < aStartLayer )
|
||||||
EXCHG( aEndLayer, aStartLayer );
|
EXCHG( aEndLayer, aStartLayer );
|
||||||
|
|
||||||
|
@ -1476,11 +1503,14 @@ ZONE_CONTAINER* BOARD::HitTestForAnyFilledArea( const wxPoint& aRefPos,
|
||||||
{
|
{
|
||||||
ZONE_CONTAINER* area = m_ZoneDescriptorList[ia];
|
ZONE_CONTAINER* area = m_ZoneDescriptorList[ia];
|
||||||
int layer = area->GetLayer();
|
int layer = area->GetLayer();
|
||||||
|
|
||||||
if( (layer < aStartLayer) || (layer > aEndLayer) )
|
if( (layer < aStartLayer) || (layer > aEndLayer) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( area->GetState( BUSY ) ) // In locate functions we must skip
|
if( area->GetState( BUSY ) ) // In locate functions we must skip
|
||||||
// tagged items with BUSY flag set.
|
// tagged items with BUSY flag set.
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( area->HitTestFilledArea( aRefPos ) )
|
if( area->HitTestFilledArea( aRefPos ) )
|
||||||
return area;
|
return area;
|
||||||
}
|
}
|
||||||
|
@ -1514,10 +1544,10 @@ int BOARD::SetAreasNetCodesFromNetNames( void )
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( GetArea( ii )->GetNet() != 0 ) // i.e. if this zone is
|
if( GetArea( ii )->GetNet() != 0 ) // i.e. if this zone is connected to a net
|
||||||
// connected to a net
|
|
||||||
{
|
{
|
||||||
const NETINFO_ITEM* net = FindNet( GetArea( ii )->m_Netname );
|
const NETINFO_ITEM* net = FindNet( GetArea( ii )->m_Netname );
|
||||||
|
|
||||||
if( net )
|
if( net )
|
||||||
{
|
{
|
||||||
GetArea( ii )->SetNet( net->GetNet() );
|
GetArea( ii )->SetNet( net->GetNet() );
|
||||||
|
@ -1555,6 +1585,7 @@ void BOARD::Show( int nestLevel, std::ostream& os )
|
||||||
// specialization of the output:
|
// specialization of the output:
|
||||||
NestedSpace( nestLevel + 1, os ) << "<modules>\n";
|
NestedSpace( nestLevel + 1, os ) << "<modules>\n";
|
||||||
p = m_Modules;
|
p = m_Modules;
|
||||||
|
|
||||||
for( ; p; p = p->Next() )
|
for( ; p; p = p->Next() )
|
||||||
p->Show( nestLevel + 2, os );
|
p->Show( nestLevel + 2, os );
|
||||||
|
|
||||||
|
@ -1562,6 +1593,7 @@ void BOARD::Show( int nestLevel, std::ostream& os )
|
||||||
|
|
||||||
NestedSpace( nestLevel + 1, os ) << "<pdrawings>\n";
|
NestedSpace( nestLevel + 1, os ) << "<pdrawings>\n";
|
||||||
p = m_Drawings;
|
p = m_Drawings;
|
||||||
|
|
||||||
for( ; p; p = p->Next() )
|
for( ; p; p = p->Next() )
|
||||||
p->Show( nestLevel + 2, os );
|
p->Show( nestLevel + 2, os );
|
||||||
|
|
||||||
|
@ -1569,6 +1601,7 @@ void BOARD::Show( int nestLevel, std::ostream& os )
|
||||||
|
|
||||||
NestedSpace( nestLevel + 1, os ) << "<tracks>\n";
|
NestedSpace( nestLevel + 1, os ) << "<tracks>\n";
|
||||||
p = m_Track;
|
p = m_Track;
|
||||||
|
|
||||||
for( ; p; p = p->Next() )
|
for( ; p; p = p->Next() )
|
||||||
p->Show( nestLevel + 2, os );
|
p->Show( nestLevel + 2, os );
|
||||||
|
|
||||||
|
@ -1576,6 +1609,7 @@ void BOARD::Show( int nestLevel, std::ostream& os )
|
||||||
|
|
||||||
NestedSpace( nestLevel + 1, os ) << "<zones>\n";
|
NestedSpace( nestLevel + 1, os ) << "<zones>\n";
|
||||||
p = m_Zone;
|
p = m_Zone;
|
||||||
|
|
||||||
for( ; p; p = p->Next() )
|
for( ; p; p = p->Next() )
|
||||||
p->Show( nestLevel + 2, os );
|
p->Show( nestLevel + 2, os );
|
||||||
|
|
||||||
|
@ -1590,6 +1624,7 @@ void BOARD::Show( int nestLevel, std::ostream& os )
|
||||||
*/
|
*/
|
||||||
|
|
||||||
p = (BOARD_ITEM*) m_Son;
|
p = (BOARD_ITEM*) m_Son;
|
||||||
|
|
||||||
for( ; p; p = p->Next() )
|
for( ; p; p = p->Next() )
|
||||||
{
|
{
|
||||||
p->Show( nestLevel + 1, os );
|
p->Show( nestLevel + 1, os );
|
||||||
|
|
|
@ -842,6 +842,7 @@ public:
|
||||||
{
|
{
|
||||||
if( (unsigned) index < m_ZoneDescriptorList.size() )
|
if( (unsigned) index < m_ZoneDescriptorList.size() )
|
||||||
return m_ZoneDescriptorList[index];
|
return m_ZoneDescriptorList[index];
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -879,8 +880,8 @@ public:
|
||||||
/**
|
/**
|
||||||
* Function AddArea
|
* Function AddArea
|
||||||
* Add an empty copper area to board areas list
|
* Add an empty copper area to board areas list
|
||||||
* @param aNewZonesList = a PICKED_ITEMS_LIST * where to store new areas pickers (useful in undo commands)
|
* @param aNewZonesList = a PICKED_ITEMS_LIST * where to store new areas pickers (useful
|
||||||
* can be NULL
|
* in undo commands) can be NULL
|
||||||
* @param aNetcode = the necode of the copper area (0 = no net)
|
* @param aNetcode = the necode of the copper area (0 = no net)
|
||||||
* @param aLayer = the layer of area
|
* @param aLayer = the layer of area
|
||||||
* @param aStartPointPosition = position of the first point of the polygon outline of this area
|
* @param aStartPointPosition = position of the first point of the polygon outline of this area
|
||||||
|
@ -924,8 +925,8 @@ public:
|
||||||
* Function ClipAreaPolygon
|
* Function ClipAreaPolygon
|
||||||
* Process an area that has been modified, by clipping its polygon against itself.
|
* Process an area that has been modified, by clipping its polygon against itself.
|
||||||
* This may change the number and order of copper areas in the net.
|
* This may change the number and order of copper areas in the net.
|
||||||
* @param aNewZonesList = a PICKED_ITEMS_LIST * where to store new areas pickers (useful in undo commands)
|
* @param aNewZonesList = a PICKED_ITEMS_LIST * where to store new areas pickers (useful
|
||||||
* can be NULL
|
* in undo commands) can be NULL
|
||||||
* @param aCurrArea = the zone to process
|
* @param aCurrArea = the zone to process
|
||||||
* @param bMessageBoxInt == true, shows message when clipping occurs.
|
* @param bMessageBoxInt == true, shows message when clipping occurs.
|
||||||
* @param bMessageBoxArc == true, shows message when clipping can't be done due to arcs.
|
* @param bMessageBoxArc == true, shows message when clipping can't be done due to arcs.
|
||||||
|
@ -940,7 +941,7 @@ public:
|
||||||
ZONE_CONTAINER* aCurrArea,
|
ZONE_CONTAINER* aCurrArea,
|
||||||
bool bMessageBoxArc,
|
bool bMessageBoxArc,
|
||||||
bool bMessageBoxInt,
|
bool bMessageBoxInt,
|
||||||
bool bRetainArcs = TRUE );
|
bool bRetainArcs = true );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process an area that has been modified, by clipping its polygon against
|
* Process an area that has been modified, by clipping its polygon against
|
||||||
|
@ -949,7 +950,7 @@ public:
|
||||||
* @param aModifiedZonesList = a PICKED_ITEMS_LIST * where to store deleted or added areas
|
* @param aModifiedZonesList = a PICKED_ITEMS_LIST * where to store deleted or added areas
|
||||||
* (useful in undo commands. Can be NULL
|
* (useful in undo commands. Can be NULL
|
||||||
* @param modified_area = area to test
|
* @param modified_area = area to test
|
||||||
* @param bMessageBoxInt : if TRUE, shows message boxes when clipping occurs.
|
* @param bMessageBoxInt : if true, shows message boxes when clipping occurs.
|
||||||
* @param bMessageBoxArc if true, shows message when clipping can't be done due to arcs.
|
* @param bMessageBoxArc if true, shows message when clipping can't be done due to arcs.
|
||||||
* @return :
|
* @return :
|
||||||
* -1 if arcs intersect other sides, so polygon can't be clipped
|
* -1 if arcs intersect other sides, so polygon can't be clipped
|
||||||
|
|
|
@ -108,8 +108,9 @@ bool DIMENSION::ReadDimensionDescr( LINE_READER* aReader )
|
||||||
while( aReader->ReadLine() )
|
while( aReader->ReadLine() )
|
||||||
{
|
{
|
||||||
Line = aReader->Line();
|
Line = aReader->Line();
|
||||||
|
|
||||||
if( strnicmp( Line, "$EndDIMENSION", 4 ) == 0 )
|
if( strnicmp( Line, "$EndDIMENSION", 4 ) == 0 )
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
if( Line[0] == 'V' )
|
if( Line[0] == 'V' )
|
||||||
{
|
{
|
||||||
|
@ -125,6 +126,7 @@ bool DIMENSION::ReadDimensionDescr( LINE_READER* aReader )
|
||||||
|
|
||||||
if( layer < FIRST_NO_COPPER_LAYER )
|
if( layer < FIRST_NO_COPPER_LAYER )
|
||||||
layer = FIRST_NO_COPPER_LAYER;
|
layer = FIRST_NO_COPPER_LAYER;
|
||||||
|
|
||||||
if( layer > LAST_NO_COPPER_LAYER )
|
if( layer > LAST_NO_COPPER_LAYER )
|
||||||
layer = LAST_NO_COPPER_LAYER;
|
layer = LAST_NO_COPPER_LAYER;
|
||||||
|
|
||||||
|
@ -221,7 +223,7 @@ bool DIMENSION::ReadDimensionDescr( LINE_READER* aReader )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -275,8 +277,10 @@ void DIMENSION::Rotate(const wxPoint& aRotCentre, int aAngle)
|
||||||
|
|
||||||
RotatePoint( &m_Text->m_Pos, aRotCentre, aAngle );
|
RotatePoint( &m_Text->m_Pos, aRotCentre, aAngle );
|
||||||
m_Text->m_Orient += aAngle;
|
m_Text->m_Orient += aAngle;
|
||||||
|
|
||||||
if( m_Text->m_Orient >= 3600 )
|
if( m_Text->m_Orient >= 3600 )
|
||||||
m_Text->m_Orient -= 3600;
|
m_Text->m_Orient -= 3600;
|
||||||
|
|
||||||
if( ( m_Text->m_Orient > 900 ) && ( m_Text->m_Orient <2700 ) )
|
if( ( m_Text->m_Orient > 900 ) && ( m_Text->m_Orient <2700 ) )
|
||||||
m_Text->m_Orient -= 1800;
|
m_Text->m_Orient -= 1800;
|
||||||
|
|
||||||
|
@ -323,8 +327,10 @@ void DIMENSION::Mirror(const wxPoint& axis_pos)
|
||||||
INVERT( m_Pos.y );
|
INVERT( m_Pos.y );
|
||||||
INVERT( m_Text->m_Pos.y );
|
INVERT( m_Text->m_Pos.y );
|
||||||
INVERT_ANGLE( m_Text->m_Orient );
|
INVERT_ANGLE( m_Text->m_Orient );
|
||||||
|
|
||||||
if( m_Text->m_Orient >= 3600 )
|
if( m_Text->m_Orient >= 3600 )
|
||||||
m_Text->m_Orient -= 3600;
|
m_Text->m_Orient -= 3600;
|
||||||
|
|
||||||
if( ( m_Text->m_Orient > 900 ) && ( m_Text->m_Orient < 2700 ) )
|
if( ( m_Text->m_Orient > 900 ) && ( m_Text->m_Orient < 2700 ) )
|
||||||
m_Text->m_Orient -= 1800;
|
m_Text->m_Orient -= 1800;
|
||||||
|
|
||||||
|
@ -456,10 +462,13 @@ void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText )
|
||||||
|
|
||||||
if( TraitG_ox > Barre_ox )
|
if( TraitG_ox > Barre_ox )
|
||||||
hx = -hx;
|
hx = -hx;
|
||||||
|
|
||||||
if( TraitG_ox == Barre_ox )
|
if( TraitG_ox == Barre_ox )
|
||||||
hx = 0;
|
hx = 0;
|
||||||
|
|
||||||
if( TraitG_oy > Barre_oy )
|
if( TraitG_oy > Barre_oy )
|
||||||
hy = -hy;
|
hy = -hy;
|
||||||
|
|
||||||
if( TraitG_oy == Barre_oy )
|
if( TraitG_oy == Barre_oy )
|
||||||
hy = 0;
|
hy = 0;
|
||||||
|
|
||||||
|
@ -503,16 +512,17 @@ void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText )
|
||||||
TraitD_fy = Barre_fy + hy;
|
TraitD_fy = Barre_fy + hy;
|
||||||
|
|
||||||
/* Calculate the better text position and orientation: */
|
/* Calculate the better text position and orientation: */
|
||||||
m_Pos.x = m_Text->m_Pos.x
|
m_Pos.x = m_Text->m_Pos.x = (Barre_fx + TraitG_fx) / 2;
|
||||||
= (Barre_fx + TraitG_fx) / 2;
|
m_Pos.y = m_Text->m_Pos.y = (Barre_fy + TraitG_fy) / 2;
|
||||||
m_Pos.y = m_Text->m_Pos.y
|
|
||||||
= (Barre_fy + TraitG_fy) / 2;
|
|
||||||
|
|
||||||
m_Text->m_Orient = -(int) (angle * 1800 / M_PI);
|
m_Text->m_Orient = -(int) (angle * 1800 / M_PI);
|
||||||
|
|
||||||
if( m_Text->m_Orient < 0 )
|
if( m_Text->m_Orient < 0 )
|
||||||
m_Text->m_Orient += 3600;
|
m_Text->m_Orient += 3600;
|
||||||
|
|
||||||
if( m_Text->m_Orient >= 3600 )
|
if( m_Text->m_Orient >= 3600 )
|
||||||
m_Text->m_Orient -= 3600;
|
m_Text->m_Orient -= 3600;
|
||||||
|
|
||||||
if( (m_Text->m_Orient > 900) && (m_Text->m_Orient <2700) )
|
if( (m_Text->m_Orient > 900) && (m_Text->m_Orient <2700) )
|
||||||
m_Text->m_Orient -= 1800;
|
m_Text->m_Orient -= 1800;
|
||||||
|
|
||||||
|
@ -537,6 +547,7 @@ void DIMENSION::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int mode_color, const wxP
|
||||||
m_Text->Draw( panel, DC, mode_color, offset );
|
m_Text->Draw( panel, DC, mode_color, offset );
|
||||||
|
|
||||||
BOARD * brd = GetBoard( );
|
BOARD * brd = GetBoard( );
|
||||||
|
|
||||||
if( brd->IsLayerVisible( m_Layer ) == false )
|
if( brd->IsLayerVisible( m_Layer ) == false )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -734,6 +745,7 @@ bool DIMENSION::HitTest( EDA_RECT& refArea )
|
||||||
{
|
{
|
||||||
if( refArea.Contains( m_Pos ) )
|
if( refArea.Contains( m_Pos ) )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -109,7 +109,7 @@ bool DRAWSEGMENT::ReadDrawSegmentDescr( LINE_READER* aReader )
|
||||||
Line = aReader->Line();
|
Line = aReader->Line();
|
||||||
|
|
||||||
if( strnicmp( Line, "$End", 4 ) == 0 )
|
if( strnicmp( Line, "$End", 4 ) == 0 )
|
||||||
return TRUE; /* End of description */
|
return true; /* End of description */
|
||||||
|
|
||||||
if( Line[0] == 'P' )
|
if( Line[0] == 'P' )
|
||||||
{
|
{
|
||||||
|
@ -175,7 +175,7 @@ bool DRAWSEGMENT::ReadDrawSegmentDescr( LINE_READER* aReader )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -227,9 +227,9 @@ MODULE* DRAWSEGMENT::GetParentModule() const
|
||||||
void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint& aOffset )
|
void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint& aOffset )
|
||||||
{
|
{
|
||||||
int ux0, uy0, dx, dy;
|
int ux0, uy0, dx, dy;
|
||||||
int l_piste;
|
int l_trace;
|
||||||
int color, mode;
|
int color, mode;
|
||||||
int rayon;
|
int radius;
|
||||||
|
|
||||||
BOARD * brd = GetBoard( );
|
BOARD * brd = GetBoard( );
|
||||||
|
|
||||||
|
@ -239,7 +239,7 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wx
|
||||||
color = brd->GetLayerColor( GetLayer() );
|
color = brd->GetLayerColor( GetLayer() );
|
||||||
|
|
||||||
GRSetDrawMode( DC, draw_mode );
|
GRSetDrawMode( DC, draw_mode );
|
||||||
l_piste = m_Width >> 1; /* half trace width */
|
l_trace = m_Width >> 1; /* half trace width */
|
||||||
|
|
||||||
// Line start point or Circle and Arc center
|
// Line start point or Circle and Arc center
|
||||||
ux0 = m_Start.x + aOffset.x;
|
ux0 = m_Start.x + aOffset.x;
|
||||||
|
@ -250,34 +250,37 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wx
|
||||||
dy = m_End.y + aOffset.y;
|
dy = m_End.y + aOffset.y;
|
||||||
|
|
||||||
mode = DisplayOpt.DisplayDrawItems;
|
mode = DisplayOpt.DisplayDrawItems;
|
||||||
|
|
||||||
if( m_Flags & FORCE_SKETCH )
|
if( m_Flags & FORCE_SKETCH )
|
||||||
mode = SKETCH;
|
mode = SKETCH;
|
||||||
|
|
||||||
if( l_piste < DC->DeviceToLogicalXRel( L_MIN_DESSIN ) )
|
if( l_trace < DC->DeviceToLogicalXRel( L_MIN_DESSIN ) )
|
||||||
mode = FILAIRE;
|
mode = FILAIRE;
|
||||||
|
|
||||||
switch( m_Shape )
|
switch( m_Shape )
|
||||||
{
|
{
|
||||||
case S_CIRCLE:
|
case S_CIRCLE:
|
||||||
rayon = (int) hypot( (double) (dx - ux0), (double) (dy - uy0) );
|
radius = (int) hypot( (double) (dx - ux0), (double) (dy - uy0) );
|
||||||
|
|
||||||
if( mode == FILAIRE )
|
if( mode == FILAIRE )
|
||||||
{
|
{
|
||||||
GRCircle( &panel->m_ClipBox, DC, ux0, uy0, rayon, color );
|
GRCircle( &panel->m_ClipBox, DC, ux0, uy0, radius, color );
|
||||||
}
|
}
|
||||||
else if( mode == SKETCH )
|
else if( mode == SKETCH )
|
||||||
{
|
{
|
||||||
GRCircle( &panel->m_ClipBox, DC, ux0, uy0, rayon - l_piste, color );
|
GRCircle( &panel->m_ClipBox, DC, ux0, uy0, radius - l_trace, color );
|
||||||
GRCircle( &panel->m_ClipBox, DC, ux0, uy0, rayon + l_piste, color );
|
GRCircle( &panel->m_ClipBox, DC, ux0, uy0, radius + l_trace, color );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GRCircle( &panel->m_ClipBox, DC, ux0, uy0, rayon, m_Width, color );
|
GRCircle( &panel->m_ClipBox, DC, ux0, uy0, radius, m_Width, color );
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case S_ARC:
|
case S_ARC:
|
||||||
int StAngle, EndAngle;
|
int StAngle, EndAngle;
|
||||||
rayon = (int) hypot( (double) (dx - ux0), (double) (dy - uy0) );
|
radius = (int) hypot( (double) (dx - ux0), (double) (dy - uy0) );
|
||||||
StAngle = (int) ArcTangente( dy - uy0, dx - ux0 );
|
StAngle = (int) ArcTangente( dy - uy0, dx - ux0 );
|
||||||
EndAngle = StAngle + m_Angle;
|
EndAngle = StAngle + m_Angle;
|
||||||
|
|
||||||
|
@ -295,19 +298,19 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wx
|
||||||
|
|
||||||
if( mode == FILAIRE )
|
if( mode == FILAIRE )
|
||||||
GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle,
|
GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle,
|
||||||
rayon, color );
|
radius, color );
|
||||||
|
|
||||||
else if( mode == SKETCH )
|
else if( mode == SKETCH )
|
||||||
{
|
{
|
||||||
GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle,
|
GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle,
|
||||||
rayon - l_piste, color );
|
radius - l_trace, color );
|
||||||
GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle,
|
GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle,
|
||||||
rayon + l_piste, color );
|
radius + l_trace, color );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle,
|
GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle,
|
||||||
rayon, m_Width, color );
|
radius, m_Width, color );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case S_CURVE:
|
case S_CURVE:
|
||||||
|
@ -337,7 +340,9 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wx
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if( mode == FILAIRE )
|
if( mode == FILAIRE )
|
||||||
|
{
|
||||||
GRLine( &panel->m_ClipBox, DC, ux0, uy0, dx, dy, 0, color );
|
GRLine( &panel->m_ClipBox, DC, ux0, uy0, dx, dy, 0, color );
|
||||||
|
}
|
||||||
else if( mode == SKETCH )
|
else if( mode == SKETCH )
|
||||||
{
|
{
|
||||||
GRCSegm( &panel->m_ClipBox, DC, ux0, uy0, dx, dy,
|
GRCSegm( &panel->m_ClipBox, DC, ux0, uy0, dx, dy,
|
||||||
|
@ -348,6 +353,7 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wx
|
||||||
GRFillCSegm( &panel->m_ClipBox, DC, ux0, uy0, dx, dy,
|
GRFillCSegm( &panel->m_ClipBox, DC, ux0, uy0, dx, dy,
|
||||||
m_Width, color );
|
m_Width, color );
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -388,6 +394,7 @@ void DRAWSEGMENT::DisplayInfo( EDA_DRAW_FRAME* frame )
|
||||||
default:
|
default:
|
||||||
frame->AppendMsgPanel( shape, _( "Segment" ), RED );
|
frame->AppendMsgPanel( shape, _( "Segment" ), RED );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString start;
|
wxString start;
|
||||||
start << GetStart();
|
start << GetStart();
|
||||||
|
|
||||||
|
@ -396,8 +403,7 @@ void DRAWSEGMENT::DisplayInfo( EDA_DRAW_FRAME* frame )
|
||||||
|
|
||||||
frame->AppendMsgPanel( start, end, DARKGREEN );
|
frame->AppendMsgPanel( start, end, DARKGREEN );
|
||||||
|
|
||||||
frame->AppendMsgPanel( _( "Layer" ),
|
frame->AppendMsgPanel( _( "Layer" ), board->GetLayerName( m_Layer ), DARKBROWN );
|
||||||
board->GetLayerName( m_Layer ), DARKBROWN );
|
|
||||||
|
|
||||||
valeur_param( (unsigned) m_Width, msg );
|
valeur_param( (unsigned) m_Width, msg );
|
||||||
frame->AppendMsgPanel( _( "Width" ), msg, DARKCYAN );
|
frame->AppendMsgPanel( _( "Width" ), msg, DARKCYAN );
|
||||||
|
@ -444,6 +450,7 @@ EDA_RECT DRAWSEGMENT::GetBoundingBox() const
|
||||||
|
|
||||||
if( ii == 0 )
|
if( ii == 0 )
|
||||||
p_end = pt;
|
p_end = pt;
|
||||||
|
|
||||||
bbox.m_Pos.x = MIN( bbox.m_Pos.x, pt.x );
|
bbox.m_Pos.x = MIN( bbox.m_Pos.x, pt.x );
|
||||||
bbox.m_Pos.y = MIN( bbox.m_Pos.y, pt.y );
|
bbox.m_Pos.y = MIN( bbox.m_Pos.y, pt.y );
|
||||||
p_end.x = MAX( p_end.x, pt.x );
|
p_end.x = MAX( p_end.x, pt.x );
|
||||||
|
@ -471,10 +478,10 @@ bool DRAWSEGMENT::HitTest( const wxPoint& aRefPos )
|
||||||
case S_CIRCLE:
|
case S_CIRCLE:
|
||||||
case S_ARC:
|
case S_ARC:
|
||||||
{
|
{
|
||||||
int rayon = GetRadius();
|
int radius = GetRadius();
|
||||||
int dist = (int) hypot( (double) relPos.x, (double) relPos.y );
|
int dist = (int) hypot( (double) relPos.x, (double) relPos.y );
|
||||||
|
|
||||||
if( abs( rayon - dist ) <= ( m_Width / 2 ) )
|
if( abs( radius - dist ) <= ( m_Width / 2 ) )
|
||||||
{
|
{
|
||||||
if( m_Shape == S_CIRCLE )
|
if( m_Shape == S_CIRCLE )
|
||||||
return true;
|
return true;
|
||||||
|
@ -498,8 +505,7 @@ bool DRAWSEGMENT::HitTest( const wxPoint& aRefPos )
|
||||||
case S_CURVE:
|
case S_CURVE:
|
||||||
for( unsigned int i= 1; i < m_BezierPoints.size(); i++)
|
for( unsigned int i= 1; i < m_BezierPoints.size(); i++)
|
||||||
{
|
{
|
||||||
if( TestSegmentHit( aRefPos,m_BezierPoints[i-1],
|
if( TestSegmentHit( aRefPos,m_BezierPoints[i-1], m_BezierPoints[i-1], m_Width / 2 ) )
|
||||||
m_BezierPoints[i-1], m_Width / 2 ) )
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -527,6 +533,7 @@ bool DRAWSEGMENT::HitTest( EDA_RECT& refArea )
|
||||||
// Text if area intersects the circle:
|
// Text if area intersects the circle:
|
||||||
EDA_RECT area = refArea;
|
EDA_RECT area = refArea;
|
||||||
area.Inflate( radius );
|
area.Inflate( radius );
|
||||||
|
|
||||||
if( area.Contains( m_Start ) )
|
if( area.Contains( m_Start ) )
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,7 @@ void EDGE_MODULE::SetDrawCoord()
|
||||||
*/
|
*/
|
||||||
void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint& offset )
|
void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint& offset )
|
||||||
{
|
{
|
||||||
int ux0, uy0, dx, dy, rayon, StAngle, EndAngle;
|
int ux0, uy0, dx, dy, radius, StAngle, EndAngle;
|
||||||
int color, type_trace;
|
int color, type_trace;
|
||||||
int typeaff;
|
int typeaff;
|
||||||
PCB_BASE_FRAME* frame;
|
PCB_BASE_FRAME* frame;
|
||||||
|
@ -105,9 +105,11 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wx
|
||||||
|
|
||||||
GRSetDrawMode( DC, draw_mode );
|
GRSetDrawMode( DC, draw_mode );
|
||||||
typeaff = frame->m_DisplayModEdge;
|
typeaff = frame->m_DisplayModEdge;
|
||||||
|
|
||||||
if( m_Layer <= LAST_COPPER_LAYER )
|
if( m_Layer <= LAST_COPPER_LAYER )
|
||||||
{
|
{
|
||||||
typeaff = frame->m_DisplayPcbTrackFill;
|
typeaff = frame->m_DisplayPcbTrackFill;
|
||||||
|
|
||||||
if( !typeaff )
|
if( !typeaff )
|
||||||
typeaff = SKETCH;
|
typeaff = SKETCH;
|
||||||
}
|
}
|
||||||
|
@ -125,53 +127,53 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wx
|
||||||
else
|
else
|
||||||
// SKETCH Mode
|
// SKETCH Mode
|
||||||
GRCSegm( &panel->m_ClipBox, DC, ux0, uy0, dx, dy, m_Width, color );
|
GRCSegm( &panel->m_ClipBox, DC, ux0, uy0, dx, dy, m_Width, color );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case S_CIRCLE:
|
case S_CIRCLE:
|
||||||
rayon = (int) hypot( (double) (dx - ux0), (double) (dy - uy0) );
|
radius = (int) hypot( (double) (dx - ux0), (double) (dy - uy0) );
|
||||||
|
|
||||||
if( typeaff == FILAIRE )
|
if( typeaff == FILAIRE )
|
||||||
{
|
{
|
||||||
GRCircle( &panel->m_ClipBox, DC, ux0, uy0, rayon, color );
|
GRCircle( &panel->m_ClipBox, DC, ux0, uy0, radius, color );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( typeaff == FILLED )
|
if( typeaff == FILLED )
|
||||||
{
|
{
|
||||||
GRCircle( &panel->m_ClipBox, DC, ux0, uy0, rayon,
|
GRCircle( &panel->m_ClipBox, DC, ux0, uy0, radius, m_Width, color );
|
||||||
m_Width, color );
|
|
||||||
}
|
}
|
||||||
else // SKETCH Mode
|
else // SKETCH Mode
|
||||||
{
|
{
|
||||||
GRCircle( &panel->m_ClipBox, DC, ux0, uy0,
|
GRCircle( &panel->m_ClipBox, DC, ux0, uy0, radius + (m_Width / 2), color );
|
||||||
rayon + (m_Width / 2), color );
|
GRCircle( &panel->m_ClipBox, DC, ux0, uy0, radius - (m_Width / 2), color );
|
||||||
GRCircle( &panel->m_ClipBox, DC, ux0, uy0,
|
|
||||||
rayon - (m_Width / 2), color );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case S_ARC:
|
case S_ARC:
|
||||||
rayon = (int) hypot( (double) (dx - ux0), (double) (dy - uy0) );
|
radius = (int) hypot( (double) (dx - ux0), (double) (dy - uy0) );
|
||||||
StAngle = (int) ArcTangente( dy - uy0, dx - ux0 );
|
StAngle = (int) ArcTangente( dy - uy0, dx - ux0 );
|
||||||
EndAngle = StAngle + m_Angle;
|
EndAngle = StAngle + m_Angle;
|
||||||
|
|
||||||
if( StAngle > EndAngle )
|
if( StAngle > EndAngle )
|
||||||
EXCHG( StAngle, EndAngle );
|
EXCHG( StAngle, EndAngle );
|
||||||
|
|
||||||
if( typeaff == FILAIRE )
|
if( typeaff == FILAIRE )
|
||||||
{
|
{
|
||||||
GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle,
|
GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle, radius, color );
|
||||||
rayon, color );
|
|
||||||
}
|
}
|
||||||
else if( typeaff == FILLED )
|
else if( typeaff == FILLED )
|
||||||
{
|
{
|
||||||
GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle, rayon,
|
GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle, radius, m_Width, color );
|
||||||
m_Width, color );
|
|
||||||
}
|
}
|
||||||
else // SKETCH Mode
|
else // SKETCH Mode
|
||||||
{
|
{
|
||||||
GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle,
|
GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle,
|
||||||
rayon + (m_Width / 2), color );
|
radius + (m_Width / 2), color );
|
||||||
GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle,
|
GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle,
|
||||||
rayon - (m_Width / 2), color );
|
radius - (m_Width / 2), color );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -190,8 +192,7 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wx
|
||||||
pt += module->m_Pos - offset;
|
pt += module->m_Pos - offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
GRPoly( &panel->m_ClipBox, DC, points.size(), &points[0],
|
GRPoly( &panel->m_ClipBox, DC, points.size(), &points[0], true, m_Width, color, color );
|
||||||
TRUE, m_Width, color, color );
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -208,34 +209,27 @@ void EDGE_MODULE::DisplayInfo( EDA_DRAW_FRAME* frame )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BOARD* board = (BOARD*) module->GetParent();
|
BOARD* board = (BOARD*) module->GetParent();
|
||||||
|
|
||||||
if( !board )
|
if( !board )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
frame->ClearMsgPanel();
|
frame->ClearMsgPanel();
|
||||||
|
|
||||||
frame->AppendMsgPanel( _( "Graphic Item" ), wxEmptyString, DARKCYAN );
|
frame->AppendMsgPanel( _( "Graphic Item" ), wxEmptyString, DARKCYAN );
|
||||||
|
frame->AppendMsgPanel( _( "Module" ), module->m_Reference->m_Text, DARKCYAN );
|
||||||
frame->AppendMsgPanel( _( "Module" ), module->m_Reference->m_Text,
|
|
||||||
DARKCYAN );
|
|
||||||
frame->AppendMsgPanel( _( "Value" ), module->m_Value->m_Text, BLUE );
|
frame->AppendMsgPanel( _( "Value" ), module->m_Value->m_Text, BLUE );
|
||||||
|
|
||||||
msg.Printf( wxT( "%8.8lX" ), module->m_TimeStamp );
|
msg.Printf( wxT( "%8.8lX" ), module->m_TimeStamp );
|
||||||
frame->AppendMsgPanel( _( "TimeStamp" ), msg, BROWN );
|
frame->AppendMsgPanel( _( "TimeStamp" ), msg, BROWN );
|
||||||
|
frame->AppendMsgPanel( _( "Mod Layer" ), board->GetLayerName( module->GetLayer() ), RED );
|
||||||
frame->AppendMsgPanel( _( "Mod Layer" ),
|
frame->AppendMsgPanel( _( "Seg Layer" ), board->GetLayerName( GetLayer() ), RED );
|
||||||
board->GetLayerName( module->GetLayer() ), RED );
|
|
||||||
|
|
||||||
frame->AppendMsgPanel( _( "Seg Layer" ),
|
|
||||||
board->GetLayerName( GetLayer() ), RED );
|
|
||||||
|
|
||||||
valeur_param( m_Width, msg );
|
valeur_param( m_Width, msg );
|
||||||
frame->AppendMsgPanel( _( "Width" ), msg, BLUE );
|
frame->AppendMsgPanel( _( "Width" ), msg, BLUE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************/
|
|
||||||
bool EDGE_MODULE::Save( FILE* aFile ) const
|
bool EDGE_MODULE::Save( FILE* aFile ) const
|
||||||
/*******************************************/
|
|
||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
|
@ -271,8 +265,7 @@ bool EDGE_MODULE::Save( FILE* aFile ) const
|
||||||
m_Width, m_Layer );
|
m_Width, m_Layer );
|
||||||
|
|
||||||
for( unsigned i = 0; i<m_PolyPoints.size(); ++i )
|
for( unsigned i = 0; i<m_PolyPoints.size(); ++i )
|
||||||
fprintf( aFile, "Dl %d %d\n", m_PolyPoints[i].x,
|
fprintf( aFile, "Dl %d %d\n", m_PolyPoints[i].x, m_PolyPoints[i].y );
|
||||||
m_PolyPoints[i].y );
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -361,11 +354,13 @@ int EDGE_MODULE::ReadDescr( LINE_READER* aReader )
|
||||||
|
|
||||||
m_PolyPoints.clear();
|
m_PolyPoints.clear();
|
||||||
m_PolyPoints.reserve( pointCount );
|
m_PolyPoints.reserve( pointCount );
|
||||||
|
|
||||||
for( ii = 0; ii<pointCount; ii++ )
|
for( ii = 0; ii<pointCount; ii++ )
|
||||||
{
|
{
|
||||||
if( aReader->ReadLine() )
|
if( aReader->ReadLine() )
|
||||||
{
|
{
|
||||||
Buf = aReader->Line();
|
Buf = aReader->Line();
|
||||||
|
|
||||||
if( strncmp( Buf, "Dl", 2 ) != 0 )
|
if( strncmp( Buf, "Dl", 2 ) != 0 )
|
||||||
{
|
{
|
||||||
error = 1;
|
error = 1;
|
||||||
|
@ -398,15 +393,18 @@ int EDGE_MODULE::ReadDescr( LINE_READER* aReader )
|
||||||
// Check for a reasonable width:
|
// Check for a reasonable width:
|
||||||
if( m_Width <= 1 )
|
if( m_Width <= 1 )
|
||||||
m_Width = 1;
|
m_Width = 1;
|
||||||
|
|
||||||
if( m_Width > MAX_WIDTH )
|
if( m_Width > MAX_WIDTH )
|
||||||
m_Width = MAX_WIDTH;
|
m_Width = MAX_WIDTH;
|
||||||
|
|
||||||
// Check for a reasonable layer:
|
// Check for a reasonable layer:
|
||||||
// m_Layer must be >= FIRST_NON_COPPER_LAYER, but because microwave footprints
|
// 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.
|
// 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
|
// @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) )
|
if( (m_Layer < 0) || (m_Layer > LAST_NON_COPPER_LAYER) )
|
||||||
m_Layer = SILKSCREEN_N_FRONT;
|
m_Layer = SILKSCREEN_N_FRONT;
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,20 +16,20 @@
|
||||||
#include "richio.h"
|
#include "richio.h"
|
||||||
|
|
||||||
|
|
||||||
MIREPCB::MIREPCB( BOARD_ITEM* aParent ) :
|
PCB_TARGET::PCB_TARGET( BOARD_ITEM* aParent ) :
|
||||||
BOARD_ITEM( aParent, TYPE_MIRE )
|
BOARD_ITEM( aParent, PCB_TARGET_T )
|
||||||
{
|
{
|
||||||
m_Shape = 0;
|
m_Shape = 0;
|
||||||
m_Size = 5000;
|
m_Size = 5000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MIREPCB::~MIREPCB()
|
PCB_TARGET::~PCB_TARGET()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MIREPCB::Copy( MIREPCB* source )
|
void PCB_TARGET::Copy( PCB_TARGET* source )
|
||||||
{
|
{
|
||||||
m_Layer = source->m_Layer;
|
m_Layer = source->m_Layer;
|
||||||
m_Width = source->m_Width;
|
m_Width = source->m_Width;
|
||||||
|
@ -42,37 +42,41 @@ void MIREPCB::Copy( MIREPCB* source )
|
||||||
|
|
||||||
/* Read the description from the PCB file.
|
/* Read the description from the PCB file.
|
||||||
*/
|
*/
|
||||||
bool MIREPCB::ReadMirePcbDescr( LINE_READER* aReader )
|
bool PCB_TARGET::ReadMirePcbDescr( LINE_READER* aReader )
|
||||||
{
|
{
|
||||||
char* Line;
|
char* Line;
|
||||||
|
|
||||||
while( aReader->ReadLine() )
|
while( aReader->ReadLine() )
|
||||||
{
|
{
|
||||||
Line = aReader->Line();
|
Line = aReader->Line();
|
||||||
|
|
||||||
if( strnicmp( Line, "$End", 4 ) == 0 )
|
if( strnicmp( Line, "$End", 4 ) == 0 )
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
if( Line[0] == 'P' )
|
if( Line[0] == 'P' )
|
||||||
{
|
{
|
||||||
sscanf( Line + 2, " %X %d %d %d %d %d %lX",
|
sscanf( Line + 2, " %X %d %d %d %d %d %lX",
|
||||||
&m_Shape, &m_Layer,
|
&m_Shape, &m_Layer,
|
||||||
&m_Pos.x, &m_Pos.y,
|
&m_Pos.x, &m_Pos.y,
|
||||||
&m_Size, &m_Width, &m_TimeStamp );
|
&m_Size, &m_Width, &m_TimeStamp );
|
||||||
|
|
||||||
if( m_Layer < FIRST_NO_COPPER_LAYER )
|
if( m_Layer < FIRST_NO_COPPER_LAYER )
|
||||||
m_Layer = FIRST_NO_COPPER_LAYER;
|
m_Layer = FIRST_NO_COPPER_LAYER;
|
||||||
|
|
||||||
if( m_Layer > LAST_NO_COPPER_LAYER )
|
if( m_Layer > LAST_NO_COPPER_LAYER )
|
||||||
m_Layer = LAST_NO_COPPER_LAYER;
|
m_Layer = LAST_NO_COPPER_LAYER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool MIREPCB::Save( FILE* aFile ) const
|
bool PCB_TARGET::Save( FILE* aFile ) const
|
||||||
{
|
{
|
||||||
bool rc = false;
|
bool rc = false;
|
||||||
|
|
||||||
if( fprintf( aFile, "$MIREPCB\n" ) != sizeof("$MIREPCB\n")-1 )
|
if( fprintf( aFile, "$PCB_TARGET\n" ) != sizeof("$PCB_TARGET\n")-1 )
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
fprintf( aFile, "Po %X %d %d %d %d %d %8.8lX\n",
|
fprintf( aFile, "Po %X %d %d %d %d %d %8.8lX\n",
|
||||||
|
@ -80,7 +84,7 @@ bool MIREPCB::Save( FILE* aFile ) const
|
||||||
m_Pos.x, m_Pos.y,
|
m_Pos.x, m_Pos.y,
|
||||||
m_Size, m_Width, m_TimeStamp );
|
m_Size, m_Width, m_TimeStamp );
|
||||||
|
|
||||||
if( fprintf( aFile, "$EndMIREPCB\n" ) != sizeof("$EndMIREPCB\n")-1 )
|
if( fprintf( aFile, "$EndPCB_TARGET\n" ) != sizeof("$EndPCB_TARGET\n")-1 )
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
rc = true;
|
rc = true;
|
||||||
|
@ -92,13 +96,13 @@ out:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Draw MIREPCB object: 2 segments + 1 circle
|
/* Draw PCB_TARGET object: 2 segments + 1 circle
|
||||||
* The circle radius is half the radius of the target
|
* The circle radius is half the radius of the target
|
||||||
* 2 lines have length the diameter of the target
|
* 2 lines have length the diameter of the target
|
||||||
*/
|
*/
|
||||||
void MIREPCB::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int mode_color, const wxPoint& offset )
|
void PCB_TARGET::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int mode_color, const wxPoint& offset )
|
||||||
{
|
{
|
||||||
int rayon, ox, oy, gcolor, width;
|
int radius, ox, oy, gcolor, width;
|
||||||
int dx1, dx2, dy1, dy2;
|
int dx1, dx2, dy1, dy2;
|
||||||
int typeaff;
|
int typeaff;
|
||||||
|
|
||||||
|
@ -106,6 +110,7 @@ void MIREPCB::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int mode_color, const wxPoi
|
||||||
oy = m_Pos.y + offset.y;
|
oy = m_Pos.y + offset.y;
|
||||||
|
|
||||||
BOARD * brd = GetBoard( );
|
BOARD * brd = GetBoard( );
|
||||||
|
|
||||||
if( brd->IsLayerVisible( m_Layer ) == false )
|
if( brd->IsLayerVisible( m_Layer ) == false )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -118,7 +123,7 @@ void MIREPCB::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int mode_color, const wxPoi
|
||||||
if( DC->LogicalToDeviceXRel( width ) < 2 )
|
if( DC->LogicalToDeviceXRel( width ) < 2 )
|
||||||
typeaff = FILAIRE;
|
typeaff = FILAIRE;
|
||||||
|
|
||||||
rayon = m_Size / 4;
|
radius = m_Size / 4;
|
||||||
|
|
||||||
switch( typeaff )
|
switch( typeaff )
|
||||||
{
|
{
|
||||||
|
@ -126,25 +131,25 @@ void MIREPCB::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int mode_color, const wxPoi
|
||||||
width = 0;
|
width = 0;
|
||||||
|
|
||||||
case FILLED:
|
case FILLED:
|
||||||
GRCircle( &panel->m_ClipBox, DC, ox, oy, rayon, width, gcolor );
|
GRCircle( &panel->m_ClipBox, DC, ox, oy, radius, width, gcolor );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SKETCH:
|
case SKETCH:
|
||||||
GRCircle( &panel->m_ClipBox, DC, ox, oy, rayon + (width / 2), gcolor );
|
GRCircle( &panel->m_ClipBox, DC, ox, oy, radius + (width / 2), gcolor );
|
||||||
GRCircle( &panel->m_ClipBox, DC, ox, oy, rayon - (width / 2), gcolor );
|
GRCircle( &panel->m_ClipBox, DC, ox, oy, radius - (width / 2), gcolor );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
rayon = m_Size / 2;
|
radius = m_Size / 2;
|
||||||
dx1 = rayon;
|
dx1 = radius;
|
||||||
dy1 = 0;
|
dy1 = 0;
|
||||||
dx2 = 0;
|
dx2 = 0;
|
||||||
dy2 = rayon;
|
dy2 = radius;
|
||||||
|
|
||||||
if( m_Shape ) /* Form X */
|
if( m_Shape ) /* Form X */
|
||||||
{
|
{
|
||||||
dx1 = dy1 = ( rayon * 7 ) / 5;
|
dx1 = dy1 = ( radius * 7 ) / 5;
|
||||||
dx2 = dx1;
|
dx2 = dx1;
|
||||||
dy2 = -dy1;
|
dy2 = -dy1;
|
||||||
}
|
}
|
||||||
|
@ -153,19 +158,13 @@ void MIREPCB::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int mode_color, const wxPoi
|
||||||
{
|
{
|
||||||
case FILAIRE:
|
case FILAIRE:
|
||||||
case FILLED:
|
case FILLED:
|
||||||
GRLine( &panel->m_ClipBox, DC, ox - dx1, oy - dy1,
|
GRLine( &panel->m_ClipBox, DC, ox - dx1, oy - dy1, ox + dx1, oy + dy1, width, gcolor );
|
||||||
ox + dx1, oy + dy1, width, gcolor );
|
GRLine( &panel->m_ClipBox, DC, ox - dx2, oy - dy2, ox + dx2, oy + dy2, width, gcolor );
|
||||||
GRLine( &panel->m_ClipBox, DC, ox - dx2, oy - dy2,
|
|
||||||
ox + dx2, oy + dy2, width, gcolor );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SKETCH:
|
case SKETCH:
|
||||||
GRCSegm( &panel->m_ClipBox, DC, ox - dx1, oy - dy1,
|
GRCSegm( &panel->m_ClipBox, DC, ox - dx1, oy - dy1, ox + dx1, oy + dy1, width, gcolor );
|
||||||
ox + dx1, oy + dy1,
|
GRCSegm( &panel->m_ClipBox, DC, ox - dx2, oy - dy2, ox + dx2, oy + dy2, width, gcolor );
|
||||||
width, gcolor );
|
|
||||||
GRCSegm( &panel->m_ClipBox, DC, ox - dx2, oy - dy2,
|
|
||||||
ox + dx2, oy + dy2,
|
|
||||||
width, gcolor );
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -177,12 +176,12 @@ void MIREPCB::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int mode_color, const wxPoi
|
||||||
* @param refPos A wxPoint to test
|
* @param refPos A wxPoint to test
|
||||||
* @return bool - true if a hit, else false
|
* @return bool - true if a hit, else false
|
||||||
*/
|
*/
|
||||||
bool MIREPCB::HitTest( const wxPoint& refPos )
|
bool PCB_TARGET::HitTest( const wxPoint& refPos )
|
||||||
{
|
{
|
||||||
int dX = refPos.x - m_Pos.x;
|
int dX = refPos.x - m_Pos.x;
|
||||||
int dY = refPos.y - m_Pos.y;
|
int dY = refPos.y - m_Pos.y;
|
||||||
int rayon = m_Size / 2;
|
int radius = m_Size / 2;
|
||||||
return abs( dX ) <= rayon && abs( dY ) <= rayon;
|
return abs( dX ) <= radius && abs( dY ) <= radius;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -192,10 +191,11 @@ bool MIREPCB::HitTest( const wxPoint& refPos )
|
||||||
* @param refArea : the given EDA_RECT
|
* @param refArea : the given EDA_RECT
|
||||||
* @return bool - true if a hit, else false
|
* @return bool - true if a hit, else false
|
||||||
*/
|
*/
|
||||||
bool MIREPCB::HitTest( EDA_RECT& refArea )
|
bool PCB_TARGET::HitTest( EDA_RECT& refArea )
|
||||||
{
|
{
|
||||||
if( refArea.Contains( m_Pos ) )
|
if( refArea.Contains( m_Pos ) )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,7 +206,7 @@ bool MIREPCB::HitTest( EDA_RECT& refArea )
|
||||||
* @param aRotCentre - the rotation point.
|
* @param aRotCentre - the rotation point.
|
||||||
* @param aAngle - the rotation angle in 0.1 degree.
|
* @param aAngle - the rotation angle in 0.1 degree.
|
||||||
*/
|
*/
|
||||||
void MIREPCB::Rotate(const wxPoint& aRotCentre, int aAngle)
|
void PCB_TARGET::Rotate(const wxPoint& aRotCentre, int aAngle)
|
||||||
{
|
{
|
||||||
RotatePoint( &m_Pos, aRotCentre, aAngle );
|
RotatePoint( &m_Pos, aRotCentre, aAngle );
|
||||||
}
|
}
|
||||||
|
@ -217,14 +217,14 @@ void MIREPCB::Rotate(const wxPoint& aRotCentre, int aAngle)
|
||||||
* Flip this object, i.e. change the board side for this object
|
* Flip this object, i.e. change the board side for this object
|
||||||
* @param aCentre - the rotation point.
|
* @param aCentre - the rotation point.
|
||||||
*/
|
*/
|
||||||
void MIREPCB::Flip(const wxPoint& aCentre )
|
void PCB_TARGET::Flip(const wxPoint& aCentre )
|
||||||
{
|
{
|
||||||
m_Pos.y = aCentre.y - ( m_Pos.y - aCentre.y );
|
m_Pos.y = aCentre.y - ( m_Pos.y - aCentre.y );
|
||||||
SetLayer( ChangeSideNumLayer( GetLayer() ) );
|
SetLayer( ChangeSideNumLayer( GetLayer() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EDA_RECT MIREPCB::GetBoundingBox() const
|
EDA_RECT PCB_TARGET::GetBoundingBox() const
|
||||||
{
|
{
|
||||||
EDA_RECT bBox;
|
EDA_RECT bBox;
|
||||||
bBox.SetX( m_Pos.x - m_Size/2 );
|
bBox.SetX( m_Pos.x - m_Size/2 );
|
||||||
|
@ -236,7 +236,7 @@ EDA_RECT MIREPCB::GetBoundingBox() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wxString MIREPCB::GetSelectMenuText() const
|
wxString PCB_TARGET::GetSelectMenuText() const
|
||||||
{
|
{
|
||||||
wxString text;
|
wxString text;
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/****************************************************/
|
/****************************************************/
|
||||||
/* MIREPCB class definition. (targets for photos) */
|
/* PCB_TARGET class definition. (targets for photos) */
|
||||||
/****************************************************/
|
/****************************************************/
|
||||||
|
|
||||||
#ifndef MIRE_H
|
#ifndef MIRE_H
|
||||||
|
@ -9,7 +9,7 @@
|
||||||
#include "richio.h"
|
#include "richio.h"
|
||||||
|
|
||||||
|
|
||||||
class MIREPCB : public BOARD_ITEM
|
class PCB_TARGET : public BOARD_ITEM
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int m_Width;
|
int m_Width;
|
||||||
|
@ -18,11 +18,11 @@ public:
|
||||||
int m_Size;
|
int m_Size;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MIREPCB( BOARD_ITEM* aParent );
|
PCB_TARGET( BOARD_ITEM* aParent );
|
||||||
~MIREPCB();
|
~PCB_TARGET();
|
||||||
|
|
||||||
MIREPCB* Next() const { return (MIREPCB*) Pnext; }
|
PCB_TARGET* Next() const { return (PCB_TARGET*) Pnext; }
|
||||||
MIREPCB* Back() const { return (MIREPCB*) Pnext; }
|
PCB_TARGET* Back() const { return (PCB_TARGET*) Pnext; }
|
||||||
|
|
||||||
wxPoint& GetPosition()
|
wxPoint& GetPosition()
|
||||||
{
|
{
|
||||||
|
@ -65,7 +65,7 @@ public:
|
||||||
|
|
||||||
bool ReadMirePcbDescr( LINE_READER* aReader );
|
bool ReadMirePcbDescr( LINE_READER* aReader );
|
||||||
|
|
||||||
void Copy( MIREPCB* source );
|
void Copy( PCB_TARGET* source );
|
||||||
|
|
||||||
void Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int aDrawMode,
|
void Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int aDrawMode,
|
||||||
const wxPoint& offset = ZeroOffset );
|
const wxPoint& offset = ZeroOffset );
|
||||||
|
|
|
@ -113,16 +113,17 @@ void MODULE::Copy( MODULE* aModule )
|
||||||
|
|
||||||
/* Copy auxiliary data: Pads */
|
/* Copy auxiliary data: Pads */
|
||||||
m_Pads.DeleteAll();
|
m_Pads.DeleteAll();
|
||||||
|
|
||||||
for( D_PAD* pad = aModule->m_Pads; pad; pad = pad->Next() )
|
for( D_PAD* pad = aModule->m_Pads; pad; pad = pad->Next() )
|
||||||
{
|
{
|
||||||
D_PAD* newpad = new D_PAD( this );
|
D_PAD* newpad = new D_PAD( this );
|
||||||
newpad->Copy( pad );
|
newpad->Copy( pad );
|
||||||
|
|
||||||
m_Pads.PushBack( newpad );
|
m_Pads.PushBack( newpad );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy auxiliary data: Drawings */
|
/* Copy auxiliary data: Drawings */
|
||||||
m_Drawings.DeleteAll();
|
m_Drawings.DeleteAll();
|
||||||
|
|
||||||
for( BOARD_ITEM* item = aModule->m_Drawings; item; item = item->Next() )
|
for( BOARD_ITEM* item = aModule->m_Drawings; item; item = item->Next() )
|
||||||
{
|
{
|
||||||
switch( item->Type() )
|
switch( item->Type() )
|
||||||
|
@ -152,15 +153,18 @@ void MODULE::Copy( MODULE* aModule )
|
||||||
|
|
||||||
// Ensure there is one (or more) item in m_3D_Drawings
|
// Ensure there is one (or more) item in m_3D_Drawings
|
||||||
m_3D_Drawings.PushBack( new S3D_MASTER( this ) ); // push a void item
|
m_3D_Drawings.PushBack( new S3D_MASTER( this ) ); // push a void item
|
||||||
|
|
||||||
for( S3D_MASTER* item = aModule->m_3D_Drawings; item; item = item->Next() )
|
for( S3D_MASTER* item = aModule->m_3D_Drawings; item; item = item->Next() )
|
||||||
{
|
{
|
||||||
if( item->m_Shape3DName.IsEmpty() ) // do not copy empty shapes.
|
if( item->m_Shape3DName.IsEmpty() ) // do not copy empty shapes.
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
S3D_MASTER* t3d = m_3D_Drawings;
|
S3D_MASTER* t3d = m_3D_Drawings;
|
||||||
|
|
||||||
if( t3d && t3d->m_Shape3DName.IsEmpty() ) // The first entry can
|
if( t3d && t3d->m_Shape3DName.IsEmpty() ) // The first entry can
|
||||||
// exist, but is empty :
|
{ // exist, but is empty : use it.
|
||||||
// use it.
|
|
||||||
t3d->Copy( item );
|
t3d->Copy( item );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
t3d = new S3D_MASTER( this );
|
t3d = new S3D_MASTER( this );
|
||||||
|
@ -297,12 +301,16 @@ bool MODULE::Save( FILE* aFile ) const
|
||||||
fprintf( aFile, "Sc %8.8lX\n", m_TimeStamp );
|
fprintf( aFile, "Sc %8.8lX\n", m_TimeStamp );
|
||||||
fprintf( aFile, "AR %s\n", TO_UTF8( m_Path ) );
|
fprintf( aFile, "AR %s\n", TO_UTF8( m_Path ) );
|
||||||
fprintf( aFile, "Op %X %X 0\n", m_CntRot90, m_CntRot180 );
|
fprintf( aFile, "Op %X %X 0\n", m_CntRot90, m_CntRot180 );
|
||||||
|
|
||||||
if( m_LocalSolderMaskMargin != 0 )
|
if( m_LocalSolderMaskMargin != 0 )
|
||||||
fprintf( aFile, ".SolderMask %d\n", m_LocalSolderMaskMargin );
|
fprintf( aFile, ".SolderMask %d\n", m_LocalSolderMaskMargin );
|
||||||
|
|
||||||
if( m_LocalSolderPasteMargin != 0 )
|
if( m_LocalSolderPasteMargin != 0 )
|
||||||
fprintf( aFile, ".SolderPaste %d\n", m_LocalSolderPasteMargin );
|
fprintf( aFile, ".SolderPaste %d\n", m_LocalSolderPasteMargin );
|
||||||
|
|
||||||
if( m_LocalSolderPasteMarginRatio != 0 )
|
if( m_LocalSolderPasteMarginRatio != 0 )
|
||||||
fprintf( aFile, ".SolderPasteRatio %g\n", m_LocalSolderPasteMarginRatio );
|
fprintf( aFile, ".SolderPasteRatio %g\n", m_LocalSolderPasteMarginRatio );
|
||||||
|
|
||||||
if( m_LocalClearance != 0 )
|
if( m_LocalClearance != 0 )
|
||||||
fprintf( aFile, ".LocalClearance %d\n", m_LocalClearance );
|
fprintf( aFile, ".LocalClearance %d\n", m_LocalClearance );
|
||||||
|
|
||||||
|
@ -310,10 +318,13 @@ bool MODULE::Save( FILE* aFile ) const
|
||||||
if( m_Attributs != MOD_DEFAULT )
|
if( m_Attributs != MOD_DEFAULT )
|
||||||
{
|
{
|
||||||
fprintf( aFile, "At " );
|
fprintf( aFile, "At " );
|
||||||
|
|
||||||
if( m_Attributs & MOD_CMS )
|
if( m_Attributs & MOD_CMS )
|
||||||
fprintf( aFile, "SMD " );
|
fprintf( aFile, "SMD " );
|
||||||
|
|
||||||
if( m_Attributs & MOD_VIRTUAL )
|
if( m_Attributs & MOD_VIRTUAL )
|
||||||
fprintf( aFile, "VIRTUAL " );
|
fprintf( aFile, "VIRTUAL " );
|
||||||
|
|
||||||
fprintf( aFile, "\n" );
|
fprintf( aFile, "\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -334,6 +345,7 @@ bool MODULE::Save( FILE* aFile ) const
|
||||||
case TYPE_EDGE_MODULE:
|
case TYPE_EDGE_MODULE:
|
||||||
if( !item->Save( aFile ) )
|
if( !item->Save( aFile ) )
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -422,11 +434,13 @@ int MODULE::Read_3D_Descr( LINE_READER* aReader )
|
||||||
while( aReader->ReadLine() )
|
while( aReader->ReadLine() )
|
||||||
{
|
{
|
||||||
Line = aReader->Line();
|
Line = aReader->Line();
|
||||||
|
|
||||||
switch( Line[0] )
|
switch( Line[0] )
|
||||||
{
|
{
|
||||||
case '$':
|
case '$':
|
||||||
if( Line[1] == 'E' )
|
if( Line[1] == 'E' )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
case 'N': // Shape File Name
|
case 'N': // Shape File Name
|
||||||
|
@ -484,6 +498,7 @@ int MODULE::ReadDescr( LINE_READER* aReader )
|
||||||
{
|
{
|
||||||
if( Line[1] == 'E' )
|
if( Line[1] == 'E' )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if( Line[1] == 'P' )
|
if( Line[1] == 'P' )
|
||||||
{
|
{
|
||||||
D_PAD* pad = new D_PAD( this );
|
D_PAD* pad = new D_PAD( this );
|
||||||
|
@ -495,6 +510,7 @@ int MODULE::ReadDescr( LINE_READER* aReader )
|
||||||
m_Pads.PushBack( pad );
|
m_Pads.PushBack( pad );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( Line[1] == 'S' )
|
if( Line[1] == 'S' )
|
||||||
Read_3D_Descr( aReader );
|
Read_3D_Descr( aReader );
|
||||||
}
|
}
|
||||||
|
@ -517,10 +533,13 @@ int MODULE::ReadDescr( LINE_READER* aReader )
|
||||||
&m_LastEdit_Time, &m_TimeStamp, BufCar1 );
|
&m_LastEdit_Time, &m_TimeStamp, BufCar1 );
|
||||||
|
|
||||||
m_ModuleStatus = 0;
|
m_ModuleStatus = 0;
|
||||||
|
|
||||||
if( BufCar1[0] == 'F' )
|
if( BufCar1[0] == 'F' )
|
||||||
SetLocked( true );
|
SetLocked( true );
|
||||||
|
|
||||||
if( BufCar1[1] == 'P' )
|
if( BufCar1[1] == 'P' )
|
||||||
m_ModuleStatus |= MODULE_is_PLACED;
|
m_ModuleStatus |= MODULE_is_PLACED;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'L': /* Li = read the library name of the footprint */
|
case 'L': /* Li = read the library name of the footprint */
|
||||||
|
@ -539,15 +558,20 @@ int MODULE::ReadDescr( LINE_READER* aReader )
|
||||||
sscanf( PtLine, " %X %X", &itmp1, &itmp2 );
|
sscanf( PtLine, " %X %X", &itmp1, &itmp2 );
|
||||||
|
|
||||||
m_CntRot180 = itmp2 & 0x0F;
|
m_CntRot180 = itmp2 & 0x0F;
|
||||||
|
|
||||||
if( m_CntRot180 > 10 )
|
if( m_CntRot180 > 10 )
|
||||||
m_CntRot180 = 10;
|
m_CntRot180 = 10;
|
||||||
|
|
||||||
m_CntRot90 = itmp1 & 0x0F;
|
m_CntRot90 = itmp1 & 0x0F;
|
||||||
|
|
||||||
if( m_CntRot90 > 10 )
|
if( m_CntRot90 > 10 )
|
||||||
m_CntRot90 = 0;
|
m_CntRot90 = 0;
|
||||||
|
|
||||||
itmp1 = (itmp1 >> 4) & 0x0F;
|
itmp1 = (itmp1 >> 4) & 0x0F;
|
||||||
|
|
||||||
if( itmp1 > 10 )
|
if( itmp1 > 10 )
|
||||||
itmp1 = 0;
|
itmp1 = 0;
|
||||||
|
|
||||||
m_CntRot90 |= itmp1 << 4;
|
m_CntRot90 |= itmp1 << 4;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -557,21 +581,25 @@ int MODULE::ReadDescr( LINE_READER* aReader )
|
||||||
/* At = (At)tributes of module */
|
/* At = (At)tributes of module */
|
||||||
if( strstr( PtLine, "SMD" ) )
|
if( strstr( PtLine, "SMD" ) )
|
||||||
m_Attributs |= MOD_CMS;
|
m_Attributs |= MOD_CMS;
|
||||||
|
|
||||||
if( strstr( PtLine, "VIRTUAL" ) )
|
if( strstr( PtLine, "VIRTUAL" ) )
|
||||||
m_Attributs |= MOD_VIRTUAL;
|
m_Attributs |= MOD_VIRTUAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( Line[1] == 'R' )
|
if( Line[1] == 'R' )
|
||||||
{
|
{
|
||||||
// alternate reference, e.g. /478C2408/478AD1B6
|
// alternate reference, e.g. /478C2408/478AD1B6
|
||||||
sscanf( PtLine, " %s", BufLine );
|
sscanf( PtLine, " %s", BufLine );
|
||||||
m_Path = FROM_UTF8( BufLine );
|
m_Path = FROM_UTF8( BufLine );
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'T': /* Read a footprint text description (ref, value, or
|
case 'T': /* Read a footprint text description (ref, value, or
|
||||||
* drawing */
|
* drawing */
|
||||||
TEXTE_MODULE * textm;
|
TEXTE_MODULE * textm;
|
||||||
sscanf( Line + 1, "%d", &itmp1 );
|
sscanf( Line + 1, "%d", &itmp1 );
|
||||||
|
|
||||||
if( itmp1 == TEXT_is_REFERENCE )
|
if( itmp1 == TEXT_is_REFERENCE )
|
||||||
textm = m_Reference;
|
textm = m_Reference;
|
||||||
else if( itmp1 == TEXT_is_VALUE )
|
else if( itmp1 == TEXT_is_VALUE )
|
||||||
|
@ -609,6 +637,7 @@ int MODULE::ReadDescr( LINE_READER* aReader )
|
||||||
m_LocalSolderPasteMarginRatio = atof( Line + 18 );
|
m_LocalSolderPasteMarginRatio = atof( Line + 18 );
|
||||||
else if( strnicmp( Line, ".LocalClearance ", 16 ) == 0 )
|
else if( strnicmp( Line, ".LocalClearance ", 16 ) == 0 )
|
||||||
m_LocalClearance = atoi( Line + 16 );
|
m_LocalClearance = atoi( Line + 16 );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -617,12 +646,12 @@ int MODULE::ReadDescr( LINE_READER* aReader )
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Recalculate the bounding box */
|
/* Recalculate the bounding box */
|
||||||
Set_Rectangle_Encadrement();
|
CalculateBoundingBox();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MODULE::Set_Rectangle_Encadrement()
|
void MODULE::CalculateBoundingBox()
|
||||||
{
|
{
|
||||||
m_BoundaryBox = GetFootPrintRect();
|
m_BoundaryBox = GetFootPrintRect();
|
||||||
m_Surface = ABS( (double) m_BoundaryBox.GetWidth() * m_BoundaryBox.GetHeight() );
|
m_Surface = ABS( (double) m_BoundaryBox.GetWidth() * m_BoundaryBox.GetHeight() );
|
||||||
|
@ -673,14 +702,14 @@ void MODULE::DisplayInfo( EDA_DRAW_FRAME* frame )
|
||||||
{
|
{
|
||||||
int nbpad;
|
int nbpad;
|
||||||
char bufcar[512], Line[512];
|
char bufcar[512], Line[512];
|
||||||
bool flag = FALSE;
|
bool flag = false;
|
||||||
wxString msg;
|
wxString msg;
|
||||||
BOARD* board = GetBoard();
|
BOARD* board = GetBoard();
|
||||||
|
|
||||||
frame->EraseMsgBox();
|
frame->EraseMsgBox();
|
||||||
|
|
||||||
if( frame->m_Ident != PCB_FRAME )
|
if( frame->m_Ident != PCB_FRAME )
|
||||||
flag = TRUE;
|
flag = true;
|
||||||
|
|
||||||
frame->AppendMsgPanel( m_Reference->m_Text, m_Value->m_Text, DARKCYAN );
|
frame->AppendMsgPanel( m_Reference->m_Text, m_Value->m_Text, DARKCYAN );
|
||||||
|
|
||||||
|
@ -783,9 +812,6 @@ D_PAD* MODULE::FindPadByName( const wxString& aPadName ) const
|
||||||
#else
|
#else
|
||||||
if( buf == aPadName )
|
if( buf == aPadName )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return pad;
|
return pad;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -824,10 +850,12 @@ SEARCH_RESULT MODULE::Visit( INSPECTOR* inspector, const void* testData,
|
||||||
|
|
||||||
case TYPE_TEXTE_MODULE:
|
case TYPE_TEXTE_MODULE:
|
||||||
result = inspector->Inspect( m_Reference, testData );
|
result = inspector->Inspect( m_Reference, testData );
|
||||||
|
|
||||||
if( result == SEARCH_QUIT )
|
if( result == SEARCH_QUIT )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
result = inspector->Inspect( m_Value, testData );
|
result = inspector->Inspect( m_Value, testData );
|
||||||
|
|
||||||
if( result == SEARCH_QUIT )
|
if( result == SEARCH_QUIT )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -908,6 +936,7 @@ void MODULE::Show( int nestLevel, std::ostream& os )
|
||||||
|
|
||||||
NestedSpace( nestLevel + 1, os ) << "<mpads>\n";
|
NestedSpace( nestLevel + 1, os ) << "<mpads>\n";
|
||||||
p = m_Pads;
|
p = m_Pads;
|
||||||
|
|
||||||
for( ; p; p = p->Next() )
|
for( ; p; p = p->Next() )
|
||||||
p->Show( nestLevel + 2, os );
|
p->Show( nestLevel + 2, os );
|
||||||
|
|
||||||
|
@ -915,12 +944,14 @@ void MODULE::Show( int nestLevel, std::ostream& os )
|
||||||
|
|
||||||
NestedSpace( nestLevel + 1, os ) << "<mdrawings>\n";
|
NestedSpace( nestLevel + 1, os ) << "<mdrawings>\n";
|
||||||
p = m_Drawings;
|
p = m_Drawings;
|
||||||
|
|
||||||
for( ; p; p = p->Next() )
|
for( ; p; p = p->Next() )
|
||||||
p->Show( nestLevel + 2, os );
|
p->Show( nestLevel + 2, os );
|
||||||
|
|
||||||
NestedSpace( nestLevel + 1, os ) << "</mdrawings>\n";
|
NestedSpace( nestLevel + 1, os ) << "</mdrawings>\n";
|
||||||
|
|
||||||
p = m_Son;
|
p = m_Son;
|
||||||
|
|
||||||
for( ; p; p = p->Next() )
|
for( ; p; p = p->Next() )
|
||||||
{
|
{
|
||||||
p->Show( nestLevel + 1, os );
|
p->Show( nestLevel + 1, os );
|
||||||
|
|
|
@ -114,10 +114,10 @@ public:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Set_Rectangle_Encadrement
|
* Function CalculateBoundingBox
|
||||||
* calculates the bounding box in board coordinates.
|
* calculates the bounding box in board coordinates.
|
||||||
*/
|
*/
|
||||||
void Set_Rectangle_Encadrement();
|
void CalculateBoundingBox();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetFootPrintRect()
|
* Function GetFootPrintRect()
|
||||||
|
|
|
@ -73,48 +73,54 @@ int ChangeSideNumLayer( int oldlayer )
|
||||||
/* Calculate the mask layer when flipping a footprint
|
/* Calculate the mask layer when flipping a footprint
|
||||||
* BACK and FRONT copper layers , mask, paste, solder layers are swapped
|
* BACK and FRONT copper layers , mask, paste, solder layers are swapped
|
||||||
*/
|
*/
|
||||||
int ChangeSideMaskLayer( int masque )
|
int ChangeSideMaskLayer( int aMask )
|
||||||
{
|
{
|
||||||
int newmasque;
|
int newMask;
|
||||||
|
|
||||||
newmasque = masque & ~(LAYER_BACK | LAYER_FRONT |
|
newMask = aMask & ~(LAYER_BACK | LAYER_FRONT |
|
||||||
SILKSCREEN_LAYER_BACK | SILKSCREEN_LAYER_FRONT |
|
SILKSCREEN_LAYER_BACK | SILKSCREEN_LAYER_FRONT |
|
||||||
ADHESIVE_LAYER_BACK | ADHESIVE_LAYER_FRONT |
|
ADHESIVE_LAYER_BACK | ADHESIVE_LAYER_FRONT |
|
||||||
SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT |
|
SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT |
|
||||||
SOLDERPASTE_LAYER_BACK | SOLDERPASTE_LAYER_FRONT |
|
SOLDERPASTE_LAYER_BACK | SOLDERPASTE_LAYER_FRONT |
|
||||||
ADHESIVE_LAYER_BACK | ADHESIVE_LAYER_FRONT);
|
ADHESIVE_LAYER_BACK | ADHESIVE_LAYER_FRONT);
|
||||||
|
|
||||||
if( masque & LAYER_BACK )
|
if( aMask & LAYER_BACK )
|
||||||
newmasque |= LAYER_FRONT;
|
newMask |= LAYER_FRONT;
|
||||||
if( masque & LAYER_FRONT )
|
|
||||||
newmasque |= LAYER_BACK;
|
|
||||||
|
|
||||||
if( masque & SILKSCREEN_LAYER_BACK )
|
if( aMask & LAYER_FRONT )
|
||||||
newmasque |= SILKSCREEN_LAYER_FRONT;
|
newMask |= LAYER_BACK;
|
||||||
if( masque & SILKSCREEN_LAYER_FRONT )
|
|
||||||
newmasque |= SILKSCREEN_LAYER_BACK;
|
|
||||||
|
|
||||||
if( masque & ADHESIVE_LAYER_BACK )
|
if( aMask & SILKSCREEN_LAYER_BACK )
|
||||||
newmasque |= ADHESIVE_LAYER_FRONT;
|
newMask |= SILKSCREEN_LAYER_FRONT;
|
||||||
if( masque & ADHESIVE_LAYER_FRONT )
|
|
||||||
newmasque |= ADHESIVE_LAYER_BACK;
|
|
||||||
|
|
||||||
if( masque & SOLDERMASK_LAYER_BACK )
|
if( aMask & SILKSCREEN_LAYER_FRONT )
|
||||||
newmasque |= SOLDERMASK_LAYER_FRONT;
|
newMask |= SILKSCREEN_LAYER_BACK;
|
||||||
if( masque & SOLDERMASK_LAYER_FRONT )
|
|
||||||
newmasque |= SOLDERMASK_LAYER_BACK;
|
|
||||||
|
|
||||||
if( masque & SOLDERPASTE_LAYER_BACK )
|
if( aMask & ADHESIVE_LAYER_BACK )
|
||||||
newmasque |= SOLDERPASTE_LAYER_FRONT;
|
newMask |= ADHESIVE_LAYER_FRONT;
|
||||||
if( masque & SOLDERPASTE_LAYER_FRONT )
|
|
||||||
newmasque |= SOLDERPASTE_LAYER_BACK;
|
|
||||||
|
|
||||||
if( masque & ADHESIVE_LAYER_BACK )
|
if( aMask & ADHESIVE_LAYER_FRONT )
|
||||||
newmasque |= ADHESIVE_LAYER_FRONT;
|
newMask |= ADHESIVE_LAYER_BACK;
|
||||||
if( masque & ADHESIVE_LAYER_FRONT )
|
|
||||||
newmasque |= ADHESIVE_LAYER_BACK;
|
|
||||||
|
|
||||||
return newmasque;
|
if( aMask & SOLDERMASK_LAYER_BACK )
|
||||||
|
newMask |= SOLDERMASK_LAYER_FRONT;
|
||||||
|
|
||||||
|
if( aMask & SOLDERMASK_LAYER_FRONT )
|
||||||
|
newMask |= SOLDERMASK_LAYER_BACK;
|
||||||
|
|
||||||
|
if( aMask & SOLDERPASTE_LAYER_BACK )
|
||||||
|
newMask |= SOLDERPASTE_LAYER_FRONT;
|
||||||
|
|
||||||
|
if( aMask & SOLDERPASTE_LAYER_FRONT )
|
||||||
|
newMask |= SOLDERPASTE_LAYER_BACK;
|
||||||
|
|
||||||
|
if( aMask & ADHESIVE_LAYER_BACK )
|
||||||
|
newMask |= ADHESIVE_LAYER_FRONT;
|
||||||
|
|
||||||
|
if( aMask & ADHESIVE_LAYER_FRONT )
|
||||||
|
newMask |= ADHESIVE_LAYER_BACK;
|
||||||
|
|
||||||
|
return newMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -171,6 +177,7 @@ void MODULE::Flip(const wxPoint& aCentre )
|
||||||
|
|
||||||
/* Mirror inversion layers pads. */
|
/* Mirror inversion layers pads. */
|
||||||
pt_pad = m_Pads;
|
pt_pad = m_Pads;
|
||||||
|
|
||||||
for( ; pt_pad != NULL; pt_pad = pt_pad->Next() )
|
for( ; pt_pad != NULL; pt_pad = pt_pad->Next() )
|
||||||
{
|
{
|
||||||
pt_pad->m_Pos.y -= m_Pos.y;
|
pt_pad->m_Pos.y -= m_Pos.y;
|
||||||
|
@ -182,7 +189,7 @@ void MODULE::Flip(const wxPoint& aCentre )
|
||||||
NEGATE_AND_NORMALIZE_ANGLE_POS( pt_pad->m_Orient );
|
NEGATE_AND_NORMALIZE_ANGLE_POS( pt_pad->m_Orient );
|
||||||
|
|
||||||
/* flip pads layers*/
|
/* flip pads layers*/
|
||||||
pt_pad->m_Masque_Layer = ChangeSideMaskLayer( pt_pad->m_Masque_Layer );
|
pt_pad->m_layerMask = ChangeSideMaskLayer( pt_pad->m_layerMask );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Mirror reference. */
|
/* Mirror reference. */
|
||||||
|
@ -285,7 +292,7 @@ void MODULE::Flip(const wxPoint& aCentre )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Set_Rectangle_Encadrement();
|
CalculateBoundingBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MODULE::SetPosition( const wxPoint& newpos )
|
void MODULE::SetPosition( const wxPoint& newpos )
|
||||||
|
@ -327,7 +334,7 @@ void MODULE::SetPosition( const wxPoint& newpos )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Set_Rectangle_Encadrement();
|
CalculateBoundingBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -373,5 +380,5 @@ void MODULE::SetOrientation( int newangle )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Set_Rectangle_Encadrement();
|
CalculateBoundingBox();
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,9 +45,8 @@ D_PAD::D_PAD( MODULE* parent ) : BOARD_CONNECTED_ITEM( parent, TYPE_PAD )
|
||||||
m_LocalSolderMaskMargin = 0;
|
m_LocalSolderMaskMargin = 0;
|
||||||
m_LocalSolderPasteMargin = 0;
|
m_LocalSolderPasteMargin = 0;
|
||||||
m_LocalSolderPasteMarginRatio = 0.0;
|
m_LocalSolderPasteMarginRatio = 0.0;
|
||||||
m_Masque_Layer = PAD_STANDARD_DEFAULT_LAYERS; // set layers mask to
|
m_layerMask = PAD_STANDARD_DEFAULT_LAYERS; // set layers mask to
|
||||||
// default for a standard
|
// default for a standard pad
|
||||||
// pad
|
|
||||||
|
|
||||||
SetSubRatsnest( 0 ); // used in ratsnest
|
SetSubRatsnest( 0 ); // used in ratsnest
|
||||||
// calculations
|
// calculations
|
||||||
|
@ -160,10 +159,12 @@ void D_PAD::ReturnStringPadName( wxString& text ) const
|
||||||
int ii;
|
int ii;
|
||||||
|
|
||||||
text.Empty();
|
text.Empty();
|
||||||
|
|
||||||
for( ii = 0; ii < 4; ii++ )
|
for( ii = 0; ii < 4; ii++ )
|
||||||
{
|
{
|
||||||
if( m_Padname[ii] == 0 )
|
if( m_Padname[ii] == 0 )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
text.Append( m_Padname[ii] );
|
text.Append( m_Padname[ii] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -175,8 +176,10 @@ void D_PAD::SetPadName( const wxString& name )
|
||||||
int ii, len;
|
int ii, len;
|
||||||
|
|
||||||
len = name.Length();
|
len = name.Length();
|
||||||
|
|
||||||
if( len > 4 )
|
if( len > 4 )
|
||||||
len = 4;
|
len = 4;
|
||||||
|
|
||||||
for( ii = 0; ii < len; ii++ )
|
for( ii = 0; ii < len; ii++ )
|
||||||
m_Padname[ii] = name.GetChar( ii );
|
m_Padname[ii] = name.GetChar( ii );
|
||||||
|
|
||||||
|
@ -202,7 +205,7 @@ void D_PAD::Copy( D_PAD* source )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_Pos = source->m_Pos;
|
m_Pos = source->m_Pos;
|
||||||
m_Masque_Layer = source->m_Masque_Layer;
|
m_layerMask = source->m_layerMask;
|
||||||
|
|
||||||
m_NumPadName = source->m_NumPadName;
|
m_NumPadName = source->m_NumPadName;
|
||||||
SetNet( source->GetNet() );
|
SetNet( source->GetNet() );
|
||||||
|
@ -280,6 +283,7 @@ int D_PAD::GetSolderMaskMargin()
|
||||||
{
|
{
|
||||||
int margin = m_LocalSolderMaskMargin;
|
int margin = m_LocalSolderMaskMargin;
|
||||||
MODULE * module = (MODULE*) GetParent();
|
MODULE * module = (MODULE*) GetParent();
|
||||||
|
|
||||||
if( module )
|
if( module )
|
||||||
{
|
{
|
||||||
if( margin == 0 )
|
if( margin == 0 )
|
||||||
|
@ -287,6 +291,7 @@ int D_PAD::GetSolderMaskMargin()
|
||||||
if( module->m_LocalSolderMaskMargin )
|
if( module->m_LocalSolderMaskMargin )
|
||||||
margin = module->m_LocalSolderMaskMargin;
|
margin = module->m_LocalSolderMaskMargin;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( margin == 0 )
|
if( margin == 0 )
|
||||||
{
|
{
|
||||||
BOARD * brd = GetBoard();
|
BOARD * brd = GetBoard();
|
||||||
|
@ -298,9 +303,11 @@ int D_PAD::GetSolderMaskMargin()
|
||||||
if( margin < 0 )
|
if( margin < 0 )
|
||||||
{
|
{
|
||||||
int minsize = -MIN( m_Size.x, m_Size.y ) / 2;
|
int minsize = -MIN( m_Size.x, m_Size.y ) / 2;
|
||||||
|
|
||||||
if( margin < minsize )
|
if( margin < minsize )
|
||||||
minsize = minsize;
|
minsize = minsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
return margin;
|
return margin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,11 +333,13 @@ wxSize D_PAD::GetSolderPasteMargin()
|
||||||
margin = module->m_LocalSolderPasteMargin;
|
margin = module->m_LocalSolderPasteMargin;
|
||||||
|
|
||||||
BOARD * brd = GetBoard();
|
BOARD * brd = GetBoard();
|
||||||
|
|
||||||
if( margin == 0 )
|
if( margin == 0 )
|
||||||
margin = brd->GetBoardDesignSettings()->m_SolderPasteMargin;
|
margin = brd->GetBoardDesignSettings()->m_SolderPasteMargin;
|
||||||
|
|
||||||
if( mratio == 0.0 )
|
if( mratio == 0.0 )
|
||||||
mratio = module->m_LocalSolderPasteMarginRatio;
|
mratio = module->m_LocalSolderPasteMarginRatio;
|
||||||
|
|
||||||
if( mratio == 0.0 )
|
if( mratio == 0.0 )
|
||||||
{
|
{
|
||||||
mratio = brd->GetBoardDesignSettings()->m_SolderPasteMarginRatio;
|
mratio = brd->GetBoardDesignSettings()->m_SolderPasteMarginRatio;
|
||||||
|
@ -373,6 +382,7 @@ int D_PAD::ReadDescr( LINE_READER* aReader )
|
||||||
while( aReader->ReadLine() )
|
while( aReader->ReadLine() )
|
||||||
{
|
{
|
||||||
Line = aReader->Line();
|
Line = aReader->Line();
|
||||||
|
|
||||||
if( Line[0] == '$' )
|
if( Line[0] == '$' )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -385,6 +395,7 @@ int D_PAD::ReadDescr( LINE_READER* aReader )
|
||||||
case 'S': // = Sh
|
case 'S': // = Sh
|
||||||
/* Read pad name */
|
/* Read pad name */
|
||||||
nn = 0;
|
nn = 0;
|
||||||
|
|
||||||
while( (*PtLine != '"') && *PtLine )
|
while( (*PtLine != '"') && *PtLine )
|
||||||
PtLine++;
|
PtLine++;
|
||||||
|
|
||||||
|
@ -392,6 +403,7 @@ int D_PAD::ReadDescr( LINE_READER* aReader )
|
||||||
PtLine++;
|
PtLine++;
|
||||||
|
|
||||||
memset( m_Padname, 0, sizeof(m_Padname) );
|
memset( m_Padname, 0, sizeof(m_Padname) );
|
||||||
|
|
||||||
while( (*PtLine != '"') && *PtLine )
|
while( (*PtLine != '"') && *PtLine )
|
||||||
{
|
{
|
||||||
if( nn < (int) sizeof(m_Padname) )
|
if( nn < (int) sizeof(m_Padname) )
|
||||||
|
@ -450,21 +462,24 @@ int D_PAD::ReadDescr( LINE_READER* aReader )
|
||||||
m_DrillShape = PAD_OVAL;
|
m_DrillShape = PAD_OVAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'A':
|
case 'A':
|
||||||
nn = sscanf( PtLine, "%s %s %X", BufLine, BufCar,
|
nn = sscanf( PtLine, "%s %s %X", BufLine, BufCar,
|
||||||
&m_Masque_Layer );
|
&m_layerMask );
|
||||||
|
|
||||||
/* BufCar is not used now */
|
/* BufCar is not used now update attributes */
|
||||||
/* update attributes */
|
|
||||||
m_Attribut = PAD_STANDARD;
|
m_Attribut = PAD_STANDARD;
|
||||||
if( strncmp( BufLine, "SMD", 3 ) == 0 )
|
if( strncmp( BufLine, "SMD", 3 ) == 0 )
|
||||||
m_Attribut = PAD_SMD;
|
m_Attribut = PAD_SMD;
|
||||||
|
|
||||||
if( strncmp( BufLine, "CONN", 4 ) == 0 )
|
if( strncmp( BufLine, "CONN", 4 ) == 0 )
|
||||||
m_Attribut = PAD_CONN;
|
m_Attribut = PAD_CONN;
|
||||||
|
|
||||||
if( strncmp( BufLine, "HOLE", 4 ) == 0 )
|
if( strncmp( BufLine, "HOLE", 4 ) == 0 )
|
||||||
m_Attribut = PAD_HOLE_NOT_PLATED;
|
m_Attribut = PAD_HOLE_NOT_PLATED;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'N': /* Read Netname */
|
case 'N': /* Read Netname */
|
||||||
|
@ -545,10 +560,12 @@ bool D_PAD::Save( FILE* aFile ) const
|
||||||
m_DeltaSize.x, m_DeltaSize.y, m_Orient );
|
m_DeltaSize.x, m_DeltaSize.y, m_Orient );
|
||||||
|
|
||||||
fprintf( aFile, "Dr %d %d %d", m_Drill.x, m_Offset.x, m_Offset.y );
|
fprintf( aFile, "Dr %d %d %d", m_Drill.x, m_Offset.x, m_Offset.y );
|
||||||
|
|
||||||
if( m_DrillShape == PAD_OVAL )
|
if( m_DrillShape == PAD_OVAL )
|
||||||
{
|
{
|
||||||
fprintf( aFile, " %c %d %d", 'O', m_Drill.x, m_Drill.y );
|
fprintf( aFile, " %c %d %d", 'O', m_Drill.x, m_Drill.y );
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf( aFile, "\n" );
|
fprintf( aFile, "\n" );
|
||||||
|
|
||||||
switch( m_Attribut )
|
switch( m_Attribut )
|
||||||
|
@ -571,7 +588,7 @@ bool D_PAD::Save( FILE* aFile ) const
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf( aFile, "At %s N %8.8X\n", texttype, m_Masque_Layer );
|
fprintf( aFile, "At %s N %8.8X\n", texttype, m_layerMask );
|
||||||
|
|
||||||
fprintf( aFile, "Ne %d %s\n", GetNet(), EscapedUTF8( m_Netname ).c_str() );
|
fprintf( aFile, "Ne %d %s\n", GetNet(), EscapedUTF8( m_Netname ).c_str() );
|
||||||
|
|
||||||
|
@ -608,6 +625,7 @@ void D_PAD::DisplayInfo( EDA_DRAW_FRAME* frame )
|
||||||
frame->EraseMsgBox();
|
frame->EraseMsgBox();
|
||||||
|
|
||||||
module = (MODULE*) m_Parent;
|
module = (MODULE*) m_Parent;
|
||||||
|
|
||||||
if( module )
|
if( module )
|
||||||
{
|
{
|
||||||
wxString msg = module->GetReference();
|
wxString msg = module->GetReference();
|
||||||
|
@ -621,8 +639,7 @@ void D_PAD::DisplayInfo( EDA_DRAW_FRAME* frame )
|
||||||
/* For test and debug only: display m_physical_connexion and
|
/* For test and debug only: display m_physical_connexion and
|
||||||
* m_logical_connexion */
|
* m_logical_connexion */
|
||||||
#if 1 // Used only to debug connectivity calculations
|
#if 1 // Used only to debug connectivity calculations
|
||||||
Line.Printf( wxT( "%d-%d-%d " ), GetSubRatsnest(),
|
Line.Printf( wxT( "%d-%d-%d " ), GetSubRatsnest(), GetSubNet(), m_ZoneSubnet );
|
||||||
GetSubNet(), m_ZoneSubnet );
|
|
||||||
frame->AppendMsgPanel( wxT( "L-P-Z" ), Line, DARKGREEN );
|
frame->AppendMsgPanel( wxT( "L-P-Z" ), Line, DARKGREEN );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -630,9 +647,9 @@ void D_PAD::DisplayInfo( EDA_DRAW_FRAME* frame )
|
||||||
|
|
||||||
wxString layerInfo;
|
wxString layerInfo;
|
||||||
|
|
||||||
if( (m_Masque_Layer & ALL_CU_LAYERS) == 0 ) // pad is not on any copper layers
|
if( (m_layerMask & ALL_CU_LAYERS) == 0 ) // pad is not on any copper layers
|
||||||
{
|
{
|
||||||
switch( m_Masque_Layer & ~ALL_CU_LAYERS )
|
switch( m_layerMask & ~ALL_CU_LAYERS )
|
||||||
{
|
{
|
||||||
case ADHESIVE_LAYER_BACK:
|
case ADHESIVE_LAYER_BACK:
|
||||||
layerInfo = board->GetLayerName( ADHESIVE_N_BACK );
|
layerInfo = board->GetLayerName( ADHESIVE_N_BACK );
|
||||||
|
@ -697,34 +714,35 @@ void D_PAD::DisplayInfo( EDA_DRAW_FRAME* frame )
|
||||||
|
|
||||||
static const wxChar* andInternal = _( " & int" );
|
static const wxChar* andInternal = _( " & int" );
|
||||||
|
|
||||||
if( (m_Masque_Layer & (LAYER_BACK | LAYER_FRONT)) == LAYER_BACK )
|
if( (m_layerMask & (LAYER_BACK | LAYER_FRONT)) == LAYER_BACK )
|
||||||
{
|
{
|
||||||
layerInfo = board->GetLayerName( LAYER_N_BACK );
|
layerInfo = board->GetLayerName( LAYER_N_BACK );
|
||||||
|
|
||||||
if( m_Masque_Layer & INTERIOR_COPPER )
|
if( m_layerMask & INTERIOR_COPPER )
|
||||||
layerInfo += andInternal;
|
layerInfo += andInternal;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( (m_Masque_Layer & (LAYER_BACK | LAYER_FRONT)) == (LAYER_BACK | LAYER_FRONT) )
|
else if( (m_layerMask & (LAYER_BACK | LAYER_FRONT)) == (LAYER_BACK | LAYER_FRONT) )
|
||||||
{
|
{
|
||||||
layerInfo = board->GetLayerName( LAYER_N_BACK ) + wxT(", ") +
|
layerInfo = board->GetLayerName( LAYER_N_BACK ) + wxT(", ") +
|
||||||
board->GetLayerName( LAYER_N_FRONT );
|
board->GetLayerName( LAYER_N_FRONT );
|
||||||
|
|
||||||
if( m_Masque_Layer & INTERIOR_COPPER )
|
if( m_layerMask & INTERIOR_COPPER )
|
||||||
layerInfo += andInternal;
|
layerInfo += andInternal;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( (m_Masque_Layer & (LAYER_BACK | LAYER_FRONT)) == LAYER_FRONT )
|
else if( (m_layerMask & (LAYER_BACK | LAYER_FRONT)) == LAYER_FRONT )
|
||||||
{
|
{
|
||||||
layerInfo = board->GetLayerName( LAYER_N_FRONT );
|
layerInfo = board->GetLayerName( LAYER_N_FRONT );
|
||||||
|
|
||||||
if( m_Masque_Layer & INTERIOR_COPPER )
|
if( m_layerMask & INTERIOR_COPPER )
|
||||||
layerInfo += andInternal;
|
layerInfo += andInternal;
|
||||||
}
|
}
|
||||||
|
else // necessarily true: if( m_layerMask & INTERIOR_COPPER )
|
||||||
else // necessarily true: if( m_Masque_Layer & INTERIOR_COPPER )
|
{
|
||||||
layerInfo = _( "internal" );
|
layerInfo = _( "internal" );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
frame->AppendMsgPanel( _( "Layer" ), layerInfo, DARKGREEN );
|
frame->AppendMsgPanel( _( "Layer" ), layerInfo, DARKGREEN );
|
||||||
|
|
||||||
|
@ -737,6 +755,7 @@ void D_PAD::DisplayInfo( EDA_DRAW_FRAME* frame )
|
||||||
frame->AppendMsgPanel( _( "V Size" ), Line, RED );
|
frame->AppendMsgPanel( _( "V Size" ), Line, RED );
|
||||||
|
|
||||||
valeur_param( (unsigned) m_Drill.x, Line );
|
valeur_param( (unsigned) m_Drill.x, Line );
|
||||||
|
|
||||||
if( m_DrillShape == PAD_CIRCLE )
|
if( m_DrillShape == PAD_CIRCLE )
|
||||||
{
|
{
|
||||||
frame->AppendMsgPanel( _( "Drill" ), Line, RED );
|
frame->AppendMsgPanel( _( "Drill" ), Line, RED );
|
||||||
|
@ -751,6 +770,7 @@ void D_PAD::DisplayInfo( EDA_DRAW_FRAME* frame )
|
||||||
}
|
}
|
||||||
|
|
||||||
int module_orient = module ? module->m_Orient : 0;
|
int module_orient = module ? module->m_Orient : 0;
|
||||||
|
|
||||||
if( module_orient )
|
if( module_orient )
|
||||||
Line.Printf( wxT( "%3.1f(+%3.1f)" ),
|
Line.Printf( wxT( "%3.1f(+%3.1f)" ),
|
||||||
(float) ( m_Orient - module_orient ) / 10,
|
(float) ( m_Orient - module_orient ) / 10,
|
||||||
|
@ -777,7 +797,7 @@ void D_PAD::DisplayInfo( EDA_DRAW_FRAME* frame )
|
||||||
// see class_pad.h
|
// see class_pad.h
|
||||||
bool D_PAD::IsOnLayer( int aLayer ) const
|
bool D_PAD::IsOnLayer( int aLayer ) const
|
||||||
{
|
{
|
||||||
return (1 << aLayer) & m_Masque_Layer;
|
return (1 << aLayer) & m_layerMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -807,8 +827,10 @@ bool D_PAD::HitTest( const wxPoint& refPos )
|
||||||
{
|
{
|
||||||
case PAD_CIRCLE:
|
case PAD_CIRCLE:
|
||||||
dist = hypot( delta.x, delta.y );
|
dist = hypot( delta.x, delta.y );
|
||||||
|
|
||||||
if( wxRound( dist ) <= dx )
|
if( wxRound( dist ) <= dx )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PAD_TRAPEZOID:
|
case PAD_TRAPEZOID:
|
||||||
|
@ -821,8 +843,10 @@ bool D_PAD::HitTest( const wxPoint& refPos )
|
||||||
|
|
||||||
default:
|
default:
|
||||||
RotatePoint( &delta, -m_Orient );
|
RotatePoint( &delta, -m_Orient );
|
||||||
|
|
||||||
if( (abs( delta.x ) <= dx ) && (abs( delta.y ) <= dy) )
|
if( (abs( delta.x ) <= dx ) && (abs( delta.y ) <= dy) )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -836,23 +860,29 @@ int D_PAD::Compare( const D_PAD* padref, const D_PAD* padcmp )
|
||||||
|
|
||||||
if( (diff = padref->m_PadShape - padcmp->m_PadShape) )
|
if( (diff = padref->m_PadShape - padcmp->m_PadShape) )
|
||||||
return diff;
|
return diff;
|
||||||
|
|
||||||
if( (diff = padref->m_Size.x - padcmp->m_Size.x) )
|
if( (diff = padref->m_Size.x - padcmp->m_Size.x) )
|
||||||
return diff;
|
return diff;
|
||||||
|
|
||||||
if( (diff = padref->m_Size.y - padcmp->m_Size.y) )
|
if( (diff = padref->m_Size.y - padcmp->m_Size.y) )
|
||||||
return diff;
|
return diff;
|
||||||
|
|
||||||
if( (diff = padref->m_Offset.x - padcmp->m_Offset.x) )
|
if( (diff = padref->m_Offset.x - padcmp->m_Offset.x) )
|
||||||
return diff;
|
return diff;
|
||||||
|
|
||||||
if( (diff = padref->m_Offset.y - padcmp->m_Offset.y) )
|
if( (diff = padref->m_Offset.y - padcmp->m_Offset.y) )
|
||||||
return diff;
|
return diff;
|
||||||
|
|
||||||
if( (diff = padref->m_DeltaSize.x - padcmp->m_DeltaSize.x) )
|
if( (diff = padref->m_DeltaSize.x - padcmp->m_DeltaSize.x) )
|
||||||
return diff;
|
return diff;
|
||||||
|
|
||||||
if( (diff = padref->m_DeltaSize.y - padcmp->m_DeltaSize.y) )
|
if( (diff = padref->m_DeltaSize.y - padcmp->m_DeltaSize.y) )
|
||||||
return diff;
|
return diff;
|
||||||
|
|
||||||
// @todo check if export_gencad still works:
|
// @todo check if export_gencad still works:
|
||||||
// specctra_export needs this, but maybe export_gencad does not. added on
|
// specctra_export needs this, but maybe export_gencad does not. added on
|
||||||
// Jan 24 2008 by Dick.
|
// Jan 24 2008 by Dick.
|
||||||
if( ( diff = padref->m_Masque_Layer - padcmp->m_Masque_Layer ) )
|
if( ( diff = padref->m_layerMask - padcmp->m_layerMask ) )
|
||||||
return diff;
|
return diff;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -910,11 +940,11 @@ wxString D_PAD::GetSelectMenuText() const
|
||||||
|
|
||||||
text << _( "Pad" ) << wxT( " \"" ) << ReturnStringPadName() << wxT( "\" (" );
|
text << _( "Pad" ) << wxT( " \"" ) << ReturnStringPadName() << wxT( "\" (" );
|
||||||
|
|
||||||
if ( (m_Masque_Layer & ALL_CU_LAYERS) == ALL_CU_LAYERS )
|
if ( (m_layerMask & ALL_CU_LAYERS) == ALL_CU_LAYERS )
|
||||||
text << _("all copper layers");
|
text << _("all copper layers");
|
||||||
else if( (m_Masque_Layer & LAYER_BACK ) == LAYER_BACK )
|
else if( (m_layerMask & LAYER_BACK ) == LAYER_BACK )
|
||||||
text << board->GetLayerName(LAYER_N_BACK);
|
text << board->GetLayerName(LAYER_N_BACK);
|
||||||
else if( (m_Masque_Layer & LAYER_FRONT) == LAYER_FRONT )
|
else if( (m_layerMask & LAYER_FRONT) == LAYER_FRONT )
|
||||||
text << board->GetLayerName(LAYER_N_FRONT);
|
text << board->GetLayerName(LAYER_N_FRONT);
|
||||||
else
|
else
|
||||||
text << _( "???" );
|
text << _( "???" );
|
||||||
|
@ -935,12 +965,11 @@ wxString D_PAD::GetSelectMenuText() const
|
||||||
*/
|
*/
|
||||||
void D_PAD::Show( int nestLevel, std::ostream& os )
|
void D_PAD::Show( int nestLevel, std::ostream& os )
|
||||||
{
|
{
|
||||||
char padname[5] =
|
char padname[5] = { m_Padname[0], m_Padname[1], m_Padname[2], m_Padname[3], 0 };
|
||||||
{ m_Padname[0], m_Padname[1], m_Padname[2], m_Padname[3], 0 };
|
|
||||||
|
|
||||||
char layerMask[16];
|
char layerMask[16];
|
||||||
|
|
||||||
sprintf( layerMask, "0x%08X", m_Masque_Layer );
|
sprintf( layerMask, "0x%08X", m_layerMask );
|
||||||
|
|
||||||
// for now, make it look like XML:
|
// for now, make it look like XML:
|
||||||
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() <<
|
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() <<
|
||||||
|
|
|
@ -73,7 +73,7 @@ public:
|
||||||
*/
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
int m_Masque_Layer; // Bitwise layer :1= copper layer, 15= cmp,
|
int m_layerMask; // Bitwise layer :1= copper layer, 15= cmp,
|
||||||
// 2..14 = internal layers
|
// 2..14 = internal layers
|
||||||
// 16 .. 31 = technical layers
|
// 16 .. 31 = technical layers
|
||||||
|
|
||||||
|
|
|
@ -97,29 +97,30 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDraw_mode, const wxPoi
|
||||||
/* If pad are only on front side (no layer on back side)
|
/* If pad are only on front side (no layer on back side)
|
||||||
* and if hide front side pads is enabled, do not draw
|
* and if hide front side pads is enabled, do not draw
|
||||||
*/
|
*/
|
||||||
if( !frontVisible && ( (m_Masque_Layer & BACK_SIDE_LAYERS) == 0 ) )
|
if( !frontVisible && ( (m_layerMask & BACK_SIDE_LAYERS) == 0 ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* If pad are only on back side (no layer on front side)
|
/* If pad are only on back side (no layer on front side)
|
||||||
* and if hide back side pads is enabled, do not draw
|
* and if hide back side pads is enabled, do not draw
|
||||||
*/
|
*/
|
||||||
if( !backVisible && ( (m_Masque_Layer & FRONT_SIDE_LAYERS) == 0 ) )
|
if( !backVisible && ( (m_layerMask & FRONT_SIDE_LAYERS) == 0 ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) aPanel->GetParent();
|
PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) aPanel->GetParent();
|
||||||
PCB_SCREEN* screen = frame->GetScreen();
|
PCB_SCREEN* screen = frame->GetScreen();
|
||||||
|
|
||||||
if( frame->m_DisplayPadFill == FILLED )
|
if( frame->m_DisplayPadFill == FILLED )
|
||||||
drawInfo.m_ShowPadFilled = true;
|
drawInfo.m_ShowPadFilled = true;
|
||||||
else
|
else
|
||||||
drawInfo.m_ShowPadFilled = false;
|
drawInfo.m_ShowPadFilled = false;
|
||||||
|
|
||||||
if( m_Masque_Layer & LAYER_FRONT )
|
if( m_layerMask & LAYER_FRONT )
|
||||||
{
|
{
|
||||||
color = brd->GetVisibleElementColor( PAD_FR_VISIBLE );
|
color = brd->GetVisibleElementColor( PAD_FR_VISIBLE );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_Masque_Layer & LAYER_BACK )
|
if( m_layerMask & LAYER_BACK )
|
||||||
{
|
{
|
||||||
color |= brd->GetVisibleElementColor( PAD_BK_VISIBLE );
|
color |= brd->GetVisibleElementColor( PAD_BK_VISIBLE );
|
||||||
}
|
}
|
||||||
|
@ -128,7 +129,7 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDraw_mode, const wxPoi
|
||||||
{
|
{
|
||||||
// If the pad in on only one tech layer, use the layer color
|
// If the pad in on only one tech layer, use the layer color
|
||||||
// else use DARKGRAY
|
// else use DARKGRAY
|
||||||
int mask_non_copper_layers = m_Masque_Layer & ~ALL_CU_LAYERS;
|
int mask_non_copper_layers = m_layerMask & ~ALL_CU_LAYERS;
|
||||||
#ifdef SHOW_PADMASK_REAL_SIZE_AND_COLOR
|
#ifdef SHOW_PADMASK_REAL_SIZE_AND_COLOR
|
||||||
mask_non_copper_layers &= brd->GetVisibleLayers();
|
mask_non_copper_layers &= brd->GetVisibleLayers();
|
||||||
#endif
|
#endif
|
||||||
|
@ -208,8 +209,7 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDraw_mode, const wxPoi
|
||||||
}
|
}
|
||||||
|
|
||||||
// if PAD_SMD pad and high contrast mode
|
// if PAD_SMD pad and high contrast mode
|
||||||
if( ( m_Attribut == PAD_SMD || m_Attribut == PAD_CONN )
|
if( ( m_Attribut == PAD_SMD || m_Attribut == PAD_CONN ) && DisplayOpt.ContrastModeDisplay )
|
||||||
&& DisplayOpt.ContrastModeDisplay )
|
|
||||||
{
|
{
|
||||||
// when routing tracks
|
// when routing tracks
|
||||||
if( frame && frame->GetToolId() == ID_TRACK_BUTT )
|
if( frame && frame->GetToolId() == ID_TRACK_BUTT )
|
||||||
|
@ -220,10 +220,8 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDraw_mode, const wxPoi
|
||||||
// if routing between copper and component layers,
|
// if routing between copper and component layers,
|
||||||
// or the current layer is one of said 2 external copper layers,
|
// or the current layer is one of said 2 external copper layers,
|
||||||
// then highlight only the current layer.
|
// then highlight only the current layer.
|
||||||
if( ( ( 1 << routeTop ) | ( 1 << routeBot ) )
|
if( ( ( 1 << routeTop ) | ( 1 << routeBot ) ) == ( LAYER_BACK | LAYER_FRONT )
|
||||||
== ( LAYER_BACK | LAYER_FRONT )
|
|| ( ( 1 << screen->m_Active_Layer ) & ( LAYER_BACK | LAYER_FRONT ) ) )
|
||||||
|| ( ( 1 << screen->m_Active_Layer )
|
|
||||||
& ( LAYER_BACK | LAYER_FRONT ) ) )
|
|
||||||
{
|
{
|
||||||
if( !IsOnLayer( screen->m_Active_Layer ) )
|
if( !IsOnLayer( screen->m_Active_Layer ) )
|
||||||
{
|
{
|
||||||
|
@ -319,8 +317,9 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDraw_mode, const wxPoi
|
||||||
color = ColorRefs[color & MASKCOLOR].m_LightColor;
|
color = ColorRefs[color & MASKCOLOR].m_LightColor;
|
||||||
|
|
||||||
bool DisplayIsol = DisplayOpt.DisplayPadIsol;
|
bool DisplayIsol = DisplayOpt.DisplayPadIsol;
|
||||||
if( ( m_Masque_Layer & ALL_CU_LAYERS ) == 0 )
|
|
||||||
DisplayIsol = FALSE;
|
if( ( m_layerMask & ALL_CU_LAYERS ) == 0 )
|
||||||
|
DisplayIsol = false;
|
||||||
|
|
||||||
if( m_Attribut == PAD_HOLE_NOT_PLATED )
|
if( m_Attribut == PAD_HOLE_NOT_PLATED )
|
||||||
drawInfo.m_ShowNotPlatedHole = true;
|
drawInfo.m_ShowNotPlatedHole = true;
|
||||||
|
@ -339,12 +338,12 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDraw_mode, const wxPoi
|
||||||
* needed (never needed in Cvpcb nor in Gerbview)
|
* needed (never needed in Cvpcb nor in Gerbview)
|
||||||
*/
|
*/
|
||||||
drawInfo.m_PadClearance = DisplayIsol ? GetClearance() : 0;
|
drawInfo.m_PadClearance = DisplayIsol ? GetClearance() : 0;
|
||||||
|
|
||||||
/* Draw the pad number */
|
/* Draw the pad number */
|
||||||
if( frame && !frame->m_DisplayPadNum )
|
if( frame && !frame->m_DisplayPadNum )
|
||||||
drawInfo.m_Display_padnum = false;
|
drawInfo.m_Display_padnum = false;
|
||||||
|
|
||||||
if( ( DisplayOpt.DisplayNetNamesMode == 0 )
|
if( ( DisplayOpt.DisplayNetNamesMode == 0 ) || ( DisplayOpt.DisplayNetNamesMode == 2 ) )
|
||||||
|| ( DisplayOpt.DisplayNetNamesMode == 2 ) )
|
|
||||||
drawInfo.m_Display_netname = false;
|
drawInfo.m_Display_netname = false;
|
||||||
|
|
||||||
// Display net names is restricted to pads that are on the active layer
|
// Display net names is restricted to pads that are on the active layer
|
||||||
|
@ -378,6 +377,7 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
|
||||||
wxSize halfsize = m_Size;
|
wxSize halfsize = m_Size;
|
||||||
halfsize.x >>= 1;
|
halfsize.x >>= 1;
|
||||||
halfsize.y >>= 1;
|
halfsize.y >>= 1;
|
||||||
|
|
||||||
switch( GetShape() )
|
switch( GetShape() )
|
||||||
{
|
{
|
||||||
case PAD_CIRCLE:
|
case PAD_CIRCLE:
|
||||||
|
@ -398,6 +398,7 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
|
||||||
0,
|
0,
|
||||||
aDrawInfo.m_Color );
|
aDrawInfo.m_Color );
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PAD_OVAL:
|
case PAD_OVAL:
|
||||||
|
@ -406,6 +407,7 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
|
||||||
seg_width = BuildSegmentFromOvalShape(segStart, segEnd, angle);
|
seg_width = BuildSegmentFromOvalShape(segStart, segEnd, angle);
|
||||||
segStart += shape_pos;
|
segStart += shape_pos;
|
||||||
segEnd += shape_pos;
|
segEnd += shape_pos;
|
||||||
|
|
||||||
if( aDrawInfo.m_ShowPadFilled )
|
if( aDrawInfo.m_ShowPadFilled )
|
||||||
{
|
{
|
||||||
GRFillCSegm( aClipBox, aDC, segStart.x, segStart.y, segEnd.x, segEnd.y,
|
GRFillCSegm( aClipBox, aDC, segStart.x, segStart.y, segEnd.x, segEnd.y,
|
||||||
|
@ -430,6 +432,7 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
|
||||||
case PAD_RECT:
|
case PAD_RECT:
|
||||||
case PAD_TRAPEZOID:
|
case PAD_TRAPEZOID:
|
||||||
BuildPadPolygon( coord, aDrawInfo.m_Mask_margin, angle );
|
BuildPadPolygon( coord, aDrawInfo.m_Mask_margin, angle );
|
||||||
|
|
||||||
for( int ii = 0; ii < 4; ii++ )
|
for( int ii = 0; ii < 4; ii++ )
|
||||||
coord[ii] += shape_pos;
|
coord[ii] += shape_pos;
|
||||||
|
|
||||||
|
@ -458,11 +461,14 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
|
||||||
int hole = m_Drill.x >> 1;
|
int hole = m_Drill.x >> 1;
|
||||||
|
|
||||||
bool drawhole = hole > 0;
|
bool drawhole = hole > 0;
|
||||||
|
|
||||||
if( !aDrawInfo.m_ShowPadFilled && !aDrawInfo. m_ShowNotPlatedHole )
|
if( !aDrawInfo.m_ShowPadFilled && !aDrawInfo. m_ShowNotPlatedHole )
|
||||||
drawhole = false;
|
drawhole = false;
|
||||||
|
|
||||||
if( drawhole )
|
if( drawhole )
|
||||||
{
|
{
|
||||||
bool blackpenstate = false;
|
bool blackpenstate = false;
|
||||||
|
|
||||||
if( aDrawInfo.m_IsPrinting )
|
if( aDrawInfo.m_IsPrinting )
|
||||||
{
|
{
|
||||||
blackpenstate = GetGRForceBlackPenState();
|
blackpenstate = GetGRForceBlackPenState();
|
||||||
|
@ -476,6 +482,7 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
|
||||||
GRSetDrawMode( aDC, GR_XOR );
|
GRSetDrawMode( aDC, GR_XOR );
|
||||||
|
|
||||||
int hole_color = aDrawInfo.m_HoleColor;
|
int hole_color = aDrawInfo.m_HoleColor;
|
||||||
|
|
||||||
if( aDrawInfo. m_ShowNotPlatedHole ) // Draw a specific hole color
|
if( aDrawInfo. m_ShowNotPlatedHole ) // Draw a specific hole color
|
||||||
hole_color = aDrawInfo.m_NPHoleColor;
|
hole_color = aDrawInfo.m_NPHoleColor;
|
||||||
|
|
||||||
|
@ -503,6 +510,7 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
|
||||||
delta_cy = halfsize.y - halfsize.x;
|
delta_cy = halfsize.y - halfsize.x;
|
||||||
seg_width = m_Drill.x;
|
seg_width = m_Drill.x;
|
||||||
}
|
}
|
||||||
|
|
||||||
RotatePoint( &delta_cx, &delta_cy, angle );
|
RotatePoint( &delta_cx, &delta_cy, angle );
|
||||||
|
|
||||||
GRFillCSegm( aClipBox, aDC, holepos.x + delta_cx, holepos.y + delta_cy,
|
GRFillCSegm( aClipBox, aDC, holepos.x + delta_cx, holepos.y + delta_cy,
|
||||||
|
@ -526,11 +534,11 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
|
||||||
int dx0 = MIN( halfsize.x, halfsize.y );
|
int dx0 = MIN( halfsize.x, halfsize.y );
|
||||||
int nc_color = BLUE;
|
int nc_color = BLUE;
|
||||||
|
|
||||||
if( m_Masque_Layer & LAYER_FRONT ) /* Draw \ */
|
if( m_layerMask & LAYER_FRONT ) /* Draw \ */
|
||||||
GRLine( aClipBox, aDC, holepos.x - dx0, holepos.y - dx0,
|
GRLine( aClipBox, aDC, holepos.x - dx0, holepos.y - dx0,
|
||||||
holepos.x + dx0, holepos.y + dx0, 0, nc_color );
|
holepos.x + dx0, holepos.y + dx0, 0, nc_color );
|
||||||
|
|
||||||
if( m_Masque_Layer & LAYER_BACK ) /* Draw / */
|
if( m_layerMask & LAYER_BACK ) /* Draw / */
|
||||||
GRLine( aClipBox, aDC, holepos.x + dx0, holepos.y - dx0,
|
GRLine( aClipBox, aDC, holepos.x + dx0, holepos.y - dx0,
|
||||||
holepos.x - dx0, holepos.y + dx0, 0, nc_color );
|
holepos.x - dx0, holepos.y + dx0, 0, nc_color );
|
||||||
}
|
}
|
||||||
|
@ -544,11 +552,15 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
|
||||||
wxSize AreaSize; // size of text area, normalized to
|
wxSize AreaSize; // size of text area, normalized to
|
||||||
// AreaSize.y < AreaSize.x
|
// AreaSize.y < AreaSize.x
|
||||||
int shortname_len = m_ShortNetname.Len();
|
int shortname_len = m_ShortNetname.Len();
|
||||||
|
|
||||||
if( !aDrawInfo.m_Display_netname )
|
if( !aDrawInfo.m_Display_netname )
|
||||||
shortname_len = 0;
|
shortname_len = 0;
|
||||||
|
|
||||||
if( GetShape() == PAD_CIRCLE )
|
if( GetShape() == PAD_CIRCLE )
|
||||||
angle = 0;
|
angle = 0;
|
||||||
|
|
||||||
AreaSize = m_Size;
|
AreaSize = m_Size;
|
||||||
|
|
||||||
if( m_Size.y > m_Size.x )
|
if( m_Size.y > m_Size.x )
|
||||||
{
|
{
|
||||||
angle += 900;
|
angle += 900;
|
||||||
|
@ -556,12 +568,10 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
|
||||||
AreaSize.y = m_Size.x;
|
AreaSize.y = m_Size.x;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( shortname_len > 0 ) // if there is a netname, provides room
|
if( shortname_len > 0 ) // if there is a netname, provides room to display this netname
|
||||||
// to display this netname
|
|
||||||
{
|
{
|
||||||
AreaSize.y /= 2; // Text used only the upper area of the
|
AreaSize.y /= 2; // Text used only the upper area of the
|
||||||
// pad. The lower area displays the net
|
// pad. The lower area displays the net name
|
||||||
// name
|
|
||||||
tpos.y -= AreaSize.y / 2;
|
tpos.y -= AreaSize.y / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -581,6 +591,7 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
|
||||||
wxString buffer;
|
wxString buffer;
|
||||||
|
|
||||||
int tsize;
|
int tsize;
|
||||||
|
|
||||||
if( aDrawInfo.m_Display_padnum )
|
if( aDrawInfo.m_Display_padnum )
|
||||||
{
|
{
|
||||||
ReturnStringPadName( buffer );
|
ReturnStringPadName( buffer );
|
||||||
|
@ -610,8 +621,10 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
|
||||||
if( aDC->LogicalToDeviceXRel( tsize ) >= CHAR_SIZE_MIN ) // Not drawable in size too small.
|
if( aDC->LogicalToDeviceXRel( tsize ) >= CHAR_SIZE_MIN ) // Not drawable in size too small.
|
||||||
{
|
{
|
||||||
tpos = tpos0;
|
tpos = tpos0;
|
||||||
|
|
||||||
if( aDrawInfo.m_Display_padnum )
|
if( aDrawInfo.m_Display_padnum )
|
||||||
tpos.y += AreaSize.y / 2;
|
tpos.y += AreaSize.y / 2;
|
||||||
|
|
||||||
RotatePoint( &tpos, shape_pos, angle );
|
RotatePoint( &tpos, shape_pos, angle );
|
||||||
|
|
||||||
// tsize reserve room for marges and segments thickness
|
// tsize reserve room for marges and segments thickness
|
||||||
|
@ -622,6 +635,7 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function BuildSegmentFromOvalShape
|
* Function BuildSegmentFromOvalShape
|
||||||
* Has meaning only for OVAL (and ROUND) pads.
|
* Has meaning only for OVAL (and ROUND) pads.
|
||||||
|
@ -632,6 +646,7 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
|
||||||
int D_PAD::BuildSegmentFromOvalShape(wxPoint& aSegStart, wxPoint& aSegEnd, int aRotation) const
|
int D_PAD::BuildSegmentFromOvalShape(wxPoint& aSegStart, wxPoint& aSegEnd, int aRotation) const
|
||||||
{
|
{
|
||||||
int width;
|
int width;
|
||||||
|
|
||||||
if( m_Size.y < m_Size.x ) // Build an horizontal equiv segment
|
if( m_Size.y < m_Size.x ) // Build an horizontal equiv segment
|
||||||
{
|
{
|
||||||
int delta = ( m_Size.x - m_Size.y ) / 2;
|
int delta = ( m_Size.x - m_Size.y ) / 2;
|
||||||
|
@ -660,6 +675,7 @@ int D_PAD::BuildSegmentFromOvalShape(wxPoint& aSegStart, wxPoint& aSegEnd, int a
|
||||||
return width;
|
return width;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function BuildPadPolygon
|
* Function BuildPadPolygon
|
||||||
* Has meaning only for polygonal pads (trapeziod and rectangular)
|
* Has meaning only for polygonal pads (trapeziod and rectangular)
|
||||||
|
@ -690,6 +706,7 @@ void D_PAD::BuildPadPolygon( wxPoint aCoord[4], wxSize aInflateValue, int aRotat
|
||||||
// Only possible for inflate negative values.
|
// Only possible for inflate negative values.
|
||||||
if( halfsize.x < 0 )
|
if( halfsize.x < 0 )
|
||||||
halfsize.x = 0;
|
halfsize.x = 0;
|
||||||
|
|
||||||
if( halfsize.y < 0 )
|
if( halfsize.y < 0 )
|
||||||
halfsize.y = 0;
|
halfsize.y = 0;
|
||||||
}
|
}
|
||||||
|
@ -702,10 +719,13 @@ void D_PAD::BuildPadPolygon( wxPoint aCoord[4], wxSize aInflateValue, int aRotat
|
||||||
// be sure delta values are not to large
|
// be sure delta values are not to large
|
||||||
if( (delta.x < 0) && (delta.x <= -halfsize.y) )
|
if( (delta.x < 0) && (delta.x <= -halfsize.y) )
|
||||||
delta.x = -halfsize.y + 1;
|
delta.x = -halfsize.y + 1;
|
||||||
|
|
||||||
if( (delta.x > 0) && (delta.x >= halfsize.y) )
|
if( (delta.x > 0) && (delta.x >= halfsize.y) )
|
||||||
delta.x = halfsize.y - 1;
|
delta.x = halfsize.y - 1;
|
||||||
|
|
||||||
if( (delta.y < 0) && (delta.y <= -halfsize.x) )
|
if( (delta.y < 0) && (delta.y <= -halfsize.x) )
|
||||||
delta.y = -halfsize.x + 1;
|
delta.y = -halfsize.x + 1;
|
||||||
|
|
||||||
if( (delta.y > 0) && (delta.y >= halfsize.x) )
|
if( (delta.y > 0) && (delta.y >= halfsize.x) )
|
||||||
delta.y = halfsize.x - 1;
|
delta.y = halfsize.x - 1;
|
||||||
}
|
}
|
||||||
|
@ -730,6 +750,7 @@ void D_PAD::BuildPadPolygon( wxPoint aCoord[4], wxSize aInflateValue, int aRotat
|
||||||
{
|
{
|
||||||
double angle;
|
double angle;
|
||||||
wxSize corr;
|
wxSize corr;
|
||||||
|
|
||||||
if( delta.y ) // lower and upper segment is horizontal
|
if( delta.y ) // lower and upper segment is horizontal
|
||||||
{
|
{
|
||||||
// Calculate angle of left (or right) segment with vertical axis
|
// Calculate angle of left (or right) segment with vertical axis
|
||||||
|
@ -766,6 +787,7 @@ void D_PAD::BuildPadPolygon( wxPoint aCoord[4], wxSize aInflateValue, int aRotat
|
||||||
{
|
{
|
||||||
delta = aInflateValue; // this pad is rectangular (delta null).
|
delta = aInflateValue; // this pad is rectangular (delta null).
|
||||||
}
|
}
|
||||||
|
|
||||||
aCoord[0].x += -delta.x - corr.x; // lower left
|
aCoord[0].x += -delta.x - corr.x; // lower left
|
||||||
aCoord[0].y += delta.y + corr.y;
|
aCoord[0].y += delta.y + corr.y;
|
||||||
|
|
||||||
|
@ -786,10 +808,13 @@ void D_PAD::BuildPadPolygon( wxPoint aCoord[4], wxSize aInflateValue, int aRotat
|
||||||
|
|
||||||
if( aCoord[0].x > 0 ) // lower left x coordinate must be <= 0
|
if( aCoord[0].x > 0 ) // lower left x coordinate must be <= 0
|
||||||
aCoord[0].x = aCoord[3].x = 0;
|
aCoord[0].x = aCoord[3].x = 0;
|
||||||
|
|
||||||
if( aCoord[1].x > 0 ) // upper left x coordinate must be <= 0
|
if( aCoord[1].x > 0 ) // upper left x coordinate must be <= 0
|
||||||
aCoord[1].x = aCoord[2].x = 0;
|
aCoord[1].x = aCoord[2].x = 0;
|
||||||
|
|
||||||
if( aCoord[0].y < 0 ) // lower left y coordinate must be >= 0
|
if( aCoord[0].y < 0 ) // lower left y coordinate must be >= 0
|
||||||
aCoord[0].y = aCoord[1].y = 0;
|
aCoord[0].y = aCoord[1].y = 0;
|
||||||
|
|
||||||
if( aCoord[3].y < 0 ) // lower right y coordinate must be >= 0
|
if( aCoord[3].y < 0 ) // lower right y coordinate must be >= 0
|
||||||
aCoord[3].y = aCoord[2].y = 0;
|
aCoord[3].y = aCoord[2].y = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,10 +30,8 @@ static bool ShowClearance( const TRACK* aTrack )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************/
|
|
||||||
TRACK::TRACK( BOARD_ITEM* aParent, KICAD_T idtype ) :
|
TRACK::TRACK( BOARD_ITEM* aParent, KICAD_T idtype ) :
|
||||||
BOARD_CONNECTED_ITEM( aParent, idtype )
|
BOARD_CONNECTED_ITEM( aParent, idtype )
|
||||||
/**********************************************************/
|
|
||||||
{
|
{
|
||||||
m_Width = 0;
|
m_Width = 0;
|
||||||
m_Shape = S_SEGMENT;
|
m_Shape = S_SEGMENT;
|
||||||
|
@ -174,6 +172,7 @@ TRACK* TRACK::Copy() const
|
||||||
return NULL; // should never happen
|
return NULL; // should never happen
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetClearance (virtual)
|
* Function GetClearance (virtual)
|
||||||
* returns the clearance in internal units. If \a aItem is not NULL then the
|
* returns the clearance in internal units. If \a aItem is not NULL then the
|
||||||
|
@ -192,6 +191,7 @@ int TRACK::GetClearance( BOARD_CONNECTED_ITEM* aItem ) const
|
||||||
return BOARD_CONNECTED_ITEM::GetClearance( aItem );
|
return BOARD_CONNECTED_ITEM::GetClearance( aItem );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetDrillValue
|
* Function GetDrillValue
|
||||||
* calculate the drill value for vias (m_Drill if > 0, or default drill value for the Netclass
|
* calculate the drill value for vias (m_Drill if > 0, or default drill value for the Netclass
|
||||||
|
@ -215,11 +215,8 @@ int TRACK::GetDrillValue() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************/
|
|
||||||
bool TRACK::IsNull()
|
|
||||||
/***********************/
|
|
||||||
|
|
||||||
// return true if segment length = 0
|
// return true if segment length = 0
|
||||||
|
bool TRACK::IsNull()
|
||||||
{
|
{
|
||||||
if( ( Type() != TYPE_VIA ) && ( m_Start == m_End ) )
|
if( ( Type() != TYPE_VIA ) && ( m_Start == m_End ) )
|
||||||
return true;
|
return true;
|
||||||
|
@ -228,10 +225,6 @@ bool TRACK::IsNull()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************/
|
|
||||||
int TRACK::IsPointOnEnds( const wxPoint& point, int min_dist )
|
|
||||||
/*************************************************************/
|
|
||||||
|
|
||||||
/* Return:
|
/* Return:
|
||||||
* STARTPOINT if point if near (dist = min_dist) star point
|
* STARTPOINT if point if near (dist = min_dist) star point
|
||||||
* ENDPOINT if point if near (dist = min_dist) end point
|
* ENDPOINT if point if near (dist = min_dist) end point
|
||||||
|
@ -239,6 +232,7 @@ int TRACK::IsPointOnEnds( const wxPoint& point, int min_dist )
|
||||||
* 0 if no
|
* 0 if no
|
||||||
* if min_dist < 0: min_dist = track_width/2
|
* if min_dist < 0: min_dist = track_width/2
|
||||||
*/
|
*/
|
||||||
|
int TRACK::IsPointOnEnds( const wxPoint& point, int min_dist )
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
|
||||||
|
@ -256,12 +250,14 @@ int TRACK::IsPointOnEnds( const wxPoint& point, int min_dist )
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
double dist = hypot( (double)dx, (double) dy );
|
double dist = hypot( (double)dx, (double) dy );
|
||||||
|
|
||||||
if( min_dist >= (int) dist )
|
if( min_dist >= (int) dist )
|
||||||
result |= STARTPOINT;
|
result |= STARTPOINT;
|
||||||
}
|
}
|
||||||
|
|
||||||
dx = m_End.x - point.x;
|
dx = m_End.x - point.x;
|
||||||
dy = m_End.y - point.y;
|
dy = m_End.y - point.y;
|
||||||
|
|
||||||
if( min_dist == 0 )
|
if( min_dist == 0 )
|
||||||
{
|
{
|
||||||
if( (dx == 0) && (dy == 0 ) )
|
if( (dx == 0) && (dy == 0 ) )
|
||||||
|
@ -270,6 +266,7 @@ int TRACK::IsPointOnEnds( const wxPoint& point, int min_dist )
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
double dist = hypot( (double) dx, (double) dy );
|
double dist = hypot( (double) dx, (double) dy );
|
||||||
|
|
||||||
if( min_dist >= (int) dist )
|
if( min_dist >= (int) dist )
|
||||||
result |= ENDPOINT;
|
result |= ENDPOINT;
|
||||||
}
|
}
|
||||||
|
@ -356,12 +353,16 @@ void TRACK::Flip( const wxPoint& aCentre )
|
||||||
{
|
{
|
||||||
m_Start.y = aCentre.y - (m_Start.y - aCentre.y);
|
m_Start.y = aCentre.y - (m_Start.y - aCentre.y);
|
||||||
m_End.y = aCentre.y - (m_End.y - aCentre.y);
|
m_End.y = aCentre.y - (m_End.y - aCentre.y);
|
||||||
|
|
||||||
if( Type() == TYPE_VIA )
|
if( Type() == TYPE_VIA )
|
||||||
{
|
{
|
||||||
|
// Huh? Wouldn't it be better to us Type() != VIA and get rid of these brackets?
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
SetLayer( ChangeSideNumLayer( GetLayer() ) );
|
SetLayer( ChangeSideNumLayer( GetLayer() ) );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// see class_track.h
|
// see class_track.h
|
||||||
|
@ -386,9 +387,7 @@ SEARCH_RESULT TRACK::Visit( INSPECTOR* inspector, const void* testData,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************/
|
|
||||||
bool SEGVIA::IsOnLayer( int layer_number ) const
|
bool SEGVIA::IsOnLayer( int layer_number ) const
|
||||||
/***********************************************/
|
|
||||||
{
|
{
|
||||||
int bottom_layer, top_layer;
|
int bottom_layer, top_layer;
|
||||||
|
|
||||||
|
@ -401,12 +400,10 @@ bool SEGVIA::IsOnLayer( int layer_number ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************/
|
|
||||||
int TRACK::ReturnMaskLayer()
|
|
||||||
/***********************************/
|
|
||||||
/* Return the mask layer for this.
|
/* Return the mask layer for this.
|
||||||
* for a via, there is more than one layer used
|
* for a via, there is more than one layer used
|
||||||
*/
|
*/
|
||||||
|
int TRACK::ReturnMaskLayer()
|
||||||
{
|
{
|
||||||
if( Type() == TYPE_VIA )
|
if( Type() == TYPE_VIA )
|
||||||
{
|
{
|
||||||
|
@ -423,6 +420,7 @@ int TRACK::ReturnMaskLayer()
|
||||||
( (SEGVIA*) this )->ReturnLayerPair( &top_layer, &bottom_layer );
|
( (SEGVIA*) this )->ReturnLayerPair( &top_layer, &bottom_layer );
|
||||||
|
|
||||||
int layermask = 0;
|
int layermask = 0;
|
||||||
|
|
||||||
while( bottom_layer <= top_layer )
|
while( bottom_layer <= top_layer )
|
||||||
{
|
{
|
||||||
layermask |= g_TabOneLayerMask[bottom_layer++];
|
layermask |= g_TabOneLayerMask[bottom_layer++];
|
||||||
|
@ -431,14 +429,12 @@ int TRACK::ReturnMaskLayer()
|
||||||
return layermask;
|
return layermask;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
return g_TabOneLayerMask[m_Layer];
|
return g_TabOneLayerMask[m_Layer];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************/
|
|
||||||
void SEGVIA::SetLayerPair( int top_layer, int bottom_layer )
|
|
||||||
/*********************************************************/
|
|
||||||
|
|
||||||
/** Set the .m_Layer member param:
|
/** Set the .m_Layer member param:
|
||||||
* For a via m_Layer contains the 2 layers :
|
* For a via m_Layer contains the 2 layers :
|
||||||
* top layer and bottom layer used by the via.
|
* top layer and bottom layer used by the via.
|
||||||
|
@ -447,6 +443,7 @@ void SEGVIA::SetLayerPair( int top_layer, int bottom_layer )
|
||||||
* @param top_layer = first layer connected by the via
|
* @param top_layer = first layer connected by the via
|
||||||
* @param bottom_layer = last layer connected by the via
|
* @param bottom_layer = last layer connected by the via
|
||||||
*/
|
*/
|
||||||
|
void SEGVIA::SetLayerPair( int top_layer, int bottom_layer )
|
||||||
{
|
{
|
||||||
if( Shape() == VIA_THROUGH )
|
if( Shape() == VIA_THROUGH )
|
||||||
{
|
{
|
||||||
|
@ -461,10 +458,6 @@ void SEGVIA::SetLayerPair( int top_layer, int bottom_layer )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************************/
|
|
||||||
void SEGVIA::ReturnLayerPair( int* top_layer, int* bottom_layer ) const
|
|
||||||
/*********************************************************************/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function ReturnLayerPair
|
* Function ReturnLayerPair
|
||||||
* Return the 2 layers used by the via (the via actually uses
|
* Return the 2 layers used by the via (the via actually uses
|
||||||
|
@ -472,6 +465,7 @@ void SEGVIA::ReturnLayerPair( int* top_layer, int* bottom_layer ) const
|
||||||
* @param top_layer = pointer to the first layer (can be null)
|
* @param top_layer = pointer to the first layer (can be null)
|
||||||
* @param bottom_layer = pointer to the last layer (can be null)
|
* @param bottom_layer = pointer to the last layer (can be null)
|
||||||
*/
|
*/
|
||||||
|
void SEGVIA::ReturnLayerPair( int* top_layer, int* bottom_layer ) const
|
||||||
{
|
{
|
||||||
int b_layer = LAYER_N_BACK;
|
int b_layer = LAYER_N_BACK;
|
||||||
int t_layer = LAYER_N_FRONT;
|
int t_layer = LAYER_N_FRONT;
|
||||||
|
@ -480,6 +474,7 @@ void SEGVIA::ReturnLayerPair( int* top_layer, int* bottom_layer ) const
|
||||||
{
|
{
|
||||||
b_layer = (m_Layer >> 4) & 15;
|
b_layer = (m_Layer >> 4) & 15;
|
||||||
t_layer = m_Layer & 15;
|
t_layer = m_Layer & 15;
|
||||||
|
|
||||||
if( b_layer > t_layer )
|
if( b_layer > t_layer )
|
||||||
EXCHG( b_layer, t_layer );
|
EXCHG( b_layer, t_layer );
|
||||||
}
|
}
|
||||||
|
@ -511,13 +506,10 @@ TRACK* TRACK::GetBestInsertPoint( BOARD* aPcb )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************/
|
|
||||||
TRACK* TRACK::GetStartNetCode( int NetCode )
|
|
||||||
/*******************************************/
|
|
||||||
|
|
||||||
/* Search (within the track linked list) the first segment matching the netcode
|
/* Search (within the track linked list) the first segment matching the netcode
|
||||||
* ( the linked list is always sorted by net codes )
|
* ( the linked list is always sorted by net codes )
|
||||||
*/
|
*/
|
||||||
|
TRACK* TRACK::GetStartNetCode( int NetCode )
|
||||||
{
|
{
|
||||||
TRACK* Track = this;
|
TRACK* Track = this;
|
||||||
int ii = 0;
|
int ii = 0;
|
||||||
|
@ -546,13 +538,10 @@ TRACK* TRACK::GetStartNetCode( int NetCode )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************/
|
|
||||||
TRACK* TRACK::GetEndNetCode( int NetCode )
|
|
||||||
/*****************************************/
|
|
||||||
|
|
||||||
/* Search (within the track linked list) the last segment matching the netcode
|
/* Search (within the track linked list) the last segment matching the netcode
|
||||||
* ( the linked list is always sorted by net codes )
|
* ( the linked list is always sorted by net codes )
|
||||||
*/
|
*/
|
||||||
|
TRACK* TRACK::GetEndNetCode( int NetCode )
|
||||||
{
|
{
|
||||||
TRACK* NextS, * Track = this;
|
TRACK* NextS, * Track = this;
|
||||||
int ii = 0;
|
int ii = 0;
|
||||||
|
@ -566,6 +555,7 @@ TRACK* TRACK::GetEndNetCode( int NetCode )
|
||||||
while( Track != NULL )
|
while( Track != NULL )
|
||||||
{
|
{
|
||||||
NextS = (TRACK*) Track->Pnext;
|
NextS = (TRACK*) Track->Pnext;
|
||||||
|
|
||||||
if( Track->GetNet() == NetCode )
|
if( Track->GetNet() == NetCode )
|
||||||
ii++;
|
ii++;
|
||||||
|
|
||||||
|
@ -603,13 +593,11 @@ bool TRACK::Save( FILE* aFile ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************************/
|
|
||||||
void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint& aOffset )
|
void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint& aOffset )
|
||||||
/*********************************************************************/
|
|
||||||
{
|
{
|
||||||
int l_piste;
|
int l_trace;
|
||||||
int color;
|
int color;
|
||||||
int rayon;
|
int radius;
|
||||||
int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
|
int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
|
||||||
|
|
||||||
if( Type() == TYPE_ZONE && DisplayOpt.DisplayZonesMode != 0 )
|
if( Type() == TYPE_ZONE && DisplayOpt.DisplayZonesMode != 0 )
|
||||||
|
@ -618,8 +606,7 @@ void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint&
|
||||||
BOARD * brd = GetBoard( );
|
BOARD * brd = GetBoard( );
|
||||||
color = brd->GetLayerColor(m_Layer);
|
color = brd->GetLayerColor(m_Layer);
|
||||||
|
|
||||||
if( brd->IsLayerVisible( m_Layer ) == false && ( color & HIGHLIGHT_FLAG ) !=
|
if( brd->IsLayerVisible( m_Layer ) == false && ( color & HIGHLIGHT_FLAG ) != HIGHLIGHT_FLAG )
|
||||||
HIGHLIGHT_FLAG )
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( DisplayOpt.ContrastModeDisplay )
|
if( DisplayOpt.ContrastModeDisplay )
|
||||||
|
@ -647,44 +634,43 @@ void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint&
|
||||||
GRSetDrawMode( DC, draw_mode );
|
GRSetDrawMode( DC, draw_mode );
|
||||||
|
|
||||||
|
|
||||||
l_piste = m_Width >> 1;
|
l_trace = m_Width >> 1;
|
||||||
|
|
||||||
if( m_Shape == S_CIRCLE )
|
if( m_Shape == S_CIRCLE )
|
||||||
{
|
{
|
||||||
rayon = (int) hypot( (double) ( m_End.x - m_Start.x ),
|
radius = (int) hypot( (double) ( m_End.x - m_Start.x ),
|
||||||
(double) ( m_End.y - m_Start.y ) );
|
(double) ( m_End.y - m_Start.y ) );
|
||||||
|
|
||||||
if( DC->LogicalToDeviceXRel( l_piste ) < L_MIN_DESSIN )
|
if( DC->LogicalToDeviceXRel( l_trace ) < L_MIN_DESSIN )
|
||||||
{
|
{
|
||||||
GRCircle( &panel->m_ClipBox, DC, m_Start.x + aOffset.x,
|
GRCircle( &panel->m_ClipBox, DC, m_Start.x + aOffset.x,
|
||||||
m_Start.y + aOffset.y, rayon, color );
|
m_Start.y + aOffset.y, radius, color );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
if( DC->LogicalToDeviceXRel( l_piste ) <= 1 ) /* Sketch mode if l_piste/zoom <= 1 */
|
if( DC->LogicalToDeviceXRel( l_trace ) <= 1 ) /* Sketch mode if l_trace/zoom <= 1 */
|
||||||
{
|
{
|
||||||
GRCircle( &panel->m_ClipBox, DC, m_Start.x + aOffset.x,
|
GRCircle( &panel->m_ClipBox, DC, m_Start.x + aOffset.x,
|
||||||
m_Start.y + aOffset.y, rayon, color );
|
m_Start.y + aOffset.y, radius, color );
|
||||||
}
|
}
|
||||||
else if( ( !DisplayOpt.DisplayPcbTrackFill) || GetState( FORCE_SKETCH ) )
|
else if( ( !DisplayOpt.DisplayPcbTrackFill) || GetState( FORCE_SKETCH ) )
|
||||||
{
|
{
|
||||||
GRCircle( &panel->m_ClipBox, DC, m_Start.x + aOffset.x,
|
GRCircle( &panel->m_ClipBox, DC, m_Start.x + aOffset.x,
|
||||||
m_Start.y + aOffset.y, rayon - l_piste, color );
|
m_Start.y + aOffset.y, radius - l_trace, color );
|
||||||
GRCircle( &panel->m_ClipBox, DC, m_Start.x + aOffset.x,
|
GRCircle( &panel->m_ClipBox, DC, m_Start.x + aOffset.x,
|
||||||
m_Start.y + aOffset.y, rayon + l_piste, color );
|
m_Start.y + aOffset.y, radius + l_trace, color );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GRCircle( &panel->m_ClipBox, DC, m_Start.x + aOffset.x,
|
GRCircle( &panel->m_ClipBox, DC, m_Start.x + aOffset.x,
|
||||||
m_Start.y + aOffset.y, rayon,
|
m_Start.y + aOffset.y, radius, m_Width, color );
|
||||||
m_Width, color );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( DC->LogicalToDeviceXRel( l_piste ) < L_MIN_DESSIN )
|
if( DC->LogicalToDeviceXRel( l_trace ) < L_MIN_DESSIN )
|
||||||
{
|
{
|
||||||
GRLine( &panel->m_ClipBox, DC, m_Start + aOffset, m_End + aOffset, 0, color );
|
GRLine( &panel->m_ClipBox, DC, m_Start + aOffset, m_End + aOffset, 0, color );
|
||||||
return;
|
return;
|
||||||
|
@ -724,12 +710,10 @@ void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint&
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#define THRESHOLD 10
|
#define THRESHOLD 10
|
||||||
if( (m_End.x - m_Start.x) != 0
|
if( (m_End.x - m_Start.x) != 0 && (m_End.y - m_Start.y) != 0 )
|
||||||
&& (m_End.y - m_Start.y) != 0 )
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int len = ABS( (m_End.x - m_Start.x)
|
int len = ABS( (m_End.x - m_Start.x) + (m_End.y - m_Start.y) );
|
||||||
+ (m_End.y - m_Start.y) );
|
|
||||||
|
|
||||||
if( len < THRESHOLD * m_Width )
|
if( len < THRESHOLD * m_Width )
|
||||||
return;
|
return;
|
||||||
|
@ -739,11 +723,14 @@ void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint&
|
||||||
|
|
||||||
if( GetNet() == 0 )
|
if( GetNet() == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
NETINFO_ITEM* net = ( (BOARD*) GetParent() )->FindNet( GetNet() );
|
NETINFO_ITEM* net = ( (BOARD*) GetParent() )->FindNet( GetNet() );
|
||||||
|
|
||||||
if( net == NULL )
|
if( net == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int textlen = net->GetShortNetname().Len();
|
int textlen = net->GetShortNetname().Len();
|
||||||
|
|
||||||
if( textlen > 0 )
|
if( textlen > 0 )
|
||||||
{
|
{
|
||||||
// calculate a good size for the text
|
// calculate a good size for the text
|
||||||
|
@ -754,6 +741,7 @@ void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint&
|
||||||
|
|
||||||
// Calculate angle: if the track segment is vertical, angle = 90 degrees
|
// Calculate angle: if the track segment is vertical, angle = 90 degrees
|
||||||
int angle = 0;
|
int angle = 0;
|
||||||
|
|
||||||
if( (m_End.x - m_Start.x) == 0 ) // Vertical segment
|
if( (m_End.x - m_Start.x) == 0 ) // Vertical segment
|
||||||
angle = 900; // angle is in 0.1 degree
|
angle = 900; // angle is in 0.1 degree
|
||||||
|
|
||||||
|
@ -772,12 +760,10 @@ void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint&
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************************/
|
|
||||||
void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint& aOffset )
|
void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint& aOffset )
|
||||||
/*******************************************************************************************/
|
|
||||||
{
|
{
|
||||||
int color;
|
int color;
|
||||||
int rayon;
|
int radius;
|
||||||
int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
|
int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
|
||||||
|
|
||||||
int fillvia = 0;
|
int fillvia = 0;
|
||||||
|
@ -819,17 +805,17 @@ void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint
|
||||||
SetAlpha( &color, 150 );
|
SetAlpha( &color, 150 );
|
||||||
|
|
||||||
|
|
||||||
rayon = m_Width >> 1;
|
radius = m_Width >> 1;
|
||||||
// for small via size on screen (rayon < 4 pixels) draw a simplified shape
|
// for small via size on screen (radius < 4 pixels) draw a simplified shape
|
||||||
|
|
||||||
int radius_in_pixels = DC->LogicalToDeviceXRel( rayon );
|
int radius_in_pixels = DC->LogicalToDeviceXRel( radius );
|
||||||
|
|
||||||
bool fast_draw = false;
|
bool fast_draw = false;
|
||||||
|
|
||||||
// Vias are drawn as a filled circle or a double circle. The hole will be drawn later
|
// Vias are drawn as a filled circle or a double circle. The hole will be drawn later
|
||||||
int drill_rayon = GetDrillValue() / 2;
|
int drill_radius = GetDrillValue() / 2;
|
||||||
|
|
||||||
int inner_rayon = rayon - DC->DeviceToLogicalXRel( 2 );
|
int inner_radius = radius - DC->DeviceToLogicalXRel( 2 );
|
||||||
|
|
||||||
if( radius_in_pixels < 3 )
|
if( radius_in_pixels < 3 )
|
||||||
{
|
{
|
||||||
|
@ -838,25 +824,27 @@ void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint
|
||||||
}
|
}
|
||||||
|
|
||||||
if( fillvia )
|
if( fillvia )
|
||||||
GRFilledCircle( &panel->m_ClipBox, DC, m_Start + aOffset, rayon, color );
|
{
|
||||||
|
GRFilledCircle( &panel->m_ClipBox, DC, m_Start + aOffset, radius, color );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GRCircle( &panel->m_ClipBox, DC, m_Start + aOffset,rayon, 0, color );
|
GRCircle( &panel->m_ClipBox, DC, m_Start + aOffset,radius, 0, color );
|
||||||
if ( fast_draw )
|
if ( fast_draw )
|
||||||
return;
|
return;
|
||||||
GRCircle( &panel->m_ClipBox, DC, m_Start + aOffset, inner_rayon, 0, color );
|
GRCircle( &panel->m_ClipBox, DC, m_Start + aOffset, inner_radius, 0, color );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw the via hole if the display option allows it
|
// Draw the via hole if the display option allows it
|
||||||
if( DisplayOpt.m_DisplayViaMode != VIA_HOLE_NOT_SHOW )
|
if( DisplayOpt.m_DisplayViaMode != VIA_HOLE_NOT_SHOW )
|
||||||
{
|
{
|
||||||
if( (DisplayOpt.m_DisplayViaMode == ALL_VIA_HOLE_SHOW) // Display all drill holes requested
|
if( (DisplayOpt.m_DisplayViaMode == ALL_VIA_HOLE_SHOW) // Display all drill holes requested
|
||||||
|| ( (drill_rayon > 0 ) && !IsDrillDefault() ) ) // Or Display non default holes requested
|
|| ( (drill_radius > 0 ) && !IsDrillDefault() ) ) // Or Display non default holes requested
|
||||||
{
|
{
|
||||||
if( fillvia )
|
if( fillvia )
|
||||||
{
|
{
|
||||||
bool blackpenstate = false;
|
bool blackpenstate = false;
|
||||||
|
|
||||||
if( screen->m_IsPrinting )
|
if( screen->m_IsPrinting )
|
||||||
{
|
{
|
||||||
blackpenstate = GetGRForceBlackPenState();
|
blackpenstate = GetGRForceBlackPenState();
|
||||||
|
@ -864,31 +852,32 @@ void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint
|
||||||
color = g_DrawBgColor;
|
color = g_DrawBgColor;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
color = BLACK; // or DARKGRAY;
|
color = BLACK; // or DARKGRAY;
|
||||||
|
}
|
||||||
|
|
||||||
if( draw_mode != GR_XOR )
|
if( draw_mode != GR_XOR )
|
||||||
GRSetDrawMode( DC, GR_COPY );
|
GRSetDrawMode( DC, GR_COPY );
|
||||||
else
|
else
|
||||||
GRSetDrawMode( DC, GR_XOR );
|
GRSetDrawMode( DC, GR_XOR );
|
||||||
|
|
||||||
if( DC->LogicalToDeviceXRel( drill_rayon ) > 1 ) // Draw hole if large enough.
|
if( DC->LogicalToDeviceXRel( drill_radius ) > 1 ) // Draw hole if large enough.
|
||||||
GRFilledCircle( &panel->m_ClipBox, DC, m_Start.x + aOffset.x,
|
GRFilledCircle( &panel->m_ClipBox, DC, m_Start.x + aOffset.x,
|
||||||
m_Start.y + aOffset.y, drill_rayon, 0, color, color );
|
m_Start.y + aOffset.y, drill_radius, 0, color, color );
|
||||||
|
|
||||||
if( screen->m_IsPrinting )
|
if( screen->m_IsPrinting )
|
||||||
GRForceBlackPen( blackpenstate );
|
GRForceBlackPen( blackpenstate );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( drill_rayon < inner_rayon ) // We can show the via hole
|
if( drill_radius < inner_radius ) // We can show the via hole
|
||||||
GRCircle( &panel->m_ClipBox, DC, m_Start + aOffset, drill_rayon, 0, color );
|
GRCircle( &panel->m_ClipBox, DC, m_Start + aOffset, drill_radius, 0, color );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( DisplayOpt.ShowTrackClearanceMode == SHOW_CLEARANCE_ALWAYS )
|
if( DisplayOpt.ShowTrackClearanceMode == SHOW_CLEARANCE_ALWAYS )
|
||||||
GRCircle( &panel->m_ClipBox, DC, m_Start + aOffset,
|
GRCircle( &panel->m_ClipBox, DC, m_Start + aOffset, radius + GetClearance(), 0, color );
|
||||||
rayon + GetClearance(), 0, color );
|
|
||||||
|
|
||||||
// for Micro Vias, draw a partial cross :
|
// for Micro Vias, draw a partial cross :
|
||||||
// X on component layer, or + on copper layer
|
// X on component layer, or + on copper layer
|
||||||
|
@ -899,13 +888,13 @@ void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint
|
||||||
|
|
||||||
if( IsOnLayer( LAYER_N_BACK ) )
|
if( IsOnLayer( LAYER_N_BACK ) )
|
||||||
{
|
{
|
||||||
ax = rayon; ay = 0;
|
ax = radius; ay = 0;
|
||||||
bx = drill_rayon; by = 0;
|
bx = drill_radius; by = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ax = ay = (rayon * 707) / 1000;
|
ax = ay = (radius * 707) / 1000;
|
||||||
bx = by = (drill_rayon * 707) / 1000;
|
bx = by = (drill_radius * 707) / 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* lines | or \ */
|
/* lines | or \ */
|
||||||
|
@ -934,7 +923,7 @@ void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint
|
||||||
// (so we can see superimposed buried vias ):
|
// (so we can see superimposed buried vias ):
|
||||||
if( Shape() == VIA_BLIND_BURIED )
|
if( Shape() == VIA_BLIND_BURIED )
|
||||||
{
|
{
|
||||||
int ax = 0, ay = rayon, bx = 0, by = drill_rayon;
|
int ax = 0, ay = radius, bx = 0, by = drill_radius;
|
||||||
int layer_top, layer_bottom;
|
int layer_top, layer_bottom;
|
||||||
|
|
||||||
( (SEGVIA*) this )->ReturnLayerPair( &layer_top, &layer_bottom );
|
( (SEGVIA*) this )->ReturnLayerPair( &layer_top, &layer_bottom );
|
||||||
|
@ -948,7 +937,7 @@ void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint
|
||||||
m_Start.y + aOffset.y - by, 0, color );
|
m_Start.y + aOffset.y - by, 0, color );
|
||||||
|
|
||||||
/* lines for the bottom layer */
|
/* lines for the bottom layer */
|
||||||
ax = 0; ay = rayon; bx = 0; by = drill_rayon;
|
ax = 0; ay = radius; bx = 0; by = drill_radius;
|
||||||
RotatePoint( &ax, &ay, layer_bottom * 3600 / brd->GetCopperLayerCount( ) );
|
RotatePoint( &ax, &ay, layer_bottom * 3600 / brd->GetCopperLayerCount( ) );
|
||||||
RotatePoint( &bx, &by, layer_bottom * 3600 / brd->GetCopperLayerCount( ) );
|
RotatePoint( &bx, &by, layer_bottom * 3600 / brd->GetCopperLayerCount( ) );
|
||||||
GRLine( &panel->m_ClipBox, DC, m_Start.x + aOffset.x - ax,
|
GRLine( &panel->m_ClipBox, DC, m_Start.x + aOffset.x - ax,
|
||||||
|
@ -960,13 +949,17 @@ void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint
|
||||||
// Display the short netname:
|
// Display the short netname:
|
||||||
if( GetNet() == 0 )
|
if( GetNet() == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( DisplayOpt.DisplayNetNamesMode == 0 || DisplayOpt.DisplayNetNamesMode == 1 )
|
if( DisplayOpt.DisplayNetNamesMode == 0 || DisplayOpt.DisplayNetNamesMode == 1 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
NETINFO_ITEM* net = ( (BOARD*) GetParent() )->FindNet( GetNet() );
|
NETINFO_ITEM* net = ( (BOARD*) GetParent() )->FindNet( GetNet() );
|
||||||
|
|
||||||
if( net == NULL )
|
if( net == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int len = net->GetShortNetname().Len();
|
int len = net->GetShortNetname().Len();
|
||||||
|
|
||||||
if( len > 0 )
|
if( len > 0 )
|
||||||
{
|
{
|
||||||
// calculate a good size for the text
|
// calculate a good size for the text
|
||||||
|
@ -998,9 +991,10 @@ void TRACK::DisplayInfo( EDA_DRAW_FRAME* frame )
|
||||||
{
|
{
|
||||||
int trackLen = 0;
|
int trackLen = 0;
|
||||||
int lenDie = 0;
|
int lenDie = 0;
|
||||||
Marque_Une_Piste( board, this, NULL, &trackLen, &lenDie, false );
|
MarkTrace( board, this, NULL, &trackLen, &lenDie, false );
|
||||||
msg = frame->CoordinateToString( trackLen );
|
msg = frame->CoordinateToString( trackLen );
|
||||||
frame->AppendMsgPanel( _( "Track Len" ), msg, DARKCYAN );
|
frame->AppendMsgPanel( _( "Track Len" ), msg, DARKCYAN );
|
||||||
|
|
||||||
if( lenDie != 0 )
|
if( lenDie != 0 )
|
||||||
{
|
{
|
||||||
msg = frame->CoordinateToString( trackLen + lenDie );
|
msg = frame->CoordinateToString( trackLen + lenDie );
|
||||||
|
@ -1092,6 +1086,7 @@ void TRACK::DisplayInfoBase( EDA_DRAW_FRAME* frame )
|
||||||
|
|
||||||
/* Display the State member */
|
/* Display the State member */
|
||||||
msg = wxT( ". . " );
|
msg = wxT( ". . " );
|
||||||
|
|
||||||
if( GetState( TRACK_LOCKED ) )
|
if( GetState( TRACK_LOCKED ) )
|
||||||
msg[0] = 'F';
|
msg[0] = 'F';
|
||||||
|
|
||||||
|
@ -1107,11 +1102,12 @@ void TRACK::DisplayInfoBase( EDA_DRAW_FRAME* frame )
|
||||||
int top_layer, bottom_layer;
|
int top_layer, bottom_layer;
|
||||||
|
|
||||||
Via->ReturnLayerPair( &top_layer, &bottom_layer );
|
Via->ReturnLayerPair( &top_layer, &bottom_layer );
|
||||||
msg = board->GetLayerName( top_layer ) + wxT( "/" )
|
msg = board->GetLayerName( top_layer ) + wxT( "/" ) + board->GetLayerName( bottom_layer );
|
||||||
+ board->GetLayerName( bottom_layer );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
msg = board->GetLayerName( m_Layer );
|
msg = board->GetLayerName( m_Layer );
|
||||||
|
}
|
||||||
|
|
||||||
frame->AppendMsgPanel( _( "Layer" ), msg, BROWN );
|
frame->AppendMsgPanel( _( "Layer" ), msg, BROWN );
|
||||||
|
|
||||||
|
@ -1172,8 +1168,7 @@ bool TRACK::HitTest( const wxPoint& refPos )
|
||||||
|
|
||||||
if( Type() == TYPE_VIA )
|
if( Type() == TYPE_VIA )
|
||||||
{
|
{
|
||||||
return (double) spot_cX * spot_cX + (double) spot_cY * spot_cY <=
|
return (double) spot_cX * spot_cX + (double) spot_cY * spot_cY <= (double) radius * radius;
|
||||||
(double) radius * radius;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1196,8 +1191,10 @@ bool TRACK::HitTest( EDA_RECT& refArea )
|
||||||
{
|
{
|
||||||
if( refArea.Contains( m_Start ) )
|
if( refArea.Contains( m_Start ) )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if( refArea.Contains( m_End ) )
|
if( refArea.Contains( m_End ) )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1305,11 +1302,11 @@ void SEGVIA::Show( int nestLevel, std::ostream& os )
|
||||||
if( board )
|
if( board )
|
||||||
os << " layers=\"" << board->GetLayerName( topLayer ).Trim().mb_str() << ","
|
os << " layers=\"" << board->GetLayerName( topLayer ).Trim().mb_str() << ","
|
||||||
<< board->GetLayerName( botLayer ).Trim().mb_str() << '"';
|
<< board->GetLayerName( botLayer ).Trim().mb_str() << '"';
|
||||||
os <<
|
|
||||||
" width=\"" << m_Width << '"' <<
|
os << " width=\"" << m_Width << '"'
|
||||||
" drill=\"" << GetDrillValue() << '"' <<
|
<< " drill=\"" << GetDrillValue() << '"'
|
||||||
" netcode=\"" << GetNet() << "\">" <<
|
<< " netcode=\"" << GetNet() << "\">"
|
||||||
"<pos" << m_Start << "/>";
|
<< "<pos" << m_Start << "/>";
|
||||||
|
|
||||||
os << "</" << GetClass().Lower().mb_str() << ">\n";
|
os << "</" << GetClass().Lower().mb_str() << ">\n";
|
||||||
}
|
}
|
||||||
|
@ -1321,26 +1318,37 @@ wxString TRACK::ShowState( int stateBits )
|
||||||
|
|
||||||
if( stateBits & IS_LINKED )
|
if( stateBits & IS_LINKED )
|
||||||
ret << wxT( " | IS_LINKED" );
|
ret << wxT( " | IS_LINKED" );
|
||||||
|
|
||||||
if( stateBits & TRACK_AR )
|
if( stateBits & TRACK_AR )
|
||||||
ret << wxT( " | TRACK_AR" );
|
ret << wxT( " | TRACK_AR" );
|
||||||
|
|
||||||
if( stateBits & TRACK_LOCKED )
|
if( stateBits & TRACK_LOCKED )
|
||||||
ret << wxT( " | TRACK_LOCKED" );
|
ret << wxT( " | TRACK_LOCKED" );
|
||||||
|
|
||||||
if( stateBits & IN_EDIT )
|
if( stateBits & IN_EDIT )
|
||||||
ret << wxT( " | IN_EDIT" );
|
ret << wxT( " | IN_EDIT" );
|
||||||
|
|
||||||
if( stateBits & IS_DRAGGED )
|
if( stateBits & IS_DRAGGED )
|
||||||
ret << wxT( " | IS_DRAGGED" );
|
ret << wxT( " | IS_DRAGGED" );
|
||||||
|
|
||||||
if( stateBits & DO_NOT_DRAW )
|
if( stateBits & DO_NOT_DRAW )
|
||||||
ret << wxT( " | DO_NOT_DRAW" );
|
ret << wxT( " | DO_NOT_DRAW" );
|
||||||
|
|
||||||
if( stateBits & IS_DELETED )
|
if( stateBits & IS_DELETED )
|
||||||
ret << wxT( " | IS_DELETED" );
|
ret << wxT( " | IS_DELETED" );
|
||||||
|
|
||||||
if( stateBits & BUSY )
|
if( stateBits & BUSY )
|
||||||
ret << wxT( " | BUSY" );
|
ret << wxT( " | BUSY" );
|
||||||
|
|
||||||
if( stateBits & END_ONPAD )
|
if( stateBits & END_ONPAD )
|
||||||
ret << wxT( " | END_ONPAD" );
|
ret << wxT( " | END_ONPAD" );
|
||||||
|
|
||||||
if( stateBits & BEGIN_ONPAD )
|
if( stateBits & BEGIN_ONPAD )
|
||||||
ret << wxT( " | BEGIN_ONPAD" );
|
ret << wxT( " | BEGIN_ONPAD" );
|
||||||
|
|
||||||
if( stateBits & FLAG0 )
|
if( stateBits & FLAG0 )
|
||||||
ret << wxT( " | FLAG0" );
|
ret << wxT( " | FLAG0" );
|
||||||
|
|
||||||
if( stateBits & FLAG1 )
|
if( stateBits & FLAG1 )
|
||||||
ret << wxT( " | FLAG1" );
|
ret << wxT( " | FLAG1" );
|
||||||
|
|
||||||
|
|
|
@ -77,41 +77,42 @@ wxPoint& ZONE_CONTAINER::GetPosition()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
pos = wxPoint( 0, 0 );
|
pos = wxPoint( 0, 0 );
|
||||||
|
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************/
|
|
||||||
void ZONE_CONTAINER::SetNet( int anet_code )
|
|
||||||
{
|
|
||||||
/*******************************************/
|
|
||||||
/**
|
/**
|
||||||
* Set the netcode and the netname
|
* Set the netcode and the netname
|
||||||
* if netcode >= 0, set the netname
|
* if netcode >= 0, set the netname
|
||||||
* if netcode < 0: keep old netname (used to set an necode error flag)
|
* if netcode < 0: keep old netname (used to set an necode error flag)
|
||||||
*/
|
*/
|
||||||
|
void ZONE_CONTAINER::SetNet( int anet_code )
|
||||||
|
{
|
||||||
m_NetCode = anet_code;
|
m_NetCode = anet_code;
|
||||||
|
|
||||||
if( anet_code < 0 )
|
if( anet_code < 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BOARD* board = GetBoard();
|
BOARD* board = GetBoard();
|
||||||
|
|
||||||
if( board )
|
if( board )
|
||||||
{
|
{
|
||||||
NETINFO_ITEM* net = board->FindNet( anet_code );
|
NETINFO_ITEM* net = board->FindNet( anet_code );
|
||||||
|
|
||||||
if( net )
|
if( net )
|
||||||
m_Netname = net->GetNetname();
|
m_Netname = net->GetNetname();
|
||||||
else
|
else
|
||||||
m_Netname.Empty();
|
m_Netname.Empty();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
m_Netname.Empty();
|
m_Netname.Empty();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************************/
|
|
||||||
bool ZONE_CONTAINER::Save( FILE* aFile ) const
|
bool ZONE_CONTAINER::Save( FILE* aFile ) const
|
||||||
/********************************************/
|
|
||||||
{
|
{
|
||||||
unsigned item_pos;
|
unsigned item_pos;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -125,11 +126,13 @@ bool ZONE_CONTAINER::Save( FILE* aFile ) const
|
||||||
ret = fprintf( aFile, "ZInfo %8.8lX %d %s\n",
|
ret = fprintf( aFile, "ZInfo %8.8lX %d %s\n",
|
||||||
m_TimeStamp, m_NetCode,
|
m_TimeStamp, m_NetCode,
|
||||||
EscapedUTF8( m_Netname ).c_str() );
|
EscapedUTF8( m_Netname ).c_str() );
|
||||||
|
|
||||||
if( ret < 3 )
|
if( ret < 3 )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Save the outline layer info
|
// Save the outline layer info
|
||||||
ret = fprintf( aFile, "ZLayer %d\n", m_Layer );
|
ret = fprintf( aFile, "ZLayer %d\n", m_Layer );
|
||||||
|
|
||||||
if( ret < 1 )
|
if( ret < 1 )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -151,6 +154,7 @@ bool ZONE_CONTAINER::Save( FILE* aFile ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = fprintf( aFile, "ZAux %d %c\n", corners_count, outline_hatch );
|
ret = fprintf( aFile, "ZAux %d %c\n", corners_count, outline_hatch );
|
||||||
|
|
||||||
if( ret < 2 )
|
if( ret < 2 )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -172,10 +176,12 @@ bool ZONE_CONTAINER::Save( FILE* aFile ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = fprintf( aFile, "ZClearance %d %c\n", m_ZoneClearance, padoption );
|
ret = fprintf( aFile, "ZClearance %d %c\n", m_ZoneClearance, padoption );
|
||||||
|
|
||||||
if( ret < 2 )
|
if( ret < 2 )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
ret = fprintf( aFile, "ZMinThickness %d\n", m_ZoneMinThickness );
|
ret = fprintf( aFile, "ZMinThickness %d\n", m_ZoneMinThickness );
|
||||||
|
|
||||||
if( ret < 1 )
|
if( ret < 1 )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -186,12 +192,14 @@ bool ZONE_CONTAINER::Save( FILE* aFile ) const
|
||||||
m_IsFilled ? 'S' : 'F',
|
m_IsFilled ? 'S' : 'F',
|
||||||
m_ThermalReliefGapValue,
|
m_ThermalReliefGapValue,
|
||||||
m_ThermalReliefCopperBridgeValue );
|
m_ThermalReliefCopperBridgeValue );
|
||||||
|
|
||||||
if( ret < 3 )
|
if( ret < 3 )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
ret = fprintf( aFile,
|
ret = fprintf( aFile,
|
||||||
"ZSmoothing %d %d\n",
|
"ZSmoothing %d %d\n",
|
||||||
cornerSmoothingType, cornerRadius );
|
cornerSmoothingType, cornerRadius );
|
||||||
|
|
||||||
if( ret < 2 )
|
if( ret < 2 )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -201,6 +209,7 @@ bool ZONE_CONTAINER::Save( FILE* aFile ) const
|
||||||
ret = fprintf( aFile, "ZCorner %d %d %d\n",
|
ret = fprintf( aFile, "ZCorner %d %d %d\n",
|
||||||
m_Poly->corner[item_pos].x, m_Poly->corner[item_pos].y,
|
m_Poly->corner[item_pos].x, m_Poly->corner[item_pos].y,
|
||||||
m_Poly->corner[item_pos].end_contour );
|
m_Poly->corner[item_pos].end_contour );
|
||||||
|
|
||||||
if( ret < 3 )
|
if( ret < 3 )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -209,6 +218,7 @@ bool ZONE_CONTAINER::Save( FILE* aFile ) const
|
||||||
if( m_FilledPolysList.size() )
|
if( m_FilledPolysList.size() )
|
||||||
{
|
{
|
||||||
fprintf( aFile, "$POLYSCORNERS\n" );
|
fprintf( aFile, "$POLYSCORNERS\n" );
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < m_FilledPolysList.size(); ii++ )
|
for( unsigned ii = 0; ii < m_FilledPolysList.size(); ii++ )
|
||||||
{
|
{
|
||||||
const CPolyPt* corner = &m_FilledPolysList[ii];
|
const CPolyPt* corner = &m_FilledPolysList[ii];
|
||||||
|
@ -218,6 +228,7 @@ bool ZONE_CONTAINER::Save( FILE* aFile ) const
|
||||||
corner->y,
|
corner->y,
|
||||||
corner->end_contour,
|
corner->end_contour,
|
||||||
corner->utility );
|
corner->utility );
|
||||||
|
|
||||||
if( ret < 4 )
|
if( ret < 4 )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -229,27 +240,28 @@ bool ZONE_CONTAINER::Save( FILE* aFile ) const
|
||||||
if( m_FillSegmList.size() )
|
if( m_FillSegmList.size() )
|
||||||
{
|
{
|
||||||
fprintf( aFile, "$FILLSEGMENTS\n" );
|
fprintf( aFile, "$FILLSEGMENTS\n" );
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < m_FillSegmList.size(); ii++ )
|
for( unsigned ii = 0; ii < m_FillSegmList.size(); ii++ )
|
||||||
{
|
{
|
||||||
ret = fprintf( aFile, "%d %d %d %d\n",
|
ret = fprintf( aFile, "%d %d %d %d\n",
|
||||||
m_FillSegmList[ii].m_Start.x, m_FillSegmList[ii].m_Start.y,
|
m_FillSegmList[ii].m_Start.x, m_FillSegmList[ii].m_Start.y,
|
||||||
m_FillSegmList[ii].m_End.x, m_FillSegmList[ii].m_End.y );
|
m_FillSegmList[ii].m_End.x, m_FillSegmList[ii].m_End.y );
|
||||||
|
|
||||||
if( ret < 4 )
|
if( ret < 4 )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf( aFile, "$endFILLSEGMENTS\n" );
|
fprintf( aFile, "$endFILLSEGMENTS\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf( aFile, "$endCZONE_OUTLINE\n" );
|
fprintf( aFile, "$endCZONE_OUTLINE\n" );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************/
|
|
||||||
int ZONE_CONTAINER::ReadDescr( LINE_READER* aReader )
|
int ZONE_CONTAINER::ReadDescr( LINE_READER* aReader )
|
||||||
{
|
{
|
||||||
/**********************************************************/
|
|
||||||
char* Line, * text;
|
char* Line, * text;
|
||||||
char netname_buffer[1024];
|
char netname_buffer[1024];
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -257,9 +269,11 @@ int ZONE_CONTAINER::ReadDescr( LINE_READER* aReader )
|
||||||
bool error = false, has_corner = false;
|
bool error = false, has_corner = false;
|
||||||
|
|
||||||
netname_buffer[0] = 0;
|
netname_buffer[0] = 0;
|
||||||
|
|
||||||
while( aReader->ReadLine() )
|
while( aReader->ReadLine() )
|
||||||
{
|
{
|
||||||
Line = aReader->Line();
|
Line = aReader->Line();
|
||||||
|
|
||||||
if( strnicmp( Line, "ZCorner", 7 ) == 0 ) // new corner found
|
if( strnicmp( Line, "ZCorner", 7 ) == 0 ) // new corner found
|
||||||
{
|
{
|
||||||
int x;
|
int x;
|
||||||
|
@ -268,8 +282,11 @@ int ZONE_CONTAINER::ReadDescr( LINE_READER* aReader )
|
||||||
|
|
||||||
text = Line + 7;
|
text = Line + 7;
|
||||||
ret = sscanf( text, "%d %d %d", &x, &y, &flag );
|
ret = sscanf( text, "%d %d %d", &x, &y, &flag );
|
||||||
|
|
||||||
if( ret < 3 )
|
if( ret < 3 )
|
||||||
|
{
|
||||||
error = true;
|
error = true;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( !has_corner )
|
if( !has_corner )
|
||||||
|
@ -278,6 +295,7 @@ int ZONE_CONTAINER::ReadDescr( LINE_READER* aReader )
|
||||||
AppendCorner( wxPoint( x, y ) );
|
AppendCorner( wxPoint( x, y ) );
|
||||||
|
|
||||||
has_corner = true;
|
has_corner = true;
|
||||||
|
|
||||||
if( flag )
|
if( flag )
|
||||||
m_Poly->Close();
|
m_Poly->Close();
|
||||||
}
|
}
|
||||||
|
@ -289,8 +307,11 @@ int ZONE_CONTAINER::ReadDescr( LINE_READER* aReader )
|
||||||
|
|
||||||
text = Line + 5;
|
text = Line + 5;
|
||||||
ret = sscanf( text, "%X %d %s", &ts, &netcode, netname_buffer );
|
ret = sscanf( text, "%X %d %s", &ts, &netcode, netname_buffer );
|
||||||
|
|
||||||
if( ret < 3 )
|
if( ret < 3 )
|
||||||
|
{
|
||||||
error = true;
|
error = true;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_TimeStamp = ts;
|
m_TimeStamp = ts;
|
||||||
|
@ -305,6 +326,7 @@ int ZONE_CONTAINER::ReadDescr( LINE_READER* aReader )
|
||||||
|
|
||||||
text = Line + 6;
|
text = Line + 6;
|
||||||
ret = sscanf( text, "%d", &x );
|
ret = sscanf( text, "%d", &x );
|
||||||
|
|
||||||
if( ret < 1 )
|
if( ret < 1 )
|
||||||
error = true;
|
error = true;
|
||||||
else
|
else
|
||||||
|
@ -317,8 +339,11 @@ int ZONE_CONTAINER::ReadDescr( LINE_READER* aReader )
|
||||||
|
|
||||||
text = Line + 4;
|
text = Line + 4;
|
||||||
ret = sscanf( text, "%d %c", &x, hopt );
|
ret = sscanf( text, "%d %c", &x, hopt );
|
||||||
|
|
||||||
if( ret < 2 )
|
if( ret < 2 )
|
||||||
|
{
|
||||||
error = true;
|
error = true;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
switch( hopt[0] )
|
switch( hopt[0] )
|
||||||
|
@ -385,8 +410,11 @@ int ZONE_CONTAINER::ReadDescr( LINE_READER* aReader )
|
||||||
char padoption;
|
char padoption;
|
||||||
text = Line + 10;
|
text = Line + 10;
|
||||||
ret = sscanf( text, "%d %1c", &clearance, &padoption );
|
ret = sscanf( text, "%d %1c", &clearance, &padoption );
|
||||||
|
|
||||||
if( ret < 2 )
|
if( ret < 2 )
|
||||||
|
{
|
||||||
error = true;
|
error = true;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_ZoneClearance = clearance;
|
m_ZoneClearance = clearance;
|
||||||
|
@ -415,6 +443,7 @@ int ZONE_CONTAINER::ReadDescr( LINE_READER* aReader )
|
||||||
int thickness;
|
int thickness;
|
||||||
text = Line + 13;
|
text = Line + 13;
|
||||||
ret = sscanf( text, "%d", &thickness );
|
ret = sscanf( text, "%d", &thickness );
|
||||||
|
|
||||||
if( ret < 1 )
|
if( ret < 1 )
|
||||||
error = true;
|
error = true;
|
||||||
else
|
else
|
||||||
|
@ -425,8 +454,10 @@ int ZONE_CONTAINER::ReadDescr( LINE_READER* aReader )
|
||||||
while( aReader->ReadLine() )
|
while( aReader->ReadLine() )
|
||||||
{
|
{
|
||||||
Line = aReader->Line();
|
Line = aReader->Line();
|
||||||
|
|
||||||
if( strnicmp( Line, "$endPOLYSCORNERS", 4 ) == 0 )
|
if( strnicmp( Line, "$endPOLYSCORNERS", 4 ) == 0 )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
CPolyPt corner;
|
CPolyPt corner;
|
||||||
int end_contour, utility;
|
int end_contour, utility;
|
||||||
utility = 0;
|
utility = 0;
|
||||||
|
@ -438,6 +469,7 @@ int ZONE_CONTAINER::ReadDescr( LINE_READER* aReader )
|
||||||
&utility );
|
&utility );
|
||||||
if( ret < 4 )
|
if( ret < 4 )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
corner.end_contour = end_contour ? true : false;
|
corner.end_contour = end_contour ? true : false;
|
||||||
corner.utility = utility;
|
corner.utility = utility;
|
||||||
m_FilledPolysList.push_back( corner );
|
m_FilledPolysList.push_back( corner );
|
||||||
|
@ -449,8 +481,10 @@ int ZONE_CONTAINER::ReadDescr( LINE_READER* aReader )
|
||||||
while( aReader->ReadLine() )
|
while( aReader->ReadLine() )
|
||||||
{
|
{
|
||||||
Line = aReader->Line();
|
Line = aReader->Line();
|
||||||
|
|
||||||
if( strnicmp( Line, "$endFILLSEGMENTS", 4 ) == 0 )
|
if( strnicmp( Line, "$endFILLSEGMENTS", 4 ) == 0 )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
ret = sscanf( Line,
|
ret = sscanf( Line,
|
||||||
"%d %d %d %d",
|
"%d %d %d %d",
|
||||||
&segm.m_Start.x,
|
&segm.m_Start.x,
|
||||||
|
@ -459,6 +493,7 @@ int ZONE_CONTAINER::ReadDescr( LINE_READER* aReader )
|
||||||
&segm.m_End.y );
|
&segm.m_End.y );
|
||||||
if( ret < 4 )
|
if( ret < 4 )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_FillSegmList.push_back( segm );
|
m_FillSegmList.push_back( segm );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -492,8 +527,7 @@ void ZONE_CONTAINER::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int aDrawMode, const
|
||||||
BOARD* brd = GetBoard();
|
BOARD* brd = GetBoard();
|
||||||
int color = brd->GetLayerColor( m_Layer );
|
int color = brd->GetLayerColor( m_Layer );
|
||||||
|
|
||||||
if( brd->IsLayerVisible( m_Layer ) == false
|
if( brd->IsLayerVisible( m_Layer ) == false && ( color & HIGHLIGHT_FLAG ) != HIGHLIGHT_FLAG )
|
||||||
&& ( color & HIGHLIGHT_FLAG ) != HIGHLIGHT_FLAG )
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GRSetDrawMode( DC, aDrawMode );
|
GRSetDrawMode( DC, aDrawMode );
|
||||||
|
@ -514,6 +548,7 @@ void ZONE_CONTAINER::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int aDrawMode, const
|
||||||
else
|
else
|
||||||
color |= HIGHLIGHT_FLAG;
|
color |= HIGHLIGHT_FLAG;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( color & HIGHLIGHT_FLAG )
|
if( color & HIGHLIGHT_FLAG )
|
||||||
color = ColorRefs[color & MASKCOLOR].m_LightColor;
|
color = ColorRefs[color & MASKCOLOR].m_LightColor;
|
||||||
|
|
||||||
|
@ -528,7 +563,7 @@ void ZONE_CONTAINER::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int aDrawMode, const
|
||||||
{
|
{
|
||||||
seg_start = GetCornerPosition( ic ) + offset;
|
seg_start = GetCornerPosition( ic ) + offset;
|
||||||
|
|
||||||
if( m_Poly->corner[ic].end_contour == FALSE && ic < GetNumCorners() - 1 )
|
if( m_Poly->corner[ic].end_contour == false && ic < GetNumCorners() - 1 )
|
||||||
{
|
{
|
||||||
seg_end = GetCornerPosition( ic + 1 ) + offset;
|
seg_end = GetCornerPosition( ic + 1 ) + offset;
|
||||||
}
|
}
|
||||||
|
@ -537,6 +572,7 @@ void ZONE_CONTAINER::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int aDrawMode, const
|
||||||
seg_end = GetCornerPosition( i_start_contour ) + offset;
|
seg_end = GetCornerPosition( i_start_contour ) + offset;
|
||||||
i_start_contour = ic + 1;
|
i_start_contour = ic + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
lines.push_back( seg_start );
|
lines.push_back( seg_start );
|
||||||
lines.push_back( seg_end );
|
lines.push_back( seg_end );
|
||||||
}
|
}
|
||||||
|
@ -561,11 +597,6 @@ void ZONE_CONTAINER::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int aDrawMode, const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************************/
|
|
||||||
void ZONE_CONTAINER::DrawFilledArea( EDA_DRAW_PANEL* panel,
|
|
||||||
wxDC* DC, int aDrawMode, const wxPoint& offset )
|
|
||||||
{
|
|
||||||
/************************************************************************************/
|
|
||||||
/**
|
/**
|
||||||
* Function DrawDrawFilledArea
|
* Function DrawDrawFilledArea
|
||||||
* Draws the filled areas for this zone (polygon list .m_FilledPolysList)
|
* Draws the filled areas for this zone (polygon list .m_FilledPolysList)
|
||||||
|
@ -574,6 +605,9 @@ void ZONE_CONTAINER::DrawFilledArea( EDA_DRAW_PANEL* panel,
|
||||||
* @param offset = Draw offset (usually wxPoint(0,0))
|
* @param offset = Draw offset (usually wxPoint(0,0))
|
||||||
* @param aDrawMode = GR_OR, GR_XOR, GR_COPY ..
|
* @param aDrawMode = GR_OR, GR_XOR, GR_COPY ..
|
||||||
*/
|
*/
|
||||||
|
void ZONE_CONTAINER::DrawFilledArea( EDA_DRAW_PANEL* panel,
|
||||||
|
wxDC* DC, int aDrawMode, const wxPoint& offset )
|
||||||
|
{
|
||||||
static vector <char> CornersTypeBuffer;
|
static vector <char> CornersTypeBuffer;
|
||||||
static vector <wxPoint> CornersBuffer;
|
static vector <wxPoint> CornersBuffer;
|
||||||
|
|
||||||
|
@ -615,6 +649,7 @@ void ZONE_CONTAINER::DrawFilledArea( EDA_DRAW_PANEL* panel,
|
||||||
else
|
else
|
||||||
color |= HIGHLIGHT_FLAG;
|
color |= HIGHLIGHT_FLAG;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( color & HIGHLIGHT_FLAG )
|
if( color & HIGHLIGHT_FLAG )
|
||||||
color = ColorRefs[color & MASKCOLOR].m_LightColor;
|
color = ColorRefs[color & MASKCOLOR].m_LightColor;
|
||||||
|
|
||||||
|
@ -625,6 +660,7 @@ void ZONE_CONTAINER::DrawFilledArea( EDA_DRAW_PANEL* panel,
|
||||||
|
|
||||||
// Draw all filled areas
|
// Draw all filled areas
|
||||||
int imax = m_FilledPolysList.size() - 1;
|
int imax = m_FilledPolysList.size() - 1;
|
||||||
|
|
||||||
for( int ic = 0; ic <= imax; ic++ )
|
for( int ic = 0; ic <= imax; ic++ )
|
||||||
{
|
{
|
||||||
CPolyPt* corner = &m_FilledPolysList[ic];
|
CPolyPt* corner = &m_FilledPolysList[ic];
|
||||||
|
@ -649,6 +685,7 @@ void ZONE_CONTAINER::DrawFilledArea( EDA_DRAW_PANEL* panel,
|
||||||
if( (m_ZoneMinThickness > 1) || outline_mode )
|
if( (m_ZoneMinThickness > 1) || outline_mode )
|
||||||
{
|
{
|
||||||
int ilim = CornersBuffer.size() - 1;
|
int ilim = CornersBuffer.size() - 1;
|
||||||
|
|
||||||
for( int is = 0, ie = ilim; is <= ilim; ie = is, is++ )
|
for( int is = 0, ie = ilim; is <= ilim; ie = is, is++ )
|
||||||
{
|
{
|
||||||
int x0 = CornersBuffer[is].x;
|
int x0 = CornersBuffer[is].x;
|
||||||
|
@ -675,6 +712,7 @@ void ZONE_CONTAINER::DrawFilledArea( EDA_DRAW_PANEL* panel,
|
||||||
GRPoly( &panel->m_ClipBox, DC, CornersBuffer.size(), &CornersBuffer[0],
|
GRPoly( &panel->m_ClipBox, DC, CornersBuffer.size(), &CornersBuffer[0],
|
||||||
true, 0, color, color );
|
true, 0, color, color );
|
||||||
}
|
}
|
||||||
|
|
||||||
CornersTypeBuffer.clear();
|
CornersTypeBuffer.clear();
|
||||||
CornersBuffer.clear();
|
CornersBuffer.clear();
|
||||||
}
|
}
|
||||||
|
@ -725,10 +763,6 @@ EDA_RECT ZONE_CONTAINER::GetBoundingBox() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************************************/
|
|
||||||
void ZONE_CONTAINER::DrawWhileCreateOutline( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode )
|
|
||||||
{
|
|
||||||
/***********************************************************************************************/
|
|
||||||
/**
|
/**
|
||||||
* Function DrawWhileCreateOutline
|
* Function DrawWhileCreateOutline
|
||||||
* Draws the zone outline when ir is created.
|
* Draws the zone outline when ir is created.
|
||||||
|
@ -739,12 +773,15 @@ void ZONE_CONTAINER::DrawWhileCreateOutline( EDA_DRAW_PANEL* panel, wxDC* DC, in
|
||||||
* @param DC = current Device Context
|
* @param DC = current Device Context
|
||||||
* @param draw_mode = draw mode: OR, XOR ..
|
* @param draw_mode = draw mode: OR, XOR ..
|
||||||
*/
|
*/
|
||||||
|
void ZONE_CONTAINER::DrawWhileCreateOutline( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode )
|
||||||
|
{
|
||||||
int current_gr_mode = draw_mode;
|
int current_gr_mode = draw_mode;
|
||||||
bool is_close_segment = false;
|
bool is_close_segment = false;
|
||||||
wxPoint seg_start, seg_end;
|
wxPoint seg_start, seg_end;
|
||||||
|
|
||||||
if( DC == NULL )
|
if( DC == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
|
int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
|
||||||
BOARD* brd = GetBoard();
|
BOARD* brd = GetBoard();
|
||||||
int color = brd->GetLayerColor( m_Layer ) & MASKCOLOR;
|
int color = brd->GetLayerColor( m_Layer ) & MASKCOLOR;
|
||||||
|
@ -758,20 +795,22 @@ void ZONE_CONTAINER::DrawWhileCreateOutline( EDA_DRAW_PANEL* panel, wxDC* DC, in
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// draw the lines
|
// draw the lines
|
||||||
wxPoint start_contour_pos = GetCornerPosition( 0 );
|
wxPoint start_contour_pos = GetCornerPosition( 0 );
|
||||||
int icmax = GetNumCorners() - 1;
|
int icmax = GetNumCorners() - 1;
|
||||||
|
|
||||||
for( int ic = 0; ic <= icmax; ic++ )
|
for( int ic = 0; ic <= icmax; ic++ )
|
||||||
{
|
{
|
||||||
int xi = GetCornerPosition( ic ).x;
|
int xi = GetCornerPosition( ic ).x;
|
||||||
int yi = GetCornerPosition( ic ).y;
|
int yi = GetCornerPosition( ic ).y;
|
||||||
int xf, yf;
|
int xf, yf;
|
||||||
if( m_Poly->corner[ic].end_contour == FALSE && ic < icmax )
|
|
||||||
|
if( m_Poly->corner[ic].end_contour == false && ic < icmax )
|
||||||
{
|
{
|
||||||
is_close_segment = false;
|
is_close_segment = false;
|
||||||
xf = GetCornerPosition( ic + 1 ).x;
|
xf = GetCornerPosition( ic + 1 ).x;
|
||||||
yf = GetCornerPosition( ic + 1 ).y;
|
yf = GetCornerPosition( ic + 1 ).y;
|
||||||
|
|
||||||
if( (m_Poly->corner[ic + 1].end_contour) || (ic == icmax - 1) )
|
if( (m_Poly->corner[ic + 1].end_contour) || (ic == icmax - 1) )
|
||||||
current_gr_mode = GR_XOR;
|
current_gr_mode = GR_XOR;
|
||||||
else
|
else
|
||||||
|
@ -788,7 +827,9 @@ void ZONE_CONTAINER::DrawWhileCreateOutline( EDA_DRAW_PANEL* panel, wxDC* DC, in
|
||||||
if( ic < icmax )
|
if( ic < icmax )
|
||||||
start_contour_pos = GetCornerPosition( ic + 1 );
|
start_contour_pos = GetCornerPosition( ic + 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
GRSetDrawMode( DC, current_gr_mode );
|
GRSetDrawMode( DC, current_gr_mode );
|
||||||
|
|
||||||
if( is_close_segment )
|
if( is_close_segment )
|
||||||
GRLine( &panel->m_ClipBox, DC, xi, yi, xf, yf, 0, WHITE );
|
GRLine( &panel->m_ClipBox, DC, xi, yi, xf, yf, 0, WHITE );
|
||||||
else
|
else
|
||||||
|
@ -808,6 +849,7 @@ bool ZONE_CONTAINER::HitTest( const wxPoint& refPos )
|
||||||
{
|
{
|
||||||
if( HitTestForCorner( refPos ) )
|
if( HitTestForCorner( refPos ) )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if( HitTestForEdge( refPos ) )
|
if( HitTestForEdge( refPos ) )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -830,6 +872,7 @@ bool ZONE_CONTAINER::HitTestForCorner( const wxPoint& refPos )
|
||||||
|
|
||||||
#define CORNER_MIN_DIST 100 // distance (in internal units) to detect a corner in a zone outline
|
#define CORNER_MIN_DIST 100 // distance (in internal units) to detect a corner in a zone outline
|
||||||
int min_dist = CORNER_MIN_DIST + 1;
|
int min_dist = CORNER_MIN_DIST + 1;
|
||||||
|
|
||||||
if( GetBoard() && GetBoard()->m_PcbFrame )
|
if( GetBoard() && GetBoard()->m_PcbFrame )
|
||||||
{
|
{
|
||||||
// Use grid size because it is known
|
// Use grid size because it is known
|
||||||
|
@ -839,12 +882,14 @@ bool ZONE_CONTAINER::HitTestForCorner( const wxPoint& refPos )
|
||||||
|
|
||||||
wxPoint delta;
|
wxPoint delta;
|
||||||
unsigned lim = m_Poly->corner.size();
|
unsigned lim = m_Poly->corner.size();
|
||||||
|
|
||||||
for( unsigned item_pos = 0; item_pos < lim; item_pos++ )
|
for( unsigned item_pos = 0; item_pos < lim; item_pos++ )
|
||||||
{
|
{
|
||||||
delta.x = refPos.x - m_Poly->corner[item_pos].x;
|
delta.x = refPos.x - m_Poly->corner[item_pos].x;
|
||||||
delta.y = refPos.y - m_Poly->corner[item_pos].y;
|
delta.y = refPos.y - m_Poly->corner[item_pos].y;
|
||||||
// Calculate a distance:
|
// Calculate a distance:
|
||||||
int dist = MAX( abs( delta.x ), abs( delta.y ) );
|
int dist = MAX( abs( delta.x ), abs( delta.y ) );
|
||||||
|
|
||||||
if( dist < min_dist ) // this corner is a candidate:
|
if( dist < min_dist ) // this corner is a candidate:
|
||||||
{
|
{
|
||||||
m_CornerSelection = item_pos;
|
m_CornerSelection = item_pos;
|
||||||
|
@ -874,6 +919,7 @@ bool ZONE_CONTAINER::HitTestForEdge( const wxPoint& refPos )
|
||||||
|
|
||||||
#define EDGE_MIN_DIST 200 // distance (in internal units) to detect a zone outline
|
#define EDGE_MIN_DIST 200 // distance (in internal units) to detect a zone outline
|
||||||
int min_dist = EDGE_MIN_DIST+1;
|
int min_dist = EDGE_MIN_DIST+1;
|
||||||
|
|
||||||
if( GetBoard() && GetBoard()->m_PcbFrame )
|
if( GetBoard() && GetBoard()->m_PcbFrame )
|
||||||
{
|
{
|
||||||
// Use grid size because it is known
|
// Use grid size because it is known
|
||||||
|
@ -882,6 +928,7 @@ bool ZONE_CONTAINER::HitTestForEdge( const wxPoint& refPos )
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned first_corner_pos = 0;
|
unsigned first_corner_pos = 0;
|
||||||
|
|
||||||
for( unsigned item_pos = 0; item_pos < lim; item_pos++ )
|
for( unsigned item_pos = 0; item_pos < lim; item_pos++ )
|
||||||
{
|
{
|
||||||
unsigned end_segm = item_pos + 1;
|
unsigned end_segm = item_pos + 1;
|
||||||
|
@ -904,6 +951,7 @@ bool ZONE_CONTAINER::HitTestForEdge( const wxPoint& refPos )
|
||||||
m_Poly->corner[item_pos].y,
|
m_Poly->corner[item_pos].y,
|
||||||
m_Poly->corner[end_segm].x,
|
m_Poly->corner[end_segm].x,
|
||||||
m_Poly->corner[end_segm].y );
|
m_Poly->corner[end_segm].y );
|
||||||
|
|
||||||
if( dist < min_dist )
|
if( dist < min_dist )
|
||||||
{
|
{
|
||||||
m_CornerSelection = item_pos;
|
m_CornerSelection = item_pos;
|
||||||
|
@ -929,10 +977,13 @@ bool ZONE_CONTAINER::HitTest( EDA_RECT& refArea )
|
||||||
|
|
||||||
if( rect.left < refArea.GetX() )
|
if( rect.left < refArea.GetX() )
|
||||||
is_out_of_box = true;
|
is_out_of_box = true;
|
||||||
|
|
||||||
if( rect.top < refArea.GetY() )
|
if( rect.top < refArea.GetY() )
|
||||||
is_out_of_box = true;
|
is_out_of_box = true;
|
||||||
|
|
||||||
if( rect.right > refArea.GetRight() )
|
if( rect.right > refArea.GetRight() )
|
||||||
is_out_of_box = true;
|
is_out_of_box = true;
|
||||||
|
|
||||||
if( rect.bottom > refArea.GetBottom() )
|
if( rect.bottom > refArea.GetBottom() )
|
||||||
is_out_of_box = true;
|
is_out_of_box = true;
|
||||||
|
|
||||||
|
@ -1011,6 +1062,7 @@ void ZONE_CONTAINER::DisplayInfo( EDA_DRAW_FRAME* frame )
|
||||||
msg = _( "Zone Outline" );
|
msg = _( "Zone Outline" );
|
||||||
|
|
||||||
int ncont = m_Poly->GetContour( m_CornerSelection );
|
int ncont = m_Poly->GetContour( m_CornerSelection );
|
||||||
|
|
||||||
if( ncont )
|
if( ncont )
|
||||||
msg << wxT( " " ) << _( "(Cutout)" );
|
msg << wxT( " " ) << _( "(Cutout)" );
|
||||||
|
|
||||||
|
@ -1037,7 +1089,9 @@ void ZONE_CONTAINER::DisplayInfo( EDA_DRAW_FRAME* frame )
|
||||||
frame->AppendMsgPanel( _( "NetName" ), msg, RED );
|
frame->AppendMsgPanel( _( "NetName" ), msg, RED );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
frame->AppendMsgPanel( _( "Non Copper Zone" ), wxEmptyString, RED );
|
frame->AppendMsgPanel( _( "Non Copper Zone" ), wxEmptyString, RED );
|
||||||
|
}
|
||||||
|
|
||||||
/* Display net code : (useful in test or debug) */
|
/* Display net code : (useful in test or debug) */
|
||||||
msg.Printf( wxT( "%d" ), GetNet() );
|
msg.Printf( wxT( "%d" ), GetNet() );
|
||||||
|
@ -1053,6 +1107,7 @@ void ZONE_CONTAINER::DisplayInfo( EDA_DRAW_FRAME* frame )
|
||||||
msg.Printf( _( "Segments" ), m_FillMode );
|
msg.Printf( _( "Segments" ), m_FillMode );
|
||||||
else
|
else
|
||||||
msg = _( "Polygons" );
|
msg = _( "Polygons" );
|
||||||
|
|
||||||
frame->AppendMsgPanel( _( "Fill mode" ), msg, BROWN );
|
frame->AppendMsgPanel( _( "Fill mode" ), msg, BROWN );
|
||||||
|
|
||||||
// Useful for statistics :
|
// Useful for statistics :
|
||||||
|
@ -1119,7 +1174,10 @@ void ZONE_CONTAINER::MoveEdge( const wxPoint& offset )
|
||||||
ii = m_Poly->GetContourStart( icont );
|
ii = m_Poly->GetContourStart( icont );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
ii++;
|
ii++;
|
||||||
|
}
|
||||||
|
|
||||||
SetCornerPosition( ii, GetCornerPosition( ii ) + offset );
|
SetCornerPosition( ii, GetCornerPosition( ii ) + offset );
|
||||||
|
|
||||||
m_Poly->Hatch();
|
m_Poly->Hatch();
|
||||||
|
|
|
@ -281,7 +281,7 @@ public:
|
||||||
* @param verbose = true to show error messages
|
* @param verbose = true to show error messages
|
||||||
* @return error level (0 = no error)
|
* @return error level (0 = no error)
|
||||||
*/
|
*/
|
||||||
int Fill_Zone( PCB_EDIT_FRAME* frame, wxDC* DC, bool verbose = TRUE );
|
int Fill_Zone( PCB_EDIT_FRAME* frame, wxDC* DC, bool verbose = true );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Fill_Zone_Areas_With_Segments
|
* Function Fill_Zone_Areas_With_Segments
|
||||||
|
|
173
pcbnew/clean.cpp
173
pcbnew/clean.cpp
|
@ -31,17 +31,17 @@ static void ConnectDanglingEndToVia( BOARD* pcb );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*****************************************/
|
|
||||||
void PCB_EDIT_FRAME::Clean_Pcb( wxDC* DC )
|
|
||||||
/*****************************************/
|
|
||||||
/* Install the track operation dialog frame
|
/* Install the track operation dialog frame
|
||||||
*/
|
*/
|
||||||
|
void PCB_EDIT_FRAME::Clean_Pcb( wxDC* DC )
|
||||||
{
|
{
|
||||||
DIALOG_CLEANING_OPTIONS::connectToPads = false;
|
DIALOG_CLEANING_OPTIONS::connectToPads = false;
|
||||||
DIALOG_CLEANING_OPTIONS dlg( this );
|
DIALOG_CLEANING_OPTIONS dlg( this );
|
||||||
|
|
||||||
if( dlg.ShowModal() == wxID_OK )
|
if( dlg.ShowModal() == wxID_OK )
|
||||||
Clean_Pcb_Items( this, DC, dlg.cleanVias, dlg.mergeSegments,
|
Clean_Pcb_Items( this, DC, dlg.cleanVias, dlg.mergeSegments,
|
||||||
dlg.deleteUnconnectedSegm, dlg.connectToPads );
|
dlg.deleteUnconnectedSegm, dlg.connectToPads );
|
||||||
|
|
||||||
DrawPanel->Refresh( true );
|
DrawPanel->Refresh( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,6 +115,7 @@ void Clean_Pcb_Items( PCB_EDIT_FRAME* frame, wxDC* DC,
|
||||||
frame->OnModify();
|
frame->OnModify();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void clean_vias( BOARD * aPcb )
|
void clean_vias( BOARD * aPcb )
|
||||||
{
|
{
|
||||||
TRACK* track;
|
TRACK* track;
|
||||||
|
@ -127,9 +128,11 @@ void clean_vias( BOARD * aPcb )
|
||||||
|
|
||||||
// Search and delete others vias at same location
|
// Search and delete others vias at same location
|
||||||
TRACK* alt_track = track->Next();
|
TRACK* alt_track = track->Next();
|
||||||
|
|
||||||
for( ; alt_track != NULL; alt_track = next_track )
|
for( ; alt_track != NULL; alt_track = next_track )
|
||||||
{
|
{
|
||||||
next_track = alt_track->Next();
|
next_track = alt_track->Next();
|
||||||
|
|
||||||
if( alt_track->m_Shape != VIA_THROUGH )
|
if( alt_track->m_Shape != VIA_THROUGH )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -146,11 +149,13 @@ void clean_vias( BOARD * aPcb )
|
||||||
for( track = aPcb->m_Track; track != NULL; track = next_track )
|
for( track = aPcb->m_Track; track != NULL; track = next_track )
|
||||||
{
|
{
|
||||||
next_track = track->Next();
|
next_track = track->Next();
|
||||||
|
|
||||||
if( track->m_Shape != VIA_THROUGH )
|
if( track->m_Shape != VIA_THROUGH )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
D_PAD* pad = Fast_Locate_Pad_Connecte( aPcb, track->m_Start, ALL_CU_LAYERS );
|
D_PAD* pad = Fast_Locate_Pad_Connecte( aPcb, track->m_Start, ALL_CU_LAYERS );
|
||||||
if( pad && (pad->m_Masque_Layer & EXTERNAL_LAYERS) == EXTERNAL_LAYERS ) // redundant Via
|
|
||||||
|
if( pad && (pad->m_layerMask & EXTERNAL_LAYERS) == EXTERNAL_LAYERS ) // redundant Via
|
||||||
{
|
{
|
||||||
/* delete via */
|
/* delete via */
|
||||||
track->UnLink();
|
track->UnLink();
|
||||||
|
@ -160,15 +165,12 @@ void clean_vias( BOARD * aPcb )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
static void DeleteUnconnectedTracks( PCB_EDIT_FRAME* frame, wxDC* DC )
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Delete dangling tracks
|
* Delete dangling tracks
|
||||||
* Vias:
|
* Vias:
|
||||||
* If a via is only connected to a dangling track, it also will be removed
|
* If a via is only connected to a dangling track, it also will be removed
|
||||||
*/
|
*/
|
||||||
|
static void DeleteUnconnectedTracks( PCB_EDIT_FRAME* frame, wxDC* DC )
|
||||||
{
|
{
|
||||||
TRACK* segment;
|
TRACK* segment;
|
||||||
TRACK* other;
|
TRACK* other;
|
||||||
|
@ -181,7 +183,7 @@ static void DeleteUnconnectedTracks( PCB_EDIT_FRAME* frame, wxDC* DC )
|
||||||
if( frame->GetBoard()->m_Track == NULL )
|
if( frame->GetBoard()->m_Track == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
frame->DrawPanel->m_AbortRequest = FALSE;
|
frame->DrawPanel->m_AbortRequest = false;
|
||||||
|
|
||||||
// correct via m_End defects
|
// correct via m_End defects
|
||||||
for( segment = frame->GetBoard()->m_Track; segment; segment = next )
|
for( segment = frame->GetBoard()->m_Track; segment; segment = next )
|
||||||
|
@ -192,6 +194,7 @@ static void DeleteUnconnectedTracks( PCB_EDIT_FRAME* frame, wxDC* DC )
|
||||||
{
|
{
|
||||||
if( segment->m_Start != segment->m_End )
|
if( segment->m_Start != segment->m_End )
|
||||||
segment->m_End = segment->m_Start;
|
segment->m_End = segment->m_Start;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -199,6 +202,7 @@ static void DeleteUnconnectedTracks( PCB_EDIT_FRAME* frame, wxDC* DC )
|
||||||
// removal of unconnected tracks
|
// removal of unconnected tracks
|
||||||
segment = startNetcode = frame->GetBoard()->m_Track;
|
segment = startNetcode = frame->GetBoard()->m_Track;
|
||||||
oldnetcode = segment->GetNet();
|
oldnetcode = segment->GetNet();
|
||||||
|
|
||||||
for( int ii = 0; segment ; segment = next, ii++ )
|
for( int ii = 0; segment ; segment = next, ii++ )
|
||||||
{
|
{
|
||||||
next = segment->Next();
|
next = segment->Next();
|
||||||
|
@ -222,6 +226,7 @@ static void DeleteUnconnectedTracks( PCB_EDIT_FRAME* frame, wxDC* DC )
|
||||||
D_PAD* pad;
|
D_PAD* pad;
|
||||||
|
|
||||||
pad = Fast_Locate_Pad_Connecte( frame->GetBoard(), segment->m_Start, masklayer );
|
pad = Fast_Locate_Pad_Connecte( frame->GetBoard(), segment->m_Start, masklayer );
|
||||||
|
|
||||||
if( pad != NULL )
|
if( pad != NULL )
|
||||||
{
|
{
|
||||||
segment->start = pad;
|
segment->start = pad;
|
||||||
|
@ -229,6 +234,7 @@ static void DeleteUnconnectedTracks( PCB_EDIT_FRAME* frame, wxDC* DC )
|
||||||
}
|
}
|
||||||
|
|
||||||
pad = Fast_Locate_Pad_Connecte( frame->GetBoard(), segment->m_End, masklayer );
|
pad = Fast_Locate_Pad_Connecte( frame->GetBoard(), segment->m_End, masklayer );
|
||||||
|
|
||||||
if( pad != NULL )
|
if( pad != NULL )
|
||||||
{
|
{
|
||||||
segment->end = pad;
|
segment->end = pad;
|
||||||
|
@ -239,27 +245,30 @@ static void DeleteUnconnectedTracks( PCB_EDIT_FRAME* frame, wxDC* DC )
|
||||||
// For via tests, an enhancement could to test if connected to 2 items on different layers.
|
// For via tests, an enhancement could to test if connected to 2 items on different layers.
|
||||||
// Currently a via must be connected to 2 items, taht can be on the same layer
|
// Currently a via must be connected to 2 items, taht can be on the same layer
|
||||||
int top_layer, bottom_layer;
|
int top_layer, bottom_layer;
|
||||||
|
|
||||||
if( (type_end & START_ON_PAD ) == 0 )
|
if( (type_end & START_ON_PAD ) == 0 )
|
||||||
{
|
{
|
||||||
other = Locate_Piste_Connectee( segment, frame->GetBoard()->m_Track, NULL, START );
|
other = GetConnectedTrace( segment, frame->GetBoard()->m_Track, NULL, START );
|
||||||
|
|
||||||
if( other == NULL ) // Test a connection to zones
|
if( other == NULL ) // Test a connection to zones
|
||||||
{
|
{
|
||||||
if( segment->Type() != TYPE_VIA )
|
if( segment->Type() != TYPE_VIA )
|
||||||
{
|
{
|
||||||
zone = frame->GetBoard()->HitTestForAnyFilledArea(segment->m_Start, segment->GetLayer() );
|
zone = frame->GetBoard()->HitTestForAnyFilledArea( segment->m_Start,
|
||||||
|
segment->GetLayer() );
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
((SEGVIA*)segment)->ReturnLayerPair( &top_layer, &bottom_layer );
|
((SEGVIA*)segment)->ReturnLayerPair( &top_layer, &bottom_layer );
|
||||||
zone = frame->GetBoard()->HitTestForAnyFilledArea(segment->m_Start, top_layer, bottom_layer );
|
zone = frame->GetBoard()->HitTestForAnyFilledArea( segment->m_Start,
|
||||||
|
top_layer, bottom_layer );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( (other == NULL) && (zone == NULL) )
|
if( (other == NULL) && (zone == NULL) )
|
||||||
|
{
|
||||||
flag_erase |= 1;
|
flag_erase |= 1;
|
||||||
|
}
|
||||||
else // segment, via or zone connected to this end
|
else // segment, via or zone connected to this end
|
||||||
{
|
{
|
||||||
segment->start = other;
|
segment->start = other;
|
||||||
|
@ -272,12 +281,14 @@ static void DeleteUnconnectedTracks( PCB_EDIT_FRAME* frame, wxDC* DC )
|
||||||
segment->SetState( BUSY, ON );
|
segment->SetState( BUSY, ON );
|
||||||
|
|
||||||
SEGVIA* via = (SEGVIA*) other;
|
SEGVIA* via = (SEGVIA*) other;
|
||||||
other = Locate_Piste_Connectee( via, frame->GetBoard()->m_Track,
|
other = GetConnectedTrace( via, frame->GetBoard()->m_Track, NULL, START );
|
||||||
NULL, START );
|
|
||||||
if( other == NULL )
|
if( other == NULL )
|
||||||
{
|
{
|
||||||
via->ReturnLayerPair( &top_layer, &bottom_layer );
|
via->ReturnLayerPair( &top_layer, &bottom_layer );
|
||||||
zone = frame->GetBoard()->HitTestForAnyFilledArea(via->m_Start, bottom_layer, top_layer );
|
zone = frame->GetBoard()->HitTestForAnyFilledArea( via->m_Start,
|
||||||
|
bottom_layer,
|
||||||
|
top_layer );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( (other == NULL) && (zone == NULL) )
|
if( (other == NULL) && (zone == NULL) )
|
||||||
|
@ -291,23 +302,25 @@ static void DeleteUnconnectedTracks( PCB_EDIT_FRAME* frame, wxDC* DC )
|
||||||
// if not connected to a pad, test if segment's END is connected to another track
|
// if not connected to a pad, test if segment's END is connected to another track
|
||||||
if( (type_end & END_ON_PAD ) == 0 )
|
if( (type_end & END_ON_PAD ) == 0 )
|
||||||
{
|
{
|
||||||
other = Locate_Piste_Connectee( segment, frame->GetBoard()->m_Track,
|
other = GetConnectedTrace( segment, frame->GetBoard()->m_Track, NULL, END );
|
||||||
NULL, END );
|
|
||||||
if( other == NULL ) // Test a connection to zones
|
if( other == NULL ) // Test a connection to zones
|
||||||
{
|
{
|
||||||
if( segment->Type() != TYPE_VIA )
|
if( segment->Type() != TYPE_VIA )
|
||||||
zone = frame->GetBoard()->HitTestForAnyFilledArea(segment->m_End, segment->GetLayer() );
|
zone = frame->GetBoard()->HitTestForAnyFilledArea( segment->m_End,
|
||||||
|
segment->GetLayer() );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
((SEGVIA*)segment)->ReturnLayerPair( &top_layer, &bottom_layer );
|
((SEGVIA*)segment)->ReturnLayerPair( &top_layer, &bottom_layer );
|
||||||
zone = frame->GetBoard()->HitTestForAnyFilledArea(segment->m_End,top_layer, bottom_layer );
|
zone = frame->GetBoard()->HitTestForAnyFilledArea( segment->m_End,
|
||||||
|
top_layer, bottom_layer );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (other == NULL) && (zone == NULL) )
|
if ( (other == NULL) && (zone == NULL) )
|
||||||
|
{
|
||||||
flag_erase |= 0x10;
|
flag_erase |= 0x10;
|
||||||
|
}
|
||||||
else // segment, via or zone connected to this end
|
else // segment, via or zone connected to this end
|
||||||
{
|
{
|
||||||
segment->end = other;
|
segment->end = other;
|
||||||
|
@ -321,12 +334,14 @@ static void DeleteUnconnectedTracks( PCB_EDIT_FRAME* frame, wxDC* DC )
|
||||||
segment->SetState( BUSY, ON );
|
segment->SetState( BUSY, ON );
|
||||||
|
|
||||||
SEGVIA* via = (SEGVIA*) other;
|
SEGVIA* via = (SEGVIA*) other;
|
||||||
other = Locate_Piste_Connectee( via, frame->GetBoard()->m_Track,
|
other = GetConnectedTrace( via, frame->GetBoard()->m_Track, NULL, END );
|
||||||
NULL, END );
|
|
||||||
if( other == NULL )
|
if( other == NULL )
|
||||||
{
|
{
|
||||||
via->ReturnLayerPair( &top_layer, &bottom_layer );
|
via->ReturnLayerPair( &top_layer, &bottom_layer );
|
||||||
zone = frame->GetBoard()->HitTestForAnyFilledArea(via->m_End, bottom_layer, top_layer );
|
zone = frame->GetBoard()->HitTestForAnyFilledArea( via->m_End,
|
||||||
|
bottom_layer,
|
||||||
|
top_layer );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( (other == NULL) && (zone == NULL) )
|
if( (other == NULL) && (zone == NULL) )
|
||||||
|
@ -346,7 +361,9 @@ static void DeleteUnconnectedTracks( PCB_EDIT_FRAME* frame, wxDC* DC )
|
||||||
startNetcode = next;
|
startNetcode = next;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
next = startNetcode;
|
next = startNetcode;
|
||||||
|
}
|
||||||
|
|
||||||
// remove segment from screen and board
|
// remove segment from screen and board
|
||||||
segment->Draw( frame->DrawPanel, DC, GR_XOR );
|
segment->Draw( frame->DrawPanel, DC, GR_XOR );
|
||||||
|
@ -359,10 +376,8 @@ static void DeleteUnconnectedTracks( PCB_EDIT_FRAME* frame, wxDC* DC )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************/
|
|
||||||
static void clean_segments( PCB_EDIT_FRAME* frame )
|
|
||||||
/************************************************************/
|
|
||||||
/* Delete null lenght segments, and intermediate points .. */
|
/* Delete null lenght segments, and intermediate points .. */
|
||||||
|
static void clean_segments( PCB_EDIT_FRAME* frame )
|
||||||
{
|
{
|
||||||
TRACK* segment, * nextsegment;
|
TRACK* segment, * nextsegment;
|
||||||
TRACK* other;
|
TRACK* other;
|
||||||
|
@ -370,12 +385,13 @@ static void clean_segments( PCB_EDIT_FRAME* frame )
|
||||||
int flag, no_inc;
|
int flag, no_inc;
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
frame->DrawPanel->m_AbortRequest = FALSE;
|
frame->DrawPanel->m_AbortRequest = false;
|
||||||
|
|
||||||
// Delete null segments
|
// Delete null segments
|
||||||
for( segment = frame->GetBoard()->m_Track; segment; segment = nextsegment )
|
for( segment = frame->GetBoard()->m_Track; segment; segment = nextsegment )
|
||||||
{
|
{
|
||||||
nextsegment = segment->Next();
|
nextsegment = segment->Next();
|
||||||
|
|
||||||
if( !segment->IsNull() )
|
if( !segment->IsNull() )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -423,6 +439,7 @@ static void clean_segments( PCB_EDIT_FRAME* frame )
|
||||||
|
|
||||||
/* delete intermediate points */
|
/* delete intermediate points */
|
||||||
ii = 0;
|
ii = 0;
|
||||||
|
|
||||||
for( segment = frame->GetBoard()->m_Track; segment; segment = nextsegment )
|
for( segment = frame->GetBoard()->m_Track; segment; segment = nextsegment )
|
||||||
{
|
{
|
||||||
TRACK* segStart;
|
TRACK* segStart;
|
||||||
|
@ -430,6 +447,7 @@ static void clean_segments( PCB_EDIT_FRAME* frame )
|
||||||
TRACK* segDelete;
|
TRACK* segDelete;
|
||||||
|
|
||||||
nextsegment = segment->Next();
|
nextsegment = segment->Next();
|
||||||
|
|
||||||
if( frame->DrawPanel->m_AbortRequest )
|
if( frame->DrawPanel->m_AbortRequest )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -441,8 +459,8 @@ static void clean_segments( PCB_EDIT_FRAME* frame )
|
||||||
// search for a possible point that connects on the START point of the segment
|
// search for a possible point that connects on the START point of the segment
|
||||||
for( segStart = segment->Next(); ; )
|
for( segStart = segment->Next(); ; )
|
||||||
{
|
{
|
||||||
segStart = Locate_Piste_Connectee( segment, segStart,
|
segStart = GetConnectedTrace( segment, segStart, NULL, START );
|
||||||
NULL, START );
|
|
||||||
if( segStart )
|
if( segStart )
|
||||||
{
|
{
|
||||||
// the two segments must have the same width
|
// the two segments must have the same width
|
||||||
|
@ -455,8 +473,7 @@ static void clean_segments( PCB_EDIT_FRAME* frame )
|
||||||
|
|
||||||
/* We must have only one segment connected */
|
/* We must have only one segment connected */
|
||||||
segStart->SetState( BUSY, ON );
|
segStart->SetState( BUSY, ON );
|
||||||
other = Locate_Piste_Connectee( segment, frame->GetBoard()->m_Track,
|
other = GetConnectedTrace( segment, frame->GetBoard()->m_Track, NULL, START );
|
||||||
NULL, START );
|
|
||||||
segStart->SetState( BUSY, OFF );
|
segStart->SetState( BUSY, OFF );
|
||||||
|
|
||||||
if( other == NULL )
|
if( other == NULL )
|
||||||
|
@ -467,9 +484,10 @@ static void clean_segments( PCB_EDIT_FRAME* frame )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( flag ) /* We have the starting point of the segment is connecte to an other segment */
|
if( flag ) // We have the starting point of the segment is connecte to an other segment
|
||||||
{
|
{
|
||||||
segDelete = AlignSegment( frame->GetBoard(), segment, segStart, START );
|
segDelete = AlignSegment( frame->GetBoard(), segment, segStart, START );
|
||||||
|
|
||||||
if( segDelete )
|
if( segDelete )
|
||||||
{
|
{
|
||||||
no_inc = 1;
|
no_inc = 1;
|
||||||
|
@ -480,7 +498,8 @@ static void clean_segments( PCB_EDIT_FRAME* frame )
|
||||||
/* search for a possible point that connects on the END point of the segment: */
|
/* search for a possible point that connects on the END point of the segment: */
|
||||||
for( segEnd = segment->Next(); ; )
|
for( segEnd = segment->Next(); ; )
|
||||||
{
|
{
|
||||||
segEnd = Locate_Piste_Connectee( segment, segEnd, NULL, END );
|
segEnd = GetConnectedTrace( segment, segEnd, NULL, END );
|
||||||
|
|
||||||
if( segEnd )
|
if( segEnd )
|
||||||
{
|
{
|
||||||
if( segment->m_Width != segEnd->m_Width )
|
if( segment->m_Width != segEnd->m_Width )
|
||||||
|
@ -491,8 +510,7 @@ static void clean_segments( PCB_EDIT_FRAME* frame )
|
||||||
|
|
||||||
/* We must have only one segment connected */
|
/* We must have only one segment connected */
|
||||||
segEnd->SetState( BUSY, ON );
|
segEnd->SetState( BUSY, ON );
|
||||||
other = Locate_Piste_Connectee( segment, frame->GetBoard()->m_Track,
|
other = GetConnectedTrace( segment, frame->GetBoard()->m_Track, NULL, END );
|
||||||
NULL, END );
|
|
||||||
segEnd->SetState( BUSY, OFF );
|
segEnd->SetState( BUSY, OFF );
|
||||||
|
|
||||||
if( other == NULL )
|
if( other == NULL )
|
||||||
|
@ -501,12 +519,15 @@ static void clean_segments( PCB_EDIT_FRAME* frame )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if( flag & 2 ) /* We have the ending point of the segment is connecte to an other segment */
|
if( flag & 2 ) // We have the ending point of the segment is connecte to an other segment
|
||||||
{
|
{
|
||||||
segDelete = AlignSegment( frame->GetBoard(), segment, segEnd, END );
|
segDelete = AlignSegment( frame->GetBoard(), segment, segEnd, END );
|
||||||
|
|
||||||
if( segDelete )
|
if( segDelete )
|
||||||
{
|
{
|
||||||
no_inc = 1;
|
no_inc = 1;
|
||||||
|
@ -522,9 +543,6 @@ static void clean_segments( PCB_EDIT_FRAME* frame )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************/
|
|
||||||
static TRACK* AlignSegment( BOARD* Pcb, TRACK* pt_ref, TRACK* pt_segm, int extremite )
|
|
||||||
/****************************************************************************/
|
|
||||||
/* Function used by clean_segments.
|
/* Function used by clean_segments.
|
||||||
* Test alignement of pt_segm and pt_ref (which must have acommon end).
|
* Test alignement of pt_segm and pt_ref (which must have acommon end).
|
||||||
* and see if the common point is not on a pad (i.e. if this common point can be removed).
|
* and see if the common point is not on a pad (i.e. if this common point can be removed).
|
||||||
|
@ -536,6 +554,7 @@ static TRACK* AlignSegment( BOARD* Pcb, TRACK* pt_ref, TRACK* pt_segm, int extre
|
||||||
* and return pt_segm (which can be deleted).
|
* and return pt_segm (which can be deleted).
|
||||||
* else return NULL
|
* else return NULL
|
||||||
*/
|
*/
|
||||||
|
static TRACK* AlignSegment( BOARD* Pcb, TRACK* pt_ref, TRACK* pt_segm, int extremite )
|
||||||
{
|
{
|
||||||
int flag = 0;
|
int flag = 0;
|
||||||
|
|
||||||
|
@ -570,6 +589,7 @@ static TRACK* AlignSegment( BOARD* Pcb, TRACK* pt_ref, TRACK* pt_segm, int extre
|
||||||
if( (refdy * segmdx != refdx * segmdy)
|
if( (refdy * segmdx != refdx * segmdy)
|
||||||
&& (refdy * segmdx != -refdx * segmdy) )
|
&& (refdy * segmdx != -refdx * segmdy) )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
flag = 4;
|
flag = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -618,6 +638,7 @@ static TRACK* AlignSegment( BOARD* Pcb, TRACK* pt_ref, TRACK* pt_segm, int extre
|
||||||
return pt_segm;
|
return pt_segm;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -644,6 +665,7 @@ bool PCB_EDIT_FRAME::RemoveMisConnectedTracks( wxDC* aDC )
|
||||||
|
|
||||||
// find the netcode for segment using anything connected to the "start" of "segment"
|
// find the netcode for segment using anything connected to the "start" of "segment"
|
||||||
net_code_s = -1;
|
net_code_s = -1;
|
||||||
|
|
||||||
if( segment->start && segment->start->Type()==TYPE_PAD )
|
if( segment->start && segment->start->Type()==TYPE_PAD )
|
||||||
{
|
{
|
||||||
// get the netcode of the pad to propagate.
|
// get the netcode of the pad to propagate.
|
||||||
|
@ -651,8 +673,7 @@ bool PCB_EDIT_FRAME::RemoveMisConnectedTracks( wxDC* aDC )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
other = Locate_Piste_Connectee( segment, GetBoard()->m_Track,
|
other = GetConnectedTrace( segment, GetBoard()->m_Track, NULL, START );
|
||||||
NULL, START );
|
|
||||||
if( other )
|
if( other )
|
||||||
net_code_s = other->GetNet();
|
net_code_s = other->GetNet();
|
||||||
}
|
}
|
||||||
|
@ -662,14 +683,15 @@ bool PCB_EDIT_FRAME::RemoveMisConnectedTracks( wxDC* aDC )
|
||||||
|
|
||||||
// find the netcode for segment using anything connected to the "end" of "segment"
|
// find the netcode for segment using anything connected to the "end" of "segment"
|
||||||
net_code_e = -1;
|
net_code_e = -1;
|
||||||
|
|
||||||
if( segment->end && segment->end->Type()==TYPE_PAD )
|
if( segment->end && segment->end->Type()==TYPE_PAD )
|
||||||
{
|
{
|
||||||
net_code_e = ((D_PAD*)(segment->end))->GetNet();
|
net_code_e = ((D_PAD*)(segment->end))->GetNet();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
other = Locate_Piste_Connectee( segment, GetBoard()->m_Track,
|
other = GetConnectedTrace( segment, GetBoard()->m_Track, NULL, END );
|
||||||
NULL, END );
|
|
||||||
if( other )
|
if( other )
|
||||||
net_code_e = other->GetNet();
|
net_code_e = other->GetNet();
|
||||||
}
|
}
|
||||||
|
@ -706,9 +728,6 @@ bool PCB_EDIT_FRAME::RemoveMisConnectedTracks( wxDC* aDC )
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
||||||
/***************************************************************/
|
|
||||||
static void Gen_Raccord_Track( PCB_EDIT_FRAME* frame, wxDC* DC )
|
|
||||||
/***************************************************************/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Gen_Raccord_Track
|
* Function Gen_Raccord_Track
|
||||||
|
@ -717,26 +736,30 @@ static void Gen_Raccord_Track( PCB_EDIT_FRAME* frame, wxDC* DC )
|
||||||
* segment first being operated on. This is done so that the subsequent tests
|
* segment first being operated on. This is done so that the subsequent tests
|
||||||
* of connection, which do not test segment overlaps, will see this continuity.
|
* of connection, which do not test segment overlaps, will see this continuity.
|
||||||
*/
|
*/
|
||||||
|
static void Gen_Raccord_Track( PCB_EDIT_FRAME* frame, wxDC* DC )
|
||||||
{
|
{
|
||||||
TRACK* segment;
|
TRACK* segment;
|
||||||
TRACK* other;
|
TRACK* other;
|
||||||
int nn = 0;
|
int nn = 0;
|
||||||
int masquelayer;
|
int layerMask;
|
||||||
int ii, percent, oldpercent;
|
int ii, percent, oldpercent;
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
frame->Affiche_Message( wxT( "Gen Raccords sur Pistes:" ) );
|
frame->Affiche_Message( wxT( "Gen Raccords sur Pistes:" ) );
|
||||||
|
|
||||||
if( frame->GetBoard()->GetNumSegmTrack() == 0 )
|
if( frame->GetBoard()->GetNumSegmTrack() == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
frame->DrawPanel->m_AbortRequest = FALSE;
|
frame->DrawPanel->m_AbortRequest = false;
|
||||||
|
|
||||||
oldpercent = -1; ii = 0;
|
oldpercent = -1; ii = 0;
|
||||||
|
|
||||||
for( segment = frame->GetBoard()->m_Track; segment; segment = segment->Next() )
|
for( segment = frame->GetBoard()->m_Track; segment; segment = segment->Next() )
|
||||||
{
|
{
|
||||||
// display activity
|
// display activity
|
||||||
ii++;
|
ii++;
|
||||||
percent = (100 * ii) / frame->GetBoard()->m_Track.GetCount();
|
percent = (100 * ii) / frame->GetBoard()->m_Track.GetCount();
|
||||||
|
|
||||||
if( percent != oldpercent )
|
if( percent != oldpercent )
|
||||||
{
|
{
|
||||||
frame->DisplayActivity( percent, wxT( "Tracks: " ) );
|
frame->DisplayActivity( percent, wxT( "Tracks: " ) );
|
||||||
|
@ -752,14 +775,15 @@ static void Gen_Raccord_Track( PCB_EDIT_FRAME* frame, wxDC* DC )
|
||||||
if( frame->DrawPanel->m_AbortRequest )
|
if( frame->DrawPanel->m_AbortRequest )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
masquelayer = segment->ReturnMaskLayer();
|
layerMask = segment->ReturnMaskLayer();
|
||||||
|
|
||||||
// look at the "start" of the "segment"
|
// look at the "start" of the "segment"
|
||||||
for( other = frame->GetBoard()->m_Track; other; other = other->Next() )
|
for( other = frame->GetBoard()->m_Track; other; other = other->Next() )
|
||||||
{
|
{
|
||||||
TRACK* newTrack;
|
TRACK* newTrack;
|
||||||
|
|
||||||
other = Locate_Pistes( other, segment->m_Start, masquelayer );
|
other = GetTrace( other, segment->m_Start, layerMask );
|
||||||
|
|
||||||
if( other == NULL )
|
if( other == NULL )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -796,7 +820,7 @@ static void Gen_Raccord_Track( PCB_EDIT_FRAME* frame, wxDC* DC )
|
||||||
other->m_End = segment->m_Start;
|
other->m_End = segment->m_Start;
|
||||||
newTrack->m_Start = segment->m_Start;
|
newTrack->m_Start = segment->m_Start;
|
||||||
|
|
||||||
Trace_Une_Piste( frame->DrawPanel, DC, other, 2, GR_OR );
|
DrawTraces( frame->DrawPanel, DC, other, 2, GR_OR );
|
||||||
|
|
||||||
// skip forward one, skipping the newTrack
|
// skip forward one, skipping the newTrack
|
||||||
other = newTrack;
|
other = newTrack;
|
||||||
|
@ -807,7 +831,8 @@ static void Gen_Raccord_Track( PCB_EDIT_FRAME* frame, wxDC* DC )
|
||||||
{
|
{
|
||||||
TRACK* newTrack;
|
TRACK* newTrack;
|
||||||
|
|
||||||
other = Locate_Pistes( other, segment->m_End, masquelayer );
|
other = GetTrace( other, segment->m_End, layerMask );
|
||||||
|
|
||||||
if( other == NULL )
|
if( other == NULL )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -842,7 +867,7 @@ static void Gen_Raccord_Track( PCB_EDIT_FRAME* frame, wxDC* DC )
|
||||||
other->m_End = segment->m_End;
|
other->m_End = segment->m_End;
|
||||||
newTrack->m_Start = segment->m_End;
|
newTrack->m_Start = segment->m_End;
|
||||||
|
|
||||||
Trace_Une_Piste( frame->DrawPanel, DC, other, 2, GR_OR );
|
DrawTraces( frame->DrawPanel, DC, other, 2, GR_OR );
|
||||||
|
|
||||||
// skip forward one, skipping the newTrack
|
// skip forward one, skipping the newTrack
|
||||||
other = newTrack;
|
other = newTrack;
|
||||||
|
@ -882,9 +907,10 @@ static void ConnectDanglingEndToVia( BOARD* pcb )
|
||||||
if( !via->IsOnLayer( other->GetLayer() ) )
|
if( !via->IsOnLayer( other->GetLayer() ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// if the other track's m_End does not match the via position, and the track's m_Start is
|
// if the other track's m_End does not match the via position, and the track's
|
||||||
// within the bounds of the via, and the other track has no start
|
// m_Start is within the bounds of the via, and the other track has no start
|
||||||
if( other->m_End!=via->GetPosition() && via->HitTest( other->m_Start ) && !other->start )
|
if( other->m_End != via->GetPosition() && via->HitTest( other->m_Start )
|
||||||
|
&& !other->start )
|
||||||
{
|
{
|
||||||
TRACK* newTrack = other->Copy();
|
TRACK* newTrack = other->Copy();
|
||||||
|
|
||||||
|
@ -905,9 +931,10 @@ static void ConnectDanglingEndToVia( BOARD* pcb )
|
||||||
via->end = other;
|
via->end = other;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the other track's m_Start does not match the via position, and the track's m_End is
|
// if the other track's m_Start does not match the via position, and the track's
|
||||||
// within the bounds of the via, and the other track has no end
|
// m_End is within the bounds of the via, and the other track has no end
|
||||||
else if( other->m_Start!=via->GetPosition() && via->HitTest( other->m_End ) && !other->end )
|
else if( other->m_Start != via->GetPosition() && via->HitTest( other->m_End )
|
||||||
|
&& !other->end )
|
||||||
{
|
{
|
||||||
TRACK* newTrack = other->Copy();
|
TRACK* newTrack = other->Copy();
|
||||||
|
|
||||||
|
@ -932,22 +959,19 @@ static void ConnectDanglingEndToVia( BOARD* pcb )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************/
|
|
||||||
void ConnectDanglingEndToPad( PCB_EDIT_FRAME* frame, wxDC* DC )
|
|
||||||
/**************************************************************/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function ConnectDanglingEndToPad
|
* Function ConnectDanglingEndToPad
|
||||||
* possibly adds a segment to the end of any and all tracks if their end is not exactly
|
* possibly adds a segment to the end of any and all tracks if their end is not exactly
|
||||||
* connected into the center of the pad. This allows faster control of
|
* connected into the center of the pad. This allows faster control of
|
||||||
* connections.
|
* connections.
|
||||||
*/
|
*/
|
||||||
|
void ConnectDanglingEndToPad( PCB_EDIT_FRAME* frame, wxDC* DC )
|
||||||
{
|
{
|
||||||
TRACK* segment;
|
TRACK* segment;
|
||||||
int nb_new_piste = 0;
|
int nb_new_trace = 0;
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
frame->DrawPanel->m_AbortRequest = FALSE;
|
frame->DrawPanel->m_AbortRequest = false;
|
||||||
|
|
||||||
for( segment = frame->GetBoard()->m_Track; segment; segment = segment->Next() )
|
for( segment = frame->GetBoard()->m_Track; segment; segment = segment->Next() )
|
||||||
{
|
{
|
||||||
|
@ -957,24 +981,23 @@ void ConnectDanglingEndToPad( PCB_EDIT_FRAME* frame, wxDC* DC )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pad = Locate_Pad_Connecte( frame->GetBoard(), segment, START );
|
pad = Locate_Pad_Connecte( frame->GetBoard(), segment, START );
|
||||||
|
|
||||||
if( pad )
|
if( pad )
|
||||||
{
|
{
|
||||||
// test if the track is not precisely starting on the found pad
|
// test if the track is not precisely starting on the found pad
|
||||||
if( segment->m_Start != pad->m_Pos )
|
if( segment->m_Start != pad->m_Pos )
|
||||||
{
|
{
|
||||||
if( Locate_Piste_Connectee( segment, frame->GetBoard()->m_Track,
|
if( GetConnectedTrace( segment, frame->GetBoard()->m_Track, NULL, START ) == NULL )
|
||||||
NULL, START ) == NULL )
|
|
||||||
{
|
{
|
||||||
TRACK* newTrack = segment->Copy();
|
TRACK* newTrack = segment->Copy();
|
||||||
|
|
||||||
frame->GetBoard()->m_Track.Insert( newTrack, segment->Next() );
|
frame->GetBoard()->m_Track.Insert( newTrack, segment->Next() );
|
||||||
|
|
||||||
newTrack->m_End = pad->m_Pos;
|
newTrack->m_End = pad->m_Pos;
|
||||||
|
|
||||||
newTrack->start = segment;
|
newTrack->start = segment;
|
||||||
newTrack->end = pad;
|
newTrack->end = pad;
|
||||||
|
|
||||||
nb_new_piste++;
|
nb_new_trace++;
|
||||||
|
|
||||||
newTrack->Draw( frame->DrawPanel, DC, GR_OR );
|
newTrack->Draw( frame->DrawPanel, DC, GR_OR );
|
||||||
}
|
}
|
||||||
|
@ -982,13 +1005,13 @@ void ConnectDanglingEndToPad( PCB_EDIT_FRAME* frame, wxDC* DC )
|
||||||
}
|
}
|
||||||
|
|
||||||
pad = Locate_Pad_Connecte( frame->GetBoard(), segment, END );
|
pad = Locate_Pad_Connecte( frame->GetBoard(), segment, END );
|
||||||
|
|
||||||
if( pad )
|
if( pad )
|
||||||
{
|
{
|
||||||
// test if the track is not precisely ending on the found pad
|
// test if the track is not precisely ending on the found pad
|
||||||
if( segment->m_End != pad->m_Pos )
|
if( segment->m_End != pad->m_Pos )
|
||||||
{
|
{
|
||||||
if( Locate_Piste_Connectee( segment, frame->GetBoard()->m_Track,
|
if( GetConnectedTrace( segment, frame->GetBoard()->m_Track, NULL, END ) == NULL )
|
||||||
NULL, END ) == NULL )
|
|
||||||
{
|
{
|
||||||
TRACK* newTrack = segment->Copy();
|
TRACK* newTrack = segment->Copy();
|
||||||
|
|
||||||
|
@ -998,7 +1021,7 @@ void ConnectDanglingEndToPad( PCB_EDIT_FRAME* frame, wxDC* DC )
|
||||||
|
|
||||||
newTrack->start = pad;
|
newTrack->start = pad;
|
||||||
newTrack->end = segment;
|
newTrack->end = segment;
|
||||||
nb_new_piste++;
|
nb_new_trace++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ const KICAD_T GENERAL_COLLECTOR::AllBoardItems[] = {
|
||||||
TYPE_TEXTE, // in m_Drawings
|
TYPE_TEXTE, // in m_Drawings
|
||||||
TYPE_DRAWSEGMENT, // in m_Drawings
|
TYPE_DRAWSEGMENT, // in m_Drawings
|
||||||
TYPE_DIMENSION, // in m_Drawings
|
TYPE_DIMENSION, // in m_Drawings
|
||||||
TYPE_MIRE, // in m_Drawings
|
PCB_TARGET_T, // in m_Drawings
|
||||||
TYPE_VIA, // in m_Tracks
|
TYPE_VIA, // in m_Tracks
|
||||||
TYPE_TRACK, // in m_Tracks
|
TYPE_TRACK, // in m_Tracks
|
||||||
TYPE_PAD, // in modules
|
TYPE_PAD, // in modules
|
||||||
|
@ -70,7 +70,7 @@ const KICAD_T GENERAL_COLLECTOR::AllButZones[] = {
|
||||||
TYPE_TEXTE,
|
TYPE_TEXTE,
|
||||||
TYPE_DRAWSEGMENT,
|
TYPE_DRAWSEGMENT,
|
||||||
TYPE_DIMENSION,
|
TYPE_DIMENSION,
|
||||||
TYPE_MIRE,
|
PCB_TARGET_T,
|
||||||
TYPE_VIA,
|
TYPE_VIA,
|
||||||
TYPE_TRACK,
|
TYPE_TRACK,
|
||||||
TYPE_PAD,
|
TYPE_PAD,
|
||||||
|
@ -153,6 +153,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, const void* testDa
|
||||||
case TYPE_PAD:
|
case TYPE_PAD:
|
||||||
{
|
{
|
||||||
MODULE* m = (MODULE*) item->GetParent();
|
MODULE* m = (MODULE*) item->GetParent();
|
||||||
|
|
||||||
if( m->GetReference() == wxT( "Y2" ) )
|
if( m->GetReference() == wxT( "Y2" ) )
|
||||||
{
|
{
|
||||||
breakhere++;
|
breakhere++;
|
||||||
|
@ -187,6 +188,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, const void* testDa
|
||||||
case TYPE_TEXTE_MODULE:
|
case TYPE_TEXTE_MODULE:
|
||||||
{
|
{
|
||||||
TEXTE_MODULE* tm = (TEXTE_MODULE*) item;
|
TEXTE_MODULE* tm = (TEXTE_MODULE*) item;
|
||||||
|
|
||||||
if( tm->m_Text == wxT( "10uH" ) )
|
if( tm->m_Text == wxT( "10uH" ) )
|
||||||
{
|
{
|
||||||
breakhere++;
|
breakhere++;
|
||||||
|
@ -197,6 +199,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, const void* testDa
|
||||||
case TYPE_MODULE:
|
case TYPE_MODULE:
|
||||||
{
|
{
|
||||||
MODULE* m = (MODULE*) item;
|
MODULE* m = (MODULE*) item;
|
||||||
|
|
||||||
if( m->GetReference() == wxT( "C98" ) )
|
if( m->GetReference() == wxT( "C98" ) )
|
||||||
{
|
{
|
||||||
breakhere++;
|
breakhere++;
|
||||||
|
@ -217,10 +220,12 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, const void* testDa
|
||||||
case TYPE_PAD:
|
case TYPE_PAD:
|
||||||
// there are pad specific visibility controls.
|
// there are pad specific visibility controls.
|
||||||
// Criterias to select a pad is:
|
// Criterias to select a pad is:
|
||||||
// for smd pads: the module parent must be seen, and pads on the corresponding board side must be seen
|
// for smd pads: the module parent must be seen, and pads on the corresponding
|
||||||
|
// board side must be seen
|
||||||
// if pad is a thru hole, then it can be visible when its parent module is not.
|
// if pad is a thru hole, then it can be visible when its parent module is not.
|
||||||
// for through pads: pads on Front or Back board sides must be seen
|
// for through pads: pads on Front or Back board sides must be seen
|
||||||
pad = (D_PAD*) item;
|
pad = (D_PAD*) item;
|
||||||
|
|
||||||
if( (pad->m_Attribut != PAD_SMD) &&
|
if( (pad->m_Attribut != PAD_SMD) &&
|
||||||
(pad->m_Attribut != PAD_CONN) ) // a hole is present, so multiple layers
|
(pad->m_Attribut != PAD_CONN) ) // a hole is present, so multiple layers
|
||||||
{
|
{
|
||||||
|
@ -229,7 +234,10 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, const void* testDa
|
||||||
pad_through = true;
|
pad_through = true;
|
||||||
}
|
}
|
||||||
else // smd, so use pads test after module test
|
else // smd, so use pads test after module test
|
||||||
|
{
|
||||||
module = (MODULE*) item->GetParent();
|
module = (MODULE*) item->GetParent();
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_VIA:
|
case TYPE_VIA:
|
||||||
|
@ -253,7 +261,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, const void* testDa
|
||||||
case TYPE_DIMENSION:
|
case TYPE_DIMENSION:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_MIRE:
|
case PCB_TARGET_T:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_TEXTE_MODULE:
|
case TYPE_TEXTE_MODULE:
|
||||||
|
@ -298,10 +306,12 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, const void* testDa
|
||||||
{
|
{
|
||||||
if( m_Guide->IgnorePads() )
|
if( m_Guide->IgnorePads() )
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
if( ! pad_through )
|
if( ! pad_through )
|
||||||
{
|
{
|
||||||
if( m_Guide->IgnorePadsOnFront() && pad->IsOnLayer(LAYER_N_FRONT ) )
|
if( m_Guide->IgnorePadsOnFront() && pad->IsOnLayer(LAYER_N_FRONT ) )
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
if( m_Guide->IgnorePadsOnBack() && pad->IsOnLayer(LAYER_N_BACK ) )
|
if( m_Guide->IgnorePadsOnBack() && pad->IsOnLayer(LAYER_N_BACK ) )
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,16 +23,12 @@ static void RebuildTrackChain( BOARD* pcb );
|
||||||
/*..*/
|
/*..*/
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************************************/
|
|
||||||
static int Merge_Two_SubNets( TRACK* pt_start_conn, TRACK* pt_end_conn, int old_val, int new_val )
|
|
||||||
/**************************************************************************************************/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Merge_Two_SubNets
|
* Function Merge_Two_SubNets
|
||||||
* Used by Propagate_SubNet()
|
* Used by Propagate_SubNet()
|
||||||
* Change a subnet value to a new value, for tracks ans pads which are connected to corresponding track
|
* Change a subnet value to a new value, for tracks ans pads which are connected to
|
||||||
* for pads and tracks, this is the .m_Subnet member that is tested and modified
|
* corresponding track for pads and tracks, this is the .m_Subnet member that is tested
|
||||||
* these members are block numbers (or cluster numbers) for a given net
|
* and modified these members are block numbers (or cluster numbers) for a given net
|
||||||
* The result is merging 2 blocks (or subnets)
|
* The result is merging 2 blocks (or subnets)
|
||||||
* @return modification count
|
* @return modification count
|
||||||
* @param old_val = subnet value to modify
|
* @param old_val = subnet value to modify
|
||||||
|
@ -41,6 +37,7 @@ static int Merge_Two_SubNets( TRACK* pt_start_conn, TRACK* pt_end_conn, int old_
|
||||||
* @param pt_end_conn = last track segment to test
|
* @param pt_end_conn = last track segment to test
|
||||||
* If pt_end_conn = NULL: search is made from pt_start_conn to end of linked list
|
* If pt_end_conn = NULL: search is made from pt_start_conn to end of linked list
|
||||||
*/
|
*/
|
||||||
|
static int Merge_Two_SubNets( TRACK* pt_start_conn, TRACK* pt_end_conn, int old_val, int new_val )
|
||||||
{
|
{
|
||||||
TRACK* pt_conn;
|
TRACK* pt_conn;
|
||||||
int nb_change = 0;
|
int nb_change = 0;
|
||||||
|
@ -53,12 +50,14 @@ static int Merge_Two_SubNets( TRACK* pt_start_conn, TRACK* pt_end_conn, int old_
|
||||||
EXCHG( old_val, new_val );
|
EXCHG( old_val, new_val );
|
||||||
|
|
||||||
pt_conn = pt_start_conn;
|
pt_conn = pt_start_conn;
|
||||||
|
|
||||||
for( ; pt_conn != NULL; pt_conn = pt_conn->Next() )
|
for( ; pt_conn != NULL; pt_conn = pt_conn->Next() )
|
||||||
{
|
{
|
||||||
if( pt_conn->GetSubNet() != old_val )
|
if( pt_conn->GetSubNet() != old_val )
|
||||||
{
|
{
|
||||||
if( pt_conn == pt_end_conn )
|
if( pt_conn == pt_end_conn )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,6 +67,7 @@ static int Merge_Two_SubNets( TRACK* pt_start_conn, TRACK* pt_end_conn, int old_
|
||||||
if( pt_conn->start && ( pt_conn->start->Type() == TYPE_PAD) )
|
if( pt_conn->start && ( pt_conn->start->Type() == TYPE_PAD) )
|
||||||
{
|
{
|
||||||
pt_pad = (D_PAD*) (pt_conn->start);
|
pt_pad = (D_PAD*) (pt_conn->start);
|
||||||
|
|
||||||
if( pt_pad->GetSubNet() == old_val )
|
if( pt_pad->GetSubNet() == old_val )
|
||||||
pt_pad->SetSubNet( pt_conn->GetSubNet() );
|
pt_pad->SetSubNet( pt_conn->GetSubNet() );
|
||||||
}
|
}
|
||||||
|
@ -75,9 +75,11 @@ static int Merge_Two_SubNets( TRACK* pt_start_conn, TRACK* pt_end_conn, int old_
|
||||||
if( pt_conn->end && (pt_conn->end->Type() == TYPE_PAD) )
|
if( pt_conn->end && (pt_conn->end->Type() == TYPE_PAD) )
|
||||||
{
|
{
|
||||||
pt_pad = (D_PAD*) (pt_conn->end);
|
pt_pad = (D_PAD*) (pt_conn->end);
|
||||||
|
|
||||||
if( pt_pad->GetSubNet() == old_val )
|
if( pt_pad->GetSubNet() == old_val )
|
||||||
pt_pad->SetSubNet( pt_conn->GetSubNet() );
|
pt_pad->SetSubNet( pt_conn->GetSubNet() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pt_conn == pt_end_conn )
|
if( pt_conn == pt_end_conn )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -86,39 +88,42 @@ static int Merge_Two_SubNets( TRACK* pt_start_conn, TRACK* pt_end_conn, int old_
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************/
|
|
||||||
static void Propagate_SubNet( TRACK* pt_start_conn, TRACK* pt_end_conn )
|
|
||||||
/******************************************************************/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Propagate_SubNet
|
* Function Propagate_SubNet
|
||||||
* Test a list of track segment, to create or propagate a sub netcode to pads and segments connected together
|
* Test a list of track segments, to create or propagate a sub netcode to pads and
|
||||||
* the track list must be sorted by nets, and all segments from pt_start_conn to pt_end_conn have the same net
|
* segments connected together the track list must be sorted by nets, and all segments
|
||||||
* When 2 items are connected (a track to a pad, or a track to an other track) they are grouped in a cluster.
|
* from pt_start_conn to pt_end_conn have the same net when 2 items are connected (a
|
||||||
|
* track to a pad, or a track to an other track) they are grouped in a cluster.
|
||||||
* for pads, this is the .m_physical_connexion member which is a cluster identifier
|
* for pads, this is the .m_physical_connexion member which is a cluster identifier
|
||||||
* for tracks, this is the .m_Subnet member which is a cluster identifier
|
* for tracks, this is the .m_Subnet member which is a cluster identifier
|
||||||
* For a given net, if all tracks are created, there is only one cluster.
|
* For a given net, if all tracks are created, there is only one cluster.
|
||||||
* but if not all tracks are created, there are more than one cluster, and some ratsnets will be shown.
|
* but if not all tracks are created, there are more than one cluster, and some ratsnets
|
||||||
|
* will be shown.
|
||||||
* @param pt_start_conn = first track to test
|
* @param pt_start_conn = first track to test
|
||||||
* @param pt_end_conn = last segment to test
|
* @param pt_end_conn = last segment to test
|
||||||
*/
|
*/
|
||||||
|
static void Propagate_SubNet( TRACK* pt_start_conn, TRACK* pt_end_conn )
|
||||||
{
|
{
|
||||||
TRACK* pt_conn;
|
TRACK* pt_conn;
|
||||||
int sub_netcode;
|
int sub_netcode;
|
||||||
D_PAD* pt_pad;
|
D_PAD* pt_pad;
|
||||||
TRACK* pt_autre_piste;
|
TRACK* pt_other_trace;
|
||||||
BOARD_ITEM* PtStruct;
|
BOARD_ITEM* PtStruct;
|
||||||
|
|
||||||
/* Clear variables used in computations */
|
/* Clear variables used in computations */
|
||||||
pt_conn = pt_start_conn;
|
pt_conn = pt_start_conn;
|
||||||
|
|
||||||
for( ; pt_conn != NULL; pt_conn = pt_conn->Next() )
|
for( ; pt_conn != NULL; pt_conn = pt_conn->Next() )
|
||||||
{
|
{
|
||||||
pt_conn->SetSubNet( 0 );
|
pt_conn->SetSubNet( 0 );
|
||||||
PtStruct = pt_conn->start;
|
PtStruct = pt_conn->start;
|
||||||
|
|
||||||
if( PtStruct && (PtStruct->Type() == TYPE_PAD) )
|
if( PtStruct && (PtStruct->Type() == TYPE_PAD) )
|
||||||
( (D_PAD*) PtStruct )->SetSubNet( 0 );
|
( (D_PAD*) PtStruct )->SetSubNet( 0 );
|
||||||
|
|
||||||
PtStruct = pt_conn->end;
|
PtStruct = pt_conn->end;
|
||||||
|
|
||||||
if( PtStruct && (PtStruct->Type() == TYPE_PAD) )
|
if( PtStruct && (PtStruct->Type() == TYPE_PAD) )
|
||||||
( (D_PAD*) PtStruct )->SetSubNet( 0 );
|
( (D_PAD*) PtStruct )->SetSubNet( 0 );
|
||||||
|
|
||||||
|
@ -131,6 +136,7 @@ static void Propagate_SubNet( TRACK* pt_start_conn, TRACK* pt_end_conn )
|
||||||
|
|
||||||
/* Start of calculation */
|
/* Start of calculation */
|
||||||
pt_conn = pt_start_conn;
|
pt_conn = pt_start_conn;
|
||||||
|
|
||||||
for( ; pt_conn != NULL; pt_conn = pt_conn->Next() )
|
for( ; pt_conn != NULL; pt_conn = pt_conn->Next() )
|
||||||
{
|
{
|
||||||
/* First: handling connections to pads */
|
/* First: handling connections to pads */
|
||||||
|
@ -140,6 +146,7 @@ static void Propagate_SubNet( TRACK* pt_start_conn, TRACK* pt_end_conn )
|
||||||
if( PtStruct && (PtStruct->Type() == TYPE_PAD) )
|
if( PtStruct && (PtStruct->Type() == TYPE_PAD) )
|
||||||
{
|
{
|
||||||
pt_pad = (D_PAD*) PtStruct;
|
pt_pad = (D_PAD*) PtStruct;
|
||||||
|
|
||||||
if( pt_conn->GetSubNet() ) /* the track segment is already a cluster member */
|
if( pt_conn->GetSubNet() ) /* the track segment is already a cluster member */
|
||||||
{
|
{
|
||||||
if( pt_pad->GetSubNet() > 0 ) /* The pad is already a cluster member, so we can merge the 2 clusters */
|
if( pt_pad->GetSubNet() > 0 ) /* The pad is already a cluster member, so we can merge the 2 clusters */
|
||||||
|
@ -166,10 +173,12 @@ static void Propagate_SubNet( TRACK* pt_start_conn, TRACK* pt_end_conn )
|
||||||
}
|
}
|
||||||
|
|
||||||
PtStruct = pt_conn->end;
|
PtStruct = pt_conn->end;
|
||||||
|
|
||||||
if( PtStruct && (PtStruct->Type() == TYPE_PAD) )
|
if( PtStruct && (PtStruct->Type() == TYPE_PAD) )
|
||||||
/* The segment end on a pad */
|
/* The segment end on a pad */
|
||||||
{
|
{
|
||||||
pt_pad = (D_PAD*) PtStruct;
|
pt_pad = (D_PAD*) PtStruct;
|
||||||
|
|
||||||
if( pt_conn->GetSubNet() )
|
if( pt_conn->GetSubNet() )
|
||||||
{
|
{
|
||||||
if( pt_pad->GetSubNet() > 0 )
|
if( pt_pad->GetSubNet() > 0 )
|
||||||
|
@ -178,8 +187,10 @@ static void Propagate_SubNet( TRACK* pt_start_conn, TRACK* pt_end_conn )
|
||||||
pt_pad->GetSubNet(), pt_conn->GetSubNet() );
|
pt_pad->GetSubNet(), pt_conn->GetSubNet() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
pt_pad->SetSubNet( pt_conn->GetSubNet() );
|
pt_pad->SetSubNet( pt_conn->GetSubNet() );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( pt_pad->GetSubNet() > 0 )
|
if( pt_pad->GetSubNet() > 0 )
|
||||||
|
@ -198,85 +209,88 @@ static void Propagate_SubNet( TRACK* pt_start_conn, TRACK* pt_end_conn )
|
||||||
|
|
||||||
/* Test connections between segments */
|
/* Test connections between segments */
|
||||||
PtStruct = pt_conn->start;
|
PtStruct = pt_conn->start;
|
||||||
|
|
||||||
if( PtStruct && (PtStruct->Type() != TYPE_PAD) )
|
if( PtStruct && (PtStruct->Type() != TYPE_PAD) )
|
||||||
{
|
{
|
||||||
/* The segment starts on an other track */
|
/* The segment starts on an other track */
|
||||||
pt_autre_piste = (TRACK*) PtStruct;
|
pt_other_trace = (TRACK*) PtStruct;
|
||||||
|
|
||||||
if( pt_conn->GetSubNet() ) /* the track segment is already a cluster member */
|
if( pt_conn->GetSubNet() ) /* the track segment is already a cluster member */
|
||||||
{
|
{
|
||||||
if( pt_autre_piste->GetSubNet() ) /* The other track is already a cluster member, so we can merge the 2 clusters */
|
if( pt_other_trace->GetSubNet() ) /* The other track is already a cluster member, so we can merge the 2 clusters */
|
||||||
{
|
{
|
||||||
Merge_Two_SubNets( pt_start_conn, pt_end_conn,
|
Merge_Two_SubNets( pt_start_conn, pt_end_conn,
|
||||||
pt_autre_piste->GetSubNet(), pt_conn->GetSubNet() );
|
pt_other_trace->GetSubNet(), pt_conn->GetSubNet() );
|
||||||
}
|
}
|
||||||
else /* The other track is not yet attached to a cluster , so we can add this other track to the cluster */
|
else /* The other track is not yet attached to a cluster , so we can add this other track to the cluster */
|
||||||
{
|
{
|
||||||
pt_autre_piste->SetSubNet( pt_conn->GetSubNet() );
|
pt_other_trace->SetSubNet( pt_conn->GetSubNet() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else /* the track segment is not yet attached to a cluster */
|
else /* the track segment is not yet attached to a cluster */
|
||||||
{
|
{
|
||||||
if( pt_autre_piste->GetSubNet() ) /* The other track is already a cluster member, so we can add the segment to the cluster */
|
if( pt_other_trace->GetSubNet() ) /* The other track is already a cluster member, so we can add the segment to the cluster */
|
||||||
{
|
{
|
||||||
pt_conn->SetSubNet( pt_autre_piste->GetSubNet() );
|
pt_conn->SetSubNet( pt_other_trace->GetSubNet() );
|
||||||
}
|
}
|
||||||
else /* it is connected to an other segment not in a cluster, so we must create a new cluster (only with the 2 track segments) */
|
else /* it is connected to an other segment not in a cluster, so we must create a new cluster (only with the 2 track segments) */
|
||||||
{
|
{
|
||||||
sub_netcode++;
|
sub_netcode++;
|
||||||
pt_conn->SetSubNet( sub_netcode );
|
pt_conn->SetSubNet( sub_netcode );
|
||||||
pt_autre_piste->SetSubNet( pt_conn->GetSubNet() );
|
pt_other_trace->SetSubNet( pt_conn->GetSubNet() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PtStruct = pt_conn->end; // Do the same calculations for the segment end point
|
PtStruct = pt_conn->end; // Do the same calculations for the segment end point
|
||||||
|
|
||||||
if( PtStruct && (PtStruct->Type() != TYPE_PAD) )
|
if( PtStruct && (PtStruct->Type() != TYPE_PAD) )
|
||||||
{
|
{
|
||||||
pt_autre_piste = (TRACK*) PtStruct;
|
pt_other_trace = (TRACK*) PtStruct;
|
||||||
|
|
||||||
if( pt_conn->GetSubNet() ) /* the track segment is already a cluster member */
|
if( pt_conn->GetSubNet() ) /* the track segment is already a cluster member */
|
||||||
{
|
{
|
||||||
if( pt_autre_piste->GetSubNet() )
|
if( pt_other_trace->GetSubNet() )
|
||||||
{
|
{
|
||||||
Merge_Two_SubNets( pt_start_conn, pt_end_conn,
|
Merge_Two_SubNets( pt_start_conn, pt_end_conn,
|
||||||
pt_autre_piste->GetSubNet(), pt_conn->GetSubNet() );
|
pt_other_trace->GetSubNet(), pt_conn->GetSubNet() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
pt_autre_piste->SetSubNet( pt_conn->GetSubNet() );
|
{
|
||||||
|
pt_other_trace->SetSubNet( pt_conn->GetSubNet() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else /* the track segment is not yet attached to a cluster */
|
else /* the track segment is not yet attached to a cluster */
|
||||||
{
|
{
|
||||||
if( pt_autre_piste->GetSubNet() )
|
if( pt_other_trace->GetSubNet() )
|
||||||
{
|
{
|
||||||
pt_conn->SetSubNet( pt_autre_piste->GetSubNet() );
|
pt_conn->SetSubNet( pt_other_trace->GetSubNet() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sub_netcode++;
|
sub_netcode++;
|
||||||
pt_conn->SetSubNet( sub_netcode );
|
pt_conn->SetSubNet( sub_netcode );
|
||||||
pt_autre_piste->SetSubNet( pt_conn->GetSubNet() );
|
pt_other_trace->SetSubNet( pt_conn->GetSubNet() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pt_conn == pt_end_conn )
|
if( pt_conn == pt_end_conn )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************/
|
|
||||||
void PCB_BASE_FRAME::test_connexions( wxDC* DC )
|
|
||||||
/***************************************************/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function testing the connections relative to all nets
|
* Function testing the connections relative to all nets
|
||||||
* This function update the status of the ratsnest ( flag CH_ACTIF = 0 if a connection is found, = 1 else)
|
* This function update the status of the ratsnest ( flag CH_ACTIF = 0 if a connection
|
||||||
* track segments are assumed to be sorted by net codes.
|
* is found, = 1 else) track segments are assumed to be sorted by net codes.
|
||||||
* This is the case because when a new track is added, it is inserted in the linked list according to its net code.
|
* This is the case because when a new track is added, it is inserted in the linked list
|
||||||
* and when nets are changed (when a new netlist is read) tracks are sorted before using this function
|
* according to its net code. and when nets are changed (when a new netlist is read)
|
||||||
|
* tracks are sorted before using this function
|
||||||
* @param DC = current Device Context
|
* @param DC = current Device Context
|
||||||
*/
|
*/
|
||||||
|
void PCB_BASE_FRAME::test_connexions( wxDC* DC )
|
||||||
{
|
{
|
||||||
// Clear the cluster identifier for all pads
|
// Clear the cluster identifier for all pads
|
||||||
for( unsigned i = 0; i< m_Pcb->GetPadsCount(); ++i )
|
for( unsigned i = 0; i< m_Pcb->GetPadsCount(); ++i )
|
||||||
|
@ -309,16 +323,13 @@ void PCB_BASE_FRAME::test_connexions( wxDC* DC )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
|
||||||
void PCB_BASE_FRAME::test_1_net_connexion( wxDC* DC, int net_code )
|
|
||||||
/*************************************************************************/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function testing the connections relative to a given net
|
* Function testing the connections relative to a given net
|
||||||
* track segments are assumed to be sorted by net codes
|
* track segments are assumed to be sorted by net codes
|
||||||
* @param DC = current Device Context
|
* @param DC = current Device Context
|
||||||
* @param net_code = net code to test
|
* @param net_code = net code to test
|
||||||
*/
|
*/
|
||||||
|
void PCB_BASE_FRAME::test_1_net_connexion( wxDC* DC, int net_code )
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
|
@ -326,7 +337,7 @@ void PCB_BASE_FRAME::test_1_net_connexion( wxDC* DC, int net_code )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( (m_Pcb->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK) == 0 )
|
if( (m_Pcb->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK) == 0 )
|
||||||
Compile_Ratsnest( DC, TRUE );
|
Compile_Ratsnest( DC, true );
|
||||||
|
|
||||||
for( unsigned i = 0; i<m_Pcb->GetPadsCount(); ++i )
|
for( unsigned i = 0; i<m_Pcb->GetPadsCount(); ++i )
|
||||||
{
|
{
|
||||||
|
@ -355,11 +366,12 @@ void PCB_BASE_FRAME::test_1_net_connexion( wxDC* DC, int net_code )
|
||||||
if( pt_start_conn )
|
if( pt_start_conn )
|
||||||
pt_end_conn = pt_start_conn->GetEndNetCode( net_code );
|
pt_end_conn = pt_start_conn->GetEndNetCode( net_code );
|
||||||
|
|
||||||
if( pt_start_conn && pt_end_conn ) // c.a.d. s'il y a des segments
|
if( pt_start_conn && pt_end_conn ) // c.a.d. if there are segments
|
||||||
{
|
{
|
||||||
Build_Pads_Info_Connections_By_Tracks( pt_start_conn, pt_end_conn );
|
Build_Pads_Info_Connections_By_Tracks( pt_start_conn, pt_end_conn );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Merge_SubNets_Connected_By_CopperAreas( m_Pcb, net_code );
|
Merge_SubNets_Connected_By_CopperAreas( m_Pcb, net_code );
|
||||||
|
|
||||||
/* Test the rastnest for this net */
|
/* Test the rastnest for this net */
|
||||||
|
@ -375,10 +387,6 @@ void PCB_BASE_FRAME::test_1_net_connexion( wxDC* DC, int net_code )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************************/
|
|
||||||
static void Build_Pads_Info_Connections_By_Tracks( TRACK* pt_start_conn, TRACK* pt_end_conn )
|
|
||||||
/*******************************************************************************************/
|
|
||||||
|
|
||||||
/** Used after a track change (delete a track ou add a track)
|
/** Used after a track change (delete a track ou add a track)
|
||||||
* Compute connections (initialize the .start and .end members) for a single net.
|
* Compute connections (initialize the .start and .end members) for a single net.
|
||||||
* tracks must be sorted by net, as usual
|
* tracks must be sorted by net, as usual
|
||||||
|
@ -388,6 +396,7 @@ static void Build_Pads_Info_Connections_By_Tracks( TRACK* pt_start_conn, TRACK*
|
||||||
* If a track is deleted, the other pointers to pads do not change.
|
* If a track is deleted, the other pointers to pads do not change.
|
||||||
* When a track is added, its pointers to pads are already initialized
|
* When a track is added, its pointers to pads are already initialized
|
||||||
*/
|
*/
|
||||||
|
static void Build_Pads_Info_Connections_By_Tracks( TRACK* pt_start_conn, TRACK* pt_end_conn )
|
||||||
{
|
{
|
||||||
TRACK* Track;
|
TRACK* Track;
|
||||||
|
|
||||||
|
@ -413,6 +422,7 @@ static void Build_Pads_Info_Connections_By_Tracks( TRACK* pt_start_conn, TRACK*
|
||||||
{
|
{
|
||||||
TRACK* pt_segm;
|
TRACK* pt_segm;
|
||||||
int layermask = Track->ReturnMaskLayer();
|
int layermask = Track->ReturnMaskLayer();
|
||||||
|
|
||||||
for( pt_segm = pt_start_conn; pt_segm != NULL; pt_segm = pt_segm->Next() )
|
for( pt_segm = pt_start_conn; pt_segm != NULL; pt_segm = pt_segm->Next() )
|
||||||
{
|
{
|
||||||
int curlayermask = pt_segm->ReturnMaskLayer();
|
int curlayermask = pt_segm->ReturnMaskLayer();
|
||||||
|
@ -428,6 +438,7 @@ static void Build_Pads_Info_Connections_By_Tracks( TRACK* pt_start_conn, TRACK*
|
||||||
{
|
{
|
||||||
pt_segm->end = Track;
|
pt_segm->end = Track;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pt_segm == pt_end_conn )
|
if( pt_segm == pt_end_conn )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -435,12 +446,12 @@ static void Build_Pads_Info_Connections_By_Tracks( TRACK* pt_start_conn, TRACK*
|
||||||
|
|
||||||
if( Track->start == NULL ) // end track not already connected, search a connection
|
if( Track->start == NULL ) // end track not already connected, search a connection
|
||||||
{
|
{
|
||||||
Track->start = Locate_Piste_Connectee( Track, Track, pt_end_conn, START );
|
Track->start = GetConnectedTrace( Track, Track, pt_end_conn, START );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( Track->end == NULL ) // end track not already connected, search a connection
|
if( Track->end == NULL ) // end track not already connected, search a connection
|
||||||
{
|
{
|
||||||
Track->end = Locate_Piste_Connectee( Track, Track, pt_end_conn, END );
|
Track->end = GetConnectedTrace( Track, Track, pt_end_conn, END );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( Track == pt_end_conn )
|
if( Track == pt_end_conn )
|
||||||
|
@ -460,18 +471,19 @@ static void Build_Pads_Info_Connections_By_Tracks( TRACK* pt_start_conn, TRACK*
|
||||||
* A track is seen as connected if the px, py position is same as the pad position.
|
* A track is seen as connected if the px, py position is same as the pad position.
|
||||||
*
|
*
|
||||||
* @param aPcb = the board.
|
* @param aPcb = the board.
|
||||||
* @param pt_liste = Pointers to pads buffer
|
* @param pt_liste = Pointers to pads buffer. This buffer is a list like the list
|
||||||
* This buffer is a list like the list created by build_liste_pad, but sorted by increasing X pad coordinate
|
* created by build_liste_pad, but sorted by increasing X pad coordinate
|
||||||
* @param posref = reference coordinate
|
* @param posref = reference coordinate
|
||||||
* @param masque_layer = Layers (bit to bit) to consider
|
* @param aLayerMask = Layers (bit to bit) to consider
|
||||||
* @return : pointer on the connected pad
|
* @return : pointer on the connected pad. This function uses a fast search in this sorted
|
||||||
* This function uses a fast search in this sorted pad list and it is faster than Fast_Locate_Pad_connecte(),
|
* pad list and it is faster than Fast_Locate_Pad_connecte(),
|
||||||
* But this sorted pad list must be built before calling this function.
|
* But this sorted pad list must be built before calling this function.
|
||||||
*
|
*
|
||||||
* (Note: The usual pad list (created by build_liste_pad) m_Pcb->m_Pads is sorted by increasing netcodes )
|
* (Note: The usual pad list (created by build_liste_pad) m_Pcb->m_Pads is sorted by
|
||||||
|
* increasing netcodes )
|
||||||
*/
|
*/
|
||||||
static D_PAD* SuperFast_Locate_Pad_Connecte( BOARD* aPcb, LISTE_PAD* pt_liste,
|
static D_PAD* SuperFast_Locate_Pad_Connecte( BOARD* aPcb, LISTE_PAD* pt_liste,
|
||||||
const wxPoint& posref, int masque_layer )
|
const wxPoint& posref, int aLayerMask )
|
||||||
{
|
{
|
||||||
D_PAD* pad;
|
D_PAD* pad;
|
||||||
int ii;
|
int ii;
|
||||||
|
@ -481,6 +493,7 @@ static D_PAD* SuperFast_Locate_Pad_Connecte( BOARD* aPcb, LISTE_PAD* pt_liste,
|
||||||
LISTE_PAD* lim = pt_liste + nb_pad - 1;
|
LISTE_PAD* lim = pt_liste + nb_pad - 1;
|
||||||
|
|
||||||
ptr_pad = pt_liste;
|
ptr_pad = pt_liste;
|
||||||
|
|
||||||
while( nb_pad )
|
while( nb_pad )
|
||||||
{
|
{
|
||||||
pad = *ptr_pad;
|
pad = *ptr_pad;
|
||||||
|
@ -493,15 +506,20 @@ static D_PAD* SuperFast_Locate_Pad_Connecte( BOARD* aPcb, LISTE_PAD* pt_liste,
|
||||||
if( pad->m_Pos.x < posref.x ) /* Must search after this item */
|
if( pad->m_Pos.x < posref.x ) /* Must search after this item */
|
||||||
{
|
{
|
||||||
ptr_pad += nb_pad;
|
ptr_pad += nb_pad;
|
||||||
|
|
||||||
if( ptr_pad > lim )
|
if( ptr_pad > lim )
|
||||||
ptr_pad = lim;
|
ptr_pad = lim;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pad->m_Pos.x > posref.x ) /* Must search before this item */
|
if( pad->m_Pos.x > posref.x ) /* Must search before this item */
|
||||||
{
|
{
|
||||||
ptr_pad -= nb_pad;
|
ptr_pad -= nb_pad;
|
||||||
|
|
||||||
if( ptr_pad < pt_liste )
|
if( ptr_pad < pt_liste )
|
||||||
ptr_pad = pt_liste;
|
ptr_pad = pt_liste;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -511,6 +529,7 @@ static D_PAD* SuperFast_Locate_Pad_Connecte( BOARD* aPcb, LISTE_PAD* pt_liste,
|
||||||
while( ptr_pad >= pt_liste )
|
while( ptr_pad >= pt_liste )
|
||||||
{
|
{
|
||||||
pad = *ptr_pad;
|
pad = *ptr_pad;
|
||||||
|
|
||||||
if( pad->m_Pos.x == posref.x )
|
if( pad->m_Pos.x == posref.x )
|
||||||
ptr_pad--;
|
ptr_pad--;
|
||||||
else
|
else
|
||||||
|
@ -525,6 +544,7 @@ static D_PAD* SuperFast_Locate_Pad_Connecte( BOARD* aPcb, LISTE_PAD* pt_liste,
|
||||||
return NULL; /* outside suitable block */
|
return NULL; /* outside suitable block */
|
||||||
|
|
||||||
pad = *ptr_pad;
|
pad = *ptr_pad;
|
||||||
|
|
||||||
if( pad->m_Pos.x != posref.x )
|
if( pad->m_Pos.x != posref.x )
|
||||||
return NULL; /* outside suitable block */
|
return NULL; /* outside suitable block */
|
||||||
|
|
||||||
|
@ -532,7 +552,7 @@ static D_PAD* SuperFast_Locate_Pad_Connecte( BOARD* aPcb, LISTE_PAD* pt_liste,
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* A Pad if found here: but it must mach the layer */
|
/* A Pad if found here: but it must mach the layer */
|
||||||
if( pad->m_Masque_Layer & masque_layer ) // Matches layer => a connected pad is found !
|
if( pad->m_layerMask & aLayerMask ) // Matches layer => a connected pad is found !
|
||||||
return pad;
|
return pad;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -555,33 +575,30 @@ static int SortPadsByXCoord( const void* pt_ref, const void* pt_comp )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
void CreateSortedPadListByXCoord( BOARD* aBoard, std::vector<D_PAD*>* aVector )
|
void CreateSortedPadListByXCoord( BOARD* aBoard, std::vector<D_PAD*>* aVector )
|
||||||
/*****************************************************************************/
|
|
||||||
{
|
{
|
||||||
aVector->insert( aVector->end(), aBoard->m_NetInfo->m_PadsFullList.begin(), aBoard->m_NetInfo->m_PadsFullList.end() );
|
aVector->insert( aVector->end(), aBoard->m_NetInfo->m_PadsFullList.begin(),
|
||||||
|
aBoard->m_NetInfo->m_PadsFullList.end() );
|
||||||
|
|
||||||
qsort( &(*aVector)[0], aBoard->GetPadsCount(), sizeof( D_PAD*), SortPadsByXCoord );
|
qsort( &(*aVector)[0], aBoard->GetPadsCount(), sizeof( D_PAD*), SortPadsByXCoord );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************************************************/
|
|
||||||
void PCB_BASE_FRAME::RecalculateAllTracksNetcode()
|
|
||||||
/********************************************************************/
|
|
||||||
|
|
||||||
/* search connections between tracks and pads, and propagate pad net codes to the track segments
|
/* search connections between tracks and pads, and propagate pad net codes to the track segments
|
||||||
* This is a 2 pass computation.
|
* This is a 2 pass computation.
|
||||||
* First:
|
* First:
|
||||||
* We search a connection between a track segment and a pad: if found : this segment netcode is set to the pad netcode
|
* We search a connection between a track segment and a pad: if found : this segment netcode
|
||||||
|
* is set to the pad netcode
|
||||||
*/
|
*/
|
||||||
|
void PCB_BASE_FRAME::RecalculateAllTracksNetcode()
|
||||||
{
|
{
|
||||||
TRACK* pt_piste;
|
TRACK* pt_trace;
|
||||||
TRACK* pt_next;
|
TRACK* pt_next;
|
||||||
char new_passe_request = 1;
|
char new_passe_request = 1;
|
||||||
|
|
||||||
std::vector<D_PAD*> sortedPads;
|
std::vector<D_PAD*> sortedPads;
|
||||||
BOARD_ITEM* PtStruct;
|
BOARD_ITEM* PtStruct;
|
||||||
int masque_layer;
|
int layerMask;
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
// Build the net info list
|
// Build the net info list
|
||||||
|
@ -589,14 +606,16 @@ void PCB_BASE_FRAME::RecalculateAllTracksNetcode()
|
||||||
|
|
||||||
if( m_Pcb->GetPadsCount() == 0 ) // If no pad, reset pointers and netcode, and do nothing else
|
if( m_Pcb->GetPadsCount() == 0 ) // If no pad, reset pointers and netcode, and do nothing else
|
||||||
{
|
{
|
||||||
pt_piste = m_Pcb->m_Track;
|
pt_trace = m_Pcb->m_Track;
|
||||||
for( ; pt_piste != NULL; pt_piste = pt_piste->Next() )
|
|
||||||
|
for( ; pt_trace != NULL; pt_trace = pt_trace->Next() )
|
||||||
{
|
{
|
||||||
pt_piste->start = NULL;
|
pt_trace->start = NULL;
|
||||||
pt_piste->SetState( BEGIN_ONPAD | END_ONPAD, OFF );
|
pt_trace->SetState( BEGIN_ONPAD | END_ONPAD, OFF );
|
||||||
pt_piste->SetNet( 0 );
|
pt_trace->SetNet( 0 );
|
||||||
pt_piste->end = NULL;
|
pt_trace->end = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -606,43 +625,45 @@ void PCB_BASE_FRAME::RecalculateAllTracksNetcode()
|
||||||
CreateSortedPadListByXCoord( m_Pcb, &sortedPads );
|
CreateSortedPadListByXCoord( m_Pcb, &sortedPads );
|
||||||
|
|
||||||
/* Reset variables and flags used in computation */
|
/* Reset variables and flags used in computation */
|
||||||
pt_piste = m_Pcb->m_Track;
|
pt_trace = m_Pcb->m_Track;
|
||||||
for( ; pt_piste != NULL; pt_piste = pt_piste->Next() )
|
|
||||||
|
for( ; pt_trace != NULL; pt_trace = pt_trace->Next() )
|
||||||
{
|
{
|
||||||
pt_piste->SetState( BUSY | IN_EDIT | BEGIN_ONPAD | END_ONPAD, OFF );
|
pt_trace->SetState( BUSY | IN_EDIT | BEGIN_ONPAD | END_ONPAD, OFF );
|
||||||
pt_piste->SetZoneSubNet( 0 );
|
pt_trace->SetZoneSubNet( 0 );
|
||||||
pt_piste->SetNet( 0 ); // net code = 0 means not connected
|
pt_trace->SetNet( 0 ); // net code = 0 means not connected
|
||||||
}
|
}
|
||||||
|
|
||||||
/* First pass: search connection between a track segment and a pad.
|
/* First pass: search connection between a track segment and a pad.
|
||||||
* if found, set the track net code to the pad netcode
|
* if found, set the track net code to the pad netcode
|
||||||
*/
|
*/
|
||||||
pt_piste = m_Pcb->m_Track;
|
pt_trace = m_Pcb->m_Track;
|
||||||
for( ; pt_piste != NULL; pt_piste = pt_piste->Next() )
|
|
||||||
|
for( ; pt_trace != NULL; pt_trace = pt_trace->Next() )
|
||||||
{
|
{
|
||||||
masque_layer = g_TabOneLayerMask[pt_piste->GetLayer()];
|
layerMask = g_TabOneLayerMask[pt_trace->GetLayer()];
|
||||||
|
|
||||||
/* Search for a pad on the segment starting point */
|
/* Search for a pad on the segment starting point */
|
||||||
pt_piste->start = SuperFast_Locate_Pad_Connecte( m_Pcb,
|
pt_trace->start = SuperFast_Locate_Pad_Connecte( m_Pcb,
|
||||||
&sortedPads[0],
|
&sortedPads[0],
|
||||||
pt_piste->m_Start,
|
pt_trace->m_Start,
|
||||||
masque_layer );
|
layerMask );
|
||||||
if( pt_piste->start != NULL )
|
if( pt_trace->start != NULL )
|
||||||
{
|
{
|
||||||
pt_piste->SetState( BEGIN_ONPAD, ON );
|
pt_trace->SetState( BEGIN_ONPAD, ON );
|
||||||
pt_piste->SetNet( ( (D_PAD*) (pt_piste->start) )->GetNet() );
|
pt_trace->SetNet( ( (D_PAD*) (pt_trace->start) )->GetNet() );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Search for a pad on the segment ending point */
|
/* Search for a pad on the segment ending point */
|
||||||
pt_piste->end = SuperFast_Locate_Pad_Connecte( m_Pcb,
|
pt_trace->end = SuperFast_Locate_Pad_Connecte( m_Pcb,
|
||||||
&sortedPads[0],
|
&sortedPads[0],
|
||||||
pt_piste->m_End,
|
pt_trace->m_End,
|
||||||
masque_layer );
|
layerMask );
|
||||||
|
|
||||||
if( pt_piste->end != NULL )
|
if( pt_trace->end != NULL )
|
||||||
{
|
{
|
||||||
pt_piste->SetState( END_ONPAD, ON );
|
pt_trace->SetState( END_ONPAD, ON );
|
||||||
pt_piste->SetNet( ( (D_PAD*) (pt_piste->end) )->GetNet() );
|
pt_trace->SetNet( ( (D_PAD*) (pt_trace->end) )->GetNet() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -657,16 +678,16 @@ void PCB_BASE_FRAME::RecalculateAllTracksNetcode()
|
||||||
* when a track has a net code and the other has a null net code, the null net code is changed
|
* when a track has a net code and the other has a null net code, the null net code is changed
|
||||||
*/
|
*/
|
||||||
|
|
||||||
for( pt_piste = m_Pcb->m_Track; pt_piste != NULL; pt_piste = pt_piste->Next() )
|
for( pt_trace = m_Pcb->m_Track; pt_trace != NULL; pt_trace = pt_trace->Next() )
|
||||||
{
|
{
|
||||||
if( pt_piste->start == NULL )
|
if( pt_trace->start == NULL )
|
||||||
{
|
{
|
||||||
pt_piste->start = Locate_Piste_Connectee( pt_piste, m_Pcb->m_Track, NULL, START );
|
pt_trace->start = GetConnectedTrace( pt_trace, m_Pcb->m_Track, NULL, START );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pt_piste->end == NULL )
|
if( pt_trace->end == NULL )
|
||||||
{
|
{
|
||||||
pt_piste->end = Locate_Piste_Connectee( pt_piste, m_Pcb->m_Track, NULL, END );
|
pt_trace->end = GetConnectedTrace( pt_trace, m_Pcb->m_Track, NULL, END );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -676,7 +697,7 @@ void PCB_BASE_FRAME::RecalculateAllTracksNetcode()
|
||||||
|
|
||||||
while( new_passe_request )
|
while( new_passe_request )
|
||||||
{
|
{
|
||||||
bool reset_flag = FALSE;
|
bool reset_flag = false;
|
||||||
new_passe_request = 0;
|
new_passe_request = 0;
|
||||||
|
|
||||||
/* look for vias which could be connect many tracks */
|
/* look for vias which could be connect many tracks */
|
||||||
|
@ -690,77 +711,83 @@ void PCB_BASE_FRAME::RecalculateAllTracksNetcode()
|
||||||
|
|
||||||
// Lock for a connection to a track with a known netcode
|
// Lock for a connection to a track with a known netcode
|
||||||
pt_next = m_Pcb->m_Track;
|
pt_next = m_Pcb->m_Track;
|
||||||
while( ( pt_next = Locate_Piste_Connectee( via, pt_next, NULL, START ) ) != NULL )
|
|
||||||
|
while( ( pt_next = GetConnectedTrace( via, pt_next, NULL, START ) ) != NULL )
|
||||||
{
|
{
|
||||||
if( pt_next->GetNet() )
|
if( pt_next->GetNet() )
|
||||||
{
|
{
|
||||||
via->SetNet( pt_next->GetNet() );
|
via->SetNet( pt_next->GetNet() );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
pt_next->SetState( BUSY, ON );
|
pt_next->SetState( BUSY, ON );
|
||||||
reset_flag = TRUE;
|
reset_flag = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( reset_flag )
|
if( reset_flag )
|
||||||
for( pt_piste = m_Pcb->m_Track; pt_piste != NULL; pt_piste = pt_piste->Next() )
|
for( pt_trace = m_Pcb->m_Track; pt_trace != NULL; pt_trace = pt_trace->Next() )
|
||||||
{
|
{
|
||||||
pt_piste->SetState( BUSY, OFF );
|
pt_trace->SetState( BUSY, OFF );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set the netcode of connected tracks: if at track is connected to a pad, its net code is already set.
|
/* set the netcode of connected tracks: if at track is connected to a pad, its net
|
||||||
|
* code is already set.
|
||||||
* if the current track is connected to an other track:
|
* if the current track is connected to an other track:
|
||||||
* if a track has a net code, it is used for the other track.
|
* if a track has a net code, it is used for the other track.
|
||||||
* Thus there is a propagation of the netcode from a track to an other.
|
* Thus there is a propagation of the netcode from a track to an other.
|
||||||
* if none of the 2 track has a net code we do nothing
|
* if none of the 2 track has a net code we do nothing
|
||||||
* the iteration is stopped when no new change occurs
|
* the iteration is stopped when no new change occurs
|
||||||
*/
|
*/
|
||||||
for( pt_piste = m_Pcb->m_Track; pt_piste != NULL; pt_piste = pt_piste->Next() )
|
for( pt_trace = m_Pcb->m_Track; pt_trace != NULL; pt_trace = pt_trace->Next() )
|
||||||
{
|
{
|
||||||
/* look for the connection to the current segment starting point */
|
/* look for the connection to the current segment starting point */
|
||||||
PtStruct = (BOARD_ITEM*) pt_piste->start;
|
PtStruct = (BOARD_ITEM*) pt_trace->start;
|
||||||
|
|
||||||
if( PtStruct && (PtStruct->Type() != TYPE_PAD) )
|
if( PtStruct && (PtStruct->Type() != TYPE_PAD) )
|
||||||
{
|
{
|
||||||
// Begin on an other track segment
|
// Begin on an other track segment
|
||||||
pt_next = (TRACK*) PtStruct;
|
pt_next = (TRACK*) PtStruct;
|
||||||
if( pt_piste->GetNet() )
|
|
||||||
|
if( pt_trace->GetNet() )
|
||||||
{
|
{
|
||||||
if( pt_next->GetNet() == 0 ) // the current track has a netcode, we use it for the other track
|
if( pt_next->GetNet() == 0 ) // the current track has a netcode, we use it for the other track
|
||||||
{
|
{
|
||||||
new_passe_request = 1; // A change is made: a new iteration is requested.
|
new_passe_request = 1; // A change is made: a new iteration is requested.
|
||||||
pt_next->SetNet( pt_piste->GetNet() );
|
pt_next->SetNet( pt_trace->GetNet() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( pt_next->GetNet() != 0 ) // the other track has a netcode, we use it for the current track
|
if( pt_next->GetNet() != 0 ) // the other track has a netcode, we use it for the current track
|
||||||
{
|
{
|
||||||
pt_piste->SetNet( pt_next->GetNet() );
|
pt_trace->SetNet( pt_next->GetNet() );
|
||||||
new_passe_request = 1;
|
new_passe_request = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* look for the connection to the current segment ending point */
|
/* look for the connection to the current segment ending point */
|
||||||
PtStruct = pt_piste->end;
|
PtStruct = pt_trace->end;
|
||||||
|
|
||||||
if( PtStruct && (PtStruct->Type() != TYPE_PAD) )
|
if( PtStruct && (PtStruct->Type() != TYPE_PAD) )
|
||||||
{
|
{
|
||||||
pt_next = (TRACK*) PtStruct;
|
pt_next = (TRACK*) PtStruct;
|
||||||
|
|
||||||
// End on an other track: propagate netcode if possible
|
// End on an other track: propagate netcode if possible
|
||||||
if( pt_piste->GetNet() )
|
if( pt_trace->GetNet() )
|
||||||
{
|
{
|
||||||
if( pt_next->GetNet() == 0 )
|
if( pt_next->GetNet() == 0 )
|
||||||
{
|
{
|
||||||
new_passe_request = 1;
|
new_passe_request = 1;
|
||||||
pt_next->SetNet( pt_piste->GetNet() );
|
pt_next->SetNet( pt_trace->GetNet() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( pt_next->GetNet() != 0 )
|
if( pt_next->GetNet() != 0 )
|
||||||
{
|
{
|
||||||
pt_piste->SetNet( pt_next->GetNet() );
|
pt_trace->SetNet( pt_next->GetNet() );
|
||||||
new_passe_request = 1;
|
new_passe_request = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ TRACK* PCB_EDIT_FRAME::Delete_Segment( wxDC* DC, TRACK* aTrack )
|
||||||
D( g_CurrentTrackList.VerifyListIntegrity(); )
|
D( g_CurrentTrackList.VerifyListIntegrity(); )
|
||||||
|
|
||||||
// Delete the current trace
|
// Delete the current trace
|
||||||
ShowNewTrackWhenMovingCursor( DrawPanel, DC, wxDefaultPosition, FALSE );
|
ShowNewTrackWhenMovingCursor( DrawPanel, DC, wxDefaultPosition, false );
|
||||||
|
|
||||||
// delete the most recently entered
|
// delete the most recently entered
|
||||||
delete g_CurrentTrackList.PopBack();
|
delete g_CurrentTrackList.PopBack();
|
||||||
|
@ -51,13 +51,11 @@ TRACK* PCB_EDIT_FRAME::Delete_Segment( wxDC* DC, TRACK* aTrack )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while( g_CurrentTrackSegment && g_CurrentTrackSegment->Type() ==
|
while( g_CurrentTrackSegment && g_CurrentTrackSegment->Type() == TYPE_VIA )
|
||||||
TYPE_VIA )
|
|
||||||
{
|
{
|
||||||
delete g_CurrentTrackList.PopBack();
|
delete g_CurrentTrackList.PopBack();
|
||||||
|
|
||||||
if( g_CurrentTrackSegment && g_CurrentTrackSegment->Type() !=
|
if( g_CurrentTrackSegment && g_CurrentTrackSegment->Type() != TYPE_VIA )
|
||||||
TYPE_VIA )
|
|
||||||
previous_layer = g_CurrentTrackSegment->GetLayer();
|
previous_layer = g_CurrentTrackSegment->GetLayer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,8 +64,8 @@ TRACK* PCB_EDIT_FRAME::Delete_Segment( wxDC* DC, TRACK* aTrack )
|
||||||
setActiveLayer( previous_layer );
|
setActiveLayer( previous_layer );
|
||||||
|
|
||||||
UpdateStatusBar();
|
UpdateStatusBar();
|
||||||
if( g_TwoSegmentTrackBuild ) // We must have 2 segments or more,
|
|
||||||
// or 0
|
if( g_TwoSegmentTrackBuild ) // We must have 2 segments or more, or 0
|
||||||
{
|
{
|
||||||
if( g_CurrentTrackList.GetCount() == 1
|
if( g_CurrentTrackList.GetCount() == 1
|
||||||
&& g_CurrentTrackSegment->Type() != TYPE_VIA )
|
&& g_CurrentTrackSegment->Type() != TYPE_VIA )
|
||||||
|
@ -89,7 +87,7 @@ TRACK* PCB_EDIT_FRAME::Delete_Segment( wxDC* DC, TRACK* aTrack )
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( DrawPanel->IsMouseCaptured() )
|
if( DrawPanel->IsMouseCaptured() )
|
||||||
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, FALSE );
|
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
|
||||||
|
|
||||||
return g_CurrentTrackSegment;
|
return g_CurrentTrackSegment;
|
||||||
}
|
}
|
||||||
|
@ -178,8 +176,9 @@ void PCB_EDIT_FRAME::Remove_One_Track( wxDC* DC, TRACK* pt_segm )
|
||||||
if( pt_segm == NULL )
|
if( pt_segm == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TRACK* trackList = Marque_Une_Piste( GetBoard(), pt_segm,
|
TRACK* trackList = MarkTrace( GetBoard(), pt_segm, &segments_to_delete_count,
|
||||||
&segments_to_delete_count, NULL, NULL, true );
|
NULL, NULL, true );
|
||||||
|
|
||||||
if( segments_to_delete_count == 0 )
|
if( segments_to_delete_count == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -190,6 +189,7 @@ void PCB_EDIT_FRAME::Remove_One_Track( wxDC* DC, TRACK* pt_segm )
|
||||||
int ii = 0;
|
int ii = 0;
|
||||||
TRACK* tracksegment = trackList;
|
TRACK* tracksegment = trackList;
|
||||||
TRACK* next_track;
|
TRACK* next_track;
|
||||||
|
|
||||||
for( ; ii < segments_to_delete_count; ii++, tracksegment = next_track )
|
for( ; ii < segments_to_delete_count; ii++, tracksegment = next_track )
|
||||||
{
|
{
|
||||||
next_track = tracksegment->Next();
|
next_track = tracksegment->Next();
|
||||||
|
@ -212,6 +212,7 @@ void PCB_EDIT_FRAME::Remove_One_Track( wxDC* DC, TRACK* pt_segm )
|
||||||
}
|
}
|
||||||
|
|
||||||
SaveCopyInUndoList( itemsList, UR_DELETED );
|
SaveCopyInUndoList( itemsList, UR_DELETED );
|
||||||
|
|
||||||
if( net_code > 0 )
|
if( net_code > 0 )
|
||||||
test_1_net_connexion( DC, net_code );
|
test_1_net_connexion( DC, net_code );
|
||||||
}
|
}
|
||||||
|
|
|
@ -565,7 +565,7 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event )
|
||||||
m_CurrentModule->m_3D_Drawings.PushBack( new S3D_MASTER( m_CurrentModule ) );
|
m_CurrentModule->m_3D_Drawings.PushBack( new S3D_MASTER( m_CurrentModule ) );
|
||||||
|
|
||||||
|
|
||||||
m_CurrentModule->Set_Rectangle_Encadrement();
|
m_CurrentModule->CalculateBoundingBox();
|
||||||
|
|
||||||
m_Parent->OnModify();
|
m_Parent->OnModify();
|
||||||
|
|
||||||
|
|
|
@ -412,7 +412,7 @@ void DIALOG_MODULE_MODULE_EDITOR::OnOkClick( wxCommandEvent& event )
|
||||||
m_CurrentModule->m_3D_Drawings.PushBack( new S3D_MASTER( m_CurrentModule ) );
|
m_CurrentModule->m_3D_Drawings.PushBack( new S3D_MASTER( m_CurrentModule ) );
|
||||||
|
|
||||||
|
|
||||||
m_CurrentModule->Set_Rectangle_Encadrement();
|
m_CurrentModule->CalculateBoundingBox();
|
||||||
|
|
||||||
m_Parent->OnModify();
|
m_Parent->OnModify();
|
||||||
|
|
||||||
|
|
|
@ -94,12 +94,12 @@ void DIALOG_PAD_PROPERTIES::OnPaintShowPanel( wxPaintEvent& event )
|
||||||
|
|
||||||
int color = 0;
|
int color = 0;
|
||||||
|
|
||||||
if( m_dummyPad->m_Masque_Layer & LAYER_FRONT )
|
if( m_dummyPad->m_layerMask & LAYER_FRONT )
|
||||||
{
|
{
|
||||||
color = m_Board->GetVisibleElementColor( PAD_FR_VISIBLE );
|
color = m_Board->GetVisibleElementColor( PAD_FR_VISIBLE );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_dummyPad->m_Masque_Layer & LAYER_BACK )
|
if( m_dummyPad->m_layerMask & LAYER_BACK )
|
||||||
{
|
{
|
||||||
color |= m_Board->GetVisibleElementColor( PAD_BK_VISIBLE );
|
color |= m_Board->GetVisibleElementColor( PAD_BK_VISIBLE );
|
||||||
}
|
}
|
||||||
|
@ -202,7 +202,7 @@ void DIALOG_PAD_PROPERTIES::initValues()
|
||||||
NEGATE( m_dummyPad->m_Offset.y );
|
NEGATE( m_dummyPad->m_Offset.y );
|
||||||
NEGATE( m_dummyPad->m_DeltaSize.y );
|
NEGATE( m_dummyPad->m_DeltaSize.y );
|
||||||
/* flip pads layers*/
|
/* flip pads layers*/
|
||||||
m_dummyPad->m_Masque_Layer = ChangeSideMaskLayer( m_dummyPad->m_Masque_Layer );
|
m_dummyPad->m_layerMask = ChangeSideMaskLayer( m_dummyPad->m_layerMask );
|
||||||
}
|
}
|
||||||
m_staticTextWarningPadFlipped->Show(m_isFlipped);
|
m_staticTextWarningPadFlipped->Show(m_isFlipped);
|
||||||
|
|
||||||
|
@ -284,7 +284,7 @@ void DIALOG_PAD_PROPERTIES::initValues()
|
||||||
NORMALIZE_ANGLE_180( m_dummyPad->m_Orient );
|
NORMALIZE_ANGLE_180( m_dummyPad->m_Orient );
|
||||||
|
|
||||||
// Set layers used by this pad: :
|
// Set layers used by this pad: :
|
||||||
SetPadLayersList( m_dummyPad->m_Masque_Layer );
|
SetPadLayersList( m_dummyPad->m_layerMask );
|
||||||
|
|
||||||
msg.Clear();
|
msg.Clear();
|
||||||
msg << m_dummyPad->m_Orient;
|
msg << m_dummyPad->m_Orient;
|
||||||
|
@ -621,13 +621,13 @@ void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event )
|
||||||
|
|
||||||
m_CurrentPad->m_LengthDie = g_Pad_Master.m_LengthDie;
|
m_CurrentPad->m_LengthDie = g_Pad_Master.m_LengthDie;
|
||||||
|
|
||||||
if( m_CurrentPad->m_Masque_Layer != g_Pad_Master.m_Masque_Layer )
|
if( m_CurrentPad->m_layerMask != g_Pad_Master.m_layerMask )
|
||||||
{
|
{
|
||||||
rastnestIsChanged = true;
|
rastnestIsChanged = true;
|
||||||
m_CurrentPad->m_Masque_Layer = g_Pad_Master.m_Masque_Layer;
|
m_CurrentPad->m_layerMask = g_Pad_Master.m_layerMask;
|
||||||
}
|
}
|
||||||
if( m_isFlipped )
|
if( m_isFlipped )
|
||||||
m_CurrentPad->m_Masque_Layer = ChangeSideMaskLayer( m_CurrentPad->m_Masque_Layer );
|
m_CurrentPad->m_layerMask = ChangeSideMaskLayer( m_CurrentPad->m_layerMask );
|
||||||
|
|
||||||
m_CurrentPad->SetPadName( g_Pad_Master.ReturnStringPadName() );
|
m_CurrentPad->SetPadName( g_Pad_Master.ReturnStringPadName() );
|
||||||
|
|
||||||
|
@ -660,7 +660,7 @@ void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event )
|
||||||
|
|
||||||
m_CurrentPad->ComputeShapeMaxRadius();
|
m_CurrentPad->ComputeShapeMaxRadius();
|
||||||
|
|
||||||
Module->Set_Rectangle_Encadrement();
|
Module->CalculateBoundingBox();
|
||||||
m_CurrentPad->DisplayInfo( m_Parent );
|
m_CurrentPad->DisplayInfo( m_Parent );
|
||||||
|
|
||||||
// redraw the area where the pad was
|
// redraw the area where the pad was
|
||||||
|
@ -862,7 +862,7 @@ bool DIALOG_PAD_PROPERTIES::TransfertDataToPad( D_PAD* aPad, bool aPromptOnError
|
||||||
if( m_PadLayerDraft->GetValue() )
|
if( m_PadLayerDraft->GetValue() )
|
||||||
PadLayerMask |= DRAW_LAYER;
|
PadLayerMask |= DRAW_LAYER;
|
||||||
|
|
||||||
aPad->m_Masque_Layer = PadLayerMask;
|
aPad->m_layerMask = PadLayerMask;
|
||||||
|
|
||||||
/* Test for incorrect values */
|
/* Test for incorrect values */
|
||||||
if( aPromptOnError )
|
if( aPromptOnError )
|
||||||
|
|
|
@ -9,10 +9,10 @@
|
||||||
class DRAG_SEGM
|
class DRAG_SEGM
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TRACK* m_Segm; /* pointeur sur le segment a "dragger */
|
TRACK* m_Segm; /* pointer to the segment a "dragger */
|
||||||
D_PAD* m_Pad_Start; /* pointeur sur le Pad origine si origine segment sur pad */
|
D_PAD* m_Pad_Start; /* pointer to the pad origin if origin segment of pad */
|
||||||
D_PAD* m_Pad_End; /* pointeur sur le Pad fin si fin segment sur pad */
|
D_PAD* m_Pad_End; /* pointer to the pad end if end segment of pad */
|
||||||
int m_Flag; /* indicateur divers */
|
int m_Flag; /* indicator flags */
|
||||||
|
|
||||||
private:
|
private:
|
||||||
wxPoint m_StartInitialValue;
|
wxPoint m_StartInitialValue;
|
||||||
|
@ -38,11 +38,11 @@ public:
|
||||||
extern std::vector<DRAG_SEGM> g_DragSegmentList;
|
extern std::vector<DRAG_SEGM> g_DragSegmentList;
|
||||||
|
|
||||||
/* Functions */
|
/* Functions */
|
||||||
void Dessine_Segments_Dragges( EDA_DRAW_PANEL* panel, wxDC* DC );
|
void DrawSegmentWhileMovingFootprint( EDA_DRAW_PANEL* panel, wxDC* DC );
|
||||||
void Build_Drag_Liste( EDA_DRAW_PANEL* panel, wxDC* DC, MODULE* Module );
|
void Build_Drag_Liste( EDA_DRAW_PANEL* panel, wxDC* DC, MODULE* Module );
|
||||||
void Build_1_Pad_SegmentsToDrag( EDA_DRAW_PANEL* panel, wxDC* DC, D_PAD* PtPad );
|
void Build_1_Pad_SegmentsToDrag( EDA_DRAW_PANEL* panel, wxDC* DC, D_PAD* PtPad );
|
||||||
void Collect_TrackSegmentsToDrag( EDA_DRAW_PANEL* panel, wxDC* DC,
|
void Collect_TrackSegmentsToDrag( EDA_DRAW_PANEL* panel, wxDC* DC,
|
||||||
wxPoint& point, int MasqueLayer, int net_code );
|
wxPoint& point, int LayerMask, int net_code );
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -26,10 +26,8 @@ DRAG_SEGM::DRAG_SEGM( TRACK* segm )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************/
|
|
||||||
void Dessine_Segments_Dragges( EDA_DRAW_PANEL* panel, wxDC* DC )
|
|
||||||
/*******************************************************************/
|
|
||||||
/* Redraw the list of segments starting in g_DragSegmentList, while moving a footprint */
|
/* Redraw the list of segments starting in g_DragSegmentList, while moving a footprint */
|
||||||
|
void DrawSegmentWhileMovingFootprint( EDA_DRAW_PANEL* panel, wxDC* DC )
|
||||||
{
|
{
|
||||||
D_PAD* pt_pad;
|
D_PAD* pt_pad;
|
||||||
TRACK* Track;
|
TRACK* Track;
|
||||||
|
@ -45,6 +43,7 @@ void Dessine_Segments_Dragges( EDA_DRAW_PANEL* panel, wxDC* DC )
|
||||||
Track->Draw( panel, DC, GR_XOR ); // erase from screen at old position
|
Track->Draw( panel, DC, GR_XOR ); // erase from screen at old position
|
||||||
#endif
|
#endif
|
||||||
pt_pad = g_DragSegmentList[ii].m_Pad_Start;
|
pt_pad = g_DragSegmentList[ii].m_Pad_Start;
|
||||||
|
|
||||||
if( pt_pad )
|
if( pt_pad )
|
||||||
{
|
{
|
||||||
pos = pt_pad->m_Pos - g_Offset_Module;
|
pos = pt_pad->m_Pos - g_Offset_Module;
|
||||||
|
@ -52,6 +51,7 @@ void Dessine_Segments_Dragges( EDA_DRAW_PANEL* panel, wxDC* DC )
|
||||||
}
|
}
|
||||||
|
|
||||||
pt_pad = g_DragSegmentList[ii].m_Pad_End;
|
pt_pad = g_DragSegmentList[ii].m_Pad_End;
|
||||||
|
|
||||||
if( pt_pad )
|
if( pt_pad )
|
||||||
{
|
{
|
||||||
pos = pt_pad->m_Pos - g_Offset_Module;
|
pos = pt_pad->m_Pos - g_Offset_Module;
|
||||||
|
@ -63,18 +63,17 @@ void Dessine_Segments_Dragges( EDA_DRAW_PANEL* panel, wxDC* DC )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
|
||||||
void Build_Drag_Liste( EDA_DRAW_PANEL* panel, wxDC* DC, MODULE* Module )
|
|
||||||
/*************************************************************************/
|
|
||||||
/** Build the list of track segments connected to pads of a given module
|
/** Build the list of track segments connected to pads of a given module
|
||||||
* by populate the std::vector<DRAG_SEGM> g_DragSegmentList
|
* by populate the std::vector<DRAG_SEGM> g_DragSegmentList
|
||||||
* For each selected track segment set the EDIT flag
|
* For each selected track segment set the EDIT flag
|
||||||
* and redraw them in EDIT mode (sketch mode)
|
* and redraw them in EDIT mode (sketch mode)
|
||||||
*/
|
*/
|
||||||
|
void Build_Drag_Liste( EDA_DRAW_PANEL* panel, wxDC* DC, MODULE* Module )
|
||||||
{
|
{
|
||||||
D_PAD* pt_pad;
|
D_PAD* pt_pad;
|
||||||
|
|
||||||
pt_pad = Module->m_Pads;
|
pt_pad = Module->m_Pads;
|
||||||
|
|
||||||
for( ; pt_pad != NULL; pt_pad = (D_PAD*) pt_pad->Next() )
|
for( ; pt_pad != NULL; pt_pad = (D_PAD*) pt_pad->Next() )
|
||||||
{
|
{
|
||||||
Build_1_Pad_SegmentsToDrag( panel, DC, pt_pad );
|
Build_1_Pad_SegmentsToDrag( panel, DC, pt_pad );
|
||||||
|
@ -84,32 +83,31 @@ void Build_Drag_Liste( EDA_DRAW_PANEL* panel, wxDC* DC, MODULE* Module )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************************/
|
|
||||||
void Build_1_Pad_SegmentsToDrag( EDA_DRAW_PANEL* panel, wxDC* DC, D_PAD* PtPad )
|
|
||||||
/**********************************************************************************/
|
|
||||||
/** Build the list of track segments connected to a given pad
|
/** Build the list of track segments connected to a given pad
|
||||||
* by populate the std::vector<DRAG_SEGM> g_DragSegmentList
|
* by populate the std::vector<DRAG_SEGM> g_DragSegmentList
|
||||||
* For each selected track segment set the EDIT flag
|
* For each selected track segment set the EDIT flag
|
||||||
* and redraw them in EDIT mode (sketch mode)
|
* and redraw them in EDIT mode (sketch mode)
|
||||||
* Net codes must be OK.
|
* Net codes must be OK.
|
||||||
*/
|
*/
|
||||||
|
void Build_1_Pad_SegmentsToDrag( EDA_DRAW_PANEL* panel, wxDC* DC, D_PAD* PtPad )
|
||||||
{
|
{
|
||||||
TRACK* Track;
|
TRACK* Track;
|
||||||
int net_code = PtPad->GetNet();
|
int net_code = PtPad->GetNet();
|
||||||
int MasqueLayer;
|
int LayerMask;
|
||||||
wxPoint pos;
|
wxPoint pos;
|
||||||
BOARD* pcb = ( (PCB_BASE_FRAME*)( panel->GetParent() ) )->GetBoard();
|
BOARD* pcb = ( (PCB_BASE_FRAME*)( panel->GetParent() ) )->GetBoard();
|
||||||
|
|
||||||
Track = pcb->m_Track->GetStartNetCode( net_code );
|
Track = pcb->m_Track->GetStartNetCode( net_code );
|
||||||
|
|
||||||
pos = PtPad->m_Pos;
|
pos = PtPad->m_Pos;
|
||||||
MasqueLayer = PtPad->m_Masque_Layer;
|
LayerMask = PtPad->m_layerMask;
|
||||||
|
|
||||||
for( ; Track; Track = Track->Next() )
|
for( ; Track; Track = Track->Next() )
|
||||||
{
|
{
|
||||||
if( Track->GetNet() != net_code )
|
if( Track->GetNet() != net_code )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if( ( MasqueLayer & Track->ReturnMaskLayer() ) == 0 )
|
if( ( LayerMask & Track->ReturnMaskLayer() ) == 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( pos == Track->m_Start )
|
if( pos == Track->m_Start )
|
||||||
|
@ -127,12 +125,10 @@ void Build_1_Pad_SegmentsToDrag( EDA_DRAW_PANEL* panel, wxDC* DC, D_PAD* PtPad )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************/
|
|
||||||
void AddSegmentToDragList( EDA_DRAW_PANEL* panel, wxDC* DC, int flag, TRACK* Track )
|
|
||||||
/******************************************************************/
|
|
||||||
/* Add the segment"Track" to the drag list, and erase it from screen
|
/* Add the segment"Track" to the drag list, and erase it from screen
|
||||||
* flag = STARTPOINT (if the point to drag is the start point of Track) or ENDPOINT
|
* flag = STARTPOINT (if the point to drag is the start point of Track) or ENDPOINT
|
||||||
*/
|
*/
|
||||||
|
void AddSegmentToDragList( EDA_DRAW_PANEL* panel, wxDC* DC, int flag, TRACK* Track )
|
||||||
{
|
{
|
||||||
DRAG_SEGM wrapper( Track );
|
DRAG_SEGM wrapper( Track );
|
||||||
|
|
||||||
|
@ -156,15 +152,12 @@ void AddSegmentToDragList( EDA_DRAW_PANEL* panel, wxDC* DC, int flag, TRACK* Tra
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************************/
|
|
||||||
void Collect_TrackSegmentsToDrag( EDA_DRAW_PANEL* panel, wxDC* DC,
|
|
||||||
wxPoint& aRefPos, int MasqueLayer, int net_code )
|
|
||||||
/**********************************************************************************/
|
|
||||||
|
|
||||||
/* Build the list of tracks connected to the ref point
|
/* Build the list of tracks connected to the ref point
|
||||||
* Net codes must be OK.
|
* Net codes must be OK.
|
||||||
* @param aRefPos = reference point of connection
|
* @param aRefPos = reference point of connection
|
||||||
*/
|
*/
|
||||||
|
void Collect_TrackSegmentsToDrag( EDA_DRAW_PANEL* panel, wxDC* DC,
|
||||||
|
wxPoint& aRefPos, int LayerMask, int net_code )
|
||||||
{
|
{
|
||||||
BOARD* pcb = ( (PCB_BASE_FRAME*)( panel->GetParent() ) )->GetBoard();
|
BOARD* pcb = ( (PCB_BASE_FRAME*)( panel->GetParent() ) )->GetBoard();
|
||||||
|
|
||||||
|
@ -175,7 +168,7 @@ void Collect_TrackSegmentsToDrag( EDA_DRAW_PANEL* panel, wxDC* DC,
|
||||||
if( track->GetNet() != net_code ) // Bad net, not connected
|
if( track->GetNet() != net_code ) // Bad net, not connected
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if( ( MasqueLayer & track->ReturnMaskLayer() ) == 0 )
|
if( ( LayerMask & track->ReturnMaskLayer() ) == 0 )
|
||||||
continue; // Cannot be connected, not on the same layer
|
continue; // Cannot be connected, not on the same layer
|
||||||
|
|
||||||
if( track->m_Flags & IS_DRAGGED )
|
if( track->m_Flags & IS_DRAGGED )
|
||||||
|
@ -194,11 +187,11 @@ void Collect_TrackSegmentsToDrag( EDA_DRAW_PANEL* panel, wxDC* DC,
|
||||||
if( flag )
|
if( flag )
|
||||||
{
|
{
|
||||||
AddSegmentToDragList( panel, DC, flag, track );
|
AddSegmentToDragList( panel, DC, flag, track );
|
||||||
|
|
||||||
// If a connected via is found at location aRefPos,
|
// If a connected via is found at location aRefPos,
|
||||||
// collect also tracks connected by this via.
|
// collect also tracks connected by this via.
|
||||||
if( track->Type() == TYPE_VIA )
|
if( track->Type() == TYPE_VIA )
|
||||||
Collect_TrackSegmentsToDrag( panel, DC, aRefPos,
|
Collect_TrackSegmentsToDrag( panel, DC, aRefPos, track->ReturnMaskLayer(),
|
||||||
track->ReturnMaskLayer(),
|
|
||||||
net_code );
|
net_code );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -228,6 +228,7 @@ void DRC::RunTests( wxTextCtrl* aMessages )
|
||||||
aMessages->AppendText( _( "Fill zones...\n" ) );
|
aMessages->AppendText( _( "Fill zones...\n" ) );
|
||||||
wxSafeYield();
|
wxSafeYield();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_mainWindow->Fill_All_Zones( false );
|
m_mainWindow->Fill_All_Zones( false );
|
||||||
|
|
||||||
// test zone clearances to other zones, pads, tracks, and vias
|
// test zone clearances to other zones, pads, tracks, and vias
|
||||||
|
@ -263,9 +264,7 @@ void DRC::RunTests( wxTextCtrl* aMessages )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************/
|
|
||||||
void DRC::ListUnconnectedPads()
|
void DRC::ListUnconnectedPads()
|
||||||
/***************************************************************/
|
|
||||||
{
|
{
|
||||||
testUnconnected();
|
testUnconnected();
|
||||||
|
|
||||||
|
@ -408,9 +407,7 @@ bool DRC::testNetClasses()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************/
|
|
||||||
void DRC::testPad2Pad()
|
void DRC::testPad2Pad()
|
||||||
/***********************/
|
|
||||||
{
|
{
|
||||||
std::vector<D_PAD*> sortedPads;
|
std::vector<D_PAD*> sortedPads;
|
||||||
|
|
||||||
|
@ -466,7 +463,7 @@ void DRC::testUnconnected()
|
||||||
if( (m_pcb->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK) == 0 )
|
if( (m_pcb->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK) == 0 )
|
||||||
{
|
{
|
||||||
wxClientDC dc( m_mainWindow->DrawPanel );
|
wxClientDC dc( m_mainWindow->DrawPanel );
|
||||||
m_mainWindow->Compile_Ratsnest( &dc, TRUE );
|
m_mainWindow->Compile_Ratsnest( &dc, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_pcb->GetRatsnestsCount() == 0 )
|
if( m_pcb->GetRatsnestsCount() == 0 )
|
||||||
|
@ -475,6 +472,7 @@ void DRC::testUnconnected()
|
||||||
for( unsigned ii = 0; ii < m_pcb->GetRatsnestsCount(); ++ii )
|
for( unsigned ii = 0; ii < m_pcb->GetRatsnestsCount(); ++ii )
|
||||||
{
|
{
|
||||||
RATSNEST_ITEM* rat = &m_pcb->m_FullRatsnest[ii];
|
RATSNEST_ITEM* rat = &m_pcb->m_FullRatsnest[ii];
|
||||||
|
|
||||||
if( (rat->m_Status & CH_ACTIF) == 0 )
|
if( (rat->m_Status & CH_ACTIF) == 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -491,9 +489,7 @@ void DRC::testUnconnected()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************/
|
|
||||||
void DRC::testZones( bool adoTestFillSegments )
|
void DRC::testZones( bool adoTestFillSegments )
|
||||||
/**********************************************/
|
|
||||||
{
|
{
|
||||||
// Test copper areas for valide netcodes
|
// Test copper areas for valide netcodes
|
||||||
// if a netcode is < 0 the netname was not found when reading a netlist
|
// if a netcode is < 0 the netname was not found when reading a netlist
|
||||||
|
@ -502,8 +498,10 @@ void DRC::testZones( bool adoTestFillSegments )
|
||||||
for( int ii = 0; ii < m_pcb->GetAreaCount(); ii++ )
|
for( int ii = 0; ii < m_pcb->GetAreaCount(); ii++ )
|
||||||
{
|
{
|
||||||
ZONE_CONTAINER* Area_To_Test = m_pcb->GetArea( ii );
|
ZONE_CONTAINER* Area_To_Test = m_pcb->GetArea( ii );
|
||||||
|
|
||||||
if( !Area_To_Test->IsOnCopperLayer() )
|
if( !Area_To_Test->IsOnCopperLayer() )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( Area_To_Test->GetNet() < 0 )
|
if( Area_To_Test->GetNet() < 0 )
|
||||||
{
|
{
|
||||||
m_currentMarker = fillMarker( Area_To_Test,
|
m_currentMarker = fillMarker( Area_To_Test,
|
||||||
|
@ -536,6 +534,7 @@ void DRC::testZones( bool adoTestFillSegments )
|
||||||
// Pads already tested: disable pad test
|
// Pads already tested: disable pad test
|
||||||
|
|
||||||
bool rc = doTrackDrc( zoneSeg, m_pcb->m_Track, false );
|
bool rc = doTrackDrc( zoneSeg, m_pcb->m_Track, false );
|
||||||
|
|
||||||
if( !rc )
|
if( !rc )
|
||||||
{
|
{
|
||||||
wxASSERT( m_currentMarker );
|
wxASSERT( m_currentMarker );
|
||||||
|
@ -546,12 +545,9 @@ void DRC::testZones( bool adoTestFillSegments )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
bool DRC::doPadToPadsDrc( D_PAD* aRefPad, LISTE_PAD* aStart, LISTE_PAD* aEnd, int x_limit )
|
||||||
bool DRC::doPadToPadsDrc( D_PAD* aRefPad, LISTE_PAD* aStart, LISTE_PAD* aEnd,
|
|
||||||
int x_limit )
|
|
||||||
/*****************************************************************************/
|
|
||||||
{
|
{
|
||||||
int layerMask = aRefPad->m_Masque_Layer & ALL_CU_LAYERS;
|
int layerMask = aRefPad->m_layerMask & ALL_CU_LAYERS;
|
||||||
|
|
||||||
/* used to test DRC pad to holes: this dummy pad has the size and shape of the hole
|
/* used to test DRC pad to holes: this dummy pad has the size and shape of the hole
|
||||||
* to test pad to pad hole DRC, using the pad to pad DRC test function.
|
* to test pad to pad hole DRC, using the pad to pad DRC test function.
|
||||||
|
@ -561,7 +557,7 @@ bool DRC::doPadToPadsDrc( D_PAD* aRefPad, LISTE_PAD* aStart, LISTE_PAD* aEnd,
|
||||||
*/
|
*/
|
||||||
MODULE dummymodule( m_pcb ); // Creates a dummy parent
|
MODULE dummymodule( m_pcb ); // Creates a dummy parent
|
||||||
D_PAD dummypad( &dummymodule );
|
D_PAD dummypad( &dummymodule );
|
||||||
dummypad.m_Masque_Layer |= ALL_CU_LAYERS; // Ensure the hole is on all copper layers
|
dummypad.m_layerMask |= ALL_CU_LAYERS; // Ensure the hole is on all copper layers
|
||||||
dummypad.m_LocalClearance = 1; /* Use the minimal local clerance value for the dummy pad
|
dummypad.m_LocalClearance = 1; /* Use the minimal local clerance value for the dummy pad
|
||||||
* the clearance of the active pad will be used
|
* the clearance of the active pad will be used
|
||||||
* as minimum distance to a hole
|
* as minimum distance to a hole
|
||||||
|
@ -571,6 +567,7 @@ bool DRC::doPadToPadsDrc( D_PAD* aRefPad, LISTE_PAD* aStart, LISTE_PAD* aEnd,
|
||||||
for( LISTE_PAD* pad_list = aStart; pad_list<aEnd; ++pad_list )
|
for( LISTE_PAD* pad_list = aStart; pad_list<aEnd; ++pad_list )
|
||||||
{
|
{
|
||||||
D_PAD* pad = *pad_list;
|
D_PAD* pad = *pad_list;
|
||||||
|
|
||||||
if( pad == aRefPad )
|
if( pad == aRefPad )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -582,7 +579,7 @@ bool DRC::doPadToPadsDrc( D_PAD* aRefPad, LISTE_PAD* aStart, LISTE_PAD* aEnd,
|
||||||
// No problem if pads are on different copper layers,
|
// No problem if pads are on different copper layers,
|
||||||
// but their hole (if any ) can create RDC error because they are on all
|
// but their hole (if any ) can create RDC error because they are on all
|
||||||
// copper layers, so we test them
|
// copper layers, so we test them
|
||||||
if( (pad->m_Masque_Layer & layerMask ) == 0 )
|
if( (pad->m_layerMask & layerMask ) == 0 )
|
||||||
{
|
{
|
||||||
// if holes are in the same location and have the same size and shape,
|
// if holes are in the same location and have the same size and shape,
|
||||||
// this can be accepted
|
// this can be accepted
|
||||||
|
@ -592,6 +589,7 @@ bool DRC::doPadToPadsDrc( D_PAD* aRefPad, LISTE_PAD* aStart, LISTE_PAD* aEnd,
|
||||||
{
|
{
|
||||||
if( aRefPad->m_DrillShape == PAD_CIRCLE )
|
if( aRefPad->m_DrillShape == PAD_CIRCLE )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( pad->m_Orient == aRefPad->m_Orient ) // for oval holes: must also have the same orientation
|
if( pad->m_Orient == aRefPad->m_Orient ) // for oval holes: must also have the same orientation
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -606,6 +604,7 @@ bool DRC::doPadToPadsDrc( D_PAD* aRefPad, LISTE_PAD* aStart, LISTE_PAD* aEnd,
|
||||||
dummypad.m_PadShape = (pad->m_DrillShape == PAD_OVAL) ? PAD_OVAL : PAD_CIRCLE;
|
dummypad.m_PadShape = (pad->m_DrillShape == PAD_OVAL) ? PAD_OVAL : PAD_CIRCLE;
|
||||||
dummypad.m_Orient = pad->m_Orient;
|
dummypad.m_Orient = pad->m_Orient;
|
||||||
dummypad.ComputeShapeMaxRadius(); // compute the radius of the circle containing this pad
|
dummypad.ComputeShapeMaxRadius(); // compute the radius of the circle containing this pad
|
||||||
|
|
||||||
if( !checkClearancePadToPad( aRefPad, &dummypad ) )
|
if( !checkClearancePadToPad( aRefPad, &dummypad ) )
|
||||||
{
|
{
|
||||||
// here we have a drc error on pad!
|
// here we have a drc error on pad!
|
||||||
|
@ -630,6 +629,7 @@ bool DRC::doPadToPadsDrc( D_PAD* aRefPad, LISTE_PAD* aStart, LISTE_PAD* aEnd,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -654,8 +654,7 @@ bool DRC::doPadToPadsDrc( D_PAD* aRefPad, LISTE_PAD* aStart, LISTE_PAD* aEnd,
|
||||||
if( !checkClearancePadToPad( aRefPad, pad ) )
|
if( !checkClearancePadToPad( aRefPad, pad ) )
|
||||||
{
|
{
|
||||||
// here we have a drc error!
|
// here we have a drc error!
|
||||||
m_currentMarker = fillMarker( aRefPad, pad,
|
m_currentMarker = fillMarker( aRefPad, pad, DRCE_PAD_NEAR_PAD1, m_currentMarker );
|
||||||
DRCE_PAD_NEAR_PAD1, m_currentMarker );
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,10 +52,12 @@ bool trapezoid2trapezoidDRC( wxPoint aTref[4], wxPoint aTcompare[4], int aDist )
|
||||||
*/
|
*/
|
||||||
if( TestPointInsidePolygon( aTref, 4, aTcompare[0] ) )
|
if( TestPointInsidePolygon( aTref, 4, aTcompare[0] ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if( TestPointInsidePolygon( aTcompare, 4, aTref[0] ) )
|
if( TestPointInsidePolygon( aTcompare, 4, aTref[0] ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
int ii, jj, kk, ll;
|
int ii, jj, kk, ll;
|
||||||
|
|
||||||
for( ii = 0, jj = 3; ii<4; jj = ii, ii++ ) // for all edges in aTref
|
for( ii = 0, jj = 3; ii<4; jj = ii, ii++ ) // for all edges in aTref
|
||||||
{
|
{
|
||||||
for( kk = 0, ll = 3; kk < 4; ll = kk, kk++ ) // for all edges in aTcompare
|
for( kk = 0, ll = 3; kk < 4; ll = kk, kk++ ) // for all edges in aTcompare
|
||||||
|
@ -91,6 +93,7 @@ bool trapezoid2segmentDRC( wxPoint aTref[4], wxPoint aSegStart, wxPoint aSegEnd,
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
int ii, jj;
|
int ii, jj;
|
||||||
|
|
||||||
for( ii = 0, jj = 3; ii < 4; jj = ii, ii++ ) // for all edges in aTref
|
for( ii = 0, jj = 3; ii < 4; jj = ii, ii++ ) // for all edges in aTref
|
||||||
{
|
{
|
||||||
double d;
|
double d;
|
||||||
|
@ -128,6 +131,7 @@ bool trapezoid2pointDRC( wxPoint aTref[4], wxPoint aPcompare, int aDist )
|
||||||
// Test distance between aPcompare and polygon edges:
|
// Test distance between aPcompare and polygon edges:
|
||||||
int ii, jj;
|
int ii, jj;
|
||||||
double dist = (double) aDist;
|
double dist = (double) aDist;
|
||||||
|
|
||||||
for( ii = 0, jj = 3; ii < 4; jj = ii, ii++ ) // for all edges in polygon
|
for( ii = 0, jj = 3; ii < 4; jj = ii, ii++ ) // for all edges in polygon
|
||||||
{
|
{
|
||||||
if( TestLineHit( aTref[ii].x, aTref[ii].y,
|
if( TestLineHit( aTref[ii].x, aTref[ii].y,
|
||||||
|
@ -140,9 +144,7 @@ bool trapezoid2pointDRC( wxPoint aTref[4], wxPoint aPcompare, int aDist )
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************/
|
|
||||||
bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
|
bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
|
||||||
/***********************************************************************/
|
|
||||||
{
|
{
|
||||||
TRACK* track;
|
TRACK* track;
|
||||||
wxPoint delta; // lenght on X and Y axis of segments
|
wxPoint delta; // lenght on X and Y axis of segments
|
||||||
|
@ -205,15 +207,18 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
|
||||||
bool err = true;
|
bool err = true;
|
||||||
|
|
||||||
( (SEGVIA*) aRefSeg )->ReturnLayerPair( &layer1, &layer2 );
|
( (SEGVIA*) aRefSeg )->ReturnLayerPair( &layer1, &layer2 );
|
||||||
|
|
||||||
if( layer1 > layer2 )
|
if( layer1 > layer2 )
|
||||||
EXCHG( layer1, layer2 );
|
EXCHG( layer1, layer2 );
|
||||||
|
|
||||||
// test:
|
// test:
|
||||||
if( layer1 == LAYER_N_BACK && layer2 == LAYER_N_2 )
|
if( layer1 == LAYER_N_BACK && layer2 == LAYER_N_2 )
|
||||||
err = false;
|
err = false;
|
||||||
|
|
||||||
if( layer1 == (m_pcb->GetBoardDesignSettings()->GetCopperLayerCount() - 2 )
|
if( layer1 == (m_pcb->GetBoardDesignSettings()->GetCopperLayerCount() - 2 )
|
||||||
&& layer2 == LAYER_N_FRONT )
|
&& layer2 == LAYER_N_FRONT )
|
||||||
err = false;
|
err = false;
|
||||||
|
|
||||||
if( err )
|
if( err )
|
||||||
{
|
{
|
||||||
m_currentMarker = fillMarker( aRefSeg, NULL,
|
m_currentMarker = fillMarker( aRefSeg, NULL,
|
||||||
|
@ -260,7 +265,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
|
||||||
*/
|
*/
|
||||||
MODULE dummymodule( m_pcb ); // Creates a dummy parent
|
MODULE dummymodule( m_pcb ); // Creates a dummy parent
|
||||||
D_PAD dummypad( &dummymodule );
|
D_PAD dummypad( &dummymodule );
|
||||||
dummypad.m_Masque_Layer = ALL_CU_LAYERS; // Ensure the hole is on all layers
|
dummypad.m_layerMask = ALL_CU_LAYERS; // Ensure the hole is on all layers
|
||||||
|
|
||||||
// Compute the min distance to pads
|
// Compute the min distance to pads
|
||||||
if( testPads )
|
if( testPads )
|
||||||
|
@ -273,10 +278,11 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
|
||||||
* But if a drill hole exists (a pad on a single layer can have a hole!)
|
* But if a drill hole exists (a pad on a single layer can have a hole!)
|
||||||
* we must test the hole
|
* we must test the hole
|
||||||
*/
|
*/
|
||||||
if( (pad->m_Masque_Layer & layerMask ) == 0 )
|
if( (pad->m_layerMask & layerMask ) == 0 )
|
||||||
{
|
{
|
||||||
/* We must test the pad hole. In order to use the function checkClearanceSegmToPad(),
|
/* We must test the pad hole. In order to use the function
|
||||||
* a pseudo pad is used, with a shape and a size like the hole
|
* checkClearanceSegmToPad(),a pseudo pad is used, with a shape and a
|
||||||
|
* size like the hole
|
||||||
*/
|
*/
|
||||||
if( pad->m_Drill.x == 0 )
|
if( pad->m_Drill.x == 0 )
|
||||||
continue;
|
continue;
|
||||||
|
@ -295,6 +301,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
|
||||||
DRCE_TRACK_NEAR_THROUGH_HOLE, m_currentMarker );
|
DRCE_TRACK_NEAR_THROUGH_HOLE, m_currentMarker );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -378,6 +385,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -396,8 +404,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
|
||||||
if( checkMarginToCircle( segStartPoint, w_dist, m_segmLength ) )
|
if( checkMarginToCircle( segStartPoint, w_dist, m_segmLength ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
m_currentMarker = fillMarker( aRefSeg, track,
|
m_currentMarker = fillMarker( aRefSeg, track, DRCE_TRACK_NEAR_VIA, m_currentMarker );
|
||||||
DRCE_TRACK_NEAR_VIA, m_currentMarker );
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -423,6 +430,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
|
||||||
DRCE_TRACK_ENDS1, m_currentMarker );
|
DRCE_TRACK_ENDS1, m_currentMarker );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !checkMarginToCircle( segStartPoint, w_dist, m_segmLength ) )
|
if( !checkMarginToCircle( segStartPoint, w_dist, m_segmLength ) )
|
||||||
{
|
{
|
||||||
m_currentMarker = fillMarker( aRefSeg, track,
|
m_currentMarker = fillMarker( aRefSeg, track,
|
||||||
|
@ -430,6 +438,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( segEndPoint.x > (-w_dist) && segEndPoint.x < (m_segmLength + w_dist) )
|
if( segEndPoint.x > (-w_dist) && segEndPoint.x < (m_segmLength + w_dist) )
|
||||||
{
|
{
|
||||||
/* Fine test : we consider the rounded shape of the ends */
|
/* Fine test : we consider the rounded shape of the ends */
|
||||||
|
@ -439,6 +448,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
|
||||||
DRCE_TRACK_ENDS3, m_currentMarker );
|
DRCE_TRACK_ENDS3, m_currentMarker );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !checkMarginToCircle( segEndPoint, w_dist, m_segmLength ) )
|
if( !checkMarginToCircle( segEndPoint, w_dist, m_segmLength ) )
|
||||||
{
|
{
|
||||||
m_currentMarker = fillMarker( aRefSeg, track,
|
m_currentMarker = fillMarker( aRefSeg, track,
|
||||||
|
@ -462,6 +472,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
|
||||||
// Test if segments are crossing
|
// Test if segments are crossing
|
||||||
if( segStartPoint.y > segEndPoint.y )
|
if( segStartPoint.y > segEndPoint.y )
|
||||||
EXCHG( segStartPoint.y, segEndPoint.y );
|
EXCHG( segStartPoint.y, segEndPoint.y );
|
||||||
|
|
||||||
if( (segStartPoint.y < 0) && (segEndPoint.y > 0) )
|
if( (segStartPoint.y < 0) && (segEndPoint.y > 0) )
|
||||||
{
|
{
|
||||||
m_currentMarker = fillMarker( aRefSeg, track,
|
m_currentMarker = fillMarker( aRefSeg, track,
|
||||||
|
@ -531,12 +542,14 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
|
||||||
|
|
||||||
RotatePoint( &relStartPos, angle );
|
RotatePoint( &relStartPos, angle );
|
||||||
RotatePoint( &relEndPos, angle );
|
RotatePoint( &relEndPos, angle );
|
||||||
|
|
||||||
if( !checkMarginToCircle( relStartPos, w_dist, delta.x ) )
|
if( !checkMarginToCircle( relStartPos, w_dist, delta.x ) )
|
||||||
{
|
{
|
||||||
m_currentMarker = fillMarker( aRefSeg, track,
|
m_currentMarker = fillMarker( aRefSeg, track,
|
||||||
DRCE_ENDS_PROBLEM4, m_currentMarker );
|
DRCE_ENDS_PROBLEM4, m_currentMarker );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !checkMarginToCircle( relEndPos, w_dist, delta.x ) )
|
if( !checkMarginToCircle( relEndPos, w_dist, delta.x ) )
|
||||||
{
|
{
|
||||||
m_currentMarker = fillMarker( aRefSeg, track,
|
m_currentMarker = fillMarker( aRefSeg, track,
|
||||||
|
@ -583,6 +596,7 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad )
|
||||||
*/
|
*/
|
||||||
bool swap_pads;
|
bool swap_pads;
|
||||||
swap_pads = false;
|
swap_pads = false;
|
||||||
|
|
||||||
if( (aRefPad->m_PadShape != PAD_CIRCLE) && (aPad->m_PadShape == PAD_CIRCLE) )
|
if( (aRefPad->m_PadShape != PAD_CIRCLE) && (aPad->m_PadShape == PAD_CIRCLE) )
|
||||||
swap_pads = true;
|
swap_pads = true;
|
||||||
else if( (aRefPad->m_PadShape != PAD_OVAL) && (aPad->m_PadShape == PAD_OVAL) )
|
else if( (aRefPad->m_PadShape != PAD_OVAL) && (aPad->m_PadShape == PAD_OVAL) )
|
||||||
|
@ -602,6 +616,7 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad )
|
||||||
* aPad is also a PAD_RECT or a PAD_TRAPEZOID
|
* aPad is also a PAD_RECT or a PAD_TRAPEZOID
|
||||||
*/
|
*/
|
||||||
bool diag = true;
|
bool diag = true;
|
||||||
|
|
||||||
switch( aRefPad->m_PadShape )
|
switch( aRefPad->m_PadShape )
|
||||||
{
|
{
|
||||||
case PAD_CIRCLE:
|
case PAD_CIRCLE:
|
||||||
|
@ -623,6 +638,7 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad )
|
||||||
// pad_angle = pad orient relative to the aRefPad orient
|
// pad_angle = pad orient relative to the aRefPad orient
|
||||||
pad_angle = aRefPad->m_Orient + aPad->m_Orient;
|
pad_angle = aRefPad->m_Orient + aPad->m_Orient;
|
||||||
NORMALIZE_ANGLE_POS( pad_angle );
|
NORMALIZE_ANGLE_POS( pad_angle );
|
||||||
|
|
||||||
if( aPad->m_PadShape == PAD_RECT )
|
if( aPad->m_PadShape == PAD_RECT )
|
||||||
{
|
{
|
||||||
wxSize size = aPad->m_Size;
|
wxSize size = aPad->m_Size;
|
||||||
|
@ -657,9 +673,11 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad )
|
||||||
wxPoint polycompare[4]; // Shape of aPad
|
wxPoint polycompare[4]; // Shape of aPad
|
||||||
aRefPad->BuildPadPolygon( polyref, wxSize( 0, 0 ), aRefPad->m_Orient );
|
aRefPad->BuildPadPolygon( polyref, wxSize( 0, 0 ), aRefPad->m_Orient );
|
||||||
aPad->BuildPadPolygon( polycompare, wxSize( 0, 0 ), aPad->m_Orient );
|
aPad->BuildPadPolygon( polycompare, wxSize( 0, 0 ), aPad->m_Orient );
|
||||||
|
|
||||||
// Move aPad shape to relativePadPos
|
// Move aPad shape to relativePadPos
|
||||||
for( int ii = 0; ii < 4; ii++ )
|
for( int ii = 0; ii < 4; ii++ )
|
||||||
polycompare[ii] += relativePadPos;
|
polycompare[ii] += relativePadPos;
|
||||||
|
|
||||||
// And now test polygons:
|
// And now test polygons:
|
||||||
if( !trapezoid2trapezoidDRC( polyref, polycompare, dist_min ) )
|
if( !trapezoid2trapezoidDRC( polyref, polycompare, dist_min ) )
|
||||||
diag = false;
|
diag = false;
|
||||||
|
@ -694,6 +712,7 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad )
|
||||||
*/
|
*/
|
||||||
int segm_width;
|
int segm_width;
|
||||||
m_segmAngle = aRefPad->m_Orient; // Segment orient.
|
m_segmAngle = aRefPad->m_Orient; // Segment orient.
|
||||||
|
|
||||||
if( aRefPad->m_Size.y < aRefPad->m_Size.x ) // Build an horizontal equiv segment
|
if( aRefPad->m_Size.y < aRefPad->m_Size.x ) // Build an horizontal equiv segment
|
||||||
{
|
{
|
||||||
segm_width = aRefPad->m_Size.y;
|
segm_width = aRefPad->m_Size.y;
|
||||||
|
@ -776,6 +795,7 @@ bool DRC::checkClearanceSegmToPad( const D_PAD* aPad, int aSegmentWidth, int aMi
|
||||||
seuil = segmHalfWidth + aMinDist;
|
seuil = segmHalfWidth + aMinDist;
|
||||||
padHalfsize.x = aPad->m_Size.x >> 1;
|
padHalfsize.x = aPad->m_Size.x >> 1;
|
||||||
padHalfsize.y = aPad->m_Size.y >> 1;
|
padHalfsize.y = aPad->m_Size.y >> 1;
|
||||||
|
|
||||||
if( aPad->m_PadShape == PAD_TRAPEZOID ) // The size is bigger, due to m_DeltaSize extra size
|
if( aPad->m_PadShape == PAD_TRAPEZOID ) // The size is bigger, due to m_DeltaSize extra size
|
||||||
{
|
{
|
||||||
padHalfsize.x += ABS(aPad->m_DeltaSize.y) / 2; // Remember: m_DeltaSize.y is the m_Size.x change
|
padHalfsize.x += ABS(aPad->m_DeltaSize.y) / 2; // Remember: m_DeltaSize.y is the m_Size.x change
|
||||||
|
@ -830,9 +850,11 @@ bool DRC::checkClearanceSegmToPad( const D_PAD* aPad, int aSegmentWidth, int aMi
|
||||||
{
|
{
|
||||||
EXCHG( padHalfsize.x, padHalfsize.y );
|
EXCHG( padHalfsize.x, padHalfsize.y );
|
||||||
orient += 900;
|
orient += 900;
|
||||||
|
|
||||||
if( orient >= 3600 )
|
if( orient >= 3600 )
|
||||||
orient -= 3600;
|
orient -= 3600;
|
||||||
}
|
}
|
||||||
|
|
||||||
deltay = padHalfsize.y - padHalfsize.x;
|
deltay = padHalfsize.y - padHalfsize.x;
|
||||||
|
|
||||||
// here: padHalfsize.x = radius, delta = dist centre cercles a centre pad
|
// here: padHalfsize.x = radius, delta = dist centre cercles a centre pad
|
||||||
|
@ -842,6 +864,7 @@ bool DRC::checkClearanceSegmToPad( const D_PAD* aPad, int aSegmentWidth, int aMi
|
||||||
m_ycliplo = m_padToTestPos.y - segmHalfWidth - deltay;
|
m_ycliplo = m_padToTestPos.y - segmHalfWidth - deltay;
|
||||||
m_xcliphi = m_padToTestPos.x + seuil + padHalfsize.x;
|
m_xcliphi = m_padToTestPos.x + seuil + padHalfsize.x;
|
||||||
m_ycliphi = m_padToTestPos.y + segmHalfWidth + deltay;
|
m_ycliphi = m_padToTestPos.y + segmHalfWidth + deltay;
|
||||||
|
|
||||||
if( !checkLine( startPoint, endPoint ) )
|
if( !checkLine( startPoint, endPoint ) )
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -856,6 +879,7 @@ bool DRC::checkClearanceSegmToPad( const D_PAD* aPad, int aSegmentWidth, int aMi
|
||||||
|
|
||||||
// Calculate the actual position of the circle in the new X,Y axis:
|
// Calculate the actual position of the circle in the new X,Y axis:
|
||||||
RotatePoint( &startPoint, m_segmAngle );
|
RotatePoint( &startPoint, m_segmAngle );
|
||||||
|
|
||||||
if( !checkMarginToCircle( startPoint, padHalfsize.x + seuil, m_segmLength ) )
|
if( !checkMarginToCircle( startPoint, padHalfsize.x + seuil, m_segmLength ) )
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -871,6 +895,7 @@ bool DRC::checkClearanceSegmToPad( const D_PAD* aPad, int aSegmentWidth, int aMi
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PAD_RECT: /* 2 rectangle + 4 1/4 cercles a tester */
|
case PAD_RECT: /* 2 rectangle + 4 1/4 cercles a tester */
|
||||||
|
@ -898,6 +923,7 @@ bool DRC::checkClearanceSegmToPad( const D_PAD* aPad, int aSegmentWidth, int aMi
|
||||||
startPoint.y = m_padToTestPos.y - padHalfsize.y;
|
startPoint.y = m_padToTestPos.y - padHalfsize.y;
|
||||||
RotatePoint( &startPoint, m_padToTestPos, orient );
|
RotatePoint( &startPoint, m_padToTestPos, orient );
|
||||||
RotatePoint( &startPoint, m_segmAngle );
|
RotatePoint( &startPoint, m_segmAngle );
|
||||||
|
|
||||||
if( !checkMarginToCircle( startPoint, seuil, m_segmLength ) )
|
if( !checkMarginToCircle( startPoint, seuil, m_segmLength ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -906,6 +932,7 @@ bool DRC::checkClearanceSegmToPad( const D_PAD* aPad, int aSegmentWidth, int aMi
|
||||||
startPoint.y = m_padToTestPos.y - padHalfsize.y;
|
startPoint.y = m_padToTestPos.y - padHalfsize.y;
|
||||||
RotatePoint( &startPoint, m_padToTestPos, orient );
|
RotatePoint( &startPoint, m_padToTestPos, orient );
|
||||||
RotatePoint( &startPoint, m_segmAngle );
|
RotatePoint( &startPoint, m_segmAngle );
|
||||||
|
|
||||||
if( !checkMarginToCircle( startPoint, seuil, m_segmLength ) )
|
if( !checkMarginToCircle( startPoint, seuil, m_segmLength ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -914,6 +941,7 @@ bool DRC::checkClearanceSegmToPad( const D_PAD* aPad, int aSegmentWidth, int aMi
|
||||||
startPoint.y = m_padToTestPos.y + padHalfsize.y;
|
startPoint.y = m_padToTestPos.y + padHalfsize.y;
|
||||||
RotatePoint( &startPoint, m_padToTestPos, orient );
|
RotatePoint( &startPoint, m_padToTestPos, orient );
|
||||||
RotatePoint( &startPoint, m_segmAngle );
|
RotatePoint( &startPoint, m_segmAngle );
|
||||||
|
|
||||||
if( !checkMarginToCircle( startPoint, seuil, m_segmLength ) )
|
if( !checkMarginToCircle( startPoint, seuil, m_segmLength ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -922,6 +950,7 @@ bool DRC::checkClearanceSegmToPad( const D_PAD* aPad, int aSegmentWidth, int aMi
|
||||||
startPoint.y = m_padToTestPos.y + padHalfsize.y;
|
startPoint.y = m_padToTestPos.y + padHalfsize.y;
|
||||||
RotatePoint( &startPoint, m_padToTestPos, orient );
|
RotatePoint( &startPoint, m_padToTestPos, orient );
|
||||||
RotatePoint( &startPoint, m_segmAngle );
|
RotatePoint( &startPoint, m_segmAngle );
|
||||||
|
|
||||||
if( !checkMarginToCircle( startPoint, seuil, m_segmLength ) )
|
if( !checkMarginToCircle( startPoint, seuil, m_segmLength ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -1006,49 +1035,54 @@ bool DRC::checkLine( wxPoint aSegStart, wxPoint aSegEnd )
|
||||||
{
|
{
|
||||||
WHEN_OUTSIDE;
|
WHEN_OUTSIDE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( aSegStart.y < aSegEnd.y )
|
if( aSegStart.y < aSegEnd.y )
|
||||||
{
|
{
|
||||||
if( (aSegEnd.y < m_ycliplo) || (aSegStart.y > m_ycliphi) )
|
if( (aSegEnd.y < m_ycliplo) || (aSegStart.y > m_ycliphi) )
|
||||||
{
|
{
|
||||||
WHEN_OUTSIDE;
|
WHEN_OUTSIDE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( aSegStart.y < m_ycliplo )
|
if( aSegStart.y < m_ycliplo )
|
||||||
{
|
{
|
||||||
temp =
|
temp = USCALE( (aSegEnd.x - aSegStart.x), (m_ycliplo - aSegStart.y),
|
||||||
USCALE( (aSegEnd.x - aSegStart.x), (m_ycliplo - aSegStart.y),
|
|
||||||
(aSegEnd.y - aSegStart.y) );
|
(aSegEnd.y - aSegStart.y) );
|
||||||
|
|
||||||
if( (aSegStart.x += temp) > m_xcliphi )
|
if( (aSegStart.x += temp) > m_xcliphi )
|
||||||
{
|
{
|
||||||
WHEN_OUTSIDE;
|
WHEN_OUTSIDE;
|
||||||
}
|
}
|
||||||
|
|
||||||
aSegStart.y = m_ycliplo;
|
aSegStart.y = m_ycliplo;
|
||||||
WHEN_INSIDE;
|
WHEN_INSIDE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( aSegEnd.y > m_ycliphi )
|
if( aSegEnd.y > m_ycliphi )
|
||||||
{
|
{
|
||||||
temp =
|
temp = USCALE( (aSegEnd.x - aSegStart.x), (aSegEnd.y - m_ycliphi),
|
||||||
USCALE( (aSegEnd.x - aSegStart.x), (aSegEnd.y - m_ycliphi),
|
|
||||||
(aSegEnd.y - aSegStart.y) );
|
(aSegEnd.y - aSegStart.y) );
|
||||||
|
|
||||||
if( (aSegEnd.x -= temp) < m_xcliplo )
|
if( (aSegEnd.x -= temp) < m_xcliplo )
|
||||||
{
|
{
|
||||||
WHEN_OUTSIDE;
|
WHEN_OUTSIDE;
|
||||||
}
|
}
|
||||||
|
|
||||||
aSegEnd.y = m_ycliphi;
|
aSegEnd.y = m_ycliphi;
|
||||||
WHEN_INSIDE;
|
WHEN_INSIDE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( aSegStart.x < m_xcliplo )
|
if( aSegStart.x < m_xcliplo )
|
||||||
{
|
{
|
||||||
temp =
|
temp = USCALE( (aSegEnd.y - aSegStart.y), (m_xcliplo - aSegStart.x),
|
||||||
USCALE( (aSegEnd.y - aSegStart.y), (m_xcliplo - aSegStart.x),
|
|
||||||
(aSegEnd.x - aSegStart.x) );
|
(aSegEnd.x - aSegStart.x) );
|
||||||
aSegStart.y += temp;
|
aSegStart.y += temp;
|
||||||
aSegStart.x = m_xcliplo;
|
aSegStart.x = m_xcliplo;
|
||||||
WHEN_INSIDE;
|
WHEN_INSIDE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( aSegEnd.x > m_xcliphi )
|
if( aSegEnd.x > m_xcliphi )
|
||||||
{
|
{
|
||||||
temp =
|
temp = USCALE( (aSegEnd.y - aSegStart.y), (aSegEnd.x - m_xcliphi),
|
||||||
USCALE( (aSegEnd.y - aSegStart.y), (aSegEnd.x - m_xcliphi),
|
|
||||||
(aSegEnd.x - aSegStart.x) );
|
(aSegEnd.x - aSegStart.x) );
|
||||||
aSegEnd.y -= temp;
|
aSegEnd.y -= temp;
|
||||||
aSegEnd.x = m_xcliphi;
|
aSegEnd.x = m_xcliphi;
|
||||||
|
@ -1061,43 +1095,47 @@ bool DRC::checkLine( wxPoint aSegStart, wxPoint aSegEnd )
|
||||||
{
|
{
|
||||||
WHEN_OUTSIDE;
|
WHEN_OUTSIDE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( aSegStart.y > m_ycliphi )
|
if( aSegStart.y > m_ycliphi )
|
||||||
{
|
{
|
||||||
temp =
|
temp = USCALE( (aSegEnd.x - aSegStart.x), (aSegStart.y - m_ycliphi),
|
||||||
USCALE( (aSegEnd.x - aSegStart.x), (aSegStart.y - m_ycliphi),
|
|
||||||
(aSegStart.y - aSegEnd.y) );
|
(aSegStart.y - aSegEnd.y) );
|
||||||
|
|
||||||
if( (aSegStart.x += temp) > m_xcliphi )
|
if( (aSegStart.x += temp) > m_xcliphi )
|
||||||
{
|
{
|
||||||
WHEN_OUTSIDE;
|
WHEN_OUTSIDE;
|
||||||
}
|
}
|
||||||
|
|
||||||
aSegStart.y = m_ycliphi;
|
aSegStart.y = m_ycliphi;
|
||||||
WHEN_INSIDE;
|
WHEN_INSIDE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( aSegEnd.y < m_ycliplo )
|
if( aSegEnd.y < m_ycliplo )
|
||||||
{
|
{
|
||||||
temp =
|
temp = USCALE( (aSegEnd.x - aSegStart.x), (m_ycliplo - aSegEnd.y),
|
||||||
USCALE( (aSegEnd.x - aSegStart.x), (m_ycliplo - aSegEnd.y),
|
|
||||||
(aSegStart.y - aSegEnd.y) );
|
(aSegStart.y - aSegEnd.y) );
|
||||||
|
|
||||||
if( (aSegEnd.x -= temp) < m_xcliplo )
|
if( (aSegEnd.x -= temp) < m_xcliplo )
|
||||||
{
|
{
|
||||||
WHEN_OUTSIDE;
|
WHEN_OUTSIDE;
|
||||||
}
|
}
|
||||||
|
|
||||||
aSegEnd.y = m_ycliplo;
|
aSegEnd.y = m_ycliplo;
|
||||||
WHEN_INSIDE;
|
WHEN_INSIDE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( aSegStart.x < m_xcliplo )
|
if( aSegStart.x < m_xcliplo )
|
||||||
{
|
{
|
||||||
temp =
|
temp = USCALE( (aSegStart.y - aSegEnd.y), (m_xcliplo - aSegStart.x),
|
||||||
USCALE( (aSegStart.y - aSegEnd.y), (m_xcliplo - aSegStart.x),
|
|
||||||
(aSegEnd.x - aSegStart.x) );
|
(aSegEnd.x - aSegStart.x) );
|
||||||
aSegStart.y -= temp;
|
aSegStart.y -= temp;
|
||||||
aSegStart.x = m_xcliplo;
|
aSegStart.x = m_xcliplo;
|
||||||
WHEN_INSIDE;
|
WHEN_INSIDE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( aSegEnd.x > m_xcliphi )
|
if( aSegEnd.x > m_xcliphi )
|
||||||
{
|
{
|
||||||
temp =
|
temp = USCALE( (aSegStart.y - aSegEnd.y), (aSegEnd.x - m_xcliphi),
|
||||||
USCALE( (aSegStart.y - aSegEnd.y), (aSegEnd.x - m_xcliphi),
|
|
||||||
(aSegEnd.x - aSegStart.x) );
|
(aSegEnd.x - aSegStart.x) );
|
||||||
aSegEnd.y += temp;
|
aSegEnd.y += temp;
|
||||||
aSegEnd.x = m_xcliphi;
|
aSegEnd.x = m_xcliphi;
|
||||||
|
@ -1113,5 +1151,7 @@ bool DRC::checkLine( wxPoint aSegStart, wxPoint aSegEnd )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ void FOOTPRINT_EDIT_FRAME::Start_Move_EdgeMod( EDGE_MODULE* Edge, wxDC* DC )
|
||||||
CursorInitialPosition = GetScreen()->GetCrossHairPosition();
|
CursorInitialPosition = GetScreen()->GetCrossHairPosition();
|
||||||
DrawPanel->SetMouseCapture( ShowCurrentOutlineWhileMoving, Abort_Move_ModuleOutline );
|
DrawPanel->SetMouseCapture( ShowCurrentOutlineWhileMoving, Abort_Move_ModuleOutline );
|
||||||
SetCurItem( Edge );
|
SetCurItem( Edge );
|
||||||
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, FALSE );
|
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -48,6 +48,7 @@ void FOOTPRINT_EDIT_FRAME::Place_EdgeMod( EDGE_MODULE* Edge )
|
||||||
{
|
{
|
||||||
if( Edge == NULL )
|
if( Edge == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Edge->m_Start -= MoveVector;
|
Edge->m_Start -= MoveVector;
|
||||||
Edge->m_End -= MoveVector;
|
Edge->m_End -= MoveVector;
|
||||||
|
|
||||||
|
@ -59,7 +60,7 @@ void FOOTPRINT_EDIT_FRAME::Place_EdgeMod( EDGE_MODULE* Edge )
|
||||||
SetCurItem( NULL );
|
SetCurItem( NULL );
|
||||||
OnModify();
|
OnModify();
|
||||||
MODULE* Module = (MODULE*) Edge->GetParent();
|
MODULE* Module = (MODULE*) Edge->GetParent();
|
||||||
Module->Set_Rectangle_Encadrement();
|
Module->CalculateBoundingBox();
|
||||||
DrawPanel->Refresh( );
|
DrawPanel->Refresh( );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +88,7 @@ static void ShowCurrentOutlineWhileMoving( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
|
||||||
|
|
||||||
Edge->Draw( aPanel, aDC, GR_XOR, MoveVector );
|
Edge->Draw( aPanel, aDC, GR_XOR, MoveVector );
|
||||||
|
|
||||||
Module->Set_Rectangle_Encadrement();
|
Module->CalculateBoundingBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -118,7 +119,7 @@ static void ShowNewEdgeModule( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
|
||||||
|
|
||||||
Edge->Draw( aPanel, aDC, GR_XOR );
|
Edge->Draw( aPanel, aDC, GR_XOR );
|
||||||
|
|
||||||
Module->Set_Rectangle_Encadrement();
|
Module->CalculateBoundingBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -131,18 +132,22 @@ void FOOTPRINT_EDIT_FRAME::Edit_Edge_Width( EDGE_MODULE* aEdge )
|
||||||
if( aEdge == NULL )
|
if( aEdge == NULL )
|
||||||
{
|
{
|
||||||
aEdge = (EDGE_MODULE*) (BOARD_ITEM*) Module->m_Drawings;
|
aEdge = (EDGE_MODULE*) (BOARD_ITEM*) Module->m_Drawings;
|
||||||
|
|
||||||
for( ; aEdge != NULL; aEdge = aEdge->Next() )
|
for( ; aEdge != NULL; aEdge = aEdge->Next() )
|
||||||
{
|
{
|
||||||
if( aEdge->Type() != TYPE_EDGE_MODULE )
|
if( aEdge->Type() != TYPE_EDGE_MODULE )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
aEdge->m_Width = g_ModuleSegmentWidth;
|
aEdge->m_Width = g_ModuleSegmentWidth;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
aEdge->m_Width = g_ModuleSegmentWidth;
|
aEdge->m_Width = g_ModuleSegmentWidth;
|
||||||
|
}
|
||||||
|
|
||||||
OnModify();
|
OnModify();
|
||||||
Module->Set_Rectangle_Encadrement();
|
Module->CalculateBoundingBox();
|
||||||
Module->m_LastEdit_Time = time( NULL );
|
Module->m_LastEdit_Time = time( NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,9 +160,9 @@ void FOOTPRINT_EDIT_FRAME::Edit_Edge_Layer( EDGE_MODULE* Edge )
|
||||||
if( Edge != NULL )
|
if( Edge != NULL )
|
||||||
new_layer = Edge->GetLayer();
|
new_layer = Edge->GetLayer();
|
||||||
|
|
||||||
|
|
||||||
/* Ask for the new layer */
|
/* Ask for the new layer */
|
||||||
new_layer = SelectLayer( new_layer, FIRST_COPPER_LAYER, LAST_NO_COPPER_LAYER );
|
new_layer = SelectLayer( new_layer, FIRST_COPPER_LAYER, LAST_NO_COPPER_LAYER );
|
||||||
|
|
||||||
if( new_layer < 0 )
|
if( new_layer < 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -190,7 +195,7 @@ void FOOTPRINT_EDIT_FRAME::Edit_Edge_Layer( EDGE_MODULE* Edge )
|
||||||
}
|
}
|
||||||
|
|
||||||
OnModify();
|
OnModify();
|
||||||
Module->Set_Rectangle_Encadrement();
|
Module->CalculateBoundingBox();
|
||||||
Module->m_LastEdit_Time = time( NULL );
|
Module->m_LastEdit_Time = time( NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -214,7 +219,7 @@ void FOOTPRINT_EDIT_FRAME::Enter_Edge_Width( EDGE_MODULE* aEdge )
|
||||||
{
|
{
|
||||||
MODULE* Module = GetBoard()->m_Modules;
|
MODULE* Module = GetBoard()->m_Modules;
|
||||||
aEdge->m_Width = g_ModuleSegmentWidth;
|
aEdge->m_Width = g_ModuleSegmentWidth;
|
||||||
Module->Set_Rectangle_Encadrement();
|
Module->CalculateBoundingBox();
|
||||||
OnModify();
|
OnModify();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -236,7 +241,7 @@ void FOOTPRINT_EDIT_FRAME::Delete_Edge_Module( EDGE_MODULE* Edge )
|
||||||
/* Delete segment. */
|
/* Delete segment. */
|
||||||
Edge->DeleteStructure();
|
Edge->DeleteStructure();
|
||||||
Module->m_LastEdit_Time = time( NULL );
|
Module->m_LastEdit_Time = time( NULL );
|
||||||
Module->Set_Rectangle_Encadrement();
|
Module->CalculateBoundingBox();
|
||||||
OnModify();
|
OnModify();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -256,7 +261,7 @@ static void Abort_Move_ModuleOutline( EDA_DRAW_PANEL* Panel, wxDC* DC )
|
||||||
MODULE* Module = (MODULE*) Edge->GetParent();
|
MODULE* Module = (MODULE*) Edge->GetParent();
|
||||||
Edge->Draw( Panel, DC, GR_XOR, MoveVector );
|
Edge->Draw( Panel, DC, GR_XOR, MoveVector );
|
||||||
Edge->DeleteStructure();
|
Edge->DeleteStructure();
|
||||||
Module->Set_Rectangle_Encadrement();
|
Module->CalculateBoundingBox();
|
||||||
}
|
}
|
||||||
else // On aborting, move existing outline to its initial position.
|
else // On aborting, move existing outline to its initial position.
|
||||||
{
|
{
|
||||||
|
@ -319,7 +324,7 @@ EDGE_MODULE* FOOTPRINT_EDIT_FRAME::Begin_Edge_Module( EDGE_MODULE* Edge,
|
||||||
RotatePoint( &Edge->m_Start0, -module->m_Orient );
|
RotatePoint( &Edge->m_Start0, -module->m_Orient );
|
||||||
|
|
||||||
Edge->m_End0 = Edge->m_Start0;
|
Edge->m_End0 = Edge->m_Start0;
|
||||||
module->Set_Rectangle_Encadrement();
|
module->CalculateBoundingBox();
|
||||||
DrawPanel->SetMouseCapture( ShowNewEdgeModule, Abort_Move_ModuleOutline );
|
DrawPanel->SetMouseCapture( ShowNewEdgeModule, Abort_Move_ModuleOutline );
|
||||||
}
|
}
|
||||||
/* Segment creation in progress.
|
/* Segment creation in progress.
|
||||||
|
@ -356,7 +361,7 @@ EDGE_MODULE* FOOTPRINT_EDIT_FRAME::Begin_Edge_Module( EDGE_MODULE* Edge,
|
||||||
|
|
||||||
Edge->m_End0 = Edge->m_Start0;
|
Edge->m_End0 = Edge->m_Start0;
|
||||||
|
|
||||||
module->Set_Rectangle_Encadrement();
|
module->CalculateBoundingBox();
|
||||||
module->m_LastEdit_Time = time( NULL );
|
module->m_LastEdit_Time = time( NULL );
|
||||||
OnModify();
|
OnModify();
|
||||||
}
|
}
|
||||||
|
@ -384,7 +389,7 @@ void FOOTPRINT_EDIT_FRAME::End_Edge_Module( EDGE_MODULE* Edge )
|
||||||
Edge->DeleteStructure();
|
Edge->DeleteStructure();
|
||||||
}
|
}
|
||||||
|
|
||||||
Module->Set_Rectangle_Encadrement();
|
Module->CalculateBoundingBox();
|
||||||
Module->m_LastEdit_Time = time( NULL );
|
Module->m_LastEdit_Time = time( NULL );
|
||||||
OnModify();
|
OnModify();
|
||||||
DrawPanel->SetMouseCapture( NULL, NULL );
|
DrawPanel->SetMouseCapture( NULL, NULL );
|
||||||
|
|
|
@ -881,18 +881,18 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_PCB_MOVE_MIRE_REQUEST:
|
case ID_POPUP_PCB_MOVE_MIRE_REQUEST:
|
||||||
StartMove_Mire( (MIREPCB*) GetCurItem(), &dc );
|
BeginMoveTarget( (PCB_TARGET*) GetCurItem(), &dc );
|
||||||
DrawPanel->MoveCursorToCrossHair();
|
DrawPanel->MoveCursorToCrossHair();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_PCB_EDIT_MIRE:
|
case ID_POPUP_PCB_EDIT_MIRE:
|
||||||
InstallMireOptionsFrame( (MIREPCB*) GetCurItem(), &dc );
|
ShowTargetOptionsDialog( (PCB_TARGET*) GetCurItem(), &dc );
|
||||||
DrawPanel->MoveCursorToCrossHair();
|
DrawPanel->MoveCursorToCrossHair();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_PCB_DELETE_MIRE:
|
case ID_POPUP_PCB_DELETE_MIRE:
|
||||||
DrawPanel->MoveCursorToCrossHair();
|
DrawPanel->MoveCursorToCrossHair();
|
||||||
Delete_Mire( (MIREPCB*) GetCurItem(), &dc );
|
DeleteTarget( (PCB_TARGET*) GetCurItem(), &dc );
|
||||||
SetCurItem( NULL );
|
SetCurItem( NULL );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1096,8 +1096,8 @@ void PCB_EDIT_FRAME::RemoveStruct( BOARD_ITEM* Item, wxDC* DC )
|
||||||
Delete_Dimension( (DIMENSION*) Item, DC );
|
Delete_Dimension( (DIMENSION*) Item, DC );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_MIRE:
|
case PCB_TARGET_T:
|
||||||
Delete_Mire( (MIREPCB*) Item, DC );
|
DeleteTarget( (PCB_TARGET*) Item, DC );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_DRAWSEGMENT:
|
case TYPE_DRAWSEGMENT:
|
||||||
|
|
|
@ -111,7 +111,7 @@ void PCB_EDIT_FRAME::StartMoveTextePcb( TEXTE_PCB* TextePcb, wxDC* DC )
|
||||||
|
|
||||||
DrawPanel->SetMouseCapture( Move_Texte_Pcb, Abort_Edit_Pcb_Text );
|
DrawPanel->SetMouseCapture( Move_Texte_Pcb, Abort_Edit_Pcb_Text );
|
||||||
SetCurItem( TextePcb );
|
SetCurItem( TextePcb );
|
||||||
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, FALSE );
|
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -160,6 +160,7 @@ TEXTE_PCB* PCB_EDIT_FRAME::Create_Texte_Pcb( wxDC* DC )
|
||||||
TextePcb->m_Flags = IS_NEW;
|
TextePcb->m_Flags = IS_NEW;
|
||||||
TextePcb->SetLayer( ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer );
|
TextePcb->SetLayer( ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer );
|
||||||
TextePcb->m_Mirror = false;
|
TextePcb->m_Mirror = false;
|
||||||
|
|
||||||
if( TextePcb->GetLayer() == LAYER_N_BACK )
|
if( TextePcb->GetLayer() == LAYER_N_BACK )
|
||||||
TextePcb->m_Mirror = true;
|
TextePcb->m_Mirror = true;
|
||||||
|
|
||||||
|
@ -168,13 +169,16 @@ TEXTE_PCB* PCB_EDIT_FRAME::Create_Texte_Pcb( wxDC* DC )
|
||||||
TextePcb->m_Thickness = GetBoard()->GetBoardDesignSettings()->m_PcbTextWidth;
|
TextePcb->m_Thickness = GetBoard()->GetBoardDesignSettings()->m_PcbTextWidth;
|
||||||
|
|
||||||
InstallTextPCBOptionsFrame( TextePcb, DC );
|
InstallTextPCBOptionsFrame( TextePcb, DC );
|
||||||
|
|
||||||
if( TextePcb->m_Text.IsEmpty() )
|
if( TextePcb->m_Text.IsEmpty() )
|
||||||
{
|
{
|
||||||
TextePcb->DeleteStructure();
|
TextePcb->DeleteStructure();
|
||||||
TextePcb = NULL;
|
TextePcb = NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
StartMoveTextePcb( TextePcb, DC );
|
StartMoveTextePcb( TextePcb, DC );
|
||||||
|
}
|
||||||
|
|
||||||
return TextePcb;
|
return TextePcb;
|
||||||
}
|
}
|
||||||
|
@ -197,6 +201,7 @@ void PCB_EDIT_FRAME::Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC )
|
||||||
/* Redraw text in new position. */
|
/* Redraw text in new position. */
|
||||||
TextePcb->Draw( DrawPanel, DC, drawmode );
|
TextePcb->Draw( DrawPanel, DC, drawmode );
|
||||||
TextePcb->DisplayInfo( this );
|
TextePcb->DisplayInfo( this );
|
||||||
|
|
||||||
if( TextePcb->m_Flags == 0 ) // i.e. not edited, or moved
|
if( TextePcb->m_Flags == 0 ) // i.e. not edited, or moved
|
||||||
SaveCopyInUndoList( TextePcb, UR_ROTATED, TextePcb->m_Pos );
|
SaveCopyInUndoList( TextePcb, UR_ROTATED, TextePcb->m_Pos );
|
||||||
else // set flag edit, to show it was a complex command
|
else // set flag edit, to show it was a complex command
|
||||||
|
|
|
@ -41,17 +41,22 @@ bool PCB_EDIT_FRAME::SetTrackSegmentWidth( TRACK* aTrackItem,
|
||||||
new_width = net->GetTrackWidth();
|
new_width = net->GetTrackWidth();
|
||||||
else
|
else
|
||||||
new_width = GetBoard()->GetCurrentTrackWidth();
|
new_width = GetBoard()->GetCurrentTrackWidth();
|
||||||
|
|
||||||
if( aTrackItem->Type() == TYPE_VIA )
|
if( aTrackItem->Type() == TYPE_VIA )
|
||||||
{
|
{
|
||||||
if( !aTrackItem->IsDrillDefault() )
|
if( !aTrackItem->IsDrillDefault() )
|
||||||
initial_drill = aTrackItem->GetDrillValue();
|
initial_drill = aTrackItem->GetDrillValue();
|
||||||
|
|
||||||
if( net )
|
if( net )
|
||||||
|
{
|
||||||
new_width = net->GetViaSize();
|
new_width = net->GetViaSize();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
new_width = GetBoard()->GetCurrentViaSize();
|
new_width = GetBoard()->GetCurrentViaSize();
|
||||||
new_drill = GetBoard()->GetCurrentViaDrill();
|
new_drill = GetBoard()->GetCurrentViaDrill();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( aTrackItem->m_Shape == VIA_MICROVIA )
|
if( aTrackItem->m_Shape == VIA_MICROVIA )
|
||||||
{
|
{
|
||||||
if( net )
|
if( net )
|
||||||
|
@ -59,29 +64,36 @@ bool PCB_EDIT_FRAME::SetTrackSegmentWidth( TRACK* aTrackItem,
|
||||||
else
|
else
|
||||||
new_width = net->GetMicroViaSize();
|
new_width = net->GetMicroViaSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
aTrackItem->m_Width = new_width;
|
aTrackItem->m_Width = new_width;
|
||||||
|
|
||||||
if( initial_width < new_width ) /* make a DRC test because the new size is bigger than the old size */
|
if( initial_width < new_width ) /* make a DRC test because the new size is bigger than the old size */
|
||||||
{
|
{
|
||||||
int diagdrc = OK_DRC;
|
int diagdrc = OK_DRC;
|
||||||
|
|
||||||
if( Drc_On )
|
if( Drc_On )
|
||||||
diagdrc = m_drc->Drc( aTrackItem, GetBoard()->m_Track );
|
diagdrc = m_drc->Drc( aTrackItem, GetBoard()->m_Track );
|
||||||
|
|
||||||
if( diagdrc == OK_DRC )
|
if( diagdrc == OK_DRC )
|
||||||
change_ok = true;
|
change_ok = true;
|
||||||
}
|
}
|
||||||
else if( initial_width > new_width )
|
else if( initial_width > new_width )
|
||||||
|
{
|
||||||
change_ok = true;
|
change_ok = true;
|
||||||
|
}
|
||||||
|
|
||||||
// if new width == initial_width: do nothing,
|
// if new width == initial_width: do nothing,
|
||||||
// unless a via has its drill value changed
|
// unless a via has its drill value changed
|
||||||
else if( (aTrackItem->Type() == TYPE_VIA) && (initial_drill != new_drill) )
|
else if( (aTrackItem->Type() == TYPE_VIA) && (initial_drill != new_drill) )
|
||||||
|
{
|
||||||
change_ok = true;
|
change_ok = true;
|
||||||
|
}
|
||||||
|
|
||||||
if( change_ok )
|
if( change_ok )
|
||||||
{
|
{
|
||||||
OnModify();
|
OnModify();
|
||||||
|
|
||||||
if( aItemsListPicker )
|
if( aItemsListPicker )
|
||||||
{
|
{
|
||||||
aTrackItem->m_Width = initial_width;
|
aTrackItem->m_Width = initial_width;
|
||||||
|
@ -89,6 +101,7 @@ bool PCB_EDIT_FRAME::SetTrackSegmentWidth( TRACK* aTrackItem,
|
||||||
picker.m_Link = aTrackItem->Copy();
|
picker.m_Link = aTrackItem->Copy();
|
||||||
aItemsListPicker->PushItem( picker );
|
aItemsListPicker->PushItem( picker );
|
||||||
aTrackItem->m_Width = new_width;
|
aTrackItem->m_Width = new_width;
|
||||||
|
|
||||||
if( aTrackItem->Type() == TYPE_VIA )
|
if( aTrackItem->Type() == TYPE_VIA )
|
||||||
{
|
{
|
||||||
// Set new drill value. Note: currently microvias have only a default drill value
|
// Set new drill value. Note: currently microvias have only a default drill value
|
||||||
|
@ -100,7 +113,9 @@ bool PCB_EDIT_FRAME::SetTrackSegmentWidth( TRACK* aTrackItem,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
aTrackItem->m_Width = initial_width;
|
aTrackItem->m_Width = initial_width;
|
||||||
|
}
|
||||||
|
|
||||||
return change_ok;
|
return change_ok;
|
||||||
}
|
}
|
||||||
|
@ -130,6 +145,7 @@ void PCB_EDIT_FRAME::Edit_TrackSegm_Width( wxDC* aDC, TRACK* aTrackItem )
|
||||||
aTrackItem->Draw( DrawPanel, aDC, GR_OR ); // Display new track shape
|
aTrackItem->Draw( DrawPanel, aDC, GR_OR ); // Display new track shape
|
||||||
DrawPanel->CrossHairOn( aDC ); // Display cursor shape
|
DrawPanel->CrossHairOn( aDC ); // Display cursor shape
|
||||||
}
|
}
|
||||||
|
|
||||||
SaveCopyInUndoList( itemsListPicker, UR_CHANGED );
|
SaveCopyInUndoList( itemsListPicker, UR_CHANGED );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,7 +153,8 @@ void PCB_EDIT_FRAME::Edit_TrackSegm_Width( wxDC* aDC, TRACK* aTrackItem )
|
||||||
/**
|
/**
|
||||||
* Function Edit_Track_Width
|
* Function Edit_Track_Width
|
||||||
* Modify a full track width (using DRC control).
|
* Modify a full track width (using DRC control).
|
||||||
* a full track is the set of track segments between 2 ends: pads or a point that has more than 2 segments ends connected
|
* a full track is the set of track segments between 2 ends: pads or a point that has
|
||||||
|
* more than 2 segments ends connected
|
||||||
* @param aDC = the curred device context (can be NULL)
|
* @param aDC = the curred device context (can be NULL)
|
||||||
* @param aTrackSegment = a segment or via on the track to change
|
* @param aTrackSegment = a segment or via on the track to change
|
||||||
*/
|
*/
|
||||||
|
@ -149,13 +166,15 @@ void PCB_EDIT_FRAME::Edit_Track_Width( wxDC* aDC, TRACK* aTrackSegment )
|
||||||
if( aTrackSegment == NULL )
|
if( aTrackSegment == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pt_track = Marque_Une_Piste( GetBoard(), aTrackSegment, &nb_segm, NULL, NULL, true );
|
pt_track = MarkTrace( GetBoard(), aTrackSegment, &nb_segm, NULL, NULL, true );
|
||||||
|
|
||||||
PICKED_ITEMS_LIST itemsListPicker;
|
PICKED_ITEMS_LIST itemsListPicker;
|
||||||
bool change = false;
|
bool change = false;
|
||||||
|
|
||||||
for( int ii = 0; ii < nb_segm; ii++, pt_track = pt_track->Next() )
|
for( int ii = 0; ii < nb_segm; ii++, pt_track = pt_track->Next() )
|
||||||
{
|
{
|
||||||
pt_track->SetState( BUSY, OFF );
|
pt_track->SetState( BUSY, OFF );
|
||||||
|
|
||||||
if( SetTrackSegmentWidth( pt_track, &itemsListPicker, false ) )
|
if( SetTrackSegmentWidth( pt_track, &itemsListPicker, false ) )
|
||||||
change = true;
|
change = true;
|
||||||
}
|
}
|
||||||
|
@ -190,9 +209,7 @@ void PCB_EDIT_FRAME::Edit_Track_Width( wxDC* aDC, TRACK* aTrackSegment )
|
||||||
* @param aNetcode : the netcode of the net to edit
|
* @param aNetcode : the netcode of the net to edit
|
||||||
* @param aUseNetclassValue : bool. True to use netclass values, false to use current values
|
* @param aUseNetclassValue : bool. True to use netclass values, false to use current values
|
||||||
*/
|
*/
|
||||||
/***********************************************************/
|
|
||||||
bool PCB_EDIT_FRAME::Change_Net_Tracks_And_Vias_Sizes( int aNetcode, bool aUseNetclassValue )
|
bool PCB_EDIT_FRAME::Change_Net_Tracks_And_Vias_Sizes( int aNetcode, bool aUseNetclassValue )
|
||||||
/***********************************************************/
|
|
||||||
{
|
{
|
||||||
TRACK* pt_segm;
|
TRACK* pt_segm;
|
||||||
|
|
||||||
|
@ -202,10 +219,12 @@ bool PCB_EDIT_FRAME::Change_Net_Tracks_And_Vias_Sizes( int aNetcode, bool aUseNe
|
||||||
/* Examine segments */
|
/* Examine segments */
|
||||||
PICKED_ITEMS_LIST itemsListPicker;
|
PICKED_ITEMS_LIST itemsListPicker;
|
||||||
bool change = false;
|
bool change = false;
|
||||||
|
|
||||||
for( pt_segm = GetBoard()->m_Track; pt_segm != NULL; pt_segm = pt_segm->Next() )
|
for( pt_segm = GetBoard()->m_Track; pt_segm != NULL; pt_segm = pt_segm->Next() )
|
||||||
{
|
{
|
||||||
if( aNetcode != pt_segm->GetNet() ) /* not in net */
|
if( aNetcode != pt_segm->GetNet() ) /* not in net */
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* we have found a item member of the net */
|
/* we have found a item member of the net */
|
||||||
if( SetTrackSegmentWidth( pt_segm, &itemsListPicker, aUseNetclassValue ) )
|
if( SetTrackSegmentWidth( pt_segm, &itemsListPicker, aUseNetclassValue ) )
|
||||||
change = true;
|
change = true;
|
||||||
|
@ -220,15 +239,14 @@ bool PCB_EDIT_FRAME::Change_Net_Tracks_And_Vias_Sizes( int aNetcode, bool aUseNe
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
|
||||||
bool PCB_EDIT_FRAME::Reset_All_Tracks_And_Vias_To_Netclass_Values( bool aTrack, bool aVia )
|
bool PCB_EDIT_FRAME::Reset_All_Tracks_And_Vias_To_Netclass_Values( bool aTrack, bool aVia )
|
||||||
/*************************************************************************/
|
|
||||||
{
|
{
|
||||||
TRACK* pt_segm;
|
TRACK* pt_segm;
|
||||||
|
|
||||||
/* read and edit tracks and vias if required */
|
/* read and edit tracks and vias if required */
|
||||||
PICKED_ITEMS_LIST itemsListPicker;
|
PICKED_ITEMS_LIST itemsListPicker;
|
||||||
bool change = false;
|
bool change = false;
|
||||||
|
|
||||||
for( pt_segm = GetBoard()->m_Track; pt_segm != NULL; pt_segm = pt_segm->Next() )
|
for( pt_segm = GetBoard()->m_Track; pt_segm != NULL; pt_segm = pt_segm->Next() )
|
||||||
{
|
{
|
||||||
if( (pt_segm->Type() == TYPE_VIA ) && aVia )
|
if( (pt_segm->Type() == TYPE_VIA ) && aVia )
|
||||||
|
|
|
@ -14,8 +14,7 @@
|
||||||
|
|
||||||
|
|
||||||
static void Abort_EditEdge( EDA_DRAW_PANEL* Panel, wxDC* DC );
|
static void Abort_EditEdge( EDA_DRAW_PANEL* Panel, wxDC* DC );
|
||||||
static void Montre_Position_NewSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
|
static void DrawSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase );
|
||||||
const wxPoint& aPosition, bool aErase );
|
|
||||||
static void Move_Segment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
|
static void Move_Segment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
|
||||||
bool aErase );
|
bool aErase );
|
||||||
|
|
||||||
|
@ -29,6 +28,7 @@ void PCB_EDIT_FRAME::Start_Move_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC )
|
||||||
{
|
{
|
||||||
if( drawitem == NULL )
|
if( drawitem == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
drawitem->Draw( DrawPanel, DC, GR_XOR );
|
drawitem->Draw( DrawPanel, DC, GR_XOR );
|
||||||
drawitem->m_Flags |= IS_MOVED;
|
drawitem->m_Flags |= IS_MOVED;
|
||||||
s_InitialPosition = s_LastPosition = GetScreen()->GetCrossHairPosition();
|
s_InitialPosition = s_LastPosition = GetScreen()->GetCrossHairPosition();
|
||||||
|
@ -94,8 +94,10 @@ void PCB_EDIT_FRAME::Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC )
|
||||||
Segment->Draw( DrawPanel, DC, GR_XOR );
|
Segment->Draw( DrawPanel, DC, GR_XOR );
|
||||||
PtStruct = Segment->Back();
|
PtStruct = Segment->Back();
|
||||||
Segment ->DeleteStructure();
|
Segment ->DeleteStructure();
|
||||||
|
|
||||||
if( PtStruct && (PtStruct->Type() == TYPE_DRAWSEGMENT ) )
|
if( PtStruct && (PtStruct->Type() == TYPE_DRAWSEGMENT ) )
|
||||||
Segment = (DRAWSEGMENT*) PtStruct;
|
Segment = (DRAWSEGMENT*) PtStruct;
|
||||||
|
|
||||||
DisplayOpt.DisplayDrawItems = track_fill_copy;
|
DisplayOpt.DisplayDrawItems = track_fill_copy;
|
||||||
SetCurItem( NULL );
|
SetCurItem( NULL );
|
||||||
}
|
}
|
||||||
|
@ -120,6 +122,7 @@ void PCB_EDIT_FRAME::Delete_Drawings_All_Layer( int aLayer )
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString msg = _( "Delete Layer " ) + GetBoard()->GetLayerName( aLayer );
|
wxString msg = _( "Delete Layer " ) + GetBoard()->GetLayerName( aLayer );
|
||||||
|
|
||||||
if( !IsOK( this, msg ) )
|
if( !IsOK( this, msg ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -136,13 +139,14 @@ void PCB_EDIT_FRAME::Delete_Drawings_All_Layer( int aLayer )
|
||||||
case TYPE_DRAWSEGMENT:
|
case TYPE_DRAWSEGMENT:
|
||||||
case TYPE_TEXTE:
|
case TYPE_TEXTE:
|
||||||
case TYPE_DIMENSION:
|
case TYPE_DIMENSION:
|
||||||
case TYPE_MIRE:
|
case PCB_TARGET_T:
|
||||||
if( item->GetLayer() == aLayer )
|
if( item->GetLayer() == aLayer )
|
||||||
{
|
{
|
||||||
item->UnLink();
|
item->UnLink();
|
||||||
picker.m_PickedItem = item;
|
picker.m_PickedItem = item;
|
||||||
pickList.PushItem( picker );
|
pickList.PushItem( picker );
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -218,10 +222,10 @@ DRAWSEGMENT* PCB_EDIT_FRAME::Begin_DrawSegment( DRAWSEGMENT* Segment, int shape,
|
||||||
Segment->m_Shape = shape;
|
Segment->m_Shape = shape;
|
||||||
Segment->m_Angle = 900;
|
Segment->m_Angle = 900;
|
||||||
Segment->m_Start = Segment->m_End = GetScreen()->GetCrossHairPosition();
|
Segment->m_Start = Segment->m_End = GetScreen()->GetCrossHairPosition();
|
||||||
DrawPanel->SetMouseCapture( Montre_Position_NewSegment, Abort_EditEdge );
|
DrawPanel->SetMouseCapture( DrawSegment, Abort_EditEdge );
|
||||||
}
|
}
|
||||||
else /* The ending point ccordinate Segment->m_End was updated by he function
|
else /* The ending point ccordinate Segment->m_End was updated by he function
|
||||||
* Montre_Position_NewSegment() called on a move mouse event
|
* DrawSegment() called on a move mouse event
|
||||||
* during the segment creation
|
* during the segment creation
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
|
@ -248,7 +252,7 @@ DRAWSEGMENT* PCB_EDIT_FRAME::Begin_DrawSegment( DRAWSEGMENT* Segment, int shape,
|
||||||
Segment->m_Type = DrawItem->m_Type;
|
Segment->m_Type = DrawItem->m_Type;
|
||||||
Segment->m_Angle = DrawItem->m_Angle;
|
Segment->m_Angle = DrawItem->m_Angle;
|
||||||
Segment->m_Start = Segment->m_End = DrawItem->m_End;
|
Segment->m_Start = Segment->m_End = DrawItem->m_End;
|
||||||
Montre_Position_NewSegment( DrawPanel, DC, wxDefaultPosition, false );
|
DrawSegment( DrawPanel, DC, wxDefaultPosition, false );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -266,12 +270,14 @@ void PCB_EDIT_FRAME::End_Edge( DRAWSEGMENT* Segment, wxDC* DC )
|
||||||
{
|
{
|
||||||
if( Segment == NULL )
|
if( Segment == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Segment->Draw( DrawPanel, DC, GR_OR );
|
Segment->Draw( DrawPanel, DC, GR_OR );
|
||||||
|
|
||||||
/* Delete if segment length is zero. */
|
/* Delete if segment length is zero. */
|
||||||
if( Segment->m_Start == Segment->m_End )
|
if( Segment->m_Start == Segment->m_End )
|
||||||
|
{
|
||||||
Segment ->DeleteStructure();
|
Segment ->DeleteStructure();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Segment->m_Flags = 0;
|
Segment->m_Flags = 0;
|
||||||
|
@ -287,8 +293,7 @@ void PCB_EDIT_FRAME::End_Edge( DRAWSEGMENT* Segment, wxDC* DC )
|
||||||
|
|
||||||
/* Redraw segment during cursor movement
|
/* Redraw segment during cursor movement
|
||||||
*/
|
*/
|
||||||
static void Montre_Position_NewSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
|
static void DrawSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase )
|
||||||
const wxPoint& aPosition, bool aErase )
|
|
||||||
{
|
{
|
||||||
DRAWSEGMENT* Segment = (DRAWSEGMENT*) aPanel->GetScreen()->GetCurItem();
|
DRAWSEGMENT* Segment = (DRAWSEGMENT*) aPanel->GetScreen()->GetCurItem();
|
||||||
int t_fill = DisplayOpt.DisplayDrawItems;
|
int t_fill = DisplayOpt.DisplayDrawItems;
|
||||||
|
@ -303,7 +308,7 @@ static void Montre_Position_NewSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
|
||||||
|
|
||||||
if( Segments_45_Only && ( Segment->m_Shape == S_SEGMENT ) )
|
if( Segments_45_Only && ( Segment->m_Shape == S_SEGMENT ) )
|
||||||
{
|
{
|
||||||
Calcule_Coord_Extremite_45( aPanel->GetScreen()->GetCrossHairPosition(),
|
CalculateSegmentEndPoint( aPanel->GetScreen()->GetCrossHairPosition(),
|
||||||
Segment->m_Start.x, Segment->m_Start.y,
|
Segment->m_Start.x, Segment->m_Start.y,
|
||||||
&Segment->m_End.x, &Segment->m_End.y );
|
&Segment->m_End.x, &Segment->m_End.y );
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,8 +23,7 @@ void PCB_EDIT_FRAME::InstallModuleOptionsFrame( MODULE* Module, wxDC* DC )
|
||||||
if( Module == NULL )
|
if( Module == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
DIALOG_MODULE_BOARD_EDITOR* dialog =
|
DIALOG_MODULE_BOARD_EDITOR* dialog = new DIALOG_MODULE_BOARD_EDITOR( this, Module, DC );
|
||||||
new DIALOG_MODULE_BOARD_EDITOR( this, Module, DC );
|
|
||||||
|
|
||||||
int retvalue = dialog->ShowModal(); /* retvalue =
|
int retvalue = dialog->ShowModal(); /* retvalue =
|
||||||
* -1 if abort,
|
* -1 if abort,
|
||||||
|
@ -47,8 +46,8 @@ void PCB_EDIT_FRAME::InstallModuleOptionsFrame( MODULE* Module, wxDC* DC )
|
||||||
m_ModuleEditFrame->Load_Module_From_BOARD( Module );
|
m_ModuleEditFrame->Load_Module_From_BOARD( Module );
|
||||||
SetCurItem( NULL );
|
SetCurItem( NULL );
|
||||||
|
|
||||||
m_ModuleEditFrame->Show( TRUE );
|
m_ModuleEditFrame->Show( true );
|
||||||
m_ModuleEditFrame->Iconize( FALSE );
|
m_ModuleEditFrame->Iconize( false );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,7 +106,7 @@ void FOOTPRINT_EDIT_FRAME::Place_Ancre( MODULE* pt_mod )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pt_mod->Set_Rectangle_Encadrement();
|
pt_mod->CalculateBoundingBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -125,16 +124,19 @@ void FOOTPRINT_EDIT_FRAME::RemoveStruct( EDA_ITEM* Item )
|
||||||
case TYPE_TEXTE_MODULE:
|
case TYPE_TEXTE_MODULE:
|
||||||
{
|
{
|
||||||
TEXTE_MODULE* text = (TEXTE_MODULE*) Item;
|
TEXTE_MODULE* text = (TEXTE_MODULE*) Item;
|
||||||
|
|
||||||
if( text->m_Type == TEXT_is_REFERENCE )
|
if( text->m_Type == TEXT_is_REFERENCE )
|
||||||
{
|
{
|
||||||
DisplayError( this, _( "Text is REFERENCE!" ) );
|
DisplayError( this, _( "Text is REFERENCE!" ) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( text->m_Type == TEXT_is_VALUE )
|
if( text->m_Type == TEXT_is_VALUE )
|
||||||
{
|
{
|
||||||
DisplayError( this, _( "Text is VALUE!" ) );
|
DisplayError( this, _( "Text is VALUE!" ) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
DeleteTextModule( text );
|
DeleteTextModule( text );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*******************************/
|
/************************/
|
||||||
/* Edit tracks */
|
/* Edit tracks */
|
||||||
/*******************************/
|
/************************/
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
#include "class_drawpanel.h"
|
#include "class_drawpanel.h"
|
||||||
|
@ -33,12 +33,14 @@ void PCB_EDIT_FRAME::ExChange_Track_Layer( TRACK* pt_segm, wxDC* DC )
|
||||||
|
|
||||||
l1 = Route_Layer_TOP; l2 = Route_Layer_BOTTOM;
|
l1 = Route_Layer_TOP; l2 = Route_Layer_BOTTOM;
|
||||||
|
|
||||||
pt_track = Marque_Une_Piste( GetBoard(), pt_segm, &nb_segm, NULL, NULL, true );
|
pt_track = MarkTrace( GetBoard(), pt_segm, &nb_segm, NULL, NULL, true );
|
||||||
|
|
||||||
if ( DC )
|
if ( DC )
|
||||||
Trace_Une_Piste( DrawPanel, DC, pt_track, nb_segm, GR_XOR );
|
DrawTraces( DrawPanel, DC, pt_track, nb_segm, GR_XOR );
|
||||||
|
|
||||||
/* Clear the BUSY flag and backup member. Param layer original. */
|
/* Clear the BUSY flag and backup member. Param layer original. */
|
||||||
ii = nb_segm; pt_segm = pt_track;
|
ii = nb_segm; pt_segm = pt_track;
|
||||||
|
|
||||||
for( ; ii > 0; ii--, pt_segm = (TRACK*) pt_segm->Next() )
|
for( ; ii > 0; ii--, pt_segm = (TRACK*) pt_segm->Next() )
|
||||||
{
|
{
|
||||||
pt_segm->SetState( BUSY, OFF );
|
pt_segm->SetState( BUSY, OFF );
|
||||||
|
@ -46,6 +48,7 @@ void PCB_EDIT_FRAME::ExChange_Track_Layer( TRACK* pt_segm, wxDC* DC )
|
||||||
}
|
}
|
||||||
|
|
||||||
ii = 0; pt_segm = pt_track;
|
ii = 0; pt_segm = pt_track;
|
||||||
|
|
||||||
for( ; ii < nb_segm; ii++, pt_segm = (TRACK*) pt_segm->Next() )
|
for( ; ii < nb_segm; ii++, pt_segm = (TRACK*) pt_segm->Next() )
|
||||||
{
|
{
|
||||||
if( pt_segm->Type() == TYPE_VIA )
|
if( pt_segm->Type() == TYPE_VIA )
|
||||||
|
@ -69,15 +72,19 @@ void PCB_EDIT_FRAME::ExChange_Track_Layer( TRACK* pt_segm, wxDC* DC )
|
||||||
}
|
}
|
||||||
|
|
||||||
if( DC )
|
if( DC )
|
||||||
Trace_Une_Piste( DrawPanel, DC, pt_track, nb_segm, GR_OR );
|
DrawTraces( DrawPanel, DC, pt_track, nb_segm, GR_OR );
|
||||||
DisplayError( this, _( "Drc error, canceled" ), 10 );
|
|
||||||
|
DisplayError( this, _( "Drc error, canceled" ) );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Trace_Une_Piste( DrawPanel, DC, pt_track, nb_segm, GR_OR | GR_SURBRILL );
|
DrawTraces( DrawPanel, DC, pt_track, nb_segm, GR_OR | GR_SURBRILL );
|
||||||
|
|
||||||
/* Control of segment end point, is it on a pad? */
|
/* Control of segment end point, is it on a pad? */
|
||||||
ii = 0; pt_segm = pt_track;
|
ii = 0;
|
||||||
|
pt_segm = pt_track;
|
||||||
|
|
||||||
for( ; ii < nb_segm; pt_segm = pt_segm->Next(), ii++ )
|
for( ; ii < nb_segm; pt_segm = pt_segm->Next(), ii++ )
|
||||||
{
|
{
|
||||||
pt_segm->start = Locate_Pad_Connecte( GetBoard(), pt_segm, START );
|
pt_segm->start = Locate_Pad_Connecte( GetBoard(), pt_segm, START );
|
||||||
|
@ -96,8 +103,7 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
|
||||||
|
|
||||||
if( aTrack == NULL )
|
if( aTrack == NULL )
|
||||||
{
|
{
|
||||||
if( getActiveLayer() !=
|
if( getActiveLayer() != ((PCB_SCREEN*)GetScreen())->m_Route_Layer_TOP )
|
||||||
((PCB_SCREEN*)GetScreen())->m_Route_Layer_TOP )
|
|
||||||
setActiveLayer( ((PCB_SCREEN*)GetScreen())->m_Route_Layer_TOP );
|
setActiveLayer( ((PCB_SCREEN*)GetScreen())->m_Route_Layer_TOP );
|
||||||
else
|
else
|
||||||
setActiveLayer(((PCB_SCREEN*)GetScreen())->m_Route_Layer_BOTTOM );
|
setActiveLayer(((PCB_SCREEN*)GetScreen())->m_Route_Layer_BOTTOM );
|
||||||
|
@ -107,14 +113,12 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Avoid more than one via on the current location: */
|
/* Avoid more than one via on the current location: */
|
||||||
if( Locate_Via( GetBoard(), g_CurrentTrackSegment->m_End,
|
if( Locate_Via( GetBoard(), g_CurrentTrackSegment->m_End, g_CurrentTrackSegment->GetLayer() ) )
|
||||||
g_CurrentTrackSegment->GetLayer() ) )
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for( TRACK* segm = g_FirstTrackSegment; segm; segm = segm->Next() )
|
for( TRACK* segm = g_FirstTrackSegment; segm; segm = segm->Next() )
|
||||||
{
|
{
|
||||||
if( segm->Type()==TYPE_VIA
|
if( segm->Type() == TYPE_VIA && g_CurrentTrackSegment->m_End == segm->m_Start )
|
||||||
&& g_CurrentTrackSegment->m_End==segm->m_Start )
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,8 +132,7 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
|
||||||
// Handle 2 segments.
|
// Handle 2 segments.
|
||||||
if( g_TwoSegmentTrackBuild && g_CurrentTrackSegment->Back() )
|
if( g_TwoSegmentTrackBuild && g_CurrentTrackSegment->Back() )
|
||||||
{
|
{
|
||||||
if( BAD_DRC == m_drc->Drc( g_CurrentTrackSegment->Back(),
|
if( BAD_DRC == m_drc->Drc( g_CurrentTrackSegment->Back(), GetBoard()->m_Track ) )
|
||||||
GetBoard()->m_Track ) )
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -140,7 +143,7 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
|
||||||
itmp = g_CurrentTrackList.GetCount();
|
itmp = g_CurrentTrackList.GetCount();
|
||||||
Begin_Route( g_CurrentTrackSegment, DC );
|
Begin_Route( g_CurrentTrackSegment, DC );
|
||||||
|
|
||||||
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, FALSE );
|
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
|
||||||
|
|
||||||
/* create the via */
|
/* create the via */
|
||||||
SEGVIA* via = new SEGVIA( GetBoard() );
|
SEGVIA* via = new SEGVIA( GetBoard() );
|
||||||
|
@ -149,6 +152,7 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
|
||||||
via->m_Width = GetBoard()->GetCurrentViaSize();
|
via->m_Width = GetBoard()->GetCurrentViaSize();
|
||||||
via->SetNet( GetBoard()->GetHightLightNetCode() );
|
via->SetNet( GetBoard()->GetHightLightNetCode() );
|
||||||
via->m_Start = via->m_End = g_CurrentTrackSegment->m_End;
|
via->m_Start = via->m_End = g_CurrentTrackSegment->m_End;
|
||||||
|
|
||||||
// Usual via is from copper to component.
|
// Usual via is from copper to component.
|
||||||
// layer pair is LAYER_N_BACK and LAYER_N_FRONT.
|
// layer pair is LAYER_N_BACK and LAYER_N_FRONT.
|
||||||
via->SetLayerPair( LAYER_N_BACK, LAYER_N_FRONT );
|
via->SetLayerPair( LAYER_N_BACK, LAYER_N_FRONT );
|
||||||
|
@ -156,6 +160,7 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
|
||||||
|
|
||||||
int first_layer = getActiveLayer();
|
int first_layer = getActiveLayer();
|
||||||
int last_layer;
|
int last_layer;
|
||||||
|
|
||||||
// prepare switch to new active layer:
|
// prepare switch to new active layer:
|
||||||
if( first_layer != GetScreen()->m_Route_Layer_TOP )
|
if( first_layer != GetScreen()->m_Route_Layer_TOP )
|
||||||
last_layer = GetScreen()->m_Route_Layer_TOP;
|
last_layer = GetScreen()->m_Route_Layer_TOP;
|
||||||
|
@ -180,6 +185,7 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
|
||||||
last_layer = LAYER_N_BACK;
|
last_layer = LAYER_N_BACK;
|
||||||
else if ( first_layer == last_inner_layer )
|
else if ( first_layer == last_inner_layer )
|
||||||
last_layer = LAYER_N_FRONT;
|
last_layer = LAYER_N_FRONT;
|
||||||
|
|
||||||
// else error: will be removed later
|
// else error: will be removed later
|
||||||
via->SetLayerPair( first_layer, last_layer );
|
via->SetLayerPair( first_layer, last_layer );
|
||||||
{
|
{
|
||||||
|
@ -198,7 +204,7 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
|
||||||
/* DRC fault: the Via cannot be placed here ... */
|
/* DRC fault: the Via cannot be placed here ... */
|
||||||
delete via;
|
delete via;
|
||||||
|
|
||||||
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, FALSE );
|
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
|
||||||
|
|
||||||
// delete the track(s) added in Begin_Route()
|
// delete the track(s) added in Begin_Route()
|
||||||
while( g_CurrentTrackList.GetCount() > itmp )
|
while( g_CurrentTrackList.GetCount() > itmp )
|
||||||
|
@ -252,7 +258,7 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
|
||||||
g_CurrentTrackList.PushBack( g_CurrentTrackSegment->Copy() );
|
g_CurrentTrackList.PushBack( g_CurrentTrackSegment->Copy() );
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, FALSE );
|
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
|
||||||
via->DisplayInfo( this );
|
via->DisplayInfo( this );
|
||||||
|
|
||||||
UpdateStatusBar();
|
UpdateStatusBar();
|
||||||
|
@ -265,13 +271,13 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
|
||||||
* The status of the net on top of the screen segment advanced by mouse.
|
* The status of the net on top of the screen segment advanced by mouse.
|
||||||
* PCB status or bottom of screen if no segment peak.
|
* PCB status or bottom of screen if no segment peak.
|
||||||
*/
|
*/
|
||||||
void PCB_EDIT_FRAME::Affiche_Status_Net( wxDC* DC )
|
void PCB_EDIT_FRAME::DisplayNetStatus( wxDC* DC )
|
||||||
{
|
{
|
||||||
TRACK* pt_segm;
|
TRACK* pt_segm;
|
||||||
int masquelayer = (1 << getActiveLayer());
|
int layerMask = (1 << getActiveLayer());
|
||||||
wxPoint pos = GetScreen()->RefPos( true );
|
wxPoint pos = GetScreen()->RefPos( true );
|
||||||
|
|
||||||
pt_segm = Locate_Pistes( GetBoard(), GetBoard()->m_Track, pos, masquelayer );
|
pt_segm = GetTrace( GetBoard(), GetBoard()->m_Track, pos, layerMask );
|
||||||
|
|
||||||
if( pt_segm == NULL )
|
if( pt_segm == NULL )
|
||||||
GetBoard()->DisplayInfo( this );
|
GetBoard()->DisplayInfo( this );
|
||||||
|
@ -294,7 +300,7 @@ void PCB_EDIT_FRAME::Show_1_Ratsnest( EDA_ITEM* item, wxDC* DC )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( ( GetBoard()->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK ) == 0 )
|
if( ( GetBoard()->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK ) == 0 )
|
||||||
Compile_Ratsnest( DC, TRUE );
|
Compile_Ratsnest( DC, true );
|
||||||
|
|
||||||
if( item )
|
if( item )
|
||||||
{
|
{
|
||||||
|
@ -307,14 +313,18 @@ void PCB_EDIT_FRAME::Show_1_Ratsnest( EDA_ITEM* item, wxDC* DC )
|
||||||
if( pt_pad ) /* Displaying the ratsnest of the corresponding net. */
|
if( pt_pad ) /* Displaying the ratsnest of the corresponding net. */
|
||||||
{
|
{
|
||||||
pt_pad->DisplayInfo( this );
|
pt_pad->DisplayInfo( this );
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < GetBoard()->GetRatsnestsCount(); ii++ )
|
for( unsigned ii = 0; ii < GetBoard()->GetRatsnestsCount(); ii++ )
|
||||||
{
|
{
|
||||||
RATSNEST_ITEM* net = &GetBoard()->m_FullRatsnest[ii];
|
RATSNEST_ITEM* net = &GetBoard()->m_FullRatsnest[ii];
|
||||||
|
|
||||||
if( net->GetNet() == pt_pad->GetNet() )
|
if( net->GetNet() == pt_pad->GetNet() )
|
||||||
{
|
{
|
||||||
if( ( net->m_Status & CH_VISIBLE ) != 0 )
|
if( ( net->m_Status & CH_VISIBLE ) != 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
net->m_Status |= CH_VISIBLE;
|
net->m_Status |= CH_VISIBLE;
|
||||||
|
|
||||||
if( ( net->m_Status & CH_ACTIF ) == 0 )
|
if( ( net->m_Status & CH_ACTIF ) == 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -326,8 +336,7 @@ void PCB_EDIT_FRAME::Show_1_Ratsnest( EDA_ITEM* item, wxDC* DC )
|
||||||
{
|
{
|
||||||
if( item->Type() == TYPE_TEXTE_MODULE )
|
if( item->Type() == TYPE_TEXTE_MODULE )
|
||||||
{
|
{
|
||||||
if( item->GetParent()
|
if( item->GetParent() && ( item->GetParent()->Type() == TYPE_MODULE ) )
|
||||||
&& ( item->GetParent()->Type() == TYPE_MODULE ) )
|
|
||||||
Module = (MODULE*) item->GetParent();
|
Module = (MODULE*) item->GetParent();
|
||||||
}
|
}
|
||||||
else if( item->Type() == TYPE_MODULE )
|
else if( item->Type() == TYPE_MODULE )
|
||||||
|
@ -339,19 +348,20 @@ void PCB_EDIT_FRAME::Show_1_Ratsnest( EDA_ITEM* item, wxDC* DC )
|
||||||
{
|
{
|
||||||
Module->DisplayInfo( this );
|
Module->DisplayInfo( this );
|
||||||
pt_pad = Module->m_Pads;
|
pt_pad = Module->m_Pads;
|
||||||
|
|
||||||
for( ; pt_pad != NULL; pt_pad = (D_PAD*) pt_pad->Next() )
|
for( ; pt_pad != NULL; pt_pad = (D_PAD*) pt_pad->Next() )
|
||||||
{
|
{
|
||||||
for( unsigned ii = 0; ii < GetBoard()->GetRatsnestsCount();
|
for( unsigned ii = 0; ii < GetBoard()->GetRatsnestsCount(); ii++ )
|
||||||
ii++ )
|
|
||||||
{
|
{
|
||||||
RATSNEST_ITEM* net = &GetBoard()->m_FullRatsnest[ii];
|
RATSNEST_ITEM* net = &GetBoard()->m_FullRatsnest[ii];
|
||||||
if( ( net->m_PadStart == pt_pad )
|
|
||||||
|| ( net->m_PadEnd == pt_pad ) )
|
if( ( net->m_PadStart == pt_pad ) || ( net->m_PadEnd == pt_pad ) )
|
||||||
{
|
{
|
||||||
if( net->m_Status & CH_VISIBLE )
|
if( net->m_Status & CH_VISIBLE )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
net->m_Status |= CH_VISIBLE;
|
net->m_Status |= CH_VISIBLE;
|
||||||
|
|
||||||
if( (net->m_Status & CH_ACTIF) == 0 )
|
if( (net->m_Status & CH_ACTIF) == 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -378,11 +388,12 @@ void PCB_EDIT_FRAME::Show_1_Ratsnest( EDA_ITEM* item, wxDC* DC )
|
||||||
|
|
||||||
/* High light the unconnected pads
|
/* High light the unconnected pads
|
||||||
*/
|
*/
|
||||||
void PCB_EDIT_FRAME::Affiche_PadsNoConnect( wxDC* DC )
|
void PCB_EDIT_FRAME::HighlightUnconnectedPads( wxDC* DC )
|
||||||
{
|
{
|
||||||
for( unsigned ii = 0; ii < GetBoard()->GetRatsnestsCount(); ii++ )
|
for( unsigned ii = 0; ii < GetBoard()->GetRatsnestsCount(); ii++ )
|
||||||
{
|
{
|
||||||
RATSNEST_ITEM* net = &GetBoard()->m_FullRatsnest[ii];
|
RATSNEST_ITEM* net = &GetBoard()->m_FullRatsnest[ii];
|
||||||
|
|
||||||
if( (net->m_Status & CH_ACTIF) == 0 )
|
if( (net->m_Status & CH_ACTIF) == 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
|
@ -26,8 +26,7 @@ static void EnsureEndTrackOnPad( D_PAD* Pad );
|
||||||
static PICKED_ITEMS_LIST s_ItemsListPicker;
|
static PICKED_ITEMS_LIST s_ItemsListPicker;
|
||||||
|
|
||||||
|
|
||||||
/* Routine to cancel the route if a track is being drawn, or exit the
|
/* Routine to cancel the route if a track is being drawn, or exit the application EDITRACK.
|
||||||
* application EDITRACK.
|
|
||||||
*/
|
*/
|
||||||
static void Abort_Create_Track( EDA_DRAW_PANEL* Panel, wxDC* DC )
|
static void Abort_Create_Track( EDA_DRAW_PANEL* Panel, wxDC* DC )
|
||||||
{
|
{
|
||||||
|
@ -39,10 +38,12 @@ static void Abort_Create_Track( EDA_DRAW_PANEL* Panel, wxDC* DC )
|
||||||
{
|
{
|
||||||
/* Erase the current drawing */
|
/* Erase the current drawing */
|
||||||
ShowNewTrackWhenMovingCursor( Panel, DC, wxDefaultPosition, false );
|
ShowNewTrackWhenMovingCursor( Panel, DC, wxDefaultPosition, false );
|
||||||
|
|
||||||
if( pcb->IsHightLightNetON() )
|
if( pcb->IsHightLightNetON() )
|
||||||
frame->High_Light( DC );
|
frame->High_Light( DC );
|
||||||
|
|
||||||
pcb->PopHightLight();
|
pcb->PopHightLight();
|
||||||
|
|
||||||
if( pcb->IsHightLightNetON() )
|
if( pcb->IsHightLightNetON() )
|
||||||
pcb->DrawHighLight( Panel, DC, pcb->GetHightLightNetCode() );
|
pcb->DrawHighLight( Panel, DC, pcb->GetHightLightNetCode() );
|
||||||
|
|
||||||
|
@ -80,8 +81,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* DC )
|
||||||
{
|
{
|
||||||
D_PAD* pt_pad = NULL;
|
D_PAD* pt_pad = NULL;
|
||||||
TRACK* TrackOnStartPoint = NULL;
|
TRACK* TrackOnStartPoint = NULL;
|
||||||
int masquelayer =
|
int layerMask = g_TabOneLayerMask[( (PCB_SCREEN*) GetScreen() )->m_Active_Layer];
|
||||||
g_TabOneLayerMask[( (PCB_SCREEN*) GetScreen() )->m_Active_Layer];
|
|
||||||
BOARD_ITEM* LockPoint;
|
BOARD_ITEM* LockPoint;
|
||||||
wxPoint pos = GetScreen()->GetCrossHairPosition();
|
wxPoint pos = GetScreen()->GetCrossHairPosition();
|
||||||
|
|
||||||
|
@ -90,9 +90,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* DC )
|
||||||
DrawPanel->SetMouseCapture( ShowNewTrackWhenMovingCursor, Abort_Create_Track );
|
DrawPanel->SetMouseCapture( ShowNewTrackWhenMovingCursor, Abort_Create_Track );
|
||||||
|
|
||||||
// Prepare the undo command info
|
// Prepare the undo command info
|
||||||
s_ItemsListPicker.ClearListAndDeleteItems(); // Should not be
|
s_ItemsListPicker.ClearListAndDeleteItems(); // Should not be necessary, but...
|
||||||
// necessary,
|
|
||||||
// but...
|
|
||||||
|
|
||||||
GetBoard()->PushHightLight();
|
GetBoard()->PushHightLight();
|
||||||
|
|
||||||
|
@ -106,7 +104,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* DC )
|
||||||
GetBoard()->SetHightLightNet(0);
|
GetBoard()->SetHightLightNet(0);
|
||||||
|
|
||||||
// Search for a starting point of the new track, a track or pad
|
// Search for a starting point of the new track, a track or pad
|
||||||
LockPoint = LocateLockPoint( GetBoard(), pos, masquelayer );
|
LockPoint = LocateLockPoint( GetBoard(), pos, layerMask );
|
||||||
|
|
||||||
if( LockPoint ) // An item (pad or track) is found
|
if( LockPoint ) // An item (pad or track) is found
|
||||||
{
|
{
|
||||||
|
@ -122,9 +120,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* DC )
|
||||||
{
|
{
|
||||||
TrackOnStartPoint = (TRACK*) LockPoint;
|
TrackOnStartPoint = (TRACK*) LockPoint;
|
||||||
GetBoard()->SetHightLightNet( TrackOnStartPoint->GetNet() );
|
GetBoard()->SetHightLightNet( TrackOnStartPoint->GetNet() );
|
||||||
CreateLockPoint( GetBoard(), pos,
|
CreateLockPoint( GetBoard(), pos, TrackOnStartPoint, &s_ItemsListPicker );
|
||||||
TrackOnStartPoint,
|
|
||||||
&s_ItemsListPicker );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // no starting point, but a filled zone area can exist. This is
|
else // no starting point, but a filled zone area can exist. This is
|
||||||
|
@ -158,6 +154,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* DC )
|
||||||
if( TrackOnStartPoint && TrackOnStartPoint->Type() == TYPE_TRACK )
|
if( TrackOnStartPoint && TrackOnStartPoint->Type() == TYPE_TRACK )
|
||||||
g_CurrentTrackSegment->m_Width = TrackOnStartPoint->m_Width;
|
g_CurrentTrackSegment->m_Width = TrackOnStartPoint->m_Width;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_CurrentTrackSegment->m_Start = pos;
|
g_CurrentTrackSegment->m_Start = pos;
|
||||||
g_CurrentTrackSegment->m_End = pos;
|
g_CurrentTrackSegment->m_End = pos;
|
||||||
|
|
||||||
|
@ -167,7 +164,9 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* DC )
|
||||||
g_CurrentTrackSegment->SetState( BEGIN_ONPAD, ON );
|
g_CurrentTrackSegment->SetState( BEGIN_ONPAD, ON );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
g_CurrentTrackSegment->start = TrackOnStartPoint;
|
g_CurrentTrackSegment->start = TrackOnStartPoint;
|
||||||
|
}
|
||||||
|
|
||||||
if( g_TwoSegmentTrackBuild )
|
if( g_TwoSegmentTrackBuild )
|
||||||
{
|
{
|
||||||
|
@ -190,8 +189,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* DC )
|
||||||
|
|
||||||
if( Drc_On )
|
if( Drc_On )
|
||||||
{
|
{
|
||||||
if( BAD_DRC ==
|
if( BAD_DRC == m_drc->Drc( g_CurrentTrackSegment, GetBoard()->m_Track ) )
|
||||||
m_drc->Drc( g_CurrentTrackSegment, GetBoard()->m_Track ) )
|
|
||||||
{
|
{
|
||||||
return g_CurrentTrackSegment;
|
return g_CurrentTrackSegment;
|
||||||
}
|
}
|
||||||
|
@ -202,16 +200,13 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* DC )
|
||||||
/* Tst for a D.R.C. error: */
|
/* Tst for a D.R.C. error: */
|
||||||
if( Drc_On )
|
if( Drc_On )
|
||||||
{
|
{
|
||||||
if( BAD_DRC ==
|
if( BAD_DRC == m_drc->Drc( g_CurrentTrackSegment, GetBoard()->m_Track ) )
|
||||||
m_drc->Drc( g_CurrentTrackSegment, GetBoard()->m_Track ) )
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
// We must handle 2 segments
|
// We must handle 2 segments
|
||||||
if( g_TwoSegmentTrackBuild && g_CurrentTrackSegment->Back() )
|
if( g_TwoSegmentTrackBuild && g_CurrentTrackSegment->Back() )
|
||||||
{
|
{
|
||||||
if( BAD_DRC ==
|
if( BAD_DRC == m_drc->Drc( g_CurrentTrackSegment->Back(), GetBoard()->m_Track ) )
|
||||||
m_drc->Drc( g_CurrentTrackSegment->Back(),
|
|
||||||
GetBoard()->m_Track ) )
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -221,6 +216,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* DC )
|
||||||
* if a 2 segments track build.
|
* if a 2 segments track build.
|
||||||
*/
|
*/
|
||||||
bool CanCreateNewSegment = true;
|
bool CanCreateNewSegment = true;
|
||||||
|
|
||||||
if( !g_TwoSegmentTrackBuild && g_CurrentTrackSegment->IsNull() )
|
if( !g_TwoSegmentTrackBuild && g_CurrentTrackSegment->IsNull() )
|
||||||
CanCreateNewSegment = false;
|
CanCreateNewSegment = false;
|
||||||
|
|
||||||
|
@ -251,13 +247,14 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* DC )
|
||||||
|
|
||||||
newTrack->SetState( BEGIN_ONPAD | END_ONPAD, OFF );
|
newTrack->SetState( BEGIN_ONPAD | END_ONPAD, OFF );
|
||||||
|
|
||||||
oneBeforeLatest->end = Locate_Pad_Connecte(
|
oneBeforeLatest->end = Locate_Pad_Connecte( GetBoard(), oneBeforeLatest, END );
|
||||||
GetBoard(), oneBeforeLatest, END );
|
|
||||||
if( oneBeforeLatest->end )
|
if( oneBeforeLatest->end )
|
||||||
{
|
{
|
||||||
oneBeforeLatest->SetState( END_ONPAD, ON );
|
oneBeforeLatest->SetState( END_ONPAD, ON );
|
||||||
newTrack->SetState( BEGIN_ONPAD, ON );
|
newTrack->SetState( BEGIN_ONPAD, ON );
|
||||||
}
|
}
|
||||||
|
|
||||||
newTrack->start = oneBeforeLatest->end;
|
newTrack->start = oneBeforeLatest->end;
|
||||||
|
|
||||||
D( g_CurrentTrackList.VerifyListIntegrity(); );
|
D( g_CurrentTrackList.VerifyListIntegrity(); );
|
||||||
|
@ -265,6 +262,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* DC )
|
||||||
newTrack->m_Start = newTrack->m_End;
|
newTrack->m_Start = newTrack->m_End;
|
||||||
|
|
||||||
newTrack->SetLayer( ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer );
|
newTrack->SetLayer( ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer );
|
||||||
|
|
||||||
if( !GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth )
|
if( !GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth )
|
||||||
{
|
{
|
||||||
newTrack->m_Width = GetBoard()->GetCurrentTrackWidth();
|
newTrack->m_Width = GetBoard()->GetCurrentTrackWidth();
|
||||||
|
@ -310,6 +308,7 @@ bool PCB_EDIT_FRAME::Add_45_degrees_Segment( wxDC* DC )
|
||||||
}
|
}
|
||||||
|
|
||||||
int segm_step_45 = wxRound( GetScreen()->GetGridSize().x / 2 );
|
int segm_step_45 = wxRound( GetScreen()->GetGridSize().x / 2 );
|
||||||
|
|
||||||
if( segm_step_45 < ( curTrack->m_Width * 2 ) )
|
if( segm_step_45 < ( curTrack->m_Width * 2 ) )
|
||||||
segm_step_45 = curTrack->m_Width * 2;
|
segm_step_45 = curTrack->m_Width * 2;
|
||||||
|
|
||||||
|
@ -415,17 +414,15 @@ bool PCB_EDIT_FRAME::Add_45_degrees_Segment( wxDC* DC )
|
||||||
*/
|
*/
|
||||||
bool PCB_EDIT_FRAME::End_Route( TRACK* aTrack, wxDC* DC )
|
bool PCB_EDIT_FRAME::End_Route( TRACK* aTrack, wxDC* DC )
|
||||||
{
|
{
|
||||||
int masquelayer =
|
int layerMask = g_TabOneLayerMask[( (PCB_SCREEN*) GetScreen() )->m_Active_Layer];
|
||||||
g_TabOneLayerMask[( (PCB_SCREEN*) GetScreen() )->m_Active_Layer];
|
|
||||||
|
|
||||||
if( aTrack == NULL )
|
if( aTrack == NULL )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if( Drc_On && BAD_DRC==
|
if( Drc_On && BAD_DRC == m_drc->Drc( g_CurrentTrackSegment, GetBoard()->m_Track ) )
|
||||||
m_drc->Drc( g_CurrentTrackSegment, GetBoard()->m_Track ) )
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* Sauvegarde des coord du point terminal de la piste */
|
/* Saving the coordinate of end point of the trace */
|
||||||
wxPoint pos = g_CurrentTrackSegment->m_End;
|
wxPoint pos = g_CurrentTrackSegment->m_End;
|
||||||
|
|
||||||
D( g_CurrentTrackList.VerifyListIntegrity(); );
|
D( g_CurrentTrackList.VerifyListIntegrity(); );
|
||||||
|
@ -454,7 +451,7 @@ bool PCB_EDIT_FRAME::End_Route( TRACK* aTrack, wxDC* DC )
|
||||||
* This helps to reduce the computing time */
|
* This helps to reduce the computing time */
|
||||||
|
|
||||||
/* Attaching the end of the track. */
|
/* Attaching the end of the track. */
|
||||||
BOARD_ITEM* LockPoint = LocateLockPoint( GetBoard(), pos, masquelayer );
|
BOARD_ITEM* LockPoint = LocateLockPoint( GetBoard(), pos, layerMask );
|
||||||
|
|
||||||
if( LockPoint ) /* End of trace is on a pad. */
|
if( LockPoint ) /* End of trace is on a pad. */
|
||||||
{
|
{
|
||||||
|
@ -490,8 +487,8 @@ bool PCB_EDIT_FRAME::End_Route( TRACK* aTrack, wxDC* DC )
|
||||||
// Put entire new current segment list in BOARD, and prepare undo
|
// Put entire new current segment list in BOARD, and prepare undo
|
||||||
// command
|
// command
|
||||||
TRACK* track;
|
TRACK* track;
|
||||||
TRACK* insertBeforeMe = g_CurrentTrackSegment->GetBestInsertPoint(
|
TRACK* insertBeforeMe = g_CurrentTrackSegment->GetBestInsertPoint( GetBoard() );
|
||||||
GetBoard() );
|
|
||||||
while( ( track = g_CurrentTrackList.PopFront() ) != NULL )
|
while( ( track = g_CurrentTrackList.PopFront() ) != NULL )
|
||||||
{
|
{
|
||||||
ITEM_PICKER picker( track, UR_NEW );
|
ITEM_PICKER picker( track, UR_NEW );
|
||||||
|
@ -501,9 +498,10 @@ bool PCB_EDIT_FRAME::End_Route( TRACK* aTrack, wxDC* DC )
|
||||||
|
|
||||||
trace_ratsnest_pad( DC );
|
trace_ratsnest_pad( DC );
|
||||||
|
|
||||||
Trace_Une_Piste( DrawPanel, DC, firstTrack, newCount, GR_OR );
|
DrawTraces( DrawPanel, DC, firstTrack, newCount, GR_OR );
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
for( track = firstTrack; track && i<newCount; ++i, track = track->Next() )
|
for( track = firstTrack; track && i<newCount; ++i, track = track->Next() )
|
||||||
{
|
{
|
||||||
track->m_Flags = 0;
|
track->m_Flags = 0;
|
||||||
|
@ -515,6 +513,7 @@ bool PCB_EDIT_FRAME::End_Route( TRACK* aTrack, wxDC* DC )
|
||||||
{
|
{
|
||||||
EraseRedundantTrack( DC, firstTrack, newCount, &s_ItemsListPicker );
|
EraseRedundantTrack( DC, firstTrack, newCount, &s_ItemsListPicker );
|
||||||
}
|
}
|
||||||
|
|
||||||
SaveCopyInUndoList( s_ItemsListPicker, UR_UNSPECIFIED );
|
SaveCopyInUndoList( s_ItemsListPicker, UR_UNSPECIFIED );
|
||||||
s_ItemsListPicker.ClearItemsList(); // s_ItemsListPicker is no more
|
s_ItemsListPicker.ClearItemsList(); // s_ItemsListPicker is no more
|
||||||
// owner of picked items
|
// owner of picked items
|
||||||
|
@ -632,10 +631,7 @@ static void PushTrack( EDA_DRAW_PANEL* panel )
|
||||||
if( !det )
|
if( !det )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
dist =
|
dist = (track->m_Width + 1) / 2 + (other->m_Width + 1) / 2 + track->GetClearance( other ) + 2;
|
||||||
(track->m_Width +
|
|
||||||
1) / 2 + (other->m_Width + 1) / 2 + track->GetClearance(
|
|
||||||
other ) + 2;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* DRC wants >, so +1.
|
* DRC wants >, so +1.
|
||||||
|
@ -653,6 +649,7 @@ static void PushTrack( EDA_DRAW_PANEL* panel )
|
||||||
n.x = -vec.y;
|
n.x = -vec.y;
|
||||||
n.y = vec.x;
|
n.y = vec.x;
|
||||||
}
|
}
|
||||||
|
|
||||||
f = dist / hypot( double(n.x), double(n.y) );
|
f = dist / hypot( double(n.x), double(n.y) );
|
||||||
n.x = wxRound( f * n.x );
|
n.x = wxRound( f * n.x );
|
||||||
n.y = wxRound( f * n.y );
|
n.y = wxRound( f * n.y );
|
||||||
|
@ -688,7 +685,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
|
||||||
/* Erase old track */
|
/* Erase old track */
|
||||||
if( aErase )
|
if( aErase )
|
||||||
{
|
{
|
||||||
Trace_Une_Piste( aPanel, aDC, g_FirstTrackSegment, g_CurrentTrackList.GetCount(), GR_XOR );
|
DrawTraces( aPanel, aDC, g_FirstTrackSegment, g_CurrentTrackList.GetCount(), GR_XOR );
|
||||||
|
|
||||||
frame->trace_ratsnest_pad( aDC );
|
frame->trace_ratsnest_pad( aDC );
|
||||||
|
|
||||||
|
@ -744,7 +741,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
|
||||||
/* Calculate of the end of the path for the permitted directions:
|
/* Calculate of the end of the path for the permitted directions:
|
||||||
* horizontal, vertical or 45 degrees.
|
* horizontal, vertical or 45 degrees.
|
||||||
*/
|
*/
|
||||||
Calcule_Coord_Extremite_45( screen->GetCrossHairPosition(),
|
CalculateSegmentEndPoint( screen->GetCrossHairPosition(),
|
||||||
g_CurrentTrackSegment->m_Start.x,
|
g_CurrentTrackSegment->m_Start.x,
|
||||||
g_CurrentTrackSegment->m_Start.y,
|
g_CurrentTrackSegment->m_Start.y,
|
||||||
&g_CurrentTrackSegment->m_End.x,
|
&g_CurrentTrackSegment->m_End.x,
|
||||||
|
@ -758,7 +755,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
|
||||||
|
|
||||||
/* Redraw the new track */
|
/* Redraw the new track */
|
||||||
D( g_CurrentTrackList.VerifyListIntegrity(); );
|
D( g_CurrentTrackList.VerifyListIntegrity(); );
|
||||||
Trace_Une_Piste( aPanel, aDC, g_FirstTrackSegment, g_CurrentTrackList.GetCount(), GR_XOR );
|
DrawTraces( aPanel, aDC, g_FirstTrackSegment, g_CurrentTrackList.GetCount(), GR_XOR );
|
||||||
|
|
||||||
if( showTrackClearanceMode >= SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS )
|
if( showTrackClearanceMode >= SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS )
|
||||||
{
|
{
|
||||||
|
@ -776,6 +773,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
|
||||||
* interesting segment.
|
* interesting segment.
|
||||||
*/
|
*/
|
||||||
TRACK* isegm = g_CurrentTrackSegment;
|
TRACK* isegm = g_CurrentTrackSegment;
|
||||||
|
|
||||||
if( isegm->GetLength() == 0 && g_CurrentTrackSegment->Back() )
|
if( isegm->GetLength() == 0 && g_CurrentTrackSegment->Back() )
|
||||||
isegm = g_CurrentTrackSegment->Back();
|
isegm = g_CurrentTrackSegment->Back();
|
||||||
|
|
||||||
|
@ -787,12 +785,14 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
|
||||||
double trackLen = 0.0;
|
double trackLen = 0.0;
|
||||||
double lenDie = 0.0;
|
double lenDie = 0.0;
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
// If the starting point is on a pad, add current track length+ lenght die
|
// If the starting point is on a pad, add current track length+ lenght die
|
||||||
if( g_FirstTrackSegment->GetState( BEGIN_ONPAD ) )
|
if( g_FirstTrackSegment->GetState( BEGIN_ONPAD ) )
|
||||||
{
|
{
|
||||||
D_PAD * pad = (D_PAD *) g_FirstTrackSegment->start;
|
D_PAD * pad = (D_PAD *) g_FirstTrackSegment->start;
|
||||||
lenDie = (double) pad->m_LengthDie;
|
lenDie = (double) pad->m_LengthDie;
|
||||||
}
|
}
|
||||||
|
|
||||||
// calculate track len on board:
|
// calculate track len on board:
|
||||||
for( TRACK* track = g_FirstTrackSegment; track; track = track->Next() )
|
for( TRACK* track = g_FirstTrackSegment; track; track = track->Next() )
|
||||||
trackLen += track->GetLength();
|
trackLen += track->GetLength();
|
||||||
|
@ -823,7 +823,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
|
||||||
/* Determine the coordinate to advanced the the current segment
|
/* Determine the coordinate to advanced the the current segment
|
||||||
* in 0, 90, or 45 degrees, depending on position of origin and \a aPosition.
|
* in 0, 90, or 45 degrees, depending on position of origin and \a aPosition.
|
||||||
*/
|
*/
|
||||||
void Calcule_Coord_Extremite_45( const wxPoint& aPosition, int ox, int oy, int* fx, int* fy )
|
void CalculateSegmentEndPoint( const wxPoint& aPosition, int ox, int oy, int* fx, int* fy )
|
||||||
{
|
{
|
||||||
int deltax, deltay, angle;
|
int deltax, deltay, angle;
|
||||||
|
|
||||||
|
@ -865,6 +865,7 @@ void Calcule_Coord_Extremite_45( const wxPoint& aPosition, int ox, int oy, int*
|
||||||
/* Recalculate the signs fo deltax and deltaY. */
|
/* Recalculate the signs fo deltax and deltaY. */
|
||||||
if( ( aPosition.x - ox ) < 0 )
|
if( ( aPosition.x - ox ) < 0 )
|
||||||
deltax = -deltax;
|
deltax = -deltax;
|
||||||
|
|
||||||
if( ( aPosition.y - oy ) < 0 )
|
if( ( aPosition.y - oy ) < 0 )
|
||||||
deltay = -deltay;
|
deltay = -deltay;
|
||||||
|
|
||||||
|
@ -891,12 +892,14 @@ void ComputeBreakPoint( TRACK* track, int SegmentCount, wxPoint end )
|
||||||
|
|
||||||
if( SegmentCount <= 0 )
|
if( SegmentCount <= 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( track == NULL )
|
if( track == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TRACK* newTrack = track;
|
TRACK* newTrack = track;
|
||||||
track = track->Back();
|
track = track->Back();
|
||||||
SegmentCount--;
|
SegmentCount--;
|
||||||
|
|
||||||
if( track )
|
if( track )
|
||||||
{
|
{
|
||||||
iDx = end.x - track->m_Start.x;
|
iDx = end.x - track->m_Start.x;
|
||||||
|
@ -907,6 +910,7 @@ void ComputeBreakPoint( TRACK* track, int SegmentCount, wxPoint end )
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACK* lastTrack = track ? track->Back() : NULL;
|
TRACK* lastTrack = track ? track->Back() : NULL;
|
||||||
|
|
||||||
if( lastTrack )
|
if( lastTrack )
|
||||||
{
|
{
|
||||||
if(( (lastTrack->m_End.x == lastTrack->m_Start.x)
|
if(( (lastTrack->m_End.x == lastTrack->m_Start.x)
|
||||||
|
@ -915,8 +919,11 @@ void ComputeBreakPoint( TRACK* track, int SegmentCount, wxPoint end )
|
||||||
{
|
{
|
||||||
iAngle = 45;
|
iAngle = 45;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
if (g_Alternate_Track_Posture) {
|
else
|
||||||
|
{
|
||||||
|
if( g_Alternate_Track_Posture )
|
||||||
|
{
|
||||||
iAngle = 45;
|
iAngle = 45;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -942,6 +949,7 @@ void ComputeBreakPoint( TRACK* track, int SegmentCount, wxPoint end )
|
||||||
track->m_End.x = end.x + iDy;
|
track->m_End.x = end.x + iDy;
|
||||||
else
|
else
|
||||||
track->m_End.x = end.x - iDy;
|
track->m_End.x = end.x - iDy;
|
||||||
|
|
||||||
track->m_End.y = track->m_Start.y;
|
track->m_End.y = track->m_Start.y;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -952,6 +960,7 @@ void ComputeBreakPoint( TRACK* track, int SegmentCount, wxPoint end )
|
||||||
/* Recalculate the signs fo deltax and deltaY. */
|
/* Recalculate the signs fo deltax and deltaY. */
|
||||||
if( ( end.x - track->m_Start.x ) < 0 )
|
if( ( end.x - track->m_Start.x ) < 0 )
|
||||||
iDx = -iDx;
|
iDx = -iDx;
|
||||||
|
|
||||||
if( ( end.y - track->m_Start.y ) < 0 )
|
if( ( end.y - track->m_Start.y ) < 0 )
|
||||||
iDy = -iDy;
|
iDy = -iDy;
|
||||||
|
|
||||||
|
@ -976,6 +985,7 @@ void ComputeBreakPoint( TRACK* track, int SegmentCount, wxPoint end )
|
||||||
|
|
||||||
newTrack->m_Start = track->m_End;
|
newTrack->m_Start = track->m_End;
|
||||||
}
|
}
|
||||||
|
|
||||||
newTrack->m_End = end;
|
newTrack->m_End = end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -993,10 +1003,12 @@ void DeleteNullTrackSegments( BOARD* pcb, DLIST<TRACK>& aTrackList )
|
||||||
TRACK* oldtrack;
|
TRACK* oldtrack;
|
||||||
|
|
||||||
BOARD_ITEM* LockPoint = track->start;
|
BOARD_ITEM* LockPoint = track->start;
|
||||||
|
|
||||||
while( track != NULL )
|
while( track != NULL )
|
||||||
{
|
{
|
||||||
oldtrack = track;
|
oldtrack = track;
|
||||||
track = track->Next();
|
track = track->Next();
|
||||||
|
|
||||||
if( !oldtrack->IsNull() )
|
if( !oldtrack->IsNull() )
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
@ -1015,6 +1027,7 @@ void DeleteNullTrackSegments( BOARD* pcb, DLIST<TRACK>& aTrackList )
|
||||||
// we must set the pointers on connected items and the connection status
|
// we must set the pointers on connected items and the connection status
|
||||||
oldtrack = track = firsttrack;
|
oldtrack = track = firsttrack;
|
||||||
firsttrack->start = NULL;
|
firsttrack->start = NULL;
|
||||||
|
|
||||||
while( track != NULL )
|
while( track != NULL )
|
||||||
{
|
{
|
||||||
oldtrack = track;
|
oldtrack = track;
|
||||||
|
@ -1028,24 +1041,29 @@ void DeleteNullTrackSegments( BOARD* pcb, DLIST<TRACK>& aTrackList )
|
||||||
}
|
}
|
||||||
|
|
||||||
firsttrack->start = LockPoint;
|
firsttrack->start = LockPoint;
|
||||||
|
|
||||||
if( LockPoint && LockPoint->Type()==TYPE_PAD )
|
if( LockPoint && LockPoint->Type()==TYPE_PAD )
|
||||||
firsttrack->SetState( BEGIN_ONPAD, ON );
|
firsttrack->SetState( BEGIN_ONPAD, ON );
|
||||||
|
|
||||||
track = firsttrack;
|
track = firsttrack;
|
||||||
|
|
||||||
while( track != NULL )
|
while( track != NULL )
|
||||||
{
|
{
|
||||||
TRACK* next_track = track->Next();
|
TRACK* next_track = track->Next();
|
||||||
LockPoint = Locate_Pad_Connecte( pcb, track, END );
|
LockPoint = Locate_Pad_Connecte( pcb, track, END );
|
||||||
|
|
||||||
if( LockPoint )
|
if( LockPoint )
|
||||||
{
|
{
|
||||||
track->end = LockPoint;
|
track->end = LockPoint;
|
||||||
track->SetState( END_ONPAD, ON );
|
track->SetState( END_ONPAD, ON );
|
||||||
|
|
||||||
if( next_track )
|
if( next_track )
|
||||||
{
|
{
|
||||||
next_track->start = LockPoint;
|
next_track->start = LockPoint;
|
||||||
next_track->SetState( BEGIN_ONPAD, ON );
|
next_track->SetState( BEGIN_ONPAD, ON );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
track = next_track;
|
track = next_track;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1065,6 +1083,7 @@ void EnsureEndTrackOnPad( D_PAD* Pad )
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACK* lasttrack = g_CurrentTrackSegment;
|
TRACK* lasttrack = g_CurrentTrackSegment;
|
||||||
|
|
||||||
if( !g_CurrentTrackSegment->IsNull() )
|
if( !g_CurrentTrackSegment->IsNull() )
|
||||||
{
|
{
|
||||||
/* Must create a new segment, from track end to pad center */
|
/* Must create a new segment, from track end to pad center */
|
||||||
|
|
|
@ -45,8 +45,7 @@ TEXTE_MODULE* PCB_BASE_FRAME::CreateTextModule( MODULE* Module, wxDC* DC )
|
||||||
Text->m_Text = wxT( "text" );
|
Text->m_Text = wxT( "text" );
|
||||||
|
|
||||||
g_ModuleTextWidth = Clamp_Text_PenSize( g_ModuleTextWidth,
|
g_ModuleTextWidth = Clamp_Text_PenSize( g_ModuleTextWidth,
|
||||||
MIN( g_ModuleTextSize.x,
|
MIN( g_ModuleTextSize.x, g_ModuleTextSize.y ), true );
|
||||||
g_ModuleTextSize.y ), true );
|
|
||||||
Text->m_Size = g_ModuleTextSize;
|
Text->m_Size = g_ModuleTextSize;
|
||||||
Text->m_Thickness = g_ModuleTextWidth;
|
Text->m_Thickness = g_ModuleTextWidth;
|
||||||
Text->m_Pos = GetScreen()->GetCrossHairPosition();
|
Text->m_Pos = GetScreen()->GetCrossHairPosition();
|
||||||
|
@ -56,6 +55,7 @@ TEXTE_MODULE* PCB_BASE_FRAME::CreateTextModule( MODULE* Module, wxDC* DC )
|
||||||
DrawPanel->MoveCursorToCrossHair();
|
DrawPanel->MoveCursorToCrossHair();
|
||||||
|
|
||||||
Text->m_Flags = 0;
|
Text->m_Flags = 0;
|
||||||
|
|
||||||
if( DC )
|
if( DC )
|
||||||
Text->Draw( DrawPanel, DC, GR_OR );
|
Text->Draw( DrawPanel, DC, GR_OR );
|
||||||
|
|
||||||
|
@ -74,8 +74,7 @@ void PCB_BASE_FRAME::RotateTextModule( TEXTE_MODULE* Text, wxDC* DC )
|
||||||
|
|
||||||
MODULE* module = (MODULE*) Text->GetParent();
|
MODULE* module = (MODULE*) Text->GetParent();
|
||||||
|
|
||||||
if( module && module->m_Flags == 0 && Text->m_Flags == 0 ) // prepare undo
|
if( module && module->m_Flags == 0 && Text->m_Flags == 0 ) // prepare undo command
|
||||||
// command
|
|
||||||
{
|
{
|
||||||
if( this->m_Ident == PCB_FRAME )
|
if( this->m_Ident == PCB_FRAME )
|
||||||
SaveCopyInUndoList( module, UR_CHANGED );
|
SaveCopyInUndoList( module, UR_CHANGED );
|
||||||
|
@ -85,6 +84,7 @@ void PCB_BASE_FRAME::RotateTextModule( TEXTE_MODULE* Text, wxDC* DC )
|
||||||
Text->Draw( DrawPanel, DC, GR_XOR, MoveVector );
|
Text->Draw( DrawPanel, DC, GR_XOR, MoveVector );
|
||||||
|
|
||||||
Text->m_Orient += 900;
|
Text->m_Orient += 900;
|
||||||
|
|
||||||
while( Text->m_Orient >= 1800 )
|
while( Text->m_Orient >= 1800 )
|
||||||
Text->m_Orient -= 1800;
|
Text->m_Orient -= 1800;
|
||||||
|
|
||||||
|
@ -93,6 +93,7 @@ void PCB_BASE_FRAME::RotateTextModule( TEXTE_MODULE* Text, wxDC* DC )
|
||||||
|
|
||||||
if( module )
|
if( module )
|
||||||
module->m_LastEdit_Time = time( NULL );
|
module->m_LastEdit_Time = time( NULL );
|
||||||
|
|
||||||
OnModify();
|
OnModify();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,7 +186,7 @@ void PCB_BASE_FRAME::StartMoveTexteModule( TEXTE_MODULE* Text, wxDC* DC )
|
||||||
|
|
||||||
SetCurItem( Text );
|
SetCurItem( Text );
|
||||||
DrawPanel->SetMouseCapture( Show_MoveTexte_Module, AbortMoveTextModule );
|
DrawPanel->SetMouseCapture( Show_MoveTexte_Module, AbortMoveTextModule );
|
||||||
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, TRUE );
|
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -200,14 +201,17 @@ void PCB_BASE_FRAME::PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC )
|
||||||
|
|
||||||
/* Update the coordinates for anchor. */
|
/* Update the coordinates for anchor. */
|
||||||
MODULE* Module = (MODULE*) Text->GetParent();
|
MODULE* Module = (MODULE*) Text->GetParent();
|
||||||
|
|
||||||
if( Module )
|
if( Module )
|
||||||
{
|
{
|
||||||
// Prepare undo command (a rotation can be made while moving)
|
// Prepare undo command (a rotation can be made while moving)
|
||||||
EXCHG( Text->m_Orient, TextInitialOrientation );
|
EXCHG( Text->m_Orient, TextInitialOrientation );
|
||||||
|
|
||||||
if( m_Ident == PCB_FRAME )
|
if( m_Ident == PCB_FRAME )
|
||||||
SaveCopyInUndoList( Module, UR_CHANGED );
|
SaveCopyInUndoList( Module, UR_CHANGED );
|
||||||
else
|
else
|
||||||
SaveCopyInUndoList( Module, UR_MODEDIT );
|
SaveCopyInUndoList( Module, UR_MODEDIT );
|
||||||
|
|
||||||
EXCHG( Text->m_Orient, TextInitialOrientation );
|
EXCHG( Text->m_Orient, TextInitialOrientation );
|
||||||
|
|
||||||
// Set the new position for text.
|
// Set the new position for text.
|
||||||
|
@ -224,8 +228,10 @@ void PCB_BASE_FRAME::PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC )
|
||||||
DrawPanel->RefreshDrawingRect( Text->GetBoundingBox() );
|
DrawPanel->RefreshDrawingRect( Text->GetBoundingBox() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
Text->m_Pos = GetScreen()->GetCrossHairPosition();
|
Text->m_Pos = GetScreen()->GetCrossHairPosition();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// leave it at (0,0) so we can use it Rotate when not moving.
|
// leave it at (0,0) so we can use it Rotate when not moving.
|
||||||
MoveVector.x = MoveVector.y = 0;
|
MoveVector.x = MoveVector.y = 0;
|
||||||
|
@ -276,12 +282,14 @@ void PCB_BASE_FRAME::ResetTextSize( BOARD_ITEM* aItem, wxDC* aDC )
|
||||||
pcbText = (TEXTE_PCB*) aItem;
|
pcbText = (TEXTE_PCB*) aItem;
|
||||||
text = (EDA_TEXT*) pcbText;
|
text = (EDA_TEXT*) pcbText;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_TEXTE_MODULE:
|
case TYPE_TEXTE_MODULE:
|
||||||
newSize = g_ModuleTextSize;
|
newSize = g_ModuleTextSize;
|
||||||
newThickness = g_ModuleTextWidth;
|
newThickness = g_ModuleTextWidth;
|
||||||
moduleText = (TEXTE_MODULE*) aItem;
|
moduleText = (TEXTE_MODULE*) aItem;
|
||||||
text = (EDA_TEXT*) moduleText;
|
text = (EDA_TEXT*) moduleText;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// Exit if aItem is not a text field
|
// Exit if aItem is not a text field
|
||||||
return;
|
return;
|
||||||
|
@ -289,8 +297,7 @@ void PCB_BASE_FRAME::ResetTextSize( BOARD_ITEM* aItem, wxDC* aDC )
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exit if there's nothing to do
|
// Exit if there's nothing to do
|
||||||
if( text->GetSize() == newSize
|
if( text->GetSize() == newSize && text->GetThickness() == newThickness )
|
||||||
&& text->GetThickness() == newThickness )
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Push item to undo list
|
// Push item to undo list
|
||||||
|
@ -299,9 +306,11 @@ void PCB_BASE_FRAME::ResetTextSize( BOARD_ITEM* aItem, wxDC* aDC )
|
||||||
case TYPE_TEXTE:
|
case TYPE_TEXTE:
|
||||||
SaveCopyInUndoList( pcbText, UR_CHANGED );
|
SaveCopyInUndoList( pcbText, UR_CHANGED );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_TEXTE_MODULE:
|
case TYPE_TEXTE_MODULE:
|
||||||
SaveCopyInUndoList( moduleText->GetParent(), UR_CHANGED );
|
SaveCopyInUndoList( moduleText->GetParent(), UR_CHANGED );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -333,28 +342,33 @@ void PCB_BASE_FRAME::ResetModuleTextSizes( int aType, wxDC* aDC )
|
||||||
while( module )
|
while( module )
|
||||||
{
|
{
|
||||||
itemWrapper.m_PickedItem = module;
|
itemWrapper.m_PickedItem = module;
|
||||||
|
|
||||||
switch( aType )
|
switch( aType )
|
||||||
{
|
{
|
||||||
case TEXT_is_REFERENCE:
|
case TEXT_is_REFERENCE:
|
||||||
item = module->m_Reference;
|
item = module->m_Reference;
|
||||||
if( item->GetSize() != g_ModuleTextSize
|
|
||||||
|| item->GetThickness() != g_ModuleTextWidth )
|
if( item->GetSize() != g_ModuleTextSize || item->GetThickness() != g_ModuleTextWidth )
|
||||||
undoItemList.PushItem( itemWrapper );
|
undoItemList.PushItem( itemWrapper );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TEXT_is_VALUE:
|
case TEXT_is_VALUE:
|
||||||
item = module->m_Value;
|
item = module->m_Value;
|
||||||
if( item->GetSize() != g_ModuleTextSize
|
|
||||||
|| item->GetThickness() != g_ModuleTextWidth )
|
if( item->GetSize() != g_ModuleTextSize || item->GetThickness() != g_ModuleTextWidth )
|
||||||
undoItemList.PushItem( itemWrapper );
|
undoItemList.PushItem( itemWrapper );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TEXT_is_DIVERS:
|
case TEXT_is_DIVERS:
|
||||||
// Go through all other module text fields
|
// Go through all other module text fields
|
||||||
for( boardItem = module->m_Drawings; boardItem;
|
for( boardItem = module->m_Drawings; boardItem; boardItem = boardItem->Next() )
|
||||||
boardItem = boardItem->Next() )
|
|
||||||
{
|
{
|
||||||
if( boardItem->Type() == TYPE_TEXTE_MODULE )
|
if( boardItem->Type() == TYPE_TEXTE_MODULE )
|
||||||
{
|
{
|
||||||
item = (TEXTE_MODULE*) boardItem;
|
item = (TEXTE_MODULE*) boardItem;
|
||||||
|
|
||||||
if( item->GetSize() != g_ModuleTextSize
|
if( item->GetSize() != g_ModuleTextSize
|
||||||
|| item->GetThickness() != g_ModuleTextWidth )
|
|| item->GetThickness() != g_ModuleTextWidth )
|
||||||
{
|
{
|
||||||
|
@ -363,7 +377,9 @@ void PCB_BASE_FRAME::ResetModuleTextSizes( int aType, wxDC* aDC )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -380,19 +396,21 @@ void PCB_BASE_FRAME::ResetModuleTextSizes( int aType, wxDC* aDC )
|
||||||
for( ii = 0; ii < undoItemList.GetCount(); ii++ )
|
for( ii = 0; ii < undoItemList.GetCount(); ii++ )
|
||||||
{
|
{
|
||||||
module = (MODULE*) undoItemList.GetPickedItem( ii );
|
module = (MODULE*) undoItemList.GetPickedItem( ii );
|
||||||
|
|
||||||
switch( aType )
|
switch( aType )
|
||||||
{
|
{
|
||||||
case TEXT_is_REFERENCE:
|
case TEXT_is_REFERENCE:
|
||||||
module->m_Reference->SetThickness( g_ModuleTextWidth );
|
module->m_Reference->SetThickness( g_ModuleTextWidth );
|
||||||
module->m_Reference->SetSize( g_ModuleTextSize );
|
module->m_Reference->SetSize( g_ModuleTextSize );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TEXT_is_VALUE:
|
case TEXT_is_VALUE:
|
||||||
module->m_Value->SetThickness( g_ModuleTextWidth );
|
module->m_Value->SetThickness( g_ModuleTextWidth );
|
||||||
module->m_Value->SetSize( g_ModuleTextSize );
|
module->m_Value->SetSize( g_ModuleTextSize );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TEXT_is_DIVERS:
|
case TEXT_is_DIVERS:
|
||||||
for( boardItem = module->m_Drawings; boardItem;
|
for( boardItem = module->m_Drawings; boardItem; boardItem = boardItem->Next() )
|
||||||
boardItem = boardItem->Next() )
|
|
||||||
{
|
{
|
||||||
if( boardItem->Type() == TYPE_TEXTE_MODULE )
|
if( boardItem->Type() == TYPE_TEXTE_MODULE )
|
||||||
{
|
{
|
||||||
|
@ -401,6 +419,7 @@ void PCB_BASE_FRAME::ResetModuleTextSizes( int aType, wxDC* aDC )
|
||||||
item->SetSize( g_ModuleTextSize );
|
item->SetSize( g_ModuleTextSize );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,7 +92,7 @@ void PCB_EDIT_FRAME::ExportToGenCAD( wxCommandEvent& event )
|
||||||
|
|
||||||
offsetX = m_Auxiliary_Axis_Position.x;
|
offsetX = m_Auxiliary_Axis_Position.x;
|
||||||
offsetY = m_Auxiliary_Axis_Position.y;
|
offsetY = m_Auxiliary_Axis_Position.y;
|
||||||
Compile_Ratsnest( NULL, TRUE );
|
Compile_Ratsnest( NULL, true );
|
||||||
|
|
||||||
/* Temporary modification of footprints that are flipped (i.e. on bottom
|
/* Temporary modification of footprints that are flipped (i.e. on bottom
|
||||||
* layer) to convert them to non flipped footprints.
|
* layer) to convert them to non flipped footprints.
|
||||||
|
@ -101,9 +101,11 @@ void PCB_EDIT_FRAME::ExportToGenCAD( wxCommandEvent& event )
|
||||||
* these changes will be undone later
|
* these changes will be undone later
|
||||||
*/
|
*/
|
||||||
MODULE* module;
|
MODULE* module;
|
||||||
|
|
||||||
for( module = GetBoard()->m_Modules; module != NULL; module = module->Next() )
|
for( module = GetBoard()->m_Modules; module != NULL; module = module->Next() )
|
||||||
{
|
{
|
||||||
module->flag = 0;
|
module->flag = 0;
|
||||||
|
|
||||||
if( module->GetLayer() == LAYER_N_BACK )
|
if( module->GetLayer() == LAYER_N_BACK )
|
||||||
{
|
{
|
||||||
module->Flip( module->m_Pos );
|
module->Flip( module->m_Pos );
|
||||||
|
@ -198,12 +200,12 @@ void CreatePadsShapesSection( FILE* file, BOARD* pcb )
|
||||||
pads.insert( pads.end(),
|
pads.insert( pads.end(),
|
||||||
pcb->m_NetInfo->m_PadsFullList.begin(),
|
pcb->m_NetInfo->m_PadsFullList.begin(),
|
||||||
pcb->m_NetInfo->m_PadsFullList.end() );
|
pcb->m_NetInfo->m_PadsFullList.end() );
|
||||||
qsort( &pads[0], pcb->GetPadsCount(), sizeof( D_PAD* ),
|
qsort( &pads[0], pcb->GetPadsCount(), sizeof( D_PAD* ), Pad_list_Sort_by_Shapes );
|
||||||
Pad_list_Sort_by_Shapes );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
D_PAD* old_pad = NULL;
|
D_PAD* old_pad = NULL;
|
||||||
int pad_name_number = 0;
|
int pad_name_number = 0;
|
||||||
|
|
||||||
for( unsigned i = 0; i<pads.size(); ++i )
|
for( unsigned i = 0; i<pads.size(); ++i )
|
||||||
{
|
{
|
||||||
D_PAD* pad = pads[i];
|
D_PAD* pad = pads[i];
|
||||||
|
@ -248,41 +250,41 @@ void CreatePadsShapesSection( FILE* file, BOARD* pcb )
|
||||||
int dr = dx - dy;
|
int dr = dx - dy;
|
||||||
if( dr >= 0 ) // Horizontal oval
|
if( dr >= 0 ) // Horizontal oval
|
||||||
{
|
{
|
||||||
int rayon = dy;
|
int radius = dy;
|
||||||
fprintf( file, "LINE %d %d %d %d\n",
|
fprintf( file, "LINE %d %d %d %d\n",
|
||||||
-dr + pad->m_Offset.x, -pad->m_Offset.y - rayon,
|
-dr + pad->m_Offset.x, -pad->m_Offset.y - radius,
|
||||||
dr + pad->m_Offset.x, -pad->m_Offset.y - rayon );
|
dr + pad->m_Offset.x, -pad->m_Offset.y - radius );
|
||||||
fprintf( file, "ARC %d %d %d %d %d %d\n",
|
fprintf( file, "ARC %d %d %d %d %d %d\n",
|
||||||
dr + pad->m_Offset.x, -pad->m_Offset.y - rayon,
|
dr + pad->m_Offset.x, -pad->m_Offset.y - radius,
|
||||||
dr + pad->m_Offset.x, -pad->m_Offset.y + rayon,
|
dr + pad->m_Offset.x, -pad->m_Offset.y + radius,
|
||||||
dr + pad->m_Offset.x, -pad->m_Offset.y );
|
dr + pad->m_Offset.x, -pad->m_Offset.y );
|
||||||
|
|
||||||
fprintf( file, "LINE %d %d %d %d\n",
|
fprintf( file, "LINE %d %d %d %d\n",
|
||||||
dr + pad->m_Offset.x, -pad->m_Offset.y + rayon,
|
dr + pad->m_Offset.x, -pad->m_Offset.y + radius,
|
||||||
-dr + pad->m_Offset.x, -pad->m_Offset.y + rayon );
|
-dr + pad->m_Offset.x, -pad->m_Offset.y + radius );
|
||||||
fprintf( file, "ARC %d %d %d %d %d %d\n",
|
fprintf( file, "ARC %d %d %d %d %d %d\n",
|
||||||
-dr + pad->m_Offset.x, -pad->m_Offset.y + rayon,
|
-dr + pad->m_Offset.x, -pad->m_Offset.y + radius,
|
||||||
-dr + pad->m_Offset.x, -pad->m_Offset.y - rayon,
|
-dr + pad->m_Offset.x, -pad->m_Offset.y - radius,
|
||||||
-dr + pad->m_Offset.x, -pad->m_Offset.y );
|
-dr + pad->m_Offset.x, -pad->m_Offset.y );
|
||||||
}
|
}
|
||||||
else // Vertical oval
|
else // Vertical oval
|
||||||
{
|
{
|
||||||
dr = -dr;
|
dr = -dr;
|
||||||
int rayon = dx;
|
int radius = dx;
|
||||||
fprintf( file, "LINE %d %d %d %d\n",
|
fprintf( file, "LINE %d %d %d %d\n",
|
||||||
-rayon + pad->m_Offset.x, -pad->m_Offset.y - dr,
|
-radius + pad->m_Offset.x, -pad->m_Offset.y - dr,
|
||||||
-rayon + pad->m_Offset.x, -pad->m_Offset.y + dr );
|
-radius + pad->m_Offset.x, -pad->m_Offset.y + dr );
|
||||||
fprintf( file, "ARC %d %d %d %d %d %d\n",
|
fprintf( file, "ARC %d %d %d %d %d %d\n",
|
||||||
-rayon + pad->m_Offset.x, -pad->m_Offset.y + dr,
|
-radius + pad->m_Offset.x, -pad->m_Offset.y + dr,
|
||||||
rayon + pad->m_Offset.x, -pad->m_Offset.y + dr,
|
radius + pad->m_Offset.x, -pad->m_Offset.y + dr,
|
||||||
pad->m_Offset.x, -pad->m_Offset.y + dr );
|
pad->m_Offset.x, -pad->m_Offset.y + dr );
|
||||||
|
|
||||||
fprintf( file, "LINE %d %d %d %d\n",
|
fprintf( file, "LINE %d %d %d %d\n",
|
||||||
rayon + pad->m_Offset.x, -pad->m_Offset.y + dr,
|
radius + pad->m_Offset.x, -pad->m_Offset.y + dr,
|
||||||
rayon + pad->m_Offset.x, -pad->m_Offset.y - dr );
|
radius + pad->m_Offset.x, -pad->m_Offset.y - dr );
|
||||||
fprintf( file, "ARC %d %d %d %d %d %d\n",
|
fprintf( file, "ARC %d %d %d %d %d %d\n",
|
||||||
rayon + pad->m_Offset.x, -pad->m_Offset.y - dr,
|
radius + pad->m_Offset.x, -pad->m_Offset.y - dr,
|
||||||
-rayon + pad->m_Offset.x, -pad->m_Offset.y - dr,
|
-radius + pad->m_Offset.x, -pad->m_Offset.y - dr,
|
||||||
pad->m_Offset.x, -pad->m_Offset.y - dr );
|
pad->m_Offset.x, -pad->m_Offset.y - dr );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -349,17 +351,19 @@ void CreateShapesSection( FILE* file, BOARD* pcb )
|
||||||
for( module = pcb->m_Modules; module != NULL; module = module->Next() )
|
for( module = pcb->m_Modules; module != NULL; module = module->Next() )
|
||||||
{
|
{
|
||||||
FootprintWriteShape( file, module );
|
FootprintWriteShape( file, module );
|
||||||
|
|
||||||
for( pad = module->m_Pads; pad != NULL; pad = pad->Next() )
|
for( pad = module->m_Pads; pad != NULL; pad = pad->Next() )
|
||||||
{
|
{
|
||||||
layer = "ALL";
|
layer = "ALL";
|
||||||
if( ( pad->m_Masque_Layer & ALL_CU_LAYERS ) == LAYER_BACK )
|
|
||||||
|
if( ( pad->m_layerMask & ALL_CU_LAYERS ) == LAYER_BACK )
|
||||||
{
|
{
|
||||||
if( module->GetLayer() == LAYER_N_FRONT )
|
if( module->GetLayer() == LAYER_N_FRONT )
|
||||||
layer = "BOTTOM";
|
layer = "BOTTOM";
|
||||||
else
|
else
|
||||||
layer = "TOP";
|
layer = "TOP";
|
||||||
}
|
}
|
||||||
else if( ( pad->m_Masque_Layer & ALL_CU_LAYERS ) == LAYER_FRONT )
|
else if( ( pad->m_layerMask & ALL_CU_LAYERS ) == LAYER_FRONT )
|
||||||
{
|
{
|
||||||
if( module->GetLayer() == LAYER_N_FRONT )
|
if( module->GetLayer() == LAYER_N_FRONT )
|
||||||
layer = "TOP";
|
layer = "TOP";
|
||||||
|
@ -368,6 +372,7 @@ void CreateShapesSection( FILE* file, BOARD* pcb )
|
||||||
}
|
}
|
||||||
|
|
||||||
pad->ReturnStringPadName( pinname );
|
pad->ReturnStringPadName( pinname );
|
||||||
|
|
||||||
if( pinname.IsEmpty() )
|
if( pinname.IsEmpty() )
|
||||||
pinname = wxT( "noname" );
|
pinname = wxT( "noname" );
|
||||||
|
|
||||||
|
@ -377,8 +382,10 @@ void CreateShapesSection( FILE* file, BOARD* pcb )
|
||||||
TO_UTF8( pinname ), pad->GetSubRatsnest(),
|
TO_UTF8( pinname ), pad->GetSubRatsnest(),
|
||||||
pad->m_Pos0.x, -pad->m_Pos0.y,
|
pad->m_Pos0.x, -pad->m_Pos0.y,
|
||||||
layer, orient / 10, mirror );
|
layer, orient / 10, mirror );
|
||||||
|
|
||||||
if( orient % 10 )
|
if( orient % 10 )
|
||||||
fprintf( file, " .%d", orient % 10 );
|
fprintf( file, " .%d", orient % 10 );
|
||||||
|
|
||||||
fprintf( file, "\n" );
|
fprintf( file, "\n" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -406,6 +413,7 @@ void CreateComponentsSection( FILE* file, BOARD* pcb )
|
||||||
for( ; module != NULL; module = module->Next() )
|
for( ; module != NULL; module = module->Next() )
|
||||||
{
|
{
|
||||||
int orient = module->m_Orient;
|
int orient = module->m_Orient;
|
||||||
|
|
||||||
if( module->flag )
|
if( module->flag )
|
||||||
{
|
{
|
||||||
mirror = "MIRRORX"; // Mirrored relative to X axis
|
mirror = "MIRRORX"; // Mirrored relative to X axis
|
||||||
|
@ -420,24 +428,22 @@ void CreateComponentsSection( FILE* file, BOARD* pcb )
|
||||||
flip = "0";
|
flip = "0";
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf( file, "COMPONENT %s\n",
|
fprintf( file, "COMPONENT %s\n", TO_UTF8( module->m_Reference->m_Text ) );
|
||||||
TO_UTF8( module->m_Reference->m_Text ) );
|
fprintf( file, "DEVICE %s\n", TO_UTF8( module->m_Reference->m_Text ) );
|
||||||
fprintf( file, "DEVICE %s\n",
|
fprintf( file, "PLACE %d %d\n", mapXto( module->m_Pos.x ), mapYto( module->m_Pos.y ) );
|
||||||
TO_UTF8( module->m_Reference->m_Text ) );
|
|
||||||
fprintf( file, "PLACE %d %d\n", mapXto( module->m_Pos.x ),
|
|
||||||
mapYto( module->m_Pos.y ) );
|
|
||||||
fprintf( file, "LAYER %s\n", (module->flag) ? "BOTTOM" : "TOP" );
|
fprintf( file, "LAYER %s\n", (module->flag) ? "BOTTOM" : "TOP" );
|
||||||
|
|
||||||
fprintf( file, "ROTATION %d", orient / 10 );
|
fprintf( file, "ROTATION %d", orient / 10 );
|
||||||
|
|
||||||
if( orient % 10 )
|
if( orient % 10 )
|
||||||
fprintf( file, ".%d", orient % 10 );
|
fprintf( file, ".%d", orient % 10 );
|
||||||
|
|
||||||
fputs( "\n", file );
|
fputs( "\n", file );
|
||||||
|
|
||||||
fprintf( file, "SHAPE %s %s %s\n",
|
fprintf( file, "SHAPE %s %s %s\n", TO_UTF8( module->m_Reference->m_Text ), mirror, flip );
|
||||||
TO_UTF8( module->m_Reference->m_Text ), mirror, flip );
|
|
||||||
|
|
||||||
/* creates texts (ref and value) */
|
/* creates texts (ref and value) */
|
||||||
PtTexte = module->m_Reference;
|
PtTexte = module->m_Reference;
|
||||||
|
|
||||||
for( ii = 0; ii < 2; ii++ )
|
for( ii = 0; ii < 2; ii++ )
|
||||||
{
|
{
|
||||||
int orient = PtTexte->m_Orient;
|
int orient = PtTexte->m_Orient;
|
||||||
|
@ -489,8 +495,8 @@ void CreateSignalsSection( FILE* file, BOARD* pcb )
|
||||||
for( unsigned ii = 0; ii < pcb->m_NetInfo->GetCount(); ii++ )
|
for( unsigned ii = 0; ii < pcb->m_NetInfo->GetCount(); ii++ )
|
||||||
{
|
{
|
||||||
net = pcb->m_NetInfo->GetNetItem( ii );
|
net = pcb->m_NetInfo->GetNetItem( ii );
|
||||||
if( net->GetNetname() == wxEmptyString ) // dummy netlist (no
|
|
||||||
// connection)
|
if( net->GetNetname() == wxEmptyString ) // dummy netlist (no connection)
|
||||||
{
|
{
|
||||||
wxString msg; msg << wxT( "NoConnection" ) << NbNoConn++;
|
wxString msg; msg << wxT( "NoConnection" ) << NbNoConn++;
|
||||||
net->SetNetname( msg );
|
net->SetNetname( msg );
|
||||||
|
@ -509,6 +515,7 @@ void CreateSignalsSection( FILE* file, BOARD* pcb )
|
||||||
for( pad = module->m_Pads; pad != NULL; pad = pad->Next() )
|
for( pad = module->m_Pads; pad != NULL; pad = pad->Next() )
|
||||||
{
|
{
|
||||||
wxString padname;
|
wxString padname;
|
||||||
|
|
||||||
if( pad->GetNet() != net->GetNet() )
|
if( pad->GetNet() != net->GetNet() )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -536,13 +543,11 @@ bool CreateHeaderInfoData( FILE* file, PCB_EDIT_FRAME* frame )
|
||||||
|
|
||||||
fputs( "$HEADER\n", file );
|
fputs( "$HEADER\n", file );
|
||||||
fputs( "GENCAD 1.4\n", file );
|
fputs( "GENCAD 1.4\n", file );
|
||||||
msg = wxT( "USER " ) + wxGetApp().GetAppName() + wxT( " " ) +
|
msg = wxT( "USER " ) + wxGetApp().GetAppName() + wxT( " " ) + GetBuildVersion();
|
||||||
GetBuildVersion();
|
|
||||||
fputs( TO_UTF8( msg ), file ); fputs( "\n", file );
|
fputs( TO_UTF8( msg ), file ); fputs( "\n", file );
|
||||||
msg = wxT( "DRAWING " ) + screen->GetFileName();
|
msg = wxT( "DRAWING " ) + screen->GetFileName();
|
||||||
fputs( TO_UTF8( msg ), file ); fputs( "\n", file );
|
fputs( TO_UTF8( msg ), file ); fputs( "\n", file );
|
||||||
msg = wxT( "REVISION " ) + screen->m_Revision + wxT( " " ) +
|
msg = wxT( "REVISION " ) + screen->m_Revision + wxT( " " ) + screen->m_Date;
|
||||||
screen->m_Date;
|
|
||||||
fputs( TO_UTF8( msg ), file ); fputs( "\n", file );
|
fputs( TO_UTF8( msg ), file ); fputs( "\n", file );
|
||||||
msg.Printf( wxT( "UNITS USER %d" ), PCB_INTERNAL_UNIT );
|
msg.Printf( wxT( "UNITS USER %d" ), PCB_INTERNAL_UNIT );
|
||||||
fputs( TO_UTF8( msg ), file ); fputs( "\n", file );
|
fputs( TO_UTF8( msg ), file ); fputs( "\n", file );
|
||||||
|
@ -553,7 +558,7 @@ bool CreateHeaderInfoData( FILE* file, PCB_EDIT_FRAME* frame )
|
||||||
fputs( "INTERTRACK 0\n", file );
|
fputs( "INTERTRACK 0\n", file );
|
||||||
fputs( "$ENDHEADER\n\n", file );
|
fputs( "$ENDHEADER\n\n", file );
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -568,10 +573,13 @@ static int Track_list_Sort_by_Netcode( const void* refptr, const void* objptr )
|
||||||
|
|
||||||
ref = *( (TRACK**) refptr );
|
ref = *( (TRACK**) refptr );
|
||||||
cmp = *( (TRACK**) objptr );
|
cmp = *( (TRACK**) objptr );
|
||||||
|
|
||||||
if( ( diff = ref->GetNet() - cmp->GetNet() ) )
|
if( ( diff = ref->GetNet() - cmp->GetNet() ) )
|
||||||
return diff;
|
return diff;
|
||||||
|
|
||||||
if( ( diff = ref->m_Width - cmp->m_Width ) )
|
if( ( diff = ref->m_Width - cmp->m_Width ) )
|
||||||
return diff;
|
return diff;
|
||||||
|
|
||||||
if( ( diff = ref->GetLayer() - cmp->GetLayer() ) )
|
if( ( diff = ref->GetLayer() - cmp->GetLayer() ) )
|
||||||
return diff;
|
return diff;
|
||||||
|
|
||||||
|
@ -625,6 +633,7 @@ void CreateRoutesSection( FILE* file, BOARD* pcb )
|
||||||
fputs( "$ROUTES\n", file );
|
fputs( "$ROUTES\n", file );
|
||||||
|
|
||||||
old_netcode = -1; old_width = -1; old_layer = -1;
|
old_netcode = -1; old_width = -1; old_layer = -1;
|
||||||
|
|
||||||
for( ii = 0; ii < nbitems; ii++ )
|
for( ii = 0; ii < nbitems; ii++ )
|
||||||
{
|
{
|
||||||
track = tracklist[ii];
|
track = tracklist[ii];
|
||||||
|
@ -633,10 +642,12 @@ void CreateRoutesSection( FILE* file, BOARD* pcb )
|
||||||
old_netcode = track->GetNet();
|
old_netcode = track->GetNet();
|
||||||
NETINFO_ITEM* net = pcb->FindNet( track->GetNet() );
|
NETINFO_ITEM* net = pcb->FindNet( track->GetNet() );
|
||||||
wxString netname;
|
wxString netname;
|
||||||
|
|
||||||
if( net && (net->GetNetname() != wxEmptyString) )
|
if( net && (net->GetNetname() != wxEmptyString) )
|
||||||
netname = net->GetNetname();
|
netname = net->GetNetname();
|
||||||
else
|
else
|
||||||
netname = wxT( "_noname_" );
|
netname = wxT( "_noname_" );
|
||||||
|
|
||||||
fprintf( file, "ROUTE %s\n", TO_UTF8( netname ) );
|
fprintf( file, "ROUTE %s\n", TO_UTF8( netname ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -652,8 +663,7 @@ void CreateRoutesSection( FILE* file, BOARD* pcb )
|
||||||
{
|
{
|
||||||
old_layer = track->GetLayer();
|
old_layer = track->GetLayer();
|
||||||
fprintf( file, "LAYER %s\n",
|
fprintf( file, "LAYER %s\n",
|
||||||
TO_UTF8( GenCAD_Layer_Name[track->GetLayer() &
|
TO_UTF8( GenCAD_Layer_Name[track->GetLayer() & 0x1F] ) );
|
||||||
0x1F] ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf( file, "LINE %d %d %d %d\n",
|
fprintf( file, "LINE %d %d %d %d\n",
|
||||||
|
@ -688,21 +698,21 @@ void CreateDevicesSection( FILE* file, BOARD* pcb )
|
||||||
|
|
||||||
for( module = pcb->m_Modules; module != NULL; module = module->Next() )
|
for( module = pcb->m_Modules; module != NULL; module = module->Next() )
|
||||||
{
|
{
|
||||||
fprintf( file, "DEVICE %s\n",
|
fprintf( file, "DEVICE %s\n", TO_UTF8( module->m_Reference->m_Text ) );
|
||||||
TO_UTF8( module->m_Reference->m_Text ) );
|
|
||||||
fprintf( file, "PART %s\n", TO_UTF8( module->m_LibRef ) );
|
fprintf( file, "PART %s\n", TO_UTF8( module->m_LibRef ) );
|
||||||
fprintf( file, "TYPE %s\n", "UNKNOWN" );
|
fprintf( file, "TYPE %s\n", "UNKNOWN" );
|
||||||
|
|
||||||
for( pad = module->m_Pads; pad != NULL; pad = pad->Next() )
|
for( pad = module->m_Pads; pad != NULL; pad = pad->Next() )
|
||||||
{
|
{
|
||||||
fprintf( file, "PINDESCR %.4s", pad->m_Padname );
|
fprintf( file, "PINDESCR %.4s", pad->m_Padname );
|
||||||
|
|
||||||
if( pad->GetNetname() == wxEmptyString )
|
if( pad->GetNetname() == wxEmptyString )
|
||||||
fputs( " NoConn\n", file );
|
fputs( " NoConn\n", file );
|
||||||
else
|
else
|
||||||
fprintf( file, " %.4s\n", pad->m_Padname );
|
fprintf( file, " %.4s\n", pad->m_Padname );
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf( file, "ATTRIBUTE %s\n",
|
fprintf( file, "ATTRIBUTE %s\n", TO_UTF8( module->m_Value->m_Text ) );
|
||||||
TO_UTF8( module->m_Value->m_Text ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fputs( "$ENDDEVICES\n\n", file );
|
fputs( "$ENDDEVICES\n\n", file );
|
||||||
|
@ -760,6 +770,7 @@ void CreateTracksInfoData( FILE* file, BOARD* pcb )
|
||||||
std::vector <int> trackinfo;
|
std::vector <int> trackinfo;
|
||||||
|
|
||||||
unsigned ii;
|
unsigned ii;
|
||||||
|
|
||||||
for( track = pcb->m_Track; track != NULL; track = track->Next() )
|
for( track = pcb->m_Track; track != NULL; track = track->Next() )
|
||||||
{
|
{
|
||||||
if( last_width != track->m_Width ) // Find a thickness already used.
|
if( last_width != track->m_Width ) // Find a thickness already used.
|
||||||
|
@ -796,6 +807,7 @@ void CreateTracksInfoData( FILE* file, BOARD* pcb )
|
||||||
|
|
||||||
// Write data
|
// Write data
|
||||||
fputs( "$TRACKS\n", file );
|
fputs( "$TRACKS\n", file );
|
||||||
|
|
||||||
for( ii = 0; ii < trackinfo.size(); ii++ )
|
for( ii = 0; ii < trackinfo.size(); ii++ )
|
||||||
{
|
{
|
||||||
fprintf( file, "TRACK TRACK%d %d\n", trackinfo[ii], trackinfo[ii] );
|
fprintf( file, "TRACK TRACK%d %d\n", trackinfo[ii], trackinfo[ii] );
|
||||||
|
@ -824,22 +836,25 @@ void FootprintWriteShape( FILE* file, MODULE* module )
|
||||||
|
|
||||||
/* creates header: */
|
/* creates header: */
|
||||||
fprintf( file, "SHAPE %s\n", TO_UTF8( module->m_Reference->m_Text ) );
|
fprintf( file, "SHAPE %s\n", TO_UTF8( module->m_Reference->m_Text ) );
|
||||||
fprintf( file, "INSERT %s\n",
|
fprintf( file, "INSERT %s\n", (module->m_Attributs & MOD_CMS) ? "SMD" : "TH" );
|
||||||
(module->m_Attributs & MOD_CMS) ? "SMD" : "TH" );
|
|
||||||
|
|
||||||
/* creates Attributes */
|
/* creates Attributes */
|
||||||
if( module->m_Attributs != MOD_DEFAULT )
|
if( module->m_Attributs != MOD_DEFAULT )
|
||||||
{
|
{
|
||||||
fprintf( file, "ATTRIBUTE" );
|
fprintf( file, "ATTRIBUTE" );
|
||||||
|
|
||||||
if( module->m_Attributs & MOD_CMS )
|
if( module->m_Attributs & MOD_CMS )
|
||||||
fprintf( file, " PAD_SMD" );
|
fprintf( file, " PAD_SMD" );
|
||||||
|
|
||||||
if( module->m_Attributs & MOD_VIRTUAL )
|
if( module->m_Attributs & MOD_VIRTUAL )
|
||||||
fprintf( file, " VIRTUAL" );
|
fprintf( file, " VIRTUAL" );
|
||||||
|
|
||||||
fprintf( file, "\n" );
|
fprintf( file, "\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* creates Drawing */
|
/* creates Drawing */
|
||||||
item = module->m_Drawings;
|
item = module->m_Drawings;
|
||||||
|
|
||||||
for( ; item != NULL; item = item->Next() )
|
for( ; item != NULL; item = item->Next() )
|
||||||
{
|
{
|
||||||
switch( item->Type() )
|
switch( item->Type() )
|
||||||
|
@ -860,12 +875,10 @@ void FootprintWriteShape( FILE* file, MODULE* module )
|
||||||
|
|
||||||
case S_CIRCLE:
|
case S_CIRCLE:
|
||||||
{
|
{
|
||||||
int rayon = (int) hypot(
|
int radius = (int) hypot( (double) ( edge->m_End0.x - edge->m_Start0.x ),
|
||||||
(double) ( edge->m_End0.x - edge->m_Start0.x ),
|
|
||||||
(double) ( edge->m_End0.y - edge->m_Start0.y ) );
|
(double) ( edge->m_End0.y - edge->m_Start0.y ) );
|
||||||
fprintf( file, "CIRCLE %d %d %d\n",
|
fprintf( file, "CIRCLE %d %d %d\n",
|
||||||
edge->m_Start0.x, y_axis_sign * edge->m_Start0.y,
|
edge->m_Start0.x, y_axis_sign * edge->m_Start0.y, radius );
|
||||||
rayon );
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -876,7 +889,8 @@ void FootprintWriteShape( FILE* file, MODULE* module )
|
||||||
// edge->m_Start0 is the arc center relative to the shape position
|
// edge->m_Start0 is the arc center relative to the shape position
|
||||||
// edge->m_End0 is the arc start point relative to the shape position
|
// edge->m_End0 is the arc start point relative to the shape position
|
||||||
arcStart = edge->m_End0;
|
arcStart = edge->m_End0;
|
||||||
// calculate arcEnd arc end point relative to the shape position, in pcbnew coordinates
|
// calculate arcEnd arc end point relative to the shape position, in pcbnew
|
||||||
|
// coordinates
|
||||||
arcEnd = arcStart;
|
arcEnd = arcStart;
|
||||||
RotatePoint( &arcEnd, edge->m_Start0, -edge->m_Angle );
|
RotatePoint( &arcEnd, edge->m_Start0, -edge->m_Angle );
|
||||||
// due to difference between pcbnew and gencad, swap arc start and arc end
|
// due to difference between pcbnew and gencad, swap arc start and arc end
|
||||||
|
|
|
@ -168,8 +168,7 @@ static void bag_flat_triangle( int layer, /*{{{*/
|
||||||
{
|
{
|
||||||
double z = layer_z[layer];
|
double z = layer_z[layer];
|
||||||
|
|
||||||
layer_triangles[layer].push_back( Triangle( x1, y1, z,
|
layer_triangles[layer].push_back( Triangle( x1, y1, z, x2, y2, z, x3, y3, z ) );
|
||||||
x2, y2, z, x3, y3, z ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -178,12 +177,10 @@ void FlatFan::bag( int layer, bool close ) /*{{{*/
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
for( i = 0; i < pts.size() - 1; i++ )
|
for( i = 0; i < pts.size() - 1; i++ )
|
||||||
bag_flat_triangle( layer, c.x, c.y, pts[i].x, pts[i].y,
|
bag_flat_triangle( layer, c.x, c.y, pts[i].x, pts[i].y, pts[i + 1].x, pts[i + 1].y );
|
||||||
pts[i + 1].x, pts[i + 1].y );
|
|
||||||
|
|
||||||
if( close )
|
if( close )
|
||||||
bag_flat_triangle( layer, c.x, c.y, pts[i].x, pts[i].y,
|
bag_flat_triangle( layer, c.x, c.y, pts[i].x, pts[i].y, pts[0].x, pts[0].y );
|
||||||
pts[0].x, pts[0].y );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -222,12 +219,10 @@ static void bag_vquad( TriangleBag& triangles, /*{{{*/
|
||||||
double x1, double y1, double x2, double y2,
|
double x1, double y1, double x2, double y2,
|
||||||
double z1, double z2 )
|
double z1, double z2 )
|
||||||
{
|
{
|
||||||
triangles.push_back( Triangle(
|
triangles.push_back( Triangle( x1, y1, z1,
|
||||||
x1, y1, z1,
|
|
||||||
x2, y2, z1,
|
x2, y2, z1,
|
||||||
x2, y2, z2 ) );
|
x2, y2, z2 ) );
|
||||||
triangles.push_back( Triangle(
|
triangles.push_back( Triangle( x1, y1, z1,
|
||||||
x1, y1, z1,
|
|
||||||
x2, y2, z2,
|
x2, y2, z2,
|
||||||
x1, y1, z2 ) );
|
x1, y1, z2 ) );
|
||||||
}
|
}
|
||||||
|
@ -345,8 +340,7 @@ static void write_triangle_bag( FILE* output_file, int color_index, /*{{{*/
|
||||||
i != triangles.end();
|
i != triangles.end();
|
||||||
i++ )
|
i++ )
|
||||||
{
|
{
|
||||||
fprintf( output_file, "%d %d %d -1\n",
|
fprintf( output_file, "%d %d %d -1\n", j, j + 1, j + 2 );
|
||||||
j, j + 1, j + 2 );
|
|
||||||
j += 3;
|
j += 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -408,6 +402,7 @@ static void export_vrml_line( int layer, double startx, double starty, /*{{{*/
|
||||||
/* Output the 'bone' as a triangle fan, this is the fan centre */
|
/* Output the 'bone' as a triangle fan, this is the fan centre */
|
||||||
fan.c.x = (startx + endx) / 2;
|
fan.c.x = (startx + endx) / 2;
|
||||||
fan.c.y = (starty + endy) / 2;
|
fan.c.y = (starty + endy) / 2;
|
||||||
|
|
||||||
/* The 'end' side cap */
|
/* The 'end' side cap */
|
||||||
for( alpha = angle - PI2; alpha < angle + PI2; alpha += PI2 / divisions )
|
for( alpha = angle - PI2; alpha < angle + PI2; alpha += PI2 / divisions )
|
||||||
fan.add( endx + r * cos( alpha ), endy + r * sin( alpha ) );
|
fan.add( endx + r * cos( alpha ), endy + r * sin( alpha ) );
|
||||||
|
@ -428,16 +423,16 @@ static void export_vrml_line( int layer, double startx, double starty, /*{{{*/
|
||||||
static void export_vrml_circle( int layer, double startx, double starty, /*{{{*/
|
static void export_vrml_circle( int layer, double startx, double starty, /*{{{*/
|
||||||
double endx, double endy, double width, int divisions )
|
double endx, double endy, double width, int divisions )
|
||||||
{
|
{
|
||||||
double hole, rayon;
|
double hole, radius;
|
||||||
FlatRing ring;
|
FlatRing ring;
|
||||||
|
|
||||||
rayon = hypot( startx - endx, starty - endy ) + ( width / 2);
|
radius = hypot( startx - endx, starty - endy ) + ( width / 2);
|
||||||
hole = rayon - width;
|
hole = radius - width;
|
||||||
|
|
||||||
for( double alpha = 0; alpha < M_PI * 2; alpha += M_PI * 2 / divisions )
|
for( double alpha = 0; alpha < M_PI * 2; alpha += M_PI * 2 / divisions )
|
||||||
{
|
{
|
||||||
ring.add_inner( startx + hole * cos( alpha ), starty + hole * sin( alpha ) );
|
ring.add_inner( startx + hole * cos( alpha ), starty + hole * sin( alpha ) );
|
||||||
ring.add_outer( startx + rayon * cos( alpha ), starty + rayon * sin( alpha ) );
|
ring.add_outer( startx + radius * cos( alpha ), starty + radius * sin( alpha ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
ring.bag( layer );
|
ring.bag( layer );
|
||||||
|
@ -454,6 +449,7 @@ static void export_vrml_slot( TriangleBag& triangles, /*{{{*/
|
||||||
loop.z_top = layer_z[top_layer];
|
loop.z_top = layer_z[top_layer];
|
||||||
loop.z_bottom = layer_z[bottom_layer];
|
loop.z_bottom = layer_z[bottom_layer];
|
||||||
double angle = orient / 1800.0 * M_PI;
|
double angle = orient / 1800.0 * M_PI;
|
||||||
|
|
||||||
if( dy > dx )
|
if( dy > dx )
|
||||||
{
|
{
|
||||||
EXCHG( dx, dy );
|
EXCHG( dx, dy );
|
||||||
|
@ -466,14 +462,17 @@ static void export_vrml_slot( TriangleBag& triangles, /*{{{*/
|
||||||
/* The first side cap */
|
/* The first side cap */
|
||||||
capx = xc + cos( angle ) * dx / 2;
|
capx = xc + cos( angle ) * dx / 2;
|
||||||
capy = yc + sin( angle ) * dx / 2;
|
capy = yc + sin( angle ) * dx / 2;
|
||||||
|
|
||||||
for( alpha = angle - PI2; alpha < angle + PI2; alpha += PI2 / divisions )
|
for( alpha = angle - PI2; alpha < angle + PI2; alpha += PI2 / divisions )
|
||||||
loop.add( capx + r * cos( alpha ), capy + r * sin( alpha ) );
|
loop.add( capx + r * cos( alpha ), capy + r * sin( alpha ) );
|
||||||
|
|
||||||
alpha = angle + PI2;
|
alpha = angle + PI2;
|
||||||
loop.add( capx + r * cos( alpha ), capy + r * sin( alpha ) );
|
loop.add( capx + r * cos( alpha ), capy + r * sin( alpha ) );
|
||||||
|
|
||||||
/* The other side cap */
|
/* The other side cap */
|
||||||
capx = xc - cos( angle ) * dx / 2;
|
capx = xc - cos( angle ) * dx / 2;
|
||||||
capy = yc - sin( angle ) * dx / 2;
|
capy = yc - sin( angle ) * dx / 2;
|
||||||
|
|
||||||
for( alpha = angle + PI2; alpha < angle + 3 * PI2; alpha += PI2 / divisions )
|
for( alpha = angle + PI2; alpha < angle + 3 * PI2; alpha += PI2 / divisions )
|
||||||
loop.add( capx + r * cos( alpha ), capy + r * sin( alpha ) );
|
loop.add( capx + r * cos( alpha ), capy + r * sin( alpha ) );
|
||||||
|
|
||||||
|
@ -491,6 +490,7 @@ static void export_vrml_hole( TriangleBag& triangles, /*{{{*/
|
||||||
|
|
||||||
loop.z_top = layer_z[top_layer];
|
loop.z_top = layer_z[top_layer];
|
||||||
loop.z_bottom = layer_z[bottom_layer];
|
loop.z_bottom = layer_z[bottom_layer];
|
||||||
|
|
||||||
for( double alpha = 0; alpha < M_PI * 2; alpha += M_PI * 2 / divisions )
|
for( double alpha = 0; alpha < M_PI * 2; alpha += M_PI * 2 / divisions )
|
||||||
loop.add( xc + cos( alpha ) * hole, yc + sin( alpha ) * hole );
|
loop.add( xc + cos( alpha ) * hole, yc + sin( alpha ) * hole );
|
||||||
|
|
||||||
|
@ -507,10 +507,11 @@ static void export_vrml_varc( TriangleBag& triangles, /*{{{*/
|
||||||
loop.z_top = layer_z[top_layer];
|
loop.z_top = layer_z[top_layer];
|
||||||
loop.z_bottom = layer_z[bottom_layer];
|
loop.z_bottom = layer_z[bottom_layer];
|
||||||
double angle = atan2( endx - startx, endy - starty );
|
double angle = atan2( endx - startx, endy - starty );
|
||||||
double rayon = hypot( startx - endx, starty - endy );
|
double radius = hypot( startx - endx, starty - endy );
|
||||||
|
|
||||||
for( double alpha = angle; alpha < angle + PI2; alpha += PI2 / divisions )
|
for( double alpha = angle; alpha < angle + PI2; alpha += PI2 / divisions )
|
||||||
{
|
{
|
||||||
loop.add( startx + cos( alpha ) * rayon, starty + sin( alpha ) * rayon );
|
loop.add( startx + cos( alpha ) * radius, starty + sin( alpha ) * radius );
|
||||||
}
|
}
|
||||||
|
|
||||||
loop.bag( triangles );
|
loop.bag( triangles );
|
||||||
|
@ -527,6 +528,7 @@ static void export_vrml_oval_pad( int layer, /*{{{*/
|
||||||
fan.c.x = xc;
|
fan.c.x = xc;
|
||||||
fan.c.y = yc;
|
fan.c.y = yc;
|
||||||
double angle = orient / 1800.0 * M_PI;
|
double angle = orient / 1800.0 * M_PI;
|
||||||
|
|
||||||
if( dy > dx )
|
if( dy > dx )
|
||||||
{
|
{
|
||||||
EXCHG( dx, dy );
|
EXCHG( dx, dy );
|
||||||
|
@ -536,9 +538,11 @@ static void export_vrml_oval_pad( int layer, /*{{{*/
|
||||||
/* The exchange above means that cutter radius is alvays dy/2 */
|
/* The exchange above means that cutter radius is alvays dy/2 */
|
||||||
double r = dy / 2;
|
double r = dy / 2;
|
||||||
double alpha;
|
double alpha;
|
||||||
|
|
||||||
/* The first side cap */
|
/* The first side cap */
|
||||||
capx = xc + cos( angle ) * dx / 2;
|
capx = xc + cos( angle ) * dx / 2;
|
||||||
capy = yc + sin( angle ) * dx / 2;
|
capy = yc + sin( angle ) * dx / 2;
|
||||||
|
|
||||||
for( alpha = angle - PI2; alpha < angle + PI2; alpha += PI2 / divisions )
|
for( alpha = angle - PI2; alpha < angle + PI2; alpha += PI2 / divisions )
|
||||||
fan.add( capx + r * cos( alpha ), capy + r * sin( alpha ) );
|
fan.add( capx + r * cos( alpha ), capy + r * sin( alpha ) );
|
||||||
|
|
||||||
|
@ -547,6 +551,7 @@ static void export_vrml_oval_pad( int layer, /*{{{*/
|
||||||
/* The other side cap */
|
/* The other side cap */
|
||||||
capx = xc - cos( angle ) * dx / 2;
|
capx = xc - cos( angle ) * dx / 2;
|
||||||
capy = yc - sin( angle ) * dx / 2;
|
capy = yc - sin( angle ) * dx / 2;
|
||||||
|
|
||||||
for( alpha = angle + PI2; alpha < angle + 3 * PI2; alpha += PI2 / divisions )
|
for( alpha = angle + PI2; alpha < angle + 3 * PI2; alpha += PI2 / divisions )
|
||||||
fan.add( capx + r * cos( alpha ), capy + r * sin( alpha ) );
|
fan.add( capx + r * cos( alpha ), capy + r * sin( alpha ) );
|
||||||
|
|
||||||
|
@ -560,16 +565,16 @@ static void export_vrml_arc( int layer, double startx, double starty, /*{{{*/
|
||||||
double endx, double endy, double width, int divisions )
|
double endx, double endy, double width, int divisions )
|
||||||
{
|
{
|
||||||
FlatRing ring;
|
FlatRing ring;
|
||||||
double hole, rayon;
|
double hole, radius;
|
||||||
double angle = atan2( endx - startx, endy - starty );
|
double angle = atan2( endx - startx, endy - starty );
|
||||||
|
|
||||||
rayon = hypot( startx - endx, starty - endy ) + ( width / 2);
|
radius = hypot( startx - endx, starty - endy ) + ( width / 2);
|
||||||
hole = rayon - width;
|
hole = radius - width;
|
||||||
|
|
||||||
for( double alpha = angle; alpha < angle + PI2; alpha += PI2 / divisions )
|
for( double alpha = angle; alpha < angle + PI2; alpha += PI2 / divisions )
|
||||||
{
|
{
|
||||||
ring.add_inner( startx + cos( alpha ) * hole, starty + sin( alpha ) * hole );
|
ring.add_inner( startx + cos( alpha ) * hole, starty + sin( alpha ) * hole );
|
||||||
ring.add_outer( startx + cos( alpha ) * rayon, starty + sin( alpha ) * rayon );
|
ring.add_outer( startx + cos( alpha ) * radius, starty + sin( alpha ) * radius );
|
||||||
}
|
}
|
||||||
|
|
||||||
ring.bag( layer, false );
|
ring.bag( layer, false );
|
||||||
|
@ -650,9 +655,11 @@ static void export_vrml_pcbtext( TEXTE_PCB* text )
|
||||||
/* Coupling by globals! Ewwww... */
|
/* Coupling by globals! Ewwww... */
|
||||||
s_text_layer = text->GetLayer();
|
s_text_layer = text->GetLayer();
|
||||||
s_text_width = text->m_Thickness;
|
s_text_width = text->m_Thickness;
|
||||||
|
|
||||||
wxSize size = text->m_Size;
|
wxSize size = text->m_Size;
|
||||||
if( text->m_Mirror )
|
if( text->m_Mirror )
|
||||||
NEGATE( size.x );
|
NEGATE( size.x );
|
||||||
|
|
||||||
if( text->m_MultilineAllowed )
|
if( text->m_MultilineAllowed )
|
||||||
{
|
{
|
||||||
wxPoint pos = text->m_Pos;
|
wxPoint pos = text->m_Pos;
|
||||||
|
@ -720,6 +727,7 @@ static void export_round_padstack( BOARD* pcb, double x, double y, double r, /*{
|
||||||
/* The last layer is always the component one, unless it's single face */
|
/* The last layer is always the component one, unless it's single face */
|
||||||
if( (layer > FIRST_COPPER_LAYER) && (layer == copper_layers - 1) )
|
if( (layer > FIRST_COPPER_LAYER) && (layer == copper_layers - 1) )
|
||||||
layer = LAST_COPPER_LAYER;
|
layer = LAST_COPPER_LAYER;
|
||||||
|
|
||||||
if( layer <= top_layer )
|
if( layer <= top_layer )
|
||||||
export_vrml_circle( layer, x, y, x + r / 2, y, r, divisions );
|
export_vrml_circle( layer, x, y, x + r / 2, y, r, divisions );
|
||||||
}
|
}
|
||||||
|
@ -890,7 +898,7 @@ static void export_vrml_pad( BOARD* pcb, D_PAD* pad ) /*{{{*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The pad proper, on the selected layers */
|
/* The pad proper, on the selected layers */
|
||||||
unsigned long layer_mask = pad->m_Masque_Layer;
|
unsigned long layer_mask = pad->m_layerMask;
|
||||||
int copper_layers = pcb->GetCopperLayerCount( );
|
int copper_layers = pcb->GetCopperLayerCount( );
|
||||||
/* The (maybe offseted) pad position */
|
/* The (maybe offseted) pad position */
|
||||||
wxPoint pad_pos = pad->ReturnShapePos();
|
wxPoint pad_pos = pad->ReturnShapePos();
|
||||||
|
@ -901,6 +909,7 @@ static void export_vrml_pad( BOARD* pcb, D_PAD* pad ) /*{{{*/
|
||||||
double pad_dy = pad_delta.y / 2;
|
double pad_dy = pad_delta.y / 2;
|
||||||
double pad_w = pad->m_Size.x / 2;
|
double pad_w = pad->m_Size.x / 2;
|
||||||
double pad_h = pad->m_Size.y / 2;
|
double pad_h = pad->m_Size.y / 2;
|
||||||
|
|
||||||
for( int layer = FIRST_COPPER_LAYER; layer < copper_layers; layer++ )
|
for( int layer = FIRST_COPPER_LAYER; layer < copper_layers; layer++ )
|
||||||
{
|
{
|
||||||
/* The last layer is always the component one, unless it's single face */
|
/* The last layer is always the component one, unless it's single face */
|
||||||
|
@ -973,6 +982,7 @@ static void build_quat( double x, double y, double z, double a, double q[4] )
|
||||||
static void from_quat( double q[4], double rot[4] )
|
static void from_quat( double q[4], double rot[4] )
|
||||||
{
|
{
|
||||||
rot[3] = acos( q[3] ) * 2;
|
rot[3] = acos( q[3] ) * 2;
|
||||||
|
|
||||||
for( int i = 0; i < 3; i++ )
|
for( int i = 0; i < 3; i++ )
|
||||||
{
|
{
|
||||||
rot[i] = q[i] / sin( rot[3] / 2 );
|
rot[i] = q[i] / sin( rot[3] / 2 );
|
||||||
|
@ -1021,17 +1031,16 @@ static void export_vrml_module( BOARD* aPcb, MODULE* aModule,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Export pads */
|
/* Export pads */
|
||||||
for( D_PAD* pad = aModule->m_Pads;
|
for( D_PAD* pad = aModule->m_Pads; pad != 0; pad = pad->Next() )
|
||||||
pad != 0;
|
|
||||||
pad = pad->Next() )
|
|
||||||
export_vrml_pad( aPcb, pad );
|
export_vrml_pad( aPcb, pad );
|
||||||
|
|
||||||
bool isFlipped = aModule->GetLayer() == LAYER_N_BACK;
|
bool isFlipped = aModule->GetLayer() == LAYER_N_BACK;
|
||||||
|
|
||||||
/* Export the object VRML model(s) */
|
/* Export the object VRML model(s) */
|
||||||
for( S3D_MASTER* vrmlm = aModule->m_3D_Drawings;
|
for( S3D_MASTER* vrmlm = aModule->m_3D_Drawings; vrmlm != 0; vrmlm = vrmlm->Next() )
|
||||||
vrmlm != 0; vrmlm = vrmlm->Next() )
|
|
||||||
{
|
{
|
||||||
wxString fname = vrmlm->m_Shape3DName;
|
wxString fname = vrmlm->m_Shape3DName;
|
||||||
|
|
||||||
if( fname.IsEmpty() )
|
if( fname.IsEmpty() )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -1039,16 +1048,19 @@ static void export_vrml_module( BOARD* aPcb, MODULE* aModule,
|
||||||
{
|
{
|
||||||
wxFileName fn = fname;
|
wxFileName fn = fname;
|
||||||
fname = wxGetApp().FindLibraryPath( fn );
|
fname = wxGetApp().FindLibraryPath( fn );
|
||||||
|
|
||||||
if( fname.IsEmpty() ) // keep "short" name if full filemane not found
|
if( fname.IsEmpty() ) // keep "short" name if full filemane not found
|
||||||
fname = vrmlm->m_Shape3DName;
|
fname = vrmlm->m_Shape3DName;
|
||||||
}
|
}
|
||||||
|
|
||||||
fname.Replace(wxT("\\"), wxT("/" ) );
|
fname.Replace(wxT("\\"), wxT("/" ) );
|
||||||
wxString source_fname = fname;
|
wxString source_fname = fname;
|
||||||
|
|
||||||
if( aExport3DFiles ) // Change illegal characters in short filename
|
if( aExport3DFiles ) // Change illegal characters in short filename
|
||||||
{
|
{
|
||||||
ChangeIllegalCharacters( fname, true );
|
ChangeIllegalCharacters( fname, true );
|
||||||
fname = a3D_Subdir + wxT("/") + fname;
|
fname = a3D_Subdir + wxT("/") + fname;
|
||||||
|
|
||||||
if( !wxFileExists( fname ) )
|
if( !wxFileExists( fname ) )
|
||||||
wxCopyFile( source_fname, fname );
|
wxCopyFile( source_fname, fname );
|
||||||
}
|
}
|
||||||
|
@ -1061,6 +1073,7 @@ static void export_vrml_module( BOARD* aPcb, MODULE* aModule,
|
||||||
double rotx = - vrmlm->m_MatRotation.x;
|
double rotx = - vrmlm->m_MatRotation.x;
|
||||||
double roty = - vrmlm->m_MatRotation.y;
|
double roty = - vrmlm->m_MatRotation.y;
|
||||||
double rotz = - vrmlm->m_MatRotation.z;
|
double rotz = - vrmlm->m_MatRotation.z;
|
||||||
|
|
||||||
if ( isFlipped )
|
if ( isFlipped )
|
||||||
{
|
{
|
||||||
rotx += 180.0;
|
rotx += 180.0;
|
||||||
|
@ -1085,13 +1098,14 @@ static void export_vrml_module( BOARD* aPcb, MODULE* aModule,
|
||||||
/* A null rotation would fail the acos! */
|
/* A null rotation would fail the acos! */
|
||||||
if( rot[3] != 0.0 )
|
if( rot[3] != 0.0 )
|
||||||
{
|
{
|
||||||
fprintf( aOutputFile, " rotation %g %g %g %g\n",
|
fprintf( aOutputFile, " rotation %g %g %g %g\n", rot[0], rot[1], rot[2], rot[3] );
|
||||||
rot[0], rot[1], rot[2], rot[3] );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf( aOutputFile, " scale %g %g %g\n",
|
fprintf( aOutputFile, " scale %g %g %g\n",
|
||||||
vrmlm->m_MatScale.x * aScalingFactor,
|
vrmlm->m_MatScale.x * aScalingFactor,
|
||||||
vrmlm->m_MatScale.y * aScalingFactor,
|
vrmlm->m_MatScale.y * aScalingFactor,
|
||||||
vrmlm->m_MatScale.z * aScalingFactor );
|
vrmlm->m_MatScale.z * aScalingFactor );
|
||||||
|
|
||||||
/* adjust 3D shape offset position (offset is given inch) */
|
/* adjust 3D shape offset position (offset is given inch) */
|
||||||
#define UNITS_3D_TO_PCB_UNITS PCB_INTERNAL_UNIT
|
#define UNITS_3D_TO_PCB_UNITS PCB_INTERNAL_UNIT
|
||||||
int offsetx = wxRound( vrmlm->m_MatPosition.x * UNITS_3D_TO_PCB_UNITS );
|
int offsetx = wxRound( vrmlm->m_MatPosition.x * UNITS_3D_TO_PCB_UNITS );
|
||||||
|
@ -1113,13 +1127,11 @@ static void export_vrml_module( BOARD* aPcb, MODULE* aModule,
|
||||||
" children [\n Inline {\n url \"%s\"\n } ]\n",
|
" children [\n Inline {\n url \"%s\"\n } ]\n",
|
||||||
TO_UTF8( fname ) );
|
TO_UTF8( fname ) );
|
||||||
fprintf( aOutputFile, " }\n" );
|
fprintf( aOutputFile, " }\n" );
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void write_and_empty_triangle_bag( FILE* output_file,
|
static void write_and_empty_triangle_bag( FILE* output_file, TriangleBag& triangles, int color )
|
||||||
TriangleBag& triangles, int color )
|
|
||||||
{
|
{
|
||||||
if( !triangles.empty() )
|
if( !triangles.empty() )
|
||||||
{
|
{
|
||||||
|
@ -1158,8 +1170,10 @@ wxBusyCursor dummy;
|
||||||
|
|
||||||
wxString fullFilename = dlg.FilePicker()->GetPath();
|
wxString fullFilename = dlg.FilePicker()->GetPath();
|
||||||
subDirFor3Dshapes = dlg.GetSubdir();
|
subDirFor3Dshapes = dlg.GetSubdir();
|
||||||
|
|
||||||
if( ! wxDirExists( subDirFor3Dshapes ) )
|
if( ! wxDirExists( subDirFor3Dshapes ) )
|
||||||
wxMkdir( subDirFor3Dshapes );
|
wxMkdir( subDirFor3Dshapes );
|
||||||
|
|
||||||
if( ! ExportVRML_File( fullFilename, scale, export3DFiles, subDirFor3Dshapes ) )
|
if( ! ExportVRML_File( fullFilename, scale, export3DFiles, subDirFor3Dshapes ) )
|
||||||
{
|
{
|
||||||
wxString msg = _( "Unable to create " ) + fullFilename;
|
wxString msg = _( "Unable to create " ) + fullFilename;
|
||||||
|
@ -1215,6 +1229,7 @@ bool PCB_EDIT_FRAME::ExportVRML_File( const wxString & aFullFileName,
|
||||||
/* scaling factor to convert internal units (decimils) to inches
|
/* scaling factor to convert internal units (decimils) to inches
|
||||||
*/
|
*/
|
||||||
double board_scaling_factor = 0.0001;
|
double board_scaling_factor = 0.0001;
|
||||||
|
|
||||||
/* auxiliary scale to export to a different scale.
|
/* auxiliary scale to export to a different scale.
|
||||||
*/
|
*/
|
||||||
double general_scaling_factor = board_scaling_factor * aScale;
|
double general_scaling_factor = board_scaling_factor * aScale;
|
||||||
|
@ -1238,6 +1253,7 @@ bool PCB_EDIT_FRAME::ExportVRML_File( const wxString & aFullFileName,
|
||||||
* So the scaling factor from 0.1 inch to board units
|
* So the scaling factor from 0.1 inch to board units
|
||||||
* is 0.1 / board_scaling_factor
|
* is 0.1 / board_scaling_factor
|
||||||
*/
|
*/
|
||||||
|
|
||||||
double wrml_3D_models_scaling_factor = 0.1 / board_scaling_factor;
|
double wrml_3D_models_scaling_factor = 0.1 / board_scaling_factor;
|
||||||
/* Preliminary computation: the z value for each layer */
|
/* Preliminary computation: the z value for each layer */
|
||||||
compute_layer_Zs( pcb );
|
compute_layer_Zs( pcb );
|
||||||
|
@ -1253,9 +1269,7 @@ bool PCB_EDIT_FRAME::ExportVRML_File( const wxString & aFullFileName,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Export footprints */
|
/* Export footprints */
|
||||||
for( MODULE* module = pcb->m_Modules;
|
for( MODULE* module = pcb->m_Modules; module != 0; module = module->Next() )
|
||||||
module != 0;
|
|
||||||
module = module->Next() )
|
|
||||||
export_vrml_module( pcb, module, output_file,
|
export_vrml_module( pcb, module, output_file,
|
||||||
wrml_3D_models_scaling_factor,
|
wrml_3D_models_scaling_factor,
|
||||||
aExport3DFiles, a3D_Subdir );
|
aExport3DFiles, a3D_Subdir );
|
||||||
|
@ -1291,6 +1305,7 @@ static void ChangeIllegalCharacters( wxString & aFileName, bool aDirSepIsIllegal
|
||||||
{
|
{
|
||||||
if( aDirSepIsIllegal )
|
if( aDirSepIsIllegal )
|
||||||
aFileName.Replace(wxT("/"), wxT("_" ) );
|
aFileName.Replace(wxT("/"), wxT("_" ) );
|
||||||
|
|
||||||
aFileName.Replace(wxT(" "), wxT("_" ) );
|
aFileName.Replace(wxT(" "), wxT("_" ) );
|
||||||
aFileName.Replace(wxT(":"), wxT("_" ) );
|
aFileName.Replace(wxT(":"), wxT("_" ) );
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ void WinEDA_PcbFindFrame::FindItem( wxCommandEvent& event )
|
||||||
PCB_SCREEN* screen = (PCB_SCREEN*) ( m_Parent->GetScreen() );
|
PCB_SCREEN* screen = (PCB_SCREEN*) ( m_Parent->GetScreen() );
|
||||||
wxPoint locate_pos;
|
wxPoint locate_pos;
|
||||||
wxString msg;
|
wxString msg;
|
||||||
bool FindMarker = FALSE;
|
bool FindMarker = false;
|
||||||
BOARD_ITEM* foundItem = 0;
|
BOARD_ITEM* foundItem = 0;
|
||||||
|
|
||||||
switch( event.GetId() )
|
switch( event.GetId() )
|
||||||
|
@ -51,7 +51,7 @@ void WinEDA_PcbFindFrame::FindItem( wxCommandEvent& event )
|
||||||
// fall thru
|
// fall thru
|
||||||
|
|
||||||
case ID_FIND_NEXT_MARKER:
|
case ID_FIND_NEXT_MARKER:
|
||||||
FindMarker = TRUE;
|
FindMarker = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,6 +63,7 @@ void WinEDA_PcbFindFrame::FindItem( wxCommandEvent& event )
|
||||||
if( FindMarker )
|
if( FindMarker )
|
||||||
{
|
{
|
||||||
MARKER_PCB* marker = m_Parent->GetBoard()->GetMARKER( s_MarkerCount++ );
|
MARKER_PCB* marker = m_Parent->GetBoard()->GetMARKER( s_MarkerCount++ );
|
||||||
|
|
||||||
if( marker )
|
if( marker )
|
||||||
{
|
{
|
||||||
foundItem = marker;
|
foundItem = marker;
|
||||||
|
@ -72,14 +73,13 @@ void WinEDA_PcbFindFrame::FindItem( wxCommandEvent& event )
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int StartCount = 0;
|
int StartCount = 0;
|
||||||
for( MODULE* module = m_Parent->GetBoard()->m_Modules;
|
|
||||||
module;
|
for( MODULE* module = m_Parent->GetBoard()->m_Modules; module; module = module->Next() )
|
||||||
module = module->Next() )
|
|
||||||
{
|
{
|
||||||
if( WildCompareString( s_OldStringFound,
|
if( WildCompareString( s_OldStringFound, module->GetReference().GetData(), false ) )
|
||||||
module->GetReference().GetData(), FALSE ) )
|
|
||||||
{
|
{
|
||||||
StartCount++;
|
StartCount++;
|
||||||
|
|
||||||
if( StartCount > s_ItemCount )
|
if( StartCount > s_ItemCount )
|
||||||
{
|
{
|
||||||
foundItem = module;
|
foundItem = module;
|
||||||
|
@ -88,10 +88,11 @@ void WinEDA_PcbFindFrame::FindItem( wxCommandEvent& event )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( WildCompareString( s_OldStringFound,
|
|
||||||
module->m_Value->m_Text.GetData(), FALSE ) )
|
if( WildCompareString( s_OldStringFound, module->m_Value->m_Text.GetData(), false ) )
|
||||||
{
|
{
|
||||||
StartCount++;
|
StartCount++;
|
||||||
|
|
||||||
if( StartCount > s_ItemCount )
|
if( StartCount > s_ItemCount )
|
||||||
{
|
{
|
||||||
foundItem = module;
|
foundItem = module;
|
||||||
|
@ -201,10 +202,12 @@ bool WinEDA_PcbFindFrame::Create( wxWindow* parent,
|
||||||
wxDialog::Create( parent, id, caption, pos, size, style );
|
wxDialog::Create( parent, id, caption, pos, size, style );
|
||||||
|
|
||||||
CreateControls();
|
CreateControls();
|
||||||
|
|
||||||
if( GetSizer() )
|
if( GetSizer() )
|
||||||
{
|
{
|
||||||
GetSizer()->SetSizeHints( this );
|
GetSizer()->SetSizeHints( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
Centre();
|
Centre();
|
||||||
|
|
||||||
////@end WinEDA_PcbFindFrame creation
|
////@end WinEDA_PcbFindFrame creation
|
||||||
|
|
|
@ -119,15 +119,12 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
|
||||||
|
|
||||||
/* Draw items on edge layer */
|
/* Draw items on edge layer */
|
||||||
|
|
||||||
for( PtStruct = aPcb->m_Drawings;
|
for( PtStruct = aPcb->m_Drawings; PtStruct != NULL; PtStruct = PtStruct->Next() )
|
||||||
PtStruct != NULL;
|
|
||||||
PtStruct = PtStruct->Next() )
|
|
||||||
{
|
{
|
||||||
switch( PtStruct->Type() )
|
switch( PtStruct->Type() )
|
||||||
{
|
{
|
||||||
case TYPE_DRAWSEGMENT:
|
case TYPE_DRAWSEGMENT:
|
||||||
PlotDrawSegment( plotter, (DRAWSEGMENT*) PtStruct, EDGE_LAYER,
|
PlotDrawSegment( plotter, (DRAWSEGMENT*) PtStruct, EDGE_LAYER, FILLED );
|
||||||
FILLED );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_TEXTE:
|
case TYPE_TEXTE:
|
||||||
|
@ -138,8 +135,8 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
|
||||||
PlotDimension( plotter, (DIMENSION*) PtStruct, EDGE_LAYER, FILLED );
|
PlotDimension( plotter, (DIMENSION*) PtStruct, EDGE_LAYER, FILLED );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_MIRE:
|
case PCB_TARGET_T:
|
||||||
PlotMirePcb( plotter, (MIREPCB*) PtStruct, EDGE_LAYER, FILLED );
|
PlotPcbTarget( plotter, (PCB_TARGET*) PtStruct, EDGE_LAYER, FILLED );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_MARKER_PCB: // do not draw
|
case TYPE_MARKER_PCB: // do not draw
|
||||||
|
@ -181,6 +178,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
|
||||||
for( unsigned ii = 0; ii < aToolListBuffer.size(); ii++ )
|
for( unsigned ii = 0; ii < aToolListBuffer.size(); ii++ )
|
||||||
{
|
{
|
||||||
int plot_diam;
|
int plot_diam;
|
||||||
|
|
||||||
if( aToolListBuffer[ii].m_TotalCount == 0 )
|
if( aToolListBuffer[ii].m_TotalCount == 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -203,6 +201,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
|
||||||
sprintf( line, "%2.2fmm / %2.3f\" ",
|
sprintf( line, "%2.2fmm / %2.3f\" ",
|
||||||
double (aToolListBuffer[ii].m_Diameter) * 0.00254,
|
double (aToolListBuffer[ii].m_Diameter) * 0.00254,
|
||||||
double (aToolListBuffer[ii].m_Diameter) * 0.0001 );
|
double (aToolListBuffer[ii].m_Diameter) * 0.0001 );
|
||||||
|
|
||||||
msg = FROM_UTF8( line );
|
msg = FROM_UTF8( line );
|
||||||
|
|
||||||
// Now list how many holes and ovals are associated with each drill.
|
// Now list how many holes and ovals are associated with each drill.
|
||||||
|
@ -212,16 +211,15 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
|
||||||
else if( aToolListBuffer[ii].m_TotalCount == 1 ) // && ( aToolListBuffer[ii]m_OvalCount == 1 )
|
else if( aToolListBuffer[ii].m_TotalCount == 1 ) // && ( aToolListBuffer[ii]m_OvalCount == 1 )
|
||||||
sprintf( line, "(1 slot)" );
|
sprintf( line, "(1 slot)" );
|
||||||
else if( aToolListBuffer[ii].m_OvalCount == 0 )
|
else if( aToolListBuffer[ii].m_OvalCount == 0 )
|
||||||
sprintf( line, "(%d holes)",
|
sprintf( line, "(%d holes)", aToolListBuffer[ii].m_TotalCount );
|
||||||
aToolListBuffer[ii].m_TotalCount );
|
|
||||||
else if( aToolListBuffer[ii].m_OvalCount == 1 )
|
else if( aToolListBuffer[ii].m_OvalCount == 1 )
|
||||||
sprintf( line, "(%d holes + 1 slot)",
|
sprintf( line, "(%d holes + 1 slot)", aToolListBuffer[ii].m_TotalCount - 1 );
|
||||||
aToolListBuffer[ii].m_TotalCount - 1 );
|
|
||||||
else // if ( aToolListBuffer[ii]m_OvalCount > 1 )
|
else // if ( aToolListBuffer[ii]m_OvalCount > 1 )
|
||||||
sprintf( line, "(%d holes + %d slots)",
|
sprintf( line, "(%d holes + %d slots)",
|
||||||
aToolListBuffer[ii].m_TotalCount -
|
aToolListBuffer[ii].m_TotalCount -
|
||||||
aToolListBuffer[ii].m_OvalCount,
|
aToolListBuffer[ii].m_OvalCount,
|
||||||
aToolListBuffer[ii].m_OvalCount );
|
aToolListBuffer[ii].m_OvalCount );
|
||||||
|
|
||||||
msg += FROM_UTF8( line );
|
msg += FROM_UTF8( line );
|
||||||
plotter->text( wxPoint( plotX, y ), BLACK,
|
plotter->text( wxPoint( plotX, y ), BLACK,
|
||||||
msg,
|
msg,
|
||||||
|
@ -258,8 +256,7 @@ void Gen_Drill_PcbMap( BOARD* aPcb, PLOTTER* aPlotter,
|
||||||
if( aToolListBuffer.size() > 13 )
|
if( aToolListBuffer.size() > 13 )
|
||||||
{
|
{
|
||||||
DisplayInfoMessage( NULL,
|
DisplayInfoMessage( NULL,
|
||||||
_(
|
_( " Drill map: Too many diameter values to draw to draw one symbol per drill value (max 13)\nPlot uses circle shape for some drill values" ),
|
||||||
" Drill map: Too many diameter values to draw to draw one symbol per drill value (max 13)\nPlot uses circle shape for some drill values" ),
|
|
||||||
10 );
|
10 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -272,6 +269,7 @@ void Gen_Drill_PcbMap( BOARD* aPcb, PLOTTER* aPlotter,
|
||||||
* cutter!) */
|
* cutter!) */
|
||||||
aPlotter->marker( pos, aHoleListBuffer[ii].m_Hole_Diameter,
|
aPlotter->marker( pos, aHoleListBuffer[ii].m_Hole_Diameter,
|
||||||
aHoleListBuffer[ii].m_Tool_Reference - 1 );
|
aHoleListBuffer[ii].m_Tool_Reference - 1 );
|
||||||
|
|
||||||
if( aHoleListBuffer[ii].m_Hole_Shape != 0 )
|
if( aHoleListBuffer[ii].m_Hole_Shape != 0 )
|
||||||
{
|
{
|
||||||
wxSize oblong_size;
|
wxSize oblong_size;
|
||||||
|
@ -366,6 +364,7 @@ void GenDrillReportFile( FILE* aFile, BOARD* aPcb,
|
||||||
ii + 1,
|
ii + 1,
|
||||||
double (aToolListBuffer[ii].m_Diameter) * 0.00254,
|
double (aToolListBuffer[ii].m_Diameter) * 0.00254,
|
||||||
double (aToolListBuffer[ii].m_Diameter) * 0.0001 );
|
double (aToolListBuffer[ii].m_Diameter) * 0.0001 );
|
||||||
|
|
||||||
fputs( line, aFile );
|
fputs( line, aFile );
|
||||||
|
|
||||||
// Now list how many holes and ovals are associated with each drill.
|
// Now list how many holes and ovals are associated with each drill.
|
||||||
|
@ -375,15 +374,14 @@ void GenDrillReportFile( FILE* aFile, BOARD* aPcb,
|
||||||
else if( aToolListBuffer[ii].m_TotalCount == 1 )
|
else if( aToolListBuffer[ii].m_TotalCount == 1 )
|
||||||
sprintf( line, "(1 hole) (with 1 oblong)\n" );
|
sprintf( line, "(1 hole) (with 1 oblong)\n" );
|
||||||
else if( aToolListBuffer[ii].m_OvalCount == 0 )
|
else if( aToolListBuffer[ii].m_OvalCount == 0 )
|
||||||
sprintf( line, "(%d holes)\n",
|
sprintf( line, "(%d holes)\n", aToolListBuffer[ii].m_TotalCount );
|
||||||
aToolListBuffer[ii].m_TotalCount );
|
|
||||||
else if( aToolListBuffer[ii].m_OvalCount == 1 )
|
else if( aToolListBuffer[ii].m_OvalCount == 1 )
|
||||||
sprintf( line, "(%d holes) (with 1 oblong)\n",
|
sprintf( line, "(%d holes) (with 1 oblong)\n", aToolListBuffer[ii].m_TotalCount );
|
||||||
aToolListBuffer[ii].m_TotalCount );
|
|
||||||
else // if ( buffer[ii]m_OvalCount > 1 )
|
else // if ( buffer[ii]m_OvalCount > 1 )
|
||||||
sprintf( line, "(%d holes) (with %d oblongs)\n",
|
sprintf( line, "(%d holes) (with %d oblongs)\n",
|
||||||
aToolListBuffer[ii].m_TotalCount,
|
aToolListBuffer[ii].m_TotalCount,
|
||||||
aToolListBuffer[ii].m_OvalCount );
|
aToolListBuffer[ii].m_OvalCount );
|
||||||
|
|
||||||
fputs( line, aFile );
|
fputs( line, aFile );
|
||||||
|
|
||||||
TotalHoleCount += aToolListBuffer[ii].m_TotalCount;
|
TotalHoleCount += aToolListBuffer[ii].m_TotalCount;
|
||||||
|
@ -393,6 +391,7 @@ void GenDrillReportFile( FILE* aFile, BOARD* aPcb,
|
||||||
sprintf( line, "\ntotal Not Plated holes count %d\n\n\n", TotalHoleCount );
|
sprintf( line, "\ntotal Not Plated holes count %d\n\n\n", TotalHoleCount );
|
||||||
else
|
else
|
||||||
sprintf( line, "\ntotal plated holes count %d\n\n\n", TotalHoleCount );
|
sprintf( line, "\ntotal plated holes count %d\n\n\n", TotalHoleCount );
|
||||||
|
|
||||||
fputs( line, aFile );
|
fputs( line, aFile );
|
||||||
|
|
||||||
if( gen_NPTH_holes )
|
if( gen_NPTH_holes )
|
||||||
|
@ -408,7 +407,9 @@ void GenDrillReportFile( FILE* aFile, BOARD* aPcb,
|
||||||
}
|
}
|
||||||
|
|
||||||
if( gen_through_holes )
|
if( gen_through_holes )
|
||||||
|
{
|
||||||
layer2 = layer1 + 1;
|
layer2 = layer1 + 1;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( layer2 >= LAYER_N_FRONT ) // no more layer pair to consider
|
if( layer2 >= LAYER_N_FRONT ) // no more layer pair to consider
|
||||||
|
@ -416,6 +417,7 @@ void GenDrillReportFile( FILE* aFile, BOARD* aPcb,
|
||||||
gen_NPTH_holes = true;
|
gen_NPTH_holes = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
layer1++; layer2++; // use next layer pair
|
layer1++; layer2++; // use next layer pair
|
||||||
|
|
||||||
if( layer2 == aPcb->GetCopperLayerCount() - 1 )
|
if( layer2 == aPcb->GetCopperLayerCount() - 1 )
|
||||||
|
|
|
@ -189,6 +189,7 @@ void PCB_EDIT_FRAME::GenModulesPosition( wxCommandEvent& event )
|
||||||
Liste = (LIST_MOD*) MyZMalloc( moduleCount * sizeof(LIST_MOD) );
|
Liste = (LIST_MOD*) MyZMalloc( moduleCount * sizeof(LIST_MOD) );
|
||||||
|
|
||||||
module = GetBoard()->m_Modules;
|
module = GetBoard()->m_Modules;
|
||||||
|
|
||||||
for( int ii = 0; module; module = module->Next() )
|
for( int ii = 0; module; module = module->Next() )
|
||||||
{
|
{
|
||||||
if( module->m_Attributs & MOD_VIRTUAL )
|
if( module->m_Attributs & MOD_VIRTUAL )
|
||||||
|
@ -206,8 +207,7 @@ void PCB_EDIT_FRAME::GenModulesPosition( wxCommandEvent& event )
|
||||||
qsort( Liste, moduleCount, sizeof(LIST_MOD), ListeModCmp );
|
qsort( Liste, moduleCount, sizeof(LIST_MOD), ListeModCmp );
|
||||||
|
|
||||||
// Write file header
|
// Write file header
|
||||||
sprintf( line, "### Module positions - created on %s ###\n",
|
sprintf( line, "### Module positions - created on %s ###\n", DateAndTime( Buff ) );
|
||||||
DateAndTime( Buff ) );
|
|
||||||
fputs( line, fpFront );
|
fputs( line, fpFront );
|
||||||
|
|
||||||
if( doBoardBack )
|
if( doBoardBack )
|
||||||
|
@ -238,6 +238,7 @@ void PCB_EDIT_FRAME::GenModulesPosition( wxCommandEvent& event )
|
||||||
sprintf( line,
|
sprintf( line,
|
||||||
"# Ref Val PosX PosY Rot Side\n" );
|
"# Ref Val PosX PosY Rot Side\n" );
|
||||||
fputs( line, fpFront );
|
fputs( line, fpFront );
|
||||||
|
|
||||||
if( doBoardBack )
|
if( doBoardBack )
|
||||||
fputs( line, fpBack );
|
fputs( line, fpBack );
|
||||||
|
|
||||||
|
@ -246,8 +247,7 @@ void PCB_EDIT_FRAME::GenModulesPosition( wxCommandEvent& event )
|
||||||
wxPoint module_pos;
|
wxPoint module_pos;
|
||||||
wxString ref = Liste[ii].m_Reference;
|
wxString ref = Liste[ii].m_Reference;
|
||||||
wxString val = Liste[ii].m_Value;
|
wxString val = Liste[ii].m_Value;
|
||||||
sprintf( line, "%-8.8s %-16.16s ", TO_UTF8( ref ),
|
sprintf( line, "%-8.8s %-16.16s ", TO_UTF8( ref ), TO_UTF8( val ) );
|
||||||
TO_UTF8( val ) );
|
|
||||||
|
|
||||||
module_pos = Liste[ii].m_Module->m_Pos;
|
module_pos = Liste[ii].m_Module->m_Pos;
|
||||||
module_pos.x -= File_Place_Offset.x;
|
module_pos.x -= File_Place_Offset.x;
|
||||||
|
@ -381,6 +381,7 @@ void PCB_EDIT_FRAME::GenModuleReport( wxCommandEvent& event )
|
||||||
fputs( "$EndBOARD\n\n", rptfile );
|
fputs( "$EndBOARD\n\n", rptfile );
|
||||||
|
|
||||||
Module = (MODULE*) GetBoard()->m_Modules;
|
Module = (MODULE*) GetBoard()->m_Modules;
|
||||||
|
|
||||||
for( ; Module != NULL; Module = Module->Next() )
|
for( ; Module != NULL; Module = Module->Next() )
|
||||||
{
|
{
|
||||||
sprintf( line, "$MODULE %s\n", EscapedUTF8( Module->m_Reference->m_Text ).c_str() );
|
sprintf( line, "$MODULE %s\n", EscapedUTF8( Module->m_Reference->m_Text ).c_str() );
|
||||||
|
@ -394,12 +395,16 @@ void PCB_EDIT_FRAME::GenModuleReport( wxCommandEvent& event )
|
||||||
fputs( line, rptfile );
|
fputs( line, rptfile );
|
||||||
|
|
||||||
msg = wxT( "attribut" );
|
msg = wxT( "attribut" );
|
||||||
|
|
||||||
if( Module->m_Attributs & MOD_VIRTUAL )
|
if( Module->m_Attributs & MOD_VIRTUAL )
|
||||||
msg += wxT( " virtual" );
|
msg += wxT( " virtual" );
|
||||||
|
|
||||||
if( Module->m_Attributs & MOD_CMS )
|
if( Module->m_Attributs & MOD_CMS )
|
||||||
msg += wxT( " smd" );
|
msg += wxT( " smd" );
|
||||||
|
|
||||||
if( ( Module->m_Attributs & (MOD_VIRTUAL | MOD_CMS) ) == 0 )
|
if( ( Module->m_Attributs & (MOD_VIRTUAL | MOD_CMS) ) == 0 )
|
||||||
msg += wxT( " none" );
|
msg += wxT( " none" );
|
||||||
|
|
||||||
msg += wxT( "\n" );
|
msg += wxT( "\n" );
|
||||||
fputs( TO_UTF8( msg ), rptfile );
|
fputs( TO_UTF8( msg ), rptfile );
|
||||||
|
|
||||||
|
@ -413,12 +418,14 @@ void PCB_EDIT_FRAME::GenModuleReport( wxCommandEvent& event )
|
||||||
fputs( line, rptfile );
|
fputs( line, rptfile );
|
||||||
|
|
||||||
sprintf( line, "orientation %.2f\n", (double) Module->m_Orient / 10 );
|
sprintf( line, "orientation %.2f\n", (double) Module->m_Orient / 10 );
|
||||||
|
|
||||||
if( Module->GetLayer() == LAYER_N_FRONT )
|
if( Module->GetLayer() == LAYER_N_FRONT )
|
||||||
strcat( line, "layer component\n" );
|
strcat( line, "layer component\n" );
|
||||||
else if( Module->GetLayer() == LAYER_N_BACK )
|
else if( Module->GetLayer() == LAYER_N_BACK )
|
||||||
strcat( line, "layer copper\n" );
|
strcat( line, "layer copper\n" );
|
||||||
else
|
else
|
||||||
strcat( line, "layer other\n" );
|
strcat( line, "layer other\n" );
|
||||||
|
|
||||||
fputs( line, rptfile );
|
fputs( line, rptfile );
|
||||||
|
|
||||||
Module->Write_3D_Descr( rptfile );
|
Module->Write_3D_Descr( rptfile );
|
||||||
|
@ -445,16 +452,18 @@ void PCB_EDIT_FRAME::GenModuleReport( wxCommandEvent& event )
|
||||||
sprintf( line, "orientation %.2f\n",
|
sprintf( line, "orientation %.2f\n",
|
||||||
double(pad->m_Orient - Module->m_Orient) / 10 );
|
double(pad->m_Orient - Module->m_Orient) / 10 );
|
||||||
fputs( line, rptfile );
|
fputs( line, rptfile );
|
||||||
const char* shape_name[6] =
|
const char* shape_name[6] = { "??? ", "Circ", "Rect", "Oval", "trap", "spec" };
|
||||||
{ "??? ", "Circ", "Rect", "Oval", "trap", "spec" };
|
|
||||||
sprintf( line, "Shape %s\n", shape_name[pad->m_PadShape] );
|
sprintf( line, "Shape %s\n", shape_name[pad->m_PadShape] );
|
||||||
fputs( line, rptfile );
|
fputs( line, rptfile );
|
||||||
|
|
||||||
int layer = 0;
|
int layer = 0;
|
||||||
if( pad->m_Masque_Layer & LAYER_BACK )
|
|
||||||
|
if( pad->m_layerMask & LAYER_BACK )
|
||||||
layer = 1;
|
layer = 1;
|
||||||
if( pad->m_Masque_Layer & LAYER_FRONT )
|
|
||||||
|
if( pad->m_layerMask & LAYER_FRONT )
|
||||||
layer |= 2;
|
layer |= 2;
|
||||||
|
|
||||||
const char* layer_name[4] = { "??? ", "copper", "component", "all" };
|
const char* layer_name[4] = { "??? ", "copper", "component", "all" };
|
||||||
sprintf( line, "Layer %s\n", layer_name[layer] );
|
sprintf( line, "Layer %s\n", layer_name[layer] );
|
||||||
fputs( line, rptfile );
|
fputs( line, rptfile );
|
||||||
|
@ -475,6 +484,7 @@ void PCB_EDIT_FRAME::GenModuleReport( wxCommandEvent& event )
|
||||||
|
|
||||||
if( ( (DRAWSEGMENT*) PtStruct )->GetLayer() != EDGE_N )
|
if( ( (DRAWSEGMENT*) PtStruct )->GetLayer() != EDGE_N )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
WriteDrawSegmentPcb( (DRAWSEGMENT*) PtStruct, rptfile );
|
WriteDrawSegmentPcb( (DRAWSEGMENT*) PtStruct, rptfile );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -499,7 +509,7 @@ void PCB_EDIT_FRAME::GenModuleReport( wxCommandEvent& event )
|
||||||
void WriteDrawSegmentPcb( DRAWSEGMENT* PtDrawSegment, FILE* rptfile )
|
void WriteDrawSegmentPcb( DRAWSEGMENT* PtDrawSegment, FILE* rptfile )
|
||||||
{
|
{
|
||||||
double conv_unit, ux0, uy0, dx, dy;
|
double conv_unit, ux0, uy0, dx, dy;
|
||||||
double rayon, width;
|
double radius, width;
|
||||||
char line[1024];
|
char line[1024];
|
||||||
|
|
||||||
conv_unit = 0.0001; /* units = INCHES */
|
conv_unit = 0.0001; /* units = INCHES */
|
||||||
|
@ -515,10 +525,10 @@ void WriteDrawSegmentPcb( DRAWSEGMENT* PtDrawSegment, FILE* rptfile )
|
||||||
switch( PtDrawSegment->m_Shape )
|
switch( PtDrawSegment->m_Shape )
|
||||||
{
|
{
|
||||||
case S_CIRCLE:
|
case S_CIRCLE:
|
||||||
rayon = hypot( dx - ux0, dy - uy0 );
|
radius = hypot( dx - ux0, dy - uy0 );
|
||||||
fprintf( rptfile, "$CIRCLE \n" );
|
fprintf( rptfile, "$CIRCLE \n" );
|
||||||
fprintf( rptfile, "centre %.6lf %.6lf\n", ux0, uy0 );
|
fprintf( rptfile, "centre %.6lf %.6lf\n", ux0, uy0 );
|
||||||
fprintf( rptfile, "radius %.6lf\n", rayon );
|
fprintf( rptfile, "radius %.6lf\n", radius );
|
||||||
fprintf( rptfile, "width %.6lf\n", width );
|
fprintf( rptfile, "width %.6lf\n", width );
|
||||||
fprintf( rptfile, "$EndCIRCLE \n" );
|
fprintf( rptfile, "$EndCIRCLE \n" );
|
||||||
break;
|
break;
|
||||||
|
@ -526,7 +536,7 @@ void WriteDrawSegmentPcb( DRAWSEGMENT* PtDrawSegment, FILE* rptfile )
|
||||||
case S_ARC:
|
case S_ARC:
|
||||||
{
|
{
|
||||||
int endx = PtDrawSegment->m_End.x, endy = PtDrawSegment->m_End.y;
|
int endx = PtDrawSegment->m_End.x, endy = PtDrawSegment->m_End.y;
|
||||||
rayon = hypot( dx - ux0, dy - uy0 );
|
radius = hypot( dx - ux0, dy - uy0 );
|
||||||
RotatePoint( &endx,
|
RotatePoint( &endx,
|
||||||
&endy,
|
&endy,
|
||||||
PtDrawSegment->m_Start.x,
|
PtDrawSegment->m_Start.x,
|
||||||
|
|
|
@ -121,8 +121,7 @@ void PCB_BASE_FRAME::Global_Import_Pad_Settings( D_PAD* aPad, bool aDraw )
|
||||||
|
|
||||||
if( Module == NULL )
|
if( Module == NULL )
|
||||||
{
|
{
|
||||||
DisplayError( this,
|
DisplayError( this, wxT( "Global_Import_Pad_Settings() Error: NULL module" ) );
|
||||||
wxT( "Global_Import_Pad_Settings() Error: NULL module" ) );
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,6 +134,7 @@ void PCB_BASE_FRAME::Global_Import_Pad_Settings( D_PAD* aPad, bool aDraw )
|
||||||
|
|
||||||
if( diag == -1 )
|
if( diag == -1 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( diag == 1 )
|
if( diag == 1 )
|
||||||
edit_Same_Modules = true;
|
edit_Same_Modules = true;
|
||||||
|
|
||||||
|
@ -155,6 +155,7 @@ void PCB_BASE_FRAME::Global_Import_Pad_Settings( D_PAD* aPad, bool aDraw )
|
||||||
|
|
||||||
bool saveMe = false;
|
bool saveMe = false;
|
||||||
D_PAD* pt_pad = (D_PAD*) Module->m_Pads;
|
D_PAD* pt_pad = (D_PAD*) Module->m_Pads;
|
||||||
|
|
||||||
for( ; pt_pad != NULL; pt_pad = pt_pad->Next() )
|
for( ; pt_pad != NULL; pt_pad = pt_pad->Next() )
|
||||||
{
|
{
|
||||||
/* Filters changes prohibited. */
|
/* Filters changes prohibited. */
|
||||||
|
@ -167,7 +168,7 @@ void PCB_BASE_FRAME::Global_Import_Pad_Settings( D_PAD* aPad, bool aDraw )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( DIALOG_GLOBAL_PADS_EDITION::m_Pad_Layer_Filter
|
if( DIALOG_GLOBAL_PADS_EDITION::m_Pad_Layer_Filter
|
||||||
&& ( pt_pad->m_Masque_Layer != aPad->m_Masque_Layer ) )
|
&& ( pt_pad->m_layerMask != aPad->m_layerMask ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
saveMe = true;
|
saveMe = true;
|
||||||
|
@ -185,6 +186,7 @@ void PCB_BASE_FRAME::Global_Import_Pad_Settings( D_PAD* aPad, bool aDraw )
|
||||||
|
|
||||||
/* Update the current module and same others modules if requested. */
|
/* Update the current module and same others modules if requested. */
|
||||||
Module = (MODULE*) m_Pcb->m_Modules;
|
Module = (MODULE*) m_Pcb->m_Modules;
|
||||||
|
|
||||||
for( ; Module != NULL; Module = Module->Next() )
|
for( ; Module != NULL; Module = Module->Next() )
|
||||||
{
|
{
|
||||||
if( !edit_Same_Modules && (Module != Module_Ref) )
|
if( !edit_Same_Modules && (Module != Module_Ref) )
|
||||||
|
@ -202,6 +204,7 @@ void PCB_BASE_FRAME::Global_Import_Pad_Settings( D_PAD* aPad, bool aDraw )
|
||||||
}
|
}
|
||||||
|
|
||||||
D_PAD* pt_pad = (D_PAD*) Module->m_Pads;
|
D_PAD* pt_pad = (D_PAD*) Module->m_Pads;
|
||||||
|
|
||||||
for( ; pt_pad != NULL; pt_pad = pt_pad->Next() )
|
for( ; pt_pad != NULL; pt_pad = pt_pad->Next() )
|
||||||
{
|
{
|
||||||
/* Filters changes prohibited. */
|
/* Filters changes prohibited. */
|
||||||
|
@ -215,18 +218,17 @@ void PCB_BASE_FRAME::Global_Import_Pad_Settings( D_PAD* aPad, bool aDraw )
|
||||||
|
|
||||||
if( DIALOG_GLOBAL_PADS_EDITION::m_Pad_Layer_Filter )
|
if( DIALOG_GLOBAL_PADS_EDITION::m_Pad_Layer_Filter )
|
||||||
{
|
{
|
||||||
if( pt_pad->m_Masque_Layer != aPad->m_Masque_Layer )
|
if( pt_pad->m_layerMask != aPad->m_layerMask )
|
||||||
continue;
|
continue;
|
||||||
else
|
else
|
||||||
m_Pcb->m_Status_Pcb &=
|
m_Pcb->m_Status_Pcb &= ~( LISTE_RATSNEST_ITEM_OK | CONNEXION_OK);
|
||||||
~( LISTE_RATSNEST_ITEM_OK | CONNEXION_OK);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Change characteristics.: */
|
/* Change characteristics.: */
|
||||||
pt_pad->m_Attribut = aPad->m_Attribut;
|
pt_pad->m_Attribut = aPad->m_Attribut;
|
||||||
pt_pad->m_PadShape = aPad->m_PadShape;
|
pt_pad->m_PadShape = aPad->m_PadShape;
|
||||||
|
|
||||||
pt_pad->m_Masque_Layer = aPad->m_Masque_Layer;
|
pt_pad->m_layerMask = aPad->m_layerMask;
|
||||||
|
|
||||||
pt_pad->m_Size = aPad->m_Size;
|
pt_pad->m_Size = aPad->m_Size;
|
||||||
pt_pad->m_DeltaSize = aPad->m_DeltaSize;
|
pt_pad->m_DeltaSize = aPad->m_DeltaSize;
|
||||||
|
@ -269,7 +271,8 @@ void PCB_BASE_FRAME::Global_Import_Pad_Settings( D_PAD* aPad, bool aDraw )
|
||||||
pt_pad->ComputeShapeMaxRadius();
|
pt_pad->ComputeShapeMaxRadius();
|
||||||
}
|
}
|
||||||
|
|
||||||
Module->Set_Rectangle_Encadrement();
|
Module->CalculateBoundingBox();
|
||||||
|
|
||||||
if( aDraw )
|
if( aDraw )
|
||||||
DrawPanel->RefreshDrawingRect( Module->GetBoundingBox() );
|
DrawPanel->RefreshDrawingRect( Module->GetBoundingBox() );
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,10 +17,6 @@ static void Extract_Parameters( wxArrayString& param_list, char* text );
|
||||||
static bool TestFlags( const wxString& flg_string, long flg_mask, const wxChar* flg_name );
|
static bool TestFlags( const wxString& flg_string, long flg_mask, const wxChar* flg_name );
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************/
|
|
||||||
bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
|
|
||||||
/**************************************************************/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Read_GPCB_Descr
|
* Function Read_GPCB_Descr
|
||||||
* Read a footprint description in GPCB (Newlib) format
|
* Read a footprint description in GPCB (Newlib) format
|
||||||
|
@ -148,6 +144,7 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
|
||||||
* For pads, set to prevent a solderpaste stencil opening for the pad. Primarily
|
* For pads, set to prevent a solderpaste stencil opening for the pad. Primarily
|
||||||
* used for pads used as fiducials.
|
* used for pads used as fiducials.
|
||||||
*/
|
*/
|
||||||
|
bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
|
||||||
{
|
{
|
||||||
#define TEXT_DEFAULT_SIZE 400
|
#define TEXT_DEFAULT_SIZE 400
|
||||||
#define OLD_GPCB_UNIT_CONV 10
|
#define OLD_GPCB_UNIT_CONV 10
|
||||||
|
@ -187,6 +184,7 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
|
||||||
|
|
||||||
// Test symbol after "Element": if [ units = 0.01 mils, and if ( units = 1 mil
|
// Test symbol after "Element": if [ units = 0.01 mils, and if ( units = 1 mil
|
||||||
iprmcnt++;
|
iprmcnt++;
|
||||||
|
|
||||||
if( params[iprmcnt] == wxT( "(" ) )
|
if( params[iprmcnt] == wxT( "(" ) )
|
||||||
conv_unit = OLD_GPCB_UNIT_CONV;
|
conv_unit = OLD_GPCB_UNIT_CONV;
|
||||||
|
|
||||||
|
@ -212,6 +210,7 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
|
||||||
|
|
||||||
// Read other infos
|
// Read other infos
|
||||||
iprmcnt++;
|
iprmcnt++;
|
||||||
|
|
||||||
for( int ii = 0; ii < 6; ii++ )
|
for( int ii = 0; ii < 6; ii++ )
|
||||||
{
|
{
|
||||||
if( iprmcnt < icnt_max )
|
if( iprmcnt < icnt_max )
|
||||||
|
@ -220,7 +219,10 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
|
||||||
ibuf[ii] = 0;
|
ibuf[ii] = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
params[iprmcnt].ToLong( &ibuf[ii] );
|
params[iprmcnt].ToLong( &ibuf[ii] );
|
||||||
|
}
|
||||||
|
|
||||||
iprmcnt++;
|
iprmcnt++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,6 +269,7 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
|
||||||
for( unsigned ii = 0; ii < 5; ii++ )
|
for( unsigned ii = 0; ii < 5; ii++ )
|
||||||
{
|
{
|
||||||
long dim;
|
long dim;
|
||||||
|
|
||||||
if( ii < (params.GetCount() - 2) )
|
if( ii < (params.GetCount() - 2) )
|
||||||
{
|
{
|
||||||
if( params[ii + 2].ToLong( &dim ) )
|
if( params[ii + 2].ToLong( &dim ) )
|
||||||
|
@ -301,7 +304,7 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
|
||||||
ibuf[ii] = 0;
|
ibuf[ii] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int rayon = (ibuf[2] + ibuf[3]) / 4; // for and arc: ibuf[3] = ibuf[4]. pcbnew does not know ellipses
|
int radius = (ibuf[2] + ibuf[3]) / 4; // for and arc: ibuf[3] = ibuf[4]. pcbnew does not know ellipses
|
||||||
wxPoint centre;
|
wxPoint centre;
|
||||||
centre.x = wxRound( ibuf[0] * conv_unit );
|
centre.x = wxRound( ibuf[0] * conv_unit );
|
||||||
centre.y = wxRound( ibuf[1] * conv_unit );
|
centre.y = wxRound( ibuf[1] * conv_unit );
|
||||||
|
@ -309,7 +312,7 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
|
||||||
int start_angle = ibuf[4] * 10; // Pcbnew uses 0.1 degrees as units
|
int start_angle = ibuf[4] * 10; // Pcbnew uses 0.1 degrees as units
|
||||||
start_angle -= 1800; // Use normal X axis as reference
|
start_angle -= 1800; // Use normal X axis as reference
|
||||||
DrawSegm->m_Angle = ibuf[5] * 10; // Angle value is clockwise in gpcb and pcbnew
|
DrawSegm->m_Angle = ibuf[5] * 10; // Angle value is clockwise in gpcb and pcbnew
|
||||||
DrawSegm->m_End0.x = wxRound( rayon * conv_unit );
|
DrawSegm->m_End0.x = wxRound( radius * conv_unit );
|
||||||
DrawSegm->m_End0.y = 0;
|
DrawSegm->m_End0.y = 0;
|
||||||
RotatePoint( &DrawSegm->m_End0, -start_angle );// Calculate start point coordinate of arc
|
RotatePoint( &DrawSegm->m_End0, -start_angle );// Calculate start point coordinate of arc
|
||||||
DrawSegm->m_End0 += centre;
|
DrawSegm->m_End0 += centre;
|
||||||
|
@ -323,24 +326,28 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
|
||||||
{ // format: Pad [x1 y1 x2 y2 thickness clearance mask "name" "pad_number" flags]
|
{ // format: Pad [x1 y1 x2 y2 thickness clearance mask "name" "pad_number" flags]
|
||||||
Pad = new D_PAD( this );
|
Pad = new D_PAD( this );
|
||||||
Pad->m_PadShape = PAD_RECT;
|
Pad->m_PadShape = PAD_RECT;
|
||||||
Pad->m_Masque_Layer = LAYER_FRONT | SOLDERMASK_LAYER_FRONT | SOLDERPASTE_LAYER_FRONT;
|
Pad->m_layerMask = LAYER_FRONT | SOLDERMASK_LAYER_FRONT | SOLDERPASTE_LAYER_FRONT;
|
||||||
|
|
||||||
// Set shape from flags
|
// Set shape from flags
|
||||||
iflgidx = params.GetCount() - 2;
|
iflgidx = params.GetCount() - 2;
|
||||||
|
|
||||||
if( TestFlags( params[iflgidx], 0x0080, wxT( "onsolder" ) ) )
|
if( TestFlags( params[iflgidx], 0x0080, wxT( "onsolder" ) ) )
|
||||||
Pad->m_Masque_Layer = LAYER_BACK | SOLDERMASK_LAYER_BACK | SOLDERPASTE_LAYER_BACK;
|
Pad->m_layerMask = LAYER_BACK | SOLDERMASK_LAYER_BACK | SOLDERPASTE_LAYER_BACK;
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < 5; ii++ )
|
for( unsigned ii = 0; ii < 5; ii++ )
|
||||||
{
|
{
|
||||||
if( ii < params.GetCount() - 2 )
|
if( ii < params.GetCount() - 2 )
|
||||||
{
|
{
|
||||||
long dim;
|
long dim;
|
||||||
|
|
||||||
if( params[ii + 2].ToLong( &dim ) )
|
if( params[ii + 2].ToLong( &dim ) )
|
||||||
ibuf[ii] = wxRound( dim * conv_unit );
|
ibuf[ii] = wxRound( dim * conv_unit );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
ibuf[ii] = 0;
|
ibuf[ii] = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Read name:
|
// Read name:
|
||||||
// Currently unused
|
// Currently unused
|
||||||
|
@ -356,6 +363,7 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
|
||||||
Pad->m_Size.y = ibuf[4] + abs( ibuf[1] - ibuf[3] );
|
Pad->m_Size.y = ibuf[4] + abs( ibuf[1] - ibuf[3] );
|
||||||
Pad->m_Pos.x += m_Pos.x;
|
Pad->m_Pos.x += m_Pos.x;
|
||||||
Pad->m_Pos.y += m_Pos.y;
|
Pad->m_Pos.y += m_Pos.y;
|
||||||
|
|
||||||
if( !TestFlags( params[iflgidx], 0x0100, wxT( "square" ) ) )
|
if( !TestFlags( params[iflgidx], 0x0100, wxT( "square" ) ) )
|
||||||
{
|
{
|
||||||
if( Pad->m_Size.x == Pad->m_Size.y )
|
if( Pad->m_Size.x == Pad->m_Size.y )
|
||||||
|
@ -372,7 +380,7 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
|
||||||
{ // format: Pin[x y Thickness Clearance Mask DrillHole Name Number Flags]
|
{ // format: Pin[x y Thickness Clearance Mask DrillHole Name Number Flags]
|
||||||
Pad = new D_PAD( this );
|
Pad = new D_PAD( this );
|
||||||
Pad->m_PadShape = PAD_ROUND;
|
Pad->m_PadShape = PAD_ROUND;
|
||||||
Pad->m_Masque_Layer = ALL_CU_LAYERS |
|
Pad->m_layerMask = ALL_CU_LAYERS |
|
||||||
SILKSCREEN_LAYER_FRONT |
|
SILKSCREEN_LAYER_FRONT |
|
||||||
SOLDERMASK_LAYER_FRONT |
|
SOLDERMASK_LAYER_FRONT |
|
||||||
SOLDERMASK_LAYER_BACK;
|
SOLDERMASK_LAYER_BACK;
|
||||||
|
@ -390,8 +398,10 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
|
||||||
ibuf[ii] = wxRound( dim * conv_unit );
|
ibuf[ii] = wxRound( dim * conv_unit );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
ibuf[ii] = 0;
|
ibuf[ii] = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Read name:
|
// Read name:
|
||||||
// Currently unused
|
// Currently unused
|
||||||
|
@ -401,12 +411,14 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
|
||||||
{
|
{
|
||||||
strncpy( Pad->m_Padname, TO_UTF8( params[9] ), 4 );
|
strncpy( Pad->m_Padname, TO_UTF8( params[9] ), 4 );
|
||||||
}
|
}
|
||||||
|
|
||||||
Pad->m_Pos.x = ibuf[0];
|
Pad->m_Pos.x = ibuf[0];
|
||||||
Pad->m_Pos.y = ibuf[1];
|
Pad->m_Pos.y = ibuf[1];
|
||||||
Pad->m_Drill.x = Pad->m_Drill.y = ibuf[5];
|
Pad->m_Drill.x = Pad->m_Drill.y = ibuf[5];
|
||||||
Pad->m_Size.x = Pad->m_Size.y = ibuf[3] + Pad->m_Drill.x;
|
Pad->m_Size.x = Pad->m_Size.y = ibuf[3] + Pad->m_Drill.x;
|
||||||
Pad->m_Pos.x += m_Pos.x;
|
Pad->m_Pos.x += m_Pos.x;
|
||||||
Pad->m_Pos.y += m_Pos.y;
|
Pad->m_Pos.y += m_Pos.y;
|
||||||
|
|
||||||
if( (Pad->m_PadShape == PAD_ROUND) && (Pad->m_Size.x != Pad->m_Size.y) )
|
if( (Pad->m_PadShape == PAD_ROUND) && (Pad->m_Size.x != Pad->m_Size.y) )
|
||||||
Pad->m_PadShape = PAD_OVAL;
|
Pad->m_PadShape = PAD_OVAL;
|
||||||
|
|
||||||
|
@ -417,6 +429,7 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
|
||||||
|
|
||||||
if( m_Value->m_Text.IsEmpty() )
|
if( m_Value->m_Text.IsEmpty() )
|
||||||
m_Value->m_Text = wxT( "Val**" );
|
m_Value->m_Text = wxT( "Val**" );
|
||||||
|
|
||||||
if( m_Reference->m_Text.IsEmpty() )
|
if( m_Reference->m_Text.IsEmpty() )
|
||||||
{
|
{
|
||||||
wxFileName filename( CmpFullFileName );
|
wxFileName filename( CmpFullFileName );
|
||||||
|
@ -424,15 +437,11 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Recalculate the bounding box */
|
/* Recalculate the bounding box */
|
||||||
Set_Rectangle_Encadrement();
|
CalculateBoundingBox();
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************/
|
|
||||||
static void Extract_Parameters( wxArrayString& param_list, char* text )
|
|
||||||
/***********************************************************************/
|
|
||||||
|
|
||||||
/* Read a text line and extract params and tokens.
|
/* Read a text line and extract params and tokens.
|
||||||
* special chars are:
|
* special chars are:
|
||||||
* [ ] ( ) Begin and end of parameter list and units indicator
|
* [ ] ( ) Begin and end of parameter list and units indicator
|
||||||
|
@ -443,6 +452,7 @@ static void Extract_Parameters( wxArrayString& param_list, char* text )
|
||||||
* other are parameters (number or delimited string)
|
* other are parameters (number or delimited string)
|
||||||
* last parameter is ) or ]
|
* last parameter is ) or ]
|
||||||
*/
|
*/
|
||||||
|
static void Extract_Parameters( wxArrayString& param_list, char* text )
|
||||||
{
|
{
|
||||||
char key;
|
char key;
|
||||||
wxString tmp;
|
wxString tmp;
|
||||||
|
@ -484,6 +494,7 @@ static void Extract_Parameters( wxArrayString& param_list, char* text )
|
||||||
{
|
{
|
||||||
key = *text;
|
key = *text;
|
||||||
text++;
|
text++;
|
||||||
|
|
||||||
if( key == '"' )
|
if( key == '"' )
|
||||||
{
|
{
|
||||||
param_list.Add( tmp );
|
param_list.Add( tmp );
|
||||||
|
@ -491,8 +502,10 @@ static void Extract_Parameters( wxArrayString& param_list, char* text )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
tmp.Append( key );
|
tmp.Append( key );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -504,10 +517,6 @@ static void Extract_Parameters( wxArrayString& param_list, char* text )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************************/
|
|
||||||
bool TestFlags( const wxString& flg_string, long flg_mask, const wxChar* flg_name )
|
|
||||||
/***********************************************************************************/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function TestFlags
|
* Function TestFlags
|
||||||
* Test flag flg_mask or flg_name.
|
* Test flag flg_mask or flg_name.
|
||||||
|
@ -518,19 +527,23 @@ bool TestFlags( const wxString& flg_string, long flg_mask, const wxChar* flg_nam
|
||||||
* @param flg_name = flag name to find in list
|
* @param flg_name = flag name to find in list
|
||||||
* @return true if found
|
* @return true if found
|
||||||
*/
|
*/
|
||||||
|
bool TestFlags( const wxString& flg_string, long flg_mask, const wxChar* flg_name )
|
||||||
{
|
{
|
||||||
wxString strnumber;
|
wxString strnumber;
|
||||||
|
|
||||||
if( flg_string.StartsWith( wxT( "0x" ),
|
if( flg_string.StartsWith( wxT( "0x" ), &strnumber )
|
||||||
&strnumber ) || flg_string.StartsWith( wxT( "0X" ), &strnumber ) )
|
|| flg_string.StartsWith( wxT( "0X" ), &strnumber ) )
|
||||||
{
|
{
|
||||||
long lflags;
|
long lflags;
|
||||||
|
|
||||||
if( strnumber.ToLong( &lflags, 16 ) )
|
if( strnumber.ToLong( &lflags, 16 ) )
|
||||||
if( lflags & flg_mask )
|
if( lflags & flg_mask )
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if( flg_string.Contains( flg_name ) )
|
else if( flg_string.Contains( flg_name ) )
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ static void TraceFilledCercle( BOARD* Pcb,
|
||||||
int cx,
|
int cx,
|
||||||
int cy,
|
int cy,
|
||||||
int radius,
|
int radius,
|
||||||
int masque_layer,
|
int aLayerMask,
|
||||||
int color,
|
int color,
|
||||||
int op_logique );
|
int op_logique );
|
||||||
static void TraceCercle( int ux0, int uy0, int ux1, int uy1, int lg, int layer,
|
static void TraceCercle( int ux0, int uy0, int ux1, int uy1, int lg, int layer,
|
||||||
|
@ -102,7 +102,7 @@ void Place_1_Pad_Board( BOARD* Pcb,
|
||||||
if( pt_pad->m_PadShape == PAD_CIRCLE )
|
if( pt_pad->m_PadShape == PAD_CIRCLE )
|
||||||
{
|
{
|
||||||
TraceFilledCercle( Pcb, shape_pos.x, shape_pos.y, dx,
|
TraceFilledCercle( Pcb, shape_pos.x, shape_pos.y, dx,
|
||||||
pt_pad->m_Masque_Layer, color, op_logique );
|
pt_pad->m_layerMask, color, op_logique );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,14 +126,14 @@ void Place_1_Pad_Board( BOARD* Pcb,
|
||||||
|
|
||||||
TraceFilledRectangle( Pcb, shape_pos.x - dx, shape_pos.y - dy,
|
TraceFilledRectangle( Pcb, shape_pos.x - dx, shape_pos.y - dy,
|
||||||
shape_pos.x + dx, shape_pos.y + dy,
|
shape_pos.x + dx, shape_pos.y + dy,
|
||||||
pt_pad->m_Masque_Layer, color, op_logique );
|
pt_pad->m_layerMask, color, op_logique );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TraceFilledRectangle( Pcb, shape_pos.x - dx, shape_pos.y - dy,
|
TraceFilledRectangle( Pcb, shape_pos.x - dx, shape_pos.y - dy,
|
||||||
shape_pos.x + dx, shape_pos.y + dy,
|
shape_pos.x + dx, shape_pos.y + dy,
|
||||||
(int) pt_pad->m_Orient,
|
(int) pt_pad->m_Orient,
|
||||||
pt_pad->m_Masque_Layer, color, op_logique );
|
pt_pad->m_layerMask, color, op_logique );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,7 +142,7 @@ void Place_1_Pad_Board( BOARD* Pcb,
|
||||||
* circle center cx, cy.
|
* circle center cx, cy.
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* radius: a value add to the radius or half the score pad
|
* radius: a value add to the radius or half the score pad
|
||||||
* masque_layer: layer occupied
|
* aLayerMask: layer occupied
|
||||||
* color: mask write in cells
|
* color: mask write in cells
|
||||||
* op_logique: type of writing in the cell (WRITE, OR)
|
* op_logique: type of writing in the cell (WRITE, OR)
|
||||||
*/
|
*/
|
||||||
|
@ -150,7 +150,7 @@ void TraceFilledCercle( BOARD* Pcb,
|
||||||
int cx,
|
int cx,
|
||||||
int cy,
|
int cy,
|
||||||
int radius,
|
int radius,
|
||||||
int masque_layer,
|
int aLayerMask,
|
||||||
int color,
|
int color,
|
||||||
int op_logique )
|
int op_logique )
|
||||||
{
|
{
|
||||||
|
@ -169,10 +169,10 @@ void TraceFilledCercle( BOARD* Pcb,
|
||||||
/* Single routing layer on bitmap and BOTTOM
|
/* Single routing layer on bitmap and BOTTOM
|
||||||
* Route_Layer_B = Route_Layer_A */
|
* Route_Layer_B = Route_Layer_A */
|
||||||
|
|
||||||
if( masque_layer & g_TabOneLayerMask[Route_Layer_BOTTOM] )
|
if( aLayerMask & g_TabOneLayerMask[Route_Layer_BOTTOM] )
|
||||||
trace = 1; /* Trace on BOTTOM */
|
trace = 1; /* Trace on BOTTOM */
|
||||||
|
|
||||||
if( masque_layer & g_TabOneLayerMask[Route_Layer_TOP] )
|
if( aLayerMask & g_TabOneLayerMask[Route_Layer_TOP] )
|
||||||
if( Nb_Sides )
|
if( Nb_Sides )
|
||||||
trace |= 2; /* Trace on TOP */
|
trace |= 2; /* Trace on TOP */
|
||||||
|
|
||||||
|
@ -528,7 +528,7 @@ void TraceLignePcb( int x0,
|
||||||
* Contact PCBs.
|
* Contact PCBs.
|
||||||
*/
|
*/
|
||||||
void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1,
|
void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1,
|
||||||
int masque_layer, int color, int op_logique )
|
int aLayerMask, int color, int op_logique )
|
||||||
{
|
{
|
||||||
int row, col;
|
int row, col;
|
||||||
int row_min, row_max, col_min, col_max;
|
int row_min, row_max, col_min, col_max;
|
||||||
|
@ -536,10 +536,10 @@ void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1,
|
||||||
|
|
||||||
void (* WriteCell)( int, int, int, MATRIX_CELL );
|
void (* WriteCell)( int, int, int, MATRIX_CELL );
|
||||||
|
|
||||||
if( masque_layer & g_TabOneLayerMask[Route_Layer_BOTTOM] )
|
if( aLayerMask & g_TabOneLayerMask[Route_Layer_BOTTOM] )
|
||||||
trace = 1; /* Trace on BOTTOM */
|
trace = 1; /* Trace on BOTTOM */
|
||||||
|
|
||||||
if( ( masque_layer & g_TabOneLayerMask[Route_Layer_TOP] ) && Nb_Sides )
|
if( ( aLayerMask & g_TabOneLayerMask[Route_Layer_TOP] ) && Nb_Sides )
|
||||||
trace |= 2; /* Trace on TOP */
|
trace |= 2; /* Trace on TOP */
|
||||||
|
|
||||||
if( trace == 0 )
|
if( trace == 0 )
|
||||||
|
@ -615,7 +615,7 @@ void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1,
|
||||||
* contact PCBs.
|
* contact PCBs.
|
||||||
*/
|
*/
|
||||||
void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1,
|
void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1,
|
||||||
int angle, int masque_layer, int color,
|
int angle, int aLayerMask, int color,
|
||||||
int op_logique )
|
int op_logique )
|
||||||
{
|
{
|
||||||
int row, col;
|
int row, col;
|
||||||
|
@ -627,10 +627,10 @@ void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1,
|
||||||
|
|
||||||
void (* WriteCell)( int, int, int, MATRIX_CELL );
|
void (* WriteCell)( int, int, int, MATRIX_CELL );
|
||||||
|
|
||||||
if( masque_layer & g_TabOneLayerMask[Route_Layer_BOTTOM] )
|
if( aLayerMask & g_TabOneLayerMask[Route_Layer_BOTTOM] )
|
||||||
trace = 1; /* Trace on BOTTOM */
|
trace = 1; /* Trace on BOTTOM */
|
||||||
|
|
||||||
if( masque_layer & g_TabOneLayerMask[Route_Layer_TOP] )
|
if( aLayerMask & g_TabOneLayerMask[Route_Layer_TOP] )
|
||||||
if( Nb_Sides )
|
if( Nb_Sides )
|
||||||
trace |= 2; /* Trace on TOP */
|
trace |= 2; /* Trace on TOP */
|
||||||
|
|
||||||
|
|
|
@ -663,7 +663,7 @@ bool PCB_EDIT_FRAME::OnHotkeyEditItem( int aIdCommand )
|
||||||
evt_type = ID_POPUP_PCB_EDIT_MODULE;
|
evt_type = ID_POPUP_PCB_EDIT_MODULE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_MIRE:
|
case PCB_TARGET_T:
|
||||||
if( aIdCommand == HK_EDIT_ITEM )
|
if( aIdCommand == HK_EDIT_ITEM )
|
||||||
evt_type = ID_POPUP_PCB_EDIT_MIRE;
|
evt_type = ID_POPUP_PCB_EDIT_MIRE;
|
||||||
break;
|
break;
|
||||||
|
@ -757,8 +757,10 @@ bool PCB_EDIT_FRAME::OnHotkeyMoveItem( int aIdCommand )
|
||||||
// the parent.
|
// the parent.
|
||||||
if( aIdCommand == HK_MOVE_ITEM )
|
if( aIdCommand == HK_MOVE_ITEM )
|
||||||
evt_type = ID_POPUP_PCB_MOVE_MODULE_REQUEST;
|
evt_type = ID_POPUP_PCB_MOVE_MODULE_REQUEST;
|
||||||
|
|
||||||
if( aIdCommand == HK_DRAG_ITEM )
|
if( aIdCommand == HK_DRAG_ITEM )
|
||||||
evt_type = ID_POPUP_PCB_DRAG_MODULE_REQUEST;
|
evt_type = ID_POPUP_PCB_DRAG_MODULE_REQUEST;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_TEXTE:
|
case TYPE_TEXTE:
|
||||||
|
@ -766,7 +768,7 @@ bool PCB_EDIT_FRAME::OnHotkeyMoveItem( int aIdCommand )
|
||||||
evt_type = ID_POPUP_PCB_MOVE_TEXTEPCB_REQUEST;
|
evt_type = ID_POPUP_PCB_MOVE_TEXTEPCB_REQUEST;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_MIRE:
|
case PCB_TARGET_T:
|
||||||
if( aIdCommand == HK_MOVE_ITEM )
|
if( aIdCommand == HK_MOVE_ITEM )
|
||||||
evt_type = ID_POPUP_PCB_MOVE_MIRE_REQUEST;
|
evt_type = ID_POPUP_PCB_MOVE_MIRE_REQUEST;
|
||||||
break;
|
break;
|
||||||
|
@ -849,8 +851,8 @@ bool PCB_EDIT_FRAME::OnHotkeyPlaceItem( wxDC* aDC )
|
||||||
Place_Module( (MODULE*) item, aDC );
|
Place_Module( (MODULE*) item, aDC );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_MIRE:
|
case PCB_TARGET_T:
|
||||||
Place_Mire( (MIREPCB*) item, aDC );
|
PlaceTarget( (PCB_TARGET*) item, aDC );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_DRAWSEGMENT:
|
case TYPE_DRAWSEGMENT:
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
bool PCB_EDIT_FRAME::Clear_Pcb( bool aQuery )
|
bool PCB_EDIT_FRAME::Clear_Pcb( bool aQuery )
|
||||||
{
|
{
|
||||||
if( GetBoard() == NULL )
|
if( GetBoard() == NULL )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
if( aQuery )
|
if( aQuery )
|
||||||
{
|
{
|
||||||
|
@ -31,7 +31,7 @@ bool PCB_EDIT_FRAME::Clear_Pcb( bool aQuery )
|
||||||
{
|
{
|
||||||
if( !IsOK( this,
|
if( !IsOK( this,
|
||||||
_( "Current Board will be lost and this operation cannot be undone. Continue ?" ) ) )
|
_( "Current Board will be lost and this operation cannot be undone. Continue ?" ) ) )
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ bool PCB_EDIT_FRAME::Clear_Pcb( bool aQuery )
|
||||||
bool FOOTPRINT_EDIT_FRAME::Clear_Pcb( bool aQuery )
|
bool FOOTPRINT_EDIT_FRAME::Clear_Pcb( bool aQuery )
|
||||||
{
|
{
|
||||||
if( GetBoard() == NULL )
|
if( GetBoard() == NULL )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
if( aQuery && GetScreen()->IsModify() )
|
if( aQuery && GetScreen()->IsModify() )
|
||||||
{
|
{
|
||||||
|
@ -82,7 +82,7 @@ bool FOOTPRINT_EDIT_FRAME::Clear_Pcb( bool aQuery )
|
||||||
{
|
{
|
||||||
if( !IsOK( this,
|
if( !IsOK( this,
|
||||||
_( "Current Footprint will be lost and this operation cannot be undone. Continue ?" ) ) )
|
_( "Current Footprint will be lost and this operation cannot be undone. Continue ?" ) ) )
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -149,8 +149,7 @@ int PCB_BASE_FRAME::ReadListeSegmentDescr( LINE_READER* aReader,
|
||||||
|
|
||||||
case TYPE_ZONE: // this is now deprecated, but exits in old boards
|
case TYPE_ZONE: // this is now deprecated, but exits in old boards
|
||||||
newTrack = new SEGZONE( GetBoard() );
|
newTrack = new SEGZONE( GetBoard() );
|
||||||
GetBoard()->m_Zone.Insert( (SEGZONE*) newTrack,
|
GetBoard()->m_Zone.Insert( (SEGZONE*) newTrack, (SEGZONE*) insertBeforeMe );
|
||||||
(SEGZONE*) insertBeforeMe );
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,8 +173,7 @@ int PCB_BASE_FRAME::ReadListeSegmentDescr( LINE_READER* aReader,
|
||||||
if( makeType == TYPE_VIA ) // Ensure layers are OK when possible:
|
if( makeType == TYPE_VIA ) // Ensure layers are OK when possible:
|
||||||
{
|
{
|
||||||
if( newTrack->Shape() == VIA_THROUGH )
|
if( newTrack->Shape() == VIA_THROUGH )
|
||||||
( (SEGVIA*) newTrack )->SetLayerPair( LAYER_N_FRONT,
|
( (SEGVIA*) newTrack )->SetLayerPair( LAYER_N_FRONT, LAYER_N_BACK );
|
||||||
LAYER_N_BACK );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
newTrack->SetNet( net_code );
|
newTrack->SetNet( net_code );
|
||||||
|
@ -195,6 +193,7 @@ int PCB_BASE_FRAME::ReadGeneralDescrPcb( LINE_READER* aReader )
|
||||||
{
|
{
|
||||||
Line = aReader->Line();
|
Line = aReader->Line();
|
||||||
data = strtok( Line, " =\n\r" );
|
data = strtok( Line, " =\n\r" );
|
||||||
|
|
||||||
if( strnicmp( data, "$EndGENERAL", 10 ) == 0 )
|
if( strnicmp( data, "$EndGENERAL", 10 ) == 0 )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -218,10 +217,12 @@ int PCB_BASE_FRAME::ReadGeneralDescrPcb( LINE_READER* aReader )
|
||||||
|
|
||||||
// Setup layer count
|
// Setup layer count
|
||||||
int layer_count = 0;
|
int layer_count = 0;
|
||||||
|
|
||||||
for( ii = 0; ii < NB_COPPER_LAYERS; ii++ )
|
for( ii = 0; ii < NB_COPPER_LAYERS; ii++ )
|
||||||
{
|
{
|
||||||
if( Masque_Layer & 1 )
|
if( Masque_Layer & 1 )
|
||||||
layer_count++;
|
layer_count++;
|
||||||
|
|
||||||
Masque_Layer >>= 1;
|
Masque_Layer >>= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,6 +230,7 @@ int PCB_BASE_FRAME::ReadGeneralDescrPcb( LINE_READER* aReader )
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( stricmp( data, "BoardThickness" ) == 0 )
|
if( stricmp( data, "BoardThickness" ) == 0 )
|
||||||
{
|
{
|
||||||
data = strtok( NULL, " =\n\r" );
|
data = strtok( NULL, " =\n\r" );
|
||||||
|
@ -257,11 +259,9 @@ int PCB_BASE_FRAME::ReadGeneralDescrPcb( LINE_READER* aReader )
|
||||||
data = strtok( NULL, " =\n\r" );
|
data = strtok( NULL, " =\n\r" );
|
||||||
GetBoard()->m_BoundaryBox.SetY( atoi( data ) );
|
GetBoard()->m_BoundaryBox.SetY( atoi( data ) );
|
||||||
data = strtok( NULL, " =\n\r" );
|
data = strtok( NULL, " =\n\r" );
|
||||||
GetBoard()->m_BoundaryBox.SetWidth(
|
GetBoard()->m_BoundaryBox.SetWidth( atoi( data ) - GetBoard()->m_BoundaryBox.GetX() );
|
||||||
atoi( data ) - GetBoard()->m_BoundaryBox.GetX() );
|
|
||||||
data = strtok( NULL, " =\n\r" );
|
data = strtok( NULL, " =\n\r" );
|
||||||
GetBoard()->m_BoundaryBox.SetHeight(
|
GetBoard()->m_BoundaryBox.SetHeight( atoi( data ) - GetBoard()->m_BoundaryBox.GetY() );
|
||||||
atoi( data ) - GetBoard()->m_BoundaryBox.GetY() );
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -367,8 +367,10 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader )
|
||||||
int gx = 0, gy = 0;
|
int gx = 0, gy = 0;
|
||||||
gx = atoi( data );
|
gx = atoi( data );
|
||||||
data = strtok( NULL, " =\n\r" );
|
data = strtok( NULL, " =\n\r" );
|
||||||
|
|
||||||
if( data )
|
if( data )
|
||||||
gy = atoi( data );
|
gy = atoi( data );
|
||||||
|
|
||||||
m_Auxiliary_Axis_Position.x = gx;
|
m_Auxiliary_Axis_Position.x = gx;
|
||||||
m_Auxiliary_Axis_Position.y = gy;
|
m_Auxiliary_Axis_Position.y = gy;
|
||||||
continue;
|
continue;
|
||||||
|
@ -398,12 +400,14 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader )
|
||||||
GetBoard()->SetLayerName( layer, layerName );
|
GetBoard()->SetLayerName( layer, layerName );
|
||||||
|
|
||||||
data = strtok( NULL, " \n\r" );
|
data = strtok( NULL, " \n\r" );
|
||||||
|
|
||||||
if( data )
|
if( data )
|
||||||
{
|
{
|
||||||
LAYER_T type = LAYER::ParseType( data );
|
LAYER_T type = LAYER::ParseType( data );
|
||||||
GetBoard()->SetLayerType( layer, type );
|
GetBoard()->SetLayerType( layer, type );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -477,11 +481,13 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader )
|
||||||
VIA_DIMENSION via_dim;
|
VIA_DIMENSION via_dim;
|
||||||
via_dim.m_Diameter = tmp;
|
via_dim.m_Diameter = tmp;
|
||||||
data = strtok( NULL, " \n\r" );
|
data = strtok( NULL, " \n\r" );
|
||||||
|
|
||||||
if( data )
|
if( data )
|
||||||
{
|
{
|
||||||
tmp = atoi( data );
|
tmp = atoi( data );
|
||||||
via_dim.m_Drill = tmp > 0 ? tmp : 0;
|
via_dim.m_Drill = tmp > 0 ? tmp : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetBoard()->m_ViasDimensionsList.push_back( via_dim );
|
GetBoard()->m_ViasDimensionsList.push_back( via_dim );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -567,16 +573,19 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader )
|
||||||
g_Pad_Master.m_Drill.y = g_Pad_Master.m_Drill.x;
|
g_Pad_Master.m_Drill.y = g_Pad_Master.m_Drill.x;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( stricmp( Line, "Pad2MaskClearance" ) == 0 )
|
if( stricmp( Line, "Pad2MaskClearance" ) == 0 )
|
||||||
{
|
{
|
||||||
GetBoard()->GetBoardDesignSettings()->m_SolderMaskMargin = atoi( data );
|
GetBoard()->GetBoardDesignSettings()->m_SolderMaskMargin = atoi( data );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( stricmp( Line, "Pad2PasteClearance" ) == 0 )
|
if( stricmp( Line, "Pad2PasteClearance" ) == 0 )
|
||||||
{
|
{
|
||||||
GetBoard()->GetBoardDesignSettings()->m_SolderPasteMargin = atoi( data );
|
GetBoard()->GetBoardDesignSettings()->m_SolderPasteMargin = atoi( data );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( stricmp( Line, "Pad2PasteClearanceRatio" ) == 0 )
|
if( stricmp( Line, "Pad2PasteClearanceRatio" ) == 0 )
|
||||||
{
|
{
|
||||||
GetBoard()->GetBoardDesignSettings()->m_SolderPasteMarginRatio = atof( data );
|
GetBoard()->GetBoardDesignSettings()->m_SolderPasteMarginRatio = atof( data );
|
||||||
|
@ -606,30 +615,23 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader )
|
||||||
* Sort lists by by increasing value and remove duplicates
|
* Sort lists by by increasing value and remove duplicates
|
||||||
* (the first value is not tested, because it is the netclass value
|
* (the first value is not tested, because it is the netclass value
|
||||||
*/
|
*/
|
||||||
sort( GetBoard()->m_ViasDimensionsList.begin() + 1,
|
sort( GetBoard()->m_ViasDimensionsList.begin() + 1, GetBoard()->m_ViasDimensionsList.end() );
|
||||||
GetBoard()->m_ViasDimensionsList.end() );
|
sort( GetBoard()->m_TrackWidthList.begin() + 1, GetBoard()->m_TrackWidthList.end() );
|
||||||
sort( GetBoard()->m_TrackWidthList.begin() + 1,
|
|
||||||
GetBoard()->m_TrackWidthList.end() );
|
for( unsigned ii = 1; ii < GetBoard()->m_ViasDimensionsList.size() - 1; ii++ )
|
||||||
for( unsigned ii = 1;
|
|
||||||
ii < GetBoard()->m_ViasDimensionsList.size() - 1;
|
|
||||||
ii++ )
|
|
||||||
{
|
{
|
||||||
if( GetBoard()->m_ViasDimensionsList[ii]
|
if( GetBoard()->m_ViasDimensionsList[ii] == GetBoard()->m_ViasDimensionsList[ii + 1] )
|
||||||
== GetBoard()->m_ViasDimensionsList[ii + 1] )
|
|
||||||
{
|
{
|
||||||
GetBoard()->m_ViasDimensionsList.erase(
|
GetBoard()->m_ViasDimensionsList.erase( GetBoard()->m_ViasDimensionsList.begin() + ii );
|
||||||
GetBoard()->m_ViasDimensionsList.begin() + ii );
|
|
||||||
ii--;
|
ii--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for( unsigned ii = 1; ii < GetBoard()->m_TrackWidthList.size() - 1; ii++ )
|
for( unsigned ii = 1; ii < GetBoard()->m_TrackWidthList.size() - 1; ii++ )
|
||||||
{
|
{
|
||||||
if( GetBoard()->m_TrackWidthList[ii]
|
if( GetBoard()->m_TrackWidthList[ii] == GetBoard()->m_TrackWidthList[ii + 1] )
|
||||||
== GetBoard()->m_TrackWidthList[ii + 1] )
|
|
||||||
{
|
{
|
||||||
GetBoard()->m_TrackWidthList.erase(
|
GetBoard()->m_TrackWidthList.erase( GetBoard()->m_TrackWidthList.begin() + ii );
|
||||||
GetBoard()->m_TrackWidthList.begin() + ii );
|
|
||||||
ii--;
|
ii--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -650,8 +652,7 @@ static int WriteSetup( FILE* aFile, PCB_BASE_FRAME* aFrame, BOARD* aBoard )
|
||||||
|
|
||||||
fprintf( aFile, "Layers %d\n", aBoard->GetCopperLayerCount() );
|
fprintf( aFile, "Layers %d\n", aBoard->GetCopperLayerCount() );
|
||||||
|
|
||||||
unsigned layerMask =
|
unsigned layerMask = g_TabAllCopperLayerMask[aBoard->GetCopperLayerCount() - 1];
|
||||||
g_TabAllCopperLayerMask[aBoard->GetCopperLayerCount() - 1];
|
|
||||||
|
|
||||||
for( int layer = 0; layerMask; ++layer, layerMask >>= 1 )
|
for( int layer = 0; layerMask; ++layer, layerMask >>= 1 )
|
||||||
{
|
{
|
||||||
|
@ -663,27 +664,22 @@ static int WriteSetup( FILE* aFile, PCB_BASE_FRAME* aFrame, BOARD* aBoard )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save current default track width, for compatibility with older
|
// Save current default track width, for compatibility with older pcbnew version;
|
||||||
// pcbnew version;
|
|
||||||
fprintf( aFile, "TrackWidth %d\n", aBoard->GetCurrentTrackWidth() );
|
fprintf( aFile, "TrackWidth %d\n", aBoard->GetCurrentTrackWidth() );
|
||||||
|
|
||||||
// Save custom tracks width list (the first is not saved here: this is the
|
// Save custom tracks width list (the first is not saved here: this is the netclass value
|
||||||
// netclass value
|
|
||||||
for( unsigned ii = 1; ii < aBoard->m_TrackWidthList.size(); ii++ )
|
for( unsigned ii = 1; ii < aBoard->m_TrackWidthList.size(); ii++ )
|
||||||
fprintf( aFile, "TrackWidthList %d\n", aBoard->m_TrackWidthList[ii] );
|
fprintf( aFile, "TrackWidthList %d\n", aBoard->m_TrackWidthList[ii] );
|
||||||
|
|
||||||
|
|
||||||
fprintf( aFile, "TrackClearence %d\n", netclass_default->GetClearance() );
|
fprintf( aFile, "TrackClearence %d\n", netclass_default->GetClearance() );
|
||||||
fprintf( aFile,
|
fprintf( aFile, "ZoneClearence %d\n", g_Zone_Default_Setting.m_ZoneClearance );
|
||||||
"ZoneClearence %d\n",
|
|
||||||
g_Zone_Default_Setting.m_ZoneClearance );
|
|
||||||
fprintf( aFile, "TrackMinWidth %d\n", aBoard->GetBoardDesignSettings()->m_TrackMinWidth );
|
fprintf( aFile, "TrackMinWidth %d\n", aBoard->GetBoardDesignSettings()->m_TrackMinWidth );
|
||||||
|
|
||||||
fprintf( aFile, "DrawSegmWidth %d\n", aBoard->GetBoardDesignSettings()->m_DrawSegmentWidth );
|
fprintf( aFile, "DrawSegmWidth %d\n", aBoard->GetBoardDesignSettings()->m_DrawSegmentWidth );
|
||||||
fprintf( aFile, "EdgeSegmWidth %d\n", aBoard->GetBoardDesignSettings()->m_EdgeSegmentWidth );
|
fprintf( aFile, "EdgeSegmWidth %d\n", aBoard->GetBoardDesignSettings()->m_EdgeSegmentWidth );
|
||||||
|
|
||||||
// Save current default via size, for compatibility with older pcbnew
|
// Save current default via size, for compatibility with older pcbnew version;
|
||||||
// version;
|
|
||||||
fprintf( aFile, "ViaSize %d\n", netclass_default->GetViaDiameter() );
|
fprintf( aFile, "ViaSize %d\n", netclass_default->GetViaDiameter() );
|
||||||
fprintf( aFile, "ViaDrill %d\n", netclass_default->GetViaDrill() );
|
fprintf( aFile, "ViaDrill %d\n", netclass_default->GetViaDrill() );
|
||||||
fprintf( aFile, "ViaMinSize %d\n", aBoard->GetBoardDesignSettings()->m_ViasMinSize );
|
fprintf( aFile, "ViaMinSize %d\n", aBoard->GetBoardDesignSettings()->m_ViasMinSize );
|
||||||
|
@ -718,18 +714,17 @@ static int WriteSetup( FILE* aFile, PCB_BASE_FRAME* aFrame, BOARD* aBoard )
|
||||||
fprintf( aFile, "EdgeModWidth %d\n", g_ModuleSegmentWidth );
|
fprintf( aFile, "EdgeModWidth %d\n", g_ModuleSegmentWidth );
|
||||||
fprintf( aFile, "TextModSize %d %d\n", g_ModuleTextSize.x, g_ModuleTextSize.y );
|
fprintf( aFile, "TextModSize %d %d\n", g_ModuleTextSize.x, g_ModuleTextSize.y );
|
||||||
fprintf( aFile, "TextModWidth %d\n", g_ModuleTextWidth );
|
fprintf( aFile, "TextModWidth %d\n", g_ModuleTextWidth );
|
||||||
fprintf( aFile,
|
fprintf( aFile, "PadSize %d %d\n", g_Pad_Master.m_Size.x, g_Pad_Master.m_Size.y );
|
||||||
"PadSize %d %d\n",
|
|
||||||
g_Pad_Master.m_Size.x,
|
|
||||||
g_Pad_Master.m_Size.y );
|
|
||||||
fprintf( aFile, "PadDrill %d\n", g_Pad_Master.m_Drill.x );
|
fprintf( aFile, "PadDrill %d\n", g_Pad_Master.m_Drill.x );
|
||||||
fprintf( aFile,
|
fprintf( aFile,
|
||||||
"Pad2MaskClearance %d\n",
|
"Pad2MaskClearance %d\n",
|
||||||
aBoard->GetBoardDesignSettings()->m_SolderMaskMargin );
|
aBoard->GetBoardDesignSettings()->m_SolderMaskMargin );
|
||||||
|
|
||||||
if( aBoard->GetBoardDesignSettings()->m_SolderPasteMargin != 0 )
|
if( aBoard->GetBoardDesignSettings()->m_SolderPasteMargin != 0 )
|
||||||
fprintf( aFile,
|
fprintf( aFile,
|
||||||
"Pad2PasteClearance %d\n",
|
"Pad2PasteClearance %d\n",
|
||||||
aBoard->GetBoardDesignSettings()->m_SolderPasteMargin );
|
aBoard->GetBoardDesignSettings()->m_SolderPasteMargin );
|
||||||
|
|
||||||
if( aBoard->GetBoardDesignSettings()->m_SolderPasteMarginRatio != 0 )
|
if( aBoard->GetBoardDesignSettings()->m_SolderPasteMarginRatio != 0 )
|
||||||
fprintf( aFile,
|
fprintf( aFile,
|
||||||
"Pad2PasteClearanceRatio %g\n",
|
"Pad2PasteClearanceRatio %g\n",
|
||||||
|
@ -756,7 +751,6 @@ static int WriteSetup( FILE* aFile, PCB_BASE_FRAME* aFrame, BOARD* aBoard )
|
||||||
record.Replace( wxT("\n"), wxT(""), true );
|
record.Replace( wxT("\n"), wxT(""), true );
|
||||||
record.Replace( wxT(" "), wxT(" "), true);
|
record.Replace( wxT(" "), wxT(" "), true);
|
||||||
fprintf( aFile, "PcbPlotParams %s\n", TO_UTF8( record ) );
|
fprintf( aFile, "PcbPlotParams %s\n", TO_UTF8( record ) );
|
||||||
|
|
||||||
fprintf( aFile, "$EndSETUP\n\n" );
|
fprintf( aFile, "$EndSETUP\n\n" );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -799,20 +793,18 @@ bool PCB_EDIT_FRAME::WriteGeneralDescrPcb( FILE* File )
|
||||||
NbModules++;
|
NbModules++;
|
||||||
|
|
||||||
PtStruct = GetBoard()->m_Drawings; NbDrawItem = 0;
|
PtStruct = GetBoard()->m_Drawings; NbDrawItem = 0;
|
||||||
|
|
||||||
for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
|
for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
|
||||||
NbDrawItem++;
|
NbDrawItem++;
|
||||||
|
|
||||||
fprintf( File, "Ndraw %d\n", NbDrawItem );
|
fprintf( File, "Ndraw %d\n", NbDrawItem );
|
||||||
fprintf( File, "Ntrack %d\n", GetBoard()->GetNumSegmTrack() );
|
fprintf( File, "Ntrack %d\n", GetBoard()->GetNumSegmTrack() );
|
||||||
fprintf( File, "Nzone %d\n", GetBoard()->GetNumSegmZone() );
|
fprintf( File, "Nzone %d\n", GetBoard()->GetNumSegmZone() );
|
||||||
fprintf( File, "BoardThickness %d\n",
|
fprintf( File, "BoardThickness %d\n", GetBoard()->GetBoardDesignSettings()->m_BoardThickness );
|
||||||
GetBoard()->GetBoardDesignSettings()->m_BoardThickness );
|
|
||||||
|
|
||||||
fprintf( File, "Nmodule %d\n", NbModules );
|
fprintf( File, "Nmodule %d\n", NbModules );
|
||||||
fprintf( File, "Nnets %d\n", GetBoard()->m_NetInfo->GetCount() );
|
fprintf( File, "Nnets %d\n", GetBoard()->m_NetInfo->GetCount() );
|
||||||
|
|
||||||
fprintf( File, "$EndGENERAL\n\n" );
|
fprintf( File, "$EndGENERAL\n\n" );
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -839,7 +831,7 @@ bool WriteSheetDescr( BASE_SCREEN* screen, FILE* File )
|
||||||
fprintf( File, "Comment4 %s\n", EscapedUTF8( screen->m_Commentaire4 ).c_str() );
|
fprintf( File, "Comment4 %s\n", EscapedUTF8( screen->m_Commentaire4 ).c_str() );
|
||||||
|
|
||||||
fprintf( File, "$EndSHEETDESCR\n\n" );
|
fprintf( File, "$EndSHEETDESCR\n\n" );
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -850,8 +842,9 @@ static bool ReadSheetDescr( BASE_SCREEN* screen, LINE_READER* aReader )
|
||||||
while( aReader->ReadLine() )
|
while( aReader->ReadLine() )
|
||||||
{
|
{
|
||||||
Line = aReader->Line();
|
Line = aReader->Line();
|
||||||
|
|
||||||
if( strnicmp( Line, "$End", 4 ) == 0 )
|
if( strnicmp( Line, "$End", 4 ) == 0 )
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
if( strnicmp( Line, "Sheet", 4 ) == 0 )
|
if( strnicmp( Line, "Sheet", 4 ) == 0 )
|
||||||
{
|
{
|
||||||
|
@ -859,20 +852,26 @@ static bool ReadSheetDescr( BASE_SCREEN* screen, LINE_READER* aReader )
|
||||||
text = strtok( NULL, " \t\n\r" );
|
text = strtok( NULL, " \t\n\r" );
|
||||||
Ki_PageDescr* sheet = g_SheetSizeList[0];
|
Ki_PageDescr* sheet = g_SheetSizeList[0];
|
||||||
int ii;
|
int ii;
|
||||||
|
|
||||||
for( ii = 0; sheet != NULL; ii++, sheet = g_SheetSizeList[ii] )
|
for( ii = 0; sheet != NULL; ii++, sheet = g_SheetSizeList[ii] )
|
||||||
{
|
{
|
||||||
if( stricmp( TO_UTF8( sheet->m_Name ), text ) == 0 )
|
if( stricmp( TO_UTF8( sheet->m_Name ), text ) == 0 )
|
||||||
{
|
{
|
||||||
screen->m_CurrentSheetDesc = sheet;
|
screen->m_CurrentSheetDesc = sheet;
|
||||||
|
|
||||||
if( sheet == &g_Sheet_user )
|
if( sheet == &g_Sheet_user )
|
||||||
{
|
{
|
||||||
text = strtok( NULL, " \t\n\r" );
|
text = strtok( NULL, " \t\n\r" );
|
||||||
|
|
||||||
if( text )
|
if( text )
|
||||||
sheet->m_Size.x = atoi( text );
|
sheet->m_Size.x = atoi( text );
|
||||||
|
|
||||||
text = strtok( NULL, " \t\n\r" );
|
text = strtok( NULL, " \t\n\r" );
|
||||||
|
|
||||||
if( text )
|
if( text )
|
||||||
sheet->m_Size.y = atoi( text );
|
sheet->m_Size.y = atoi( text );
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -937,7 +936,7 @@ static bool ReadSheetDescr( BASE_SCREEN* screen, LINE_READER* aReader )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1008,8 +1007,7 @@ int PCB_EDIT_FRAME::ReadPcbFile( LINE_READER* aReader, bool Append )
|
||||||
{
|
{
|
||||||
#ifdef PCBNEW
|
#ifdef PCBNEW
|
||||||
TRACK* insertBeforeMe = Append ? NULL : board->m_Track.GetFirst();
|
TRACK* insertBeforeMe = Append ? NULL : board->m_Track.GetFirst();
|
||||||
ReadListeSegmentDescr( aReader, insertBeforeMe, TYPE_TRACK,
|
ReadListeSegmentDescr( aReader, insertBeforeMe, TYPE_TRACK, NbTrack );
|
||||||
NbTrack );
|
|
||||||
#endif
|
#endif
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1054,9 +1052,9 @@ int PCB_EDIT_FRAME::ReadPcbFile( LINE_READER* aReader, bool Append )
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( TESTLINE( "MIREPCB" ) )
|
if( TESTLINE( "PCB_TARGET" ) )
|
||||||
{
|
{
|
||||||
MIREPCB* Mire = new MIREPCB( board );
|
PCB_TARGET* Mire = new PCB_TARGET( board );
|
||||||
board->Add( Mire, ADD_APPEND );
|
board->Add( Mire, ADD_APPEND );
|
||||||
Mire->ReadMirePcbDescr( aReader );
|
Mire->ReadMirePcbDescr( aReader );
|
||||||
continue;
|
continue;
|
||||||
|
@ -1067,8 +1065,7 @@ int PCB_EDIT_FRAME::ReadPcbFile( LINE_READER* aReader, bool Append )
|
||||||
#ifdef PCBNEW
|
#ifdef PCBNEW
|
||||||
SEGZONE* insertBeforeMe = Append ? NULL : board->m_Zone.GetFirst();
|
SEGZONE* insertBeforeMe = Append ? NULL : board->m_Zone.GetFirst();
|
||||||
|
|
||||||
ReadListeSegmentDescr( aReader, insertBeforeMe, TYPE_ZONE,
|
ReadListeSegmentDescr( aReader, insertBeforeMe, TYPE_ZONE, NbZone );
|
||||||
NbZone );
|
|
||||||
#endif
|
#endif
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1093,12 +1090,15 @@ int PCB_EDIT_FRAME::ReadPcbFile( LINE_READER* aReader, bool Append )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
while( aReader->ReadLine() ) {
|
while( aReader->ReadLine() )
|
||||||
|
{
|
||||||
Line = aReader->Line();
|
Line = aReader->Line();
|
||||||
|
|
||||||
if( TESTLINE( "EndSETUP" ) )
|
if( TESTLINE( "EndSETUP" ) )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1144,8 +1144,7 @@ int PCB_EDIT_FRAME::SavePcbFormatAscii( FILE* aFile )
|
||||||
/* Writing file header. */
|
/* Writing file header. */
|
||||||
fprintf( aFile, "PCBNEW-BOARD Version %d date %s\n\n", g_CurrentVersionPCB,
|
fprintf( aFile, "PCBNEW-BOARD Version %d date %s\n\n", g_CurrentVersionPCB,
|
||||||
DateAndTime( line ) );
|
DateAndTime( line ) );
|
||||||
fprintf( aFile, "# Created by Pcbnew%s\n\n",
|
fprintf( aFile, "# Created by Pcbnew%s\n\n", TO_UTF8( GetBuildVersion() ) );
|
||||||
TO_UTF8( GetBuildVersion() ) );
|
|
||||||
|
|
||||||
GetBoard()->SynchronizeNetsAndNetClasses();
|
GetBoard()->SynchronizeNetsAndNetClasses();
|
||||||
|
|
||||||
|
|
|
@ -76,32 +76,32 @@ TRACK* Locate_Via_Area( TRACK* aStart, const wxPoint& pos, int layer )
|
||||||
|
|
||||||
|
|
||||||
/* Locate the pad CONNECTED to a track
|
/* Locate the pad CONNECTED to a track
|
||||||
* input: ptr_piste: pointer to the segment of track
|
* input: ptr_trace: pointer to the segment of track
|
||||||
* Extr = flag = START -> beginning of the test segment
|
* Extr = flag = START -> beginning of the test segment
|
||||||
* END -> end of the segment to be tested
|
* END -> end of the segment to be tested
|
||||||
* Returns:
|
* Returns:
|
||||||
* A pointer to the description of the pad if found.
|
* A pointer to the description of the pad if found.
|
||||||
* NULL pointer if pad NOT FOUND
|
* NULL pointer if pad NOT FOUND
|
||||||
*/
|
*/
|
||||||
D_PAD* Locate_Pad_Connecte( BOARD* Pcb, TRACK* ptr_piste, int extr )
|
D_PAD* Locate_Pad_Connecte( BOARD* Pcb, TRACK* ptr_trace, int extr )
|
||||||
{
|
{
|
||||||
D_PAD* ptr_pad = NULL;
|
D_PAD* ptr_pad = NULL;
|
||||||
wxPoint ref_pos;
|
wxPoint ref_pos;
|
||||||
|
|
||||||
int masque_layer = g_TabOneLayerMask[ptr_piste->GetLayer()];
|
int aLayerMask = g_TabOneLayerMask[ptr_trace->GetLayer()];
|
||||||
|
|
||||||
if( extr == START )
|
if( extr == START )
|
||||||
{
|
{
|
||||||
ref_pos = ptr_piste->m_Start;
|
ref_pos = ptr_trace->m_Start;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ref_pos = ptr_piste->m_End;
|
ref_pos = ptr_trace->m_End;
|
||||||
}
|
}
|
||||||
|
|
||||||
for( MODULE* module = Pcb->m_Modules; module; module = module->Next() )
|
for( MODULE* module = Pcb->m_Modules; module; module = module->Next() )
|
||||||
{
|
{
|
||||||
ptr_pad = Locate_Pads( module, ref_pos, masque_layer );
|
ptr_pad = Locate_Pads( module, ref_pos, aLayerMask );
|
||||||
|
|
||||||
if( ptr_pad != NULL )
|
if( ptr_pad != NULL )
|
||||||
break;
|
break;
|
||||||
|
@ -140,12 +140,12 @@ D_PAD* Locate_Any_Pad( BOARD* Pcb, const wxPoint& ref_pos, int aLayerMask )
|
||||||
* Returns:
|
* Returns:
|
||||||
* A pointer to the pad if found or NULL
|
* A pointer to the pad if found or NULL
|
||||||
*/
|
*/
|
||||||
D_PAD* Locate_Pads( MODULE* module, const wxPoint& ref_pos, int masque_layer )
|
D_PAD* Locate_Pads( MODULE* module, const wxPoint& ref_pos, int aLayerMask )
|
||||||
{
|
{
|
||||||
for( D_PAD* pt_pad = module->m_Pads; pt_pad; pt_pad = pt_pad->Next() )
|
for( D_PAD* pt_pad = module->m_Pads; pt_pad; pt_pad = pt_pad->Next() )
|
||||||
{
|
{
|
||||||
/* ... and on the correct layer. */
|
/* ... and on the correct layer. */
|
||||||
if( ( pt_pad->m_Masque_Layer & masque_layer ) == 0 )
|
if( ( pt_pad->m_layerMask & aLayerMask ) == 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( pt_pad->HitTest( ref_pos ) )
|
if( pt_pad->HitTest( ref_pos ) )
|
||||||
|
@ -274,7 +274,8 @@ int dist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Search for the track (or via) segment which is connected to the track
|
/**
|
||||||
|
* Search for the track (or via) segment which is connected to the track
|
||||||
* segment PtRefSegm
|
* segment PtRefSegm
|
||||||
* if extr == START, the starting track segment PtRefSegm is used to locate
|
* if extr == START, the starting track segment PtRefSegm is used to locate
|
||||||
* a connected segment
|
* a connected segment
|
||||||
|
@ -294,7 +295,7 @@ int dist;
|
||||||
* @param pt_lim = upper limit for search (can be NULL)
|
* @param pt_lim = upper limit for search (can be NULL)
|
||||||
* @param extr = START or END = end of ref track segment to use in tests
|
* @param extr = START or END = end of ref track segment to use in tests
|
||||||
*/
|
*/
|
||||||
TRACK* Locate_Piste_Connectee( TRACK* PtRefSegm, TRACK* pt_base, TRACK* pt_lim, int extr )
|
TRACK* GetConnectedTrace( TRACK* PtRefSegm, TRACK* pt_base, TRACK* pt_lim, int extr )
|
||||||
{
|
{
|
||||||
const int NEIGHTBOUR_COUNT_MAX = 50;
|
const int NEIGHTBOUR_COUNT_MAX = 50;
|
||||||
|
|
||||||
|
@ -389,6 +390,7 @@ suite1:
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( PtSegmN == PtRefSegm )
|
if( PtSegmN == PtRefSegm )
|
||||||
{
|
{
|
||||||
if( PtSegmN == pt_lim )
|
if( PtSegmN == pt_lim )
|
||||||
|
@ -410,6 +412,7 @@ suite1:
|
||||||
if( Reflayer & PtSegmN->ReturnMaskLayer() )
|
if( Reflayer & PtSegmN->ReturnMaskLayer() )
|
||||||
return PtSegmN;
|
return PtSegmN;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( PtSegmN == pt_lim )
|
if( PtSegmN == pt_lim )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -425,7 +428,7 @@ suite1:
|
||||||
*
|
*
|
||||||
* The search begins to address start_adresse
|
* The search begins to address start_adresse
|
||||||
*/
|
*/
|
||||||
TRACK* Locate_Pistes( BOARD* aPcb, TRACK* start_adresse, const wxPoint& ref_pos, int MasqueLayer )
|
TRACK* GetTrace( BOARD* aPcb, TRACK* start_adresse, const wxPoint& ref_pos, int LayerMask )
|
||||||
{
|
{
|
||||||
for( TRACK* track = start_adresse; track; track = track->Next() )
|
for( TRACK* track = start_adresse; track; track = track->Next() )
|
||||||
{
|
{
|
||||||
|
@ -449,7 +452,7 @@ TRACK* Locate_Pistes( BOARD* aPcb, TRACK* start_adresse, const wxPoint& ref_pos,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( (g_TabOneLayerMask[layer] & MasqueLayer) == 0 )
|
if( (g_TabOneLayerMask[layer] & LayerMask) == 0 )
|
||||||
continue; /* Segments on different layers. */
|
continue; /* Segments on different layers. */
|
||||||
|
|
||||||
if( track->HitTest( ref_pos ) )
|
if( track->HitTest( ref_pos ) )
|
||||||
|
@ -486,7 +489,7 @@ TRACK* Locate_Zone( TRACK* start_adresse, const wxPoint& ref_pos, int layer )
|
||||||
|
|
||||||
|
|
||||||
/* Find the pad center px, py,
|
/* Find the pad center px, py,
|
||||||
* The layer INDICATED BY masque_layer (bitwise)
|
* The layer INDICATED BY aLayerMask (bitwise)
|
||||||
* (Runway end)
|
* (Runway end)
|
||||||
* The list of pads must already exist.
|
* The list of pads must already exist.
|
||||||
*
|
*
|
||||||
|
@ -495,7 +498,7 @@ TRACK* Locate_Zone( TRACK* start_adresse, const wxPoint& ref_pos, int layer )
|
||||||
* Pointer to the structure corresponding descr_pad if pad found
|
* Pointer to the structure corresponding descr_pad if pad found
|
||||||
* (Good position and good layer).
|
* (Good position and good layer).
|
||||||
*/
|
*/
|
||||||
D_PAD* Fast_Locate_Pad_Connecte( BOARD* Pcb, const wxPoint& ref_pos, int masque_layer )
|
D_PAD* Fast_Locate_Pad_Connecte( BOARD* Pcb, const wxPoint& ref_pos, int aLayerMask )
|
||||||
{
|
{
|
||||||
for( unsigned i=0; i<Pcb->GetPadsCount(); ++i )
|
for( unsigned i=0; i<Pcb->GetPadsCount(); ++i )
|
||||||
{
|
{
|
||||||
|
@ -505,7 +508,7 @@ D_PAD* Fast_Locate_Pad_Connecte( BOARD* Pcb, const wxPoint& ref_pos, int masque_
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Pad found, it must be on the correct layer */
|
/* Pad found, it must be on the correct layer */
|
||||||
if( pad->m_Masque_Layer & masque_layer )
|
if( pad->m_layerMask & aLayerMask )
|
||||||
return pad;
|
return pad;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -520,7 +523,7 @@ D_PAD* Fast_Locate_Pad_Connecte( BOARD* Pcb, const wxPoint& ref_pos, int masque_
|
||||||
* The segments of track marks with the flag are not IS_DELETED or taken
|
* The segments of track marks with the flag are not IS_DELETED or taken
|
||||||
* into account
|
* into account
|
||||||
*/
|
*/
|
||||||
TRACK* Fast_Locate_Piste( TRACK* start_adr, TRACK* end_adr, const wxPoint& ref_pos, int MaskLayer )
|
TRACK* GetTrace( TRACK* start_adr, TRACK* end_adr, const wxPoint& ref_pos, int MaskLayer )
|
||||||
{
|
{
|
||||||
TRACK* PtSegm;
|
TRACK* PtSegm;
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,7 @@ static bool Join( wxPoint* res, wxPoint a0, wxPoint a1, wxPoint b0, wxPoint b1 )
|
||||||
b0 -= a0;
|
b0 -= a0;
|
||||||
|
|
||||||
denom = (double) b1.y * a1.x - (double) b1.x * a1.y;
|
denom = (double) b1.y * a1.x - (double) b1.x * a1.y;
|
||||||
|
|
||||||
if( !denom )
|
if( !denom )
|
||||||
{
|
{
|
||||||
return false; // parallel
|
return false; // parallel
|
||||||
|
@ -192,7 +193,7 @@ bool Magnetize( BOARD* m_Pcb, PCB_EDIT_FRAME* frame, int aCurrentTool, wxSize gr
|
||||||
{
|
{
|
||||||
int layer_mask = g_TabOneLayerMask[layer];
|
int layer_mask = g_TabOneLayerMask[layer];
|
||||||
|
|
||||||
TRACK* track = Locate_Pistes( m_Pcb, m_Pcb->m_Track, pos, layer_mask );
|
TRACK* track = GetTrace( m_Pcb, m_Pcb->m_Track, pos, layer_mask );
|
||||||
|
|
||||||
if( !track || track->Type() != TYPE_TRACK )
|
if( !track || track->Type() != TYPE_TRACK )
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,7 +22,7 @@ static void ShowTargetShapeWhileMovingMouse( EDA_DRAW_PANEL* aPanel,
|
||||||
|
|
||||||
/* Local variables : */
|
/* Local variables : */
|
||||||
static int MireDefaultSize = 5000;
|
static int MireDefaultSize = 5000;
|
||||||
static MIREPCB s_TargetCopy( NULL ); /* Used to store "old" values of the
|
static PCB_TARGET s_TargetCopy( NULL ); /* Used to store "old" values of the
|
||||||
* current item parameters before
|
* current item parameters before
|
||||||
* edition (used in undo/redo or
|
* edition (used in undo/redo or
|
||||||
* cancel operations)
|
* cancel operations)
|
||||||
|
@ -38,13 +38,13 @@ private:
|
||||||
|
|
||||||
PCB_EDIT_FRAME* m_Parent;
|
PCB_EDIT_FRAME* m_Parent;
|
||||||
wxDC* m_DC;
|
wxDC* m_DC;
|
||||||
MIREPCB* m_MirePcb;
|
PCB_TARGET* m_Target;
|
||||||
EDA_VALUE_CTRL* m_MireWidthCtrl;
|
EDA_VALUE_CTRL* m_MireWidthCtrl;
|
||||||
EDA_VALUE_CTRL* m_MireSizeCtrl;
|
EDA_VALUE_CTRL* m_MireSizeCtrl;
|
||||||
wxRadioBox* m_MireShape;
|
wxRadioBox* m_MireShape;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TARGET_PROPERTIES_DIALOG_EDITOR( PCB_EDIT_FRAME* parent, MIREPCB* Mire, wxDC* DC );
|
TARGET_PROPERTIES_DIALOG_EDITOR( PCB_EDIT_FRAME* parent, PCB_TARGET* Mire, wxDC* DC );
|
||||||
~TARGET_PROPERTIES_DIALOG_EDITOR() { }
|
~TARGET_PROPERTIES_DIALOG_EDITOR() { }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -60,19 +60,18 @@ BEGIN_EVENT_TABLE( TARGET_PROPERTIES_DIALOG_EDITOR, wxDialog )
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
void PCB_EDIT_FRAME::InstallMireOptionsFrame( MIREPCB* MirePcb, wxDC* DC )
|
void PCB_EDIT_FRAME::ShowTargetOptionsDialog( PCB_TARGET* aTarget, wxDC* DC )
|
||||||
{
|
{
|
||||||
TARGET_PROPERTIES_DIALOG_EDITOR* frame =
|
TARGET_PROPERTIES_DIALOG_EDITOR* frame =
|
||||||
new TARGET_PROPERTIES_DIALOG_EDITOR( this, MirePcb, DC );
|
new TARGET_PROPERTIES_DIALOG_EDITOR( this, aTarget, DC );
|
||||||
|
|
||||||
frame->ShowModal();
|
frame->ShowModal();
|
||||||
frame->Destroy();
|
frame->Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TARGET_PROPERTIES_DIALOG_EDITOR::TARGET_PROPERTIES_DIALOG_EDITOR(
|
TARGET_PROPERTIES_DIALOG_EDITOR::TARGET_PROPERTIES_DIALOG_EDITOR( PCB_EDIT_FRAME* parent,
|
||||||
PCB_EDIT_FRAME* parent,
|
PCB_TARGET* aTarget, wxDC* DC ) :
|
||||||
MIREPCB* Mire, wxDC* DC ) :
|
|
||||||
wxDialog( parent, wxID_ANY, wxString( _( "Target Properties" ) ) )
|
wxDialog( parent, wxID_ANY, wxString( _( "Target Properties" ) ) )
|
||||||
{
|
{
|
||||||
wxString number;
|
wxString number;
|
||||||
|
@ -82,7 +81,7 @@ TARGET_PROPERTIES_DIALOG_EDITOR::TARGET_PROPERTIES_DIALOG_EDITOR(
|
||||||
m_DC = DC;
|
m_DC = DC;
|
||||||
Centre();
|
Centre();
|
||||||
|
|
||||||
m_MirePcb = Mire;
|
m_Target = aTarget;
|
||||||
|
|
||||||
wxBoxSizer* MainBoxSizer = new wxBoxSizer( wxHORIZONTAL );
|
wxBoxSizer* MainBoxSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||||
SetSizer( MainBoxSizer );
|
SetSizer( MainBoxSizer );
|
||||||
|
@ -100,13 +99,13 @@ TARGET_PROPERTIES_DIALOG_EDITOR::TARGET_PROPERTIES_DIALOG_EDITOR(
|
||||||
|
|
||||||
// Size:
|
// Size:
|
||||||
m_MireSizeCtrl = new EDA_VALUE_CTRL( this, _( "Size" ),
|
m_MireSizeCtrl = new EDA_VALUE_CTRL( this, _( "Size" ),
|
||||||
m_MirePcb->m_Size,
|
m_Target->m_Size,
|
||||||
g_UserUnit, LeftBoxSizer,
|
g_UserUnit, LeftBoxSizer,
|
||||||
m_Parent->m_InternalUnits );
|
m_Parent->m_InternalUnits );
|
||||||
|
|
||||||
// Width:
|
// Width:
|
||||||
m_MireWidthCtrl = new EDA_VALUE_CTRL( this, _( "Width" ),
|
m_MireWidthCtrl = new EDA_VALUE_CTRL( this, _( "Width" ),
|
||||||
m_MirePcb->m_Width,
|
m_Target->m_Width,
|
||||||
g_UserUnit, LeftBoxSizer,
|
g_UserUnit, LeftBoxSizer,
|
||||||
m_Parent->m_InternalUnits );
|
m_Parent->m_InternalUnits );
|
||||||
|
|
||||||
|
@ -116,7 +115,7 @@ TARGET_PROPERTIES_DIALOG_EDITOR::TARGET_PROPERTIES_DIALOG_EDITOR(
|
||||||
_( "Target Shape:" ),
|
_( "Target Shape:" ),
|
||||||
wxDefaultPosition, wxSize( -1, -1 ),
|
wxDefaultPosition, wxSize( -1, -1 ),
|
||||||
2, shape_list, 1 );
|
2, shape_list, 1 );
|
||||||
m_MireShape->SetSelection( m_MirePcb->m_Shape ? 1 : 0 );
|
m_MireShape->SetSelection( m_Target->m_Shape ? 1 : 0 );
|
||||||
LeftBoxSizer->Add( m_MireShape, 0, wxGROW | wxALL, 5 );
|
LeftBoxSizer->Add( m_MireShape, 0, wxGROW | wxALL, 5 );
|
||||||
|
|
||||||
GetSizer()->Fit( this );
|
GetSizer()->Fit( this );
|
||||||
|
@ -134,143 +133,140 @@ void TARGET_PROPERTIES_DIALOG_EDITOR::OnCancelClick( wxCommandEvent& event )
|
||||||
*/
|
*/
|
||||||
void TARGET_PROPERTIES_DIALOG_EDITOR::OnOkClick( wxCommandEvent& event )
|
void TARGET_PROPERTIES_DIALOG_EDITOR::OnOkClick( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
m_MirePcb->Draw( m_Parent->DrawPanel, m_DC, GR_XOR );
|
m_Target->Draw( m_Parent->DrawPanel, m_DC, GR_XOR );
|
||||||
|
|
||||||
// Save old item in undo list, if is is not currently edited (will be later
|
// Save old item in undo list, if is is not currently edited (will be later if so)
|
||||||
// if so)
|
if( m_Target->m_Flags == 0 )
|
||||||
if( m_MirePcb->m_Flags == 0 )
|
m_Parent->SaveCopyInUndoList( m_Target, UR_CHANGED );
|
||||||
m_Parent->SaveCopyInUndoList( m_MirePcb, UR_CHANGED );
|
|
||||||
|
|
||||||
if( m_MirePcb->m_Flags != 0 ) // other edition in progress (MOVE,
|
if( m_Target->m_Flags != 0 ) // other edition in progress (MOVE, NEW ..)
|
||||||
// NEW ..)
|
m_Target->m_Flags |= IN_EDIT; // set flag in edit to force
|
||||||
m_MirePcb->m_Flags |= IN_EDIT; // set flag in edit to force
|
|
||||||
// undo/redo/abort proper operation
|
// undo/redo/abort proper operation
|
||||||
|
|
||||||
m_MirePcb->m_Width = m_MireWidthCtrl->GetValue();
|
m_Target->m_Width = m_MireWidthCtrl->GetValue();
|
||||||
MireDefaultSize = m_MirePcb->m_Size = m_MireSizeCtrl->GetValue();
|
MireDefaultSize = m_Target->m_Size = m_MireSizeCtrl->GetValue();
|
||||||
m_MirePcb->m_Shape = m_MireShape->GetSelection() ? 1 : 0;
|
m_Target->m_Shape = m_MireShape->GetSelection() ? 1 : 0;
|
||||||
|
|
||||||
m_MirePcb->Draw( m_Parent->DrawPanel, m_DC,
|
m_Target->Draw( m_Parent->DrawPanel, m_DC, ( m_Target->m_Flags & IS_MOVED ) ? GR_XOR : GR_OR );
|
||||||
( m_MirePcb->m_Flags & IS_MOVED ) ? GR_XOR : GR_OR );
|
|
||||||
|
|
||||||
m_Parent->OnModify();
|
m_Parent->OnModify();
|
||||||
EndModal( 1 );
|
EndModal( 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_EDIT_FRAME::Delete_Mire( MIREPCB* MirePcb, wxDC* DC )
|
void PCB_EDIT_FRAME::DeleteTarget( PCB_TARGET* aTarget, wxDC* DC )
|
||||||
{
|
{
|
||||||
if( MirePcb == NULL )
|
if( aTarget == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
MirePcb->Draw( DrawPanel, DC, GR_XOR );
|
aTarget->Draw( DrawPanel, DC, GR_XOR );
|
||||||
SaveCopyInUndoList( MirePcb, UR_DELETED );
|
SaveCopyInUndoList( aTarget, UR_DELETED );
|
||||||
MirePcb->UnLink();
|
aTarget->UnLink();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void AbortMoveAndEditTarget( EDA_DRAW_PANEL* Panel, wxDC* DC )
|
static void AbortMoveAndEditTarget( EDA_DRAW_PANEL* Panel, wxDC* DC )
|
||||||
{
|
{
|
||||||
BASE_SCREEN* screen = Panel->GetScreen();
|
BASE_SCREEN* screen = Panel->GetScreen();
|
||||||
MIREPCB* MirePcb = (MIREPCB*) screen->GetCurItem();
|
PCB_TARGET* target = (PCB_TARGET*) screen->GetCurItem();
|
||||||
|
|
||||||
( (PCB_EDIT_FRAME*) Panel->GetParent() )->SetCurItem( NULL );
|
( (PCB_EDIT_FRAME*) Panel->GetParent() )->SetCurItem( NULL );
|
||||||
|
|
||||||
Panel->SetMouseCapture( NULL, NULL );
|
Panel->SetMouseCapture( NULL, NULL );
|
||||||
|
|
||||||
if( MirePcb == NULL )
|
if( target == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
MirePcb->Draw( Panel, DC, GR_XOR );
|
target->Draw( Panel, DC, GR_XOR );
|
||||||
|
|
||||||
if( MirePcb->IsNew() ) // If it is new, delete it
|
if( target->IsNew() ) // If it is new, delete it
|
||||||
{
|
{
|
||||||
MirePcb->Draw( Panel, DC, GR_XOR );
|
target->Draw( Panel, DC, GR_XOR );
|
||||||
MirePcb->DeleteStructure();
|
target->DeleteStructure();
|
||||||
MirePcb = NULL;
|
target = NULL;
|
||||||
}
|
}
|
||||||
else /* it is an existing item: retrieve initial values of parameters */
|
else /* it is an existing item: retrieve initial values of parameters */
|
||||||
{
|
{
|
||||||
if( ( MirePcb->m_Flags & (IN_EDIT | IS_MOVED) ) )
|
if( ( target->m_Flags & (IN_EDIT | IS_MOVED) ) )
|
||||||
{
|
{
|
||||||
MirePcb->m_Pos = s_TargetCopy.m_Pos;
|
target->m_Pos = s_TargetCopy.m_Pos;
|
||||||
MirePcb->m_Width = s_TargetCopy.m_Width;
|
target->m_Width = s_TargetCopy.m_Width;
|
||||||
MirePcb->m_Size = s_TargetCopy.m_Size;
|
target->m_Size = s_TargetCopy.m_Size;
|
||||||
MirePcb->m_Shape = s_TargetCopy.m_Shape;
|
target->m_Shape = s_TargetCopy.m_Shape;
|
||||||
}
|
}
|
||||||
MirePcb->m_Flags = 0;
|
target->m_Flags = 0;
|
||||||
MirePcb->Draw( Panel, DC, GR_OR );
|
target->Draw( Panel, DC, GR_OR );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Draw Symbol PCB type MIRE.
|
/* Draw Symbol PCB type MIRE.
|
||||||
*/
|
*/
|
||||||
MIREPCB* PCB_EDIT_FRAME::Create_Mire( wxDC* DC )
|
PCB_TARGET* PCB_EDIT_FRAME::CreateTarget( wxDC* DC )
|
||||||
{
|
{
|
||||||
MIREPCB* MirePcb = new MIREPCB( GetBoard() );
|
PCB_TARGET* target = new PCB_TARGET( GetBoard() );
|
||||||
|
|
||||||
MirePcb->m_Flags = IS_NEW;
|
target->m_Flags = IS_NEW;
|
||||||
|
|
||||||
GetBoard()->Add( MirePcb );
|
GetBoard()->Add( target );
|
||||||
|
|
||||||
MirePcb->SetLayer( EDGE_N );
|
target->SetLayer( EDGE_N );
|
||||||
MirePcb->m_Width = GetBoard()->GetBoardDesignSettings()->m_EdgeSegmentWidth;
|
target->m_Width = GetBoard()->GetBoardDesignSettings()->m_EdgeSegmentWidth;
|
||||||
MirePcb->m_Size = MireDefaultSize;
|
target->m_Size = MireDefaultSize;
|
||||||
MirePcb->m_Pos = DrawPanel->GetScreen()->GetCrossHairPosition();
|
target->m_Pos = DrawPanel->GetScreen()->GetCrossHairPosition();
|
||||||
|
|
||||||
Place_Mire( MirePcb, DC );
|
PlaceTarget( target, DC );
|
||||||
|
|
||||||
return MirePcb;
|
return target;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Routine to initialize the displacement of a focal
|
/* Routine to initialize the displacement of a focal
|
||||||
*/
|
*/
|
||||||
void PCB_EDIT_FRAME::StartMove_Mire( MIREPCB* MirePcb, wxDC* DC )
|
void PCB_EDIT_FRAME::BeginMoveTarget( PCB_TARGET* aTarget, wxDC* DC )
|
||||||
{
|
{
|
||||||
if( MirePcb == NULL )
|
if( aTarget == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
s_TargetCopy = *MirePcb;
|
s_TargetCopy = *aTarget;
|
||||||
MirePcb->m_Flags |= IS_MOVED;
|
aTarget->m_Flags |= IS_MOVED;
|
||||||
DrawPanel->SetMouseCapture( ShowTargetShapeWhileMovingMouse, AbortMoveAndEditTarget );
|
DrawPanel->SetMouseCapture( ShowTargetShapeWhileMovingMouse, AbortMoveAndEditTarget );
|
||||||
SetCurItem( MirePcb );
|
SetCurItem( aTarget );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_EDIT_FRAME::Place_Mire( MIREPCB* MirePcb, wxDC* DC )
|
void PCB_EDIT_FRAME::PlaceTarget( PCB_TARGET* aTarget, wxDC* DC )
|
||||||
{
|
{
|
||||||
if( MirePcb == NULL )
|
if( aTarget == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
MirePcb->Draw( DrawPanel, DC, GR_OR );
|
aTarget->Draw( DrawPanel, DC, GR_OR );
|
||||||
DrawPanel->SetMouseCapture( NULL, NULL );
|
DrawPanel->SetMouseCapture( NULL, NULL );
|
||||||
SetCurItem( NULL );
|
SetCurItem( NULL );
|
||||||
OnModify();
|
OnModify();
|
||||||
|
|
||||||
if( MirePcb->IsNew() )
|
if( aTarget->IsNew() )
|
||||||
{
|
{
|
||||||
SaveCopyInUndoList( MirePcb, UR_NEW );
|
SaveCopyInUndoList( aTarget, UR_NEW );
|
||||||
MirePcb->m_Flags = 0;
|
aTarget->m_Flags = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( MirePcb->m_Flags == IS_MOVED )
|
if( aTarget->m_Flags == IS_MOVED )
|
||||||
{
|
{
|
||||||
SaveCopyInUndoList( MirePcb, UR_MOVED, MirePcb->m_Pos - s_TargetCopy.m_Pos );
|
SaveCopyInUndoList( aTarget, UR_MOVED, aTarget->m_Pos - s_TargetCopy.m_Pos );
|
||||||
MirePcb->m_Flags = 0;
|
aTarget->m_Flags = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( (MirePcb->m_Flags & IN_EDIT) )
|
if( (aTarget->m_Flags & IN_EDIT) )
|
||||||
{
|
{
|
||||||
SwapData( MirePcb, &s_TargetCopy );
|
SwapData( aTarget, &s_TargetCopy );
|
||||||
SaveCopyInUndoList( MirePcb, UR_CHANGED );
|
SaveCopyInUndoList( aTarget, UR_CHANGED );
|
||||||
SwapData( MirePcb, &s_TargetCopy );
|
SwapData( aTarget, &s_TargetCopy );
|
||||||
}
|
}
|
||||||
|
|
||||||
MirePcb->m_Flags = 0;
|
aTarget->m_Flags = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -279,15 +275,15 @@ static void ShowTargetShapeWhileMovingMouse( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
|
||||||
const wxPoint& aPosition, bool aErase )
|
const wxPoint& aPosition, bool aErase )
|
||||||
{
|
{
|
||||||
BASE_SCREEN* screen = aPanel->GetScreen();
|
BASE_SCREEN* screen = aPanel->GetScreen();
|
||||||
MIREPCB* MirePcb = (MIREPCB*) screen->GetCurItem();
|
PCB_TARGET* target = (PCB_TARGET*) screen->GetCurItem();
|
||||||
|
|
||||||
if( MirePcb == NULL )
|
if( target == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( aErase )
|
if( aErase )
|
||||||
MirePcb->Draw( aPanel, aDC, GR_XOR );
|
target->Draw( aPanel, aDC, GR_XOR );
|
||||||
|
|
||||||
MirePcb->m_Pos = screen->GetCrossHairPosition();
|
target->m_Pos = screen->GetCrossHairPosition();
|
||||||
|
|
||||||
MirePcb->Draw( aPanel, aDC, GR_XOR );
|
target->Draw( aPanel, aDC, GR_XOR );
|
||||||
}
|
}
|
||||||
|
|
|
@ -795,8 +795,10 @@ void FOOTPRINT_EDIT_FRAME::Transform( MODULE* module, int transform )
|
||||||
textmod = (TEXTE_MODULE*) PtStruct;
|
textmod = (TEXTE_MODULE*) PtStruct;
|
||||||
NEGATE( textmod->m_Pos.y );
|
NEGATE( textmod->m_Pos.y );
|
||||||
NEGATE( textmod->m_Pos0.y );
|
NEGATE( textmod->m_Pos0.y );
|
||||||
|
|
||||||
if( textmod->m_Orient )
|
if( textmod->m_Orient )
|
||||||
textmod->m_Orient = 3600 - textmod->m_Orient;
|
textmod->m_Orient = 3600 - textmod->m_Orient;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -812,7 +814,7 @@ void FOOTPRINT_EDIT_FRAME::Transform( MODULE* module, int transform )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
module->Set_Rectangle_Encadrement();
|
module->CalculateBoundingBox();
|
||||||
OnModify();
|
OnModify();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -184,7 +184,7 @@ bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMen
|
||||||
{
|
{
|
||||||
BOARD_ITEM* item = GetCurItem();
|
BOARD_ITEM* item = GetCurItem();
|
||||||
wxString msg;
|
wxString msg;
|
||||||
bool append_set_width = FALSE;
|
bool append_set_width = false;
|
||||||
bool blockActive = GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE;
|
bool blockActive = GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE;
|
||||||
|
|
||||||
// Simple location of elements where possible.
|
// Simple location of elements where possible.
|
||||||
|
@ -338,7 +338,7 @@ bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMen
|
||||||
_( "Edit Layer (All)" ), select_layer_pair_xpm );
|
_( "Edit Layer (All)" ), select_layer_pair_xpm );
|
||||||
msg = AddHotkeyName( _("Delete edge" ), g_Module_Editor_Hokeys_Descr, HK_DELETE );
|
msg = AddHotkeyName( _("Delete edge" ), g_Module_Editor_Hokeys_Descr, HK_DELETE );
|
||||||
AddMenuItem( PopMenu, ID_POPUP_PCB_DELETE_EDGE, msg, delete_xpm );
|
AddMenuItem( PopMenu, ID_POPUP_PCB_DELETE_EDGE, msg, delete_xpm );
|
||||||
append_set_width = TRUE;
|
append_set_width = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -349,7 +349,7 @@ bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMen
|
||||||
case TYPE_ZONE:
|
case TYPE_ZONE:
|
||||||
case TYPE_MARKER_PCB:
|
case TYPE_MARKER_PCB:
|
||||||
case TYPE_DIMENSION:
|
case TYPE_DIMENSION:
|
||||||
case TYPE_MIRE:
|
case PCB_TARGET_T:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_SCREEN:
|
case TYPE_SCREEN:
|
||||||
|
|
|
@ -35,22 +35,27 @@ MODULE* PCB_BASE_FRAME::GetModuleByName()
|
||||||
MODULE* module = NULL;
|
MODULE* module = NULL;
|
||||||
|
|
||||||
wxTextEntryDialog dlg( this, _( "Name:" ), _( "Search footprint" ), moduleName );
|
wxTextEntryDialog dlg( this, _( "Name:" ), _( "Search footprint" ), moduleName );
|
||||||
|
|
||||||
if( dlg.ShowModal() != wxID_OK )
|
if( dlg.ShowModal() != wxID_OK )
|
||||||
return NULL; //Aborted by user
|
return NULL; //Aborted by user
|
||||||
|
|
||||||
moduleName = dlg.GetValue();
|
moduleName = dlg.GetValue();
|
||||||
moduleName.Trim( true );
|
moduleName.Trim( true );
|
||||||
moduleName.Trim( false );
|
moduleName.Trim( false );
|
||||||
|
|
||||||
if( !moduleName.IsEmpty() )
|
if( !moduleName.IsEmpty() )
|
||||||
{
|
{
|
||||||
module = GetBoard()->m_Modules;
|
module = GetBoard()->m_Modules;
|
||||||
|
|
||||||
while( module )
|
while( module )
|
||||||
{
|
{
|
||||||
if( module->m_Reference->m_Text.CmpNoCase( moduleName ) == 0 )
|
if( module->m_Reference->m_Text.CmpNoCase( moduleName ) == 0 )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
module = module->Next();
|
module = module->Next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return module;
|
return module;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,6 +88,7 @@ void PCB_EDIT_FRAME::StartMove_Module( MODULE* module, wxDC* DC )
|
||||||
{
|
{
|
||||||
Build_Drag_Liste( DrawPanel, DC, module );
|
Build_Drag_Liste( DrawPanel, DC, module );
|
||||||
ITEM_PICKER itemWrapper( NULL, UR_CHANGED );
|
ITEM_PICKER itemWrapper( NULL, UR_CHANGED );
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
|
for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
|
||||||
{
|
{
|
||||||
TRACK* segm = g_DragSegmentList[ii].m_Segm;
|
TRACK* segm = g_DragSegmentList[ii].m_Segm;
|
||||||
|
@ -94,7 +100,7 @@ void PCB_EDIT_FRAME::StartMove_Module( MODULE* module, wxDC* DC )
|
||||||
}
|
}
|
||||||
|
|
||||||
GetBoard()->m_Status_Pcb |= DO_NOT_SHOW_GENERAL_RASTNEST;
|
GetBoard()->m_Status_Pcb |= DO_NOT_SHOW_GENERAL_RASTNEST;
|
||||||
DrawPanel->SetMouseCapture( Montre_Position_Empreinte, Abort_MoveOrCopyModule );
|
DrawPanel->SetMouseCapture( MoveFootprint, Abort_MoveOrCopyModule );
|
||||||
DrawPanel->m_AutoPAN_Request = true;
|
DrawPanel->m_AutoPAN_Request = true;
|
||||||
|
|
||||||
// Erase the module.
|
// Erase the module.
|
||||||
|
@ -229,8 +235,7 @@ MODULE* PCB_BASE_FRAME::Copie_Module( MODULE* module )
|
||||||
|
|
||||||
/* Redraw the footprint when moving the mouse.
|
/* Redraw the footprint when moving the mouse.
|
||||||
*/
|
*/
|
||||||
void Montre_Position_Empreinte( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
|
void MoveFootprint( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase )
|
||||||
bool aErase )
|
|
||||||
{
|
{
|
||||||
MODULE* module = (MODULE*) aPanel->GetScreen()->GetCurItem();
|
MODULE* module = (MODULE*) aPanel->GetScreen()->GetCurItem();
|
||||||
|
|
||||||
|
@ -247,7 +252,7 @@ void Montre_Position_Empreinte( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint
|
||||||
g_Offset_Module = module->m_Pos - aPanel->GetScreen()->GetCrossHairPosition();
|
g_Offset_Module = module->m_Pos - aPanel->GetScreen()->GetCrossHairPosition();
|
||||||
DrawModuleOutlines( aPanel, aDC, module );
|
DrawModuleOutlines( aPanel, aDC, module );
|
||||||
|
|
||||||
Dessine_Segments_Dragges( aPanel, aDC );
|
DrawSegmentWhileMovingFootprint( aPanel, aDC );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -274,6 +279,7 @@ bool PCB_EDIT_FRAME::Delete_Module( MODULE* aModule, wxDC* aDC, bool aAskBeforeD
|
||||||
msg.Printf( _( "Delete Module %s (value %s) ?" ),
|
msg.Printf( _( "Delete Module %s (value %s) ?" ),
|
||||||
GetChars( aModule->m_Reference->m_Text ),
|
GetChars( aModule->m_Reference->m_Text ),
|
||||||
GetChars( aModule->m_Value->m_Text ) );
|
GetChars( aModule->m_Value->m_Text ) );
|
||||||
|
|
||||||
if( !IsOK( this, msg ) )
|
if( !IsOK( this, msg ) )
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -311,16 +317,16 @@ void PCB_EDIT_FRAME::Change_Side_Module( MODULE* Module, wxDC* DC )
|
||||||
{
|
{
|
||||||
if( Module == NULL )
|
if( Module == NULL )
|
||||||
return;
|
return;
|
||||||
if( ( Module->GetLayer() != LAYER_N_FRONT )
|
|
||||||
&& ( Module->GetLayer() != LAYER_N_BACK ) )
|
if( ( Module->GetLayer() != LAYER_N_FRONT ) && ( Module->GetLayer() != LAYER_N_BACK ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
OnModify();
|
OnModify();
|
||||||
|
|
||||||
if( !( Module->m_Flags & IS_MOVED ) ) /* This is a simple flip, no other
|
if( !( Module->m_Flags & IS_MOVED ) ) /* This is a simple flip, no other edition in progress */
|
||||||
*edition in progress */
|
|
||||||
{
|
{
|
||||||
GetBoard()->m_Status_Pcb &= ~( LISTE_RATSNEST_ITEM_OK | CONNEXION_OK );
|
GetBoard()->m_Status_Pcb &= ~( LISTE_RATSNEST_ITEM_OK | CONNEXION_OK );
|
||||||
|
|
||||||
if( DC )
|
if( DC )
|
||||||
{
|
{
|
||||||
int tmp = Module->m_Flags;
|
int tmp = Module->m_Flags;
|
||||||
|
@ -342,7 +348,7 @@ void PCB_EDIT_FRAME::Change_Side_Module( MODULE* Module, wxDC* DC )
|
||||||
if( DC )
|
if( DC )
|
||||||
{
|
{
|
||||||
DrawModuleOutlines( DrawPanel, DC, Module );
|
DrawModuleOutlines( DrawPanel, DC, Module );
|
||||||
Dessine_Segments_Dragges( DrawPanel, DC );
|
DrawSegmentWhileMovingFootprint( DrawPanel, DC );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -356,6 +362,7 @@ void PCB_EDIT_FRAME::Change_Side_Module( MODULE* Module, wxDC* DC )
|
||||||
if( DC )
|
if( DC )
|
||||||
{
|
{
|
||||||
Module->Draw( DrawPanel, DC, GR_OR );
|
Module->Draw( DrawPanel, DC, GR_OR );
|
||||||
|
|
||||||
if( GetBoard()->IsElementVisible( RATSNEST_VISIBLE ) )
|
if( GetBoard()->IsElementVisible( RATSNEST_VISIBLE ) )
|
||||||
Compile_Ratsnest( DC, true );
|
Compile_Ratsnest( DC, true );
|
||||||
}
|
}
|
||||||
|
@ -365,8 +372,9 @@ void PCB_EDIT_FRAME::Change_Side_Module( MODULE* Module, wxDC* DC )
|
||||||
if( DC )
|
if( DC )
|
||||||
{
|
{
|
||||||
DrawModuleOutlines( DrawPanel, DC, Module );
|
DrawModuleOutlines( DrawPanel, DC, Module );
|
||||||
Dessine_Segments_Dragges( DrawPanel, DC );
|
DrawSegmentWhileMovingFootprint( DrawPanel, DC );
|
||||||
}
|
}
|
||||||
|
|
||||||
GetBoard()->m_Status_Pcb &= ~RATSNEST_ITEM_LOCAL_OK;
|
GetBoard()->m_Status_Pcb &= ~RATSNEST_ITEM_LOCAL_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -397,22 +405,19 @@ void PCB_BASE_FRAME::Place_Module( MODULE* module, wxDC* DC, bool aDoNotRecreate
|
||||||
ITEM_PICKER picker( module, UR_CHANGED );
|
ITEM_PICKER picker( module, UR_CHANGED );
|
||||||
picker.m_Link = s_ModuleInitialCopy;
|
picker.m_Link = s_ModuleInitialCopy;
|
||||||
s_PickedList.PushItem( picker );
|
s_PickedList.PushItem( picker );
|
||||||
s_ModuleInitialCopy = NULL; // the picker is now owner of
|
s_ModuleInitialCopy = NULL; // the picker is now owner of s_ModuleInitialCopy.
|
||||||
// s_ModuleInitialCopy.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( s_PickedList.GetCount() )
|
if( s_PickedList.GetCount() )
|
||||||
{
|
{
|
||||||
SaveCopyInUndoList( s_PickedList, UR_UNSPECIFIED );
|
SaveCopyInUndoList( s_PickedList, UR_UNSPECIFIED );
|
||||||
|
|
||||||
// Clear list, but DO NOT delete items,
|
// Clear list, but DO NOT delete items, because they are owned by the saved undo
|
||||||
// because they are owned by the saved undo list and they therefore in
|
// list and they therefore in use
|
||||||
// use
|
|
||||||
s_PickedList.ClearItemsList();
|
s_PickedList.ClearItemsList();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( g_Show_Module_Ratsnest && ( GetBoard()->m_Status_Pcb & LISTE_PAD_OK )
|
if( g_Show_Module_Ratsnest && ( GetBoard()->m_Status_Pcb & LISTE_PAD_OK ) && DC )
|
||||||
&& DC )
|
|
||||||
trace_ratsnest_module( DC );
|
trace_ratsnest_module( DC );
|
||||||
|
|
||||||
newpos = GetScreen()->GetCrossHairPosition();
|
newpos = GetScreen()->GetCrossHairPosition();
|
||||||
|
@ -487,7 +492,7 @@ void PCB_BASE_FRAME::Rotate_Module( wxDC* DC, MODULE* module, int angle, bool in
|
||||||
if( DC )
|
if( DC )
|
||||||
{
|
{
|
||||||
DrawModuleOutlines( DrawPanel, DC, module );
|
DrawModuleOutlines( DrawPanel, DC, module );
|
||||||
Dessine_Segments_Dragges( DrawPanel, DC );
|
DrawSegmentWhileMovingFootprint( DrawPanel, DC );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -506,6 +511,7 @@ void PCB_BASE_FRAME::Rotate_Module( wxDC* DC, MODULE* module, int angle, bool in
|
||||||
{
|
{
|
||||||
// not beiing moved: redraw the module and update ratsnest
|
// not beiing moved: redraw the module and update ratsnest
|
||||||
module->Draw( DrawPanel, DC, GR_OR );
|
module->Draw( DrawPanel, DC, GR_OR );
|
||||||
|
|
||||||
if( GetBoard()->IsElementVisible( RATSNEST_VISIBLE ) )
|
if( GetBoard()->IsElementVisible( RATSNEST_VISIBLE ) )
|
||||||
Compile_Ratsnest( DC, true );
|
Compile_Ratsnest( DC, true );
|
||||||
}
|
}
|
||||||
|
@ -513,7 +519,7 @@ void PCB_BASE_FRAME::Rotate_Module( wxDC* DC, MODULE* module, int angle, bool in
|
||||||
{
|
{
|
||||||
// Beiing moved: just redraw it
|
// Beiing moved: just redraw it
|
||||||
DrawModuleOutlines( DrawPanel, DC, module );
|
DrawModuleOutlines( DrawPanel, DC, module );
|
||||||
Dessine_Segments_Dragges( DrawPanel, DC );
|
DrawSegmentWhileMovingFootprint( DrawPanel, DC );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( module->m_Flags == 0 ) // module not in edit: redraw full screen
|
if( module->m_Flags == 0 ) // module not in edit: redraw full screen
|
||||||
|
@ -540,6 +546,7 @@ void DrawModuleOutlines( EDA_DRAW_PANEL* panel, wxDC* DC, MODULE* module )
|
||||||
DisplayOpt.DisplayPadFill = true;
|
DisplayOpt.DisplayPadFill = true;
|
||||||
|
|
||||||
pt_pad = module->m_Pads;
|
pt_pad = module->m_Pads;
|
||||||
|
|
||||||
for( ; pt_pad != NULL; pt_pad = pt_pad->Next() )
|
for( ; pt_pad != NULL; pt_pad = pt_pad->Next() )
|
||||||
{
|
{
|
||||||
pt_pad->Draw( panel, DC, GR_XOR, g_Offset_Module );
|
pt_pad->Draw( panel, DC, GR_XOR, g_Offset_Module );
|
||||||
|
|
|
@ -51,7 +51,7 @@ static void Abort_Move_Pad( EDA_DRAW_PANEL* Panel, wxDC* DC )
|
||||||
|
|
||||||
EraseDragList();
|
EraseDragList();
|
||||||
s_CurrentSelectedPad = NULL;
|
s_CurrentSelectedPad = NULL;
|
||||||
g_Drag_Pistes_On = FALSE;
|
g_Drag_Pistes_On = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ void PCB_BASE_FRAME::Export_Pad_Settings( D_PAD* pt_pad )
|
||||||
|
|
||||||
g_Pad_Master.m_PadShape = pt_pad->m_PadShape;
|
g_Pad_Master.m_PadShape = pt_pad->m_PadShape;
|
||||||
g_Pad_Master.m_Attribut = pt_pad->m_Attribut;
|
g_Pad_Master.m_Attribut = pt_pad->m_Attribut;
|
||||||
g_Pad_Master.m_Masque_Layer = pt_pad->m_Masque_Layer;
|
g_Pad_Master.m_layerMask = pt_pad->m_layerMask;
|
||||||
g_Pad_Master.m_Orient = pt_pad->m_Orient -
|
g_Pad_Master.m_Orient = pt_pad->m_Orient -
|
||||||
( (MODULE*) pt_pad->GetParent() )->m_Orient;
|
( (MODULE*) pt_pad->GetParent() )->m_Orient;
|
||||||
g_Pad_Master.m_Size = pt_pad->m_Size;
|
g_Pad_Master.m_Size = pt_pad->m_Size;
|
||||||
|
@ -137,7 +137,7 @@ void PCB_BASE_FRAME::Import_Pad_Settings( D_PAD* aPad, bool aDraw )
|
||||||
}
|
}
|
||||||
|
|
||||||
aPad->m_PadShape = g_Pad_Master.m_PadShape;
|
aPad->m_PadShape = g_Pad_Master.m_PadShape;
|
||||||
aPad->m_Masque_Layer = g_Pad_Master.m_Masque_Layer;
|
aPad->m_layerMask = g_Pad_Master.m_layerMask;
|
||||||
aPad->m_Attribut = g_Pad_Master.m_Attribut;
|
aPad->m_Attribut = g_Pad_Master.m_Attribut;
|
||||||
aPad->m_Orient = g_Pad_Master.m_Orient +
|
aPad->m_Orient = g_Pad_Master.m_Orient +
|
||||||
( (MODULE*) aPad->GetParent() )->m_Orient;
|
( (MODULE*) aPad->GetParent() )->m_Orient;
|
||||||
|
@ -206,8 +206,7 @@ void PCB_BASE_FRAME::AddPad( MODULE* Module, bool draw )
|
||||||
long num = 0;
|
long num = 0;
|
||||||
int ponder = 1;
|
int ponder = 1;
|
||||||
|
|
||||||
while( lastPadName.Len() && lastPadName.Last() >= '0'
|
while( lastPadName.Len() && lastPadName.Last() >= '0' && lastPadName.Last() <= '9' )
|
||||||
&& lastPadName.Last() <= '9' )
|
|
||||||
{
|
{
|
||||||
num += ( lastPadName.Last() - '0' ) * ponder;
|
num += ( lastPadName.Last() - '0' ) * ponder;
|
||||||
lastPadName.RemoveLast();
|
lastPadName.RemoveLast();
|
||||||
|
@ -219,8 +218,9 @@ void PCB_BASE_FRAME::AddPad( MODULE* Module, bool draw )
|
||||||
Pad->SetPadName( lastPadName );
|
Pad->SetPadName( lastPadName );
|
||||||
g_Pad_Master.SetPadName(lastPadName);
|
g_Pad_Master.SetPadName(lastPadName);
|
||||||
|
|
||||||
Module->Set_Rectangle_Encadrement();
|
Module->CalculateBoundingBox();
|
||||||
Pad->DisplayInfo( this );
|
Pad->DisplayInfo( this );
|
||||||
|
|
||||||
if( draw )
|
if( draw )
|
||||||
DrawPanel->RefreshDrawingRect( Module->GetBoundingBox() );
|
DrawPanel->RefreshDrawingRect( Module->GetBoundingBox() );
|
||||||
}
|
}
|
||||||
|
@ -250,6 +250,7 @@ void PCB_BASE_FRAME::DeletePad( D_PAD* aPad, bool aQuery )
|
||||||
msg.Printf( _( "Delete Pad (module %s %s) " ),
|
msg.Printf( _( "Delete Pad (module %s %s) " ),
|
||||||
GetChars( Module->m_Reference->m_Text ),
|
GetChars( Module->m_Reference->m_Text ),
|
||||||
GetChars( Module->m_Value->m_Text ) );
|
GetChars( Module->m_Value->m_Text ) );
|
||||||
|
|
||||||
if( !IsOK( this, msg ) )
|
if( !IsOK( this, msg ) )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -257,7 +258,7 @@ void PCB_BASE_FRAME::DeletePad( D_PAD* aPad, bool aQuery )
|
||||||
m_Pcb->m_Status_Pcb = 0;
|
m_Pcb->m_Status_Pcb = 0;
|
||||||
aPad->DeleteStructure();
|
aPad->DeleteStructure();
|
||||||
DrawPanel->RefreshDrawingRect( Module->GetBoundingBox() );
|
DrawPanel->RefreshDrawingRect( Module->GetBoundingBox() );
|
||||||
Module->Set_Rectangle_Encadrement();
|
Module->CalculateBoundingBox();
|
||||||
|
|
||||||
OnModify();
|
OnModify();
|
||||||
}
|
}
|
||||||
|
@ -310,6 +311,7 @@ void PCB_BASE_FRAME::PlacePad( D_PAD* Pad, wxDC* DC )
|
||||||
// Set the old state
|
// Set the old state
|
||||||
if( g_DragSegmentList[ii].m_Pad_Start )
|
if( g_DragSegmentList[ii].m_Pad_Start )
|
||||||
Track->m_Start = Pad_OldPos;
|
Track->m_Start = Pad_OldPos;
|
||||||
|
|
||||||
if( g_DragSegmentList[ii].m_Pad_End )
|
if( g_DragSegmentList[ii].m_Pad_End )
|
||||||
Track->m_End = Pad_OldPos;
|
Track->m_End = Pad_OldPos;
|
||||||
|
|
||||||
|
@ -342,6 +344,7 @@ void PCB_BASE_FRAME::PlacePad( D_PAD* Pad, wxDC* DC )
|
||||||
// Set the new state
|
// Set the new state
|
||||||
if( g_DragSegmentList[ii].m_Pad_Start )
|
if( g_DragSegmentList[ii].m_Pad_Start )
|
||||||
Track->m_Start = Pad->m_Pos;
|
Track->m_Start = Pad->m_Pos;
|
||||||
|
|
||||||
if( g_DragSegmentList[ii].m_Pad_End )
|
if( g_DragSegmentList[ii].m_Pad_End )
|
||||||
Track->m_End = Pad->m_Pos;
|
Track->m_End = Pad->m_Pos;
|
||||||
|
|
||||||
|
@ -351,8 +354,7 @@ void PCB_BASE_FRAME::PlacePad( D_PAD* Pad, wxDC* DC )
|
||||||
Track->Draw( DrawPanel, DC, GR_OR );
|
Track->Draw( DrawPanel, DC, GR_OR );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Compute local coordinates (i.e refer to Module position and for Module
|
/* Compute local coordinates (i.e refer to Module position and for Module orient = 0) */
|
||||||
* orient = 0) */
|
|
||||||
dX = Pad->m_Pos.x - Pad_OldPos.x;
|
dX = Pad->m_Pos.x - Pad_OldPos.x;
|
||||||
dY = Pad->m_Pos.y - Pad_OldPos.y;
|
dY = Pad->m_Pos.y - Pad_OldPos.y;
|
||||||
RotatePoint( &dX, &dY, -Module->m_Orient );
|
RotatePoint( &dX, &dY, -Module->m_Orient );
|
||||||
|
@ -365,7 +367,7 @@ void PCB_BASE_FRAME::PlacePad( D_PAD* Pad, wxDC* DC )
|
||||||
if( DC )
|
if( DC )
|
||||||
Pad->Draw( DrawPanel, DC, GR_OR );
|
Pad->Draw( DrawPanel, DC, GR_OR );
|
||||||
|
|
||||||
Module->Set_Rectangle_Encadrement();
|
Module->CalculateBoundingBox();
|
||||||
Module->m_LastEdit_Time = time( NULL );
|
Module->m_LastEdit_Time = time( NULL );
|
||||||
|
|
||||||
EraseDragList();
|
EraseDragList();
|
||||||
|
@ -400,7 +402,7 @@ void PCB_BASE_FRAME::RotatePad( D_PAD* Pad, wxDC* DC )
|
||||||
|
|
||||||
EXCHG( Pad->m_DeltaSize.x, Pad->m_DeltaSize.y );
|
EXCHG( Pad->m_DeltaSize.x, Pad->m_DeltaSize.y );
|
||||||
Pad->m_DeltaSize.x = -Pad->m_DeltaSize.x;
|
Pad->m_DeltaSize.x = -Pad->m_DeltaSize.x;
|
||||||
Module->Set_Rectangle_Encadrement();
|
Module->CalculateBoundingBox();
|
||||||
Pad->DisplayInfo( this );
|
Pad->DisplayInfo( this );
|
||||||
|
|
||||||
if( DC )
|
if( DC )
|
||||||
|
|
|
@ -83,6 +83,7 @@ static void Abort_MoveTrack( EDA_DRAW_PANEL* Panel, wxDC* DC )
|
||||||
TRACK* Track = NewTrack;
|
TRACK* Track = NewTrack;
|
||||||
int dx = s_LastPos.x - PosInit.x;
|
int dx = s_LastPos.x - PosInit.x;
|
||||||
int dy = s_LastPos.y - PosInit.y;
|
int dy = s_LastPos.y - PosInit.y;
|
||||||
|
|
||||||
for( ii = 0; ii < NbPtNewTrack; ii++, Track = Track->Next() )
|
for( ii = 0; ii < NbPtNewTrack; ii++, Track = Track->Next() )
|
||||||
{
|
{
|
||||||
if( Track == NULL )
|
if( Track == NULL )
|
||||||
|
@ -97,7 +98,7 @@ static void Abort_MoveTrack( EDA_DRAW_PANEL* Panel, wxDC* DC )
|
||||||
Track->m_Flags = 0;
|
Track->m_Flags = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Trace_Une_Piste( Panel, DC, NewTrack, NbPtNewTrack, GR_OR );
|
DrawTraces( Panel, DC, NewTrack, NbPtNewTrack, GR_OR );
|
||||||
}
|
}
|
||||||
|
|
||||||
NewTrack = NULL;
|
NewTrack = NULL;
|
||||||
|
@ -147,7 +148,7 @@ static void Show_MoveNode( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPo
|
||||||
if( aErase )
|
if( aErase )
|
||||||
{
|
{
|
||||||
if( NewTrack )
|
if( NewTrack )
|
||||||
Trace_Une_Piste( aPanel, aDC, NewTrack, NbPtNewTrack, draw_mode );
|
DrawTraces( aPanel, aDC, NewTrack, NbPtNewTrack, draw_mode );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set the new track coordinates */
|
/* set the new track coordinates */
|
||||||
|
@ -169,7 +170,7 @@ static void Show_MoveNode( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPo
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Redraw the current moved track segments */
|
/* Redraw the current moved track segments */
|
||||||
Trace_Une_Piste( aPanel, aDC, NewTrack, NbPtNewTrack, draw_mode );
|
DrawTraces( aPanel, aDC, NewTrack, NbPtNewTrack, draw_mode );
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
|
for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
|
||||||
{
|
{
|
||||||
|
@ -422,13 +423,13 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( EDA_DRAW_PANEL* aPanel, wxDC
|
||||||
xi1 = tx1;
|
xi1 = tx1;
|
||||||
yi1 = ty1;
|
yi1 = ty1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( tSegmentToEnd == NULL )
|
if( tSegmentToEnd == NULL )
|
||||||
{
|
{
|
||||||
xi2 = tx2;
|
xi2 = tx2;
|
||||||
yi2 = ty2;
|
yi2 = ty2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if( update )
|
if( update )
|
||||||
{
|
{
|
||||||
s_LastPos = Pos;
|
s_LastPos = Pos;
|
||||||
|
@ -492,22 +493,23 @@ bool InitialiseDragParameters()
|
||||||
Track = g_DragSegmentList[ii].m_Segm;
|
Track = g_DragSegmentList[ii].m_Segm;
|
||||||
if( Track == NULL )
|
if( Track == NULL )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
ii--;
|
ii--;
|
||||||
|
|
||||||
if( ii >= 0)
|
if( ii >= 0)
|
||||||
{
|
{
|
||||||
if( s_EndSegmentPresent )
|
if( s_EndSegmentPresent )
|
||||||
{
|
{
|
||||||
tSegmentToEnd = g_DragSegmentList[ii].m_Segm; // Get the segment
|
tSegmentToEnd = g_DragSegmentList[ii].m_Segm; // Get the segment connected to
|
||||||
// connected to the end
|
// the end point
|
||||||
// point
|
|
||||||
ii--;
|
ii--;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( s_StartSegmentPresent )
|
if( s_StartSegmentPresent )
|
||||||
{
|
{
|
||||||
if( ii >= 0 )
|
if( ii >= 0 )
|
||||||
tSegmentToStart = g_DragSegmentList[ii].m_Segm; // Get the segment
|
tSegmentToStart = g_DragSegmentList[ii].m_Segm; // Get the segment connected to
|
||||||
// connected to the
|
// the start point
|
||||||
// start point
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -549,6 +551,7 @@ bool InitialiseDragParameters()
|
||||||
ty2 = (double) Track->m_End.y;
|
ty2 = (double) Track->m_End.y;
|
||||||
RotatePoint( &tx2, &ty2, tx1, ty1, 900 );
|
RotatePoint( &tx2, &ty2, tx1, ty1, 900 );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( tx1 != tx2 )
|
if( tx1 != tx2 )
|
||||||
{
|
{
|
||||||
s_StartSegmentSlope = ( ty2 - ty1 ) / ( tx2 - tx1 );
|
s_StartSegmentSlope = ( ty2 - ty1 ) / ( tx2 - tx1 );
|
||||||
|
@ -558,6 +561,7 @@ bool InitialiseDragParameters()
|
||||||
{
|
{
|
||||||
s_StartPointVertical = true; //signal first segment vertical
|
s_StartPointVertical = true; //signal first segment vertical
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ty1 == ty2 )
|
if( ty1 == ty2 )
|
||||||
{
|
{
|
||||||
s_StartPointHorizontal = true;
|
s_StartPointHorizontal = true;
|
||||||
|
@ -602,6 +606,7 @@ bool InitialiseDragParameters()
|
||||||
{
|
{
|
||||||
s_EndPointVertical = true; //signal second segment vertical
|
s_EndPointVertical = true; //signal second segment vertical
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ty1 == ty2 )
|
if( ty1 == ty2 )
|
||||||
{
|
{
|
||||||
s_EndPointHorizontal = true;
|
s_EndPointHorizontal = true;
|
||||||
|
@ -621,6 +626,7 @@ bool InitialiseDragParameters()
|
||||||
{
|
{
|
||||||
s_MovingSegmentVertical = true; //signal vertical line
|
s_MovingSegmentVertical = true; //signal vertical line
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ty1 == ty2 )
|
if( ty1 == ty2 )
|
||||||
{
|
{
|
||||||
s_MovingSegmentHorizontal = true;
|
s_MovingSegmentHorizontal = true;
|
||||||
|
@ -634,11 +640,10 @@ bool InitialiseDragParameters()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( !s_EndPointVertical
|
if( !s_EndPointVertical && ( s_MovingSegmentSlope == s_EndSegmentSlope ) )
|
||||||
&& ( s_MovingSegmentSlope == s_EndSegmentSlope ) )
|
|
||||||
return false;
|
return false;
|
||||||
if( !s_StartPointVertical
|
|
||||||
&& ( s_MovingSegmentSlope == s_StartSegmentSlope ) )
|
if( !s_StartPointVertical && ( s_MovingSegmentSlope == s_StartSegmentSlope ) )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -664,17 +669,20 @@ void PCB_EDIT_FRAME::Start_MoveOneNodeOrSegment( TRACK* track, wxDC* DC, int com
|
||||||
|
|
||||||
if( GetBoard()->IsHightLightNetON() )
|
if( GetBoard()->IsHightLightNetON() )
|
||||||
High_Light( DC );
|
High_Light( DC );
|
||||||
|
|
||||||
PosInit = GetScreen()->GetCrossHairPosition();
|
PosInit = GetScreen()->GetCrossHairPosition();
|
||||||
|
|
||||||
if( track->Type() == TYPE_VIA ) // For a via: always drag it
|
if( track->Type() == TYPE_VIA ) // For a via: always drag it
|
||||||
{
|
{
|
||||||
track->m_Flags = IS_DRAGGED | STARTPOINT | ENDPOINT;
|
track->m_Flags = IS_DRAGGED | STARTPOINT | ENDPOINT;
|
||||||
|
|
||||||
if( command != ID_POPUP_PCB_MOVE_TRACK_SEGMENT )
|
if( command != ID_POPUP_PCB_MOVE_TRACK_SEGMENT )
|
||||||
{
|
{
|
||||||
Collect_TrackSegmentsToDrag( DrawPanel, DC, track->m_Start,
|
Collect_TrackSegmentsToDrag( DrawPanel, DC, track->m_Start,
|
||||||
track->ReturnMaskLayer(),
|
track->ReturnMaskLayer(),
|
||||||
track->GetNet() );
|
track->GetNet() );
|
||||||
}
|
}
|
||||||
|
|
||||||
NewTrack = track;
|
NewTrack = track;
|
||||||
NbPtNewTrack = 1;
|
NbPtNewTrack = 1;
|
||||||
PosInit = track->m_Start;
|
PosInit = track->m_Start;
|
||||||
|
@ -719,6 +727,7 @@ void PCB_EDIT_FRAME::Start_MoveOneNodeOrSegment( TRACK* track, wxDC* DC, int com
|
||||||
ITEM_PICKER picker( track, UR_CHANGED );
|
ITEM_PICKER picker( track, UR_CHANGED );
|
||||||
picker.m_Link = track->Copy();
|
picker.m_Link = track->Copy();
|
||||||
s_ItemsListPicker.PushItem( picker );
|
s_ItemsListPicker.PushItem( picker );
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
|
for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
|
||||||
{
|
{
|
||||||
TRACK* draggedtrack = g_DragSegmentList[ii].m_Segm;
|
TRACK* draggedtrack = g_DragSegmentList[ii].m_Segm;
|
||||||
|
@ -774,13 +783,12 @@ void SortTrackEndPoints( TRACK* track )
|
||||||
* 2 collinear segments can be merged only in no other segment or via is
|
* 2 collinear segments can be merged only in no other segment or via is
|
||||||
* connected to the common point
|
* connected to the common point
|
||||||
* and if they have the same width. See cleanup.cpp for merge functions,
|
* and if they have the same width. See cleanup.cpp for merge functions,
|
||||||
* and consider Marque_Une_Piste() to locate segments that can be merged
|
* and consider MarkTrace() to locate segments that can be merged
|
||||||
*/
|
*/
|
||||||
bool PCB_EDIT_FRAME::MergeCollinearTracks( TRACK* track, wxDC* DC, int end )
|
bool PCB_EDIT_FRAME::MergeCollinearTracks( TRACK* track, wxDC* DC, int end )
|
||||||
{
|
{
|
||||||
testtrack = (TRACK*) Locate_Piste_Connectee( track,
|
testtrack = (TRACK*) GetConnectedTrace( track, GetBoard()->m_Track, NULL, end );
|
||||||
GetBoard()->m_Track, NULL,
|
|
||||||
end );
|
|
||||||
if( testtrack )
|
if( testtrack )
|
||||||
{
|
{
|
||||||
SortTrackEndPoints( track );
|
SortTrackEndPoints( track );
|
||||||
|
@ -790,14 +798,12 @@ bool PCB_EDIT_FRAME::MergeCollinearTracks( TRACK* track, wxDC* DC, int end )
|
||||||
int tdx = testtrack->m_End.x - testtrack->m_Start.x;
|
int tdx = testtrack->m_End.x - testtrack->m_Start.x;
|
||||||
int tdy = testtrack->m_End.y - testtrack->m_Start.y;
|
int tdy = testtrack->m_End.y - testtrack->m_Start.y;
|
||||||
|
|
||||||
if( ( dy * tdx == dx * tdy && dy != 0 && dx != 0 && tdy != 0 && tdx !=
|
if( ( dy * tdx == dx * tdy && dy != 0 && dx != 0 && tdy != 0 && tdx != 0 ) /* angle, same slope */
|
||||||
0 ) /* angle, same slope */
|
|
||||||
|| ( dy == 0 && tdy == 0 && dx * tdx ) /*horizontal */
|
|| ( dy == 0 && tdy == 0 && dx * tdx ) /*horizontal */
|
||||||
|| ( dx == 0 && tdx == 0 && dy * tdy ) /*vertical */
|
|| ( dx == 0 && tdx == 0 && dy * tdy ) /*vertical */
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if( track->m_Start == testtrack->m_Start || track->m_End ==
|
if( track->m_Start == testtrack->m_Start || track->m_End == testtrack->m_Start )
|
||||||
testtrack->m_Start )
|
|
||||||
{
|
{
|
||||||
if( ( dx * tdx && testtrack->m_End.x > track->m_End.x )
|
if( ( dx * tdx && testtrack->m_End.x > track->m_End.x )
|
||||||
||( dy * tdy && testtrack->m_End.y > track->m_End.y ) )
|
||( dy * tdy && testtrack->m_End.y > track->m_End.y ) )
|
||||||
|
@ -808,8 +814,8 @@ bool PCB_EDIT_FRAME::MergeCollinearTracks( TRACK* track, wxDC* DC, int end )
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( track->m_Start == testtrack->m_End || track->m_End ==
|
|
||||||
testtrack->m_End )
|
if( track->m_Start == testtrack->m_End || track->m_End == testtrack->m_End )
|
||||||
{
|
{
|
||||||
if( ( dx * tdx && testtrack->m_Start.x < track->m_Start.x )
|
if( ( dx * tdx && testtrack->m_Start.x < track->m_Start.x )
|
||||||
|| ( dy * tdy && testtrack->m_Start.y < track->m_Start.y ) )
|
|| ( dy * tdy && testtrack->m_Start.y < track->m_Start.y ) )
|
||||||
|
@ -846,6 +852,7 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC
|
||||||
while( MergeCollinearTracks( track, DC, START ) )
|
while( MergeCollinearTracks( track, DC, START ) )
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
while( MergeCollinearTracks( track, DC, END ) )
|
while( MergeCollinearTracks( track, DC, END ) )
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
@ -854,32 +861,32 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC
|
||||||
s_StartSegmentPresent = s_EndSegmentPresent = true;
|
s_StartSegmentPresent = s_EndSegmentPresent = true;
|
||||||
|
|
||||||
if( ( track->start == NULL ) || ( track->start->Type() == TYPE_TRACK ) )
|
if( ( track->start == NULL ) || ( track->start->Type() == TYPE_TRACK ) )
|
||||||
TrackToStartPoint = Locate_Piste_Connectee( track,
|
TrackToStartPoint = GetConnectedTrace( track, GetBoard()->m_Track, NULL, START );
|
||||||
GetBoard()->m_Track, NULL,
|
|
||||||
START );
|
|
||||||
|
|
||||||
// Test if more than one segment is connected to this point
|
// Test if more than one segment is connected to this point
|
||||||
if( TrackToStartPoint )
|
if( TrackToStartPoint )
|
||||||
{
|
{
|
||||||
TrackToStartPoint->SetState( BUSY, ON );
|
TrackToStartPoint->SetState( BUSY, ON );
|
||||||
|
|
||||||
if( ( TrackToStartPoint->Type() == TYPE_VIA )
|
if( ( TrackToStartPoint->Type() == TYPE_VIA )
|
||||||
|| Locate_Piste_Connectee( track, GetBoard()->m_Track, NULL, START ) )
|
|| GetConnectedTrace( track, GetBoard()->m_Track, NULL, START ) )
|
||||||
error = true;
|
error = true;
|
||||||
|
|
||||||
TrackToStartPoint->SetState( BUSY, OFF );
|
TrackToStartPoint->SetState( BUSY, OFF );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ( track->end == NULL ) || ( track->end->Type() == TYPE_TRACK ) )
|
if( ( track->end == NULL ) || ( track->end->Type() == TYPE_TRACK ) )
|
||||||
TrackToEndPoint = Locate_Piste_Connectee( track,
|
TrackToEndPoint = GetConnectedTrace( track, GetBoard()->m_Track, NULL, END );
|
||||||
GetBoard()->m_Track, NULL,
|
|
||||||
END );
|
|
||||||
|
|
||||||
// Test if more than one segment is connected to this point
|
// Test if more than one segment is connected to this point
|
||||||
if( TrackToEndPoint )
|
if( TrackToEndPoint )
|
||||||
{
|
{
|
||||||
TrackToEndPoint->SetState( BUSY, ON );
|
TrackToEndPoint->SetState( BUSY, ON );
|
||||||
|
|
||||||
if( (TrackToEndPoint->Type() == TYPE_VIA)
|
if( (TrackToEndPoint->Type() == TYPE_VIA)
|
||||||
|| Locate_Piste_Connectee( track, GetBoard()->m_Track, NULL, END ) )
|
|| GetConnectedTrace( track, GetBoard()->m_Track, NULL, END ) )
|
||||||
error = true;
|
error = true;
|
||||||
|
|
||||||
TrackToEndPoint->SetState( BUSY, OFF );
|
TrackToEndPoint->SetState( BUSY, OFF );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -898,6 +905,7 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC
|
||||||
|
|
||||||
/* Change high light net: the new one will be highlighted */
|
/* Change high light net: the new one will be highlighted */
|
||||||
GetBoard()->PushHightLight();
|
GetBoard()->PushHightLight();
|
||||||
|
|
||||||
if( GetBoard()->IsHightLightNetON() )
|
if( GetBoard()->IsHightLightNetON() )
|
||||||
High_Light( DC );
|
High_Light( DC );
|
||||||
|
|
||||||
|
@ -910,8 +918,10 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC
|
||||||
if( TrackToStartPoint )
|
if( TrackToStartPoint )
|
||||||
{
|
{
|
||||||
int flag = STARTPOINT;
|
int flag = STARTPOINT;
|
||||||
|
|
||||||
if( track->m_Start != TrackToStartPoint->m_Start )
|
if( track->m_Start != TrackToStartPoint->m_Start )
|
||||||
flag = ENDPOINT;
|
flag = ENDPOINT;
|
||||||
|
|
||||||
AddSegmentToDragList( DrawPanel, DC, flag, TrackToStartPoint );
|
AddSegmentToDragList( DrawPanel, DC, flag, TrackToStartPoint );
|
||||||
track->m_Flags |= STARTPOINT;
|
track->m_Flags |= STARTPOINT;
|
||||||
}
|
}
|
||||||
|
@ -919,8 +929,10 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC
|
||||||
if( TrackToEndPoint )
|
if( TrackToEndPoint )
|
||||||
{
|
{
|
||||||
int flag = STARTPOINT;
|
int flag = STARTPOINT;
|
||||||
|
|
||||||
if( track->m_End != TrackToEndPoint->m_Start )
|
if( track->m_End != TrackToEndPoint->m_Start )
|
||||||
flag = ENDPOINT;
|
flag = ENDPOINT;
|
||||||
|
|
||||||
AddSegmentToDragList( DrawPanel, DC, flag, TrackToEndPoint );
|
AddSegmentToDragList( DrawPanel, DC, flag, TrackToEndPoint );
|
||||||
track->m_Flags |= ENDPOINT;
|
track->m_Flags |= ENDPOINT;
|
||||||
}
|
}
|
||||||
|
@ -938,6 +950,7 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC
|
||||||
|
|
||||||
// Prepare the Undo command
|
// Prepare the Undo command
|
||||||
ITEM_PICKER picker( NULL, UR_CHANGED );
|
ITEM_PICKER picker( NULL, UR_CHANGED );
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
|
for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
|
||||||
{
|
{
|
||||||
TRACK* draggedtrack = g_DragSegmentList[ii].m_Segm;
|
TRACK* draggedtrack = g_DragSegmentList[ii].m_Segm;
|
||||||
|
@ -973,12 +986,15 @@ bool PCB_EDIT_FRAME::PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC )
|
||||||
if( Drc_On )
|
if( Drc_On )
|
||||||
{
|
{
|
||||||
errdrc = m_drc->Drc( Track, GetBoard()->m_Track );
|
errdrc = m_drc->Drc( Track, GetBoard()->m_Track );
|
||||||
|
|
||||||
if( errdrc == BAD_DRC )
|
if( errdrc == BAD_DRC )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* Redraw the dragged segments */
|
/* Redraw the dragged segments */
|
||||||
for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
|
for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
|
||||||
{
|
{
|
||||||
errdrc = m_drc->Drc( g_DragSegmentList[ii].m_Segm, GetBoard()->m_Track );
|
errdrc = m_drc->Drc( g_DragSegmentList[ii].m_Segm, GetBoard()->m_Track );
|
||||||
|
|
||||||
if( errdrc == BAD_DRC )
|
if( errdrc == BAD_DRC )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1002,14 +1018,15 @@ bool PCB_EDIT_FRAME::PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC )
|
||||||
/* Test the connections modified by the move
|
/* Test the connections modified by the move
|
||||||
* (only pad connection must be tested, track connection will be
|
* (only pad connection must be tested, track connection will be
|
||||||
* tested by test_1_net_connexion() ) */
|
* tested by test_1_net_connexion() ) */
|
||||||
int masque_layer = g_TabOneLayerMask[Track->GetLayer()];
|
int layerMask = g_TabOneLayerMask[Track->GetLayer()];
|
||||||
Track->start = Fast_Locate_Pad_Connecte( GetBoard(), Track->m_Start, masque_layer );
|
Track->start = Fast_Locate_Pad_Connecte( GetBoard(), Track->m_Start, layerMask );
|
||||||
|
|
||||||
if( Track->start )
|
if( Track->start )
|
||||||
Track->SetState( BEGIN_ONPAD, ON );
|
Track->SetState( BEGIN_ONPAD, ON );
|
||||||
else
|
else
|
||||||
Track->SetState( BEGIN_ONPAD, OFF );
|
Track->SetState( BEGIN_ONPAD, OFF );
|
||||||
|
|
||||||
Track->end = Fast_Locate_Pad_Connecte( GetBoard(), Track->m_End, masque_layer );
|
Track->end = Fast_Locate_Pad_Connecte( GetBoard(), Track->m_End, layerMask );
|
||||||
if( Track->end )
|
if( Track->end )
|
||||||
Track->SetState( END_ONPAD, ON );
|
Track->SetState( END_ONPAD, ON );
|
||||||
else
|
else
|
||||||
|
@ -1019,8 +1036,7 @@ bool PCB_EDIT_FRAME::PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC )
|
||||||
EraseDragList();
|
EraseDragList();
|
||||||
|
|
||||||
SaveCopyInUndoList( s_ItemsListPicker, UR_UNSPECIFIED );
|
SaveCopyInUndoList( s_ItemsListPicker, UR_UNSPECIFIED );
|
||||||
s_ItemsListPicker.ClearItemsList(); // s_ItemsListPicker is no more owner
|
s_ItemsListPicker.ClearItemsList(); // s_ItemsListPicker is no more owner of picked items
|
||||||
// of picked items
|
|
||||||
|
|
||||||
if( GetBoard()->IsHightLightNetON() )
|
if( GetBoard()->IsHightLightNetON() )
|
||||||
High_Light( DC );
|
High_Light( DC );
|
||||||
|
@ -1061,10 +1077,10 @@ BOARD_ITEM* LocateLockPoint( BOARD* Pcb, wxPoint pos, int LayerMask )
|
||||||
}
|
}
|
||||||
|
|
||||||
/* No pad has been located so check for a segment of the trace. */
|
/* No pad has been located so check for a segment of the trace. */
|
||||||
TRACK* ptsegm = Fast_Locate_Piste( Pcb->m_Track, NULL, pos, LayerMask );
|
TRACK* ptsegm = GetTrace( Pcb->m_Track, NULL, pos, LayerMask );
|
||||||
|
|
||||||
if( ptsegm == NULL )
|
if( ptsegm == NULL )
|
||||||
ptsegm = Locate_Pistes( Pcb, Pcb->m_Track, pos, LayerMask );
|
ptsegm = GetTrace( Pcb, Pcb->m_Track, pos, LayerMask );
|
||||||
|
|
||||||
return ptsegm;
|
return ptsegm;
|
||||||
}
|
}
|
||||||
|
@ -1133,6 +1149,7 @@ TRACK* CreateLockPoint( BOARD* aPcb,
|
||||||
newPoint.y += aSegm->m_Start.y;
|
newPoint.y += aSegm->m_Start.y;
|
||||||
|
|
||||||
TRACK* newTrack = aSegm->Copy();
|
TRACK* newTrack = aSegm->Copy();
|
||||||
|
|
||||||
if( aItemsListPicker )
|
if( aItemsListPicker )
|
||||||
{
|
{
|
||||||
ITEM_PICKER picker( newTrack, UR_NEW );
|
ITEM_PICKER picker( newTrack, UR_NEW );
|
||||||
|
@ -1169,6 +1186,7 @@ TRACK* CreateLockPoint( BOARD* aPcb,
|
||||||
newTrack->SetState( BEGIN_ONPAD, OFF );
|
newTrack->SetState( BEGIN_ONPAD, OFF );
|
||||||
|
|
||||||
D_PAD * pad = Locate_Pad_Connecte( aPcb, newTrack, START );
|
D_PAD * pad = Locate_Pad_Connecte( aPcb, newTrack, START );
|
||||||
|
|
||||||
if ( pad )
|
if ( pad )
|
||||||
{
|
{
|
||||||
newTrack->start = pad;
|
newTrack->start = pad;
|
||||||
|
|
|
@ -199,6 +199,7 @@ MODULE* PCB_EDIT_FRAME::Genere_Self( wxDC* DC )
|
||||||
/* Enter the desired length. */
|
/* Enter the desired length. */
|
||||||
msg = ReturnStringFromValue( g_UserUnit, Mself.lng, GetScreen()->GetInternalUnits() );
|
msg = ReturnStringFromValue( g_UserUnit, Mself.lng, GetScreen()->GetInternalUnits() );
|
||||||
wxTextEntryDialog dlg( this, _( "Length:" ), _( "Length" ), msg );
|
wxTextEntryDialog dlg( this, _( "Length:" ), _( "Length" ), msg );
|
||||||
|
|
||||||
if( dlg.ShowModal() != wxID_OK )
|
if( dlg.ShowModal() != wxID_OK )
|
||||||
return NULL; // cancelled by user
|
return NULL; // cancelled by user
|
||||||
|
|
||||||
|
@ -216,8 +217,8 @@ MODULE* PCB_EDIT_FRAME::Genere_Self( wxDC* DC )
|
||||||
Mself.m_Width = GetBoard()->GetCurrentTrackWidth();
|
Mself.m_Width = GetBoard()->GetCurrentTrackWidth();
|
||||||
|
|
||||||
std::vector <wxPoint> buffer;
|
std::vector <wxPoint> buffer;
|
||||||
ll = BuildCornersList_S_Shape( buffer, Mself.m_Start, Mself.m_End,
|
ll = BuildCornersList_S_Shape( buffer, Mself.m_Start, Mself.m_End, Mself.lng, Mself.m_Width );
|
||||||
Mself.lng, Mself.m_Width );
|
|
||||||
if( !ll )
|
if( !ll )
|
||||||
{
|
{
|
||||||
DisplayError( this, _( "Requested length too large" ) );
|
DisplayError( this, _( "Requested length too large" ) );
|
||||||
|
@ -228,6 +229,7 @@ MODULE* PCB_EDIT_FRAME::Genere_Self( wxDC* DC )
|
||||||
/* Generate module. */
|
/* Generate module. */
|
||||||
MODULE* Module;
|
MODULE* Module;
|
||||||
Module = Create_1_Module( wxEmptyString );
|
Module = Create_1_Module( wxEmptyString );
|
||||||
|
|
||||||
if( Module == NULL )
|
if( Module == NULL )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
@ -261,7 +263,7 @@ MODULE* PCB_EDIT_FRAME::Genere_Self( wxDC* DC )
|
||||||
PtPad->m_Pos = Mself.m_End;
|
PtPad->m_Pos = Mself.m_End;
|
||||||
PtPad->m_Pos0 = PtPad->m_Pos - Module->m_Pos;
|
PtPad->m_Pos0 = PtPad->m_Pos - Module->m_Pos;
|
||||||
PtPad->m_Size.x = PtPad->m_Size.y = Mself.m_Width;
|
PtPad->m_Size.x = PtPad->m_Size.y = Mself.m_Width;
|
||||||
PtPad->m_Masque_Layer = g_TabOneLayerMask[Module->GetLayer()];
|
PtPad->m_layerMask = g_TabOneLayerMask[Module->GetLayer()];
|
||||||
PtPad->m_Attribut = PAD_SMD;
|
PtPad->m_Attribut = PAD_SMD;
|
||||||
PtPad->m_PadShape = PAD_CIRCLE;
|
PtPad->m_PadShape = PAD_CIRCLE;
|
||||||
PtPad->ComputeShapeMaxRadius();
|
PtPad->ComputeShapeMaxRadius();
|
||||||
|
@ -288,8 +290,7 @@ MODULE* PCB_EDIT_FRAME::Genere_Self( wxDC* DC )
|
||||||
Module->m_Reference->m_Pos0 = Module->m_Reference->m_Pos - Module->m_Pos;
|
Module->m_Reference->m_Pos0 = Module->m_Reference->m_Pos - Module->m_Pos;
|
||||||
Module->m_Value->m_Pos0 = Module->m_Value->m_Pos - Module->m_Pos;
|
Module->m_Value->m_Pos0 = Module->m_Value->m_Pos - Module->m_Pos;
|
||||||
|
|
||||||
|
Module->CalculateBoundingBox();
|
||||||
Module->Set_Rectangle_Encadrement();
|
|
||||||
Module->Draw( DrawPanel, DC, GR_OR );
|
Module->Draw( DrawPanel, DC, GR_OR );
|
||||||
|
|
||||||
return Module;
|
return Module;
|
||||||
|
@ -394,7 +395,7 @@ int BuildCornersList_S_Shape( std::vector <wxPoint>& aBuffer,
|
||||||
wxPoint pt = aEndPoint - aStartPoint;
|
wxPoint pt = aEndPoint - aStartPoint;
|
||||||
int angle = -wxRound( atan2( (double) pt.y, (double) pt.x ) * 1800.0 / M_PI );
|
int angle = -wxRound( atan2( (double) pt.y, (double) pt.x ) * 1800.0 / M_PI );
|
||||||
int min_len = wxRound( sqrt( (double) pt.x * pt.x + (double) pt.y * pt.y ) );
|
int min_len = wxRound( sqrt( (double) pt.x * pt.x + (double) pt.y * pt.y ) );
|
||||||
int segm_len = 0; // lenght of segments
|
int segm_len = 0; // length of segments
|
||||||
int full_len; // full len of shape (sum of lenght of all segments + arcs)
|
int full_len; // full len of shape (sum of lenght of all segments + arcs)
|
||||||
|
|
||||||
|
|
||||||
|
@ -415,19 +416,23 @@ int BuildCornersList_S_Shape( std::vector <wxPoint>& aBuffer,
|
||||||
int segm_count; // number of full len segments
|
int segm_count; // number of full len segments
|
||||||
// the half size segments (first and last segment) are not counted here
|
// the half size segments (first and last segment) are not counted here
|
||||||
int stubs_len = 0; // lenght of first or last segment (half size of others segments)
|
int stubs_len = 0; // lenght of first or last segment (half size of others segments)
|
||||||
|
|
||||||
for( segm_count = 0; ; segm_count++ )
|
for( segm_count = 0; ; segm_count++ )
|
||||||
{
|
{
|
||||||
stubs_len = ( size.y - ( radius * 2 * (segm_count + 2 ) ) ) / 2;
|
stubs_len = ( size.y - ( radius * 2 * (segm_count + 2 ) ) ) / 2;
|
||||||
|
|
||||||
if( stubs_len < size.y / 10 ) // Reduce radius.
|
if( stubs_len < size.y / 10 ) // Reduce radius.
|
||||||
{
|
{
|
||||||
stubs_len = size.y / 10;
|
stubs_len = size.y / 10;
|
||||||
radius = ( size.y - (2 * stubs_len) ) / ( 2 * (segm_count + 2) );
|
radius = ( size.y - (2 * stubs_len) ) / ( 2 * (segm_count + 2) );
|
||||||
|
|
||||||
if( radius < aWidth ) // Radius too small.
|
if( radius < aWidth ) // Radius too small.
|
||||||
{
|
{
|
||||||
// Unable to create line: Requested length value is too large for room
|
// Unable to create line: Requested length value is too large for room
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
segm_len = size.x - ( radius * 2 );
|
segm_len = size.x - ( radius * 2 );
|
||||||
full_len = 2 * stubs_len; // Length of coil connections.
|
full_len = 2 * stubs_len; // Length of coil connections.
|
||||||
full_len += segm_len * segm_count; // Length of full length segments.
|
full_len += segm_len * segm_count; // Length of full length segments.
|
||||||
|
@ -457,6 +462,7 @@ int BuildCornersList_S_Shape( std::vector <wxPoint>& aBuffer,
|
||||||
pt = aBuffer.back();
|
pt = aBuffer.back();
|
||||||
|
|
||||||
int half_size_seg_len = segm_len / 2 - radius;
|
int half_size_seg_len = segm_len / 2 - radius;
|
||||||
|
|
||||||
if( half_size_seg_len )
|
if( half_size_seg_len )
|
||||||
{
|
{
|
||||||
pt.x -= half_size_seg_len;
|
pt.x -= half_size_seg_len;
|
||||||
|
@ -467,6 +473,7 @@ int BuildCornersList_S_Shape( std::vector <wxPoint>& aBuffer,
|
||||||
int ii;
|
int ii;
|
||||||
int sign = 1;
|
int sign = 1;
|
||||||
segm_count += 1; // increase segm_count to create the last half_size segment
|
segm_count += 1; // increase segm_count to create the last half_size segment
|
||||||
|
|
||||||
for( ii = 0; ii < segm_count; ii++ )
|
for( ii = 0; ii < segm_count; ii++ )
|
||||||
{
|
{
|
||||||
int arc_angle;
|
int arc_angle;
|
||||||
|
@ -475,6 +482,7 @@ int BuildCornersList_S_Shape( std::vector <wxPoint>& aBuffer,
|
||||||
sign = -1;
|
sign = -1;
|
||||||
else
|
else
|
||||||
sign = 1;
|
sign = 1;
|
||||||
|
|
||||||
arc_angle = 1800 * sign;
|
arc_angle = 1800 * sign;
|
||||||
centre = pt;
|
centre = pt;
|
||||||
centre.y += radius;
|
centre.y += radius;
|
||||||
|
@ -498,10 +506,10 @@ int BuildCornersList_S_Shape( std::vector <wxPoint>& aBuffer,
|
||||||
|
|
||||||
// Rotate point
|
// Rotate point
|
||||||
angle += 900;
|
angle += 900;
|
||||||
|
|
||||||
for( unsigned jj = 0; jj < aBuffer.size(); jj++ )
|
for( unsigned jj = 0; jj < aBuffer.size(); jj++ )
|
||||||
{
|
{
|
||||||
RotatePoint( &aBuffer[jj].x, &aBuffer[jj].y,
|
RotatePoint( &aBuffer[jj].x, &aBuffer[jj].y, aStartPoint.x, aStartPoint.y, angle );
|
||||||
aStartPoint.x, aStartPoint.y, angle );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// push last point (end point)
|
// push last point (end point)
|
||||||
|
@ -522,6 +530,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveBasicShape( const wxString& name, int pad_c
|
||||||
wxString Line;
|
wxString Line;
|
||||||
|
|
||||||
Module = Create_1_Module( name );
|
Module = Create_1_Module( name );
|
||||||
|
|
||||||
if( Module == NULL )
|
if( Module == NULL )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
@ -550,7 +559,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveBasicShape( const wxString& name, int pad_c
|
||||||
pad->m_Pos = Module->m_Pos;
|
pad->m_Pos = Module->m_Pos;
|
||||||
pad->m_PadShape = PAD_RECT;
|
pad->m_PadShape = PAD_RECT;
|
||||||
pad->m_Attribut = PAD_SMD;
|
pad->m_Attribut = PAD_SMD;
|
||||||
pad->m_Masque_Layer = LAYER_FRONT;
|
pad->m_layerMask = LAYER_FRONT;
|
||||||
Line.Printf( wxT( "%d" ), pad_num );
|
Line.Printf( wxT( "%d" ), pad_num );
|
||||||
pad->SetPadName( Line );
|
pad->SetPadName( Line );
|
||||||
pad_num++;
|
pad_num++;
|
||||||
|
@ -605,6 +614,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveComponent( int shape_type )
|
||||||
wxString value = ReturnStringFromValue( g_UserUnit, gap_size,
|
wxString value = ReturnStringFromValue( g_UserUnit, gap_size,
|
||||||
GetScreen()->GetInternalUnits() );
|
GetScreen()->GetInternalUnits() );
|
||||||
wxTextEntryDialog dlg( this, msg, _( "Create microwave module" ), value );
|
wxTextEntryDialog dlg( this, msg, _( "Create microwave module" ), value );
|
||||||
|
|
||||||
if( dlg.ShowModal() != wxID_OK )
|
if( dlg.ShowModal() != wxID_OK )
|
||||||
{
|
{
|
||||||
DrawPanel->MoveCursorToCrossHair();
|
DrawPanel->MoveCursorToCrossHair();
|
||||||
|
@ -615,24 +625,30 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveComponent( int shape_type )
|
||||||
gap_size = ReturnValueFromString( g_UserUnit, value, GetScreen()->GetInternalUnits() );
|
gap_size = ReturnValueFromString( g_UserUnit, value, GetScreen()->GetInternalUnits() );
|
||||||
|
|
||||||
bool abort = false;
|
bool abort = false;
|
||||||
|
|
||||||
if( shape_type == 2 )
|
if( shape_type == 2 )
|
||||||
{
|
{
|
||||||
double fcoeff = 10.0, fval;
|
double fcoeff = 10.0, fval;
|
||||||
msg.Printf( wxT( "%3.1f" ), angle / fcoeff );
|
msg.Printf( wxT( "%3.1f" ), angle / fcoeff );
|
||||||
wxTextEntryDialog angledlg( this, _( "Angle (0.1deg):" ), _(
|
wxTextEntryDialog angledlg( this, _( "Angle (0.1deg):" ),
|
||||||
"Create microwave module" ), msg );
|
_( "Create microwave module" ), msg );
|
||||||
|
|
||||||
if( angledlg.ShowModal() != wxID_OK )
|
if( angledlg.ShowModal() != wxID_OK )
|
||||||
{
|
{
|
||||||
DrawPanel->MoveCursorToCrossHair();
|
DrawPanel->MoveCursorToCrossHair();
|
||||||
return NULL; // cancelled by user
|
return NULL; // cancelled by user
|
||||||
}
|
}
|
||||||
|
|
||||||
msg = angledlg.GetValue();
|
msg = angledlg.GetValue();
|
||||||
|
|
||||||
if( !msg.ToDouble( &fval ) )
|
if( !msg.ToDouble( &fval ) )
|
||||||
{
|
{
|
||||||
DisplayError( this, _( "Incorrect number, abort" ) );
|
DisplayError( this, _( "Incorrect number, abort" ) );
|
||||||
abort = TRUE;
|
abort = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
angle = ABS( wxRound( fval * fcoeff ) );
|
angle = ABS( wxRound( fval * fcoeff ) );
|
||||||
|
|
||||||
if( angle > 1800 )
|
if( angle > 1800 )
|
||||||
angle = 1800;
|
angle = 1800;
|
||||||
}
|
}
|
||||||
|
@ -681,6 +697,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveComponent( int shape_type )
|
||||||
polyPoints.push_back( wxPoint( 0, 0 ) );
|
polyPoints.push_back( wxPoint( 0, 0 ) );
|
||||||
|
|
||||||
int theta = -angle / 2;
|
int theta = -angle / 2;
|
||||||
|
|
||||||
for( int ii = 1; ii<numPoints - 1; ii++ )
|
for( int ii = 1; ii<numPoints - 1; ii++ )
|
||||||
{
|
{
|
||||||
wxPoint pt( 0, -gap_size );
|
wxPoint pt( 0, -gap_size );
|
||||||
|
@ -690,6 +707,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveComponent( int shape_type )
|
||||||
polyPoints.push_back( pt );
|
polyPoints.push_back( pt );
|
||||||
|
|
||||||
theta += 50;
|
theta += 50;
|
||||||
|
|
||||||
if( theta > angle / 2 )
|
if( theta > angle / 2 )
|
||||||
theta = angle / 2;
|
theta = angle / 2;
|
||||||
}
|
}
|
||||||
|
@ -703,7 +721,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveComponent( int shape_type )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Module->Set_Rectangle_Encadrement();
|
Module->CalculateBoundingBox();
|
||||||
GetBoard()->m_Status_Pcb = 0;
|
GetBoard()->m_Status_Pcb = 0;
|
||||||
OnModify();
|
OnModify();
|
||||||
return Module;
|
return Module;
|
||||||
|
@ -748,8 +766,7 @@ END_EVENT_TABLE()
|
||||||
|
|
||||||
WinEDA_SetParamShapeFrame::WinEDA_SetParamShapeFrame( PCB_EDIT_FRAME* parent,
|
WinEDA_SetParamShapeFrame::WinEDA_SetParamShapeFrame( PCB_EDIT_FRAME* parent,
|
||||||
const wxPoint& framepos ) :
|
const wxPoint& framepos ) :
|
||||||
wxDialog( parent, -1, _( "Complex shape" ), framepos, wxSize( 350, 280 ),
|
wxDialog( parent, -1, _( "Complex shape" ), framepos, wxSize( 350, 280 ), DIALOG_STYLE )
|
||||||
DIALOG_STYLE )
|
|
||||||
{
|
{
|
||||||
m_Parent = parent;
|
m_Parent = parent;
|
||||||
|
|
||||||
|
@ -772,8 +789,7 @@ WinEDA_SetParamShapeFrame::WinEDA_SetParamShapeFrame( PCB_EDIT_FRAME* parent,
|
||||||
Button = new wxButton( this, wxID_CANCEL, _( "Cancel" ) );
|
Button = new wxButton( this, wxID_CANCEL, _( "Cancel" ) );
|
||||||
RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
|
RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
|
||||||
|
|
||||||
Button =
|
Button = new wxButton( this, ID_READ_SHAPE_FILE,
|
||||||
new wxButton( this, ID_READ_SHAPE_FILE,
|
|
||||||
_( "Read Shape Description File..." ) );
|
_( "Read Shape Description File..." ) );
|
||||||
RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
|
RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
|
||||||
|
|
||||||
|
@ -782,6 +798,7 @@ WinEDA_SetParamShapeFrame::WinEDA_SetParamShapeFrame( PCB_EDIT_FRAME* parent,
|
||||||
_( "Normal" ), _( "Symmetrical" ),
|
_( "Normal" ), _( "Symmetrical" ),
|
||||||
_( "Mirrored" )
|
_( "Mirrored" )
|
||||||
};
|
};
|
||||||
|
|
||||||
m_ShapeOptionCtrl = new wxRadioBox( this, -1, _( "Shape Option" ),
|
m_ShapeOptionCtrl = new wxRadioBox( this, -1, _( "Shape Option" ),
|
||||||
wxDefaultPosition, wxDefaultSize, 3,
|
wxDefaultPosition, wxDefaultSize, 3,
|
||||||
shapelist, 1,
|
shapelist, 1,
|
||||||
|
@ -801,6 +818,7 @@ void WinEDA_SetParamShapeFrame::OnCancelClick( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
if( PolyEdges )
|
if( PolyEdges )
|
||||||
free( PolyEdges );
|
free( PolyEdges );
|
||||||
|
|
||||||
PolyEdges = NULL;
|
PolyEdges = NULL;
|
||||||
PolyEdgesCount = 0;
|
PolyEdgesCount = 0;
|
||||||
EndModal( -1 );
|
EndModal( -1 );
|
||||||
|
@ -849,7 +867,7 @@ void WinEDA_SetParamShapeFrame::ReadDataShapeDescr( wxCommandEvent& event )
|
||||||
mask,
|
mask,
|
||||||
this,
|
this,
|
||||||
wxFD_OPEN,
|
wxFD_OPEN,
|
||||||
TRUE );
|
true );
|
||||||
if( FullFileName.IsEmpty() )
|
if( FullFileName.IsEmpty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -869,6 +887,7 @@ void WinEDA_SetParamShapeFrame::ReadDataShapeDescr( wxCommandEvent& event )
|
||||||
ptbuf = PolyEdges = (double*) MyZMalloc( bufsize * 2 * sizeof(double) );
|
ptbuf = PolyEdges = (double*) MyZMalloc( bufsize * 2 * sizeof(double) );
|
||||||
|
|
||||||
SetLocaleTo_C_standard();
|
SetLocaleTo_C_standard();
|
||||||
|
|
||||||
while( reader.ReadLine() )
|
while( reader.ReadLine() )
|
||||||
{
|
{
|
||||||
Line = reader.Line();
|
Line = reader.Line();
|
||||||
|
@ -879,11 +898,14 @@ void WinEDA_SetParamShapeFrame::ReadDataShapeDescr( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
if( strnicmp( param2, "inch", 4 ) == 0 )
|
if( strnicmp( param2, "inch", 4 ) == 0 )
|
||||||
unitconv = 10000;
|
unitconv = 10000;
|
||||||
|
|
||||||
if( strnicmp( param2, "mm", 2 ) == 0 )
|
if( strnicmp( param2, "mm", 2 ) == 0 )
|
||||||
unitconv = 10000 / 25.4;
|
unitconv = 10000 / 25.4;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( strnicmp( param1, "$ENDCOORD", 8 ) == 0 )
|
if( strnicmp( param1, "$ENDCOORD", 8 ) == 0 )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if( strnicmp( param1, "$COORD", 6 ) == 0 )
|
if( strnicmp( param1, "$COORD", 6 ) == 0 )
|
||||||
{
|
{
|
||||||
while( reader.ReadLine() )
|
while( reader.ReadLine() )
|
||||||
|
@ -891,17 +913,19 @@ void WinEDA_SetParamShapeFrame::ReadDataShapeDescr( wxCommandEvent& event )
|
||||||
Line = reader.Line();
|
Line = reader.Line();
|
||||||
param1 = strtok( Line, " \t\n\r" );
|
param1 = strtok( Line, " \t\n\r" );
|
||||||
param2 = strtok( NULL, " \t\n\r" );
|
param2 = strtok( NULL, " \t\n\r" );
|
||||||
|
|
||||||
if( strnicmp( param1, "$ENDCOORD", 8 ) == 0 )
|
if( strnicmp( param1, "$ENDCOORD", 8 ) == 0 )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if( bufsize <= PolyEdgesCount )
|
if( bufsize <= PolyEdgesCount )
|
||||||
{
|
{
|
||||||
int index = ptbuf - PolyEdges;
|
int index = ptbuf - PolyEdges;
|
||||||
bufsize *= 2;
|
bufsize *= 2;
|
||||||
ptbuf = PolyEdges = (double*) realloc(
|
ptbuf = PolyEdges = (double*) realloc( PolyEdges, bufsize * 2 *
|
||||||
PolyEdges, bufsize * 2 *
|
|
||||||
sizeof(double) );
|
sizeof(double) );
|
||||||
ptbuf += index;
|
ptbuf += index;
|
||||||
}
|
}
|
||||||
|
|
||||||
*ptbuf = atof( param1 );
|
*ptbuf = atof( param1 );
|
||||||
ptbuf++;
|
ptbuf++;
|
||||||
*ptbuf = atof( param2 );
|
*ptbuf = atof( param2 );
|
||||||
|
@ -909,10 +933,12 @@ void WinEDA_SetParamShapeFrame::ReadDataShapeDescr( wxCommandEvent& event )
|
||||||
PolyEdgesCount++;
|
PolyEdgesCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( strnicmp( Line, "XScale", 6 ) == 0 )
|
if( strnicmp( Line, "XScale", 6 ) == 0 )
|
||||||
{
|
{
|
||||||
ShapeScaleX = atof( param2 );
|
ShapeScaleX = atof( param2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( strnicmp( Line, "YScale", 6 ) == 0 )
|
if( strnicmp( Line, "YScale", 6 ) == 0 )
|
||||||
{
|
{
|
||||||
ShapeScaleY = atof( param2 );
|
ShapeScaleY = atof( param2 );
|
||||||
|
@ -924,6 +950,7 @@ void WinEDA_SetParamShapeFrame::ReadDataShapeDescr( wxCommandEvent& event )
|
||||||
free( PolyEdges );
|
free( PolyEdges );
|
||||||
PolyEdges = NULL;
|
PolyEdges = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetLocaleTo_Default(); // revert to the current locale
|
SetLocaleTo_Default(); // revert to the current locale
|
||||||
|
|
||||||
ShapeScaleX *= unitconv;
|
ShapeScaleX *= unitconv;
|
||||||
|
@ -942,8 +969,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWavePolygonShape()
|
||||||
EDGE_MODULE* edge;
|
EDGE_MODULE* edge;
|
||||||
int ii, npoints;
|
int ii, npoints;
|
||||||
|
|
||||||
WinEDA_SetParamShapeFrame* frame = new WinEDA_SetParamShapeFrame(
|
WinEDA_SetParamShapeFrame* frame = new WinEDA_SetParamShapeFrame( this, wxPoint( -1, -1 ) );
|
||||||
this, wxPoint( -1, -1 ) );
|
|
||||||
|
|
||||||
int ok = frame->ShowModal();
|
int ok = frame->ShowModal();
|
||||||
|
|
||||||
|
@ -955,6 +981,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWavePolygonShape()
|
||||||
{
|
{
|
||||||
if( PolyEdges )
|
if( PolyEdges )
|
||||||
free( PolyEdges );
|
free( PolyEdges );
|
||||||
|
|
||||||
PolyEdges = NULL;
|
PolyEdges = NULL;
|
||||||
PolyEdgesCount = 0;
|
PolyEdgesCount = 0;
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -971,6 +998,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWavePolygonShape()
|
||||||
DisplayError( this, _( "Shape has a null size!" ) );
|
DisplayError( this, _( "Shape has a null size!" ) );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( PolyEdgesCount == 0 )
|
if( PolyEdgesCount == 0 )
|
||||||
{
|
{
|
||||||
DisplayError( this, _( "Shape has no points!" ) );
|
DisplayError( this, _( "Shape has no points!" ) );
|
||||||
|
@ -1005,6 +1033,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWavePolygonShape()
|
||||||
|
|
||||||
double* dptr = PolyEdges;
|
double* dptr = PolyEdges;
|
||||||
wxPoint first_coordinate, last_coordinate;
|
wxPoint first_coordinate, last_coordinate;
|
||||||
|
|
||||||
for( ii = 0; ii < npoints; ii++ ) // Copy points
|
for( ii = 0; ii < npoints; ii++ ) // Copy points
|
||||||
{
|
{
|
||||||
last_coordinate.x = wxRound( *dptr++ *ShapeScaleX ) + pad1->m_Pos0.x;
|
last_coordinate.x = wxRound( *dptr++ *ShapeScaleX ) + pad1->m_Pos0.x;
|
||||||
|
@ -1049,7 +1078,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWavePolygonShape()
|
||||||
PolyEdgesCount = 0;
|
PolyEdgesCount = 0;
|
||||||
PolyEdges = NULL;
|
PolyEdges = NULL;
|
||||||
|
|
||||||
Module->Set_Rectangle_Encadrement();
|
Module->CalculateBoundingBox();
|
||||||
GetBoard()->m_Status_Pcb = 0;
|
GetBoard()->m_Status_Pcb = 0;
|
||||||
OnModify();
|
OnModify();
|
||||||
return Module;
|
return Module;
|
||||||
|
@ -1071,16 +1100,20 @@ void PCB_EDIT_FRAME::Edit_Gap( wxDC* DC, MODULE* Module )
|
||||||
|
|
||||||
/* Test if module is a gap type (name begins with GAP, and has 2 pads). */
|
/* Test if module is a gap type (name begins with GAP, and has 2 pads). */
|
||||||
msg = Module->m_Reference->m_Text.Left( 3 );
|
msg = Module->m_Reference->m_Text.Left( 3 );
|
||||||
|
|
||||||
if( msg != wxT( "GAP" ) )
|
if( msg != wxT( "GAP" ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pad = Module->m_Pads;
|
pad = Module->m_Pads;
|
||||||
|
|
||||||
if( pad == NULL )
|
if( pad == NULL )
|
||||||
{
|
{
|
||||||
DisplayError( this, _( "No pad for this module" ) );
|
DisplayError( this, _( "No pad for this module" ) );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
next_pad = (D_PAD*) pad->Next();
|
next_pad = (D_PAD*) pad->Next();
|
||||||
|
|
||||||
if( next_pad == NULL )
|
if( next_pad == NULL )
|
||||||
{
|
{
|
||||||
DisplayError( this, _( "Only one pad for this module" ) );
|
DisplayError( this, _( "Only one pad for this module" ) );
|
||||||
|
@ -1095,6 +1128,7 @@ void PCB_EDIT_FRAME::Edit_Gap( wxDC* DC, MODULE* Module )
|
||||||
/* Entrer the desired length of the gap. */
|
/* Entrer the desired length of the gap. */
|
||||||
msg = ReturnStringFromValue( g_UserUnit, gap_size, GetScreen()->GetInternalUnits() );
|
msg = ReturnStringFromValue( g_UserUnit, gap_size, GetScreen()->GetInternalUnits() );
|
||||||
wxTextEntryDialog dlg( this, _( "Gap:" ), _( "Create Microwave Gap" ), msg );
|
wxTextEntryDialog dlg( this, _( "Gap:" ), _( "Create Microwave Gap" ), msg );
|
||||||
|
|
||||||
if( dlg.ShowModal() != wxID_OK )
|
if( dlg.ShowModal() != wxID_OK )
|
||||||
return; // cancelled by user
|
return; // cancelled by user
|
||||||
|
|
||||||
|
|
|
@ -72,8 +72,8 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
||||||
exit = true;
|
exit = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_MIRE:
|
case PCB_TARGET_T:
|
||||||
Place_Mire( (MIREPCB*) DrawStruct, aDC );
|
PlaceTarget( (PCB_TARGET*) DrawStruct, aDC );
|
||||||
exit = true;
|
exit = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -171,15 +171,18 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
||||||
case ID_PCB_MIRE_BUTT:
|
case ID_PCB_MIRE_BUTT:
|
||||||
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
||||||
{
|
{
|
||||||
SetCurItem( Create_Mire( aDC ) );
|
SetCurItem( CreateTarget( aDC ) );
|
||||||
DrawPanel->MoveCursorToCrossHair();
|
DrawPanel->MoveCursorToCrossHair();
|
||||||
}
|
}
|
||||||
else if( DrawStruct->Type() == TYPE_MIRE )
|
else if( DrawStruct->Type() == PCB_TARGET_T )
|
||||||
{
|
{
|
||||||
Place_Mire( (MIREPCB*) DrawStruct, aDC );
|
PlaceTarget( (PCB_TARGET*) DrawStruct, aDC );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
DisplayError( this, wxT( "Internal err: Struct not TYPE_MIRE" ) );
|
{
|
||||||
|
DisplayError( this, wxT( "Internal err: Struct not PCB_TARGET_T" ) );
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_PCB_CIRCLE_BUTT:
|
case ID_PCB_CIRCLE_BUTT:
|
||||||
|
@ -286,7 +289,10 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
||||||
GetScreen()->SetCurItem( DrawStruct );
|
GetScreen()->SetCurItem( DrawStruct );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
DisplayError( this, wxT( "PCB_EDIT_FRAME::OnLeftClick() zone internal error" ) );
|
DisplayError( this, wxT( "PCB_EDIT_FRAME::OnLeftClick() zone internal error" ) );
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_PCB_ADD_TEXT_BUTT:
|
case ID_PCB_ADD_TEXT_BUTT:
|
||||||
|
@ -302,7 +308,10 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
||||||
DrawPanel->m_AutoPAN_Request = false;
|
DrawPanel->m_AutoPAN_Request = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
DisplayError( this, wxT( "Internal err: Struct not TYPE_TEXTE" ) );
|
DisplayError( this, wxT( "Internal err: Struct not TYPE_TEXTE" ) );
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_PCB_MODULE_BUTT:
|
case ID_PCB_MODULE_BUTT:
|
||||||
|
@ -311,6 +320,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
||||||
DrawPanel->MoveCursorToCrossHair();
|
DrawPanel->MoveCursorToCrossHair();
|
||||||
DrawStruct = Load_Module_From_Library( wxEmptyString, aDC );
|
DrawStruct = Load_Module_From_Library( wxEmptyString, aDC );
|
||||||
SetCurItem( DrawStruct );
|
SetCurItem( DrawStruct );
|
||||||
|
|
||||||
if( DrawStruct )
|
if( DrawStruct )
|
||||||
StartMove_Module( (MODULE*) DrawStruct, aDC );
|
StartMove_Module( (MODULE*) DrawStruct, aDC );
|
||||||
}
|
}
|
||||||
|
@ -320,7 +330,10 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
||||||
DrawPanel->m_AutoPAN_Request = false;
|
DrawPanel->m_AutoPAN_Request = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
DisplayError( this, wxT( "Internal err: Struct not TYPE_MODULE" ) );
|
DisplayError( this, wxT( "Internal err: Struct not TYPE_MODULE" ) );
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_PCB_DIMENSION_BUTT:
|
case ID_PCB_DIMENSION_BUTT:
|
||||||
|
@ -344,20 +357,25 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
||||||
DrawPanel->m_AutoPAN_Request = true;
|
DrawPanel->m_AutoPAN_Request = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
DisplayError( this,
|
DisplayError( this,
|
||||||
wxT( "PCB_EDIT_FRAME::OnLeftClick() error item is not a DIMENSION" ) );
|
wxT( "PCB_EDIT_FRAME::OnLeftClick() error item is not a DIMENSION" ) );
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_PCB_DELETE_ITEM_BUTT:
|
case ID_PCB_DELETE_ITEM_BUTT:
|
||||||
if( !DrawStruct || (DrawStruct->m_Flags == 0) )
|
if( !DrawStruct || (DrawStruct->m_Flags == 0) )
|
||||||
{
|
{
|
||||||
DrawStruct = PcbGeneralLocateAndDisplay();
|
DrawStruct = PcbGeneralLocateAndDisplay();
|
||||||
|
|
||||||
if( DrawStruct && (DrawStruct->m_Flags == 0) )
|
if( DrawStruct && (DrawStruct->m_Flags == 0) )
|
||||||
{
|
{
|
||||||
RemoveStruct( DrawStruct, aDC );
|
RemoveStruct( DrawStruct, aDC );
|
||||||
SetCurItem( DrawStruct = NULL );
|
SetCurItem( DrawStruct = NULL );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_PCB_PLACE_OFFSET_COORD_BUTT:
|
case ID_PCB_PLACE_OFFSET_COORD_BUTT:
|
||||||
|
@ -416,12 +434,13 @@ void PCB_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
|
||||||
{
|
{
|
||||||
Edit_TrackSegm_Width( aDC, (TRACK*) DrawStruct );
|
Edit_TrackSegm_Width( aDC, (TRACK*) DrawStruct );
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_TEXTE:
|
case TYPE_TEXTE:
|
||||||
case TYPE_PAD:
|
case TYPE_PAD:
|
||||||
case TYPE_MODULE:
|
case TYPE_MODULE:
|
||||||
case TYPE_MIRE:
|
case PCB_TARGET_T:
|
||||||
case TYPE_DIMENSION:
|
case TYPE_DIMENSION:
|
||||||
case TYPE_TEXTE_MODULE:
|
case TYPE_TEXTE_MODULE:
|
||||||
OnEditItemRequest( aDC, DrawStruct );
|
OnEditItemRequest( aDC, DrawStruct );
|
||||||
|
@ -450,6 +469,7 @@ void PCB_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
|
||||||
if( End_Route( (TRACK*) DrawStruct, aDC ) )
|
if( End_Route( (TRACK*) DrawStruct, aDC ) )
|
||||||
DrawPanel->m_AutoPAN_Request = false;
|
DrawPanel->m_AutoPAN_Request = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_PCB_ZONES_BUTT:
|
case ID_PCB_ZONES_BUTT:
|
||||||
|
@ -506,8 +526,8 @@ void PCB_EDIT_FRAME::OnEditItemRequest( wxDC* aDC, BOARD_ITEM* aItem )
|
||||||
InstallModuleOptionsFrame( (MODULE*) aItem, aDC );
|
InstallModuleOptionsFrame( (MODULE*) aItem, aDC );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_MIRE:
|
case PCB_TARGET_T:
|
||||||
InstallMireOptionsFrame( (MIREPCB*) aItem, aDC );
|
ShowTargetOptionsDialog( (PCB_TARGET*) aItem, aDC );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_DIMENSION:
|
case TYPE_DIMENSION:
|
||||||
|
|
|
@ -23,7 +23,7 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
bool locate_track = FALSE;
|
bool locate_track = false;
|
||||||
bool blockActive = (GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE);
|
bool blockActive = (GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE);
|
||||||
|
|
||||||
wxClientDC dc( DrawPanel );
|
wxClientDC dc( DrawPanel );
|
||||||
|
@ -223,7 +223,7 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_MIRE:
|
case PCB_TARGET_T:
|
||||||
if( !flags )
|
if( !flags )
|
||||||
{
|
{
|
||||||
msg = AddHotkeyName( _( "Move Target" ), g_Board_Editor_Hokeys_Descr,
|
msg = AddHotkeyName( _( "Move Target" ), g_Board_Editor_Hokeys_Descr,
|
||||||
|
|
|
@ -2,13 +2,13 @@
|
||||||
/** pcbnew_config.cpp : configuration **/
|
/** pcbnew_config.cpp : configuration **/
|
||||||
/****************************************/
|
/****************************************/
|
||||||
|
|
||||||
#include <wx-2.8/wx/xml/xml.h>
|
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
#include "appl_wxstruct.h"
|
#include "appl_wxstruct.h"
|
||||||
#include "class_drawpanel.h"
|
#include "class_drawpanel.h"
|
||||||
#include "confirm.h"
|
#include "confirm.h"
|
||||||
#include "gestfich.h"
|
#include "gestfich.h"
|
||||||
|
#include "xnode.h"
|
||||||
|
|
||||||
#include "pcbnew.h"
|
#include "pcbnew.h"
|
||||||
#include "wxPcbStruct.h"
|
#include "wxPcbStruct.h"
|
||||||
#include "class_board_design_settings.h"
|
#include "class_board_design_settings.h"
|
||||||
|
@ -416,8 +416,8 @@ void PCB_EDIT_FRAME::SaveMacros()
|
||||||
{
|
{
|
||||||
wxFileName fn;
|
wxFileName fn;
|
||||||
wxXmlDocument xml;
|
wxXmlDocument xml;
|
||||||
wxXmlNode *rootNode = new wxXmlNode::wxXmlNode( NULL, wxXML_ELEMENT_NODE, wxT( "macrosrootnode" ), wxEmptyString, NULL);
|
XNODE *rootNode = new XNODE( wxXML_ELEMENT_NODE, wxT( "macrosrootnode" ), wxEmptyString );
|
||||||
wxXmlNode *macrosNode, *hkNode;
|
XNODE *macrosNode, *hkNode;
|
||||||
wxXmlProperty *macrosProp, *hkProp, *xProp, *yProp;
|
wxXmlProperty *macrosProp, *hkProp, *xProp, *yProp;
|
||||||
wxString str, hkStr, xStr, yStr;
|
wxString str, hkStr, xStr, yStr;
|
||||||
|
|
||||||
|
@ -435,11 +435,14 @@ void PCB_EDIT_FRAME::SaveMacros()
|
||||||
for( int number = 9; number >= 0; number-- )
|
for( int number = 9; number >= 0; number-- )
|
||||||
{
|
{
|
||||||
str.Printf( wxT( "%d" ), number );
|
str.Printf( wxT( "%d" ), number );
|
||||||
macrosProp = new wxXmlProperty::wxXmlProperty( wxT("number"), str);
|
macrosProp = new wxXmlProperty( wxT( "number" ), str );
|
||||||
|
|
||||||
macrosNode = new wxXmlNode::wxXmlNode(rootNode, wxXML_ELEMENT_NODE, wxT( "macros" ), wxEmptyString, macrosProp);
|
macrosNode = new XNODE( rootNode, wxXML_ELEMENT_NODE, wxT( "macros" ), wxEmptyString,
|
||||||
|
macrosProp );
|
||||||
|
|
||||||
for( std::list<MACROS_RECORD>::reverse_iterator i = m_Macros[number].m_Record.rbegin(); i != m_Macros[number].m_Record.rend(); i++ )
|
for( std::list<MACROS_RECORD>::reverse_iterator i = m_Macros[number].m_Record.rbegin();
|
||||||
|
i != m_Macros[number].m_Record.rend();
|
||||||
|
i++ )
|
||||||
{
|
{
|
||||||
hkStr.Printf( wxT( "%d" ), i->m_HotkeyCode );
|
hkStr.Printf( wxT( "%d" ), i->m_HotkeyCode );
|
||||||
xStr.Printf( wxT( "%d" ), i->m_Position.x );
|
xStr.Printf( wxT( "%d" ), i->m_Position.x );
|
||||||
|
@ -449,7 +452,8 @@ void PCB_EDIT_FRAME::SaveMacros()
|
||||||
xProp = new wxXmlProperty( wxT( "x" ), xStr, yProp );
|
xProp = new wxXmlProperty( wxT( "x" ), xStr, yProp );
|
||||||
hkProp = new wxXmlProperty( wxT( "hkcode" ), hkStr, xProp );
|
hkProp = new wxXmlProperty( wxT( "hkcode" ), hkStr, xProp );
|
||||||
|
|
||||||
hkNode = new wxXmlNode(macrosNode, wxXML_ELEMENT_NODE, wxT( "hotkey" ), wxEmptyString, hkProp);
|
hkNode = new XNODE( macrosNode, wxXML_ELEMENT_NODE, wxT( "hotkey" ),
|
||||||
|
wxEmptyString, hkProp );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -486,10 +490,11 @@ void PCB_EDIT_FRAME::ReadMacros()
|
||||||
wxXmlDocument xml;
|
wxXmlDocument xml;
|
||||||
|
|
||||||
xml.SetFileEncoding( wxT( "UTF-8" ) );
|
xml.SetFileEncoding( wxT( "UTF-8" ) );
|
||||||
|
|
||||||
if( !xml.Load( dlg.GetFilename() ) )
|
if( !xml.Load( dlg.GetFilename() ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxXmlNode *macrosNode = xml.GetRoot()->GetChildren();
|
XNODE *macrosNode = (XNODE*) xml.GetRoot()->GetChildren();
|
||||||
|
|
||||||
while( macrosNode )
|
while( macrosNode )
|
||||||
{
|
{
|
||||||
|
@ -497,20 +502,21 @@ void PCB_EDIT_FRAME::ReadMacros()
|
||||||
|
|
||||||
if( macrosNode->GetName() == wxT( "macros" ) )
|
if( macrosNode->GetName() == wxT( "macros" ) )
|
||||||
{
|
{
|
||||||
number = wxAtoi( macrosNode->GetPropVal( wxT( "number" ), wxT( "-1" ) ) );
|
number = wxAtoi( macrosNode->GetAttribute( wxT( "number" ), wxT( "-1" ) ) );
|
||||||
|
|
||||||
if( number >= 0 && number < 10 )
|
if( number >= 0 && number < 10 )
|
||||||
{
|
{
|
||||||
m_Macros[number].m_Record.clear();
|
m_Macros[number].m_Record.clear();
|
||||||
|
|
||||||
wxXmlNode *hotkeyNode = macrosNode->GetChildren();
|
XNODE *hotkeyNode = (XNODE*) macrosNode->GetChildren();
|
||||||
|
|
||||||
while( hotkeyNode )
|
while( hotkeyNode )
|
||||||
{
|
{
|
||||||
if( hotkeyNode->GetName() == wxT( "hotkey" ) )
|
if( hotkeyNode->GetName() == wxT( "hotkey" ) )
|
||||||
{
|
{
|
||||||
int x = wxAtoi( hotkeyNode->GetPropVal( wxT( "x" ), wxT( "0" ) ) );
|
int x = wxAtoi( hotkeyNode->GetAttribute( wxT( "x" ), wxT( "0" ) ) );
|
||||||
int y = wxAtoi( hotkeyNode->GetPropVal( wxT( "y" ), wxT( "0" ) ) );
|
int y = wxAtoi( hotkeyNode->GetAttribute( wxT( "y" ), wxT( "0" ) ) );
|
||||||
int hk = wxAtoi( hotkeyNode->GetPropVal( wxT( "hkcode" ), wxT( "0" ) ) );
|
int hk = wxAtoi( hotkeyNode->GetAttribute( wxT( "hkcode" ), wxT( "0" ) ) );
|
||||||
|
|
||||||
MACROS_RECORD macros_record;
|
MACROS_RECORD macros_record;
|
||||||
macros_record.m_HotkeyCode = hk;
|
macros_record.m_HotkeyCode = hk;
|
||||||
|
@ -519,12 +525,11 @@ void PCB_EDIT_FRAME::ReadMacros()
|
||||||
m_Macros[number].m_Record.push_back( macros_record );
|
m_Macros[number].m_Record.push_back( macros_record );
|
||||||
}
|
}
|
||||||
|
|
||||||
hotkeyNode = hotkeyNode->GetNext();
|
hotkeyNode = (XNODE*) hotkeyNode->GetNext();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
macrosNode = macrosNode->GetNext();
|
macrosNode = (XNODE*) macrosNode->GetNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ void PlotDrawSegment( PLOTTER* plotter, DRAWSEGMENT* PtSegm, int masque_layer,
|
||||||
void PlotDimension( PLOTTER* plotter, DIMENSION* Dimension, int masque_layer,
|
void PlotDimension( PLOTTER* plotter, DIMENSION* Dimension, int masque_layer,
|
||||||
GRTraceMode trace_mode );
|
GRTraceMode trace_mode );
|
||||||
|
|
||||||
void PlotMirePcb( PLOTTER* plotter, MIREPCB* PtMire, int masque_layer,
|
void PlotPcbTarget( PLOTTER* plotter, PCB_TARGET* PtMire, int masque_layer,
|
||||||
GRTraceMode trace_mode );
|
GRTraceMode trace_mode );
|
||||||
|
|
||||||
void Plot_1_EdgeModule( PLOTTER* plotter, EDGE_MODULE* PtEdge,
|
void Plot_1_EdgeModule( PLOTTER* plotter, EDGE_MODULE* PtEdge,
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
#include "class_board_design_settings.h"
|
#include "class_board_design_settings.h"
|
||||||
|
|
||||||
|
|
||||||
static void Plot_Edges_Modules( PLOTTER* plotter, BOARD* pcb, int masque_layer,
|
static void Plot_Edges_Modules( PLOTTER* plotter, BOARD* pcb, int aLayerMask,
|
||||||
GRTraceMode trace_mode );
|
GRTraceMode trace_mode );
|
||||||
static void PlotTextModule( PLOTTER* plotter, TEXTE_MODULE* pt_texte,
|
static void PlotTextModule( PLOTTER* plotter, TEXTE_MODULE* pt_texte,
|
||||||
GRTraceMode trace_mode );
|
GRTraceMode trace_mode );
|
||||||
|
@ -23,7 +23,7 @@ static void PlotTextModule( PLOTTER* plotter, TEXTE_MODULE* pt_texte,
|
||||||
/* Creates the plot for silkscreen layers
|
/* Creates the plot for silkscreen layers
|
||||||
*/
|
*/
|
||||||
void PCB_BASE_FRAME::Plot_Serigraphie( PLOTTER* plotter,
|
void PCB_BASE_FRAME::Plot_Serigraphie( PLOTTER* plotter,
|
||||||
int masque_layer,
|
int aLayerMask,
|
||||||
GRTraceMode trace_mode )
|
GRTraceMode trace_mode )
|
||||||
{
|
{
|
||||||
bool trace_val, trace_ref;
|
bool trace_val, trace_ref;
|
||||||
|
@ -37,19 +37,19 @@ void PCB_BASE_FRAME::Plot_Serigraphie( PLOTTER* plotter,
|
||||||
switch( PtStruct->Type() )
|
switch( PtStruct->Type() )
|
||||||
{
|
{
|
||||||
case TYPE_DRAWSEGMENT:
|
case TYPE_DRAWSEGMENT:
|
||||||
PlotDrawSegment( plotter, (DRAWSEGMENT*) PtStruct, masque_layer, trace_mode );
|
PlotDrawSegment( plotter, (DRAWSEGMENT*) PtStruct, aLayerMask, trace_mode );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_TEXTE:
|
case TYPE_TEXTE:
|
||||||
PlotTextePcb( plotter, (TEXTE_PCB*) PtStruct, masque_layer, trace_mode );
|
PlotTextePcb( plotter, (TEXTE_PCB*) PtStruct, aLayerMask, trace_mode );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_DIMENSION:
|
case TYPE_DIMENSION:
|
||||||
PlotDimension( plotter, (DIMENSION*) PtStruct, masque_layer, trace_mode );
|
PlotDimension( plotter, (DIMENSION*) PtStruct, aLayerMask, trace_mode );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_MIRE:
|
case PCB_TARGET_T:
|
||||||
PlotMirePcb( plotter, (MIREPCB*) PtStruct, masque_layer, trace_mode );
|
PlotPcbTarget( plotter, (PCB_TARGET*) PtStruct, aLayerMask, trace_mode );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_MARKER_PCB:
|
case TYPE_MARKER_PCB:
|
||||||
|
@ -62,13 +62,15 @@ void PCB_BASE_FRAME::Plot_Serigraphie( PLOTTER* plotter,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Plot footprint outlines : */
|
/* Plot footprint outlines : */
|
||||||
Plot_Edges_Modules( plotter, m_Pcb, masque_layer, trace_mode );
|
Plot_Edges_Modules( plotter, m_Pcb, aLayerMask, trace_mode );
|
||||||
|
|
||||||
/* Plot pads (creates pads outlines, for pads on silkscreen layers) */
|
/* Plot pads (creates pads outlines, for pads on silkscreen layers) */
|
||||||
int layersmask_plotpads = masque_layer;
|
int layersmask_plotpads = aLayerMask;
|
||||||
// Calculate the mask layers of allowed layers for pads
|
// Calculate the mask layers of allowed layers for pads
|
||||||
|
|
||||||
if( !g_PcbPlotOptions.m_PlotPadsOnSilkLayer ) // Do not plot pads on silk screen layers
|
if( !g_PcbPlotOptions.m_PlotPadsOnSilkLayer ) // Do not plot pads on silk screen layers
|
||||||
layersmask_plotpads &= ~(SILKSCREEN_LAYER_BACK | SILKSCREEN_LAYER_FRONT );
|
layersmask_plotpads &= ~(SILKSCREEN_LAYER_BACK | SILKSCREEN_LAYER_FRONT );
|
||||||
|
|
||||||
if( layersmask_plotpads )
|
if( layersmask_plotpads )
|
||||||
{
|
{
|
||||||
for( MODULE* Module = m_Pcb->m_Modules; Module; Module = Module->Next() )
|
for( MODULE* Module = m_Pcb->m_Modules; Module; Module = Module->Next() )
|
||||||
|
@ -76,7 +78,7 @@ void PCB_BASE_FRAME::Plot_Serigraphie( PLOTTER* plotter,
|
||||||
for( D_PAD * pad = Module->m_Pads; pad != NULL; pad = pad->Next() )
|
for( D_PAD * pad = Module->m_Pads; pad != NULL; pad = pad->Next() )
|
||||||
{
|
{
|
||||||
/* See if the pad is on this layer */
|
/* See if the pad is on this layer */
|
||||||
if( (pad->m_Masque_Layer & layersmask_plotpads) == 0 )
|
if( (pad->m_layerMask & layersmask_plotpads) == 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
wxPoint shape_pos = pad->ReturnShapePos();
|
wxPoint shape_pos = pad->ReturnShapePos();
|
||||||
|
@ -129,11 +131,11 @@ module\n %s's \"reference\" text." ),
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ( ( 1 << textLayer ) & masque_layer ) == 0 )
|
if( ( ( 1 << textLayer ) & aLayerMask ) == 0 )
|
||||||
trace_ref = FALSE;
|
trace_ref = false;
|
||||||
|
|
||||||
if( text->m_NoShow && !g_PcbPlotOptions.m_PlotInvisibleTexts )
|
if( text->m_NoShow && !g_PcbPlotOptions.m_PlotInvisibleTexts )
|
||||||
trace_ref = FALSE;
|
trace_ref = false;
|
||||||
|
|
||||||
text = Module->m_Value;
|
text = Module->m_Value;
|
||||||
textLayer = text->GetLayer();
|
textLayer = text->GetLayer();
|
||||||
|
@ -149,11 +151,11 @@ module\n %s's \"value\" text." ),
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ( (1 << textLayer) & masque_layer ) == 0 )
|
if( ( (1 << textLayer) & aLayerMask ) == 0 )
|
||||||
trace_val = FALSE;
|
trace_val = false;
|
||||||
|
|
||||||
if( text->m_NoShow && !g_PcbPlotOptions.m_PlotInvisibleTexts )
|
if( text->m_NoShow && !g_PcbPlotOptions.m_PlotInvisibleTexts )
|
||||||
trace_val = FALSE;
|
trace_val = false;
|
||||||
|
|
||||||
/* Plot text fields, if allowed */
|
/* Plot text fields, if allowed */
|
||||||
if( trace_ref )
|
if( trace_ref )
|
||||||
|
@ -171,11 +173,12 @@ module\n %s's \"value\" text." ),
|
||||||
|
|
||||||
if( !g_PcbPlotOptions.m_PlotTextOther )
|
if( !g_PcbPlotOptions.m_PlotTextOther )
|
||||||
continue;
|
continue;
|
||||||
if( (pt_texte->m_NoShow)
|
|
||||||
&& !g_PcbPlotOptions.m_PlotInvisibleTexts )
|
if( (pt_texte->m_NoShow) && !g_PcbPlotOptions.m_PlotInvisibleTexts )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
textLayer = pt_texte->GetLayer();
|
textLayer = pt_texte->GetLayer();
|
||||||
|
|
||||||
if( textLayer >= 32 )
|
if( textLayer >= 32 )
|
||||||
{
|
{
|
||||||
wxString errMsg;
|
wxString errMsg;
|
||||||
|
@ -188,7 +191,7 @@ for module\n %s's \"module text\" text of %s." ),
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !( ( 1 << textLayer ) & masque_layer ) )
|
if( !( ( 1 << textLayer ) & aLayerMask ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
PlotTextModule( plotter, pt_texte, trace_mode );
|
PlotTextModule( plotter, pt_texte, trace_mode );
|
||||||
|
@ -199,8 +202,10 @@ for module\n %s's \"module text\" text of %s." ),
|
||||||
for( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
|
for( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
|
||||||
{
|
{
|
||||||
ZONE_CONTAINER* edge_zone = m_Pcb->GetArea( ii );
|
ZONE_CONTAINER* edge_zone = m_Pcb->GetArea( ii );
|
||||||
if( ( ( 1 << edge_zone->GetLayer() ) & masque_layer ) == 0 )
|
|
||||||
|
if( ( ( 1 << edge_zone->GetLayer() ) & aLayerMask ) == 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
PlotFilledAreas( plotter, edge_zone, trace_mode );
|
PlotFilledAreas( plotter, edge_zone, trace_mode );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,16 +213,15 @@ for module\n %s's \"module text\" text of %s." ),
|
||||||
// compatibility):
|
// compatibility):
|
||||||
for( SEGZONE* seg = m_Pcb->m_Zone; seg != NULL; seg = seg->Next() )
|
for( SEGZONE* seg = m_Pcb->m_Zone; seg != NULL; seg = seg->Next() )
|
||||||
{
|
{
|
||||||
if( ( ( 1 << seg->GetLayer() ) & masque_layer ) == 0 )
|
if( ( ( 1 << seg->GetLayer() ) & aLayerMask ) == 0 )
|
||||||
continue;
|
continue;
|
||||||
plotter->thick_segment( seg->m_Start, seg->m_End, seg->m_Width,
|
|
||||||
trace_mode );
|
plotter->thick_segment( seg->m_Start, seg->m_End, seg->m_Width, trace_mode );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void PlotTextModule( PLOTTER* plotter, TEXTE_MODULE* pt_texte,
|
static void PlotTextModule( PLOTTER* plotter, TEXTE_MODULE* pt_texte, GRTraceMode trace_mode )
|
||||||
GRTraceMode trace_mode )
|
|
||||||
{
|
{
|
||||||
wxSize size;
|
wxSize size;
|
||||||
wxPoint pos;
|
wxPoint pos;
|
||||||
|
@ -230,6 +234,7 @@ static void PlotTextModule( PLOTTER* plotter, TEXTE_MODULE* pt_texte,
|
||||||
orient = pt_texte->GetDrawRotation();
|
orient = pt_texte->GetDrawRotation();
|
||||||
|
|
||||||
thickness = pt_texte->m_Thickness;
|
thickness = pt_texte->m_Thickness;
|
||||||
|
|
||||||
if( trace_mode == FILAIRE )
|
if( trace_mode == FILAIRE )
|
||||||
thickness = -1;
|
thickness = -1;
|
||||||
|
|
||||||
|
@ -250,12 +255,12 @@ static void PlotTextModule( PLOTTER* plotter, TEXTE_MODULE* pt_texte,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PlotDimension( PLOTTER* plotter, DIMENSION* Dimension, int masque_layer,
|
void PlotDimension( PLOTTER* plotter, DIMENSION* Dimension, int aLayerMask,
|
||||||
GRTraceMode trace_mode )
|
GRTraceMode trace_mode )
|
||||||
{
|
{
|
||||||
DRAWSEGMENT* DrawTmp;
|
DRAWSEGMENT* DrawTmp;
|
||||||
|
|
||||||
if( (g_TabOneLayerMask[Dimension->GetLayer()] & masque_layer) == 0 )
|
if( (g_TabOneLayerMask[Dimension->GetLayer()] & aLayerMask) == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
DrawTmp = new DRAWSEGMENT( NULL );
|
DrawTmp = new DRAWSEGMENT( NULL );
|
||||||
|
@ -263,61 +268,60 @@ void PlotDimension( PLOTTER* plotter, DIMENSION* Dimension, int masque_layer,
|
||||||
DrawTmp->m_Width = (trace_mode==FILAIRE) ? -1 : Dimension->m_Width;
|
DrawTmp->m_Width = (trace_mode==FILAIRE) ? -1 : Dimension->m_Width;
|
||||||
DrawTmp->SetLayer( Dimension->GetLayer() );
|
DrawTmp->SetLayer( Dimension->GetLayer() );
|
||||||
|
|
||||||
PlotTextePcb( plotter, Dimension->m_Text, masque_layer, trace_mode );
|
PlotTextePcb( plotter, Dimension->m_Text, aLayerMask, trace_mode );
|
||||||
|
|
||||||
DrawTmp->m_Start.x = Dimension->Barre_ox;
|
DrawTmp->m_Start.x = Dimension->Barre_ox;
|
||||||
DrawTmp->m_Start.y = Dimension->Barre_oy;
|
DrawTmp->m_Start.y = Dimension->Barre_oy;
|
||||||
DrawTmp->m_End.x = Dimension->Barre_fx;
|
DrawTmp->m_End.x = Dimension->Barre_fx;
|
||||||
DrawTmp->m_End.y = Dimension->Barre_fy;
|
DrawTmp->m_End.y = Dimension->Barre_fy;
|
||||||
PlotDrawSegment( plotter, DrawTmp, masque_layer, trace_mode );
|
PlotDrawSegment( plotter, DrawTmp, aLayerMask, trace_mode );
|
||||||
|
|
||||||
DrawTmp->m_Start.x = Dimension->TraitG_ox;
|
DrawTmp->m_Start.x = Dimension->TraitG_ox;
|
||||||
DrawTmp->m_Start.y = Dimension->TraitG_oy;
|
DrawTmp->m_Start.y = Dimension->TraitG_oy;
|
||||||
DrawTmp->m_End.x = Dimension->TraitG_fx;
|
DrawTmp->m_End.x = Dimension->TraitG_fx;
|
||||||
DrawTmp->m_End.y = Dimension->TraitG_fy;
|
DrawTmp->m_End.y = Dimension->TraitG_fy;
|
||||||
PlotDrawSegment( plotter, DrawTmp, masque_layer, trace_mode );
|
PlotDrawSegment( plotter, DrawTmp, aLayerMask, trace_mode );
|
||||||
|
|
||||||
DrawTmp->m_Start.x = Dimension->TraitD_ox;
|
DrawTmp->m_Start.x = Dimension->TraitD_ox;
|
||||||
DrawTmp->m_Start.y = Dimension->TraitD_oy;
|
DrawTmp->m_Start.y = Dimension->TraitD_oy;
|
||||||
DrawTmp->m_End.x = Dimension->TraitD_fx;
|
DrawTmp->m_End.x = Dimension->TraitD_fx;
|
||||||
DrawTmp->m_End.y = Dimension->TraitD_fy;
|
DrawTmp->m_End.y = Dimension->TraitD_fy;
|
||||||
PlotDrawSegment( plotter, DrawTmp, masque_layer, trace_mode );
|
PlotDrawSegment( plotter, DrawTmp, aLayerMask, trace_mode );
|
||||||
|
|
||||||
DrawTmp->m_Start.x = Dimension->FlecheD1_ox;
|
DrawTmp->m_Start.x = Dimension->FlecheD1_ox;
|
||||||
DrawTmp->m_Start.y = Dimension->FlecheD1_oy;
|
DrawTmp->m_Start.y = Dimension->FlecheD1_oy;
|
||||||
DrawTmp->m_End.x = Dimension->FlecheD1_fx;
|
DrawTmp->m_End.x = Dimension->FlecheD1_fx;
|
||||||
DrawTmp->m_End.y = Dimension->FlecheD1_fy;
|
DrawTmp->m_End.y = Dimension->FlecheD1_fy;
|
||||||
PlotDrawSegment( plotter, DrawTmp, masque_layer, trace_mode );
|
PlotDrawSegment( plotter, DrawTmp, aLayerMask, trace_mode );
|
||||||
|
|
||||||
DrawTmp->m_Start.x = Dimension->FlecheD2_ox;
|
DrawTmp->m_Start.x = Dimension->FlecheD2_ox;
|
||||||
DrawTmp->m_Start.y = Dimension->FlecheD2_oy;
|
DrawTmp->m_Start.y = Dimension->FlecheD2_oy;
|
||||||
DrawTmp->m_End.x = Dimension->FlecheD2_fx;
|
DrawTmp->m_End.x = Dimension->FlecheD2_fx;
|
||||||
DrawTmp->m_End.y = Dimension->FlecheD2_fy;
|
DrawTmp->m_End.y = Dimension->FlecheD2_fy;
|
||||||
PlotDrawSegment( plotter, DrawTmp, masque_layer, trace_mode );
|
PlotDrawSegment( plotter, DrawTmp, aLayerMask, trace_mode );
|
||||||
|
|
||||||
DrawTmp->m_Start.x = Dimension->FlecheG1_ox;
|
DrawTmp->m_Start.x = Dimension->FlecheG1_ox;
|
||||||
DrawTmp->m_Start.y = Dimension->FlecheG1_oy;
|
DrawTmp->m_Start.y = Dimension->FlecheG1_oy;
|
||||||
DrawTmp->m_End.x = Dimension->FlecheG1_fx;
|
DrawTmp->m_End.x = Dimension->FlecheG1_fx;
|
||||||
DrawTmp->m_End.y = Dimension->FlecheG1_fy;
|
DrawTmp->m_End.y = Dimension->FlecheG1_fy;
|
||||||
PlotDrawSegment( plotter, DrawTmp, masque_layer, trace_mode );
|
PlotDrawSegment( plotter, DrawTmp, aLayerMask, trace_mode );
|
||||||
|
|
||||||
DrawTmp->m_Start.x = Dimension->FlecheG2_ox;
|
DrawTmp->m_Start.x = Dimension->FlecheG2_ox;
|
||||||
DrawTmp->m_Start.y = Dimension->FlecheG2_oy;
|
DrawTmp->m_Start.y = Dimension->FlecheG2_oy;
|
||||||
DrawTmp->m_End.x = Dimension->FlecheG2_fx;
|
DrawTmp->m_End.x = Dimension->FlecheG2_fx;
|
||||||
DrawTmp->m_End.y = Dimension->FlecheG2_fy;
|
DrawTmp->m_End.y = Dimension->FlecheG2_fy;
|
||||||
PlotDrawSegment( plotter, DrawTmp, masque_layer, trace_mode );
|
PlotDrawSegment( plotter, DrawTmp, aLayerMask, trace_mode );
|
||||||
|
|
||||||
delete DrawTmp;
|
delete DrawTmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PlotMirePcb( PLOTTER* plotter, MIREPCB* Mire, int masque_layer,
|
void PlotPcbTarget( PLOTTER* plotter, PCB_TARGET* Mire, int aLayerMask, GRTraceMode trace_mode )
|
||||||
GRTraceMode trace_mode )
|
|
||||||
{
|
{
|
||||||
DRAWSEGMENT* DrawTmp;
|
DRAWSEGMENT* DrawTmp;
|
||||||
int dx1, dx2, dy1, dy2, radius;
|
int dx1, dx2, dy1, dy2, radius;
|
||||||
|
|
||||||
if( (g_TabOneLayerMask[Mire->GetLayer()] & masque_layer) == 0 )
|
if( (g_TabOneLayerMask[Mire->GetLayer()] & aLayerMask) == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
DrawTmp = new DRAWSEGMENT( NULL );
|
DrawTmp = new DRAWSEGMENT( NULL );
|
||||||
|
@ -329,7 +333,7 @@ void PlotMirePcb( PLOTTER* plotter, MIREPCB* Mire, int masque_layer,
|
||||||
DrawTmp->m_End.x = DrawTmp->m_Start.x + ( Mire->m_Size / 4 );
|
DrawTmp->m_End.x = DrawTmp->m_Start.x + ( Mire->m_Size / 4 );
|
||||||
DrawTmp->m_End.y = DrawTmp->m_Start.y;
|
DrawTmp->m_End.y = DrawTmp->m_Start.y;
|
||||||
DrawTmp->m_Shape = S_CIRCLE;
|
DrawTmp->m_Shape = S_CIRCLE;
|
||||||
PlotDrawSegment( plotter, DrawTmp, masque_layer, trace_mode );
|
PlotDrawSegment( plotter, DrawTmp, aLayerMask, trace_mode );
|
||||||
|
|
||||||
DrawTmp->m_Shape = S_SEGMENT;
|
DrawTmp->m_Shape = S_SEGMENT;
|
||||||
|
|
||||||
|
@ -350,20 +354,20 @@ void PlotMirePcb( PLOTTER* plotter, MIREPCB* Mire, int masque_layer,
|
||||||
DrawTmp->m_Start.y = Mire->m_Pos.y - dy1;
|
DrawTmp->m_Start.y = Mire->m_Pos.y - dy1;
|
||||||
DrawTmp->m_End.x = Mire->m_Pos.x + dx1;
|
DrawTmp->m_End.x = Mire->m_Pos.x + dx1;
|
||||||
DrawTmp->m_End.y = Mire->m_Pos.y + dy1;
|
DrawTmp->m_End.y = Mire->m_Pos.y + dy1;
|
||||||
PlotDrawSegment( plotter, DrawTmp, masque_layer, trace_mode );
|
PlotDrawSegment( plotter, DrawTmp, aLayerMask, trace_mode );
|
||||||
|
|
||||||
DrawTmp->m_Start.x = Mire->m_Pos.x - dx2;
|
DrawTmp->m_Start.x = Mire->m_Pos.x - dx2;
|
||||||
DrawTmp->m_Start.y = Mire->m_Pos.y - dy2;
|
DrawTmp->m_Start.y = Mire->m_Pos.y - dy2;
|
||||||
DrawTmp->m_End.x = Mire->m_Pos.x + dx2;
|
DrawTmp->m_End.x = Mire->m_Pos.x + dx2;
|
||||||
DrawTmp->m_End.y = Mire->m_Pos.y + dy2;
|
DrawTmp->m_End.y = Mire->m_Pos.y + dy2;
|
||||||
PlotDrawSegment( plotter, DrawTmp, masque_layer, trace_mode );
|
PlotDrawSegment( plotter, DrawTmp, aLayerMask, trace_mode );
|
||||||
|
|
||||||
delete DrawTmp;
|
delete DrawTmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Plot footprints graphic items (outlines) */
|
/* Plot footprints graphic items (outlines) */
|
||||||
void Plot_Edges_Modules( PLOTTER* plotter, BOARD* pcb, int masque_layer,
|
void Plot_Edges_Modules( PLOTTER* plotter, BOARD* pcb, int aLayerMask,
|
||||||
GRTraceMode trace_mode )
|
GRTraceMode trace_mode )
|
||||||
{
|
{
|
||||||
for( MODULE* module = pcb->m_Modules; module; module = module->Next() )
|
for( MODULE* module = pcb->m_Modules; module; module = module->Next() )
|
||||||
|
@ -375,7 +379,7 @@ void Plot_Edges_Modules( PLOTTER* plotter, BOARD* pcb, int masque_layer,
|
||||||
if( edge->Type() != TYPE_EDGE_MODULE )
|
if( edge->Type() != TYPE_EDGE_MODULE )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( ( g_TabOneLayerMask[edge->GetLayer()] & masque_layer ) == 0 )
|
if( ( g_TabOneLayerMask[edge->GetLayer()] & aLayerMask ) == 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Plot_1_EdgeModule( plotter, edge, trace_mode );
|
Plot_1_EdgeModule( plotter, edge, trace_mode );
|
||||||
|
@ -431,6 +435,7 @@ void Plot_1_EdgeModule( PLOTTER* plotter, EDGE_MODULE* PtEdge,
|
||||||
case S_POLYGON:
|
case S_POLYGON:
|
||||||
{
|
{
|
||||||
std::vector<wxPoint> polyPoints = PtEdge->GetPolyPoints();
|
std::vector<wxPoint> polyPoints = PtEdge->GetPolyPoints();
|
||||||
|
|
||||||
if( polyPoints.size() <= 1 ) // Malformed polygon
|
if( polyPoints.size() <= 1 ) // Malformed polygon
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -462,7 +467,7 @@ void Plot_1_EdgeModule( PLOTTER* plotter, EDGE_MODULE* PtEdge,
|
||||||
|
|
||||||
|
|
||||||
/* Plot a PCB Text, i;e. a text found on a copper or technical layer */
|
/* Plot a PCB Text, i;e. a text found on a copper or technical layer */
|
||||||
void PlotTextePcb( PLOTTER* plotter, TEXTE_PCB* pt_texte, int masque_layer,
|
void PlotTextePcb( PLOTTER* plotter, TEXTE_PCB* pt_texte, int aLayerMask,
|
||||||
GRTraceMode trace_mode )
|
GRTraceMode trace_mode )
|
||||||
{
|
{
|
||||||
int orient, thickness;
|
int orient, thickness;
|
||||||
|
@ -471,7 +476,8 @@ void PlotTextePcb( PLOTTER* plotter, TEXTE_PCB* pt_texte, int masque_layer,
|
||||||
|
|
||||||
if( pt_texte->m_Text.IsEmpty() )
|
if( pt_texte->m_Text.IsEmpty() )
|
||||||
return;
|
return;
|
||||||
if( ( g_TabOneLayerMask[pt_texte->GetLayer()] & masque_layer ) == 0 )
|
|
||||||
|
if( ( g_TabOneLayerMask[pt_texte->GetLayer()] & aLayerMask ) == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
size = pt_texte->m_Size;
|
size = pt_texte->m_Size;
|
||||||
|
@ -496,6 +502,7 @@ void PlotTextePcb( PLOTTER* plotter, TEXTE_PCB* pt_texte, int masque_layer,
|
||||||
offset.y = pt_texte->GetInterline();
|
offset.y = pt_texte->GetInterline();
|
||||||
|
|
||||||
RotatePoint( &offset, orient );
|
RotatePoint( &offset, orient );
|
||||||
|
|
||||||
for( unsigned i = 0; i < list->Count(); i++ )
|
for( unsigned i = 0; i < list->Count(); i++ )
|
||||||
{
|
{
|
||||||
wxString txt = list->Item( i );
|
wxString txt = list->Item( i );
|
||||||
|
@ -510,20 +517,22 @@ void PlotTextePcb( PLOTTER* plotter, TEXTE_PCB* pt_texte, int masque_layer,
|
||||||
delete (list);
|
delete (list);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
plotter->text( pos, BLACK,
|
plotter->text( pos, BLACK,
|
||||||
pt_texte->m_Text,
|
pt_texte->m_Text,
|
||||||
orient, size,
|
orient, size,
|
||||||
pt_texte->m_HJustify, pt_texte->m_VJustify,
|
pt_texte->m_HJustify, pt_texte->m_VJustify,
|
||||||
thickness, pt_texte->m_Italic, allow_bold );
|
thickness, pt_texte->m_Italic, allow_bold );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Plot areas (given by .m_FilledPolysList member) in a zone
|
/* Plot areas (given by .m_FilledPolysList member) in a zone
|
||||||
*/
|
*/
|
||||||
void PlotFilledAreas( PLOTTER* plotter, ZONE_CONTAINER* aZone,
|
void PlotFilledAreas( PLOTTER* plotter, ZONE_CONTAINER* aZone, GRTraceMode trace_mode )
|
||||||
GRTraceMode trace_mode )
|
|
||||||
{
|
{
|
||||||
unsigned imax = aZone->m_FilledPolysList.size();
|
unsigned imax = aZone->m_FilledPolysList.size();
|
||||||
|
|
||||||
if( imax == 0 ) // Nothing to draw
|
if( imax == 0 ) // Nothing to draw
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -541,6 +550,7 @@ void PlotFilledAreas( PLOTTER* plotter, ZONE_CONTAINER* aZone,
|
||||||
{
|
{
|
||||||
CPolyPt* corner = &aZone->m_FilledPolysList[ic];
|
CPolyPt* corner = &aZone->m_FilledPolysList[ic];
|
||||||
cornerList.push_back( wxPoint( corner->x, corner->y) );
|
cornerList.push_back( wxPoint( corner->x, corner->y) );
|
||||||
|
|
||||||
if( corner->end_contour ) // Plot the current filled area outline
|
if( corner->end_contour ) // Plot the current filled area outline
|
||||||
{
|
{
|
||||||
// First, close the outline
|
// First, close the outline
|
||||||
|
@ -554,14 +564,12 @@ void PlotFilledAreas( PLOTTER* plotter, ZONE_CONTAINER* aZone,
|
||||||
{
|
{
|
||||||
// Plot the current filled area polygon
|
// Plot the current filled area polygon
|
||||||
if( aZone->m_FillMode == 0 ) // We are using solid polygons
|
if( aZone->m_FillMode == 0 ) // We are using solid polygons
|
||||||
// (if != 0: using segments )
|
{ // (if != 0: using segments )
|
||||||
plotter->PlotPoly( cornerList, FILLED_SHAPE );
|
plotter->PlotPoly( cornerList, FILLED_SHAPE );
|
||||||
|
}
|
||||||
else // We are using areas filled by
|
else // We are using areas filled by
|
||||||
// segments: plot them )
|
{ // segments: plot them )
|
||||||
{
|
for( unsigned iseg = 0; iseg < aZone->m_FillSegmList.size(); iseg++ )
|
||||||
for( unsigned iseg = 0;
|
|
||||||
iseg < aZone->m_FillSegmList.size();
|
|
||||||
iseg++ )
|
|
||||||
{
|
{
|
||||||
wxPoint start = aZone->m_FillSegmList[iseg].m_Start;
|
wxPoint start = aZone->m_FillSegmList[iseg].m_Start;
|
||||||
wxPoint end = aZone->m_FillSegmList[iseg].m_End;
|
wxPoint end = aZone->m_FillSegmList[iseg].m_End;
|
||||||
|
@ -585,24 +593,26 @@ void PlotFilledAreas( PLOTTER* plotter, ZONE_CONTAINER* aZone,
|
||||||
( trace_mode == FILAIRE ) ? -1 : aZone->m_ZoneMinThickness,
|
( trace_mode == FILAIRE ) ? -1 : aZone->m_ZoneMinThickness,
|
||||||
trace_mode );
|
trace_mode );
|
||||||
}
|
}
|
||||||
|
|
||||||
plotter->set_current_line_width( -1 );
|
plotter->set_current_line_width( -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
cornerList.clear();
|
cornerList.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Plot items type DRAWSEGMENT on layers allowed by masque_layer
|
/* Plot items type DRAWSEGMENT on layers allowed by aLayerMask
|
||||||
*/
|
*/
|
||||||
void PlotDrawSegment( PLOTTER* plotter, DRAWSEGMENT* pt_segm, int masque_layer,
|
void PlotDrawSegment( PLOTTER* plotter, DRAWSEGMENT* pt_segm, int aLayerMask,
|
||||||
GRTraceMode trace_mode )
|
GRTraceMode trace_mode )
|
||||||
{
|
{
|
||||||
wxPoint start, end;
|
wxPoint start, end;
|
||||||
int thickness;
|
int thickness;
|
||||||
int radius = 0, StAngle = 0, EndAngle = 0;
|
int radius = 0, StAngle = 0, EndAngle = 0;
|
||||||
|
|
||||||
if( (g_TabOneLayerMask[pt_segm->GetLayer()] & masque_layer) == 0 )
|
if( (g_TabOneLayerMask[pt_segm->GetLayer()] & aLayerMask) == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( trace_mode == FILAIRE )
|
if( trace_mode == FILAIRE )
|
||||||
|
@ -614,27 +624,21 @@ void PlotDrawSegment( PLOTTER* plotter, DRAWSEGMENT* pt_segm, int masque_layer,
|
||||||
end = pt_segm->m_End;
|
end = pt_segm->m_End;
|
||||||
|
|
||||||
plotter->set_current_line_width( thickness );
|
plotter->set_current_line_width( thickness );
|
||||||
|
|
||||||
switch( pt_segm->m_Shape )
|
switch( pt_segm->m_Shape )
|
||||||
{
|
{
|
||||||
case S_CIRCLE:
|
case S_CIRCLE:
|
||||||
radius =
|
radius = (int) hypot( (double) ( end.x - start.x ),
|
||||||
(int) hypot( (double) ( end.x - start.x ),
|
|
||||||
(double) ( end.y - start.y ) );
|
(double) ( end.y - start.y ) );
|
||||||
plotter->thick_circle( start, radius * 2, thickness, trace_mode );
|
plotter->thick_circle( start, radius * 2, thickness, trace_mode );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case S_ARC:
|
case S_ARC:
|
||||||
radius =
|
radius = (int) hypot( (double) ( end.x - start.x ),
|
||||||
(int) hypot( (double) ( end.x - start.x ),
|
|
||||||
(double) ( end.y - start.y ) );
|
(double) ( end.y - start.y ) );
|
||||||
StAngle = ArcTangente( end.y - start.y, end.x - start.x );
|
StAngle = ArcTangente( end.y - start.y, end.x - start.x );
|
||||||
EndAngle = StAngle + pt_segm->m_Angle;
|
EndAngle = StAngle + pt_segm->m_Angle;
|
||||||
plotter->thick_arc( start,
|
plotter->thick_arc( start, -EndAngle, -StAngle, radius, thickness, trace_mode );
|
||||||
-EndAngle,
|
|
||||||
-StAngle,
|
|
||||||
radius,
|
|
||||||
thickness,
|
|
||||||
trace_mode );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case S_CURVE:
|
case S_CURVE:
|
||||||
|
@ -684,8 +688,7 @@ void PCB_BASE_FRAME::Plot_Layer( PLOTTER* plotter, int Layer, GRTraceMode trace_
|
||||||
Plot_Standard_Layer( plotter, layer_mask, true, trace_mode,
|
Plot_Standard_Layer( plotter, layer_mask, true, trace_mode,
|
||||||
g_PcbPlotOptions.m_SkipNPTH_Pads );
|
g_PcbPlotOptions.m_SkipNPTH_Pads );
|
||||||
|
|
||||||
// Adding drill marks, if required and if the plotter is able to plot
|
// Adding drill marks, if required and if the plotter is able to plot them:
|
||||||
// them:
|
|
||||||
if( g_PcbPlotOptions.m_DrillShapeOpt != PCB_PLOT_PARAMS::NO_DRILL_SHAPE )
|
if( g_PcbPlotOptions.m_DrillShapeOpt != PCB_PLOT_PARAMS::NO_DRILL_SHAPE )
|
||||||
{
|
{
|
||||||
if( plotter->GetPlotterType() == PLOT_FORMAT_POST )
|
if( plotter->GetPlotterType() == PLOT_FORMAT_POST )
|
||||||
|
@ -693,6 +696,7 @@ void PCB_BASE_FRAME::Plot_Layer( PLOTTER* plotter, int Layer, GRTraceMode trace_
|
||||||
g_PcbPlotOptions.m_DrillShapeOpt ==
|
g_PcbPlotOptions.m_DrillShapeOpt ==
|
||||||
PCB_PLOT_PARAMS::SMALL_DRILL_SHAPE );
|
PCB_PLOT_PARAMS::SMALL_DRILL_SHAPE );
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SOLDERMASK_N_BACK:
|
case SOLDERMASK_N_BACK:
|
||||||
|
@ -728,6 +732,7 @@ void PCB_BASE_FRAME::Plot_Layer( PLOTTER* plotter, int Layer, GRTraceMode trace_
|
||||||
g_PcbPlotOptions.m_PlotViaOnMaskLayer,
|
g_PcbPlotOptions.m_PlotViaOnMaskLayer,
|
||||||
trace_mode );
|
trace_mode );
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -752,10 +757,7 @@ void PCB_BASE_FRAME::Plot_Standard_Layer( PLOTTER* aPlotter,
|
||||||
switch( item->Type() )
|
switch( item->Type() )
|
||||||
{
|
{
|
||||||
case TYPE_DRAWSEGMENT:
|
case TYPE_DRAWSEGMENT:
|
||||||
PlotDrawSegment( aPlotter,
|
PlotDrawSegment( aPlotter, (DRAWSEGMENT*) item, aLayerMask, aPlotMode );
|
||||||
(DRAWSEGMENT*) item,
|
|
||||||
aLayerMask,
|
|
||||||
aPlotMode );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_TEXTE:
|
case TYPE_TEXTE:
|
||||||
|
@ -766,8 +768,8 @@ void PCB_BASE_FRAME::Plot_Standard_Layer( PLOTTER* aPlotter,
|
||||||
PlotDimension( aPlotter, (DIMENSION*) item, aLayerMask, aPlotMode );
|
PlotDimension( aPlotter, (DIMENSION*) item, aLayerMask, aPlotMode );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_MIRE:
|
case PCB_TARGET_T:
|
||||||
PlotMirePcb( aPlotter, (MIREPCB*) item, aLayerMask, aPlotMode );
|
PlotPcbTarget( aPlotter, (PCB_TARGET*) item, aLayerMask, aPlotMode );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_MARKER_PCB:
|
case TYPE_MARKER_PCB:
|
||||||
|
@ -788,9 +790,8 @@ void PCB_BASE_FRAME::Plot_Standard_Layer( PLOTTER* aPlotter,
|
||||||
{
|
{
|
||||||
case TYPE_EDGE_MODULE:
|
case TYPE_EDGE_MODULE:
|
||||||
if( aLayerMask & g_TabOneLayerMask[ item->GetLayer() ] )
|
if( aLayerMask & g_TabOneLayerMask[ item->GetLayer() ] )
|
||||||
Plot_1_EdgeModule( aPlotter,
|
Plot_1_EdgeModule( aPlotter, (EDGE_MODULE*) item, aPlotMode );
|
||||||
(EDGE_MODULE*) item,
|
|
||||||
aPlotMode );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -805,12 +806,14 @@ void PCB_BASE_FRAME::Plot_Standard_Layer( PLOTTER* aPlotter,
|
||||||
for( D_PAD* pad = module->m_Pads; pad; pad = pad->Next() )
|
for( D_PAD* pad = module->m_Pads; pad; pad = pad->Next() )
|
||||||
{
|
{
|
||||||
wxPoint shape_pos;
|
wxPoint shape_pos;
|
||||||
if( (pad->m_Masque_Layer & aLayerMask) == 0 )
|
|
||||||
|
if( (pad->m_layerMask & aLayerMask) == 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
shape_pos = pad->ReturnShapePos();
|
shape_pos = pad->ReturnShapePos();
|
||||||
pos = shape_pos;
|
pos = shape_pos;
|
||||||
wxSize margin;
|
wxSize margin;
|
||||||
|
|
||||||
switch( aLayerMask &
|
switch( aLayerMask &
|
||||||
( SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT |
|
( SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT |
|
||||||
SOLDERPASTE_LAYER_BACK | SOLDERPASTE_LAYER_FRONT ) )
|
SOLDERPASTE_LAYER_BACK | SOLDERPASTE_LAYER_FRONT ) )
|
||||||
|
@ -843,6 +846,7 @@ void PCB_BASE_FRAME::Plot_Standard_Layer( PLOTTER* aPlotter,
|
||||||
(pad->m_Size == pad->m_Drill) &&
|
(pad->m_Size == pad->m_Drill) &&
|
||||||
(pad->m_Attribut == PAD_HOLE_NOT_PLATED) )
|
(pad->m_Attribut == PAD_HOLE_NOT_PLATED) )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
aPlotter->flash_pad_circle( pos, size.x, aPlotMode );
|
aPlotter->flash_pad_circle( pos, size.x, aPlotMode );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -851,6 +855,7 @@ void PCB_BASE_FRAME::Plot_Standard_Layer( PLOTTER* aPlotter,
|
||||||
(pad->m_Size == pad->m_Drill) &&
|
(pad->m_Size == pad->m_Drill) &&
|
||||||
(pad->m_Attribut == PAD_HOLE_NOT_PLATED) )
|
(pad->m_Attribut == PAD_HOLE_NOT_PLATED) )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
aPlotter->flash_pad_oval( pos, size, pad->m_Orient, aPlotMode );
|
aPlotter->flash_pad_oval( pos, size, pad->m_Orient, aPlotMode );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -884,10 +889,13 @@ void PCB_BASE_FRAME::Plot_Standard_Layer( PLOTTER* aPlotter,
|
||||||
// is SOLDERMASK_LAYER_BACK or SOLDERMASK_LAYER_FRONT,vias are drawn,
|
// is SOLDERMASK_LAYER_BACK or SOLDERMASK_LAYER_FRONT,vias are drawn,
|
||||||
// if they are on an external copper layer
|
// if they are on an external copper layer
|
||||||
int via_mask_layer = Via->ReturnMaskLayer();
|
int via_mask_layer = Via->ReturnMaskLayer();
|
||||||
|
|
||||||
if( via_mask_layer & LAYER_BACK )
|
if( via_mask_layer & LAYER_BACK )
|
||||||
via_mask_layer |= SOLDERMASK_LAYER_BACK;
|
via_mask_layer |= SOLDERMASK_LAYER_BACK;
|
||||||
|
|
||||||
if( via_mask_layer & LAYER_FRONT )
|
if( via_mask_layer & LAYER_FRONT )
|
||||||
via_mask_layer |= SOLDERMASK_LAYER_FRONT;
|
via_mask_layer |= SOLDERMASK_LAYER_FRONT;
|
||||||
|
|
||||||
if( ( via_mask_layer & aLayerMask ) == 0 )
|
if( ( via_mask_layer & aLayerMask ) == 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -897,6 +905,7 @@ void PCB_BASE_FRAME::Plot_Standard_Layer( PLOTTER* aPlotter,
|
||||||
// clearance for vias
|
// clearance for vias
|
||||||
if( ( aLayerMask & ( SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT ) ) )
|
if( ( aLayerMask & ( SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT ) ) )
|
||||||
via_margin = GetBoard()->GetBoardDesignSettings()->m_SolderMaskMargin;
|
via_margin = GetBoard()->GetBoardDesignSettings()->m_SolderMaskMargin;
|
||||||
|
|
||||||
pos = Via->m_Start;
|
pos = Via->m_Start;
|
||||||
size.x = size.y = Via->m_Width + 2 * via_margin;
|
size.x = size.y = Via->m_Width + 2 * via_margin;
|
||||||
|
|
||||||
|
@ -945,8 +954,10 @@ void PCB_BASE_FRAME::Plot_Standard_Layer( PLOTTER* aPlotter,
|
||||||
for( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
|
for( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
|
||||||
{
|
{
|
||||||
ZONE_CONTAINER* edge_zone = m_Pcb->GetArea( ii );
|
ZONE_CONTAINER* edge_zone = m_Pcb->GetArea( ii );
|
||||||
|
|
||||||
if( ( ( 1 << edge_zone->GetLayer() ) & aLayerMask ) == 0 )
|
if( ( ( 1 << edge_zone->GetLayer() ) & aLayerMask ) == 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
PlotFilledAreas( aPlotter, edge_zone, aPlotMode );
|
PlotFilledAreas( aPlotter, edge_zone, aPlotMode );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -982,7 +993,9 @@ void PCB_BASE_FRAME::PlotDrillMark( PLOTTER* aPlotter,
|
||||||
{
|
{
|
||||||
if( pts->Type() != TYPE_VIA )
|
if( pts->Type() != TYPE_VIA )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
pos = pts->m_Start;
|
pos = pts->m_Start;
|
||||||
|
|
||||||
if( g_PcbPlotOptions.m_DrillShapeOpt == PCB_PLOT_PARAMS::SMALL_DRILL_SHAPE )
|
if( g_PcbPlotOptions.m_DrillShapeOpt == PCB_PLOT_PARAMS::SMALL_DRILL_SHAPE )
|
||||||
diam.x = diam.y = SMALL_DRILL;
|
diam.x = diam.y = SMALL_DRILL;
|
||||||
else
|
else
|
||||||
|
@ -991,26 +1004,20 @@ void PCB_BASE_FRAME::PlotDrillMark( PLOTTER* aPlotter,
|
||||||
aPlotter->flash_pad_circle( pos, diam.x, aTraceMode );
|
aPlotter->flash_pad_circle( pos, diam.x, aTraceMode );
|
||||||
}
|
}
|
||||||
|
|
||||||
for( Module = m_Pcb->m_Modules;
|
for( Module = m_Pcb->m_Modules; Module != NULL; Module = Module->Next() )
|
||||||
Module != NULL;
|
|
||||||
Module = Module->Next() )
|
|
||||||
{
|
{
|
||||||
for( PtPad = Module->m_Pads;
|
for( PtPad = Module->m_Pads; PtPad != NULL; PtPad = PtPad->Next() )
|
||||||
PtPad != NULL;
|
|
||||||
PtPad = PtPad->Next() )
|
|
||||||
{
|
{
|
||||||
if( PtPad->m_Drill.x == 0 )
|
if( PtPad->m_Drill.x == 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Output hole shapes:
|
// Output hole shapes:
|
||||||
pos = PtPad->m_Pos;
|
pos = PtPad->m_Pos;
|
||||||
|
|
||||||
if( PtPad->m_DrillShape == PAD_OVAL )
|
if( PtPad->m_DrillShape == PAD_OVAL )
|
||||||
{
|
{
|
||||||
diam = PtPad->m_Drill;
|
diam = PtPad->m_Drill;
|
||||||
aPlotter->flash_pad_oval( pos,
|
aPlotter->flash_pad_oval( pos, diam, PtPad->m_Orient, aTraceMode );
|
||||||
diam,
|
|
||||||
PtPad->m_Orient,
|
|
||||||
aTraceMode );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,29 +18,34 @@ bool PCB_BASE_FRAME::Genere_HPGL( const wxString& FullFileName, int Layer, GRTra
|
||||||
wxSize SheetSize;
|
wxSize SheetSize;
|
||||||
wxSize BoardSize;
|
wxSize BoardSize;
|
||||||
wxPoint BoardCenter;
|
wxPoint BoardCenter;
|
||||||
bool Center = FALSE;
|
bool Center = false;
|
||||||
Ki_PageDescr* currentsheet = GetScreen()->m_CurrentSheetDesc;
|
Ki_PageDescr* currentsheet = GetScreen()->m_CurrentSheetDesc;
|
||||||
double scale;
|
double scale;
|
||||||
wxPoint offset;
|
wxPoint offset;
|
||||||
|
|
||||||
FILE* output_file = wxFopen( FullFileName, wxT( "wt" ) );
|
FILE* output_file = wxFopen( FullFileName, wxT( "wt" ) );
|
||||||
|
|
||||||
if( output_file == NULL )
|
if( output_file == NULL )
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compute pen_dim (from g_m_HPGLPenDiam in mils) in pcb units,
|
// Compute pen_dim (from g_m_HPGLPenDiam in mils) in pcb units,
|
||||||
// with plot scale (if Scale is 2, pen diameter is always g_m_HPGLPenDiam
|
// with plot scale (if Scale is 2, pen diameter is always g_m_HPGLPenDiam
|
||||||
// so apparent pen diam is real pen diam / Scale
|
// so apparent pen diam is real pen diam / Scale
|
||||||
int pen_diam = wxRound( (g_PcbPlotOptions.m_HPGLPenDiam * U_PCB) / g_PcbPlotOptions.m_PlotScale );
|
int pen_diam = wxRound( (g_PcbPlotOptions.m_HPGLPenDiam * U_PCB) /
|
||||||
|
g_PcbPlotOptions.m_PlotScale );
|
||||||
|
|
||||||
// compute pen_overlay (from g_m_HPGLPenOvr in mils)
|
// compute pen_overlay (from g_m_HPGLPenOvr in mils)
|
||||||
// with plot scale
|
// with plot scale
|
||||||
if( g_PcbPlotOptions.m_HPGLPenOvr < 0 )
|
if( g_PcbPlotOptions.m_HPGLPenOvr < 0 )
|
||||||
g_PcbPlotOptions.m_HPGLPenOvr = 0;
|
g_PcbPlotOptions.m_HPGLPenOvr = 0;
|
||||||
|
|
||||||
if( g_PcbPlotOptions.m_HPGLPenOvr >= g_PcbPlotOptions.m_HPGLPenDiam )
|
if( g_PcbPlotOptions.m_HPGLPenOvr >= g_PcbPlotOptions.m_HPGLPenDiam )
|
||||||
g_PcbPlotOptions.m_HPGLPenOvr = g_PcbPlotOptions.m_HPGLPenDiam - 1;
|
g_PcbPlotOptions.m_HPGLPenOvr = g_PcbPlotOptions.m_HPGLPenDiam - 1;
|
||||||
int pen_overlay = wxRound(
|
|
||||||
g_PcbPlotOptions.m_HPGLPenOvr * 10.0 / g_PcbPlotOptions.m_PlotScale );
|
int pen_overlay = wxRound( g_PcbPlotOptions.m_HPGLPenOvr * 10.0 /
|
||||||
|
g_PcbPlotOptions.m_PlotScale );
|
||||||
|
|
||||||
|
|
||||||
SetLocaleTo_C_standard();
|
SetLocaleTo_C_standard();
|
||||||
|
@ -68,7 +73,9 @@ bool PCB_BASE_FRAME::Genere_HPGL( const wxString& FullFileName, int Layer, GRTra
|
||||||
scale = MIN( Xscale, Yscale );
|
scale = MIN( Xscale, Yscale );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
scale = g_PcbPlotOptions.m_PlotScale;
|
scale = g_PcbPlotOptions.m_PlotScale;
|
||||||
|
}
|
||||||
|
|
||||||
// Calculate the page size offset.
|
// Calculate the page size offset.
|
||||||
if( Center )
|
if( Center )
|
||||||
|
|
|
@ -23,13 +23,14 @@ bool PCB_BASE_FRAME::Genere_PS( const wxString& FullFileName, int Layer,
|
||||||
wxSize PaperSize;
|
wxSize PaperSize;
|
||||||
wxSize BoardSize;
|
wxSize BoardSize;
|
||||||
wxPoint BoardCenter;
|
wxPoint BoardCenter;
|
||||||
bool Center = FALSE;
|
bool Center = false;
|
||||||
Ki_PageDescr* currentsheet = GetScreen()->m_CurrentSheetDesc;
|
Ki_PageDescr* currentsheet = GetScreen()->m_CurrentSheetDesc;
|
||||||
double scale, paperscale;
|
double scale, paperscale;
|
||||||
Ki_PageDescr* SheetPS;
|
Ki_PageDescr* SheetPS;
|
||||||
wxPoint offset;
|
wxPoint offset;
|
||||||
|
|
||||||
FILE* output_file = wxFopen( FullFileName, wxT( "wt" ) );
|
FILE* output_file = wxFopen( FullFileName, wxT( "wt" ) );
|
||||||
|
|
||||||
if( output_file == NULL )
|
if( output_file == NULL )
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -80,10 +81,8 @@ bool PCB_BASE_FRAME::Genere_PS( const wxString& FullFileName, int Layer,
|
||||||
|
|
||||||
if( Center )
|
if( Center )
|
||||||
{
|
{
|
||||||
offset.x = wxRound( (double) BoardCenter.x -
|
offset.x = wxRound( (double) BoardCenter.x - ( (double) PaperSize.x / 2.0 ) / scale );
|
||||||
( (double) PaperSize.x / 2.0 ) / scale );
|
offset.y = wxRound( (double) BoardCenter.y - ( (double) PaperSize.y / 2.0 ) / scale );
|
||||||
offset.y = wxRound( (double) BoardCenter.y -
|
|
||||||
( (double) PaperSize.y / 2.0 ) / scale );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -114,16 +114,18 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
|
||||||
MODULE* Module;
|
MODULE* Module;
|
||||||
int drawmode = GR_COPY;
|
int drawmode = GR_COPY;
|
||||||
DISPLAY_OPTIONS save_opt;
|
DISPLAY_OPTIONS save_opt;
|
||||||
TRACK* pt_piste;
|
TRACK* pt_trace;
|
||||||
BOARD* Pcb = GetBoard();
|
BOARD* Pcb = GetBoard();
|
||||||
int defaultPenSize = 50;
|
int defaultPenSize = 50;
|
||||||
bool onePagePerLayer = false;
|
bool onePagePerLayer = false;
|
||||||
|
|
||||||
PRINT_PARAMETERS * printParameters = (PRINT_PARAMETERS*) aData; // can be null
|
PRINT_PARAMETERS * printParameters = (PRINT_PARAMETERS*) aData; // can be null
|
||||||
|
|
||||||
if( printParameters && printParameters->m_OptionPrintPage == 0 )
|
if( printParameters && printParameters->m_OptionPrintPage == 0 )
|
||||||
onePagePerLayer = true;
|
onePagePerLayer = true;
|
||||||
|
|
||||||
PRINT_PARAMETERS::DrillShapeOptT drillShapeOpt = PRINT_PARAMETERS::FULL_DRILL_SHAPE;
|
PRINT_PARAMETERS::DrillShapeOptT drillShapeOpt = PRINT_PARAMETERS::FULL_DRILL_SHAPE;
|
||||||
|
|
||||||
if( printParameters )
|
if( printParameters )
|
||||||
{
|
{
|
||||||
drillShapeOpt = printParameters->m_DrillShapeOpt;
|
drillShapeOpt = printParameters->m_DrillShapeOpt;
|
||||||
|
@ -140,14 +142,15 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
|
||||||
if( (aPrintMaskLayer & ALL_CU_LAYERS) == 0 )
|
if( (aPrintMaskLayer & ALL_CU_LAYERS) == 0 )
|
||||||
{
|
{
|
||||||
if( onePagePerLayer )
|
if( onePagePerLayer )
|
||||||
{ // We can print mask layers (solder mask and solder paste) with the actual pad sizes
|
{ // We can print mask layers (solder mask and solder paste) with the actual
|
||||||
// To do that, we must set ContrastModeDisplay to true and set the GetScreen()->m_Active_Layer
|
// pad sizes. To do that, we must set ContrastModeDisplay to true and set
|
||||||
// to the current printed layer
|
//the GetScreen()->m_Active_Layer to the current printed layer
|
||||||
DisplayOpt.ContrastModeDisplay = true;
|
DisplayOpt.ContrastModeDisplay = true;
|
||||||
DisplayOpt.DisplayPadFill = true;
|
DisplayOpt.DisplayPadFill = true;
|
||||||
|
|
||||||
// Calculate the active layer number to print from its mask layer:
|
// Calculate the active layer number to print from its mask layer:
|
||||||
GetScreen()->m_Active_Layer = 0;
|
GetScreen()->m_Active_Layer = 0;
|
||||||
|
|
||||||
for(int kk = 0; kk < 32; kk ++ )
|
for(int kk = 0; kk < 32; kk ++ )
|
||||||
{
|
{
|
||||||
if( ((1 << kk) & aPrintMaskLayer) != 0 )
|
if( ((1 << kk) & aPrintMaskLayer) != 0 )
|
||||||
|
@ -203,7 +206,7 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
|
||||||
case TYPE_DRAWSEGMENT:
|
case TYPE_DRAWSEGMENT:
|
||||||
case TYPE_DIMENSION:
|
case TYPE_DIMENSION:
|
||||||
case TYPE_TEXTE:
|
case TYPE_TEXTE:
|
||||||
case TYPE_MIRE:
|
case PCB_TARGET_T:
|
||||||
if( ( ( 1 << item->GetLayer() ) & aPrintMaskLayer ) == 0 )
|
if( ( ( 1 << item->GetLayer() ) & aPrintMaskLayer ) == 0 )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -217,38 +220,38 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print tracks */
|
/* Print tracks */
|
||||||
pt_piste = Pcb->m_Track;
|
pt_trace = Pcb->m_Track;
|
||||||
|
|
||||||
for( ; pt_piste != NULL; pt_piste = pt_piste->Next() )
|
for( ; pt_trace != NULL; pt_trace = pt_trace->Next() )
|
||||||
{
|
{
|
||||||
if( ( aPrintMaskLayer & pt_piste->ReturnMaskLayer() ) == 0 )
|
if( ( aPrintMaskLayer & pt_trace->ReturnMaskLayer() ) == 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( pt_piste->Type() == TYPE_VIA ) /* VIA encountered. */
|
if( pt_trace->Type() == TYPE_VIA ) /* VIA encountered. */
|
||||||
{
|
{
|
||||||
int rayon = pt_piste->m_Width >> 1;
|
int radius = pt_trace->m_Width >> 1;
|
||||||
int color = g_ColorsSettings.GetItemColor(VIAS_VISIBLE+pt_piste->m_Shape);
|
int color = g_ColorsSettings.GetItemColor( VIAS_VISIBLE + pt_trace->m_Shape );
|
||||||
GRSetDrawMode( aDC, drawmode );
|
GRSetDrawMode( aDC, drawmode );
|
||||||
GRFilledCircle( &DrawPanel->m_ClipBox, aDC,
|
GRFilledCircle( &DrawPanel->m_ClipBox, aDC,
|
||||||
pt_piste->m_Start.x,
|
pt_trace->m_Start.x,
|
||||||
pt_piste->m_Start.y,
|
pt_trace->m_Start.y,
|
||||||
rayon,
|
radius,
|
||||||
0, color, color );
|
0, color, color );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pt_piste->Draw( DrawPanel, aDC, drawmode );
|
pt_trace->Draw( DrawPanel, aDC, drawmode );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pt_piste = Pcb->m_Zone;
|
pt_trace = Pcb->m_Zone;
|
||||||
|
|
||||||
for( ; pt_piste != NULL; pt_piste = pt_piste->Next() )
|
for( ; pt_trace != NULL; pt_trace = pt_trace->Next() )
|
||||||
{
|
{
|
||||||
if( ( aPrintMaskLayer & pt_piste->ReturnMaskLayer() ) == 0 )
|
if( ( aPrintMaskLayer & pt_trace->ReturnMaskLayer() ) == 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
pt_piste->Draw( DrawPanel, aDC, drawmode );
|
pt_trace->Draw( DrawPanel, aDC, drawmode );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Draw filled areas (i.e. zones) */
|
/* Draw filled areas (i.e. zones) */
|
||||||
|
@ -279,28 +282,28 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
|
||||||
* vias */
|
* vias */
|
||||||
if( drillShapeOpt != PRINT_PARAMETERS::NO_DRILL_SHAPE )
|
if( drillShapeOpt != PRINT_PARAMETERS::NO_DRILL_SHAPE )
|
||||||
{
|
{
|
||||||
pt_piste = Pcb->m_Track;
|
pt_trace = Pcb->m_Track;
|
||||||
int color = g_DrawBgColor;
|
int color = g_DrawBgColor;
|
||||||
bool blackpenstate = GetGRForceBlackPenState();
|
bool blackpenstate = GetGRForceBlackPenState();
|
||||||
GRForceBlackPen( false );
|
GRForceBlackPen( false );
|
||||||
GRSetDrawMode( aDC, GR_COPY );
|
GRSetDrawMode( aDC, GR_COPY );
|
||||||
|
|
||||||
for( ; pt_piste != NULL; pt_piste = pt_piste->Next() )
|
for( ; pt_trace != NULL; pt_trace = pt_trace->Next() )
|
||||||
{
|
{
|
||||||
if( ( aPrintMaskLayer & pt_piste->ReturnMaskLayer() ) == 0 )
|
if( ( aPrintMaskLayer & pt_trace->ReturnMaskLayer() ) == 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( pt_piste->Type() == TYPE_VIA ) /* VIA encountered. */
|
if( pt_trace->Type() == TYPE_VIA ) /* VIA encountered. */
|
||||||
{
|
{
|
||||||
int diameter;
|
int diameter;
|
||||||
|
|
||||||
if( drillShapeOpt == PRINT_PARAMETERS::SMALL_DRILL_SHAPE )
|
if( drillShapeOpt == PRINT_PARAMETERS::SMALL_DRILL_SHAPE )
|
||||||
diameter = min( SMALL_DRILL, pt_piste->GetDrillValue() );
|
diameter = min( SMALL_DRILL, pt_trace->GetDrillValue() );
|
||||||
else
|
else
|
||||||
diameter = pt_piste->GetDrillValue();
|
diameter = pt_trace->GetDrillValue();
|
||||||
|
|
||||||
GRFilledCircle( &DrawPanel->m_ClipBox, aDC,
|
GRFilledCircle( &DrawPanel->m_ClipBox, aDC,
|
||||||
pt_piste->m_Start.x, pt_piste->m_Start.y,
|
pt_trace->m_Start.x, pt_trace->m_Start.y,
|
||||||
diameter/2,
|
diameter/2,
|
||||||
0, color, color );
|
0, color, color );
|
||||||
}
|
}
|
||||||
|
@ -337,7 +340,7 @@ static void Print_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, MODULE* aModule,
|
||||||
|
|
||||||
for( ; pt_pad != NULL; pt_pad = pt_pad->Next() )
|
for( ; pt_pad != NULL; pt_pad = pt_pad->Next() )
|
||||||
{
|
{
|
||||||
if( (pt_pad->m_Masque_Layer & aMasklayer ) == 0 )
|
if( (pt_pad->m_layerMask & aMasklayer ) == 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Manage hole according to the print drill option
|
// Manage hole according to the print drill option
|
||||||
|
@ -394,8 +397,10 @@ static void Print_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, MODULE* aModule,
|
||||||
case TYPE_EDGE_MODULE:
|
case TYPE_EDGE_MODULE:
|
||||||
{
|
{
|
||||||
EDGE_MODULE* edge = (EDGE_MODULE*) PtStruct;
|
EDGE_MODULE* edge = (EDGE_MODULE*) PtStruct;
|
||||||
|
|
||||||
if( ( g_TabOneLayerMask[edge->GetLayer()] & aMasklayer ) == 0 )
|
if( ( g_TabOneLayerMask[edge->GetLayer()] & aMasklayer ) == 0 )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
edge->Draw( aPanel, aDC, aDraw_mode );
|
edge->Draw( aPanel, aDC, aDraw_mode );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,9 +55,9 @@ void CreateSortedPadListByXCoord( BOARD* aBoard, std::vector<D_PAD*>* aVector );
|
||||||
* The starting point of a track following MUST exist: may be
|
* The starting point of a track following MUST exist: may be
|
||||||
* Then put a 0 before calling a routine if the track is the last draw
|
* Then put a 0 before calling a routine if the track is the last draw
|
||||||
*/
|
*/
|
||||||
void Trace_Une_Piste( EDA_DRAW_PANEL* panel,
|
void DrawTraces( EDA_DRAW_PANEL* panel,
|
||||||
wxDC* DC,
|
wxDC* DC,
|
||||||
TRACK* pt_start_piste,
|
TRACK* aStartTrace,
|
||||||
int nbsegment,
|
int nbsegment,
|
||||||
int mode_color );
|
int mode_color );
|
||||||
|
|
||||||
|
@ -89,8 +89,7 @@ TRACK* Fast_Locate_Via( TRACK* start_adr, TRACK* end_adr, const wxPoint& pos, in
|
||||||
* by masquelayer.
|
* by masquelayer.
|
||||||
* Search is done to address start_adr has end_adr (not included)
|
* Search is done to address start_adr has end_adr (not included)
|
||||||
*/
|
*/
|
||||||
TRACK* Fast_Locate_Piste( TRACK* start_adr, TRACK* end_adr,
|
TRACK* GetTrace( TRACK* start_adr, TRACK* end_adr, const wxPoint& ref_pos, int masquelayer );
|
||||||
const wxPoint& ref_pos, int masquelayer );
|
|
||||||
|
|
||||||
/* Search for segment connected to the segment edge by
|
/* Search for segment connected to the segment edge by
|
||||||
* Ptr_piste:
|
* Ptr_piste:
|
||||||
|
@ -99,7 +98,7 @@ TRACK* Fast_Locate_Piste( TRACK* start_adr, TRACK* end_adr,
|
||||||
* The search is done only on the ends of segments
|
* The search is done only on the ends of segments
|
||||||
* The search is limited to the area [... pt_base] pt_lim.
|
* The search is limited to the area [... pt_base] pt_lim.
|
||||||
*/
|
*/
|
||||||
TRACK* Locate_Piste_Connectee( TRACK* ptr_piste, TRACK* pt_base, TRACK* pt_lim, int extr );
|
TRACK* GetConnectedTrace( TRACK* aTrace, TRACK* pt_base, TRACK* pt_lim, int extr );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 1 - Locate segment of track leading from the mouse.
|
* 1 - Locate segment of track leading from the mouse.
|
||||||
|
@ -110,7 +109,7 @@ TRACK* Locate_Piste_Connectee( TRACK* ptr_piste, TRACK* pt_base, TRACK* pt_lim,
|
||||||
*
|
*
|
||||||
* The search begins to address start_adresse
|
* The search begins to address start_adresse
|
||||||
*/
|
*/
|
||||||
TRACK* Locate_Pistes( BOARD* aPcb, TRACK* start_adresse, const wxPoint& ref_pos, int layer );
|
TRACK* GetTrace( BOARD* aPcb, TRACK* start_adresse, const wxPoint& ref_pos, int layer );
|
||||||
|
|
||||||
/* Locate pad connected to the beginning or end of a segment
|
/* Locate pad connected to the beginning or end of a segment
|
||||||
* Input: pointer to the segment, and flag = START or END
|
* Input: pointer to the segment, and flag = START or END
|
||||||
|
@ -158,7 +157,7 @@ D_PAD* Locate_Pads( MODULE* Module, int typeloc );
|
||||||
/* Locate a trace segment at the current cursor position.
|
/* Locate a trace segment at the current cursor position.
|
||||||
* The search begins to address start_adresse.
|
* The search begins to address start_adresse.
|
||||||
*/
|
*/
|
||||||
TRACK* Locate_Pistes( TRACK* start_adresse, int typeloc );
|
TRACK* GetTrace( TRACK* start_adresse, int typeloc );
|
||||||
|
|
||||||
DRAWSEGMENT* Locate_Segment_Pcb( BOARD* Pcb, int LayerSearch, int typeloc );
|
DRAWSEGMENT* Locate_Segment_Pcb( BOARD* Pcb, int LayerSearch, int typeloc );
|
||||||
|
|
||||||
|
@ -187,8 +186,7 @@ TRACK* Locate_Zone( TRACK* start_adresse, const wxPoint& ref_pos, int layer );
|
||||||
/*************/
|
/*************/
|
||||||
int ChangeSideNumLayer( int oldlayer );
|
int ChangeSideNumLayer( int oldlayer );
|
||||||
void DrawModuleOutlines( EDA_DRAW_PANEL* panel, wxDC* DC, MODULE* module );
|
void DrawModuleOutlines( EDA_DRAW_PANEL* panel, wxDC* DC, MODULE* module );
|
||||||
void Montre_Position_Empreinte( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
|
void MoveFootprint( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase );
|
||||||
bool aErase );
|
|
||||||
|
|
||||||
|
|
||||||
/****************/
|
/****************/
|
||||||
|
@ -203,7 +201,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
|
||||||
/* Determine coordinate for a segment direction of 0, 90 or 45 degrees,
|
/* Determine coordinate for a segment direction of 0, 90 or 45 degrees,
|
||||||
* depending on it's position from the origin (ox, oy) and \a aPosiition..
|
* depending on it's position from the origin (ox, oy) and \a aPosiition..
|
||||||
*/
|
*/
|
||||||
void Calcule_Coord_Extremite_45( const wxPoint& aPosition, int ox, int oy, int* fx, int* fy );
|
void CalculateSegmentEndPoint( const wxPoint& aPosition, int ox, int oy, int* fx, int* fy );
|
||||||
|
|
||||||
|
|
||||||
/*****************/
|
/*****************/
|
||||||
|
@ -211,7 +209,7 @@ void Calcule_Coord_Extremite_45( const wxPoint& aPosition, int ox, int oy, int*
|
||||||
/*****************/
|
/*****************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Marque_Une_Piste
|
* Function MarkTrace
|
||||||
* marks a chain of track segments, connected to aTrackList.
|
* marks a chain of track segments, connected to aTrackList.
|
||||||
* Each segment is marked by setting the BUSY bit into m_Flags. Electrical
|
* Each segment is marked by setting the BUSY bit into m_Flags. Electrical
|
||||||
* continuity is detected by walking each segment, and finally the segments
|
* continuity is detected by walking each segment, and finally the segments
|
||||||
|
@ -234,7 +232,7 @@ void Calcule_Coord_Extremite_45( const wxPoint& aPosition, int ox, int oy, int*
|
||||||
* track length in this case, flags are reset
|
* track length in this case, flags are reset
|
||||||
* @return TRACK* the first in the chain of interesting segments.
|
* @return TRACK* the first in the chain of interesting segments.
|
||||||
*/
|
*/
|
||||||
TRACK* Marque_Une_Piste( BOARD* aPcb,
|
TRACK* MarkTrace( BOARD* aPcb,
|
||||||
TRACK* aStartSegm,
|
TRACK* aStartSegm,
|
||||||
int* aSegmCount,
|
int* aSegmCount,
|
||||||
int* aTrackLen,
|
int* aTrackLen,
|
||||||
|
|
|
@ -116,7 +116,7 @@ void PCB_BASE_FRAME::Compile_Ratsnest( wxDC* aDC, bool aDisplayStatus )
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
DisplayRastnestInProgress = TRUE;
|
DisplayRastnestInProgress = true;
|
||||||
|
|
||||||
GetBoard()->m_Status_Pcb = 0; /* we want a full ratsnest computation,
|
GetBoard()->m_Status_Pcb = 0; /* we want a full ratsnest computation,
|
||||||
* from the scratch */
|
* from the scratch */
|
||||||
|
@ -203,7 +203,8 @@ static int sort_by_length( const void* o1, const void* o2 )
|
||||||
* @param aPadIdxMax = ending index (within the pad list) for search
|
* @param aPadIdxMax = ending index (within the pad list) for search
|
||||||
* @return blocks not connected count
|
* @return blocks not connected count
|
||||||
*/
|
*/
|
||||||
static int gen_rats_block_to_block(
|
static int gen_rats_block_to_block
|
||||||
|
(
|
||||||
std::vector<RATSNEST_ITEM>& aRatsnestBuffer,
|
std::vector<RATSNEST_ITEM>& aRatsnestBuffer,
|
||||||
std::vector<D_PAD*>& aPadBuffer,
|
std::vector<D_PAD*>& aPadBuffer,
|
||||||
unsigned aPadIdxStart,
|
unsigned aPadIdxStart,
|
||||||
|
@ -271,8 +272,10 @@ static int gen_rats_block_to_block(
|
||||||
}
|
}
|
||||||
|
|
||||||
if( padBlock1Idx < 0 )
|
if( padBlock1Idx < 0 )
|
||||||
|
{
|
||||||
DisplayError( NULL,
|
DisplayError( NULL,
|
||||||
wxT( "gen_rats_block_to_block() internal error" ) );
|
wxT( "gen_rats_block_to_block() internal error" ) );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Create the new ratsnest */
|
/* Create the new ratsnest */
|
||||||
|
@ -285,6 +288,7 @@ static int gen_rats_block_to_block(
|
||||||
aRatsnestBuffer.push_back( net );
|
aRatsnestBuffer.push_back( net );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return current_num_block;
|
return current_num_block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -355,11 +359,9 @@ static int gen_rats_pad_to_pad( vector<RATSNEST_ITEM>& aRatsnestBuffer,
|
||||||
/* Update the block number
|
/* Update the block number
|
||||||
* if the 2 pads are not already created : a new block is created
|
* if the 2 pads are not already created : a new block is created
|
||||||
*/
|
*/
|
||||||
if( (pad->GetSubRatsnest() == 0)
|
if( (pad->GetSubRatsnest() == 0) && (ref_pad->GetSubRatsnest() == 0) )
|
||||||
&& (ref_pad->GetSubRatsnest() == 0) )
|
|
||||||
{
|
{
|
||||||
current_num_block++; // Creates a new block number (or
|
current_num_block++; // Creates a new block number (or subratsnest)
|
||||||
// subratsnest)
|
|
||||||
pad->SetSubRatsnest( current_num_block );
|
pad->SetSubRatsnest( current_num_block );
|
||||||
ref_pad->SetSubRatsnest( current_num_block );
|
ref_pad->SetSubRatsnest( current_num_block );
|
||||||
}
|
}
|
||||||
|
@ -437,7 +439,7 @@ void PCB_BASE_FRAME::Build_Board_Ratsnest( wxDC* DC )
|
||||||
return; /* No useful connections. */
|
return; /* No useful connections. */
|
||||||
|
|
||||||
/* Ratsnest computation */
|
/* Ratsnest computation */
|
||||||
DisplayRastnestInProgress = TRUE;
|
DisplayRastnestInProgress = true;
|
||||||
|
|
||||||
unsigned current_net_code = 1; // First net code is analyzed.
|
unsigned current_net_code = 1; // First net code is analyzed.
|
||||||
// (net_code = 0 -> no connect)
|
// (net_code = 0 -> no connect)
|
||||||
|
@ -446,19 +448,23 @@ void PCB_BASE_FRAME::Build_Board_Ratsnest( wxDC* DC )
|
||||||
for( ; current_net_code < m_Pcb->m_NetInfo->GetCount(); current_net_code++ )
|
for( ; current_net_code < m_Pcb->m_NetInfo->GetCount(); current_net_code++ )
|
||||||
{
|
{
|
||||||
NETINFO_ITEM* net = m_Pcb->FindNet( current_net_code );
|
NETINFO_ITEM* net = m_Pcb->FindNet( current_net_code );
|
||||||
|
|
||||||
if( net == NULL ) //Should not occur
|
if( net == NULL ) //Should not occur
|
||||||
{
|
{
|
||||||
DisplayError( this,
|
DisplayError( this,
|
||||||
wxT( "Build_Board_Ratsnest() error: net not found" ) );
|
wxT( "Build_Board_Ratsnest() error: net not found" ) );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
net->m_RatsnestStartIdx = m_Pcb->GetRatsnestsCount();
|
net->m_RatsnestStartIdx = m_Pcb->GetRatsnestsCount();
|
||||||
|
|
||||||
// Search for the last subratsnest already in use
|
// Search for the last subratsnest already in use
|
||||||
int num_block = 0;
|
int num_block = 0;
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < net->m_ListPad.size(); ii++ )
|
for( unsigned ii = 0; ii < net->m_ListPad.size(); ii++ )
|
||||||
{
|
{
|
||||||
pad = net->m_ListPad[ii];
|
pad = net->m_ListPad[ii];
|
||||||
|
|
||||||
if( num_block < pad->GetSubRatsnest() )
|
if( num_block < pad->GetSubRatsnest() )
|
||||||
num_block = pad->GetSubRatsnest();
|
num_block = pad->GetSubRatsnest();
|
||||||
}
|
}
|
||||||
|
@ -486,6 +492,7 @@ void PCB_BASE_FRAME::Build_Board_Ratsnest( wxDC* DC )
|
||||||
|
|
||||||
/* sort by length */
|
/* sort by length */
|
||||||
net = m_Pcb->FindNet( current_net_code );
|
net = m_Pcb->FindNet( current_net_code );
|
||||||
|
|
||||||
if( ( net->m_RatsnestEndIdx - net->m_RatsnestStartIdx ) > 1 )
|
if( ( net->m_RatsnestEndIdx - net->m_RatsnestStartIdx ) > 1 )
|
||||||
{
|
{
|
||||||
RATSNEST_ITEM* rats = &m_Pcb->m_FullRatsnest[0];
|
RATSNEST_ITEM* rats = &m_Pcb->m_FullRatsnest[0];
|
||||||
|
@ -522,14 +529,19 @@ void PCB_BASE_FRAME::DrawGeneralRatsnest( wxDC* aDC, int aNetcode )
|
||||||
{
|
{
|
||||||
if( ( m_Pcb->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK ) == 0 )
|
if( ( m_Pcb->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK ) == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( ( m_Pcb->m_Status_Pcb & DO_NOT_SHOW_GENERAL_RASTNEST ) )
|
if( ( m_Pcb->m_Status_Pcb & DO_NOT_SHOW_GENERAL_RASTNEST ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( aDC == NULL )
|
if( aDC == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int state = CH_VISIBLE | CH_ACTIF;
|
int state = CH_VISIBLE | CH_ACTIF;
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < m_Pcb->GetRatsnestsCount(); ii++ )
|
for( unsigned ii = 0; ii < m_Pcb->GetRatsnestsCount(); ii++ )
|
||||||
{
|
{
|
||||||
RATSNEST_ITEM& item = m_Pcb->m_FullRatsnest[ii];
|
RATSNEST_ITEM& item = m_Pcb->m_FullRatsnest[ii];
|
||||||
|
|
||||||
if( ( item.m_Status & state ) != state )
|
if( ( item.m_Status & state ) != state )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -565,13 +577,12 @@ static int tst_rats_block_to_block( NETINFO_ITEM* net,
|
||||||
|
|
||||||
/* Search a link from a block to an other block */
|
/* Search a link from a block to an other block */
|
||||||
min_rats = NULL;
|
min_rats = NULL;
|
||||||
for( unsigned ii = net->m_RatsnestStartIdx;
|
|
||||||
ii < net->m_RatsnestEndIdx;
|
for( unsigned ii = net->m_RatsnestStartIdx; ii < net->m_RatsnestEndIdx; ii++ )
|
||||||
ii++ )
|
|
||||||
{
|
{
|
||||||
rats = &aRatsnestBuffer[ii];
|
rats = &aRatsnestBuffer[ii];
|
||||||
if( rats->m_PadStart->GetSubRatsnest() ==
|
|
||||||
rats->m_PadEnd->GetSubRatsnest() ) // Same block
|
if( rats->m_PadStart->GetSubRatsnest() == rats->m_PadEnd->GetSubRatsnest() ) // Same block
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( min_rats == NULL )
|
if( min_rats == NULL )
|
||||||
|
@ -631,35 +642,33 @@ static int tst_rats_pad_to_pad( int current_num_block,
|
||||||
RATSNEST_ITEM* end_rat_list )
|
RATSNEST_ITEM* end_rat_list )
|
||||||
{
|
{
|
||||||
D_PAD* pad_start, * pad_end;
|
D_PAD* pad_start, * pad_end;
|
||||||
RATSNEST_ITEM* chevelu;
|
RATSNEST_ITEM* item;
|
||||||
|
|
||||||
for( chevelu = start_rat_list; chevelu < end_rat_list; chevelu++ )
|
for( item = start_rat_list; item < end_rat_list; item++ )
|
||||||
{
|
{
|
||||||
pad_start = chevelu->m_PadStart;
|
pad_start = item->m_PadStart;
|
||||||
pad_end = chevelu->m_PadEnd;
|
pad_end = item->m_PadEnd;
|
||||||
|
|
||||||
/* Update the block if the 2 pads are not connected : a new block is
|
/* Update the block if the 2 pads are not connected : a new block is created
|
||||||
* created
|
|
||||||
*/
|
*/
|
||||||
if( (pad_start->GetSubRatsnest() == 0)
|
if( (pad_start->GetSubRatsnest() == 0) && (pad_end->GetSubRatsnest() == 0) )
|
||||||
&& (pad_end->GetSubRatsnest() == 0) )
|
|
||||||
{
|
{
|
||||||
current_num_block++;
|
current_num_block++;
|
||||||
pad_start->SetSubRatsnest( current_num_block );
|
pad_start->SetSubRatsnest( current_num_block );
|
||||||
pad_end->SetSubRatsnest( current_num_block );
|
pad_end->SetSubRatsnest( current_num_block );
|
||||||
chevelu->m_Status |= CH_ACTIF;
|
item->m_Status |= CH_ACTIF;
|
||||||
}
|
}
|
||||||
/* If a pad is already connected : the other is merged in the current
|
|
||||||
* block */
|
/* If a pad is already connected : the other is merged in the current block */
|
||||||
else if( pad_start->GetSubRatsnest() == 0 )
|
else if( pad_start->GetSubRatsnest() == 0 )
|
||||||
{
|
{
|
||||||
pad_start->SetSubRatsnest( pad_end->GetSubRatsnest() );
|
pad_start->SetSubRatsnest( pad_end->GetSubRatsnest() );
|
||||||
chevelu->m_Status |= CH_ACTIF;
|
item->m_Status |= CH_ACTIF;
|
||||||
}
|
}
|
||||||
else if( pad_end->GetSubRatsnest() == 0 )
|
else if( pad_end->GetSubRatsnest() == 0 )
|
||||||
{
|
{
|
||||||
pad_end->SetSubRatsnest( pad_start->GetSubRatsnest() );
|
pad_end->SetSubRatsnest( pad_start->GetSubRatsnest() );
|
||||||
chevelu->m_Status |= CH_ACTIF;
|
item->m_Status |= CH_ACTIF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -680,14 +689,14 @@ void PCB_BASE_FRAME::Tst_Ratsnest( wxDC* DC, int ref_netcode )
|
||||||
|
|
||||||
if( m_Pcb->GetPadsCount() == 0 )
|
if( m_Pcb->GetPadsCount() == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( (m_Pcb->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK) == 0 )
|
if( (m_Pcb->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK) == 0 )
|
||||||
Build_Board_Ratsnest( DC );
|
Build_Board_Ratsnest( DC );
|
||||||
|
|
||||||
for( int net_code = 1;
|
for( int net_code = 1; net_code < (int) m_Pcb->m_NetInfo->GetCount(); net_code++ )
|
||||||
net_code < (int) m_Pcb->m_NetInfo->GetCount();
|
|
||||||
net_code++ )
|
|
||||||
{
|
{
|
||||||
net = m_Pcb->FindNet( net_code );
|
net = m_Pcb->FindNet( net_code );
|
||||||
|
|
||||||
if( net == NULL ) //Should not occur
|
if( net == NULL ) //Should not occur
|
||||||
{
|
{
|
||||||
DisplayError( this, wxT( "Tst_Ratsnest() error: net not found" ) );
|
DisplayError( this, wxT( "Tst_Ratsnest() error: net not found" ) );
|
||||||
|
@ -698,6 +707,7 @@ void PCB_BASE_FRAME::Tst_Ratsnest( wxDC* DC, int ref_netcode )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int num_block = 0;
|
int num_block = 0;
|
||||||
|
|
||||||
for( unsigned ip = 0; ip < net->m_ListPad.size(); ip++ )
|
for( unsigned ip = 0; ip < net->m_ListPad.size(); ip++ )
|
||||||
{
|
{
|
||||||
pad = net->m_ListPad[ip];
|
pad = net->m_ListPad[ip];
|
||||||
|
@ -706,9 +716,7 @@ void PCB_BASE_FRAME::Tst_Ratsnest( wxDC* DC, int ref_netcode )
|
||||||
num_block = MAX( num_block, subnet );
|
num_block = MAX( num_block, subnet );
|
||||||
}
|
}
|
||||||
|
|
||||||
for( unsigned ii = net->m_RatsnestStartIdx;
|
for( unsigned ii = net->m_RatsnestStartIdx; ii < net->m_RatsnestEndIdx; ii++ )
|
||||||
ii < net->m_RatsnestEndIdx;
|
|
||||||
ii++ )
|
|
||||||
{
|
{
|
||||||
m_Pcb->m_FullRatsnest[ii].m_Status &= ~CH_ACTIF;
|
m_Pcb->m_FullRatsnest[ii].m_Status &= ~CH_ACTIF;
|
||||||
}
|
}
|
||||||
|
@ -727,6 +735,7 @@ void PCB_BASE_FRAME::Tst_Ratsnest( wxDC* DC, int ref_netcode )
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Pcb->m_NbNoconnect = 0;
|
m_Pcb->m_NbNoconnect = 0;
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < m_Pcb->GetRatsnestsCount(); ii++ )
|
for( unsigned ii = 0; ii < m_Pcb->GetRatsnestsCount(); ii++ )
|
||||||
{
|
{
|
||||||
if( m_Pcb->m_FullRatsnest[ii].m_Status & CH_ACTIF )
|
if( m_Pcb->m_FullRatsnest[ii].m_Status & CH_ACTIF )
|
||||||
|
@ -743,7 +752,7 @@ void PCB_BASE_FRAME::Tst_Ratsnest( wxDC* DC, int ref_netcode )
|
||||||
*/
|
*/
|
||||||
int PCB_BASE_FRAME::Test_1_Net_Ratsnest( wxDC* aDC, int aNetcode )
|
int PCB_BASE_FRAME::Test_1_Net_Ratsnest( wxDC* aDC, int aNetcode )
|
||||||
{
|
{
|
||||||
DisplayRastnestInProgress = FALSE;
|
DisplayRastnestInProgress = false;
|
||||||
DrawGeneralRatsnest( aDC, aNetcode );
|
DrawGeneralRatsnest( aDC, aNetcode );
|
||||||
Tst_Ratsnest( aDC, aNetcode );
|
Tst_Ratsnest( aDC, aNetcode );
|
||||||
DrawGeneralRatsnest( aDC, aNetcode );
|
DrawGeneralRatsnest( aDC, aNetcode );
|
||||||
|
@ -811,27 +820,27 @@ void PCB_BASE_FRAME::build_ratsnest_module( MODULE* aModule )
|
||||||
}
|
}
|
||||||
|
|
||||||
pads_module_count = s_localPadBuffer.size();
|
pads_module_count = s_localPadBuffer.size();
|
||||||
|
|
||||||
if( pads_module_count == 0 )
|
if( pads_module_count == 0 )
|
||||||
return; /* no connection! */
|
return; /* no connection! */
|
||||||
|
|
||||||
qsort( &s_localPadBuffer[0],
|
qsort( &s_localPadBuffer[0], pads_module_count, sizeof( D_PAD* ), sortByNetcode );
|
||||||
pads_module_count,
|
|
||||||
sizeof(D_PAD*),
|
|
||||||
sortByNetcode );
|
|
||||||
|
|
||||||
/* Build the list of pads linked to the current footprint pads */
|
/* Build the list of pads linked to the current footprint pads */
|
||||||
DisplayRastnestInProgress = FALSE;
|
DisplayRastnestInProgress = false;
|
||||||
|
|
||||||
current_net_code = 0;
|
current_net_code = 0;
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < pads_module_count; ii++ )
|
for( unsigned ii = 0; ii < pads_module_count; ii++ )
|
||||||
{
|
{
|
||||||
pad_ref = s_localPadBuffer[ii];
|
pad_ref = s_localPadBuffer[ii];
|
||||||
|
|
||||||
if( pad_ref->GetNet() == current_net_code )
|
if( pad_ref->GetNet() == current_net_code )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// A new net was found, load all pads of others modules members of this
|
// A new net was found, load all pads of others modules members of this net:
|
||||||
// net:
|
|
||||||
NETINFO_ITEM* net = m_Pcb->FindNet( pad_ref->GetNet() );
|
NETINFO_ITEM* net = m_Pcb->FindNet( pad_ref->GetNet() );
|
||||||
|
|
||||||
if( net == NULL ) //Should not occur
|
if( net == NULL ) //Should not occur
|
||||||
{
|
{
|
||||||
DisplayError( this,
|
DisplayError( this,
|
||||||
|
@ -842,6 +851,7 @@ void PCB_BASE_FRAME::build_ratsnest_module( MODULE* aModule )
|
||||||
for( unsigned jj = 0; jj < net->m_ListPad.size(); jj++ )
|
for( unsigned jj = 0; jj < net->m_ListPad.size(); jj++ )
|
||||||
{
|
{
|
||||||
pad_externe = net->m_ListPad[jj];
|
pad_externe = net->m_ListPad[jj];
|
||||||
|
|
||||||
if( pad_externe->GetParent() == aModule )
|
if( pad_externe->GetParent() == aModule )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -854,8 +864,8 @@ void PCB_BASE_FRAME::build_ratsnest_module( MODULE* aModule )
|
||||||
|
|
||||||
/* Sort the pad list by net_code */
|
/* Sort the pad list by net_code */
|
||||||
baseListePad = &s_localPadBuffer[0];
|
baseListePad = &s_localPadBuffer[0];
|
||||||
qsort( baseListePad + pads_module_count,
|
|
||||||
s_localPadBuffer.size() - pads_module_count,
|
qsort( baseListePad + pads_module_count, s_localPadBuffer.size() - pads_module_count,
|
||||||
sizeof(D_PAD*), sortByNetcode );
|
sizeof(D_PAD*), sortByNetcode );
|
||||||
|
|
||||||
/* Compute the internal rats nest:
|
/* Compute the internal rats nest:
|
||||||
|
@ -869,6 +879,7 @@ void PCB_BASE_FRAME::build_ratsnest_module( MODULE* aModule )
|
||||||
{
|
{
|
||||||
/* Search the end of pad list relative to the current net */
|
/* Search the end of pad list relative to the current net */
|
||||||
unsigned jj = ii + 1;
|
unsigned jj = ii + 1;
|
||||||
|
|
||||||
for( ; jj <= pads_module_count; jj++ )
|
for( ; jj <= pads_module_count; jj++ )
|
||||||
{
|
{
|
||||||
if( jj >= pads_module_count )
|
if( jj >= pads_module_count )
|
||||||
|
@ -880,20 +891,17 @@ void PCB_BASE_FRAME::build_ratsnest_module( MODULE* aModule )
|
||||||
|
|
||||||
/* End of list found: */
|
/* End of list found: */
|
||||||
/* a - first step of lee algorithm : build the pad to pad link list */
|
/* a - first step of lee algorithm : build the pad to pad link list */
|
||||||
int icnt = gen_rats_pad_to_pad( m_Pcb->m_LocalRatsnest,
|
int icnt = gen_rats_pad_to_pad( m_Pcb->m_LocalRatsnest, s_localPadBuffer, ii, jj, 0 );
|
||||||
s_localPadBuffer,
|
|
||||||
ii, jj, 0 );
|
|
||||||
|
|
||||||
/* b - second step of lee algorithm : build the block to block link
|
/* b - second step of lee algorithm : build the block to block link
|
||||||
*list (Iteration) */
|
*list (Iteration) */
|
||||||
while( icnt > 1 )
|
while( icnt > 1 )
|
||||||
{
|
{
|
||||||
icnt = gen_rats_block_to_block( m_Pcb->m_LocalRatsnest,
|
icnt = gen_rats_block_to_block( m_Pcb->m_LocalRatsnest, s_localPadBuffer, ii, jj );
|
||||||
s_localPadBuffer,
|
|
||||||
ii, jj );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ii = jj;
|
ii = jj;
|
||||||
|
|
||||||
if( ii < s_localPadBuffer.size() )
|
if( ii < s_localPadBuffer.size() )
|
||||||
current_net_code = s_localPadBuffer[ii]->GetNet();
|
current_net_code = s_localPadBuffer[ii]->GetNet();
|
||||||
}
|
}
|
||||||
|
@ -926,14 +934,15 @@ CalculateExternalRatsnest:
|
||||||
local_rats.m_Status = 0;
|
local_rats.m_Status = 0;
|
||||||
bool addRats = false;
|
bool addRats = false;
|
||||||
if( internalRatsCount < m_Pcb->m_LocalRatsnest.size() )
|
if( internalRatsCount < m_Pcb->m_LocalRatsnest.size() )
|
||||||
m_Pcb->m_LocalRatsnest.erase(
|
m_Pcb->m_LocalRatsnest.erase( m_Pcb->m_LocalRatsnest.begin() + internalRatsCount,
|
||||||
m_Pcb->m_LocalRatsnest.begin() + internalRatsCount,
|
|
||||||
m_Pcb->m_LocalRatsnest.end() );
|
m_Pcb->m_LocalRatsnest.end() );
|
||||||
|
|
||||||
current_net_code = s_localPadBuffer[0]->GetNet();
|
current_net_code = s_localPadBuffer[0]->GetNet();
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < pads_module_count; ii++ )
|
for( unsigned ii = 0; ii < pads_module_count; ii++ )
|
||||||
{
|
{
|
||||||
pad_ref = s_localPadBuffer[ii];
|
pad_ref = s_localPadBuffer[ii];
|
||||||
|
|
||||||
if( pad_ref->GetNet() != current_net_code )
|
if( pad_ref->GetNet() != current_net_code )
|
||||||
{
|
{
|
||||||
/* if needed, creates a new ratsnest for the old net */
|
/* if needed, creates a new ratsnest for the old net */
|
||||||
|
@ -941,6 +950,7 @@ CalculateExternalRatsnest:
|
||||||
{
|
{
|
||||||
m_Pcb->m_LocalRatsnest.push_back( local_rats );
|
m_Pcb->m_LocalRatsnest.push_back( local_rats );
|
||||||
}
|
}
|
||||||
|
|
||||||
addRats = false;
|
addRats = false;
|
||||||
current_net_code = pad_ref->GetNet();
|
current_net_code = pad_ref->GetNet();
|
||||||
local_rats.m_Lenght = 0x7FFFFFFF;
|
local_rats.m_Lenght = 0x7FFFFFFF;
|
||||||
|
@ -949,9 +959,7 @@ CalculateExternalRatsnest:
|
||||||
pad_pos = pad_ref->m_Pos - g_Offset_Module;
|
pad_pos = pad_ref->m_Pos - g_Offset_Module;
|
||||||
|
|
||||||
// Search the nearest external pad of this current pad
|
// Search the nearest external pad of this current pad
|
||||||
for( unsigned jj = pads_module_count;
|
for( unsigned jj = pads_module_count; jj < s_localPadBuffer.size(); jj++ )
|
||||||
jj < s_localPadBuffer.size();
|
|
||||||
jj++ )
|
|
||||||
{
|
{
|
||||||
pad_externe = s_localPadBuffer[jj];
|
pad_externe = s_localPadBuffer[jj];
|
||||||
|
|
||||||
|
@ -959,9 +967,7 @@ CalculateExternalRatsnest:
|
||||||
if( pad_externe->GetNet() < pad_ref->GetNet() )
|
if( pad_externe->GetNet() < pad_ref->GetNet() )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( pad_externe->GetNet() > pad_ref->GetNet() ) // remember pads
|
if( pad_externe->GetNet() > pad_ref->GetNet() ) // pads are sorted by net code
|
||||||
// are sorted by
|
|
||||||
// net code
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
distance = abs( pad_externe->m_Pos.x - pad_pos.x ) +
|
distance = abs( pad_externe->m_Pos.x - pad_pos.x ) +
|
||||||
|
@ -993,13 +999,16 @@ void PCB_BASE_FRAME::trace_ratsnest_module( wxDC* DC )
|
||||||
{
|
{
|
||||||
if( DC == NULL )
|
if( DC == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( ( m_Pcb->m_Status_Pcb & RATSNEST_ITEM_LOCAL_OK ) == 0 )
|
if( ( m_Pcb->m_Status_Pcb & RATSNEST_ITEM_LOCAL_OK ) == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int tmpcolor = g_ColorsSettings.GetItemColor(RATSNEST_VISIBLE);
|
int tmpcolor = g_ColorsSettings.GetItemColor(RATSNEST_VISIBLE);
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < m_Pcb->m_LocalRatsnest.size(); ii++ )
|
for( unsigned ii = 0; ii < m_Pcb->m_LocalRatsnest.size(); ii++ )
|
||||||
{
|
{
|
||||||
RATSNEST_ITEM* rats = &m_Pcb->m_LocalRatsnest[ii];
|
RATSNEST_ITEM* rats = &m_Pcb->m_LocalRatsnest[ii];
|
||||||
|
|
||||||
if( rats->m_Status & LOCAL_RATSNEST_ITEM )
|
if( rats->m_Status & LOCAL_RATSNEST_ITEM )
|
||||||
{
|
{
|
||||||
g_ColorsSettings.SetItemColor(RATSNEST_VISIBLE, YELLOW);
|
g_ColorsSettings.SetItemColor(RATSNEST_VISIBLE, YELLOW);
|
||||||
|
@ -1073,9 +1082,11 @@ void PCB_BASE_FRAME::build_ratsnest_pad( BOARD_ITEM* ref, const wxPoint& refpos,
|
||||||
}
|
}
|
||||||
|
|
||||||
s_CursorPos = refpos;
|
s_CursorPos = refpos;
|
||||||
|
|
||||||
if( init )
|
if( init )
|
||||||
{
|
{
|
||||||
s_RatsnestMouseToPads.clear();
|
s_RatsnestMouseToPads.clear();
|
||||||
|
|
||||||
if( ref == NULL )
|
if( ref == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1107,8 +1118,7 @@ void PCB_BASE_FRAME::build_ratsnest_pad( BOARD_ITEM* ref, const wxPoint& refpos,
|
||||||
|
|
||||||
if( net == NULL ) // Should not occur
|
if( net == NULL ) // Should not occur
|
||||||
{
|
{
|
||||||
DisplayError( this,
|
DisplayError( this, wxT( "build_ratsnest_pad() error: net not found" ) );
|
||||||
wxT( "build_ratsnest_pad() error: net not found" ) );
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1117,6 +1127,7 @@ void PCB_BASE_FRAME::build_ratsnest_pad( BOARD_ITEM* ref, const wxPoint& refpos,
|
||||||
for( unsigned ii = 0; ii < net->m_ListPad.size(); ii++ )
|
for( unsigned ii = 0; ii < net->m_ListPad.size(); ii++ )
|
||||||
{
|
{
|
||||||
D_PAD* pad = net->m_ListPad[ii];
|
D_PAD* pad = net->m_ListPad[ii];
|
||||||
|
|
||||||
if( pad == pad_ref )
|
if( pad == pad_ref )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -1126,8 +1137,7 @@ void PCB_BASE_FRAME::build_ratsnest_pad( BOARD_ITEM* ref, const wxPoint& refpos,
|
||||||
} /* end if Init */
|
} /* end if Init */
|
||||||
|
|
||||||
if( s_RatsnestMouseToPads.size() > 1 )
|
if( s_RatsnestMouseToPads.size() > 1 )
|
||||||
sort( s_RatsnestMouseToPads.begin(),
|
sort( s_RatsnestMouseToPads.begin(), s_RatsnestMouseToPads.end(), sort_by_localnetlength );
|
||||||
s_RatsnestMouseToPads.end(), sort_by_localnetlength );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1144,12 +1154,12 @@ void PCB_BASE_FRAME::trace_ratsnest_pad( wxDC* DC )
|
||||||
|
|
||||||
|
|
||||||
GRSetDrawMode( DC, GR_XOR );
|
GRSetDrawMode( DC, GR_XOR );
|
||||||
|
|
||||||
for( int ii = 0; ii < (int) s_RatsnestMouseToPads.size(); ii++ )
|
for( int ii = 0; ii < (int) s_RatsnestMouseToPads.size(); ii++ )
|
||||||
{
|
{
|
||||||
if( ii >= g_MaxLinksShowed )
|
if( ii >= g_MaxLinksShowed )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
GRLine( &DrawPanel->m_ClipBox, DC, s_CursorPos,
|
GRLine( &DrawPanel->m_ClipBox, DC, s_CursorPos, s_RatsnestMouseToPads[ii], 0, YELLOW );
|
||||||
s_RatsnestMouseToPads[ii], 0, YELLOW );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
148
pcbnew/solve.cpp
148
pcbnew/solve.cpp
|
@ -23,6 +23,7 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
|
||||||
int row_target,
|
int row_target,
|
||||||
int col_target,
|
int col_target,
|
||||||
RATSNEST_ITEM* pt_chevelu );
|
RATSNEST_ITEM* pt_chevelu );
|
||||||
|
|
||||||
static int Retrace( PCB_EDIT_FRAME* pcbframe,
|
static int Retrace( PCB_EDIT_FRAME* pcbframe,
|
||||||
wxDC* DC,
|
wxDC* DC,
|
||||||
int,
|
int,
|
||||||
|
@ -31,13 +32,15 @@ static int Retrace( PCB_EDIT_FRAME* pcbframe,
|
||||||
int,
|
int,
|
||||||
int,
|
int,
|
||||||
int net_code );
|
int net_code );
|
||||||
|
|
||||||
static void OrCell_Trace( BOARD* pcb,
|
static void OrCell_Trace( BOARD* pcb,
|
||||||
int col,
|
int col,
|
||||||
int row,
|
int row,
|
||||||
int side,
|
int side,
|
||||||
int orient,
|
int orient,
|
||||||
int current_net_code );
|
int current_net_code );
|
||||||
static void Place_Piste_en_Buffer( PCB_EDIT_FRAME* pcbframe, wxDC* DC );
|
|
||||||
|
static void AddNewTrace( PCB_EDIT_FRAME* pcbframe, wxDC* DC );
|
||||||
|
|
||||||
|
|
||||||
static int segm_oX, segm_oY;
|
static int segm_oX, segm_oY;
|
||||||
|
@ -260,8 +263,10 @@ int PCB_EDIT_FRAME::Solve( wxDC* DC, int two_sides )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
DrawPanel->m_AbortRequest = 0;
|
DrawPanel->m_AbortRequest = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
EraseMsgBox();
|
EraseMsgBox();
|
||||||
|
|
||||||
|
@ -375,15 +380,12 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
|
||||||
int newdist, olddir, _self;
|
int newdist, olddir, _self;
|
||||||
int current_net_code;
|
int current_net_code;
|
||||||
int marge;
|
int marge;
|
||||||
int pad_masque_layer_s; /* Mask layers belonging to the
|
int padLayerMaskStart; /* Mask layers belonging to the starting pad. */
|
||||||
*starting pad. */
|
int padLayerMaskEnd; /* Mask layers belonging to the ending pad. */
|
||||||
int pad_masque_layer_e; /* Mask layers belonging to the ending
|
int topLayerMask = g_TabOneLayerMask[Route_Layer_TOP];
|
||||||
*pad. */
|
int bottomLayerMask = g_TabOneLayerMask[Route_Layer_BOTTOM];
|
||||||
int masque_layer_TOP = g_TabOneLayerMask[Route_Layer_TOP];
|
int routeLayerMask; /* Mask two layers for routing. */
|
||||||
int masque_layer_BOTTOM = g_TabOneLayerMask[Route_Layer_BOTTOM];
|
int tab_mask[2]; /* Enables the calculation of the mask layer being
|
||||||
int masque_layers; /* Mask two layers for routing. */
|
|
||||||
int tab_mask[2]; /* Enables the calculation of the mask
|
|
||||||
* layer being
|
|
||||||
* tested. (side = TOP or BOTTOM) */
|
* tested. (side = TOP or BOTTOM) */
|
||||||
int start_mask_layer = 0;
|
int start_mask_layer = 0;
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
@ -393,8 +395,7 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
|
||||||
|
|
||||||
result = NOSUCCESS;
|
result = NOSUCCESS;
|
||||||
|
|
||||||
marge = s_Clearance +
|
marge = s_Clearance + ( pcbframe->GetBoard()->GetCurrentTrackWidth() / 2 );
|
||||||
( pcbframe->GetBoard()->GetCurrentTrackWidth() / 2 );
|
|
||||||
|
|
||||||
/* clear direction flags */
|
/* clear direction flags */
|
||||||
i = Nrows * Ncols * sizeof(DIR_CELL);
|
i = Nrows * Ncols * sizeof(DIR_CELL);
|
||||||
|
@ -404,23 +405,24 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
|
||||||
lastopen = lastclos = lastmove = 0;
|
lastopen = lastclos = lastmove = 0;
|
||||||
|
|
||||||
/* Set tab_masque[side] for final test of routing. */
|
/* Set tab_masque[side] for final test of routing. */
|
||||||
tab_mask[TOP] = masque_layer_TOP;
|
tab_mask[TOP] = topLayerMask;
|
||||||
tab_mask[BOTTOM] = masque_layer_BOTTOM;
|
tab_mask[BOTTOM] = bottomLayerMask;
|
||||||
/* Set active layers mask. */
|
/* Set active layers mask. */
|
||||||
masque_layers = masque_layer_TOP | masque_layer_BOTTOM;
|
routeLayerMask = topLayerMask | bottomLayerMask;
|
||||||
|
|
||||||
pt_cur_ch = pt_chevelu;
|
pt_cur_ch = pt_chevelu;
|
||||||
current_net_code = pt_chevelu->GetNet();
|
current_net_code = pt_chevelu->GetNet();
|
||||||
pad_masque_layer_s = pt_cur_ch->m_PadStart->m_Masque_Layer;
|
padLayerMaskStart = pt_cur_ch->m_PadStart->m_layerMask;
|
||||||
pad_masque_layer_e = pt_cur_ch->m_PadEnd->m_Masque_Layer;
|
padLayerMaskEnd = pt_cur_ch->m_PadEnd->m_layerMask;
|
||||||
|
|
||||||
|
|
||||||
/* First Test if routing possible ie if the pads are accessible
|
/* First Test if routing possible ie if the pads are accessible
|
||||||
* on the routing layers.
|
* on the routing layers.
|
||||||
*/
|
*/
|
||||||
if( ( masque_layers & pad_masque_layer_s ) == 0 )
|
if( ( routeLayerMask & padLayerMaskStart ) == 0 )
|
||||||
goto end_of_route;
|
goto end_of_route;
|
||||||
if( ( masque_layers & pad_masque_layer_e ) == 0 )
|
|
||||||
|
if( ( routeLayerMask & padLayerMaskEnd ) == 0 )
|
||||||
goto end_of_route;
|
goto end_of_route;
|
||||||
|
|
||||||
/* Then test if routing possible ie if the pads are accessible
|
/* Then test if routing possible ie if the pads are accessible
|
||||||
|
@ -438,6 +440,7 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
|
||||||
|
|
||||||
if( ( ( pt_cur_ch->m_PadStart->m_Orient / 900 ) & 1 ) != 0 )
|
if( ( ( pt_cur_ch->m_PadStart->m_Orient / 900 ) & 1 ) != 0 )
|
||||||
EXCHG( dx, dy );
|
EXCHG( dx, dy );
|
||||||
|
|
||||||
if( ( abs( cX - px ) > dx ) || ( abs( cY - py ) > dy ) )
|
if( ( abs( cX - px ) > dx ) || ( abs( cY - py ) > dy ) )
|
||||||
goto end_of_route;
|
goto end_of_route;
|
||||||
|
|
||||||
|
@ -449,6 +452,7 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
|
||||||
dy = pt_cur_ch->m_PadEnd->m_Size.y / 2;
|
dy = pt_cur_ch->m_PadEnd->m_Size.y / 2;
|
||||||
px = pt_cur_ch->m_PadEnd->GetPosition().x;
|
px = pt_cur_ch->m_PadEnd->GetPosition().x;
|
||||||
py = pt_cur_ch->m_PadEnd->GetPosition().y;
|
py = pt_cur_ch->m_PadEnd->GetPosition().y;
|
||||||
|
|
||||||
if( ( (pt_cur_ch->m_PadEnd->m_Orient / 900) & 1 ) != 0 )
|
if( ( (pt_cur_ch->m_PadEnd->m_Orient / 900) & 1 ) != 0 )
|
||||||
EXCHG( dx, dy );
|
EXCHG( dx, dy );
|
||||||
|
|
||||||
|
@ -458,7 +462,7 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
|
||||||
|
|
||||||
/* Test the trivial case: direct connection overlay pads. */
|
/* Test the trivial case: direct connection overlay pads. */
|
||||||
if( ( row_source == row_target ) && ( col_source == col_target )
|
if( ( row_source == row_target ) && ( col_source == col_target )
|
||||||
&& ( pad_masque_layer_e & pad_masque_layer_s &
|
&& ( padLayerMaskEnd & padLayerMaskStart &
|
||||||
g_TabAllCopperLayerMask[pcbframe->GetBoard()->GetCopperLayerCount() - 1] ) )
|
g_TabAllCopperLayerMask[pcbframe->GetBoard()->GetCopperLayerCount() - 1] ) )
|
||||||
{
|
{
|
||||||
result = TRIVIAL_SUCCESS;
|
result = TRIVIAL_SUCCESS;
|
||||||
|
@ -477,13 +481,15 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
|
||||||
* bits precedent)
|
* bits precedent)
|
||||||
*/
|
*/
|
||||||
i = pcbframe->GetBoard()->GetPadsCount();
|
i = pcbframe->GetBoard()->GetPadsCount();
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < pcbframe->GetBoard()->GetPadsCount(); ii++ )
|
for( unsigned ii = 0; ii < pcbframe->GetBoard()->GetPadsCount(); ii++ )
|
||||||
{
|
{
|
||||||
|
|
||||||
D_PAD* ptr = pcbframe->GetBoard()->m_NetInfo->GetPad( ii );
|
D_PAD* ptr = pcbframe->GetBoard()->m_NetInfo->GetPad( ii );
|
||||||
|
|
||||||
if( ( pt_cur_ch->m_PadStart != ptr ) && ( pt_cur_ch->m_PadEnd != ptr ) )
|
if( ( pt_cur_ch->m_PadStart != ptr ) && ( pt_cur_ch->m_PadEnd != ptr ) )
|
||||||
{
|
{
|
||||||
Place_1_Pad_Board( pcbframe->GetBoard(), ptr, ~CURRENT_PAD,
|
Place_1_Pad_Board( pcbframe->GetBoard(), ptr, ~CURRENT_PAD, marge, WRITE_AND_CELL );
|
||||||
marge, WRITE_AND_CELL );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -495,16 +501,18 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
|
||||||
{
|
{
|
||||||
if( abs( row_target - row_source ) > abs( col_target - col_source ) )
|
if( abs( row_target - row_source ) > abs( col_target - col_source ) )
|
||||||
{
|
{
|
||||||
if( pad_masque_layer_s & masque_layer_TOP )
|
if( padLayerMaskStart & topLayerMask )
|
||||||
{
|
{
|
||||||
start_mask_layer = 2;
|
start_mask_layer = 2;
|
||||||
|
|
||||||
if( SetQueue( row_source, col_source, TOP, 0, apx_dist,
|
if( SetQueue( row_source, col_source, TOP, 0, apx_dist,
|
||||||
row_target, col_target ) == 0 )
|
row_target, col_target ) == 0 )
|
||||||
{
|
{
|
||||||
return ERR_MEMORY;
|
return ERR_MEMORY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( pad_masque_layer_s & masque_layer_BOTTOM )
|
|
||||||
|
if( padLayerMaskStart & bottomLayerMask )
|
||||||
{
|
{
|
||||||
start_mask_layer |= 1;
|
start_mask_layer |= 1;
|
||||||
|
|
||||||
|
@ -517,16 +525,18 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( pad_masque_layer_s & masque_layer_BOTTOM )
|
if( padLayerMaskStart & bottomLayerMask )
|
||||||
{
|
{
|
||||||
start_mask_layer = 1;
|
start_mask_layer = 1;
|
||||||
|
|
||||||
if( SetQueue( row_source, col_source, BOTTOM, 0, apx_dist,
|
if( SetQueue( row_source, col_source, BOTTOM, 0, apx_dist,
|
||||||
row_target, col_target ) == 0 )
|
row_target, col_target ) == 0 )
|
||||||
{
|
{
|
||||||
return ERR_MEMORY;
|
return ERR_MEMORY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( pad_masque_layer_s & masque_layer_TOP )
|
|
||||||
|
if( padLayerMaskStart & topLayerMask )
|
||||||
{
|
{
|
||||||
start_mask_layer |= 2;
|
start_mask_layer |= 2;
|
||||||
|
|
||||||
|
@ -538,12 +548,11 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( pad_masque_layer_s & masque_layer_BOTTOM )
|
else if( padLayerMaskStart & bottomLayerMask )
|
||||||
{
|
{
|
||||||
start_mask_layer = 1;
|
start_mask_layer = 1;
|
||||||
|
|
||||||
if( SetQueue( row_source, col_source, BOTTOM, 0, apx_dist,
|
if( SetQueue( row_source, col_source, BOTTOM, 0, apx_dist, row_target, col_target ) == 0 )
|
||||||
row_target, col_target ) == 0 )
|
|
||||||
{
|
{
|
||||||
return ERR_MEMORY;
|
return ERR_MEMORY;
|
||||||
}
|
}
|
||||||
|
@ -551,13 +560,16 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
|
||||||
|
|
||||||
/* search until success or we exhaust all possibilities */
|
/* search until success or we exhaust all possibilities */
|
||||||
GetQueue( &r, &c, &side, &d, &apx_dist );
|
GetQueue( &r, &c, &side, &d, &apx_dist );
|
||||||
|
|
||||||
for( ; r != ILLEGAL; GetQueue( &r, &c, &side, &d, &apx_dist ) )
|
for( ; r != ILLEGAL; GetQueue( &r, &c, &side, &d, &apx_dist ) )
|
||||||
{
|
{
|
||||||
curcell = GetCell( r, c, side );
|
curcell = GetCell( r, c, side );
|
||||||
|
|
||||||
if( curcell & CURRENT_PAD )
|
if( curcell & CURRENT_PAD )
|
||||||
curcell &= ~HOLE;
|
curcell &= ~HOLE;
|
||||||
|
|
||||||
if( (r == row_target) && (c == col_target) /* success if layer OK */
|
if( (r == row_target) && (c == col_target) /* success if layer OK */
|
||||||
&& ( tab_mask[side] & pad_masque_layer_e) )
|
&& ( tab_mask[side] & padLayerMaskEnd) )
|
||||||
{
|
{
|
||||||
/* Remove link. */
|
/* Remove link. */
|
||||||
GRSetDrawMode( DC, GR_XOR );
|
GRSetDrawMode( DC, GR_XOR );
|
||||||
|
@ -576,6 +588,7 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
|
||||||
{
|
{
|
||||||
result = SUCCESS; /* Success : Route OK */
|
result = SUCCESS; /* Success : Route OK */
|
||||||
}
|
}
|
||||||
|
|
||||||
break; /* Routing complete. */
|
break; /* Routing complete. */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -600,9 +613,11 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
|
||||||
}
|
}
|
||||||
|
|
||||||
_self = 0;
|
_self = 0;
|
||||||
|
|
||||||
if( curcell & HOLE )
|
if( curcell & HOLE )
|
||||||
{
|
{
|
||||||
_self = 5;
|
_self = 5;
|
||||||
|
|
||||||
/* set 'present' bits */
|
/* set 'present' bits */
|
||||||
for( i = 0; i < 8; i++ )
|
for( i = 0; i < 8; i++ )
|
||||||
{
|
{
|
||||||
|
@ -622,7 +637,9 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
|
||||||
|
|
||||||
if( _self == 5 && selfok2[i].present )
|
if( _self == 5 && selfok2[i].present )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
newcell = GetCell( nr, nc, side );
|
newcell = GetCell( nr, nc, side );
|
||||||
|
|
||||||
if( newcell & CURRENT_PAD )
|
if( newcell & CURRENT_PAD )
|
||||||
newcell &= ~HOLE;
|
newcell &= ~HOLE;
|
||||||
|
|
||||||
|
@ -634,23 +651,29 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
|
||||||
}
|
}
|
||||||
/* check for traces */
|
/* check for traces */
|
||||||
else if( newcell & HOLE & ~(newmask[i]) )
|
else if( newcell & HOLE & ~(newmask[i]) )
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
/* check blocking on corner neighbors */
|
/* check blocking on corner neighbors */
|
||||||
if( delta[i][0] && delta[i][1] )
|
if( delta[i][0] && delta[i][1] )
|
||||||
{
|
{
|
||||||
/* check first buddy */
|
/* check first buddy */
|
||||||
buddy = GetCell( r + blocking[i].r1, c + blocking[i].c1, side );
|
buddy = GetCell( r + blocking[i].r1, c + blocking[i].c1, side );
|
||||||
|
|
||||||
if( buddy & CURRENT_PAD )
|
if( buddy & CURRENT_PAD )
|
||||||
buddy &= ~HOLE;
|
buddy &= ~HOLE;
|
||||||
|
|
||||||
if( buddy & HOLE )
|
if( buddy & HOLE )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// if (buddy & (blocking[i].b1)) continue;
|
// if (buddy & (blocking[i].b1)) continue;
|
||||||
/* check second buddy */
|
/* check second buddy */
|
||||||
buddy = GetCell( r + blocking[i].r2, c + blocking[i].c2, side );
|
buddy = GetCell( r + blocking[i].r2, c + blocking[i].c2, side );
|
||||||
|
|
||||||
if( buddy & CURRENT_PAD )
|
if( buddy & CURRENT_PAD )
|
||||||
buddy &= ~HOLE;
|
buddy &= ~HOLE;
|
||||||
|
|
||||||
if( buddy & HOLE )
|
if( buddy & HOLE )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -668,6 +691,7 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
|
||||||
{
|
{
|
||||||
SetDir( nr, nc, side, ndir[i] );
|
SetDir( nr, nc, side, ndir[i] );
|
||||||
SetDist( nr, nc, side, newdist );
|
SetDist( nr, nc, side, newdist );
|
||||||
|
|
||||||
if( SetQueue( nr, nc, side, newdist,
|
if( SetQueue( nr, nc, side, newdist,
|
||||||
GetApxDist( nr, nc, row_target, col_target ),
|
GetApxDist( nr, nc, row_target, col_target ),
|
||||||
row_target, col_target ) == 0 )
|
row_target, col_target ) == 0 )
|
||||||
|
@ -689,13 +713,17 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
|
||||||
if( two_sides )
|
if( two_sides )
|
||||||
{
|
{
|
||||||
olddir = GetDir( r, c, side );
|
olddir = GetDir( r, c, side );
|
||||||
|
|
||||||
if( olddir == FROM_OTHERSIDE )
|
if( olddir == FROM_OTHERSIDE )
|
||||||
continue; /* useless move, so don't bother */
|
continue; /* useless move, so don't bother */
|
||||||
|
|
||||||
if( curcell ) /* can't drill via if anything here */
|
if( curcell ) /* can't drill via if anything here */
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* check for holes or traces on other side */
|
/* check for holes or traces on other side */
|
||||||
if( ( newcell = GetCell( r, c, 1 - side ) ) != 0 )
|
if( ( newcell = GetCell( r, c, 1 - side ) ) != 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* check for nearby holes or traces on both sides */
|
/* check for nearby holes or traces on both sides */
|
||||||
for( skip = 0, i = 0; i < 8; i++ )
|
for( skip = 0, i = 0; i < 8; i++ )
|
||||||
{
|
{
|
||||||
|
@ -729,8 +757,8 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
|
||||||
{
|
{
|
||||||
SetDir( r, c, 1 - side, FROM_OTHERSIDE );
|
SetDir( r, c, 1 - side, FROM_OTHERSIDE );
|
||||||
SetDist( r, c, 1 - side, newdist );
|
SetDist( r, c, 1 - side, newdist );
|
||||||
if( SetQueue( r, c, 1 - side, newdist, apx_dist, row_target,
|
|
||||||
col_target ) == 0 )
|
if( SetQueue( r, c, 1 - side, newdist, apx_dist, row_target, col_target ) == 0 )
|
||||||
{
|
{
|
||||||
return ERR_MEMORY;
|
return ERR_MEMORY;
|
||||||
}
|
}
|
||||||
|
@ -899,7 +927,8 @@ static int Retrace( PCB_EDIT_FRAME* pcbframe, wxDC* DC,
|
||||||
|
|
||||||
wxASSERT( g_CurrentTrackList.GetCount() == 0 );
|
wxASSERT( g_CurrentTrackList.GetCount() == 0 );
|
||||||
|
|
||||||
do {
|
do
|
||||||
|
{
|
||||||
/* find where we came from to get here */
|
/* find where we came from to get here */
|
||||||
r2 = r1; c2 = c1; s2 = s1;
|
r2 = r1; c2 = c1; s2 = s1;
|
||||||
x = GetDir( r1, c1, s1 );
|
x = GetDir( r1, c1, s1 );
|
||||||
|
@ -947,8 +976,7 @@ static int Retrace( PCB_EDIT_FRAME* pcbframe, wxDC* DC,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
DisplayError( pcbframe,
|
DisplayError( pcbframe, wxT( "Retrace: internal error: no way back" ) );
|
||||||
wxT( "Retrace: internal error: no way back" ) );
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1001,8 +1029,7 @@ static int Retrace( PCB_EDIT_FRAME* pcbframe, wxDC* DC,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
OrCell_Trace(
|
OrCell_Trace( pcbframe->GetBoard(), r1, c1, s1, p_dir, current_net_code );
|
||||||
pcbframe->GetBoard(), r1, c1, s1, p_dir, current_net_code );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1017,11 +1044,10 @@ static int Retrace( PCB_EDIT_FRAME* pcbframe, wxDC* DC,
|
||||||
|| x == FROM_OTHERSIDE )
|
|| x == FROM_OTHERSIDE )
|
||||||
&& ( ( b = bit[y - 1][x - 1] ) != 0 ) )
|
&& ( ( b = bit[y - 1][x - 1] ) != 0 ) )
|
||||||
{
|
{
|
||||||
OrCell_Trace( pcbframe->GetBoard(), r1, c1, s1, b,
|
OrCell_Trace( pcbframe->GetBoard(), r1, c1, s1, b, current_net_code );
|
||||||
current_net_code );
|
|
||||||
if( b & HOLE )
|
if( b & HOLE )
|
||||||
OrCell_Trace( pcbframe->GetBoard(), r2, c2, s2, HOLE,
|
OrCell_Trace( pcbframe->GetBoard(), r2, c2, s2, HOLE, current_net_code );
|
||||||
current_net_code );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1074,9 +1100,9 @@ static int Retrace( PCB_EDIT_FRAME* pcbframe, wxDC* DC,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
OrCell_Trace( pcbframe->GetBoard(), r2, c2, s2, p_dir,
|
OrCell_Trace( pcbframe->GetBoard(), r2, c2, s2, p_dir, current_net_code );
|
||||||
current_net_code );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* move to next cell */
|
/* move to next cell */
|
||||||
r0 = r1;
|
r0 = r1;
|
||||||
c0 = c1;
|
c0 = c1;
|
||||||
|
@ -1086,7 +1112,7 @@ static int Retrace( PCB_EDIT_FRAME* pcbframe, wxDC* DC,
|
||||||
s1 = s2;
|
s1 = s2;
|
||||||
} while( !( ( r2 == row_source ) && ( c2 == col_source ) ) );
|
} while( !( ( r2 == row_source ) && ( c2 == col_source ) ) );
|
||||||
|
|
||||||
Place_Piste_en_Buffer( pcbframe, DC );
|
AddNewTrace( pcbframe, DC );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1129,6 +1155,7 @@ static void OrCell_Trace( BOARD* pcb, int col, int row,
|
||||||
g_CurrentTrackList.PushBack( newTrack );
|
g_CurrentTrackList.PushBack( newTrack );
|
||||||
|
|
||||||
g_CurrentTrackSegment->SetLayer( Route_Layer_BOTTOM );
|
g_CurrentTrackSegment->SetLayer( Route_Layer_BOTTOM );
|
||||||
|
|
||||||
if( side == TOP )
|
if( side == TOP )
|
||||||
g_CurrentTrackSegment->SetLayer( Route_Layer_TOP );
|
g_CurrentTrackSegment->SetLayer( Route_Layer_TOP );
|
||||||
|
|
||||||
|
@ -1145,26 +1172,20 @@ static void OrCell_Trace( BOARD* pcb, int col, int row,
|
||||||
g_CurrentTrackSegment->m_Start.y = segm_fY;
|
g_CurrentTrackSegment->m_Start.y = segm_fY;
|
||||||
|
|
||||||
/* Placement on the center of the pad if outside grid. */
|
/* Placement on the center of the pad if outside grid. */
|
||||||
dx1 = g_CurrentTrackSegment->m_End.x -
|
dx1 = g_CurrentTrackSegment->m_End.x - g_CurrentTrackSegment->m_Start.x;
|
||||||
g_CurrentTrackSegment->m_Start.x;
|
dy1 = g_CurrentTrackSegment->m_End.y - g_CurrentTrackSegment->m_Start.y;
|
||||||
dy1 = g_CurrentTrackSegment->m_End.y -
|
|
||||||
g_CurrentTrackSegment->m_Start.y;
|
|
||||||
|
|
||||||
dx0 = pt_cur_ch->m_PadEnd->GetPosition().x -
|
dx0 = pt_cur_ch->m_PadEnd->GetPosition().x - g_CurrentTrackSegment->m_Start.x;
|
||||||
g_CurrentTrackSegment->m_Start.x;
|
dy0 = pt_cur_ch->m_PadEnd->GetPosition().y - g_CurrentTrackSegment->m_Start.y;
|
||||||
dy0 = pt_cur_ch->m_PadEnd->GetPosition().y -
|
|
||||||
g_CurrentTrackSegment->m_Start.y;
|
|
||||||
|
|
||||||
/* If aligned, change the origin point. */
|
/* If aligned, change the origin point. */
|
||||||
if( abs( dx0 * dy1 ) == abs( dx1 * dy0 ) )
|
if( abs( dx0 * dy1 ) == abs( dx1 * dy0 ) )
|
||||||
{
|
{
|
||||||
g_CurrentTrackSegment->m_Start =
|
g_CurrentTrackSegment->m_Start = pt_cur_ch->m_PadEnd->GetPosition();
|
||||||
pt_cur_ch->m_PadEnd->GetPosition();
|
|
||||||
}
|
}
|
||||||
else // Creation of a supplemental segment
|
else // Creation of a supplemental segment
|
||||||
{
|
{
|
||||||
g_CurrentTrackSegment->m_Start =
|
g_CurrentTrackSegment->m_Start = pt_cur_ch->m_PadEnd->GetPosition();
|
||||||
pt_cur_ch->m_PadEnd->GetPosition();
|
|
||||||
|
|
||||||
newTrack = g_CurrentTrackSegment->Copy();
|
newTrack = g_CurrentTrackSegment->Copy();
|
||||||
newTrack->m_Start = g_CurrentTrackSegment->m_End;
|
newTrack->m_Start = g_CurrentTrackSegment->m_End;
|
||||||
|
@ -1176,22 +1197,21 @@ static void OrCell_Trace( BOARD* pcb, int col, int row,
|
||||||
{
|
{
|
||||||
if( g_CurrentTrackSegment->Back() )
|
if( g_CurrentTrackSegment->Back() )
|
||||||
{
|
{
|
||||||
g_CurrentTrackSegment->m_Start =
|
g_CurrentTrackSegment->m_Start = g_CurrentTrackSegment->Back()->m_End;
|
||||||
g_CurrentTrackSegment->Back()->m_End;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_CurrentTrackSegment->m_Width = pcb->GetCurrentTrackWidth();
|
g_CurrentTrackSegment->m_Width = pcb->GetCurrentTrackWidth();
|
||||||
|
|
||||||
if( g_CurrentTrackSegment->m_Start != g_CurrentTrackSegment->m_End )
|
if( g_CurrentTrackSegment->m_Start != g_CurrentTrackSegment->m_End )
|
||||||
{
|
{
|
||||||
/* Reduce aligned segments by one. */
|
/* Reduce aligned segments by one. */
|
||||||
TRACK* oldTrack = g_CurrentTrackSegment->Back();
|
TRACK* oldTrack = g_CurrentTrackSegment->Back();
|
||||||
|
|
||||||
if( oldTrack && oldTrack->Type() != TYPE_VIA )
|
if( oldTrack && oldTrack->Type() != TYPE_VIA )
|
||||||
{
|
{
|
||||||
dx1 = g_CurrentTrackSegment->m_End.x -
|
dx1 = g_CurrentTrackSegment->m_End.x - g_CurrentTrackSegment->m_Start.x;
|
||||||
g_CurrentTrackSegment->m_Start.x;
|
dy1 = g_CurrentTrackSegment->m_End.y - g_CurrentTrackSegment->m_Start.y;
|
||||||
dy1 = g_CurrentTrackSegment->m_End.y -
|
|
||||||
g_CurrentTrackSegment->m_Start.y;
|
|
||||||
|
|
||||||
dx0 = oldTrack->m_End.x - oldTrack->m_Start.x;
|
dx0 = oldTrack->m_End.x - oldTrack->m_Start.x;
|
||||||
dy0 = oldTrack->m_End.y - oldTrack->m_Start.y;
|
dy0 = oldTrack->m_End.y - oldTrack->m_Start.y;
|
||||||
|
@ -1213,7 +1233,7 @@ static void OrCell_Trace( BOARD* pcb, int col, int row,
|
||||||
* connected
|
* connected
|
||||||
* Center on pads even if they are off grid.
|
* Center on pads even if they are off grid.
|
||||||
*/
|
*/
|
||||||
static void Place_Piste_en_Buffer( PCB_EDIT_FRAME* pcbframe, wxDC* DC )
|
static void AddNewTrace( PCB_EDIT_FRAME* pcbframe, wxDC* DC )
|
||||||
{
|
{
|
||||||
if( g_FirstTrackSegment == NULL )
|
if( g_FirstTrackSegment == NULL )
|
||||||
return;
|
return;
|
||||||
|
@ -1282,7 +1302,7 @@ static void Place_Piste_en_Buffer( PCB_EDIT_FRAME* pcbframe, wxDC* DC )
|
||||||
pcbframe->GetBoard()->m_Track.Insert( track, insertBeforeMe );
|
pcbframe->GetBoard()->m_Track.Insert( track, insertBeforeMe );
|
||||||
}
|
}
|
||||||
|
|
||||||
Trace_Une_Piste( panel, DC, firstTrack, newCount, GR_OR );
|
DrawTraces( panel, DC, firstTrack, newCount, GR_OR );
|
||||||
|
|
||||||
pcbframe->test_1_net_connexion( DC, netcode );
|
pcbframe->test_1_net_connexion( DC, netcode );
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,7 @@ void PCB_EDIT_FRAME::ExportToSpecctra( wxCommandEvent& event )
|
||||||
mask,
|
mask,
|
||||||
this,
|
this,
|
||||||
wxFD_SAVE,
|
wxFD_SAVE,
|
||||||
FALSE
|
false
|
||||||
);
|
);
|
||||||
if( fullFileName == wxEmptyString )
|
if( fullFileName == wxEmptyString )
|
||||||
return;
|
return;
|
||||||
|
@ -245,7 +245,7 @@ static bool isRoundKeepout( D_PAD* aPad )
|
||||||
if( aPad->m_Drill.x >= aPad->m_Size.x )
|
if( aPad->m_Drill.x >= aPad->m_Size.x )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if( (aPad->m_Masque_Layer & ALL_CU_LAYERS) == 0 )
|
if( (aPad->m_layerMask & ALL_CU_LAYERS) == 0 )
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -283,7 +283,7 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, D_PAD* aPad )
|
||||||
|
|
||||||
uniqifier = '[';
|
uniqifier = '[';
|
||||||
|
|
||||||
bool onAllCopperLayers = ( (aPad->m_Masque_Layer & ALL_CU_LAYERS) == ALL_CU_LAYERS );
|
bool onAllCopperLayers = ( (aPad->m_layerMask & ALL_CU_LAYERS) == ALL_CU_LAYERS );
|
||||||
|
|
||||||
if( onAllCopperLayers )
|
if( onAllCopperLayers )
|
||||||
uniqifier += 'A'; // A for all layers
|
uniqifier += 'A'; // A for all layers
|
||||||
|
|
|
@ -80,7 +80,7 @@ void PCB_EDIT_FRAME::ImportSpecctraSession( wxCommandEvent& event )
|
||||||
mask,
|
mask,
|
||||||
this,
|
this,
|
||||||
wxFD_OPEN,
|
wxFD_OPEN,
|
||||||
FALSE
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
if( fullFileName == wxEmptyString )
|
if( fullFileName == wxEmptyString )
|
||||||
|
|
|
@ -209,17 +209,21 @@ WinEDA_SwapLayerFrame::WinEDA_SwapLayerFrame( PCB_BASE_FRAME* parent ) :
|
||||||
for( int jj = 1; jj < NB_LAYERS; jj++ )
|
for( int jj = 1; jj < NB_LAYERS; jj++ )
|
||||||
{
|
{
|
||||||
text->SetLabel( board->GetLayerName( jj ) );
|
text->SetLabel( board->GetLayerName( jj ) );
|
||||||
|
|
||||||
if( goodSize.x < text->GetSize().x )
|
if( goodSize.x < text->GetSize().x )
|
||||||
goodSize.x = text->GetSize().x;
|
goodSize.x = text->GetSize().x;
|
||||||
}
|
}
|
||||||
|
|
||||||
text->SetLabel( _( "No Change" ) );
|
text->SetLabel( _( "No Change" ) );
|
||||||
|
|
||||||
if( goodSize.x < text->GetSize().x )
|
if( goodSize.x < text->GetSize().x )
|
||||||
goodSize.x = text->GetSize().x;
|
goodSize.x = text->GetSize().x;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
text = new wxStaticText( this, item_ID, _( "No Change" ),
|
text = new wxStaticText( this, item_ID, _( "No Change" ),
|
||||||
wxDefaultPosition, wxDefaultSize, 0 );
|
wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
}
|
||||||
|
|
||||||
text->SetMinSize( goodSize );
|
text->SetMinSize( goodSize );
|
||||||
FlexColumnBoxSizer->Add( text, 1,
|
FlexColumnBoxSizer->Add( text, 1,
|
||||||
|
@ -241,8 +245,7 @@ WinEDA_SwapLayerFrame::WinEDA_SwapLayerFrame( PCB_BASE_FRAME* parent ) :
|
||||||
|
|
||||||
// Provide a line to separate the controls which have been provided so far
|
// Provide a line to separate the controls which have been provided so far
|
||||||
// from the OK and Cancel buttons (which will be provided after this line)
|
// from the OK and Cancel buttons (which will be provided after this line)
|
||||||
Line = new wxStaticLine( this, -1, wxDefaultPosition, wxDefaultSize,
|
Line = new wxStaticLine( this, -1, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||||
wxLI_HORIZONTAL );
|
|
||||||
OuterBoxSizer->Add( Line, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
|
OuterBoxSizer->Add( Line, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
|
||||||
|
|
||||||
// Provide a StdDialogButtonSizer to accommodate the OK and Cancel buttons;
|
// Provide a StdDialogButtonSizer to accommodate the OK and Cancel buttons;
|
||||||
|
@ -251,8 +254,7 @@ WinEDA_SwapLayerFrame::WinEDA_SwapLayerFrame( PCB_BASE_FRAME* parent ) :
|
||||||
StdDialogButtonSizer = new wxStdDialogButtonSizer;
|
StdDialogButtonSizer = new wxStdDialogButtonSizer;
|
||||||
OuterBoxSizer->Add( StdDialogButtonSizer, 0, wxGROW | wxALL, 10 );
|
OuterBoxSizer->Add( StdDialogButtonSizer, 0, wxGROW | wxALL, 10 );
|
||||||
|
|
||||||
Button = new wxButton( this, wxID_OK, _( "&OK" ), wxDefaultPosition,
|
Button = new wxButton( this, wxID_OK, _( "&OK" ), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
wxDefaultSize, 0 );
|
|
||||||
Button->SetDefault();
|
Button->SetDefault();
|
||||||
StdDialogButtonSizer->AddButton( Button );
|
StdDialogButtonSizer->AddButton( Button );
|
||||||
|
|
||||||
|
@ -281,8 +283,10 @@ void WinEDA_SwapLayerFrame::Sel_Layer( wxCommandEvent& event )
|
||||||
ii = event.GetId() - ID_BUTTON_0;
|
ii = event.GetId() - ID_BUTTON_0;
|
||||||
|
|
||||||
jj = New_Layer[ii];
|
jj = New_Layer[ii];
|
||||||
|
|
||||||
if( (jj < 0) || (jj > NB_LAYERS) )
|
if( (jj < 0) || (jj > NB_LAYERS) )
|
||||||
jj = LAYER_NO_CHANGE; // (Defaults to "No Change".)
|
jj = LAYER_NO_CHANGE; // (Defaults to "No Change".)
|
||||||
|
|
||||||
jj = m_Parent->SelectLayer( jj, -1, -1, true );
|
jj = m_Parent->SelectLayer( jj, -1, -1, true );
|
||||||
|
|
||||||
if( (jj < 0) || (jj > NB_LAYERS) )
|
if( (jj < 0) || (jj > NB_LAYERS) )
|
||||||
|
@ -303,6 +307,7 @@ void WinEDA_SwapLayerFrame::Sel_Layer( wxCommandEvent& event )
|
||||||
if( jj != New_Layer[ii] )
|
if( jj != New_Layer[ii] )
|
||||||
{
|
{
|
||||||
New_Layer[ii] = jj;
|
New_Layer[ii] = jj;
|
||||||
|
|
||||||
if( jj >= LAYER_NO_CHANGE )
|
if( jj >= LAYER_NO_CHANGE )
|
||||||
{
|
{
|
||||||
layer_list[ii]->SetLabel( _( "No Change" ) );
|
layer_list[ii]->SetLabel( _( "No Change" ) );
|
||||||
|
@ -356,27 +361,34 @@ void PCB_EDIT_FRAME::Swap_Layers( wxCommandEvent& event )
|
||||||
|
|
||||||
/* Change traces. */
|
/* Change traces. */
|
||||||
pt_segm = GetBoard()->m_Track;
|
pt_segm = GetBoard()->m_Track;
|
||||||
|
|
||||||
for( ; pt_segm != NULL; pt_segm = pt_segm->Next() )
|
for( ; pt_segm != NULL; pt_segm = pt_segm->Next() )
|
||||||
{
|
{
|
||||||
OnModify();
|
OnModify();
|
||||||
|
|
||||||
if( pt_segm->Type() == TYPE_VIA )
|
if( pt_segm->Type() == TYPE_VIA )
|
||||||
{
|
{
|
||||||
SEGVIA* Via = (SEGVIA*) pt_segm;
|
SEGVIA* Via = (SEGVIA*) pt_segm;
|
||||||
|
|
||||||
if( Via->Shape() == VIA_THROUGH )
|
if( Via->Shape() == VIA_THROUGH )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int top_layer, bottom_layer;
|
int top_layer, bottom_layer;
|
||||||
|
|
||||||
Via->ReturnLayerPair( &top_layer, &bottom_layer );
|
Via->ReturnLayerPair( &top_layer, &bottom_layer );
|
||||||
if( New_Layer[bottom_layer] >= 0 && New_Layer[bottom_layer] <
|
|
||||||
LAYER_NO_CHANGE )
|
if( New_Layer[bottom_layer] >= 0 && New_Layer[bottom_layer] < LAYER_NO_CHANGE )
|
||||||
bottom_layer = New_Layer[bottom_layer];
|
bottom_layer = New_Layer[bottom_layer];
|
||||||
if( New_Layer[top_layer] >= 0
|
|
||||||
&& New_Layer[top_layer] < LAYER_NO_CHANGE )
|
if( New_Layer[top_layer] >= 0 && New_Layer[top_layer] < LAYER_NO_CHANGE )
|
||||||
top_layer = New_Layer[top_layer];
|
top_layer = New_Layer[top_layer];
|
||||||
|
|
||||||
Via->SetLayerPair( top_layer, bottom_layer );
|
Via->SetLayerPair( top_layer, bottom_layer );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
jj = pt_segm->GetLayer();
|
jj = pt_segm->GetLayer();
|
||||||
|
|
||||||
if( New_Layer[jj] >= 0 && New_Layer[jj] < LAYER_NO_CHANGE )
|
if( New_Layer[jj] >= 0 && New_Layer[jj] < LAYER_NO_CHANGE )
|
||||||
pt_segm->SetLayer( New_Layer[jj] );
|
pt_segm->SetLayer( New_Layer[jj] );
|
||||||
}
|
}
|
||||||
|
@ -387,12 +399,14 @@ void PCB_EDIT_FRAME::Swap_Layers( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
OnModify();
|
OnModify();
|
||||||
jj = pt_segm->GetLayer();
|
jj = pt_segm->GetLayer();
|
||||||
|
|
||||||
if( New_Layer[jj] >= 0 && New_Layer[jj] < LAYER_NO_CHANGE )
|
if( New_Layer[jj] >= 0 && New_Layer[jj] < LAYER_NO_CHANGE )
|
||||||
pt_segm->SetLayer( New_Layer[jj] );
|
pt_segm->SetLayer( New_Layer[jj] );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Change other segments. */
|
/* Change other segments. */
|
||||||
PtStruct = GetBoard()->m_Drawings;
|
PtStruct = GetBoard()->m_Drawings;
|
||||||
|
|
||||||
for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
|
for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
|
||||||
{
|
{
|
||||||
if( PtStruct->Type() == TYPE_DRAWSEGMENT )
|
if( PtStruct->Type() == TYPE_DRAWSEGMENT )
|
||||||
|
@ -400,10 +414,11 @@ void PCB_EDIT_FRAME::Swap_Layers( wxCommandEvent& event )
|
||||||
OnModify();
|
OnModify();
|
||||||
pt_drawsegm = (DRAWSEGMENT*) PtStruct;
|
pt_drawsegm = (DRAWSEGMENT*) PtStruct;
|
||||||
jj = pt_drawsegm->GetLayer();
|
jj = pt_drawsegm->GetLayer();
|
||||||
|
|
||||||
if( New_Layer[jj] >= 0 && New_Layer[jj] < LAYER_NO_CHANGE )
|
if( New_Layer[jj] >= 0 && New_Layer[jj] < LAYER_NO_CHANGE )
|
||||||
pt_drawsegm->SetLayer( New_Layer[jj] );
|
pt_drawsegm->SetLayer( New_Layer[jj] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawPanel->Refresh( TRUE );
|
DrawPanel->Refresh( true );
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,8 +54,7 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC,
|
||||||
if( aNewTrack->Type() == TYPE_VIA && ( aNewTrackSegmentsCount > 1 ) )
|
if( aNewTrack->Type() == TYPE_VIA && ( aNewTrackSegmentsCount > 1 ) )
|
||||||
aNewTrack = aNewTrack->Next();
|
aNewTrack = aNewTrack->Next();
|
||||||
|
|
||||||
aNewTrack = Marque_Une_Piste( GetBoard(), aNewTrack,
|
aNewTrack = MarkTrace( GetBoard(), aNewTrack, &aNewTrackSegmentsCount, NULL, NULL, true );
|
||||||
&aNewTrackSegmentsCount, NULL, NULL, true );
|
|
||||||
wxASSERT( aNewTrack );
|
wxASSERT( aNewTrack );
|
||||||
|
|
||||||
#if 0 && defined(DEBUG)
|
#if 0 && defined(DEBUG)
|
||||||
|
@ -63,11 +62,11 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC,
|
||||||
* the track */
|
* the track */
|
||||||
|
|
||||||
EndNewTrack = aNewTrack;
|
EndNewTrack = aNewTrack;
|
||||||
|
|
||||||
for( ii = 1; ii < aNewTrackSegmentsCount; ii++ )
|
for( ii = 1; ii < aNewTrackSegmentsCount; ii++ )
|
||||||
{
|
{
|
||||||
wxASSERT( EndNewTrack->GetState( -1 ) != 0 );
|
wxASSERT( EndNewTrack->GetState( -1 ) != 0 );
|
||||||
D( printf( "track %p is newly part of net %d\n", EndNewTrack,
|
D( printf( "track %p is newly part of net %d\n", EndNewTrack, netcode ); )
|
||||||
netcode ); )
|
|
||||||
EndNewTrack = EndNewTrack->Next();
|
EndNewTrack = EndNewTrack->Next();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,12 +87,12 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC,
|
||||||
//D( printf( "track %p turning off BUSY | IN_EDIT | IS_LINKED\n", pt_del ); )
|
//D( printf( "track %p turning off BUSY | IN_EDIT | IS_LINKED\n", pt_del ); )
|
||||||
D( std::cout<<"track "<<pt_del<<" turning off BUSY | IN_EDIT | IS_LINKED"<<std::endl; )
|
D( std::cout<<"track "<<pt_del<<" turning off BUSY | IN_EDIT | IS_LINKED"<<std::endl; )
|
||||||
pt_del->SetState( BUSY | IN_EDIT | IS_LINKED, OFF );
|
pt_del->SetState( BUSY | IN_EDIT | IS_LINKED, OFF );
|
||||||
|
|
||||||
if( pt_del == bufEnd ) // Last segment reached
|
if( pt_del == bufEnd ) // Last segment reached
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ReturnEndsTrack( aNewTrack, aNewTrackSegmentsCount,
|
if( ReturnEndsTrack( aNewTrack, aNewTrackSegmentsCount, &StartTrack, &EndTrack ) == 0 )
|
||||||
&StartTrack, &EndTrack ) == 0 )
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if( ( StartTrack == NULL ) || ( EndTrack == NULL ) )
|
if( ( StartTrack == NULL ) || ( EndTrack == NULL ) )
|
||||||
|
@ -112,6 +111,7 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC,
|
||||||
|
|
||||||
/* There may be a via or a pad on the end points. */
|
/* There may be a via or a pad on the end points. */
|
||||||
pt_segm = Fast_Locate_Via( m_Pcb->m_Track, NULL, start, startmasklayer );
|
pt_segm = Fast_Locate_Via( m_Pcb->m_Track, NULL, start, startmasklayer );
|
||||||
|
|
||||||
if( pt_segm )
|
if( pt_segm )
|
||||||
startmasklayer |= pt_segm->ReturnMaskLayer();
|
startmasklayer |= pt_segm->ReturnMaskLayer();
|
||||||
|
|
||||||
|
@ -119,17 +119,18 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC,
|
||||||
{
|
{
|
||||||
/* Start on pad. */
|
/* Start on pad. */
|
||||||
D_PAD* pt_pad = (D_PAD*)(StartTrack->start);
|
D_PAD* pt_pad = (D_PAD*)(StartTrack->start);
|
||||||
startmasklayer |= pt_pad->m_Masque_Layer;
|
startmasklayer |= pt_pad->m_layerMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
pt_segm = Fast_Locate_Via( m_Pcb->m_Track, NULL, end, endmasklayer );
|
pt_segm = Fast_Locate_Via( m_Pcb->m_Track, NULL, end, endmasklayer );
|
||||||
|
|
||||||
if( pt_segm )
|
if( pt_segm )
|
||||||
endmasklayer |= pt_segm->ReturnMaskLayer();
|
endmasklayer |= pt_segm->ReturnMaskLayer();
|
||||||
|
|
||||||
if( EndTrack->end && ( EndTrack->end->Type() == TYPE_PAD ) )
|
if( EndTrack->end && ( EndTrack->end->Type() == TYPE_PAD ) )
|
||||||
{
|
{
|
||||||
D_PAD* pt_pad = (D_PAD*)(EndTrack->end);
|
D_PAD* pt_pad = (D_PAD*)(EndTrack->end);
|
||||||
endmasklayer |= pt_pad->m_Masque_Layer;
|
endmasklayer |= pt_pad->m_layerMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Mark as deleted a new track (which is not involved in the search for
|
/* Mark as deleted a new track (which is not involved in the search for
|
||||||
|
@ -140,7 +141,7 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC,
|
||||||
/* A segment must be connected to the starting point, otherwise
|
/* A segment must be connected to the starting point, otherwise
|
||||||
* it is unnecessary to analyze the other point
|
* it is unnecessary to analyze the other point
|
||||||
*/
|
*/
|
||||||
pt_segm = Fast_Locate_Piste( bufStart, bufEnd, start, startmasklayer );
|
pt_segm = GetTrace( bufStart, bufEnd, start, startmasklayer );
|
||||||
|
|
||||||
if( pt_segm == NULL ) /* Not connected to the track starting point. */
|
if( pt_segm == NULL ) /* Not connected to the track starting point. */
|
||||||
{
|
{
|
||||||
|
@ -155,7 +156,8 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC,
|
||||||
*/
|
*/
|
||||||
for( pt_del = bufStart, nbconnect = 0; ; )
|
for( pt_del = bufStart, nbconnect = 0; ; )
|
||||||
{
|
{
|
||||||
pt_segm = Fast_Locate_Piste( pt_del, bufEnd, end, endmasklayer );
|
pt_segm = GetTrace( pt_del, bufEnd, end, endmasklayer );
|
||||||
|
|
||||||
if( pt_segm == NULL )
|
if( pt_segm == NULL )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -167,6 +169,7 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC,
|
||||||
nbconnect++;
|
nbconnect++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pt_del == bufEnd )
|
if( pt_del == bufEnd )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -179,6 +182,7 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC,
|
||||||
for( pt_del = bufStart; pt_del; pt_del = pt_del->Next() )
|
for( pt_del = bufStart; pt_del; pt_del = pt_del->Next() )
|
||||||
{
|
{
|
||||||
pt_del->SetState( BUSY | IS_DELETED | IN_EDIT | IS_LINKED, OFF );
|
pt_del->SetState( BUSY | IS_DELETED | IN_EDIT | IS_LINKED, OFF );
|
||||||
|
|
||||||
if( pt_del == bufEnd ) // Last segment reached
|
if( pt_del == bufEnd ) // Last segment reached
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -199,6 +203,7 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC,
|
||||||
{
|
{
|
||||||
if( pt_del->GetState( IS_LINKED ) )
|
if( pt_del->GetState( IS_LINKED ) )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if( pt_del == bufEnd ) // Last segment reached
|
if( pt_del == bufEnd ) // Last segment reached
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -206,13 +211,14 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC,
|
||||||
nbconnect--;
|
nbconnect--;
|
||||||
pt_del->SetState( IS_LINKED, OFF );
|
pt_del->SetState( IS_LINKED, OFF );
|
||||||
|
|
||||||
pt_del = Marque_Une_Piste( GetBoard(), pt_del, &nb_segm, NULL, NULL, true );
|
pt_del = MarkTrace( GetBoard(), pt_del, &nb_segm, NULL, NULL, true );
|
||||||
|
|
||||||
/* Test if the marked track is redundant, i.e. if one of marked segments
|
/* Test if the marked track is redundant, i.e. if one of marked segments
|
||||||
* is connected to the starting point of the new track.
|
* is connected to the starting point of the new track.
|
||||||
*/
|
*/
|
||||||
ii = 0;
|
ii = 0;
|
||||||
pt_segm = pt_del;
|
pt_segm = pt_del;
|
||||||
|
|
||||||
for( ; pt_segm && (ii < nb_segm); pt_segm = pt_segm->Next(), ii++ )
|
for( ; pt_segm && (ii < nb_segm); pt_segm = pt_segm->Next(), ii++ )
|
||||||
{
|
{
|
||||||
if( pt_segm->GetState( BUSY ) == 0 )
|
if( pt_segm->GetState( BUSY ) == 0 )
|
||||||
|
@ -222,12 +228,13 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC,
|
||||||
{
|
{
|
||||||
/* Marked track can be erased. */
|
/* Marked track can be erased. */
|
||||||
TRACK* NextS;
|
TRACK* NextS;
|
||||||
Trace_Une_Piste( DrawPanel, aDC, pt_del, nb_segm,
|
|
||||||
GR_XOR | GR_SURBRILL );
|
DrawTraces( DrawPanel, aDC, pt_del, nb_segm, GR_XOR | GR_SURBRILL );
|
||||||
|
|
||||||
for( jj = 0; jj < nb_segm; jj++, pt_del = NextS )
|
for( jj = 0; jj < nb_segm; jj++, pt_del = NextS )
|
||||||
{
|
{
|
||||||
NextS = pt_del->Next();
|
NextS = pt_del->Next();
|
||||||
|
|
||||||
if( aItemsListPicker )
|
if( aItemsListPicker )
|
||||||
{
|
{
|
||||||
pt_del->UnLink();
|
pt_del->UnLink();
|
||||||
|
@ -237,19 +244,22 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC,
|
||||||
aItemsListPicker->PushItem( picker );
|
aItemsListPicker->PushItem( picker );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
pt_del->DeleteStructure();
|
pt_del->DeleteStructure();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Clean up flags. */
|
/* Clean up flags. */
|
||||||
for( pt_del = m_Pcb->m_Track; pt_del != NULL;
|
for( pt_del = m_Pcb->m_Track; pt_del != NULL; pt_del = pt_del->Next() )
|
||||||
pt_del = pt_del->Next() )
|
|
||||||
{
|
{
|
||||||
if( pt_del->GetState( IN_EDIT ) )
|
if( pt_del->GetState( IN_EDIT ) )
|
||||||
{
|
{
|
||||||
pt_del->SetState( IN_EDIT, OFF );
|
pt_del->SetState( IN_EDIT, OFF );
|
||||||
|
|
||||||
if( aDC )
|
if( aDC )
|
||||||
pt_del->Draw( DrawPanel, aDC, GR_OR );
|
pt_del->Draw( DrawPanel, aDC, GR_OR );
|
||||||
}
|
}
|
||||||
|
|
||||||
pt_del->SetState( IN_EDIT | IS_LINKED, OFF );
|
pt_del->SetState( IN_EDIT | IS_LINKED, OFF );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -266,6 +276,7 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC,
|
||||||
for( pt_del = m_Pcb->m_Track; pt_del; pt_del = pt_del->Next() )
|
for( pt_del = m_Pcb->m_Track; pt_del; pt_del = pt_del->Next() )
|
||||||
{
|
{
|
||||||
pt_del->SetState( BUSY | IS_DELETED | IN_EDIT | IS_LINKED, OFF );
|
pt_del->SetState( BUSY | IS_DELETED | IN_EDIT | IS_LINKED, OFF );
|
||||||
|
|
||||||
if( pt_del == bufEnd ) // Last segment reached
|
if( pt_del == bufEnd ) // Last segment reached
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,10 +26,10 @@ extern int g_DrawDefaultLineThickness; // Default line thickness, used to draw F
|
||||||
/* Trace the pads of a module in sketch mode.
|
/* Trace the pads of a module in sketch mode.
|
||||||
* Used to display pads when when the module visibility is set to not visible
|
* Used to display pads when when the module visibility is set to not visible
|
||||||
* and we want to see pad through.
|
* and we want to see pad through.
|
||||||
* The pads must appear on the layers selected in MasqueLayer
|
* The pads must appear on the layers selected in LayerMask
|
||||||
*/
|
*/
|
||||||
static void Trace_Pads_Only( EDA_DRAW_PANEL* panel, wxDC* DC, MODULE* Module,
|
static void Trace_Pads_Only( EDA_DRAW_PANEL* panel, wxDC* DC, MODULE* Module,
|
||||||
int ox, int oy, int MasqueLayer, int draw_mode );
|
int ox, int oy, int LayerMask, int draw_mode );
|
||||||
|
|
||||||
|
|
||||||
void FOOTPRINT_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
void FOOTPRINT_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
||||||
|
@ -141,7 +141,7 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* DC, int aDrawMode, const wxPoint
|
||||||
{
|
{
|
||||||
case TYPE_DIMENSION:
|
case TYPE_DIMENSION:
|
||||||
case TYPE_TEXTE:
|
case TYPE_TEXTE:
|
||||||
case TYPE_MIRE:
|
case PCB_TARGET_T:
|
||||||
case TYPE_DRAWSEGMENT:
|
case TYPE_DRAWSEGMENT:
|
||||||
item->Draw( aPanel, DC, aDrawMode );
|
item->Draw( aPanel, DC, aDrawMode );
|
||||||
break;
|
break;
|
||||||
|
@ -177,6 +177,7 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* DC, int aDrawMode, const wxPoint
|
||||||
{
|
{
|
||||||
if( module->GetLayer() == LAYER_N_FRONT )
|
if( module->GetLayer() == LAYER_N_FRONT )
|
||||||
display = false;
|
display = false;
|
||||||
|
|
||||||
layerMask &= ~LAYER_FRONT;
|
layerMask &= ~LAYER_FRONT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,10 +251,10 @@ void BOARD::DrawHighLight( EDA_DRAW_PANEL* aDrawPanel, wxDC* DC, int aNetCode )
|
||||||
/* Trace the pads of a module in sketch mode.
|
/* Trace the pads of a module in sketch mode.
|
||||||
* Used to display pads when when the module visibility is set to not visible
|
* Used to display pads when when the module visibility is set to not visible
|
||||||
* and we want to see pad through.
|
* and we want to see pad through.
|
||||||
* The pads must appear on the layers selected in MasqueLayer
|
* The pads must appear on the layers selected in LayerMask
|
||||||
*/
|
*/
|
||||||
void Trace_Pads_Only( EDA_DRAW_PANEL* panel, wxDC* DC, MODULE* Module,
|
void Trace_Pads_Only( EDA_DRAW_PANEL* panel, wxDC* DC, MODULE* Module,
|
||||||
int ox, int oy, int MasqueLayer, int draw_mode )
|
int ox, int oy, int LayerMask, int draw_mode )
|
||||||
{
|
{
|
||||||
int tmp;
|
int tmp;
|
||||||
PCB_BASE_FRAME* frame;
|
PCB_BASE_FRAME* frame;
|
||||||
|
@ -266,7 +267,7 @@ void Trace_Pads_Only( EDA_DRAW_PANEL* panel, wxDC* DC, MODULE* Module,
|
||||||
/* Draw pads. */
|
/* Draw pads. */
|
||||||
for( D_PAD* pad = Module->m_Pads; pad; pad = pad->Next() )
|
for( D_PAD* pad = Module->m_Pads; pad; pad = pad->Next() )
|
||||||
{
|
{
|
||||||
if( (pad->m_Masque_Layer & MasqueLayer) == 0 )
|
if( (pad->m_layerMask & LayerMask) == 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
pad->Draw( panel, DC, draw_mode, wxPoint( ox, oy ) );
|
pad->Draw( panel, DC, draw_mode, wxPoint( ox, oy ) );
|
||||||
|
|
141
pcbnew/track.cpp
141
pcbnew/track.cpp
|
@ -22,13 +22,13 @@ typedef std::vector<TRACK*> TRACK_PTRS; // buffer of item candidates when
|
||||||
|
|
||||||
|
|
||||||
/* Local functions */
|
/* Local functions */
|
||||||
static void Marque_Chaine_segments( BOARD* Pcb,
|
static void ChainMarkedSegments( BOARD* Pcb,
|
||||||
wxPoint ref_pos,
|
wxPoint ref_pos,
|
||||||
int masklayer,
|
int masklayer,
|
||||||
TRACK_PTRS* aList );
|
TRACK_PTRS* aList );
|
||||||
|
|
||||||
|
|
||||||
TRACK* Marque_Une_Piste( BOARD* aPcb,
|
TRACK* MarkTrace( BOARD* aPcb,
|
||||||
TRACK* aStartSegm,
|
TRACK* aStartSegm,
|
||||||
int* aSegmCount,
|
int* aSegmCount,
|
||||||
int* aTrackLen,
|
int* aTrackLen,
|
||||||
|
@ -55,7 +55,7 @@ TRACK* Marque_Une_Piste( BOARD* aPcb,
|
||||||
|
|
||||||
/* Set flags of the initial track segment */
|
/* Set flags of the initial track segment */
|
||||||
aStartSegm->SetState( BUSY, ON );
|
aStartSegm->SetState( BUSY, ON );
|
||||||
int masque_layer = aStartSegm->ReturnMaskLayer();
|
int layerMask = aStartSegm->ReturnMaskLayer();
|
||||||
|
|
||||||
trackList.push_back( aStartSegm );
|
trackList.push_back( aStartSegm );
|
||||||
|
|
||||||
|
@ -69,50 +69,42 @@ TRACK* Marque_Une_Piste( BOARD* aPcb,
|
||||||
if( aStartSegm->Type() == TYPE_VIA )
|
if( aStartSegm->Type() == TYPE_VIA )
|
||||||
{
|
{
|
||||||
TRACK* Segm1, * Segm2 = NULL, * Segm3 = NULL;
|
TRACK* Segm1, * Segm2 = NULL, * Segm3 = NULL;
|
||||||
Segm1 = Fast_Locate_Piste( aPcb->m_Track, NULL,
|
Segm1 = GetTrace( aPcb->m_Track, NULL, aStartSegm->m_Start, layerMask );
|
||||||
aStartSegm->m_Start, masque_layer );
|
|
||||||
if( Segm1 )
|
if( Segm1 )
|
||||||
{
|
{
|
||||||
Segm2 = Fast_Locate_Piste( Segm1->Next(), NULL,
|
Segm2 = GetTrace( Segm1->Next(), NULL, aStartSegm->m_Start, layerMask );
|
||||||
aStartSegm->m_Start, masque_layer );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( Segm2 )
|
if( Segm2 )
|
||||||
{
|
{
|
||||||
Segm3 = Fast_Locate_Piste( Segm2->Next(), NULL,
|
Segm3 = GetTrace( Segm2->Next(), NULL, aStartSegm->m_Start, layerMask );
|
||||||
aStartSegm->m_Start, masque_layer );
|
|
||||||
}
|
}
|
||||||
if( Segm3 ) // More than 2 segments are connected to this via. the
|
|
||||||
// "track" is only this via
|
if( Segm3 ) // More than 2 segments are connected to this via. the track" is only this via
|
||||||
{
|
{
|
||||||
if( aSegmCount )
|
if( aSegmCount )
|
||||||
*aSegmCount = 1;
|
*aSegmCount = 1;
|
||||||
|
|
||||||
return aStartSegm;
|
return aStartSegm;
|
||||||
}
|
}
|
||||||
if( Segm1 ) // search for others segments connected to the initial
|
|
||||||
// segment start point
|
if( Segm1 ) // search for others segments connected to the initial segment start point
|
||||||
{
|
{
|
||||||
masque_layer = Segm1->ReturnMaskLayer();
|
layerMask = Segm1->ReturnMaskLayer();
|
||||||
Marque_Chaine_segments( aPcb, aStartSegm->m_Start, masque_layer,
|
ChainMarkedSegments( aPcb, aStartSegm->m_Start, layerMask, &trackList );
|
||||||
&trackList );
|
|
||||||
}
|
}
|
||||||
if( Segm2 ) // search for others segments connected to the initial
|
|
||||||
// segment end point
|
if( Segm2 ) // search for others segments connected to the initial segment end point
|
||||||
{
|
{
|
||||||
masque_layer = Segm2->ReturnMaskLayer();
|
layerMask = Segm2->ReturnMaskLayer();
|
||||||
Marque_Chaine_segments( aPcb, aStartSegm->m_Start, masque_layer,
|
ChainMarkedSegments( aPcb, aStartSegm->m_Start, layerMask, &trackList );
|
||||||
&trackList );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // mark the chain using both ends of the initial segment
|
else // mark the chain using both ends of the initial segment
|
||||||
{
|
{
|
||||||
Marque_Chaine_segments( aPcb,
|
ChainMarkedSegments( aPcb, aStartSegm->m_Start, layerMask, &trackList );
|
||||||
aStartSegm->m_Start,
|
ChainMarkedSegments( aPcb, aStartSegm->m_End, layerMask, &trackList );
|
||||||
masque_layer,
|
|
||||||
&trackList );
|
|
||||||
Marque_Chaine_segments( aPcb,
|
|
||||||
aStartSegm->m_End,
|
|
||||||
masque_layer,
|
|
||||||
&trackList );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now examine selected vias and flag them if they are on the track
|
// Now examine selected vias and flag them if they are on the track
|
||||||
|
@ -131,17 +123,13 @@ TRACK* Marque_Une_Piste( BOARD* aPcb,
|
||||||
if( via == aStartSegm )
|
if( via == aStartSegm )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
via->SetState( BUSY, ON ); // Try to flag it. the flag will be cleared
|
via->SetState( BUSY, ON ); // Try to flag it. the flag will be cleared later if needed
|
||||||
// later if needed
|
|
||||||
|
|
||||||
masque_layer = via->ReturnMaskLayer();
|
layerMask = via->ReturnMaskLayer();
|
||||||
|
|
||||||
TRACK* track = Fast_Locate_Piste( aPcb->m_Track,
|
TRACK* track = GetTrace( aPcb->m_Track, NULL, via->m_Start, layerMask );
|
||||||
NULL,
|
|
||||||
via->m_Start,
|
|
||||||
masque_layer );
|
|
||||||
|
|
||||||
// Fast_Locate_Piste does not consider tracks flagged BUSY.
|
// GetTrace does not consider tracks flagged BUSY.
|
||||||
// So if no connected track found, this via is on the current track
|
// So if no connected track found, this via is on the current track
|
||||||
// only: keep it
|
// only: keep it
|
||||||
if( track == NULL )
|
if( track == NULL )
|
||||||
|
@ -161,9 +149,7 @@ TRACK* Marque_Une_Piste( BOARD* aPcb,
|
||||||
*/
|
*/
|
||||||
int layer = track->GetLayer();
|
int layer = track->GetLayer();
|
||||||
|
|
||||||
while( ( track = Fast_Locate_Piste( track->Next(), NULL,
|
while( ( track = GetTrace( track->Next(), NULL, via->m_Start, layerMask ) ) != NULL )
|
||||||
via->m_Start,
|
|
||||||
masque_layer ) ) != NULL )
|
|
||||||
{
|
{
|
||||||
if( layer != track->GetLayer() )
|
if( layer != track->GetLayer() )
|
||||||
{
|
{
|
||||||
|
@ -183,9 +169,8 @@ TRACK* Marque_Une_Piste( BOARD* aPcb,
|
||||||
*/
|
*/
|
||||||
NbSegmBusy = 0;
|
NbSegmBusy = 0;
|
||||||
TRACK* firstTrack;
|
TRACK* firstTrack;
|
||||||
for( firstTrack = aPcb->m_Track;
|
|
||||||
firstTrack;
|
for( firstTrack = aPcb->m_Track; firstTrack; firstTrack = firstTrack->Next() )
|
||||||
firstTrack = firstTrack->Next() )
|
|
||||||
{
|
{
|
||||||
// Search for the first flagged BUSY segments
|
// Search for the first flagged BUSY segments
|
||||||
if( firstTrack->GetState( BUSY ) )
|
if( firstTrack->GetState( BUSY ) )
|
||||||
|
@ -200,6 +185,7 @@ TRACK* Marque_Une_Piste( BOARD* aPcb,
|
||||||
|
|
||||||
double full_len = 0;
|
double full_len = 0;
|
||||||
double lenDie = 0;
|
double lenDie = 0;
|
||||||
|
|
||||||
if( aReorder )
|
if( aReorder )
|
||||||
{
|
{
|
||||||
DLIST<TRACK>* list = (DLIST<TRACK>*)firstTrack->GetList();
|
DLIST<TRACK>* list = (DLIST<TRACK>*)firstTrack->GetList();
|
||||||
|
@ -210,16 +196,20 @@ TRACK* Marque_Une_Piste( BOARD* aPcb,
|
||||||
* of the flagged list
|
* of the flagged list
|
||||||
*/
|
*/
|
||||||
TRACK* next;
|
TRACK* next;
|
||||||
|
|
||||||
for( TRACK* track = firstTrack->Next(); track; track = next )
|
for( TRACK* track = firstTrack->Next(); track; track = next )
|
||||||
{
|
{
|
||||||
next = track->Next();
|
next = track->Next();
|
||||||
|
|
||||||
if( track->GetState( BUSY ) ) // move it!
|
if( track->GetState( BUSY ) ) // move it!
|
||||||
{
|
{
|
||||||
NbSegmBusy++;
|
NbSegmBusy++;
|
||||||
track->UnLink();
|
track->UnLink();
|
||||||
list->Insert( track, firstTrack->Next() );
|
list->Insert( track, firstTrack->Next() );
|
||||||
|
|
||||||
if( aTrackLen )
|
if( aTrackLen )
|
||||||
full_len += track->GetLength();
|
full_len += track->GetLength();
|
||||||
|
|
||||||
if( aLengthDie ) // Add now length die.
|
if( aLengthDie ) // Add now length die.
|
||||||
{
|
{
|
||||||
// In fact only 2 pads (maximum) will be taken in account:
|
// In fact only 2 pads (maximum) will be taken in account:
|
||||||
|
@ -229,6 +219,7 @@ TRACK* Marque_Une_Piste( BOARD* aPcb,
|
||||||
D_PAD * pad = (D_PAD *) track->start;
|
D_PAD * pad = (D_PAD *) track->start;
|
||||||
lenDie += (double) pad->m_LengthDie;
|
lenDie += (double) pad->m_LengthDie;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( track->GetState( END_ONPAD ) )
|
if( track->GetState( END_ONPAD ) )
|
||||||
{
|
{
|
||||||
D_PAD * pad = (D_PAD *) track->end;
|
D_PAD * pad = (D_PAD *) track->end;
|
||||||
|
@ -241,6 +232,7 @@ TRACK* Marque_Une_Piste( BOARD* aPcb,
|
||||||
else if( aTrackLen )
|
else if( aTrackLen )
|
||||||
{
|
{
|
||||||
NbSegmBusy = 0;
|
NbSegmBusy = 0;
|
||||||
|
|
||||||
for( TRACK* track = firstTrack; track; track = track->Next() )
|
for( TRACK* track = firstTrack; track; track = track->Next() )
|
||||||
{
|
{
|
||||||
if( track->GetState( BUSY ) )
|
if( track->GetState( BUSY ) )
|
||||||
|
@ -248,6 +240,7 @@ TRACK* Marque_Une_Piste( BOARD* aPcb,
|
||||||
NbSegmBusy++;
|
NbSegmBusy++;
|
||||||
track->SetState( BUSY, OFF );
|
track->SetState( BUSY, OFF );
|
||||||
full_len += track->GetLength();
|
full_len += track->GetLength();
|
||||||
|
|
||||||
// Add now length die.
|
// Add now length die.
|
||||||
// In fact only 2 pads (maximum) will be taken in account:
|
// In fact only 2 pads (maximum) will be taken in account:
|
||||||
// that are on each end of the track, if any
|
// that are on each end of the track, if any
|
||||||
|
@ -256,6 +249,7 @@ TRACK* Marque_Une_Piste( BOARD* aPcb,
|
||||||
D_PAD * pad = (D_PAD *) track->start;
|
D_PAD * pad = (D_PAD *) track->start;
|
||||||
lenDie += (double) pad->m_LengthDie;
|
lenDie += (double) pad->m_LengthDie;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( track->GetState( END_ONPAD ) )
|
if( track->GetState( END_ONPAD ) )
|
||||||
{
|
{
|
||||||
D_PAD * pad = (D_PAD *) track->end;
|
D_PAD * pad = (D_PAD *) track->end;
|
||||||
|
@ -267,8 +261,10 @@ TRACK* Marque_Une_Piste( BOARD* aPcb,
|
||||||
|
|
||||||
if( aTrackLen )
|
if( aTrackLen )
|
||||||
*aTrackLen = wxRound( full_len );
|
*aTrackLen = wxRound( full_len );
|
||||||
|
|
||||||
if( aLengthDie )
|
if( aLengthDie )
|
||||||
*aLengthDie = wxRound( lenDie );
|
*aLengthDie = wxRound( lenDie );
|
||||||
|
|
||||||
if( aSegmCount )
|
if( aSegmCount )
|
||||||
*aSegmCount = NbSegmBusy;
|
*aSegmCount = NbSegmBusy;
|
||||||
|
|
||||||
|
@ -277,7 +273,7 @@ TRACK* Marque_Une_Piste( BOARD* aPcb,
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function used by Marque_Une_Piste
|
* Function used by MarkTrace
|
||||||
* - Set the BUSY flag of connected segments, the first search point is
|
* - Set the BUSY flag of connected segments, the first search point is
|
||||||
* ref_pos on layers allowed in masque_layer
|
* ref_pos on layers allowed in masque_layer
|
||||||
* - Put segments fount in aList
|
* - Put segments fount in aList
|
||||||
|
@ -289,7 +285,7 @@ TRACK* Marque_Une_Piste( BOARD* aPcb,
|
||||||
* starting point is on a via)
|
* starting point is on a via)
|
||||||
* @param aList = the track list to fill with points of segments flagged
|
* @param aList = the track list to fill with points of segments flagged
|
||||||
*/
|
*/
|
||||||
static void Marque_Chaine_segments( BOARD* aPcb,
|
static void ChainMarkedSegments( BOARD* aPcb,
|
||||||
wxPoint aRef_pos,
|
wxPoint aRef_pos,
|
||||||
int aLayerMask,
|
int aLayerMask,
|
||||||
TRACK_PTRS* aList )
|
TRACK_PTRS* aList )
|
||||||
|
@ -332,6 +328,7 @@ static void Marque_Chaine_segments( BOARD* aPcb,
|
||||||
* and we do not know if this via is on the track or finish the track
|
* and we do not know if this via is on the track or finish the track
|
||||||
*/
|
*/
|
||||||
pt_via = Fast_Locate_Via( aPcb->m_Track, NULL, aRef_pos, aLayerMask );
|
pt_via = Fast_Locate_Via( aPcb->m_Track, NULL, aRef_pos, aLayerMask );
|
||||||
|
|
||||||
if( pt_via )
|
if( pt_via )
|
||||||
{
|
{
|
||||||
aLayerMask = pt_via->ReturnMaskLayer();
|
aLayerMask = pt_via->ReturnMaskLayer();
|
||||||
|
@ -346,11 +343,10 @@ static void Marque_Chaine_segments( BOARD* aPcb,
|
||||||
*/
|
*/
|
||||||
pt_segm = aPcb->m_Track; SegmentCandidate = NULL;
|
pt_segm = aPcb->m_Track; SegmentCandidate = NULL;
|
||||||
NbSegm = 0;
|
NbSegm = 0;
|
||||||
while( ( pt_segm = Fast_Locate_Piste( pt_segm, NULL,
|
|
||||||
aRef_pos, aLayerMask ) ) != NULL )
|
while( ( pt_segm = GetTrace( pt_segm, NULL, aRef_pos, aLayerMask ) ) != NULL )
|
||||||
{
|
{
|
||||||
if( pt_segm->GetState( BUSY ) ) // already found and selected: skip
|
if( pt_segm->GetState( BUSY ) ) // already found and selected: skip it
|
||||||
// it
|
|
||||||
{
|
{
|
||||||
pt_segm = pt_segm->Next();
|
pt_segm = pt_segm->Next();
|
||||||
continue;
|
continue;
|
||||||
|
@ -363,21 +359,19 @@ static void Marque_Chaine_segments( BOARD* aPcb,
|
||||||
}
|
}
|
||||||
|
|
||||||
NbSegm++;
|
NbSegm++;
|
||||||
if( NbSegm == 1 ) /* First time we found a connected item: pt_segm
|
|
||||||
* is candidate */
|
if( NbSegm == 1 ) /* First time we found a connected item: pt_segm is candidate */
|
||||||
{
|
{
|
||||||
SegmentCandidate = pt_segm;
|
SegmentCandidate = pt_segm;
|
||||||
pt_segm = pt_segm->Next();
|
pt_segm = pt_segm->Next();
|
||||||
}
|
}
|
||||||
else /* More than 1 segment connected -> this location is an end of
|
else /* More than 1 segment connected -> this location is an end of the track */
|
||||||
* the track */
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( SegmentCandidate ) // A candidate is found: flag it an push it
|
if( SegmentCandidate ) // A candidate is found: flag it an push it in list
|
||||||
// in list
|
|
||||||
{
|
{
|
||||||
/* Initialize parameters to search items connected to this
|
/* Initialize parameters to search items connected to this
|
||||||
* candidate:
|
* candidate:
|
||||||
|
@ -401,9 +395,11 @@ static void Marque_Chaine_segments( BOARD* aPcb,
|
||||||
SegmentCandidate->SetState( BUSY, ON );
|
SegmentCandidate->SetState( BUSY, ON );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Calculate the end points coordinates of a track (a list of connected
|
/* Calculate the end points coordinates of a track (a list of connected
|
||||||
|
@ -416,11 +412,10 @@ static void Marque_Chaine_segments( BOARD* aPcb,
|
||||||
* (*EndTrack)->m_End coordinate is the end of the track
|
* (*EndTrack)->m_End coordinate is the end of the track
|
||||||
* Segments connected must be consecutive in list
|
* Segments connected must be consecutive in list
|
||||||
*/
|
*/
|
||||||
int ReturnEndsTrack( TRACK* RefTrack, int NbSegm,
|
int ReturnEndsTrack( TRACK* RefTrack, int NbSegm, TRACK** StartTrack, TRACK** EndTrack )
|
||||||
TRACK** StartTrack, TRACK** EndTrack )
|
|
||||||
{
|
{
|
||||||
TRACK* Track, * via, * segm, * TrackListEnd;
|
TRACK* Track, * via, * segm, * TrackListEnd;
|
||||||
int NbEnds, masque_layer, ii, ok = 0;
|
int NbEnds, layerMask, ii, ok = 0;
|
||||||
|
|
||||||
if( NbSegm <= 1 )
|
if( NbSegm <= 1 )
|
||||||
{
|
{
|
||||||
|
@ -431,6 +426,7 @@ int ReturnEndsTrack( TRACK* RefTrack, int NbSegm,
|
||||||
/* Calculation of the limit analysis. */
|
/* Calculation of the limit analysis. */
|
||||||
*StartTrack = *EndTrack = NULL;
|
*StartTrack = *EndTrack = NULL;
|
||||||
TrackListEnd = Track = RefTrack; ii = 0;
|
TrackListEnd = Track = RefTrack; ii = 0;
|
||||||
|
|
||||||
for( ; ( Track != NULL ) && ( ii < NbSegm ); ii++, Track = Track->Next() )
|
for( ; ( Track != NULL ) && ( ii < NbSegm ); ii++, Track = Track->Next() )
|
||||||
{
|
{
|
||||||
TrackListEnd = Track;
|
TrackListEnd = Track;
|
||||||
|
@ -439,24 +435,25 @@ int ReturnEndsTrack( TRACK* RefTrack, int NbSegm,
|
||||||
|
|
||||||
/* Calculate the extremes. */
|
/* Calculate the extremes. */
|
||||||
NbEnds = 0; Track = RefTrack; ii = 0;
|
NbEnds = 0; Track = RefTrack; ii = 0;
|
||||||
|
|
||||||
for( ; ( Track != NULL ) && ( ii < NbSegm ); ii++, Track = Track->Next() )
|
for( ; ( Track != NULL ) && ( ii < NbSegm ); ii++, Track = Track->Next() )
|
||||||
{
|
{
|
||||||
if( Track->Type() == TYPE_VIA )
|
if( Track->Type() == TYPE_VIA )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
masque_layer = Track->ReturnMaskLayer();
|
layerMask = Track->ReturnMaskLayer();
|
||||||
via = Fast_Locate_Via( RefTrack, TrackListEnd,
|
via = Fast_Locate_Via( RefTrack, TrackListEnd, Track->m_Start, layerMask );
|
||||||
Track->m_Start, masque_layer );
|
|
||||||
if( via )
|
if( via )
|
||||||
{
|
{
|
||||||
masque_layer |= via->ReturnMaskLayer();
|
layerMask |= via->ReturnMaskLayer();
|
||||||
via->SetState( BUSY, ON );
|
via->SetState( BUSY, ON );
|
||||||
}
|
}
|
||||||
|
|
||||||
Track->SetState( BUSY, ON );
|
Track->SetState( BUSY, ON );
|
||||||
segm = Fast_Locate_Piste( RefTrack, TrackListEnd,
|
segm = GetTrace( RefTrack, TrackListEnd, Track->m_Start, layerMask );
|
||||||
Track->m_Start, masque_layer );
|
|
||||||
Track->SetState( BUSY, OFF );
|
Track->SetState( BUSY, OFF );
|
||||||
|
|
||||||
if( via )
|
if( via )
|
||||||
via->SetState( BUSY, OFF );
|
via->SetState( BUSY, OFF );
|
||||||
|
|
||||||
|
@ -480,6 +477,7 @@ int ReturnEndsTrack( TRACK* RefTrack, int NbSegm,
|
||||||
|
|
||||||
if( BeginPad )
|
if( BeginPad )
|
||||||
Track->SetState( END_ONPAD, ON );
|
Track->SetState( END_ONPAD, ON );
|
||||||
|
|
||||||
if( EndPad )
|
if( EndPad )
|
||||||
Track->SetState( BEGIN_ONPAD, ON );
|
Track->SetState( BEGIN_ONPAD, ON );
|
||||||
|
|
||||||
|
@ -490,21 +488,22 @@ int ReturnEndsTrack( TRACK* RefTrack, int NbSegm,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
masque_layer = Track->ReturnMaskLayer();
|
layerMask = Track->ReturnMaskLayer();
|
||||||
via = Fast_Locate_Via( RefTrack, TrackListEnd,
|
via = Fast_Locate_Via( RefTrack, TrackListEnd, Track->m_End, layerMask );
|
||||||
Track->m_End, masque_layer );
|
|
||||||
if( via )
|
if( via )
|
||||||
{
|
{
|
||||||
masque_layer |= via->ReturnMaskLayer();
|
layerMask |= via->ReturnMaskLayer();
|
||||||
via->SetState( BUSY, ON );
|
via->SetState( BUSY, ON );
|
||||||
}
|
}
|
||||||
|
|
||||||
Track->SetState( BUSY, ON );
|
Track->SetState( BUSY, ON );
|
||||||
segm = Fast_Locate_Piste( RefTrack, TrackListEnd,
|
segm = GetTrace( RefTrack, TrackListEnd, Track->m_End, layerMask );
|
||||||
Track->m_End, masque_layer );
|
|
||||||
Track->SetState( BUSY, OFF );
|
Track->SetState( BUSY, OFF );
|
||||||
|
|
||||||
if( via )
|
if( via )
|
||||||
via->SetState( BUSY, OFF );
|
via->SetState( BUSY, OFF );
|
||||||
|
|
||||||
if( segm == NULL )
|
if( segm == NULL )
|
||||||
{
|
{
|
||||||
switch( NbEnds )
|
switch( NbEnds )
|
||||||
|
@ -522,6 +521,7 @@ int ReturnEndsTrack( TRACK* RefTrack, int NbSegm,
|
||||||
|
|
||||||
if( BeginPad )
|
if( BeginPad )
|
||||||
Track->SetState( END_ONPAD, ON );
|
Track->SetState( END_ONPAD, ON );
|
||||||
|
|
||||||
if( EndPad )
|
if( EndPad )
|
||||||
Track->SetState( BEGIN_ONPAD, ON );
|
Track->SetState( BEGIN_ONPAD, ON );
|
||||||
|
|
||||||
|
@ -539,4 +539,3 @@ int ReturnEndsTrack( TRACK* RefTrack, int NbSegm,
|
||||||
|
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,22 +12,21 @@
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
|
|
||||||
|
|
||||||
/* Trace consecutive segments in memory.
|
/**
|
||||||
|
* Draw a list of trace segmants.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* Pt_start_piste = first segment in the list
|
* Pt_start_trace = first segment in the list
|
||||||
* Nbsegment = number of segments traced
|
* Nbsegment = number of segments traced
|
||||||
* Draw_mode = mode (GR_XOR, GR_OR ..)
|
* Draw_mode = mode (GR_XOR, GR_OR ..)
|
||||||
* CAUTION:
|
* CAUTION:
|
||||||
* The starting point of a track following MUST exist: may be
|
* The starting point of a track following MUST exist: may be
|
||||||
* then put a 0 before calling a routine if the track is the last drawn.
|
* then put a 0 before calling a routine if the track is the last drawn.
|
||||||
*/
|
*/
|
||||||
void Trace_Une_Piste( EDA_DRAW_PANEL* panel, wxDC* DC, TRACK* aTrackList,
|
void DrawTraces( EDA_DRAW_PANEL* panel, wxDC* DC, TRACK* aTrackList, int nbsegment, int draw_mode )
|
||||||
int nbsegment, int draw_mode )
|
|
||||||
{
|
{
|
||||||
// preserve the start of the list for debugging.
|
// preserve the start of the list for debugging.
|
||||||
for( TRACK* track = aTrackList; nbsegment > 0 && track;
|
for( TRACK* track = aTrackList; nbsegment > 0 && track; nbsegment--, track = track->Next() )
|
||||||
nbsegment--, track = track->Next() )
|
|
||||||
{
|
{
|
||||||
track->Draw( panel, DC, draw_mode );
|
track->Draw( panel, DC, draw_mode );
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,9 +40,6 @@ static PICKED_ITEMS_LIST _AuxiliaryList; // a picked list to store z
|
||||||
|
|
||||||
#include "dialog_copper_zones.h"
|
#include "dialog_copper_zones.h"
|
||||||
|
|
||||||
/**********************************************************************************/
|
|
||||||
void PCB_EDIT_FRAME::Add_Similar_Zone( wxDC* DC, ZONE_CONTAINER* zone_container )
|
|
||||||
/**********************************************************************************/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Add_Similar_Zone
|
* Function Add_Similar_Zone
|
||||||
|
@ -51,6 +48,7 @@ void PCB_EDIT_FRAME::Add_Similar_Zone( wxDC* DC, ZONE_CONTAINER* zone_container
|
||||||
* @param DC = current Device Context
|
* @param DC = current Device Context
|
||||||
* @param zone_container = parent zone outline
|
* @param zone_container = parent zone outline
|
||||||
*/
|
*/
|
||||||
|
void PCB_EDIT_FRAME::Add_Similar_Zone( wxDC* DC, ZONE_CONTAINER* zone_container )
|
||||||
{
|
{
|
||||||
if ( zone_container == NULL )
|
if ( zone_container == NULL )
|
||||||
return;
|
return;
|
||||||
|
@ -67,19 +65,17 @@ void PCB_EDIT_FRAME::Add_Similar_Zone( wxDC* DC, ZONE_CONTAINER* zone_container
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************************/
|
|
||||||
void PCB_EDIT_FRAME::Add_Zone_Cutout( wxDC* DC, ZONE_CONTAINER* zone_container )
|
|
||||||
/**********************************************************************************/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Add_Zone_Cutout
|
* Function Add_Zone_Cutout
|
||||||
* Add a cutout zone to a given zone outline
|
* Add a cutout zone to a given zone outline
|
||||||
* @param DC = current Device Context
|
* @param DC = current Device Context
|
||||||
* @param zone_container = parent zone outline
|
* @param zone_container = parent zone outline
|
||||||
*/
|
*/
|
||||||
|
void PCB_EDIT_FRAME::Add_Zone_Cutout( wxDC* DC, ZONE_CONTAINER* zone_container )
|
||||||
{
|
{
|
||||||
if ( zone_container == NULL )
|
if ( zone_container == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
s_AddCutoutToCurrentZone = true;
|
s_AddCutoutToCurrentZone = true;
|
||||||
s_CurrentZone = zone_container;
|
s_CurrentZone = zone_container;
|
||||||
|
|
||||||
|
@ -93,15 +89,12 @@ void PCB_EDIT_FRAME::Add_Zone_Cutout( wxDC* DC, ZONE_CONTAINER* zone_container )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************/
|
|
||||||
int PCB_EDIT_FRAME::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
|
* Remove and delete the current outline segment in progress
|
||||||
* @return 0 if no corner in list, or corner number
|
* @return 0 if no corner in list, or corner number
|
||||||
* if no corner in list, close the outline creation
|
* if no corner in list, close the outline creation
|
||||||
*/
|
*/
|
||||||
|
int PCB_EDIT_FRAME::Delete_LastCreatedCorner( wxDC* DC )
|
||||||
{
|
{
|
||||||
ZONE_CONTAINER* zone = GetBoard()->m_CurrentZoneContour;
|
ZONE_CONTAINER* zone = GetBoard()->m_CurrentZoneContour;
|
||||||
|
|
||||||
|
@ -127,18 +120,16 @@ int PCB_EDIT_FRAME::Delete_LastCreatedCorner( wxDC* DC )
|
||||||
zone->RemoveAllContours();
|
zone->RemoveAllContours();
|
||||||
zone->m_Flags = 0;
|
zone->m_Flags = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return zone->GetNumCorners();
|
return zone->GetNumCorners();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
|
||||||
static void Abort_Zone_Create_Outline( EDA_DRAW_PANEL* Panel, wxDC* DC )
|
|
||||||
/*************************************************************************/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Abort_Zone_Create_Outline
|
* Function Abort_Zone_Create_Outline
|
||||||
* cancels the Begin_Zone command if at least one EDGE_ZONE was created.
|
* cancels the Begin_Zone command if at least one EDGE_ZONE was created.
|
||||||
*/
|
*/
|
||||||
|
static void Abort_Zone_Create_Outline( EDA_DRAW_PANEL* Panel, wxDC* DC )
|
||||||
{
|
{
|
||||||
PCB_EDIT_FRAME* pcbframe = (PCB_EDIT_FRAME*) Panel->GetParent();
|
PCB_EDIT_FRAME* pcbframe = (PCB_EDIT_FRAME*) Panel->GetParent();
|
||||||
ZONE_CONTAINER* zone = pcbframe->GetBoard()->m_CurrentZoneContour;
|
ZONE_CONTAINER* zone = pcbframe->GetBoard()->m_CurrentZoneContour;
|
||||||
|
@ -157,16 +148,13 @@ static void Abort_Zone_Create_Outline( EDA_DRAW_PANEL* Panel, wxDC* DC )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************************************/
|
|
||||||
void PCB_EDIT_FRAME::Start_Move_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_container,
|
|
||||||
int corner_id, bool IsNewCorner )
|
|
||||||
/*******************************************************************************************************/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Start_Move_Zone_Corner
|
* Function Start_Move_Zone_Corner
|
||||||
* Initialise parametres to move an existing corner of a zone.
|
* Initialise parametres to move an existing corner of a zone.
|
||||||
* if IsNewCorner is true, the Abort_Zone_Move_Corner_Or_Outlines will remove this corner, if called
|
* if IsNewCorner is true, the Abort_Zone_Move_Corner_Or_Outlines will remove this corner, if called
|
||||||
*/
|
*/
|
||||||
|
void PCB_EDIT_FRAME::Start_Move_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_container,
|
||||||
|
int corner_id, bool IsNewCorner )
|
||||||
{
|
{
|
||||||
if( zone_container->IsOnCopperLayer() ) /* Show the Net */
|
if( zone_container->IsOnCopperLayer() ) /* Show the Net */
|
||||||
{
|
{
|
||||||
|
@ -177,6 +165,7 @@ void PCB_EDIT_FRAME::Start_Move_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_cont
|
||||||
|
|
||||||
g_Zone_Default_Setting.m_NetcodeSelection = zone_container->GetNet();
|
g_Zone_Default_Setting.m_NetcodeSelection = zone_container->GetNet();
|
||||||
GetBoard()->SetHightLightNet( zone_container->GetNet() );
|
GetBoard()->SetHightLightNet( zone_container->GetNet() );
|
||||||
|
|
||||||
if( DC )
|
if( DC )
|
||||||
High_Light( DC );
|
High_Light( DC );
|
||||||
}
|
}
|
||||||
|
@ -193,7 +182,9 @@ void PCB_EDIT_FRAME::Start_Move_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_cont
|
||||||
_AuxiliaryList.ClearListAndDeleteItems();
|
_AuxiliaryList.ClearListAndDeleteItems();
|
||||||
s_PickedList.ClearListAndDeleteItems();
|
s_PickedList.ClearListAndDeleteItems();
|
||||||
|
|
||||||
SaveCopyOfZones(s_PickedList, GetBoard(), zone_container->GetNet(), zone_container->GetLayer() );
|
SaveCopyOfZones( s_PickedList, GetBoard(), zone_container->GetNet(),
|
||||||
|
zone_container->GetLayer() );
|
||||||
|
|
||||||
if ( IsNewCorner )
|
if ( IsNewCorner )
|
||||||
zone_container->m_Poly->InsertCorner(corner_id-1, cx, cy );
|
zone_container->m_Poly->InsertCorner(corner_id-1, cx, cy );
|
||||||
|
|
||||||
|
@ -207,16 +198,13 @@ void PCB_EDIT_FRAME::Start_Move_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_cont
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************************/
|
|
||||||
void PCB_EDIT_FRAME::Start_Move_Zone_Drag_Outline_Edge( wxDC* DC,
|
|
||||||
ZONE_CONTAINER* zone_container,
|
|
||||||
int corner_id )
|
|
||||||
/**************************************************************************************/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Start_Move_Zone_Drag_Outline_Edge
|
* Function Start_Move_Zone_Drag_Outline_Edge
|
||||||
* Prepares a drag edge for an existing zone outline,
|
* Prepares a drag edge for an existing zone outline,
|
||||||
*/
|
*/
|
||||||
|
void PCB_EDIT_FRAME::Start_Move_Zone_Drag_Outline_Edge( wxDC* DC,
|
||||||
|
ZONE_CONTAINER* zone_container,
|
||||||
|
int corner_id )
|
||||||
{
|
{
|
||||||
zone_container->m_Flags = IS_DRAGGED;
|
zone_container->m_Flags = IS_DRAGGED;
|
||||||
zone_container->m_CornerSelection = corner_id;
|
zone_container->m_CornerSelection = corner_id;
|
||||||
|
@ -233,14 +221,11 @@ void PCB_EDIT_FRAME::Start_Move_Zone_Drag_Outline_Edge( wxDC* DC,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************************************/
|
|
||||||
void PCB_EDIT_FRAME::Start_Move_Zone_Outlines( wxDC* DC, ZONE_CONTAINER* zone_container )
|
|
||||||
/*******************************************************************************************************/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Start_Move_Zone_Outlines
|
* Function Start_Move_Zone_Outlines
|
||||||
* Initialise parametres to move an existing zone outlines.
|
* Initialise parametres to move an existing zone outlines.
|
||||||
*/
|
*/
|
||||||
|
void PCB_EDIT_FRAME::Start_Move_Zone_Outlines( wxDC* DC, ZONE_CONTAINER* zone_container )
|
||||||
{
|
{
|
||||||
/* Show the Net */
|
/* Show the Net */
|
||||||
if( zone_container->IsOnCopperLayer() ) /* Show the Net */
|
if( zone_container->IsOnCopperLayer() ) /* Show the Net */
|
||||||
|
@ -257,7 +242,8 @@ void PCB_EDIT_FRAME::Start_Move_Zone_Outlines( wxDC* DC, ZONE_CONTAINER* zone_co
|
||||||
|
|
||||||
s_PickedList.ClearListAndDeleteItems();
|
s_PickedList.ClearListAndDeleteItems();
|
||||||
_AuxiliaryList.ClearListAndDeleteItems();
|
_AuxiliaryList.ClearListAndDeleteItems();
|
||||||
SaveCopyOfZones(s_PickedList, GetBoard(), zone_container->GetNet(), zone_container->GetLayer() );
|
SaveCopyOfZones( s_PickedList, GetBoard(), zone_container->GetNet(),
|
||||||
|
zone_container->GetLayer() );
|
||||||
|
|
||||||
zone_container->m_Flags = IS_MOVED;
|
zone_container->m_Flags = IS_MOVED;
|
||||||
DrawPanel->SetMouseCapture( Show_Zone_Corner_Or_Outline_While_Move_Mouse,
|
DrawPanel->SetMouseCapture( Show_Zone_Corner_Or_Outline_While_Move_Mouse,
|
||||||
|
@ -269,16 +255,13 @@ void PCB_EDIT_FRAME::Start_Move_Zone_Outlines( wxDC* DC, ZONE_CONTAINER* zone_co
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************************************/
|
|
||||||
void PCB_EDIT_FRAME::End_Move_Zone_Corner_Or_Outlines( wxDC* DC, ZONE_CONTAINER* zone_container )
|
|
||||||
/*************************************************************************************************/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function End_Move_Zone_Corner_Or_Outlines
|
* Function End_Move_Zone_Corner_Or_Outlines
|
||||||
* Terminates a move corner in a zone outline, or a move zone outlines
|
* Terminates a move corner in a zone outline, or a move zone outlines
|
||||||
* @param DC = current Device Context (can be NULL)
|
* @param DC = current Device Context (can be NULL)
|
||||||
* @param zone_container: the given zone
|
* @param zone_container: the given zone
|
||||||
*/
|
*/
|
||||||
|
void PCB_EDIT_FRAME::End_Move_Zone_Corner_Or_Outlines( wxDC* DC, ZONE_CONTAINER* zone_container )
|
||||||
{
|
{
|
||||||
zone_container->m_Flags = 0;
|
zone_container->m_Flags = 0;
|
||||||
DrawPanel->SetMouseCapture( NULL, NULL );
|
DrawPanel->SetMouseCapture( NULL, NULL );
|
||||||
|
@ -299,6 +282,7 @@ void PCB_EDIT_FRAME::End_Move_Zone_Corner_Or_Outlines( wxDC* DC, ZONE_CONTAINER*
|
||||||
|
|
||||||
|
|
||||||
int ii = GetBoard()->GetAreaIndex( zone_container ); // test if zone_container exists
|
int ii = GetBoard()->GetAreaIndex( zone_container ); // test if zone_container exists
|
||||||
|
|
||||||
if( ii < 0 )
|
if( ii < 0 )
|
||||||
zone_container = NULL; // was removed by combining zones
|
zone_container = NULL; // was removed by combining zones
|
||||||
|
|
||||||
|
@ -307,6 +291,7 @@ void PCB_EDIT_FRAME::End_Move_Zone_Corner_Or_Outlines( wxDC* DC, ZONE_CONTAINER*
|
||||||
s_PickedList.ClearItemsList(); // s_ItemsListPicker is no more owner of picked items
|
s_PickedList.ClearItemsList(); // s_ItemsListPicker is no more owner of picked items
|
||||||
|
|
||||||
int error_count = GetBoard()->Test_Drc_Areas_Outlines_To_Areas_Outlines( zone_container, true );
|
int error_count = GetBoard()->Test_Drc_Areas_Outlines_To_Areas_Outlines( zone_container, true );
|
||||||
|
|
||||||
if( error_count )
|
if( error_count )
|
||||||
{
|
{
|
||||||
DisplayError( this, _( "Area: DRC outline error" ) );
|
DisplayError( this, _( "Area: DRC outline error" ) );
|
||||||
|
@ -314,10 +299,6 @@ void PCB_EDIT_FRAME::End_Move_Zone_Corner_Or_Outlines( wxDC* DC, ZONE_CONTAINER*
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************************/
|
|
||||||
void PCB_EDIT_FRAME::Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_container )
|
|
||||||
/*************************************************************************************/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Remove_Zone_Corner
|
* Function Remove_Zone_Corner
|
||||||
* Remove the currently selected corner in a zone outline
|
* Remove the currently selected corner in a zone outline
|
||||||
|
@ -326,17 +307,20 @@ void PCB_EDIT_FRAME::Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_containe
|
||||||
* @param zone_container = the zone that contains the selected corner
|
* @param zone_container = the zone that contains the selected corner
|
||||||
* the member .m_CornerSelection is used as selected corner
|
* the member .m_CornerSelection is used as selected corner
|
||||||
*/
|
*/
|
||||||
|
void PCB_EDIT_FRAME::Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_container )
|
||||||
{
|
{
|
||||||
OnModify();
|
OnModify();
|
||||||
|
|
||||||
if( zone_container->m_Poly->GetNumCorners() <= 3 )
|
if( zone_container->m_Poly->GetNumCorners() <= 3 )
|
||||||
{
|
{
|
||||||
DrawPanel->RefreshDrawingRect( zone_container->GetBoundingBox() );
|
DrawPanel->RefreshDrawingRect( zone_container->GetBoundingBox() );
|
||||||
|
|
||||||
if( DC )
|
if( DC )
|
||||||
{ // Remove the full zone because this is no more an area
|
{ // Remove the full zone because this is no more an area
|
||||||
zone_container->UnFill();
|
zone_container->UnFill();
|
||||||
zone_container->DrawFilledArea( DrawPanel, DC, GR_XOR );
|
zone_container->DrawFilledArea( DrawPanel, DC, GR_XOR );
|
||||||
}
|
}
|
||||||
|
|
||||||
GetBoard()->Delete( zone_container );
|
GetBoard()->Delete( zone_container );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -351,11 +335,13 @@ void PCB_EDIT_FRAME::Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_containe
|
||||||
|
|
||||||
_AuxiliaryList.ClearListAndDeleteItems();
|
_AuxiliaryList.ClearListAndDeleteItems();
|
||||||
s_PickedList. ClearListAndDeleteItems();
|
s_PickedList. ClearListAndDeleteItems();
|
||||||
SaveCopyOfZones(s_PickedList, GetBoard(), zone_container->GetNet(), zone_container->GetLayer() );
|
SaveCopyOfZones( s_PickedList, GetBoard(), zone_container->GetNet(),
|
||||||
|
zone_container->GetLayer() );
|
||||||
zone_container->m_Poly->DeleteCorner( zone_container->m_CornerSelection );
|
zone_container->m_Poly->DeleteCorner( zone_container->m_CornerSelection );
|
||||||
|
|
||||||
// modify zones outlines according to the new zone_container shape
|
// modify zones outlines according to the new zone_container shape
|
||||||
GetBoard()->AreaPolygonModified( &_AuxiliaryList, zone_container, true, s_Verbose );
|
GetBoard()->AreaPolygonModified( &_AuxiliaryList, zone_container, true, s_Verbose );
|
||||||
|
|
||||||
if( DC )
|
if( DC )
|
||||||
{
|
{
|
||||||
GetBoard()->RedrawAreasOutlines( DrawPanel, DC, GR_OR, layer );
|
GetBoard()->RedrawAreasOutlines( DrawPanel, DC, GR_OR, layer );
|
||||||
|
@ -367,9 +353,12 @@ void PCB_EDIT_FRAME::Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_containe
|
||||||
s_PickedList.ClearItemsList(); // s_ItemsListPicker is no more owner of picked items
|
s_PickedList.ClearItemsList(); // s_ItemsListPicker is no more owner of picked items
|
||||||
|
|
||||||
int ii = GetBoard()->GetAreaIndex( zone_container ); // test if zone_container exists
|
int ii = GetBoard()->GetAreaIndex( zone_container ); // test if zone_container exists
|
||||||
|
|
||||||
if( ii < 0 )
|
if( ii < 0 )
|
||||||
zone_container = NULL; // zone_container does not exist anymaore, after combining zones
|
zone_container = NULL; // zone_container does not exist anymaore, after combining zones
|
||||||
|
|
||||||
int error_count = GetBoard()->Test_Drc_Areas_Outlines_To_Areas_Outlines( zone_container, true );
|
int error_count = GetBoard()->Test_Drc_Areas_Outlines_To_Areas_Outlines( zone_container, true );
|
||||||
|
|
||||||
if( error_count )
|
if( error_count )
|
||||||
{
|
{
|
||||||
DisplayError( this, _( "Area: DRC outline error" ) );
|
DisplayError( this, _( "Area: DRC outline error" ) );
|
||||||
|
@ -377,14 +366,11 @@ void PCB_EDIT_FRAME::Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_containe
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************/
|
|
||||||
void Abort_Zone_Move_Corner_Or_Outlines( EDA_DRAW_PANEL* Panel, wxDC* DC )
|
|
||||||
/**************************************************************************/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Abort_Zone_Move_Corner_Or_Outlines
|
* Function Abort_Zone_Move_Corner_Or_Outlines
|
||||||
* cancels the Begin_Zone state if at least one EDGE_ZONE has been created.
|
* cancels the Begin_Zone state if at least one EDGE_ZONE has been created.
|
||||||
*/
|
*/
|
||||||
|
void Abort_Zone_Move_Corner_Or_Outlines( EDA_DRAW_PANEL* Panel, wxDC* DC )
|
||||||
{
|
{
|
||||||
PCB_EDIT_FRAME* pcbframe = (PCB_EDIT_FRAME*) Panel->GetParent();
|
PCB_EDIT_FRAME* pcbframe = (PCB_EDIT_FRAME*) Panel->GetParent();
|
||||||
ZONE_CONTAINER* zone_container = (ZONE_CONTAINER*) pcbframe->GetCurItem();
|
ZONE_CONTAINER* zone_container = (ZONE_CONTAINER*) pcbframe->GetCurItem();
|
||||||
|
@ -456,16 +442,14 @@ void Show_Zone_Corner_Or_Outline_While_Move_Mouse( EDA_DRAW_PANEL* aPanel, wxDC*
|
||||||
s_CursorLastPosition = pos;
|
s_CursorLastPosition = pos;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
zone->m_Poly->MoveCorner( zone->m_CornerSelection, pos.x, pos.y );
|
zone->m_Poly->MoveCorner( zone->m_CornerSelection, pos.x, pos.y );
|
||||||
|
}
|
||||||
|
|
||||||
zone->Draw( aPanel, aDC, GR_XOR );
|
zone->Draw( aPanel, aDC, GR_XOR );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************/
|
|
||||||
int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC )
|
|
||||||
/*************************************************/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Begin_Zone
|
* Function Begin_Zone
|
||||||
* either initializes the first segment of a new zone, or adds an
|
* either initializes the first segment of a new zone, or adds an
|
||||||
|
@ -475,9 +459,11 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC )
|
||||||
* created from a similar zone (s_CurrentZone is used): parameters are copied from s_CurrentZone
|
* created from a similar zone (s_CurrentZone is used): parameters are copied from s_CurrentZone
|
||||||
* created as a cutout (an hole) inside s_CurrentZone
|
* created as a cutout (an hole) inside s_CurrentZone
|
||||||
*/
|
*/
|
||||||
|
int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC )
|
||||||
{
|
{
|
||||||
// verify if s_CurrentZone exists (could be deleted since last selection) :
|
// verify if s_CurrentZone exists (could be deleted since last selection) :
|
||||||
int ii;
|
int ii;
|
||||||
|
|
||||||
for( ii = 0; ii < GetBoard()->GetAreaCount(); ii++ )
|
for( ii = 0; ii < GetBoard()->GetAreaCount(); ii++ )
|
||||||
{
|
{
|
||||||
if( s_CurrentZone == GetBoard()->GetArea( ii ) )
|
if( s_CurrentZone == GetBoard()->GetArea( ii ) )
|
||||||
|
@ -495,7 +481,8 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC )
|
||||||
GetBoard()->m_CurrentZoneContour = new ZONE_CONTAINER( GetBoard() );
|
GetBoard()->m_CurrentZoneContour = new ZONE_CONTAINER( GetBoard() );
|
||||||
|
|
||||||
ZONE_CONTAINER* zone = GetBoard()->m_CurrentZoneContour;
|
ZONE_CONTAINER* zone = GetBoard()->m_CurrentZoneContour;
|
||||||
if( zone->GetNumCorners() == 0 ) /* Start a new contour: init zone params (net, layer ...) */
|
|
||||||
|
if( zone->GetNumCorners() == 0 ) // Start a new contour: init zone params (net, layer ...)
|
||||||
{
|
{
|
||||||
if( s_CurrentZone == NULL ) // A new outline is created, from scratch
|
if( s_CurrentZone == NULL ) // A new outline is created, from scratch
|
||||||
{
|
{
|
||||||
|
@ -504,7 +491,8 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC )
|
||||||
zone->SetLayer( getActiveLayer() );
|
zone->SetLayer( getActiveLayer() );
|
||||||
|
|
||||||
// Prompt user for parameters:
|
// Prompt user for parameters:
|
||||||
DrawPanel->m_IgnoreMouseEvents = TRUE;
|
DrawPanel->m_IgnoreMouseEvents = true;
|
||||||
|
|
||||||
if( zone->IsOnCopperLayer() )
|
if( zone->IsOnCopperLayer() )
|
||||||
{ // Put a zone on a copper layer
|
{ // Put a zone on a copper layer
|
||||||
if ( GetBoard()->GetHightLightNetCode() > 0 )
|
if ( GetBoard()->GetHightLightNetCode() > 0 )
|
||||||
|
@ -530,8 +518,9 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC )
|
||||||
diag = InstallDialogNonCopperZonesEditor( zone );
|
diag = InstallDialogNonCopperZonesEditor( zone );
|
||||||
g_Zone_Default_Setting.m_NetcodeSelection = 0; // No net for non copper zones
|
g_Zone_Default_Setting.m_NetcodeSelection = 0; // No net for non copper zones
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawPanel->MoveCursorToCrossHair();
|
DrawPanel->MoveCursorToCrossHair();
|
||||||
DrawPanel->m_IgnoreMouseEvents = FALSE;
|
DrawPanel->m_IgnoreMouseEvents = false;
|
||||||
|
|
||||||
if( diag == ZONE_ABORT )
|
if( diag == ZONE_ABORT )
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -539,8 +528,8 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC )
|
||||||
// Switch active layer to the selectec zonz layer
|
// Switch active layer to the selectec zonz layer
|
||||||
setActiveLayer( g_Zone_Default_Setting.m_CurrentZone_Layer );
|
setActiveLayer( g_Zone_Default_Setting.m_CurrentZone_Layer );
|
||||||
}
|
}
|
||||||
else // Start a new contour: init zone params (net and layer) from an existing zone (add cutout or similar zone)
|
else // Start a new contour: init zone params (net and layer) from an existing
|
||||||
{
|
{ // zone (add cutout or similar zone)
|
||||||
g_Zone_Default_Setting.m_CurrentZone_Layer = s_CurrentZone->GetLayer();
|
g_Zone_Default_Setting.m_CurrentZone_Layer = s_CurrentZone->GetLayer();
|
||||||
setActiveLayer( s_CurrentZone->GetLayer() );
|
setActiveLayer( s_CurrentZone->GetLayer() );
|
||||||
g_Zone_Default_Setting.ImportSetting( * s_CurrentZone);
|
g_Zone_Default_Setting.ImportSetting( * s_CurrentZone);
|
||||||
|
@ -551,6 +540,7 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC )
|
||||||
{
|
{
|
||||||
if( s_CurrentZone )
|
if( s_CurrentZone )
|
||||||
g_Zone_Default_Setting.m_NetcodeSelection = s_CurrentZone->GetNet();
|
g_Zone_Default_Setting.m_NetcodeSelection = s_CurrentZone->GetNet();
|
||||||
|
|
||||||
if( GetBoard()->IsHightLightNetON() )
|
if( GetBoard()->IsHightLightNetON() )
|
||||||
{
|
{
|
||||||
High_Light( DC ); // Remove old hightlight selection
|
High_Light( DC ); // Remove old hightlight selection
|
||||||
|
@ -559,6 +549,7 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC )
|
||||||
GetBoard()->SetHightLightNet( g_Zone_Default_Setting.m_NetcodeSelection );
|
GetBoard()->SetHightLightNet( g_Zone_Default_Setting.m_NetcodeSelection );
|
||||||
High_Light( DC );
|
High_Light( DC );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !s_AddCutoutToCurrentZone )
|
if( !s_AddCutoutToCurrentZone )
|
||||||
s_CurrentZone = NULL; // the zone is used only once ("add similar zone" command)
|
s_CurrentZone = NULL; // the zone is used only once ("add similar zone" command)
|
||||||
}
|
}
|
||||||
|
@ -574,6 +565,7 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC )
|
||||||
GetScreen()->GetCrossHairPosition().y,
|
GetScreen()->GetCrossHairPosition().y,
|
||||||
zone->GetHatchStyle() );
|
zone->GetHatchStyle() );
|
||||||
zone->AppendCorner( GetScreen()->GetCrossHairPosition() );
|
zone->AppendCorner( GetScreen()->GetCrossHairPosition() );
|
||||||
|
|
||||||
if( Drc_On && (m_drc->Drc( zone, 0 ) == BAD_DRC) && zone->IsOnCopperLayer() )
|
if( Drc_On && (m_drc->Drc( zone, 0 ) == BAD_DRC) && zone->IsOnCopperLayer() )
|
||||||
{
|
{
|
||||||
zone->m_Flags = 0;
|
zone->m_Flags = 0;
|
||||||
|
@ -589,20 +581,16 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC )
|
||||||
}
|
}
|
||||||
|
|
||||||
SetCurItem( zone );
|
SetCurItem( zone );
|
||||||
DrawPanel->SetMouseCapture( Show_New_Edge_While_Move_Mouse,
|
DrawPanel->SetMouseCapture( Show_New_Edge_While_Move_Mouse, Abort_Zone_Create_Outline );
|
||||||
Abort_Zone_Create_Outline );
|
|
||||||
}
|
}
|
||||||
// edge in progress:
|
else // edge in progress:
|
||||||
else
|
|
||||||
{
|
{
|
||||||
ii = zone->GetNumCorners() - 1;
|
ii = zone->GetNumCorners() - 1;
|
||||||
|
|
||||||
/* edge in progress : the current corner coordinate was set by Show_New_Edge_While_Move_Mouse */
|
/* edge in progress : the current corner coordinate was set by Show_New_Edge_While_Move_Mouse */
|
||||||
if( zone->GetCornerPosition( ii - 1 ) != zone->GetCornerPosition( ii ) )
|
if( zone->GetCornerPosition( ii - 1 ) != zone->GetCornerPosition( ii ) )
|
||||||
{
|
{
|
||||||
if( !Drc_On || !zone->IsOnCopperLayer()
|
if( !Drc_On || !zone->IsOnCopperLayer() || ( m_drc->Drc( zone, ii - 1 ) == OK_DRC ) )
|
||||||
|| ( m_drc->Drc( zone, ii - 1 ) == OK_DRC )
|
|
||||||
)
|
|
||||||
{ // Ok, we can add a new corner
|
{ // Ok, we can add a new corner
|
||||||
zone->AppendCorner( GetScreen()->GetCrossHairPosition() );
|
zone->AppendCorner( GetScreen()->GetCrossHairPosition() );
|
||||||
SetCurItem( zone ); // calls DisplayInfo().
|
SetCurItem( zone ); // calls DisplayInfo().
|
||||||
|
@ -614,10 +602,6 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********************************************/
|
|
||||||
bool PCB_EDIT_FRAME::End_Zone( wxDC* DC )
|
|
||||||
/*********************************************/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function End_Zone
|
* Function End_Zone
|
||||||
* Terminates a zone outline creation
|
* Terminates a zone outline creation
|
||||||
|
@ -626,6 +610,7 @@ bool PCB_EDIT_FRAME::End_Zone( wxDC* DC )
|
||||||
* @return true if Ok, false if DRC error
|
* @return true if Ok, false if DRC error
|
||||||
* if ok, put it in the main list GetBoard()->m_ZoneDescriptorList (a vector<ZONE_CONTAINER*>)
|
* if ok, put it in the main list GetBoard()->m_ZoneDescriptorList (a vector<ZONE_CONTAINER*>)
|
||||||
*/
|
*/
|
||||||
|
bool PCB_EDIT_FRAME::End_Zone( wxDC* DC )
|
||||||
{
|
{
|
||||||
ZONE_CONTAINER* zone = GetBoard()->m_CurrentZoneContour;
|
ZONE_CONTAINER* zone = GetBoard()->m_CurrentZoneContour;
|
||||||
|
|
||||||
|
@ -645,6 +630,7 @@ bool PCB_EDIT_FRAME::End_Zone( wxDC* DC )
|
||||||
{
|
{
|
||||||
if( Drc_On && m_drc->Drc( zone, icorner - 1 ) == BAD_DRC ) // we can't validate last edge
|
if( Drc_On && m_drc->Drc( zone, icorner - 1 ) == BAD_DRC ) // we can't validate last edge
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if( Drc_On && m_drc->Drc( zone, icorner ) == BAD_DRC ) // we can't validate the closing edge
|
if( Drc_On && m_drc->Drc( zone, icorner ) == BAD_DRC ) // we can't validate the closing edge
|
||||||
{
|
{
|
||||||
DisplayError( this,
|
DisplayError( this,
|
||||||
|
@ -705,10 +691,12 @@ bool PCB_EDIT_FRAME::End_Zone( wxDC* DC )
|
||||||
GetBoard()->RedrawFilledAreas( DrawPanel, DC, GR_OR, layer );
|
GetBoard()->RedrawFilledAreas( DrawPanel, DC, GR_OR, layer );
|
||||||
|
|
||||||
int ii = GetBoard()->GetAreaIndex( zone ); // test if zone_container exists
|
int ii = GetBoard()->GetAreaIndex( zone ); // test if zone_container exists
|
||||||
|
|
||||||
if( ii < 0 )
|
if( ii < 0 )
|
||||||
zone = NULL; // was removed by combining zones
|
zone = NULL; // was removed by combining zones
|
||||||
|
|
||||||
int error_count = GetBoard()->Test_Drc_Areas_Outlines_To_Areas_Outlines( zone, true );
|
int error_count = GetBoard()->Test_Drc_Areas_Outlines_To_Areas_Outlines( zone, true );
|
||||||
|
|
||||||
if( error_count )
|
if( error_count )
|
||||||
{
|
{
|
||||||
DisplayError( this, _( "Area: DRC outline error" ) );
|
DisplayError( this, _( "Area: DRC outline error" ) );
|
||||||
|
@ -750,7 +738,7 @@ static void Show_New_Edge_While_Move_Mouse( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
|
||||||
{
|
{
|
||||||
// calculate the new position as allowed
|
// calculate the new position as allowed
|
||||||
wxPoint StartPoint = zone->GetCornerPosition( icorner - 1 );
|
wxPoint StartPoint = zone->GetCornerPosition( icorner - 1 );
|
||||||
Calcule_Coord_Extremite_45( c_pos, StartPoint.x, StartPoint.y, &c_pos.x, &c_pos.y );
|
CalculateSegmentEndPoint( c_pos, StartPoint.x, StartPoint.y, &c_pos.x, &c_pos.y );
|
||||||
}
|
}
|
||||||
|
|
||||||
zone->SetCornerPosition( icorner, c_pos );
|
zone->SetCornerPosition( icorner, c_pos );
|
||||||
|
@ -759,17 +747,14 @@ static void Show_New_Edge_While_Move_Mouse( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************************/
|
|
||||||
void PCB_EDIT_FRAME::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* zone_container )
|
|
||||||
/***********************************************************************************/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Edit_Zone_Params
|
* Function Edit_Zone_Params
|
||||||
* Edit params (layer, clearance, ...) for a zone outline
|
* Edit params (layer, clearance, ...) for a zone outline
|
||||||
*/
|
*/
|
||||||
|
void PCB_EDIT_FRAME::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* zone_container )
|
||||||
{
|
{
|
||||||
int diag;
|
int diag;
|
||||||
DrawPanel->m_IgnoreMouseEvents = TRUE;
|
DrawPanel->m_IgnoreMouseEvents = true;
|
||||||
|
|
||||||
/* Save initial zones configuration, for undo/redo, before adding new zone
|
/* Save initial zones configuration, for undo/redo, before adding new zone
|
||||||
* note the net name and the layer can be changed, so we must save all zones
|
* note the net name and the layer can be changed, so we must save all zones
|
||||||
|
@ -786,10 +771,12 @@ void PCB_EDIT_FRAME::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* zone_container
|
||||||
frame->Destroy();
|
frame->Destroy();
|
||||||
}
|
}
|
||||||
else // edit a zone on a non copper layer (technical layer)
|
else // edit a zone on a non copper layer (technical layer)
|
||||||
|
{
|
||||||
diag = InstallDialogNonCopperZonesEditor( zone_container );
|
diag = InstallDialogNonCopperZonesEditor( zone_container );
|
||||||
|
}
|
||||||
|
|
||||||
DrawPanel->MoveCursorToCrossHair();
|
DrawPanel->MoveCursorToCrossHair();
|
||||||
DrawPanel->m_IgnoreMouseEvents = FALSE;
|
DrawPanel->m_IgnoreMouseEvents = false;
|
||||||
|
|
||||||
if( diag == ZONE_ABORT )
|
if( diag == ZONE_ABORT )
|
||||||
{
|
{
|
||||||
|
@ -797,6 +784,7 @@ void PCB_EDIT_FRAME::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* zone_container
|
||||||
s_PickedList.ClearListAndDeleteItems();
|
s_PickedList.ClearListAndDeleteItems();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( diag == ZONE_EXPORT_VALUES )
|
if( diag == ZONE_EXPORT_VALUES )
|
||||||
{
|
{
|
||||||
UpdateCopyOfZonesList( s_PickedList, _AuxiliaryList, GetBoard() );
|
UpdateCopyOfZonesList( s_PickedList, _AuxiliaryList, GetBoard() );
|
||||||
|
@ -814,6 +802,7 @@ void PCB_EDIT_FRAME::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* zone_container
|
||||||
|
|
||||||
g_Zone_Default_Setting.ExportSetting( *zone_container);
|
g_Zone_Default_Setting.ExportSetting( *zone_container);
|
||||||
NETINFO_ITEM* net = GetBoard()->FindNet( g_Zone_Default_Setting.m_NetcodeSelection );
|
NETINFO_ITEM* net = GetBoard()->FindNet( g_Zone_Default_Setting.m_NetcodeSelection );
|
||||||
|
|
||||||
if( net ) // net == NULL should not occur
|
if( net ) // net == NULL should not occur
|
||||||
zone_container->m_Netname = net->GetNetname();
|
zone_container->m_Netname = net->GetNetname();
|
||||||
|
|
||||||
|
@ -831,10 +820,6 @@ void PCB_EDIT_FRAME::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* zone_container
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************************/
|
|
||||||
void PCB_EDIT_FRAME::Delete_Zone_Contour( wxDC* DC, ZONE_CONTAINER* zone_container )
|
|
||||||
/************************************************************************************/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Delete_Zone_Contour
|
* Function Delete_Zone_Contour
|
||||||
* Remove the zone which include the segment aZone, or the zone which have the given time stamp.
|
* Remove the zone which include the segment aZone, or the zone which have the given time stamp.
|
||||||
|
@ -845,6 +830,7 @@ void PCB_EDIT_FRAME::Delete_Zone_Contour( wxDC* DC, ZONE_CONTAINER* zone_contain
|
||||||
* if the outline is the main outline, all the zone_container is removed (deleted)
|
* if the outline is the main outline, all the zone_container is removed (deleted)
|
||||||
* otherwise, the hole is deleted
|
* otherwise, the hole is deleted
|
||||||
*/
|
*/
|
||||||
|
void PCB_EDIT_FRAME::Delete_Zone_Contour( wxDC* DC, ZONE_CONTAINER* zone_container )
|
||||||
{
|
{
|
||||||
int ncont = zone_container->m_Poly->GetContour( zone_container->m_CornerSelection );
|
int ncont = zone_container->m_Poly->GetContour( zone_container->m_CornerSelection );
|
||||||
|
|
||||||
|
@ -871,4 +857,3 @@ void PCB_EDIT_FRAME::Delete_Zone_Contour( wxDC* DC, ZONE_CONTAINER* zone_contain
|
||||||
|
|
||||||
OnModify();
|
OnModify();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,8 @@
|
||||||
/**
|
/**
|
||||||
* Function Delete_OldZone_Fill (obsolete)
|
* Function Delete_OldZone_Fill (obsolete)
|
||||||
* Used for compatibility with old boards
|
* Used for compatibility with old boards
|
||||||
* Remove the zone filling which include the segment aZone, or the zone which have the given time stamp.
|
* Remove the zone filling which include the segment aZone, or the zone which have the
|
||||||
|
* given time stamp.
|
||||||
* A zone is a group of segments which have the same TimeStamp
|
* A zone is a group of segments which have the same TimeStamp
|
||||||
* @param aZone = zone segment within the zone to delete. Can be NULL
|
* @param aZone = zone segment within the zone to delete. Can be NULL
|
||||||
* @param aTimestamp = Timestamp for the zone to delete, used if aZone == NULL
|
* @param aTimestamp = Timestamp for the zone to delete, used if aZone == NULL
|
||||||
|
@ -53,12 +54,14 @@ void PCB_EDIT_FRAME::Delete_OldZone_Fill( SEGZONE* aZone, long aTimestamp )
|
||||||
TimeStamp = aZone->m_TimeStamp; // Save reference time stamp (aZone will be deleted)
|
TimeStamp = aZone->m_TimeStamp; // Save reference time stamp (aZone will be deleted)
|
||||||
|
|
||||||
SEGZONE* next;
|
SEGZONE* next;
|
||||||
|
|
||||||
for( SEGZONE* zone = GetBoard()->m_Zone; zone != NULL; zone = next )
|
for( SEGZONE* zone = GetBoard()->m_Zone; zone != NULL; zone = next )
|
||||||
{
|
{
|
||||||
next = zone->Next();
|
next = zone->Next();
|
||||||
|
|
||||||
if( zone->m_TimeStamp == TimeStamp )
|
if( zone->m_TimeStamp == TimeStamp )
|
||||||
{
|
{
|
||||||
modify = TRUE;
|
modify = true;
|
||||||
/* remove item from linked list and free memory */
|
/* remove item from linked list and free memory */
|
||||||
zone->DeleteStructure();
|
zone->DeleteStructure();
|
||||||
}
|
}
|
||||||
|
@ -116,7 +119,6 @@ int PCB_EDIT_FRAME::Fill_Zone( ZONE_CONTAINER* zone_container, bool verbose )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int PCB_EDIT_FRAME::Fill_All_Zones( bool verbose )
|
|
||||||
/**
|
/**
|
||||||
* Function Fill_All_Zones
|
* Function Fill_All_Zones
|
||||||
* Fill all zones on the board
|
* Fill all zones on the board
|
||||||
|
@ -124,6 +126,7 @@ int PCB_EDIT_FRAME::Fill_All_Zones( bool verbose )
|
||||||
* @param verbose = true to show error messages
|
* @param verbose = true to show error messages
|
||||||
* @return error level (0 = no error)
|
* @return error level (0 = no error)
|
||||||
*/
|
*/
|
||||||
|
int PCB_EDIT_FRAME::Fill_All_Zones( bool verbose )
|
||||||
{
|
{
|
||||||
int errorLevel = 0;
|
int errorLevel = 0;
|
||||||
int areaCount = GetBoard()->GetAreaCount();
|
int areaCount = GetBoard()->GetAreaCount();
|
||||||
|
@ -133,8 +136,7 @@ int PCB_EDIT_FRAME::Fill_All_Zones( bool verbose )
|
||||||
|
|
||||||
// Create a message with a long net name, and build a wxProgressDialog
|
// Create a message with a long net name, and build a wxProgressDialog
|
||||||
// with a correct size to show this long net name
|
// with a correct size to show this long net name
|
||||||
msg.Printf( FORMAT_STRING,
|
msg.Printf( FORMAT_STRING, 000, areaCount, wxT("XXXXXXXXXXXXXXXXX" ) );
|
||||||
000, areaCount, wxT("XXXXXXXXXXXXXXXXX" ) );
|
|
||||||
wxProgressDialog progressDialog( _( "Fill All Zones" ), msg,
|
wxProgressDialog progressDialog( _( "Fill All Zones" ), msg,
|
||||||
areaCount+2, this,
|
areaCount+2, this,
|
||||||
wxPD_AUTO_HIDE | wxPD_APP_MODAL | wxPD_CAN_ABORT );
|
wxPD_AUTO_HIDE | wxPD_APP_MODAL | wxPD_CAN_ABORT );
|
||||||
|
@ -145,11 +147,11 @@ int PCB_EDIT_FRAME::Fill_All_Zones( bool verbose )
|
||||||
GetBoard()->m_Zone.DeleteAll();
|
GetBoard()->m_Zone.DeleteAll();
|
||||||
|
|
||||||
int ii;
|
int ii;
|
||||||
|
|
||||||
for( ii = 0; ii < areaCount; ii++ )
|
for( ii = 0; ii < areaCount; ii++ )
|
||||||
{
|
{
|
||||||
ZONE_CONTAINER* zoneContainer = GetBoard()->GetArea( ii );
|
ZONE_CONTAINER* zoneContainer = GetBoard()->GetArea( ii );
|
||||||
msg.Printf( FORMAT_STRING,
|
msg.Printf( FORMAT_STRING, ii+1, areaCount, GetChars( zoneContainer->GetNetName() ) );
|
||||||
ii+1, areaCount, GetChars( zoneContainer->GetNetName() ) );
|
|
||||||
|
|
||||||
if( !progressDialog.Update( ii+1, msg ) )
|
if( !progressDialog.Update( ii+1, msg ) )
|
||||||
break;
|
break;
|
||||||
|
@ -159,6 +161,7 @@ int PCB_EDIT_FRAME::Fill_All_Zones( bool verbose )
|
||||||
if( errorLevel && !verbose )
|
if( errorLevel && !verbose )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
progressDialog.Update( ii+2, _( "Updating ratsnest..." ) );
|
progressDialog.Update( ii+2, _( "Updating ratsnest..." ) );
|
||||||
test_connexions( NULL );
|
test_connexions( NULL );
|
||||||
|
|
||||||
|
@ -168,5 +171,3 @@ int PCB_EDIT_FRAME::Fill_All_Zones( bool verbose )
|
||||||
|
|
||||||
return errorLevel;
|
return errorLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -9,9 +9,11 @@
|
||||||
* calculated from these items shapes and the clearance area
|
* calculated from these items shapes and the clearance area
|
||||||
*
|
*
|
||||||
* Important note:
|
* Important note:
|
||||||
* Because filled areas must have a minimum thickness to match with Design rule, they are draw in 2 step:
|
* Because filled areas must have a minimum thickness to match with Design rule, they are
|
||||||
|
* draw in 2 step:
|
||||||
* 1 - filled polygons are drawn
|
* 1 - filled polygons are drawn
|
||||||
* 2 - polygon outlines are drawn with a "minimum thickness width" ( or with a minimum thickness pen )
|
* 2 - polygon outlines are drawn with a "minimum thickness width" ( or with a minimum
|
||||||
|
* thickness pen )
|
||||||
* So outlines of filled polygons are calculated with the constraint they match with clearance,
|
* So outlines of filled polygons are calculated with the constraint they match with clearance,
|
||||||
* taking in account outlines have thickness
|
* taking in account outlines have thickness
|
||||||
* This ensures:
|
* This ensures:
|
||||||
|
@ -38,8 +40,10 @@ extern void BuildUnconnectedThermalStubsPolygonList( std::vector<CPolyPt>& aCorn
|
||||||
BOARD* aPcb, ZONE_CONTAINER* aZone,
|
BOARD* aPcb, ZONE_CONTAINER* aZone,
|
||||||
double aArcCorrection,
|
double aArcCorrection,
|
||||||
int aRoundPadThermalRotation);
|
int aRoundPadThermalRotation);
|
||||||
|
|
||||||
extern void Test_For_Copper_Island_And_Remove( BOARD* aPcb,
|
extern void Test_For_Copper_Island_And_Remove( BOARD* aPcb,
|
||||||
ZONE_CONTAINER* aZone_container );
|
ZONE_CONTAINER* aZone_container );
|
||||||
|
|
||||||
extern void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer,
|
extern void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer,
|
||||||
D_PAD& aPad,
|
D_PAD& aPad,
|
||||||
int aThermalGap,
|
int aThermalGap,
|
||||||
|
@ -55,6 +59,7 @@ static void AddPolygonCornersToKPolygonList( std::vector <CPolyPt>& aCornersBuff
|
||||||
|
|
||||||
static int CopyPolygonsFromKPolygonListToFilledPolysList( ZONE_CONTAINER* aZone,
|
static int CopyPolygonsFromKPolygonListToFilledPolysList( ZONE_CONTAINER* aZone,
|
||||||
KPolygonSet& aKPolyList );
|
KPolygonSet& aKPolyList );
|
||||||
|
|
||||||
static int CopyPolygonsFromFilledPolysListTotKPolygonList( ZONE_CONTAINER* aZone,
|
static int CopyPolygonsFromFilledPolysListTotKPolygonList( ZONE_CONTAINER* aZone,
|
||||||
KPolygonSet& aKPolyList );
|
KPolygonSet& aKPolyList );
|
||||||
|
|
||||||
|
@ -86,9 +91,10 @@ double s_Correction; /* mult coeff used to enlarge rounded and oval pads (an
|
||||||
* 1 - Creates the main outline (zone outline) using a correction to shrink the resulting area
|
* 1 - Creates the main outline (zone outline) using a correction to shrink the resulting area
|
||||||
* with m_ZoneMinThickness/2 value.
|
* with m_ZoneMinThickness/2 value.
|
||||||
* The result is areas with a margin of m_ZoneMinThickness/2
|
* The result is areas with a margin of m_ZoneMinThickness/2
|
||||||
* When drawing outline with segments having a thickness of m_ZoneMinThickness, the outlines will
|
* When drawing outline with segments having a thickness of m_ZoneMinThickness, the
|
||||||
* match exactly the initial outlines
|
* outlines will match exactly the initial outlines
|
||||||
* 3 - Add all non filled areas (pads, tracks) in group B with a clearance of m_Clearance + m_ZoneMinThickness/2
|
* 3 - Add all non filled areas (pads, tracks) in group B with a clearance of m_Clearance +
|
||||||
|
* m_ZoneMinThickness/2
|
||||||
* in a buffer
|
* in a buffer
|
||||||
* - If Thermal shapes are wanted, add non filled area, in order to create these thermal shapes
|
* - If Thermal shapes are wanted, add non filled area, in order to create these thermal shapes
|
||||||
* 4 - calculates the polygon A - B
|
* 4 - calculates the polygon A - B
|
||||||
|
@ -134,8 +140,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
|
||||||
* the main polygon is stored in polyset_zone_solid_areas
|
* the main polygon is stored in polyset_zone_solid_areas
|
||||||
*/
|
*/
|
||||||
|
|
||||||
CopyPolygonsFromFilledPolysListTotKPolygonList( this,
|
CopyPolygonsFromFilledPolysListTotKPolygonList( this, polyset_zone_solid_areas );
|
||||||
polyset_zone_solid_areas );
|
|
||||||
polyset_zone_solid_areas -= margin;
|
polyset_zone_solid_areas -= margin;
|
||||||
|
|
||||||
if( polyset_zone_solid_areas.size() == 0 )
|
if( polyset_zone_solid_areas.size() == 0 )
|
||||||
|
@ -189,17 +194,21 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
|
||||||
{
|
{
|
||||||
for( D_PAD* pad = module->m_Pads; pad != NULL; pad = nextpad )
|
for( D_PAD* pad = module->m_Pads; pad != NULL; pad = nextpad )
|
||||||
{
|
{
|
||||||
nextpad = pad->Next(); // pad pointer can be modified by next code, so calculate the next pad here
|
nextpad = pad->Next(); // pad pointer can be modified by next code, so
|
||||||
|
// calculate the next pad here
|
||||||
|
|
||||||
if( !pad->IsOnLayer( GetLayer() ) )
|
if( !pad->IsOnLayer( GetLayer() ) )
|
||||||
{
|
{
|
||||||
/* Test for pads that are on top or bottom only and have a hole.
|
/* Test for pads that are on top or bottom only and have a hole.
|
||||||
* There are curious pads but they can be used for some components that are inside the
|
* There are curious pads but they can be used for some components that are
|
||||||
* board (in fact inside the hole. Some photo diodes and Leds are like this)
|
* inside the board (in fact inside the hole. Some photo diodes and Leds are
|
||||||
|
* like this)
|
||||||
*/
|
*/
|
||||||
if( (pad->m_Drill.x == 0) && (pad->m_Drill.y == 0) )
|
if( (pad->m_Drill.x == 0) && (pad->m_Drill.y == 0) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Use a dummy pad to calculate a hole shape that have the same dimension as the pad hole
|
// Use a dummy pad to calculate a hole shape that have the same dimension as
|
||||||
|
// the pad hole
|
||||||
dummypad.m_Size = pad->m_Drill;
|
dummypad.m_Size = pad->m_Drill;
|
||||||
dummypad.m_Orient = pad->m_Orient;
|
dummypad.m_Orient = pad->m_Orient;
|
||||||
dummypad.m_PadShape = pad->m_DrillShape;
|
dummypad.m_PadShape = pad->m_DrillShape;
|
||||||
|
@ -211,6 +220,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
|
||||||
{
|
{
|
||||||
item_clearance = pad->GetClearance() + margin;
|
item_clearance = pad->GetClearance() + margin;
|
||||||
item_boundingbox = pad->GetBoundingBox();
|
item_boundingbox = pad->GetBoundingBox();
|
||||||
|
|
||||||
if( item_boundingbox.Intersects( zone_boundingbox ) )
|
if( item_boundingbox.Intersects( zone_boundingbox ) )
|
||||||
{
|
{
|
||||||
int clearance = MAX( zone_clearance, item_clearance );
|
int clearance = MAX( zone_clearance, item_clearance );
|
||||||
|
@ -219,10 +229,12 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
|
||||||
s_CircleToSegmentsCount,
|
s_CircleToSegmentsCount,
|
||||||
s_Correction );
|
s_Correction );
|
||||||
}
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
int gap = zone_clearance;
|
int gap = zone_clearance;
|
||||||
|
|
||||||
if( (m_PadOption == PAD_NOT_IN_ZONE)
|
if( (m_PadOption == PAD_NOT_IN_ZONE)
|
||||||
|| (GetNet() == 0) || pad->m_PadShape == PAD_TRAPEZOID )
|
|| (GetNet() == 0) || pad->m_PadShape == PAD_TRAPEZOID )
|
||||||
|
|
||||||
|
@ -230,6 +242,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
|
||||||
// and i think it is good that shapes are not changed by thermal pads or others
|
// and i think it is good that shapes are not changed by thermal pads or others
|
||||||
{
|
{
|
||||||
item_boundingbox = pad->GetBoundingBox();
|
item_boundingbox = pad->GetBoundingBox();
|
||||||
|
|
||||||
if( item_boundingbox.Intersects( zone_boundingbox ) )
|
if( item_boundingbox.Intersects( zone_boundingbox ) )
|
||||||
{
|
{
|
||||||
pad->TransformShapeWithClearanceToPolygon( cornerBufferPolysToSubstract,
|
pad->TransformShapeWithClearanceToPolygon( cornerBufferPolysToSubstract,
|
||||||
|
@ -248,11 +261,13 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
|
||||||
{
|
{
|
||||||
if( !track->IsOnLayer( GetLayer() ) )
|
if( !track->IsOnLayer( GetLayer() ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( track->GetNet() == GetNet() && (GetNet() != 0) )
|
if( track->GetNet() == GetNet() && (GetNet() != 0) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
item_clearance = track->GetClearance() + margin;
|
item_clearance = track->GetClearance() + margin;
|
||||||
item_boundingbox = track->GetBoundingBox();
|
item_boundingbox = track->GetBoundingBox();
|
||||||
|
|
||||||
if( item_boundingbox.Intersects( zone_boundingbox ) )
|
if( item_boundingbox.Intersects( zone_boundingbox ) )
|
||||||
{
|
{
|
||||||
int clearance = MAX( zone_clearance, item_clearance );
|
int clearance = MAX( zone_clearance, item_clearance );
|
||||||
|
@ -273,9 +288,12 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
|
||||||
{
|
{
|
||||||
if( !item->IsOnLayer( GetLayer() ) )
|
if( !item->IsOnLayer( GetLayer() ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( item->Type() != TYPE_EDGE_MODULE )
|
if( item->Type() != TYPE_EDGE_MODULE )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
item_boundingbox = item->GetBoundingBox();
|
item_boundingbox = item->GetBoundingBox();
|
||||||
|
|
||||||
if( item_boundingbox.Intersects( zone_boundingbox ) )
|
if( item_boundingbox.Intersects( zone_boundingbox ) )
|
||||||
{
|
{
|
||||||
( (EDGE_MODULE*) item )->TransformShapeWithClearanceToPolygon(
|
( (EDGE_MODULE*) item )->TransformShapeWithClearanceToPolygon(
|
||||||
|
@ -301,7 +319,6 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
|
||||||
s_Correction );
|
s_Correction );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case TYPE_TEXTE:
|
case TYPE_TEXTE:
|
||||||
( (TEXTE_PCB*) item )->TransformShapeWithClearanceToPolygon(
|
( (TEXTE_PCB*) item )->TransformShapeWithClearanceToPolygon(
|
||||||
cornerBufferPolysToSubstract,
|
cornerBufferPolysToSubstract,
|
||||||
|
@ -329,6 +346,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
|
||||||
continue;
|
continue;
|
||||||
item_boundingbox = pad->GetBoundingBox();
|
item_boundingbox = pad->GetBoundingBox();
|
||||||
item_boundingbox.Inflate( m_ThermalReliefGapValue, m_ThermalReliefGapValue );
|
item_boundingbox.Inflate( m_ThermalReliefGapValue, m_ThermalReliefGapValue );
|
||||||
|
|
||||||
if( item_boundingbox.Intersects( zone_boundingbox ) )
|
if( item_boundingbox.Intersects( zone_boundingbox ) )
|
||||||
{
|
{
|
||||||
CreateThermalReliefPadPolygon( cornerBufferPolysToSubstract,
|
CreateThermalReliefPadPolygon( cornerBufferPolysToSubstract,
|
||||||
|
@ -348,8 +366,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
|
||||||
if( cornerBufferPolysToSubstract.size() > 0 )
|
if( cornerBufferPolysToSubstract.size() > 0 )
|
||||||
{
|
{
|
||||||
KPolygonSet polyset_holes;
|
KPolygonSet polyset_holes;
|
||||||
AddPolygonCornersToKPolygonList( cornerBufferPolysToSubstract,
|
AddPolygonCornersToKPolygonList( cornerBufferPolysToSubstract, polyset_holes );
|
||||||
polyset_holes );
|
|
||||||
// Remove holes from initial area.:
|
// Remove holes from initial area.:
|
||||||
polyset_zone_solid_areas -= polyset_holes;
|
polyset_zone_solid_areas -= polyset_holes;
|
||||||
}
|
}
|
||||||
|
@ -367,7 +384,8 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
|
||||||
{
|
{
|
||||||
cornerBufferPolysToSubstract.clear();
|
cornerBufferPolysToSubstract.clear();
|
||||||
// Test thermal stubs connections and add polygons to remove unconnected stubs.
|
// Test thermal stubs connections and add polygons to remove unconnected stubs.
|
||||||
BuildUnconnectedThermalStubsPolygonList( cornerBufferPolysToSubstract, aPcb, this, s_Correction, s_thermalRot );
|
BuildUnconnectedThermalStubsPolygonList( cornerBufferPolysToSubstract, aPcb, this,
|
||||||
|
s_Correction, s_thermalRot );
|
||||||
|
|
||||||
/* remove copper areas */
|
/* remove copper areas */
|
||||||
if( cornerBufferPolysToSubstract.size() )
|
if( cornerBufferPolysToSubstract.size() )
|
||||||
|
@ -379,6 +397,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
|
||||||
/* put these areas in m_FilledPolysList */
|
/* put these areas in m_FilledPolysList */
|
||||||
m_FilledPolysList.clear();
|
m_FilledPolysList.clear();
|
||||||
CopyPolygonsFromKPolygonListToFilledPolysList( this, polyset_zone_solid_areas );
|
CopyPolygonsFromKPolygonListToFilledPolysList( this, polyset_zone_solid_areas );
|
||||||
|
|
||||||
if( GetNet() > 0 )
|
if( GetNet() > 0 )
|
||||||
Test_For_Copper_Island_And_Remove_Insulated_Islands( aPcb );
|
Test_For_Copper_Island_And_Remove_Insulated_Islands( aPcb );
|
||||||
}
|
}
|
||||||
|
@ -387,8 +406,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
|
||||||
cornerBufferPolysToSubstract.clear();
|
cornerBufferPolysToSubstract.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddPolygonCornersToKPolygonList( std::vector <CPolyPt>&
|
void AddPolygonCornersToKPolygonList( std::vector <CPolyPt>& aCornersBuffer,
|
||||||
aCornersBuffer,
|
|
||||||
KPolygonSet& aKPolyList )
|
KPolygonSet& aKPolyList )
|
||||||
{
|
{
|
||||||
unsigned ii;
|
unsigned ii;
|
||||||
|
@ -396,6 +414,7 @@ void AddPolygonCornersToKPolygonList( std::vector <CPolyPt>&
|
||||||
std::vector<KPolyPoint> cornerslist;
|
std::vector<KPolyPoint> cornerslist;
|
||||||
|
|
||||||
int polycount = 0;
|
int polycount = 0;
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < aCornersBuffer.size(); ii++ )
|
for( unsigned ii = 0; ii < aCornersBuffer.size(); ii++ )
|
||||||
{
|
{
|
||||||
if( aCornersBuffer[ii].end_contour )
|
if( aCornersBuffer[ii].end_contour )
|
||||||
|
@ -408,10 +427,11 @@ void AddPolygonCornersToKPolygonList( std::vector <CPolyPt>&
|
||||||
{
|
{
|
||||||
KPolygon poly;
|
KPolygon poly;
|
||||||
cornerslist.clear();
|
cornerslist.clear();
|
||||||
|
|
||||||
for( ii = icnt; ii < aCornersBuffer.size(); ii++ )
|
for( ii = icnt; ii < aCornersBuffer.size(); ii++ )
|
||||||
{
|
{
|
||||||
cornerslist.push_back( KPolyPoint( aCornersBuffer[ii].x,
|
cornerslist.push_back( KPolyPoint( aCornersBuffer[ii].x, aCornersBuffer[ii].y ) );
|
||||||
aCornersBuffer[ii].y ) );
|
|
||||||
if( aCornersBuffer[ii].end_contour )
|
if( aCornersBuffer[ii].end_contour )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -423,9 +443,8 @@ void AddPolygonCornersToKPolygonList( std::vector <CPolyPt>&
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int CopyPolygonsFromKPolygonListToFilledPolysList( ZONE_CONTAINER*
|
int CopyPolygonsFromKPolygonListToFilledPolysList( ZONE_CONTAINER* aZone,
|
||||||
aZone, KPolygonSet&
|
KPolygonSet& aKPolyList )
|
||||||
aKPolyList )
|
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
|
@ -433,6 +452,7 @@ int CopyPolygonsFromKPolygonListToFilledPolysList( ZONE_CONTAINER*
|
||||||
{
|
{
|
||||||
KPolygon& poly = aKPolyList[ii];
|
KPolygon& poly = aKPolyList[ii];
|
||||||
CPolyPt corner( 0, 0, false );
|
CPolyPt corner( 0, 0, false );
|
||||||
|
|
||||||
for( unsigned jj = 0; jj < poly.size(); jj++ )
|
for( unsigned jj = 0; jj < poly.size(); jj++ )
|
||||||
{
|
{
|
||||||
KPolyPoint point = *(poly.begin() + jj);
|
KPolyPoint point = *(poly.begin() + jj);
|
||||||
|
@ -456,9 +476,8 @@ int CopyPolygonsFromKPolygonListToFilledPolysList( ZONE_CONTAINER*
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int CopyPolygonsFromFilledPolysListTotKPolygonList( ZONE_CONTAINER*
|
int CopyPolygonsFromFilledPolysListTotKPolygonList( ZONE_CONTAINER* aZone,
|
||||||
aZone, KPolygonSet&
|
KPolygonSet& aKPolyList )
|
||||||
aKPolyList )
|
|
||||||
{
|
{
|
||||||
unsigned corners_count = aZone->m_FilledPolysList.size();
|
unsigned corners_count = aZone->m_FilledPolysList.size();
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
@ -469,12 +488,14 @@ int CopyPolygonsFromFilledPolysListTotKPolygonList( ZONE_CONTAINER*
|
||||||
for( unsigned ii = 0; ii < corners_count; ii++ )
|
for( unsigned ii = 0; ii < corners_count; ii++ )
|
||||||
{
|
{
|
||||||
CPolyPt* corner = &aZone->m_FilledPolysList[ic];
|
CPolyPt* corner = &aZone->m_FilledPolysList[ic];
|
||||||
|
|
||||||
if( corner->end_contour )
|
if( corner->end_contour )
|
||||||
polycount++;
|
polycount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
aKPolyList.reserve( polycount );
|
aKPolyList.reserve( polycount );
|
||||||
std::vector<KPolyPoint> cornerslist;
|
std::vector<KPolyPoint> cornerslist;
|
||||||
|
|
||||||
while( ic < corners_count )
|
while( ic < corners_count )
|
||||||
{
|
{
|
||||||
cornerslist.clear();
|
cornerslist.clear();
|
||||||
|
@ -485,6 +506,7 @@ int CopyPolygonsFromFilledPolysListTotKPolygonList( ZONE_CONTAINER*
|
||||||
CPolyPt* corner = &aZone->m_FilledPolysList[ic];
|
CPolyPt* corner = &aZone->m_FilledPolysList[ic];
|
||||||
cornerslist.push_back( KPolyPoint( corner->x, corner->y ) );
|
cornerslist.push_back( KPolyPoint( corner->x, corner->y ) );
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
if( corner->end_contour )
|
if( corner->end_contour )
|
||||||
{
|
{
|
||||||
ic++;
|
ic++;
|
||||||
|
|
|
@ -9,9 +9,11 @@
|
||||||
* calculated from these items shapes and the clearance area
|
* calculated from these items shapes and the clearance area
|
||||||
*
|
*
|
||||||
* Important note:
|
* Important note:
|
||||||
* Because filled areas must have a minimum thickness to match with Design rule, they are draw in 2 step:
|
* Because filled areas must have a minimum thickness to match with Design rule, they are
|
||||||
|
* draw in 2 step:
|
||||||
* 1 - filled polygons are drawn
|
* 1 - filled polygons are drawn
|
||||||
* 2 - polygon outlines are drawn with a "minimum thickness width" ( or with a minimum thickness pen )
|
* 2 - polygon outlines are drawn with a "minimum thickness width" ( or with a minimum
|
||||||
|
* thickness pen )
|
||||||
* So outlines of filled polygons are calculated with the constraint they match with clearance,
|
* So outlines of filled polygons are calculated with the constraint they match with clearance,
|
||||||
* taking in account outlines have thickness
|
* taking in account outlines have thickness
|
||||||
* This ensures:
|
* This ensures:
|
||||||
|
@ -31,7 +33,8 @@
|
||||||
|
|
||||||
#include "PolyLine.h"
|
#include "PolyLine.h"
|
||||||
|
|
||||||
// Kbool 1.9 and before had sometimes problemes when calculating thermal shapes as polygons (this is the best solution)
|
// Kbool 1.9 and before had sometimes problemes when calculating thermal shapes as polygons
|
||||||
|
// (this is the best solution)
|
||||||
// Kbool 2.0 has solved some problems, but not all
|
// Kbool 2.0 has solved some problems, but not all
|
||||||
// Kbool 2.1 has solved some others problems, but not all
|
// Kbool 2.1 has solved some others problems, but not all
|
||||||
|
|
||||||
|
@ -47,8 +50,10 @@ extern void BuildUnconnectedThermalStubsPolygonList( std::vector<CPolyPt>& aCorn
|
||||||
BOARD* aPcb, ZONE_CONTAINER* aZone,
|
BOARD* aPcb, ZONE_CONTAINER* aZone,
|
||||||
double aArcCorrection,
|
double aArcCorrection,
|
||||||
int aRoundPadThermalRotation);
|
int aRoundPadThermalRotation);
|
||||||
|
|
||||||
extern void Test_For_Copper_Island_And_Remove( BOARD* aPcb,
|
extern void Test_For_Copper_Island_And_Remove( BOARD* aPcb,
|
||||||
ZONE_CONTAINER* aZone_container );
|
ZONE_CONTAINER* aZone_container );
|
||||||
|
|
||||||
extern void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer,
|
extern void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer,
|
||||||
D_PAD& aPad,
|
D_PAD& aPad,
|
||||||
int aThermalGap,
|
int aThermalGap,
|
||||||
|
@ -90,23 +95,27 @@ double s_Correction; /* mult coeff used to enlarge rounded and oval pads (an
|
||||||
* BuildFilledPolysListData() call this function just after creating the
|
* BuildFilledPolysListData() call this function just after creating the
|
||||||
* filled copper area polygon (without clearence areas
|
* filled copper area polygon (without clearence areas
|
||||||
* to do that this function:
|
* to do that this function:
|
||||||
* 1 - creates a Bool_Engine,with option: holes are linked to outer contours by double overlapping segments
|
* 1 - creates a Bool_Engine,with option: holes are linked to outer contours by double
|
||||||
* this means the created polygons have no holes (hole are linked to outer outline by double overlapped segments
|
* overlapping segments this means the created polygons have no holes (hole are linked
|
||||||
* and are therefore compatible with draw functions (DC draw polygons and Gerber or PS outputs)
|
* to outer outline by double overlapped segments and are therefore compatible with
|
||||||
|
* draw functions (DC draw polygons and Gerber or PS outputs)
|
||||||
* 2 - Add the main outline (zone outline) in group A
|
* 2 - Add the main outline (zone outline) in group A
|
||||||
* 3 - Creates a correction using BOOL_CORRECTION operation to shrink the resulting area
|
* 3 - Creates a correction using BOOL_CORRECTION operation to shrink the resulting area
|
||||||
* with m_ZoneMinThickness/2 value.
|
* with m_ZoneMinThickness/2 value.
|
||||||
* The result is areas with a margin of m_ZoneMinThickness/2
|
* The result is areas with a margin of m_ZoneMinThickness/2
|
||||||
* When drawing outline with segments having a thickness of m_ZoneMinThickness, the outlines will
|
* When drawing outline with segments having a thickness of m_ZoneMinThickness, the
|
||||||
|
* outlines will
|
||||||
* match exactly the initial outlines
|
* match exactly the initial outlines
|
||||||
* 4 - recreates the same Bool_Engine, with no correction
|
* 4 - recreates the same Bool_Engine, with no correction
|
||||||
* 5 - Add the main modified outline (zone outline) in group A
|
* 5 - Add the main modified outline (zone outline) in group A
|
||||||
* 6 - Add all non filled areas (pads, tracks) in group B with a clearance of m_Clearance + m_ZoneMinThickness/2
|
* 6 - Add all non filled areas (pads, tracks) in group B with a clearance of m_Clearance +
|
||||||
|
* m_ZoneMinThickness/2
|
||||||
* 7 - calculates the polygon A - B
|
* 7 - calculates the polygon A - B
|
||||||
* 8 - put resulting list of polygons (filled areas) in m_FilledPolysList
|
* 8 - put resulting list of polygons (filled areas) in m_FilledPolysList
|
||||||
* This zone contains pads with the same net.
|
* This zone contains pads with the same net.
|
||||||
* 9 - Remove insulated copper islands
|
* 9 - Remove insulated copper islands
|
||||||
* 10 - If Thermal shapes are wanted, remove copper around pads in zone, in order to create thes thermal shapes
|
* 10 - If Thermal shapes are wanted, remove copper around pads in zone, in order to create
|
||||||
|
* thes thermal shapes
|
||||||
* a - Creates a bool engine and add the last copper areas in group A
|
* a - Creates a bool engine and add the last copper areas in group A
|
||||||
* b - Add thermal shapes (non copper ares in group B
|
* b - Add thermal shapes (non copper ares in group B
|
||||||
* c - Calculates the polygon A - B
|
* c - Calculates the polygon A - B
|
||||||
|
@ -223,11 +232,13 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
|
||||||
MODULE dummymodule( aPcb ); // Creates a dummy parent
|
MODULE dummymodule( aPcb ); // Creates a dummy parent
|
||||||
D_PAD dummypad( &dummymodule );
|
D_PAD dummypad( &dummymodule );
|
||||||
D_PAD* nextpad;
|
D_PAD* nextpad;
|
||||||
|
|
||||||
for( MODULE* module = aPcb->m_Modules; module; module = module->Next() )
|
for( MODULE* module = aPcb->m_Modules; module; module = module->Next() )
|
||||||
{
|
{
|
||||||
for( D_PAD* pad = module->m_Pads; pad != NULL; pad = nextpad )
|
for( D_PAD* pad = module->m_Pads; pad != NULL; pad = nextpad )
|
||||||
{
|
{
|
||||||
nextpad = pad->Next(); // pad pointer can be modified by next code, so calculate the next pad here
|
nextpad = pad->Next(); // pad pointer can be modified by next code, so calculate the next pad here
|
||||||
|
|
||||||
if( !pad->IsOnLayer( GetLayer() ) )
|
if( !pad->IsOnLayer( GetLayer() ) )
|
||||||
{
|
{
|
||||||
/* Test fo pads that are on top or bottom only and have a hole.
|
/* Test fo pads that are on top or bottom only and have a hole.
|
||||||
|
@ -249,6 +260,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
|
||||||
{
|
{
|
||||||
item_clearance = pad->GetClearance() + margin;
|
item_clearance = pad->GetClearance() + margin;
|
||||||
item_boundingbox = pad->GetBoundingBox();
|
item_boundingbox = pad->GetBoundingBox();
|
||||||
|
|
||||||
if( item_boundingbox.Intersects( zone_boundingbox ) )
|
if( item_boundingbox.Intersects( zone_boundingbox ) )
|
||||||
{
|
{
|
||||||
int clearance = MAX( zone_clearance, item_clearance );
|
int clearance = MAX( zone_clearance, item_clearance );
|
||||||
|
@ -261,6 +273,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
|
||||||
}
|
}
|
||||||
|
|
||||||
int gap = zone_clearance;
|
int gap = zone_clearance;
|
||||||
|
|
||||||
if( (m_PadOption == PAD_NOT_IN_ZONE)
|
if( (m_PadOption == PAD_NOT_IN_ZONE)
|
||||||
|| (GetNet() == 0) || pad->m_PadShape == PAD_TRAPEZOID )
|
|| (GetNet() == 0) || pad->m_PadShape == PAD_TRAPEZOID )
|
||||||
|
|
||||||
|
@ -268,6 +281,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
|
||||||
// and i think it is good that shapes are not changed by thermal pads or others
|
// and i think it is good that shapes are not changed by thermal pads or others
|
||||||
{
|
{
|
||||||
item_boundingbox = pad->GetBoundingBox();
|
item_boundingbox = pad->GetBoundingBox();
|
||||||
|
|
||||||
if( item_boundingbox.Intersects( zone_boundingbox ) )
|
if( item_boundingbox.Intersects( zone_boundingbox ) )
|
||||||
{
|
{
|
||||||
pad->TransformShapeWithClearanceToPolygon( cornerBufferPolysToSubstract,
|
pad->TransformShapeWithClearanceToPolygon( cornerBufferPolysToSubstract,
|
||||||
|
@ -286,11 +300,13 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
|
||||||
{
|
{
|
||||||
if( !track->IsOnLayer( GetLayer() ) )
|
if( !track->IsOnLayer( GetLayer() ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( track->GetNet() == GetNet() && (GetNet() != 0) )
|
if( track->GetNet() == GetNet() && (GetNet() != 0) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
item_clearance = track->GetClearance() + margin;
|
item_clearance = track->GetClearance() + margin;
|
||||||
item_boundingbox = track->GetBoundingBox();
|
item_boundingbox = track->GetBoundingBox();
|
||||||
|
|
||||||
if( item_boundingbox.Intersects( zone_boundingbox ) )
|
if( item_boundingbox.Intersects( zone_boundingbox ) )
|
||||||
{
|
{
|
||||||
int clearance = MAX( zone_clearance, item_clearance );
|
int clearance = MAX( zone_clearance, item_clearance );
|
||||||
|
@ -311,9 +327,12 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
|
||||||
{
|
{
|
||||||
if( !item->IsOnLayer( GetLayer() ) )
|
if( !item->IsOnLayer( GetLayer() ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( item->Type() != TYPE_EDGE_MODULE )
|
if( item->Type() != TYPE_EDGE_MODULE )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
item_boundingbox = item->GetBoundingBox();
|
item_boundingbox = item->GetBoundingBox();
|
||||||
|
|
||||||
if( item_boundingbox.Intersects( zone_boundingbox ) )
|
if( item_boundingbox.Intersects( zone_boundingbox ) )
|
||||||
{
|
{
|
||||||
( (EDGE_MODULE*) item )->TransformShapeWithClearanceToPolygon(
|
( (EDGE_MODULE*) item )->TransformShapeWithClearanceToPolygon(
|
||||||
|
@ -355,17 +374,18 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
|
||||||
|
|
||||||
// cornerBufferPolysToSubstract contains polygons to substract,
|
// cornerBufferPolysToSubstract contains polygons to substract,
|
||||||
// prepare booleng to do that:
|
// prepare booleng to do that:
|
||||||
AddPolygonCornersToBoolengine( cornerBufferPolysToSubstract,
|
AddPolygonCornersToBoolengine( cornerBufferPolysToSubstract, booleng, GROUP_B );
|
||||||
booleng, GROUP_B );
|
|
||||||
|
|
||||||
#ifdef CREATE_KBOOL_KEY_FILES_FIRST_PASS
|
#ifdef CREATE_KBOOL_KEY_FILES_FIRST_PASS
|
||||||
for( unsigned icnt = 0; icnt < cornerBuffer.size(); )
|
for( unsigned icnt = 0; icnt < cornerBuffer.size(); )
|
||||||
{
|
{
|
||||||
StartKeyFilePolygon( 1 );
|
StartKeyFilePolygon( 1 );
|
||||||
|
|
||||||
for( ii = icnt; ii < cornerBuffer.size(); ii++ )
|
for( ii = icnt; ii < cornerBuffer.size(); ii++ )
|
||||||
{
|
{
|
||||||
AddKeyFilePointXY( cornerBufferPolysToSubstract[ii].x,
|
AddKeyFilePointXY( cornerBufferPolysToSubstract[ii].x,
|
||||||
cornerBufferPolysToSubstract[ii].y );
|
cornerBufferPolysToSubstract[ii].y );
|
||||||
|
|
||||||
if( cornerBufferPolysToSubstract[ii].end_contour )
|
if( cornerBufferPolysToSubstract[ii].end_contour )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -392,6 +412,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
|
||||||
m_FilledPolysList.clear();
|
m_FilledPolysList.clear();
|
||||||
CopyPolygonsFromBoolengineToFilledPolysList( booleng );
|
CopyPolygonsFromBoolengineToFilledPolysList( booleng );
|
||||||
}
|
}
|
||||||
|
|
||||||
delete booleng;
|
delete booleng;
|
||||||
|
|
||||||
// Remove insulated islands:
|
// Remove insulated islands:
|
||||||
|
@ -404,6 +425,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
|
||||||
|
|
||||||
// Remove thermal symbols
|
// Remove thermal symbols
|
||||||
cornerBufferPolysToSubstract.clear();
|
cornerBufferPolysToSubstract.clear();
|
||||||
|
|
||||||
if( m_PadOption == THERMAL_PAD )
|
if( m_PadOption == THERMAL_PAD )
|
||||||
{
|
{
|
||||||
booleng = new Bool_Engine();
|
booleng = new Bool_Engine();
|
||||||
|
@ -424,8 +446,10 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
|
||||||
|
|
||||||
if( pad->GetNet() != GetNet() )
|
if( pad->GetNet() != GetNet() )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
item_boundingbox = pad->GetBoundingBox();
|
item_boundingbox = pad->GetBoundingBox();
|
||||||
item_boundingbox.Inflate( m_ThermalReliefGapValue );
|
item_boundingbox.Inflate( m_ThermalReliefGapValue );
|
||||||
|
|
||||||
if( item_boundingbox.Intersects( zone_boundingbox ) )
|
if( item_boundingbox.Intersects( zone_boundingbox ) )
|
||||||
{
|
{
|
||||||
CreateThermalReliefPadPolygon( cornerBufferPolysToSubstract,
|
CreateThermalReliefPadPolygon( cornerBufferPolysToSubstract,
|
||||||
|
@ -447,8 +471,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
|
||||||
|
|
||||||
// cornerBufferPolysToSubstract contains polygons to substract,
|
// cornerBufferPolysToSubstract contains polygons to substract,
|
||||||
// prepare booleng to do that:
|
// prepare booleng to do that:
|
||||||
AddPolygonCornersToBoolengine( cornerBufferPolysToSubstract,
|
AddPolygonCornersToBoolengine( cornerBufferPolysToSubstract, booleng, GROUP_B );
|
||||||
booleng, GROUP_B );
|
|
||||||
|
|
||||||
/* remove thermal areas (non copper areas) */
|
/* remove thermal areas (non copper areas) */
|
||||||
booleng->Do_Operation( BOOL_A_SUB_B );
|
booleng->Do_Operation( BOOL_A_SUB_B );
|
||||||
|
@ -456,19 +479,23 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
|
||||||
m_FilledPolysList.clear();
|
m_FilledPolysList.clear();
|
||||||
CopyPolygonsFromBoolengineToFilledPolysList( booleng );
|
CopyPolygonsFromBoolengineToFilledPolysList( booleng );
|
||||||
}
|
}
|
||||||
|
|
||||||
delete booleng;
|
delete booleng;
|
||||||
|
|
||||||
// Remove insulated islands:
|
// Remove insulated islands:
|
||||||
if( GetNet() > 0 )
|
if( GetNet() > 0 )
|
||||||
Test_For_Copper_Island_And_Remove_Insulated_Islands( aPcb );
|
Test_For_Copper_Island_And_Remove_Insulated_Islands( aPcb );
|
||||||
|
|
||||||
#ifdef CREATE_KBOOL_KEY_FILES
|
#ifdef CREATE_KBOOL_KEY_FILES
|
||||||
for( unsigned icnt = 0; icnt < cornerBufferPolysToSubstract.size(); )
|
for( unsigned icnt = 0; icnt < cornerBufferPolysToSubstract.size(); )
|
||||||
{
|
{
|
||||||
StartKeyFilePolygon( 1 );
|
StartKeyFilePolygon( 1 );
|
||||||
|
|
||||||
for( ii = icnt; ii < cornerBufferPolysToSubstract.size(); ii++ )
|
for( ii = icnt; ii < cornerBufferPolysToSubstract.size(); ii++ )
|
||||||
{
|
{
|
||||||
AddKeyFilePointXY( cornerBufferPolysToSubstract[ii].x,
|
AddKeyFilePointXY( cornerBufferPolysToSubstract[ii].x,
|
||||||
cornerBufferPolysToSubstract[ii].y );
|
cornerBufferPolysToSubstract[ii].y );
|
||||||
|
|
||||||
if( cornerBufferPolysToSubstract[ii].end_contour )
|
if( cornerBufferPolysToSubstract[ii].end_contour )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -477,6 +504,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
|
||||||
icnt = ii + 1;
|
icnt = ii + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CloseKeyFileEntity();
|
CloseKeyFileEntity();
|
||||||
CloseKeyFile();
|
CloseKeyFile();
|
||||||
#endif
|
#endif
|
||||||
|
@ -490,7 +518,9 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
|
||||||
booleng = new Bool_Engine();
|
booleng = new Bool_Engine();
|
||||||
ArmBoolEng( booleng, true );
|
ArmBoolEng( booleng, true );
|
||||||
cornerBufferPolysToSubstract.clear();
|
cornerBufferPolysToSubstract.clear();
|
||||||
BuildUnconnectedThermalStubsPolygonList( cornerBufferPolysToSubstract, aPcb, this, s_Correction, s_thermalRot );
|
BuildUnconnectedThermalStubsPolygonList( cornerBufferPolysToSubstract, aPcb, this,
|
||||||
|
s_Correction, s_thermalRot );
|
||||||
|
|
||||||
/* remove copper areas */
|
/* remove copper areas */
|
||||||
if( cornerBufferPolysToSubstract.size() )
|
if( cornerBufferPolysToSubstract.size() )
|
||||||
{
|
{
|
||||||
|
@ -531,9 +561,11 @@ void AddPolygonCornersToBoolengine( std::vector <CPolyPt>& aCornersBuffer,
|
||||||
for( unsigned icnt = 0; icnt < aCornersBuffer.size(); )
|
for( unsigned icnt = 0; icnt < aCornersBuffer.size(); )
|
||||||
{
|
{
|
||||||
aBoolengine->StartPolygonAdd( aGroup );
|
aBoolengine->StartPolygonAdd( aGroup );
|
||||||
|
|
||||||
for( ii = icnt; ii < aCornersBuffer.size(); ii++ )
|
for( ii = icnt; ii < aCornersBuffer.size(); ii++ )
|
||||||
{
|
{
|
||||||
aBoolengine->AddPoint( aCornersBuffer[ii].x, aCornersBuffer[ii].y );
|
aBoolengine->AddPoint( aCornersBuffer[ii].x, aCornersBuffer[ii].y );
|
||||||
|
|
||||||
if( aCornersBuffer[ii].end_contour )
|
if( aCornersBuffer[ii].end_contour )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -544,11 +576,6 @@ void AddPolygonCornersToBoolengine( std::vector <CPolyPt>& aCornersBuffer,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************************************************/
|
|
||||||
int ZONE_CONTAINER::CopyPolygonsFromFilledPolysListToBoolengine( Bool_Engine* aBoolengine,
|
|
||||||
GroupType aGroup )
|
|
||||||
/************************************************************************************************************/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function CopyPolygonsFromFilledPolysListToBoolengine
|
* Function CopyPolygonsFromFilledPolysListToBoolengine
|
||||||
* Copy (Add) polygons found in m_FilledPolysList to kbool BoolEngine
|
* Copy (Add) polygons found in m_FilledPolysList to kbool BoolEngine
|
||||||
|
@ -557,6 +584,8 @@ int ZONE_CONTAINER::CopyPolygonsFromFilledPolysListToBoolengine( Bool_Engine* aB
|
||||||
* @param aGroup = group in kbool engine (GROUP_A or GROUP_B only)
|
* @param aGroup = group in kbool engine (GROUP_A or GROUP_B only)
|
||||||
* @return the corner count
|
* @return the corner count
|
||||||
*/
|
*/
|
||||||
|
int ZONE_CONTAINER::CopyPolygonsFromFilledPolysListToBoolengine( Bool_Engine* aBoolengine,
|
||||||
|
GroupType aGroup )
|
||||||
{
|
{
|
||||||
unsigned corners_count = m_FilledPolysList.size();
|
unsigned corners_count = m_FilledPolysList.size();
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
@ -571,6 +600,7 @@ int ZONE_CONTAINER::CopyPolygonsFromFilledPolysListToBoolengine( Bool_Engine* aB
|
||||||
CPolyPt* corner = &m_FilledPolysList[ic];
|
CPolyPt* corner = &m_FilledPolysList[ic];
|
||||||
aBoolengine->AddPoint( corner->x, corner->y );
|
aBoolengine->AddPoint( corner->x, corner->y );
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
if( corner->end_contour )
|
if( corner->end_contour )
|
||||||
{
|
{
|
||||||
ic++;
|
ic++;
|
||||||
|
@ -586,22 +616,20 @@ int ZONE_CONTAINER::CopyPolygonsFromFilledPolysListToBoolengine( Bool_Engine* aB
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************************/
|
|
||||||
int ZONE_CONTAINER::CopyPolygonsFromBoolengineToFilledPolysList( Bool_Engine* aBoolengine )
|
|
||||||
/*****************************************************************************************/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function CopyPolygonsFromBoolengineToFilledPolysList
|
* Function CopyPolygonsFromBoolengineToFilledPolysList
|
||||||
* Copy (Add) polygons created by kbool (after Do_Operation) to m_FilledPolysList
|
* Copy (Add) polygons created by kbool (after Do_Operation) to m_FilledPolysList
|
||||||
* @param aBoolengine = kbool engine
|
* @param aBoolengine = kbool engine
|
||||||
* @return the corner count
|
* @return the corner count
|
||||||
*/
|
*/
|
||||||
|
int ZONE_CONTAINER::CopyPolygonsFromBoolengineToFilledPolysList( Bool_Engine* aBoolengine )
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
while( aBoolengine->StartPolygonGet() )
|
while( aBoolengine->StartPolygonGet() )
|
||||||
{
|
{
|
||||||
CPolyPt corner( 0, 0, false );
|
CPolyPt corner( 0, 0, false );
|
||||||
|
|
||||||
while( aBoolengine->PolygonHasMorePoints() )
|
while( aBoolengine->PolygonHasMorePoints() )
|
||||||
{
|
{
|
||||||
corner.x = (int) aBoolengine->GetPolygonXPoint();
|
corner.x = (int) aBoolengine->GetPolygonXPoint();
|
||||||
|
|
|
@ -38,12 +38,10 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************************/
|
|
||||||
DialogNonCopperZonesEditor::DialogNonCopperZonesEditor( PCB_EDIT_FRAME* parent,
|
DialogNonCopperZonesEditor::DialogNonCopperZonesEditor( PCB_EDIT_FRAME* parent,
|
||||||
ZONE_CONTAINER* zone_container,
|
ZONE_CONTAINER* zone_container,
|
||||||
ZONE_SETTING* zone_setting ) :
|
ZONE_SETTING* zone_setting ) :
|
||||||
DialogNonCopperZonesPropertiesBase( parent )
|
DialogNonCopperZonesPropertiesBase( parent )
|
||||||
/*******************************************************************************************/
|
|
||||||
{
|
{
|
||||||
m_Parent = parent;
|
m_Parent = parent;
|
||||||
m_Zone_Container = zone_container;
|
m_Zone_Container = zone_container;
|
||||||
|
@ -54,9 +52,7 @@ DialogNonCopperZonesEditor::DialogNonCopperZonesEditor( PCB_EDIT_FRAME* parent,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************************************/
|
|
||||||
DialogNonCopperZonesEditor::~DialogNonCopperZonesEditor()
|
DialogNonCopperZonesEditor::~DialogNonCopperZonesEditor()
|
||||||
/********************************************************/
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,9 +66,7 @@ bool PCB_EDIT_FRAME::InstallDialogNonCopperZonesEditor( ZONE_CONTAINER* aZone )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************************************************/
|
|
||||||
void DialogNonCopperZonesEditor::Init()
|
void DialogNonCopperZonesEditor::Init()
|
||||||
/********************************************************************/
|
|
||||||
{
|
{
|
||||||
SetFocus();
|
SetFocus();
|
||||||
SetReturnCode( ZONE_ABORT ); // Will be changed on buttons click
|
SetReturnCode( ZONE_ABORT ); // Will be changed on buttons click
|
||||||
|
@ -126,18 +120,16 @@ void DialogNonCopperZonesEditor::Init()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************/
|
|
||||||
void DialogNonCopperZonesEditor::OnOkClick( wxCommandEvent& event )
|
void DialogNonCopperZonesEditor::OnOkClick( wxCommandEvent& event )
|
||||||
/******************************************************************/
|
|
||||||
{
|
{
|
||||||
wxString txtvalue = m_ZoneMinThicknessCtrl->GetValue();
|
wxString txtvalue = m_ZoneMinThicknessCtrl->GetValue();
|
||||||
m_Zone_Setting->m_ZoneMinThickness =
|
m_Zone_Setting->m_ZoneMinThickness =
|
||||||
ReturnValueFromString( g_UserUnit, txtvalue, m_Parent->m_InternalUnits );
|
ReturnValueFromString( g_UserUnit, txtvalue, m_Parent->m_InternalUnits );
|
||||||
|
|
||||||
if( m_Zone_Setting->m_ZoneMinThickness < 10 )
|
if( m_Zone_Setting->m_ZoneMinThickness < 10 )
|
||||||
{
|
{
|
||||||
DisplayError( this,
|
DisplayError( this,
|
||||||
_(
|
_( "Error :\nyou must choose a copper min thickness value bigger than 0.001 inch (or 0.0254 mm)" ) );
|
||||||
"Error :\nyou must choose a copper min thickness value bigger than 0.001 inch (or 0.0254 mm)" ) );
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,25 +157,25 @@ void DialogNonCopperZonesEditor::OnOkClick( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_OrientEdgesOpt->GetSelection() == 0 )
|
if( m_OrientEdgesOpt->GetSelection() == 0 )
|
||||||
g_Zone_45_Only = FALSE;
|
g_Zone_45_Only = false;
|
||||||
else
|
else
|
||||||
g_Zone_45_Only = TRUE;
|
g_Zone_45_Only = true;
|
||||||
|
|
||||||
/* Get the layer selection for this zone */
|
/* Get the layer selection for this zone */
|
||||||
int ii = m_LayerSelectionCtrl->GetSelection();
|
int ii = m_LayerSelectionCtrl->GetSelection();
|
||||||
|
|
||||||
if( ii < 0 )
|
if( ii < 0 )
|
||||||
{
|
{
|
||||||
DisplayError( this, _( "Error : you must choose a layer" ) );
|
DisplayError( this, _( "Error : you must choose a layer" ) );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_Zone_Default_Setting.m_CurrentZone_Layer = ii + FIRST_NO_COPPER_LAYER;
|
g_Zone_Default_Setting.m_CurrentZone_Layer = ii + FIRST_NO_COPPER_LAYER;
|
||||||
EndModal( ZONE_OK );
|
EndModal( ZONE_OK );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************/
|
|
||||||
void DialogNonCopperZonesEditor::OnCancelClick( wxCommandEvent& event )
|
void DialogNonCopperZonesEditor::OnCancelClick( wxCommandEvent& event )
|
||||||
/**********************************************************************/
|
|
||||||
{
|
{
|
||||||
EndModal( ZONE_ABORT );
|
EndModal( ZONE_ABORT );
|
||||||
}
|
}
|
||||||
|
|
|
@ -1019,7 +1019,7 @@ bool DRC::doEdgeZoneDrc( ZONE_CONTAINER* aArea, int aCornerIndex )
|
||||||
wxPoint end;
|
wxPoint end;
|
||||||
|
|
||||||
// Search the end point of the edge starting at aCornerIndex
|
// Search the end point of the edge starting at aCornerIndex
|
||||||
if( aArea->m_Poly->corner[aCornerIndex].end_contour == FALSE
|
if( aArea->m_Poly->corner[aCornerIndex].end_contour == false
|
||||||
&& aCornerIndex < (aArea->GetNumCorners() - 1) )
|
&& aCornerIndex < (aArea->GetNumCorners() - 1) )
|
||||||
{
|
{
|
||||||
end = aArea->GetCornerPosition( aCornerIndex + 1 );
|
end = aArea->GetCornerPosition( aCornerIndex + 1 );
|
||||||
|
|
Loading…
Reference in New Issue