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.
This commit is contained in:
parent
31a4334a5a
commit
4e55b6be65
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||||
* Copyright (C) 1992-2011 Kicad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -53,9 +53,6 @@ NETLIST_OBJECT_LIST g_NetObjectslist;
|
||||||
|
|
||||||
static void PropageNetCode( int OldNetCode, int NewNetCode, int IsBus );
|
static void PropageNetCode( int OldNetCode, int NewNetCode, int IsBus );
|
||||||
static void SheetLabelConnect( NETLIST_OBJECT* SheetLabel );
|
static void SheetLabelConnect( NETLIST_OBJECT* SheetLabel );
|
||||||
static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist,
|
|
||||||
NETLIST_OBJECT_LIST& aNetItemBuffer );
|
|
||||||
static void ConvertBusToMembers( NETLIST_OBJECT_LIST& aNetItemBuffer, NETLIST_OBJECT& ObjNet );
|
|
||||||
static void PointToPointConnect( NETLIST_OBJECT* Ref, int IsBus, int start );
|
static void PointToPointConnect( NETLIST_OBJECT* Ref, int IsBus, int start );
|
||||||
static void SegmentToPointConnect( NETLIST_OBJECT* Jonction, int IsBus, int start );
|
static void SegmentToPointConnect( NETLIST_OBJECT* Jonction, int IsBus, int start );
|
||||||
static void LabelConnect( NETLIST_OBJECT* Label );
|
static void LabelConnect( NETLIST_OBJECT* Label );
|
||||||
|
@ -122,7 +119,12 @@ void SCH_EDIT_FRAME::BuildNetListBase()
|
||||||
|
|
||||||
/* Fill g_NetObjectslist with items used in connectivity calculation */
|
/* Fill g_NetObjectslist with items used in connectivity calculation */
|
||||||
for( sheet = sheets.GetFirst(); sheet != NULL; sheet = sheets.GetNext() )
|
for( sheet = sheets.GetFirst(); sheet != NULL; sheet = sheets.GetNext() )
|
||||||
AddConnectedObjects( sheet, g_NetObjectslist );
|
{
|
||||||
|
for( SCH_ITEM* item = sheet->LastScreen()->GetDrawItems(); item; item = item->Next() )
|
||||||
|
{
|
||||||
|
item->GetNetListItem( g_NetObjectslist, sheet );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if( g_NetObjectslist.size() == 0 )
|
if( g_NetObjectslist.size() == 0 )
|
||||||
return; // no objects
|
return; // no objects
|
||||||
|
@ -396,6 +398,7 @@ void FindBestNetNameForEachNet( NETLIST_OBJECT_LIST& aNetItemBuffer )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function FindBestNetName
|
* Function FindBestNetName
|
||||||
* @return a reference to the "best" label that can be used to give a name
|
* @return a reference to the "best" label that can be used to give a name
|
||||||
|
@ -537,177 +540,15 @@ static void SheetLabelConnect( NETLIST_OBJECT* SheetLabel )
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function AddConnectedObjects
|
* Function ConvertBusToMembers
|
||||||
* Creates the list of objects related to connections (pins of components,
|
* breaks the text of a bus label type in as many members as it contains and
|
||||||
* wires, labels, junctions ...)
|
* creates a #NETLIST_OBJECT for each label.
|
||||||
*
|
*
|
||||||
* @param sheetlist: pointer to a sheetlist.
|
* @param aNetListItems A reference to vector of #NETLIST_OBJECT pointers to add
|
||||||
* @param aNetItemBuffer: a std::vector to store pointer on NETLIST_OBJECT
|
* the bus label NETLIST_OBJECTs.
|
||||||
* created
|
* @param aBusLabel A reference to the base bus label #NETLIST_OBJECT.
|
||||||
*/
|
*/
|
||||||
static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist,
|
void ConvertBusToMembers( NETLIST_OBJECT_LIST& aNetListItems, NETLIST_OBJECT& aBusLabel )
|
||||||
std::vector<NETLIST_OBJECT*>& aNetItemBuffer )
|
|
||||||
{
|
|
||||||
SCH_ITEM* item;
|
|
||||||
NETLIST_OBJECT* new_item;
|
|
||||||
SCH_SHEET_PATH list;
|
|
||||||
|
|
||||||
item = sheetlist->LastScreen()->GetDrawItems();
|
|
||||||
|
|
||||||
for( ; item; item = item->Next() )
|
|
||||||
{
|
|
||||||
switch( item->Type() )
|
|
||||||
{
|
|
||||||
case SCH_POLYLINE_T:
|
|
||||||
case SCH_BUS_ENTRY_T:
|
|
||||||
case SCH_MARKER_T:
|
|
||||||
case SCH_TEXT_T:
|
|
||||||
case SCH_LINE_T:
|
|
||||||
case SCH_JUNCTION_T:
|
|
||||||
case SCH_NO_CONNECT_T:
|
|
||||||
case SCH_COMPONENT_T:
|
|
||||||
item->GetNetListItem( aNetItemBuffer, sheetlist );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SCH_LABEL_T:
|
|
||||||
case SCH_GLOBAL_LABEL_T:
|
|
||||||
case SCH_HIERARCHICAL_LABEL_T:
|
|
||||||
#undef STRUCT
|
|
||||||
#define STRUCT ( (SCH_LABEL*) item )
|
|
||||||
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;
|
|
||||||
|
|
||||||
// this is not the simplest way of doing it
|
|
||||||
// (look at the case statement above).
|
|
||||||
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( IsBusLabel( STRUCT->m_Text ) )
|
|
||||||
ConvertBusToMembers( aNetItemBuffer, *new_item );
|
|
||||||
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SCH_SHEET_T:
|
|
||||||
{
|
|
||||||
#undef STRUCT
|
|
||||||
#define STRUCT ( (SCH_SHEET*) item )
|
|
||||||
list = *sheetlist;
|
|
||||||
list.Push( STRUCT );
|
|
||||||
SCH_SHEET* sheet = (SCH_SHEET*) item;
|
|
||||||
|
|
||||||
BOOST_FOREACH( SCH_SHEET_PIN pin, sheet->GetPins() )
|
|
||||||
{
|
|
||||||
new_item = new NETLIST_OBJECT();
|
|
||||||
new_item->m_SheetList = *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_Start = new_item->m_End = pin.m_Pos;
|
|
||||||
aNetItemBuffer.push_back( new_item );
|
|
||||||
|
|
||||||
if( IsBusLabel( pin.m_Text ) )
|
|
||||||
ConvertBusToMembers( aNetItemBuffer, *new_item );
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case SCH_SHEET_PIN_T:
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
wxString msg;
|
|
||||||
msg.Printf( wxT( "Netlist: unexpected struct type %d" ), item->Type() );
|
|
||||||
wxMessageBox( msg );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Routine that analyzes the type labels xxBUSLABELMEMBER
|
|
||||||
* Propagate Netcode between the corresponding labels (ie when
|
|
||||||
* Their member number is the same) when they are connected
|
|
||||||
* Generally by their BusNetCode
|
|
||||||
* Uses and updates the variable LastNetCode
|
|
||||||
*/
|
|
||||||
static void ConnectBusLabels( NETLIST_OBJECT_LIST& aNetItemBuffer )
|
|
||||||
{
|
|
||||||
for( unsigned ii = 0; ii < aNetItemBuffer.size(); ii++ )
|
|
||||||
{
|
|
||||||
NETLIST_OBJECT* Label = aNetItemBuffer[ii];
|
|
||||||
|
|
||||||
if( (Label->m_Type == NET_SHEETBUSLABELMEMBER)
|
|
||||||
|| (Label->m_Type == NET_BUSLABELMEMBER)
|
|
||||||
|| (Label->m_Type == NET_HIERBUSLABELMEMBER) )
|
|
||||||
{
|
|
||||||
if( Label->GetNet() == 0 )
|
|
||||||
{
|
|
||||||
Label->SetNet( LastNetCode );
|
|
||||||
LastNetCode++;
|
|
||||||
}
|
|
||||||
|
|
||||||
for( unsigned jj = ii + 1; jj < aNetItemBuffer.size(); jj++ )
|
|
||||||
{
|
|
||||||
NETLIST_OBJECT* LabelInTst = aNetItemBuffer[jj];
|
|
||||||
if( (LabelInTst->m_Type == NET_SHEETBUSLABELMEMBER)
|
|
||||||
|| (LabelInTst->m_Type == NET_BUSLABELMEMBER)
|
|
||||||
|| (LabelInTst->m_Type == NET_HIERBUSLABELMEMBER) )
|
|
||||||
{
|
|
||||||
if( LabelInTst->m_BusNetCode != Label->m_BusNetCode )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if( LabelInTst->m_Member != Label->m_Member )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if( LabelInTst->GetNet() == 0 )
|
|
||||||
LabelInTst->SetNet( Label->GetNet() );
|
|
||||||
else
|
|
||||||
PropageNetCode( LabelInTst->GetNet(), Label->GetNet(), 0 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool IsBusLabel( const wxString& aLabel )
|
|
||||||
{
|
|
||||||
/* Search for '[' because a bus label is like "busname[nn..mm]" */
|
|
||||||
return aLabel.Find( '[' ) != wxNOT_FOUND;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Routine which breaks a seal Bus type Label in as many members it contains,
|
|
||||||
* And creates structures with type NET_GLOBBUSLABELMEMBER, NET_BUSLABELMEMBER
|
|
||||||
* Or NET_SHEETBUSLABELMEMBER
|
|
||||||
* Entry = pointer to NETLIST_OBJECT initializes the corresp buslabel
|
|
||||||
* Assumes that FirstNumWireBus, LastNumWireBus and RootBusNameLength are up
|
|
||||||
* to date
|
|
||||||
* Amends NETLIST_OBJECT base and meets the following
|
|
||||||
* M_Label is a pointer to a new wxString
|
|
||||||
* M_Label must be deallocated by the user (only for a NET_GLOBBUSLABELMEMBER,
|
|
||||||
* NET_BUSLABELMEMBER gold NET_SHEETBUSLABELMEMBER object type)
|
|
||||||
*/
|
|
||||||
static void ConvertBusToMembers( NETLIST_OBJECT_LIST& aNetItemBuffer,
|
|
||||||
NETLIST_OBJECT& aBusLabel )
|
|
||||||
{
|
{
|
||||||
wxCHECK_RET( IsBusLabel( aBusLabel.m_Label ),
|
wxCHECK_RET( IsBusLabel( aBusLabel.m_Label ),
|
||||||
wxT( "<" ) + aBusLabel.m_Label + wxT( "> is not a valid bus label." ) );
|
wxT( "<" ) + aBusLabel.m_Label + wxT( "> is not a valid bus label." ) );
|
||||||
|
@ -718,8 +559,10 @@ static void ConvertBusToMembers( NETLIST_OBJECT_LIST& aNetItemBuffer,
|
||||||
aBusLabel.m_Type = NET_GLOBBUSLABELMEMBER;
|
aBusLabel.m_Type = NET_GLOBBUSLABELMEMBER;
|
||||||
else if( aBusLabel.m_Type == NET_SHEETLABEL )
|
else if( aBusLabel.m_Type == NET_SHEETLABEL )
|
||||||
aBusLabel.m_Type = NET_SHEETBUSLABELMEMBER;
|
aBusLabel.m_Type = NET_SHEETBUSLABELMEMBER;
|
||||||
else
|
else if( aBusLabel.m_Type == NET_LABEL )
|
||||||
aBusLabel.m_Type = NET_BUSLABELMEMBER;
|
aBusLabel.m_Type = NET_BUSLABELMEMBER;
|
||||||
|
else
|
||||||
|
wxCHECK_RET( false, wxT( "Net object type is not valid." ) );
|
||||||
|
|
||||||
unsigned i;
|
unsigned i;
|
||||||
wxString tmp, busName;
|
wxString tmp, busName;
|
||||||
|
@ -777,11 +620,65 @@ static void ConvertBusToMembers( NETLIST_OBJECT_LIST& aNetItemBuffer,
|
||||||
item->m_Label = tmp;
|
item->m_Label = tmp;
|
||||||
item->m_Member = member;
|
item->m_Member = member;
|
||||||
|
|
||||||
aNetItemBuffer.push_back( item );
|
aNetListItems.push_back( item );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Routine that analyzes the type labels xxBUSLABELMEMBER
|
||||||
|
* Propagate Netcode between the corresponding labels (ie when
|
||||||
|
* Their member number is the same) when they are connected
|
||||||
|
* Generally by their BusNetCode
|
||||||
|
* Uses and updates the variable LastNetCode
|
||||||
|
*/
|
||||||
|
static void ConnectBusLabels( NETLIST_OBJECT_LIST& aNetItemBuffer )
|
||||||
|
{
|
||||||
|
for( unsigned ii = 0; ii < aNetItemBuffer.size(); ii++ )
|
||||||
|
{
|
||||||
|
NETLIST_OBJECT* Label = aNetItemBuffer[ii];
|
||||||
|
|
||||||
|
if( (Label->m_Type == NET_SHEETBUSLABELMEMBER)
|
||||||
|
|| (Label->m_Type == NET_BUSLABELMEMBER)
|
||||||
|
|| (Label->m_Type == NET_HIERBUSLABELMEMBER) )
|
||||||
|
{
|
||||||
|
if( Label->GetNet() == 0 )
|
||||||
|
{
|
||||||
|
Label->SetNet( LastNetCode );
|
||||||
|
LastNetCode++;
|
||||||
|
}
|
||||||
|
|
||||||
|
for( unsigned jj = ii + 1; jj < aNetItemBuffer.size(); jj++ )
|
||||||
|
{
|
||||||
|
NETLIST_OBJECT* LabelInTst = aNetItemBuffer[jj];
|
||||||
|
if( (LabelInTst->m_Type == NET_SHEETBUSLABELMEMBER)
|
||||||
|
|| (LabelInTst->m_Type == NET_BUSLABELMEMBER)
|
||||||
|
|| (LabelInTst->m_Type == NET_HIERBUSLABELMEMBER) )
|
||||||
|
{
|
||||||
|
if( LabelInTst->m_BusNetCode != Label->m_BusNetCode )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if( LabelInTst->m_Member != Label->m_Member )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if( LabelInTst->GetNet() == 0 )
|
||||||
|
LabelInTst->SetNet( Label->GetNet() );
|
||||||
|
else
|
||||||
|
PropageNetCode( LabelInTst->GetNet(), Label->GetNet(), 0 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool IsBusLabel( const wxString& aLabel )
|
||||||
|
{
|
||||||
|
/* Search for '[' because a bus label is like "busname[nn..mm]" */
|
||||||
|
return aLabel.Find( '[' ) != wxNOT_FOUND;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* PropageNetCode propagates Netcode NewNetCode on all elements
|
* PropageNetCode propagates Netcode NewNetCode on all elements
|
||||||
* belonging to the former Netcode OldNetCode
|
* belonging to the former Netcode OldNetCode
|
||||||
|
|
|
@ -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 @@
|
||||||
#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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
|
@ -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 <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:
|
||||||
|
|
||||||
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
|
||||||
|
|
|
@ -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 <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,17 +41,13 @@
|
||||||
#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
|
||||||
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 )
|
||||||
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,
|
||||||
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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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 )
|
||||||
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++;
|
||||||
|
|
||||||
|
|
|
@ -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 <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:
|
||||||
|
|
||||||
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
|
||||||
|
|
Loading…
Reference in New Issue