From b3a5e08c2f0e0d3e8a7b3d2e710629b38716f0ff Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Sat, 29 Sep 2018 10:58:31 -0700 Subject: [PATCH] pcbnew: Rename PCB_ZONE_T and remove from connectivity SEGZONE types were confusingly named PCB_ZONE_T. Zones in pcbnew are now _only_ PCB_ZONE_AREA_T, so we name segzone types PCB_SEGZONE_T to be clear. This also removes processing of the SEGZONEs from connectivity calculations. --- include/core/typeinfo.h | 2 +- pcbnew/attribut.cpp | 2 +- pcbnew/block.cpp | 8 ++++---- pcbnew/board_commit.cpp | 2 +- pcbnew/class_board.cpp | 6 +++--- pcbnew/class_track.cpp | 6 +++--- pcbnew/class_zone.h | 2 +- pcbnew/collectors.cpp | 10 +++++----- pcbnew/connectivity_algo.cpp | 15 ++++++++------- pcbnew/controle.cpp | 2 +- pcbnew/edit.cpp | 2 +- pcbnew/exporters/export_gencad.cpp | 2 +- pcbnew/footprint_editor_onclick.cpp | 2 +- pcbnew/highlight.cpp | 2 +- pcbnew/legacy_plugin.cpp | 6 +++--- pcbnew/legacy_plugin.h | 2 +- pcbnew/onrightclick.cpp | 2 +- pcbnew/pcb_painter.cpp | 2 +- pcbnew/swig/pcbnew_action_plugins.cpp | 2 +- pcbnew/tools/pcb_selection_conditions.cpp | 2 +- 20 files changed, 40 insertions(+), 39 deletions(-) diff --git a/include/core/typeinfo.h b/include/core/typeinfo.h index ad4962efec..178e522b59 100644 --- a/include/core/typeinfo.h +++ b/include/core/typeinfo.h @@ -94,7 +94,7 @@ 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_ZONE_T, ///< class SEGZONE, a segment used to fill a zone area (segment on a + 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) diff --git a/pcbnew/attribut.cpp b/pcbnew/attribut.cpp index 5c6cfff5ca..b731bcf415 100644 --- a/pcbnew/attribut.cpp +++ b/pcbnew/attribut.cpp @@ -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_ZONE_T) ) + if( (track == NULL ) || (track->Type() == PCB_SEGZONE_T) ) return; m_canvas->CrossHairOff( DC ); // Erase cursor shape diff --git a/pcbnew/block.cpp b/pcbnew/block.cpp index b45cfea592..b73e6c6c00 100644 --- a/pcbnew/block.cpp +++ b/pcbnew/block.cpp @@ -566,7 +566,7 @@ 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_ZONE_T: // SEG_ZONE items are now deprecated + case PCB_SEGZONE_T: // SEG_ZONE items are now deprecated item->UnLink(); itemsList->RemovePicker( ii ); ii--; @@ -625,7 +625,7 @@ void PCB_EDIT_FRAME::Block_Rotate() break; // This item is not put in undo list - case PCB_ZONE_T: // SEG_ZONE items are now deprecated + case PCB_SEGZONE_T: // SEG_ZONE items are now deprecated itemsList->RemovePicker( ii ); ii--; break; @@ -694,7 +694,7 @@ void PCB_EDIT_FRAME::Block_Flip() break; // This item is not put in undo list - case PCB_ZONE_T: // SEG_ZONE items are now deprecated + case PCB_SEGZONE_T: // SEG_ZONE items are now deprecated itemsList->RemovePicker( ii ); ii--; break; @@ -750,7 +750,7 @@ void PCB_EDIT_FRAME::Block_Move() break; // This item is not put in undo list - case PCB_ZONE_T: // SEG_ZONE items are now deprecated + case PCB_SEGZONE_T: // SEG_ZONE items are now deprecated itemsList->RemovePicker( ii ); ii--; break; diff --git a/pcbnew/board_commit.cpp b/pcbnew/board_commit.cpp index 76a39a0166..bf6eafac62 100644 --- a/pcbnew/board_commit.cpp +++ b/pcbnew/board_commit.cpp @@ -188,7 +188,7 @@ 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_ZONE_T: // SEG_ZONE items are now deprecated + case PCB_SEGZONE_T: // SEG_ZONE items are now deprecated case PCB_ZONE_AREA_T: view->Remove( boardItem ); diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index d62d82de51..402620828e 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -905,7 +905,7 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, ADD_MODE aMode ) break; - case PCB_ZONE_T: + case PCB_SEGZONE_T: if( aMode == ADD_APPEND ) m_SegZoneDeprecated.PushBack( (SEGZONE*) aBoardItem ); else @@ -1001,7 +1001,7 @@ void BOARD::Remove( BOARD_ITEM* aBoardItem ) m_Track.Remove( (TRACK*) aBoardItem ); break; - case PCB_ZONE_T: + case PCB_SEGZONE_T: m_SegZoneDeprecated.Remove( (SEGZONE*) aBoardItem ); break; @@ -1383,7 +1383,7 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR inspector, void* testData, const KICAD_T s ++p; break; - case PCB_ZONE_T: + case PCB_SEGZONE_T: result = IterateForward( m_SegZoneDeprecated, inspector, testData, p ); ++p; break; diff --git a/pcbnew/class_track.cpp b/pcbnew/class_track.cpp index d510edcb7c..a76d47ef01 100644 --- a/pcbnew/class_track.cpp +++ b/pcbnew/class_track.cpp @@ -109,7 +109,7 @@ EDA_ITEM* TRACK::Clone() const SEGZONE::SEGZONE( BOARD_ITEM* aParent ) : - TRACK( aParent, PCB_ZONE_T ) + TRACK( aParent, PCB_SEGZONE_T ) { } @@ -457,7 +457,7 @@ TRACK* TRACK::GetBestInsertPoint( BOARD* aPcb ) // 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_ZONE_T ) // Deprecated items, only found in very old boards + if( Type() == PCB_SEGZONE_T ) // Deprecated items, only found in very old boards track = aPcb->m_SegZoneDeprecated.GetLast(); else track = aPcb->m_Track.GetLast(); @@ -468,7 +468,7 @@ TRACK* TRACK::GetBestInsertPoint( BOARD* aPcb ) return track->Next(); } - if( Type() == PCB_ZONE_T ) // Deprecated + if( Type() == PCB_SEGZONE_T ) // Deprecated return aPcb->m_SegZoneDeprecated.GetFirst(); else return aPcb->m_Track.GetFirst(); diff --git a/pcbnew/class_zone.h b/pcbnew/class_zone.h index 89f5130662..3658afe048 100644 --- a/pcbnew/class_zone.h +++ b/pcbnew/class_zone.h @@ -76,7 +76,7 @@ public: static inline bool ClassOf( const EDA_ITEM* aItem ) { return aItem && ( ( PCB_ZONE_AREA_T == aItem->Type() ) || - ( PCB_ZONE_T == aItem->Type() ) ); + ( PCB_SEGZONE_T == aItem->Type() ) ); } /** diff --git a/pcbnew/collectors.cpp b/pcbnew/collectors.cpp index b24fde03ff..256343825a 100644 --- a/pcbnew/collectors.cpp +++ b/pcbnew/collectors.cpp @@ -50,7 +50,7 @@ const KICAD_T GENERAL_COLLECTOR::AllBoardItems[] = { PCB_PAD_T, // in modules PCB_MODULE_TEXT_T, // in modules PCB_MODULE_T, // in m_Modules - PCB_ZONE_T, // in m_Zones + PCB_SEGZONE_T, // in m_Zones PCB_ZONE_AREA_T, // in m_ZoneDescriptorList EOT }; @@ -65,7 +65,7 @@ const KICAD_T GENERAL_COLLECTOR::BoardLevelItems[] = { PCB_VIA_T, PCB_TRACE_T, PCB_MODULE_T, - PCB_ZONE_T, + PCB_SEGZONE_T, PCB_ZONE_AREA_T, EOT }; @@ -104,7 +104,7 @@ const KICAD_T GENERAL_COLLECTOR::PadsTracksOrZones[] = { PCB_PAD_T, PCB_VIA_T, PCB_TRACE_T, - PCB_ZONE_T, + PCB_SEGZONE_T, PCB_ZONE_AREA_T, EOT }; @@ -182,7 +182,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData ) breakhere++; break; - case PCB_ZONE_T: + case PCB_SEGZONE_T: breakhere++; break; @@ -266,7 +266,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData ) goto exit; break; - case PCB_ZONE_T: + case PCB_SEGZONE_T: break; case PCB_ZONE_AREA_T: diff --git a/pcbnew/connectivity_algo.cpp b/pcbnew/connectivity_algo.cpp index 50863e5725..4c722ba8f2 100644 --- a/pcbnew/connectivity_algo.cpp +++ b/pcbnew/connectivity_algo.cpp @@ -188,7 +188,6 @@ bool CN_CONNECTIVITY_ALGO::Remove( BOARD_ITEM* aItem ) break; case PCB_ZONE_AREA_T: - case PCB_ZONE_T: { m_itemMap[ static_cast( aItem ) ].MarkItemsAsInvalid(); m_itemMap.erase ( static_cast( aItem ) ); @@ -196,6 +195,7 @@ bool CN_CONNECTIVITY_ALGO::Remove( BOARD_ITEM* aItem ) break; } + case PCB_SEGZONE_T: default: return false; } @@ -279,7 +279,6 @@ bool CN_CONNECTIVITY_ALGO::Add( BOARD_ITEM* aItem ) break; case PCB_ZONE_AREA_T: - case PCB_ZONE_T: { auto zone = static_cast( aItem ); @@ -294,6 +293,8 @@ 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; } @@ -584,7 +585,6 @@ void CN_CONNECTIVITY_ALGO::Build( const std::vector& aItems ) { case PCB_TRACE_T: case PCB_VIA_T: - case PCB_ZONE_T: case PCB_PAD_T: Add( item ); break; @@ -599,6 +599,8 @@ void CN_CONNECTIVITY_ALGO::Build( const std::vector& aItems ) break; } + //N.B. SEGZONE items are deprecated and not to used for connectivity + case PCB_SEGZONE_T: default: break; } @@ -830,21 +832,20 @@ bool CN_VISITOR::operator()( CN_ITEM* aCandidate ) return true; // We should handle zone-zone connection separately - if ( ( parentA->Type() == PCB_ZONE_AREA_T || parentA->Type() == PCB_ZONE_T ) && - ( parentB->Type() == PCB_ZONE_AREA_T || parentB->Type() == PCB_ZONE_T ) ) + if ( parentA->Type() == PCB_ZONE_AREA_T && parentB->Type() == PCB_ZONE_AREA_T ) { checkZoneZoneConnection( static_cast( m_item ), static_cast( aCandidate ) ); return true; } - if( parentA->Type() == PCB_ZONE_AREA_T || parentA->Type() == PCB_ZONE_T) + if( parentA->Type() == PCB_ZONE_AREA_T ) { checkZoneItemConnection( static_cast( aCandidate ), m_item ); return true; } - if( parentB->Type() == PCB_ZONE_AREA_T || parentB->Type() == PCB_ZONE_T) + if( parentB->Type() == PCB_ZONE_AREA_T ) { checkZoneItemConnection( static_cast( m_item ), aCandidate ); return true; diff --git a/pcbnew/controle.cpp b/pcbnew/controle.cpp index 49b905290b..c8220d4704 100644 --- a/pcbnew/controle.cpp +++ b/pcbnew/controle.cpp @@ -170,7 +170,7 @@ BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode ) switch( item->Type() ) { - case PCB_ZONE_T: + case PCB_SEGZONE_T: // Found a TYPE ZONE if( item->GetTimeStamp() == timestampzone ) // Remove it, redundant, zone already found { diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index fdd9b7ab4e..c59db64fa1 100644 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -1300,7 +1300,7 @@ void PCB_EDIT_FRAME::RemoveStruct( BOARD_ITEM* Item, wxDC* DC ) Delete_Segment( DC, (TRACK*) Item ); break; - case PCB_ZONE_T: + case PCB_SEGZONE_T: Delete_OldZone_Fill( (SEGZONE*) Item ); break; diff --git a/pcbnew/exporters/export_gencad.cpp b/pcbnew/exporters/export_gencad.cpp index 9010ca76c8..160135f2cf 100644 --- a/pcbnew/exporters/export_gencad.cpp +++ b/pcbnew/exporters/export_gencad.cpp @@ -1103,7 +1103,7 @@ static void CreateRoutesSection( FILE* aFile, BOARD* aPcb ) fprintf( aFile, "TRACK TRACK%d\n", track->GetWidth() ); } - if( (track->Type() == PCB_TRACE_T) || (track->Type() == PCB_ZONE_T) ) + if( (track->Type() == PCB_TRACE_T) || (track->Type() == PCB_SEGZONE_T) ) { if( old_layer != track->GetLayer() ) { diff --git a/pcbnew/footprint_editor_onclick.cpp b/pcbnew/footprint_editor_onclick.cpp index 1cf90d2d21..d55db5081d 100644 --- a/pcbnew/footprint_editor_onclick.cpp +++ b/pcbnew/footprint_editor_onclick.cpp @@ -444,7 +444,7 @@ bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMen case PCB_TEXT_T: case PCB_VIA_T: case PCB_TRACE_T: - case PCB_ZONE_T: + case PCB_SEGZONE_T: case PCB_MARKER_T: case PCB_DIMENSION_T: case PCB_TARGET_T: diff --git a/pcbnew/highlight.cpp b/pcbnew/highlight.cpp index 03610c9621..0a1a4ec8a4 100644 --- a/pcbnew/highlight.cpp +++ b/pcbnew/highlight.cpp @@ -72,7 +72,7 @@ int PCB_EDIT_FRAME::SelectHighLight( wxDC* DC ) case PCB_TRACE_T: case PCB_VIA_T: - case PCB_ZONE_T: + case PCB_SEGZONE_T: // since these classes are all derived from TRACK, use a common // GetNet() function: netcode = ( (TRACK*) item )->GetNetCode(); diff --git a/pcbnew/legacy_plugin.cpp b/pcbnew/legacy_plugin.cpp index a436bedd75..49d728c772 100644 --- a/pcbnew/legacy_plugin.cpp +++ b/pcbnew/legacy_plugin.cpp @@ -491,7 +491,7 @@ void LEGACY_PLUGIN::loadAllSections( bool doAppend ) else if( TESTLINE( "$ZONE" ) ) { - loadTrackList( PCB_ZONE_T ); + loadTrackList( PCB_SEGZONE_T ); } else if( TESTLINE( "$GENERAL" ) ) @@ -2263,7 +2263,7 @@ void LEGACY_PLUGIN::loadTrackList( int aStructType ) BIU drill = data ? biuParse( data ) : -1; // SetDefault() if < 0 // Read the 2nd line to determine the exact type, one of: - // PCB_TRACE_T, PCB_VIA_T, or PCB_ZONE_T. The type field in 2nd line + // PCB_TRACE_T, PCB_VIA_T, or PCB_SEGZONE_T. The type field in 2nd line // differentiates between PCB_TRACE_T and PCB_VIA_T. With virtual // functions in use, it is critical to instantiate the PCB_VIA_T // exactly. @@ -2316,7 +2316,7 @@ void LEGACY_PLUGIN::loadTrackList( int aStructType ) newTrack = new VIA( m_board ); break; - case PCB_ZONE_T: // this is now deprecated, but exist in old boards + case PCB_SEGZONE_T: // this is now deprecated, but exist in old boards newTrack = new SEGZONE( m_board ); break; } diff --git a/pcbnew/legacy_plugin.h b/pcbnew/legacy_plugin.h index e4ab1bea20..297abfcb30 100644 --- a/pcbnew/legacy_plugin.h +++ b/pcbnew/legacy_plugin.h @@ -210,7 +210,7 @@ protected: * reads a list of segments (Tracks and Vias, or Segzones) * * @param aStructType is either PCB_TRACE_T to indicate tracks and vias, or - * PCB_ZONE_T to indicate oldschool zone segments (before polygons came to be). + * PCB_SEGZONE_T to indicate oldschool zone segments (before polygons came to be). */ void loadTrackList( int aStructType ); diff --git a/pcbnew/onrightclick.cpp b/pcbnew/onrightclick.cpp index 4c0f30a54e..ac73282081 100644 --- a/pcbnew/onrightclick.cpp +++ b/pcbnew/onrightclick.cpp @@ -196,7 +196,7 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) break; - case PCB_ZONE_T: // Item used to fill a zone + case PCB_SEGZONE_T: // Item used to fill a zone AddMenuItem( aPopMenu, ID_POPUP_PCB_DELETE_ZONE, _( "Delete Zone Filling" ), KiBitmap( delete_xpm ) ); break; diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp index b1f762c951..74b0163c14 100644 --- a/pcbnew/pcb_painter.cpp +++ b/pcbnew/pcb_painter.cpp @@ -290,7 +290,7 @@ bool PCB_PAINTER::Draw( const VIEW_ITEM* aItem, int aLayer ) // the "cast" applied in here clarifies which overloaded draw() is called switch( item->Type() ) { - case PCB_ZONE_T: + case PCB_SEGZONE_T: case PCB_TRACE_T: draw( static_cast( item ), aLayer ); break; diff --git a/pcbnew/swig/pcbnew_action_plugins.cpp b/pcbnew/swig/pcbnew_action_plugins.cpp index 0de652664f..48cf00fbe9 100644 --- a/pcbnew/swig/pcbnew_action_plugins.cpp +++ b/pcbnew/swig/pcbnew_action_plugins.cpp @@ -310,7 +310,7 @@ void PCB_EDIT_FRAME::RunActionPlugin( ACTION_PLUGIN* aActionPlugin ) case PCB_TEXT_T: case PCB_DIMENSION_T: case PCB_TARGET_T: - case PCB_ZONE_T: + case PCB_SEGZONE_T: // If item has a list it's mean that the element is on the board if( item->GetList() == NULL ) diff --git a/pcbnew/tools/pcb_selection_conditions.cpp b/pcbnew/tools/pcb_selection_conditions.cpp index dd752bebbb..d239f46320 100644 --- a/pcbnew/tools/pcb_selection_conditions.cpp +++ b/pcbnew/tools/pcb_selection_conditions.cpp @@ -39,7 +39,7 @@ bool PCB_SELECTION_CONDITIONS::OnlyConnectedItems( const SELECTION& aSelection ) { auto type = item->Type(); - if( type != PCB_PAD_T && type != PCB_VIA_T && type != PCB_TRACE_T && type != PCB_ZONE_T ) + if( type != PCB_PAD_T && type != PCB_VIA_T && type != PCB_TRACE_T && type != PCB_ZONE_AREA_T ) return false; }