Commit 4e55b6be authored by Wayne Stambaugh's avatar Wayne Stambaugh

More Eeschema net list object generation improvements.

* Add net list object creation functions to schematic sheet and label
  objects.
* Remove function to add schematic object net list items as it is no
  longer needed.
* Add license statements to all modified files that required one.
parent 31a4334a
This diff is collapsed.
...@@ -61,6 +61,13 @@ EDA_Colors ReturnLayerColor( int Layer ); ...@@ -61,6 +61,13 @@ EDA_Colors ReturnLayerColor( int Layer );
/***************/ /***************/
/* NETLIST.CPP */ /* NETLIST.CPP */
/***************/ /***************/
/**
* Function IsBusLabel
* test if the \a aLabel has a bus notation.
*
* @param aLabel A wxString object containing the label to test.
* @return false if text is not a bus notattion otherwise true is returned.
*/
bool IsBusLabel( const wxString& aLabel ); bool IsBusLabel( const wxString& aLabel );
......
...@@ -37,13 +37,17 @@ ...@@ -37,13 +37,17 @@
#include "richio.h" #include "richio.h"
#include "wxEeschemaStruct.h" #include "wxEeschemaStruct.h"
#include "plot_common.h" #include "plot_common.h"
#include "kicad_string.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "sch_sheet.h" #include "sch_sheet.h"
#include "sch_sheet_path.h" #include "sch_sheet_path.h"
#include "sch_component.h" #include "sch_component.h"
#include "kicad_string.h" #include "class_netlist_object.h"
extern void ConvertBusToMembers( NETLIST_OBJECT_LIST& aNetItemBuffer, NETLIST_OBJECT& aBusLabel );
SCH_SHEET::SCH_SHEET( const wxPoint& pos ) : SCH_SHEET::SCH_SHEET( const wxPoint& pos ) :
...@@ -1094,6 +1098,31 @@ wxPoint SCH_SHEET::GetResizePosition() const ...@@ -1094,6 +1098,31 @@ wxPoint SCH_SHEET::GetResizePosition() const
} }
void SCH_SHEET::GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems,
SCH_SHEET_PATH* aSheetPath )
{
SCH_SHEET_PATH sheetPath = *aSheetPath;
sheetPath.Push( this );
for( size_t i = 0; i < m_pins.size(); i++ )
{
NETLIST_OBJECT* item = new NETLIST_OBJECT();
item->m_SheetListInclude = sheetPath;
item->m_SheetList = *aSheetPath;
item->m_Comp = &m_pins[i];
item->m_Link = this;
item->m_Type = NET_SHEETLABEL;
item->m_ElectricalType = m_pins[i].m_Shape;
item->m_Label = m_pins[i].m_Text;
item->m_Start = item->m_End = m_pins[i].m_Pos;
aNetListItems.push_back( item );
if( IsBusLabel( m_pins[i].m_Text ) )
ConvertBusToMembers( aNetListItems, *item );
}
}
void SCH_SHEET::doPlot( PLOTTER* aPlotter ) void SCH_SHEET::doPlot( PLOTTER* aPlotter )
{ {
EDA_Colors txtcolor = UNSPECIFIED_COLOR; EDA_Colors txtcolor = UNSPECIFIED_COLOR;
......
/*
* 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_sheet.h * @file sch_sheet.h
* @brief Definition of the SCH_SHEET class for Eeschema. * @brief Definition of the SCH_SHEET class for Eeschema.
...@@ -565,6 +590,9 @@ public: ...@@ -565,6 +590,9 @@ public:
virtual BITMAP_DEF GetMenuImage() const { return add_hierarchical_subsheet_xpm; } virtual BITMAP_DEF GetMenuImage() const { return add_hierarchical_subsheet_xpm; }
virtual void GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems,
SCH_SHEET_PATH* aSheetPath );
#if defined(DEBUG) #if defined(DEBUG)
// comment inherited by Doxygen from Base_Struct // comment inherited by Doxygen from Base_Struct
......
/*
* 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_text.cpp * @file sch_text.cpp
* @brief Code for handling schematic sheet labels. * @brief Code for handling schematic sheet labels.
...@@ -16,16 +41,12 @@ ...@@ -16,16 +41,12 @@
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "sch_text.h" #include "sch_text.h"
#include "class_netlist_object.h"
extern void IncrementLabelMember( wxString& name );
extern void IncrementLabelMember( wxString& name );
extern void ConvertBusToMembers( NETLIST_OBJECT_LIST& aNetItemBuffer, NETLIST_OBJECT& aBusLabel );
/************************/
/* class SCH_TEXT */
/* class SCH_LABEL */
/* class SCH_GLOBALLABEL */
/* class SCH_HIERLABEL */
/************************/
/* Names of sheet label types. */ /* Names of sheet label types. */
const char* SheetLabelType[] = const char* SheetLabelType[] =
...@@ -150,8 +171,10 @@ bool SCH_TEXT::Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint ...@@ -150,8 +171,10 @@ bool SCH_TEXT::Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint
if( SCH_ITEM::Matches( m_Text, aSearchData ) ) if( SCH_ITEM::Matches( m_Text, aSearchData ) )
{ {
EDA_RECT BoundaryBox = GetBoundingBox(); EDA_RECT BoundaryBox = GetBoundingBox();
if( aFindLocation ) if( aFindLocation )
*aFindLocation = BoundaryBox.Centre(); *aFindLocation = BoundaryBox.Centre();
return true; return true;
} }
...@@ -345,7 +368,7 @@ void SCH_TEXT::Place( SCH_EDIT_FRAME* frame, wxDC* DC ) ...@@ -345,7 +368,7 @@ void SCH_TEXT::Place( SCH_EDIT_FRAME* frame, wxDC* DC )
frame->SetUndoItem( NULL ); frame->SetUndoItem( NULL );
pickList.PushItem( picker ); pickList.PushItem( picker );
frame->SaveCopyInUndoList( pickList, UR_CHANGED); //UR_EXCHANGE_T ); frame->SaveCopyInUndoList( pickList, UR_CHANGED ); //UR_EXCHANGE_T );
} }
SCH_ITEM::Place( frame, DC ); SCH_ITEM::Place( frame, DC );
...@@ -389,6 +412,7 @@ void SCH_TEXT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& aOffset, ...@@ -389,6 +412,7 @@ void SCH_TEXT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& aOffset,
EXCHG( linewidth, m_Thickness ); // Set the minimum width EXCHG( linewidth, m_Thickness ); // Set the minimum width
EDA_TEXT::Draw( panel, DC, text_offset, color, DrawMode, FILLED, UNSPECIFIED_COLOR ); EDA_TEXT::Draw( panel, DC, text_offset, color, DrawMode, FILLED, UNSPECIFIED_COLOR );
EXCHG( linewidth, m_Thickness ); // set initial value EXCHG( linewidth, m_Thickness ); // set initial value
if( m_IsDangling ) if( m_IsDangling )
DrawDanglingSymbol( panel, DC, m_Pos + aOffset, color ); DrawDanglingSymbol( panel, DC, m_Pos + aOffset, color );
...@@ -648,6 +672,34 @@ wxString SCH_TEXT::GetSelectMenuText() const ...@@ -648,6 +672,34 @@ wxString SCH_TEXT::GetSelectMenuText() const
} }
void SCH_TEXT::GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems,
SCH_SHEET_PATH* aSheetPath )
{
if( GetLayer() == LAYER_NOTES || GetLayer() == LAYER_SHEETLABEL )
return;
NETLIST_OBJECT* item = new NETLIST_OBJECT();
item->m_SheetList = *aSheetPath;
item->m_SheetListInclude = *aSheetPath;
item->m_Comp = (SCH_ITEM*) this;
item->m_Type = NET_LABEL;
if( GetLayer() == LAYER_GLOBLABEL )
item->m_Type = NET_GLOBLABEL;
else if( GetLayer() == LAYER_HIERLABEL )
item->m_Type = NET_HIERLABEL;
item->m_Label = m_Text;
item->m_Start = item->m_End = m_Pos;
aNetListItems.push_back( item );
/* If a bus connects to label */
if( IsBusLabel( m_Text ) )
ConvertBusToMembers( aNetListItems, *item );
}
bool SCH_TEXT::doHitTest( const wxPoint& aPoint, int aAccuracy ) const bool SCH_TEXT::doHitTest( const wxPoint& aPoint, int aAccuracy ) const
{ {
return TextHitTest( aPoint, aAccuracy ); return TextHitTest( aPoint, aAccuracy );
...@@ -1416,6 +1468,7 @@ bool SCH_HIERLABEL::Load( LINE_READER& aLine, wxString& aErrorMsg ) ...@@ -1416,6 +1468,7 @@ bool SCH_HIERLABEL::Load( LINE_READER& aLine, wxString& aErrorMsg )
Name1[0] = 0; Name2[0] = 0; Name3[0] = 0; Name1[0] = 0; Name2[0] = 0; Name3[0] = 0;
char* sline = (char*) aLine; char* sline = (char*) aLine;
while( (*sline != ' ' ) && *sline ) while( (*sline != ' ' ) && *sline )
sline++; sline++;
......
/*
* 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_text.h * @file sch_text.h
* @brief Definitions of the SCH_TEXT class and derivatives for Eeschema. * @brief Definitions of the SCH_TEXT class and derivatives for Eeschema.
...@@ -205,6 +230,9 @@ public: ...@@ -205,6 +230,9 @@ public:
virtual BITMAP_DEF GetMenuImage() const { return add_text_xpm; } virtual BITMAP_DEF GetMenuImage() const { return add_text_xpm; }
virtual void GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems,
SCH_SHEET_PATH* aSheetPath );
#if defined(DEBUG) #if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ); void Show( int nestLevel, std::ostream& os );
#endif #endif
......
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