Commit 11bf0ad7 authored by stambaughw's avatar stambaughw

Merge component library draw item and field list.

* Use single list for component library draw item and fields to simplify
  component library object.
* Add field manipulation helper methods to component library object.
* Make component library draw item edit dialog sizable.
parent 6adf9163
This diff is collapsed.
...@@ -5,8 +5,6 @@ ...@@ -5,8 +5,6 @@
#ifndef CLASS_LIBENTRY_H #ifndef CLASS_LIBENTRY_H
#define CLASS_LIBENTRY_H #define CLASS_LIBENTRY_H
#include "dlist.h"
#include "classes_body_items.h" #include "classes_body_items.h"
#include "class_libentry_fields.h" #include "class_libentry_fields.h"
...@@ -43,7 +41,6 @@ class CMP_LIB_ENTRY : public EDA_BaseStruct ...@@ -43,7 +41,6 @@ class CMP_LIB_ENTRY : public EDA_BaseStruct
public: public:
LibrEntryType Type; /* Type = ROOT; LibrEntryType Type; /* Type = ROOT;
* = ALIAS pour struct LibraryAliasType */ * = ALIAS pour struct LibraryAliasType */
LIB_FIELD m_Name; // name (74LS00 ..) in lib ( = VALUE )
wxString m_Doc; /* documentation for info */ wxString m_Doc; /* documentation for info */
wxString m_KeyWord; /* keyword list (used to select a group of wxString m_KeyWord; /* keyword list (used to select a group of
* components by keyword) */ * components by keyword) */
...@@ -64,7 +61,9 @@ public: ...@@ -64,7 +61,9 @@ public:
wxString GetLibraryName(); wxString GetLibraryName();
const wxString& GetName() { return m_Name.m_Text; } virtual const wxString& GetName() const { return m_Name; }
virtual void SetName( const wxString& name ) { m_Name = name; }
/** /**
* Write the entry document information to a FILE in "*.dcm" format. * Write the entry document information to a FILE in "*.dcm" format.
...@@ -85,7 +84,10 @@ public: ...@@ -85,7 +84,10 @@ public:
} }
protected: protected:
CMP_LIBRARY* m_lib; wxString m_Name;
/** Library object that entry is attached to. */
CMP_LIBRARY* m_lib;
}; };
...@@ -107,7 +109,6 @@ extern int LibraryEntryCompare( const CMP_LIB_ENTRY* LE1, ...@@ -107,7 +109,6 @@ extern int LibraryEntryCompare( const CMP_LIB_ENTRY* LE1,
class LIB_COMPONENT : public CMP_LIB_ENTRY class LIB_COMPONENT : public CMP_LIB_ENTRY
{ {
public: public:
LIB_FIELD m_Prefix; /* Prefix ( U, IC ... ) = REFERENCE */
wxArrayString m_AliasList; /* ALIAS list for the component */ wxArrayString m_AliasList; /* ALIAS list for the component */
wxArrayString m_FootprintList; /* list of suitable footprint names wxArrayString m_FootprintList; /* list of suitable footprint names
* for the component (wildcard names * for the component (wildcard names
...@@ -123,7 +124,6 @@ public: ...@@ -123,7 +124,6 @@ public:
* m_TextInside in mils */ * m_TextInside in mils */
bool m_DrawPinNum; bool m_DrawPinNum;
bool m_DrawPinName; bool m_DrawPinName;
DLIST<LIB_FIELD> m_Fields; /* Auxiliary Field list (id >= 2 ) */
long m_LastDate; // Last change Date long m_LastDate; // Last change Date
protected: protected:
...@@ -137,6 +137,12 @@ public: ...@@ -137,6 +137,12 @@ public:
} }
virtual void SetName( const wxString& name )
{
CMP_LIB_ENTRY::SetName( name );
GetValueField().m_Text = name;
}
LIB_COMPONENT( const wxString& name, CMP_LIBRARY* lib = NULL ); LIB_COMPONENT( const wxString& name, CMP_LIBRARY* lib = NULL );
LIB_COMPONENT( LIB_COMPONENT& component, CMP_LIBRARY* lib = NULL ); LIB_COMPONENT( LIB_COMPONENT& component, CMP_LIBRARY* lib = NULL );
...@@ -181,6 +187,29 @@ public: ...@@ -181,6 +187,29 @@ public:
*/ */
void SetFields( const std::vector <LIB_FIELD> aFields ); void SetFields( const std::vector <LIB_FIELD> aFields );
/**
* Return list of field references of component.
*
* @param list - List to add field references to.
*/
void GetFields( LIB_FIELD_LIST& list );
/**
* Return pointer to the requested field.
*
* @param id - Id of field to return.
*
* @return LIB_FIELD* - Pointer to field if found. NULL is returned if
* field not found.
*/
LIB_FIELD* GetField( int id );
/** Return reference to the value field. */
LIB_FIELD& GetValueField( void );
/** Return reference to the reference designator field. */
LIB_FIELD& GetReferenceField( void );
/** /**
* Draw component. * Draw component.
* *
......
...@@ -56,6 +56,7 @@ LIB_FIELD::LIB_FIELD( int idfield ) : ...@@ -56,6 +56,7 @@ LIB_FIELD::LIB_FIELD( int idfield ) :
LIB_FIELD::LIB_FIELD( const LIB_FIELD& field ) : LIB_DRAW_ITEM( field ) LIB_FIELD::LIB_FIELD( const LIB_FIELD& field ) : LIB_DRAW_ITEM( field )
{ {
m_FieldId = field.m_FieldId;
m_Pos = field.m_Pos; m_Pos = field.m_Pos;
m_Size = field.m_Size; m_Size = field.m_Size;
m_Width = field.m_Width; m_Width = field.m_Width;
...@@ -431,7 +432,7 @@ int LIB_FIELD::DoCompare( const LIB_DRAW_ITEM& other ) const ...@@ -431,7 +432,7 @@ int LIB_FIELD::DoCompare( const LIB_DRAW_ITEM& other ) const
const LIB_FIELD* tmp = ( LIB_FIELD* ) &other; const LIB_FIELD* tmp = ( LIB_FIELD* ) &other;
if( m_FieldId == tmp->m_FieldId ) if( m_FieldId != tmp->m_FieldId )
return m_FieldId - tmp->m_FieldId; return m_FieldId - tmp->m_FieldId;
int result = m_Text.CmpNoCase( tmp->m_Text ); int result = m_Text.CmpNoCase( tmp->m_Text );
......
...@@ -9,6 +9,12 @@ ...@@ -9,6 +9,12 @@
#include "classes_body_items.h" #include "classes_body_items.h"
class LIB_FIELD;
typedef std::vector< LIB_FIELD > LIB_FIELD_LIST;
/* Fields , same as component fields. /* Fields , same as component fields.
* can be defined in libraries (mandatory for ref and value, ca be useful for * can be defined in libraries (mandatory for ref and value, ca be useful for
* footprints) * footprints)
......
...@@ -29,7 +29,7 @@ loading components into a schematic." ); ...@@ -29,7 +29,7 @@ loading components into a schematic." );
static bool DuplicateEntryName( const CMP_LIB_ENTRY& item1, static bool DuplicateEntryName( const CMP_LIB_ENTRY& item1,
const CMP_LIB_ENTRY& item2 ) const CMP_LIB_ENTRY& item2 )
{ {
return item1.m_Name.m_Text.CmpNoCase( item2.m_Name.m_Text ) == 0; return item1.GetName().CmpNoCase( item2.GetName() ) == 0;
} }
...@@ -100,9 +100,15 @@ void CMP_LIBRARY::GetEntryNames( wxArrayString& names, bool sort, ...@@ -100,9 +100,15 @@ void CMP_LIBRARY::GetEntryNames( wxArrayString& names, bool sort,
BOOST_FOREACH( CMP_LIB_ENTRY& entry, m_Entries ) BOOST_FOREACH( CMP_LIB_ENTRY& entry, m_Entries )
{ {
if( makeUpperCase ) if( makeUpperCase )
names.Add( entry.m_Name.m_Text.MakeUpper() ); {
wxString tmp = entry.GetName();
tmp.MakeUpper();
names.Add( tmp );
}
else else
{
names.Add( entry.GetName() ); names.Add( entry.GetName() );
}
} }
if( sort ) if( sort )
...@@ -346,7 +352,7 @@ library <%s>" ), ...@@ -346,7 +352,7 @@ library <%s>" ),
RemoveEntry( AliasName ); RemoveEntry( AliasName );
/* Change the root name. */ /* Change the root name. */
Root->m_Name.m_Text = AliasName; Root->SetName( AliasName );
} }
......
...@@ -63,6 +63,9 @@ SCH_COMPONENT::SCH_COMPONENT( LIB_COMPONENT& libComponent, DrawSheetPath* sheet, ...@@ -63,6 +63,9 @@ SCH_COMPONENT::SCH_COMPONENT( LIB_COMPONENT& libComponent, DrawSheetPath* sheet,
bool setNewItemFlag ) : bool setNewItemFlag ) :
SCH_ITEM( NULL, TYPE_SCH_COMPONENT ) SCH_ITEM( NULL, TYPE_SCH_COMPONENT )
{ {
size_t i;
LIB_FIELD_LIST libFields;
Init( pos ); Init( pos );
m_Multi = unit; m_Multi = unit;
...@@ -73,55 +76,49 @@ SCH_COMPONENT::SCH_COMPONENT( LIB_COMPONENT& libComponent, DrawSheetPath* sheet, ...@@ -73,55 +76,49 @@ SCH_COMPONENT::SCH_COMPONENT( LIB_COMPONENT& libComponent, DrawSheetPath* sheet,
if( setNewItemFlag ) if( setNewItemFlag )
m_Flags = IS_NEW | IS_MOVED; m_Flags = IS_NEW | IS_MOVED;
GetField( VALUE )->m_Pos = libComponent.m_Name.m_Pos + m_Pos; libComponent.GetFields( libFields );
GetField( VALUE )->ImportValues( libComponent.m_Name );
GetField( VALUE )->m_Text = m_ChipName;
wxString msg = libComponent.m_Prefix.m_Text;
if( msg.IsEmpty() )
msg = wxT( "U" );
msg += wxT( "?" );
// update the reference -- just the prefix for now.
SetRef( sheet, msg );
GetField( REFERENCE )->m_Pos = libComponent.m_Prefix.m_Pos + m_Pos;
GetField( REFERENCE )->ImportValues( libComponent.m_Prefix );
m_PrefixString = libComponent.m_Prefix.m_Text;
/* Init des autres champs si predefinis dans la librairie */
LIB_FIELD* EntryField;
int ii;
for( EntryField = libComponent.m_Fields; EntryField != NULL; for( i = 0; i < libFields.size(); i++ )
EntryField = EntryField->Next() )
{ {
if( EntryField->m_Text.IsEmpty() && EntryField->m_Name.IsEmpty() ) if( libFields[i].m_Text.IsEmpty() && libFields[i].m_Name.IsEmpty() )
continue; continue;
ii = EntryField->m_FieldId; /* Add extra fields if library component has more than the default
if( ii < 2 ) // Reference or value, already done * number of fields.
continue; */
if( (int) i >= GetFieldCount() )
if( ii >= GetFieldCount() ) {
{ // This entry has more than the default count: add extra fields while( (int) i >= GetFieldCount() )
while( ii >= GetFieldCount() )
{ {
int field_id = GetFieldCount(); SCH_CMP_FIELD field( wxPoint( 0, 0 ), GetFieldCount(), this,
SCH_CMP_FIELD field( wxPoint( 0, 0 ), field_id, this, ReturnDefaultFieldName( i ) );
ReturnDefaultFieldName( ii ) );
AddField( field ); AddField( field );
} }
} }
SCH_CMP_FIELD* curr_field = GetField( ii ); SCH_CMP_FIELD* schField = GetField( i );
curr_field->m_Pos = m_Pos + EntryField->m_Pos; schField->m_Pos = m_Pos + libFields[i].m_Pos;
curr_field->ImportValues( *EntryField ); schField->ImportValues( libFields[i] );
curr_field->m_Text = EntryField->m_Text; schField->m_Text = libFields[i].m_Text;
curr_field->m_Name = schField->m_Name = ( i < FIELD1 ) ? ReturnDefaultFieldName( i ) :
( ii < FIELD1 ) ? ReturnDefaultFieldName( ii ) : EntryField->m_Name; libFields[i].m_Name;
} }
wxString msg = libComponent.GetReferenceField().m_Text;
if( msg.IsEmpty() )
msg = wxT( "U" );
msg += wxT( "?" );
// update the reference -- just the prefix for now.
SetRef( sheet, msg );
/* Use the schematic component name instead of the library value field
* name.
*/
GetField( VALUE )->m_Text = m_ChipName;
} }
......
...@@ -108,7 +108,7 @@ void WinEDA_CreateCmpDialog::SetComponentData( LIB_COMPONENT & component ) ...@@ -108,7 +108,7 @@ void WinEDA_CreateCmpDialog::SetComponentData( LIB_COMPONENT & component )
parent->SetShowDeMorgan( m_AsConvert->GetValue() ); parent->SetShowDeMorgan( m_AsConvert->GetValue() );
component.SetPartCount( m_PartsCount->GetSelection() + 1 ); component.SetPartCount( m_PartsCount->GetSelection() + 1 );
component.m_Prefix.m_Text = m_Reference->GetValue(); component.GetReference().m_Text = m_Reference->GetValue();
if ( m_PinNameInside->GetValue() == FALSE) if ( m_PinNameInside->GetValue() == FALSE)
component.m_TextInside = 0; component.m_TextInside = 0;
else else
......
...@@ -720,11 +720,13 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp( wxCommandEvent& event ) ...@@ -720,11 +720,13 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp( wxCommandEvent& event )
RedrawOneStruct( m_Parent->DrawPanel, &dc, m_Cmp, g_XorMode ); RedrawOneStruct( m_Parent->DrawPanel, &dc, m_Cmp, g_XorMode );
/* Initialise fields values to default values found in library: */ /* Initialise fields values to default values found in library: */
m_Cmp->GetField( REFERENCE )->m_Pos = entry->m_Prefix.m_Pos + m_Cmp->m_Pos; LIB_FIELD& refField = entry->GetReferenceField();
m_Cmp->GetField( REFERENCE )->ImportValues( entry->m_Prefix ); m_Cmp->GetField( REFERENCE )->m_Pos = refField.m_Pos + m_Cmp->m_Pos;
m_Cmp->GetField( REFERENCE )->ImportValues( refField );
m_Cmp->GetField( VALUE )->m_Pos = entry->m_Name.m_Pos + m_Cmp->m_Pos; LIB_FIELD& valField = entry->GetValueField();
m_Cmp->GetField( VALUE )->ImportValues( entry->m_Name ); m_Cmp->GetField( VALUE )->m_Pos = valField.m_Pos + m_Cmp->m_Pos;
m_Cmp->GetField( VALUE )->ImportValues( valField );
m_Cmp->SetRotationMiroir( CMP_NORMAL ); m_Cmp->SetRotationMiroir( CMP_NORMAL );
......
...@@ -416,15 +416,16 @@ static bool SortFieldsById(const LIB_FIELD& item1, const LIB_FIELD& item2) ...@@ -416,15 +416,16 @@ static bool SortFieldsById(const LIB_FIELD& item1, const LIB_FIELD& item2)
void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::InitBuffers( void ) void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::InitBuffers( void )
/***********************************************************/ /***********************************************************/
{ {
LIB_FIELD_LIST fields;
m_LibEntry->GetFields( fields );
// copy all the fields to a work area // copy all the fields to a work area
m_FieldsBuf.reserve(NUMBER_OF_FIELDS); m_FieldsBuf.reserve(NUMBER_OF_FIELDS);
m_FieldsBuf.push_back( m_LibEntry->m_Prefix );
m_FieldsBuf.push_back( m_LibEntry->m_Name );
// Creates a working copy of fields // Creates a working copy of fields
for( LIB_FIELD* field = m_LibEntry->m_Fields; field != NULL; field = field->Next() ) for( size_t i = 0; i < fields.size(); i++ )
m_FieldsBuf.push_back( *field ); m_FieldsBuf.push_back( fields[i] );
// Display 12 fields (or more), and add missing fields // Display 12 fields (or more), and add missing fields
LIB_FIELD blank( 2 ); LIB_FIELD blank( 2 );
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
<property name="name">DIALOG_LIB_EDIT_DRAW_ITEM_BASE</property> <property name="name">DIALOG_LIB_EDIT_DRAW_ITEM_BASE</property>
<property name="pos"></property> <property name="pos"></property>
<property name="size"></property> <property name="size"></property>
<property name="style">wxDEFAULT_DIALOG_STYLE</property> <property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="title">Drawing Properties</property> <property name="title">Drawing Properties</property>
<property name="tooltip"></property> <property name="tooltip"></property>
......
...@@ -55,7 +55,7 @@ class DIALOG_LIB_EDIT_DRAW_ITEM_BASE : public wxDialog ...@@ -55,7 +55,7 @@ class DIALOG_LIB_EDIT_DRAW_ITEM_BASE : public wxDialog
wxButton* m_sdbSizer1Cancel; wxButton* m_sdbSizer1Cancel;
public: public:
DIALOG_LIB_EDIT_DRAW_ITEM_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Drawing Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE ); DIALOG_LIB_EDIT_DRAW_ITEM_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Drawing Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_LIB_EDIT_DRAW_ITEM_BASE(); ~DIALOG_LIB_EDIT_DRAW_ITEM_BASE();
}; };
......
...@@ -527,7 +527,7 @@ lost!\n\nClear the current component from the screen?" ) ) ) ...@@ -527,7 +527,7 @@ lost!\n\nClear the current component from the screen?" ) ) )
} }
LIB_COMPONENT* component = new LIB_COMPONENT( name ); LIB_COMPONENT* component = new LIB_COMPONENT( name );
component->m_Prefix.m_Text = dlg.GetReference(); component->GetReferenceField().m_Text = dlg.GetReference();
component->SetPartCount( dlg.GetPartCount() ); component->SetPartCount( dlg.GetPartCount() );
// Initialize component->m_TextInside member: // Initialize component->m_TextInside member:
// if 0, pin text is outside the body (on the pin) // if 0, pin text is outside the body (on the pin)
......
...@@ -160,6 +160,8 @@ void WinEDA_LibeditFrame::EditField( wxDC* DC, LIB_FIELD* Field ) ...@@ -160,6 +160,8 @@ void WinEDA_LibeditFrame::EditField( wxDC* DC, LIB_FIELD* Field )
Get_Message( title, _( "Edit field" ), Text, this ); Get_Message( title, _( "Edit field" ), Text, this );
Text.Replace( wxT( " " ), wxT( "_" ) ); Text.Replace( wxT( " " ), wxT( "_" ) );
wxString fieldText = Field->GetFullText( m_unit );
/* If the value field is changed, this is equivalent to creating a new /* If the value field is changed, this is equivalent to creating a new
* component from the old one. Check for an existing library entry of * component from the old one. Check for an existing library entry of
* this "new" component and change the value only if there is no existing * this "new" component and change the value only if there is no existing
...@@ -194,9 +196,9 @@ not conflict with any library entries." ), ...@@ -194,9 +196,9 @@ not conflict with any library entries." ),
DisplayError( this, msg ); DisplayError( this, msg );
return; return;
} }
}
wxString fieldText = Field->GetFullText( m_unit ); Field->GetParent()->SetName( Text );
}
Field->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, g_XorMode, &fieldText, Field->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, g_XorMode, &fieldText,
DefaultTransformMatrix ); DefaultTransformMatrix );
......
...@@ -101,6 +101,8 @@ void WinEDA_LibeditFrame::LoadOneSymbol( void ) ...@@ -101,6 +101,8 @@ void WinEDA_LibeditFrame::LoadOneSymbol( void )
BOOST_FOREACH( LIB_DRAW_ITEM& item, drawList ) BOOST_FOREACH( LIB_DRAW_ITEM& item, drawList )
{ {
if( item.Type() == COMPONENT_FIELD_DRAW_TYPE )
continue;
if( item.m_Unit ) if( item.m_Unit )
item.m_Unit = m_unit; item.m_Unit = m_unit;
if( item.m_Convert ) if( item.m_Convert )
...@@ -146,7 +148,7 @@ void WinEDA_LibeditFrame::SaveOneSymbol() ...@@ -146,7 +148,7 @@ void WinEDA_LibeditFrame::SaveOneSymbol()
wxString default_path = wxGetApp().ReturnLastVisitedLibraryPath(); wxString default_path = wxGetApp().ReturnLastVisitedLibraryPath();
wxFileDialog dlg( this, _( "Export Symbol Drawings" ), default_path, wxFileDialog dlg( this, _( "Export Symbol Drawings" ), default_path,
m_component->m_Name.m_Text, SymbolFileWildcard, m_component->GetName(), SymbolFileWildcard,
wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
...@@ -182,14 +184,14 @@ void WinEDA_LibeditFrame::SaveOneSymbol() ...@@ -182,14 +184,14 @@ void WinEDA_LibeditFrame::SaveOneSymbol()
/* Creation du commentaire donnant le nom du composant */ /* Creation du commentaire donnant le nom du composant */
fprintf( ExportFile, "# SYMBOL %s\n#\n", fprintf( ExportFile, "# SYMBOL %s\n#\n",
CONV_TO_UTF8( m_component->m_Name.m_Text ) ); CONV_TO_UTF8( m_component->GetName() ) );
/* Generation des lignes utiles */ /* Generation des lignes utiles */
fprintf( ExportFile, "DEF %s", fprintf( ExportFile, "DEF %s",
CONV_TO_UTF8( m_component->m_Name.m_Text ) ); CONV_TO_UTF8( m_component->GetName() ) );
if( !m_component->m_Prefix.m_Text.IsEmpty() ) if( !m_component->GetReferenceField().m_Text.IsEmpty() )
fprintf( ExportFile, " %s", fprintf( ExportFile, " %s",
CONV_TO_UTF8( m_component->m_Prefix.m_Text ) ); CONV_TO_UTF8( m_component->GetReferenceField().m_Text ) );
else else
fprintf( ExportFile, " ~" ); fprintf( ExportFile, " ~" );
...@@ -201,8 +203,8 @@ void WinEDA_LibeditFrame::SaveOneSymbol() ...@@ -201,8 +203,8 @@ void WinEDA_LibeditFrame::SaveOneSymbol()
1, 0 /* unused */, 'N' ); 1, 0 /* unused */, 'N' );
/* Position / orientation / visibilite des champs */ /* Position / orientation / visibilite des champs */
m_component->m_Prefix.Save( ExportFile ); m_component->GetReferenceField().Save( ExportFile );
m_component->m_Name.Save( ExportFile ); m_component->GetValueField().Save( ExportFile );
LIB_DRAW_ITEM_LIST& drawList = m_component->GetDrawItemList(); LIB_DRAW_ITEM_LIST& drawList = m_component->GetDrawItemList();
...@@ -210,7 +212,9 @@ void WinEDA_LibeditFrame::SaveOneSymbol() ...@@ -210,7 +212,9 @@ void WinEDA_LibeditFrame::SaveOneSymbol()
BOOST_FOREACH( LIB_DRAW_ITEM& item, drawList ) BOOST_FOREACH( LIB_DRAW_ITEM& item, drawList )
{ {
/* Elimination des elements non relatifs a l'unite */ if( item.Type() == COMPONENT_FIELD_DRAW_TYPE )
continue;
/* Don't save unused parts or alternate body styles. */
if( m_unit && item.m_Unit && ( item.m_Unit != m_unit ) ) if( m_unit && item.m_Unit && ( item.m_Unit != m_unit ) )
continue; continue;
if( m_convert && item.m_Convert && ( item.m_Convert != m_convert ) ) if( m_convert && item.m_Convert && ( item.m_Convert != m_convert ) )
......
...@@ -216,7 +216,7 @@ void WinEDA_ViewlibFrame::ViewOneLibraryContent( CMP_LIBRARY* Lib, int Flag ) ...@@ -216,7 +216,7 @@ void WinEDA_ViewlibFrame::ViewOneLibraryContent( CMP_LIBRARY* Lib, int Flag )
LibEntry = Lib->GetNextEntry( m_entryName ); LibEntry = Lib->GetNextEntry( m_entryName );
if( LibEntry ) if( LibEntry )
CmpName = LibEntry->m_Name.m_Text; CmpName = LibEntry->GetName();
} }
if( Flag == PREVIOUS_PART ) if( Flag == PREVIOUS_PART )
...@@ -224,7 +224,7 @@ void WinEDA_ViewlibFrame::ViewOneLibraryContent( CMP_LIBRARY* Lib, int Flag ) ...@@ -224,7 +224,7 @@ void WinEDA_ViewlibFrame::ViewOneLibraryContent( CMP_LIBRARY* Lib, int Flag )
LibEntry = Lib->GetPreviousEntry( m_entryName ); LibEntry = Lib->GetPreviousEntry( m_entryName );
if( LibEntry ) if( LibEntry )
CmpName = LibEntry->m_Name.m_Text; CmpName = LibEntry->GetName();
} }
m_unit = 1; m_unit = 1;
...@@ -291,12 +291,12 @@ void WinEDA_ViewlibFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) ...@@ -291,12 +291,12 @@ void WinEDA_ViewlibFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
/* Temporarily change the name field text to reflect the alias name. */ /* Temporarily change the name field text to reflect the alias name. */
tmp = component->GetName(); tmp = component->GetName();
component->m_Name.m_Text = alias->GetName(); component->SetName( alias->GetName() );
if( m_unit < 1 ) if( m_unit < 1 )
m_unit = 1; m_unit = 1;
if( m_convert < 1 ) if( m_convert < 1 )
m_convert = 1; m_convert = 1;
component->m_Name.m_Text = tmp; component->SetName( tmp );
} }
else else
{ {
...@@ -308,7 +308,7 @@ void WinEDA_ViewlibFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) ...@@ -308,7 +308,7 @@ void WinEDA_ViewlibFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
GR_DEFAULT_DRAWMODE ); GR_DEFAULT_DRAWMODE );
if( !tmp.IsEmpty() ) if( !tmp.IsEmpty() )
component->m_Name.m_Text = tmp; component->SetName( tmp );
ClearMsgPanel(); ClearMsgPanel();
AppendMsgPanel( _( "Part" ), component->GetName(), BLUE, 6 ); AppendMsgPanel( _( "Part" ), component->GetName(), BLUE, 6 );
......
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