Loading eeschema/eelibs_read_libraryfiles.cpp +0 −24 Original line number Original line Diff line number Diff line Loading @@ -257,30 +257,6 @@ void FreeCmpLibrary (wxWindow* frame, const wxString& LibName) } } /******************************/ /** GetLibNames() * Routine to return pointers to all library names. * User is responsible to deallocate memory */ /******************************/ const wxChar** GetLibNames() { int ii, NumOfLibs = NumOfLibraries(); const wxChar** Names; LibraryStruct* Lib; Names = (const wxChar**) MyZMalloc( sizeof(wxChar*) * (NumOfLibs + 1) ); for( ii = 0, Lib = g_LibraryList; Lib != NULL; Lib = Lib->m_Pnext, ii++ ) { Names[ii] = Lib->m_Name.GetData(); } Names[ii] = NULL; return Names; } /** Function LibraryEntryCompare /** Function LibraryEntryCompare * Routine to compare two EDA_LibComponentStruct for the PriorQue module. * Routine to compare two EDA_LibComponentStruct for the PriorQue module. * Comparison (insensitive case) is based on Part name. * Comparison (insensitive case) is based on Part name. Loading eeschema/find.cpp +11 −23 Original line number Original line Diff line number Diff line Loading @@ -627,12 +627,12 @@ SCH_ITEM* WinEDA_SchematicFrame::FindSchematicItem( void WinEDA_FindFrame::LocatePartInLibs( wxCommandEvent& event ) void WinEDA_FindFrame::LocatePartInLibs( wxCommandEvent& event ) /*************************************************************/ /*************************************************************/ /* Recherche exhaustive d'un composant en librairies, meme non chargees /* Search for a given component. * The serach is made in loaded libraries, * and if not found in all libraries found in lib paths. */ */ { { wxString Text, FindList; wxString Text, FindList; const wxChar** ListNames; LibraryStruct* Lib = NULL; EDA_LibComponentStruct* LibEntry; EDA_LibComponentStruct* LibEntry; bool FoundInLib = FALSE; // True si reference trouvee ailleurs qu'en cache bool FoundInLib = FALSE; // True si reference trouvee ailleurs qu'en cache Loading @@ -643,33 +643,23 @@ void WinEDA_FindFrame::LocatePartInLibs( wxCommandEvent& event ) } } s_OldStringFound = Text; s_OldStringFound = Text; int ii, nbitems, NumOfLibs = NumOfLibraries(); if( NumOfLibraries() == 0 ) if( NumOfLibs == 0 ) { { DisplayError( this, _( "No libraries are loaded" ) ); DisplayError( this, _( "No libraries are loaded" ) ); Close(); return; Close(); return; } } ListNames = GetLibNames(); nbitems = 0; int nbitemsFound = 0; for( ii = 0; ii < NumOfLibs; ii++ ) /* Recherche de la librairie */ for( LibraryStruct* Lib = g_LibraryList; Lib != NULL; Lib = Lib->m_Pnext ) { { bool IsLibCache; Lib = FindLibrary( ListNames[ii] ); if( Lib == NULL ) break; if( Lib->m_Name.Contains( wxT( ".cache" ) ) ) IsLibCache = TRUE; else IsLibCache = FALSE; LibEntry = (EDA_LibComponentStruct*) PQFirst( &Lib->m_Entries, FALSE ); LibEntry = (EDA_LibComponentStruct*) PQFirst( &Lib->m_Entries, FALSE ); while( LibEntry ) while( LibEntry ) { { if( WildCompareString( Text, LibEntry->m_Name.m_Text, FALSE ) ) if( WildCompareString( Text, LibEntry->m_Name.m_Text, FALSE ) ) { { nbitems++; nbitemsFound++; if( !IsLibCache ) if( !Lib->m_IsLibCache ) FoundInLib = TRUE; FoundInLib = TRUE; if( !FindList.IsEmpty() ) if( !FindList.IsEmpty() ) FindList += wxT( "\n" ); FindList += wxT( "\n" ); Loading @@ -681,11 +671,9 @@ void WinEDA_FindFrame::LocatePartInLibs( wxCommandEvent& event ) } } } } free( ListNames ); if( !FoundInLib ) if( !FoundInLib ) { { if( nbitems ) if( nbitemsFound ) FindList = wxT( "\n" ) + Text + _( " found only in cache" ); FindList = wxT( "\n" ) + Text + _( " found only in cache" ); else else FindList = Text + _( " not found" ); FindList = Text + _( " not found" ); Loading Loading @@ -719,7 +707,7 @@ int WinEDA_FindFrame::ExploreAllLibraries( const wxString& wildmask, wxString& F for( unsigned ii = 0; ii < wxGetApp().GetLibraryPathList().GetCount(); ii++ ) for( unsigned ii = 0; ii < wxGetApp().GetLibraryPathList().GetCount(); ii++ ) { { path = wxGetApp().GetLibraryPathList()[ii]; path = wxGetApp().GetLibraryPathList()[ii] + STRING_DIR_SEP; FullFileName = wxFindFirstFile( path + wxT( "*." ) + CompLibFileExtension ); FullFileName = wxFindFirstFile( path + wxT( "*." ) + CompLibFileExtension ); while( !FullFileName.IsEmpty() ) while( !FullFileName.IsEmpty() ) Loading eeschema/protos.h +0 −1 Original line number Original line Diff line number Diff line Loading @@ -80,7 +80,6 @@ LibraryStruct * LoadLibraryName(WinEDA_DrawFrame * frame, const wxString & FullLibName, const wxString & LibName); const wxString & FullLibName, const wxString & LibName); void LoadLibraries( WinEDA_SchematicFrame* frame ); void LoadLibraries( WinEDA_SchematicFrame* frame ); void FreeCmpLibrary(wxWindow * frame, const wxString & LibName); void FreeCmpLibrary(wxWindow * frame, const wxString & LibName); const wxChar **GetLibNames(); void SnapLibItemPoint(int OrigX, int OrigY, int *ClosestX, int *ClosestY, void SnapLibItemPoint(int OrigX, int OrigY, int *ClosestX, int *ClosestY, SCH_COMPONENT *DrawLibItem); SCH_COMPONENT *DrawLibItem); Loading eeschema/save_schemas.cpp +5 −8 Original line number Original line Diff line number Diff line Loading @@ -114,22 +114,19 @@ bool SCH_SCREEN::Save( FILE* aFile ) const * @return bool - true if success writing else false. * @return bool - true if success writing else false. */ */ { { const wxChar** LibNames; wxString Name, msg; wxString Name, msg; Ki_PageDescr* PlotSheet; Ki_PageDescr* PlotSheet; wxString datetime = DateAndTime( ); wxString datetime = DateAndTime( ); bool first = true; LibNames = GetLibNames(); for( LibraryStruct* Lib = g_LibraryList; Lib != NULL; Lib = Lib->m_Pnext ) for( int ii = 0; LibNames[ii] != NULL; ii++ ) { { if( ii > 0 ) if( first ) Name += wxT( "," ); Name += wxT( "," ); Name += LibNames[ii]; Name += Lib->m_Name; first = false; } } MyFree( LibNames ); // Creates header // Creates header if( fprintf( aFile, "%s %s %d", EESCHEMA_FILE_STAMP, if( fprintf( aFile, "%s %s %d", EESCHEMA_FILE_STAMP, SCHEMATIC_HEAD_STRING, EESCHEMA_VERSION ) == EOF ) SCHEMATIC_HEAD_STRING, EESCHEMA_VERSION ) == EOF ) Loading eeschema/selpart.cpp +30 −12 Original line number Original line Diff line number Diff line Loading @@ -24,15 +24,15 @@ /***************************************************************/ /***************************************************************/ LibraryStruct * SelectLibraryFromList(WinEDA_DrawFrame * frame) LibraryStruct * SelectLibraryFromList(WinEDA_DrawFrame * frame) /***************************************************************/ /***************************************************************/ /* Routine pour selectionner une librairie a partir d'une liste /** Function SelectLibraryFromList * Displays a list of current loaded libraries, and allows the user to select a library * This list is sorted, with the library cache always at end of the list */ */ { { int ii, NumOfLibs = NumOfLibraries(); int ii, NumOfLibs = NumOfLibraries(); LibraryStruct *Lib = NULL; LibraryStruct *Lib = NULL; static wxString OldLibName; static wxString OldLibName; WinEDAListBox * ListBox; wxString LibName; wxString LibName; const wxChar ** ListNames; if (NumOfLibs == 0) if (NumOfLibs == 0) { { Loading @@ -40,20 +40,38 @@ const wxChar ** ListNames; return(NULL) ; return(NULL) ; } } ListNames = GetLibNames(); WinEDAListBox ListBox(frame, _("Select Lib"), ListBox = new WinEDAListBox(frame, _("Select Lib"), NULL, OldLibName, NULL, ListNames, OldLibName, NULL, wxColour(255,255,255)); // Library browser background color wxColour(255,255,255)); // Library browser background color ListBox->MoveMouseToOrigin(); ii = ListBox->ShowModal(); ListBox->Destroy(); wxArrayString libNamesList; LibraryStruct * libcache = NULL; 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 ); ListBox.InsertItems(libNamesList); ListBox.MoveMouseToOrigin(); ii = ListBox.ShowModal(); if (ii >= 0) /* Recherche de la librairie */ if (ii >= 0) /* Recherche de la librairie */ { { Lib = FindLibrary(ListNames[ii]); Lib = FindLibrary(libNamesList[ii]); } } free (ListNames); return(Lib); return(Lib); } } Loading Loading
eeschema/eelibs_read_libraryfiles.cpp +0 −24 Original line number Original line Diff line number Diff line Loading @@ -257,30 +257,6 @@ void FreeCmpLibrary (wxWindow* frame, const wxString& LibName) } } /******************************/ /** GetLibNames() * Routine to return pointers to all library names. * User is responsible to deallocate memory */ /******************************/ const wxChar** GetLibNames() { int ii, NumOfLibs = NumOfLibraries(); const wxChar** Names; LibraryStruct* Lib; Names = (const wxChar**) MyZMalloc( sizeof(wxChar*) * (NumOfLibs + 1) ); for( ii = 0, Lib = g_LibraryList; Lib != NULL; Lib = Lib->m_Pnext, ii++ ) { Names[ii] = Lib->m_Name.GetData(); } Names[ii] = NULL; return Names; } /** Function LibraryEntryCompare /** Function LibraryEntryCompare * Routine to compare two EDA_LibComponentStruct for the PriorQue module. * Routine to compare two EDA_LibComponentStruct for the PriorQue module. * Comparison (insensitive case) is based on Part name. * Comparison (insensitive case) is based on Part name. Loading
eeschema/find.cpp +11 −23 Original line number Original line Diff line number Diff line Loading @@ -627,12 +627,12 @@ SCH_ITEM* WinEDA_SchematicFrame::FindSchematicItem( void WinEDA_FindFrame::LocatePartInLibs( wxCommandEvent& event ) void WinEDA_FindFrame::LocatePartInLibs( wxCommandEvent& event ) /*************************************************************/ /*************************************************************/ /* Recherche exhaustive d'un composant en librairies, meme non chargees /* Search for a given component. * The serach is made in loaded libraries, * and if not found in all libraries found in lib paths. */ */ { { wxString Text, FindList; wxString Text, FindList; const wxChar** ListNames; LibraryStruct* Lib = NULL; EDA_LibComponentStruct* LibEntry; EDA_LibComponentStruct* LibEntry; bool FoundInLib = FALSE; // True si reference trouvee ailleurs qu'en cache bool FoundInLib = FALSE; // True si reference trouvee ailleurs qu'en cache Loading @@ -643,33 +643,23 @@ void WinEDA_FindFrame::LocatePartInLibs( wxCommandEvent& event ) } } s_OldStringFound = Text; s_OldStringFound = Text; int ii, nbitems, NumOfLibs = NumOfLibraries(); if( NumOfLibraries() == 0 ) if( NumOfLibs == 0 ) { { DisplayError( this, _( "No libraries are loaded" ) ); DisplayError( this, _( "No libraries are loaded" ) ); Close(); return; Close(); return; } } ListNames = GetLibNames(); nbitems = 0; int nbitemsFound = 0; for( ii = 0; ii < NumOfLibs; ii++ ) /* Recherche de la librairie */ for( LibraryStruct* Lib = g_LibraryList; Lib != NULL; Lib = Lib->m_Pnext ) { { bool IsLibCache; Lib = FindLibrary( ListNames[ii] ); if( Lib == NULL ) break; if( Lib->m_Name.Contains( wxT( ".cache" ) ) ) IsLibCache = TRUE; else IsLibCache = FALSE; LibEntry = (EDA_LibComponentStruct*) PQFirst( &Lib->m_Entries, FALSE ); LibEntry = (EDA_LibComponentStruct*) PQFirst( &Lib->m_Entries, FALSE ); while( LibEntry ) while( LibEntry ) { { if( WildCompareString( Text, LibEntry->m_Name.m_Text, FALSE ) ) if( WildCompareString( Text, LibEntry->m_Name.m_Text, FALSE ) ) { { nbitems++; nbitemsFound++; if( !IsLibCache ) if( !Lib->m_IsLibCache ) FoundInLib = TRUE; FoundInLib = TRUE; if( !FindList.IsEmpty() ) if( !FindList.IsEmpty() ) FindList += wxT( "\n" ); FindList += wxT( "\n" ); Loading @@ -681,11 +671,9 @@ void WinEDA_FindFrame::LocatePartInLibs( wxCommandEvent& event ) } } } } free( ListNames ); if( !FoundInLib ) if( !FoundInLib ) { { if( nbitems ) if( nbitemsFound ) FindList = wxT( "\n" ) + Text + _( " found only in cache" ); FindList = wxT( "\n" ) + Text + _( " found only in cache" ); else else FindList = Text + _( " not found" ); FindList = Text + _( " not found" ); Loading Loading @@ -719,7 +707,7 @@ int WinEDA_FindFrame::ExploreAllLibraries( const wxString& wildmask, wxString& F for( unsigned ii = 0; ii < wxGetApp().GetLibraryPathList().GetCount(); ii++ ) for( unsigned ii = 0; ii < wxGetApp().GetLibraryPathList().GetCount(); ii++ ) { { path = wxGetApp().GetLibraryPathList()[ii]; path = wxGetApp().GetLibraryPathList()[ii] + STRING_DIR_SEP; FullFileName = wxFindFirstFile( path + wxT( "*." ) + CompLibFileExtension ); FullFileName = wxFindFirstFile( path + wxT( "*." ) + CompLibFileExtension ); while( !FullFileName.IsEmpty() ) while( !FullFileName.IsEmpty() ) Loading
eeschema/protos.h +0 −1 Original line number Original line Diff line number Diff line Loading @@ -80,7 +80,6 @@ LibraryStruct * LoadLibraryName(WinEDA_DrawFrame * frame, const wxString & FullLibName, const wxString & LibName); const wxString & FullLibName, const wxString & LibName); void LoadLibraries( WinEDA_SchematicFrame* frame ); void LoadLibraries( WinEDA_SchematicFrame* frame ); void FreeCmpLibrary(wxWindow * frame, const wxString & LibName); void FreeCmpLibrary(wxWindow * frame, const wxString & LibName); const wxChar **GetLibNames(); void SnapLibItemPoint(int OrigX, int OrigY, int *ClosestX, int *ClosestY, void SnapLibItemPoint(int OrigX, int OrigY, int *ClosestX, int *ClosestY, SCH_COMPONENT *DrawLibItem); SCH_COMPONENT *DrawLibItem); Loading
eeschema/save_schemas.cpp +5 −8 Original line number Original line Diff line number Diff line Loading @@ -114,22 +114,19 @@ bool SCH_SCREEN::Save( FILE* aFile ) const * @return bool - true if success writing else false. * @return bool - true if success writing else false. */ */ { { const wxChar** LibNames; wxString Name, msg; wxString Name, msg; Ki_PageDescr* PlotSheet; Ki_PageDescr* PlotSheet; wxString datetime = DateAndTime( ); wxString datetime = DateAndTime( ); bool first = true; LibNames = GetLibNames(); for( LibraryStruct* Lib = g_LibraryList; Lib != NULL; Lib = Lib->m_Pnext ) for( int ii = 0; LibNames[ii] != NULL; ii++ ) { { if( ii > 0 ) if( first ) Name += wxT( "," ); Name += wxT( "," ); Name += LibNames[ii]; Name += Lib->m_Name; first = false; } } MyFree( LibNames ); // Creates header // Creates header if( fprintf( aFile, "%s %s %d", EESCHEMA_FILE_STAMP, if( fprintf( aFile, "%s %s %d", EESCHEMA_FILE_STAMP, SCHEMATIC_HEAD_STRING, EESCHEMA_VERSION ) == EOF ) SCHEMATIC_HEAD_STRING, EESCHEMA_VERSION ) == EOF ) Loading
eeschema/selpart.cpp +30 −12 Original line number Original line Diff line number Diff line Loading @@ -24,15 +24,15 @@ /***************************************************************/ /***************************************************************/ LibraryStruct * SelectLibraryFromList(WinEDA_DrawFrame * frame) LibraryStruct * SelectLibraryFromList(WinEDA_DrawFrame * frame) /***************************************************************/ /***************************************************************/ /* Routine pour selectionner une librairie a partir d'une liste /** Function SelectLibraryFromList * Displays a list of current loaded libraries, and allows the user to select a library * This list is sorted, with the library cache always at end of the list */ */ { { int ii, NumOfLibs = NumOfLibraries(); int ii, NumOfLibs = NumOfLibraries(); LibraryStruct *Lib = NULL; LibraryStruct *Lib = NULL; static wxString OldLibName; static wxString OldLibName; WinEDAListBox * ListBox; wxString LibName; wxString LibName; const wxChar ** ListNames; if (NumOfLibs == 0) if (NumOfLibs == 0) { { Loading @@ -40,20 +40,38 @@ const wxChar ** ListNames; return(NULL) ; return(NULL) ; } } ListNames = GetLibNames(); WinEDAListBox ListBox(frame, _("Select Lib"), ListBox = new WinEDAListBox(frame, _("Select Lib"), NULL, OldLibName, NULL, ListNames, OldLibName, NULL, wxColour(255,255,255)); // Library browser background color wxColour(255,255,255)); // Library browser background color ListBox->MoveMouseToOrigin(); ii = ListBox->ShowModal(); ListBox->Destroy(); wxArrayString libNamesList; LibraryStruct * libcache = NULL; 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 ); ListBox.InsertItems(libNamesList); ListBox.MoveMouseToOrigin(); ii = ListBox.ShowModal(); if (ii >= 0) /* Recherche de la librairie */ if (ii >= 0) /* Recherche de la librairie */ { { Lib = FindLibrary(ListNames[ii]); Lib = FindLibrary(libNamesList[ii]); } } free (ListNames); return(Lib); return(Lib); } } Loading