Commit e1b5d49f authored by Wayne Stambaugh's avatar Wayne Stambaugh

EESchema component library and hierarchical sheet label object improvements.

* Continue component library class clean up and encapsulation work.
* Change hierarchical sheet label container to boost::vector_ptr.
* Encapsulate hierarchical label handling in hierarchical sheet class.
* Convert some missed occurrences of wxString::GetData() to GetChars( wxString ).
* Fix some minor code formatting issues.
parent bf9e49dd
......@@ -675,13 +675,12 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
if( Struct->Type() == DRAW_SHEET_STRUCT_TYPE )
{
SCH_SHEET* sheet = (SCH_SHEET*) Struct;
// Add all pins sheets of a selected hierarchical sheet to the list
SCH_SHEET_PIN* SLabel = ( (SCH_SHEET*) Struct )->m_Label;
while( SLabel )
BOOST_FOREACH( SCH_SHEET_PIN label, sheet->GetSheetPins() )
{
if( SLabel->Type() == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE )
AddPickedItem( screen, SLabel->m_Pos );
SLabel = (SCH_SHEET_PIN*) SLabel->Next();
AddPickedItem( screen, label.m_Pos );
}
}
......
......@@ -340,31 +340,28 @@ void BuildComponentsListFromSchematic( std::vector <OBJ_CMP_TO_LIST>& aList )
{
EDA_BaseStruct* SchItem;
SCH_COMPONENT* DrawLibItem;
SCH_SHEET_PATH* sheet;
SCH_SHEET_PATH* sheetPath;
/* Build the sheet (not screen) list */
SCH_SHEET_LIST SheetList;
for( sheet = SheetList.GetFirst();
sheet != NULL;
sheet = SheetList.GetNext() )
for( sheetPath = SheetList.GetFirst(); sheetPath != NULL; sheetPath = SheetList.GetNext() )
{
for( SchItem = sheet->LastDrawList(); SchItem;
SchItem = SchItem->Next() )
for( SchItem = sheetPath->LastDrawList(); SchItem; SchItem = SchItem->Next() )
{
if( SchItem->Type() != TYPE_SCH_COMPONENT )
continue;
DrawLibItem = (SCH_COMPONENT*) SchItem;
DrawLibItem->SetParent( sheet->LastScreen() );
DrawLibItem->SetParent( sheetPath->LastScreen() );
OBJ_CMP_TO_LIST item;
item.m_RootCmp = DrawLibItem;
item.m_SheetPath = *sheet;
item.m_Unit = DrawLibItem->GetUnitSelection( sheet );
item.m_SheetPath = *sheetPath;
item.m_Unit = DrawLibItem->GetUnitSelection( sheetPath );
strncpy( item.m_Reference,
CONV_TO_UTF8( DrawLibItem->GetRef( sheet ) ),
sizeof( item.m_Reference ) );
CONV_TO_UTF8( DrawLibItem->GetRef( sheetPath ) ),
sizeof( item.m_Reference ) );
// Ensure always null terminate m_Ref.
item.m_Reference[sizeof( item.m_Reference ) - 1 ] = 0;
......@@ -384,19 +381,17 @@ void BuildComponentsListFromSchematic( std::vector <OBJ_CMP_TO_LIST>& aList )
static void GenListeGLabels( std::vector <LABEL_OBJECT>& aList )
{
SCH_ITEM* DrawList;
SCH_SHEET_PIN* PinLabel;
SCH_SHEET_PATH* sheet;
SCH_SHEET_PATH* sheetPath;
/* Build the sheet list */
SCH_SHEET_LIST SheetList;
LABEL_OBJECT labet_object;
for( sheet = SheetList.GetFirst();
sheet != NULL;
sheet = SheetList.GetNext() )
for( sheetPath = SheetList.GetFirst(); sheetPath != NULL; sheetPath = SheetList.GetNext() )
{
DrawList = (SCH_ITEM*) sheet->LastDrawList();
DrawList = (SCH_ITEM*) sheetPath->LastDrawList();
while( DrawList )
{
switch( DrawList->Type() )
......@@ -404,22 +399,21 @@ static void GenListeGLabels( std::vector <LABEL_OBJECT>& aList )
case TYPE_SCH_HIERLABEL:
case TYPE_SCH_GLOBALLABEL:
labet_object.m_LabelType = DrawList->Type();
labet_object.m_SheetPath = *sheet;
labet_object.m_SheetPath = *sheetPath;
labet_object.m_Label = DrawList;
aList.push_back( labet_object );
break;
case DRAW_SHEET_STRUCT_TYPE:
{
PinLabel = ( (SCH_SHEET*) DrawList )->m_Label;
while( PinLabel != NULL )
SCH_SHEET* sheet = (SCH_SHEET*) DrawList;
BOOST_FOREACH( SCH_SHEET_PIN sheetLabel, sheet->GetSheetPins() )
{
labet_object.m_LabelType =
DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE;
labet_object.m_SheetPath = *sheet;
labet_object.m_Label = PinLabel;
labet_object.m_LabelType = DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE;
labet_object.m_SheetPath = *sheetPath;
labet_object.m_Label = &sheetLabel;
aList.push_back( labet_object );
PinLabel = PinLabel->Next();
}
}
break;
......
This diff is collapsed.
......@@ -6,6 +6,9 @@
#define CLASS_DRAWSHEET_H
#include "base_struct.h"
#include <boost/ptr_container/ptr_vector.hpp>
#include <boost/foreach.hpp>
extern SCH_SHEET* g_RootSheet;
......@@ -21,12 +24,15 @@ extern SCH_SHEET* g_RootSheet;
*/
class SCH_SHEET_PIN : public SCH_ITEM, public EDA_TextStruct
{
private:
int m_Number; ///< Label number use for saving sheet label to file.
///< Sheet label numbering begins at 2.
///< 0 is reserved for the sheet name.
///< 1 is reserve for the sheet file name.
public:
int m_Edge, m_Shape;
bool m_IsDangling; // TRUE non connected
int m_Number; // used to numbered labels when writing data on file .
// m_Number >= 2
// value 0 is for sheet name and 1 for sheet filename
public:
SCH_SHEET_PIN( SCH_SHEET* parent,
......@@ -40,6 +46,7 @@ public:
return wxT( "SCH_SHEET_PIN" );
}
bool operator==( const SCH_SHEET_PIN* aPin ) const;
SCH_SHEET_PIN* GenCopy();
......@@ -48,14 +55,43 @@ public:
return ( SCH_SHEET_PIN*) Pnext;
}
void Place( WinEDA_SchematicFrame* frame,
wxDC* DC );
/**
* Get the sheet label number.
*
* @return Number of the sheet label.
*/
int GetNumber() { return m_Number; }
/**
* Set the sheet label number.
*
* @param aNumber - New sheet number label.
*/
void SetNumber( int aNumber );
/**
* Get the parent sheet object of this sheet pin.
*
* @return The sheet that is the parent of this sheet pin or NULL if it does
* not have a parent.
*/
SCH_SHEET* GetParent() const { return (SCH_SHEET*) m_Parent; }
void Place( WinEDA_SchematicFrame* frame, wxDC* DC );
void Draw( WinEDA_DrawPanel* panel,
wxDC* DC,
const wxPoint& offset,
int draw_mode,
int Color = -1 );
/**
* Plot this sheet pin object to aPlotter.
*
* @param aPlotter - The plotter object to plot to.
*/
void Plot( PLOTTER* aPlotter );
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.sch"
......@@ -119,6 +155,9 @@ public:
};
typedef boost::ptr_vector< SCH_SHEET_PIN > SCH_SHEET_PIN_LIST;
/* class SCH_SHEET
* This class is the sheet symbol placed in a schematic, and is the entry point
* for a sub schematic
......@@ -131,10 +170,14 @@ public:
* components: it is stored in F0 ...
* of the file. */
private:
wxString m_FileName; /*also in SCH_SCREEN (redundant),
wxString m_FileName; /* also in SCH_SCREEN (redundant),
* but need it here for loading after
* reading the sheet description from
* file. */
protected:
SCH_SHEET_PIN_LIST m_labels; /* List of points to be connected.*/
public:
int m_SheetNameSize; /* Size (height) of the text, used to
* draw the sheet name */
......@@ -143,10 +186,6 @@ public:
wxPoint m_Pos;
wxSize m_Size; /* Position and Size of *sheet symbol */
int m_Layer;
SCH_SHEET_PIN* m_Label; /* Points Be connection, linked
* list.*/
int m_NbLabel; /* Pins sheet (corresponding to
* hierarchical labels) count */
SCH_SCREEN* m_AssociatedScreen; /* Associated Screen which
* handle the physical data
* In complex hierarchies we
......@@ -176,14 +215,60 @@ public:
SCH_SHEET* GenCopy();
void DisplayInfo( WinEDA_DrawFrame* frame );
/** Function CleanupSheet
* Delete pinsheets which are not corresponding to a hierarchical label
* @param aFrame = the schematic frame
* @param aRedraw = true to redraw Sheet
* @param aSaveForUndoRedo = true to put this sheet in UndoRedo list,
* if it is modified.
/**
* Add aLabel to this sheet.
*
* Note: Once a label is added to the sheet, it is owned by the sheet.
* Do not delete the label object or you will likely get a segfault
* when this sheet is destroyed.
*
* @param aLabel - The label to add to the sheet.
*/
void AddLabel( SCH_SHEET_PIN* aLabel );
SCH_SHEET_PIN_LIST& GetSheetPins() { return m_labels; }
/**
* Remove a sheet label from this sheet.
*
* @param aSheetLabel - The sheet label to remove from the list.
*/
void RemoveLabel( SCH_SHEET_PIN* aSheetLabel );
/**
* Delete sheet label which do not have a corresponding hierarchical label.
*
* Note: Make sure you save a copy of the sheet in the undo list before calling
* CleanupSheet() otherwise any unrefernced sheet labels will be lost.
*/
void CleanupSheet();
/**
* Return the label found at aPosition in this sheet.
*
* @param aPosition - The position to check for a label.
*
* @return The label found at aPosition or NULL if no label is found.
*/
SCH_SHEET_PIN* GetLabel( const wxPoint& aPosition );
/**
* Checks if a label already exists with aName.
*
* @param aName - Name of label to search for.
*
* @return - True if label found, otherwise false.
*/
void CleanupSheet( WinEDA_SchematicFrame* frame, bool aRedraw, bool aSaveForUndoRedo );
bool HasLabel( const wxString& aName );
bool HasLabels() { return !m_labels.empty(); }
/**
* Check all sheet labels against schematic for undefined hierarchical labels.
*
* @return True if there are any undefined labels.
*/
bool HasUndefinedLabels();
/** Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
......@@ -272,7 +357,7 @@ public:
wxString GetFileName( void );
// Set a new filename without changing anything else
void SetFileName( const wxString& aFilename )
void SetFileName( const wxString& aFilename )
{
m_FileName = aFilename;
}
......@@ -304,11 +389,9 @@ public:
virtual void Move( const wxPoint& aMoveVector )
{
m_Pos += aMoveVector;
SCH_SHEET_PIN* label = m_Label;
while( label != NULL )
BOOST_FOREACH( SCH_SHEET_PIN& label, m_labels )
{
label->Move( aMoveVector );
label = label->Next();
label.Move( aMoveVector );
}
}
......@@ -323,18 +406,35 @@ public:
* Compare schematic sheet file and sheet name against search string.
*
* @param aSearchData - Criteria to search against.
* @param aCaseSensitive - True for case sensitive search.
* @param aWholeWord - True to match whole word.
*
* @return True if this item matches the search criteria.
*/
virtual bool Matches( wxFindReplaceData& aSearchData );
/**
* Resize this sheet to aSize and adjust all of the labels accordingly.
*
* @param aSize - The new size for this sheet.
*/
void Resize( const wxSize& aSize );
#if defined(DEBUG)
// comment inherited by Doxygen from Base_Struct
void Show( int nestLevel, std::ostream& os );
#endif
protected:
/**
* Renumber labels in list.
*
* This method is used internally by SCH_SHEET to update the label numbering
* when the label list changes. Make sure you call this method any time a
* label is added or removed.
*/
void renumberLabels();
};
#endif /* CLASS_DRAWSHEET_H */
......@@ -16,20 +16,16 @@
#include "common.h"
#include "class_drawpanel.h"
#include "drawtxt.h"
#include "plot_common.h"
#include "program.h"
#include "general.h"
#include "protos.h"
/*******************************************************************/
SCH_SHEET_PIN::SCH_SHEET_PIN( SCH_SHEET* parent,
const wxPoint& pos,
const wxString& text ) :
SCH_ITEM( parent, DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE ),
EDA_TextStruct( text )
SCH_SHEET_PIN::SCH_SHEET_PIN( SCH_SHEET* parent, const wxPoint& pos, const wxString& text ) :
SCH_ITEM( parent, DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE ), EDA_TextStruct( text )
{
/*******************************************************************/
wxASSERT( parent );
wxASSERT( Pnext == NULL );
m_Layer = LAYER_SHEETLABEL;
......@@ -41,12 +37,9 @@ SCH_SHEET_PIN::SCH_SHEET_PIN( SCH_SHEET* parent,
}
/***********************************************************/
SCH_SHEET_PIN* SCH_SHEET_PIN::GenCopy()
{
/***********************************************************/
SCH_SHEET_PIN* newitem =
new SCH_SHEET_PIN( (SCH_SHEET*) m_Parent, m_Pos, m_Text );
SCH_SHEET_PIN* newitem = new SCH_SHEET_PIN( (SCH_SHEET*) m_Parent, m_Pos, m_Text );
newitem->m_Edge = m_Edge;
newitem->m_Shape = m_Shape;
......@@ -56,6 +49,12 @@ SCH_SHEET_PIN* SCH_SHEET_PIN::GenCopy()
}
bool SCH_SHEET_PIN::operator==(const SCH_SHEET_PIN* aPin ) const
{
return aPin == this;
}
/** Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
*/
......@@ -65,6 +64,16 @@ int SCH_SHEET_PIN::GetPenSize()
}
void SCH_SHEET_PIN::SetNumber( int aNumber )
{
wxASSERT( aNumber >= 2 );
m_Number = aNumber;
}
/*****************************************************************************/
/* Routine to create hierarchical labels */
/*****************************************************************************/
void SCH_SHEET_PIN::Draw( WinEDA_DrawPanel* panel,
wxDC* DC,
......@@ -72,8 +81,6 @@ void SCH_SHEET_PIN::Draw( WinEDA_DrawPanel* panel,
int DrawMode,
int Color )
{
/*****************************************************************************/
/* Routine to create hierarchical labels */
GRTextHorizJustifyType side;
EDA_Colors txtcolor;
int posx, tposx, posy;
......@@ -117,6 +124,47 @@ void SCH_SHEET_PIN::Draw( WinEDA_DrawPanel* panel,
}
void SCH_SHEET_PIN::Plot( PLOTTER* aPlotter )
{
wxASSERT( aPlotter != NULL );
EDA_Colors txtcolor = UNSPECIFIED_COLOR;
int posx, tposx, posy, size;
static std::vector <wxPoint> Poly;
txtcolor = ReturnLayerColor( GetLayer() );
posx = m_Pos.x;
posy = m_Pos.y;
size = m_Size.x;
GRTextHorizJustifyType side;
if( m_Edge )
{
tposx = posx - size;
side = GR_TEXT_HJUSTIFY_RIGHT;
}
else
{
tposx = posx + size + (size / 8);
side = GR_TEXT_HJUSTIFY_LEFT;
}
int thickness = GetPenSize();
aPlotter->set_current_line_width( thickness );
aPlotter->text( wxPoint( tposx, posy ), txtcolor, m_Text, TEXT_ORIENT_HORIZ,
wxSize( size, size ), side, GR_TEXT_VJUSTIFY_CENTER, thickness,
m_Italic, m_Bold );
/* Draw the associated graphic symbol */
CreateGraphicShape( Poly, m_Pos );
aPlotter->poly( Poly.size(), &Poly[0].x, NO_FILL );
}
/** function CreateGraphicShape
* Calculates the graphic shape (a polygon) associated to the text
* @param aCorner_list = list to fill with polygon corners coordinates
......
......@@ -180,13 +180,13 @@ void LIB_ALIAS::SetComponent( LIB_COMPONENT* aComponent )
LIB_COMPONENT::LIB_COMPONENT( const wxString& aName, CMP_LIBRARY* aLibrary ) :
CMP_LIB_ENTRY( ROOT, aName, aLibrary )
{
m_LastDate = 0;
m_dateModified = 0;
unitCount = 1;
m_TextInside = 40;
m_pinNameOffset = 40;
m_options = ENTRY_NORMAL;
m_UnitSelectionLocked = FALSE;
m_DrawPinNum = 1;
m_DrawPinName = 1;
m_unitsLocked = FALSE;
m_showPinNumbers = true;
m_showPinNames = true;
// Add the MANDATORY_FIELDS in RAM only. These are assumed to be present
// when the field editors are invoked.
......@@ -209,11 +209,11 @@ LIB_COMPONENT::LIB_COMPONENT( LIB_COMPONENT& aComponent, CMP_LIBRARY* aLibrary )
m_aliasListData = aComponent.m_aliasListData;
m_FootprintList = aComponent.m_FootprintList;
unitCount = aComponent.unitCount;
m_UnitSelectionLocked = aComponent.m_UnitSelectionLocked;
m_TextInside = aComponent.m_TextInside;
m_DrawPinNum = aComponent.m_DrawPinNum;
m_DrawPinName = aComponent.m_DrawPinName;
m_LastDate = aComponent.m_LastDate;
m_unitsLocked = aComponent.m_unitsLocked;
m_pinNameOffset = aComponent.m_pinNameOffset;
m_showPinNumbers = aComponent.m_showPinNumbers;
m_showPinNames = aComponent.m_showPinNames;
m_dateModified = aComponent.m_dateModified;
m_options = aComponent.m_options;
BOOST_FOREACH( LIB_DRAW_ITEM& oldItem, aComponent.GetDrawItemList() )
......@@ -554,10 +554,10 @@ bool LIB_COMPONENT::Save( FILE* aFile )
}
if( fprintf( aFile, " %d %d %c %c %d %c %c\n",
0, m_TextInside,
m_DrawPinNum ? 'Y' : 'N',
m_DrawPinName ? 'Y' : 'N',
unitCount, m_UnitSelectionLocked ? 'L' : 'F',
0, m_pinNameOffset,
m_showPinNumbers ? 'Y' : 'N',
m_showPinNames ? 'Y' : 'N',
unitCount, m_unitsLocked ? 'L' : 'F',
m_options == ENTRY_POWER ? 'P' : 'N' ) < 0 )
return false;
......@@ -688,7 +688,7 @@ bool LIB_COMPONENT::Load( FILE* aFile, char* aLine, int* aLineNum,
|| ( p = strtok( NULL, " \t\n" ) ) == NULL /* NumOfPins: */
|| sscanf( p, "%d", &unused ) != 1
|| ( p = strtok( NULL, " \t\n" ) ) == NULL /* TextInside: */
|| sscanf( p, "%d", &m_TextInside ) != 1
|| sscanf( p, "%d", &m_pinNameOffset ) != 1
|| ( p = strtok( NULL, " \t\n" ) ) == NULL /* DrawNums: */
|| sscanf( p, "%c", &drawnum ) != 1
|| ( p = strtok( NULL, " \t\n" ) ) == NULL /* DrawNums: */
......@@ -712,8 +712,8 @@ bool LIB_COMPONENT::Load( FILE* aFile, char* aLine, int* aLineNum,
if( unitCount < 1 )
unitCount = 1;
m_DrawPinNum = ( drawnum == 'N' ) ? FALSE : true;
m_DrawPinName = ( drawname == 'N' ) ? FALSE : true;
m_showPinNumbers = ( drawnum == 'N' ) ? false : true;
m_showPinNames = ( drawname == 'N' ) ? false : true;
/* Copy part name and prefix. */
LIB_FIELD& value = GetValueField();
......@@ -743,7 +743,7 @@ bool LIB_COMPONENT::Load( FILE* aFile, char* aLine, int* aLineNum,
// Copy optional infos
if( ( p = strtok( NULL, " \t\n" ) ) != NULL && *p == 'L' )
m_UnitSelectionLocked = true;
m_unitsLocked = true;
if( ( p = strtok( NULL, " \t\n" ) ) != NULL && *p == 'P' )
m_options = ENTRY_POWER;
......@@ -1101,15 +1101,15 @@ bool LIB_COMPONENT::SaveDateAndTime( FILE* aFile )
{
int year, mon, day, hour, min, sec;
if( m_LastDate == 0 )
if( m_dateModified == 0 )
return true;
sec = m_LastDate & 63;
min = ( m_LastDate >> 6 ) & 63;
hour = ( m_LastDate >> 12 ) & 31;
day = ( m_LastDate >> 17 ) & 31;
mon = ( m_LastDate >> 22 ) & 15;
year = ( m_LastDate >> 26 ) + 1990;
sec = m_dateModified & 63;
min = ( m_dateModified >> 6 ) & 63;
hour = ( m_dateModified >> 12 ) & 31;
day = ( m_dateModified >> 17 ) & 31;
mon = ( m_dateModified >> 22 ) & 15;
year = ( m_dateModified >> 26 ) + 1990;
if ( fprintf( aFile, "Ti %d/%d/%d %d:%d:%d\n",
year, mon, day, hour, min, sec ) < 0 )
......@@ -1134,7 +1134,7 @@ bool LIB_COMPONENT::LoadDateAndTime( char* aLine )
&year, &mon, &day, &hour, &min, &sec ) != 6 )
return false;
m_LastDate = ( sec & 63 ) + ( ( min & 63 ) << 6 ) +
m_dateModified = ( sec & 63 ) + ( ( min & 63 ) << 6 ) +
( ( hour & 31 ) << 12 ) + ( ( day & 31 ) << 17 ) +
( ( mon & 15 ) << 22 ) + ( ( year - 1990 ) << 26 );
......@@ -1192,7 +1192,7 @@ int LIB_COMPONENT::SelectItems( EDA_Rect& aRect, int aUnit, int aConvert,
continue;
// Specific rules for pins.
if( aEditPinByPin || m_UnitSelectionLocked
if( aEditPinByPin || m_unitsLocked
|| ( item.m_Convert && item.m_Convert != aConvert ) )
continue;
}
......
This diff is collapsed.
......@@ -82,7 +82,7 @@ void NETLIST_OBJECT::Show( std::ostream& out, int ndx )
out << " <start " << m_Start << "/> <end " << m_End << "/>\n";
if( m_Label )
out << " <label>" << m_Label->mb_str() << "</label>\n";
out << " <label>" << m_Label.mb_str() << "</label>\n";
if( m_Comp )
m_Comp->Show( 1, out );
......@@ -98,26 +98,28 @@ void NETLIST_OBJECT::Show( std::ostream& out, int ndx )
NETLIST_OBJECT::NETLIST_OBJECT()
{
m_Type = NET_ITEM_UNSPECIFIED; /* Type of this item (see NetObjetType enum) */
m_Comp = NULL; /* Pointer on the library item that created this net object (the parent)*/
m_Link = NULL; /* For SCH_SHEET_PIN:
* Pointer to the hierarchy sheet that contains this SCH_SHEET_PIN
* For Pins: pointer to the component that contains this pin
*/
m_Flag = 0; /* flag used in calculations */
m_ElectricalType = 0; /* Has meaning only for Pins and hierachical pins: electrical type */
m_NetCode = 0; /* net code for all items except BUS labels because a BUS label has
* as many net codes as bus members
*/
m_BusNetCode = 0; /* Used for BUS connections */
m_Member = 0; /* for labels type NET_BUSLABELMEMBER ( bus member created from the BUS label )
* member number
*/
m_Type = NET_ITEM_UNSPECIFIED; /* Type of this item (see NetObjetType enum) */
m_Comp = NULL; /* Pointer on the library item that created this net object
* (the parent)*/
m_Link = NULL; /* For SCH_SHEET_PIN:
* Pointer to the hierarchy sheet that contains this
* SCH_SHEET_PIN For Pins: pointer to the component that
* contains this pin
*/
m_Flag = 0; /* flag used in calculations */
m_ElectricalType = 0; /* Has meaning only for Pins and hierachical pins: electrical
* type */
m_NetCode = 0; /* net code for all items except BUS labels because a BUS
* label has as many net codes as bus members
*/
m_BusNetCode = 0; /* Used for BUS connections */
m_Member = 0; /* for labels type NET_BUSLABELMEMBER ( bus member created
* from the BUS label ) member number
*/
m_FlagOfConnection = UNCONNECTED;
m_PinNum = 0; /* pin number ( 1 long = 4 bytes -> 4 ascii codes) */
m_Label = 0; /* For all labels:pointer on the text label */
m_NetNameCandidate = NULL; /* a pointer to a NETLIST_OBJECT type label connected to this object
* used to give a name to the net
m_NetNameCandidate = NULL; /* a pointer to a NETLIST_OBJECT type label connected to this
* object used to give a name to the net
*/
}
......@@ -125,30 +127,10 @@ NETLIST_OBJECT::NETLIST_OBJECT()
// Copy constructor
NETLIST_OBJECT::NETLIST_OBJECT( NETLIST_OBJECT& aSource )
{
*this = aSource;
m_Label = NULL; // set to null because some items are owner, so the delete operator can create problems
// if this member is copied here (if 2 different items are owner of the same object)
*this = aSource;
}
NETLIST_OBJECT::~NETLIST_OBJECT()
{
/* NETLIST_OBJECT is owner of m_Label only if its type is
* NET_HIERBUSLABELMEMBER, NET_GLOBBUSLABELMEMBER, NET_SHEETBUSLABELMEMBER or NET_BUSLABELMEMBER
* So we must delete m_Label only for these cases
* ( see the note in ConvertBustToMembers)
*/
switch( m_Type )
{
default:
break;
case NET_HIERBUSLABELMEMBER:
case NET_GLOBBUSLABELMEMBER:
case NET_SHEETBUSLABELMEMBER:
case NET_BUSLABELMEMBER:
SAFE_DELETE( m_Label );
break;
}
}
......@@ -84,8 +84,7 @@ public:
* connects to.*/
long m_PinNum; /* pin number ( 1 long = 4 bytes ->
* 4 ascii codes) */
const wxString* m_Label; /* For all labels:pointer on the text
* label */
wxString m_Label; /* Label text. */
wxPoint m_Start; // Position of object or for segments:
// starting point
wxPoint m_End; // For segments (wire and buses):
......
......@@ -809,8 +809,8 @@ void LIB_PIN::Draw( WinEDA_DrawPanel* aPanel,
if( DrawPinText )
{
DrawPinTexts( aPanel, aDC, pos1, orient, Entry->m_TextInside,
Entry->m_DrawPinNum, Entry->m_DrawPinName,
DrawPinTexts( aPanel, aDC, pos1, orient, Entry->GetPinNameOffset(),
Entry->ShowPinNumbers(), Entry->ShowPinNames(),
aColor, aDrawMode );
}
......@@ -1610,8 +1610,8 @@ void LIB_PIN::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
plotter->set_current_line_width( GetPenSize() );
PlotPinSymbol( plotter, pos, m_PinLen, orient, m_PinShape );
PlotPinTexts( plotter, pos, orient, GetParent()->m_TextInside,
GetParent()->m_DrawPinNum, GetParent()->m_DrawPinName,
PlotPinTexts( plotter, pos, orient, GetParent()->GetPinNameOffset(),
GetParent()->ShowPinNumbers(), GetParent()->ShowPinNames(),
GetPenSize() );
}
......
......@@ -659,7 +659,7 @@ void SCH_COMPONENT::ClearAnnotation( SCH_SHEET_PATH* aSheet )
Entry = CMP_LIBRARY::FindLibraryComponent( m_ChipName );
if( Entry && Entry->m_UnitSelectionLocked )
if( Entry && Entry->UnitsLocked() )
KeepMulti = true;
while( defRef.Last() == '?' )
......
......@@ -415,18 +415,15 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList )
case DRAW_SHEET_STRUCT_TYPE:
{
SCH_SHEET_PIN* pinsheet;
for( pinsheet = ( (SCH_SHEET*) DrawItem )->m_Label;
pinsheet;
pinsheet = pinsheet->Next() )
SCH_SHEET* sheet = (SCH_SHEET*) DrawItem;
BOOST_FOREACH( SCH_SHEET_PIN pinsheet, sheet->GetSheetPins() )
{
wxASSERT( pinsheet->Type() ==
DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE );
wxASSERT( pinsheet.Type() == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE );
item = new DanglingEndHandle( SHEET_LABEL_END );
item->m_Item = pinsheet;
item->m_Pos = pinsheet->m_Pos;
item->m_Item = &pinsheet;
item->m_Pos = pinsheet.m_Pos;
if( lastitem )
lastitem->m_Pnext = item;
......
......@@ -389,7 +389,6 @@ bool LocateAndDeleteItem( WinEDA_SchematicFrame* frame, wxDC* DC )
void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Screen )
{
EDA_BaseStruct* DrawList;
SCH_SHEET_PIN* SheetLabel, * NextLabel;
if( DrawStruct == NULL )
return;
......@@ -401,44 +400,12 @@ void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Screen )
if( DrawStruct->Type() == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE )
{
//this structure is attached to a sheet , which we must find.
DrawList = Screen->EEDrawList;
for( ; DrawList != NULL; DrawList = DrawList->Next() )
{
if( DrawList->Type() != DRAW_SHEET_STRUCT_TYPE )
continue;
/* See if our item is in this Sheet */
SheetLabel = ( (SCH_SHEET*) DrawList )->m_Label;
if( SheetLabel == NULL )
continue;
if( SheetLabel == (SCH_SHEET_PIN*) DrawStruct )
{
( (SCH_SHEET*) DrawList )->m_Label =
(SCH_SHEET_PIN*) SheetLabel->Next();
SAFE_DELETE( DrawStruct );
return;
}
else
{
while( SheetLabel->Next() )
{
NextLabel = (SCH_SHEET_PIN*) SheetLabel->Next();
if( NextLabel == (SCH_SHEET_PIN*) DrawStruct )
{
SheetLabel->SetNext( (EDA_BaseStruct*) NextLabel->Next() );
SAFE_DELETE( DrawStruct );
return;
}
SheetLabel = NextLabel;
}
}
}
// This structure is attached to a sheet, get the parent sheet object.
SCH_SHEET_PIN* sheetLabel = (SCH_SHEET_PIN*) DrawStruct;
SCH_SHEET* sheet = sheetLabel->GetParent();
wxASSERT_MSG( sheet != NULL,
wxT( "Sheet label parent not properly set, bad programmer!" ) );
sheet->RemoveLabel( sheetLabel );
return;
}
else
......
......@@ -110,9 +110,9 @@ void WinEDA_CreateCmpDialog::SetComponentData( LIB_COMPONENT & component )
component.SetPartCount( m_PartsCount->GetSelection() + 1 );
component.GetReference().m_Text = m_Reference->GetValue();
if ( m_PinNameInside->GetValue() == FALSE)
component.m_TextInside = 0;
component.SetPinNameOffset( 0 );
else
component.m_TextInside = m_SetSkew->GetValue();
component.SetPinNameOffset( m_SetSkew->GetValue() );
if ( m_IsPowerSymbol->GetValue() == TRUE )
component.SetPower();
......@@ -121,9 +121,9 @@ void WinEDA_CreateCmpDialog::SetComponentData( LIB_COMPONENT & component )
/* Set the option "Units locked".
Obviously, cannot be TRUE if there is only one part */
component.m_UnitSelectionLocked = m_PartsAreLocked->GetValue();
component.LockUnits( m_PartsAreLocked->GetValue() );
if ( component.GetPartCount() <= 1 )
component.m_UnitSelectionLocked = FALSE;
component.LockUnits( false );
}
/*!
......
......@@ -146,11 +146,11 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::InitBasicPanel()
return;
}
m_ShowPinNumButt->SetValue( component->m_DrawPinNum );
m_ShowPinNameButt->SetValue( component->m_DrawPinName );
m_PinsNameInsideButt->SetValue( component->m_TextInside != 0 );
m_ShowPinNumButt->SetValue( component->ShowPinNumbers() );
m_ShowPinNameButt->SetValue( component->ShowPinNames() );
m_PinsNameInsideButt->SetValue( component->GetPinNameOffset() != 0 );
m_SelNumberOfUnits->SetValue( component->GetPartCount() );
m_SetSkew->SetValue( component->m_TextInside );
m_SetSkew->SetValue( component->GetPinNameOffset() );
m_OptionPower->SetValue( component->isPower() );
m_OptionPartsLocked->SetValue( component->m_UnitSelectionLocked );
m_OptionPartsLocked->SetValue( component->UnitsLocked() );
}
......@@ -763,7 +763,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyOptionsToPanel()
}
// Show the "Parts Locked" option?
if( !m_LibEntry || !m_LibEntry->m_UnitSelectionLocked )
if( !m_LibEntry || !m_LibEntry->UnitsLocked() )
{
D( printf( "partsAreLocked->false\n" ); )
partsAreLockedLabel->Show( false );
......
......@@ -32,15 +32,15 @@
void WinEDA_LibeditFrame::OnEditComponentProperties( wxCommandEvent& event )
{
bool partLocked = GetComponent()->m_UnitSelectionLocked;
bool partLocked = GetComponent()->UnitsLocked();
EditComponentProperties();
if( partLocked != GetComponent()->m_UnitSelectionLocked )
if( partLocked != GetComponent()->UnitsLocked() )
{ // g_EditPinByPinIsOn is set to the better value,
// if m_UnitSelectionLocked has changed
g_EditPinByPinIsOn = GetComponent()->m_UnitSelectionLocked ? true : false;
g_EditPinByPinIsOn = GetComponent()->UnitsLocked() ? true : false;
m_HToolBar->ToggleTool( ID_LIBEDIT_EDIT_PIN_BY_PIN, g_EditPinByPinIsOn );
}
m_HToolBar->Refresh();
DrawPanel->Refresh();
}
......@@ -143,17 +143,17 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnOkClick( wxCommandEvent& event )
}
}
component->m_DrawPinNum = m_ShowPinNumButt->GetValue() ? 1 : 0;
component->m_DrawPinName = m_ShowPinNameButt->GetValue() ? 1 : 0;
component->SetShowPinNumbers( m_ShowPinNumButt->GetValue() );
component->SetShowPinNames( m_ShowPinNameButt->GetValue() );
if( m_PinsNameInsideButt->GetValue() == false )
component->m_TextInside = 0; // pin text outside the body (name is on the pin)
component->SetPinNameOffset( 0 ); // pin text outside the body (name is on the pin)
else
{
component->m_TextInside = m_SetSkew->GetValue();
component->SetPinNameOffset( m_SetSkew->GetValue() );
// Ensure component->m_TextInside != 0, because the meaning is "text outside".
if( component->m_TextInside == 0 )
component->m_TextInside = 20; // give a reasonnable value
if( component->GetPinNameOffset() == 0 )
component->SetPinNameOffset( 20 ); // give a reasonnable value
}
if( m_OptionPower->GetValue() == true )
......@@ -163,9 +163,9 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnOkClick( wxCommandEvent& event )
/* Set the option "Units locked".
* Obviously, cannot be true if there is only one part */
component->m_UnitSelectionLocked = m_OptionPartsLocked->GetValue();
component->LockUnits( m_OptionPartsLocked->GetValue() );
if( component->GetPartCount() <= 1 )
component->m_UnitSelectionLocked = false;
component->LockUnits( false );
/* Update the footprint filter list */
component->m_FootprintList.Clear();
......
......@@ -428,11 +428,14 @@ static void Diagnose( WinEDA_DrawPanel* aPanel,
|| (aNetItemRef->m_Type == NET_HIERBUSLABELMEMBER) )
{
msg.Printf( _( "HLabel %s not connected to SheetLabel" ),
aNetItemRef->m_Label->GetData() );
GetChars( aNetItemRef->m_Label ) );
}
else
{
msg.Printf( _( "SheetLabel %s not connected to HLabel" ),
aNetItemRef->m_Label->GetData() );
GetChars( aNetItemRef->m_Label ) );
}
Marker->SetData( ERCE_HIERACHICAL_LABEL,
aNetItemRef->m_Start,
......@@ -458,7 +461,7 @@ static void Diagnose( WinEDA_DrawPanel* aPanel,
if( aMinConn == NOC ) /* Only 1 element in the net. */
{
msg.Printf( _( "Cmp %s, Pin %s (%s) Unconnected" ),
cmp_ref.GetData(), string_pinnum.GetData(),
GetChars( cmp_ref ), GetChars( string_pinnum ),
MsgPinElectricType[ii] );
Marker->SetData( ERCE_PIN_NOT_CONNECTED,
aNetItemRef->m_Start,
......@@ -473,7 +476,7 @@ static void Diagnose( WinEDA_DrawPanel* aPanel,
cmp_ref = ( (SCH_COMPONENT*) aNetItemRef->m_Link )->GetRef(
&aNetItemRef->m_SheetList );
msg.Printf( _( "Cmp %s, Pin %s (%s) not driven (Net %d)" ),
cmp_ref.GetData(), string_pinnum.GetData(),
GetChars( cmp_ref ), GetChars( string_pinnum ),
MsgPinElectricType[ii], aNetItemRef->GetNet() );
Marker->SetData( ERCE_PIN_NOT_DRIVEN,
aNetItemRef->m_Start,
......@@ -513,15 +516,13 @@ static void Diagnose( WinEDA_DrawPanel* aPanel,
alt_cmp = ( (SCH_COMPONENT*) aNetItemTst->m_Link )->GetRef(
&aNetItemTst->m_SheetList );
msg.Printf( _( "Cmp %s, Pin %s (%s) connected to " ),
cmp_ref.GetData(),
string_pinnum.GetData(), MsgPinElectricType[ii] );
GetChars( cmp_ref ), GetChars( string_pinnum ), MsgPinElectricType[ii] );
Marker->SetData( errortype,
aNetItemRef->m_Start,
msg,
aNetItemRef->m_Start );
msg.Printf( _( "Cmp %s, Pin %s (%s) (net %d)" ),
alt_cmp.GetData(),
alt_string_pinnum.GetData(), MsgPinElectricType[jj],
GetChars( alt_cmp ), GetChars( alt_string_pinnum ), MsgPinElectricType[jj],
aNetItemRef->GetNet() );
Marker->SetAuxiliaryData( msg, aNetItemTst->m_Start );
}
......@@ -703,7 +704,7 @@ static bool WriteDiagnosticERC( const wxString& FullFileName )
else
{
wxString str = Sheet->PathHumanReadable();
msg.Printf( _( "\n***** Sheet %s\n" ), str.GetData() );
msg.Printf( _( "\n***** Sheet %s\n" ), GetChars( str ) );
}
fprintf( OutErc, "%s", CONV_TO_UTF8( msg ) );
......
......@@ -107,9 +107,9 @@ library \"%s\"." ),
if( !LoadOneLibraryPartAux( LibEntry, m_library ) )
return;
g_EditPinByPinIsOn = m_component->m_UnitSelectionLocked ? true : false;
g_EditPinByPinIsOn = m_component->UnitsLocked() ? true : false;
m_HToolBar->ToggleTool( ID_LIBEDIT_EDIT_PIN_BY_PIN, g_EditPinByPinIsOn );
GetScreen()->ClearUndoRedoList();
Zoom_Automatique( false );
DrawPanel->Refresh();
......@@ -556,21 +556,21 @@ created. Aborted" ) );
SetShowDeMorgan( dlg.GetAlternateBodyStyle() );
if( dlg.GetPinNameInside( ) )
{
component->m_TextInside = dlg.GetPinTextPosition();
if( component->m_TextInside == 0 )
component->m_TextInside = 1;
component->SetPinNameOffset( dlg.GetPinTextPosition() );
if( component->GetPinNameOffset() == 0 )
component->SetPinNameOffset( 1 );
}
else
{
component->m_TextInside = 0;
component->SetPinNameOffset( 0 );
}
( dlg.GetPowerSymbol() ) ? component->SetPower() : component->SetNormal();
component->m_DrawPinNum = dlg.GetShowPinNumber();
component->m_DrawPinName = dlg.GetShowPinName();
component->m_UnitSelectionLocked = dlg.GetLockItems();
component->SetShowPinNumbers( dlg.GetShowPinNumber() );
component->SetShowPinNames( dlg.GetShowPinName() );
component->LockUnits( dlg.GetLockItems() );
if( dlg.GetPartCount() < 2 )
component->m_UnitSelectionLocked = false;
component->LockUnits( false );
if( m_component )
{
......@@ -584,7 +584,7 @@ created. Aborted" ) );
DisplayCmpDoc();
UpdateAliasSelectList();
UpdatePartSelectList();
g_EditPinByPinIsOn = m_component->m_UnitSelectionLocked ? true : false;
g_EditPinByPinIsOn = m_component->UnitsLocked() ? true : false;
m_HToolBar->ToggleTool( ID_LIBEDIT_EDIT_PIN_BY_PIN, g_EditPinByPinIsOn );
m_lastDrawItem = NULL;
GetScreen()->ClearUndoRedoList();
......
......@@ -49,12 +49,12 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen,
SCH_JUNCTION* ConnectionStruct;
SCH_POLYLINE* PolylineStruct;
SCH_LINE* SegmentStruct;
SCH_BUS_ENTRY* RaccordStruct;
SCH_BUS_ENTRY* busEntry;
SCH_NO_CONNECT* NoConnectStruct;
int LineCount;
wxString MsgDiag; /* Error and log messages */
FILE* f;
FILE* f;
if( screen == NULL )
return FALSE;
......@@ -138,29 +138,28 @@ again." );
{
case '$': /* identification block */
if( Line[1] == 'C' )
Failed = ReadPartDescr( this, Line, f, MsgDiag, &LineCount,
screen );
Failed = ReadPartDescr( this, Line, f, MsgDiag, &LineCount, screen );
else if( Line[1] == 'S' )
Failed = ReadSheetDescr( this, Line, f, MsgDiag, &LineCount,
screen );
Failed = ReadSheetDescr( this, Line, f, MsgDiag, &LineCount, screen );
else if( Line[1] == 'D' )
Failed = ReadSchemaDescr( this, Line, f, MsgDiag, &LineCount,
screen );
Failed = ReadSchemaDescr( this, Line, f, MsgDiag, &LineCount, screen );
else if( Line[1] == 'T' ) //text part
{
printf("**** TEXT PART\n");
SCH_ITEM* Struct;
Struct = ReadTextDescr( f, MsgDiag, Line, sizeof(Line),
&LineCount, version);
if( Struct )
{
Struct->SetNext( screen->EEDrawList );
screen->EEDrawList = Struct;
}
else
Failed = true;
printf( "**** TEXT PART\n" );
SCH_ITEM* Struct;
Struct = ReadTextDescr( f, MsgDiag, Line, sizeof(Line), &LineCount, version );
if( Struct )
{
Struct->SetNext( screen->EEDrawList );
screen->EEDrawList = Struct;
}
else
{
Failed = true;
}
}
break;
......@@ -222,28 +221,27 @@ again." );
ii = WIRE_TO_BUS;
if( Name1[0] == 'B' )
ii = BUS_TO_BUS;
RaccordStruct = new SCH_BUS_ENTRY( wxPoint( 0, 0 ), '\\', ii );
busEntry = new SCH_BUS_ENTRY( wxPoint( 0, 0 ), '\\', ii );
LineCount++;
if( fgets( Line, 256 - 1, f ) == NULL
|| sscanf( Line, "%d %d %d %d ", &RaccordStruct->m_Pos.x,
&RaccordStruct->m_Pos.y, &RaccordStruct->m_Size.x,
&RaccordStruct->m_Size.y ) != 4 )
|| sscanf( Line, "%d %d %d %d ", &busEntry->m_Pos.x, &busEntry->m_Pos.y,
&busEntry->m_Size.x, &busEntry->m_Size.y ) != 4 )
{
MsgDiag.Printf( wxT( "EESchema file Bus Entry struct error at line %d, aborted" ),
LineCount );
MsgDiag << wxT( "\n" ) << CONV_FROM_UTF8( Line );
Failed = true;
SAFE_DELETE( RaccordStruct );
SAFE_DELETE( busEntry );
break;
}
if( !Failed )
{
RaccordStruct->m_Size.x -= RaccordStruct->m_Pos.x;
RaccordStruct->m_Size.y -= RaccordStruct->m_Pos.y;
RaccordStruct->SetNext( screen->EEDrawList );
screen->EEDrawList = RaccordStruct;
busEntry->m_Size.x -= busEntry->m_Pos.x;
busEntry->m_Size.y -= busEntry->m_Pos.y;
busEntry->SetNext( screen->EEDrawList );
screen->EEDrawList = busEntry;
}
break;
......@@ -333,8 +331,8 @@ at line %d, aborted" ),
case 'T': /* It is a text item. */
{
SCH_ITEM* Struct;
Struct = ReadTextDescr( f, MsgDiag, Line, sizeof(Line),
&LineCount, version);
Struct = ReadTextDescr( f, MsgDiag, Line, sizeof(Line), &LineCount, version);
if( Struct )
{
Struct->SetNext( screen->EEDrawList );
......
......@@ -459,33 +459,11 @@ bool IsItemInBox( EDA_Rect& aBox, SCH_ITEM* DrawStruct )
SCH_SHEET_PIN* LocateSheetLabel( SCH_SHEET* Sheet, const wxPoint& pos )
{
int size, dy, minx, maxx;
SCH_SHEET_PIN* SheetLabel;
SheetLabel = Sheet->m_Label;
while( SheetLabel
&& SheetLabel->Type() == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE )
{
size = ( SheetLabel->GetLength() + 1 ) * SheetLabel->m_Size.x;
if( SheetLabel->m_Edge )
size = -size;
minx = SheetLabel->m_Pos.x; maxx = SheetLabel->m_Pos.x + size;
if( maxx < minx )
EXCHG( maxx, minx );
dy = SheetLabel->m_Size.x / 2;
if( (ABS( pos.y - SheetLabel->m_Pos.y ) <= dy )
&& (pos.x <= maxx)
&& (pos.x >= minx) )
return SheetLabel;
SheetLabel = SheetLabel->Next();
}
return NULL;
return Sheet->GetLabel( pos );
}
LIB_PIN* LocateAnyPin( SCH_ITEM* DrawList, const wxPoint& RefPos,
SCH_COMPONENT** libpart )
LIB_PIN* LocateAnyPin( SCH_ITEM* DrawList, const wxPoint& RefPos, SCH_COMPONENT** libpart )
{
SCH_ITEM* DrawStruct;
LIB_COMPONENT* Entry;
......
This diff is collapsed.
......@@ -361,7 +361,7 @@ void FindBestNetNameForEachNet( NETLIST_OBJECT_LIST& aNetItemBuffer )
* pin labels are global labels and have the highter priority
* local labels have the lower priority
* labels having the same priority are sorted by alphabetic order.
*
*
*/
static NETLIST_OBJECT* FindBestNetName( NETLIST_OBJECT_LIST& aLabelItemBuffer )
{
......@@ -385,7 +385,7 @@ static NETLIST_OBJECT* FindBestNetName( NETLIST_OBJECT_LIST& aLabelItemBuffer )
item = candidate;
else if( candidate->m_Type == NET_HIERLABEL )
{
if( candidate->m_Label->Cmp(*item->m_Label) < 0 )
if( candidate->m_Label.Cmp( item->m_Label ) < 0 )
item = candidate;
}
break;
......@@ -393,7 +393,7 @@ static NETLIST_OBJECT* FindBestNetName( NETLIST_OBJECT_LIST& aLabelItemBuffer )
case NET_LABEL:
if( candidate->m_Type == NET_LABEL )
{
if( candidate->m_Label->Cmp(*item->m_Label) < 0 )
if( candidate->m_Label.Cmp( item->m_Label ) < 0 )
item = candidate;
}
else
......@@ -403,10 +403,10 @@ static NETLIST_OBJECT* FindBestNetName( NETLIST_OBJECT_LIST& aLabelItemBuffer )
case NET_PINLABEL:
if( candidate->m_Type != NET_PINLABEL )
break;
if( candidate->m_Label->Cmp(*item->m_Label) < 0 )
if( candidate->m_Label.Cmp( item->m_Label ) < 0 )
item = candidate;
break;
default: // Should not occur.
break;
}
......@@ -439,9 +439,7 @@ static void SheetLabelConnect( NETLIST_OBJECT* SheetLabel )
if( ObjetNet->GetNet() == SheetLabel->GetNet() )
continue; //already connected.
wxASSERT( ObjetNet->m_Label );
wxASSERT( SheetLabel->m_Label );
if( ObjetNet->m_Label->CmpNoCase( *SheetLabel->m_Label ) != 0 )
if( ObjetNet->m_Label.CmpNoCase( SheetLabel->m_Label ) != 0 )
continue; //different names.
/* Propagate Netcode having all the objects of the same Netcode. */
......@@ -470,7 +468,6 @@ static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist,
SCH_COMPONENT* DrawLibItem;
LIB_COMPONENT* Entry;
LIB_PIN* pin;
SCH_SHEET_PIN* SheetLabel;
SCH_SHEET_PATH list;
DrawList = sheetlist->LastScreen()->EEDrawList;
......@@ -547,7 +544,7 @@ static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist,
if( STRUCT->m_Layer == LAYER_HIERLABEL )
new_item->m_Type = NET_HIERLABEL;
new_item->m_Label = &STRUCT->m_Text;
new_item->m_Label = STRUCT->m_Text;
new_item->m_Start = new_item->m_End = STRUCT->m_Pos;
aNetItemBuffer.push_back( new_item );
......@@ -576,7 +573,7 @@ static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist,
if( STRUCT->m_Layer == LAYER_HIERLABEL )
new_item->m_Type = NET_HIERLABEL;
new_item->m_Label = &STRUCT->m_Text;
new_item->m_Label = STRUCT->m_Text;
new_item->m_Start = new_item->m_End = STRUCT->m_Pos;
aNetItemBuffer.push_back( new_item );
......@@ -622,7 +619,7 @@ static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist,
new_item->m_Link = DrawLibItem;
new_item->m_ElectricalType = pin->m_PinType;
new_item->m_PinNum = pin->m_PinNum;
new_item->m_Label = &pin->m_PinName;
new_item->m_Label = pin->m_PinName;
new_item->m_Start = new_item->m_End = pos2;
aNetItemBuffer.push_back( new_item );
......@@ -636,7 +633,7 @@ static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist,
new_item->m_Comp = NULL;
new_item->m_SheetList = *sheetlist;
new_item->m_Type = NET_PINLABEL;
new_item->m_Label = &pin->m_PinName;
new_item->m_Label = pin->m_PinName;
new_item->m_Start = pos2;
new_item->m_End = new_item->m_Start;
......@@ -653,24 +650,26 @@ static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist,
break;
case DRAW_SHEET_STRUCT_TYPE:
{
#undef STRUCT
#define STRUCT ( (SCH_SHEET*) DrawList )
list = *sheetlist;
list.Push( STRUCT );
SheetLabel = STRUCT->m_Label;
for( ; SheetLabel != NULL; SheetLabel = SheetLabel->Next() )
SCH_SHEET* sheet = (SCH_SHEET*) DrawList;
BOOST_FOREACH( SCH_SHEET_PIN label, sheet->GetSheetPins() )
{
ii = IsBusLabel( SheetLabel->m_Text );
ii = IsBusLabel( label.m_Text );
new_item = new NETLIST_OBJECT();
new_item->m_SheetListInclude = *sheetlist;
new_item->m_Comp = SheetLabel;
new_item->m_Comp = &label;
new_item->m_SheetList = *sheetlist;
new_item->m_Link = DrawList;
new_item->m_Type = NET_SHEETLABEL;
new_item->m_ElectricalType = SheetLabel->m_Shape;
new_item->m_Label = &SheetLabel->m_Text;
new_item->m_ElectricalType = label.m_Shape;
new_item->m_Label = label.m_Text;
new_item->m_SheetListInclude = list;
new_item->m_Start = new_item->m_End = SheetLabel->m_Pos;
new_item->m_Start = new_item->m_End = label.m_Pos;
aNetItemBuffer.push_back( new_item );
if( ii )
......@@ -678,6 +677,7 @@ static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist,
}
break;
}
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE:
default:
......@@ -828,11 +828,11 @@ static int ConvertBusToMembers( NETLIST_OBJECT_LIST& aNetItemBuffer,
BusLabel.m_Type = NET_BUSLABELMEMBER;
/* Conversion of BusLabel to the root Label name + the member id like mybus0, mybus1 ... */
BufLine = BusLabel.m_Label->Left( RootBusNameLength );
BufLine = BusLabel.m_Label.Left( RootBusNameLength );
BusMember = FirstNumWireBus;
BufLine << BusMember;
BusLabel.m_Label = new wxString( BufLine );
BusLabel.m_Label = BufLine;
BusLabel.m_Member = BusMember;
NumItem = 1;
......@@ -843,9 +843,9 @@ static int ConvertBusToMembers( NETLIST_OBJECT_LIST& aNetItemBuffer,
NumItem++;
/* Conversion of BusLabel to the root name + the current member id.*/
BufLine = BusLabel.m_Label->Left( RootBusNameLength );
BufLine = BusLabel.m_Label.Left( RootBusNameLength );
BufLine << BusMember;
new_label->m_Label = new wxString( BufLine );
new_label->m_Label = BufLine;
new_label->m_Member = BusMember;
aNetItemBuffer.push_back( new_label );
......@@ -1095,13 +1095,11 @@ void LabelConnect( NETLIST_OBJECT* LabelRef )
|| ntype == NET_HIERBUSLABELMEMBER
|| ntype == NET_PINLABEL )
{
if( g_NetObjectslist[i]->m_Label->CmpNoCase( *LabelRef->m_Label )
!= 0 )
if( g_NetObjectslist[i]->m_Label.CmpNoCase( LabelRef->m_Label ) != 0 )
continue;
if( g_NetObjectslist[i]->GetNet() )
PropageNetCode(
g_NetObjectslist[i]->GetNet(), LabelRef->GetNet(), 0 );
PropageNetCode( g_NetObjectslist[i]->GetNet(), LabelRef->GetNet(), 0 );
else
g_NetObjectslist[i]->SetNet( LabelRef->GetNet() );
}
......
......@@ -93,7 +93,7 @@ public:
bool IsPartsLocked()
{
return m_Entry->m_UnitSelectionLocked;
return m_Entry->UnitsLocked();
}
};
......
This diff is collapsed.
......@@ -346,7 +346,6 @@ static void Plot_Hierarchical_PIN_Sheet( PLOTTER* plotter,
static void PlotSheetStruct( PLOTTER* plotter, SCH_SHEET* Struct )
{
SCH_SHEET_PIN* SheetLabelStruct;
EDA_Colors txtcolor = UNSPECIFIED_COLOR;
wxSize size;
wxString Text;
......@@ -392,20 +391,17 @@ static void PlotSheetStruct( PLOTTER* plotter, SCH_SHEET* Struct )
plotter->set_color( ReturnLayerColor( LAYER_SHEETFILENAME ) );
plotter->text( wxPoint( Struct->m_Pos.x,
Struct->m_Pos.y + Struct->m_Size.y + 4 ),
plotter->text( wxPoint( Struct->m_Pos.x, Struct->m_Pos.y + Struct->m_Size.y + 4 ),
txtcolor, Text, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP,
thickness, italic, false );
/* Draw texts : SheetLabel */
SheetLabelStruct = Struct->m_Label;
plotter->set_color( ReturnLayerColor( Struct->m_Layer ) );
while( SheetLabelStruct != NULL )
/* Draw texts : SheetLabel */
BOOST_FOREACH( SCH_SHEET_PIN& label, Struct->GetSheetPins() )
{
Plot_Hierarchical_PIN_Sheet( plotter, SheetLabelStruct );
SheetLabelStruct = SheetLabelStruct->Next();
label.Plot( plotter );
}
}
......
......@@ -184,7 +184,7 @@ int ReadSheetDescr( wxWindow* frame, char* Line, FILE* f, wxString& aMsgDiag,
int ii, fieldNdx, size;
char Name1[256], Char1[256], Char2[256];
SCH_SHEET* SheetStruct;
SCH_SHEET_PIN* SheetLabelStruct, * OldSheetLabel = NULL;
SCH_SHEET_PIN* SheetLabelStruct;
int Failed = FALSE;
char* ptcar;
......@@ -305,28 +305,21 @@ error line %d, aborted\n" ),
if( fieldNdx > 1 )
{
SheetLabelStruct = new SCH_SHEET_PIN( SheetStruct, wxPoint( 0, 0 ),
CONV_FROM_UTF8( Name1 ) );
if( SheetStruct->m_Label == NULL )
OldSheetLabel = SheetStruct->m_Label = SheetLabelStruct;
else
OldSheetLabel->SetNext( (EDA_BaseStruct*) SheetLabelStruct );
OldSheetLabel = SheetLabelStruct;
int x, y;
/* Read coordinates. */
if( sscanf( ptcar, "%s %s %d %d %d", Char1, Char2,
&SheetLabelStruct->m_Pos.x, &SheetLabelStruct->m_Pos.y,
&size ) != 5 )
if( sscanf( ptcar, "%s %s %d %d %d", Char1, Char2, &x, &y, &size ) != 5 )
{
aMsgDiag.Printf( wxT( "EESchema file Sheet Label Caract \
error line %d, aborted\n" ),
aMsgDiag.Printf( wxT( "EESchema file sheet label error at line %d, ignoring.\n" ),
*aLineNum );
aMsgDiag << CONV_FROM_UTF8( Line );
DisplayError( frame, aMsgDiag );
continue;
}
SheetLabelStruct = new SCH_SHEET_PIN( SheetStruct, wxPoint( x, y ),
CONV_FROM_UTF8( Name1 ) );
if( size == 0 )
size = DEFAULT_SIZE_TEXT;
SheetLabelStruct->m_Size.x = SheetLabelStruct->m_Size.y = size;
......@@ -356,6 +349,8 @@ error line %d, aborted\n" ),
if( Char2[0] == 'R' )
SheetLabelStruct->m_Edge = 1;
SheetStruct->AddLabel( SheetLabelStruct );
}
}
......
......@@ -374,16 +374,31 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_POPUP_IMPORT_GLABEL:
if ( screen->GetCurItem()
&& screen->GetCurItem()->Type() == DRAW_SHEET_STRUCT_TYPE )
GetScreen()->SetCurItem(
Import_PinSheet( (SCH_SHEET*)screen->GetCurItem(), &dc ) );
if ( screen->GetCurItem() && screen->GetCurItem()->Type() == DRAW_SHEET_STRUCT_TYPE )
GetScreen()->SetCurItem( Import_PinSheet( (SCH_SHEET*)screen->GetCurItem(), &dc ) );
break;
case ID_POPUP_SCH_CLEANUP_SHEET:
if ( screen->GetCurItem()
&& screen->GetCurItem()->Type() == DRAW_SHEET_STRUCT_TYPE )
( (SCH_SHEET*) screen->GetCurItem() )->CleanupSheet( this, true, true );
if ( screen->GetCurItem() && screen->GetCurItem()->Type() == DRAW_SHEET_STRUCT_TYPE )
{
SCH_SHEET* sheet = (SCH_SHEET*) screen->GetCurItem();
if( !sheet->HasUndefinedLabels() )
{
DisplayInfoMessage( this,
_( "There are no undefined labels in this sheet to clean up." ) );
return;
}
if( !IsOK( this, _( "Do you wish to cleanup this sheet" ) ) )
return;
/* Save sheet in undo list before cleaning up unreferenced hierarchical labels. */
SaveCopyInUndoList( sheet, UR_CHANGED );
sheet->CleanupSheet();
OnModify();
DrawPanel->PostDirtyRect( sheet->GetBoundingBox() );
}
break;
case ID_POPUP_SCH_EDIT_PINSHEET:
......
......@@ -144,7 +144,6 @@ structures and cannot be undone.\nOk to continue renaming?" );
static void MoveOrResizeSheet( WinEDA_DrawPanel* aPanel, wxDC* aDC, bool aErase )
{
wxPoint moveVector;
SCH_SHEET_PIN* sheetLabel;
BASE_SCREEN* screen = aPanel->GetScreen();
SCH_SHEET* sheet = (SCH_SHEET*) screen->GetCurItem();
......@@ -153,16 +152,9 @@ static void MoveOrResizeSheet( WinEDA_DrawPanel* aPanel, wxDC* aDC, bool aErase
if( sheet->m_Flags & IS_RESIZED )
{
sheet->m_Size.x = MAX( s_PreviousSheetWidth, screen->m_Curseur.x - sheet->m_Pos.x );
sheet->m_Size.y = MAX( s_PreviousSheetHeight, screen->m_Curseur.y - sheet->m_Pos.y );
sheetLabel = sheet->m_Label;
while( sheetLabel )
{
if( sheetLabel->m_Edge )
sheetLabel->m_Pos.x = sheet->m_Pos.x + sheet->m_Size.x;
sheetLabel = sheetLabel->Next();
}
wxSize newSize( MAX( s_PreviousSheetWidth, screen->m_Curseur.x - sheet->m_Pos.x ),
MAX( s_PreviousSheetHeight, screen->m_Curseur.y - sheet->m_Pos.y ) );
sheet->Resize( newSize );
}
else /* Move Sheet */
{
......@@ -244,8 +236,6 @@ SCH_SHEET* WinEDA_SchematicFrame::CreateSheet( wxDC* aDC )
void WinEDA_SchematicFrame::ReSizeSheet( SCH_SHEET* aSheet, wxDC* aDC )
{
SCH_SHEET_PIN* sheetLabel;
if( aSheet == NULL || aSheet->m_Flags & IS_NEW )
return;
......@@ -263,16 +253,13 @@ void WinEDA_SchematicFrame::ReSizeSheet( SCH_SHEET* aSheet, wxDC* aDC )
s_PreviousSheetWidth = SHEET_MIN_WIDTH;
s_PreviousSheetHeight = SHEET_MIN_HEIGHT;
sheetLabel = aSheet->m_Label;
while( sheetLabel )
BOOST_FOREACH( SCH_SHEET_PIN sheetLabel, aSheet->GetSheetPins() )
{
s_PreviousSheetWidth = MAX( s_PreviousSheetWidth,
(int) ( ( sheetLabel->GetLength() + 1 ) *
sheetLabel->m_Size.x ) );
( sheetLabel.GetLength() + 1 ) * sheetLabel.m_Size.x );
s_PreviousSheetHeight = MAX( s_PreviousSheetHeight,
sheetLabel->m_Pos.y - aSheet->m_Pos.y );
sheetLabel = sheetLabel->Next();
sheetLabel.m_Pos.y - aSheet->m_Pos.y );
}
DrawPanel->ManageCurseur = MoveOrResizeSheet;
......
......@@ -17,9 +17,9 @@ static void ExitPinSheet( WinEDA_DrawPanel* Panel, wxDC* DC );
static void Move_PinSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
static int s_CurrentTypeLabel = NET_INPUT;
static wxSize NetSheetTextSize( DEFAULT_SIZE_TEXT, DEFAULT_SIZE_TEXT );
static wxPoint s_InitialPosition; // remember here the initial value of the pin label when moving it
static int s_CurrentTypeLabel = NET_INPUT;
static wxSize NetSheetTextSize( DEFAULT_SIZE_TEXT, DEFAULT_SIZE_TEXT );
static wxPoint s_InitialPosition; // remember the initial value of the pin label when moving it
/****************************************/
......@@ -38,9 +38,8 @@ private:
WinEDA_GraphicTextCtrl* m_TextWin;
public: WinEDA_PinSheetPropertiesFrame( WinEDA_SchematicFrame* parent,
SCH_SHEET_PIN* curr_pinsheet,
const wxPoint& framepos =
wxPoint( -1, -1 ) );
SCH_SHEET_PIN* curr_pinsheet,
const wxPoint& framepos = wxPoint( -1, -1 ) );
~WinEDA_PinSheetPropertiesFrame() { };
private:
......@@ -51,8 +50,8 @@ private:
};
BEGIN_EVENT_TABLE( WinEDA_PinSheetPropertiesFrame, wxDialog )
EVT_BUTTON( wxID_OK, WinEDA_PinSheetPropertiesFrame::OnOkClick )
EVT_BUTTON( wxID_CANCEL, WinEDA_PinSheetPropertiesFrame::OnCancelClick )
EVT_BUTTON( wxID_OK, WinEDA_PinSheetPropertiesFrame::OnOkClick )
EVT_BUTTON( wxID_CANCEL, WinEDA_PinSheetPropertiesFrame::OnCancelClick )
END_EVENT_TABLE()
......@@ -121,8 +120,7 @@ void WinEDA_PinSheetPropertiesFrame::OnCancelClick( wxCommandEvent& WXUNUSED(
void WinEDA_PinSheetPropertiesFrame::OnOkClick( wxCommandEvent& event )
{
m_CurrentPinSheet->m_Text = m_TextWin->GetText();
m_CurrentPinSheet->m_Size.x = m_CurrentPinSheet->m_Size.y =
m_TextWin->GetTextSize();
m_CurrentPinSheet->m_Size.x = m_CurrentPinSheet->m_Size.y = m_TextWin->GetTextSize();
m_CurrentPinSheet->m_Shape = m_PinSheetShape->GetSelection();
EndModal( wxID_OK );
......@@ -133,8 +131,7 @@ void WinEDA_PinSheetPropertiesFrame::OnOkClick( wxCommandEvent& event )
*/
static void ExitPinSheet( WinEDA_DrawPanel* Panel, wxDC* DC )
{
SCH_SHEET_PIN* SheetLabel =
(SCH_SHEET_PIN*) Panel->GetScreen()->GetCurItem();
SCH_SHEET_PIN* SheetLabel = (SCH_SHEET_PIN*) Panel->GetScreen()->GetCurItem();
if( SheetLabel == NULL )
return;
......@@ -168,31 +165,17 @@ static void ExitPinSheet( WinEDA_DrawPanel* Panel, wxDC* DC )
void SCH_SHEET_PIN::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
{
SCH_SHEET* Sheet = (SCH_SHEET*) GetParent();
wxASSERT( Sheet != NULL && Sheet->Type() == DRAW_SHEET_STRUCT_TYPE );
SAFE_DELETE( g_ItemToUndoCopy );
int flags = m_Flags;
m_Flags = 0;
if( flags & IS_NEW )
{
frame->SaveCopyInUndoList( Sheet, UR_CHANGED );
if( Sheet->m_Label == NULL )
Sheet->m_Label = this;
else
{
SCH_SHEET_PIN* pinsheet = Sheet->m_Label;
while( pinsheet )
{
if( pinsheet->Next() == NULL )
{
pinsheet->SetNext( this );
break;
}
pinsheet = pinsheet->Next();
}
}
Sheet->AddLabel( this );
}
else // pin sheet was existing and only moved
{
wxPoint tmp = m_Pos;
......@@ -206,7 +189,8 @@ void SCH_SHEET_PIN::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
m_Pos.x = Sheet->m_Pos.x;
m_Edge = 0;
if( frame->GetScreen()->m_Curseur.x > ( Sheet->m_Pos.x + (Sheet->m_Size.x / 2) ) )
if( frame->GetScreen()->m_Curseur.x > ( Sheet->m_Pos.x + ( Sheet->m_Size.x / 2 ) ) )
{
m_Edge = 1;
m_Pos.x = Sheet->m_Pos.x + Sheet->m_Size.x;
......@@ -219,7 +203,6 @@ void SCH_SHEET_PIN::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
m_Pos.y = Sheet->m_Pos.y + Sheet->m_Size.y;
RedrawOneStruct( frame->DrawPanel, DC, Sheet, GR_DEFAULT_DRAWMODE );
frame->DrawPanel->ManageCurseur = NULL;
frame->DrawPanel->ForceCloseManageCurseur = NULL;
}
......@@ -241,8 +224,7 @@ void WinEDA_SchematicFrame::StartMove_PinSheet( SCH_SHEET_PIN* SheetLabel,
static void Move_PinSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
{
SCH_SHEET_PIN* SheetLabel =
(SCH_SHEET_PIN*) panel->GetScreen()->GetCurItem();
SCH_SHEET_PIN* SheetLabel = (SCH_SHEET_PIN*) panel->GetScreen()->GetCurItem();
if( SheetLabel == NULL )
return;
......@@ -273,8 +255,7 @@ static void Move_PinSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
}
int WinEDA_SchematicFrame::Edit_PinSheet( SCH_SHEET_PIN* SheetLabel,
wxDC* DC )
int WinEDA_SchematicFrame::Edit_PinSheet( SCH_SHEET_PIN* SheetLabel, wxDC* DC )
{
if( SheetLabel == NULL )
return wxID_CANCEL;
......@@ -297,8 +278,7 @@ int WinEDA_SchematicFrame::Edit_PinSheet( SCH_SHEET_PIN* SheetLabel,
/* Add a new sheet pin to the sheet at the current cursor position.
*/
SCH_SHEET_PIN* WinEDA_SchematicFrame::Create_PinSheet( SCH_SHEET* Sheet,
wxDC* DC )
SCH_SHEET_PIN* WinEDA_SchematicFrame::Create_PinSheet( SCH_SHEET* Sheet, wxDC* DC )
{
wxString Line, Text;
SCH_SHEET_PIN* NewSheetLabel;
......@@ -330,41 +310,35 @@ SCH_SHEET_PIN* WinEDA_SchematicFrame::Create_PinSheet( SCH_SHEET* Sheet,
/* Automatically create a sheet labels from global labels for each node in
* the corresponding hierarchy.
*/
SCH_SHEET_PIN* WinEDA_SchematicFrame::Import_PinSheet( SCH_SHEET* Sheet,
wxDC* DC )
SCH_SHEET_PIN* WinEDA_SchematicFrame::Import_PinSheet( SCH_SHEET* Sheet, wxDC* DC )
{
EDA_BaseStruct* DrawStruct;
SCH_SHEET_PIN* NewSheetLabel, * SheetLabel = NULL;
SCH_SHEET_PIN* NewSheetLabel;
SCH_HIERLABEL* HLabel = NULL;
if( !Sheet->m_AssociatedScreen )
return NULL;
DrawStruct = Sheet->m_AssociatedScreen->EEDrawList;
HLabel = NULL;
for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Next() )
{
if( DrawStruct->Type() != TYPE_SCH_HIERLABEL )
continue;
HLabel = (SCH_HIERLABEL*) DrawStruct;
/* A global label has been found: check is there a corresponding
* sheet label. */
SheetLabel = Sheet->m_Label;
for( ; SheetLabel != NULL; SheetLabel = SheetLabel->Next() )
{
if( SheetLabel->m_Text.CmpNoCase( HLabel->m_Text ) == 0 )
{
break;
}
}
if( SheetLabel == NULL )
/* A global label has been found: check if there a corresponding sheet label. */
if( !Sheet->HasLabel( HLabel->m_Text ) )
break;
HLabel = NULL;
}
if( (HLabel == NULL ) || SheetLabel )
if( HLabel == NULL )
{
DisplayInfoMessage( this, _( "No new hierarchical labels found" ), 10 );
DisplayInfoMessage( this, _( "No new hierarchical labels found" ) );
return NULL;
}
......@@ -392,8 +366,7 @@ SCH_SHEET_PIN* WinEDA_SchematicFrame::Import_PinSheet( SCH_SHEET* Sheet,
* This sheet label can not be put in a pile "undelete" because it would not
* Possible to link it back it's 'SCH_SHEET' parent.
*/
void WinEDA_SchematicFrame::DeleteSheetLabel( bool aRedraw,
SCH_SHEET_PIN* aSheetLabelToDel )
void WinEDA_SchematicFrame::DeleteSheetLabel( bool aRedraw, SCH_SHEET_PIN* aSheetLabelToDel )
{
SCH_SHEET* parent = (SCH_SHEET*) aSheetLabelToDel->GetParent();
......@@ -406,23 +379,7 @@ void WinEDA_SchematicFrame::DeleteSheetLabel( bool aRedraw,
std::cout << "\n\n\n" << std::flush;
#endif
SCH_SHEET_PIN* prev = NULL;
SCH_SHEET_PIN* label = parent->m_Label;
for( ; label; prev = label, label = label->Next() )
{
if( label == aSheetLabelToDel )
{
if( prev )
prev->SetNext( label->Next() );
else
parent->m_Label = label->Next();
delete aSheetLabelToDel;
break;
}
}
parent->RemoveLabel( aSheetLabelToDel );
if( aRedraw )
DrawPanel->PostDirtyRect( parent->GetBoundingBox() );
......
......@@ -175,14 +175,14 @@ void WinEDA_LibeditFrame::SaveOneSymbol()
else
line << wxT( "~ " );
line << 0 << wxT( " " ) << m_component->m_TextInside << wxT( " " );
line << 0 << wxT( " " ) << m_component->GetPinNameOffset() << wxT( " " );
if( m_component->m_DrawPinNum )
if( m_component->ShowPinNumbers() )
line << wxT( "Y " );
else
line << wxT( "N " );
if( m_component->m_DrawPinName )
if( m_component->ShowPinNames() )
line << wxT( "Y " );
else
line << wxT( "N " );
......
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