Commit d5cbd5d1 authored by Wayne Stambaugh's avatar Wayne Stambaugh

Eeschema net list object generation improvements.

* Add net list object creation functions to schematic component object.
* Remove external variables used by the verify bus label and parse bus
  label functions.
* Remove redundant net list object include sheet path member assignment.
* Add license statements to all modified files that required one.
parent 2ba19844
This diff is collapsed.
......@@ -61,7 +61,7 @@ EDA_Colors ReturnLayerColor( int Layer );
/***************/
/* NETLIST.CPP */
/***************/
int IsBusLabel( const wxString& LabelDrawList );
bool IsBusLabel( const wxString& aLabel );
/***************/
......
/*
* 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 <stambaughw@verizon.net>
* 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_component.cpp
* @brief Implementation of the class SCH_COMPONENT.
......@@ -21,6 +46,7 @@
#include "sch_component.h"
#include "sch_sheet.h"
#include "sch_sheet_path.h"
#include "class_netlist_object.h"
#include "dialogs/dialog_schematic_find.h"
......@@ -1735,6 +1761,57 @@ SEARCH_RESULT SCH_COMPONENT::Visit( INSPECTOR* aInspector, const void* aTestData
}
void SCH_COMPONENT::GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems,
SCH_SHEET_PATH* aSheetPath )
{
LIB_COMPONENT* component = CMP_LIBRARY::FindLibraryComponent( GetLibName() );
if( component == NULL )
return;
for( LIB_PIN* pin = component->GetNextPin(); pin; pin = component->GetNextPin( pin ) )
{
wxASSERT( pin->Type() == LIB_PIN_T );
if( pin->GetUnit() && ( pin->GetUnit() != GetUnitSelection( aSheetPath ) ) )
continue;
if( pin->GetConvert() && ( pin->GetConvert() != GetConvert() ) )
continue;
wxPoint pos = GetTransform().TransformCoordinate( pin->GetPosition() ) + m_Pos;
NETLIST_OBJECT* item = new NETLIST_OBJECT();
item->m_SheetListInclude = *aSheetPath;
item->m_Comp = (SCH_ITEM*) pin;
item->m_SheetList = *aSheetPath;
item->m_Type = NET_PIN;
item->m_Link = (SCH_ITEM*) this;
item->m_ElectricalType = pin->GetType();
item->m_PinNum = pin->GetNumber();
item->m_Label = pin->GetName();
item->m_Start = item->m_End = pos;
aNetListItems.push_back( item );
if( ( (int) pin->GetType() == (int) PIN_POWER_IN ) && !pin->IsVisible() )
{
/* There is an associated PIN_LABEL. */
item = new NETLIST_OBJECT();
item->m_SheetListInclude = *aSheetPath;
item->m_Comp = NULL;
item->m_SheetList = *aSheetPath;
item->m_Type = NET_PINLABEL;
item->m_Label = pin->GetName();
item->m_Start = pos;
item->m_End = item->m_Start;
aNetListItems.push_back( item );
}
}
}
bool SCH_COMPONENT::operator <( const SCH_ITEM& aItem ) const
{
if( Type() != aItem.Type() )
......
/*
* 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 <stambaughw@verizon.net>
* 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_component.h
* @brief Definition the SCH_COMPONENT class for Eeschema.
......@@ -384,6 +409,9 @@ public:
virtual BITMAP_DEF GetMenuImage() const { return add_component_xpm; }
virtual void GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems,
SCH_SHEET_PATH* aSheetPath );
virtual bool operator <( const SCH_ITEM& aItem ) const;
#if defined(DEBUG)
......
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