Commit 0c3541b7 authored by Wayne Stambaugh's avatar Wayne Stambaugh

Component library object refactoring and minor code cleaning.

parent f360d5cc
......@@ -103,7 +103,6 @@ SCH_SHEET* SCH_SHEET::GenCopy()
{
SCH_SHEET* newitem = new SCH_SHEET( m_Pos );
newitem->m_Size = m_Size;
newitem->SetParent( m_Parent );
newitem->m_TimeStamp = GetTimeStamp();
......@@ -206,13 +205,13 @@ bool SCH_SHEET::HasLabel( const wxString& aName )
}
bool SCH_SHEET::IsVerticalOrientation()
{
{
BOOST_FOREACH( SCH_SHEET_PIN label, m_labels )
{
if( label.GetEdge()>1 )
return true;
if( label.GetEdge() > 1 )
return true;
}
return false;
return false;
}
......@@ -323,11 +322,10 @@ void SCH_SHEET::CleanupSheet()
SCH_SHEET_PIN* SCH_SHEET::GetLabel( const wxPoint& aPosition )
{
int size, dy, minx, maxx;
BOOST_FOREACH( SCH_SHEET_PIN& label, m_labels )
{
if (label.HitTest(aPosition)) return &label;
if( label.HitTest( aPosition ) )
return &label;
}
return NULL;
......@@ -371,17 +369,17 @@ void SCH_SHEET::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
GRRect( &aPanel->m_ClipBox, aDC, pos.x, pos.y,
pos.x + m_Size.x, pos.y + m_Size.y, LineWidth, color );
if (IsVerticalOrientation())
if( IsVerticalOrientation() )
{
pos_sheetname=wxPoint( pos.x-8, pos.y+m_Size.y );
pos_filename=wxPoint( pos.x+m_Size.x+4, pos.y+m_Size.y );
name_orientation=TEXT_ORIENT_VERT;
pos_sheetname = wxPoint( pos.x-8, pos.y+m_Size.y );
pos_filename = wxPoint( pos.x+m_Size.x+4, pos.y+m_Size.y );
name_orientation = TEXT_ORIENT_VERT;
}
else
{
pos_sheetname=wxPoint( pos.x, pos.y - 8 );
pos_filename=wxPoint( pos.x, pos.y + m_Size.y + 4 );
name_orientation=TEXT_ORIENT_HORIZ;
pos_sheetname = wxPoint( pos.x, pos.y - 8 );
pos_filename = wxPoint( pos.x, pos.y + m_Size.y + 4 );
name_orientation = TEXT_ORIENT_HORIZ;
}
/* Draw text : SheetName */
if( aColor > 0 )
......@@ -756,21 +754,28 @@ void SCH_SHEET::DisplayInfo( WinEDA_DrawFrame* frame )
void SCH_SHEET::Rotate(wxPoint rotationPoint)
{
RotatePoint(&m_Pos,rotationPoint,900);
RotatePoint(&m_Size.x,&m_Size.y,900);
if (m_Size.x<0) {
m_Pos.x+=m_Size.x;
NEGATE(m_Size.x);
RotatePoint( &m_Pos, rotationPoint, 900 );
RotatePoint( &m_Size.x, &m_Size.y, 900 );
if( m_Size.x < 0 )
{
m_Pos.x += m_Size.x;
NEGATE( m_Size.x );
}
if (m_Size.y<0) {
m_Pos.y+=m_Size.y;
NEGATE(m_Size.y);
if( m_Size.y < 0 )
{
m_Pos.y += m_Size.y;
NEGATE( m_Size.y );
}
BOOST_FOREACH( SCH_SHEET_PIN& sheetPin, m_labels )
{
sheetPin.Rotate( rotationPoint );
}
}
void SCH_SHEET::Mirror_X( int aXaxis_position )
{
m_Pos.y -= aXaxis_position;
......@@ -782,6 +787,8 @@ void SCH_SHEET::Mirror_X( int aXaxis_position )
sheetPin.Mirror_X( aXaxis_position );
}
}
/** virtual function Mirror_Y
* mirror item relative to an Y axis
* @param aYaxis_position = the y axis position
......@@ -811,7 +818,7 @@ void SCH_SHEET::Resize( const wxSize& aSize )
/* Move the sheet labels according to the new sheet size. */
BOOST_FOREACH( SCH_SHEET_PIN& label, m_labels )
{
label.ConstraintOnEdge(label.m_Pos);
label.ConstraintOnEdge( label.m_Pos );
}
}
......
......@@ -384,9 +384,7 @@ void LIB_COMPONENT::Plot( PLOTTER* aPlotter, int aUnit, int aConvert,
}
void LIB_COMPONENT::RemoveDrawItem( LIB_DRAW_ITEM* aItem,
WinEDA_DrawPanel* aPanel,
wxDC* aDc )
void LIB_COMPONENT::RemoveDrawItem( LIB_DRAW_ITEM* aItem, WinEDA_DrawPanel* aPanel, wxDC* aDc )
{
wxASSERT( aItem != NULL );
......@@ -409,8 +407,7 @@ from component %s in library %s." ),
LIB_DRAW_ITEM_LIST::iterator i;
if( aDc != NULL )
aItem->Draw( aPanel, aDc, wxPoint( 0, 0 ), -1, g_XorMode, NULL,
DefaultTransformMatrix );
aItem->Draw( aPanel, aDc, wxPoint( 0, 0 ), -1, g_XorMode, NULL, DefaultTransformMatrix );
for( i = drawings.begin(); i < drawings.end(); i++ )
{
......@@ -432,8 +429,7 @@ void LIB_COMPONENT::AddDrawItem( LIB_DRAW_ITEM* aItem )
}
LIB_DRAW_ITEM* LIB_COMPONENT::GetNextDrawItem( LIB_DRAW_ITEM* aItem,
KICAD_T aType )
LIB_DRAW_ITEM* LIB_COMPONENT::GetNextDrawItem( LIB_DRAW_ITEM* aItem, KICAD_T aType )
{
/* Return the next draw object pointer.
* If item is NULL return the first item of type in the list.
......@@ -674,8 +670,7 @@ bool LIB_COMPONENT::Load( FILE* aFile, char* aLine, int* aLineNum,
if( strcmp( p, "DEF" ) != 0 )
{
aErrorMsg.Printf( wxT( "DEF command expected in line %d, aborted." ),
*aLineNum );
aErrorMsg.Printf( wxT( "DEF command expected in line %d, aborted." ), *aLineNum );
return false;
}
......@@ -696,8 +691,7 @@ bool LIB_COMPONENT::Load( FILE* aFile, char* aLine, int* aLineNum,
|| ( p = strtok( NULL, " \t\n" ) ) == NULL /* unitCount: */
|| sscanf( p, "%d", &unitCount ) != 1 )
{
aErrorMsg.Printf( wxT( "Wrong DEF format in line %d, skipped." ),
*aLineNum );
aErrorMsg.Printf( wxT( "Wrong DEF format in line %d, skipped." ), *aLineNum );
while( GetLine( aFile, aLine, aLineNum, LINE_BUFFER_LEN_LARGE ) )
{
p = strtok( aLine, " \t\n" );
......@@ -901,7 +895,7 @@ bool LIB_COMPONENT::LoadField( char* aLine, wxString& aErrorMsg )
LIB_FIELD* fixedField = GetField( field->m_FieldId );
// this will fire only if somebody broke a constructor or editor.
// MANDATORY_FIELDS are alway present in ram resident components, no
// MANDATORY_FIELDS are always present in ram resident components, no
// exceptions, and they always have their names set, even fixed fields.
wxASSERT( fixedField );
......@@ -960,8 +954,7 @@ EDA_Rect LIB_COMPONENT::GetBoundaryBox( int aUnit, int aConvert )
&& ( aUnit != item.m_Unit ) ) )
continue;
if( item.m_Convert > 0
&& ( ( aConvert > 0 ) && ( aConvert != item.m_Convert ) ) )
if( item.m_Convert > 0 && ( ( aConvert > 0 ) && ( aConvert != item.m_Convert ) ) )
continue;
if ( ( item.Type() == COMPONENT_FIELD_DRAW_TYPE )
......@@ -1006,7 +999,7 @@ void LIB_COMPONENT::SetFields( const std::vector <LIB_FIELD>& aFields )
}
// Reorder drawings: transparent polygons first, pins and text last.
// so texts have priority on sreen.
// so texts have priority on screen.
drawings.sort();
}
......@@ -1113,8 +1106,7 @@ bool LIB_COMPONENT::SaveDateAndTime( FILE* aFile )
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 )
if ( fprintf( aFile, "Ti %d/%d/%d %d:%d:%d\n", year, mon, day, hour, min, sec ) < 0 )
return false;
return true;
......@@ -1132,8 +1124,7 @@ bool LIB_COMPONENT::LoadDateAndTime( char* aLine )
text = strtok( aLine, " \r\t\n" );
text = strtok( NULL, " \r\t\n" );
if (sscanf( aLine, "%d/%d/%d %d:%d:%d",
&year, &mon, &day, &hour, &min, &sec ) != 6 )
if (sscanf( aLine, "%d/%d/%d %d:%d:%d", &year, &mon, &day, &hour, &min, &sec ) != 6 )
return false;
m_dateModified = ( sec & 63 ) + ( ( min & 63 ) << 6 ) +
......@@ -1239,7 +1230,7 @@ void LIB_COMPONENT::DeleteSelectedItems()
// We *do not* remove the 2 mandatory fields: reference and value
// so skip them (do not remove) if they are flagged selected.
// Skip also not visible items.
// But I think fileds must not be deleted by a block delete command or other global command
// But I think fields must not be deleted by a block delete command or other global command
// because they are not really graphic items
while( item != drawings.end() )
{
......@@ -1487,11 +1478,11 @@ int LIB_COMPONENT::LocateAliasData( const wxString & aAliasName, bool aCreateIfN
if( aCreateIfNotExist && (idx < 0) )
{
idx = (int) m_aliasListData.size();
m_aliasListData.Add(aAliasName);
// Add void strinds for data:
m_aliasListData.Add(wxEmptyString); //Doc string
m_aliasListData.Add(wxEmptyString); //keywords string
m_aliasListData.Add(wxEmptyString); //Doc fliname string
m_aliasListData.Add( aAliasName );
// Add void strings for data:
m_aliasListData.Add( wxEmptyString ); //Doc string
m_aliasListData.Add( wxEmptyString ); //keywords string
m_aliasListData.Add( wxEmptyString ); //Doc fliname string
}
return idx;
......@@ -1505,7 +1496,7 @@ int LIB_COMPONENT::LocateAliasData( const wxString & aAliasName, bool aCreateIfN
wxString LIB_COMPONENT::GetAliasDataDoc( const wxString & aAliasName )
{
wxString data;
int idx = LocateAliasData( aAliasName);
int idx = LocateAliasData( aAliasName );
if ( idx >= 0 )
data = m_aliasListData[idx + ALIAS_DOC_IDX];
......@@ -1520,7 +1511,7 @@ wxString LIB_COMPONENT::GetAliasDataDoc( const wxString & aAliasName )
wxString LIB_COMPONENT::GetAliasDataKeyWords( const wxString & aAliasName )
{
wxString data;
int idx = LocateAliasData( aAliasName);
int idx = LocateAliasData( aAliasName );
if ( idx >= 0 )
data = m_aliasListData[idx + ALIAS_KEYWORD_IDX];
......@@ -1535,7 +1526,7 @@ wxString LIB_COMPONENT::GetAliasDataKeyWords( const wxString & aAliasName )
wxString LIB_COMPONENT::GetAliasDataDocFileName( const wxString & aAliasName )
{
wxString data;
int idx = LocateAliasData( aAliasName);
int idx = LocateAliasData( aAliasName );
if ( idx >= 0 )
data = m_aliasListData[idx + ALIAS_DOC_FILENAME_IDX];
......@@ -1550,7 +1541,7 @@ wxString LIB_COMPONENT::GetAliasDataDocFileName( const wxString & aAliasName )
*/
void LIB_COMPONENT::SetAliasDataDoc( const wxString & aAliasName, const wxString & aAliasData )
{
int idx = LocateAliasData( aAliasName, true);
int idx = LocateAliasData( aAliasName, true );
m_aliasListData[idx + ALIAS_DOC_IDX] = aAliasData;
}
......@@ -1560,7 +1551,7 @@ void LIB_COMPONENT::SetAliasDataDoc( const wxString & aAliasName, const wxString
*/
void LIB_COMPONENT::SetAliasDataKeywords( const wxString & aAliasName, const wxString & aAliasData )
{
int idx = LocateAliasData( aAliasName, true);
int idx = LocateAliasData( aAliasName, true );
m_aliasListData[idx + ALIAS_KEYWORD_IDX] = aAliasData;
}
......@@ -1568,9 +1559,10 @@ void LIB_COMPONENT::SetAliasDataKeywords( const wxString & aAliasName, const wxS
* @param aAliasName = the alias name
* @param aAliasData = the Doc filename string
*/
void LIB_COMPONENT::SetAliasDataDocFileName( const wxString & aAliasName, const wxString & aAliasData )
void LIB_COMPONENT::SetAliasDataDocFileName( const wxString & aAliasName,
const wxString & aAliasData )
{
int idx = LocateAliasData( aAliasName, true);
int idx = LocateAliasData( aAliasName, true );
m_aliasListData[idx + ALIAS_DOC_FILENAME_IDX] = aAliasData;
}
......@@ -1581,9 +1573,9 @@ void LIB_COMPONENT::SetAliasDataDocFileName( const wxString & aAliasName, const
*/
void LIB_COMPONENT::RemoveAliasData(const wxString & aAliasName )
{
int idx = LocateAliasData( aAliasName);
int idx = LocateAliasData( aAliasName );
if ( idx >= 0 )
m_aliasListData.RemoveAt(idx + ALIAS_NAME_IDX, ALIAS_NEXT_IDX);
m_aliasListData.RemoveAt( idx + ALIAS_NAME_IDX, ALIAS_NEXT_IDX );
}
/** Function CollectAliasesData
......@@ -1595,7 +1587,9 @@ void LIB_COMPONENT::CollectAliasesData( CMP_LIBRARY* aLibrary )
for( unsigned ii = 0; ii < m_AliasList.GetCount(); ii++ )
{
CMP_LIB_ENTRY* entry = aLibrary->FindEntry( m_AliasList[ii] );
if ( ! entry ) continue;
if ( ! entry )
continue;
SetAliasDataDoc( m_AliasList[ii], entry->GetDescription() );
SetAliasDataKeywords( m_AliasList[ii], entry->GetKeyWords() );
SetAliasDataDocFileName( m_AliasList[ii], entry->GetDocFileName() );
......
......@@ -132,12 +132,30 @@ extern int LibraryEntryCompare( const CMP_LIB_ENTRY* aItem1, const CMP_LIB_ENTRY
*/
class LIB_COMPONENT : public CMP_LIB_ENTRY
{
public:
wxArrayString m_AliasList; /* ALIAS list for the component */
wxArrayString m_FootprintList; /* list of suitable footprint names
* for the component (wildcard names
* accepted) */
int m_pinNameOffset; ///< The offset in mils to draw the pin name. Set to 0
///< to draw the pin name above the pin.
bool m_unitsLocked; ///< True if component has multiple parts and changing
///< one part does not automatically change another part.
bool m_showPinNames; ///< Determines if component pin names are visible.
bool m_showPinNumbers; ///< Determines if component pin numbers are visible.
long m_dateModified; ///< Date the component was last modified.
LibrEntryOptions m_options; ///< Special component features such as POWER or NORMAL.)
int unitCount; ///< Number of units (parts) per package.
LIB_DRAW_ITEM_LIST drawings; ///< How to draw this part.
wxArrayString m_aliasListData; /* ALIAS data (name, doc, keywords and doc filename).
* Used only by the component editor LibEdit
* to store aliases info during edition
* usually void outside the component editor */
wxArrayString m_AliasList; ///< List of alias names for the component.
wxArrayString m_FootprintList; /**< List of suitable footprint names for the
component (wildcard names accepted). */
void deleteAllFields();
friend class CMP_LIBRARY;
public:
/* Offsets used in editing library component,
* for handle aliases data in m_AliasListData array string
* when editing a library component, aliases data is stored
......@@ -156,25 +174,6 @@ public:
ALIAS_NEXT_IDX = 4
};
private:
int m_pinNameOffset; ///< The offset in mils to draw the pin name. Set to 0
///< to draw the pin name above the pin.
bool m_unitsLocked; ///< True if component has multple parts and changing
///< one part does not automatically change another part.
bool m_showPinNames; ///< Determines if component pin names are visible.
bool m_showPinNumbers; ///< Determines if component pin numbers are visible.
long m_dateModified; ///< Date the component was last modified.
LibrEntryOptions m_options; // special features (i.e. Entry is a POWER)
int unitCount; /* Units (parts) per package */
LIB_DRAW_ITEM_LIST drawings; /* How to draw this part */
wxArrayString m_aliasListData; /* ALIAS data (name, doc, keywords and doc filename).
* Used only by the component editor LibEdit
* to store aliases info during edition
* usually void outside the component editor */
void deleteAllFields();
public:
LIB_COMPONENT( const wxString& aName, CMP_LIBRARY* aLibrary = NULL );
LIB_COMPONENT( LIB_COMPONENT& aComponent, CMP_LIBRARY* aLibrary = NULL );
......@@ -192,6 +191,10 @@ public:
GetValueField().m_Text = aName;
}
wxArrayString& GetAliasList() { return m_AliasList; }
wxArrayString& GetFootPrints() { return m_FootprintList; }
/* accessors to aliases data, used by the component editor, during edition
*/
/** Function CollectAliasesData
......@@ -206,7 +209,7 @@ public:
* @param aAliasName = the alias name
* @param aCreateIfNotExist = true if the alias data must be created, when not exists
*/
int LocateAliasData( const wxString & aAliasName, bool aCreateIfNotExist = false);
int LocateAliasData( const wxString & aAliasName, bool aCreateIfNotExist = false );
/** Function GetAliasDataDoc
* @param aAliasName = the alias name
......
......@@ -75,10 +75,9 @@ bool operator<( const CMP_LIBRARY& aItem1, const CMP_LIBRARY& aItem2 )
CMP_LIBRARY::CMP_LIBRARY( int aType, const wxFileName& aFileName )
{
m_Type = aType;
type = aType;
isModified = false;
timeStamp = 0;
m_Flags = 0;
isCache = false;
timeStamp = wxDateTime::Now();
......@@ -227,7 +226,7 @@ bool CMP_LIBRARY::AddAlias( LIB_ALIAS* aAlias )
/**
* Add /a aComponent entry to library.
* Add \a aComponent entry to library.
* Note a component can have an alias list,
* so these alias will be added in library.
* Conflicts can happen if aliases are already existing.
......@@ -344,8 +343,8 @@ LIB_COMPONENT* CMP_LIBRARY::AddComponent( LIB_COMPONENT* aComponent )
}
/** function RemoveEntryName
* Remove an /a aName entry from the library list names.
* Warning: this is a partiel remove, because if aName is an alias
* Remove an \a aName entry from the library list names.
* Warning: this is a partial remove, because if aName is an alias
* it is not removed from its root component.
* this is for internal use only
* Use RemoveEntry( CMP_LIB_ENTRY* aEntry ) to remove safely an entry in library.
......@@ -367,7 +366,7 @@ void CMP_LIBRARY::RemoveEntryName( const wxString& aName )
/**
* Remove safely an /a aEntry from the library.
* Remove safely an \a aEntry from the library.
*
* If the entry is an alias, the alias is removed from the library and from
* the alias list of the root component. If the entry is a root component
......@@ -579,7 +578,7 @@ bool CMP_LIBRARY::Load( wxString& aErrorMsg )
}
/* There is no header if this is a symbol library. */
if( m_Type == LIBRARY_TYPE_EESCHEMA )
if( type == LIBRARY_TYPE_EESCHEMA )
{
wxString tmp;
......@@ -643,8 +642,7 @@ the current schematic." ),
while( GetLine( file, line, &lineNumber, sizeof( line ) ) )
{
if( m_Type == LIBRARY_TYPE_EESCHEMA
&& strnicmp( line, "$HEADER", 7 ) == 0 )
if( type == LIBRARY_TYPE_EESCHEMA && strnicmp( line, "$HEADER", 7 ) == 0 )
{
if( !LoadHeader( file, &lineNumber ) )
{
......@@ -701,7 +699,7 @@ void CMP_LIBRARY::LoadAliases( LIB_COMPONENT* component )
LIB_ALIAS* alias;
unsigned ii;
for( ii = 0; ii < component->m_AliasList.GetCount(); ii++ )
for( ii = 0; ii < component->GetAliasList().GetCount(); ii++ )
{
if( FindEntry( component->m_AliasList[ii] ) != NULL )
{
......
......@@ -57,11 +57,7 @@ extern bool operator<( const CMP_LIBRARY& item1, const CMP_LIBRARY& item2 );
*/
class CMP_LIBRARY
{
public:
int m_Type; ///< type indicator
int m_Flags;
protected:
int type; ///< Library type indicator.
wxFileName fileName; ///< Library file name.
wxDateTime timeStamp; ///< Library save time and date.
int versionMajor; ///< Library major version number.
......@@ -70,14 +66,13 @@ protected:
bool isCache; /**< False for the "standard" libraries,
True for the library cache */
wxString header; ///< first line of loaded library.
bool isModified; ///< Library modification status.
static CMP_LIBRARY_LIST libraryList;
static wxArrayString libraryListSortOrder;
friend class CMP_LIB_ENTRY;
private:
bool isModified; ///< Library modification status.
friend class LIB_COMPONENT;
public:
CMP_LIBRARY( int aType, const wxFileName& aFileName );
......@@ -98,11 +93,11 @@ public:
* saves library to a file.
* <p>
* Prior to component library version 3.0, two files were created. The
* component objects are wer as component library (*.lib) files. The
* library entry ojbect document strings were save in library document
* component objects are were as component library (*.lib) files. The
* library entry object document strings were save in library document
* definition (*.dcm) files. After version component library version 3.0,
* the document string information is saved as part of the library file.
* Saving separate document is maintained for backwards compatability.
* Saving separate document is maintained for backwards compatibility.
* Please note that this behavior may change in the future. If the
* component library already exists, it is backup up in file *.bak.
*
......@@ -143,8 +138,8 @@ private:
/**
* Function RemoveEntryName
* removes an /a aName entry from the library list names.
* Warning: this is a partiel remove, because if aname is an alias
* removes an \a aName entry from the library list names.
* Warning: this is a partied remove, because if aname is an alias
* it is not removed from its root component.
* this is for internal use only
* Use RemoveEntry( CMP_LIB_ENTRY* aEntry ) to remove safely an entry.
......@@ -216,7 +211,7 @@ public:
* Find components in library by key word regular expression search.
*
* @param aNames - String array to place found component names into.
* @param aRe - Regular expression used to seach component key words.
* @param aRe - Regular expression used to search component key words.
* @param aSort - Sort component name list.
*/
void SearchEntryNames( wxArrayString& aNames, const wxRegEx& aRe,
......@@ -231,7 +226,7 @@ public:
CMP_LIB_ENTRY* FindEntry( const wxChar* aName );
/**
* Find entry by /a aName and /a aType.
* Find entry by \a aName and \a aType.
*
* @param aName - Name of entry, case insensitive.
* @param aType - Type of entry, root or alias.
......@@ -240,7 +235,7 @@ public:
CMP_LIB_ENTRY* FindEntry( const wxChar* aName, LibrEntryType aType );
/**
* Find component by /a aName.
* Find component by \a aName.
*
* This is a helper for FindEntry so casting a CMP_LIB_ENTRY pointer to
* a LIB_COMPONENT pointer is not required.
......@@ -251,7 +246,7 @@ public:
LIB_COMPONENT* FindComponent( const wxChar* aName );
/**
* Find alias by /a nName.
* Find alias by \a nName.
*
* This is a helper for FindEntry so casting a CMP_LIB_ENTRY pointer to
* a LIB_ALIAS pointer is not required.
......@@ -265,7 +260,7 @@ public:
}
/**
* Add a new /a aAlias entry to the library.
* Add a new \a aAlias entry to the library.
*
* First check if a component or alias with the same name already exists
* in the library and add alias if no conflict occurs. Once the alias
......@@ -279,7 +274,7 @@ public:
bool AddAlias( LIB_ALIAS* aAlias );
/**
* Add /a aComponent entry to library.
* Add \a aComponent entry to library.
* Note a component can have an alias list,
* so these alias will be added in library.
* Conflicts can happen if aliases are already existing.
......@@ -290,7 +285,7 @@ public:
LIB_COMPONENT* AddComponent( LIB_COMPONENT* aComponent );
/**
* Remove safely an /a aEntry from the library.
* Remove safely an \a aEntry from the library.
*
* If the entry is an alias, the alias is removed from the library and from
* the alias list of the root component. If the entry is a root component
......@@ -321,7 +316,7 @@ public:
CMP_LIB_ENTRY* GetFirstEntry();
/**
* Find next library entry by /a aName.
* Find next library entry by \a aName.
*
* If the name of the entry is the last entry in the library, the first
* entry in the list is returned.
......@@ -333,7 +328,7 @@ public:
/**
* Find previous library entry by /a aName.
* Find previous library entry by \a aName.
*
* If the name of the entry is the first entry in the library, the last
* entry in the list is returned.
......@@ -420,7 +415,7 @@ public:
/**
* Function AddLibrary
* adds a compnent library to the library list.
* adds a component library to the library list.
*
* @param aFileName - File name object of component library.
* @param aErrorMsg - Error message if the component library failed to load.
......@@ -430,7 +425,7 @@ public:
/**
* Function AddLibrary
* inserts a compnent library into the library list.
* inserts a component library into the library list.
*
* @param aFileName - File name object of component library.
* @param aErrerMsg - Error message if the component library failed to load.
......
......@@ -74,18 +74,18 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::Init( )
m_ButtonDeleteAllAlias->Enable( false );
/* Place list of alias names in listbox */
m_PartAliasListCtrl->Append( component->m_AliasList );
m_PartAliasListCtrl->Append( component->GetAliasList() );
if( component->m_AliasList.GetCount() == 0 )
if( component->GetAliasList().GetCount() == 0 )
{
m_ButtonDeleteAllAlias->Enable( false );
m_ButtonDeleteOneAlias->Enable( false );
}
/* Read the Footprint Filter list */
m_FootprintFilterListBox->Append( component->m_FootprintList );
m_FootprintFilterListBox->Append( component->GetFootPrints() );
if( component->m_FootprintList.GetCount() == 0 )
if( component->GetFootPrints().GetCount() == 0 )
{
m_ButtonDeleteAllFootprintFilter->Enable( false );
m_ButtonDeleteOneFootprintFilter->Enable( false );
......
......@@ -221,9 +221,9 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnOKButtonClick( wxCommandEvent& event
/* A new name could be entered in VALUE field.
* Must not be an existing alias name in alias list box */
wxString* newvalue = &m_FieldsBuf[VALUE].m_Text;
for( size_t i = 0; i < m_LibEntry->m_AliasList.GetCount(); i++ )
for( size_t i = 0; i < m_LibEntry->GetAliasList().GetCount(); i++ )
{
if( newvalue->CmpNoCase( m_LibEntry->m_AliasList[i] ) == 0 )
if( newvalue->CmpNoCase( m_LibEntry->GetAliasList()[i] ) == 0 )
{
wxString msg;
msg.Printf( _( "A new name is entered for this component\n\
......
......@@ -93,34 +93,34 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnOkClick( wxCommandEvent& event )
component->SetAliasDataDocFileName(aliasname, m_DocfileCtrl->GetValue() );
}
if( m_PartAliasListCtrl->GetStrings() != component->m_AliasList )
if( m_PartAliasListCtrl->GetStrings() != component->GetAliasList() )
{
wxArrayString aliases = m_PartAliasListCtrl->GetStrings();
/* Add names not existing in the current component alias list. */
for( i = 0; i < aliases.GetCount(); i++ )
{
index = component->m_AliasList.Index( aliases[ i ], false );
index = component->GetAliasList().Index( aliases[ i ], false );
if( index != wxNOT_FOUND )
continue;
component->m_AliasList.Add( aliases[ i ] );
component->GetAliasList().Add( aliases[ i ] );
}
/* Remove names in the current component that are not in the new alias list. */
for( i = 0; i < component->m_AliasList.GetCount(); i++ )
for( i = 0; i < component->GetAliasList().GetCount(); i++ )
{
index = aliases.Index( component->m_AliasList[ i ], false );
index = aliases.Index( component->GetAliasList()[ i ], false );
if( index == wxNOT_FOUND )
continue;
component->m_AliasList.RemoveAt( i );
component->GetAliasList().RemoveAt( i );
i--;
}
component->m_AliasList = aliases;
component->GetAliasList() = aliases;
}
index = m_SelNumberOfUnits->GetValue();
......@@ -168,8 +168,8 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnOkClick( wxCommandEvent& event )
component->LockUnits( false );
/* Update the footprint filter list */
component->m_FootprintList.Clear();
component->m_FootprintList = m_FootprintFilterListBox->GetStrings();
component->GetFootPrints().Clear();
component->GetFootPrints() = m_FootprintFilterListBox->GetStrings();
EndModal( wxID_OK );
}
......
......@@ -480,7 +480,7 @@ All changes will be lost. Discard changes?" ) ) )
*/
if( m_component->GetName().CmpNoCase( LibEntry->GetName() ) == 0 )
{
if( m_component->m_AliasList.IsEmpty() )
if( m_component->GetAliasList().IsEmpty() )
{
nextEntry = m_library->GetNextEntry( m_component->GetName() );
......@@ -489,7 +489,7 @@ All changes will be lost. Discard changes?" ) ) )
}
else
{
newCmpName = m_component->m_AliasList[ 0 ];
newCmpName = m_component->GetAliasList()[ 0 ];
}
}
else
......
......@@ -426,9 +426,9 @@ void WinEDA_LibeditFrame::UpdateAliasSelectList()
m_SelAliasBox->Append( m_component->GetName() );
m_SelAliasBox->SetSelection( 0 );
if( !m_component->m_AliasList.IsEmpty() )
if( !m_component->GetAliasList().IsEmpty() )
{
m_SelAliasBox->Append( m_component->m_AliasList );
m_SelAliasBox->Append( m_component->GetAliasList() );
int index = m_SelAliasBox->FindString( m_aliasName );
......@@ -571,7 +571,7 @@ void WinEDA_LibeditFrame::OnUpdateSelectAlias( wxUpdateUIEvent& event )
* so use the pointer to alias combobox to directly enable or disable.
*/
m_SelAliasBox->Enable( m_component != NULL
&& !m_component->m_AliasList.IsEmpty() );
&& !m_component->GetAliasList().IsEmpty() );
}
......
......@@ -186,14 +186,13 @@ void WinEDA_LibeditFrame::EditField( wxDC* DC, LIB_FIELD* Field )
wxString msg;
/* Test for an existing name in the current components alias list. */
if( Field->GetParent()->m_AliasList.Index( Text, false ) != wxNOT_FOUND )
if( Field->GetParent()->GetAliasList().Index( Text, false ) != wxNOT_FOUND )
{
msg.Printf( _(
"The field name <%s> is an existing alias of the \
msg.Printf( _( "The field name <%s> is an existing alias of the \
component <%s>.\nPlease choose another name that does not conflict with any \
names in the alias list." ),
GetChars( Text ),
GetChars( Field->GetParent()->GetName() ) );
GetChars( Text ),
GetChars( Field->GetParent()->GetName() ) );
DisplayError( this, msg );
return;
}
......
......@@ -729,14 +729,14 @@ XNODE* EXPORT_HELP::makeGenericLibParts()
xlibpart->AddChild( node( sDocs, lcomp->GetDocFileName() ) );
// Write the footprint list
if( lcomp->m_FootprintList.GetCount() )
if( lcomp->GetFootPrints().GetCount() )
{
XNODE* xfootprints;
xlibpart->AddChild( xfootprints = node( sFprints ) );
for( unsigned i=0; i<lcomp->m_FootprintList.GetCount(); ++i )
for( unsigned i=0; i<lcomp->GetFootPrints().GetCount(); ++i )
{
xfootprints->AddChild( node( sFp, lcomp->m_FootprintList[i] ) );
xfootprints->AddChild( node( sFp, lcomp->GetFootPrints()[i] ) );
}
}
......@@ -1186,7 +1186,7 @@ bool EXPORT_HELP::WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f, boo
DateAndTime( Line );
ret |= fprintf( f, "* %s (Spice format) creation date: %s\n\n",
NETLIST_HEAD_STRING, Line );
NETLIST_HEAD_STRING, Line );
// Create text list starting by [.-]pspice , or [.-]gnucap (simulator
// commands) and create text list starting by [+]pspice , or [+]gnucap
......@@ -1222,8 +1222,8 @@ bool EXPORT_HELP::WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f, boo
int ypos = drawText->m_Pos.y;
for( int ii = 0; ii < BUFYPOS_LEN; ii++ )
{
bufnum[BUFYPOS_LEN - 1 -
ii] = (ypos & 63) + ' '; ypos >>= 6;
bufnum[BUFYPOS_LEN - 1 - ii] = (ypos & 63) + ' ';
ypos >>= 6;
}
text = drawText->m_Text.AfterFirst( ' ' );
......@@ -1363,7 +1363,7 @@ bool EXPORT_HELP::WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, boo
if( entry )
{
if( entry->m_FootprintList.GetCount() != 0 ) // Put in list
if( entry->GetFootPrints().GetCount() != 0 ) // Put in list
{
cmpList.push_back( OBJ_CMP_TO_LIST() );
......@@ -1383,8 +1383,8 @@ bool EXPORT_HELP::WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, boo
field = comp->GetRef( path );
ret |= fprintf( f, " ( %s %s",
CONV_TO_UTF8( comp->GetPath( path ) ),
CONV_TO_UTF8( footprint ) );
CONV_TO_UTF8( comp->GetPath( path ) ),
CONV_TO_UTF8( footprint ) );
ret |= fprintf( f, " %s", CONV_TO_UTF8( field ) );
......@@ -1414,7 +1414,7 @@ bool EXPORT_HELP::WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, boo
netName.Replace( wxT( " " ), wxT( "_" ) );
ret |= fprintf( f, " ( %4.4s %s )\n", (char*) &pin->m_PinNum,
CONV_TO_UTF8( netName ) );
CONV_TO_UTF8( netName ) );
}
ret |= fprintf( f, " )\n" );
......@@ -1444,10 +1444,9 @@ bool EXPORT_HELP::WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, boo
ret |= fprintf( f, "$component %s\n", CONV_TO_UTF8( ref ) );
// Write the footprint list
for( unsigned jj = 0; jj < entry->m_FootprintList.GetCount(); jj++ )
for( unsigned jj = 0; jj < entry->GetFootPrints().GetCount(); jj++ )
{
ret |= fprintf( f, " %s\n",
CONV_TO_UTF8( entry->m_FootprintList[jj] ) );
ret |= fprintf( f, " %s\n", CONV_TO_UTF8( entry->GetFootPrints()[jj] ) );
}
ret |= fprintf( f, "$endlist\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