Commit f7452ce1 authored by stambaughw's avatar stambaughw

Component library object and other minor improvements.

* Create static component library methods to manage library list.
* Rename component library, component, and alias objects to more readable name.
* Use pointer to component instead of root name to prevent redundant library searches.
* Add append message helper to message panel that calculates string length.
* Initial ground work for merging library and library document files.
* Improved component library file load error checking.
* Minor component library editor improvements.
parent 7776dd61
...@@ -690,28 +690,6 @@ void Affiche_1_Parametre( WinEDA_DrawFrame* frame, int pos_X, ...@@ -690,28 +690,6 @@ void Affiche_1_Parametre( WinEDA_DrawFrame* frame, int pos_X,
} }
/*
* Routine d'affichage de la documentation associee a un composant
*/
/****************************************************************************/
void AfficheDoc( WinEDA_DrawFrame* frame, const wxString& Doc,
const wxString& KeyW )
/****************************************************************************/
{
wxString Line1( wxT( "Doc: " ) ), Line2( wxT( "KeyW: " ) );
int color = BLUE;
if( frame && frame->MsgPanel )
{
frame->MsgPanel->EraseMsgBox();
Line1 += Doc;
Line2 += KeyW;
frame->MsgPanel->Affiche_1_Parametre( 10, Line1, Line2, color );
}
}
/***********************/ /***********************/
int GetTimeStamp() int GetTimeStamp()
/***********************/ /***********************/
......
...@@ -1379,7 +1379,8 @@ void WinEDA_DrawPanel::OnPan( wxCommandEvent& event ) ...@@ -1379,7 +1379,8 @@ void WinEDA_DrawPanel::OnPan( wxCommandEvent& event )
} }
void WinEDA_DrawPanel::UnManageCursor( void ) void WinEDA_DrawPanel::UnManageCursor( int id, int cursor,
const wxString& title )
{ {
wxClientDC dc( this ); wxClientDC dc( this );
...@@ -1387,5 +1388,12 @@ void WinEDA_DrawPanel::UnManageCursor( void ) ...@@ -1387,5 +1388,12 @@ void WinEDA_DrawPanel::UnManageCursor( void )
{ {
ForceCloseManageCurseur( this, &dc ); ForceCloseManageCurseur( this, &dc );
m_AutoPAN_Request = false; m_AutoPAN_Request = false;
if( id != -1 && cursor != -1 )
{
wxASSERT( cursor > wxCURSOR_NONE && cursor < wxCURSOR_MAX );
m_Parent->SetToolID( id, cursor, title );
}
} }
} }
...@@ -61,6 +61,20 @@ int WinEDA_MsgPanel::GetRequiredHeight() ...@@ -61,6 +61,20 @@ int WinEDA_MsgPanel::GetRequiredHeight()
} }
wxSize WinEDA_MsgPanel::computeTextSize( const wxString& text )
{
// Get size of the wxSYS_DEFAULT_GUI_FONT
wxSize textSizeInPixels;
wxScreenDC dc;
dc.SetFont( wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ) );
dc.GetTextExtent( text, &textSizeInPixels.x, &textSizeInPixels.y );
return textSizeInPixels;
}
/*************************************************/ /*************************************************/
void WinEDA_MsgPanel::OnPaint( wxPaintEvent& event ) void WinEDA_MsgPanel::OnPaint( wxPaintEvent& event )
/*************************************************/ /*************************************************/
...@@ -80,6 +94,36 @@ void WinEDA_MsgPanel::OnPaint( wxPaintEvent& event ) ...@@ -80,6 +94,36 @@ void WinEDA_MsgPanel::OnPaint( wxPaintEvent& event )
event.Skip(); event.Skip();
} }
void WinEDA_MsgPanel::AppendMessage( const wxString& textUpper,
const wxString& textLower,
int color, int pad )
{
wxString text;
wxSize drawSize = GetClientSize();
text = ( textUpper.Len() > textLower.Len() ) ? textUpper : textLower;
text.Append( ' ', pad );
MsgItem item;
/* Don't put the first message a window client position 0. Offset by
* one 'W' character width. */
if( m_last_x == 0 )
m_last_x = m_fontSize.x;
item.m_X = m_last_x;
item.m_UpperY = ( drawSize.y / 2 ) - m_fontSize.y;
item.m_LowerY = drawSize.y - m_fontSize.y;
item.m_UpperText = textUpper;
item.m_LowerText = textLower;
item.m_Color = color;
m_Items.push_back( item );
m_last_x += computeTextSize( text ).x;
Refresh();
}
/*****************************************************************************/ /*****************************************************************************/
void WinEDA_MsgPanel::Affiche_1_Parametre( int pos_X, const wxString& texte_H, void WinEDA_MsgPanel::Affiche_1_Parametre( int pos_X, const wxString& texte_H,
......
...@@ -72,9 +72,9 @@ void ReAnnotatePowerSymbolsOnly( void ) ...@@ -72,9 +72,9 @@ void ReAnnotatePowerSymbolsOnly( void )
{ {
if( DrawList->Type() != TYPE_SCH_COMPONENT ) if( DrawList->Type() != TYPE_SCH_COMPONENT )
continue; continue;
SCH_COMPONENT* DrawLibItem = (SCH_COMPONENT*) DrawList; SCH_COMPONENT* DrawLibItem = (SCH_COMPONENT*) DrawList;
EDA_LibComponentStruct* Entry = LIB_COMPONENT* Entry =
( EDA_LibComponentStruct* )FindLibPart( DrawLibItem->m_ChipName ); CMP_LIBRARY::FindLibraryComponent( DrawLibItem->m_ChipName );
if( (Entry == NULL) || (Entry->m_Options != ENTRY_POWER) ) if( (Entry == NULL) || (Entry->m_Options != ENTRY_POWER) )
continue; continue;
...@@ -344,17 +344,18 @@ int AddComponentsInSheetToList( std::vector <OBJ_CMP_TO_LIST>& aComponentsList, ...@@ -344,17 +344,18 @@ int AddComponentsInSheetToList( std::vector <OBJ_CMP_TO_LIST>& aComponentsList,
* @param the DrawSheetPath sheet to analyse * @param the DrawSheetPath sheet to analyse
*/ */
{ {
int NbrCmp = 0; int NbrCmp = 0;
EDA_BaseStruct* DrawList = aSheet->LastDrawList(); EDA_BaseStruct* DrawList = aSheet->LastDrawList();
SCH_COMPONENT* DrawLibItem; SCH_COMPONENT* DrawLibItem;
EDA_LibComponentStruct* Entry; LIB_COMPONENT* Entry;
for( ; DrawList != NULL; DrawList = DrawList->Next() ) for( ; DrawList != NULL; DrawList = DrawList->Next() )
{ {
if( DrawList->Type() == TYPE_SCH_COMPONENT ) if( DrawList->Type() == TYPE_SCH_COMPONENT )
{ {
DrawLibItem = (SCH_COMPONENT*) DrawList; DrawLibItem = (SCH_COMPONENT*) DrawList;
Entry = ( EDA_LibComponentStruct* )FindLibPart( DrawLibItem->m_ChipName ); Entry =
CMP_LIBRARY::FindLibraryComponent( DrawLibItem->m_ChipName );
if( Entry == NULL ) if( Entry == NULL )
continue; continue;
......
...@@ -855,7 +855,7 @@ static LibEDA_BaseStruct* GetNextPinPosition( SCH_COMPONENT* aDrawLibItem, ...@@ -855,7 +855,7 @@ static LibEDA_BaseStruct* GetNextPinPosition( SCH_COMPONENT* aDrawLibItem,
* @return a pointer to the pin * @return a pointer to the pin
*/ */
{ {
EDA_LibComponentStruct* Entry; LIB_COMPONENT* Entry;
static LibEDA_BaseStruct* NextItem; static LibEDA_BaseStruct* NextItem;
static int Multi, convert, TransMat[2][2]; static int Multi, convert, TransMat[2][2];
LibEDA_BaseStruct* DEntry; LibEDA_BaseStruct* DEntry;
...@@ -866,8 +866,7 @@ static LibEDA_BaseStruct* GetNextPinPosition( SCH_COMPONENT* aDrawLibItem, ...@@ -866,8 +866,7 @@ static LibEDA_BaseStruct* GetNextPinPosition( SCH_COMPONENT* aDrawLibItem,
if( aDrawLibItem ) if( aDrawLibItem )
{ {
NextItem = NULL; NextItem = NULL;
Entry = Entry = CMP_LIBRARY::FindLibraryComponent( aDrawLibItem->m_ChipName );
( EDA_LibComponentStruct* )FindLibPart( aDrawLibItem->m_ChipName );
if( Entry == NULL ) if( Entry == NULL )
return NULL; return NULL;
......
...@@ -18,18 +18,18 @@ ...@@ -18,18 +18,18 @@
static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
bool erase ); bool erase );
static int MarkItemsInBloc( EDA_LibComponentStruct* LibComponent, static int MarkItemsInBloc( LIB_COMPONENT* LibComponent,
EDA_Rect& Rect ); EDA_Rect& Rect );
static void ClearMarkItems( EDA_LibComponentStruct* LibComponent ); static void ClearMarkItems( LIB_COMPONENT* LibComponent );
static void CopyMarkedItems( EDA_LibComponentStruct* LibEntry, wxPoint offset ); static void CopyMarkedItems( LIB_COMPONENT* LibEntry, wxPoint offset );
static void MoveMarkedItems( EDA_LibComponentStruct* LibEntry, wxPoint offset ); static void MoveMarkedItems( LIB_COMPONENT* LibEntry, wxPoint offset );
static void MirrorMarkedItems( EDA_LibComponentStruct* LibEntry, static void MirrorMarkedItems( LIB_COMPONENT* LibEntry,
wxPoint offset ); wxPoint offset );
static void DeleteMarkedItems( EDA_LibComponentStruct* LibEntry ); static void DeleteMarkedItems( LIB_COMPONENT* LibEntry );
void ClearMarkItems( EDA_LibComponentStruct* LibComponent ) void ClearMarkItems( LIB_COMPONENT* LibComponent )
{ {
LibEDA_BaseStruct* item; LibEDA_BaseStruct* item;
...@@ -55,8 +55,8 @@ void ClearMarkItems( EDA_LibComponentStruct* LibComponent ) ...@@ -55,8 +55,8 @@ void ClearMarkItems( EDA_LibComponentStruct* LibComponent )
* only the pins specific to current part and current convert are marked * only the pins specific to current part and current convert are marked
* - all specific to current convert pins are marked; * - all specific to current convert pins are marked;
*/ */
int MarkItemsInBloc( EDA_LibComponentStruct* LibComponent, int MarkItemsInBloc( LIB_COMPONENT* LibComponent,
EDA_Rect& Rect ) EDA_Rect& Rect )
{ {
LibEDA_BaseStruct* item; LibEDA_BaseStruct* item;
int ItemsCount = 0; int ItemsCount = 0;
...@@ -389,7 +389,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -389,7 +389,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
/* /*
* Copy marked items, at new position = old position + offset * Copy marked items, at new position = old position + offset
*/ */
void CopyMarkedItems( EDA_LibComponentStruct* LibEntry, wxPoint offset ) void CopyMarkedItems( LIB_COMPONENT* LibEntry, wxPoint offset )
{ {
LibEDA_BaseStruct* item; LibEDA_BaseStruct* item;
...@@ -415,7 +415,7 @@ void CopyMarkedItems( EDA_LibComponentStruct* LibEntry, wxPoint offset ) ...@@ -415,7 +415,7 @@ void CopyMarkedItems( EDA_LibComponentStruct* LibEntry, wxPoint offset )
/* /*
* Move marked items, at new position = old position + offset * Move marked items, at new position = old position + offset
*/ */
void MoveMarkedItems( EDA_LibComponentStruct* LibEntry, wxPoint offset ) void MoveMarkedItems( LIB_COMPONENT* LibEntry, wxPoint offset )
{ {
LibEDA_BaseStruct* item; LibEDA_BaseStruct* item;
...@@ -437,7 +437,7 @@ void MoveMarkedItems( EDA_LibComponentStruct* LibEntry, wxPoint offset ) ...@@ -437,7 +437,7 @@ void MoveMarkedItems( EDA_LibComponentStruct* LibEntry, wxPoint offset )
/* /*
* Delete marked items * Delete marked items
*/ */
void DeleteMarkedItems( EDA_LibComponentStruct* LibEntry ) void DeleteMarkedItems( LIB_COMPONENT* LibEntry )
{ {
LibEDA_BaseStruct* item, * next_item; LibEDA_BaseStruct* item, * next_item;
...@@ -458,7 +458,7 @@ void DeleteMarkedItems( EDA_LibComponentStruct* LibEntry ) ...@@ -458,7 +458,7 @@ void DeleteMarkedItems( EDA_LibComponentStruct* LibEntry )
/* /*
* Mirror marked items, refer to a Vertical axis at position offset * Mirror marked items, refer to a Vertical axis at position offset
*/ */
void MirrorMarkedItems( EDA_LibComponentStruct* LibEntry, wxPoint offset ) void MirrorMarkedItems( LIB_COMPONENT* LibEntry, wxPoint offset )
{ {
#define SETMIRROR( z ) (z) -= offset.x; (z) = -(z); (z) += offset.x; #define SETMIRROR( z ) (z) -= offset.x; (z) = -(z); (z) += offset.x;
LibEDA_BaseStruct* item; LibEDA_BaseStruct* item;
......
...@@ -576,12 +576,12 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( ...@@ -576,12 +576,12 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef(
/* Print the B.O.M sorted by reference /* Print the B.O.M sorted by reference
*/ */
{ {
int Multi, Unit; int Multi, Unit;
EDA_BaseStruct* DrawList; EDA_BaseStruct* DrawList;
SCH_COMPONENT* DrawLibItem; SCH_COMPONENT* DrawLibItem;
EDA_LibComponentStruct* Entry; LIB_COMPONENT* Entry;
char CmpName[80]; char CmpName[80];
wxString msg; wxString msg;
if( CompactForm ) if( CompactForm )
{ {
...@@ -649,7 +649,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( ...@@ -649,7 +649,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef(
Multi = 0; Multi = 0;
Unit = ' '; Unit = ' ';
Entry = ( EDA_LibComponentStruct* ) FindLibPart( DrawLibItem->m_ChipName ); Entry = CMP_LIBRARY::FindLibraryComponent( DrawLibItem->m_ChipName );
if( Entry ) if( Entry )
Multi = Entry->m_UnitCount; Multi = Entry->m_UnitCount;
...@@ -714,17 +714,16 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( ...@@ -714,17 +714,16 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef(
int DIALOG_BUILD_BOM::PrintComponentsListByVal( int DIALOG_BUILD_BOM::PrintComponentsListByVal(
FILE* f, FILE* f,
std::vector <OBJ_CMP_TO_LIST>& aList, std::vector <OBJ_CMP_TO_LIST>& aList,
bool bool aIncludeSubComponents )
aIncludeSubComponents )
/**********************************************************************************************/ /**********************************************************************************************/
{ {
int Multi; int Multi;
wxChar Unit; wxChar Unit;
EDA_BaseStruct* DrawList; EDA_BaseStruct* DrawList;
SCH_COMPONENT* DrawLibItem; SCH_COMPONENT* DrawLibItem;
EDA_LibComponentStruct* Entry; LIB_COMPONENT* Entry;
char CmpName[80]; char CmpName[80];
wxString msg; wxString msg;
msg = _( "\n#Cmp ( order = Value )" ); msg = _( "\n#Cmp ( order = Value )" );
...@@ -749,7 +748,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByVal( ...@@ -749,7 +748,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByVal(
Multi = 0; Multi = 0;
Unit = ' '; Unit = ' ';
Entry = ( EDA_LibComponentStruct* ) FindLibPart( DrawLibItem->m_ChipName ); Entry = CMP_LIBRARY::FindLibraryComponent( DrawLibItem->m_ChipName );
if( Entry ) if( Entry )
Multi = Entry->m_UnitCount; Multi = Entry->m_UnitCount;
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
LibDrawText::LibDrawText(EDA_LibComponentStruct * aParent) : LibDrawText::LibDrawText(LIB_COMPONENT * aParent) :
LibEDA_BaseStruct( COMPONENT_GRAPHIC_TEXT_DRAW_TYPE, aParent ), LibEDA_BaseStruct( COMPONENT_GRAPHIC_TEXT_DRAW_TYPE, aParent ),
EDA_TextStruct() EDA_TextStruct()
{ {
......
This diff is collapsed.
...@@ -13,12 +13,15 @@ ...@@ -13,12 +13,15 @@
#include <boost/ptr_container/ptr_vector.hpp> #include <boost/ptr_container/ptr_vector.hpp>
class CMP_LIBRARY;
/* Types for components in libraries /* Types for components in libraries
* components can be a true component or an alias of a true component. * components can be a true component or an alias of a true component.
*/ */
enum LibrEntryType enum LibrEntryType
{ {
ROOT, /* This is a true component standard EDA_LibComponentStruct */ ROOT, /* This is a true component standard LIB_COMPONENT */
ALIAS /* This is an alias of a true component */ ALIAS /* This is an alias of a true component */
}; };
...@@ -35,7 +38,7 @@ enum LibrEntryOptions ...@@ -35,7 +38,7 @@ enum LibrEntryOptions
* *
* This class is not to be used directly. * This class is not to be used directly.
*/ */
class LibCmpEntry : public EDA_BaseStruct class CMP_LIB_ENTRY : public EDA_BaseStruct
{ {
public: public:
LibrEntryType Type; /* Type = ROOT; LibrEntryType Type; /* Type = ROOT;
...@@ -48,13 +51,16 @@ public: ...@@ -48,13 +51,16 @@ public:
LibrEntryOptions m_Options; // special features (i.e. Entry is a POWER) LibrEntryOptions m_Options; // special features (i.e. Entry is a POWER)
public: public:
LibCmpEntry( LibrEntryType CmpType, const wxChar* CmpName ); CMP_LIB_ENTRY( LibrEntryType CmpType, const wxString& name,
virtual ~LibCmpEntry(); CMP_LIBRARY* lib = NULL );
virtual ~CMP_LIB_ENTRY();
virtual wxString GetClass() const virtual wxString GetClass() const
{ {
return wxT( "LibCmpEntry" ); return wxT( "CMP_LIB_ENTRY" );
} }
wxString GetLibraryName();
const wxString& GetName() { return m_Name.m_Text; } const wxString& GetName() { return m_Name.m_Text; }
...@@ -75,15 +81,18 @@ public: ...@@ -75,15 +81,18 @@ public:
{ {
return !( *this == name ); return !( *this == name );
} }
protected:
CMP_LIBRARY* m_lib;
}; };
typedef boost::ptr_vector< LibCmpEntry > LIB_ENTRY_LIST; typedef boost::ptr_vector< CMP_LIB_ENTRY > LIB_ENTRY_LIST;
extern bool operator<( const LibCmpEntry& item1, const LibCmpEntry& item2 ); extern bool operator<( const CMP_LIB_ENTRY& item1, const CMP_LIB_ENTRY& item2 );
extern int LibraryEntryCompare( const LibCmpEntry* LE1, extern int LibraryEntryCompare( const CMP_LIB_ENTRY* LE1,
const LibCmpEntry* LE2 ); const CMP_LIB_ENTRY* LE2 );
/** /**
...@@ -93,7 +102,7 @@ extern int LibraryEntryCompare( const LibCmpEntry* LE1, ...@@ -93,7 +102,7 @@ extern int LibraryEntryCompare( const LibCmpEntry* LE1,
* library file (.lib). Library components are different from schematic * library file (.lib). Library components are different from schematic
* components. * components.
*/ */
class EDA_LibComponentStruct : public LibCmpEntry class LIB_COMPONENT : public CMP_LIB_ENTRY
{ {
public: public:
LibDrawField m_Prefix; /* Prefix ( U, IC ... ) = REFERENCE */ LibDrawField m_Prefix; /* Prefix ( U, IC ... ) = REFERENCE */
...@@ -120,12 +129,12 @@ public: ...@@ -120,12 +129,12 @@ public:
public: public:
virtual wxString GetClass() const virtual wxString GetClass() const
{ {
return wxT( "EDA_LibComponentStruct" ); return wxT( "LIB_COMPONENT" );
} }
EDA_LibComponentStruct( const wxChar* CmpName ); LIB_COMPONENT( const wxString& name, CMP_LIBRARY* lib = NULL );
~EDA_LibComponentStruct(); ~LIB_COMPONENT();
EDA_Rect GetBoundaryBox( int Unit, int Convert ); EDA_Rect GetBoundaryBox( int Unit, int Convert );
...@@ -248,19 +257,33 @@ public: ...@@ -248,19 +257,33 @@ public:
* object not as children of a library object. This would greatly * object not as children of a library object. This would greatly
* simplify searching for components in libraries. * simplify searching for components in libraries.
*/ */
class EDA_LibCmpAliasStruct : public LibCmpEntry class LIB_ALIAS : public CMP_LIB_ENTRY
{ {
public: protected:
wxString m_RootName; /* Root component Part name */ LIB_COMPONENT* m_root; /* Root component of the alias. */
public: public:
EDA_LibCmpAliasStruct( const wxChar* CmpName, const wxChar* CmpRootName ); LIB_ALIAS( const wxString& name, LIB_COMPONENT* root,
~EDA_LibCmpAliasStruct(); CMP_LIBRARY* lib = NULL );
~LIB_ALIAS();
virtual wxString GetClass() const virtual wxString GetClass() const
{ {
return wxT( "EDA_LibCmpAliasStruct" ); return wxT( "LIB_ALIAS" );
} }
/**
* Get the alias root component.
*/
LIB_COMPONENT* GetComponent( void ) const
{
return m_root;
}
/**
* Set the alias root component.
*/
void SetComponent( LIB_COMPONENT* component );
}; };
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
* *
* others = free fields * others = free fields
*/ */
LibDrawField::LibDrawField(EDA_LibComponentStruct * aParent, int idfield ) : LibDrawField::LibDrawField(LIB_COMPONENT * aParent, int idfield ) :
LibEDA_BaseStruct( COMPONENT_FIELD_DRAW_TYPE, aParent ) LibEDA_BaseStruct( COMPONENT_FIELD_DRAW_TYPE, aParent )
{ {
m_FieldId = idfield; m_FieldId = idfield;
...@@ -327,7 +327,7 @@ bool LibDrawField::HitTest( wxPoint aPosRef, int aThreshold, ...@@ -327,7 +327,7 @@ bool LibDrawField::HitTest( wxPoint aPosRef, int aThreshold,
{ {
extraCharCount++; extraCharCount++;
m_Text.Append('?'); m_Text.Append('?');
EDA_LibComponentStruct* parent = (EDA_LibComponentStruct*)m_Parent; LIB_COMPONENT* parent = (LIB_COMPONENT*)m_Parent;
if ( parent && ( parent->m_UnitCount > 1 ) ) if ( parent && ( parent->m_UnitCount > 1 ) )
{ {
m_Text.Append('A'); m_Text.Append('A');
......
...@@ -35,7 +35,7 @@ public: ...@@ -35,7 +35,7 @@ public:
LibDrawField( int idfield = 2 ); LibDrawField( int idfield = 2 );
LibDrawField( EDA_LibComponentStruct * aParent, int idfield = 2 ); LibDrawField( LIB_COMPONENT * aParent, int idfield = 2 );
~LibDrawField(); ~LibDrawField();
virtual wxString GetClass() const virtual wxString GetClass() const
{ {
......
This diff is collapsed.
This diff is collapsed.
...@@ -30,7 +30,7 @@ const wxChar* MsgPinElectricType[] = ...@@ -30,7 +30,7 @@ const wxChar* MsgPinElectricType[] =
wxT( "?????" ) wxT( "?????" )
}; };
LibDrawPin::LibDrawPin(EDA_LibComponentStruct * aParent) : LibDrawPin::LibDrawPin(LIB_COMPONENT * aParent) :
LibEDA_BaseStruct( COMPONENT_PIN_DRAW_TYPE, aParent ) LibEDA_BaseStruct( COMPONENT_PIN_DRAW_TYPE, aParent )
{ {
m_PinLen = 300; /* default Pin len */ m_PinLen = 300; /* default Pin len */
...@@ -324,7 +324,7 @@ void LibDrawPin::Draw( WinEDA_DrawPanel* aPanel, ...@@ -324,7 +324,7 @@ void LibDrawPin::Draw( WinEDA_DrawPanel* aPanel,
return; return;
} }
EDA_LibComponentStruct* Entry = GetParent(); LIB_COMPONENT* Entry = GetParent();
bool DrawPinText = true; bool DrawPinText = true;
if( ( aData != NULL ) && ( (bool*) aData == false ) ) if( ( aData != NULL ) && ( (bool*) aData == false ) )
......
...@@ -405,7 +405,7 @@ bool SCH_CMP_FIELD::Save( FILE* aFile ) const ...@@ -405,7 +405,7 @@ bool SCH_CMP_FIELD::Save( FILE* aFile ) const
void SCH_CMP_FIELD::Place( WinEDA_SchematicFrame* frame, wxDC* DC ) void SCH_CMP_FIELD::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
{ {
int fieldNdx; int fieldNdx;
EDA_LibComponentStruct* Entry; LIB_COMPONENT* Entry;
frame->DrawPanel->ManageCurseur = NULL; frame->DrawPanel->ManageCurseur = NULL;
frame->DrawPanel->ForceCloseManageCurseur = NULL; frame->DrawPanel->ForceCloseManageCurseur = NULL;
...@@ -424,7 +424,7 @@ void SCH_CMP_FIELD::Place( WinEDA_SchematicFrame* frame, wxDC* DC ) ...@@ -424,7 +424,7 @@ void SCH_CMP_FIELD::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
m_AddExtraText = 0; m_AddExtraText = 0;
if( fieldNdx == REFERENCE ) if( fieldNdx == REFERENCE )
{ {
Entry = ( EDA_LibComponentStruct* ) FindLibPart( component->m_ChipName ); Entry = CMP_LIBRARY::FindLibraryComponent( component->m_ChipName );
if( Entry != NULL ) if( Entry != NULL )
{ {
if( Entry->m_UnitCount > 1 ) if( Entry->m_UnitCount > 1 )
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
/* Local variables */ /* Local variables */
static EDA_LibComponentStruct* DummyCmp; static LIB_COMPONENT* DummyCmp;
/* Descr component <DUMMY> used when a component is not found in library, /* Descr component <DUMMY> used when a component is not found in library,
* to draw a dummy shape * to draw a dummy shape
...@@ -33,7 +33,7 @@ static EDA_LibComponentStruct* DummyCmp; ...@@ -33,7 +33,7 @@ static EDA_LibComponentStruct* DummyCmp;
*/ */
void CreateDummyCmp() void CreateDummyCmp()
{ {
DummyCmp = new EDA_LibComponentStruct( NULL ); DummyCmp = new LIB_COMPONENT( wxEmptyString );
LibDrawSquare* Square = new LibDrawSquare(DummyCmp); LibDrawSquare* Square = new LibDrawSquare(DummyCmp);
...@@ -58,8 +58,7 @@ void CreateDummyCmp() ...@@ -58,8 +58,7 @@ void CreateDummyCmp()
*****************************************************************************/ *****************************************************************************/
/* DrawMode = GrXOR, GrOR ..*/ /* DrawMode = GrXOR, GrOR ..*/
void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC, void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC,
SCH_COMPONENT* Component, SCH_COMPONENT* Component, LIB_COMPONENT* Entry,
EDA_LibComponentStruct* Entry,
const wxPoint& Pos, const int TransMat[2][2], const wxPoint& Pos, const int TransMat[2][2],
int Multi, int convert, int DrawMode, int Multi, int convert, int DrawMode,
int Color, bool DrawPinText ) int Color, bool DrawPinText )
...@@ -165,11 +164,11 @@ SCH_COMPONENT::SCH_COMPONENT( const SCH_COMPONENT& aTemplate ) : ...@@ -165,11 +164,11 @@ SCH_COMPONENT::SCH_COMPONENT( const SCH_COMPONENT& aTemplate ) :
void SCH_COMPONENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, void SCH_COMPONENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
const wxPoint& offset, int DrawMode, int Color ) const wxPoint& offset, int DrawMode, int Color )
{ {
EDA_LibComponentStruct* Entry; LIB_COMPONENT* Entry;
int ii; int ii;
bool dummy = FALSE; bool dummy = FALSE;
Entry = ( EDA_LibComponentStruct* ) FindLibPart( m_ChipName ); Entry = CMP_LIBRARY::FindLibraryComponent( m_ChipName );
if( Entry == NULL ) if( Entry == NULL )
{ {
...@@ -477,8 +476,7 @@ void SCH_COMPONENT::AddField( const SCH_CMP_FIELD& aField ) ...@@ -477,8 +476,7 @@ void SCH_COMPONENT::AddField( const SCH_CMP_FIELD& aField )
EDA_Rect SCH_COMPONENT::GetBoundaryBox() const EDA_Rect SCH_COMPONENT::GetBoundaryBox() const
{ {
EDA_LibComponentStruct* Entry = LIB_COMPONENT* Entry = CMP_LIBRARY::FindLibraryComponent( m_ChipName );
( EDA_LibComponentStruct* ) FindLibPart( m_ChipName );
EDA_Rect BoundaryBox; EDA_Rect BoundaryBox;
int x0, xm, y0, ym; int x0, xm, y0, ym;
...@@ -587,13 +585,13 @@ void SCH_COMPONENT::Place( WinEDA_SchematicFrame* frame, wxDC* DC ) ...@@ -587,13 +585,13 @@ void SCH_COMPONENT::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
*/ */
void SCH_COMPONENT::ClearAnnotation( DrawSheetPath* aSheet ) void SCH_COMPONENT::ClearAnnotation( DrawSheetPath* aSheet )
{ {
wxString defRef = m_PrefixString; wxString defRef = m_PrefixString;
bool KeepMulti = false; bool KeepMulti = false;
EDA_LibComponentStruct* Entry; LIB_COMPONENT* Entry;
wxString separators( wxT( " " ) ); wxString separators( wxT( " " ) );
wxArrayString reference_fields; wxArrayString reference_fields;
Entry = ( EDA_LibComponentStruct* ) FindLibPart( m_ChipName ); Entry = CMP_LIBRARY::FindLibraryComponent( m_ChipName );
if( Entry && Entry->m_UnitSelectionLocked ) if( Entry && Entry->m_UnitSelectionLocked )
KeepMulti = true; KeepMulti = true;
...@@ -1025,8 +1023,7 @@ EDA_Rect SCH_COMPONENT::GetBoundingBox() ...@@ -1025,8 +1023,7 @@ EDA_Rect SCH_COMPONENT::GetBoundingBox()
void SCH_COMPONENT::DisplayInfo( WinEDA_DrawFrame* frame ) void SCH_COMPONENT::DisplayInfo( WinEDA_DrawFrame* frame )
{ {
EDA_LibComponentStruct* Entry = LIB_COMPONENT* Entry = CMP_LIBRARY::FindLibraryComponent( m_ChipName );
( EDA_LibComponentStruct* ) FindLibPart( m_ChipName );
wxString msg; wxString msg;
...@@ -1045,7 +1042,8 @@ void SCH_COMPONENT::DisplayInfo( WinEDA_DrawFrame* frame ) ...@@ -1045,7 +1042,8 @@ void SCH_COMPONENT::DisplayInfo( WinEDA_DrawFrame* frame )
Affiche_1_Parametre( frame, 28, _( "RefLib" ), m_ChipName.GetData(), BROWN ); Affiche_1_Parametre( frame, 28, _( "RefLib" ), m_ChipName.GetData(), BROWN );
msg = FindLibName; msg = Entry->GetLibraryName();
Affiche_1_Parametre( frame, 40, _( "Lib" ), msg, DARKRED ); Affiche_1_Parametre( frame, 40, _( "Lib" ), msg, DARKRED );
if( Entry ) if( Entry )
......
...@@ -14,8 +14,7 @@ ...@@ -14,8 +14,7 @@
extern void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC, extern void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC,
SCH_COMPONENT* Component, SCH_COMPONENT* Component, LIB_COMPONENT* Entry,
EDA_LibComponentStruct* Entry,
const wxPoint& Pos, const int TransMat[2][2], const wxPoint& Pos, const int TransMat[2][2],
int Multi, int convert, int DrawMode, int Multi, int convert, int DrawMode,
int Color = -1, bool DrawPinText = TRUE ); int Color = -1, bool DrawPinText = TRUE );
......
...@@ -23,7 +23,7 @@ static int fill_tab[3] = { 'N', 'F', 'f' }; ...@@ -23,7 +23,7 @@ static int fill_tab[3] = { 'N', 'F', 'f' };
/* Base class (abstract) for components bodies items */ /* Base class (abstract) for components bodies items */
LibEDA_BaseStruct::LibEDA_BaseStruct( KICAD_T struct_type, LibEDA_BaseStruct::LibEDA_BaseStruct( KICAD_T struct_type,
EDA_LibComponentStruct* aParent ) : LIB_COMPONENT* aParent ) :
EDA_BaseStruct( struct_type ) EDA_BaseStruct( struct_type )
{ {
m_Unit = 0; /* Unit identification (for multi part per package) m_Unit = 0; /* Unit identification (for multi part per package)
...@@ -83,7 +83,7 @@ bool LibEDA_BaseStruct::operator==( const LibEDA_BaseStruct& other ) const ...@@ -83,7 +83,7 @@ bool LibEDA_BaseStruct::operator==( const LibEDA_BaseStruct& other ) const
/** class LibDrawArc **/ /** class LibDrawArc **/
/**********************/ /**********************/
LibDrawArc::LibDrawArc( EDA_LibComponentStruct* aParent ) : LibDrawArc::LibDrawArc( LIB_COMPONENT* aParent ) :
LibEDA_BaseStruct( COMPONENT_ARC_DRAW_TYPE, aParent ) LibEDA_BaseStruct( COMPONENT_ARC_DRAW_TYPE, aParent )
{ {
m_Radius = 0; m_Radius = 0;
...@@ -437,7 +437,7 @@ void LibDrawArc::DisplayInfo( WinEDA_DrawFrame* frame ) ...@@ -437,7 +437,7 @@ void LibDrawArc::DisplayInfo( WinEDA_DrawFrame* frame )
/** class LibDrawCircle **/ /** class LibDrawCircle **/
/*************************/ /*************************/
LibDrawCircle::LibDrawCircle( EDA_LibComponentStruct* aParent ) : LibDrawCircle::LibDrawCircle( LIB_COMPONENT* aParent ) :
LibEDA_BaseStruct( COMPONENT_CIRCLE_DRAW_TYPE, aParent ) LibEDA_BaseStruct( COMPONENT_CIRCLE_DRAW_TYPE, aParent )
{ {
m_Radius = 0; m_Radius = 0;
...@@ -645,7 +645,7 @@ void LibDrawCircle::DisplayInfo( WinEDA_DrawFrame* frame ) ...@@ -645,7 +645,7 @@ void LibDrawCircle::DisplayInfo( WinEDA_DrawFrame* frame )
/** class LibDrawSquare **/ /** class LibDrawSquare **/
/*************************/ /*************************/
LibDrawSquare::LibDrawSquare( EDA_LibComponentStruct* aParent ) : LibDrawSquare::LibDrawSquare( LIB_COMPONENT* aParent ) :
LibEDA_BaseStruct( COMPONENT_RECT_DRAW_TYPE, aParent ) LibEDA_BaseStruct( COMPONENT_RECT_DRAW_TYPE, aParent )
{ {
m_Width = 0; m_Width = 0;
...@@ -863,7 +863,7 @@ bool LibDrawSquare::HitTest( wxPoint aRefPoint, int aThreshold, ...@@ -863,7 +863,7 @@ bool LibDrawSquare::HitTest( wxPoint aRefPoint, int aThreshold,
/**************************/ /**************************/
/** class LibDrawSegment **/ /** class LibDrawSegment **/
/**************************/ /**************************/
LibDrawSegment::LibDrawSegment( EDA_LibComponentStruct* aParent ) : LibDrawSegment::LibDrawSegment( LIB_COMPONENT* aParent ) :
LibEDA_BaseStruct( COMPONENT_LINE_DRAW_TYPE, aParent ) LibEDA_BaseStruct( COMPONENT_LINE_DRAW_TYPE, aParent )
{ {
m_Width = 0; m_Width = 0;
...@@ -1015,7 +1015,7 @@ bool LibDrawSegment::HitTest( wxPoint aPosRef, int aThreshold, ...@@ -1015,7 +1015,7 @@ bool LibDrawSegment::HitTest( wxPoint aPosRef, int aThreshold,
/***************************/ /***************************/
/** class LibDrawPolyline **/ /** class LibDrawPolyline **/
/***************************/ /***************************/
LibDrawPolyline::LibDrawPolyline( EDA_LibComponentStruct* aParent ) : LibDrawPolyline::LibDrawPolyline( LIB_COMPONENT* aParent ) :
LibEDA_BaseStruct( COMPONENT_POLYLINE_DRAW_TYPE, aParent ) LibEDA_BaseStruct( COMPONENT_POLYLINE_DRAW_TYPE, aParent )
{ {
m_Fill = NO_FILL; m_Fill = NO_FILL;
...@@ -1320,7 +1320,7 @@ void LibDrawPolyline::DisplayInfo( WinEDA_DrawFrame* frame ) ...@@ -1320,7 +1320,7 @@ void LibDrawPolyline::DisplayInfo( WinEDA_DrawFrame* frame )
/***************************/ /***************************/
/** class LibDrawBezier **/ /** class LibDrawBezier **/
/***************************/ /***************************/
LibDrawBezier::LibDrawBezier( EDA_LibComponentStruct* aParent ) : LibDrawBezier::LibDrawBezier( LIB_COMPONENT* aParent ) :
LibEDA_BaseStruct( COMPONENT_BEZIER_DRAW_TYPE, aParent ) LibEDA_BaseStruct( COMPONENT_BEZIER_DRAW_TYPE, aParent )
{ {
m_Fill = NO_FILL; m_Fill = NO_FILL;
......
...@@ -105,7 +105,7 @@ public: ...@@ -105,7 +105,7 @@ public:
} }
LibEDA_BaseStruct( KICAD_T struct_type, EDA_LibComponentStruct * aParent ); LibEDA_BaseStruct( KICAD_T struct_type, LIB_COMPONENT * aParent );
virtual ~LibEDA_BaseStruct() { } virtual ~LibEDA_BaseStruct() { }
/** Function Draw (virtual pure) /** Function Draw (virtual pure)
...@@ -143,9 +143,9 @@ public: ...@@ -143,9 +143,9 @@ public:
virtual bool Save( FILE* aFile ) const = 0; virtual bool Save( FILE* aFile ) const = 0;
virtual bool Load( char* line, wxString& errorMsg ) = 0; virtual bool Load( char* line, wxString& errorMsg ) = 0;
EDA_LibComponentStruct * GetParent() LIB_COMPONENT * GetParent()
{ {
return (EDA_LibComponentStruct *)m_Parent; return (LIB_COMPONENT *)m_Parent;
} }
/** /**
...@@ -266,7 +266,7 @@ public: ...@@ -266,7 +266,7 @@ public:
int m_Width; /* Line width */ int m_Width; /* Line width */
public: public:
LibDrawPin(EDA_LibComponentStruct * aParent); LibDrawPin(LIB_COMPONENT * aParent);
~LibDrawPin() { } ~LibDrawPin() { }
LibDrawPin* Next() const { return (LibDrawPin*) Pnext; } LibDrawPin* Next() const { return (LibDrawPin*) Pnext; }
...@@ -382,7 +382,7 @@ public: ...@@ -382,7 +382,7 @@ public:
int m_Width; /* Line width */ int m_Width; /* Line width */
public: public:
LibDrawArc(EDA_LibComponentStruct * aParent); LibDrawArc(LIB_COMPONENT * aParent);
~LibDrawArc() { } ~LibDrawArc() { }
virtual wxString GetClass() const virtual wxString GetClass() const
{ {
...@@ -449,7 +449,7 @@ public: ...@@ -449,7 +449,7 @@ public:
int m_Width; /* Line width */ int m_Width; /* Line width */
public: public:
LibDrawCircle(EDA_LibComponentStruct * aParent); LibDrawCircle(LIB_COMPONENT * aParent);
~LibDrawCircle() { } ~LibDrawCircle() { }
virtual wxString GetClass() const virtual wxString GetClass() const
{ {
...@@ -514,7 +514,7 @@ protected: ...@@ -514,7 +514,7 @@ protected:
class LibDrawText : public LibEDA_BaseStruct, public EDA_TextStruct class LibDrawText : public LibEDA_BaseStruct, public EDA_TextStruct
{ {
public: public:
LibDrawText(EDA_LibComponentStruct * aParent); LibDrawText(LIB_COMPONENT * aParent);
~LibDrawText() { } ~LibDrawText() { }
virtual wxString GetClass() const virtual wxString GetClass() const
{ {
...@@ -591,7 +591,7 @@ public: ...@@ -591,7 +591,7 @@ public:
int m_Width; /* Line width */ int m_Width; /* Line width */
public: public:
LibDrawSquare(EDA_LibComponentStruct * aParent); LibDrawSquare(LIB_COMPONENT * aParent);
~LibDrawSquare() { } ~LibDrawSquare() { }
virtual wxString GetClass() const virtual wxString GetClass() const
{ {
...@@ -658,7 +658,7 @@ public: ...@@ -658,7 +658,7 @@ public:
int m_Width; /* Line width */ int m_Width; /* Line width */
public: public:
LibDrawSegment(EDA_LibComponentStruct * aParent); LibDrawSegment(LIB_COMPONENT * aParent);
~LibDrawSegment() { } ~LibDrawSegment() { }
virtual wxString GetClass() const virtual wxString GetClass() const
{ {
...@@ -723,7 +723,7 @@ public: ...@@ -723,7 +723,7 @@ public:
std::vector<wxPoint> m_PolyPoints; // list of points (>= 2) std::vector<wxPoint> m_PolyPoints; // list of points (>= 2)
public: public:
LibDrawPolyline(EDA_LibComponentStruct * aParent); LibDrawPolyline(LIB_COMPONENT * aParent);
~LibDrawPolyline() { } ~LibDrawPolyline() { }
virtual wxString GetClass() const virtual wxString GetClass() const
...@@ -800,7 +800,7 @@ public: ...@@ -800,7 +800,7 @@ public:
std::vector<wxPoint> m_PolyPoints; // list of points (>= 2) std::vector<wxPoint> m_PolyPoints; // list of points (>= 2)
public: public:
LibDrawBezier(EDA_LibComponentStruct * aParent); LibDrawBezier(LIB_COMPONENT * aParent);
~LibDrawBezier() { } ~LibDrawBezier() { }
virtual wxString GetClass() const virtual wxString GetClass() const
......
...@@ -387,8 +387,8 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList ) ...@@ -387,8 +387,8 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList )
{ {
#undef STRUCT #undef STRUCT
#define STRUCT ( (SCH_COMPONENT*) DrawItem ) #define STRUCT ( (SCH_COMPONENT*) DrawItem )
EDA_LibComponentStruct* Entry; LIB_COMPONENT* Entry;
Entry = ( EDA_LibComponentStruct* ) FindLibPart( STRUCT->m_ChipName ); Entry = CMP_LIBRARY::FindLibraryComponent( STRUCT->m_ChipName );
if( Entry == NULL ) if( Entry == NULL )
break; break;
......
...@@ -15,9 +15,10 @@ ...@@ -15,9 +15,10 @@
#include "program.h" #include "program.h"
#include "libcmp.h" #include "libcmp.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include <boost/foreach.hpp>
/* /*
* Routine de selection du nom d'un composant en librairie pour chargement, * Routine de selection du nom d'un composant en librairie pour chargement,
...@@ -34,7 +35,6 @@ ...@@ -34,7 +35,6 @@
wxString DataBaseGetName( WinEDA_DrawFrame* frame, wxString& Keys, wxString DataBaseGetName( WinEDA_DrawFrame* frame, wxString& Keys,
wxString& BufName ) wxString& BufName )
{ {
LibraryStruct* Lib;
wxArrayString nameList; wxArrayString nameList;
wxString msg; wxString msg;
...@@ -42,9 +42,9 @@ wxString DataBaseGetName( WinEDA_DrawFrame* frame, wxString& Keys, ...@@ -42,9 +42,9 @@ wxString DataBaseGetName( WinEDA_DrawFrame* frame, wxString& Keys,
Keys.MakeUpper(); Keys.MakeUpper();
/* Examen de la liste des librairies pour comptage */ /* Examen de la liste des librairies pour comptage */
for( Lib = g_LibraryList; Lib != NULL; Lib = Lib->m_Pnext ) BOOST_FOREACH( CMP_LIBRARY& lib, CMP_LIBRARY::GetLibraryList() )
{ {
Lib->SearchEntryNames( nameList, BufName, Keys ); lib.SearchEntryNames( nameList, BufName, Keys );
} }
if( nameList.IsEmpty() ) if( nameList.IsEmpty() )
...@@ -77,14 +77,9 @@ wxString DataBaseGetName( WinEDA_DrawFrame* frame, wxString& Keys, ...@@ -77,14 +77,9 @@ wxString DataBaseGetName( WinEDA_DrawFrame* frame, wxString& Keys,
void DisplayCmpDoc( wxString& Name ) void DisplayCmpDoc( wxString& Name )
{ {
LibCmpEntry* CmpEntry = NULL; CMP_LIB_ENTRY* CmpEntry = NULL;
LibraryStruct* Lib = g_LibraryList;
while( Lib != NULL && CmpEntry == NULL ) CmpEntry = CMP_LIBRARY::FindLibraryEntry( Name );
{
CmpEntry = Lib->FindEntry( Name );
Lib = Lib->m_Pnext;
}
if( CmpEntry == NULL ) if( CmpEntry == NULL )
return; return;
......
...@@ -101,7 +101,7 @@ bool WinEDA_CreateCmpDialog::Create( WinEDA_DrawFrame* parent, wxWindowID id, co ...@@ -101,7 +101,7 @@ bool WinEDA_CreateCmpDialog::Create( WinEDA_DrawFrame* parent, wxWindowID id, co
/**********************************************************************************/ /**********************************************************************************/
void WinEDA_CreateCmpDialog::SetComponentData( EDA_LibComponentStruct & component ) void WinEDA_CreateCmpDialog::SetComponentData( LIB_COMPONENT & component )
/**********************************************************************************/ /**********************************************************************************/
{ {
g_AsDeMorgan = m_AsConvert->GetValue(); g_AsDeMorgan = m_AsConvert->GetValue();
......
...@@ -94,7 +94,7 @@ public: ...@@ -94,7 +94,7 @@ public:
{ {
return m_CmpName->GetValue(); return m_CmpName->GetValue();
} }
void SetComponentData( EDA_LibComponentStruct & component ); void SetComponentData( LIB_COMPONENT & component );
////@begin WinEDA_CreateCmpDialog event handler declarations ////@begin WinEDA_CreateCmpDialog event handler declarations
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK /// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
......
...@@ -171,7 +171,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions() ...@@ -171,7 +171,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions()
else if( newname.CmpNoCase( m_Cmp->m_ChipName ) ) else if( newname.CmpNoCase( m_Cmp->m_ChipName ) )
{ {
if( FindLibPart( newname, wxEmptyString, ALIAS ) == NULL ) if( CMP_LIBRARY::FindLibraryEntry( newname ) == NULL )
{ {
wxString message; wxString message;
message.Printf( _( "Component [%s] not found!" ), newname.GetData() ); message.Printf( _( "Component [%s] not found!" ), newname.GetData() );
...@@ -263,8 +263,8 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnOKButtonClick( wxCommandEvent& event ...@@ -263,8 +263,8 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnOKButtonClick( wxCommandEvent& event
++i; ++i;
} }
EDA_LibComponentStruct* entry = LIB_COMPONENT* entry =
( EDA_LibComponentStruct* ) FindLibPart( m_Cmp->m_ChipName ); CMP_LIBRARY::FindLibraryComponent( m_Cmp->m_ChipName );
if( entry && entry->m_Options == ENTRY_POWER ) if( entry && entry->m_Options == ENTRY_POWER )
m_FieldsBuf[VALUE].m_Text = m_Cmp->m_ChipName; m_FieldsBuf[VALUE].m_Text = m_Cmp->m_ChipName;
...@@ -411,7 +411,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::InitBuffers( SCH_COMPONENT* aComponent ...@@ -411,7 +411,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::InitBuffers( SCH_COMPONENT* aComponent
{ {
m_Cmp = aComponent; m_Cmp = aComponent;
m_LibEntry = ( EDA_LibComponentStruct* ) FindLibPart( m_Cmp->m_ChipName ); m_LibEntry = CMP_LIBRARY::FindLibraryComponent( m_Cmp->m_ChipName );
#if 0 && defined(DEBUG) #if 0 && defined(DEBUG)
for( int i = 0; i<aComponent->GetFieldCount(); ++i ) for( int i = 0; i<aComponent->GetFieldCount(); ++i )
...@@ -700,12 +700,12 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp( wxCommandEvent& event ) ...@@ -700,12 +700,12 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp( wxCommandEvent& event )
/* reinitialise components parametres to default values found in lib /* reinitialise components parametres to default values found in lib
*/ */
{ {
EDA_LibComponentStruct* entry; LIB_COMPONENT* entry;
if( m_Cmp == NULL ) if( m_Cmp == NULL )
return; return;
entry = ( EDA_LibComponentStruct* ) FindLibPart( m_Cmp->m_ChipName ); entry = CMP_LIBRARY::FindLibraryComponent( m_Cmp->m_ChipName );
if( entry == NULL ) if( entry == NULL )
return; return;
......
...@@ -15,18 +15,18 @@ class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC : public DIALOG_EDIT_COMPONENT_IN_SCHEM ...@@ -15,18 +15,18 @@ class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC : public DIALOG_EDIT_COMPONENT_IN_SCHEM
friend void InstallCmpeditFrame( WinEDA_SchematicFrame* parent, wxPoint& pos, friend void InstallCmpeditFrame( WinEDA_SchematicFrame* parent, wxPoint& pos,
SCH_COMPONENT* aComponent ); SCH_COMPONENT* aComponent );
WinEDA_SchematicFrame* m_Parent; WinEDA_SchematicFrame* m_Parent;
SCH_COMPONENT* m_Cmp; SCH_COMPONENT* m_Cmp;
EDA_LibComponentStruct* m_LibEntry; LIB_COMPONENT* m_LibEntry;
bool m_skipCopyFromPanel; bool m_skipCopyFromPanel;
static int s_SelectedRow; static int s_SelectedRow;
/// The size of the dialog window last time it was displayed; /// The size of the dialog window last time it was displayed;
static wxSize s_LastSize; static wxSize s_LastSize;
/// a copy of the edited component's SCH_CMP_FIELDs /// a copy of the edited component's SCH_CMP_FIELDs
SCH_CMP_FIELDS m_FieldsBuf; SCH_CMP_FIELDS m_FieldsBuf;
void setSelectedFieldNdx( int aFieldNdx ); void setSelectedFieldNdx( int aFieldNdx );
......
...@@ -28,15 +28,15 @@ class DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB : public DIALOG_EDIT_LIBENTRY_FIELDS_IN ...@@ -28,15 +28,15 @@ class DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB : public DIALOG_EDIT_LIBENTRY_FIELDS_IN
{ {
private: private:
WinEDA_LibeditFrame* m_Parent; WinEDA_LibeditFrame* m_Parent;
EDA_LibComponentStruct* m_LibEntry; LIB_COMPONENT* m_LibEntry;
bool m_skipCopyFromPanel; bool m_skipCopyFromPanel;
/// a copy of the edited component's LibDrawFields /// a copy of the edited component's LibDrawFields
std::vector <LibDrawField> m_FieldsBuf; std::vector <LibDrawField> m_FieldsBuf;
public: public:
DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB( WinEDA_LibeditFrame* aParent, DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB( WinEDA_LibeditFrame* aParent,
EDA_LibComponentStruct* aLibEntry ); LIB_COMPONENT* aLibEntry );
~DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB(); ~DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB();
private: private:
...@@ -121,8 +121,8 @@ void WinEDA_LibeditFrame::InstallFieldsEditorDialog( void ) ...@@ -121,8 +121,8 @@ void WinEDA_LibeditFrame::InstallFieldsEditorDialog( void )
/***********************************************************************/ /***********************************************************************/
DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB(
WinEDA_LibeditFrame* aParent, WinEDA_LibeditFrame* aParent,
EDA_LibComponentStruct* aLibEntry ) : LIB_COMPONENT* aLibEntry ) :
DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE( aParent ) DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE( aParent )
/***********************************************************************/ /***********************************************************************/
{ {
......
...@@ -161,7 +161,7 @@ void DIALOG_EESCHEMA_CONFIG::OnOkClick( wxCommandEvent& event ) ...@@ -161,7 +161,7 @@ void DIALOG_EESCHEMA_CONFIG::OnOkClick( wxCommandEvent& event )
m_Parent->m_ComponentLibFiles.Add(m_ListLibr->GetString(ii) ); m_Parent->m_ComponentLibFiles.Add(m_ListLibr->GetString(ii) );
// take new list in account // take new list in account
LoadLibraries( m_Parent ); m_Parent->LoadLibraries();
if( m_Parent->m_ViewlibFrame ) if( m_Parent->m_ViewlibFrame )
m_Parent->m_ViewlibFrame->ReCreateListLib(); m_Parent->m_ViewlibFrame->ReCreateListLib();
} }
......
...@@ -56,7 +56,7 @@ void WinEDA_LibeditFrame::EditComponentProperties() ...@@ -56,7 +56,7 @@ void WinEDA_LibeditFrame::EditComponentProperties()
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::InitPanelDoc() void DIALOG_EDIT_COMPONENT_IN_LIBRARY::InitPanelDoc()
{ {
LibCmpEntry* entry; CMP_LIB_ENTRY* entry;
if( CurrentLibEntry == NULL ) if( CurrentLibEntry == NULL )
return; return;
...@@ -67,7 +67,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::InitPanelDoc() ...@@ -67,7 +67,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::InitPanelDoc()
} }
else else
{ {
entry = ( LibCmpEntry* ) CurrentLib->FindAlias( CurrentAliasName ); entry = ( CMP_LIB_ENTRY* ) CurrentLib->FindAlias( CurrentAliasName );
if( entry == NULL ) if( entry == NULL )
return; return;
...@@ -138,7 +138,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnOkClick( wxCommandEvent& event ) ...@@ -138,7 +138,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnOkClick( wxCommandEvent& event )
/* Update the doc, keyword and doc filename strings */ /* Update the doc, keyword and doc filename strings */
size_t i; size_t i;
int index; int index;
LibCmpEntry* entry; CMP_LIB_ENTRY* entry;
if( CurrentAliasName.IsEmpty() ) if( CurrentAliasName.IsEmpty() )
{ {
...@@ -155,7 +155,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnOkClick( wxCommandEvent& event ) ...@@ -155,7 +155,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnOkClick( wxCommandEvent& event )
msg.Printf( _( "Alias <%s> not found for component <%s> in library <%s>." ), msg.Printf( _( "Alias <%s> not found for component <%s> in library <%s>." ),
(const wxChar*) CurrentAliasName, (const wxChar*) CurrentAliasName,
(const wxChar*) CurrentLibEntry->GetName(), (const wxChar*) CurrentLibEntry->GetName(),
(const wxChar*) CurrentLib->m_Name ); (const wxChar*) CurrentLib->GetName() );
wxMessageBox( msg, _( "Component Library Error" ), wxMessageBox( msg, _( "Component Library Error" ),
wxID_OK | wxICON_ERROR, this ); wxID_OK | wxICON_ERROR, this );
} }
...@@ -168,7 +168,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnOkClick( wxCommandEvent& event ) ...@@ -168,7 +168,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnOkClick( wxCommandEvent& event )
if( m_PartAliasList->GetStrings() != CurrentLibEntry->m_AliasList ) if( m_PartAliasList->GetStrings() != CurrentLibEntry->m_AliasList )
{ {
EDA_LibCmpAliasStruct* alias; LIB_ALIAS* alias;
wxArrayString aliases = m_PartAliasList->GetStrings(); wxArrayString aliases = m_PartAliasList->GetStrings();
/* Add names not existing in the old alias list. */ /* Add names not existing in the old alias list. */
...@@ -179,8 +179,8 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnOkClick( wxCommandEvent& event ) ...@@ -179,8 +179,8 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnOkClick( wxCommandEvent& event )
if( index != wxNOT_FOUND ) if( index != wxNOT_FOUND )
continue; continue;
alias = new EDA_LibCmpAliasStruct( aliases[ i ], alias = new LIB_ALIAS( aliases[ i ], CurrentLibEntry );
CurrentLibEntry->GetName() );
if( !CurrentLib->AddAlias( alias ) ) if( !CurrentLib->AddAlias( alias ) )
{ {
delete alias; delete alias;
...@@ -196,7 +196,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnOkClick( wxCommandEvent& event ) ...@@ -196,7 +196,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnOkClick( wxCommandEvent& event )
if( index == wxNOT_FOUND ) if( index == wxNOT_FOUND )
continue; continue;
LibCmpEntry* alias = CMP_LIB_ENTRY* alias =
CurrentLib->FindAlias( CurrentLibEntry->m_AliasList[ i ] ); CurrentLib->FindAlias( CurrentLibEntry->m_AliasList[ i ] );
if( alias != NULL ) if( alias != NULL )
CurrentLib->RemoveEntry( alias ); CurrentLib->RemoveEntry( alias );
...@@ -318,7 +318,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::AddAliasOfPart( wxCommandEvent& WXUNUSED ...@@ -318,7 +318,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::AddAliasOfPart( wxCommandEvent& WXUNUSED
msg.Printf( _( "Alias or component name <%s> already exists in \ msg.Printf( _( "Alias or component name <%s> already exists in \
library <%s>." ), library <%s>." ),
(const wxChar*) aliasname, (const wxChar*) aliasname,
(const wxChar*) CurrentLib->m_Name ); (const wxChar*) CurrentLib->GetName() );
DisplayError( this, msg ); DisplayError( this, msg );
return; return;
} }
......
...@@ -27,7 +27,7 @@ void WinEDA_SchematicFrame::StartMoveCmpField( SCH_CMP_FIELD* aField, wxDC* DC ) ...@@ -27,7 +27,7 @@ void WinEDA_SchematicFrame::StartMoveCmpField( SCH_CMP_FIELD* aField, wxDC* DC )
/* Prepare le deplacement du texte en cours d'edition /* Prepare le deplacement du texte en cours d'edition
*/ */
{ {
EDA_LibComponentStruct* Entry; LIB_COMPONENT* Entry;
SetCurrentField( aField ); SetCurrentField( aField );
if( aField == NULL ) if( aField == NULL )
...@@ -68,7 +68,7 @@ void WinEDA_SchematicFrame::StartMoveCmpField( SCH_CMP_FIELD* aField, wxDC* DC ) ...@@ -68,7 +68,7 @@ void WinEDA_SchematicFrame::StartMoveCmpField( SCH_CMP_FIELD* aField, wxDC* DC )
m_Multiflag = 0; m_Multiflag = 0;
if( aField->m_FieldId == REFERENCE ) if( aField->m_FieldId == REFERENCE )
{ {
Entry = ( EDA_LibComponentStruct* ) FindLibPart( comp->m_ChipName ); Entry = CMP_LIBRARY::FindLibraryComponent( comp->m_ChipName );
if( Entry != NULL ) if( Entry != NULL )
{ {
...@@ -91,7 +91,7 @@ void WinEDA_SchematicFrame::EditCmpFieldText( SCH_CMP_FIELD* Field, wxDC* DC ) ...@@ -91,7 +91,7 @@ void WinEDA_SchematicFrame::EditCmpFieldText( SCH_CMP_FIELD* Field, wxDC* DC )
/* Edit the field Field (text, size) */ /* Edit the field Field (text, size) */
{ {
int fieldNdx, flag; int fieldNdx, flag;
EDA_LibComponentStruct* Entry; LIB_COMPONENT* Entry;
if( Field == NULL ) if( Field == NULL )
{ {
...@@ -104,7 +104,7 @@ void WinEDA_SchematicFrame::EditCmpFieldText( SCH_CMP_FIELD* Field, wxDC* DC ) ...@@ -104,7 +104,7 @@ void WinEDA_SchematicFrame::EditCmpFieldText( SCH_CMP_FIELD* Field, wxDC* DC )
fieldNdx = Field->m_FieldId; fieldNdx = Field->m_FieldId;
if( fieldNdx == VALUE ) if( fieldNdx == VALUE )
{ {
Entry = ( EDA_LibComponentStruct* ) FindLibPart( Cmp->m_ChipName ); Entry = CMP_LIBRARY::FindLibraryComponent( Cmp->m_ChipName );
if( Entry && (Entry->m_Options == ENTRY_POWER) ) if( Entry && (Entry->m_Options == ENTRY_POWER) )
{ {
...@@ -119,7 +119,7 @@ void WinEDA_SchematicFrame::EditCmpFieldText( SCH_CMP_FIELD* Field, wxDC* DC ) ...@@ -119,7 +119,7 @@ void WinEDA_SchematicFrame::EditCmpFieldText( SCH_CMP_FIELD* Field, wxDC* DC )
flag = 0; flag = 0;
if( fieldNdx == REFERENCE ) if( fieldNdx == REFERENCE )
{ {
Entry = ( EDA_LibComponentStruct* ) FindLibPart( Cmp->m_ChipName ); Entry = CMP_LIBRARY::FindLibraryComponent( Cmp->m_ChipName );
if( Entry != NULL ) if( Entry != NULL )
{ {
...@@ -249,7 +249,7 @@ void WinEDA_SchematicFrame::RotateCmpField( SCH_CMP_FIELD* Field, wxDC* DC ) ...@@ -249,7 +249,7 @@ void WinEDA_SchematicFrame::RotateCmpField( SCH_CMP_FIELD* Field, wxDC* DC )
/*********************************************************************************/ /*********************************************************************************/
{ {
int fieldNdx, flag; int fieldNdx, flag;
EDA_LibComponentStruct* Entry; LIB_COMPONENT* Entry;
if( Field == NULL ) if( Field == NULL )
return; return;
...@@ -262,7 +262,8 @@ void WinEDA_SchematicFrame::RotateCmpField( SCH_CMP_FIELD* Field, wxDC* DC ) ...@@ -262,7 +262,8 @@ void WinEDA_SchematicFrame::RotateCmpField( SCH_CMP_FIELD* Field, wxDC* DC )
flag = 0; flag = 0;
if( fieldNdx == REFERENCE ) if( fieldNdx == REFERENCE )
{ {
Entry = ( EDA_LibComponentStruct* ) FindLibPart( ( (SCH_COMPONENT*) Field->GetParent() )->m_ChipName ); Entry = CMP_LIBRARY::FindLibraryComponent(
( (SCH_COMPONENT*) Field->GetParent() )->m_ChipName );
if( Entry != NULL ) if( Entry != NULL )
{ {
...@@ -293,13 +294,13 @@ void WinEDA_SchematicFrame::EditComponentReference( SCH_COMPONENT* Cmp, wxDC* DC ...@@ -293,13 +294,13 @@ void WinEDA_SchematicFrame::EditComponentReference( SCH_COMPONENT* Cmp, wxDC* DC
/**************************************************************************************************/ /**************************************************************************************************/
/* Edit the component text reference*/ /* Edit the component text reference*/
{ {
EDA_LibComponentStruct* Entry; LIB_COMPONENT* Entry;
int flag = 0; int flag = 0;
if( Cmp == NULL ) if( Cmp == NULL )
return; return;
Entry = ( EDA_LibComponentStruct* ) FindLibPart( Cmp->m_ChipName ); Entry = CMP_LIBRARY::FindLibraryComponent( Cmp->m_ChipName );
if( Entry == NULL ) if( Entry == NULL )
return; return;
...@@ -334,12 +335,12 @@ void WinEDA_SchematicFrame::EditComponentValue( SCH_COMPONENT* Cmp, wxDC* DC ) ...@@ -334,12 +335,12 @@ void WinEDA_SchematicFrame::EditComponentValue( SCH_COMPONENT* Cmp, wxDC* DC )
/* Routine de changement du texte selectionne */ /* Routine de changement du texte selectionne */
{ {
wxString message; wxString message;
EDA_LibComponentStruct* Entry; LIB_COMPONENT* Entry;
if( Cmp == NULL ) if( Cmp == NULL )
return; return;
Entry = ( EDA_LibComponentStruct* ) FindLibPart( Cmp->m_ChipName ); Entry = CMP_LIBRARY::FindLibraryComponent( Cmp->m_ChipName );
if( Entry == NULL ) if( Entry == NULL )
return; return;
...@@ -372,13 +373,13 @@ void WinEDA_SchematicFrame::EditComponentFootprint( SCH_COMPONENT* Cmp, wxDC* DC ...@@ -372,13 +373,13 @@ void WinEDA_SchematicFrame::EditComponentFootprint( SCH_COMPONENT* Cmp, wxDC* DC
/*****************************************************************************************/ /*****************************************************************************************/
{ {
wxString message; wxString message;
EDA_LibComponentStruct* Entry; LIB_COMPONENT* Entry;
bool wasEmpty = false; bool wasEmpty = false;
if( Cmp == NULL ) if( Cmp == NULL )
return; return;
Entry = ( EDA_LibComponentStruct* ) FindLibPart( Cmp->m_ChipName ); Entry = CMP_LIBRARY::FindLibraryComponent( Cmp->m_ChipName );
if( Entry == NULL ) if( Entry == NULL )
return; return;
......
...@@ -233,9 +233,6 @@ bool WinEDA_SchematicFrame::LoadProjectFile( const wxString& CfgFileName, ...@@ -233,9 +233,6 @@ bool WinEDA_SchematicFrame::LoadProjectFile( const wxString& CfgFileName,
wxFileName fn; wxFileName fn;
bool IsRead = TRUE; bool IsRead = TRUE;
wxArrayString liblist_tmp = m_ComponentLibFiles; wxArrayString liblist_tmp = m_ComponentLibFiles;
WinEDA_SchematicFrame* frame;
frame = (WinEDA_SchematicFrame*)wxGetApp().GetTopWindow();
if( CfgFileName.IsEmpty() ) if( CfgFileName.IsEmpty() )
fn = g_RootSheet->m_AssociatedScreen->m_FileName; fn = g_RootSheet->m_AssociatedScreen->m_FileName;
...@@ -265,12 +262,8 @@ bool WinEDA_SchematicFrame::LoadProjectFile( const wxString& CfgFileName, ...@@ -265,12 +262,8 @@ bool WinEDA_SchematicFrame::LoadProjectFile( const wxString& CfgFileName,
if( m_ComponentLibFiles.GetCount() == 0 ) if( m_ComponentLibFiles.GetCount() == 0 )
m_ComponentLibFiles.Add( wxT( "power" ) ); m_ComponentLibFiles.Add( wxT( "power" ) );
if( frame ) SetDrawBgColor( g_DrawBgColor );
{ LoadLibraries();
frame->SetDrawBgColor( g_DrawBgColor );
}
LoadLibraries( frame );
return IsRead; return IsRead;
} }
......
...@@ -10,11 +10,12 @@ ...@@ -10,11 +10,12 @@
#include "libcmp.h" #include "libcmp.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "class_library.h"
//#define DRAW_ARC_WITH_ANGLE // Used to select function to draw arcs #include <boost/foreach.hpp>
/* Local functions */ //#define DRAW_ARC_WITH_ANGLE // Used to select function to draw arcs
/***************************************************************************/ /***************************************************************************/
...@@ -40,57 +41,6 @@ wxPoint TransformCoordinate( const int aTransformMatrix[2][2], ...@@ -40,57 +41,6 @@ wxPoint TransformCoordinate( const int aTransformMatrix[2][2],
} }
/*****************************************************************************/
/*
* Routine to find a part in one of the libraries given its name.
* Name = Name of part.
* LibName = Name of Lib; if "": seach in all libs
* Alias = Flag: si flag != 0, retourne un pointeur sur une part ou un alias
* si flag = 0, retourne un pointeur sur une part meme si le nom
* correspond a un alias
* Alias = FIND_ROOT, ou Alias = FIND_ALIAS
*/
/*****************************************************************************/
LibCmpEntry* FindLibPart( const wxChar* Name, const wxString& LibName,
LibrEntryType type )
{
LibCmpEntry* Entry = NULL;
LibraryStruct* Lib = g_LibraryList;
FindLibName.Empty();
while( Lib )
{
if( !LibName.IsEmpty() )
{
if( Lib->m_Name != LibName )
{
Lib = Lib->m_Pnext;
continue;
}
}
if( Lib == NULL )
break;
if( type == ROOT )
Entry = (LibCmpEntry*) Lib->FindComponent( Name );
else
Entry = Lib->FindEntry( Name );
if( Entry != NULL )
{
FindLibName = Lib->m_Name;
break;
}
Lib = Lib->m_Pnext;
}
return Entry;
}
/***************************************************************************** /*****************************************************************************
* Routine to rotate the given angular direction by the given Transformation. * * Routine to rotate the given angular direction by the given Transformation. *
* Input (and output) angles must be as follows: * * Input (and output) angles must be as follows: *
...@@ -162,9 +112,9 @@ bool MapAngles( int* Angle1, int* Angle2, const int TransMat[2][2] ) ...@@ -162,9 +112,9 @@ bool MapAngles( int* Angle1, int* Angle2, const int TransMat[2][2] )
* This routine is applied by the PlaceLibItem routine above. * * This routine is applied by the PlaceLibItem routine above. *
*****************************************************************************/ *****************************************************************************/
void DrawingLibInGhost( WinEDA_DrawPanel* panel, wxDC* DC, void DrawingLibInGhost( WinEDA_DrawPanel* panel, wxDC* DC,
EDA_LibComponentStruct* LibEntry, LIB_COMPONENT* LibEntry, SCH_COMPONENT* DrawLibItem,
SCH_COMPONENT* DrawLibItem, int PartX, int PartY, int PartX, int PartY, int multi, int convert,
int multi, int convert, int Color, bool DrawPinText ) int Color, bool DrawPinText )
{ {
int DrawMode = g_XorMode; int DrawMode = g_XorMode;
......
...@@ -3,113 +3,52 @@ ...@@ -3,113 +3,52 @@
/*****************************************************************/ /*****************************************************************/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "confirm.h" #include "confirm.h"
#include "kicad_string.h"
#include "gestfich.h"
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
#include "program.h" #include "program.h"
#include "libcmp.h" #include "libcmp.h"
#include "general.h" #include "general.h"
#include "protos.h"
#include "dialog_load_error.h" #include "dialog_load_error.h"
/**
* Function LoadLibraryName
*
* Routine to load the given library name. FullLibName should hold full path
* of file name to open, while LibName should hold only its name.
* If library already exists, it is NOT reloaded.
*
* @return : new lib or NULL
*/
LibraryStruct* LoadLibraryName( WinEDA_DrawFrame* frame,
const wxString& FullLibName,
const wxString& LibName )
{
LibraryStruct* NewLib;
wxFileName fn;
wxString errMsg;
if( ( NewLib = FindLibrary( LibName ) ) != NULL )
{
if( NewLib->m_FullFileName == FullLibName )
return NewLib;
delete NewLib;
}
NewLib = new LibraryStruct( LIBRARY_TYPE_EESCHEMA, LibName, FullLibName );
wxBusyCursor ShowWait;
if( NewLib->Load( errMsg ) )
{
if( g_LibraryList == NULL )
g_LibraryList = NewLib;
else
{
LibraryStruct* tmplib = g_LibraryList;
while( tmplib->m_Pnext )
tmplib = tmplib->m_Pnext;
tmplib->m_Pnext = NewLib;
}
NewLib->LoadDocs( errMsg );
}
else
{
wxString msg;
msg.Printf( _( "Error <%s> occurred attempting to load component \
library <%s>" ),
( const wxChar* ) errMsg,
( const wxChar* ) FullLibName );
DisplayError( frame, msg );
SAFE_DELETE( NewLib );
}
return NewLib;
}
/** /**
* Function LoadLibraries * Function LoadLibraries
* *
* Clear all already loaded libraries and load all librairies * Clear all already loaded libraries and load all of the project libraries.
* given in frame->m_ComponentLibFiles
*/ */
void LoadLibraries( WinEDA_SchematicFrame* frame ) void WinEDA_SchematicFrame::LoadLibraries( void )
{ {
size_t ii;
wxFileName fn; wxFileName fn;
wxString msg, tmp; wxString msg, tmp, errMsg;
wxString libraries_not_found; wxString libraries_not_found;
unsigned ii, iimax = frame->m_ComponentLibFiles.GetCount();
// Free the unwanted libraries (i.e. not in list) but keep the cache lib CMP_LIBRARY_LIST::iterator i = CMP_LIBRARY::GetLibraryList().begin();
LibraryStruct* nextlib, * lib = g_LibraryList;
for( ; lib != NULL; lib = nextlib ) /* Free the unwanted libraries but keep the cache library. */
while ( i < CMP_LIBRARY::GetLibraryList().end() )
{ {
nextlib = lib->m_Pnext; if( i->IsCache() )
if( lib->m_IsLibCache ) {
i++;
continue; continue;
}
// is this library in "wanted list" frame->m_ComponentLibFiles ? if( m_ComponentLibFiles.Index( i->GetName(), false ) == wxNOT_FOUND )
if( frame->m_ComponentLibFiles.Index( lib->m_Name ) == wxNOT_FOUND ) i = CMP_LIBRARY::GetLibraryList().erase( i );
FreeCmpLibrary( frame, lib->m_Name ); else
i++;
} }
// Load missing libraries (if any) /* Load missing libraries. */
for( ii = 0; ii < iimax; ii++ ) for( ii = 0; ii < m_ComponentLibFiles.GetCount(); ii++ )
{ {
fn = frame->m_ComponentLibFiles[ii]; fn = m_ComponentLibFiles[ii];
fn.SetExt( CompLibFileExtension ); fn.SetExt( CompLibFileExtension );
/* Skip if the file name is not valid.. */
if( !fn.IsOk() ) if( !fn.IsOk() )
continue; continue;
...@@ -129,164 +68,46 @@ void LoadLibraries( WinEDA_SchematicFrame* frame ) ...@@ -129,164 +68,46 @@ void LoadLibraries( WinEDA_SchematicFrame* frame )
// Loaded library statusbar message // Loaded library statusbar message
msg = _( "Library " ) + tmp; msg = _( "Library " ) + tmp;
fn = tmp;
if( LoadLibraryName( frame, tmp, fn.GetName() ) ) if( CMP_LIBRARY::AddLibrary( fn, errMsg ) )
{
msg += _( " loaded" ); msg += _( " loaded" );
}
else else
{
wxString prompt;
prompt.Printf( _( "Component library <%s> failed to load.\n\n\
Error: %s" ),
( const wxChar* ) fn.GetFullPath(),
( const wxChar* ) errMsg );
DisplayError( this, prompt );
msg += _( " error!" ); msg += _( " error!" );
}
frame->PrintMsg( msg ); PrintMsg( msg );
} }
/* Print the libraries not found */ /* Print the libraries not found */
if( !libraries_not_found.IsEmpty() ) if( !libraries_not_found.IsEmpty() )
{ {
DIALOG_LOAD_ERROR dialog( frame ); DIALOG_LOAD_ERROR dialog( this );
dialog.MessageSet( _( "The following libraries could not be found:" ) ); dialog.MessageSet( _( "The following libraries could not be found:" ) );
dialog.ListSet( libraries_not_found ); dialog.ListSet( libraries_not_found );
libraries_not_found.empty(); libraries_not_found.empty();
dialog.ShowModal(); dialog.ShowModal();
} }
// reorder the linked list to match the order filename list: /* Put the libraries in the correct order. */
int NumOfLibs = 0; CMP_LIBRARY::SetSortOrder( m_ComponentLibFiles );
CMP_LIBRARY::GetLibraryList().sort();
for( lib = g_LibraryList; lib != NULL; lib = lib->m_Pnext )
{
lib->m_Flags = 0;
NumOfLibs++;
}
if( NumOfLibs == 0 )
return;
LibraryStruct** libs =
(LibraryStruct**) MyZMalloc( sizeof(LibraryStruct*) * (NumOfLibs + 2) );
int jj = 0;
for( ii = 0; ii < frame->m_ComponentLibFiles.GetCount(); ii++ )
{
if( jj >= NumOfLibs )
break;
fn = frame->m_ComponentLibFiles[ii];
lib = FindLibrary( fn.GetName() );
if( lib )
{
lib->m_Flags = 1;
libs[jj++] = lib;
}
}
/* Put lib cache at end of list */
for( lib = g_LibraryList; lib != NULL; lib = lib->m_Pnext )
{
if( lib->m_Flags == 0 )
libs[jj++] = lib;
}
libs[jj] = NULL;
/* Change the linked list pointers */
for( ii = 0; libs[ii] != NULL; ii++ )
libs[ii]->m_Pnext = libs[ii + 1];
g_LibraryList = libs[0];
MyFree( libs );
for( lib = g_LibraryList; lib != NULL; lib = lib->m_Pnext )
lib->m_Flags = 0;
}
/**
* Function FreeCmpLibrary
*
* Routine to remove and free a library from the current loaded libraries.
*/
void FreeCmpLibrary( wxWindow* frame, const wxString& LibName )
{
int NumOfLibs = NumOfLibraries();
LibraryStruct* Lib, * TempLib;
if( NumOfLibs == 0 )
{
DisplayError( frame, wxT( "No libraries are loaded" ), 20 );
return;
}
/* Search for this library name: */
for( Lib = g_LibraryList; Lib != NULL; Lib = Lib->m_Pnext )
{
if( LibName == Lib->m_Name )
break;
}
if( Lib == NULL )
return;
if( Lib == g_LibraryList )
g_LibraryList = Lib->m_Pnext;
else
{
for( TempLib = g_LibraryList; TempLib->m_Pnext != Lib;
TempLib = TempLib->m_Pnext )
;
TempLib->m_Pnext = TempLib->m_Pnext->m_Pnext;
}
SAFE_DELETE( Lib );
/* The removed librairy can be the current library in libedit.
* If so, clear the current library in libedit */
if( Lib == CurrentLib )
CurrentLib = NULL;
}
/**
* Function LibraryEntryCompare
*
* Routine to compare two EDA_LibComponentStruct for the PriorQue module.
* Comparison (insensitive case) is based on Part name.
*/
int LibraryEntryCompare( EDA_LibComponentStruct* LE1,
EDA_LibComponentStruct* LE2 )
{
return LE1->m_Name.m_Text.CmpNoCase( LE2->m_Name.m_Text );
}
/*****************************************************************************
* Routine to find the library given its name.
*****************************************************************************/
LibraryStruct* FindLibrary( const wxString& Name )
{
LibraryStruct* Lib = g_LibraryList;
while( Lib )
{
if( *Lib == Name )
return Lib;
Lib = Lib->m_Pnext;
}
return NULL;
}
/*****************************************************************************
* Routine to find the number of libraries currently loaded.
*****************************************************************************/
int NumOfLibraries()
{
int ii;
LibraryStruct* Lib = g_LibraryList;
for( ii = 0; Lib != NULL; Lib = Lib->m_Pnext ) #ifdef __WXDEBUG__
ii++; wxLogDebug( wxT( "Component library sort order:" ) );
return ii; for ( i = CMP_LIBRARY::GetLibraryList().begin();
i < CMP_LIBRARY::GetLibraryList().end(); i++ )
wxLogDebug( wxT( " " ) + i->GetName() );
#endif
} }
...@@ -256,14 +256,15 @@ void DrawStructsInGhost( WinEDA_DrawPanel * aPanel, wxDC * aDC, SCH_ITEM * aItem ...@@ -256,14 +256,15 @@ void DrawStructsInGhost( WinEDA_DrawPanel * aPanel, wxDC * aDC, SCH_ITEM * aItem
case TYPE_SCH_COMPONENT: case TYPE_SCH_COMPONENT:
{ {
EDA_LibComponentStruct* LibEntry; LIB_COMPONENT* LibEntry;
SCH_COMPONENT* Struct; SCH_COMPONENT* Struct;
Struct = (SCH_COMPONENT*) aItem; Struct = (SCH_COMPONENT*) aItem;
LibEntry = ( EDA_LibComponentStruct* ) FindLibPart( Struct->m_ChipName ); LibEntry = CMP_LIBRARY::FindLibraryComponent( Struct->m_ChipName );
if( LibEntry == NULL ) if( LibEntry == NULL )
break; break;
DrawingLibInGhost( aPanel, aDC, LibEntry, Struct, Struct->m_Pos.x + aOffset.x, DrawingLibInGhost( aPanel, aDC, LibEntry, Struct,
Struct->m_Pos.x + aOffset.x,
Struct->m_Pos.y + aOffset.y, Struct->m_Multi, Struct->m_Pos.y + aOffset.y, Struct->m_Multi,
Struct->m_Convert, g_GhostColor, FALSE ); Struct->m_Convert, g_GhostColor, FALSE );
break; break;
......
...@@ -21,8 +21,6 @@ ...@@ -21,8 +21,6 @@
// Global variables // Global variables
LibraryStruct* g_LibraryList; // All part libs are saved here.
int g_OptNetListUseNames; /* TRUE pour utiliser les noms de net plutot que int g_OptNetListUseNames; /* TRUE pour utiliser les noms de net plutot que
* les numeros (netlist PSPICE seulement) */ * les numeros (netlist PSPICE seulement) */
SCH_ITEM* g_ItemToRepeat; /* pointeur sur la derniere structure SCH_ITEM* g_ItemToRepeat; /* pointeur sur la derniere structure
...@@ -103,8 +101,8 @@ int g_InvisibleItemColor = DARKGRAY; ...@@ -103,8 +101,8 @@ int g_InvisibleItemColor = DARKGRAY;
LibEDA_BaseStruct* LibItemToRepeat = NULL; /* pointer on a graphic item than LibEDA_BaseStruct* LibItemToRepeat = NULL; /* pointer on a graphic item than
* can be duplicated by the Ins key * can be duplicated by the Ins key
* (usually the last created item */ * (usually the last created item */
LibraryStruct* CurrentLib = NULL; /* Current opened library */ CMP_LIBRARY* CurrentLib = NULL; /* Current opened library */
EDA_LibComponentStruct* CurrentLibEntry = NULL; /* Current component */ LIB_COMPONENT* CurrentLibEntry = NULL; /* Current component */
LibEDA_BaseStruct* CurrentDrawItem = NULL; /* current edited item */ LibEDA_BaseStruct* CurrentDrawItem = NULL; /* current edited item */
// Current selected alias (for components which have aliases) // Current selected alias (for components which have aliases)
...@@ -115,9 +113,6 @@ bool g_AsDeMorgan; ...@@ -115,9 +113,6 @@ bool g_AsDeMorgan;
int CurrentUnit = 1; int CurrentUnit = 1;
int CurrentConvert = 1; int CurrentConvert = 1;
/* Library (name) containing the last component find by FindLibPart() */
wxString FindLibName;
int DefaultTransformMatrix[2][2] = { { 1, 0 }, { 0, -1 } }; int DefaultTransformMatrix[2][2] = { { 1, 0 }, { 0, -1 } };
......
/****************************/ /****************************/
/* EESCHEMA - files-io.cpp */ /* EESCHEMA - files-io.cpp */
/****************************/ /****************************/
#include "fctsys.h" #include "fctsys.h"
...@@ -45,19 +45,18 @@ void WinEDA_SchematicFrame::Save_File( wxCommandEvent& event ) ...@@ -45,19 +45,18 @@ void WinEDA_SchematicFrame::Save_File( wxCommandEvent& event )
} }
/************************************************************************************/ /*
* Load an entire project
*
* Schematic root file and its subhierarchies, the configuration and the libs
* which are not already loaded)
*/
int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName, int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName,
bool IsNew ) bool IsNew )
/************************************************************************************/
{ {
/*
* Load an entire project
* ( schematic root file and its subhierarchies, the configuration and the libs
* which are not already loaded)
*/
SCH_SCREEN* screen; SCH_SCREEN* screen;
wxString FullFileName, msg; wxString FullFileName, msg;
bool LibCacheExist = FALSE; bool LibCacheExist = false;
EDA_ScreenList ScreenList; EDA_ScreenList ScreenList;
...@@ -133,13 +132,7 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName, ...@@ -133,13 +132,7 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName,
LoadProjectFile( wxEmptyString, FALSE ); LoadProjectFile( wxEmptyString, FALSE );
// Delete old caches. // Delete old caches.
LibraryStruct* nextlib, * lib = g_LibraryList; CMP_LIBRARY::RemoveCacheLibrary();
for( ; lib != NULL; lib = nextlib )
{
nextlib = lib->m_Pnext;
if( lib->m_IsLibCache )
FreeCmpLibrary( this, lib->m_Name );
}
if( IsNew ) if( IsNew )
{ {
...@@ -164,29 +157,44 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName, ...@@ -164,29 +157,44 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName,
fn.SetExt( wxT( "cache.lib" ) ); fn.SetExt( wxT( "cache.lib" ) );
use_oldcachename = true; use_oldcachename = true;
} }
if( fn.FileExists() ) if( fn.FileExists() )
{ {
wxString errMsg;
wxLogDebug( wxT( "Load schematic cache library file <%s>" ), wxLogDebug( wxT( "Load schematic cache library file <%s>" ),
fn.GetFullPath().c_str() ); fn.GetFullPath().c_str() );
msg = wxT( "Load " ) + fn.GetFullPath(); msg = wxT( "Load " ) + fn.GetFullPath();
LibraryStruct* LibCache = LoadLibraryName( this, fn.GetFullPath(),
fn.GetName() ); CMP_LIBRARY* LibCache = CMP_LIBRARY::LoadLibrary( fn, errMsg );
if( LibCache ) if( LibCache )
{ {
LibCache->m_IsLibCache = TRUE; LibCache->SetCache();
msg += wxT( " OK" ); msg += wxT( " OK" );
if ( use_oldcachename ) // set the new name if ( use_oldcachename ) // set the new name
{ {
fn.SetName(cachename); fn.SetName(cachename);
fn.SetExt( CompLibFileExtension ); fn.SetExt( CompLibFileExtension );
LibCache->m_Name = fn.GetName(); LibCache->SetFileName( fn );
LibCache->m_FullFileName = fn.GetFullPath();
} }
LibCacheExist = true;
CMP_LIBRARY::GetLibraryList().push_back( LibCache );
} }
else else
{
wxString prompt;
prompt.Printf( _( "Component library <%s> failed to load.\n\n\
Error: %s" ),
( const wxChar* ) fn.GetFullPath(),
( const wxChar* ) errMsg );
DisplayError( this, prompt );
msg += wxT( " ->Error" ); msg += wxT( " ->Error" );
}
PrintMsg( msg ); PrintMsg( msg );
LibCacheExist = TRUE;
} }
if( !wxFileExists( g_RootSheet->m_AssociatedScreen->m_FileName ) if( !wxFileExists( g_RootSheet->m_AssociatedScreen->m_FileName )
...@@ -194,7 +202,7 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName, ...@@ -194,7 +202,7 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName,
{ {
Zoom_Automatique( FALSE ); Zoom_Automatique( FALSE );
msg.Printf( _( "File <%s> not found." ), msg.Printf( _( "File <%s> not found." ),
g_RootSheet->m_AssociatedScreen->m_FileName.GetData() ); g_RootSheet->m_AssociatedScreen->m_FileName.GetData() );
DisplayInfoMessage( this, msg, 0 ); DisplayInfoMessage( this, msg, 0 );
return -1; return -1;
} }
......
...@@ -8,18 +8,21 @@ ...@@ -8,18 +8,21 @@
* in current sheet or whole the project * in current sheet or whole the project
*/ */
#include "fctsys.h" #include "fctsys.h"
//#include "gr_basic.h"
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
#include "common.h" #include "common.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "confirm.h" #include "confirm.h"
#include "kicad_string.h" #include "kicad_string.h"
#include "gestfich.h" #include "gestfich.h"
#include "program.h" #include "program.h"
#include "libcmp.h" #include "libcmp.h"
#include "general.h" #include "general.h"
#include "class_marker_sch.h" #include "class_marker_sch.h"
#include "protos.h"
#include <boost/foreach.hpp>
/* Variables Locales */ /* Variables Locales */
static int s_ItemsCount, s_MarkerCount; static int s_ItemsCount, s_MarkerCount;
...@@ -28,9 +31,6 @@ static wxString s_OldStringFound; ...@@ -28,9 +31,6 @@ static wxString s_OldStringFound;
#include "dialog_find.cpp" #include "dialog_find.cpp"
#include "protos.h"
/**************************************************************/ /**************************************************************/
void WinEDA_FindFrame::FindMarker( wxCommandEvent& event ) void WinEDA_FindFrame::FindMarker( wxCommandEvent& event )
/**************************************************************/ /**************************************************************/
...@@ -645,25 +645,25 @@ void WinEDA_FindFrame::LocatePartInLibs( wxCommandEvent& event ) ...@@ -645,25 +645,25 @@ void WinEDA_FindFrame::LocatePartInLibs( wxCommandEvent& event )
s_OldStringFound = Text; s_OldStringFound = Text;
if( NumOfLibraries() == 0 ) if( CMP_LIBRARY::GetLibraryCount() == 0 )
{ {
DisplayError( this, _( "No libraries are loaded" ) ); DisplayError( this, _( "No component libraries are loaded." ) );
Close(); Close();
return; return;
} }
int nbitemsFound = 0; int nbitemsFound = 0;
for( LibraryStruct* Lib = g_LibraryList; Lib != NULL; Lib = Lib->m_Pnext ) BOOST_FOREACH( CMP_LIBRARY& lib, CMP_LIBRARY::GetLibraryList() )
{ {
Lib->SearchEntryNames( nameList, Text ); lib.SearchEntryNames( nameList, Text );
if( nameList.IsEmpty() ) if( nameList.IsEmpty() )
continue; continue;
nbitemsFound += nameList.GetCount(); nbitemsFound += nameList.GetCount();
if( !Lib->m_IsLibCache ) if( !lib.IsCache() )
FoundInLib = true; FoundInLib = true;
for( size_t i = 0; i < nameList.GetCount(); i++ ) for( size_t i = 0; i < nameList.GetCount(); i++ )
...@@ -671,7 +671,7 @@ void WinEDA_FindFrame::LocatePartInLibs( wxCommandEvent& event ) ...@@ -671,7 +671,7 @@ void WinEDA_FindFrame::LocatePartInLibs( wxCommandEvent& event )
if( !FindList.IsEmpty() ) if( !FindList.IsEmpty() )
FindList += wxT( "\n" ); FindList += wxT( "\n" );
FindList << _( "Found " ) + nameList[i] + _( " in library " ) FindList << _( "Found " ) + nameList[i] + _( " in library " )
+ Lib->m_Name; + lib.GetName();
} }
} }
......
...@@ -94,8 +94,6 @@ typedef enum { ...@@ -94,8 +94,6 @@ typedef enum {
/* variables generales */ /* variables generales */
extern LibraryStruct* g_LibraryList; // All part libs are saved here.
extern int g_OptNetListUseNames; /* TRUE pour utiliser les noms de net plutot que extern int g_OptNetListUseNames; /* TRUE pour utiliser les noms de net plutot que
* les numeros (netlist PSPICE seulement) */ * les numeros (netlist PSPICE seulement) */
extern SCH_ITEM* g_ItemToRepeat; /* pointeur sur la derniere structure extern SCH_ITEM* g_ItemToRepeat; /* pointeur sur la derniere structure
......
...@@ -8,11 +8,15 @@ ...@@ -8,11 +8,15 @@
#include "common.h" #include "common.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "confirm.h" #include "confirm.h"
#include "get_component_dialog.h" #include "get_component_dialog.h"
#include "program.h" #include "program.h"
#include "libcmp.h" #include "libcmp.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "class_library.h"
#include <boost/foreach.hpp>
/* Routines Locales */ /* Routines Locales */
...@@ -65,36 +69,28 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC, ...@@ -65,36 +69,28 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
wxArrayString& HistoryList, wxArrayString& HistoryList,
bool UseLibBrowser ) bool UseLibBrowser )
{ {
int ii, CmpCount = 0; int ii, CmpCount = 0;
EDA_LibComponentStruct* Entry = NULL; LIB_COMPONENT* Entry = NULL;
SCH_COMPONENT* Component = NULL; SCH_COMPONENT* Component = NULL;
LibraryStruct* Library = NULL; CMP_LIBRARY* Library = NULL;
wxString Name, keys, msg; wxString Name, keys, msg;
bool AllowWildSeach = TRUE; bool AllowWildSeach = TRUE;
g_ItemToRepeat = NULL; g_ItemToRepeat = NULL;
DrawPanel->m_IgnoreMouseEvents = TRUE; DrawPanel->m_IgnoreMouseEvents = TRUE;
if( !libname.IsEmpty() ) if( !libname.IsEmpty() )
{ {
Library = g_LibraryList; Library = CMP_LIBRARY::FindLibrary( libname );
while( Library )
{ if( Library != NULL )
if( Library->GetName().CmpNoCase( libname ) == 0 ) CmpCount = Library->GetCount();
{
CmpCount = Library->GetCount();
break;
}
Library = Library->m_Pnext;
}
} }
else else
{ {
LibraryStruct* lib = g_LibraryList; BOOST_FOREACH( CMP_LIBRARY& lib, CMP_LIBRARY::GetLibraryList() )
while( lib )
{ {
CmpCount += lib->GetCount(); CmpCount += lib.GetCount();
lib = lib->m_Pnext;
} }
} }
...@@ -145,7 +141,7 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC, ...@@ -145,7 +141,7 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
} }
} }
Entry = ( EDA_LibComponentStruct* ) FindLibPart( Name, libname ); Entry = CMP_LIBRARY::FindLibraryComponent( Name, libname );
if( (Entry == NULL) && AllowWildSeach ) /* Attemp to search with wildcard */ if( (Entry == NULL) && AllowWildSeach ) /* Attemp to search with wildcard */
{ {
...@@ -155,7 +151,7 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC, ...@@ -155,7 +151,7 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
Name = DataBaseGetName( this, keys, Name ); Name = DataBaseGetName( this, keys, Name );
if( !Name.IsEmpty() ) if( !Name.IsEmpty() )
Entry = ( EDA_LibComponentStruct* ) FindLibPart( Name, libname ); Entry = CMP_LIBRARY::FindLibraryComponent( Name, libname );
if( Entry == NULL ) if( Entry == NULL )
{ {
...@@ -347,12 +343,12 @@ void WinEDA_SchematicFrame::SelPartUnit( SCH_COMPONENT* DrawComponent, ...@@ -347,12 +343,12 @@ void WinEDA_SchematicFrame::SelPartUnit( SCH_COMPONENT* DrawComponent,
int unit, wxDC* DC ) int unit, wxDC* DC )
{ {
int m_UnitCount; int m_UnitCount;
EDA_LibComponentStruct* LibEntry; LIB_COMPONENT* LibEntry;
if( DrawComponent == NULL ) if( DrawComponent == NULL )
return; return;
LibEntry = ( EDA_LibComponentStruct* ) FindLibPart( DrawComponent->m_ChipName ); LibEntry = CMP_LIBRARY::FindLibraryComponent( DrawComponent->m_ChipName );
if( LibEntry == NULL ) if( LibEntry == NULL )
return; return;
...@@ -395,12 +391,12 @@ void WinEDA_SchematicFrame::ConvertPart( SCH_COMPONENT* DrawComponent, ...@@ -395,12 +391,12 @@ void WinEDA_SchematicFrame::ConvertPart( SCH_COMPONENT* DrawComponent,
wxDC* DC ) wxDC* DC )
{ {
int ii; int ii;
EDA_LibComponentStruct* LibEntry; LIB_COMPONENT* LibEntry;
if( DrawComponent == NULL ) if( DrawComponent == NULL )
return; return;
LibEntry = ( EDA_LibComponentStruct* ) FindLibPart( DrawComponent->m_ChipName ); LibEntry = CMP_LIBRARY::FindLibraryComponent( DrawComponent->m_ChipName );
if( LibEntry == NULL ) if( LibEntry == NULL )
return; return;
...@@ -441,7 +437,7 @@ void WinEDA_SchematicFrame::ConvertPart( SCH_COMPONENT* DrawComponent, ...@@ -441,7 +437,7 @@ void WinEDA_SchematicFrame::ConvertPart( SCH_COMPONENT* DrawComponent,
* Si il y a une representation type "convert", * Si il y a une representation type "convert",
* la valeur retournee est > 1 (typiquement 2) * la valeur retournee est > 1 (typiquement 2)
*/ */
int LookForConvertPart( EDA_LibComponentStruct* LibEntry ) int LookForConvertPart( LIB_COMPONENT* LibEntry )
{ {
int ii; int ii;
LibEDA_BaseStruct* DrawLibEntry; LibEDA_BaseStruct* DrawLibEntry;
......
...@@ -13,15 +13,13 @@ ...@@ -13,15 +13,13 @@
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "confirm.h" #include "confirm.h"
#include "gestfich.h" #include "gestfich.h"
#include "id.h"
#include "program.h" #include "program.h"
#include "libcmp.h" #include "libcmp.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "id.h"
#include <wx/filename.h> #include <wx/filename.h>
...@@ -37,10 +35,10 @@ extern int ExportPartId; ...@@ -37,10 +35,10 @@ extern int ExportPartId;
/*************************************************/ /*************************************************/
void WinEDA_LibeditFrame::OnImportPart( wxCommandEvent& event ) void WinEDA_LibeditFrame::OnImportPart( wxCommandEvent& event )
{ {
wxString errMsg;
wxFileName fn; wxFileName fn;
LibraryStruct* LibTmp; CMP_LIBRARY* LibTmp;
LibCmpEntry* LibEntry; CMP_LIB_ENTRY* LibEntry;
bool entryLoaded = false;
LibItemToRepeat = NULL; LibItemToRepeat = NULL;
...@@ -51,33 +49,35 @@ void WinEDA_LibeditFrame::OnImportPart( wxCommandEvent& event ) ...@@ -51,33 +49,35 @@ void WinEDA_LibeditFrame::OnImportPart( wxCommandEvent& event )
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
return; return;
LibTmp = g_LibraryList; fn = dlg.GetPath();
g_LibraryList = NULL;
LibTmp = CMP_LIBRARY::LoadLibrary( fn, errMsg );
if( LibTmp == NULL )
return;
LoadLibraryName( this, dlg.GetPath(), wxT( "$tmplib$" ) ); LibEntry = LibTmp->GetFirstEntry();
if( g_LibraryList ) if( LibEntry == NULL )
{ {
LibEntry = g_LibraryList->GetFirstEntry(); wxString msg;
if( LibEntry ) msg.Printf( _( "Component library file <%s> is empty." ),
entryLoaded = LoadOneLibraryPartAux( LibEntry, g_LibraryList ); (const wxChar*) fn.GetFullPath() );
FreeCmpLibrary( this, g_LibraryList->m_Name ); DisplayError( this, msg );
return;
if( entryLoaded )
{
fn = dlg.GetPath();
m_LastLibImportPath = fn.GetPath();
ReCreateHToolbar();
DisplayLibInfos();
GetScreen()->ClearUndoRedoList();
DrawPanel->Refresh();
}
else
DisplayError( this, _( "File is empty" ) );
} }
g_LibraryList = LibTmp; if( LoadOneLibraryPartAux( LibEntry, LibTmp ) )
{
fn = dlg.GetPath();
m_LastLibImportPath = fn.GetPath();
DisplayLibInfos();
GetScreen()->ClearUndoRedoList();
DrawPanel->Refresh();
}
delete LibTmp;
} }
...@@ -90,18 +90,18 @@ void WinEDA_LibeditFrame::OnImportPart( wxCommandEvent& event ) ...@@ -90,18 +90,18 @@ void WinEDA_LibeditFrame::OnImportPart( wxCommandEvent& event )
*/ */
void WinEDA_LibeditFrame::OnExportPart( wxCommandEvent& event ) void WinEDA_LibeditFrame::OnExportPart( wxCommandEvent& event )
{ {
wxFileName fn; wxFileName fn;
wxString Name, mask, title; wxString msg, title;
LibraryStruct* NewLib, * LibTmp, * CurLibTmp; CMP_LIBRARY* CurLibTmp;
bool createLib = ( event.GetId() == ExportPartId ) ? false : true; bool createLib = ( event.GetId() != ExportPartId ) ? false : true;
if( CurrentLibEntry == NULL ) if( CurrentLibEntry == NULL )
{ {
DisplayError( this, _( "No Part to Save" ), 10 ); DisplayError( this, _( "There is no component selected to save." ) );
return; return;
} }
fn = CurrentLibEntry->m_Name.m_Text.Lower(); fn = CurrentLibEntry->GetName().Lower();
fn.SetExt( CompLibFileExtension ); fn.SetExt( CompLibFileExtension );
title = createLib ? _( "New Library" ) : _( "Export Component" ); title = createLib ? _( "New Library" ) : _( "Export Component" );
...@@ -114,38 +114,26 @@ void WinEDA_LibeditFrame::OnExportPart( wxCommandEvent& event ) ...@@ -114,38 +114,26 @@ void WinEDA_LibeditFrame::OnExportPart( wxCommandEvent& event )
fn = dlg.GetPath(); fn = dlg.GetPath();
/* Creation d'une librairie standard pour sauvegarde */
LibTmp = g_LibraryList;
CurLibTmp = CurrentLib; CurLibTmp = CurrentLib;
NewLib = new LibraryStruct( LIBRARY_TYPE_EESCHEMA, wxT( "$libTmp$" ), CurrentLib = new CMP_LIBRARY( LIBRARY_TYPE_EESCHEMA, fn );
fn.GetFullName() );
g_LibraryList = NewLib;
/* Sauvegarde du composant: */
CurrentLib = NewLib;
SaveOnePartInMemory(); SaveOnePartInMemory();
bool success = NewLib->Save( fn.GetFullPath() );
bool success = CurrentLib->Save( fn.GetFullPath() );
if( success ) if( success )
{
m_LastLibExportPath = fn.GetPath(); m_LastLibExportPath = fn.GetPath();
}
/* Suppression de la librarie temporaire */ delete CurrentLib;
FreeCmpLibrary( this, NewLib->m_Name ); CurrentLib = CurLibTmp;
g_LibraryList = LibTmp;
CurrentLib = CurLibTmp;
wxString msg;
if( createLib && success ) if( createLib && success )
{ {
msg = fn.GetFullPath() + _( " - OK" ); msg = fn.GetFullPath() + _( " - OK" );
DisplayInfoMessage( this, DisplayInfoMessage( this, _( "This library will not be available \
_( "Note: this new library will be available only \ until it is loaded by EESchema.\nModify the EESchema library configuration \
if it is loaded by eeschema.\nModify eeschema config if you want use it." ) ); if you want to include it as part of this project." ) );
} }
else else
msg = _( "Error creating " ) + fn.GetFullName(); msg = _( "Error creating " ) + fn.GetFullName();
......
...@@ -2,123 +2,61 @@ ...@@ -2,123 +2,61 @@
/* libarch.cc */ /* libarch.cc */
/* Module de generation du fichier d'archivage des composants */ /* Module de generation du fichier d'archivage des composants */
/**************************************************************/ /**************************************************************/
#include <algorithm> // to use sort vector
#include <vector>
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
#include "confirm.h" #include "confirm.h"
#include "kicad_string.h"
#include "gestfich.h"
#include "program.h" #include "program.h"
#include "libcmp.h" #include "libcmp.h"
#include "general.h" #include "general.h"
#include "netlist.h" #include "netlist.h"
#include "protos.h" #include "protos.h"
/* Local functions*/
static bool SortCmpByName( const EDA_LibComponentStruct* Objet1,
const EDA_LibComponentStruct* Objet2 );
/*******************************************************************/
bool LibArchive( wxWindow* frame, const wxString& ArchFullFileName )
/*******************************************************************/
/* /*
* Creates a library that contains all components used in the whole hierarchy * Creates a library that contains all components used in the schematic.
*
* return true if success * return true if success
*/ */
bool LibArchive( wxWindow* frame, const wxString& ArchFullFileName )
{ {
wxFileName docFileName; wxString msg;
wxString msg; LIB_COMPONENT* Entry;
char Line[256]; CMP_LIBRARY* libCache;
FILE* ArchiveFile, * DocFile;
EDA_LibComponentStruct* Entry;
std::vector <EDA_LibComponentStruct*> ListEntry;
EDA_ScreenList ScreenList; EDA_ScreenList ScreenList;
/* examine all screens (not scheets) used and build the list of components found in lib libCache = new CMP_LIBRARY( LIBRARY_TYPE_EESCHEMA, ArchFullFileName );
* complex hierarchies are not a problem because we just want to know used components in libraries libCache->SetCache();
/* examine all screens (not scheets) used and build the list of components
* found in lib complex hierarchies are not a problem because we just want
* to know used components in libraries
*/ */
for( SCH_SCREEN* screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() ) for( SCH_SCREEN* screen = ScreenList.GetFirst(); screen != NULL;
screen = ScreenList.GetNext() )
{ {
for( SCH_ITEM* SchItem = screen->EEDrawList; SchItem; SchItem = SchItem->Next() ) for( SCH_ITEM* SchItem = screen->EEDrawList; SchItem;
SchItem = SchItem->Next() )
{ {
if( SchItem->Type() != TYPE_SCH_COMPONENT ) if( SchItem->Type() != TYPE_SCH_COMPONENT )
continue; continue;
SCH_COMPONENT* DrawLibItem = (SCH_COMPONENT*) SchItem; SCH_COMPONENT* component = (SCH_COMPONENT*) SchItem;
Entry = ( EDA_LibComponentStruct* ) FindLibPart( DrawLibItem->m_ChipName ); Entry = CMP_LIBRARY::FindLibraryComponent( component->m_ChipName );
if( Entry ) // if NULL : component not found if( Entry ) // if NULL : component not found
ListEntry.push_back( Entry ); libCache->AddComponent( Entry );
} }
} }
// Sort components (libraries entries) by name if( !libCache->Save( ArchFullFileName ) )
// (they are components name in library, not in schematic) :
sort( ListEntry.begin(), ListEntry.end(), SortCmpByName );
/* calculate the file name for the associated doc file */
docFileName = ArchFullFileName;
docFileName.SetExt( DOC_EXT );
if( ( ArchiveFile = wxFopen( ArchFullFileName, wxT( "wt" ) ) ) == NULL )
{
msg = _( "Failed to create archive lib file " ) + ArchFullFileName;
DisplayError( frame, msg );
return FALSE;
}
if( ( DocFile = wxFopen( docFileName.GetFullPath(), wxT( "wt" ) ) ) == NULL )
{ {
msg = _( "Failed to create doc lib file " ) + docFileName.GetFullPath(); msg.Printf( _( "An error occurrred attempting to save component \
library <%s>." ), (const wxChar*) ArchFullFileName );
DisplayError( frame, msg ); DisplayError( frame, msg );
return false;
} }
fprintf( ArchiveFile, "%s %s\n#\n", LIBFILE_IDENT, DateAndTime( Line ) ); return true;
if( DocFile )
fprintf( DocFile, "%s %s\n", DOCFILE_IDENT, DateAndTime( Line ) );
/* Save components in file */
for( unsigned ii = 0; ii < ListEntry.size(); ii++ )
{
if( (ii == 0) || ( ListEntry[ii - 1] != ListEntry[ii] ) )
{
if( ListEntry[ii]->Type == ROOT ) // Must be always true, but just in case
ListEntry[ii]->Save( ArchiveFile );
if( DocFile )
ListEntry[ii]->SaveDoc( DocFile );
}
}
fprintf( ArchiveFile, "#\n#EndLibrary\n" );
fclose( ArchiveFile );
if( DocFile )
{
fprintf( DocFile, "#\n#End Doc Library\n" );
fclose( DocFile );
}
return TRUE;
}
/***********************************************************************************************/
bool SortCmpByName( const EDA_LibComponentStruct* Objet1, const EDA_LibComponentStruct* Objet2 )
/***********************************************************************************************/
/* Compare function for sort()
* lib components are sorted by name
*/
{
int ii;
ii = Objet1->m_Name.m_Text.CmpNoCase( Objet2->m_Name.m_Text );
return ii < 0;
} }
...@@ -8,19 +8,33 @@ ...@@ -8,19 +8,33 @@
#define LIB_VERSION_MAJOR 2 #define LIB_VERSION_MAJOR 2
#define LIB_VERSION_MINOR 3 #define LIB_VERSION_MINOR 3
#define LIBFILE_IDENT "EESchema-LIBRARY Version" /* Must be the first line of lib files. */
#define DOCFILE_IDENT "EESchema-DOCLIB Version 2.0" /* Must be the first line of doc files. */
#define DOC_EXT wxT( "dcm" ) /* Ext. of documentation files */
/* Must be the first line of component library (.lib) files. */
#define LIBFILE_IDENT "EESchema-LIBRARY Version"
enum LocateDrawStructType { #define LIB_VERSION( major, minor ) ( major * 100 + minor )
LOCATE_COMPONENT_ARC_DRAW_TYPE = 1,
LOCATE_COMPONENT_CIRCLE_DRAW_TYPE = 2, #define IS_LIB_CURRENT_VERSION( major, minor ) \
( \
LIB_VERSION( major1, minor1 ) == \
LIB_VERSION( LIB_VERSION_MAJOR, LIB_VERSION_MINOR) \
)
/* Must be the first line of component library document (.dcm) files. */
#define DOCFILE_IDENT "EESchema-DOCLIB Version 2.0"
#define DOC_EXT wxT( "dcm" )
enum LocateDrawStructType
{
LOCATE_COMPONENT_ARC_DRAW_TYPE = 1,
LOCATE_COMPONENT_CIRCLE_DRAW_TYPE = 2,
LOCATE_COMPONENT_GRAPHIC_TEXT_DRAW_TYPE = 4, LOCATE_COMPONENT_GRAPHIC_TEXT_DRAW_TYPE = 4,
LOCATE_COMPONENT_RECT_DRAW_TYPE = 8, LOCATE_COMPONENT_RECT_DRAW_TYPE = 8,
LOCATE_LINE_DRAW_TYPE = 0x10, LOCATE_LINE_DRAW_TYPE = 0x10,
LOCATE_COMPONENT_POLYLINE_DRAW_TYPE = 0x20, LOCATE_COMPONENT_POLYLINE_DRAW_TYPE = 0x20,
LOCATE_COMPONENT_LINE_DRAW_TYPE = 0x40 LOCATE_COMPONENT_LINE_DRAW_TYPE = 0x40
}; };
#define LOCATE_ALL_DRAW_ITEM 0xFFFFFFFF #define LOCATE_ALL_DRAW_ITEM 0xFFFFFFFF
...@@ -29,21 +43,17 @@ enum LocateDrawStructType { ...@@ -29,21 +43,17 @@ enum LocateDrawStructType {
#include "class_library.h" #include "class_library.h"
/* Variables */
extern LibraryStruct* LibraryList; /* All part libs are saved here. */
/* Variables used by LibEdit */ /* Variables used by LibEdit */
extern LibEDA_BaseStruct* LibItemToRepeat; /* pointer on a graphic item than can be duplicated by the Ins key extern LibEDA_BaseStruct* LibItemToRepeat; /* pointer on a graphic item than
* (usually the last created item */ * can be duplicated by the Ins key
extern LibraryStruct* CurrentLib; /* Current opened library */ * (usually the last created item */
extern EDA_LibComponentStruct* CurrentLibEntry; /* Current component */ extern CMP_LIBRARY* CurrentLib; /* Current opened library */
extern LibEDA_BaseStruct* CurrentDrawItem; /* current edited item */ extern LIB_COMPONENT* CurrentLibEntry; /* Current component */
extern LibEDA_BaseStruct* CurrentDrawItem; /* current edited item */
extern wxString CurrentAliasName; extern wxString CurrentAliasName;
extern bool g_AsDeMorgan; extern bool g_AsDeMorgan;
extern int CurrentUnit; extern int CurrentUnit;
extern int CurrentConvert; extern int CurrentConvert;
extern wxString FindLibName;
#endif // LIBCMP_H #endif // LIBCMP_H
This diff is collapsed.
...@@ -78,12 +78,7 @@ void WinEDA_LibeditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -78,12 +78,7 @@ void WinEDA_LibeditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
DrawEntry->DisplayInfo( this ); DrawEntry->DisplayInfo( this );
else else
{ DisplayCmpDoc();
if( CurrentAliasName.IsEmpty() )
DisplayCmpDoc( CurrentAliasName );
else
DisplayCmpDoc( CurrentLibEntry->GetName() );
}
} }
} }
...@@ -151,13 +146,7 @@ void WinEDA_LibeditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -151,13 +146,7 @@ void WinEDA_LibeditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
LOCATE_ALL_DRAW_ITEM ); LOCATE_ALL_DRAW_ITEM );
} }
if( DrawEntry == NULL ) if( DrawEntry == NULL )
{ DisplayCmpDoc();
if( CurrentAliasName.IsEmpty() )
DisplayCmpDoc( CurrentLibEntry->GetName() );
else
DisplayCmpDoc( CurrentAliasName );
break;
}
SaveCopyInUndoList( CurrentLibEntry ); SaveCopyInUndoList( CurrentLibEntry );
if( DrawEntry->Type() == COMPONENT_PIN_DRAW_TYPE ) if( DrawEntry->Type() == COMPONENT_PIN_DRAW_TYPE )
DeletePin( DC, CurrentLibEntry, (LibDrawPin*) DrawEntry ); DeletePin( DC, CurrentLibEntry, (LibDrawPin*) DrawEntry );
......
...@@ -19,11 +19,11 @@ void WinEDA_LibeditFrame::SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy, ...@@ -19,11 +19,11 @@ void WinEDA_LibeditFrame::SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy,
int unused_flag ) int unused_flag )
/*************************************************************************/ /*************************************************************************/
{ {
EDA_BaseStruct* item; EDA_BaseStruct* item;
EDA_LibComponentStruct* CopyItem; LIB_COMPONENT* CopyItem;
PICKED_ITEMS_LIST* lastcmd; PICKED_ITEMS_LIST* lastcmd;
CopyItem = CopyLibEntryStruct( (EDA_LibComponentStruct*) ItemToCopy ); CopyItem = CopyLibEntryStruct( (LIB_COMPONENT*) ItemToCopy );
if( CopyItem == NULL ) if( CopyItem == NULL )
return; return;
...@@ -62,7 +62,7 @@ void WinEDA_LibeditFrame::GetComponentFromRedoList(wxCommandEvent& event) ...@@ -62,7 +62,7 @@ void WinEDA_LibeditFrame::GetComponentFromRedoList(wxCommandEvent& event)
lastcmd = GetScreen()->PopCommandFromRedoList( ); lastcmd = GetScreen()->PopCommandFromRedoList( );
wrapper = lastcmd->PopItem(); wrapper = lastcmd->PopItem();
CurrentLibEntry = (EDA_LibComponentStruct*) wrapper.m_PickedItem; CurrentLibEntry = (LIB_COMPONENT*) wrapper.m_PickedItem;
if( CurrentLibEntry ) if( CurrentLibEntry )
CurrentLibEntry->SetNext( NULL ); CurrentLibEntry->SetNext( NULL );
CurrentDrawItem = NULL; CurrentDrawItem = NULL;
...@@ -92,7 +92,7 @@ void WinEDA_LibeditFrame::GetComponentFromUndoList(wxCommandEvent& event) ...@@ -92,7 +92,7 @@ void WinEDA_LibeditFrame::GetComponentFromUndoList(wxCommandEvent& event)
lastcmd = GetScreen()->PopCommandFromUndoList( ); lastcmd = GetScreen()->PopCommandFromUndoList( );
wrapper = lastcmd->PopItem(); wrapper = lastcmd->PopItem();
CurrentLibEntry = (EDA_LibComponentStruct*) wrapper.m_PickedItem; CurrentLibEntry = (LIB_COMPONENT*) wrapper.m_PickedItem;
if( CurrentLibEntry ) if( CurrentLibEntry )
CurrentLibEntry->SetNext( NULL ); CurrentLibEntry->SetNext( NULL );
......
...@@ -216,7 +216,7 @@ names in the alias list." ), ...@@ -216,7 +216,7 @@ names in the alias list." ),
entry in the component library <%s>.\nPlease choose another name that does \ entry in the component library <%s>.\nPlease choose another name that does \
not conflict with any library entries." ), not conflict with any library entries." ),
(const wxChar*) Text, (const wxChar*) Text,
(const wxChar*) CurrentLib->m_Name ); (const wxChar*) CurrentLib->GetName() );
DisplayError( this, msg ); DisplayError( this, msg );
return; return;
} }
...@@ -294,7 +294,7 @@ void WinEDA_LibeditFrame::RotateField( wxDC* DC, LibDrawField* Field ) ...@@ -294,7 +294,7 @@ void WinEDA_LibeditFrame::RotateField( wxDC* DC, LibDrawField* Field )
* return: * return:
* pointer on the field (or NULL ) * pointer on the field (or NULL )
*/ */
LibDrawField* WinEDA_LibeditFrame::LocateField( EDA_LibComponentStruct* LibEntry ) LibDrawField* WinEDA_LibeditFrame::LocateField( LIB_COMPONENT* LibEntry )
{ {
wxPoint refpos = GetScreen()->m_Curseur; wxPoint refpos = GetScreen()->m_Curseur;
/* Test reference */ /* Test reference */
......
...@@ -17,6 +17,9 @@ ...@@ -17,6 +17,9 @@
#include "bitmaps.h" #include "bitmaps.h"
#include "protos.h" #include "protos.h"
#include "id.h" #include "id.h"
#include "class_library.h"
#include <boost/foreach.hpp>
/* Library editor wxConfig entry names. */ /* Library editor wxConfig entry names. */
...@@ -147,6 +150,7 @@ WinEDA_LibeditFrame::WinEDA_LibeditFrame( wxWindow* father, ...@@ -147,6 +150,7 @@ WinEDA_LibeditFrame::WinEDA_LibeditFrame( wxWindow* father,
ReCreateHToolbar(); ReCreateHToolbar();
ReCreateVToolbar(); ReCreateVToolbar();
DisplayLibInfos(); DisplayLibInfos();
DisplayCmpDoc();
UpdateAliasSelectList(); UpdateAliasSelectList();
UpdatePartSelectList(); UpdatePartSelectList();
BestZoom(); BestZoom();
...@@ -204,8 +208,6 @@ void WinEDA_LibeditFrame::SaveSettings() ...@@ -204,8 +208,6 @@ void WinEDA_LibeditFrame::SaveSettings()
void WinEDA_LibeditFrame::OnCloseWindow( wxCloseEvent& Event ) void WinEDA_LibeditFrame::OnCloseWindow( wxCloseEvent& Event )
{ {
LibraryStruct* Lib;
if( GetScreen()->IsModify() ) if( GetScreen()->IsModify() )
{ {
if( !IsOK( this, _( "Component was modified!\nDiscard changes?" ) ) ) if( !IsOK( this, _( "Component was modified!\nDiscard changes?" ) ) )
...@@ -217,13 +219,13 @@ void WinEDA_LibeditFrame::OnCloseWindow( wxCloseEvent& Event ) ...@@ -217,13 +219,13 @@ void WinEDA_LibeditFrame::OnCloseWindow( wxCloseEvent& Event )
GetScreen()->ClrModify(); GetScreen()->ClrModify();
} }
for( Lib = g_LibraryList; Lib != NULL; Lib = Lib->m_Pnext ) BOOST_FOREACH( const CMP_LIBRARY& lib, CMP_LIBRARY::GetLibraryList() )
{ {
if( Lib->IsModified() ) if( lib.IsModified() )
{ {
wxString msg; wxString msg;
msg.Printf( _( "Library \"%s\" was modified!\nDiscard changes?" ), msg.Printf( _( "Library \"%s\" was modified!\nDiscard changes?" ),
Lib->m_Name.GetData() ); (const wxChar*) lib.GetName() );
if( !IsOK( this, msg ) ) if( !IsOK( this, msg ) )
{ {
Event.Veto(); Event.Veto();
...@@ -358,7 +360,8 @@ void WinEDA_LibeditFrame::OnUpdateRedo( wxUpdateUIEvent& event ) ...@@ -358,7 +360,8 @@ void WinEDA_LibeditFrame::OnUpdateRedo( wxUpdateUIEvent& event )
void WinEDA_LibeditFrame::OnUpdateSaveCurrentLib( wxUpdateUIEvent& event ) void WinEDA_LibeditFrame::OnUpdateSaveCurrentLib( wxUpdateUIEvent& event )
{ {
event.Enable( CurrentLib != NULL ); event.Enable( CurrentLib != NULL
&& ( CurrentLib->IsModified() || GetScreen()->IsModify() ) );
} }
...@@ -370,7 +373,7 @@ void WinEDA_LibeditFrame::OnUpdateViewDoc( wxUpdateUIEvent& event ) ...@@ -370,7 +373,7 @@ void WinEDA_LibeditFrame::OnUpdateViewDoc( wxUpdateUIEvent& event )
{ {
if( !CurrentAliasName.IsEmpty() ) if( !CurrentAliasName.IsEmpty() )
{ {
LibCmpEntry* entry = CurrentLib->FindEntry( CurrentAliasName ); CMP_LIB_ENTRY* entry = CurrentLib->FindEntry( CurrentAliasName );
if( entry != NULL ) if( entry != NULL )
enable = !entry->m_DocFile.IsEmpty(); enable = !entry->m_DocFile.IsEmpty();
...@@ -452,11 +455,9 @@ void WinEDA_LibeditFrame::OnSelectAlias( wxCommandEvent& event ) ...@@ -452,11 +455,9 @@ void WinEDA_LibeditFrame::OnSelectAlias( wxCommandEvent& event )
if( m_SelAliasBox->GetStringSelection().CmpNoCase(CurrentLibEntry->GetName() ) == 0 ) if( m_SelAliasBox->GetStringSelection().CmpNoCase(CurrentLibEntry->GetName() ) == 0 )
CurrentAliasName.Empty(); CurrentAliasName.Empty();
else else
{
CurrentAliasName = m_SelAliasBox->GetStringSelection(); CurrentAliasName = m_SelAliasBox->GetStringSelection();
DisplayCmpDoc( CurrentAliasName );
}
DisplayCmpDoc();
DrawPanel->Refresh(); DrawPanel->Refresh();
} }
...@@ -464,11 +465,14 @@ void WinEDA_LibeditFrame::OnSelectAlias( wxCommandEvent& event ) ...@@ -464,11 +465,14 @@ void WinEDA_LibeditFrame::OnSelectAlias( wxCommandEvent& event )
void WinEDA_LibeditFrame::OnSelectPart( wxCommandEvent& event ) void WinEDA_LibeditFrame::OnSelectPart( wxCommandEvent& event )
{ {
int i = event.GetSelection(); int i = event.GetSelection();
if( i < 0 )
if( ( i == wxNOT_FOUND ) || ( ( i + 1 ) == CurrentUnit ) )
return; return;
LibItemToRepeat = NULL; LibItemToRepeat = NULL;
CurrentUnit = i + 1; CurrentUnit = i + 1;
DrawPanel->Refresh(); DrawPanel->Refresh();
DisplayCmpDoc();
} }
...@@ -585,7 +589,7 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -585,7 +589,7 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
wxString docfilename; wxString docfilename;
if( !CurrentAliasName.IsEmpty() ) if( !CurrentAliasName.IsEmpty() )
{ {
LibCmpEntry* entry = CurrentLib->FindEntry( CurrentAliasName ); CMP_LIB_ENTRY* entry = CurrentLib->FindEntry( CurrentAliasName );
if( entry != NULL ) if( entry != NULL )
docfilename = entry->m_DocFile; docfilename = entry->m_DocFile;
} }
......
...@@ -612,12 +612,12 @@ static bool IsBox1InBox2( int StartX1, int StartY1, int EndX1, int EndY1, ...@@ -612,12 +612,12 @@ static bool IsBox1InBox2( int StartX1, int StartY1, int EndX1, int EndY1,
/*********************************************************************************/ /*********************************************************************************/
LibEDA_BaseStruct* LocateDrawItem( SCH_SCREEN* Screen, LibEDA_BaseStruct* LocateDrawItem( SCH_SCREEN* Screen,
const wxPoint& aRefPoint, const wxPoint& aRefPoint,
EDA_LibComponentStruct* LibEntry, LIB_COMPONENT* LibEntry,
int Unit, int Unit,
int Convert, int Convert,
int masque ) int masque )
/*********************************************************************************/ /*********************************************************************************/
/* Locates a body item( not pins ) /* Locates a body item( not pins )
...@@ -718,11 +718,11 @@ LibDrawPin* LocatePinByNumber( const wxString& ePin_Number, ...@@ -718,11 +718,11 @@ LibDrawPin* LocatePinByNumber( const wxString& ePin_Number,
*/ */
{ {
LibEDA_BaseStruct* DrawItem; LibEDA_BaseStruct* DrawItem;
EDA_LibComponentStruct* Entry; LIB_COMPONENT* Entry;
LibDrawPin* Pin; LibDrawPin* Pin;
int Unit, Convert; int Unit, Convert;
Entry = ( EDA_LibComponentStruct* )FindLibPart( eComponent->m_ChipName ); Entry = CMP_LIBRARY::FindLibraryComponent( eComponent->m_ChipName );
if( Entry == NULL ) if( Entry == NULL )
return NULL; return NULL;
...@@ -760,8 +760,7 @@ LibDrawPin* LocatePinByNumber( const wxString& ePin_Number, ...@@ -760,8 +760,7 @@ LibDrawPin* LocatePinByNumber( const wxString& ePin_Number,
/*******************************************************************/ /*******************************************************************/
LibEDA_BaseStruct* LocatePin( const wxPoint& RefPos, LibEDA_BaseStruct* LocatePin( const wxPoint& RefPos, LIB_COMPONENT* Entry,
EDA_LibComponentStruct* Entry,
int Unit, int convert, SCH_COMPONENT* DrawLibItem ) int Unit, int convert, SCH_COMPONENT* DrawLibItem )
/*******************************************************************/ /*******************************************************************/
...@@ -850,7 +849,7 @@ LibDrawPin* LocateAnyPin( SCH_ITEM* DrawList, const wxPoint& RefPos, ...@@ -850,7 +849,7 @@ LibDrawPin* LocateAnyPin( SCH_ITEM* DrawList, const wxPoint& RefPos,
/**************************************************************************/ /**************************************************************************/
{ {
SCH_ITEM* DrawStruct; SCH_ITEM* DrawStruct;
EDA_LibComponentStruct* Entry; LIB_COMPONENT* Entry;
SCH_COMPONENT* LibItem = NULL; SCH_COMPONENT* LibItem = NULL;
LibDrawPin* Pin = NULL; LibDrawPin* Pin = NULL;
...@@ -859,7 +858,7 @@ LibDrawPin* LocateAnyPin( SCH_ITEM* DrawList, const wxPoint& RefPos, ...@@ -859,7 +858,7 @@ LibDrawPin* LocateAnyPin( SCH_ITEM* DrawList, const wxPoint& RefPos,
if( DrawStruct->Type() != TYPE_SCH_COMPONENT ) if( DrawStruct->Type() != TYPE_SCH_COMPONENT )
continue; continue;
LibItem = (SCH_COMPONENT*) DrawStruct; LibItem = (SCH_COMPONENT*) DrawStruct;
Entry = ( EDA_LibComponentStruct* ) FindLibPart( LibItem->m_ChipName ); Entry = CMP_LIBRARY::FindLibraryComponent( LibItem->m_ChipName );
if( Entry == NULL ) if( Entry == NULL )
continue; continue;
......
...@@ -28,9 +28,9 @@ static void WriteGENERICListOfNets( FILE* f, NETLIST_OBJECT_LIST& aObjectsList ) ...@@ -28,9 +28,9 @@ static void WriteGENERICListOfNets( FILE* f, NETLIST_OBJECT_LIST& aObjectsList )
static void AddPinToComponentPinList( SCH_COMPONENT* Component, static void AddPinToComponentPinList( SCH_COMPONENT* Component,
DrawSheetPath* sheet, DrawSheetPath* sheet,
LibDrawPin* PinEntry ); LibDrawPin* PinEntry );
static void FindAllsInstancesOfComponent( SCH_COMPONENT* Component, static void FindAllsInstancesOfComponent( SCH_COMPONENT* Component,
EDA_LibComponentStruct* Entry, LIB_COMPONENT* Entry,
DrawSheetPath* Sheet_in ); DrawSheetPath* Sheet_in );
static bool SortPinsByNum( NETLIST_OBJECT* Pin1, NETLIST_OBJECT* Pin2 ); static bool SortPinsByNum( NETLIST_OBJECT* Pin1, NETLIST_OBJECT* Pin2 );
static void EraseDuplicatePins( NETLIST_OBJECT_LIST& aPinList ); static void EraseDuplicatePins( NETLIST_OBJECT_LIST& aPinList );
...@@ -108,9 +108,9 @@ static SCH_COMPONENT* FindNextComponentAndCreatPinList( ...@@ -108,9 +108,9 @@ static SCH_COMPONENT* FindNextComponentAndCreatPinList(
* Must be deallocated by the user * Must be deallocated by the user
*/ */
{ {
SCH_COMPONENT* Component = NULL; SCH_COMPONENT* Component = NULL;
EDA_LibComponentStruct* Entry; LIB_COMPONENT* Entry;
LibEDA_BaseStruct* DEntry; LibEDA_BaseStruct* DEntry;
s_SortedComponentPinList.clear(); s_SortedComponentPinList.clear();
for( ; DrawList != NULL; DrawList = DrawList->Next() ) for( ; DrawList != NULL; DrawList = DrawList->Next() )
...@@ -130,7 +130,7 @@ static SCH_COMPONENT* FindNextComponentAndCreatPinList( ...@@ -130,7 +130,7 @@ static SCH_COMPONENT* FindNextComponentAndCreatPinList(
// removed because with multiple instances of one schematic // removed because with multiple instances of one schematic
// (several sheets pointing to 1 screen), this will be erroneously be toggled. // (several sheets pointing to 1 screen), this will be erroneously be toggled.
Entry = ( EDA_LibComponentStruct* ) FindLibPart( Component->m_ChipName ); Entry = CMP_LIBRARY::FindLibraryComponent( Component->m_ChipName );
if( Entry == NULL ) if( Entry == NULL )
continue; continue;
...@@ -550,8 +550,8 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with ...@@ -550,8 +550,8 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with
break; break;
/* Get the Component FootprintFilter and put the component in CmpList if filter is not void */ /* Get the Component FootprintFilter and put the component in CmpList if filter is not void */
EDA_LibComponentStruct* Entry = LIB_COMPONENT* Entry =
( EDA_LibComponentStruct* ) FindLibPart( Component->m_ChipName ); CMP_LIBRARY::FindLibraryComponent( Component->m_ChipName );
if( Entry != NULL ) if( Entry != NULL )
{ {
...@@ -628,11 +628,11 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with ...@@ -628,11 +628,11 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with
if( with_pcbnew && CmpList ) if( with_pcbnew && CmpList )
{ {
fprintf( f, "{ Allowed footprints by component:\n" ); fprintf( f, "{ Allowed footprints by component:\n" );
EDA_LibComponentStruct* Entry; LIB_COMPONENT* Entry;
for( int ii = 0; ii < CmpListCount; ii++ ) for( int ii = 0; ii < CmpListCount; ii++ )
{ {
Component = CmpList[ii].m_RootCmp; Component = CmpList[ii].m_RootCmp;
Entry = ( EDA_LibComponentStruct* ) FindLibPart( Component->m_ChipName ); Entry = CMP_LIBRARY::FindLibraryComponent( Component->m_ChipName );
//Line.Printf(_("%s"), CmpList[ii].m_Ref); //Line.Printf(_("%s"), CmpList[ii].m_Ref);
//Line.Replace( wxT( " " ), wxT( "_" ) ); //Line.Replace( wxT( " " ), wxT( "_" ) );
...@@ -754,9 +754,9 @@ static void EraseDuplicatePins( NETLIST_OBJECT_LIST& aPinList ) ...@@ -754,9 +754,9 @@ static void EraseDuplicatePins( NETLIST_OBJECT_LIST& aPinList )
/**********************************************************************************/ /**********************************************************************************/
static void FindAllsInstancesOfComponent( SCH_COMPONENT* Component_in, static void FindAllsInstancesOfComponent( SCH_COMPONENT* Component_in,
EDA_LibComponentStruct* Entry, LIB_COMPONENT* Entry,
DrawSheetPath* Sheet_in ) DrawSheetPath* Sheet_in )
/**********************************************************************************/ /**********************************************************************************/
/** /**
......
...@@ -353,7 +353,7 @@ static void ListeObjetConnection( DrawSheetPath* sheetlist, ...@@ -353,7 +353,7 @@ static void ListeObjetConnection( DrawSheetPath* sheetlist,
SCH_ITEM* DrawList; SCH_ITEM* DrawList;
NETLIST_OBJECT* new_item; NETLIST_OBJECT* new_item;
SCH_COMPONENT* DrawLibItem; SCH_COMPONENT* DrawLibItem;
EDA_LibComponentStruct* Entry; LIB_COMPONENT* Entry;
LibEDA_BaseStruct* DEntry; LibEDA_BaseStruct* DEntry;
Hierarchical_PIN_Sheet_Struct* SheetLabel; Hierarchical_PIN_Sheet_Struct* SheetLabel;
DrawSheetPath list; DrawSheetPath list;
...@@ -472,8 +472,8 @@ static void ListeObjetConnection( DrawSheetPath* sheetlist, ...@@ -472,8 +472,8 @@ static void ListeObjetConnection( DrawSheetPath* sheetlist,
case TYPE_SCH_COMPONENT: case TYPE_SCH_COMPONENT:
DrawLibItem = (SCH_COMPONENT*) DrawList; DrawLibItem = (SCH_COMPONENT*) DrawList;
Entry = ( EDA_LibComponentStruct* )FindLibPart( Entry =
DrawLibItem->m_ChipName ); CMP_LIBRARY::FindLibraryComponent( DrawLibItem->m_ChipName );
if( Entry == NULL ) if( Entry == NULL )
break; break;
......
...@@ -43,11 +43,11 @@ enum TypeNetForm { ...@@ -43,11 +43,11 @@ enum TypeNetForm {
class OBJ_CMP_TO_LIST class OBJ_CMP_TO_LIST
{ {
public: public:
SCH_COMPONENT* m_RootCmp; // the component in schematic SCH_COMPONENT* m_RootCmp; // the component in schematic
EDA_LibComponentStruct* m_Entry; // the source component in library LIB_COMPONENT* m_Entry; // the source component in library
int m_Unit; /* Selected part (For multi parts per package) depending on sheet path */ int m_Unit; /* Selected part (For multi parts per package) depending on sheet path */
DrawSheetPath m_SheetPath; /* the sheet path for this component */ DrawSheetPath m_SheetPath; /* the sheet path for this component */
unsigned long m_TimeStamp; /* unique identification number depending on sheet path */ unsigned long m_TimeStamp; /* unique identification number depending on sheet path */
bool m_IsNew; /* true for not yet annotated components */ bool m_IsNew; /* true for not yet annotated components */
wxString* m_Value; /* Component value (same for all instances) */ wxString* m_Value; /* Component value (same for all instances) */
char m_Reference[32]; /* Component reference prefix, without number (for IC1, this is IC) ) */ char m_Reference[32]; /* Component reference prefix, without number (for IC1, this is IC) ) */
......
This diff is collapsed.
...@@ -501,9 +501,9 @@ void WinEDA_PinPropertiesFrame::SetPinNum( const wxString& newnum, int newsize ) ...@@ -501,9 +501,9 @@ void WinEDA_PinPropertiesFrame::SetPinNum( const wxString& newnum, int newsize )
/*************************************************/ /*************************************************/
void WinEDA_LibeditFrame::DeletePin( wxDC* DC, void WinEDA_LibeditFrame::DeletePin( wxDC* DC,
EDA_LibComponentStruct* LibEntry, LIB_COMPONENT* LibEntry,
LibDrawPin* Pin ) LibDrawPin* Pin )
/*************************************************/ /*************************************************/
/* Routine d'effacement de la pin pointee par la souris /* Routine d'effacement de la pin pointee par la souris
...@@ -956,7 +956,7 @@ int sort_by_pin_number( const void* ref, const void* tst ) ...@@ -956,7 +956,7 @@ int sort_by_pin_number( const void* ref, const void* tst )
/***************************************************************/ /***************************************************************/
bool WinEDA_LibeditFrame::TestPins( EDA_LibComponentStruct* LibEntry ) bool WinEDA_LibeditFrame::TestPins( LIB_COMPONENT* LibEntry )
/***************************************************************/ /***************************************************************/
// Test des pins ( duplicates...) // Test des pins ( duplicates...)
......
...@@ -50,14 +50,14 @@ static void PlotLibPart( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem ) ...@@ -50,14 +50,14 @@ static void PlotLibPart( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem )
/*************************************************/ /*************************************************/
/* Polt a component */ /* Polt a component */
{ {
int ii, t1, t2, * Poly, orient; int ii, t1, t2, * Poly, orient;
EDA_LibComponentStruct* Entry; LIB_COMPONENT* Entry;
int TransMat[2][2], Multi, convert; int TransMat[2][2], Multi, convert;
EDA_Colors CharColor = UNSPECIFIED_COLOR; EDA_Colors CharColor = UNSPECIFIED_COLOR;
wxPoint pos; wxPoint pos;
bool draw_bgfill = false; bool draw_bgfill = false;
Entry = ( EDA_LibComponentStruct* ) FindLibPart( DrawLibItem->m_ChipName ); Entry = CMP_LIBRARY::FindLibraryComponent( DrawLibItem->m_ChipName );
if( Entry == NULL ) if( Entry == NULL )
return;; return;;
memcpy( TransMat, DrawLibItem->m_Transform, sizeof(TransMat) ); memcpy( TransMat, DrawLibItem->m_Transform, sizeof(TransMat) );
......
...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
/* prototypage des fonctions de EESchema */ /* prototypage des fonctions de EESchema */
/*****************************************/ /*****************************************/
LibEDA_BaseStruct* LocatePin( const wxPoint& RefPos, LibEDA_BaseStruct* LocatePin( const wxPoint& RefPos,
EDA_LibComponentStruct* Entry, LIB_COMPONENT* Entry,
int Unit, int Unit,
int Convert, int Convert,
SCH_COMPONENT* DrawItem = NULL ); SCH_COMPONENT* DrawItem = NULL );
/* Routine de localisation d'une PIN de la PartLib pointee par Entry */ /* Routine de localisation d'une PIN de la PartLib pointee par Entry */
...@@ -40,22 +40,16 @@ void InstallCmpeditFrame( WinEDA_SchematicFrame* parent, wxPoint& pos, ...@@ -40,22 +40,16 @@ void InstallCmpeditFrame( WinEDA_SchematicFrame* parent, wxPoint& pos,
/******************************/ /******************************/
/* EELIBS_DRAW_COMPONENTS.CPP */ /* EELIBS_DRAW_COMPONENTS.CPP */
/******************************/ /******************************/
int NumOfLibraries(); void DrawingLibInGhost( WinEDA_DrawPanel* panel,
wxDC* DC,
LibCmpEntry* FindLibPart( const wxChar* Name, LIB_COMPONENT* LibEntry,
const wxString& LibName = wxEmptyString, SCH_COMPONENT* DrawLibItem,
LibrEntryType Alias = ROOT ); int PartX,
int PartY,
void DrawingLibInGhost( WinEDA_DrawPanel* panel, int Multi,
wxDC* DC, int convert,
EDA_LibComponentStruct* LibEntry, int Color,
SCH_COMPONENT* DrawLibItem, bool DrawPinText );
int PartX,
int PartY,
int Multi,
int convert,
int Color,
bool DrawPinText );
bool MapAngles( int* Angle1, bool MapAngles( int* Angle1,
int* Angle2, int* Angle2,
...@@ -73,14 +67,6 @@ bool MapAngles( int* Angle1, ...@@ -73,14 +67,6 @@ bool MapAngles( int* Angle1,
wxPoint TransformCoordinate( const int aTransformMatrix[2][2], wxPoint TransformCoordinate( const int aTransformMatrix[2][2],
const wxPoint& aPosition ); const wxPoint& aPosition );
LibraryStruct* FindLibrary( const wxString& Name );
LibraryStruct* LoadLibraryName( WinEDA_DrawFrame* frame,
const wxString& FullLibName,
const wxString& LibName );
void LoadLibraries( WinEDA_SchematicFrame* frame );
void FreeCmpLibrary( wxWindow* frame,
const wxString& LibName );
void SnapLibItemPoint( int OrigX, void SnapLibItemPoint( int OrigX,
int OrigY, int OrigY,
int* ClosestX, int* ClosestX,
...@@ -153,12 +139,12 @@ SCH_ITEM* PickStruct( const wxPoint& refpos, ...@@ -153,12 +139,12 @@ SCH_ITEM* PickStruct( const wxPoint& refpos,
int SearchMask ); int SearchMask );
LibEDA_BaseStruct* LocateDrawItem( SCH_SCREEN* Screen, LibEDA_BaseStruct* LocateDrawItem( SCH_SCREEN* Screen,
const wxPoint& refpoint, const wxPoint& refpoint,
EDA_LibComponentStruct* LibEntry, LIB_COMPONENT* LibEntry,
int Unit, int Unit,
int Convert, int Convert,
int masque ); int masque );
Hierarchical_PIN_Sheet_Struct* LocateSheetLabel( DrawSheetStruct* Sheet, Hierarchical_PIN_Sheet_Struct* LocateSheetLabel( DrawSheetStruct* Sheet,
const wxPoint& pos ); const wxPoint& pos );
...@@ -216,7 +202,7 @@ bool Read_Hotkey_Config( WinEDA_DrawFrame* frame, bool verbose ); ...@@ -216,7 +202,7 @@ bool Read_Hotkey_Config( WinEDA_DrawFrame* frame, bool verbose );
/* SAVELIB.CPP */ /* SAVELIB.CPP */
/**************/ /**************/
EDA_LibComponentStruct* CopyLibEntryStruct( EDA_LibComponentStruct* OldEntry ); LIB_COMPONENT* CopyLibEntryStruct( LIB_COMPONENT* OldEntry );
/* Routine de copie d'une partlib /* Routine de copie d'une partlib
* Parametres d'entree: pointeur sur la structure de depart * Parametres d'entree: pointeur sur la structure de depart
...@@ -262,7 +248,7 @@ void DeleteAllMarkers( int type ); ...@@ -262,7 +248,7 @@ void DeleteAllMarkers( int type );
/* GETPART.CPP */ /* GETPART.CPP */
/**************/ /**************/
int LookForConvertPart( EDA_LibComponentStruct* LibEntry ); int LookForConvertPart( LIB_COMPONENT* LibEntry );
/* Retourne la plus grande valeur trouvee dans la liste des elements /* Retourne la plus grande valeur trouvee dans la liste des elements
* "drawings" du composant LibEntry, pour le membre .Convert * "drawings" du composant LibEntry, pour le membre .Convert
...@@ -295,7 +281,7 @@ void InstallPineditFrame( WinEDA_LibeditFrame* parent, ...@@ -295,7 +281,7 @@ void InstallPineditFrame( WinEDA_LibeditFrame* parent,
* 0 si commande annulee * 0 si commande annulee
*/ */
int DisplayComponentsNamesInLib( WinEDA_DrawFrame* frame, int DisplayComponentsNamesInLib( WinEDA_DrawFrame* frame,
LibraryStruct* Library, CMP_LIBRARY* Library,
wxString& Buffer, wxString& Buffer,
wxString& OldName ); wxString& OldName );
...@@ -305,7 +291,7 @@ int DisplayComponentsNamesInLib( WinEDA_DrawFrame* frame, ...@@ -305,7 +291,7 @@ int DisplayComponentsNamesInLib( WinEDA_DrawFrame* frame,
* a library * a library
* This list is sorted, with the library cache always at end of the list * This list is sorted, with the library cache always at end of the list
*/ */
LibraryStruct* SelectLibraryFromList( WinEDA_DrawFrame* frame ); CMP_LIBRARY* SelectLibraryFromList( WinEDA_DrawFrame* frame );
/** /**
* Function GetNameOfPartToLoad * Function GetNameOfPartToLoad
...@@ -319,7 +305,7 @@ LibraryStruct* SelectLibraryFromList( WinEDA_DrawFrame* frame ); ...@@ -319,7 +305,7 @@ LibraryStruct* SelectLibraryFromList( WinEDA_DrawFrame* frame );
* BufName * BufName
*/ */
int GetNameOfPartToLoad( WinEDA_DrawFrame* frame, int GetNameOfPartToLoad( WinEDA_DrawFrame* frame,
LibraryStruct* Lib, CMP_LIBRARY* Lib,
wxString& BufName ); wxString& BufName );
/**************/ /**************/
......
...@@ -8,12 +8,16 @@ ...@@ -8,12 +8,16 @@
#include "confirm.h" #include "confirm.h"
#include "kicad_string.h" #include "kicad_string.h"
#include "gestfich.h" #include "gestfich.h"
#include "program.h" #include "program.h"
#include "libcmp.h" #include "libcmp.h"
#include "general.h" #include "general.h"
#include "macros.h" #include "macros.h"
#include "protos.h" #include "protos.h"
#include "class_library.h"
#include <boost/foreach.hpp>
/* Fonctions Locales */ /* Fonctions Locales */
static void SaveLayers( FILE* f ); static void SaveLayers( FILE* f );
...@@ -119,11 +123,12 @@ bool SCH_SCREEN::Save( FILE* aFile ) const ...@@ -119,11 +123,12 @@ bool SCH_SCREEN::Save( FILE* aFile ) const
wxString datetime = DateAndTime( ); wxString datetime = DateAndTime( );
bool first = true; bool first = true;
for( LibraryStruct* Lib = g_LibraryList; Lib != NULL; Lib = Lib->m_Pnext )
BOOST_FOREACH( const CMP_LIBRARY& lib, CMP_LIBRARY::GetLibraryList() )
{ {
if( ! first ) if( ! first )
Name += wxT( "," ); Name += wxT( "," );
Name += Lib->m_Name; Name += lib.GetName();
first = false; first = false;
} }
......
...@@ -25,13 +25,13 @@ ...@@ -25,13 +25,13 @@
* Parametres de sortie: pointeur sur la structure creee * Parametres de sortie: pointeur sur la structure creee
* Do not copy new items ( i.e. with m_Flag & IS_NEW) * Do not copy new items ( i.e. with m_Flag & IS_NEW)
*/ */
EDA_LibComponentStruct* CopyLibEntryStruct( EDA_LibComponentStruct* OldEntry ) LIB_COMPONENT* CopyLibEntryStruct( LIB_COMPONENT* OldEntry )
{ {
wxString msg; wxString msg;
EDA_LibComponentStruct* NewStruct; LIB_COMPONENT* NewStruct;
LibEDA_BaseStruct* NewDrawings, * OldDrawings; LibEDA_BaseStruct* NewDrawings, * OldDrawings;
LibEDA_BaseStruct* LastItem; LibEDA_BaseStruct* LastItem;
LibDrawField* OldField, * NewField; LibDrawField* OldField, * NewField;
if( OldEntry->Type != ROOT ) if( OldEntry->Type != ROOT )
{ {
...@@ -41,7 +41,7 @@ EDA_LibComponentStruct* CopyLibEntryStruct( EDA_LibComponentStruct* OldEntry ) ...@@ -41,7 +41,7 @@ EDA_LibComponentStruct* CopyLibEntryStruct( EDA_LibComponentStruct* OldEntry )
return NULL; return NULL;
} }
NewStruct = new EDA_LibComponentStruct( NULL ); NewStruct = new LIB_COMPONENT( wxEmptyString );
OldEntry->m_Prefix.Copy( &NewStruct->m_Prefix ); OldEntry->m_Prefix.Copy( &NewStruct->m_Prefix );
OldEntry->m_Name.Copy( &NewStruct->m_Name ); OldEntry->m_Name.Copy( &NewStruct->m_Name );
......
...@@ -649,10 +649,10 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -649,10 +649,10 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
if( screen->GetCurItem() == NULL ) if( screen->GetCurItem() == NULL )
break; break;
{ {
LibCmpEntry* LibEntry; CMP_LIB_ENTRY* LibEntry;
LibEntry = FindLibPart( LibEntry = CMP_LIBRARY::FindLibraryEntry(
( (SCH_COMPONENT*) screen->GetCurItem() )->m_ChipName, ( (SCH_COMPONENT*) screen->GetCurItem() )->m_ChipName );
wxEmptyString, ALIAS );
if( LibEntry && LibEntry->m_DocFile != wxEmptyString ) if( LibEntry && LibEntry->m_DocFile != wxEmptyString )
{ {
GetAssociatedDocument( this, LibEntry->m_DocFile , GetAssociatedDocument( this, LibEntry->m_DocFile ,
......
...@@ -13,37 +13,23 @@ ...@@ -13,37 +13,23 @@
#include "protos.h" #include "protos.h"
LibraryStruct* SelectLibraryFromList( WinEDA_DrawFrame* frame ) CMP_LIBRARY* SelectLibraryFromList( WinEDA_DrawFrame* frame )
{ {
static wxString OldLibName; static wxString OldLibName;
wxString LibName, msg; wxString msg;
int count = NumOfLibraries(); wxArrayString libNamesList;
LibraryStruct* Lib = NULL; int count = CMP_LIBRARY::GetLibraryCount();
CMP_LIBRARY* Lib = NULL;
if( count == 0 ) if( count == 0 )
{ {
DisplayError( frame, _( "No libraries are loaded" ) ); DisplayError( frame, _( "No component libraries are loaded." ) );
return NULL; return NULL;
} }
msg.Printf( _( " Select 1 of %d libraries." ), count ); libNamesList = CMP_LIBRARY::GetLibraryNames();
wxArrayString libNamesList;
LibraryStruct* libcache = NULL;
for( LibraryStruct* Lib = g_LibraryList; Lib != NULL; Lib = Lib->m_Pnext ) msg.Printf( _( " Select 1 of %d libraries." ), count );
{
if( Lib->m_IsLibCache )
libcache = Lib;
else
libNamesList.Add( Lib->m_Name );
}
libNamesList.Sort();
// Add lib cache
if( libcache )
libNamesList.Add( libcache->m_Name );
wxSingleChoiceDialog dlg( frame, msg, _( "Select Library" ), libNamesList ); wxSingleChoiceDialog dlg( frame, msg, _( "Select Library" ), libNamesList );
...@@ -55,7 +41,7 @@ LibraryStruct* SelectLibraryFromList( WinEDA_DrawFrame* frame ) ...@@ -55,7 +41,7 @@ LibraryStruct* SelectLibraryFromList( WinEDA_DrawFrame* frame )
if( dlg.ShowModal() == wxID_CANCEL || dlg.GetStringSelection().IsEmpty() ) if( dlg.ShowModal() == wxID_CANCEL || dlg.GetStringSelection().IsEmpty() )
return NULL; return NULL;
Lib = FindLibrary( dlg.GetStringSelection() ); Lib = CMP_LIBRARY::FindLibrary( dlg.GetStringSelection() );
if( Lib != NULL ) if( Lib != NULL )
OldLibName = dlg.GetStringSelection(); OldLibName = dlg.GetStringSelection();
...@@ -65,7 +51,7 @@ LibraryStruct* SelectLibraryFromList( WinEDA_DrawFrame* frame ) ...@@ -65,7 +51,7 @@ LibraryStruct* SelectLibraryFromList( WinEDA_DrawFrame* frame )
int DisplayComponentsNamesInLib( WinEDA_DrawFrame* frame, int DisplayComponentsNamesInLib( WinEDA_DrawFrame* frame,
LibraryStruct* Library, CMP_LIBRARY* Library,
wxString& Buffer, wxString& OldName ) wxString& Buffer, wxString& OldName )
{ {
size_t i; size_t i;
...@@ -105,7 +91,7 @@ int DisplayComponentsNamesInLib( WinEDA_DrawFrame* frame, ...@@ -105,7 +91,7 @@ int DisplayComponentsNamesInLib( WinEDA_DrawFrame* frame,
} }
int GetNameOfPartToLoad( WinEDA_DrawFrame* frame, LibraryStruct* Library, int GetNameOfPartToLoad( WinEDA_DrawFrame* frame, CMP_LIBRARY* Library,
wxString& BufName ) wxString& BufName )
{ {
int ii; int ii;
......
...@@ -179,8 +179,8 @@ static void AbortSymbolTraceOn( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -179,8 +179,8 @@ static void AbortSymbolTraceOn( WinEDA_DrawPanel* Panel, wxDC* DC )
/*******************************************************************************************/ /*******************************************************************************************/
LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( EDA_LibComponentStruct* LibEntry, LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( LIB_COMPONENT* LibEntry,
wxDC* DC ) wxDC* DC )
/*******************************************************************************************/ /*******************************************************************************************/
/* Routine de creation d'un nouvel element type LibraryDrawStruct /* Routine de creation d'un nouvel element type LibraryDrawStruct
......
...@@ -30,11 +30,11 @@ ...@@ -30,11 +30,11 @@
*/ */
void WinEDA_LibeditFrame::LoadOneSymbol( void ) void WinEDA_LibeditFrame::LoadOneSymbol( void )
{ {
EDA_LibComponentStruct* Component; LIB_COMPONENT* Component;
LibEDA_BaseStruct* DrawEntry; LibEDA_BaseStruct* DrawEntry;
FILE* ImportFile; FILE* ImportFile;
wxString msg, err; wxString msg, err;
LibraryStruct* Lib; CMP_LIBRARY* Lib;
/* Exit if no library entry is selected or a command is in progress. */ /* Exit if no library entry is selected or a command is in progress. */
if( CurrentLibEntry == NULL if( CurrentLibEntry == NULL
...@@ -70,8 +70,7 @@ void WinEDA_LibeditFrame::LoadOneSymbol( void ) ...@@ -70,8 +70,7 @@ void WinEDA_LibeditFrame::LoadOneSymbol( void )
return; return;
} }
Lib = new LibraryStruct( LIBRARY_TYPE_SYMBOL, fn.GetName(), Lib = new CMP_LIBRARY( LIBRARY_TYPE_SYMBOL, fn );
fn.GetFullPath() );
if( !Lib->Load( err ) ) if( !Lib->Load( err ) )
{ {
...@@ -96,7 +95,7 @@ void WinEDA_LibeditFrame::LoadOneSymbol( void ) ...@@ -96,7 +95,7 @@ void WinEDA_LibeditFrame::LoadOneSymbol( void )
if( Lib->GetCount() > 1 ) if( Lib->GetCount() > 1 )
DisplayError( this, _( "Warning: more than 1 part in Symbol File" ) ); DisplayError( this, _( "Warning: more than 1 part in Symbol File" ) );
Component = (EDA_LibComponentStruct*) Lib->GetFirstEntry(); Component = (LIB_COMPONENT*) Lib->GetFirstEntry();
DrawEntry = Component->m_Drawings; DrawEntry = Component->m_Drawings;
while( DrawEntry ) while( DrawEntry )
......
...@@ -3,27 +3,23 @@ ...@@ -3,27 +3,23 @@
/****************************************************************/ /****************************************************************/
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
#include "bitmaps.h"
#include "id.h"
#include "program.h" #include "program.h"
#include "libcmp.h" #include "libcmp.h"
#include "general.h" #include "general.h"
#include "wx/spinctrl.h"
#include "protos.h" #include "protos.h"
#include "class_library.h"
#include "bitmaps.h"
#include "id.h"
void WinEDA_ViewlibFrame::ReCreateHToolbar() void WinEDA_ViewlibFrame::ReCreateHToolbar()
{ {
int ii; int ii;
LibraryStruct* lib; CMP_LIBRARY* lib;
EDA_LibComponentStruct* component = NULL; LIB_COMPONENT* component = NULL;
LibCmpEntry* entry = NULL; CMP_LIB_ENTRY* entry = NULL;
bool asdeMorgan = false; bool asdeMorgan = false;
if( m_HToolBar == NULL ) if( m_HToolBar == NULL )
...@@ -108,7 +104,7 @@ void WinEDA_ViewlibFrame::ReCreateHToolbar() ...@@ -108,7 +104,7 @@ void WinEDA_ViewlibFrame::ReCreateHToolbar()
if( (g_CurrentViewLibraryName != wxEmptyString) if( (g_CurrentViewLibraryName != wxEmptyString)
&& (g_CurrentViewComponentName != wxEmptyString) ) && (g_CurrentViewComponentName != wxEmptyString) )
{ {
lib = FindLibrary( g_CurrentViewLibraryName ); lib = CMP_LIBRARY::FindLibrary( g_CurrentViewLibraryName );
if( lib != NULL ) if( lib != NULL )
{ {
......
...@@ -5,13 +5,15 @@ ...@@ -5,13 +5,15 @@
#include "fctsys.h" #include "fctsys.h"
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
#include "common.h" #include "common.h"
#include "id.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "bitmaps.h"
#include "program.h" #include "program.h"
#include "libcmp.h" #include "libcmp.h"
#include "general.h" #include "general.h"
#include "bitmaps.h"
#include "protos.h" #include "protos.h"
#include "id.h"
/*****************************/ /*****************************/
/* class WinEDA_ViewlibFrame */ /* class WinEDA_ViewlibFrame */
...@@ -60,9 +62,9 @@ static wxAcceleratorEntry accels[] = ...@@ -60,9 +62,9 @@ static wxAcceleratorEntry accels[] =
#define EXTRA_BORDER_SIZE 2 #define EXTRA_BORDER_SIZE 2
WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father, WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father,
LibraryStruct* Library, CMP_LIBRARY* Library,
wxSemaphore* semaphore ) : wxSemaphore* semaphore ) :
WinEDA_DrawFrame( father, VIEWER_FRAME, _( "Library browser" ), WinEDA_DrawFrame( father, VIEWER_FRAME, _( "Library browser" ),
wxDefaultPosition, wxDefaultSize ) wxDefaultPosition, wxDefaultSize )
{ {
...@@ -117,7 +119,7 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father, ...@@ -117,7 +119,7 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father,
} }
else else
{ {
g_CurrentViewLibraryName = Library->m_Name; g_CurrentViewLibraryName = Library->GetName();
m_LibListSize.x = 0; m_LibListSize.x = 0;
} }
...@@ -277,14 +279,14 @@ int WinEDA_ViewlibFrame::BestZoom() ...@@ -277,14 +279,14 @@ int WinEDA_ViewlibFrame::BestZoom()
{ {
int bestzoom, ii, jj; int bestzoom, ii, jj;
wxSize size, itemsize; wxSize size, itemsize;
EDA_LibComponentStruct* component; LIB_COMPONENT* component;
LibraryStruct* lib; CMP_LIBRARY* lib;
GetScreen()->m_Curseur.x = 0; GetScreen()->m_Curseur.x = 0;
GetScreen()->m_Curseur.y = 0; GetScreen()->m_Curseur.y = 0;
bestzoom = 16; bestzoom = 16;
lib = FindLibrary( g_CurrentViewLibraryName ); lib = CMP_LIBRARY::FindLibrary( g_CurrentViewLibraryName );
if( lib == NULL ) if( lib == NULL )
return bestzoom; return bestzoom;
...@@ -314,37 +316,22 @@ int WinEDA_ViewlibFrame::BestZoom() ...@@ -314,37 +316,22 @@ int WinEDA_ViewlibFrame::BestZoom()
} }
/******************************************/ /**
void WinEDA_ViewlibFrame::ReCreateListLib() * Function ReCreateListLib
/******************************************/ *
/** Function ReCreateListLib
* Creates or recreates the list of current loaded libraries. * Creates or recreates the list of current loaded libraries.
* This list is sorted, with the library cache always at end of the list * This list is sorted, with the library cache always at end of the list
*/ */
void WinEDA_ViewlibFrame::ReCreateListLib()
{ {
LibraryStruct * libcache = NULL; wxArrayString libNamesList;
bool found = FALSE; bool found = false;
if( m_LibList == NULL ) if( m_LibList == NULL )
return; return;
m_LibList->Clear(); m_LibList->Clear();
libNamesList = CMP_LIBRARY::GetLibraryNames();
wxArrayString libNamesList;
for( LibraryStruct* Lib = g_LibraryList; Lib != NULL; Lib = Lib->m_Pnext )
{
if ( Lib->m_IsLibCache )
libcache = Lib;
else
libNamesList.Add( Lib->m_Name );
}
libNamesList.Sort();
// Add lib cache
if ( libcache )
libNamesList.Add( libcache->m_Name );
m_LibList->Append( libNamesList ); m_LibList->Append( libNamesList );
// Search for a previous selection: // Search for a previous selection:
...@@ -379,7 +366,7 @@ void WinEDA_ViewlibFrame::ReCreateListCmp() ...@@ -379,7 +366,7 @@ void WinEDA_ViewlibFrame::ReCreateListCmp()
if( m_CmpList == NULL ) if( m_CmpList == NULL )
return; return;
LibraryStruct* Library = FindLibrary( g_CurrentViewLibraryName ); CMP_LIBRARY* Library = CMP_LIBRARY::FindLibrary( g_CurrentViewLibraryName );
wxArrayString nameList; wxArrayString nameList;
m_CmpList->Clear(); m_CmpList->Clear();
......
This diff is collapsed.
...@@ -155,7 +155,8 @@ public: ...@@ -155,7 +155,8 @@ public:
* Check to see if the cursor is being managed for block or editing * Check to see if the cursor is being managed for block or editing
* commands and release it. * commands and release it.
*/ */
void UnManageCursor( void ); void UnManageCursor( int id = -1, int cursor = -1,
const wxString& title = wxEmptyString );
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
......
...@@ -289,9 +289,6 @@ void Affiche_1_Parametre( WinEDA_DrawFrame* frame, ...@@ -289,9 +289,6 @@ void Affiche_1_Parametre( WinEDA_DrawFrame* frame,
const wxString& texte_L, const wxString& texte_L,
int color ); int color );
void AfficheDoc( WinEDA_DrawFrame* frame, const wxString& Doc,
const wxString& KeyW );
/* Routine d'affichage de la documentation associee a un composant */ /* Routine d'affichage de la documentation associee a un composant */
int GetTimeStamp(); int GetTimeStamp();
......
This diff is collapsed.
...@@ -362,6 +362,10 @@ protected: ...@@ -362,6 +362,10 @@ protected:
*/ */
static wxSize computeFontSize(); static wxSize computeFontSize();
/**
* Calculate the width and height of a text string using the system UI font.
*/
wxSize computeTextSize( const wxString& text );
public: public:
WinEDA_DrawFrame* m_Parent; WinEDA_DrawFrame* m_Parent;
...@@ -386,6 +390,21 @@ public: ...@@ -386,6 +390,21 @@ public:
void Affiche_1_Parametre( int pos_X, const wxString& texte_H, void Affiche_1_Parametre( int pos_X, const wxString& texte_H,
const wxString& texte_L, int color ); const wxString& texte_L, int color );
/**
* Append a message to the message panel.
*
* This method automatically adjusts for the width of the text string.
* Making consectutive calls to AppendMessage will append each message
* to the right of the last message. This message is not compatible
* with Affiche_1_Parametre.
*
* @param textUpper - The message upper text.
* @param textLower - The message lower text.
* @param color - A color ID from the Kicad color list (see colors.h).
* @param pad - Number of spaces to pad between messages (default = 4).
*/
void AppendMessage( const wxString& textUpper, const wxString& textLower,
int color, int pad = 4 );
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
......
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