mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-11 00:30:01 +00:00
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
3d-viewer
cvpcb
gerbview
include
pcbnew
attribut.cppautomove.cppautoplac.cppbasepcbframe.cppblock.cppblock_module_editor.cppboard.cppboard_items_to_polygon_shape_transform.cppboard_undo_redo.cppclass_board.cppclass_board.hclass_dimension.cppclass_drawsegment.cppclass_edge_mod.cppclass_mire.cppclass_mire.hclass_module.cppclass_module.hclass_module_transform_functions.cppclass_pad.cppclass_pad.hclass_pad_draw_functions.cppclass_track.cppclass_zone.cppclass_zone.hclean.cppcollectors.cppconnect.cppdeltrack.cpp
dialogs
drag.hdragsegm.cppdrc.cppdrc_clearance_test_functions.cppedgemod.cppedit.cppedit_pcb_text.cppedit_track_width.cppeditedge.cppeditmod.cppeditrack-part2.cppeditrack.cppedtxtmod.cppexport_gencad.cppexport_vrml.cppfind.cppgen_drill_report_files.cppgen_modules_placefile.cppglobaleditpad.cppgpcb_exchange.cppgraphpcb.cpphotkeys_board_editor.cppinitpcb.cppioascii.cpplocate.cppmagnetic_tracks_functions.cppmirepcb.cppmodedit.cppmodedit_onclick.cppmodules.cppmove-drag_pads.cppmove_or_drag_track.cppmuonde.cpponleftclick.cpponrightclick.cpppcbnew_config.cpppcbplot.hplot_rtn.cppplothpgl.cppplotps.cppprint_board_functions.cppprotos.hratsnest.cppsolve.cppspecctra_export.cppspecctra_import.cppswap_layers.cpptr_modif.cpptracepcb.cpptrack.cpptrpiste.cppzones_by_polygon.cppzones_by_polygon_fill_functions.cppzones_convert_brd_items_to_polygons_with_Boost.cppzones_convert_brd_items_to_polygons_with_Kbool.cppzones_non_copper_type_functions.cppzones_test_and_combine_areas.cpp@ -92,7 +92,9 @@ void Pcb3D_GLCanvas::Redraw( bool finish )
|
||||
glRotatef( g_Parm_3D_Visu.m_Rot[2], 0.0, 0.0, 1.0 );
|
||||
|
||||
if( m_gllist )
|
||||
{
|
||||
glCallList( m_gllist );
|
||||
}
|
||||
else
|
||||
{
|
||||
CreateDrawGL_List();
|
||||
@ -146,9 +148,8 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
|
||||
for( ii = 0; ii < 32; ii++ )
|
||||
{
|
||||
if( ii < g_Parm_3D_Visu.m_Layers )
|
||||
g_Parm_3D_Visu.m_LayerZcoord[ii] =
|
||||
g_Parm_3D_Visu.m_Epoxy_Width
|
||||
* ii / (g_Parm_3D_Visu.m_Layers - 1);
|
||||
g_Parm_3D_Visu.m_LayerZcoord[ii] = g_Parm_3D_Visu.m_Epoxy_Width
|
||||
* ii / (g_Parm_3D_Visu.m_Layers - 1);
|
||||
else
|
||||
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++ )
|
||||
{
|
||||
ZONE_CONTAINER* zone = pcb->GetArea( ii );
|
||||
|
||||
if( zone->m_FilledPolysList.size() == 0 )
|
||||
continue;
|
||||
|
||||
if( zone->m_ZoneMinThickness <= 1 )
|
||||
continue;
|
||||
|
||||
int imax = zone->m_FilledPolysList.size() - 1;
|
||||
CPolyPt* firstcorner = &zone->m_FilledPolysList[0];
|
||||
CPolyPt* begincorner = firstcorner;
|
||||
SEGZONE dummysegment( pcb );
|
||||
dummysegment.SetLayer( zone->GetLayer() );
|
||||
dummysegment.m_Width = zone->m_ZoneMinThickness;
|
||||
|
||||
for( int ic = 1; ic <= imax; ic++ )
|
||||
{
|
||||
CPolyPt* endcorner = &zone->m_FilledPolysList[ic];
|
||||
@ -312,13 +317,16 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
|
||||
|
||||
Draw3D_Track( &dummysegment );
|
||||
}
|
||||
|
||||
ic++;
|
||||
|
||||
if( ic < imax - 1 )
|
||||
begincorner = firstcorner =
|
||||
&zone->m_FilledPolysList[ic];
|
||||
begincorner = firstcorner = &zone->m_FilledPolysList[ic];
|
||||
}
|
||||
else
|
||||
{
|
||||
begincorner = endcorner;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -345,6 +353,7 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
|
||||
|
||||
/* draw footprints */
|
||||
MODULE* Module = pcb->m_Modules;
|
||||
|
||||
for( ; Module != NULL; Module = Module->Next() )
|
||||
{
|
||||
Module->Draw3D( this );
|
||||
@ -373,6 +382,7 @@ void Pcb3D_GLCanvas::Draw3D_Track( TRACK* track )
|
||||
|
||||
if( layer == LAST_COPPER_LAYER )
|
||||
layer = g_Parm_3D_Visu.m_Layers - 1;
|
||||
|
||||
zpos = g_Parm_3D_Visu.m_LayerZcoord[layer];
|
||||
|
||||
SetGLColor( color );
|
||||
@ -404,6 +414,7 @@ void Pcb3D_GLCanvas::Draw3D_SolidPolygonsInZones( ZONE_CONTAINER* aZone )
|
||||
|
||||
if( layer == LAST_COPPER_LAYER )
|
||||
layer = g_Parm_3D_Visu.m_Layers - 1;
|
||||
|
||||
zpos = g_Parm_3D_Visu.m_LayerZcoord[layer];
|
||||
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];
|
||||
if( layer < g_Parm_3D_Visu.m_Layers - 1 )
|
||||
{
|
||||
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) ==
|
||||
false )
|
||||
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) == false )
|
||||
continue;
|
||||
|
||||
color = g_ColorsSettings.GetLayerColor( layer );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( LAYER_N_FRONT ) ==
|
||||
false )
|
||||
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( LAYER_N_FRONT ) == false )
|
||||
continue;
|
||||
|
||||
color = g_ColorsSettings.GetLayerColor( LAYER_N_FRONT );
|
||||
}
|
||||
|
||||
@ -488,11 +499,14 @@ void Pcb3D_GLCanvas::Draw3D_Via( SEGVIA* via )
|
||||
|
||||
// SetGLColor( LIGHTGRAY );
|
||||
glNormal3f( 0.0, 0.0, (layer == LAYER_N_BACK) ? -1.0 : 1.0 );
|
||||
|
||||
if( layer == LAYER_N_BACK )
|
||||
zpos = zpos - 5 * g_Parm_3D_Visu.m_BoardScale;
|
||||
else
|
||||
zpos = zpos + 5 * g_Parm_3D_Visu.m_BoardScale;
|
||||
|
||||
Draw3D_FilledCircle( x, -y, r, hole, zpos );
|
||||
|
||||
if( layer >= top_layer )
|
||||
break;
|
||||
}
|
||||
@ -500,10 +514,8 @@ void Pcb3D_GLCanvas::Draw3D_Via( SEGVIA* via )
|
||||
// Drawing hole:
|
||||
color = g_ColorsSettings.GetItemColor( VIAS_VISIBLE + via->m_Shape );
|
||||
SetGLColor( color );
|
||||
height = g_Parm_3D_Visu.m_LayerZcoord[top_layer] -
|
||||
g_Parm_3D_Visu.m_LayerZcoord[bottom_layer];
|
||||
Draw3D_FilledCylinder( x, -y, hole, height,
|
||||
g_Parm_3D_Visu.m_LayerZcoord[bottom_layer] );
|
||||
height = g_Parm_3D_Visu.m_LayerZcoord[top_layer] - 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 ) );
|
||||
zpos = g_Parm_3D_Visu.m_LayerZcoord[layer];
|
||||
|
||||
if( Get3DLayerEnable( layer ) )
|
||||
{
|
||||
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 endy = yf * g_Parm_3D_Visu.m_BoardScale;
|
||||
|
||||
Draw3D_FilledSegment( startx, -starty, endx, -endy,
|
||||
s_Text3DWidth, s_Text3DZPos );
|
||||
Draw3D_FilledSegment( startx, -starty, endx, -endy, s_Text3DWidth, s_Text3DZPos );
|
||||
}
|
||||
|
||||
|
||||
@ -605,14 +617,15 @@ void Pcb3D_GLCanvas::Draw3D_DrawText( TEXTE_PCB* text )
|
||||
|
||||
int color = g_ColorsSettings.GetLayerColor( layer );
|
||||
|
||||
|
||||
SetGLColor( color );
|
||||
s_Text3DZPos = g_Parm_3D_Visu.m_LayerZcoord[layer];
|
||||
s_Text3DWidth = text->m_Thickness * g_Parm_3D_Visu.m_BoardScale;
|
||||
glNormal3f( 0.0, 0.0, Get3DLayerSide( layer ) );
|
||||
wxSize size = text->m_Size;
|
||||
|
||||
if( text->m_Mirror )
|
||||
NEGATE( size.x );
|
||||
|
||||
if( text->m_MultilineAllowed )
|
||||
{
|
||||
wxPoint pos = text->m_Pos;
|
||||
@ -622,6 +635,7 @@ void Pcb3D_GLCanvas::Draw3D_DrawText( TEXTE_PCB* text )
|
||||
offset.y = text->GetInterline();
|
||||
|
||||
RotatePoint( &offset, text->m_Orient );
|
||||
|
||||
for( unsigned i = 0; i<list->Count(); i++ )
|
||||
{
|
||||
wxString txt = list->Item( i );
|
||||
@ -636,12 +650,14 @@ void Pcb3D_GLCanvas::Draw3D_DrawText( TEXTE_PCB* text )
|
||||
delete (list);
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawGraphicText( NULL, NULL, text->m_Pos, (EDA_Colors) color,
|
||||
text->m_Text, text->m_Orient, size,
|
||||
text->m_HJustify, text->m_VJustify,
|
||||
text->m_Thickness, text->m_Italic,
|
||||
true,
|
||||
Draw3dTextSegm );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -652,6 +668,7 @@ void MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas )
|
||||
/* Draw pads */
|
||||
glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
|
||||
glNormal3f( 0.0, 0.0, 1.0 ); // Normal is Z axis
|
||||
|
||||
for( ; pad != NULL; pad = pad->Next() )
|
||||
{
|
||||
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, 0.0, 1.0 );
|
||||
}
|
||||
|
||||
DataScale3D = g_Parm_3D_Visu.m_BoardScale * UNITS3D_TO_UNITSPCB;
|
||||
|
||||
for( ; Struct3D != NULL; Struct3D = Struct3D->Next() )
|
||||
@ -789,7 +807,7 @@ void EDGE_MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas )
|
||||
default:
|
||||
s.Printf( wxT( "Error: Shape nr %d not implemented!\n" ), m_Shape );
|
||||
D( printf( "%s", TO_UTF8( s ) ); )
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -837,7 +855,7 @@ void EDGE_MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas )
|
||||
default:
|
||||
s.Printf( wxT( "Error: Shape nr %d not implemented!\n" ), m_Shape );
|
||||
D( printf( "%s", TO_UTF8( s ) ); )
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -889,8 +907,8 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
|
||||
|
||||
glNormal3f( 0.0, 0.0, 1.0 ); // Normal is Z axis
|
||||
nlmax = g_Parm_3D_Visu.m_Layers - 1;
|
||||
Oncu = (m_Masque_Layer & LAYER_BACK) ? TRUE : FALSE;
|
||||
Oncmp = (m_Masque_Layer & LAYER_FRONT) ? TRUE : FALSE;
|
||||
Oncu = (m_layerMask & LAYER_BACK) ? TRUE : FALSE;
|
||||
Oncmp = (m_layerMask & LAYER_FRONT) ? TRUE : FALSE;
|
||||
Both = Oncu && Oncmp;
|
||||
|
||||
switch( m_PadShape & 0x7F )
|
||||
@ -899,29 +917,35 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
|
||||
x = xc * scale;
|
||||
y = yc * scale;
|
||||
r = (double) dx * scale;
|
||||
|
||||
for( layer = FIRST_COPPER_LAYER; layer <= LAST_COPPER_LAYER; layer++ )
|
||||
{
|
||||
if( layer && (layer == nlmax) )
|
||||
layer = LAYER_N_FRONT;
|
||||
|
||||
if( (layer == LAYER_N_FRONT) && !Oncmp )
|
||||
continue;
|
||||
|
||||
if( (layer == LAYER_N_BACK) && !Oncu )
|
||||
continue;
|
||||
if( (layer > FIRST_COPPER_LAYER) && (layer < LAST_COPPER_LAYER)
|
||||
&& !Both )
|
||||
|
||||
if( (layer > FIRST_COPPER_LAYER) && (layer < LAST_COPPER_LAYER) && !Both )
|
||||
continue;
|
||||
|
||||
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;
|
||||
|
||||
SetGLColor( color );
|
||||
glNormal3f( 0.0, 0.0, (layer == LAYER_N_BACK) ? -1.0 : 1.0 );
|
||||
zpos = g_Parm_3D_Visu.m_LayerZcoord[layer];
|
||||
|
||||
if( layer == LAYER_N_BACK )
|
||||
zpos = zpos - 5 * g_Parm_3D_Visu.m_BoardScale;
|
||||
else
|
||||
zpos = zpos + 5 * g_Parm_3D_Visu.m_BoardScale;
|
||||
|
||||
Draw3D_FilledCircle( x, -y, r, hole, zpos );
|
||||
}
|
||||
|
||||
@ -940,42 +964,48 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
|
||||
delta_cy = dy - dx;
|
||||
w = m_Size.x * scale;
|
||||
}
|
||||
|
||||
RotatePoint( &delta_cx, &delta_cy, angle );
|
||||
|
||||
{
|
||||
double ox, oy, fx, fy;
|
||||
ox = (double) ( ux0 + delta_cx ) * scale;
|
||||
oy = (double) ( uy0 + delta_cy ) * scale;
|
||||
fx = (double) ( ux0 - delta_cx ) * scale;
|
||||
fy = (double) ( uy0 - delta_cy ) * 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) )
|
||||
layer = LAYER_N_FRONT;
|
||||
|
||||
if( (layer == LAYER_N_FRONT) && !Oncmp )
|
||||
continue;
|
||||
|
||||
if( (layer == LAYER_N_BACK) && !Oncu )
|
||||
continue;
|
||||
if( (layer > FIRST_COPPER_LAYER)
|
||||
&& (layer < LAST_COPPER_LAYER) && !Both )
|
||||
|
||||
if( (layer > FIRST_COPPER_LAYER) && (layer < LAST_COPPER_LAYER) && !Both )
|
||||
continue;
|
||||
|
||||
color = g_ColorsSettings.GetLayerColor( layer );
|
||||
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;
|
||||
|
||||
SetGLColor( color );
|
||||
zpos = g_Parm_3D_Visu.m_LayerZcoord[layer];
|
||||
|
||||
if( layer == LAYER_N_BACK )
|
||||
zpos = zpos - 5 * g_Parm_3D_Visu.m_BoardScale;
|
||||
else
|
||||
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;
|
||||
|
||||
case PAD_RECT:
|
||||
@ -984,6 +1014,7 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
|
||||
wxPoint coord[5];
|
||||
wxRealPoint fcoord[8], f_hole_coord[8];
|
||||
BuildPadPolygon( coord, wxSize(0,0), angle );
|
||||
|
||||
for( ii = 0; ii < 4; ii++ )
|
||||
{
|
||||
coord[ii].x += ux0;
|
||||
@ -996,8 +1027,10 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
|
||||
for( ii = 0; ii < 7; ii += 2 )
|
||||
{
|
||||
ll = ii + 2;
|
||||
|
||||
if( ll > 7 )
|
||||
ll -= 8;
|
||||
|
||||
fcoord[ii + 1].x = (fcoord[ii].x + fcoord[ll].x) / 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) )
|
||||
layer = LAYER_N_FRONT;
|
||||
|
||||
if( (layer == LAYER_N_FRONT) && !Oncmp )
|
||||
continue;
|
||||
|
||||
if( (layer == LAYER_N_BACK) && !Oncu )
|
||||
continue;
|
||||
if( (layer > FIRST_COPPER_LAYER) && (layer < LAST_COPPER_LAYER)
|
||||
&& !Both )
|
||||
|
||||
if( (layer > FIRST_COPPER_LAYER) && (layer < LAST_COPPER_LAYER) && !Both )
|
||||
continue;
|
||||
|
||||
color = g_ColorsSettings.GetLayerColor( layer );
|
||||
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;
|
||||
|
||||
SetGLColor( color );
|
||||
zpos = g_Parm_3D_Visu.m_LayerZcoord[layer];
|
||||
|
||||
if( layer == LAYER_N_BACK )
|
||||
zpos = zpos - 5 * g_Parm_3D_Visu.m_BoardScale;
|
||||
else
|
||||
zpos = zpos + 5 * g_Parm_3D_Visu.m_BoardScale;
|
||||
|
||||
glBegin( GL_QUAD_STRIP );
|
||||
|
||||
for( ii = 0; ii < 8; ii++ )
|
||||
{
|
||||
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;
|
||||
|
||||
glBegin( GL_QUAD_STRIP );
|
||||
|
||||
for( ii = 0; ii <= slice; ii++ )
|
||||
{
|
||||
x = hole;
|
||||
@ -1151,6 +1191,7 @@ static void Draw3D_FilledSegment( double startx, double starty, double endx,
|
||||
x += dx;
|
||||
RotatePoint( &x, &y, -angle );
|
||||
glVertex3f( startx + x, starty + y, zpos );
|
||||
|
||||
if( ii == 0 )
|
||||
{
|
||||
firstx = startx + x;
|
||||
@ -1217,6 +1258,7 @@ static void Draw3D_FilledSegmentWithHole( double startx, double starty,
|
||||
RotatePoint( &xin, &yin, -angle );
|
||||
glVertex3f( startx + xin, starty + yin, zpos );
|
||||
glVertex3f( startx + x, starty + y, zpos );
|
||||
|
||||
if( ii == 0 )
|
||||
{
|
||||
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
|
||||
int imax = (int) ( (double) arc_angle * slice / 3600.0 );
|
||||
|
||||
if( imax < 0 )
|
||||
imax = -imax;
|
||||
|
||||
if( imax == 0 )
|
||||
imax = 1;
|
||||
|
||||
@ -1273,6 +1317,7 @@ static void Draw3D_ArcSegment( double startx, double starty, double centrex,
|
||||
double delta_angle = (double) arc_angle / imax;
|
||||
|
||||
glBegin( GL_QUAD_STRIP );
|
||||
|
||||
for( ii = 0; ii <= imax; ii++ )
|
||||
{
|
||||
double angle = (double) ii * delta_angle;
|
||||
@ -1301,6 +1346,7 @@ static void Draw3D_CircleSegment( double startx, double starty, double endx,
|
||||
hole = rayon - width;
|
||||
|
||||
glBegin( GL_QUAD_STRIP );
|
||||
|
||||
for( ii = 0; ii <= slice; ii++ )
|
||||
{
|
||||
x = hole; y = 0.0;
|
||||
@ -1339,6 +1385,7 @@ void Pcb3D_GLCanvas::Draw3D_Polygon( std::vector<wxPoint>& aCornersList, double
|
||||
// Draw solid polygon
|
||||
gluTessBeginPolygon( tess, NULL );
|
||||
gluTessBeginContour( tess );
|
||||
|
||||
for( unsigned ii = 0; ii < aCornersList.size(); ii++ )
|
||||
{
|
||||
v_data[0] = aCornersList[ii].x * g_Parm_3D_Visu.m_BoardScale;
|
||||
@ -1361,12 +1408,16 @@ static int Get3DLayerEnable( int act_layer )
|
||||
bool enablelayer;
|
||||
|
||||
enablelayer = TRUE;
|
||||
|
||||
if( act_layer == DRAW_N && !g_Parm_3D_Visu.m_Draw3DDrawings )
|
||||
enablelayer = FALSE;
|
||||
|
||||
if( act_layer == COMMENT_N && !g_Parm_3D_Visu.m_Draw3DComments )
|
||||
enablelayer = FALSE;
|
||||
|
||||
if( act_layer == ECO1_N && !g_Parm_3D_Visu.m_Draw3DEco1 )
|
||||
enablelayer = FALSE;
|
||||
|
||||
if( act_layer == ECO2_N && !g_Parm_3D_Visu.m_Draw3DEco2 )
|
||||
enablelayer = FALSE;
|
||||
|
||||
@ -1379,6 +1430,7 @@ static GLfloat Get3DLayerSide( int act_layer )
|
||||
GLfloat nZ;
|
||||
|
||||
nZ = 1.0;
|
||||
|
||||
if( ( act_layer <= LAST_COPPER_LAYER - 1 )
|
||||
|| ( act_layer == ADHESIVE_N_BACK )
|
||||
|| ( act_layer == SOLDERPASTE_N_BACK )
|
||||
|
@ -136,12 +136,12 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoin
|
||||
* but they must exist because they appear in some classes.
|
||||
* Do nothing in CvPcb.
|
||||
*/
|
||||
TRACK* Marque_Une_Piste( BOARD* aPcb,
|
||||
TRACK* aStartSegm,
|
||||
int* aSegmCount,
|
||||
int* aTrackLen,
|
||||
int* aLenDie,
|
||||
bool aReorder )
|
||||
TRACK* MarkTrace( BOARD* aPcb,
|
||||
TRACK* aStartSegm,
|
||||
int* aSegmCount,
|
||||
int* aTrackLen,
|
||||
int* aLenDie,
|
||||
bool aReorder )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
@ -420,12 +420,12 @@ void PCB_SCREEN::ClearUndoORRedoList( UNDO_REDO_CONTAINER&, int )
|
||||
* but they must exist because they appear in some classes, and here, no nothing.
|
||||
*/
|
||||
|
||||
TRACK* Marque_Une_Piste( BOARD* aPcb,
|
||||
TRACK* aStartSegm,
|
||||
int* aSegmCount,
|
||||
int* aTrackLen,
|
||||
int* aLenDie,
|
||||
bool aReorder )
|
||||
TRACK* MarkTrace( BOARD* aPcb,
|
||||
TRACK* aStartSegm,
|
||||
int* aSegmCount,
|
||||
int* aTrackLen,
|
||||
int* aLenDie,
|
||||
bool aReorder )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
@ -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
|
||||
#define BASE_STRUCT_H
|
||||
@ -41,7 +42,7 @@ enum KICAD_T {
|
||||
// copper layer)
|
||||
TYPE_MARKER_PCB, // a marker used to show something
|
||||
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_CONTAINER, // a zone area
|
||||
TYPE_BOARD_ITEM_LIST, // a list of board items
|
||||
|
@ -28,7 +28,7 @@ class SEGZONE;
|
||||
class SEGVIA;
|
||||
class D_PAD;
|
||||
class TEXTE_MODULE;
|
||||
class MIREPCB;
|
||||
class PCB_TARGET;
|
||||
class DIMENSION;
|
||||
class EDGE_MODULE;
|
||||
class DRC;
|
||||
@ -830,8 +830,8 @@ public:
|
||||
* the case where DRC would not allow a via.
|
||||
*/
|
||||
bool Other_Layer_Route( TRACK* track, wxDC* DC );
|
||||
void Affiche_PadsNoConnect( wxDC* DC );
|
||||
void Affiche_Status_Net( wxDC* DC );
|
||||
void HighlightUnconnectedPads( wxDC* DC );
|
||||
void DisplayNetStatus( wxDC* DC );
|
||||
TRACK* Delete_Segment( wxDC* DC, TRACK* Track );
|
||||
void Delete_Track( wxDC* DC, TRACK* Track );
|
||||
void Delete_net( wxDC* DC, TRACK* Track );
|
||||
@ -910,7 +910,6 @@ public:
|
||||
void Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC );
|
||||
void SwitchLayer( wxDC* DC, int layer );
|
||||
bool Add_45_degrees_Segment( wxDC* DC );
|
||||
bool Genere_Pad_Connexion( wxDC* DC, int layer );
|
||||
|
||||
/**
|
||||
* Function EraseRedundantTrack
|
||||
@ -1085,11 +1084,11 @@ public:
|
||||
void Start_Move_Zone_Outlines( wxDC* DC, ZONE_CONTAINER* zone_container );
|
||||
|
||||
// Target handling
|
||||
MIREPCB* Create_Mire( wxDC* DC );
|
||||
void Delete_Mire( MIREPCB* MirePcb, wxDC* DC );
|
||||
void StartMove_Mire( MIREPCB* MirePcb, wxDC* DC );
|
||||
void Place_Mire( MIREPCB* MirePcb, wxDC* DC );
|
||||
void InstallMireOptionsFrame( MIREPCB* MirePcb, wxDC* DC );
|
||||
PCB_TARGET* CreateTarget( wxDC* DC );
|
||||
void DeleteTarget( PCB_TARGET* aTarget, wxDC* DC );
|
||||
void BeginMoveTarget( PCB_TARGET* aTarget, wxDC* DC );
|
||||
void PlaceTarget( PCB_TARGET* aTarget, wxDC* DC );
|
||||
void ShowTargetOptionsDialog( PCB_TARGET* aTarget, wxDC* DC );
|
||||
|
||||
// Graphic segments type DRAWSEGMENT handling:
|
||||
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
|
||||
* 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;
|
||||
|
||||
DrawPanel->CrossHairOff( DC ); // Erase cursor shape
|
||||
Track = Marque_Une_Piste( GetBoard(), track, &nb_segm, NULL, NULL, true );
|
||||
Trace_Une_Piste( DrawPanel, DC, Track, nb_segm, GR_OR | GR_SURBRILL );
|
||||
Track = MarkTrace( GetBoard(), track, &nb_segm, NULL, NULL, true );
|
||||
DrawTraces( DrawPanel, DC, Track, nb_segm, GR_OR | GR_SURBRILL );
|
||||
|
||||
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
|
||||
|
||||
while( Track ) /* Flag change */
|
||||
{
|
||||
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:
|
||||
on_state = m_HToolBar->GetToolState( ID_TOOLBARH_PCB_MODE_MODULE );
|
||||
|
||||
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;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_HTOOL_current_state = 0;
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
case ID_TOOLBARH_PCB_MODE_TRACKS:
|
||||
on_state = m_HToolBar->GetToolState( ID_TOOLBARH_PCB_MODE_TRACKS );
|
||||
|
||||
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;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_HTOOL_current_state = 0;
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
|
||||
@ -75,11 +83,11 @@ void PCB_EDIT_FRAME::AutoPlace( wxCommandEvent& event )
|
||||
return;
|
||||
|
||||
case ID_POPUP_PCB_AUTOPLACE_FREE_MODULE:
|
||||
LockModule( (MODULE*) GetScreen()->GetCurItem(), FALSE );
|
||||
LockModule( (MODULE*) GetScreen()->GetCurItem(), false );
|
||||
return;
|
||||
|
||||
case ID_POPUP_PCB_AUTOPLACE_FREE_ALL_MODULES:
|
||||
LockModule( NULL, FALSE );
|
||||
LockModule( NULL, false );
|
||||
return;
|
||||
|
||||
case ID_POPUP_PCB_AUTOPLACE_FIXE_ALL_MODULES:
|
||||
@ -91,6 +99,7 @@ void PCB_EDIT_FRAME::AutoPlace( wxCommandEvent& event )
|
||||
{
|
||||
DrawPanel->m_endMouseCaptureCallback( DrawPanel, &dc );
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default: // Abort a current command (if any)
|
||||
@ -101,13 +110,13 @@ void PCB_EDIT_FRAME::AutoPlace( wxCommandEvent& event )
|
||||
/* Erase ratsnest if needed */
|
||||
if( GetBoard()->IsElementVisible(RATSNEST_VISIBLE) )
|
||||
DrawGeneralRatsnest( &dc );
|
||||
|
||||
GetBoard()->m_Status_Pcb |= DO_NOT_SHOW_GENERAL_RASTNEST;
|
||||
|
||||
switch( id )
|
||||
{
|
||||
case ID_POPUP_PCB_AUTOPLACE_CURRENT_MODULE:
|
||||
AutoPlaceModule( (MODULE*) GetScreen()->GetCurItem(),
|
||||
PLACE_1_MODULE, &dc );
|
||||
AutoPlaceModule( (MODULE*) GetScreen()->GetCurItem(), PLACE_1_MODULE, &dc );
|
||||
break;
|
||||
|
||||
case ID_POPUP_PCB_AUTOPLACE_ALL_MODULES:
|
||||
@ -123,7 +132,7 @@ void PCB_EDIT_FRAME::AutoPlace( wxCommandEvent& event )
|
||||
break;
|
||||
|
||||
case ID_POPUP_PCB_AUTOMOVE_ALL_MODULES:
|
||||
AutoMoveModulesOnPcb( FALSE );
|
||||
AutoMoveModulesOnPcb( false );
|
||||
break;
|
||||
|
||||
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 )
|
||||
MODULE* Module = GetBoard()->m_Modules;
|
||||
|
||||
for( ; Module != NULL; Module = Module->Next() )
|
||||
{
|
||||
Module->Set_Rectangle_Encadrement();
|
||||
Module->CalculateBoundingBox();
|
||||
moduleList.push_back(Module);
|
||||
}
|
||||
|
||||
sort( moduleList.begin(), moduleList.end(), sortModulesbySize );
|
||||
|
||||
/* 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 */
|
||||
surface = 0.0;
|
||||
|
||||
for( unsigned ii = 0; ii < moduleList.size(); ii++ )
|
||||
{
|
||||
Module = moduleList[ii];
|
||||
|
||||
if( PlaceModulesHorsPcb && edgesExists )
|
||||
{
|
||||
if( GetBoard()->m_BoundaryBox.Contains( Module->m_Pos ) )
|
||||
continue;
|
||||
}
|
||||
|
||||
surface += Module->m_Surface;
|
||||
}
|
||||
|
||||
@ -235,6 +249,7 @@ void PCB_EDIT_FRAME::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb )
|
||||
for( unsigned ii = 0; ii < moduleList.size(); ii++ )
|
||||
{
|
||||
Module = moduleList[ii];
|
||||
|
||||
if( Module->IsLocked() )
|
||||
continue;
|
||||
|
||||
@ -253,6 +268,7 @@ void PCB_EDIT_FRAME::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb )
|
||||
|
||||
GetScreen()->SetCrossHairPosition( current + Module->m_Pos -
|
||||
Module->m_BoundaryBox.GetPosition() );
|
||||
|
||||
Ymax_size = MAX( Ymax_size, Module->m_BoundaryBox.GetHeight() );
|
||||
|
||||
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
|
||||
* or all modules if aModule == NULL
|
||||
/* Set or reset (true or false) Lock attribute of aModule or all modules if aModule == NULL
|
||||
*/
|
||||
void PCB_EDIT_FRAME::LockModule( MODULE* aModule, bool aLocked )
|
||||
{
|
||||
@ -279,10 +294,10 @@ void PCB_EDIT_FRAME::LockModule( MODULE* aModule, bool aLocked )
|
||||
else
|
||||
{
|
||||
aModule = GetBoard()->m_Modules;
|
||||
|
||||
for( ; aModule != NULL; aModule = aModule->Next() )
|
||||
{
|
||||
if( WildCompareString( ModulesMaskSelection,
|
||||
aModule->m_Reference->m_Text ) )
|
||||
if( WildCompareString( ModulesMaskSelection, aModule->m_Reference->m_Text ) )
|
||||
{
|
||||
aModule->SetLocked( aLocked );
|
||||
OnModify();
|
||||
@ -296,4 +311,3 @@ static bool sortModulesbySize( MODULE* ref, MODULE* compare )
|
||||
{
|
||||
return compare->m_Surface < ref->m_Surface;
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ static void TracePenaliteRectangle( BOARD* Pcb,
|
||||
int uy1,
|
||||
int marge,
|
||||
int Penalite,
|
||||
int masque_layer );
|
||||
int aLayerMask );
|
||||
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:
|
||||
ThisModule = Module;
|
||||
|
||||
if( ThisModule == NULL )
|
||||
return;
|
||||
|
||||
ThisModule->m_ModuleStatus &= ~(MODULE_is_PLACED | MODULE_to_PLACE);
|
||||
break;
|
||||
|
||||
@ -97,11 +99,13 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
|
||||
case PLACE_ALL:
|
||||
if( !IsOK( this, _( "Footprints NOT LOCKED will be moved" ) ) )
|
||||
return;
|
||||
|
||||
break;
|
||||
|
||||
case PLACE_INCREMENTAL:
|
||||
if( !IsOK( this, _( "Footprints NOT PLACED will be moved" ) ) )
|
||||
return;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@ -118,9 +122,10 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
|
||||
/* Compute module parmeters used in auto place */
|
||||
Module = GetBoard()->m_Modules;
|
||||
NbTotalModules = 0;
|
||||
|
||||
for( ; Module != NULL; Module = Module->Next() )
|
||||
{
|
||||
Module->Set_Rectangle_Encadrement();
|
||||
Module->CalculateBoundingBox();
|
||||
NbTotalModules ++;
|
||||
}
|
||||
|
||||
@ -128,6 +133,7 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
|
||||
return;
|
||||
|
||||
Module = GetBoard()->m_Modules;
|
||||
|
||||
for( ; Module != NULL; Module = Module->Next() )
|
||||
{
|
||||
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:
|
||||
Module->m_ModuleStatus &= ~MODULE_is_PLACED;
|
||||
|
||||
if( Module->m_ModuleStatus & MODULE_is_LOCKED )
|
||||
break;
|
||||
|
||||
if( !GetBoard()->m_BoundaryBox.Contains( Module->m_Pos ) )
|
||||
Module->m_ModuleStatus |= MODULE_to_PLACE;
|
||||
|
||||
break;
|
||||
|
||||
case PLACE_ALL:
|
||||
Module->m_ModuleStatus &= ~MODULE_is_PLACED;
|
||||
|
||||
if( Module->m_ModuleStatus & MODULE_is_LOCKED )
|
||||
break;
|
||||
|
||||
Module->m_ModuleStatus |= MODULE_to_PLACE;
|
||||
break;
|
||||
|
||||
@ -159,8 +170,10 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
|
||||
{
|
||||
Module->m_ModuleStatus &= ~MODULE_is_PLACED; break;
|
||||
}
|
||||
|
||||
if( !(Module->m_ModuleStatus & MODULE_is_PLACED) )
|
||||
Module->m_ModuleStatus |= MODULE_to_PLACE;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@ -181,6 +194,7 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
|
||||
|
||||
if( NbModules )
|
||||
Pas = 100.0 / (float) NbModules;
|
||||
|
||||
while( ( Module = PickModule( this, DC ) ) != NULL )
|
||||
{
|
||||
float BestScore;
|
||||
@ -192,6 +206,7 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
|
||||
error = RecherchePlacementModule( Module, DC );
|
||||
BestScore = MinCout;
|
||||
PosOK = CurrPosition;
|
||||
|
||||
if( error == ESC )
|
||||
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;
|
||||
Rotate_Module( DC, Module, Angle_Rot_Module, false );
|
||||
Module->Set_Rectangle_Encadrement();
|
||||
Module->CalculateBoundingBox();
|
||||
error = RecherchePlacementModule( Module, DC );
|
||||
MinCout *= OrientPenality[ii];
|
||||
|
||||
if( BestScore > MinCout ) /* This orientation is best. */
|
||||
{
|
||||
PosOK = CurrPosition;
|
||||
@ -215,18 +231,21 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
|
||||
Angle_Rot_Module = -1800;
|
||||
Rotate_Module( DC, Module, Angle_Rot_Module, false );
|
||||
}
|
||||
|
||||
if( error == ESC )
|
||||
goto end_of_tst;
|
||||
}
|
||||
|
||||
/* Determine if the best orientation of a module is 90. */
|
||||
ii = Module->m_CntRot90 & 0x0F;
|
||||
|
||||
if( ii != 0 )
|
||||
{
|
||||
int Angle_Rot_Module = 900;
|
||||
Rotate_Module( DC, Module, Angle_Rot_Module, false );
|
||||
error = RecherchePlacementModule( Module, DC );
|
||||
MinCout *= OrientPenality[ii];
|
||||
|
||||
if( BestScore > MinCout ) /* This orientation is best. */
|
||||
{
|
||||
PosOK = CurrPosition;
|
||||
@ -237,18 +256,21 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
|
||||
Angle_Rot_Module = -900;
|
||||
Rotate_Module( DC, Module, Angle_Rot_Module, false );
|
||||
}
|
||||
|
||||
if( error == ESC )
|
||||
goto end_of_tst;
|
||||
}
|
||||
|
||||
/* Determine if the best orientation of a module is 270. */
|
||||
ii = (Module->m_CntRot90 >> 4 ) & 0x0F;
|
||||
|
||||
if( ii != 0 )
|
||||
{
|
||||
int Angle_Rot_Module = 2700;
|
||||
Rotate_Module( DC, Module, Angle_Rot_Module, false );
|
||||
error = RecherchePlacementModule( Module, DC );
|
||||
MinCout *= OrientPenality[ii];
|
||||
|
||||
if( BestScore > MinCout ) /* This orientation is best. */
|
||||
{
|
||||
PosOK = CurrPosition;
|
||||
@ -259,6 +281,7 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
|
||||
Angle_Rot_Module = -2700;
|
||||
Rotate_Module( DC, Module, Angle_Rot_Module, false );
|
||||
}
|
||||
|
||||
if( error == ESC )
|
||||
goto end_of_tst;
|
||||
}
|
||||
@ -274,7 +297,7 @@ end_of_tst:
|
||||
Place_Module( Module, DC );
|
||||
GetScreen()->SetCrossHairPosition( CurrPosition );
|
||||
|
||||
Module->Set_Rectangle_Encadrement();
|
||||
Module->CalculateBoundingBox();
|
||||
|
||||
GenModuleOnBoard( Module );
|
||||
Module->m_ModuleStatus |= MODULE_is_PLACED;
|
||||
@ -289,15 +312,15 @@ end_of_tst:
|
||||
Route_Layer_BOTTOM = lay_tmp_BOTTOM;
|
||||
|
||||
Module = GetBoard()->m_Modules;
|
||||
|
||||
for( ; Module != NULL; Module = Module->Next() )
|
||||
{
|
||||
Module->Set_Rectangle_Encadrement();
|
||||
Module->CalculateBoundingBox();
|
||||
}
|
||||
|
||||
GetBoard()->m_Status_Pcb = 0;
|
||||
Compile_Ratsnest( DC, true );
|
||||
DrawPanel->ReDraw( DC, true );
|
||||
|
||||
DrawPanel->m_AbortEnable = false;
|
||||
}
|
||||
|
||||
@ -309,14 +332,14 @@ void PCB_EDIT_FRAME::DrawInfoPlace( wxDC* DC )
|
||||
MATRIX_CELL top_state, bottom_state;
|
||||
|
||||
GRSetDrawMode( DC, GR_COPY );
|
||||
|
||||
for( ii = 0; ii < Board.m_Nrows; ii++ )
|
||||
{
|
||||
oy = GetBoard()->m_BoundaryBox.m_Pos.y + ( ii * Board.m_GridRouting );
|
||||
|
||||
for( jj = 0; jj < Board.m_Ncols; jj++ )
|
||||
{
|
||||
ox = GetBoard()->m_BoundaryBox.m_Pos.x +
|
||||
(jj * Board.m_GridRouting);
|
||||
ox = GetBoard()->m_BoundaryBox.m_Pos.x + (jj * Board.m_GridRouting);
|
||||
color = BLACK;
|
||||
|
||||
top_state = GetCell( ii, jj, TOP );
|
||||
@ -328,12 +351,10 @@ void PCB_EDIT_FRAME::DrawInfoPlace( wxDC* DC )
|
||||
/* obstacles */
|
||||
if( ( top_state & CELL_is_EDGE ) || ( bottom_state & CELL_is_EDGE ) )
|
||||
color = WHITE;
|
||||
|
||||
else if( top_state & ( HOLE | CELL_is_MODULE ) )
|
||||
color = LIGHTRED;
|
||||
else if( bottom_state & (HOLE | CELL_is_MODULE) )
|
||||
color = LIGHTGREEN;
|
||||
|
||||
else /* Display the filling and keep out regions. */
|
||||
{
|
||||
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 );
|
||||
|
||||
Route_Layer_BOTTOM = LAYER_N_FRONT;
|
||||
|
||||
if( Nb_Sides == TWO_SIDES )
|
||||
Route_Layer_BOTTOM = LAYER_N_BACK;
|
||||
|
||||
Route_Layer_TOP = LAYER_N_FRONT;
|
||||
|
||||
/* Place the edge layer segments */
|
||||
@ -430,6 +453,7 @@ int PCB_EDIT_FRAME::GenPlaceBoard()
|
||||
TmpSegm.SetLayer( -1 );
|
||||
TmpSegm.SetNet( -1 );
|
||||
TmpSegm.m_Width = Board.m_GridRouting / 2;
|
||||
|
||||
for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
|
||||
{
|
||||
DRAWSEGMENT* DrawSegm;
|
||||
@ -438,6 +462,7 @@ int PCB_EDIT_FRAME::GenPlaceBoard()
|
||||
{
|
||||
case TYPE_DRAWSEGMENT:
|
||||
DrawSegm = (DRAWSEGMENT*) PtStruct;
|
||||
|
||||
if( DrawSegm->GetLayer() != EDGE_N )
|
||||
break;
|
||||
|
||||
@ -485,7 +510,7 @@ void PCB_EDIT_FRAME::GenModuleOnBoard( MODULE* Module )
|
||||
{
|
||||
int ox, oy, fx, fy, Penalite;
|
||||
int marge = Board.m_GridRouting / 2;
|
||||
int masque_layer;
|
||||
int layerMask;
|
||||
D_PAD* Pad;
|
||||
|
||||
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 )
|
||||
ox = GetBoard()->m_BoundaryBox.m_Pos.x;
|
||||
|
||||
if( ox > GetBoard()->m_BoundaryBox.GetRight() )
|
||||
ox = GetBoard()->m_BoundaryBox.GetRight();
|
||||
|
||||
if( fx < GetBoard()->m_BoundaryBox.m_Pos.x )
|
||||
fx = GetBoard()->m_BoundaryBox.m_Pos.x;
|
||||
|
||||
if( fx > GetBoard()->m_BoundaryBox.GetRight() )
|
||||
fx = GetBoard()->m_BoundaryBox.GetRight();
|
||||
|
||||
if( oy < GetBoard()->m_BoundaryBox.m_Pos.y )
|
||||
oy = GetBoard()->m_BoundaryBox.m_Pos.y;
|
||||
|
||||
if( oy > GetBoard()->m_BoundaryBox.GetBottom() )
|
||||
oy = GetBoard()->m_BoundaryBox.GetBottom();
|
||||
|
||||
if( fy < GetBoard()->m_BoundaryBox.m_Pos.y )
|
||||
fy = GetBoard()->m_BoundaryBox.m_Pos.y;
|
||||
|
||||
if( fy > GetBoard()->m_BoundaryBox.GetBottom() )
|
||||
fy = GetBoard()->m_BoundaryBox.GetBottom();
|
||||
|
||||
masque_layer = 0;
|
||||
if( Module->GetLayer() == LAYER_N_FRONT )
|
||||
masque_layer = LAYER_FRONT;
|
||||
if( Module->GetLayer() == LAYER_N_BACK )
|
||||
masque_layer = LAYER_BACK;
|
||||
layerMask = 0;
|
||||
|
||||
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 );
|
||||
|
||||
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() )
|
||||
{
|
||||
Place_1_Pad_Board( GetBoard(), Pad, CELL_is_MODULE, marge,
|
||||
WRITE_OR_CELL );
|
||||
Place_1_Pad_Board( GetBoard(), Pad, CELL_is_MODULE, marge, WRITE_OR_CELL );
|
||||
}
|
||||
|
||||
/* Trace clearance. */
|
||||
marge = (Board.m_GridRouting * Module->m_PadNum ) / GAIN;
|
||||
marge = ( Board.m_GridRouting * Module->m_PadNum ) / GAIN;
|
||||
Penalite = PENALITE;
|
||||
TracePenaliteRectangle( GetBoard(), ox, oy, fx, fy, marge, Penalite,
|
||||
masque_layer );
|
||||
TracePenaliteRectangle( GetBoard(), ox, oy, fx, fy, marge, Penalite, layerMask );
|
||||
}
|
||||
|
||||
|
||||
@ -588,23 +617,25 @@ int PCB_EDIT_FRAME::RecherchePlacementModule( MODULE* Module, wxDC* DC )
|
||||
* appearing on the other side.
|
||||
*/
|
||||
TstOtherSide = false;
|
||||
|
||||
if( Nb_Sides == TWO_SIDES )
|
||||
{
|
||||
D_PAD* Pad; int masque_otherlayer;
|
||||
masque_otherlayer = LAYER_BACK;
|
||||
D_PAD* Pad;
|
||||
int otherLayerMask = LAYER_BACK;
|
||||
|
||||
if( Module->GetLayer() == LAYER_N_BACK )
|
||||
masque_otherlayer = LAYER_FRONT;
|
||||
otherLayerMask = LAYER_FRONT;
|
||||
|
||||
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;
|
||||
|
||||
TstOtherSide = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DrawModuleOutlines( DrawPanel, DC, Module );
|
||||
|
||||
mincout = -1.0;
|
||||
@ -614,6 +645,7 @@ int PCB_EDIT_FRAME::RecherchePlacementModule( MODULE* Module, wxDC* DC )
|
||||
CurrPosition.x += Board.m_GridRouting )
|
||||
{
|
||||
wxYield();
|
||||
|
||||
if( DrawPanel->m_AbortRequest )
|
||||
{
|
||||
if( IsOK( this, _( "Ok to abort?" ) ) )
|
||||
@ -640,8 +672,10 @@ int PCB_EDIT_FRAME::RecherchePlacementModule( MODULE* Module, wxDC* DC )
|
||||
{
|
||||
/* Erase traces. */
|
||||
DrawModuleOutlines( DrawPanel, DC, Module );
|
||||
|
||||
if( DisplayChevelu )
|
||||
Compute_Ratsnest_PlaceModule( DC );
|
||||
|
||||
DisplayChevelu = 0;
|
||||
Module->m_BoundaryBox.m_Pos.x = ox + CurrPosition.x;
|
||||
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;
|
||||
DrawModuleOutlines( DrawPanel, DC, Module );
|
||||
Penalite = TstModuleOnBoard( GetBoard(), Module, TstOtherSide );
|
||||
|
||||
if( Penalite >= 0 ) /* c a d if the module can be placed. */
|
||||
{
|
||||
error = 0;
|
||||
@ -669,13 +704,16 @@ int PCB_EDIT_FRAME::RecherchePlacementModule( MODULE* Module, wxDC* DC )
|
||||
SetStatusText( msg );
|
||||
}
|
||||
}
|
||||
|
||||
if( DisplayChevelu )
|
||||
Compute_Ratsnest_PlaceModule( DC );
|
||||
|
||||
DisplayChevelu = 0;
|
||||
}
|
||||
}
|
||||
|
||||
DrawModuleOutlines( DrawPanel, DC, Module ); /* erasing the last traces */
|
||||
|
||||
if( DisplayChevelu )
|
||||
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;
|
||||
col_max = ux1 / Board.m_GridRouting;
|
||||
row_min = uy0 / Board.m_GridRouting;
|
||||
|
||||
if( uy0 > row_min * Board.m_GridRouting )
|
||||
row_min++;
|
||||
|
||||
col_min = ux0 / Board.m_GridRouting;
|
||||
|
||||
if( ux0 > col_min * Board.m_GridRouting )
|
||||
col_min++;
|
||||
|
||||
if( row_min < 0 )
|
||||
row_min = 0;
|
||||
|
||||
if( row_max >= ( Nrows - 1 ) )
|
||||
row_max = Nrows - 1;
|
||||
|
||||
if( col_min < 0 )
|
||||
col_min = 0;
|
||||
|
||||
if( 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++ )
|
||||
{
|
||||
data = GetCell( row, col, side );
|
||||
|
||||
if( ( data & CELL_is_ZONE ) == 0 )
|
||||
return OUT_OF_BOARD;
|
||||
|
||||
if( data & CELL_is_MODULE )
|
||||
return OCCUPED_By_MODULE;
|
||||
}
|
||||
@ -761,22 +807,29 @@ unsigned int CalculePenaliteRectangle( BOARD* Pcb, int ux0, int uy0,
|
||||
row_max = uy1 / Board.m_GridRouting;
|
||||
col_max = ux1 / Board.m_GridRouting;
|
||||
row_min = uy0 / Board.m_GridRouting;
|
||||
|
||||
if( uy0 > row_min * Board.m_GridRouting )
|
||||
row_min++;
|
||||
|
||||
col_min = ux0 / Board.m_GridRouting;
|
||||
|
||||
if( ux0 > col_min * Board.m_GridRouting )
|
||||
col_min++;
|
||||
|
||||
if( row_min < 0 )
|
||||
row_min = 0;
|
||||
|
||||
if( row_max >= ( Nrows - 1 ) )
|
||||
row_max = Nrows - 1;
|
||||
|
||||
if( col_min < 0 )
|
||||
col_min = 0;
|
||||
|
||||
if( col_max >= ( Ncols - 1 ) )
|
||||
col_max = Ncols - 1;
|
||||
|
||||
Penalite = 0;
|
||||
|
||||
for( row = row_min; row <= row_max; row++ )
|
||||
{
|
||||
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;
|
||||
|
||||
side = TOP; otherside = BOTTOM;
|
||||
|
||||
if( Module->GetLayer() == LAYER_N_BACK )
|
||||
{
|
||||
side = BOTTOM; otherside = TOP;
|
||||
@ -810,12 +864,14 @@ int TstModuleOnBoard( BOARD* Pcb, MODULE* Module, bool TstOtherSide )
|
||||
fy = Module->m_BoundaryBox.GetBottom();
|
||||
|
||||
error = TstRectangle( Pcb, ox, oy, fx, fy, side );
|
||||
|
||||
if( error < 0 )
|
||||
return error;
|
||||
|
||||
if( TstOtherSide )
|
||||
{
|
||||
error = TstRectangle( Pcb, ox, oy, fx, fy, otherside );
|
||||
|
||||
if( error < 0 )
|
||||
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 )
|
||||
return -1;
|
||||
|
||||
cout = 0;
|
||||
|
||||
int color = g_ColorsSettings.GetItemColor(RATSNEST_VISIBLE);
|
||||
|
||||
if( AutoPlaceShowAll )
|
||||
GRSetDrawMode( DC, GR_XOR );
|
||||
|
||||
for( unsigned ii = 0; ii < GetBoard()->m_LocalRatsnest.size(); ii++ )
|
||||
{
|
||||
RATSNEST_ITEM* pt_local_chevelu = &GetBoard()->m_LocalRatsnest[ii];
|
||||
|
||||
if( !( pt_local_chevelu->m_Status & LOCAL_RATSNEST_ITEM ) )
|
||||
{
|
||||
ox = pt_local_chevelu->m_PadStart->GetPosition().x -
|
||||
@ -863,8 +922,7 @@ float PCB_EDIT_FRAME::Compute_Ratsnest_PlaceModule( wxDC* DC )
|
||||
|
||||
if( AutoPlaceShowAll )
|
||||
{
|
||||
GRLine( &DrawPanel->m_ClipBox, DC, ox, oy, fx, fy,
|
||||
0, color );
|
||||
GRLine( &DrawPanel->m_ClipBox, DC, ox, oy, fx, fy, 0, color );
|
||||
}
|
||||
|
||||
/* 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
|
||||
* 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
|
||||
* 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,
|
||||
int ux0,
|
||||
@ -910,7 +968,7 @@ static void TracePenaliteRectangle( BOARD* Pcb,
|
||||
int uy1,
|
||||
int marge,
|
||||
int Penalite,
|
||||
int masque_layer )
|
||||
int aLayerMask )
|
||||
{
|
||||
int row, col;
|
||||
int row_min, row_max, col_min, col_max, pmarge;
|
||||
@ -918,10 +976,10 @@ static void TracePenaliteRectangle( BOARD* Pcb,
|
||||
DIST_CELL data, LocalPenalite;
|
||||
int lgain, cgain;
|
||||
|
||||
if( masque_layer & g_TabOneLayerMask[Route_Layer_BOTTOM] )
|
||||
if( aLayerMask & g_TabOneLayerMask[Route_Layer_BOTTOM] )
|
||||
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. */
|
||||
|
||||
if( trace == 0 )
|
||||
@ -942,24 +1000,31 @@ static void TracePenaliteRectangle( BOARD* Pcb,
|
||||
row_max = uy1 / Board.m_GridRouting;
|
||||
col_max = ux1 / Board.m_GridRouting;
|
||||
row_min = uy0 / Board.m_GridRouting;
|
||||
|
||||
if( uy0 > row_min * Board.m_GridRouting )
|
||||
row_min++;
|
||||
|
||||
col_min = ux0 / Board.m_GridRouting;
|
||||
|
||||
if( ux0 > col_min * Board.m_GridRouting )
|
||||
col_min++;
|
||||
|
||||
if( row_min < 0 )
|
||||
row_min = 0;
|
||||
|
||||
if( row_max >= (Nrows - 1) )
|
||||
row_max = Nrows - 1;
|
||||
|
||||
if( col_min < 0 )
|
||||
col_min = 0;
|
||||
|
||||
if( col_max >= (Ncols - 1) )
|
||||
col_max = Ncols - 1;
|
||||
|
||||
for( row = row_min; row <= row_max; row++ )
|
||||
{
|
||||
lgain = 256;
|
||||
|
||||
if( row < pmarge )
|
||||
lgain = ( 256 * row ) / pmarge;
|
||||
else if( row > row_max - pmarge )
|
||||
@ -969,19 +1034,23 @@ static void TracePenaliteRectangle( BOARD* Pcb,
|
||||
{
|
||||
cgain = 256;
|
||||
LocalPenalite = Penalite;
|
||||
|
||||
if( col < pmarge )
|
||||
cgain = ( 256 * col ) / pmarge;
|
||||
else if( col > col_max - pmarge )
|
||||
cgain = ( 256 * ( col_max - col ) ) / pmarge;
|
||||
|
||||
cgain = ( cgain * lgain ) / 256;
|
||||
|
||||
if( cgain != 256 )
|
||||
LocalPenalite = ( LocalPenalite * cgain ) / 256;
|
||||
|
||||
if( trace & 1 )
|
||||
{
|
||||
data = GetDist( row, col, BOTTOM ) + LocalPenalite;
|
||||
SetDist( row, col, BOTTOM, data );
|
||||
}
|
||||
|
||||
if( trace & 2 )
|
||||
{
|
||||
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 )
|
||||
Module = pcbframe->GetBoard()->m_Modules;
|
||||
|
||||
for( ; Module != NULL; Module = Module->Next() )
|
||||
{
|
||||
Module->Set_Rectangle_Encadrement();
|
||||
Module->CalculateBoundingBox();
|
||||
moduleList.push_back(Module);
|
||||
}
|
||||
|
||||
sort( moduleList.begin(), moduleList.end(), Tri_PlaceModules );
|
||||
|
||||
for( unsigned ii = 0; ii < moduleList.size(); ii++ )
|
||||
{
|
||||
Module = moduleList[ii];
|
||||
Module->flag = 0;
|
||||
|
||||
if( !( Module->m_ModuleStatus & MODULE_to_PLACE ) )
|
||||
continue;
|
||||
|
||||
pcbframe->GetBoard()->m_Status_Pcb &= ~RATSNEST_ITEM_LOCAL_OK;
|
||||
Module->DisplayInfo( pcbframe );
|
||||
pcbframe->build_ratsnest_module( Module );
|
||||
|
||||
/* Calculate external ratsnet. */
|
||||
for( unsigned ii = 0;
|
||||
ii < pcbframe->GetBoard()->m_LocalRatsnest.size();
|
||||
ii++ )
|
||||
for( unsigned ii = 0; ii < pcbframe->GetBoard()->m_LocalRatsnest.size(); ii++ )
|
||||
{
|
||||
if( ( pcbframe->GetBoard()->m_LocalRatsnest[ii].m_Status &
|
||||
LOCAL_RATSNEST_ITEM ) == 0 )
|
||||
@ -1060,14 +1131,19 @@ static MODULE* PickModule( PCB_EDIT_FRAME* pcbframe, wxDC* DC )
|
||||
/* Search for "best" module. */
|
||||
MODULE* bestModule = NULL;
|
||||
MODULE* altModule = NULL;
|
||||
|
||||
for( unsigned ii = 0; ii < moduleList.size(); ii++ )
|
||||
{
|
||||
Module = moduleList[ii];
|
||||
|
||||
if( !( Module->m_ModuleStatus & MODULE_to_PLACE ) )
|
||||
continue;
|
||||
|
||||
altModule = Module;
|
||||
|
||||
if( Module->flag == 0 )
|
||||
continue;
|
||||
|
||||
bestModule = Module;
|
||||
break;
|
||||
}
|
||||
@ -1079,10 +1155,6 @@ static MODULE* PickModule( PCB_EDIT_FRAME* pcbframe, wxDC* DC )
|
||||
}
|
||||
|
||||
|
||||
/********************************************/
|
||||
int Propagation( PCB_EDIT_FRAME* frame )
|
||||
/********************************************/
|
||||
|
||||
/**
|
||||
* Function Propagation
|
||||
* 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.
|
||||
* @return: added cells count (i.e. which the attribute CELL_is_ZONE is set)
|
||||
*/
|
||||
int Propagation( PCB_EDIT_FRAME* frame )
|
||||
{
|
||||
int row, col, nn;
|
||||
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 */
|
||||
memset( pt_cell_V, 0, nn );
|
||||
|
||||
for( row = 0; row < Nrows; row++ )
|
||||
{
|
||||
old_cell_H = 0;
|
||||
|
||||
for( col = 0; col < Ncols; col++ )
|
||||
{
|
||||
current_cell = GetCell( row, col, BOTTOM ) & NO_CELL_ZONE;
|
||||
|
||||
if( current_cell == 0 ) /* a free cell is found */
|
||||
{
|
||||
if( (old_cell_H & CELL_is_ZONE)
|
||||
|| (pt_cell_V[col] & CELL_is_ZONE) )
|
||||
if( (old_cell_H & CELL_is_ZONE) || (pt_cell_V[col] & CELL_is_ZONE) )
|
||||
{
|
||||
OrCell( row, col, BOTTOM, CELL_is_ZONE );
|
||||
current_cell = CELL_is_ZONE;
|
||||
nbpoints++;
|
||||
}
|
||||
}
|
||||
|
||||
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 */
|
||||
frame->MsgPanel->SetMessage( -1, wxEmptyString, wxT( "2" ), CYAN );
|
||||
memset( pt_cell_V, 0, nn );
|
||||
|
||||
for( row = 0; row < Nrows; row++ )
|
||||
{
|
||||
old_cell_H = 0;
|
||||
for( col = Ncols - 1; col >= 0; col-- )
|
||||
{
|
||||
current_cell = GetCell( row, col, BOTTOM ) & NO_CELL_ZONE;
|
||||
|
||||
if( current_cell == 0 ) /* a free cell is found */
|
||||
{
|
||||
if( (old_cell_H & CELL_is_ZONE)
|
||||
|| (pt_cell_V[col] & CELL_is_ZONE) )
|
||||
if( (old_cell_H & CELL_is_ZONE) || (pt_cell_V[col] & CELL_is_ZONE) )
|
||||
{
|
||||
OrCell( row, col, BOTTOM, CELL_is_ZONE );
|
||||
current_cell = CELL_is_ZONE;
|
||||
nbpoints++;
|
||||
}
|
||||
}
|
||||
|
||||
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 */
|
||||
frame->MsgPanel->SetMessage( -1, wxEmptyString, wxT( "3" ), CYAN );
|
||||
memset( pt_cell_V, 0, nn );
|
||||
|
||||
for( col = Ncols - 1; col >= 0; col-- )
|
||||
{
|
||||
old_cell_H = 0;
|
||||
|
||||
for( row = Nrows - 1; row >= 0; row-- )
|
||||
{
|
||||
current_cell = GetCell( row, col, BOTTOM ) & NO_CELL_ZONE;
|
||||
|
||||
if( current_cell == 0 ) /* a free cell is found */
|
||||
{
|
||||
if( (old_cell_H & CELL_is_ZONE)
|
||||
|| (pt_cell_V[row] & CELL_is_ZONE) )
|
||||
if( (old_cell_H & CELL_is_ZONE) || (pt_cell_V[row] & CELL_is_ZONE) )
|
||||
{
|
||||
OrCell( row, col, BOTTOM, CELL_is_ZONE );
|
||||
current_cell = CELL_is_ZONE;
|
||||
nbpoints++;
|
||||
}
|
||||
}
|
||||
|
||||
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++ )
|
||||
{
|
||||
old_cell_H = 0;
|
||||
|
||||
for( row = Nrows - 1; row >= 0; row-- )
|
||||
{
|
||||
current_cell = GetCell( row, col, BOTTOM ) & NO_CELL_ZONE;
|
||||
|
||||
if( current_cell == 0 ) /* a free cell is found */
|
||||
{
|
||||
if( (old_cell_H & CELL_is_ZONE)
|
||||
|| (pt_cell_V[row] & CELL_is_ZONE) )
|
||||
if( (old_cell_H & CELL_is_ZONE) || (pt_cell_V[row] & CELL_is_ZONE) )
|
||||
{
|
||||
OrCell( row, col, BOTTOM, CELL_is_ZONE );
|
||||
current_cell = CELL_is_ZONE;
|
||||
nbpoints++;
|
||||
}
|
||||
}
|
||||
|
||||
pt_cell_V[row] = old_cell_H = current_cell;
|
||||
}
|
||||
}
|
||||
@ -1219,4 +1302,3 @@ int Propagation( PCB_EDIT_FRAME* frame )
|
||||
|
||||
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_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_ModuleEditFrame = NULL; // Frame for footprint edition
|
||||
|
||||
|
@ -378,7 +378,7 @@ bool PCB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
|
||||
*/
|
||||
void PCB_EDIT_FRAME::Block_SelectItems()
|
||||
{
|
||||
int masque_layer;
|
||||
int layerMask;
|
||||
|
||||
GetScreen()->m_BlockLocate.Normalize();
|
||||
|
||||
@ -388,8 +388,7 @@ void PCB_EDIT_FRAME::Block_SelectItems()
|
||||
// Add modules
|
||||
if( blockIncludeModules )
|
||||
{
|
||||
for( MODULE* module = m_Pcb->m_Modules; module != NULL;
|
||||
module = module->Next() )
|
||||
for( MODULE* module = m_Pcb->m_Modules; module != NULL; module = module->Next() )
|
||||
{
|
||||
int layer = module->GetLayer();
|
||||
|
||||
@ -409,8 +408,7 @@ void PCB_EDIT_FRAME::Block_SelectItems()
|
||||
// Add tracks and vias
|
||||
if( blockIncludeTracks )
|
||||
{
|
||||
for( TRACK* pt_segm = m_Pcb->m_Track; pt_segm != NULL;
|
||||
pt_segm = pt_segm->Next() )
|
||||
for( TRACK* pt_segm = m_Pcb->m_Track; pt_segm != NULL; pt_segm = pt_segm->Next() )
|
||||
{
|
||||
if( pt_segm->HitTest( GetScreen()->m_BlockLocate ) )
|
||||
{
|
||||
@ -425,16 +423,15 @@ void PCB_EDIT_FRAME::Block_SelectItems()
|
||||
}
|
||||
|
||||
// Add graphic items
|
||||
masque_layer = EDGE_LAYER;
|
||||
layerMask = EDGE_LAYER;
|
||||
|
||||
if( blockIncludeItemsOnTechLayers )
|
||||
masque_layer = ALL_LAYERS;
|
||||
layerMask = ALL_LAYERS;
|
||||
|
||||
if( !blockIncludeBoardOutlineLayer )
|
||||
masque_layer &= ~EDGE_LAYER;
|
||||
layerMask &= ~EDGE_LAYER;
|
||||
|
||||
for( BOARD_ITEM* PtStruct = m_Pcb->m_Drawings; PtStruct != NULL;
|
||||
PtStruct = PtStruct->Next() )
|
||||
for( BOARD_ITEM* PtStruct = m_Pcb->m_Drawings; PtStruct != NULL; PtStruct = PtStruct->Next() )
|
||||
{
|
||||
if( !m_Pcb->IsLayerVisible( PtStruct->GetLayer() ) && ! blockIncludeItemsOnInvisibleLayers)
|
||||
continue;
|
||||
@ -442,7 +439,7 @@ void PCB_EDIT_FRAME::Block_SelectItems()
|
||||
switch( PtStruct->Type() )
|
||||
{
|
||||
case TYPE_DRAWSEGMENT:
|
||||
if( (g_TabOneLayerMask[PtStruct->GetLayer()] & masque_layer) == 0 )
|
||||
if( (g_TabOneLayerMask[PtStruct->GetLayer()] & layerMask) == 0 )
|
||||
break;
|
||||
|
||||
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
|
||||
break;
|
||||
|
||||
case TYPE_MIRE:
|
||||
if( ( g_TabOneLayerMask[PtStruct->GetLayer()] & masque_layer ) == 0 )
|
||||
case PCB_TARGET_T:
|
||||
if( ( g_TabOneLayerMask[PtStruct->GetLayer()] & layerMask ) == 0 )
|
||||
break;
|
||||
|
||||
if( !PtStruct->HitTest( GetScreen()->m_BlockLocate ) )
|
||||
break;
|
||||
|
||||
select_me = true; // This item is in bloc: select it
|
||||
break;
|
||||
|
||||
case TYPE_DIMENSION:
|
||||
if( ( g_TabOneLayerMask[PtStruct->GetLayer()] & masque_layer ) == 0 )
|
||||
if( ( g_TabOneLayerMask[PtStruct->GetLayer()] & layerMask ) == 0 )
|
||||
break;
|
||||
|
||||
if( !PtStruct->HitTest( GetScreen()->m_BlockLocate ) )
|
||||
break;
|
||||
|
||||
select_me = true; // This item is in bloc: select it
|
||||
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();
|
||||
|
||||
g_Offset_Module = -aOffset;
|
||||
|
||||
for( unsigned ii = 0; ii < itemsList->GetCount(); ii++ )
|
||||
{
|
||||
BOARD_ITEM* item = (BOARD_ITEM*) itemsList->GetPickedItem( ii );
|
||||
|
||||
switch( item->Type() )
|
||||
{
|
||||
case TYPE_MODULE:
|
||||
@ -531,7 +532,7 @@ static void drawPickedItems( EDA_DRAW_PANEL* aPanel, wxDC* aDC, wxPoint aOffset
|
||||
case TYPE_TEXTE:
|
||||
case TYPE_TRACK:
|
||||
case TYPE_VIA:
|
||||
case TYPE_MIRE:
|
||||
case PCB_TARGET_T:
|
||||
case TYPE_DIMENSION: // Currently markers are not affected by block commands
|
||||
case TYPE_MARKER_PCB:
|
||||
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 );
|
||||
itemsList->SetPickedItemStatus( UR_DELETED, ii );
|
||||
|
||||
switch( item->Type() )
|
||||
{
|
||||
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_VIA: // a via (like atrack segment on a copper layer)
|
||||
case TYPE_DIMENSION: // a dimension (graphic item)
|
||||
case TYPE_MIRE: // a target (graphic item)
|
||||
case PCB_TARGET_T: // a target (graphic item)
|
||||
item->UnLink();
|
||||
break;
|
||||
|
||||
@ -671,6 +673,7 @@ void PCB_EDIT_FRAME::Block_Rotate()
|
||||
wxASSERT( item );
|
||||
itemsList->SetPickedItemStatus( UR_ROTATED, ii );
|
||||
item->Rotate( centre, rotAngle );
|
||||
|
||||
switch( item->Type() )
|
||||
{
|
||||
case TYPE_MODULE:
|
||||
@ -687,7 +690,7 @@ void PCB_EDIT_FRAME::Block_Rotate()
|
||||
case TYPE_ZONE_CONTAINER:
|
||||
case TYPE_DRAWSEGMENT:
|
||||
case TYPE_TEXTE:
|
||||
case TYPE_MIRE:
|
||||
case PCB_TARGET_T:
|
||||
case TYPE_DIMENSION:
|
||||
break;
|
||||
|
||||
@ -736,6 +739,7 @@ void PCB_EDIT_FRAME::Block_Flip()
|
||||
wxASSERT( item );
|
||||
itemsList->SetPickedItemStatus( UR_FLIPPED, ii );
|
||||
item->Flip( center );
|
||||
|
||||
switch( item->Type() )
|
||||
{
|
||||
case TYPE_MODULE:
|
||||
@ -752,7 +756,7 @@ void PCB_EDIT_FRAME::Block_Flip()
|
||||
case TYPE_ZONE_CONTAINER:
|
||||
case TYPE_DRAWSEGMENT:
|
||||
case TYPE_TEXTE:
|
||||
case TYPE_MIRE:
|
||||
case PCB_TARGET_T:
|
||||
case TYPE_DIMENSION:
|
||||
break;
|
||||
|
||||
@ -812,7 +816,7 @@ void PCB_EDIT_FRAME::Block_Move()
|
||||
case TYPE_ZONE_CONTAINER:
|
||||
case TYPE_DRAWSEGMENT:
|
||||
case TYPE_TEXTE:
|
||||
case TYPE_MIRE:
|
||||
case PCB_TARGET_T:
|
||||
case TYPE_DIMENSION:
|
||||
break;
|
||||
|
||||
@ -890,8 +894,7 @@ void PCB_EDIT_FRAME::Block_Duplicate()
|
||||
|
||||
case TYPE_ZONE_CONTAINER:
|
||||
{
|
||||
ZONE_CONTAINER* new_zone =
|
||||
new ZONE_CONTAINER( (BOARD*) item->GetParent() );
|
||||
ZONE_CONTAINER* new_zone = new ZONE_CONTAINER( (BOARD*) item->GetParent() );
|
||||
new_zone->Copy( (ZONE_CONTAINER*) item );
|
||||
new_zone->m_TimeStamp = GetTimeStamp();
|
||||
newitem = new_zone;
|
||||
@ -917,12 +920,12 @@ void PCB_EDIT_FRAME::Block_Duplicate()
|
||||
}
|
||||
break;
|
||||
|
||||
case TYPE_MIRE:
|
||||
case PCB_TARGET_T:
|
||||
{
|
||||
MIREPCB* new_mire = new MIREPCB( m_Pcb );
|
||||
new_mire->Copy( (MIREPCB*) item );
|
||||
m_Pcb->Add( new_mire );
|
||||
newitem = new_mire;
|
||||
PCB_TARGET* target = new PCB_TARGET( m_Pcb );
|
||||
target->Copy( (PCB_TARGET*) item );
|
||||
m_Pcb->Add( target );
|
||||
newitem = target;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -941,12 +944,12 @@ void PCB_EDIT_FRAME::Block_Duplicate()
|
||||
}
|
||||
|
||||
if( newitem )
|
||||
{
|
||||
newitem->Move( MoveVector );
|
||||
picker.m_PickedItem = newitem;
|
||||
picker.m_PickedItemType = newitem->Type();
|
||||
newList.PushItem( picker );
|
||||
}
|
||||
{
|
||||
newitem->Move( MoveVector );
|
||||
picker.m_PickedItem = newitem;
|
||||
picker.m_PickedItemType = newitem->Type();
|
||||
newList.PushItem( picker );
|
||||
}
|
||||
}
|
||||
|
||||
if( newList.GetCount() )
|
||||
|
@ -114,13 +114,13 @@ bool FOOTPRINT_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
|
||||
|
||||
if( DrawPanel->IsMouseCaptured() )
|
||||
{
|
||||
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, FALSE );
|
||||
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
|
||||
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;
|
||||
DrawPanel->Refresh( TRUE );
|
||||
DrawPanel->Refresh( true );
|
||||
}
|
||||
break;
|
||||
|
||||
@ -215,7 +215,7 @@ void FOOTPRINT_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
|
||||
GetScreen()->m_BlockLocate.ClearItemsList();
|
||||
SaveCopyInUndoList( currentModule, UR_MODEDIT );
|
||||
MoveMarkedItems( currentModule, GetScreen()->m_BlockLocate.m_MoveVector );
|
||||
DrawPanel->Refresh( TRUE );
|
||||
DrawPanel->Refresh( true );
|
||||
break;
|
||||
|
||||
case BLOCK_COPY: /* Copy */
|
||||
@ -366,6 +366,7 @@ void CopyMarkedItems( MODULE* module, wxPoint offset )
|
||||
{
|
||||
if( pad->m_Selected == 0 )
|
||||
continue;
|
||||
|
||||
pad->m_Selected = 0;
|
||||
D_PAD* NewPad = new D_PAD( module );
|
||||
NewPad->Copy( pad );
|
||||
|
@ -81,16 +81,19 @@ int MATRIX_ROUTING_HEAD::InitBoard()
|
||||
|
||||
/* allocate Board & initialize everything to empty */
|
||||
m_BoardSide[kk] = (MATRIX_CELL*) MyZMalloc( ii * sizeof(MATRIX_CELL) );
|
||||
|
||||
if( m_BoardSide[kk] == NULL )
|
||||
return -1;
|
||||
|
||||
/***** allocate Distances *****/
|
||||
m_DistSide[kk] = (DIST_CELL*) MyZMalloc( ii * sizeof(DIST_CELL) );
|
||||
|
||||
if( m_DistSide[kk] == NULL )
|
||||
return -1;
|
||||
|
||||
/***** allocate Dir (chars) *****/
|
||||
m_DirSide[kk] = (char*) MyZMalloc( ii );
|
||||
|
||||
if( m_DirSide[kk] == NULL )
|
||||
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 marge, via_marge;
|
||||
int masque_layer;
|
||||
int layerMask;
|
||||
|
||||
// use the default NETCLASS?
|
||||
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, VIA_IMPOSSIBLE, via_marge, WRITE_OR_CELL );
|
||||
}
|
||||
|
||||
// Place outlines of modules on matrix routing, if they are on a copper layer
|
||||
// or on the edge layer
|
||||
TRACK tmpSegm( NULL ); // A dummy track used to create segments.
|
||||
|
||||
for( MODULE* module = aPcb->m_Modules; module; module = module->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;
|
||||
|
||||
tmpSegm.SetLayer( edge->GetLayer() );
|
||||
|
||||
if( tmpSegm.GetLayer() == EDGE_N )
|
||||
tmpSegm.SetLayer( -1 );
|
||||
|
||||
@ -195,8 +201,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
|
||||
tmpSegm.SetNet( -1 );
|
||||
|
||||
TraceSegmentPcb( aPcb, &tmpSegm, HOLE, marge, WRITE_CELL );
|
||||
TraceSegmentPcb( aPcb, &tmpSegm, VIA_IMPOSSIBLE, via_marge,
|
||||
WRITE_OR_CELL );
|
||||
TraceSegmentPcb( aPcb, &tmpSegm, VIA_IMPOSSIBLE, via_marge, WRITE_OR_CELL );
|
||||
}
|
||||
break;
|
||||
|
||||
@ -218,6 +223,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
|
||||
int type_cell = HOLE;
|
||||
DrawSegm = (DRAWSEGMENT*) item;
|
||||
tmpSegm.SetLayer( DrawSegm->GetLayer() );
|
||||
|
||||
if( DrawSegm->GetLayer() == EDGE_N )
|
||||
{
|
||||
tmpSegm.SetLayer( -1 );
|
||||
@ -258,16 +264,16 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
|
||||
ux0 -= dx;
|
||||
uy0 -= dy;
|
||||
|
||||
masque_layer = g_TabOneLayerMask[PtText->GetLayer()];
|
||||
layerMask = g_TabOneLayerMask[PtText->GetLayer()];
|
||||
|
||||
TraceFilledRectangle( aPcb, ux0 - marge, uy0 - marge, ux1 + marge,
|
||||
uy1 + marge, (int) (PtText->m_Orient),
|
||||
masque_layer, HOLE, WRITE_CELL );
|
||||
layerMask, HOLE, WRITE_CELL );
|
||||
|
||||
TraceFilledRectangle( aPcb, ux0 - via_marge, uy0 - via_marge,
|
||||
ux1 + via_marge, uy1 + via_marge,
|
||||
(int) (PtText->m_Orient),
|
||||
masque_layer, VIA_IMPOSSIBLE, WRITE_OR_CELL );
|
||||
layerMask, VIA_IMPOSSIBLE, WRITE_OR_CELL );
|
||||
}
|
||||
break;
|
||||
|
||||
@ -299,6 +305,7 @@ int Build_Work( BOARD* Pcb )
|
||||
|
||||
InitWork(); /* clear work list */
|
||||
Ntotal = 0;
|
||||
|
||||
for( unsigned ii = 0; ii < Pcb->GetRatsnestsCount(); ii++ )
|
||||
{
|
||||
pt_rats = &Pcb->m_FullRatsnest[ii];
|
||||
@ -308,10 +315,13 @@ int Build_Work( BOARD* Pcb )
|
||||
*/
|
||||
if( (pt_rats->m_Status & CH_ACTIF) == 0 )
|
||||
continue;
|
||||
|
||||
if( pt_rats->m_Status & CH_UNROUTABLE )
|
||||
continue;
|
||||
|
||||
if( (pt_rats->m_Status & CH_ROUTE_REQ) == 0 )
|
||||
continue;
|
||||
|
||||
pt_pad = pt_rats->m_PadStart;
|
||||
|
||||
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
|
||||
+ demi_pas ) / Board.m_GridRouting;
|
||||
|
||||
if( r1 < 0 || r1 >= Nrows )
|
||||
{
|
||||
msg.Printf( wxT( "error : row = %d ( padY %d pcbY %d) " ), r1,
|
||||
@ -326,8 +337,10 @@ int Build_Work( BOARD* Pcb )
|
||||
wxMessageBox( msg );
|
||||
return 0;
|
||||
}
|
||||
|
||||
c1 = ( pt_pad->GetPosition().x - Pcb->m_BoundaryBox.m_Pos.x
|
||||
+ demi_pas ) / Board.m_GridRouting;
|
||||
|
||||
if( c1 < 0 || c1 >= Ncols )
|
||||
{
|
||||
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
|
||||
+ demi_pas ) / Board.m_GridRouting;
|
||||
|
||||
if( r2 < 0 || r2 >= Nrows )
|
||||
{
|
||||
msg.Printf( wxT( "error : row = %d ( padY %d pcbY %d) " ), r2,
|
||||
@ -347,8 +361,10 @@ int Build_Work( BOARD* Pcb )
|
||||
wxMessageBox( msg );
|
||||
return 0;
|
||||
}
|
||||
|
||||
c2 = ( pt_pad->GetPosition().x - Pcb->m_BoundaryBox.m_Pos.x
|
||||
+ demi_pas ) / Board.m_GridRouting;
|
||||
|
||||
if( c2 < 0 || c2 >= Ncols )
|
||||
{
|
||||
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 )
|
||||
{
|
||||
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;
|
||||
|
||||
if( aArcAngle != 3600 )
|
||||
{
|
||||
RotatePoint( &arc_end, aCentre, -aArcAngle );
|
||||
@ -63,12 +64,13 @@ void TransformArcToPolygon( std::vector <CPolyPt>& aCornerBuffer,
|
||||
// Compute the ends of segments and creates poly
|
||||
wxPoint curr_end = arc_start;
|
||||
wxPoint curr_start = arc_start;
|
||||
|
||||
for( int ii = delta; ii < aArcAngle; ii += delta )
|
||||
{
|
||||
curr_end = arc_start;
|
||||
RotatePoint( &curr_end, aCentre, -ii );
|
||||
TransformRoundedEndsSegmentToPolygon( aCornerBuffer,
|
||||
curr_start, curr_end, aCircleToSegmentsCount, aWidth );
|
||||
TransformRoundedEndsSegmentToPolygon( aCornerBuffer, curr_start, curr_end,
|
||||
aCircleToSegmentsCount, aWidth );
|
||||
curr_start = curr_end;
|
||||
}
|
||||
|
||||
@ -90,11 +92,10 @@ void TransformArcToPolygon( std::vector <CPolyPt>& aCornerBuffer,
|
||||
* clearance when the circle is approximated by segment bigger or equal
|
||||
* to the real clearance value (usually near from 1.0)
|
||||
*/
|
||||
void TEXTE_PCB::TransformShapeWithClearanceToPolygon(
|
||||
std::vector <CPolyPt>& aCornerBuffer,
|
||||
int aClearanceValue,
|
||||
int aCircleToSegmentsCount,
|
||||
double aCorrectionFactor )
|
||||
void TEXTE_PCB::TransformShapeWithClearanceToPolygon( std::vector <CPolyPt>& aCornerBuffer,
|
||||
int aClearanceValue,
|
||||
int aCircleToSegmentsCount,
|
||||
double aCorrectionFactor )
|
||||
{
|
||||
if( GetLength() == 0 )
|
||||
return;
|
||||
@ -115,9 +116,7 @@ void TEXTE_PCB::TransformShapeWithClearanceToPolygon(
|
||||
for( int ii = 0; ii < 4; ii++ )
|
||||
{
|
||||
// Rotate polygon
|
||||
RotatePoint( &corners[ii].x, &corners[ii].y,
|
||||
m_Pos.x, m_Pos.y,
|
||||
m_Orient );
|
||||
RotatePoint( &corners[ii].x, &corners[ii].y, m_Pos.x, m_Pos.y, m_Orient );
|
||||
aCornerBuffer.push_back( corners[ii] );
|
||||
}
|
||||
|
||||
@ -137,32 +136,31 @@ void TEXTE_PCB::TransformShapeWithClearanceToPolygon(
|
||||
* clearance when the circle is approxiamted by segment bigger or equal
|
||||
* to the real clearance value (usually near from 1.0)
|
||||
*/
|
||||
void DRAWSEGMENT::TransformShapeWithClearanceToPolygon(
|
||||
std::vector <CPolyPt>& aCornerBuffer,
|
||||
int aClearanceValue,
|
||||
int aCircleToSegmentsCount,
|
||||
double aCorrectionFactor )
|
||||
void DRAWSEGMENT::TransformShapeWithClearanceToPolygon( std::vector <CPolyPt>& aCornerBuffer,
|
||||
int aClearanceValue,
|
||||
int aCircleToSegmentsCount,
|
||||
double aCorrectionFactor )
|
||||
{
|
||||
switch( m_Shape )
|
||||
{
|
||||
case S_CIRCLE:
|
||||
TransformArcToPolygon( aCornerBuffer, m_Start, // Circle centre
|
||||
m_End, 3600,
|
||||
aCircleToSegmentsCount,
|
||||
m_Width + (2 * aClearanceValue) );
|
||||
m_End, 3600,
|
||||
aCircleToSegmentsCount,
|
||||
m_Width + (2 * aClearanceValue) );
|
||||
break;
|
||||
|
||||
case S_ARC:
|
||||
TransformArcToPolygon( aCornerBuffer, m_Start,
|
||||
m_End, m_Angle,
|
||||
aCircleToSegmentsCount,
|
||||
m_Width + (2 * aClearanceValue) );
|
||||
m_End, m_Angle,
|
||||
aCircleToSegmentsCount,
|
||||
m_Width + (2 * aClearanceValue) );
|
||||
break;
|
||||
|
||||
default:
|
||||
TransformRoundedEndsSegmentToPolygon(
|
||||
aCornerBuffer, m_Start, m_End,
|
||||
aCircleToSegmentsCount, m_Width + (2 * aClearanceValue) );
|
||||
TransformRoundedEndsSegmentToPolygon( aCornerBuffer, m_Start, m_End,
|
||||
aCircleToSegmentsCount,
|
||||
m_Width + (2 * aClearanceValue) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -188,17 +186,17 @@ void TRACK:: TransformShapeWithClearanceToPolygon( std:: vector < CPolyPt>& aCor
|
||||
wxPoint corner_position;
|
||||
int ii, angle;
|
||||
int dx = (m_Width / 2) + aClearanceValue;
|
||||
int delta = 3600 / aCircleToSegmentsCount; // rot angle in 0.1 degree
|
||||
int delta = 3600 / aCircleToSegmentsCount; // rot angle in 0.1 degree
|
||||
|
||||
switch( Type() )
|
||||
{
|
||||
case TYPE_VIA:
|
||||
dx = (int) ( dx * aCorrectionFactor );
|
||||
|
||||
for( ii = 0; ii < aCircleToSegmentsCount; ii++ )
|
||||
{
|
||||
corner_position = wxPoint( dx, 0 );
|
||||
RotatePoint( &corner_position.x, &corner_position.y,
|
||||
(1800 / aCircleToSegmentsCount) );
|
||||
RotatePoint( &corner_position.x, &corner_position.y, (1800 / aCircleToSegmentsCount) );
|
||||
angle = ii * delta;
|
||||
RotatePoint( &corner_position.x, &corner_position.y, angle );
|
||||
corner_position.x += m_Start.x;
|
||||
@ -211,11 +209,10 @@ void TRACK:: TransformShapeWithClearanceToPolygon( std:: vector < CPolyPt>& aCor
|
||||
break;
|
||||
|
||||
default:
|
||||
TransformRoundedEndsSegmentToPolygon(
|
||||
aCornerBuffer,
|
||||
m_Start, m_End,
|
||||
aCircleToSegmentsCount,
|
||||
m_Width + ( 2 * aClearanceValue) );
|
||||
TransformRoundedEndsSegmentToPolygon( aCornerBuffer,
|
||||
m_Start, m_End,
|
||||
aCircleToSegmentsCount,
|
||||
m_Width + ( 2 * aClearanceValue) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -228,7 +225,7 @@ void TransformRoundedEndsSegmentToPolygon( std::vector <CPolyPt>& aCornerBuffer,
|
||||
int aCircleToSegmentsCount,
|
||||
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 startp = aStart;
|
||||
wxPoint corner;
|
||||
@ -241,20 +238,21 @@ void TransformRoundedEndsSegmentToPolygon( std::vector <CPolyPt>& aCornerBuffer,
|
||||
endp = aStart - aEnd;
|
||||
startp = aEnd;
|
||||
}
|
||||
|
||||
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 ) );
|
||||
|
||||
int delta = 3600 / aCircleToSegmentsCount; // rot angle in 0.1 degree
|
||||
|
||||
// Compute the outlines of the segment, and creates a polygon
|
||||
corner = wxPoint( 0, rayon );
|
||||
corner = wxPoint( 0, radius );
|
||||
RotatePoint( &corner, -delta_angle );
|
||||
corner += startp;
|
||||
polypoint.x = corner.x;
|
||||
polypoint.y = corner.y;
|
||||
aCornerBuffer.push_back( polypoint );
|
||||
|
||||
corner = wxPoint( seg_len, rayon );
|
||||
corner = wxPoint( seg_len, radius );
|
||||
RotatePoint( &corner, -delta_angle );
|
||||
corner += startp;
|
||||
polypoint.x = corner.x;
|
||||
@ -264,7 +262,7 @@ void TransformRoundedEndsSegmentToPolygon( std::vector <CPolyPt>& aCornerBuffer,
|
||||
// add right rounded end:
|
||||
for( int ii = delta; ii < 1800; ii += delta )
|
||||
{
|
||||
corner = wxPoint( 0, rayon );
|
||||
corner = wxPoint( 0, radius );
|
||||
RotatePoint( &corner, ii );
|
||||
corner.x += seg_len;
|
||||
RotatePoint( &corner, -delta_angle );
|
||||
@ -274,14 +272,14 @@ void TransformRoundedEndsSegmentToPolygon( std::vector <CPolyPt>& aCornerBuffer,
|
||||
aCornerBuffer.push_back( polypoint );
|
||||
}
|
||||
|
||||
corner = wxPoint( seg_len, -rayon );
|
||||
corner = wxPoint( seg_len, -radius );
|
||||
RotatePoint( &corner, -delta_angle );
|
||||
corner += startp;
|
||||
polypoint.x = corner.x;
|
||||
polypoint.y = corner.y;
|
||||
aCornerBuffer.push_back( polypoint );
|
||||
|
||||
corner = wxPoint( 0, -rayon );
|
||||
corner = wxPoint( 0, -radius );
|
||||
RotatePoint( &corner, -delta_angle );
|
||||
corner += startp;
|
||||
polypoint.x = corner.x;
|
||||
@ -291,7 +289,7 @@ void TransformRoundedEndsSegmentToPolygon( std::vector <CPolyPt>& aCornerBuffer,
|
||||
// add left rounded end:
|
||||
for( int ii = delta; ii < 1800; ii += delta )
|
||||
{
|
||||
corner = wxPoint( 0, -rayon );
|
||||
corner = wxPoint( 0, -radius );
|
||||
RotatePoint( &corner, ii );
|
||||
RotatePoint( &corner, -delta_angle );
|
||||
corner += startp;
|
||||
@ -326,17 +324,18 @@ void D_PAD:: TransformShapeWithClearanceToPolygon( std:: vector < CPolyPt>& aCor
|
||||
int dx = (m_Size.x / 2) + aClearanceValue;
|
||||
int dy = (m_Size.y / 2) + aClearanceValue;
|
||||
|
||||
int delta = 3600 / aCircleToSegmentsCount; // rot angle in 0.1 degree
|
||||
wxPoint PadShapePos = ReturnShapePos(); /* Note: for pad having a shape offset,
|
||||
* the pad position is NOT the shape position */
|
||||
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
|
||||
*/
|
||||
int delta = 3600 / aCircleToSegmentsCount; // rot angle in 0.1 degree
|
||||
wxPoint PadShapePos = ReturnShapePos(); /* Note: for pad having a shape offset,
|
||||
* the pad position is NOT the shape position */
|
||||
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 */
|
||||
|
||||
switch( m_PadShape )
|
||||
{
|
||||
case PAD_CIRCLE:
|
||||
dx = (int) ( dx * aCorrectionFactor );
|
||||
|
||||
for( ii = 0; ii < aCircleToSegmentsCount; ii++ )
|
||||
{
|
||||
corner_position = wxPoint( dx, 0 );
|
||||
@ -360,7 +359,8 @@ void D_PAD:: TransformShapeWithClearanceToPolygon( std:: vector < CPolyPt>& aCor
|
||||
dy = (int) ( dy * aCorrectionFactor );
|
||||
int angle_pg; // Polygon angle
|
||||
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...
|
||||
{
|
||||
@ -434,10 +434,13 @@ void D_PAD:: TransformShapeWithClearanceToPolygon( std:: vector < CPolyPt>& aCor
|
||||
psize.y += ABS( m_DeltaSize.x );
|
||||
|
||||
// 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;
|
||||
int rounding_radius = (int) ( aClearanceValue * aCorrectionFactor ); // Corner rounding radius
|
||||
int angle_pg; // Polygon increment angle
|
||||
|
||||
// Corner rounding radius
|
||||
int rounding_radius = (int) ( aClearanceValue * aCorrectionFactor );
|
||||
int angle_pg; // Polygon increment angle
|
||||
|
||||
for( int i = 0; i < aCircleToSegmentsCount / 4 + 1; i++ )
|
||||
{
|
||||
@ -449,11 +452,11 @@ void D_PAD:: TransformShapeWithClearanceToPolygon( std:: vector < CPolyPt>& aCor
|
||||
RotatePoint( &corner_position, angle_pg );
|
||||
|
||||
// Rounding vector rotation
|
||||
corner_position -= psize / 2; // Rounding vector + Pad corner offset
|
||||
corner_position -= psize / 2; // Rounding vector + Pad corner offset
|
||||
RotatePoint( &corner_position, angle );
|
||||
|
||||
// Rotate according to module orientation
|
||||
corner_position += PadShapePos; // Shift origin to position
|
||||
corner_position += PadShapePos; // Shift origin to position
|
||||
CPolyPt polypoint( corner_position.x, corner_position.y );
|
||||
aCornerBuffer.push_back( polypoint );
|
||||
}
|
||||
@ -471,9 +474,7 @@ void D_PAD:: TransformShapeWithClearanceToPolygon( std:: vector < CPolyPt>& aCor
|
||||
aCornerBuffer.push_back( polypoint );
|
||||
}
|
||||
|
||||
for( int i = 0;
|
||||
i < aCircleToSegmentsCount / 4 + 1;
|
||||
i++ )
|
||||
for( int i = 0; i < aCircleToSegmentsCount / 4 + 1; i++ )
|
||||
{
|
||||
corner_position = wxPoint( 0, rounding_radius );
|
||||
RotatePoint( &corner_position, (1800 / aCircleToSegmentsCount) );
|
||||
@ -533,7 +534,8 @@ void D_PAD:: TransformShapeWithClearanceToPolygon( std:: vector < CPolyPt>& aCor
|
||||
* And
|
||||
* nothing else between holes
|
||||
* 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
|
||||
* a hole above the identical holes
|
||||
*
|
||||
@ -547,8 +549,8 @@ void D_PAD:: TransformShapeWithClearanceToPolygon( std:: vector < CPolyPt>& aCor
|
||||
*
|
||||
* Note 2:
|
||||
* 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
|
||||
* by creating stubs and destroy their properties.
|
||||
* and are used in microwave applications and they *DO NOT* have a thermal relief that
|
||||
* change the shape by creating stubs and destroy their properties.
|
||||
*/
|
||||
void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer,
|
||||
D_PAD& aPad,
|
||||
@ -579,6 +581,7 @@ void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer,
|
||||
* with a thickness of aMinThicknessValue will increase real thickness by aMinThicknessValue
|
||||
*/
|
||||
aCopperThickness -= aMinThicknessValue;
|
||||
|
||||
if( 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
|
||||
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;
|
||||
int y = outer_radius - (aThermalGap / 4);
|
||||
corner.y = (int) sqrt( ( ( (double) y * y ) - (double) corner.x * corner.x ) );
|
||||
|
||||
if( aThermalRot != 0 )
|
||||
corners_buffer.push_back( corner );
|
||||
|
||||
// calculate the starting point of the outter arc
|
||||
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;
|
||||
RotatePoint( &corner, 90 );
|
||||
|
||||
@ -638,7 +644,8 @@ void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer,
|
||||
|
||||
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.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
|
||||
// this seems a bug in kbool polygon (exists in 2.0 kbool version)
|
||||
// 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
|
||||
int angle_pad = aPad.m_Orient; // Pad orientation
|
||||
int th_angle = aThermalRot;
|
||||
|
||||
for( unsigned ihole = 0; ihole < 4; ihole++ )
|
||||
{
|
||||
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.
|
||||
// if this is not the case, exchange dx and dy, and rotate the shape 90 deg.
|
||||
int supp_angle = 0;
|
||||
|
||||
if( dx < dy )
|
||||
{
|
||||
EXCHG( dx, dy );
|
||||
supp_angle = 900;
|
||||
EXCHG( copper_thickness.x, copper_thickness.y );
|
||||
}
|
||||
|
||||
int deltasize = dx - dy; // = distance between shape position and the 2 demi-circle ends centre
|
||||
// here we have dx > dy
|
||||
// Radius of outer arcs of the shape:
|
||||
@ -703,9 +714,8 @@ 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.
|
||||
{
|
||||
corner.x = copper_thickness.x / 2;
|
||||
corner.y =
|
||||
(int) sqrt( ( (double) outer_radius * outer_radius ) -
|
||||
( (double) ( corner.x - delta ) * ( corner.x - deltasize ) ) );
|
||||
corner.y = (int) sqrt( ( (double) outer_radius * outer_radius ) -
|
||||
( (double) ( corner.x - delta ) * ( corner.x - deltasize ) ) );
|
||||
corner.x -= deltasize;
|
||||
|
||||
/* creates an intermediate point, to have a > 90 deg angle
|
||||
@ -724,7 +734,8 @@ void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer,
|
||||
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;
|
||||
last_corner.y = copper_thickness.y / 2;
|
||||
int px = outer_radius - (aThermalGap / 4);
|
||||
@ -745,13 +756,14 @@ void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer,
|
||||
RotatePoint( &corner, delta );
|
||||
}
|
||||
|
||||
//corners_buffer.push_back(corner + shape_offset); // TODO: about one mil geometry error forms somewhere.
|
||||
//corners_buffer.push_back(corner + shape_offset); // TODO: about one mil geometry error forms somewhere.
|
||||
corners_buffer.push_back( corner_end + shape_offset );
|
||||
corners_buffer.push_back( last_corner + shape_offset ); // Enabling the line above shows intersection point.
|
||||
|
||||
/* Create 2 holes, rotated by pad rotation.
|
||||
*/
|
||||
int angle = aPad.m_Orient + supp_angle;
|
||||
|
||||
for( int irect = 0; irect < 2; irect++ )
|
||||
{
|
||||
for( unsigned ic = 0; ic < corners_buffer.size(); ic++ )
|
||||
@ -764,6 +776,7 @@ void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer,
|
||||
|
||||
aCornerBuffer.back().end_contour = true;
|
||||
angle += 1800; // this is calculate hole 3
|
||||
|
||||
if( 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
|
||||
angle = aPad.m_Orient + supp_angle;
|
||||
|
||||
for( int irect = 0; irect < 2; irect++ )
|
||||
{
|
||||
for( unsigned ic = 0; ic < corners_buffer.size(); ic++ )
|
||||
@ -790,6 +804,7 @@ void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer,
|
||||
|
||||
aCornerBuffer.back().end_contour = true;
|
||||
angle += 1800;
|
||||
|
||||
if( angle >= 3600 )
|
||||
angle -= 3600;
|
||||
}
|
||||
@ -818,15 +833,17 @@ void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer,
|
||||
// | |
|
||||
// 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
|
||||
|
||||
int dx = (aPad.m_Size.x / 2) + aThermalGap; // Cutout radius x
|
||||
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 third is upper right corner and the rest are rounding vertices going anticlockwise. Note the inveted Y-axis in CG.
|
||||
// The first point of polygon buffer is left lower corner, second the crosspoint of
|
||||
// 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 ) ); // fill and spoke corner
|
||||
corners_buffer.push_back( wxPoint( -copper_thickness.x / 2, -copper_thickness.y / 2 ) );
|
||||
@ -852,13 +869,14 @@ void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer,
|
||||
for( unsigned ic = 0; ic < corners_buffer.size(); ic++ )
|
||||
{
|
||||
wxPoint cpos = corners_buffer[ic];
|
||||
RotatePoint( &cpos, angle ); // Rotate according to module orientation
|
||||
cpos += PadShapePos; // Shift origin to position
|
||||
RotatePoint( &cpos, angle ); // Rotate according to module orientation
|
||||
cpos += PadShapePos; // Shift origin to position
|
||||
aCornerBuffer.push_back( CPolyPt( cpos.x, cpos.y ) );
|
||||
}
|
||||
|
||||
aCornerBuffer.back().end_contour = true;
|
||||
angle += 1800; // this is calculate hole 3
|
||||
|
||||
if( angle >= 3600 )
|
||||
angle -= 3600;
|
||||
}
|
||||
@ -884,6 +902,7 @@ void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer,
|
||||
|
||||
aCornerBuffer.back().end_contour = true;
|
||||
angle += 1800;
|
||||
|
||||
if( angle >= 3600 )
|
||||
angle -= 3600;
|
||||
}
|
||||
|
@ -16,7 +16,8 @@
|
||||
* 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
|
||||
* 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
|
||||
* (the old values of parameters are therefore saved)
|
||||
*
|
||||
@ -49,9 +50,11 @@
|
||||
* => the copy of item(s) is moved in Undo list
|
||||
*
|
||||
* - 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)
|
||||
* mirror (Y) and flip list of items (undo/redo is made by mirror or flip items)
|
||||
* 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
|
||||
* Used in undo / redo command:
|
||||
@ -119,6 +118,7 @@ void SwapData( BOARD_ITEM* aItem, BOARD_ITEM* aImage )
|
||||
* @param aItem = the item
|
||||
* @param aImage = a copy of the item
|
||||
*/
|
||||
void SwapData( BOARD_ITEM* aItem, BOARD_ITEM* aImage )
|
||||
{
|
||||
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_Shape, image->m_Shape );
|
||||
int atmp = track->GetDrillValue();
|
||||
|
||||
if( track->IsDrillDefault() )
|
||||
atmp = -1;
|
||||
|
||||
int itmp = image->GetDrillValue();
|
||||
|
||||
if( image->IsDrillDefault() )
|
||||
itmp = -1;
|
||||
|
||||
EXCHG(itmp, atmp );
|
||||
|
||||
if( atmp > 0 )
|
||||
track->SetDrillValue( atmp );
|
||||
else
|
||||
track->SetDrillDefault();
|
||||
|
||||
if( itmp > 0 )
|
||||
image->SetDrillValue( itmp );
|
||||
else
|
||||
@ -203,11 +209,11 @@ void SwapData( BOARD_ITEM* aItem, BOARD_ITEM* aImage )
|
||||
EXCHG( ( (TEXTE_PCB*) aItem )->m_VJustify, ( (TEXTE_PCB*) aImage )->m_VJustify );
|
||||
break;
|
||||
|
||||
case TYPE_MIRE:
|
||||
EXCHG( ( (MIREPCB*) aItem )->m_Pos, ( (MIREPCB*) aImage )->m_Pos );
|
||||
EXCHG( ( (MIREPCB*) aItem )->m_Width, ( (MIREPCB*) aImage )->m_Width );
|
||||
EXCHG( ( (MIREPCB*) aItem )->m_Size, ( (MIREPCB*) aImage )->m_Size );
|
||||
EXCHG( ( (MIREPCB*) aItem )->m_Shape, ( (MIREPCB*) aImage )->m_Shape );
|
||||
case PCB_TARGET_T:
|
||||
EXCHG( ( (PCB_TARGET*) aItem )->m_Pos, ( (PCB_TARGET*) aImage )->m_Pos );
|
||||
EXCHG( ( (PCB_TARGET*) aItem )->m_Width, ( (PCB_TARGET*) aImage )->m_Width );
|
||||
EXCHG( ( (PCB_TARGET*) aItem )->m_Size, ( (PCB_TARGET*) aImage )->m_Size );
|
||||
EXCHG( ( (PCB_TARGET*) aItem )->m_Shape, ( (PCB_TARGET*) aImage )->m_Shape );
|
||||
break;
|
||||
|
||||
case TYPE_DIMENSION:
|
||||
@ -217,8 +223,10 @@ void SwapData( BOARD_ITEM* aItem, BOARD_ITEM* aImage )
|
||||
( (DIMENSION*) aImage )->SetText( txt );
|
||||
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_Thickness, ( (DIMENSION*) aImage )->m_Text->m_Thickness );
|
||||
EXCHG( ( (DIMENSION*) aItem )->m_Text->m_Mirror, ( (DIMENSION*) aImage )->m_Text->m_Mirror );
|
||||
EXCHG( ( (DIMENSION*) aItem )->m_Text->m_Thickness,
|
||||
( (DIMENSION*) aImage )->m_Text->m_Thickness );
|
||||
EXCHG( ( (DIMENSION*) aItem )->m_Text->m_Mirror,
|
||||
( (DIMENSION*) aImage )->m_Text->m_Mirror );
|
||||
}
|
||||
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.
|
||||
* The new object is not put in list (not linked)
|
||||
*/
|
||||
BOARD_ITEM* DuplicateStruct( BOARD_ITEM* aItem )
|
||||
{
|
||||
if( aItem == NULL )
|
||||
{
|
||||
@ -295,11 +300,11 @@ BOARD_ITEM* DuplicateStruct( BOARD_ITEM* aItem )
|
||||
}
|
||||
break;
|
||||
|
||||
case TYPE_MIRE:
|
||||
case PCB_TARGET_T:
|
||||
{
|
||||
MIREPCB* new_mire = new MIREPCB( aItem->GetParent() );
|
||||
new_mire->Copy( (MIREPCB*) aItem );
|
||||
return new_mire;
|
||||
PCB_TARGET* target = new PCB_TARGET( aItem->GetParent() );
|
||||
target->Copy( (PCB_TARGET*) aItem );
|
||||
return target;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -413,6 +418,7 @@ void PCB_EDIT_FRAME::SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList,
|
||||
{
|
||||
BOARD_ITEM* item = (BOARD_ITEM*) commandToUndo->GetPickedItem( ii );
|
||||
UNDO_REDO_T command = commandToUndo->GetPickedItemStatus( ii );
|
||||
|
||||
if( command == UR_UNSPECIFIED )
|
||||
{
|
||||
command = aTypeCommand;
|
||||
@ -461,7 +467,9 @@ void PCB_EDIT_FRAME::SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList,
|
||||
GetScreen()->ClearUndoORRedoList( GetScreen()->m_RedoList );
|
||||
}
|
||||
else // Should not occur
|
||||
{
|
||||
delete commandToUndo;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -555,9 +563,8 @@ void PCB_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRed
|
||||
default:
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( wxT(
|
||||
"PutDataInPreviousState() error (unknown code %X)" ),
|
||||
aList->GetPickedItemStatus( ii ) );
|
||||
msg.Printf( wxT( "PutDataInPreviousState() error (unknown code %X)" ),
|
||||
aList->GetPickedItemStatus( ii ) );
|
||||
wxMessageBox( msg );
|
||||
}
|
||||
break;
|
||||
@ -573,10 +580,6 @@ void PCB_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRed
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************/
|
||||
void PCB_EDIT_FRAME::GetBoardFromUndoList( wxCommandEvent& event )
|
||||
/**********************************************************/
|
||||
|
||||
/**
|
||||
* Function GetBoardFromUndoList
|
||||
* 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
|
||||
* @return none
|
||||
*/
|
||||
void PCB_EDIT_FRAME::GetBoardFromUndoList( wxCommandEvent& event )
|
||||
{
|
||||
if( GetScreen()->GetUndoCommandCount() <= 0 )
|
||||
return;
|
||||
@ -630,10 +634,6 @@ void PCB_EDIT_FRAME::GetBoardFromRedoList( wxCommandEvent& event )
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************/
|
||||
void PCB_SCREEN::ClearUndoORRedoList( UNDO_REDO_CONTAINER& aList, int aItemCount )
|
||||
/**********************************************************************************/
|
||||
|
||||
/**
|
||||
* Function ClearUndoORRedoList
|
||||
* 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.
|
||||
* So this function can be called to remove old commands
|
||||
*/
|
||||
void PCB_SCREEN::ClearUndoORRedoList( UNDO_REDO_CONTAINER& aList, int aItemCount )
|
||||
{
|
||||
if( aItemCount == 0 )
|
||||
return;
|
||||
|
||||
unsigned icnt = aList.m_CommandsList.size();
|
||||
|
||||
if( aItemCount > 0 )
|
||||
icnt = aItemCount;
|
||||
|
||||
@ -657,6 +659,7 @@ void PCB_SCREEN::ClearUndoORRedoList( UNDO_REDO_CONTAINER& aList, int aItemCount
|
||||
{
|
||||
if( aList.m_CommandsList.size() == 0 )
|
||||
break;
|
||||
|
||||
PICKED_ITEMS_LIST* curr_cmd = aList.m_CommandsList[0];
|
||||
aList.m_CommandsList.erase( aList.m_CommandsList.begin() );
|
||||
|
||||
|
@ -39,8 +39,7 @@ BOARD::BOARD( EDA_ITEM* parent, PCB_BASE_FRAME* frame ) :
|
||||
// progress
|
||||
m_NetInfo = new NETINFO_LIST( this ); // handle nets info list (name,
|
||||
// design constraints ..
|
||||
m_NetInfo->BuildListOfNets(); // prepare pads and nets lists
|
||||
// containers.
|
||||
m_NetInfo->BuildListOfNets(); // prepare pads and nets lists containers.
|
||||
|
||||
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
|
||||
// defaults
|
||||
// will get overwritten during load.
|
||||
m_NetClasses.GetDefault()->SetDescription(
|
||||
_( "This is the default net class." ) );
|
||||
m_NetClasses.GetDefault()->SetDescription( _( "This is the default net class." ) );
|
||||
m_ViaSizeSelector = 0;
|
||||
m_TrackWidthSelector = 0;
|
||||
|
||||
@ -88,6 +86,7 @@ BOARD::~BOARD()
|
||||
delete m_NetInfo;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Function PushHightLight
|
||||
* save current hight light info for later use
|
||||
@ -97,6 +96,7 @@ void BOARD::PushHightLight()
|
||||
m_hightLightPrevious = m_hightLight;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Function PopHightLight
|
||||
* retrieve a previously saved hight light info
|
||||
@ -107,6 +107,7 @@ void BOARD::PopHightLight()
|
||||
m_hightLightPrevious.Clear();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function SetCurrentNetClass
|
||||
* 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;
|
||||
m_ViasDimensionsList.push_back( viadim );
|
||||
}
|
||||
|
||||
if( m_TrackWidthList.size() == 0 )
|
||||
{
|
||||
lists_sizes_modified = true;
|
||||
@ -145,14 +147,17 @@ bool BOARD::SetCurrentNetClass( const wxString& aNetClassName )
|
||||
*/
|
||||
if( m_ViasDimensionsList[0].m_Diameter != netClass->GetViaDiameter() )
|
||||
lists_sizes_modified = true;
|
||||
|
||||
m_ViasDimensionsList[0].m_Diameter = netClass->GetViaDiameter();
|
||||
|
||||
if( m_TrackWidthList[0] != netClass->GetTrackWidth() )
|
||||
lists_sizes_modified = true;
|
||||
|
||||
m_TrackWidthList[0] = netClass->GetTrackWidth();
|
||||
|
||||
if( m_ViaSizeSelector >= m_ViasDimensionsList.size() )
|
||||
m_ViaSizeSelector = m_ViasDimensionsList.size();
|
||||
|
||||
if( m_TrackWidthSelector >= m_TrackWidthList.size() )
|
||||
m_TrackWidthSelector = m_TrackWidthList.size();
|
||||
|
||||
@ -169,9 +174,7 @@ int BOARD::GetBiggestClearanceValue()
|
||||
int clearance = m_NetClasses.GetDefault()->GetClearance();
|
||||
|
||||
//Read list of Net Classes
|
||||
for( NETCLASSES::const_iterator nc = m_NetClasses.begin();
|
||||
nc != m_NetClasses.end();
|
||||
nc++ )
|
||||
for( NETCLASSES::const_iterator nc = m_NetClasses.begin(); nc != m_NetClasses.end(); nc++ )
|
||||
{
|
||||
NETCLASS* netclass = nc->second;
|
||||
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++ )
|
||||
{
|
||||
if( i != aLayerIndex && IsLayerEnabled( i )
|
||||
&& NameTemp == m_Layer[i].m_Name )
|
||||
if( i != aLayerIndex && IsLayerEnabled( i ) && NameTemp == m_Layer[i].m_Name )
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -314,6 +316,7 @@ LAYER_T BOARD::GetLayerType( int aLayerIndex ) const
|
||||
// in the layer sequence.
|
||||
if( IsLayerEnabled( aLayerIndex ) )
|
||||
return m_Layer[aLayerIndex].m_Type;
|
||||
|
||||
return LT_SIGNAL;
|
||||
}
|
||||
|
||||
@ -330,6 +333,7 @@ bool BOARD::SetLayerType( int aLayerIndex, LAYER_T aLayerType )
|
||||
m_Layer[aLayerIndex].m_Type = aLayerType;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -430,6 +434,7 @@ void BOARD::SetVisibleElements( int aMask )
|
||||
void BOARD::SetVisibleAlls( )
|
||||
{
|
||||
SetVisibleLayers( FULL_LAYERS );
|
||||
|
||||
/* Call SetElementVisibility for each item,
|
||||
* to ensure specific calculations that can be needed by some items
|
||||
*/
|
||||
@ -461,14 +466,15 @@ void BOARD::SetElementVisibility( int aPCB_VISIBLE, bool isEnabled )
|
||||
// so the hide/show option is a per item selection
|
||||
if( IsElementVisible(RATSNEST_VISIBLE) )
|
||||
{
|
||||
for( unsigned ii = 0; ii < GetRatsnestsCount(); ii++ )
|
||||
m_FullRatsnest[ii].m_Status |= CH_VISIBLE;
|
||||
for( unsigned ii = 0; ii < GetRatsnestsCount(); ii++ )
|
||||
m_FullRatsnest[ii].m_Status |= CH_VISIBLE;
|
||||
}
|
||||
else
|
||||
{
|
||||
for( unsigned ii = 0; ii < GetRatsnestsCount(); ii++ )
|
||||
m_FullRatsnest[ii].m_Status &= ~CH_VISIBLE;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
|
||||
@ -541,6 +547,7 @@ int BOARD::GetLayerColor( int aLayer )
|
||||
return GetColorsSettings()->GetLayerColor( aLayer );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function IsModuleLayerVisible
|
||||
* 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 )
|
||||
return IsElementVisible( PCB_VISIBLE(MOD_FR_VISIBLE) );
|
||||
|
||||
else if( layer==LAYER_N_BACK )
|
||||
return IsElementVisible( PCB_VISIBLE(MOD_BK_VISIBLE) );
|
||||
|
||||
else
|
||||
return true;
|
||||
}
|
||||
@ -612,6 +617,7 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, int aControl )
|
||||
m_Modules.PushBack( (MODULE*) aBoardItem );
|
||||
else
|
||||
m_Modules.PushFront( (MODULE*) aBoardItem );
|
||||
|
||||
aBoardItem->SetParent( this );
|
||||
|
||||
// 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_TEXTE:
|
||||
case TYPE_EDGE_MODULE:
|
||||
case TYPE_MIRE:
|
||||
case PCB_TARGET_T:
|
||||
if( aControl & ADD_APPEND )
|
||||
m_Drawings.PushBack( aBoardItem );
|
||||
else
|
||||
m_Drawings.PushFront( aBoardItem );
|
||||
|
||||
aBoardItem->SetParent( this );
|
||||
break;
|
||||
|
||||
@ -636,9 +643,8 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, int aControl )
|
||||
default:
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf(
|
||||
wxT( "BOARD::Add() needs work: BOARD_ITEM type (%d) not handled" ),
|
||||
aBoardItem->Type() );
|
||||
msg.Printf( wxT( "BOARD::Add() needs work: BOARD_ITEM type (%d) not handled" ),
|
||||
aBoardItem->Type() );
|
||||
wxFAIL_MSG( msg );
|
||||
}
|
||||
break;
|
||||
@ -697,7 +703,7 @@ BOARD_ITEM* BOARD::Remove( BOARD_ITEM* aBoardItem )
|
||||
case TYPE_DRAWSEGMENT:
|
||||
case TYPE_TEXTE:
|
||||
case TYPE_EDGE_MODULE:
|
||||
case TYPE_MIRE:
|
||||
case PCB_TARGET_T:
|
||||
m_Drawings.Remove( aBoardItem );
|
||||
break;
|
||||
|
||||
@ -774,6 +780,7 @@ bool BOARD::ComputeBoundingBox( bool aBoardEdgesOnly )
|
||||
area = item->GetBoundingBox();
|
||||
else
|
||||
area.Merge( item->GetBoundingBox() );
|
||||
|
||||
hasItems = true;
|
||||
}
|
||||
|
||||
@ -786,6 +793,7 @@ bool BOARD::ComputeBoundingBox( bool aBoardEdgesOnly )
|
||||
area = module->GetBoundingBox();
|
||||
else
|
||||
area.Merge( module->GetBoundingBox() );
|
||||
|
||||
hasItems = true;
|
||||
}
|
||||
|
||||
@ -796,6 +804,7 @@ bool BOARD::ComputeBoundingBox( bool aBoardEdgesOnly )
|
||||
area = track->GetBoundingBox();
|
||||
else
|
||||
area.Merge( track->GetBoundingBox() );
|
||||
|
||||
hasItems = true;
|
||||
}
|
||||
|
||||
@ -806,6 +815,7 @@ bool BOARD::ComputeBoundingBox( bool aBoardEdgesOnly )
|
||||
area = track->GetBoundingBox();
|
||||
else
|
||||
area.Merge( track->GetBoundingBox() );
|
||||
|
||||
hasItems = true;
|
||||
}
|
||||
|
||||
@ -818,6 +828,7 @@ bool BOARD::ComputeBoundingBox( bool aBoardEdgesOnly )
|
||||
area = aZone->GetBoundingBox();
|
||||
else
|
||||
area.Merge( aZone->GetBoundingBox() );
|
||||
|
||||
area.Merge( aZone->GetBoundingBox() );
|
||||
hasItems = true;
|
||||
}
|
||||
@ -836,7 +847,7 @@ bool BOARD::ComputeBoundingBox( bool aBoardEdgesOnly )
|
||||
area.SetOrigin( -m_PcbFrame->GetScreen()->ReturnPageSize().x / 2,
|
||||
-m_PcbFrame->GetScreen()->ReturnPageSize().y / 2 );
|
||||
area.SetEnd( m_PcbFrame->GetScreen()->ReturnPageSize().x / 2,
|
||||
m_PcbFrame->GetScreen()->ReturnPageSize().y / 2 );
|
||||
m_PcbFrame->GetScreen()->ReturnPageSize().y / 2 );
|
||||
}
|
||||
}
|
||||
|
||||
@ -858,6 +869,7 @@ void BOARD::DisplayInfo( EDA_DRAW_FRAME* frame )
|
||||
|
||||
int viasCount = 0;
|
||||
int trackSegmentsCount = 0;
|
||||
|
||||
for( BOARD_ITEM* item = m_Track; item; item = item->Next() )
|
||||
{
|
||||
if( item->Type() == TYPE_VIA )
|
||||
@ -914,6 +926,7 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData,
|
||||
while( !done )
|
||||
{
|
||||
stype = *p;
|
||||
|
||||
switch( stype )
|
||||
{
|
||||
case TYPE_PCB:
|
||||
@ -960,7 +973,7 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData,
|
||||
case TYPE_DRAWSEGMENT:
|
||||
case TYPE_TEXTE:
|
||||
case TYPE_DIMENSION:
|
||||
case TYPE_MIRE:
|
||||
case PCB_TARGET_T:
|
||||
result = IterateForward( m_Drawings, inspector, testData, p );
|
||||
|
||||
// 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_TEXTE:
|
||||
case TYPE_DIMENSION:
|
||||
case TYPE_MIRE:
|
||||
case PCB_TARGET_T:
|
||||
continue;
|
||||
|
||||
default:
|
||||
@ -1041,6 +1054,7 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData,
|
||||
for( unsigned i = 0; i<m_markers.size(); ++i )
|
||||
{
|
||||
result = m_markers[i]->Visit( inspector, testData, p );
|
||||
|
||||
if( result == SEARCH_QUIT )
|
||||
break;
|
||||
}
|
||||
@ -1053,9 +1067,8 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData,
|
||||
// TYPE_ZONE_CONTAINER are in the m_ZoneDescriptorList std::vector
|
||||
for( unsigned i = 0; i< m_ZoneDescriptorList.size(); ++i )
|
||||
{
|
||||
result = m_ZoneDescriptorList[i]->Visit( inspector,
|
||||
testData,
|
||||
p );
|
||||
result = m_ZoneDescriptorList[i]->Visit( inspector, testData, p );
|
||||
|
||||
if( result == SEARCH_QUIT )
|
||||
break;
|
||||
}
|
||||
@ -1108,7 +1121,7 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData,
|
||||
* D_PAD* pad = (D_PAD*) item;
|
||||
* if( pad->HitTest( refPos ) )
|
||||
* {
|
||||
* if( layer_mask & pad->m_Masque_Layer )
|
||||
* if( layer_mask & pad->m_layerMask )
|
||||
* {
|
||||
* found = item;
|
||||
* return SEARCH_QUIT;
|
||||
@ -1211,6 +1224,7 @@ NETINFO_ITEM* BOARD::FindNet( const wxString& aNetname ) const
|
||||
for( int ii = 1; ii < ncount; ii++ )
|
||||
{
|
||||
NETINFO_ITEM* item = m_NetInfo->GetNetItem( ii );
|
||||
|
||||
if( item && item->GetNetname() == aNetname )
|
||||
{
|
||||
return item;
|
||||
@ -1225,6 +1239,7 @@ NETINFO_ITEM* BOARD::FindNet( const wxString& aNetname ) const
|
||||
// NETINFO_LIST::Build_Pads_Full_List()
|
||||
int imax = ncount - 1;
|
||||
int index = imax;
|
||||
|
||||
while( ncount > 0 )
|
||||
{
|
||||
int ii = ncount;
|
||||
@ -1234,26 +1249,34 @@ NETINFO_ITEM* BOARD::FindNet( const wxString& aNetname ) const
|
||||
ncount++;
|
||||
|
||||
NETINFO_ITEM* item = m_NetInfo->GetNetItem( index );
|
||||
|
||||
if( item == NULL )
|
||||
return NULL;
|
||||
|
||||
int icmp = item->GetNetname().Cmp( aNetname );
|
||||
|
||||
if( icmp == 0 ) // found !
|
||||
{
|
||||
return item;
|
||||
}
|
||||
|
||||
if( icmp < 0 ) // must search after item
|
||||
{
|
||||
index += ncount;
|
||||
|
||||
if( index > imax )
|
||||
index = imax;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if( icmp > 0 ) // must search before item
|
||||
{
|
||||
index -= ncount;
|
||||
|
||||
if( index < 1 )
|
||||
index = 1;
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -1281,6 +1304,7 @@ MODULE* BOARD::FindModuleByReference( const wxString& aReference ) const
|
||||
found = module;
|
||||
return SEARCH_QUIT;
|
||||
}
|
||||
|
||||
return SEARCH_CONTINUE;
|
||||
}
|
||||
} 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)
|
||||
* @return int - net names count.
|
||||
*/
|
||||
int BOARD::ReturnSortedNetnamesList( wxArrayString& aNames,
|
||||
bool aSortbyPadsCount )
|
||||
int BOARD::ReturnSortedNetnamesList( wxArrayString& aNames, bool aSortbyPadsCount )
|
||||
{
|
||||
if( m_NetInfo->GetCount() == 0 )
|
||||
return 0;
|
||||
@ -1362,18 +1385,18 @@ bool BOARD::Save( FILE* aFile ) const
|
||||
{
|
||||
case TYPE_TEXTE:
|
||||
case TYPE_DRAWSEGMENT:
|
||||
case TYPE_MIRE:
|
||||
case PCB_TARGET_T:
|
||||
case TYPE_DIMENSION:
|
||||
if( !item->Save( aFile ) )
|
||||
goto out;
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
// future: throw exception here
|
||||
#if defined(DEBUG)
|
||||
printf( "BOARD::Save() ignoring m_Drawings type %d\n",
|
||||
item->Type() );
|
||||
printf( "BOARD::Save() ignoring m_Drawings type %d\n", item->Type() );
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
@ -1391,6 +1414,7 @@ bool BOARD::Save( FILE* aFile ) const
|
||||
|
||||
// save the zones
|
||||
fprintf( aFile, "$ZONE\n" );
|
||||
|
||||
for( item = m_Zone; item; item = item->Next() )
|
||||
if( !item->Save( aFile ) )
|
||||
goto out;
|
||||
@ -1427,6 +1451,7 @@ void BOARD::RedrawAreasOutlines( EDA_DRAW_PANEL* panel, wxDC* aDC, int aDrawMode
|
||||
for( int ii = 0; ii < GetAreaCount(); ii++ )
|
||||
{
|
||||
ZONE_CONTAINER* edge_zone = GetArea( ii );
|
||||
|
||||
if( (aLayer < 0) || ( aLayer == edge_zone->GetLayer() ) )
|
||||
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++ )
|
||||
{
|
||||
ZONE_CONTAINER* edge_zone = GetArea( ii );
|
||||
|
||||
if( (aLayer < 0) || ( aLayer == edge_zone->GetLayer() ) )
|
||||
edge_zone->DrawFilledArea( panel, aDC, aDrawMode );
|
||||
}
|
||||
@ -1469,6 +1495,7 @@ ZONE_CONTAINER* BOARD::HitTestForAnyFilledArea( const wxPoint& aRefPos,
|
||||
{
|
||||
if( aEndLayer < 0 )
|
||||
aEndLayer = aStartLayer;
|
||||
|
||||
if( aEndLayer < aStartLayer )
|
||||
EXCHG( aEndLayer, aStartLayer );
|
||||
|
||||
@ -1476,11 +1503,14 @@ ZONE_CONTAINER* BOARD::HitTestForAnyFilledArea( const wxPoint& aRefPos,
|
||||
{
|
||||
ZONE_CONTAINER* area = m_ZoneDescriptorList[ia];
|
||||
int layer = area->GetLayer();
|
||||
|
||||
if( (layer < aStartLayer) || (layer > aEndLayer) )
|
||||
continue;
|
||||
|
||||
if( area->GetState( BUSY ) ) // In locate functions we must skip
|
||||
// tagged items with BUSY flag set.
|
||||
continue;
|
||||
|
||||
if( area->HitTestFilledArea( aRefPos ) )
|
||||
return area;
|
||||
}
|
||||
@ -1514,10 +1544,10 @@ int BOARD::SetAreasNetCodesFromNetNames( void )
|
||||
continue;
|
||||
}
|
||||
|
||||
if( GetArea( ii )->GetNet() != 0 ) // i.e. if this zone is
|
||||
// connected to a net
|
||||
if( GetArea( ii )->GetNet() != 0 ) // i.e. if this zone is connected to a net
|
||||
{
|
||||
const NETINFO_ITEM* net = FindNet( GetArea( ii )->m_Netname );
|
||||
|
||||
if( net )
|
||||
{
|
||||
GetArea( ii )->SetNet( net->GetNet() );
|
||||
@ -1555,6 +1585,7 @@ void BOARD::Show( int nestLevel, std::ostream& os )
|
||||
// specialization of the output:
|
||||
NestedSpace( nestLevel + 1, os ) << "<modules>\n";
|
||||
p = m_Modules;
|
||||
|
||||
for( ; p; p = p->Next() )
|
||||
p->Show( nestLevel + 2, os );
|
||||
|
||||
@ -1562,6 +1593,7 @@ void BOARD::Show( int nestLevel, std::ostream& os )
|
||||
|
||||
NestedSpace( nestLevel + 1, os ) << "<pdrawings>\n";
|
||||
p = m_Drawings;
|
||||
|
||||
for( ; p; p = p->Next() )
|
||||
p->Show( nestLevel + 2, os );
|
||||
|
||||
@ -1569,6 +1601,7 @@ void BOARD::Show( int nestLevel, std::ostream& os )
|
||||
|
||||
NestedSpace( nestLevel + 1, os ) << "<tracks>\n";
|
||||
p = m_Track;
|
||||
|
||||
for( ; p; p = p->Next() )
|
||||
p->Show( nestLevel + 2, os );
|
||||
|
||||
@ -1576,6 +1609,7 @@ void BOARD::Show( int nestLevel, std::ostream& os )
|
||||
|
||||
NestedSpace( nestLevel + 1, os ) << "<zones>\n";
|
||||
p = m_Zone;
|
||||
|
||||
for( ; p; p = p->Next() )
|
||||
p->Show( nestLevel + 2, os );
|
||||
|
||||
@ -1590,6 +1624,7 @@ void BOARD::Show( int nestLevel, std::ostream& os )
|
||||
*/
|
||||
|
||||
p = (BOARD_ITEM*) m_Son;
|
||||
|
||||
for( ; p; p = p->Next() )
|
||||
{
|
||||
p->Show( nestLevel + 1, os );
|
||||
|
@ -842,6 +842,7 @@ public:
|
||||
{
|
||||
if( (unsigned) index < m_ZoneDescriptorList.size() )
|
||||
return m_ZoneDescriptorList[index];
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -879,8 +880,8 @@ public:
|
||||
/**
|
||||
* Function AddArea
|
||||
* 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)
|
||||
* can be NULL
|
||||
* @param aNewZonesList = a PICKED_ITEMS_LIST * where to store new areas pickers (useful
|
||||
* in undo commands) can be NULL
|
||||
* @param aNetcode = the necode of the copper area (0 = no net)
|
||||
* @param aLayer = the layer of area
|
||||
* @param aStartPointPosition = position of the first point of the polygon outline of this area
|
||||
@ -924,8 +925,8 @@ public:
|
||||
* Function ClipAreaPolygon
|
||||
* 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.
|
||||
* @param aNewZonesList = a PICKED_ITEMS_LIST * where to store new areas pickers (useful in undo commands)
|
||||
* can be NULL
|
||||
* @param aNewZonesList = a PICKED_ITEMS_LIST * where to store new areas pickers (useful
|
||||
* in undo commands) can be NULL
|
||||
* @param aCurrArea = the zone to process
|
||||
* @param bMessageBoxInt == true, shows message when clipping occurs.
|
||||
* @param bMessageBoxArc == true, shows message when clipping can't be done due to arcs.
|
||||
@ -940,7 +941,7 @@ public:
|
||||
ZONE_CONTAINER* aCurrArea,
|
||||
bool bMessageBoxArc,
|
||||
bool bMessageBoxInt,
|
||||
bool bRetainArcs = TRUE );
|
||||
bool bRetainArcs = true );
|
||||
|
||||
/**
|
||||
* 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
|
||||
* (useful in undo commands. Can be NULL
|
||||
* @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.
|
||||
* @return :
|
||||
* -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() )
|
||||
{
|
||||
Line = aReader->Line();
|
||||
|
||||
if( strnicmp( Line, "$EndDIMENSION", 4 ) == 0 )
|
||||
return TRUE;
|
||||
return true;
|
||||
|
||||
if( Line[0] == 'V' )
|
||||
{
|
||||
@ -125,6 +126,7 @@ bool DIMENSION::ReadDimensionDescr( LINE_READER* aReader )
|
||||
|
||||
if( layer < FIRST_NO_COPPER_LAYER )
|
||||
layer = FIRST_NO_COPPER_LAYER;
|
||||
|
||||
if( 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 );
|
||||
m_Text->m_Orient += aAngle;
|
||||
|
||||
if( m_Text->m_Orient >= 3600 )
|
||||
m_Text->m_Orient -= 3600;
|
||||
|
||||
if( ( m_Text->m_Orient > 900 ) && ( m_Text->m_Orient <2700 ) )
|
||||
m_Text->m_Orient -= 1800;
|
||||
|
||||
@ -323,8 +327,10 @@ void DIMENSION::Mirror(const wxPoint& axis_pos)
|
||||
INVERT( m_Pos.y );
|
||||
INVERT( m_Text->m_Pos.y );
|
||||
INVERT_ANGLE( m_Text->m_Orient );
|
||||
|
||||
if( m_Text->m_Orient >= 3600 )
|
||||
m_Text->m_Orient -= 3600;
|
||||
|
||||
if( ( m_Text->m_Orient > 900 ) && ( m_Text->m_Orient < 2700 ) )
|
||||
m_Text->m_Orient -= 1800;
|
||||
|
||||
@ -456,10 +462,13 @@ void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText )
|
||||
|
||||
if( TraitG_ox > Barre_ox )
|
||||
hx = -hx;
|
||||
|
||||
if( TraitG_ox == Barre_ox )
|
||||
hx = 0;
|
||||
|
||||
if( TraitG_oy > Barre_oy )
|
||||
hy = -hy;
|
||||
|
||||
if( TraitG_oy == Barre_oy )
|
||||
hy = 0;
|
||||
|
||||
@ -503,16 +512,17 @@ void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText )
|
||||
TraitD_fy = Barre_fy + hy;
|
||||
|
||||
/* Calculate the better text position and orientation: */
|
||||
m_Pos.x = m_Text->m_Pos.x
|
||||
= (Barre_fx + TraitG_fx) / 2;
|
||||
m_Pos.y = m_Text->m_Pos.y
|
||||
= (Barre_fy + TraitG_fy) / 2;
|
||||
m_Pos.x = m_Text->m_Pos.x = (Barre_fx + TraitG_fx) / 2;
|
||||
m_Pos.y = m_Text->m_Pos.y = (Barre_fy + TraitG_fy) / 2;
|
||||
|
||||
m_Text->m_Orient = -(int) (angle * 1800 / M_PI);
|
||||
|
||||
if( m_Text->m_Orient < 0 )
|
||||
m_Text->m_Orient += 3600;
|
||||
|
||||
if( m_Text->m_Orient >= 3600 )
|
||||
m_Text->m_Orient -= 3600;
|
||||
|
||||
if( (m_Text->m_Orient > 900) && (m_Text->m_Orient <2700) )
|
||||
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 );
|
||||
|
||||
BOARD * brd = GetBoard( );
|
||||
|
||||
if( brd->IsLayerVisible( m_Layer ) == false )
|
||||
return;
|
||||
|
||||
@ -734,6 +745,7 @@ bool DIMENSION::HitTest( EDA_RECT& refArea )
|
||||
{
|
||||
if( refArea.Contains( m_Pos ) )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,7 @@ bool DRAWSEGMENT::ReadDrawSegmentDescr( LINE_READER* aReader )
|
||||
Line = aReader->Line();
|
||||
|
||||
if( strnicmp( Line, "$End", 4 ) == 0 )
|
||||
return TRUE; /* End of description */
|
||||
return true; /* End of description */
|
||||
|
||||
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 )
|
||||
{
|
||||
int ux0, uy0, dx, dy;
|
||||
int l_piste;
|
||||
int l_trace;
|
||||
int color, mode;
|
||||
int rayon;
|
||||
int radius;
|
||||
|
||||
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() );
|
||||
|
||||
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
|
||||
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;
|
||||
|
||||
mode = DisplayOpt.DisplayDrawItems;
|
||||
|
||||
if( m_Flags & FORCE_SKETCH )
|
||||
mode = SKETCH;
|
||||
|
||||
if( l_piste < DC->DeviceToLogicalXRel( L_MIN_DESSIN ) )
|
||||
if( l_trace < DC->DeviceToLogicalXRel( L_MIN_DESSIN ) )
|
||||
mode = FILAIRE;
|
||||
|
||||
switch( m_Shape )
|
||||
{
|
||||
case S_CIRCLE:
|
||||
rayon = (int) hypot( (double) (dx - ux0), (double) (dy - uy0) );
|
||||
radius = (int) hypot( (double) (dx - ux0), (double) (dy - uy0) );
|
||||
|
||||
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 )
|
||||
{
|
||||
GRCircle( &panel->m_ClipBox, DC, ux0, uy0, rayon - l_piste, color );
|
||||
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, radius + l_trace, color );
|
||||
}
|
||||
else
|
||||
{
|
||||
GRCircle( &panel->m_ClipBox, DC, ux0, uy0, rayon, m_Width, color );
|
||||
GRCircle( &panel->m_ClipBox, DC, ux0, uy0, radius, m_Width, color );
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case S_ARC:
|
||||
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 );
|
||||
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 )
|
||||
GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle,
|
||||
rayon, color );
|
||||
radius, color );
|
||||
|
||||
else if( mode == SKETCH )
|
||||
{
|
||||
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,
|
||||
rayon + l_piste, color );
|
||||
radius + l_trace, color );
|
||||
}
|
||||
else
|
||||
{
|
||||
GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle,
|
||||
rayon, m_Width, color );
|
||||
radius, m_Width, color );
|
||||
}
|
||||
break;
|
||||
case S_CURVE:
|
||||
@ -329,15 +332,17 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wx
|
||||
else
|
||||
{
|
||||
GRFillCSegm( &panel->m_ClipBox, DC,
|
||||
m_BezierPoints[i].x, m_BezierPoints[i].y,
|
||||
m_BezierPoints[i-1].x, m_BezierPoints[i-1].y,
|
||||
m_BezierPoints[i].x, m_BezierPoints[i].y,
|
||||
m_BezierPoints[i-1].x, m_BezierPoints[i-1].y,
|
||||
m_Width, color );
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if( mode == FILAIRE )
|
||||
{
|
||||
GRLine( &panel->m_ClipBox, DC, ux0, uy0, dx, dy, 0, color );
|
||||
}
|
||||
else if( mode == SKETCH )
|
||||
{
|
||||
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,
|
||||
m_Width, color );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -388,6 +394,7 @@ void DRAWSEGMENT::DisplayInfo( EDA_DRAW_FRAME* frame )
|
||||
default:
|
||||
frame->AppendMsgPanel( shape, _( "Segment" ), RED );
|
||||
}
|
||||
|
||||
wxString start;
|
||||
start << GetStart();
|
||||
|
||||
@ -396,8 +403,7 @@ void DRAWSEGMENT::DisplayInfo( EDA_DRAW_FRAME* frame )
|
||||
|
||||
frame->AppendMsgPanel( start, end, DARKGREEN );
|
||||
|
||||
frame->AppendMsgPanel( _( "Layer" ),
|
||||
board->GetLayerName( m_Layer ), DARKBROWN );
|
||||
frame->AppendMsgPanel( _( "Layer" ), board->GetLayerName( m_Layer ), DARKBROWN );
|
||||
|
||||
valeur_param( (unsigned) m_Width, msg );
|
||||
frame->AppendMsgPanel( _( "Width" ), msg, DARKCYAN );
|
||||
@ -444,6 +450,7 @@ EDA_RECT DRAWSEGMENT::GetBoundingBox() const
|
||||
|
||||
if( ii == 0 )
|
||||
p_end = pt;
|
||||
|
||||
bbox.m_Pos.x = MIN( bbox.m_Pos.x, pt.x );
|
||||
bbox.m_Pos.y = MIN( bbox.m_Pos.y, pt.y );
|
||||
p_end.x = MAX( p_end.x, pt.x );
|
||||
@ -471,10 +478,10 @@ bool DRAWSEGMENT::HitTest( const wxPoint& aRefPos )
|
||||
case S_CIRCLE:
|
||||
case S_ARC:
|
||||
{
|
||||
int rayon = GetRadius();
|
||||
int radius = GetRadius();
|
||||
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 )
|
||||
return true;
|
||||
@ -498,8 +505,7 @@ bool DRAWSEGMENT::HitTest( const wxPoint& aRefPos )
|
||||
case S_CURVE:
|
||||
for( unsigned int i= 1; i < m_BezierPoints.size(); i++)
|
||||
{
|
||||
if( TestSegmentHit( aRefPos,m_BezierPoints[i-1],
|
||||
m_BezierPoints[i-1], m_Width / 2 ) )
|
||||
if( TestSegmentHit( aRefPos,m_BezierPoints[i-1], m_BezierPoints[i-1], m_Width / 2 ) )
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
@ -527,6 +533,7 @@ bool DRAWSEGMENT::HitTest( EDA_RECT& refArea )
|
||||
// Text if area intersects the circle:
|
||||
EDA_RECT area = refArea;
|
||||
area.Inflate( radius );
|
||||
|
||||
if( area.Contains( m_Start ) )
|
||||
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 )
|
||||
{
|
||||
int ux0, uy0, dx, dy, rayon, StAngle, EndAngle;
|
||||
int ux0, uy0, dx, dy, radius, StAngle, EndAngle;
|
||||
int color, type_trace;
|
||||
int typeaff;
|
||||
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 );
|
||||
typeaff = frame->m_DisplayModEdge;
|
||||
|
||||
if( m_Layer <= LAST_COPPER_LAYER )
|
||||
{
|
||||
typeaff = frame->m_DisplayPcbTrackFill;
|
||||
|
||||
if( !typeaff )
|
||||
typeaff = SKETCH;
|
||||
}
|
||||
@ -125,53 +127,53 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wx
|
||||
else
|
||||
// SKETCH Mode
|
||||
GRCSegm( &panel->m_ClipBox, DC, ux0, uy0, dx, dy, m_Width, color );
|
||||
|
||||
break;
|
||||
|
||||
case S_CIRCLE:
|
||||
rayon = (int) hypot( (double) (dx - ux0), (double) (dy - uy0) );
|
||||
radius = (int) hypot( (double) (dx - ux0), (double) (dy - uy0) );
|
||||
|
||||
if( typeaff == FILAIRE )
|
||||
{
|
||||
GRCircle( &panel->m_ClipBox, DC, ux0, uy0, rayon, color );
|
||||
GRCircle( &panel->m_ClipBox, DC, ux0, uy0, radius, color );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( typeaff == FILLED )
|
||||
{
|
||||
GRCircle( &panel->m_ClipBox, DC, ux0, uy0, rayon,
|
||||
m_Width, color );
|
||||
GRCircle( &panel->m_ClipBox, DC, ux0, uy0, radius, m_Width, color );
|
||||
}
|
||||
else // SKETCH Mode
|
||||
{
|
||||
GRCircle( &panel->m_ClipBox, DC, ux0, uy0,
|
||||
rayon + (m_Width / 2), color );
|
||||
GRCircle( &panel->m_ClipBox, DC, ux0, uy0,
|
||||
rayon - (m_Width / 2), color );
|
||||
GRCircle( &panel->m_ClipBox, DC, ux0, uy0, radius + (m_Width / 2), color );
|
||||
GRCircle( &panel->m_ClipBox, DC, ux0, uy0, radius - (m_Width / 2), color );
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
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 );
|
||||
EndAngle = StAngle + m_Angle;
|
||||
|
||||
if( StAngle > EndAngle )
|
||||
EXCHG( StAngle, EndAngle );
|
||||
|
||||
if( typeaff == FILAIRE )
|
||||
{
|
||||
GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle,
|
||||
rayon, color );
|
||||
GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle, radius, color );
|
||||
}
|
||||
else if( typeaff == FILLED )
|
||||
{
|
||||
GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle, rayon,
|
||||
m_Width, color );
|
||||
GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle, radius, m_Width, color );
|
||||
}
|
||||
else // SKETCH Mode
|
||||
{
|
||||
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,
|
||||
rayon - (m_Width / 2), color );
|
||||
radius - (m_Width / 2), color );
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
GRPoly( &panel->m_ClipBox, DC, points.size(), &points[0],
|
||||
TRUE, m_Width, color, color );
|
||||
GRPoly( &panel->m_ClipBox, DC, points.size(), &points[0], true, m_Width, color, color );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -208,34 +209,27 @@ void EDGE_MODULE::DisplayInfo( EDA_DRAW_FRAME* frame )
|
||||
return;
|
||||
|
||||
BOARD* board = (BOARD*) module->GetParent();
|
||||
|
||||
if( !board )
|
||||
return;
|
||||
|
||||
frame->ClearMsgPanel();
|
||||
|
||||
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 );
|
||||
|
||||
msg.Printf( wxT( "%8.8lX" ), module->m_TimeStamp );
|
||||
frame->AppendMsgPanel( _( "TimeStamp" ), msg, BROWN );
|
||||
|
||||
frame->AppendMsgPanel( _( "Mod Layer" ),
|
||||
board->GetLayerName( module->GetLayer() ), RED );
|
||||
|
||||
frame->AppendMsgPanel( _( "Seg Layer" ),
|
||||
board->GetLayerName( GetLayer() ), RED );
|
||||
frame->AppendMsgPanel( _( "Mod Layer" ), board->GetLayerName( module->GetLayer() ), RED );
|
||||
frame->AppendMsgPanel( _( "Seg Layer" ), board->GetLayerName( GetLayer() ), RED );
|
||||
|
||||
valeur_param( m_Width, msg );
|
||||
frame->AppendMsgPanel( _( "Width" ), msg, BLUE );
|
||||
}
|
||||
|
||||
|
||||
/*******************************************/
|
||||
bool EDGE_MODULE::Save( FILE* aFile ) const
|
||||
/*******************************************/
|
||||
{
|
||||
int ret = -1;
|
||||
|
||||
@ -271,8 +265,7 @@ bool EDGE_MODULE::Save( FILE* aFile ) const
|
||||
m_Width, m_Layer );
|
||||
|
||||
for( unsigned i = 0; i<m_PolyPoints.size(); ++i )
|
||||
fprintf( aFile, "Dl %d %d\n", m_PolyPoints[i].x,
|
||||
m_PolyPoints[i].y );
|
||||
fprintf( aFile, "Dl %d %d\n", m_PolyPoints[i].x, m_PolyPoints[i].y );
|
||||
|
||||
break;
|
||||
|
||||
@ -361,11 +354,13 @@ int EDGE_MODULE::ReadDescr( LINE_READER* aReader )
|
||||
|
||||
m_PolyPoints.clear();
|
||||
m_PolyPoints.reserve( pointCount );
|
||||
|
||||
for( ii = 0; ii<pointCount; ii++ )
|
||||
{
|
||||
if( aReader->ReadLine() )
|
||||
{
|
||||
Buf = aReader->Line();
|
||||
|
||||
if( strncmp( Buf, "Dl", 2 ) != 0 )
|
||||
{
|
||||
error = 1;
|
||||
@ -398,15 +393,18 @@ int EDGE_MODULE::ReadDescr( LINE_READER* aReader )
|
||||
// Check for a reasonable width:
|
||||
if( m_Width <= 1 )
|
||||
m_Width = 1;
|
||||
|
||||
if( m_Width > MAX_WIDTH )
|
||||
m_Width = MAX_WIDTH;
|
||||
|
||||
// Check for a reasonable layer:
|
||||
// m_Layer must be >= FIRST_NON_COPPER_LAYER, but because microwave footprints
|
||||
// can use the copper layers m_Layer < FIRST_NON_COPPER_LAYER is allowed.
|
||||
// @todo: changes use of EDGE_MODULE these footprints and allows only m_Layer >= FIRST_NON_COPPER_LAYER
|
||||
// @todo: changes use of EDGE_MODULE these footprints and allows only
|
||||
// m_Layer >= FIRST_NON_COPPER_LAYER
|
||||
if( (m_Layer < 0) || (m_Layer > LAST_NON_COPPER_LAYER) )
|
||||
m_Layer = SILKSCREEN_N_FRONT;
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
@ -16,20 +16,20 @@
|
||||
#include "richio.h"
|
||||
|
||||
|
||||
MIREPCB::MIREPCB( BOARD_ITEM* aParent ) :
|
||||
BOARD_ITEM( aParent, TYPE_MIRE )
|
||||
PCB_TARGET::PCB_TARGET( BOARD_ITEM* aParent ) :
|
||||
BOARD_ITEM( aParent, PCB_TARGET_T )
|
||||
{
|
||||
m_Shape = 0;
|
||||
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_Width = source->m_Width;
|
||||
@ -42,37 +42,41 @@ void MIREPCB::Copy( MIREPCB* source )
|
||||
|
||||
/* Read the description from the PCB file.
|
||||
*/
|
||||
bool MIREPCB::ReadMirePcbDescr( LINE_READER* aReader )
|
||||
bool PCB_TARGET::ReadMirePcbDescr( LINE_READER* aReader )
|
||||
{
|
||||
char* Line;
|
||||
|
||||
while( aReader->ReadLine() )
|
||||
{
|
||||
Line = aReader->Line();
|
||||
|
||||
if( strnicmp( Line, "$End", 4 ) == 0 )
|
||||
return TRUE;
|
||||
return true;
|
||||
|
||||
if( Line[0] == 'P' )
|
||||
{
|
||||
sscanf( Line + 2, " %X %d %d %d %d %d %lX",
|
||||
&m_Shape, &m_Layer,
|
||||
&m_Pos.x, &m_Pos.y,
|
||||
&m_Size, &m_Width, &m_TimeStamp );
|
||||
|
||||
if( m_Layer < FIRST_NO_COPPER_LAYER )
|
||||
m_Layer = FIRST_NO_COPPER_LAYER;
|
||||
|
||||
if( 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;
|
||||
|
||||
if( fprintf( aFile, "$MIREPCB\n" ) != sizeof("$MIREPCB\n")-1 )
|
||||
if( fprintf( aFile, "$PCB_TARGET\n" ) != sizeof("$PCB_TARGET\n")-1 )
|
||||
goto out;
|
||||
|
||||
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_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;
|
||||
|
||||
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
|
||||
* 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 typeaff;
|
||||
|
||||
@ -106,10 +110,11 @@ void MIREPCB::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int mode_color, const wxPoi
|
||||
oy = m_Pos.y + offset.y;
|
||||
|
||||
BOARD * brd = GetBoard( );
|
||||
|
||||
if( brd->IsLayerVisible( m_Layer ) == false )
|
||||
return;
|
||||
|
||||
gcolor = brd->GetLayerColor(m_Layer);
|
||||
gcolor = brd->GetLayerColor( m_Layer );
|
||||
|
||||
GRSetDrawMode( DC, mode_color );
|
||||
typeaff = DisplayOpt.DisplayDrawItems;
|
||||
@ -118,7 +123,7 @@ void MIREPCB::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int mode_color, const wxPoi
|
||||
if( DC->LogicalToDeviceXRel( width ) < 2 )
|
||||
typeaff = FILAIRE;
|
||||
|
||||
rayon = m_Size / 4;
|
||||
radius = m_Size / 4;
|
||||
|
||||
switch( typeaff )
|
||||
{
|
||||
@ -126,25 +131,25 @@ void MIREPCB::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int mode_color, const wxPoi
|
||||
width = 0;
|
||||
|
||||
case FILLED:
|
||||
GRCircle( &panel->m_ClipBox, DC, ox, oy, rayon, width, gcolor );
|
||||
GRCircle( &panel->m_ClipBox, DC, ox, oy, radius, width, gcolor );
|
||||
break;
|
||||
|
||||
case SKETCH:
|
||||
GRCircle( &panel->m_ClipBox, DC, ox, oy, rayon + (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 );
|
||||
GRCircle( &panel->m_ClipBox, DC, ox, oy, radius - (width / 2), gcolor );
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
rayon = m_Size / 2;
|
||||
dx1 = rayon;
|
||||
radius = m_Size / 2;
|
||||
dx1 = radius;
|
||||
dy1 = 0;
|
||||
dx2 = 0;
|
||||
dy2 = rayon;
|
||||
dy2 = radius;
|
||||
|
||||
if( m_Shape ) /* Form X */
|
||||
{
|
||||
dx1 = dy1 = ( rayon * 7 ) / 5;
|
||||
dx1 = dy1 = ( radius * 7 ) / 5;
|
||||
dx2 = dx1;
|
||||
dy2 = -dy1;
|
||||
}
|
||||
@ -153,19 +158,13 @@ void MIREPCB::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int mode_color, const wxPoi
|
||||
{
|
||||
case FILAIRE:
|
||||
case FILLED:
|
||||
GRLine( &panel->m_ClipBox, DC, ox - dx1, oy - dy1,
|
||||
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 - dx1, oy - dy1, ox + dx1, oy + dy1, width, gcolor );
|
||||
GRLine( &panel->m_ClipBox, DC, ox - dx2, oy - dy2, ox + dx2, oy + dy2, width, gcolor );
|
||||
break;
|
||||
|
||||
case SKETCH:
|
||||
GRCSegm( &panel->m_ClipBox, DC, ox - dx1, oy - dy1,
|
||||
ox + dx1, oy + dy1,
|
||||
width, gcolor );
|
||||
GRCSegm( &panel->m_ClipBox, DC, ox - dx2, oy - dy2,
|
||||
ox + dx2, oy + dy2,
|
||||
width, gcolor );
|
||||
GRCSegm( &panel->m_ClipBox, DC, ox - dx1, oy - dy1, ox + dx1, oy + dy1, width, gcolor );
|
||||
GRCSegm( &panel->m_ClipBox, DC, ox - dx2, oy - dy2, ox + dx2, oy + dy2, width, gcolor );
|
||||
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
|
||||
* @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 dY = refPos.y - m_Pos.y;
|
||||
int rayon = m_Size / 2;
|
||||
return abs( dX ) <= rayon && abs( dY ) <= rayon;
|
||||
int radius = m_Size / 2;
|
||||
return abs( dX ) <= radius && abs( dY ) <= radius;
|
||||
}
|
||||
|
||||
|
||||
@ -192,10 +191,11 @@ bool MIREPCB::HitTest( const wxPoint& refPos )
|
||||
* @param refArea : the given EDA_RECT
|
||||
* @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 ) )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -206,7 +206,7 @@ bool MIREPCB::HitTest( EDA_RECT& refArea )
|
||||
* @param aRotCentre - the rotation point.
|
||||
* @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 );
|
||||
}
|
||||
@ -217,14 +217,14 @@ void MIREPCB::Rotate(const wxPoint& aRotCentre, int aAngle)
|
||||
* Flip this object, i.e. change the board side for this object
|
||||
* @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 );
|
||||
SetLayer( ChangeSideNumLayer( GetLayer() ) );
|
||||
}
|
||||
|
||||
|
||||
EDA_RECT MIREPCB::GetBoundingBox() const
|
||||
EDA_RECT PCB_TARGET::GetBoundingBox() const
|
||||
{
|
||||
EDA_RECT bBox;
|
||||
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 msg;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/****************************************************/
|
||||
/* MIREPCB class definition. (targets for photos) */
|
||||
/* PCB_TARGET class definition. (targets for photos) */
|
||||
/****************************************************/
|
||||
|
||||
#ifndef MIRE_H
|
||||
@ -9,7 +9,7 @@
|
||||
#include "richio.h"
|
||||
|
||||
|
||||
class MIREPCB : public BOARD_ITEM
|
||||
class PCB_TARGET : public BOARD_ITEM
|
||||
{
|
||||
public:
|
||||
int m_Width;
|
||||
@ -18,11 +18,11 @@ public:
|
||||
int m_Size;
|
||||
|
||||
public:
|
||||
MIREPCB( BOARD_ITEM* aParent );
|
||||
~MIREPCB();
|
||||
PCB_TARGET( BOARD_ITEM* aParent );
|
||||
~PCB_TARGET();
|
||||
|
||||
MIREPCB* Next() const { return (MIREPCB*) Pnext; }
|
||||
MIREPCB* Back() const { return (MIREPCB*) Pnext; }
|
||||
PCB_TARGET* Next() const { return (PCB_TARGET*) Pnext; }
|
||||
PCB_TARGET* Back() const { return (PCB_TARGET*) Pnext; }
|
||||
|
||||
wxPoint& GetPosition()
|
||||
{
|
||||
@ -65,7 +65,7 @@ public:
|
||||
|
||||
bool ReadMirePcbDescr( LINE_READER* aReader );
|
||||
|
||||
void Copy( MIREPCB* source );
|
||||
void Copy( PCB_TARGET* source );
|
||||
|
||||
void Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int aDrawMode,
|
||||
const wxPoint& offset = ZeroOffset );
|
||||
|
@ -113,16 +113,17 @@ void MODULE::Copy( MODULE* aModule )
|
||||
|
||||
/* Copy auxiliary data: Pads */
|
||||
m_Pads.DeleteAll();
|
||||
|
||||
for( D_PAD* pad = aModule->m_Pads; pad; pad = pad->Next() )
|
||||
{
|
||||
D_PAD* newpad = new D_PAD( this );
|
||||
newpad->Copy( pad );
|
||||
|
||||
m_Pads.PushBack( newpad );
|
||||
}
|
||||
|
||||
/* Copy auxiliary data: Drawings */
|
||||
m_Drawings.DeleteAll();
|
||||
|
||||
for( BOARD_ITEM* item = aModule->m_Drawings; item; item = item->Next() )
|
||||
{
|
||||
switch( item->Type() )
|
||||
@ -152,15 +153,18 @@ void MODULE::Copy( MODULE* aModule )
|
||||
|
||||
// Ensure there is one (or more) item in m_3D_Drawings
|
||||
m_3D_Drawings.PushBack( new S3D_MASTER( this ) ); // push a void item
|
||||
|
||||
for( S3D_MASTER* item = aModule->m_3D_Drawings; item; item = item->Next() )
|
||||
{
|
||||
if( item->m_Shape3DName.IsEmpty() ) // do not copy empty shapes.
|
||||
continue;
|
||||
|
||||
S3D_MASTER* t3d = m_3D_Drawings;
|
||||
|
||||
if( t3d && t3d->m_Shape3DName.IsEmpty() ) // The first entry can
|
||||
// exist, but is empty :
|
||||
// use it.
|
||||
{ // exist, but is empty : use it.
|
||||
t3d->Copy( item );
|
||||
}
|
||||
else
|
||||
{
|
||||
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, "AR %s\n", TO_UTF8( m_Path ) );
|
||||
fprintf( aFile, "Op %X %X 0\n", m_CntRot90, m_CntRot180 );
|
||||
|
||||
if( m_LocalSolderMaskMargin != 0 )
|
||||
fprintf( aFile, ".SolderMask %d\n", m_LocalSolderMaskMargin );
|
||||
|
||||
if( m_LocalSolderPasteMargin != 0 )
|
||||
fprintf( aFile, ".SolderPaste %d\n", m_LocalSolderPasteMargin );
|
||||
|
||||
if( m_LocalSolderPasteMarginRatio != 0 )
|
||||
fprintf( aFile, ".SolderPasteRatio %g\n", m_LocalSolderPasteMarginRatio );
|
||||
|
||||
if( m_LocalClearance != 0 )
|
||||
fprintf( aFile, ".LocalClearance %d\n", m_LocalClearance );
|
||||
|
||||
@ -310,10 +318,13 @@ bool MODULE::Save( FILE* aFile ) const
|
||||
if( m_Attributs != MOD_DEFAULT )
|
||||
{
|
||||
fprintf( aFile, "At " );
|
||||
|
||||
if( m_Attributs & MOD_CMS )
|
||||
fprintf( aFile, "SMD " );
|
||||
|
||||
if( m_Attributs & MOD_VIRTUAL )
|
||||
fprintf( aFile, "VIRTUAL " );
|
||||
|
||||
fprintf( aFile, "\n" );
|
||||
}
|
||||
|
||||
@ -334,6 +345,7 @@ bool MODULE::Save( FILE* aFile ) const
|
||||
case TYPE_EDGE_MODULE:
|
||||
if( !item->Save( aFile ) )
|
||||
goto out;
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -422,11 +434,13 @@ int MODULE::Read_3D_Descr( LINE_READER* aReader )
|
||||
while( aReader->ReadLine() )
|
||||
{
|
||||
Line = aReader->Line();
|
||||
|
||||
switch( Line[0] )
|
||||
{
|
||||
case '$':
|
||||
if( Line[1] == 'E' )
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
|
||||
case 'N': // Shape File Name
|
||||
@ -484,6 +498,7 @@ int MODULE::ReadDescr( LINE_READER* aReader )
|
||||
{
|
||||
if( Line[1] == 'E' )
|
||||
break;
|
||||
|
||||
if( Line[1] == 'P' )
|
||||
{
|
||||
D_PAD* pad = new D_PAD( this );
|
||||
@ -495,6 +510,7 @@ int MODULE::ReadDescr( LINE_READER* aReader )
|
||||
m_Pads.PushBack( pad );
|
||||
continue;
|
||||
}
|
||||
|
||||
if( Line[1] == 'S' )
|
||||
Read_3D_Descr( aReader );
|
||||
}
|
||||
@ -517,10 +533,13 @@ int MODULE::ReadDescr( LINE_READER* aReader )
|
||||
&m_LastEdit_Time, &m_TimeStamp, BufCar1 );
|
||||
|
||||
m_ModuleStatus = 0;
|
||||
|
||||
if( BufCar1[0] == 'F' )
|
||||
SetLocked( true );
|
||||
|
||||
if( BufCar1[1] == 'P' )
|
||||
m_ModuleStatus |= MODULE_is_PLACED;
|
||||
|
||||
break;
|
||||
|
||||
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 );
|
||||
|
||||
m_CntRot180 = itmp2 & 0x0F;
|
||||
|
||||
if( m_CntRot180 > 10 )
|
||||
m_CntRot180 = 10;
|
||||
|
||||
m_CntRot90 = itmp1 & 0x0F;
|
||||
|
||||
if( m_CntRot90 > 10 )
|
||||
m_CntRot90 = 0;
|
||||
|
||||
itmp1 = (itmp1 >> 4) & 0x0F;
|
||||
|
||||
if( itmp1 > 10 )
|
||||
itmp1 = 0;
|
||||
|
||||
m_CntRot90 |= itmp1 << 4;
|
||||
break;
|
||||
|
||||
@ -557,21 +581,25 @@ int MODULE::ReadDescr( LINE_READER* aReader )
|
||||
/* At = (At)tributes of module */
|
||||
if( strstr( PtLine, "SMD" ) )
|
||||
m_Attributs |= MOD_CMS;
|
||||
|
||||
if( strstr( PtLine, "VIRTUAL" ) )
|
||||
m_Attributs |= MOD_VIRTUAL;
|
||||
}
|
||||
|
||||
if( Line[1] == 'R' )
|
||||
{
|
||||
// alternate reference, e.g. /478C2408/478AD1B6
|
||||
sscanf( PtLine, " %s", BufLine );
|
||||
m_Path = FROM_UTF8( BufLine );
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'T': /* Read a footprint text description (ref, value, or
|
||||
* drawing */
|
||||
TEXTE_MODULE * textm;
|
||||
sscanf( Line + 1, "%d", &itmp1 );
|
||||
|
||||
if( itmp1 == TEXT_is_REFERENCE )
|
||||
textm = m_Reference;
|
||||
else if( itmp1 == TEXT_is_VALUE )
|
||||
@ -609,6 +637,7 @@ int MODULE::ReadDescr( LINE_READER* aReader )
|
||||
m_LocalSolderPasteMarginRatio = atof( Line + 18 );
|
||||
else if( strnicmp( Line, ".LocalClearance ", 16 ) == 0 )
|
||||
m_LocalClearance = atoi( Line + 16 );
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -617,12 +646,12 @@ int MODULE::ReadDescr( LINE_READER* aReader )
|
||||
}
|
||||
|
||||
/* Recalculate the bounding box */
|
||||
Set_Rectangle_Encadrement();
|
||||
CalculateBoundingBox();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void MODULE::Set_Rectangle_Encadrement()
|
||||
void MODULE::CalculateBoundingBox()
|
||||
{
|
||||
m_BoundaryBox = GetFootPrintRect();
|
||||
m_Surface = ABS( (double) m_BoundaryBox.GetWidth() * m_BoundaryBox.GetHeight() );
|
||||
@ -673,14 +702,14 @@ void MODULE::DisplayInfo( EDA_DRAW_FRAME* frame )
|
||||
{
|
||||
int nbpad;
|
||||
char bufcar[512], Line[512];
|
||||
bool flag = FALSE;
|
||||
bool flag = false;
|
||||
wxString msg;
|
||||
BOARD* board = GetBoard();
|
||||
|
||||
frame->EraseMsgBox();
|
||||
|
||||
if( frame->m_Ident != PCB_FRAME )
|
||||
flag = TRUE;
|
||||
flag = true;
|
||||
|
||||
frame->AppendMsgPanel( m_Reference->m_Text, m_Value->m_Text, DARKCYAN );
|
||||
|
||||
@ -783,9 +812,6 @@ D_PAD* MODULE::FindPadByName( const wxString& aPadName ) const
|
||||
#else
|
||||
if( buf == aPadName )
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
return pad;
|
||||
}
|
||||
|
||||
@ -824,10 +850,12 @@ SEARCH_RESULT MODULE::Visit( INSPECTOR* inspector, const void* testData,
|
||||
|
||||
case TYPE_TEXTE_MODULE:
|
||||
result = inspector->Inspect( m_Reference, testData );
|
||||
|
||||
if( result == SEARCH_QUIT )
|
||||
break;
|
||||
|
||||
result = inspector->Inspect( m_Value, testData );
|
||||
|
||||
if( result == SEARCH_QUIT )
|
||||
break;
|
||||
|
||||
@ -908,6 +936,7 @@ void MODULE::Show( int nestLevel, std::ostream& os )
|
||||
|
||||
NestedSpace( nestLevel + 1, os ) << "<mpads>\n";
|
||||
p = m_Pads;
|
||||
|
||||
for( ; p; p = p->Next() )
|
||||
p->Show( nestLevel + 2, os );
|
||||
|
||||
@ -915,12 +944,14 @@ void MODULE::Show( int nestLevel, std::ostream& os )
|
||||
|
||||
NestedSpace( nestLevel + 1, os ) << "<mdrawings>\n";
|
||||
p = m_Drawings;
|
||||
|
||||
for( ; p; p = p->Next() )
|
||||
p->Show( nestLevel + 2, os );
|
||||
|
||||
NestedSpace( nestLevel + 1, os ) << "</mdrawings>\n";
|
||||
|
||||
p = m_Son;
|
||||
|
||||
for( ; p; p = p->Next() )
|
||||
{
|
||||
p->Show( nestLevel + 1, os );
|
||||
|
@ -114,10 +114,10 @@ public:
|
||||
*/
|
||||
|
||||
/**
|
||||
* Function Set_Rectangle_Encadrement
|
||||
* Function CalculateBoundingBox
|
||||
* calculates the bounding box in board coordinates.
|
||||
*/
|
||||
void Set_Rectangle_Encadrement();
|
||||
void CalculateBoundingBox();
|
||||
|
||||
/**
|
||||
* Function GetFootPrintRect()
|
||||
|
@ -73,48 +73,54 @@ int ChangeSideNumLayer( int oldlayer )
|
||||
/* Calculate the mask layer when flipping a footprint
|
||||
* 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 |
|
||||
ADHESIVE_LAYER_BACK | ADHESIVE_LAYER_FRONT |
|
||||
SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT |
|
||||
SOLDERPASTE_LAYER_BACK | SOLDERPASTE_LAYER_FRONT |
|
||||
ADHESIVE_LAYER_BACK | ADHESIVE_LAYER_FRONT);
|
||||
|
||||
if( masque & LAYER_BACK )
|
||||
newmasque |= LAYER_FRONT;
|
||||
if( masque & LAYER_FRONT )
|
||||
newmasque |= LAYER_BACK;
|
||||
if( aMask & LAYER_BACK )
|
||||
newMask |= LAYER_FRONT;
|
||||
|
||||
if( masque & SILKSCREEN_LAYER_BACK )
|
||||
newmasque |= SILKSCREEN_LAYER_FRONT;
|
||||
if( masque & SILKSCREEN_LAYER_FRONT )
|
||||
newmasque |= SILKSCREEN_LAYER_BACK;
|
||||
if( aMask & LAYER_FRONT )
|
||||
newMask |= LAYER_BACK;
|
||||
|
||||
if( masque & ADHESIVE_LAYER_BACK )
|
||||
newmasque |= ADHESIVE_LAYER_FRONT;
|
||||
if( masque & ADHESIVE_LAYER_FRONT )
|
||||
newmasque |= ADHESIVE_LAYER_BACK;
|
||||
if( aMask & SILKSCREEN_LAYER_BACK )
|
||||
newMask |= SILKSCREEN_LAYER_FRONT;
|
||||
|
||||
if( masque & SOLDERMASK_LAYER_BACK )
|
||||
newmasque |= SOLDERMASK_LAYER_FRONT;
|
||||
if( masque & SOLDERMASK_LAYER_FRONT )
|
||||
newmasque |= SOLDERMASK_LAYER_BACK;
|
||||
if( aMask & SILKSCREEN_LAYER_FRONT )
|
||||
newMask |= SILKSCREEN_LAYER_BACK;
|
||||
|
||||
if( masque & SOLDERPASTE_LAYER_BACK )
|
||||
newmasque |= SOLDERPASTE_LAYER_FRONT;
|
||||
if( masque & SOLDERPASTE_LAYER_FRONT )
|
||||
newmasque |= SOLDERPASTE_LAYER_BACK;
|
||||
if( aMask & ADHESIVE_LAYER_BACK )
|
||||
newMask |= ADHESIVE_LAYER_FRONT;
|
||||
|
||||
if( masque & ADHESIVE_LAYER_BACK )
|
||||
newmasque |= ADHESIVE_LAYER_FRONT;
|
||||
if( masque & ADHESIVE_LAYER_FRONT )
|
||||
newmasque |= ADHESIVE_LAYER_BACK;
|
||||
if( aMask & ADHESIVE_LAYER_FRONT )
|
||||
newMask |= 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;
|
||||
}
|
||||
|
||||
|
||||
@ -160,7 +166,7 @@ void MODULE::Flip(const wxPoint& aCentre )
|
||||
// Move module to its final position:
|
||||
wxPoint finalPos = m_Pos;
|
||||
finalPos.y = aCentre.y - ( finalPos.y - aCentre.y ); /// Mirror the Y position
|
||||
SetPosition(finalPos);
|
||||
SetPosition(finalPos);
|
||||
|
||||
/* Flip layer */
|
||||
SetLayer( ChangeSideNumLayer( GetLayer() ) );
|
||||
@ -171,6 +177,7 @@ void MODULE::Flip(const wxPoint& aCentre )
|
||||
|
||||
/* Mirror inversion layers pads. */
|
||||
pt_pad = m_Pads;
|
||||
|
||||
for( ; pt_pad != NULL; pt_pad = pt_pad->Next() )
|
||||
{
|
||||
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 );
|
||||
|
||||
/* 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. */
|
||||
@ -285,7 +292,7 @@ void MODULE::Flip(const wxPoint& aCentre )
|
||||
}
|
||||
}
|
||||
|
||||
Set_Rectangle_Encadrement();
|
||||
CalculateBoundingBox();
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user