From 2ba19844428773ca75266e76339bb250c3e87db5 Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Tue, 11 Oct 2011 09:38:13 -0400 Subject: [PATCH] Eeschema net list object generation improvements. * Define function to allow schematic objects to create their own net list objects. * Add net list object creation functions to schematic line, junction, and no connect objects. * Add license statements to all modified files that required one. --- eeschema/netlist.cpp | 159 ++++++++++++------------------------ eeschema/sch_junction.cpp | 51 ++++++++++-- eeschema/sch_junction.h | 29 ++++++- eeschema/sch_line.cpp | 63 +++++++++++++- eeschema/sch_line.h | 33 +++++++- eeschema/sch_no_connect.cpp | 49 ++++++++++- eeschema/sch_no_connect.h | 29 ++++++- include/sch_item_struct.h | 21 ++++- 8 files changed, 305 insertions(+), 129 deletions(-) diff --git a/eeschema/netlist.cpp b/eeschema/netlist.cpp index 14f5386fff..e71396d50d 100644 --- a/eeschema/netlist.cpp +++ b/eeschema/netlist.cpp @@ -1,3 +1,28 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com + * Copyright (C) 2011 Wayne Stambaugh + * Copyright (C) 1992-2011 Kicad Developers, see AUTHORS.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + /** * @file eeschema/netlist.cpp */ @@ -94,13 +119,10 @@ void SCH_EDIT_FRAME::BuildNetListBase() FreeNetObjectsList( g_NetObjectslist ); /* Build the sheet (not screen) list (flattened)*/ - SCH_SHEET_LIST SheetListList; + SCH_SHEET_LIST sheets; /* Fill g_NetObjectslist with items used in connectivity calculation */ - - sheet = SheetListList.GetFirst(); - - for( ; sheet != NULL; sheet = SheetListList.GetNext() ) + for( sheet = sheets.GetFirst(); sheet != NULL; sheet = sheets.GetNext() ) AddConnectedObjects( sheet, g_NetObjectslist ); if( g_NetObjectslist.size() == 0 ) @@ -409,6 +431,7 @@ static NETLIST_OBJECT* FindBestNetName( NETLIST_OBJECT_LIST& aLabelItemBuffer ) // Calculate item priority (initial priority) int item_priority = 0; + for( unsigned ii = 0; ii <= NET_PRIO_MAX; ii++ ) { if ( item->m_Type == priority_order[ii] ) @@ -433,6 +456,7 @@ static NETLIST_OBJECT* FindBestNetName( NETLIST_OBJECT_LIST& aLabelItemBuffer ) break; } } + if( candidate_priority > item_priority ) { item = candidate; @@ -474,6 +498,7 @@ static NETLIST_OBJECT* FindBestNetName( NETLIST_OBJECT_LIST& aLabelItemBuffer ) return item; } + /* * Connect sheets by sheetLabels */ @@ -489,11 +514,11 @@ static void SheetLabelConnect( NETLIST_OBJECT* SheetLabel ) for( unsigned ii = 0; ii < g_NetObjectslist.size(); ii++ ) { NETLIST_OBJECT* ObjetNet = g_NetObjectslist[ii]; + if( ObjetNet->m_SheetList != SheetLabel->m_SheetListInclude ) continue; //use SheetInclude, not the sheet!! - if( (ObjetNet->m_Type != NET_HIERLABEL ) - && (ObjetNet->m_Type != NET_HIERBUSLABELMEMBER ) ) + if( (ObjetNet->m_Type != NET_HIERLABEL ) && (ObjetNet->m_Type != NET_HIERBUSLABELMEMBER ) ) continue; if( ObjetNet->GetNet() == SheetLabel->GetNet() ) @@ -524,105 +549,33 @@ static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist, std::vector& aNetItemBuffer ) { int ii; - SCH_ITEM* DrawList; + SCH_ITEM* item; NETLIST_OBJECT* new_item; SCH_COMPONENT* DrawLibItem; LIB_COMPONENT* Entry; SCH_SHEET_PATH list; - DrawList = sheetlist->LastScreen()->GetDrawItems(); + item = sheetlist->LastScreen()->GetDrawItems(); - for( ; DrawList; DrawList = DrawList->Next() ) + for( ; item; item = item->Next() ) { - switch( DrawList->Type() ) + switch( item->Type() ) { + case SCH_POLYLINE_T: + case SCH_BUS_ENTRY_T: + case SCH_MARKER_T: + case SCH_TEXT_T: case SCH_LINE_T: - #undef STRUCT - #define STRUCT ( (SCH_LINE*) DrawList ) - - if( (STRUCT->GetLayer() != LAYER_BUS) && (STRUCT->GetLayer() != LAYER_WIRE) ) - break; - - new_item = new NETLIST_OBJECT(); - new_item->m_SheetList = *sheetlist; - new_item->m_SheetListInclude = *sheetlist; - new_item->m_Comp = STRUCT; - new_item->m_Start = STRUCT->m_Start; - new_item->m_End = STRUCT->m_End; - - if( STRUCT->GetLayer() == LAYER_BUS ) - { - new_item->m_Type = NET_BUS; - } - else /* WIRE */ - { - new_item->m_Type = NET_SEGMENT; - } - - aNetItemBuffer.push_back( new_item ); - break; - case SCH_JUNCTION_T: - #undef STRUCT - #define STRUCT ( (SCH_JUNCTION*) DrawList ) - new_item = new NETLIST_OBJECT(); - - new_item->m_SheetList = *sheetlist; - new_item->m_SheetListInclude = *sheetlist; - new_item->m_Comp = STRUCT; - new_item->m_Type = NET_JUNCTION; - new_item->m_Start = new_item->m_End = STRUCT->m_Pos; - - aNetItemBuffer.push_back( new_item ); - break; - case SCH_NO_CONNECT_T: - #undef STRUCT - #define STRUCT ( (SCH_NO_CONNECT*) DrawList ) - new_item = new NETLIST_OBJECT(); - - new_item->m_SheetList = *sheetlist; - new_item->m_SheetListInclude = *sheetlist; - new_item->m_Comp = STRUCT; - new_item->m_Type = NET_NOCONNECT; - new_item->m_Start = new_item->m_End = STRUCT->m_Pos; - - aNetItemBuffer.push_back( new_item ); + item->GetNetListItem( aNetItemBuffer, sheetlist ); break; case SCH_LABEL_T: - #undef STRUCT - #define STRUCT ( (SCH_LABEL*) DrawList ) - ii = IsBusLabel( STRUCT->m_Text ); - - new_item = new NETLIST_OBJECT(); - new_item->m_SheetList = *sheetlist; - new_item->m_SheetListInclude = *sheetlist; - new_item->m_Comp = STRUCT; - new_item->m_Type = NET_LABEL; - - if( STRUCT->GetLayer() == LAYER_GLOBLABEL ) - new_item->m_Type = NET_GLOBLABEL; - - if( STRUCT->GetLayer() == LAYER_HIERLABEL ) - new_item->m_Type = NET_HIERLABEL; - - new_item->m_Label = STRUCT->m_Text; - new_item->m_Start = new_item->m_End = STRUCT->m_Pos; - - aNetItemBuffer.push_back( new_item ); - - /* If a bus connects to label */ - if( ii ) - ConvertBusToMembers( aNetItemBuffer, *new_item ); - - - break; - case SCH_GLOBAL_LABEL_T: case SCH_HIERARCHICAL_LABEL_T: #undef STRUCT - #define STRUCT ( (SCH_LABEL*) DrawList ) + #define STRUCT ( (SCH_LABEL*) item ) ii = IsBusLabel( STRUCT->m_Text ); new_item = new NETLIST_OBJECT(); new_item->m_SheetList = *sheetlist; @@ -650,7 +603,7 @@ static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist, break; case SCH_COMPONENT_T: - DrawLibItem = (SCH_COMPONENT*) DrawList; + DrawLibItem = (SCH_COMPONENT*) item; Entry = CMP_LIBRARY::FindLibraryComponent( DrawLibItem->GetLibName() ); @@ -703,32 +656,26 @@ static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist, } break; - case SCH_POLYLINE_T: - case SCH_BUS_ENTRY_T: - case SCH_MARKER_T: - case SCH_TEXT_T: - break; - case SCH_SHEET_T: { #undef STRUCT - #define STRUCT ( (SCH_SHEET*) DrawList ) + #define STRUCT ( (SCH_SHEET*) item ) list = *sheetlist; list.Push( STRUCT ); - SCH_SHEET* sheet = (SCH_SHEET*) DrawList; + SCH_SHEET* sheet = (SCH_SHEET*) item; BOOST_FOREACH( SCH_SHEET_PIN pin, sheet->GetPins() ) { ii = IsBusLabel( pin.m_Text ); new_item = new NETLIST_OBJECT(); - new_item->m_SheetListInclude = *sheetlist; - new_item->m_Comp = &pin; new_item->m_SheetList = *sheetlist; - new_item->m_Link = DrawList; + new_item->m_SheetListInclude = *sheetlist; + new_item->m_SheetListInclude = list; + new_item->m_Comp = &pin; + new_item->m_Link = item; new_item->m_Type = NET_SHEETLABEL; new_item->m_ElectricalType = pin.m_Shape; new_item->m_Label = pin.m_Text; - new_item->m_SheetListInclude = list; new_item->m_Start = new_item->m_End = pin.m_Pos; aNetItemBuffer.push_back( new_item ); @@ -743,7 +690,7 @@ static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist, default: { wxString msg; - msg.Printf( wxT( "Netlist: unexpected struct type %d" ), DrawList->Type() ); + msg.Printf( wxT( "Netlist: unexpected struct type %d" ), item->Type() ); wxMessageBox( msg ); break; } @@ -1172,8 +1119,7 @@ void LabelConnect( NETLIST_OBJECT* LabelRef ) /* Comparison routine for sorting by increasing Netcode * table of elements connected (TabPinSort) by qsort () */ -bool SortItemsbyNetcode( const NETLIST_OBJECT* Objet1, - const NETLIST_OBJECT* Objet2 ) +bool SortItemsbyNetcode( const NETLIST_OBJECT* Objet1, const NETLIST_OBJECT* Objet2 ) { return Objet1->GetNet() < Objet2->GetNet(); } @@ -1182,8 +1128,7 @@ bool SortItemsbyNetcode( const NETLIST_OBJECT* Objet1, /* Comparison routine for sorting items by Sheet Number ( used by qsort ) */ -bool SortItemsBySheet( const NETLIST_OBJECT* Objet1, - const NETLIST_OBJECT* Objet2 ) +bool SortItemsBySheet( const NETLIST_OBJECT* Objet1, const NETLIST_OBJECT* Objet2 ) { return Objet1->m_SheetList.Cmp( Objet2->m_SheetList ) < 0; } diff --git a/eeschema/sch_junction.cpp b/eeschema/sch_junction.cpp index 122b33d73a..3d4dad161d 100644 --- a/eeschema/sch_junction.cpp +++ b/eeschema/sch_junction.cpp @@ -1,6 +1,31 @@ -/********************/ -/* sch_junction.cpp */ -/********************/ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com + * Copyright (C) 2011 Wayne Stambaugh + * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +/** + * @file sch_junction.cpp + */ #include "fctsys.h" #include "gr_basic.h" @@ -14,12 +39,9 @@ #include "general.h" #include "protos.h" #include "sch_junction.h" +#include "class_netlist_object.h" -/**********************/ -/* class SCH_JUNCTION */ -/**********************/ - SCH_JUNCTION::SCH_JUNCTION( const wxPoint& pos ) : SCH_ITEM( NULL, SCH_JUNCTION_T ) { @@ -155,6 +177,21 @@ void SCH_JUNCTION::GetConnectionPoints( vector< wxPoint >& aPoints ) const } +void SCH_JUNCTION::GetNetListItem( vector& aNetListItems, + SCH_SHEET_PATH* aSheetPath ) +{ + NETLIST_OBJECT* item = new NETLIST_OBJECT(); + + item->m_SheetList = *aSheetPath; + item->m_SheetListInclude = *aSheetPath; + item->m_Comp = (SCH_ITEM*) this; + item->m_Type = NET_JUNCTION; + item->m_Start = item->m_End = m_Pos; + + aNetListItems.push_back( item ); +} + + #if defined(DEBUG) void SCH_JUNCTION::Show( int nestLevel, std::ostream& os ) { diff --git a/eeschema/sch_junction.h b/eeschema/sch_junction.h index 3f38258c5c..9b3ce545ee 100644 --- a/eeschema/sch_junction.h +++ b/eeschema/sch_junction.h @@ -1,6 +1,30 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com + * Copyright (C) 2011 Wayne Stambaugh + * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + /** * @file sch_junction.h - * */ #ifndef _SCH_JUNCTION_H_ @@ -93,6 +117,9 @@ public: virtual BITMAP_DEF GetMenuImage() const { return add_junction_xpm; } + virtual void GetNetListItem( vector& aNetListItems, + SCH_SHEET_PATH* aSheetPath ); + #if defined(DEBUG) void Show( int nestLevel, std::ostream& os ); #endif diff --git a/eeschema/sch_line.cpp b/eeschema/sch_line.cpp index 1bbc5963bb..66aeee204c 100644 --- a/eeschema/sch_line.cpp +++ b/eeschema/sch_line.cpp @@ -1,6 +1,32 @@ -/******************/ -/* Class SCH_LINE */ -/******************/ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com + * Copyright (C) 2011 Wayne Stambaugh + * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +/** + * @file sch_line.cpp + * @brief Class SCH_LINE implementation + */ #include "fctsys.h" #include "gr_basic.h" @@ -13,6 +39,7 @@ #include "general.h" #include "protos.h" #include "sch_line.h" +#include "class_netlist_object.h" #include @@ -23,7 +50,7 @@ SCH_LINE::SCH_LINE( const wxPoint& pos, int layer ) : m_Start = pos; m_End = pos; m_Width = 0; // Default thickness used - m_StartIsDangling = m_EndIsDangling = FALSE; + m_StartIsDangling = m_EndIsDangling = false; switch( layer ) { @@ -421,6 +448,7 @@ void SCH_LINE::GetConnectionPoints( vector< wxPoint >& aPoints ) const wxString SCH_LINE::GetSelectMenuText() const { wxString menuText, txtfmt, orient; + if( m_Start.x == m_End.x ) orient = _("Vert."); else if( m_Start.y == m_End.y ) @@ -465,6 +493,33 @@ BITMAP_DEF SCH_LINE::GetMenuImage() const } +void SCH_LINE::GetNetListItem( vector& aNetListItems, + SCH_SHEET_PATH* aSheetPath ) +{ + // Net list item not required for graphic lines. + if( (GetLayer() != LAYER_BUS) && (GetLayer() != LAYER_WIRE) ) + return; + + NETLIST_OBJECT* item = new NETLIST_OBJECT(); + item->m_SheetList = *aSheetPath; + item->m_SheetListInclude = *aSheetPath; + item->m_Comp = (SCH_ITEM*) this; + item->m_Start = m_Start; + item->m_End = m_End; + + if( GetLayer() == LAYER_BUS ) + { + item->m_Type = NET_BUS; + } + else /* WIRE */ + { + item->m_Type = NET_SEGMENT; + } + + aNetListItems.push_back( item ); +} + + bool SCH_LINE::operator <( const SCH_ITEM& aItem ) const { if( Type() != aItem.Type() ) diff --git a/eeschema/sch_line.h b/eeschema/sch_line.h index 6ad225d1db..c5f02b45bb 100644 --- a/eeschema/sch_line.h +++ b/eeschema/sch_line.h @@ -1,6 +1,30 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com + * Copyright (C) 2011 Wayne Stambaugh + * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + /** * @file sch_line.h - * */ #ifndef _SCH_LINE_H_ @@ -117,9 +141,9 @@ public: */ bool MergeOverlap( SCH_LINE* aLine ); - virtual void GetEndPoints( std::vector & aItemList ); + virtual void GetEndPoints( vector & aItemList ); - virtual bool IsDanglingStateChanged( std::vector< DANGLING_END_ITEM >& aItemList ); + virtual bool IsDanglingStateChanged( vector< DANGLING_END_ITEM >& aItemList ); virtual bool IsDangling() const { return m_StartIsDangling || m_EndIsDangling; } @@ -137,6 +161,9 @@ public: virtual BITMAP_DEF GetMenuImage() const; + virtual void GetNetListItem( vector& aNetListItems, + SCH_SHEET_PATH* aSheetPath ); + virtual bool operator <( const SCH_ITEM& aItem ) const; #if defined(DEBUG) diff --git a/eeschema/sch_no_connect.cpp b/eeschema/sch_no_connect.cpp index 7c5cc00a14..66d3bf159b 100644 --- a/eeschema/sch_no_connect.cpp +++ b/eeschema/sch_no_connect.cpp @@ -1,6 +1,32 @@ -/************************/ -/* Class SCH_NO_CONNECT */ -/************************/ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com + * Copyright (C) 2011 Wayne Stambaugh + * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +/** + * @file sch_no_connect.cpp + * @brief Class SCH_NO_CONNECT implementation. + */ #include "fctsys.h" #include "gr_basic.h" @@ -14,6 +40,7 @@ #include "general.h" #include "protos.h" #include "sch_no_connect.h" +#include "class_netlist_object.h" SCH_NO_CONNECT::SCH_NO_CONNECT( const wxPoint& pos ) : @@ -155,6 +182,22 @@ void SCH_NO_CONNECT::GetConnectionPoints( vector< wxPoint >& aPoints ) const aPoints.push_back( m_Pos ); } + +void SCH_NO_CONNECT::GetNetListItem( vector& aNetListItems, + SCH_SHEET_PATH* aSheetPath ) +{ + NETLIST_OBJECT* item = new NETLIST_OBJECT(); + + item->m_SheetList = *aSheetPath; + item->m_SheetListInclude = *aSheetPath; + item->m_Comp = this; + item->m_Type = NET_NOCONNECT; + item->m_Start = item->m_End = m_Pos; + + aNetListItems.push_back( item ); +} + + bool SCH_NO_CONNECT::doIsConnected( const wxPoint& aPosition ) const { return m_Pos == aPosition; diff --git a/eeschema/sch_no_connect.h b/eeschema/sch_no_connect.h index 2a5a07c02c..bb2bb049c5 100644 --- a/eeschema/sch_no_connect.h +++ b/eeschema/sch_no_connect.h @@ -1,6 +1,30 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com + * Copyright (C) 2011 Wayne Stambaugh + * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + /** * @file sch_no_connect.h - * */ #ifndef _SCH_NO_CONNECT_H_ @@ -98,6 +122,9 @@ public: virtual BITMAP_DEF GetMenuImage() const { return noconn_xpm; } + virtual void GetNetListItem( vector& aNetListItems, + SCH_SHEET_PATH* aSheetPath ); + private: virtual bool doIsConnected( const wxPoint& aPosition ) const; virtual bool doHitTest( const wxPoint& aPoint, int aAccuracy ) const; diff --git a/include/sch_item_struct.h b/include/sch_item_struct.h index f8212b54a4..54b8518178 100644 --- a/include/sch_item_struct.h +++ b/include/sch_item_struct.h @@ -1,6 +1,7 @@ -/*****************************************************************************/ -/* sch_item_struct.h : Basic classes for most eeschema items descriptions */ -/*****************************************************************************/ +/** + * @file sch_item_struct.h + * @brief Base schematic object class definition. + */ #ifndef SCH_ITEM_STRUCT_H #define SCH_ITEM_STRUCT_H @@ -12,10 +13,12 @@ using namespace std; class SCH_ITEM; +class SCH_SHEET_PATH; class LINE_READER; class SCH_EDIT_FRAME; class wxFindReplaceData; class PLOTTER; +class NETLIST_OBJECT; typedef boost::ptr_vector< SCH_ITEM > SCH_ITEMS; @@ -306,6 +309,18 @@ public: void Plot( PLOTTER* aPlotter ) { doPlot( aPlotter ); } + /** + * Function GetNetListItem + * creates a new #NETLIST_OBJECT for the schematic object and adds it to + * \a aNetListItems. + *

+ * Not all schematic objects have net list items associated with them. This + * method only needs to be overridden for those schematic objects that have + * net list objects associated with them. + */ + virtual void GetNetListItem( vector& aNetListItems, + SCH_SHEET_PATH* aSheetPath ) { } + virtual bool operator <( const SCH_ITEM& aItem ) const; /**