Commit 9eba4f95 authored by charras's avatar charras

Solved a bug when creating a new zone outline that could crash pcbnew

parent 544ca4c9
...@@ -5,6 +5,14 @@ Started 2007-June-11 ...@@ -5,6 +5,14 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2008-oct-11 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+pcbnew:
Solved a bug when creating a new zone outline that could crash pcbnew
More about copper zones filled without grid (by polygons)
Currently for tests only (work in progress).
now working: Thermal reliefs parameters can be set.
2008-oct-11 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> 2008-oct-11 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================ ================================================================================
+pcbnew: +pcbnew:
......
No preview for this file type
This diff is collapsed.
...@@ -21,16 +21,18 @@ ZONE_CONTAINER::ZONE_CONTAINER( BOARD* parent ) : ...@@ -21,16 +21,18 @@ ZONE_CONTAINER::ZONE_CONTAINER( BOARD* parent ) :
BOARD_ITEM( parent, TYPEZONE_CONTAINER ) BOARD_ITEM( parent, TYPEZONE_CONTAINER )
{ {
m_NetCode = -1; // Net number for fast comparisons m_NetCode = -1; // Net number for fast comparisons
m_CornerSelection = -1; m_CornerSelection = -1;
m_ZoneClearance = 200; // a reasonnable clerance value m_ZoneClearance = 200; // a reasonnable clerance value
m_GridFillValue = 50; // a reasonnable grid used for filling m_GridFillValue = 50; // a reasonnable grid used for filling
m_PadOption = THERMAL_PAD; m_PadOption = THERMAL_PAD;
utility = 0; // flags used in polygon calculations utility = 0; // flags used in polygon calculations
utility2 = 0; // flags used in polygon calculations utility2 = 0; // flags used in polygon calculations
m_Poly = new CPolyLine(); // Outlines m_Poly = new CPolyLine(); // Outlines
m_ArcToSegmentsCount = 16; // Use 16 segment to convert a circle to a polygon m_ArcToSegmentsCount = 16; // Use 16 segment to convert a circle to a polygon
m_DrawOptions = 0; m_DrawOptions = 0;
m_ThermalReliefGapValue = 200; // tickness of the gap in thermal reliefs
m_ThermalReliefCopperBridgeValue = 200; // tickness of the copper bridge in thermal reliefs
} }
...@@ -86,8 +88,8 @@ bool ZONE_CONTAINER::Save( FILE* aFile ) const ...@@ -86,8 +88,8 @@ bool ZONE_CONTAINER::Save( FILE* aFile ) const
// Save the outline main info // Save the outline main info
ret = fprintf( aFile, "ZInfo %8.8lX %d \"%s\"\n", ret = fprintf( aFile, "ZInfo %8.8lX %d \"%s\"\n",
m_TimeStamp, m_NetCode, m_TimeStamp, m_NetCode,
CONV_TO_UTF8( m_Netname ) ); CONV_TO_UTF8( m_Netname ) );
if( ret < 3 ) if( ret < 3 )
return false; return false;
...@@ -138,8 +140,8 @@ bool ZONE_CONTAINER::Save( FILE* aFile ) const ...@@ -138,8 +140,8 @@ bool ZONE_CONTAINER::Save( FILE* aFile ) const
if( ret < 2 ) if( ret < 2 )
return false; return false;
ret = fprintf( aFile, "ZOptions %d %d %c\n", m_GridFillValue, m_ArcToSegmentsCount, ret = fprintf( aFile, "ZOptions %d %d %c %d %d\n", m_GridFillValue, m_ArcToSegmentsCount,
m_DrawOptions ? 'S' : 'F' ); m_DrawOptions ? 'S' : 'F' , m_ThermalReliefGapValue, m_ThermalReliefCopperBridgeValue);
if( ret < 3 ) if( ret < 3 )
return false; return false;
...@@ -148,8 +150,8 @@ bool ZONE_CONTAINER::Save( FILE* aFile ) const ...@@ -148,8 +150,8 @@ bool ZONE_CONTAINER::Save( FILE* aFile ) const
for( item_pos = 0; item_pos < corners_count; item_pos++ ) for( item_pos = 0; item_pos < corners_count; item_pos++ )
{ {
ret = fprintf( aFile, "ZCorner %d %d %d\n", ret = fprintf( aFile, "ZCorner %d %d %d\n",
m_Poly->corner[item_pos].x, m_Poly->corner[item_pos].y, m_Poly->corner[item_pos].x, m_Poly->corner[item_pos].y,
m_Poly->corner[item_pos].end_contour ); m_Poly->corner[item_pos].end_contour );
if( ret < 3 ) if( ret < 3 )
return false; return false;
} }
...@@ -274,20 +276,20 @@ int ZONE_CONTAINER::ReadDescr( FILE* aFile, int* aLineNum ) ...@@ -274,20 +276,20 @@ int ZONE_CONTAINER::ReadDescr( FILE* aFile, int* aLineNum )
{ {
int gridsize = 50; int gridsize = 50;
int arcsegmentcount = 16; int arcsegmentcount = 16;
int drawopt = 'F'; char drawopt = 'F';
text = Line + 8; text = Line + 8;
ret = sscanf( text, "%d %d %c", &gridsize, &arcsegmentcount, &drawopt ); ret = sscanf( text, "%d %d %c %d %d", &gridsize, &arcsegmentcount, &drawopt,
if( ret < 1 ) // Must find 1 or more args. &m_ThermalReliefGapValue, &m_ThermalReliefCopperBridgeValue );
if( ret < 1 ) // Must find 1 or more args.
return false; return false;
else else
m_GridFillValue = gridsize; m_GridFillValue = gridsize;
if ( arcsegmentcount >= 32 ) if( arcsegmentcount >= 32 )
m_ArcToSegmentsCount = 32; m_ArcToSegmentsCount = 32;
if ( drawopt == 'S' ) // Sketch mode for filled areas in this zone selected
m_DrawOptions = 1;
if( drawopt == 'S' ) // Sketch mode for filled areas in this zone selected
m_DrawOptions = 1;
} }
if( strnicmp( Line, "ZClearance", 10 ) == 0 ) // Clearence and pad options info found if( strnicmp( Line, "ZClearance", 10 ) == 0 ) // Clearence and pad options info found
{ {
...@@ -351,7 +353,7 @@ int ZONE_CONTAINER::ReadDescr( FILE* aFile, int* aLineNum ) ...@@ -351,7 +353,7 @@ int ZONE_CONTAINER::ReadDescr( FILE* aFile, int* aLineNum )
} }
/* Set hatch here, when outlines corners are read */ /* Set hatch here, when outlines corners are read */
m_Poly->SetHatch(outline_hatch); m_Poly->SetHatch( outline_hatch );
return error ? 0 : 1; return error ? 0 : 1;
} }
...@@ -509,10 +511,10 @@ void ZONE_CONTAINER::DrawFilledArea( WinEDA_DrawPanel* panel, ...@@ -509,10 +511,10 @@ void ZONE_CONTAINER::DrawFilledArea( WinEDA_DrawPanel* panel,
{ // Draw the current filled area { // Draw the current filled area
if( sketch_mode ) if( sketch_mode )
GRClosedPoly( &panel->m_ClipBox, DC, corners_count, CornersBuffer, GRClosedPoly( &panel->m_ClipBox, DC, corners_count, CornersBuffer,
false, 0, color, color ); false, 0, color, color );
else else
GRPoly( &panel->m_ClipBox, DC, corners_count, CornersBuffer, GRPoly( &panel->m_ClipBox, DC, corners_count, CornersBuffer,
true, 0, color, color ); true, 0, color, color );
corners_count = 0; corners_count = 0;
ii = 0; ii = 0;
} }
...@@ -571,7 +573,7 @@ void ZONE_CONTAINER::DrawWhileCreateOutline( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -571,7 +573,7 @@ void ZONE_CONTAINER::DrawWhileCreateOutline( WinEDA_DrawPanel* panel, wxDC* DC,
if( DC == NULL ) if( DC == NULL )
return; return;
int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
int color = g_DesignSettings.m_LayerColor[m_Layer] & MASKCOLOR; int color = g_DesignSettings.m_LayerColor[m_Layer & 31] & MASKCOLOR;
if( DisplayOpt.ContrastModeDisplay ) if( DisplayOpt.ContrastModeDisplay )
{ {
...@@ -585,28 +587,31 @@ void ZONE_CONTAINER::DrawWhileCreateOutline( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -585,28 +587,31 @@ void ZONE_CONTAINER::DrawWhileCreateOutline( WinEDA_DrawPanel* panel, wxDC* DC,
// draw the lines // draw the lines
wxPoint start_contour_pos = GetCornerPosition( 0 ); wxPoint start_contour_pos = GetCornerPosition( 0 );
for( int ic = 0; ic < GetNumCorners(); ic++ ) int icmax = GetNumCorners() - 1;
for( int ic = 0; ic <= icmax; ic++ )
{ {
int xi = GetCornerPosition( ic ).x; int xi = GetCornerPosition( ic ).x;
int yi = GetCornerPosition( ic ).y; int yi = GetCornerPosition( ic ).y;
int xf, yf; int xf, yf;
if( m_Poly->corner[ic].end_contour == FALSE && ic < GetNumCorners() - 1 ) if( m_Poly->corner[ic].end_contour == FALSE && ic < icmax )
{ {
is_close_segment = false; is_close_segment = false;
xf = GetCornerPosition( ic + 1 ).x; xf = GetCornerPosition( ic + 1 ).x;
yf = GetCornerPosition( ic + 1 ).y; yf = GetCornerPosition( ic + 1 ).y;
if( (m_Poly->corner[ic + 1].end_contour) || (ic == GetNumCorners() - 2) ) if( (m_Poly->corner[ic + 1].end_contour) || (ic == icmax - 1) )
current_gr_mode = GR_XOR; current_gr_mode = GR_XOR;
else else
current_gr_mode = draw_mode; current_gr_mode = draw_mode;
} }
else else // Draw the line from last corner to the first corner of the current coutour
{ {
is_close_segment = true; is_close_segment = true;
current_gr_mode = GR_XOR; current_gr_mode = GR_XOR;
xf = start_contour_pos.x; xf = start_contour_pos.x;
yf = start_contour_pos.y; yf = start_contour_pos.y;
start_contour_pos = GetCornerPosition( ic + 1 ); // Prepare the next contour for drawing, if exists
if ( ic < icmax )
start_contour_pos = GetCornerPosition( ic + 1 );
} }
GRSetDrawMode( DC, current_gr_mode ); GRSetDrawMode( DC, current_gr_mode );
if( is_close_segment ) if( is_close_segment )
...@@ -707,11 +712,11 @@ int ZONE_CONTAINER::HitTestForEdge( const wxPoint& refPos ) ...@@ -707,11 +712,11 @@ int ZONE_CONTAINER::HitTestForEdge( const wxPoint& refPos )
/* test the dist between segment and ref point */ /* test the dist between segment and ref point */
dist = (int) GetPointToLineSegmentDistance( refPos.x, dist = (int) GetPointToLineSegmentDistance( refPos.x,
refPos.y, refPos.y,
m_Poly->corner[item_pos].x, m_Poly->corner[item_pos].x,
m_Poly->corner[item_pos].y, m_Poly->corner[item_pos].y,
m_Poly->corner[end_segm].x, m_Poly->corner[end_segm].x,
m_Poly->corner[end_segm].y ); m_Poly->corner[end_segm].y );
if( dist <= min_dist ) if( dist <= min_dist )
{ {
m_CornerSelection = item_pos; m_CornerSelection = item_pos;
......
...@@ -27,33 +27,35 @@ public: ...@@ -27,33 +27,35 @@ public:
PAD_IN_ZONE // pads are covered by copper PAD_IN_ZONE // pads are covered by copper
}; };
wxString m_Netname; // Net Name wxString m_Netname; // Net Name
CPolyLine* m_Poly; // outlines CPolyLine* m_Poly; // outlines
int m_CornerSelection; // For corner moving, corner index to drag, or -1 if no selection int m_CornerSelection; // For corner moving, corner index to drag, or -1 if no selection
int m_ZoneClearance; // clearance value int m_ZoneClearance; // clearance value
int m_GridFillValue; // Grid used for filling, 0 = use polygonal areas to fill int m_GridFillValue; // Grid used for filling, 0 = use polygonal areas to fill
int m_ArcToSegmentsCount; // number of segments to convert a cirlce to a polygon (uses 16 or 32) int m_ArcToSegmentsCount; // number of segments to convert a cirlce to a polygon (uses 16 or 32)
m_PadInZone m_PadOption; // see m_PadInZone m_PadInZone m_PadOption; // see m_PadInZone
int utility, utility2; // flags used in polygon calculations int m_ThermalReliefGapValue; // tickness of the gap in thermal reliefs
int m_ThermalReliefCopperBridgeValue; // tickness of the copper bridge in thermal reliefs
int utility, utility2; // flags used in polygon calculations
std::vector <CPolyPt> m_FilledPolysList; /* set of filled polygons used to draw a zone as a filled area. std::vector <CPolyPt> m_FilledPolysList; /* set of filled polygons used to draw a zone as a filled area.
* from outlines (m_Poly) but unlike m_Poly these filled polygons have no hole (they are all in one piece) * from outlines (m_Poly) but unlike m_Poly these filled polygons have no hole (they are all in one piece)
* In very simple cases m_FilledPolysList is same as m_Poly * In very simple cases m_FilledPolysList is same as m_Poly
* In less simple cases (when m_Poly has holes) m_FilledPolysList is a polygon equivalent to m_Poly, without holes * In less simple cases (when m_Poly has holes) m_FilledPolysList is a polygon equivalent to m_Poly, without holes
* In complex cases an ouline decribed by m_Poly can have many filled areas * In complex cases an ouline decribed by m_Poly can have many filled areas
*/ */
int m_DrawOptions; /* used to pass some draw options (draw filled areas in sketch mode for instance ...) int m_DrawOptions; /* used to pass some draw options (draw filled areas in sketch mode for instance ...)
* currently useful when testing filling zones algos * currently useful when testing filling zones algos
*/ */
private: private:
int m_NetCode; // Net number for fast comparisons int m_NetCode; // Net number for fast comparisons
public: public:
ZONE_CONTAINER( BOARD* parent ); ZONE_CONTAINER( BOARD* parent );
~ZONE_CONTAINER(); ~ZONE_CONTAINER();
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
int ReadDescr( FILE* aFile, int* aLineNum = NULL ); int ReadDescr( FILE* aFile, int* aLineNum = NULL );
wxPoint& GetPosition() wxPoint& GetPosition()
{ {
...@@ -72,9 +74,9 @@ public: ...@@ -72,9 +74,9 @@ public:
* copy usefull data from the source. * copy usefull data from the source.
* flags and linked list pointers are NOT copied * flags and linked list pointers are NOT copied
*/ */
void Copy( ZONE_CONTAINER* src ); void Copy( ZONE_CONTAINER* src );
void Display_Infos( WinEDA_DrawFrame* frame ); void Display_Infos( WinEDA_DrawFrame* frame );
/** /**
* Function Draw * Function Draw
...@@ -84,10 +86,10 @@ public: ...@@ -84,10 +86,10 @@ public:
* @param offset = Draw offset (usually wxPoint(0,0)) * @param offset = Draw offset (usually wxPoint(0,0))
* @param aDrawMode = GR_OR, GR_XOR, GR_COPY .. * @param aDrawMode = GR_OR, GR_XOR, GR_COPY ..
*/ */
void Draw( WinEDA_DrawPanel* panel, void Draw( WinEDA_DrawPanel* panel,
wxDC* DC, wxDC* DC,
int aDrawMode, int aDrawMode,
const wxPoint& offset = ZeroOffset ); const wxPoint& offset = ZeroOffset );
/** /**
* Function DrawDrawFilledArea * Function DrawDrawFilledArea
...@@ -97,19 +99,19 @@ public: ...@@ -97,19 +99,19 @@ public:
* @param offset = Draw offset (usually wxPoint(0,0)) * @param offset = Draw offset (usually wxPoint(0,0))
* @param aDrawMode = GR_OR, GR_XOR, GR_COPY .. * @param aDrawMode = GR_OR, GR_XOR, GR_COPY ..
*/ */
void DrawFilledArea( WinEDA_DrawPanel* panel, void DrawFilledArea( WinEDA_DrawPanel* panel,
wxDC* DC, wxDC* DC,
int aDrawMode, int aDrawMode,
const wxPoint& offset = ZeroOffset ); const wxPoint& offset = ZeroOffset );
EDA_Rect GetBoundingBox(); EDA_Rect GetBoundingBox();
/** /**
* Function Test_For_Copper_Island_And_Remove__Insulated_Islands * Function Test_For_Copper_Island_And_Remove__Insulated_Islands
* Remove insulated copper islands found in m_FilledPolysList. * Remove insulated copper islands found in m_FilledPolysList.
* @param aPcb = the board to analyse * @param aPcb = the board to analyse
*/ */
void Test_For_Copper_Island_And_Remove_Insulated_Islands( BOARD* aPcb ); void Test_For_Copper_Island_And_Remove_Insulated_Islands( BOARD* aPcb );
/** /**
* Function DrawWhileCreateOutline * Function DrawWhileCreateOutline
...@@ -120,7 +122,7 @@ public: ...@@ -120,7 +122,7 @@ public:
* @param DC = current Device Context * @param DC = current Device Context
* @param draw_mode = draw mode: OR, XOR .. * @param draw_mode = draw mode: OR, XOR ..
*/ */
void DrawWhileCreateOutline( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode = GR_OR ); void DrawWhileCreateOutline( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode = GR_OR );
/** /**
...@@ -139,7 +141,7 @@ public: ...@@ -139,7 +141,7 @@ public:
} }
void SetNet( int anet_code ); void SetNet( int anet_code );
/** /**
* Function HitTest * Function HitTest
...@@ -147,7 +149,7 @@ public: ...@@ -147,7 +149,7 @@ public:
* @param refPos A wxPoint to test * @param refPos A wxPoint to test
* @return bool - true if a hit, else false * @return bool - true if a hit, else false
*/ */
bool HitTest( const wxPoint& refPos ); bool HitTest( const wxPoint& refPos );
/** function BuildFilledPolysListData /** function BuildFilledPolysListData
* Build m_FilledPolysList data from real outlines (m_Poly) * Build m_FilledPolysList data from real outlines (m_Poly)
...@@ -158,7 +160,7 @@ public: ...@@ -158,7 +160,7 @@ public:
* This function does not add holes for pads and tracks but calls * This function does not add holes for pads and tracks but calls
* AddClearanceAreasPolygonsToPolysList() to do that for copper layers * AddClearanceAreasPolygonsToPolysList() to do that for copper layers
*/ */
int BuildFilledPolysListData( BOARD* aPcb ); int BuildFilledPolysListData( BOARD* aPcb );
/** function AddClearanceAreasPolygonsToPolysList /** function AddClearanceAreasPolygonsToPolysList
* Add non copper areas polygons (pads and tracks with clearence) * Add non copper areas polygons (pads and tracks with clearence)
...@@ -170,7 +172,7 @@ public: ...@@ -170,7 +172,7 @@ public:
* filled copper area polygon (without clearence areas * filled copper area polygon (without clearence areas
* @param aPcb: the current board * @param aPcb: the current board
*/ */
void AddClearanceAreasPolygonsToPolysList( BOARD* aPcb ); void AddClearanceAreasPolygonsToPolysList( BOARD* aPcb );
/** /**
* Function HitTestForCorner * Function HitTestForCorner
...@@ -178,7 +180,7 @@ public: ...@@ -178,7 +180,7 @@ public:
* @return -1 if none, corner index in .corner <vector> * @return -1 if none, corner index in .corner <vector>
* @param refPos : A wxPoint to test * @param refPos : A wxPoint to test
*/ */
int HitTestForCorner( const wxPoint& refPos ); int HitTestForCorner( const wxPoint& refPos );
/** /**
* Function HitTestForEdge * Function HitTestForEdge
...@@ -186,7 +188,7 @@ public: ...@@ -186,7 +188,7 @@ public:
* @return -1 if none, or index of the starting corner in .corner <vector> * @return -1 if none, or index of the starting corner in .corner <vector>
* @param refPos : A wxPoint to test * @param refPos : A wxPoint to test
*/ */
int HitTestForEdge( const wxPoint& refPos ); int HitTestForEdge( const wxPoint& refPos );
/** /**
* Function HitTest (overlayed) * Function HitTest (overlayed)
...@@ -194,7 +196,7 @@ public: ...@@ -194,7 +196,7 @@ public:
* @param refArea : the given EDA_Rect * @param refArea : the given EDA_Rect
* @return bool - true if a hit, else false * @return bool - true if a hit, else false
*/ */
bool HitTest( EDA_Rect& refArea ); bool HitTest( EDA_Rect& refArea );
/** /**
* Function Fill_Zone() * Function Fill_Zone()
...@@ -207,7 +209,7 @@ public: ...@@ -207,7 +209,7 @@ public:
* @param verbose = true to show error messages * @param verbose = true to show error messages
* @return error level (0 = no error) * @return error level (0 = no error)
*/ */
int Fill_Zone( WinEDA_PcbFrame* frame, wxDC* DC, bool verbose = TRUE ); int Fill_Zone( WinEDA_PcbFrame* frame, wxDC* DC, bool verbose = TRUE );
/* Geometric transformations: */ /* Geometric transformations: */
...@@ -216,14 +218,14 @@ public: ...@@ -216,14 +218,14 @@ public:
* Move the outlines * Move the outlines
* @param offset = moving vector * @param offset = moving vector
*/ */
void Move( const wxPoint& offset ); void Move( const wxPoint& offset );
/** /**
* Function MoveEdge * Function MoveEdge
* Move the outline Edge. m_CornerSelection is the start point of the outline edge * Move the outline Edge. m_CornerSelection is the start point of the outline edge
* @param offset = moving vector * @param offset = moving vector
*/ */
void MoveEdge( const wxPoint& offset ); void MoveEdge( const wxPoint& offset );
/** /**
* Function Rotate * Function Rotate
...@@ -231,7 +233,7 @@ public: ...@@ -231,7 +233,7 @@ public:
* @param centre = rot centre * @param centre = rot centre
* @param angle = in 0.1 degree * @param angle = in 0.1 degree
*/ */
void Rotate( const wxPoint& centre, int angle ); void Rotate( const wxPoint& centre, int angle );
/** /**
* Function Mirror * Function Mirror
...@@ -239,7 +241,7 @@ public: ...@@ -239,7 +241,7 @@ public:
* the layer is not changed * the layer is not changed
* @param mirror_ref = vertical axis position * @param mirror_ref = vertical axis position
*/ */
void Mirror( const wxPoint& mirror_ref ); void Mirror( const wxPoint& mirror_ref );
/** /**
* Function GetClass * Function GetClass
......
...@@ -53,7 +53,7 @@ dialog_copper_zone::dialog_copper_zone( WinEDA_PcbFrame* parent, ZONE_CONTAINER ...@@ -53,7 +53,7 @@ dialog_copper_zone::dialog_copper_zone( WinEDA_PcbFrame* parent, ZONE_CONTAINER
/*****************************************************************/ /*****************************************************************/
void dialog_copper_zone::OnInitDialog( wxInitDialogEvent& event ) void dialog_copper_zone::OnInitDialog( wxInitDialogEvent& event )
/*****************************************************************/ /*****************************************************************/
// Initialise dialog options // Initialise all dialog options and values in wxTextCtrl
{ {
BOARD* board = m_Parent->m_Pcb; BOARD* board = m_Parent->m_Pcb;
...@@ -81,7 +81,7 @@ void dialog_copper_zone::OnInitDialog( wxInitDialogEvent& event ) ...@@ -81,7 +81,7 @@ void dialog_copper_zone::OnInitDialog( wxInitDialogEvent& event )
int selection = 0; int selection = 0;
int grid_routing = g_GridRoutingSize; int grid_routing = g_GridRoutingSize;
if( m_Zone_Container ) if( m_Zone_Container )
grid_routing = m_Zone_Container->m_GridFillValue; grid_routing = m_Zone_Container->m_GridFillValue;
...@@ -109,18 +109,18 @@ void dialog_copper_zone::OnInitDialog( wxInitDialogEvent& event ) ...@@ -109,18 +109,18 @@ void dialog_copper_zone::OnInitDialog( wxInitDialogEvent& event )
switch( m_Zone_Container->m_PadOption ) switch( m_Zone_Container->m_PadOption )
{ {
case ZONE_CONTAINER::PAD_NOT_IN_ZONE: // Pads are not covered case ZONE_CONTAINER::PAD_NOT_IN_ZONE: // Pads are not covered
m_FillOpt->SetSelection( 2 ); m_PadInZoneOpt->SetSelection( 2 );
break; break;
case ZONE_CONTAINER::THERMAL_PAD: // Use thermal relief for pads case ZONE_CONTAINER::THERMAL_PAD: // Use thermal relief for pads
m_FillOpt->SetSelection( 1 ); m_PadInZoneOpt->SetSelection( 1 );
break; break;
case ZONE_CONTAINER::PAD_IN_ZONE: // pads are covered by copper case ZONE_CONTAINER::PAD_IN_ZONE: // pads are covered by copper
m_FillOpt->SetSelection( 0 ); m_PadInZoneOpt->SetSelection( 0 );
break; break;
} }
g_Zone_Hatching = m_Zone_Container->m_Poly->GetHatchStyle(); g_Zone_Hatching = m_Zone_Container->m_Poly->GetHatchStyle();
g_Zone_Arc_Approximation = m_Zone_Container->m_ArcToSegmentsCount; g_Zone_Arc_Approximation = m_Zone_Container->m_ArcToSegmentsCount;
g_FilledAreasShowMode = m_Zone_Container->m_DrawOptions; g_FilledAreasShowMode = m_Zone_Container->m_DrawOptions;
if ( g_FilledAreasShowMode == 1) if ( g_FilledAreasShowMode == 1)
m_ShowFilledAreasInSketchOpt->SetValue(true); m_ShowFilledAreasInSketchOpt->SetValue(true);
...@@ -133,19 +133,45 @@ void dialog_copper_zone::OnInitDialog( wxInitDialogEvent& event ) ...@@ -133,19 +133,45 @@ void dialog_copper_zone::OnInitDialog( wxInitDialogEvent& event )
switch( g_Zone_Pad_Options ) switch( g_Zone_Pad_Options )
{ {
case ZONE_CONTAINER::PAD_NOT_IN_ZONE: // Pads are not covered case ZONE_CONTAINER::PAD_NOT_IN_ZONE: // Pads are not covered
m_FillOpt->SetSelection( 2 ); m_PadInZoneOpt->SetSelection( 2 );
break; break;
case ZONE_CONTAINER::THERMAL_PAD: // Use thermal relief for pads case ZONE_CONTAINER::THERMAL_PAD: // Use thermal relief for pads
m_FillOpt->SetSelection( 1 ); m_PadInZoneOpt->SetSelection( 1 );
break; break;
case ZONE_CONTAINER::PAD_IN_ZONE: // pads are covered by copper case ZONE_CONTAINER::PAD_IN_ZONE: // pads are covered by copper
m_FillOpt->SetSelection( 0 ); m_PadInZoneOpt->SetSelection( 0 );
break; break;
} }
g_Zone_Hatching = m_Parent->m_Parent->m_EDA_Config->Read( ZONE_NET_OUTLINES_HATCH_OPTION_KEY, g_Zone_Hatching = m_Parent->m_Parent->m_EDA_Config->Read( ZONE_NET_OUTLINES_HATCH_OPTION_KEY,
(long) CPolyLine::DIAGONAL_EDGE ); (long) CPolyLine::DIAGONAL_EDGE );
} }
if ( g_Zone_Pad_Options != ZONE_CONTAINER::THERMAL_PAD )
{
m_AntipadSizeValue->Enable(false);
m_CopperWidthValue->Enable(false);
}
else
{
m_AntipadSizeValue->Enable(true);
m_CopperWidthValue->Enable(true);
}
if( m_Zone_Container )
{
g_ThermalReliefGapValue = m_Zone_Container->m_ThermalReliefGapValue;
g_ThermalReliefCopperBridgeValue = m_Zone_Container->m_ThermalReliefCopperBridgeValue;
}
else
{
m_Parent->m_Parent->m_EDA_Config->Read( ZONE_THERMAL_RELIEF_GAP_STRING_KEY, &g_ThermalReliefGapValue );
m_Parent->m_Parent->m_EDA_Config->Read( ZONE_THERMAL_RELIEF_COPPER_WIDTH_STRING_KEY, &g_ThermalReliefCopperBridgeValue );
}
AddUnitSymbol( *m_AntipadSizeText, g_UnitMetric );
AddUnitSymbol( *m_CopperBridgeWidthText, g_UnitMetric );
PutValueInLocalUnits( *m_AntipadSizeValue, g_ThermalReliefGapValue, PCB_INTERNAL_UNIT );
PutValueInLocalUnits( *m_CopperWidthValue, g_ThermalReliefCopperBridgeValue, PCB_INTERNAL_UNIT );
switch( g_Zone_Hatching ) switch( g_Zone_Hatching )
{ {
case CPolyLine::NO_HATCH: case CPolyLine::NO_HATCH:
...@@ -160,7 +186,7 @@ void dialog_copper_zone::OnInitDialog( wxInitDialogEvent& event ) ...@@ -160,7 +186,7 @@ void dialog_copper_zone::OnInitDialog( wxInitDialogEvent& event )
m_OutlineAppearanceCtrl->SetSelection(2); m_OutlineAppearanceCtrl->SetSelection(2);
break; break;
} }
m_ArcApproximationOpt->SetSelection( g_Zone_Arc_Approximation == 32 ? 1 : 0 ); m_ArcApproximationOpt->SetSelection( g_Zone_Arc_Approximation == 32 ? 1 : 0 );
/* build copper layers list */ /* build copper layers list */
...@@ -245,6 +271,7 @@ void dialog_copper_zone::OnInitDialog( wxInitDialogEvent& event ) ...@@ -245,6 +271,7 @@ void dialog_copper_zone::OnInitDialog( wxInitDialogEvent& event )
{ {
GetSizer()->SetSizeHints(this); GetSizer()->SetSizeHints(this);
} }
Center();
} }
...@@ -265,7 +292,7 @@ bool dialog_copper_zone::AcceptOptions(bool aPromptForErrors, bool aUseExportabl ...@@ -265,7 +292,7 @@ bool dialog_copper_zone::AcceptOptions(bool aPromptForErrors, bool aUseExportabl
* @param aUseExportableSetupOnly = true to use exportable parametres only (used to export this setup to other zones) * @param aUseExportableSetupOnly = true to use exportable parametres only (used to export this setup to other zones)
*/ */
{ {
switch( m_FillOpt->GetSelection() ) switch( m_PadInZoneOpt->GetSelection() )
{ {
case 2: case 2:
g_Zone_Pad_Options = ZONE_CONTAINER::PAD_NOT_IN_ZONE; // Pads are not covered g_Zone_Pad_Options = ZONE_CONTAINER::PAD_NOT_IN_ZONE; // Pads are not covered
...@@ -280,7 +307,7 @@ bool dialog_copper_zone::AcceptOptions(bool aPromptForErrors, bool aUseExportabl ...@@ -280,7 +307,7 @@ bool dialog_copper_zone::AcceptOptions(bool aPromptForErrors, bool aUseExportabl
break; break;
} }
switch( m_OutlineAppearanceCtrl->GetSelection() ) switch( m_OutlineAppearanceCtrl->GetSelection() )
{ {
case 0: case 0:
g_Zone_Hatching = CPolyLine::NO_HATCH; g_Zone_Hatching = CPolyLine::NO_HATCH;
...@@ -294,7 +321,7 @@ bool dialog_copper_zone::AcceptOptions(bool aPromptForErrors, bool aUseExportabl ...@@ -294,7 +321,7 @@ bool dialog_copper_zone::AcceptOptions(bool aPromptForErrors, bool aUseExportabl
g_Zone_Hatching = CPolyLine::DIAGONAL_FULL; g_Zone_Hatching = CPolyLine::DIAGONAL_FULL;
break; break;
} }
g_Zone_Arc_Approximation = m_ArcApproximationOpt->GetSelection() == 1 ? 32 : 16; g_Zone_Arc_Approximation = m_ArcApproximationOpt->GetSelection() == 1 ? 32 : 16;
if( m_Parent->m_Parent->m_EDA_Config ) if( m_Parent->m_Parent->m_EDA_Config )
...@@ -338,6 +365,12 @@ bool dialog_copper_zone::AcceptOptions(bool aPromptForErrors, bool aUseExportabl ...@@ -338,6 +365,12 @@ bool dialog_copper_zone::AcceptOptions(bool aPromptForErrors, bool aUseExportabl
g_FilledAreasShowMode = m_ShowFilledAreasInSketchOpt->IsChecked() ? 1 : 0; g_FilledAreasShowMode = m_ShowFilledAreasInSketchOpt->IsChecked() ? 1 : 0;
g_ThermalReliefGapValue = ReturnValueFromTextCtrl( *m_AntipadSizeValue, PCB_INTERNAL_UNIT );
g_ThermalReliefCopperBridgeValue = ReturnValueFromTextCtrl( *m_CopperWidthValue, PCB_INTERNAL_UNIT );
m_Parent->m_Parent->m_EDA_Config->Write( ZONE_THERMAL_RELIEF_GAP_STRING_KEY, (long) g_ThermalReliefGapValue );
m_Parent->m_Parent->m_EDA_Config->Write( ZONE_THERMAL_RELIEF_COPPER_WIDTH_STRING_KEY, (long)g_ThermalReliefCopperBridgeValue );
// If we use only exportable to others zones parameters, exit here: // If we use only exportable to others zones parameters, exit here:
if ( aUseExportableSetupOnly ) if ( aUseExportableSetupOnly )
return true; return true;
...@@ -349,10 +382,10 @@ bool dialog_copper_zone::AcceptOptions(bool aPromptForErrors, bool aUseExportabl ...@@ -349,10 +382,10 @@ bool dialog_copper_zone::AcceptOptions(bool aPromptForErrors, bool aUseExportabl
DisplayError( this, _( "Error : you must choose a layer" ) ); DisplayError( this, _( "Error : you must choose a layer" ) );
return false; return false;
} }
g_CurrentZone_Layer = m_LayerId[ii]; g_CurrentZone_Layer = m_LayerId[ii];
/* Get the net name selection for this zone */ /* Get the net name selection for this zone */
ii = m_ListNetNameSelection->GetSelection(); ii = m_ListNetNameSelection->GetSelection();
...@@ -406,7 +439,7 @@ void dialog_copper_zone::OnNetSortingOptionSelected( wxCommandEvent& event ) ...@@ -406,7 +439,7 @@ void dialog_copper_zone::OnNetSortingOptionSelected( wxCommandEvent& event )
m_Parent->m_Parent->m_EDA_Config->Write( ZONE_NET_SORT_OPTION_KEY, (long) m_NetSorting ); m_Parent->m_Parent->m_EDA_Config->Write( ZONE_NET_SORT_OPTION_KEY, (long) m_NetSorting );
m_Parent->m_Parent->m_EDA_Config->Write( ZONE_NET_FILTER_STRING_KEY, m_NetNameFilter->GetValue() ); m_Parent->m_Parent->m_EDA_Config->Write( ZONE_NET_FILTER_STRING_KEY, m_NetNameFilter->GetValue() );
} }
// Select and isplay current zone net name in listbox: // Select and isplay current zone net name in listbox:
int net_select = g_HightLigth_NetCode; int net_select = g_HightLigth_NetCode;
if( m_Zone_Container ) if( m_Zone_Container )
...@@ -455,7 +488,7 @@ void dialog_copper_zone::ExportSetupToOtherCopperZones( wxCommandEvent& event ) ...@@ -455,7 +488,7 @@ void dialog_copper_zone::ExportSetupToOtherCopperZones( wxCommandEvent& event )
{ {
if ( !AcceptOptions(true, true) ) if ( !AcceptOptions(true, true) )
return; return;
// Export to others zones: // Export to others zones:
BOARD * pcb = m_Parent->m_Pcb; BOARD * pcb = m_Parent->m_Pcb;
for( int ii = 0; ii < pcb->GetAreaCount(); ii++ ) for( int ii = 0; ii < pcb->GetAreaCount(); ii++ )
...@@ -467,7 +500,28 @@ void dialog_copper_zone::ExportSetupToOtherCopperZones( wxCommandEvent& event ) ...@@ -467,7 +500,28 @@ void dialog_copper_zone::ExportSetupToOtherCopperZones( wxCommandEvent& event )
zone->m_GridFillValue = g_GridRoutingSize; zone->m_GridFillValue = g_GridRoutingSize;
zone->m_ArcToSegmentsCount = g_Zone_Arc_Approximation; zone->m_ArcToSegmentsCount = g_Zone_Arc_Approximation;
zone->m_DrawOptions = g_FilledAreasShowMode; zone->m_DrawOptions = g_FilledAreasShowMode;
zone->m_ThermalReliefGapValue = g_ThermalReliefGapValue;
zone->m_ThermalReliefCopperBridgeValue = g_ThermalReliefCopperBridgeValue;
m_Parent->GetScreen()->SetModify();; m_Parent->GetScreen()->SetModify();;
} }
} }
/******************************************************************/
void dialog_copper_zone::OnPadsInZoneClick( wxCommandEvent& event )
/******************************************************************/
{
switch ( m_PadInZoneOpt->GetSelection() )
{
default:
m_AntipadSizeValue->Enable(false);
m_CopperWidthValue->Enable(false);
break;
case 1:
m_AntipadSizeValue->Enable(true);
m_CopperWidthValue->Enable(true);
break;
}
}
...@@ -24,6 +24,7 @@ public: ...@@ -24,6 +24,7 @@ public:
void OnRemoveFillZoneButtonClick( wxCommandEvent& event ); void OnRemoveFillZoneButtonClick( wxCommandEvent& event );
void OnNetSortingOptionSelected( wxCommandEvent& event ); void OnNetSortingOptionSelected( wxCommandEvent& event );
void ExportSetupToOtherCopperZones( wxCommandEvent& event ); void ExportSetupToOtherCopperZones( wxCommandEvent& event );
void OnPadsInZoneClick( wxCommandEvent& event );
}; };
#endif // #ifndef DIALOG_COPPER_ZONES #endif // #ifndef DIALOG_COPPER_ZONES
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
BEGIN_EVENT_TABLE( dialog_copper_zone_frame, wxDialog ) BEGIN_EVENT_TABLE( dialog_copper_zone_frame, wxDialog )
EVT_INIT_DIALOG( dialog_copper_zone_frame::_wxFB_OnInitDialog ) EVT_INIT_DIALOG( dialog_copper_zone_frame::_wxFB_OnInitDialog )
EVT_RADIOBOX( wxID_PADS_IN_ZONE_OPTIONS, dialog_copper_zone_frame::_wxFB_OnPadsInZoneClick )
EVT_BUTTON( wxID_BUTTON_EXPORT, dialog_copper_zone_frame::_wxFB_ExportSetupToOtherCopperZones ) EVT_BUTTON( wxID_BUTTON_EXPORT, dialog_copper_zone_frame::_wxFB_ExportSetupToOtherCopperZones )
EVT_BUTTON( wxID_OK, dialog_copper_zone_frame::_wxFB_OnButtonOkClick ) EVT_BUTTON( wxID_OK, dialog_copper_zone_frame::_wxFB_OnButtonOkClick )
EVT_BUTTON( wxID_CANCEL, dialog_copper_zone_frame::_wxFB_OnButtonCancelClick ) EVT_BUTTON( wxID_CANCEL, dialog_copper_zone_frame::_wxFB_OnButtonCancelClick )
...@@ -37,30 +38,40 @@ dialog_copper_zone_frame::dialog_copper_zone_frame( wxWindow* parent, wxWindowID ...@@ -37,30 +38,40 @@ dialog_copper_zone_frame::dialog_copper_zone_frame( wxWindow* parent, wxWindowID
wxStaticBoxSizer* m_FillOptionsBox; wxStaticBoxSizer* m_FillOptionsBox;
m_FillOptionsBox = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Zone Fill Options:") ), wxVERTICAL ); m_FillOptionsBox = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Zone Fill Options:") ), wxVERTICAL );
wxString m_GridCtrlChoices[] = { _("0.00000"), _("0.00000"), _("0.00000"), _("0.00000"), _("No Grid (For tests only!)") }; wxString m_GridCtrlChoices[] = { _("0.00000"), _("0.00000"), _("0.00000"), _("0.00000"), _("No grid (For tests only!)") };
int m_GridCtrlNChoices = sizeof( m_GridCtrlChoices ) / sizeof( wxString ); int m_GridCtrlNChoices = sizeof( m_GridCtrlChoices ) / sizeof( wxString );
m_GridCtrl = new wxRadioBox( this, ID_RADIOBOX_GRID_SELECTION, _("Grid Size for Filling:"), wxDefaultPosition, wxDefaultSize, m_GridCtrlNChoices, m_GridCtrlChoices, 1, wxRA_SPECIFY_COLS ); m_GridCtrl = new wxRadioBox( this, ID_RADIOBOX_GRID_SELECTION, _("Grid Size for Filling:"), wxDefaultPosition, wxDefaultSize, m_GridCtrlNChoices, m_GridCtrlChoices, 1, wxRA_SPECIFY_COLS );
m_GridCtrl->SetSelection( 0 ); m_GridCtrl->SetSelection( 4 );
m_FillOptionsBox->Add( m_GridCtrl, 0, wxALL|wxEXPAND, 5 ); m_FillOptionsBox->Add( m_GridCtrl, 0, wxALL|wxEXPAND, 5 );
m_ClearanceValueTitle = new wxStaticText( this, wxID_ANY, _("Zone clearance value (mm):"), wxDefaultPosition, wxDefaultSize, 0 ); wxString m_PadInZoneOptChoices[] = { _("Include pads"), _("Thermal relief"), _("Exclude pads") };
m_ClearanceValueTitle->Wrap( -1 ); int m_PadInZoneOptNChoices = sizeof( m_PadInZoneOptChoices ) / sizeof( wxString );
m_FillOptionsBox->Add( m_ClearanceValueTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); m_PadInZoneOpt = new wxRadioBox( this, wxID_PADS_IN_ZONE_OPTIONS, _("Pad in Zone:"), wxDefaultPosition, wxDefaultSize, m_PadInZoneOptNChoices, m_PadInZoneOptChoices, 1, wxRA_SPECIFY_COLS );
m_PadInZoneOpt->SetSelection( 1 );
m_FillOptionsBox->Add( m_PadInZoneOpt, 0, wxALL|wxEXPAND, 5 );
m_ZoneClearanceCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); wxStaticBoxSizer* m_ThermalShapesParamsSizer;
m_FillOptionsBox->Add( m_ZoneClearanceCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); m_ThermalShapesParamsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Thermal Reliefs Parameters") ), wxVERTICAL );
wxString m_FillOptChoices[] = { _("Include Pads"), _("Thermal Relief"), _("Exclude Pads") }; m_AntipadSizeText = new wxStaticText( this, wxID_ANY, _("Antipad Size"), wxDefaultPosition, wxDefaultSize, 0 );
int m_FillOptNChoices = sizeof( m_FillOptChoices ) / sizeof( wxString ); m_AntipadSizeText->Wrap( -1 );
m_FillOpt = new wxRadioBox( this, wxID_ANY, _("Pad in Zone:"), wxDefaultPosition, wxDefaultSize, m_FillOptNChoices, m_FillOptChoices, 1, wxRA_SPECIFY_COLS ); m_ThermalShapesParamsSizer->Add( m_AntipadSizeText, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_FillOpt->SetSelection( 2 );
m_FillOptionsBox->Add( m_FillOpt, 0, wxALL|wxEXPAND, 5 );
m_ShowFilledAreasInSketchOpt = new wxCheckBox( this, wxID_ANY, _("Show filled areas in sketch mode"), wxDefaultPosition, wxDefaultSize, 0 ); m_AntipadSizeValue = new wxTextCtrl( this, wxID_ANTIPAD_SIZE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_AntipadSizeValue->SetToolTip( _("Define the gap around the pad") );
m_ShowFilledAreasInSketchOpt->SetToolTip( _("If enabled, filled areas in is this zone will be displayed as non filled polygons.\nIf disabled, filled areas in is this zone will be displayed as \"solid\" areas (normal mode).") ); m_ThermalShapesParamsSizer->Add( m_AntipadSizeValue, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_CopperBridgeWidthText = new wxStaticText( this, wxID_ANY, _("Copper Width"), wxDefaultPosition, wxDefaultSize, 0 );
m_CopperBridgeWidthText->Wrap( -1 );
m_ThermalShapesParamsSizer->Add( m_CopperBridgeWidthText, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_FillOptionsBox->Add( m_ShowFilledAreasInSketchOpt, 0, wxALL, 5 ); m_CopperWidthValue = new wxTextCtrl( this, wxID_COPPER_BRIDGE_VALUE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_CopperWidthValue->SetToolTip( _("Define the tickness of copper in therma reliefs") );
m_ThermalShapesParamsSizer->Add( m_CopperWidthValue, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_FillOptionsBox->Add( m_ThermalShapesParamsSizer, 0, wxEXPAND, 5 );
m_LeftBoxSizer->Add( m_FillOptionsBox, 1, wxEXPAND, 5 ); m_LeftBoxSizer->Add( m_FillOptionsBox, 1, wxEXPAND, 5 );
...@@ -84,13 +95,10 @@ dialog_copper_zone_frame::dialog_copper_zone_frame( wxWindow* parent, wxWindowID ...@@ -84,13 +95,10 @@ dialog_copper_zone_frame::dialog_copper_zone_frame( wxWindow* parent, wxWindowID
m_OrientEdgesOpt->SetSelection( 0 ); m_OrientEdgesOpt->SetSelection( 0 );
m_OutilinesBoxOpt->Add( m_OrientEdgesOpt, 0, wxALL|wxEXPAND, 5 ); m_OutilinesBoxOpt->Add( m_OrientEdgesOpt, 0, wxALL|wxEXPAND, 5 );
wxString m_OutlineAppearanceCtrlChoices[] = { _("Line"), _("Hatched outline"), _("Full hatched") };
m_OutilinesBoxOpt->Add( 5, 5, 0, 0, 5 );
wxString m_OutlineAppearanceCtrlChoices[] = { _("Line"), _("Hatched Outline"), _("Full Hatched") };
int m_OutlineAppearanceCtrlNChoices = sizeof( m_OutlineAppearanceCtrlChoices ) / sizeof( wxString ); int m_OutlineAppearanceCtrlNChoices = sizeof( m_OutlineAppearanceCtrlChoices ) / sizeof( wxString );
m_OutlineAppearanceCtrl = new wxRadioBox( this, ID_RADIOBOX_OUTLINES_OPTION, _("Outlines Appearance"), wxDefaultPosition, wxDefaultSize, m_OutlineAppearanceCtrlNChoices, m_OutlineAppearanceCtrlChoices, 1, wxRA_SPECIFY_COLS ); m_OutlineAppearanceCtrl = new wxRadioBox( this, ID_RADIOBOX_OUTLINES_OPTION, _("Outlines Appearance"), wxDefaultPosition, wxDefaultSize, m_OutlineAppearanceCtrlNChoices, m_OutlineAppearanceCtrlChoices, 1, wxRA_SPECIFY_COLS );
m_OutlineAppearanceCtrl->SetSelection( 0 ); m_OutlineAppearanceCtrl->SetSelection( 1 );
m_OutlineAppearanceCtrl->SetToolTip( _("Choose how a zone outline is displayed\n- Single line\n- Short hatching\n- Full zone area hatched") ); m_OutlineAppearanceCtrl->SetToolTip( _("Choose how a zone outline is displayed\n- Single line\n- Short hatching\n- Full zone area hatched") );
m_OutilinesBoxOpt->Add( m_OutlineAppearanceCtrl, 0, wxALL|wxEXPAND, 5 ); m_OutilinesBoxOpt->Add( m_OutlineAppearanceCtrl, 0, wxALL|wxEXPAND, 5 );
...@@ -103,12 +111,30 @@ dialog_copper_zone_frame::dialog_copper_zone_frame( wxWindow* parent, wxWindowID ...@@ -103,12 +111,30 @@ dialog_copper_zone_frame::dialog_copper_zone_frame( wxWindow* parent, wxWindowID
m_OutilinesBoxOpt->Add( m_ArcApproximationOpt, 0, wxALL|wxEXPAND, 5 ); m_OutilinesBoxOpt->Add( m_ArcApproximationOpt, 0, wxALL|wxEXPAND, 5 );
wxStaticBoxSizer* m_OthersOptionsSizer;
m_OthersOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Others Options:") ), wxVERTICAL );
m_ShowFilledAreasInSketchOpt = new wxCheckBox( this, wxID_ANY, _("Show filled areas in sketch mode"), wxDefaultPosition, wxDefaultSize, 0 );
m_ShowFilledAreasInSketchOpt->SetToolTip( _("If enabled, filled areas in is this zone will be displayed as non filled polygons.\nIf disabled, filled areas in is this zone will be displayed as \"solid\" areas (normal mode).") );
m_OthersOptionsSizer->Add( m_ShowFilledAreasInSketchOpt, 0, wxALL, 5 );
m_ClearanceValueTitle = new wxStaticText( this, wxID_ANY, _("Zone clearance value (mm):"), wxDefaultPosition, wxDefaultSize, 0 );
m_ClearanceValueTitle->Wrap( -1 );
m_OthersOptionsSizer->Add( m_ClearanceValueTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_ZoneClearanceCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_OthersOptionsSizer->Add( m_ZoneClearanceCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_OutilinesBoxOpt->Add( m_OthersOptionsSizer, 1, wxEXPAND, 5 );
m_MiddleBoxSizer->Add( m_OutilinesBoxOpt, 1, wxEXPAND, 5 ); m_MiddleBoxSizer->Add( m_OutilinesBoxOpt, 1, wxEXPAND, 5 );
m_ExportSetupBuuton = new wxButton( this, wxID_BUTTON_EXPORT, _("Export to others zones"), wxDefaultPosition, wxDefaultSize, 0 ); m_ExportSetupButton = new wxButton( this, wxID_BUTTON_EXPORT, _("Export to others zones"), wxDefaultPosition, wxDefaultSize, 0 );
m_ExportSetupBuuton->SetToolTip( _("Export this zone setup to all others copper zones") ); m_ExportSetupButton->SetToolTip( _("Export this zone setup to all others copper zones") );
m_MiddleBoxSizer->Add( m_ExportSetupBuuton, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); m_MiddleBoxSizer->Add( m_ExportSetupButton, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
m_MiddleBox->Add( m_MiddleBoxSizer, 0, 0, 5 ); m_MiddleBox->Add( m_MiddleBoxSizer, 0, 0, 5 );
...@@ -129,7 +155,7 @@ dialog_copper_zone_frame::dialog_copper_zone_frame( wxWindow* parent, wxWindowID ...@@ -129,7 +155,7 @@ dialog_copper_zone_frame::dialog_copper_zone_frame( wxWindow* parent, wxWindowID
m_ButtonCancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); m_ButtonCancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
m_RightBoxSizer->Add( m_ButtonCancel, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); m_RightBoxSizer->Add( m_ButtonCancel, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
m_UnFillZoneButton = new wxButton( this, wxID_BUTTON_UNFILL, _("UnFill Zone"), wxDefaultPosition, wxDefaultSize, 0 ); m_UnFillZoneButton = new wxButton( this, wxID_BUTTON_UNFILL, _("Remove Filling"), wxDefaultPosition, wxDefaultSize, 0 );
m_RightBoxSizer->Add( m_UnFillZoneButton, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); m_RightBoxSizer->Add( m_UnFillZoneButton, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
......
This diff is collapsed.
...@@ -18,9 +18,9 @@ ...@@ -18,9 +18,9 @@
#include <wx/settings.h> #include <wx/settings.h>
#include <wx/stattext.h> #include <wx/stattext.h>
#include <wx/textctrl.h> #include <wx/textctrl.h>
#include <wx/checkbox.h>
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/statbox.h> #include <wx/statbox.h>
#include <wx/checkbox.h>
#include <wx/button.h> #include <wx/button.h>
#include <wx/listbox.h> #include <wx/listbox.h>
#include <wx/dialog.h> #include <wx/dialog.h>
...@@ -37,6 +37,7 @@ class dialog_copper_zone_frame : public wxDialog ...@@ -37,6 +37,7 @@ class dialog_copper_zone_frame : public wxDialog
// Private event handlers // Private event handlers
void _wxFB_OnInitDialog( wxInitDialogEvent& event ){ OnInitDialog( event ); } void _wxFB_OnInitDialog( wxInitDialogEvent& event ){ OnInitDialog( event ); }
void _wxFB_OnPadsInZoneClick( wxCommandEvent& event ){ OnPadsInZoneClick( event ); }
void _wxFB_ExportSetupToOtherCopperZones( wxCommandEvent& event ){ ExportSetupToOtherCopperZones( event ); } void _wxFB_ExportSetupToOtherCopperZones( wxCommandEvent& event ){ ExportSetupToOtherCopperZones( event ); }
void _wxFB_OnButtonOkClick( wxCommandEvent& event ){ OnButtonOkClick( event ); } void _wxFB_OnButtonOkClick( wxCommandEvent& event ){ OnButtonOkClick( event ); }
void _wxFB_OnButtonCancelClick( wxCommandEvent& event ){ OnButtonCancelClick( event ); } void _wxFB_OnButtonCancelClick( wxCommandEvent& event ){ OnButtonCancelClick( event ); }
...@@ -48,6 +49,9 @@ class dialog_copper_zone_frame : public wxDialog ...@@ -48,6 +49,9 @@ class dialog_copper_zone_frame : public wxDialog
enum enum
{ {
ID_RADIOBOX_GRID_SELECTION = 1000, ID_RADIOBOX_GRID_SELECTION = 1000,
wxID_PADS_IN_ZONE_OPTIONS,
wxID_ANTIPAD_SIZE,
wxID_COPPER_BRIDGE_VALUE,
ID_RADIOBOX_OUTLINES_OPTION, ID_RADIOBOX_OUTLINES_OPTION,
wxID_ARC_APPROX, wxID_ARC_APPROX,
wxID_BUTTON_EXPORT, wxID_BUTTON_EXPORT,
...@@ -59,16 +63,19 @@ class dialog_copper_zone_frame : public wxDialog ...@@ -59,16 +63,19 @@ class dialog_copper_zone_frame : public wxDialog
}; };
wxRadioBox* m_GridCtrl; wxRadioBox* m_GridCtrl;
wxStaticText* m_ClearanceValueTitle; wxRadioBox* m_PadInZoneOpt;
wxTextCtrl* m_ZoneClearanceCtrl; wxStaticText* m_AntipadSizeText;
wxRadioBox* m_FillOpt; wxTextCtrl* m_AntipadSizeValue;
wxCheckBox* m_ShowFilledAreasInSketchOpt; wxStaticText* m_CopperBridgeWidthText;
wxTextCtrl* m_CopperWidthValue;
wxRadioBox* m_OrientEdgesOpt; wxRadioBox* m_OrientEdgesOpt;
wxRadioBox* m_OutlineAppearanceCtrl; wxRadioBox* m_OutlineAppearanceCtrl;
wxRadioBox* m_ArcApproximationOpt; wxRadioBox* m_ArcApproximationOpt;
wxButton* m_ExportSetupBuuton; wxCheckBox* m_ShowFilledAreasInSketchOpt;
wxStaticText* m_ClearanceValueTitle;
wxTextCtrl* m_ZoneClearanceCtrl;
wxButton* m_ExportSetupButton;
wxButton* m_OkButton; wxButton* m_OkButton;
wxButton* m_ButtonCancel; wxButton* m_ButtonCancel;
...@@ -84,6 +91,7 @@ class dialog_copper_zone_frame : public wxDialog ...@@ -84,6 +91,7 @@ class dialog_copper_zone_frame : public wxDialog
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void OnInitDialog( wxInitDialogEvent& event ){ event.Skip(); } virtual void OnInitDialog( wxInitDialogEvent& event ){ event.Skip(); }
virtual void OnPadsInZoneClick( wxCommandEvent& event ){ event.Skip(); }
virtual void ExportSetupToOtherCopperZones( wxCommandEvent& event ){ event.Skip(); } virtual void ExportSetupToOtherCopperZones( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonOkClick( wxCommandEvent& event ){ event.Skip(); } virtual void OnButtonOkClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonCancelClick( wxCommandEvent& event ){ event.Skip(); } virtual void OnButtonCancelClick( wxCommandEvent& event ){ event.Skip(); }
...@@ -92,7 +100,7 @@ class dialog_copper_zone_frame : public wxDialog ...@@ -92,7 +100,7 @@ class dialog_copper_zone_frame : public wxDialog
public: public:
dialog_copper_zone_frame( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Fill Zones Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 452,493 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); dialog_copper_zone_frame( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Fill Zones Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 545,493 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~dialog_copper_zone_frame(); ~dialog_copper_zone_frame();
}; };
......
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
#define ZONE_NET_OUTLINES_HATCH_OPTION_KEY wxT( "Zone_Ouline_Hatch_Opt" ) #define ZONE_NET_OUTLINES_HATCH_OPTION_KEY wxT( "Zone_Ouline_Hatch_Opt" )
#define ZONE_NET_SORT_OPTION_KEY wxT( "Zone_NetSort_Opt" ) #define ZONE_NET_SORT_OPTION_KEY wxT( "Zone_NetSort_Opt" )
#define ZONE_NET_FILTER_STRING_KEY wxT( "Zone_Filter_Opt" ) #define ZONE_NET_FILTER_STRING_KEY wxT( "Zone_Filter_Opt" )
#define ZONE_THERMAL_RELIEF_GAP_STRING_KEY wxT( "Zone_TH_Gap" )
#define ZONE_THERMAL_RELIEF_COPPER_WIDTH_STRING_KEY wxT( "Zone_TH_Copper_Width" )
enum zone_cmd { enum zone_cmd {
ZONE_ABORT, ZONE_ABORT,
...@@ -37,6 +39,16 @@ eda_global int g_Zone_Hatching; // Option to show the zone a ...@@ -37,6 +39,16 @@ eda_global int g_Zone_Hatching; // Option to show the zone a
eda_global int g_Zone_Arc_Approximation; // Option to select number of segments to approximate a circle eda_global int g_Zone_Arc_Approximation; // Option to select number of segments to approximate a circle
// 16 or 32 segments // 16 or 32 segments
eda_global int g_FilledAreasShowMode; // Used to select draw options for filled areas in a zone (currently normal =0, sketch = 1) eda_global int g_FilledAreasShowMode; // Used to select draw options for filled areas in a zone (currently normal =0, sketch = 1)
eda_global long g_ThermalReliefGapValue // tickness of the gap in thermal reliefs
#ifdef MAIN
= 200
#endif
;
eda_global long g_ThermalReliefCopperBridgeValue // tickness of the copper bridge in thermal reliefs
#ifdef MAIN
= 200
#endif
;
eda_global ZONE_CONTAINER::m_PadInZone g_Zone_Pad_Options eda_global ZONE_CONTAINER::m_PadInZone g_Zone_Pad_Options
#ifdef MAIN #ifdef MAIN
......
...@@ -64,6 +64,8 @@ void WinEDA_PcbFrame::Add_Similar_Zone( wxDC* DC, ZONE_CONTAINER* zone_container ...@@ -64,6 +64,8 @@ void WinEDA_PcbFrame::Add_Similar_Zone( wxDC* DC, ZONE_CONTAINER* zone_container
* @param zone_container = parent zone outline * @param zone_container = parent zone outline
*/ */
{ {
if ( zone_container == NULL )
return;
s_AddCutoutToCurrentZone = false; s_AddCutoutToCurrentZone = false;
s_CurrentZone = zone_container; s_CurrentZone = zone_container;
wxCommandEvent evt; wxCommandEvent evt;
...@@ -83,6 +85,8 @@ void WinEDA_PcbFrame::Add_Zone_Cutout( wxDC* DC, ZONE_CONTAINER* zone_container ...@@ -83,6 +85,8 @@ void WinEDA_PcbFrame::Add_Zone_Cutout( wxDC* DC, ZONE_CONTAINER* zone_container
* @param zone_container = parent zone outline * @param zone_container = parent zone outline
*/ */
{ {
if ( zone_container == NULL )
return;
s_AddCutoutToCurrentZone = true; s_AddCutoutToCurrentZone = true;
s_CurrentZone = zone_container; s_CurrentZone = zone_container;
wxCommandEvent evt; wxCommandEvent evt;
...@@ -479,39 +483,40 @@ int WinEDA_PcbFrame::Begin_Zone( wxDC* DC ) ...@@ -479,39 +483,40 @@ int WinEDA_PcbFrame::Begin_Zone( wxDC* DC )
* Function Begin_Zone * Function Begin_Zone
* either initializes the first segment of a new zone, or adds an * either initializes the first segment of a new zone, or adds an
* intermediate segment. * intermediate segment.
* A new zone can be:
* created from scratch: the user will be prompted to define parameters (layer, clearence ...)
* created from a similar zone (s_CurrentZone is used): parameters are copied from s_CurrentZone
* created as a cutout (an hole) inside s_CurrentZone
*/ */
{ {
// verify if s_CurrentZone exists: // verify if s_CurrentZone exists (could be deleted since last selection) :
int ii; int ii;
for( ii = 0; ii < m_Pcb->GetAreaCount(); ii++ ) for( ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
{ {
if( s_CurrentZone == m_Pcb->GetArea( ii ) ) if( s_CurrentZone == m_Pcb->GetArea( ii ) )
break; break;
} }
if( ii == m_Pcb->GetAreaCount() ) // Not found: could be deleted since last selection if( ii >= m_Pcb->GetAreaCount() ) // Not found: could be deleted since last selection
{ {
s_AddCutoutToCurrentZone = false; s_AddCutoutToCurrentZone = false;
s_CurrentZone = NULL; s_CurrentZone = NULL;
} }
// If no zone contour in progress, a new zone is beeing created:
ZONE_CONTAINER* zone;
if( m_Pcb->m_CurrentZoneContour == NULL ) if( m_Pcb->m_CurrentZoneContour == NULL )
m_Pcb->m_CurrentZoneContour = new ZONE_CONTAINER( m_Pcb ); m_Pcb->m_CurrentZoneContour = new ZONE_CONTAINER( m_Pcb );
zone = m_Pcb->m_CurrentZoneContour; ZONE_CONTAINER* zone = m_Pcb->m_CurrentZoneContour;
if( zone->GetNumCorners() == 0 ) /* Start a new contour: init zone params (net and layer) */ if( zone->GetNumCorners() == 0 ) /* Start a new contour: init zone params (net, layer ...) */
{ {
if( s_CurrentZone == NULL ) // A new outline is created if( s_CurrentZone == NULL ) // A new outline is created, from scratch
{ {
int diag; int diag;
// Init zone params to reasonnable values // Init zone params to reasonnable values
zone->SetLayer( ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer ); zone->SetLayer( ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer );
// Prompt user fro exact parameters: // Prompt user for parameters:
DrawPanel->m_IgnoreMouseEvents = TRUE; DrawPanel->m_IgnoreMouseEvents = TRUE;
if( zone->IsOnCopperLayer() ) if( zone->IsOnCopperLayer() )
{ // Put a zone on a copper layer { // Put a zone on a copper layer
...@@ -541,7 +546,7 @@ int WinEDA_PcbFrame::Begin_Zone( wxDC* DC ) ...@@ -541,7 +546,7 @@ int WinEDA_PcbFrame::Begin_Zone( wxDC* DC )
( (PCB_SCREEN*) GetScreen() )->m_Active_Layer = g_CurrentZone_Layer; // Set by the dialog frame ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer = g_CurrentZone_Layer; // Set by the dialog frame
} }
else /* Start a new contour: init zone params (net and layer) from an existing zone */ else // Start a new contour: init zone params (net and layer) from an existing zone (add cutout or similar zone)
{ {
( (PCB_SCREEN*) GetScreen() )->m_Active_Layer = g_CurrentZone_Layer = ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer = g_CurrentZone_Layer =
s_CurrentZone->GetLayer(); s_CurrentZone->GetLayer();
...@@ -551,18 +556,18 @@ int WinEDA_PcbFrame::Begin_Zone( wxDC* DC ) ...@@ -551,18 +556,18 @@ int WinEDA_PcbFrame::Begin_Zone( wxDC* DC )
/* Show the Net for zones on copper layers */ /* Show the Net for zones on copper layers */
if( g_CurrentZone_Layer < FIRST_NO_COPPER_LAYER ) if( g_CurrentZone_Layer < FIRST_NO_COPPER_LAYER )
{ {
if( g_HightLigt_Status && (g_HightLigth_NetCode != g_NetcodeSelection) ) if( s_CurrentZone )
g_NetcodeSelection = s_CurrentZone->GetNet();
if( g_HightLigt_Status )
{ {
Hight_Light( DC ); // Remove old hightlight selection Hight_Light( DC ); // Remove old hightlight selection
} }
if( s_CurrentZone )
g_NetcodeSelection = s_CurrentZone->GetNet();
g_HightLigth_NetCode = g_NetcodeSelection; g_HightLigth_NetCode = g_NetcodeSelection;
Hight_Light( DC ); Hight_Light( DC );
} }
if( !s_AddCutoutToCurrentZone ) if( !s_AddCutoutToCurrentZone )
s_CurrentZone = NULL; // the zone is used only once s_CurrentZone = NULL; // the zone is used only once ("add similar zone" command)
} }
// if first segment // if first segment
...@@ -574,6 +579,8 @@ int WinEDA_PcbFrame::Begin_Zone( wxDC* DC ) ...@@ -574,6 +579,8 @@ int WinEDA_PcbFrame::Begin_Zone( wxDC* DC )
zone->m_TimeStamp = GetTimeStamp(); zone->m_TimeStamp = GetTimeStamp();
zone->m_PadOption = g_Zone_Pad_Options; zone->m_PadOption = g_Zone_Pad_Options;
zone->m_ZoneClearance = g_DesignSettings.m_ZoneClearence; zone->m_ZoneClearance = g_DesignSettings.m_ZoneClearence;
zone->m_ThermalReliefGapValue = g_ThermalReliefGapValue;
zone->m_ThermalReliefCopperBridgeValue = g_ThermalReliefCopperBridgeValue;
zone->m_GridFillValue = g_GridRoutingSize; zone->m_GridFillValue = g_GridRoutingSize;
zone->m_Poly->Start( g_CurrentZone_Layer, zone->m_Poly->Start( g_CurrentZone_Layer,
GetScreen()->m_Curseur.x, GetScreen()->m_Curseur.y, GetScreen()->m_Curseur.x, GetScreen()->m_Curseur.y,
...@@ -729,6 +736,8 @@ static void Show_New_Edge_While_Move_Mouse( WinEDA_DrawPanel* panel, wxDC* DC, b ...@@ -729,6 +736,8 @@ static void Show_New_Edge_While_Move_Mouse( WinEDA_DrawPanel* panel, wxDC* DC, b
return; return;
int icorner = zone->GetNumCorners() - 1; int icorner = zone->GetNumCorners() - 1;
if ( icorner < 1 )
return; // We must have 2 (or more) corners
if( erase ) /* Undraw edge in old position*/ if( erase ) /* Undraw edge in old position*/
{ {
...@@ -760,7 +769,6 @@ void WinEDA_PcbFrame::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* zone_container ...@@ -760,7 +769,6 @@ void WinEDA_PcbFrame::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* zone_container
*/ */
{ {
int diag; int diag;
DrawPanel->m_IgnoreMouseEvents = TRUE; DrawPanel->m_IgnoreMouseEvents = TRUE;
if( zone_container->GetLayer() < FIRST_NO_COPPER_LAYER ) if( zone_container->GetLayer() < FIRST_NO_COPPER_LAYER )
{ // edit a zone on a copper layer { // edit a zone on a copper layer
...@@ -795,6 +803,8 @@ void WinEDA_PcbFrame::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* zone_container ...@@ -795,6 +803,8 @@ void WinEDA_PcbFrame::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* zone_container
zone_container->m_GridFillValue = g_GridRoutingSize; zone_container->m_GridFillValue = g_GridRoutingSize;
zone_container->m_ArcToSegmentsCount = g_Zone_Arc_Approximation; zone_container->m_ArcToSegmentsCount = g_Zone_Arc_Approximation;
zone_container->m_DrawOptions = g_FilledAreasShowMode; zone_container->m_DrawOptions = g_FilledAreasShowMode;
zone_container->m_ThermalReliefGapValue = g_ThermalReliefGapValue;
zone_container->m_ThermalReliefCopperBridgeValue = g_ThermalReliefCopperBridgeValue;
// Combine zones if possible : // Combine zones if possible :
......
...@@ -113,7 +113,8 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb ) ...@@ -113,7 +113,8 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
break; break;
case THERMAL_PAD: case THERMAL_PAD:
AddThermalReliefPadPolygon( booleng, *pad, 100, 100 ); AddThermalReliefPadPolygon( booleng, *pad,
m_ThermalReliefGapValue, m_ThermalReliefCopperBridgeValue );
break; break;
case PAD_IN_ZONE: case PAD_IN_ZONE:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment