mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-19 20:31:41 +00:00
Remove legacy segment-based zones.
Give the user the option of cancelling a file open if there are segment zones; otherwise they're converted to polygon fills. Fixes: lp:1823087 * https://bugs.launchpad.net/kicad/+bug/1823087
This commit is contained in:
parent
2d7ef9813f
commit
dae41b7460
include/core
pcbnew
attribut.cppblock.cppboard_commit.cppclass_board.cppclass_board.hclass_track.cppclass_track.hclass_zone.cppclass_zone.hcollectors.cpp
connectivity
controle.cppdialogs
drc.cppedit.cppexporters
files.cppfootprint_editor_onclick.cpphighlight.cppkicad_plugin.cpplegacy_plugin.cpplegacy_plugin.hnetinfo_list.cpponrightclick.cpppcb_draw_panel_gal.cpppcb_edit_frame.hpcb_legacy_draw_utils.cpppcb_painter.cpppcb_painter.hpcb_parser.cpppcb_parser.hpcbnew_id.hplot_board_layers.cppplot_brditems_plotter.cppswig
tools
undo_redo.cppzone_filler.cppzone_filler.hzone_settings.hzones_by_polygon.cppzones_by_polygon_fill_functions.cpp@ -94,8 +94,6 @@ enum KICAD_T
|
||||
PCB_MODULE_EDGE_T, ///< class EDGE_MODULE, a footprint edge
|
||||
PCB_TRACE_T, ///< class TRACK, a track segment (segment on a copper layer)
|
||||
PCB_VIA_T, ///< class VIA, a via (like a track segment on a copper layer)
|
||||
PCB_SEGZONE_T, ///< class SEGZONE, a segment used to fill a zone area (segment on a
|
||||
///< copper layer)
|
||||
PCB_MARKER_T, ///< class MARKER_PCB, a marker used to show something
|
||||
PCB_DIMENSION_T, ///< class DIMENSION, a dimension (graphic item)
|
||||
PCB_TARGET_T, ///< class PCB_TARGET, a target (graphic item)
|
||||
|
@ -70,7 +70,7 @@ void PCB_EDIT_FRAME::Attribut_Track( TRACK* track, wxDC* DC, bool Flag_On )
|
||||
TRACK* Track;
|
||||
int nb_segm;
|
||||
|
||||
if( (track == NULL ) || (track->Type() == PCB_SEGZONE_T) )
|
||||
if( track == NULL )
|
||||
return;
|
||||
|
||||
m_canvas->CrossHairOff( DC ); // Erase cursor shape
|
||||
|
@ -566,7 +566,6 @@ void PCB_EDIT_FRAME::Block_Delete()
|
||||
|
||||
// These items are deleted, but not put in undo list
|
||||
case PCB_MARKER_T: // a marker used to show something
|
||||
case PCB_SEGZONE_T: // SEG_ZONE items are now deprecated
|
||||
item->UnLink();
|
||||
itemsList->RemovePicker( ii );
|
||||
ii--;
|
||||
@ -626,12 +625,6 @@ void PCB_EDIT_FRAME::Block_Rotate()
|
||||
case PCB_DIMENSION_T:
|
||||
break;
|
||||
|
||||
// This item is not put in undo list
|
||||
case PCB_SEGZONE_T: // SEG_ZONE items are now deprecated
|
||||
itemsList->RemovePicker( ii );
|
||||
ii--;
|
||||
break;
|
||||
|
||||
default:
|
||||
wxMessageBox( wxT( "PCB_EDIT_FRAME::Block_Rotate( ) error: unexpected type" ) );
|
||||
break;
|
||||
@ -695,13 +688,6 @@ void PCB_EDIT_FRAME::Block_Flip()
|
||||
case PCB_DIMENSION_T:
|
||||
break;
|
||||
|
||||
// This item is not put in undo list
|
||||
case PCB_SEGZONE_T: // SEG_ZONE items are now deprecated
|
||||
itemsList->RemovePicker( ii );
|
||||
ii--;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
wxMessageBox( wxT( "PCB_EDIT_FRAME::Block_Flip( ) error: unexpected type" ) );
|
||||
break;
|
||||
@ -751,12 +737,6 @@ void PCB_EDIT_FRAME::Block_Move()
|
||||
case PCB_DIMENSION_T:
|
||||
break;
|
||||
|
||||
// This item is not put in undo list
|
||||
case PCB_SEGZONE_T: // SEG_ZONE items are now deprecated
|
||||
itemsList->RemovePicker( ii );
|
||||
ii--;
|
||||
break;
|
||||
|
||||
default:
|
||||
wxMessageBox( wxT( "PCB_EDIT_FRAME::Block_Move( ) error: unexpected type" ) );
|
||||
break;
|
||||
|
@ -183,7 +183,6 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a
|
||||
case PCB_DIMENSION_T: // a dimension (graphic item)
|
||||
case PCB_TARGET_T: // a target (graphic item)
|
||||
case PCB_MARKER_T: // a marker used to show something
|
||||
case PCB_SEGZONE_T: // SEG_ZONE items are now deprecated
|
||||
case PCB_ZONE_AREA_T:
|
||||
itemsToDeselect.push_back( boardItem );
|
||||
|
||||
|
@ -903,14 +903,6 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, ADD_MODE aMode )
|
||||
|
||||
break;
|
||||
|
||||
case PCB_SEGZONE_T:
|
||||
if( aMode == ADD_APPEND )
|
||||
m_SegZoneDeprecated.PushBack( (SEGZONE*) aBoardItem );
|
||||
else
|
||||
m_SegZoneDeprecated.PushFront( (SEGZONE*) aBoardItem );
|
||||
|
||||
break;
|
||||
|
||||
case PCB_MODULE_T:
|
||||
if( aMode == ADD_APPEND )
|
||||
m_Modules.PushBack( (MODULE*) aBoardItem );
|
||||
@ -999,10 +991,6 @@ void BOARD::Remove( BOARD_ITEM* aBoardItem )
|
||||
m_Track.Remove( (TRACK*) aBoardItem );
|
||||
break;
|
||||
|
||||
case PCB_SEGZONE_T:
|
||||
m_SegZoneDeprecated.Remove( (SEGZONE*) aBoardItem );
|
||||
break;
|
||||
|
||||
case PCB_DIMENSION_T:
|
||||
case PCB_LINE_T:
|
||||
case PCB_TEXT_T:
|
||||
@ -1090,12 +1078,6 @@ int BOARD::GetNumSegmTrack() const
|
||||
}
|
||||
|
||||
|
||||
int BOARD::GetNumSegmZone() const
|
||||
{
|
||||
return m_SegZoneDeprecated.GetCount();
|
||||
}
|
||||
|
||||
|
||||
unsigned BOARD::GetNodesCount( int aNet )
|
||||
{
|
||||
unsigned retval = 0;
|
||||
@ -1161,18 +1143,7 @@ EDA_RECT BOARD::ComputeBoundingBox( bool aBoardEdgesOnly ) const
|
||||
hasItems = true;
|
||||
}
|
||||
|
||||
// Check segment zones
|
||||
for( TRACK* track = m_SegZoneDeprecated; track; track = track->Next() )
|
||||
{
|
||||
if( !hasItems )
|
||||
area = track->GetBoundingBox();
|
||||
else
|
||||
area.Merge( track->GetBoundingBox() );
|
||||
|
||||
hasItems = true;
|
||||
}
|
||||
|
||||
// Check polygonal zones
|
||||
// Check zones
|
||||
for( auto aZone : m_ZoneDescriptorList )
|
||||
{
|
||||
if( !hasItems )
|
||||
@ -1387,11 +1358,6 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR inspector, void* testData, const KICAD_T s
|
||||
++p;
|
||||
break;
|
||||
|
||||
case PCB_SEGZONE_T:
|
||||
result = IterateForward( m_SegZoneDeprecated, inspector, testData, p );
|
||||
++p;
|
||||
break;
|
||||
|
||||
default: // catch EOT or ANY OTHER type here and return.
|
||||
done = true;
|
||||
break;
|
||||
|
@ -55,7 +55,6 @@ class PCB_EDIT_FRAME;
|
||||
class PICKED_ITEMS_LIST;
|
||||
class BOARD;
|
||||
class ZONE_CONTAINER;
|
||||
class SEGZONE;
|
||||
class TRACK;
|
||||
class D_PAD;
|
||||
class MARKER_PCB;
|
||||
@ -251,8 +250,6 @@ public:
|
||||
|
||||
DLIST<MODULE> m_Modules; // linked list of MODULEs
|
||||
DLIST<TRACK> m_Track; // linked list of TRACKs and VIAs
|
||||
DLIST<SEGZONE> m_SegZoneDeprecated; // linked list of SEGZONEs, for really very old boards
|
||||
// should be removed one day
|
||||
|
||||
DLIST_ITERATOR_WRAPPER<TRACK> Tracks() { return DLIST_ITERATOR_WRAPPER<TRACK>(m_Track); }
|
||||
DLIST_ITERATOR_WRAPPER<MODULE> Modules() { return DLIST_ITERATOR_WRAPPER<MODULE>(m_Modules); }
|
||||
@ -275,8 +272,7 @@ public:
|
||||
|
||||
bool IsEmpty() const
|
||||
{
|
||||
return m_Drawings.GetCount() == 0 && m_Modules.GetCount() == 0 &&
|
||||
m_Track.GetCount() == 0 && m_SegZoneDeprecated.GetCount() == 0;
|
||||
return m_Drawings.GetCount() == 0 && m_Modules.GetCount() == 0 && m_Track.GetCount() == 0;
|
||||
}
|
||||
|
||||
void Move( const wxPoint& aMoveVector ) override;
|
||||
@ -698,9 +694,6 @@ public:
|
||||
/** Functions to get some items count */
|
||||
int GetNumSegmTrack() const;
|
||||
|
||||
/** Calculate the zone segment count */
|
||||
int GetNumSegmZone() const;
|
||||
|
||||
/**
|
||||
* Function GetNodesCount
|
||||
* @param aNet Only count nodes belonging to this net
|
||||
|
@ -108,32 +108,6 @@ EDA_ITEM* TRACK::Clone() const
|
||||
}
|
||||
|
||||
|
||||
SEGZONE::SEGZONE( BOARD_ITEM* aParent ) :
|
||||
TRACK( aParent, PCB_SEGZONE_T )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
EDA_ITEM* SEGZONE::Clone() const
|
||||
{
|
||||
return new SEGZONE( *this );
|
||||
}
|
||||
|
||||
|
||||
wxString SEGZONE::GetSelectMenuText( EDA_UNITS_T aUnits ) const
|
||||
{
|
||||
return wxString::Format( _( "Zone [%s] on %s" ),
|
||||
UnescapeString( GetNetnameMsg() ),
|
||||
GetLayerName() );
|
||||
}
|
||||
|
||||
|
||||
BITMAP_DEF SEGZONE::GetMenuImage() const
|
||||
{
|
||||
return add_zone_xpm;
|
||||
}
|
||||
|
||||
|
||||
VIA::VIA( BOARD_ITEM* aParent ) :
|
||||
TRACK( aParent, PCB_VIA_T )
|
||||
{
|
||||
@ -454,26 +428,16 @@ void VIA::SanitizeLayers()
|
||||
|
||||
TRACK* TRACK::GetBestInsertPoint( BOARD* aPcb )
|
||||
{
|
||||
TRACK* track;
|
||||
|
||||
// When reading from a file most of the items will already be in the correct order.
|
||||
// Searching from the back therefore takes us from n^2 to essentially 0.
|
||||
|
||||
if( Type() == PCB_SEGZONE_T ) // Deprecated items, only found in very old boards
|
||||
track = aPcb->m_SegZoneDeprecated.GetLast();
|
||||
else
|
||||
track = aPcb->m_Track.GetLast();
|
||||
|
||||
for( ; track; track = track->Back() )
|
||||
for( TRACK* track = aPcb->m_Track.GetLast(); track; track = track->Back() )
|
||||
{
|
||||
if( GetNetCode() >= track->GetNetCode() )
|
||||
return track->Next();
|
||||
}
|
||||
|
||||
if( Type() == PCB_SEGZONE_T ) // Deprecated
|
||||
return aPcb->m_SegZoneDeprecated.GetFirst();
|
||||
else
|
||||
return aPcb->m_Track.GetFirst();
|
||||
return aPcb->m_Track.GetFirst();
|
||||
}
|
||||
|
||||
|
||||
@ -694,65 +658,6 @@ void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode,
|
||||
}
|
||||
|
||||
|
||||
void SEGZONE::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode,
|
||||
const wxPoint& aOffset )
|
||||
{
|
||||
auto displ_opts = (PCB_DISPLAY_OPTIONS*)( panel->GetDisplayOptions() );
|
||||
|
||||
if( displ_opts->m_DisplayZonesMode != 0 )
|
||||
return;
|
||||
|
||||
BOARD* brd = GetBoard();
|
||||
|
||||
auto frame = static_cast<PCB_BASE_FRAME*> ( panel->GetParent() );
|
||||
auto color = frame->Settings().Colors().GetLayerColor( m_Layer );
|
||||
|
||||
if( brd->IsLayerVisible( m_Layer ) == false && !( aDrawMode & GR_HIGHLIGHT ) )
|
||||
return;
|
||||
|
||||
#ifdef USE_WX_OVERLAY
|
||||
// If dragged not draw in OnPaint otherwise remains impressed in wxOverlay
|
||||
if( (m_Flags & IS_DRAGGED) && aDC->IsKindOf(wxCLASSINFO(wxPaintDC)))
|
||||
return;
|
||||
#endif
|
||||
|
||||
if( ( aDrawMode & GR_ALLOW_HIGHCONTRAST ) && displ_opts->m_ContrastModeDisplay )
|
||||
{
|
||||
PCB_LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
|
||||
|
||||
if( !IsOnLayer( curr_layer ) )
|
||||
color = COLOR4D( DARKDARKGRAY );
|
||||
}
|
||||
|
||||
if( ( aDrawMode & GR_HIGHLIGHT ) && !( aDrawMode & GR_AND ) )
|
||||
color.SetToLegacyHighlightColor();
|
||||
|
||||
color.a = 0.588;
|
||||
|
||||
GRSetDrawMode( aDC, aDrawMode );
|
||||
|
||||
// Draw track as line if width <= 1pixel:
|
||||
if( aDC->LogicalToDeviceXRel( m_Width ) <= 1 )
|
||||
{
|
||||
GRLine( panel->GetClipBox(), aDC, m_Start + aOffset, m_End + aOffset, m_Width, color );
|
||||
return;
|
||||
}
|
||||
|
||||
if( !displ_opts->m_DisplayPcbTrackFill || GetState( FORCE_SKETCH ) )
|
||||
{
|
||||
GRCSegm( panel->GetClipBox(), aDC, m_Start + aOffset, m_End + aOffset, m_Width, color );
|
||||
}
|
||||
else
|
||||
{
|
||||
GRFillCSegm( panel->GetClipBox(), aDC, m_Start.x + aOffset.x,
|
||||
m_Start.y + aOffset.y,
|
||||
m_End.x + aOffset.x, m_End.y + aOffset.y, m_Width, color );
|
||||
}
|
||||
|
||||
// No clearance or netnames for zones
|
||||
}
|
||||
|
||||
|
||||
void TRACK::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
{
|
||||
// Show the track and its netname on different layers
|
||||
@ -1194,33 +1099,6 @@ void TRACK::GetMsgPanelInfoBase( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM
|
||||
aList.push_back( MSG_PANEL_ITEM( _( "Segment Length" ), msg, DARKCYAN ) );
|
||||
}
|
||||
|
||||
void SEGZONE::GetMsgPanelInfoBase( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList )
|
||||
{
|
||||
wxString msg;
|
||||
BOARD* board = GetBoard();
|
||||
|
||||
aList.push_back( MSG_PANEL_ITEM( _( "Type" ), _( "Zone " ), DARKCYAN ) );
|
||||
|
||||
GetMsgPanelInfoBase_Common( aUnits, aList );
|
||||
|
||||
// Display layer
|
||||
if( board )
|
||||
msg = board->GetLayerName( m_Layer );
|
||||
else
|
||||
msg.Printf( wxT( "%d" ), m_Layer );
|
||||
|
||||
aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), msg, BROWN ) );
|
||||
|
||||
// Display width
|
||||
msg = MessageTextFromValue( aUnits, m_Width );
|
||||
|
||||
aList.push_back( MSG_PANEL_ITEM( _( "Width" ), msg, DARKCYAN ) );
|
||||
|
||||
// Display segment length
|
||||
msg = MessageTextFromValue( aUnits, GetLength() );
|
||||
aList.push_back( MSG_PANEL_ITEM( _( "Segment Length" ), msg, DARKCYAN ) );
|
||||
}
|
||||
|
||||
void VIA::GetMsgPanelInfoBase( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList )
|
||||
{
|
||||
wxString msg;
|
||||
|
@ -358,35 +358,6 @@ private:
|
||||
};
|
||||
|
||||
|
||||
class SEGZONE : public TRACK
|
||||
{
|
||||
public:
|
||||
SEGZONE( BOARD_ITEM* aParent );
|
||||
|
||||
// Do not create a copy constructor. The one generated by the compiler is adequate.
|
||||
|
||||
wxString GetClass() const override
|
||||
{
|
||||
return wxT( "ZONE" );
|
||||
}
|
||||
|
||||
|
||||
SEGZONE* Next() const { return static_cast<SEGZONE*>( Pnext ); }
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override;
|
||||
|
||||
void Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
|
||||
GR_DRAWMODE aDrawMode, const wxPoint& aOffset = ZeroOffset ) override;
|
||||
|
||||
BITMAP_DEF GetMenuImage() const override;
|
||||
|
||||
EDA_ITEM* Clone() const override;
|
||||
|
||||
protected:
|
||||
void GetMsgPanelInfoBase( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override;
|
||||
};
|
||||
|
||||
|
||||
class VIA : public TRACK
|
||||
{
|
||||
public:
|
||||
|
@ -459,7 +459,7 @@ void ZONE_CONTAINER::DrawFilledArea( EDA_DRAW_PANEL* panel,
|
||||
color.a = 0.588;
|
||||
|
||||
|
||||
for ( int ic = 0; ic < m_FilledPolysList.OutlineCount(); ic++ )
|
||||
for( int ic = 0; ic < m_FilledPolysList.OutlineCount(); ic++ )
|
||||
{
|
||||
const SHAPE_LINE_CHAIN& path = m_FilledPolysList.COutline( ic );
|
||||
|
||||
@ -485,40 +485,29 @@ void ZONE_CONTAINER::DrawFilledArea( EDA_DRAW_PANEL* panel,
|
||||
if( ( m_ZoneMinThickness > 1 ) || outline_mode )
|
||||
{
|
||||
int ilim = CornersBuffer.size() - 1;
|
||||
|
||||
int line_thickness = m_ZoneMinThickness;
|
||||
|
||||
for( int is = 0, ie = ilim; is <= ilim; ie = is, is++ )
|
||||
{
|
||||
// Draw only basic outlines, not extra segments.
|
||||
if( !displ_opts->m_DisplayPcbTrackFill || GetState( FORCE_SKETCH ) )
|
||||
GRCSegm( panel->GetClipBox(), DC,
|
||||
CornersBuffer[is], CornersBuffer[ie], line_thickness, color );
|
||||
{
|
||||
GRCSegm( panel->GetClipBox(), DC, CornersBuffer[is], CornersBuffer[ie],
|
||||
line_thickness, color );
|
||||
}
|
||||
else
|
||||
GRFilledSegment( panel->GetClipBox(), DC,
|
||||
CornersBuffer[is], CornersBuffer[ie], line_thickness, color );
|
||||
{
|
||||
GRFilledSegment( panel->GetClipBox(), DC, CornersBuffer[is], CornersBuffer[ie],
|
||||
line_thickness, color );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Draw areas:
|
||||
if( m_FillMode != ZFM_SEGMENTS && !outline_mode )
|
||||
GRPoly( panel->GetClipBox(), DC, CornersBuffer.size(), &CornersBuffer[0],
|
||||
true, 0, color, color );
|
||||
}
|
||||
|
||||
if( m_FillMode == ZFM_SEGMENTS && !outline_mode ) // filled with segments
|
||||
{
|
||||
for( unsigned ic = 0; ic < m_FillSegmList.size(); ic++ )
|
||||
// Draw fill:
|
||||
if( !outline_mode )
|
||||
{
|
||||
wxPoint start = (wxPoint) ( m_FillSegmList[ic].A + VECTOR2I(offset) );
|
||||
wxPoint end = (wxPoint) ( m_FillSegmList[ic].B + VECTOR2I(offset) );
|
||||
|
||||
if( !displ_opts->m_DisplayPcbTrackFill || GetState( FORCE_SKETCH ) )
|
||||
GRCSegm( panel->GetClipBox(), DC, start.x, start.y, end.x, end.y,
|
||||
m_ZoneMinThickness, color );
|
||||
else
|
||||
GRFillCSegm( panel->GetClipBox(), DC, start.x, start.y, end.x, end.y,
|
||||
m_ZoneMinThickness, color );
|
||||
GRPoly( panel->GetClipBox(), DC, CornersBuffer.size(), &CornersBuffer[0], true, 0,
|
||||
color, color );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -882,11 +871,9 @@ void ZONE_CONTAINER::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL
|
||||
switch( m_FillMode )
|
||||
{
|
||||
case ZFM_POLYGONS:
|
||||
msg = _( "Polygons" ); break;
|
||||
msg = _( "Solid" ); break;
|
||||
case ZFM_HATCH_PATTERN:
|
||||
msg = _( "Hatch Fill" ); break;
|
||||
case ZFM_SEGMENTS: // Deprecated: found in old boards
|
||||
msg = _( "Segments" ); break;
|
||||
msg = _( "Hatched" ); break;
|
||||
default:
|
||||
msg = _( "Unknown" ); break;
|
||||
}
|
||||
|
@ -74,8 +74,7 @@ public:
|
||||
|
||||
static inline bool ClassOf( const EDA_ITEM* aItem )
|
||||
{
|
||||
return aItem && ( ( PCB_ZONE_AREA_T == aItem->Type() ) ||
|
||||
( PCB_SEGZONE_T == aItem->Type() ) );
|
||||
return aItem && aItem->Type() == PCB_ZONE_AREA_T;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -782,7 +781,6 @@ private:
|
||||
|
||||
/** How to fill areas:
|
||||
* ZFM_POLYGONS => use solid polygons
|
||||
* ZFM_SEGMENTS => fill by segments (deprecated).
|
||||
* ZFM_HATCH_PATTERN => use a grid pattern as shape
|
||||
*/
|
||||
ZONE_FILL_MODE m_FillMode;
|
||||
|
@ -51,7 +51,6 @@ const KICAD_T GENERAL_COLLECTOR::AllBoardItems[] = {
|
||||
PCB_PAD_T, // in modules
|
||||
PCB_MODULE_TEXT_T, // in modules
|
||||
PCB_MODULE_T, // in m_Modules
|
||||
PCB_SEGZONE_T, // in m_Zones
|
||||
PCB_ZONE_AREA_T, // in m_ZoneDescriptorList
|
||||
EOT
|
||||
};
|
||||
@ -66,7 +65,6 @@ const KICAD_T GENERAL_COLLECTOR::BoardLevelItems[] = {
|
||||
PCB_VIA_T,
|
||||
PCB_TRACE_T,
|
||||
PCB_MODULE_T,
|
||||
PCB_SEGZONE_T,
|
||||
PCB_ZONE_AREA_T,
|
||||
EOT
|
||||
};
|
||||
@ -182,10 +180,6 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
|
||||
breakhere++;
|
||||
break;
|
||||
|
||||
case PCB_SEGZONE_T:
|
||||
breakhere++;
|
||||
break;
|
||||
|
||||
case PCB_TEXT_T:
|
||||
breakhere++;
|
||||
break;
|
||||
@ -266,9 +260,6 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
|
||||
goto exit;
|
||||
break;
|
||||
|
||||
case PCB_SEGZONE_T:
|
||||
break;
|
||||
|
||||
case PCB_ZONE_AREA_T:
|
||||
zone = static_cast<ZONE_CONTAINER*>( item );
|
||||
break;
|
||||
|
@ -78,7 +78,6 @@ bool CN_CONNECTIVITY_ALGO::Remove( BOARD_ITEM* aItem )
|
||||
break;
|
||||
}
|
||||
|
||||
case PCB_SEGZONE_T:
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@ -176,8 +175,6 @@ bool CN_CONNECTIVITY_ALGO::Add( BOARD_ITEM* aItem )
|
||||
break;
|
||||
}
|
||||
|
||||
//N.B. SEGZONE items are deprecated and not to used for connectivity
|
||||
case PCB_SEGZONE_T:
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@ -440,8 +437,6 @@ void CN_CONNECTIVITY_ALGO::Build( const std::vector<BOARD_ITEM*>& aItems )
|
||||
break;
|
||||
}
|
||||
|
||||
//N.B. SEGZONE items are deprecated and not to used for connectivity
|
||||
case PCB_SEGZONE_T:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -158,43 +158,17 @@ BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode )
|
||||
(*m_Collector)[i]->Show( 0, std::cout );
|
||||
#endif
|
||||
|
||||
/* Remove redundancies: sometime, legacy zones are found twice,
|
||||
* because zones can be filled by overlapping segments (this is a fill option)
|
||||
* Trigger the selection of the current edge for new-style zones
|
||||
*/
|
||||
timestamp_t timestampzone = 0;
|
||||
|
||||
// Trigger the selection of the current edge for zones
|
||||
for( int ii = 0; ii < m_Collector->GetCount(); ii++ )
|
||||
{
|
||||
item = (*m_Collector)[ii];
|
||||
|
||||
switch( item->Type() )
|
||||
if( item->Type() == PCB_ZONE_AREA_T )
|
||||
{
|
||||
case PCB_SEGZONE_T:
|
||||
// Found a TYPE ZONE
|
||||
if( item->GetTimeStamp() == timestampzone ) // Remove it, redundant, zone already found
|
||||
{
|
||||
m_Collector->Remove( ii );
|
||||
ii--;
|
||||
}
|
||||
else
|
||||
{
|
||||
timestampzone = item->GetTimeStamp();
|
||||
}
|
||||
break;
|
||||
|
||||
case PCB_ZONE_AREA_T:
|
||||
{
|
||||
/* We need to do the selection now because the menu text
|
||||
* depends on it */
|
||||
ZONE_CONTAINER *zone = static_cast<ZONE_CONTAINER*>( item );
|
||||
int accuracy = KiROUND( 5 * guide.OnePixelInIU() );
|
||||
zone->SetSelectedCorner( RefPos( true ), accuracy );
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
// We need to do the selection now because the menu text depends on it
|
||||
ZONE_CONTAINER *zone = static_cast<ZONE_CONTAINER*>( item );
|
||||
int accuracy = KiROUND( 5 * guide.OnePixelInIU() );
|
||||
zone->SetSelectedCorner( RefPos( true ), accuracy );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -240,12 +240,6 @@ void PCB_EDIT_FRAME::Swap_Layers( wxCommandEvent& event )
|
||||
}
|
||||
}
|
||||
|
||||
for( TRACK* segm = GetBoard()->m_SegZoneDeprecated; segm; segm = segm->Next() )
|
||||
{
|
||||
// Note: deprecated zone segment fills only found in very old boards
|
||||
hasChanges |= processBoardItem( this, commit, segm, new_layer );
|
||||
}
|
||||
|
||||
for( BOARD_ITEM* zone : GetBoard()->Zones() )
|
||||
{
|
||||
hasChanges |= processBoardItem( this, commit, zone, new_layer );
|
||||
|
@ -462,7 +462,7 @@ void DRC::RunTests( wxTextCtrl* aMessages )
|
||||
if( aMessages )
|
||||
aMessages->AppendText( _( "Refilling all zones...\n" ) );
|
||||
|
||||
m_pcbEditorFrame->Fill_All_Zones( caller );
|
||||
m_pcbEditorFrame->Fill_All_Zones();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -111,7 +111,6 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||
case ID_POPUP_PCB_PLACE_ZONE_CORNER:
|
||||
case ID_POPUP_PCB_PLACE_ZONE_OUTLINES:
|
||||
case ID_POPUP_PCB_EDIT_ZONE_PARAMS:
|
||||
case ID_POPUP_PCB_DELETE_ZONE:
|
||||
case ID_POPUP_PCB_DELETE_ZONE_CORNER:
|
||||
case ID_POPUP_PCB_MOVE_ZONE_CORNER:
|
||||
case ID_POPUP_PCB_DRAG_ZONE_OUTLINE_SEGMENT:
|
||||
@ -499,21 +498,6 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||
case ID_POPUP_PCB_SETFLAGS_TRACK_MNU:
|
||||
break;
|
||||
|
||||
case ID_POPUP_PCB_DELETE_ZONE:
|
||||
m_canvas->MoveCursorToCrossHair();
|
||||
|
||||
if( GetCurItem() )
|
||||
{
|
||||
SEGZONE* zsegm = (SEGZONE*) GetCurItem();
|
||||
int netcode = zsegm->GetNetCode();
|
||||
Delete_OldZone_Fill( zsegm );
|
||||
SetCurItem( NULL );
|
||||
TestNetConnection( NULL, netcode );
|
||||
OnModify();
|
||||
SetMsgPanel( GetBoard() );
|
||||
}
|
||||
break;
|
||||
|
||||
case ID_POPUP_PCB_EDIT_ZONE_PARAMS:
|
||||
Edit_Zone_Params( &dc, (ZONE_CONTAINER*) GetCurItem() );
|
||||
SetCurItem( NULL ); // Outlines can have changed
|
||||
@ -617,7 +601,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||
|
||||
case ID_POPUP_PCB_FILL_ALL_ZONES:
|
||||
m_canvas->MoveCursorToCrossHair();
|
||||
Fill_All_Zones( this );
|
||||
Fill_All_Zones();
|
||||
m_canvas->Refresh();
|
||||
SetMsgPanel( GetBoard() );
|
||||
break;
|
||||
@ -638,9 +622,6 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||
break;
|
||||
|
||||
case ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_ALL_ZONES: // Remove all zones :
|
||||
GetBoard()->m_SegZoneDeprecated.DeleteAll(); // remove deprecated zone segments used
|
||||
// to fill zones in very old boards.
|
||||
|
||||
for( int ii = 0; ii < GetBoard()->GetAreaCount(); ii++ )
|
||||
{
|
||||
// Remove filled areas in zone
|
||||
@ -1293,10 +1274,6 @@ void PCB_EDIT_FRAME::RemoveStruct( BOARD_ITEM* Item, wxDC* DC )
|
||||
Delete_Segment( DC, (TRACK*) Item );
|
||||
break;
|
||||
|
||||
case PCB_SEGZONE_T:
|
||||
Delete_OldZone_Fill( (SEGZONE*) Item );
|
||||
break;
|
||||
|
||||
case PCB_ZONE_AREA_T:
|
||||
{
|
||||
SetCurItem( NULL );
|
||||
|
@ -1103,14 +1103,13 @@ static void CreateRoutesSection( FILE* aFile, BOARD* aPcb )
|
||||
fprintf( aFile, "TRACK TRACK%d\n", track->GetWidth() );
|
||||
}
|
||||
|
||||
if( (track->Type() == PCB_TRACE_T) || (track->Type() == PCB_SEGZONE_T) )
|
||||
if( track->Type() == PCB_TRACE_T )
|
||||
{
|
||||
if( old_layer != track->GetLayer() )
|
||||
{
|
||||
old_layer = track->GetLayer();
|
||||
fprintf( aFile, "LAYER %s\n",
|
||||
GenCADLayerName( cu_count, track->GetLayer() ).c_str()
|
||||
);
|
||||
GenCADLayerName( cu_count, track->GetLayer() ).c_str() );
|
||||
}
|
||||
|
||||
fprintf( aFile, "LINE %g %g %g %g\n",
|
||||
|
@ -576,7 +576,10 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
|
||||
if( bds.m_CopperEdgeClearance == Millimeter2iu( LEGACY_COPPEREDGECLEARANCE ) )
|
||||
bds.SetCopperEdgeClearance( inferLegacyEdgeClearance( loadedBoard ) );
|
||||
|
||||
GetScreen()->ClrModify();
|
||||
if( loadedBoard->IsModified() )
|
||||
OnModify();
|
||||
else
|
||||
GetScreen()->ClrModify();
|
||||
|
||||
if( pluginType == IO_MGR::LEGACY &&
|
||||
loadedBoard->GetFileFormatVersionAtLoad() < LEGACY_BOARD_FILE_VERSION )
|
||||
|
@ -437,7 +437,6 @@ bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMen
|
||||
case PCB_TEXT_T:
|
||||
case PCB_VIA_T:
|
||||
case PCB_TRACE_T:
|
||||
case PCB_SEGZONE_T:
|
||||
case PCB_MARKER_T:
|
||||
case PCB_DIMENSION_T:
|
||||
case PCB_TARGET_T:
|
||||
|
@ -76,7 +76,6 @@ int PCB_EDIT_FRAME::SelectHighLight( wxDC* DC )
|
||||
|
||||
case PCB_TRACE_T:
|
||||
case PCB_VIA_T:
|
||||
case PCB_SEGZONE_T:
|
||||
// since these classes are all derived from TRACK, use a common
|
||||
// GetNet() function:
|
||||
netcode = ( (TRACK*) item )->GetNetCode();
|
||||
|
@ -600,7 +600,6 @@ void PCB_IO::formatGeneral( BOARD* aBoard, int aNestLevel ) const
|
||||
|
||||
m_out->Print( aNestLevel+1, "(drawings %d)\n", aBoard->Drawings().Size() );
|
||||
m_out->Print( aNestLevel+1, "(tracks %d)\n", aBoard->GetNumSegmTrack() );
|
||||
m_out->Print( aNestLevel+1, "(zones %d)\n", aBoard->GetNumSegmZone() );
|
||||
m_out->Print( aNestLevel+1, "(modules %d)\n", aBoard->m_Modules.GetCount() );
|
||||
m_out->Print( aNestLevel+1, "(nets %d)\n", m_mapping->GetSize() );
|
||||
m_out->Print( aNestLevel, ")\n\n" );
|
||||
@ -675,8 +674,7 @@ void PCB_IO::formatBoardLayers( BOARD* aBoard, int aNestLevel ) const
|
||||
void PCB_IO::formatNetInformation( BOARD* aBoard, int aNestLevel ) const
|
||||
{
|
||||
const BOARD_DESIGN_SETTINGS& dsnSettings = aBoard->GetDesignSettings();
|
||||
for( NETINFO_MAPPING::iterator net = m_mapping->begin(), netEnd = m_mapping->end();
|
||||
net != netEnd; ++net )
|
||||
for( NETINFO_ITEM* net : *m_mapping )
|
||||
{
|
||||
m_out->Print( aNestLevel, "(net %d %s)\n",
|
||||
m_mapping->Translate( net->GetNet() ),
|
||||
@ -691,11 +689,9 @@ void PCB_IO::formatNetInformation( BOARD* aBoard, int aNestLevel ) const
|
||||
defaultNC.Format( m_out, aNestLevel, m_ctl );
|
||||
|
||||
// Save the rest of the net classes alphabetically.
|
||||
for( NETCLASSES::const_iterator it = dsnSettings.m_NetClasses.begin();
|
||||
it != dsnSettings.m_NetClasses.end();
|
||||
++it )
|
||||
for( const auto& it : dsnSettings.m_NetClasses )
|
||||
{
|
||||
NETCLASS netclass = *it->second;
|
||||
NETCLASS netclass = *it.second;
|
||||
filterNetClass( *aBoard, netclass ); // Remove empty nets (from a copy of a netclass)
|
||||
netclass.Format( m_out, aNestLevel, m_ctl );
|
||||
}
|
||||
@ -1719,9 +1715,7 @@ void PCB_IO::format( ZONE_CONTAINER* aZone, int aNestLevel ) const
|
||||
m_out->Print( 0, " yes" );
|
||||
|
||||
// Default is polygon filled.
|
||||
if( aZone->GetFillMode() == ZFM_SEGMENTS ) // Now deprecated. Should not be used
|
||||
m_out->Print( 0, " (mode segment)" );
|
||||
else if( aZone->GetFillMode() == ZFM_HATCH_PATTERN )
|
||||
if( aZone->GetFillMode() == ZFM_HATCH_PATTERN )
|
||||
m_out->Print( 0, " (mode hatch)" );
|
||||
|
||||
m_out->Print( 0, " (arc_segments %d) (thermal_gap %s) (thermal_bridge_width %s)",
|
||||
|
@ -86,7 +86,7 @@
|
||||
#include <convert_to_biu.h>
|
||||
#include <trigo.h>
|
||||
#include <build_version.h>
|
||||
|
||||
#include <confirm.h>
|
||||
|
||||
typedef LEGACY_PLUGIN::BIU BIU;
|
||||
|
||||
@ -496,7 +496,8 @@ void LEGACY_PLUGIN::loadAllSections( bool doAppend )
|
||||
|
||||
else if( TESTLINE( "$ZONE" ) )
|
||||
{
|
||||
loadTrackList( PCB_SEGZONE_T );
|
||||
// No longer supported; discard segment fills
|
||||
loadTrackList( NOT_USED );
|
||||
}
|
||||
|
||||
else if( TESTLINE( "$GENERAL" ) )
|
||||
@ -2306,10 +2307,12 @@ void LEGACY_PLUGIN::loadTrackList( int aStructType )
|
||||
|
||||
flags = static_cast<STATUS_FLAGS>( flags_int );
|
||||
|
||||
if( aStructType==PCB_TRACE_T && type==1 )
|
||||
makeType = PCB_VIA_T;
|
||||
if( aStructType == PCB_TRACE_T )
|
||||
makeType = ( type == 1 ) ? PCB_VIA_T : PCB_TRACE_T;
|
||||
else if (aStructType == NOT_USED )
|
||||
continue;
|
||||
else
|
||||
makeType = aStructType;
|
||||
wxFAIL_MSG( "Segment type unknown" );
|
||||
|
||||
TRACK* newTrack;
|
||||
|
||||
@ -2323,10 +2326,6 @@ void LEGACY_PLUGIN::loadTrackList( int aStructType )
|
||||
case PCB_VIA_T:
|
||||
newTrack = new VIA( m_board );
|
||||
break;
|
||||
|
||||
case PCB_SEGZONE_T: // this is now deprecated, but exist in old boards
|
||||
newTrack = new SEGZONE( m_board );
|
||||
break;
|
||||
}
|
||||
|
||||
newTrack->SetTimeStamp( (timestamp_t)timeStamp );
|
||||
@ -2623,7 +2622,31 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER()
|
||||
BIU thermalReliefGap = biuParse( data += 2 , &data ); // +=2 for " F"
|
||||
BIU thermalReliefCopperBridge = biuParse( data );
|
||||
|
||||
zc->SetFillMode( fillmode ? ZFM_SEGMENTS : ZFM_POLYGONS );
|
||||
if( fillmode)
|
||||
{
|
||||
// SEGMENT fill mode no longer supported. Make sure user is OK with converting them.
|
||||
if( m_showLegacyZoneWarning )
|
||||
{
|
||||
KIDIALOG dlg( nullptr,
|
||||
_( "The legacy segment fill mode is no longer supported.\n"
|
||||
"Convert zones to polygon fills?"),
|
||||
_( "Legacy Zone Warning" ),
|
||||
wxYES_NO | wxICON_WARNING );
|
||||
|
||||
dlg.DoNotShowCheckbox( __FILE__, __LINE__ );
|
||||
|
||||
if( dlg.ShowModal() == wxID_NO )
|
||||
THROW_IO_ERROR( wxT( "CANCEL" ) );
|
||||
|
||||
m_showLegacyZoneWarning = false;
|
||||
}
|
||||
|
||||
// User OK'd; switch to polygon mode
|
||||
zc->SetFillMode( ZFM_POLYGONS );
|
||||
m_board->SetModified();
|
||||
}
|
||||
else
|
||||
zc->SetFillMode( ZFM_POLYGONS );
|
||||
|
||||
// @todo ARC_APPROX_SEGMENTS_COUNT_HIGH_DEF: don't really want pcbnew.h
|
||||
// in here, after all, its a PLUGIN and global data is evil.
|
||||
@ -3063,6 +3086,7 @@ void LEGACY_PLUGIN::init( const PROPERTIES* aProperties )
|
||||
m_loading_format_version = 0;
|
||||
m_cu_count = 16;
|
||||
m_board = NULL;
|
||||
m_showLegacyZoneWarning = true;
|
||||
m_props = aProperties;
|
||||
|
||||
// conversion factor for saving RAM BIUs to KICAD legacy file format.
|
||||
|
@ -53,7 +53,6 @@ class NETINFO_MAPPING;
|
||||
class TEXTE_MODULE;
|
||||
class EDGE_MODULE;
|
||||
class TRACK;
|
||||
class SEGZONE;
|
||||
class D_PAD;
|
||||
struct LP_CACHE;
|
||||
|
||||
@ -128,6 +127,7 @@ protected:
|
||||
wxString m_field; ///< reused to stuff MODULE fields.
|
||||
int m_loading_format_version; ///< which BOARD_FORMAT_VERSION am I Load()ing?
|
||||
LP_CACHE* m_cache;
|
||||
bool m_showLegacyZoneWarning;
|
||||
|
||||
NETINFO_MAPPING* m_mapping; ///< mapping for net codes, so only not empty nets
|
||||
///< are stored with consecutive integers as net codes
|
||||
@ -209,8 +209,8 @@ protected:
|
||||
* Function loadTrackList
|
||||
* reads a list of segments (Tracks and Vias, or Segzones)
|
||||
*
|
||||
* @param aStructType is either PCB_TRACE_T to indicate tracks and vias, or
|
||||
* PCB_SEGZONE_T to indicate oldschool zone segments (before polygons came to be).
|
||||
* @param aStructType is either PCB_TRACE_T to indicate tracks and vias, or NOT_USED
|
||||
* to indicate oldschool zone segments (which are discarded).
|
||||
*/
|
||||
void loadTrackList( int aStructType );
|
||||
|
||||
|
@ -228,10 +228,6 @@ void NETINFO_MAPPING::Update()
|
||||
}
|
||||
}
|
||||
|
||||
// Segzones (should be removed: used only in very old boards)
|
||||
for( SEGZONE* zone = m_board->m_SegZoneDeprecated; zone; zone = zone->Next() )
|
||||
nets.insert( zone->GetNetCode() );
|
||||
|
||||
// Prepare the new mapping
|
||||
m_netMapping.clear();
|
||||
|
||||
|
@ -196,11 +196,6 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
|
||||
|
||||
break;
|
||||
|
||||
case PCB_SEGZONE_T: // Item used to fill a zone
|
||||
AddMenuItem( aPopMenu, ID_POPUP_PCB_DELETE_ZONE,
|
||||
_( "Delete Zone Filling" ), KiBitmap( delete_xpm ) );
|
||||
break;
|
||||
|
||||
case PCB_ZONE_AREA_T: // Item used to handle a zone area (outlines, holes ...)
|
||||
if( flags & IS_NEW )
|
||||
{
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user