Commit 79c9be25 authored by stambaughw's avatar stambaughw

Replace PriorQue with boost::ptr_vector for component library entries.

* Replaced WinEDAListBox buttons with wxStdDialogButtonSizer.
* Moved library draw entries GenCopy method to base class.
* Remove priorque.cpp and priorque.h from CMakeLists.txt.
* The usual code cleaning and uncrustification.
parent 27a0c73c
/********************************/
/* MODULE displlst.cpp */
/* MODULE displlst.cpp */
/********************************/
#include "fctsys.h"
......@@ -40,17 +40,13 @@ END_EVENT_TABLE()
*/
WinEDAListBox::WinEDAListBox( WinEDA_DrawFrame* parent, const wxString& title,
const wxChar** itemlist,
const wxString& reftext,
const wxChar** itemlist, const wxString& reftext,
void(* movefct)(wxString& Text) ,
const wxColour& colour, wxPoint dialog_position ) :
wxDialog( parent, -1, title, dialog_position, wxDefaultSize,
wxDEFAULT_DIALOG_STYLE | MAYBE_RESIZE_BORDER
)
wxDEFAULT_DIALOG_STYLE | MAYBE_RESIZE_BORDER )
{
wxSize size;
const wxChar** names;
int ii;
m_ItemList = itemlist;
m_Parent = parent;
......@@ -58,34 +54,12 @@ WinEDAListBox::WinEDAListBox( WinEDA_DrawFrame* parent, const wxString& title,
m_WinMsg = NULL;
SetReturnCode( -1 );
if( itemlist )
for( names = m_ItemList, ii = 0; *names != NULL; names++ )
ii++;
else
ii = 30;
wxBoxSizer* GeneralBoxSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* GeneralBoxSizer = new wxBoxSizer( wxVERTICAL );
SetSizer( GeneralBoxSizer );
wxBoxSizer* MainBoxSizer = new wxBoxSizer( wxHORIZONTAL );
GeneralBoxSizer->Add( MainBoxSizer, 0, wxGROW | wxEXPAND | wxALL, 1 );
wxBoxSizer* LeftBoxSizer = new wxBoxSizer( wxVERTICAL );
MainBoxSizer->Add( LeftBoxSizer, 0, wxGROW | wxALL, 5 );
wxBoxSizer* RightBoxSizer = new wxBoxSizer( wxVERTICAL );
MainBoxSizer->Add( RightBoxSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
size.x = 200;
size.y = 350;
m_List = new wxListBox( this,
ID_LISTBOX_LIST,
wxDefaultPosition, size,
0, NULL,
m_List = new wxListBox( this, ID_LISTBOX_LIST, wxDefaultPosition,
wxSize( 300, 200 ), 0, NULL,
wxLB_NEEDED_SB | wxLB_SINGLE | wxLB_HSCROLL );
if( colour != wxNullColour )
......@@ -93,38 +67,33 @@ WinEDAListBox::WinEDAListBox( WinEDA_DrawFrame* parent, const wxString& title,
m_List->SetBackgroundColour( colour );
m_List->SetForegroundColour( *wxBLACK );
}
LeftBoxSizer->Add( m_List, 0, wxGROW | wxALL, 5 );
GeneralBoxSizer->Add( m_List, 0, wxGROW | wxALL, 5 );
if( itemlist )
for( names = m_ItemList, ii = 0; *names != NULL; names++, ii++ )
{
{
for( names = m_ItemList; *names != NULL; names++ )
m_List->Append( *names );
}
wxButton* butt = new wxButton( this, wxID_OK, _( "OK" ) );
RightBoxSizer->Add( butt, 0, wxGROW | wxALL, 5 );
butt->SetDefault();
butt = new wxButton( this, wxID_CANCEL, _( "Cancel" ) );
RightBoxSizer->Add( butt, 0, wxGROW | wxALL, 5 );
}
if( m_MoveFct )
{
size.x = -1;
size.y = 60;
m_WinMsg = new wxTextCtrl( this, -1, wxEmptyString, wxDefaultPosition,
size, wxTE_READONLY | wxTE_MULTILINE );
m_WinMsg = new wxTextCtrl( this, -1, wxEmptyString,
wxDefaultPosition, wxSize( -1, 60 ),
wxTE_READONLY | wxTE_MULTILINE );
GeneralBoxSizer->Add( m_WinMsg, 0, wxGROW | wxALL, 5 );
}
wxSizer* buttonSizer = CreateButtonSizer( wxOK | wxCANCEL );
if( buttonSizer )
GeneralBoxSizer->Add( buttonSizer, 0, wxGROW | wxALL, 5 );
GetSizer()->Fit( this );
GetSizer()->SetSizeHints( this );
if( dialog_position == wxDefaultPosition ) // Put the window on the parent centre
if( dialog_position == wxDefaultPosition )
{
Centre();
}
......
......@@ -101,7 +101,6 @@ set(EESCHEMA_SRCS
plothpgl.cpp
plotps.cpp
plotdxf.cpp
priorque.cpp
read_from_file_schematic_items_descriptions.cpp
savelib.cpp
save_schemas.cpp
......
......@@ -512,7 +512,7 @@ void CopyMarkedItems( EDA_LibComponentStruct* LibEntry, wxPoint offset )
if( item->m_Selected == 0 )
continue;
item->m_Selected = 0;
LibEDA_BaseStruct* newitem = CopyDrawEntryStruct( item );
LibEDA_BaseStruct* newitem = item->GenCopy();
newitem->m_Selected = IS_SELECTED;
newitem->SetNext( LibEntry->m_Drawings );
LibEntry->m_Drawings = newitem;
......
......@@ -168,7 +168,7 @@ bool LibDrawText::HitTest( wxPoint aPosRef, int aThreshold, const int aTransMat[
}
LibDrawText* LibDrawText::GenCopy()
LibEDA_BaseStruct* LibDrawText::DoGenCopy()
{
LibDrawText* newitem = new LibDrawText(NULL);
......@@ -185,7 +185,7 @@ LibDrawText* LibDrawText::GenCopy()
newitem->m_Bold = m_Bold;
newitem->m_HJustify = m_HJustify;
newitem->m_VJustify = m_VJustify;
return newitem;
return (LibEDA_BaseStruct*) newitem;
}
......@@ -247,4 +247,3 @@ void LibDrawText::DisplayInfo( WinEDA_DrawFrame* frame )
frame->MsgPanel->Affiche_1_Parametre( 20, _( "Line width" ), msg, BLUE );
}
......@@ -179,13 +179,13 @@ bool LibCmpEntry::operator==( const wxChar* name ) const
}
bool operator<( LibCmpEntry& item1, LibCmpEntry& item2 )
bool operator<( const LibCmpEntry& item1, const LibCmpEntry& item2 )
{
return item1.m_Name.m_Text.CmpNoCase( item2.m_Name.m_Text ) == -1;
return item1.m_Name.m_Text.CmpNoCase( item2.m_Name.m_Text ) < 0;
}
int LibraryEntryCompare( LibCmpEntry* LE1, LibCmpEntry* LE2 )
int LibraryEntryCompare( const LibCmpEntry* LE1, const LibCmpEntry* LE2 )
{
return LE1->m_Name.m_Text.CmpNoCase( LE2->m_Name.m_Text );
}
......
......@@ -16,13 +16,15 @@
/* Types for components in libraries
* 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 */
ALIAS /* This is an alias of a true component */
};
/* values for member .m_Options */
enum LibrEntryOptions {
enum LibrEntryOptions
{
ENTRY_NORMAL, // Libentry is a standard component (real or alias)
ENTRY_POWER // Libentry is a power symbol
};
......@@ -31,7 +33,7 @@ enum LibrEntryOptions {
/**
* Base class to describe library components and aliases.
*
* This class is not to be used directly.
* This class is not to be used directly.
*/
class LibCmpEntry : public EDA_BaseStruct
{
......@@ -76,9 +78,10 @@ public:
typedef boost::ptr_vector< LibCmpEntry > LIB_ENTRY_LIST;
extern bool operator<( LibCmpEntry& item1, LibCmpEntry& item2 );
extern bool operator<( const LibCmpEntry& item1, const LibCmpEntry& item2 );
extern int LibraryEntryCompare( LibCmpEntry* LE1, LibCmpEntry* LE2 );
extern int LibraryEntryCompare( const LibCmpEntry* LE1,
const LibCmpEntry* LE2 );
/**
......@@ -173,7 +176,7 @@ public:
*
* @todo Alias objects should really be defined as children of a component
* object not as children of a library object. This would greatly
* simply searching for components in libraries.
* simplify searching for components in libraries.
*/
class EDA_LibCmpAliasStruct : public LibCmpEntry
{
......
......@@ -347,13 +347,13 @@ bool LibDrawField::HitTest( wxPoint aPosRef, int aThreshold, const int aTransMat
}
// Creation et Duplication d'un field
LibDrawField* LibDrawField::GenCopy()
LibEDA_BaseStruct* LibDrawField::DoGenCopy()
{
LibDrawField* newfield = new LibDrawField( m_FieldId );
Copy( newfield );
return newfield;
return (LibEDA_BaseStruct*) newfield;
}
......
......@@ -58,8 +58,6 @@ public:
virtual bool Save( FILE* aFile ) const;
virtual bool Load( char* line, wxString& errorMsg );
LibDrawField* GenCopy();
/** Function Copy
* copy parameters of this to Target. Pointers are not copied
* @param aTarget = the LibDrawField to set with "this" values
......@@ -104,6 +102,9 @@ public:
m_VJustify = field.m_VJustify;
m_Parent = field.m_Parent;
}
protected:
virtual LibEDA_BaseStruct* DoGenCopy();
};
#endif // CLASS_LIBENTRY_FIELDS_H
This diff is collapsed.
......@@ -9,9 +9,12 @@
#include "class_libentry.h"
/******************************/
/* Class to handle a library */
/******************************/
/**
* Component library object.
*
* Component libraries are used to load, save, search, and otherwise manipulate
* component library files.
*/
class LibraryStruct
{
......@@ -20,10 +23,7 @@ public:
wxString m_Name; /* Library file name (without path). */
wxString m_FullFileName; /* Full File Name (with path) of library. */
wxString m_Header; /* first line of loaded library. */
int m_NumOfParts; /* Number of parts this library has. */
LibraryStruct* m_Pnext; /* Point on next lib in chain. */
int m_Modified; /* flag indicateur d'edition */
int m_Size; // Size in bytes (for statistics)
unsigned long m_TimeStamp; // Signature temporelle
int m_Flags; // variable used in some functions
bool m_IsLibCache; /* False for the "standard" libraries,
......@@ -46,14 +46,26 @@ public:
*
* @return bool - true if success writing else false.
*/
bool SaveLibrary( const wxString& aFullFileName );
bool ReadHeader( FILE* file, int* LineNum );
bool Save( const wxString& aFullFileName );
/**
* Load library from file.
*
* @param errMsg - Error message if load fails.
*
* @return bool - True if load was successful otherwise false.
*/
bool Load( wxString& errMsg );
void InsertAliases( PriorQue** PQ, EDA_LibComponentStruct* component );
bool LoadDocs( wxString& errMsg );
private:
bool WriteHeader( FILE* file );
bool SaveHeader( FILE* file );
bool LoadHeader( FILE* file, int* LineNum );
void LoadAliases( EDA_LibComponentStruct* component );
void RemoveEntry( const wxString& name );
public:
LibraryStruct( const wxChar* fileName = NULL );
......@@ -65,7 +77,22 @@ public:
*/
bool IsEmpty()
{
return m_Entries == NULL;
return m_Entries.empty();
}
/**
* Get the number of entries in the library.
*
* @return The number of component and alias entries.
*/
int GetCount()
{
return m_Entries.size();
}
bool IsModified()
{
return m_IsModified;
}
/**
......@@ -73,8 +100,10 @@ public:
*
* @param names - String array to place entry names into.
* @param sort - Sort names if true.
* @param makeUpperCase - Force entry names to upper case.
*/
void GetEntryNames( wxArrayString& names, bool sort = true );
void GetEntryNames( wxArrayString& names, bool sort = true,
bool makeUpperCase = true );
/**
* Load string array with entry names matching name and/or key word.
......@@ -150,7 +179,7 @@ public:
*/
LibCmpEntry* GetFirstEntry()
{
return (LibCmpEntry*) PQFirst( &m_Entries, false );
return &m_Entries.front();
}
/**
......@@ -180,23 +209,19 @@ public:
*/
LibCmpEntry* GetPreviousEntry( const wxChar* name );
bool Save( const wxString& saveAsFile );
wxString GetName();
protected:
wxFileName m_fileName; /* Library file name. */
wxDateTime m_DateTime; /* Library save time and date. */
wxString m_Version; /* Library save version. */
PriorQue* m_Entries; /* Parts themselves are saved here. */
LIB_ENTRY_LIST m_Entries; /* Parts themselves are saved here. */
bool m_IsModified; /* Library modification status. */
friend class EDA_LibComponentStruct;
};
extern void FreeLibraryEntry( LibCmpEntry* Entry );
/**
* Case insensitive library name comparison.
*/
......
This diff is collapsed.
......@@ -218,7 +218,7 @@ bool LibDrawArc::HitTest( wxPoint aRefPoint, int aThreshold, const int aTransMat
}
LibDrawArc* LibDrawArc::GenCopy()
LibEDA_BaseStruct* LibDrawArc::DoGenCopy()
{
LibDrawArc* newitem = new LibDrawArc( GetParent() );
......@@ -233,7 +233,7 @@ LibDrawArc* LibDrawArc::GenCopy()
newitem->m_Convert = m_Convert;
newitem->m_Flags = m_Flags;
newitem->m_Fill = m_Fill;
return newitem;
return (LibEDA_BaseStruct*) newitem;
}
......@@ -477,7 +477,7 @@ bool LibDrawCircle::HitTest( wxPoint aPosRef, int aThreshold, const int aTransMa
}
LibDrawCircle* LibDrawCircle::GenCopy()
LibEDA_BaseStruct* LibDrawCircle::DoGenCopy()
{
LibDrawCircle* newitem = new LibDrawCircle( GetParent() );
......@@ -488,7 +488,7 @@ LibDrawCircle* LibDrawCircle::GenCopy()
newitem->m_Convert = m_Convert;
newitem->m_Flags = m_Flags;
newitem->m_Fill = m_Fill;
return newitem;
return (LibEDA_BaseStruct*) newitem;
}
......@@ -619,7 +619,7 @@ bool LibDrawSquare::Load( char* line, wxString& errorMsg )
}
LibDrawSquare* LibDrawSquare::GenCopy()
LibEDA_BaseStruct* LibDrawSquare::DoGenCopy()
{
LibDrawSquare* newitem = new LibDrawSquare( GetParent() );
......@@ -630,7 +630,7 @@ LibDrawSquare* LibDrawSquare::GenCopy()
newitem->m_Convert = m_Convert;
newitem->m_Flags = m_Flags;
newitem->m_Fill = m_Fill;
return newitem;
return (LibEDA_BaseStruct*) newitem;
}
......@@ -788,7 +788,7 @@ bool LibDrawSegment::Load( char* line, wxString& errorMsg )
}
LibDrawSegment* LibDrawSegment::GenCopy()
LibEDA_BaseStruct* LibDrawSegment::DoGenCopy()
{
LibDrawSegment* newitem = new LibDrawSegment( GetParent() );
......@@ -798,7 +798,7 @@ LibDrawSegment* LibDrawSegment::GenCopy()
newitem->m_Unit = m_Unit;
newitem->m_Convert = m_Convert;
newitem->m_Flags = m_Flags;
return newitem;
return (LibEDA_BaseStruct*) newitem;
}
......@@ -976,7 +976,7 @@ bool LibDrawPolyline::Load( char* line, wxString& errorMsg )
}
LibDrawPolyline* LibDrawPolyline::GenCopy()
LibEDA_BaseStruct* LibDrawPolyline::DoGenCopy()
{
LibDrawPolyline* newitem = new LibDrawPolyline( GetParent() );
......@@ -986,7 +986,7 @@ LibDrawPolyline* LibDrawPolyline::GenCopy()
newitem->m_Convert = m_Convert;
newitem->m_Flags = m_Flags;
newitem->m_Fill = m_Fill;
return newitem;
return (LibEDA_BaseStruct*) newitem;
}
......@@ -1238,7 +1238,7 @@ bool LibDrawBezier::Load( char* line, wxString& errorMsg )
}
LibDrawBezier* LibDrawBezier::GenCopy()
LibEDA_BaseStruct* LibDrawBezier::DoGenCopy()
{
LibDrawBezier* newitem = new LibDrawBezier(GetParent());
......@@ -1248,7 +1248,7 @@ LibDrawBezier* LibDrawBezier::GenCopy()
newitem->m_Convert = m_Convert;
newitem->m_Flags = m_Flags;
newitem->m_Fill = m_Fill;
return newitem;
return (LibEDA_BaseStruct*) newitem;
}
/** Function GetPenSize
......
This diff is collapsed.
......@@ -77,13 +77,22 @@ wxString DataBaseGetName( WinEDA_DrawFrame* frame, wxString& Keys,
void DisplayCmpDoc( wxString& Name )
{
LibCmpEntry* CmpEntry;
LibCmpEntry* CmpEntry = NULL;
LibraryStruct* Lib = g_LibraryList;
CmpEntry = FindLibPart( Name, wxEmptyString, ALIAS );
while( Lib != NULL && CmpEntry == NULL )
{
CmpEntry = Lib->FindEntry( Name );
Lib = Lib->m_Pnext;
}
if( CmpEntry == NULL )
return;
wxLogDebug( wxT( "Selected component <%s>, m_Doc: <%s>, m_KeyWord: <%s>." ),
(const wxChar*) Name, (const wxChar*) CmpEntry->m_Doc,
(const wxChar*) CmpEntry->m_KeyWord );
Name = wxT( "Description: " ) + CmpEntry->m_Doc;
Name += wxT( "\nKey Words: " ) + CmpEntry->m_KeyWord;
}
......@@ -452,7 +452,7 @@ bool DIALOG_EDIT_COMPONENT_IN_LIBRARY::ChangeNbUnitsPerPackage( int MaxUnit )
{
for( ii = OldNumUnits + 1; ii <= MaxUnit; ii++ )
{
NextDrawItem = CopyDrawEntryStruct( DrawItem );
NextDrawItem = DrawItem->GenCopy();
NextDrawItem->SetNext( CurrentLibEntry->m_Drawings );
CurrentLibEntry->m_Drawings = NextDrawItem;
NextDrawItem->m_Unit = ii;
......@@ -499,7 +499,7 @@ bool DIALOG_EDIT_COMPONENT_IN_LIBRARY::SetUnsetConvert()
g_AsDeMorgan = 0; return FALSE;
}
}
NextDrawItem = CopyDrawEntryStruct( DrawItem );
NextDrawItem = DrawItem->GenCopy();
NextDrawItem->SetNext( CurrentLibEntry->m_Drawings );
CurrentLibEntry->m_Drawings = NextDrawItem;
NextDrawItem->m_Convert = 2;
......
......@@ -18,15 +18,15 @@
#include "dialog_load_error.h"
/****************************************************************************/
/** Function LoadLibraryName
/**
* 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 )
......@@ -60,9 +60,7 @@ LibraryStruct* LoadLibraryName( WinEDA_DrawFrame* frame,
tmplib->m_Pnext = NewLib;
}
fn = FullLibName;
fn.SetExt( DOC_EXT );
LoadDocLib( frame, fn.GetFullPath(), NewLib->m_Name );
NewLib->LoadDocs( errMsg );
}
else
{
......@@ -79,7 +77,9 @@ library <%s>" ),
}
/** Function LoadLibraries
/**
* Function LoadLibraries
*
* Clear all already loaded libraries and load all librairies
* given in frame->m_ComponentLibFiles
*/
......@@ -200,12 +200,11 @@ void LoadLibraries( WinEDA_SchematicFrame* frame )
}
/**************************************************************/
/** Function FreeCmpLibrary
/**
* Function FreeCmpLibrary
*
* Routine to remove and free a library from the current loaded libraries.
*/
/**************************************************************/
void FreeCmpLibrary( wxWindow* frame, const wxString& LibName )
{
int NumOfLibs = NumOfLibraries();
......@@ -247,7 +246,9 @@ void FreeCmpLibrary( wxWindow* frame, const wxString& LibName )
}
/** Function LibraryEntryCompare
/**
* Function LibraryEntryCompare
*
* Routine to compare two EDA_LibComponentStruct for the PriorQue module.
* Comparison (insensitive case) is based on Part name.
*/
......@@ -259,8 +260,8 @@ int LibraryEntryCompare( EDA_LibComponentStruct* LE1,
/*****************************************************************************
* Routine to find the library given its name. *
*****************************************************************************/
* Routine to find the library given its name.
*****************************************************************************/
LibraryStruct* FindLibrary( const wxString& Name )
{
LibraryStruct* Lib = g_LibraryList;
......@@ -277,8 +278,8 @@ LibraryStruct* FindLibrary( const wxString& Name )
/*****************************************************************************
* Routine to find the number of libraries currently loaded. *
*****************************************************************************/
* Routine to find the number of libraries currently loaded.
*****************************************************************************/
int NumOfLibraries()
{
int ii;
......@@ -289,83 +290,3 @@ int NumOfLibraries()
return ii;
}
/*******************************************************/
/* Routines de lecture des Documentation de composants */
/*******************************************************/
/* Routine to load a library from given open file.*/
int LoadDocLib( WinEDA_DrawFrame* frame, const wxString& FullDocLibName,
const wxString& Libname )
{
int LineNum = 0;
char Line[1024], * Name, * Text;
LibCmpEntry* Entry;
FILE* f;
wxString msg;
f = wxFopen( FullDocLibName, wxT( "rt" ) );
if( f == NULL )
return 0;
if( GetLine( f, Line, &LineNum, sizeof(Line) ) == NULL )
{
/* pas de lignes utiles */
fclose( f );
return 0;
}
if( strnicmp( Line, DOCFILE_IDENT, 10 ) != 0 )
{
DisplayError( frame, wxT( "File is NOT EESCHEMA doclib!" ) );
fclose( f );
return 0;
}
while( GetLine( f, Line, &LineNum, sizeof(Line) ) )
{
if( strncmp( Line, "$CMP", 4 ) != 0 )
{
msg.Printf( wxT( "$CMP command expected in line %d, aborted." ),
LineNum );
DisplayError( frame, msg );
fclose( f );
return 0;
}
/* Read one $CMP/$ENDCMP part entry from library: */
Name = strtok( Line + 5, "\n\r" );
wxString cmpname;
cmpname = CONV_FROM_UTF8( Name );
Entry = FindLibPart( cmpname, Libname, ALIAS );
while( GetLine( f, Line, &LineNum, sizeof(Line) ) )
{
if( strncmp( Line, "$ENDCMP", 7 ) == 0 )
break;
Text = strtok( Line + 2, "\n\r" );
switch( Line[0] )
{
case 'D':
if( Entry )
Entry->m_Doc = CONV_FROM_UTF8( Text );
break;
case 'K':
if( Entry )
Entry->m_KeyWord = CONV_FROM_UTF8( Text );
break;
case 'F':
if( Entry )
Entry->m_DocFile = CONV_FROM_UTF8( Text );
break;
}
}
}
fclose( f );
return 1;
}
This diff is collapsed.
......@@ -127,7 +127,7 @@ void WinEDA_LibeditFrame::OnExportPart( wxCommandEvent& event )
/* Sauvegarde du composant: */
CurrentLib = NewLib;
SaveOnePartInMemory();
bool success = NewLib->SaveLibrary( fn.GetFullPath() );
bool success = NewLib->Save( fn.GetFullPath() );
if( success )
{
......
/*****************************************************************/
/* Headers for library definition and lib component definitions */
/* Headers for library definition and lib component definitions */
/*****************************************************************/
#ifndef LIBCMP_H
#define LIBCMP_H
#include "priorque.h"
#define LIB_VERSION_MAJOR 2
#define LIB_VERSION_MINOR 3
......@@ -14,7 +13,7 @@
#define DOC_EXT wxT( "dcm" ) /* Ext. of documentation files */
//Offsets used in editing library component, for handle aliad dats
//Offsets used in editing library component, for handle alias data
#define ALIAS_NAME 0
#define ALIAS_DOC 1
#define ALIAS_KEYWORD 2
......
/****************************/
/* EESchema - libedit.cpp */
/* EESchema - libedit.cpp */
/****************************/
/* Routines de maintenanace des librairies:
......@@ -86,7 +86,7 @@ bool WinEDA_LibeditFrame::LoadOneLibraryPart()
if( g_ScreenLib->IsModify() )
{
if( !IsOK( this, _( "Current Part not saved.\nContinue?" ) ) )
if( !IsOK( this, _( "Current part not saved.\nContinue?" ) ) )
return FALSE;
}
......@@ -115,7 +115,8 @@ bool WinEDA_LibeditFrame::LoadOneLibraryPart()
if( LibEntry == NULL )
{
msg = _( "Component \"" ); msg << CmpName << _( "\" not found." );
msg = _( "Component \"" );
msg << CmpName << _( "\" not found." );
DisplayError( this, msg );
return FALSE;
}
......@@ -144,7 +145,7 @@ bool WinEDA_LibeditFrame::LoadOneLibraryPartAux( LibCmpEntry* LibEntry,
{
wxString msg, cmpName, rootName;
if( (LibEntry == NULL) || (Library == NULL) )
if( ( LibEntry == NULL ) || ( Library == NULL ) )
return false;
if( LibEntry->m_Name.m_Text.IsEmpty() )
......@@ -263,33 +264,33 @@ void WinEDA_LibeditFrame::SaveActiveLibrary()
if( CurrentLib == NULL )
{
DisplayError( this, wxT( "No Library specified" ) );
DisplayError( this, wxT( "No library specified" ) );
return;
}
fn = wxFileName( CurrentLib->m_FullFileName );
msg = _( "Modify Library File \"" ) + fn.GetFullPath() + _( "\"?" );
msg = _( "Modify library file \"" ) + fn.GetFullPath() + _( "\"?" );
if( !IsOK( this, msg ) )
return;
bool success = CurrentLib->SaveLibrary( fn.GetFullPath() );
bool success = CurrentLib->Save( fn.GetFullPath() );
MsgPanel->EraseMsgBox();
if( !success )
{
msg = _( "Error while saving Library File \"" ) + fn.GetFullPath() +
msg = _( "Error while saving library file \"" ) + fn.GetFullPath() +
_( "\"." );
Affiche_1_Parametre( this, 1, wxT( " *** ERROR : **" ), msg, BLUE );
DisplayError( this, msg );
}
else
{
msg = _( "Library File \"" ) + fn.GetFullName() + wxT( "\" Ok" );
msg = _( "Library file \"" ) + fn.GetFullName() + wxT( "\" Ok" );
fn.SetExt( DOC_EXT );
wxString msg1 = _( "Document File \"" ) + fn.GetFullPath() +
wxString msg1 = _( "Document file \"" ) + fn.GetFullPath() +
wxT( "\" Ok" );
Affiche_1_Parametre( this, 1, msg, msg1, BLUE );
}
......@@ -476,7 +477,7 @@ void WinEDA_LibeditFrame::SaveOnePartInMemory()
if( CurrentLib == NULL )
{
DisplayError( this, _( "No Library specified." ) );
DisplayError( this, _( "No library specified." ) );
return;
}
......
/****************************/
/* EESchema - libframe.cpp */
/* EESchema - libframe.cpp */
/****************************/
/* Gestion de la frame d'edition des composants en librairie
......@@ -200,7 +200,7 @@ void WinEDA_LibeditFrame::OnCloseWindow( wxCloseEvent& Event )
for( Lib = g_LibraryList; Lib != NULL; Lib = Lib->m_Pnext )
{
if( Lib->m_Modified )
if( Lib->IsModified() )
{
wxString msg;
msg.Printf( _( "Library \"%s\" was modified!\nDiscard changes?" ),
......@@ -352,7 +352,7 @@ int WinEDA_LibeditFrame::BestZoom()
}
size = DrawPanel->GetClientSize();
size -= wxSize(100,100); // reserve 100 mils margin
size -= wxSize( 100, 100 ); // reserve 100 mils margin
ii = abs( dx / size.x );
jj = abs( dy / size.y );
......@@ -659,7 +659,8 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_LIBEDIT_DELETE_ITEM_BUTT:
if( CurrentLibEntry == NULL )
{
wxBell(); break;
wxBell();
break;
}
SetToolID( id, wxCURSOR_BULLSEYE, _( "Delete item" ) );
break;
......
This diff is collapsed.
This diff is collapsed.
/*****************************************************************************
* Definitions, visible to others, of Priority Queue module: *
*****************************************************************************/
#ifndef PRIOR_Q_GH
#define PRIOR_Q_GH
typedef struct PriorQue
{
struct PriorQue *Right, *Left; /* Pointers to two sons of this node. */
void * Data; /* Pointers to the data itself. */
} PriorQue;
typedef int (*PQCompFuncType)( void *, void *); /* Comparison function. */
/* And global function prototypes: */
void PQInit(PriorQue **PQ);
int PQEmpty(PriorQue *PQ);
void PQCompFunc(PQCompFuncType NewCompFunc);
void * PQFirst(PriorQue **PQ, int Delete);
void * PQInsert(PriorQue **PQ, void * NewItem);
void * PQDelete(PriorQue **PQ, void * NewItem);
void * PQFind(PriorQue *PQ, void * OldItem);
void * PQNext(PriorQue *PQ, void * CmpItem, void * BiggerThan);
void PQPrint(PriorQue *PQ, void (*PrintFunc)());
void PQFree(PriorQue *PQ, int FreeItems);
void PQFreeFunc(PriorQue *PQ, void (*FreeFunc)(void *));
#endif /* PRIOR_Q_GH */
......@@ -91,9 +91,6 @@ wxPoint TransformCoordinate( const int aTransformMatrix[2][2],
const wxPoint& aPosition );
LibraryStruct* FindLibrary( const wxString& Name );
int LoadDocLib( WinEDA_DrawFrame* frame,
const wxString& FullDocLibName,
const wxString& Libname );
LibraryStruct* LoadLibraryName( WinEDA_DrawFrame* frame,
const wxString& FullLibName,
const wxString& LibName );
......@@ -236,18 +233,6 @@ bool Read_Hotkey_Config( WinEDA_DrawFrame* frame, bool verbose );
/* SAVELIB.CPP */
/**************/
LibEDA_BaseStruct* CopyDrawEntryStruct( LibEDA_BaseStruct* DrawItem );
/* Routine de Duplication d'une structure DrawLibItem d'une partlib
* Parametres d'entree:
* DrawEntry = pointeur sur la structure a dupliquer
* La structure nouvelle est creee, mais n'est pas inseree dans le
* chainage
* Retourne:
* Pointeur sur la structure creee (ou NULL si impossible)
*/
EDA_LibComponentStruct* CopyLibEntryStruct( EDA_LibComponentStruct* OldEntry );
/* Routine de copie d'une partlib
......
/****************************/
/* EESchema - eesavlib.cpp */
/* EESchema - eesavlib.cpp */
/****************************/
/* Functions to save schematic libraries and library components (::Save()
......@@ -19,61 +19,6 @@
#include "protos.h"
/** Function CopyDrawEntryStruct
* Duplicate a DrawLibItem
* the new item is only created, it is not put in the current component linked
* list
* @param DrawEntry = DrawLibItem * item to duplicate
* @return a pointer to the new item
* A better way to duplicate a DrawLibItem is to have a virtual GenCopy() in
* LibEDA_BaseStruct class (ToDo).
*/
LibEDA_BaseStruct* CopyDrawEntryStruct( LibEDA_BaseStruct* DrawItem )
{
wxString msg;
LibEDA_BaseStruct* NewDrawItem = NULL;
switch( DrawItem->Type() )
{
case COMPONENT_ARC_DRAW_TYPE:
NewDrawItem = ( (LibDrawArc*) DrawItem )->GenCopy();
break;
case COMPONENT_CIRCLE_DRAW_TYPE:
NewDrawItem = ( (LibDrawCircle*) DrawItem )->GenCopy();
break;
case COMPONENT_RECT_DRAW_TYPE:
NewDrawItem = ( (LibDrawSquare*) DrawItem )->GenCopy();
break;
case COMPONENT_PIN_DRAW_TYPE:
NewDrawItem = ( (LibDrawPin*) DrawItem )->GenCopy();
break;
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE:
NewDrawItem = ( (LibDrawText*) DrawItem )->GenCopy();
break;
case COMPONENT_POLYLINE_DRAW_TYPE:
NewDrawItem = ( (LibDrawPolyline*) DrawItem )->GenCopy();
break;
case COMPONENT_BEZIER_DRAW_TYPE:
NewDrawItem = ( (LibDrawBezier*) DrawItem )->GenCopy();
break;
default:
msg.Printf( wxT( "CopyDrawLibEntryStruct: unknown Draw Type %d" ),
DrawItem->Type() );
wxLogError( msg );
break;
}
return NewDrawItem;
}
/*
* Routine de copie d'une partlib
* Parametres d'entree: pointeur sur la structure de depart
......@@ -118,7 +63,7 @@ EDA_LibComponentStruct* CopyLibEntryStruct( EDA_LibComponentStruct* OldEntry )
for( OldField = OldEntry->m_Fields; OldField != NULL;
OldField = OldField->Next() )
{
NewField = OldField->GenCopy();
NewField = (LibDrawField*) OldField->GenCopy();
NewStruct->m_Fields.PushBack( NewField );
}
......@@ -130,7 +75,8 @@ EDA_LibComponentStruct* CopyLibEntryStruct( EDA_LibComponentStruct* OldEntry )
if( ( OldDrawings->m_Flags & IS_NEW ) != 0 )
continue;
NewDrawings = CopyDrawEntryStruct( OldDrawings );
NewDrawings = OldDrawings->GenCopy();
if( NewDrawings )
{
if( LastItem == NULL )
......@@ -141,7 +87,7 @@ EDA_LibComponentStruct* CopyLibEntryStruct( EDA_LibComponentStruct* OldEntry )
LastItem = NewDrawings;
NewDrawings->SetNext( NULL );
}
else // Should never occur, just in case...
else // Should never occur, just in case...
{ // CopyDrawEntryStruct() was not able to duplicate the type
// of OldDrawings
// occurs when an unexpected type is encountered
......
......@@ -2,9 +2,6 @@
/* EESchema - selpart.cpp */
/**************************/
/* Routine de selection d'un composant en librairie
*/
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
......@@ -16,32 +13,24 @@
#include "protos.h"
/* Routines locales */
/* Variables locales */
/***************************************************************/
LibraryStruct* SelectLibraryFromList( WinEDA_DrawFrame* frame )
/***************************************************************/
{
int ii, NumOfLibs = NumOfLibraries();
LibraryStruct* Lib = NULL;
static wxString OldLibName;
wxString LibName;
wxString LibName, msg;
int count = NumOfLibraries();
LibraryStruct* Lib = NULL;
if( NumOfLibs == 0 )
if( count == 0 )
{
DisplayError( frame, _( "No libraries are loaded" ) );
return NULL;
}
WinEDAListBox ListBox( frame, _( "Select Lib" ),
NULL, OldLibName, NULL,
wxColour( 255, 255, 255 ) ); // Library browser background color
msg.Printf( _( " Select 1 of %d libraries." ), count );
wxArrayString libNamesList;
LibraryStruct* libcache = NULL;
for( LibraryStruct* Lib = g_LibraryList; Lib != NULL; Lib = Lib->m_Pnext )
{
if( Lib->m_IsLibCache )
......@@ -56,17 +45,20 @@ LibraryStruct* SelectLibraryFromList( WinEDA_DrawFrame* frame )
if( libcache )
libNamesList.Add( libcache->m_Name );
ListBox.InsertItems( libNamesList );
wxSingleChoiceDialog dlg( frame, msg, _( "Select Library" ), libNamesList );
int index = libNamesList.Index( OldLibName );
ListBox.MoveMouseToOrigin();
if( index != wxNOT_FOUND )
dlg.SetSelection( index );
ii = ListBox.ShowModal();
if( dlg.ShowModal() == wxID_CANCEL || dlg.GetStringSelection().IsEmpty() )
return NULL;
if( ii >= 0 ) /* Recherche de la librairie */
{
Lib = FindLibrary( libNamesList[ii] );
}
Lib = FindLibrary( dlg.GetStringSelection() );
if( Lib != NULL )
OldLibName = dlg.GetStringSelection();
return Lib;
}
......@@ -77,7 +69,6 @@ int DisplayComponentsNamesInLib( WinEDA_DrawFrame* frame,
wxString& Buffer, wxString& OldName )
{
size_t i;
wxString msg;
wxArrayString nameList;
const wxChar** ListNames;
......@@ -92,14 +83,11 @@ int DisplayComponentsNamesInLib( WinEDA_DrawFrame* frame,
ListNames = (const wxChar**) MyZMalloc( ( nameList.GetCount() + 1 ) *
sizeof( wxChar* ) );
msg.Printf( _( "Select 1 of %d components from library <%s>" ),
nameList.GetCount(), (const wxChar*) Library->m_Name );
for( i = 0; i < nameList.GetCount(); i++ )
ListNames[i] = (const wxChar*) nameList[i];
WinEDAListBox dlg( frame, msg, ListNames, OldName, DisplayCmpDoc,
wxColour( 255, 255, 255 ) );
WinEDAListBox dlg( frame, _( "Select Component" ), ListNames, OldName,
DisplayCmpDoc, wxColour( 255, 255, 255 ) );
dlg.MoveMouseToOrigin();
......@@ -117,10 +105,8 @@ int DisplayComponentsNamesInLib( WinEDA_DrawFrame* frame,
}
/************************************************************/
int GetNameOfPartToLoad( WinEDA_DrawFrame* frame,
LibraryStruct* Library, wxString& BufName )
/************************************************************/
int GetNameOfPartToLoad( WinEDA_DrawFrame* frame, LibraryStruct* Library,
wxString& BufName )
{
int ii;
static wxString OldCmpName;
......
/*************************************************/
/* Functions to Load from file and save to file */
/* the graphic shapes used to draw a component */
/* When using the import/export symbol options */
/* When using the import/export symbol options */
/* files are the *.sym files */
/*************************************************/
......@@ -109,7 +109,7 @@ void WinEDA_LibeditFrame::LoadOneSymbol( void )
return;
}
if( Lib->m_NumOfParts > 1 )
if( Lib->GetCount() > 1 )
DisplayError( this, _( "Warning: more than 1 part in Symbol File" ) );
Component = (EDA_LibComponentStruct*) Lib->GetFirstEntry();
......@@ -240,10 +240,10 @@ void WinEDA_LibeditFrame::SaveOneSymbol()
for( ; DrawEntry != NULL; DrawEntry = DrawEntry->Next() )
{
/* Elimination des elements non relatifs a l'unite */
if( Unit && DrawEntry->m_Unit && (DrawEntry->m_Unit != Unit) )
if( Unit && DrawEntry->m_Unit && ( DrawEntry->m_Unit != Unit ) )
continue;
if( convert && DrawEntry->m_Convert
&& (DrawEntry->m_Convert != convert) )
&& ( DrawEntry->m_Convert != convert ) )
continue;
DrawEntry->Save( ExportFile );
......@@ -401,10 +401,10 @@ static bool CompareSymbols( LibEDA_BaseStruct* DEntryRef,
/***************************************************************************/
/* Routine de placement du point d'ancrage ( reference des coordonnes pour */
/* le trace) du composant courant */
/* Toutes les coord apparaissant dans les structures sont modifiees */
/* pour repositionner le point repere par le curseur souris au point */
/* d'ancrage ( coord 0,0 ). */
/* le trace) du composant courant */
/* Toutes les coord apparaissant dans les structures sont modifiees */
/* pour repositionner le point repere par le curseur souris au point */
/* d'ancrage ( coord 0,0 ). */
/***************************************************************************/
void WinEDA_LibeditFrame::PlaceAncre()
{
......
......@@ -111,7 +111,8 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father,
m_LibList =
new wxListBox( m_LibListWindow, ID_LIBVIEW_LIB_LIST,
wxPoint( 0, 0 ),
m_LibListWindow->GetClientSize() - wxSize(EXTRA_BORDER_SIZE*2,0),
m_LibListWindow->GetClientSize() -
wxSize( EXTRA_BORDER_SIZE * 2, 0 ),
0, NULL, wxLB_HSCROLL );
}
else
......@@ -135,7 +136,8 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father,
m_CmpListWindow->SetExtraBorderSize( EXTRA_BORDER_SIZE );
m_CmpList = new wxListBox( m_CmpListWindow, ID_LIBVIEW_CMP_LIST,
wxPoint( 0, 0 ),
m_CmpListWindow->GetClientSize() - wxSize(EXTRA_BORDER_SIZE*2,0),
m_CmpListWindow->GetClientSize() -
wxSize( EXTRA_BORDER_SIZE * 2, 0 ),
0, NULL, wxLB_HSCROLL );
if( m_LibList )
......@@ -231,7 +233,8 @@ void WinEDA_ViewlibFrame::OnSize( wxSizeEvent& SizeEv )
if( m_VToolBar )
{
Vtoolbar_size = m_VToolBar->GetSize();
m_VToolBar->SetSize( clientsize.x - maintoolbar_size.y, 0, -1, clientsize.y );
m_VToolBar->SetSize( clientsize.x - maintoolbar_size.y, 0, -1,
clientsize.y );
}
if( MsgPanel )
......@@ -242,7 +245,8 @@ void WinEDA_ViewlibFrame::OnSize( wxSizeEvent& SizeEv )
if( DrawPanel )
{
DrawPanel->SetSize( m_LibListSize.x + m_CmpListSize.x, 0,
clientsize.x - Vtoolbar_size.x - m_LibListSize.x - m_CmpListSize.x,
clientsize.x - Vtoolbar_size.x -
m_LibListSize.x - m_CmpListSize.x,
clientsize.y );
}
......@@ -250,7 +254,8 @@ void WinEDA_ViewlibFrame::OnSize( wxSizeEvent& SizeEv )
{
m_LibListSize.y = clientsize.y - 2;
m_LibListWindow->SetSize( m_LibListSize );
m_LibList->SetSize( m_LibListWindow->GetClientSize() - wxSize(EXTRA_BORDER_SIZE*2,0) );
m_LibList->SetSize( m_LibListWindow->GetClientSize() -
wxSize( EXTRA_BORDER_SIZE * 2, 0 ) );
}
if( m_CmpList && m_CmpListWindow )
......@@ -258,7 +263,8 @@ void WinEDA_ViewlibFrame::OnSize( wxSizeEvent& SizeEv )
m_CmpListSize.y = clientsize.y - 2;
m_CmpListWindow->SetSize( m_CmpListSize );
m_CmpListWindow->SetPosition( wxPoint( m_LibListSize.x, 0 ) );
m_CmpList->SetSize( m_CmpListWindow->GetClientSize() - wxSize(EXTRA_BORDER_SIZE*2,0) );
m_CmpList->SetSize( m_CmpListWindow->GetClientSize() -
wxSize( EXTRA_BORDER_SIZE * 2, 0 ) );
}
SizeEv.Skip();
......@@ -285,7 +291,8 @@ int WinEDA_ViewlibFrame::BestZoom()
return bestzoom;
}
EDA_Rect BoundaryBox = CurrentLibEntry->GetBoundaryBox( g_ViewUnit, g_ViewConvert );
EDA_Rect BoundaryBox = CurrentLibEntry->GetBoundaryBox( g_ViewUnit,
g_ViewConvert );
itemsize = BoundaryBox.GetSize();
size = DrawPanel->GetClientSize();
......@@ -331,12 +338,12 @@ void WinEDA_ViewlibFrame::ReCreateListLib()
if ( libcache )
libNamesList.Add( libcache->m_Name );
m_LibList->Append(libNamesList);
m_LibList->Append( libNamesList );
// Search for a previous selection:
for ( unsigned ii = 0; ii < m_LibList->GetCount(); ii++ )
{
if( g_CurrentViewLibraryName.Cmp( m_LibList->GetString(ii) ) == 0 )
if( g_CurrentViewLibraryName.Cmp( m_LibList->GetString( ii ) ) == 0 )
{
m_LibList->SetSelection( ii, TRUE );
found = TRUE;
......@@ -344,7 +351,8 @@ void WinEDA_ViewlibFrame::ReCreateListLib()
}
}
/* If not found, clear current library selection because it can be deleted after a config change
/* If not found, clear current library selection because it can be
* deleted after a config change.
*/
if( !found )
{
......@@ -364,7 +372,7 @@ void WinEDA_ViewlibFrame::ReCreateListCmp()
if( m_CmpList == NULL )
return;
LibraryStruct* Library = FindLibrary( g_CurrentViewLibraryName.GetData() );
LibraryStruct* Library = FindLibrary( g_CurrentViewLibraryName );
wxArrayString nameList;
m_CmpList->Clear();
......@@ -378,9 +386,7 @@ void WinEDA_ViewlibFrame::ReCreateListCmp()
}
/********************************************************************/
void WinEDA_ViewlibFrame::ClickOnLibList( wxCommandEvent& event )
/********************************************************************/
{
int ii = m_LibList->GetSelection();
......@@ -398,9 +404,7 @@ void WinEDA_ViewlibFrame::ClickOnLibList( wxCommandEvent& event )
}
/****************************************************************/
void WinEDA_ViewlibFrame::ClickOnCmpList( wxCommandEvent& event )
/****************************************************************/
{
int ii = m_CmpList->GetSelection();
......@@ -418,12 +422,11 @@ void WinEDA_ViewlibFrame::ClickOnCmpList( wxCommandEvent& event )
}
/****************************************************************************/
void WinEDA_ViewlibFrame::ExportToSchematicLibraryPart( wxCommandEvent& event )
/****************************************************************************/
/* Export the current component to schematic and close the library browser
/*
* Export the current component to schematic and close the library browser
*/
void WinEDA_ViewlibFrame::ExportToSchematicLibraryPart( wxCommandEvent& event )
{
int ii = m_CmpList->GetSelection();
......
......@@ -17,18 +17,12 @@
#include "id.h"
#define NEXT_PART 1
#define NEW_PART 0
#define NEXT_PART 1
#define NEW_PART 0
#define PREVIOUS_PART -1
/* Routines locales */
/* Variables locales */
/*************************************************************************/
void WinEDA_ViewlibFrame::Process_Special_Functions( wxCommandEvent& event )
/*************************************************************************/
{
wxString msg;
EDA_LibComponentStruct* LibEntry;
......@@ -63,7 +57,7 @@ void WinEDA_ViewlibFrame::Process_Special_Functions( wxCommandEvent& event )
ALIAS );
if( LibEntry && ( !LibEntry->m_DocFile.IsEmpty() ) )
GetAssociatedDocument( this, LibEntry->m_DocFile,
& wxGetApp().GetLibraryPathList());
&wxGetApp().GetLibraryPathList() );
break;
case ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT:
......@@ -96,26 +90,20 @@ void WinEDA_ViewlibFrame::Process_Special_Functions( wxCommandEvent& event )
}
/*************************************************************************/
void WinEDA_ViewlibFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
/*************************************************************************/
{
}
/********************************************************************************/
bool WinEDA_ViewlibFrame::OnRightClick( const wxPoint& MousePos,
wxMenu* PopMenu )
/********************************************************************************/
{
return true;
}
/**********************************************/
void WinEDA_ViewlibFrame::DisplayLibInfos()
/**********************************************/
/* Affiche en Ligne d'info la librairie en cours de visualisation */
void WinEDA_ViewlibFrame::DisplayLibInfos()
{
wxString msg;
LibraryStruct* Lib;
......@@ -136,7 +124,7 @@ void WinEDA_ViewlibFrame::DisplayLibInfos()
/*****************************************/
/* Routine to Select Current library */
/* Routine to Select Current library */
/*****************************************/
void WinEDA_ViewlibFrame::SelectCurrentLibrary()
{
......@@ -162,10 +150,10 @@ void WinEDA_ViewlibFrame::SelectCurrentLibrary()
}
/**************************************************************/
/*
* Routine to select and view library Part (NEW, NEXT or PREVIOUS)
*/
void WinEDA_ViewlibFrame::SelectAndViewLibraryPart( int option )
/**************************************************************/
/* Routine to select and view library Part (NEW, NEXT or PREVIOUS) */
{
LibraryStruct* Lib;
......@@ -209,15 +197,14 @@ void WinEDA_ViewlibFrame::ViewOneLibraryContent( LibraryStruct* Lib, int Flag )
wxString CmpName;
wxClientDC dc( DrawPanel );
DrawPanel->PrepareGraphicContext( &dc );
if( Lib )
NumOfParts = Lib->m_NumOfParts;
NumOfParts = Lib->GetCount();
if( NumOfParts == 0 )
{
DisplayError( this, wxT( "No Library or Library is empty!" ) );
DisplayError( this, wxT( "No library or library is empty!" ) );
return;
}
......@@ -226,9 +213,7 @@ void WinEDA_ViewlibFrame::ViewOneLibraryContent( LibraryStruct* Lib, int Flag )
if( Flag == NEW_PART )
{
DisplayComponentsNamesInLib( this,
Lib,
CmpName,
DisplayComponentsNamesInLib( this, Lib, CmpName,
g_CurrentViewComponentName );
}
......@@ -269,7 +254,7 @@ void WinEDA_ViewlibFrame::ViewOneLibraryContent( LibraryStruct* Lib, int Flag )
/*****************************************************************************/
/* Routine d'affichage du composant selectionne */
/* Si Le composant est un alias, le composant ROOT est recherche et affiche */
/* Si Le composant est un alias, le composant ROOT est recherche et affiche */
/*****************************************************************************/
void WinEDA_ViewlibFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
{
......
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