Loading eeschema/backanno.cpp +44 −29 Original line number Diff line number Diff line Loading @@ -38,17 +38,28 @@ SCH_COMPONENT * WinEDA_SchematicFrame::FindComponentByRef( } } } return NULL; } /**************************************************************/ bool WinEDA_SchematicFrame::ProcessStuffFile( FILE* StuffFile ) /**************************************************************/ /* Read a "stuff" file created by cvpcb. * That file has lines like: * comp = "C1" module = "CP6" * comp = "C2" module = "C1" * comp = "C3" module = "C1" * "comp =" gives the component reference * "module =" gives the footprint name * */ { int LineNum = 0; char* cp, Ref[256], FootPrint[256], Line[1024]; SCH_COMPONENT* Cmp; PartTextStruct* TextField; while( GetLine( StuffFile, Line, &LineNum, sizeof(Line) ) ) { Loading @@ -68,12 +79,16 @@ bool WinEDA_SchematicFrame::ProcessStuffFile( FILE* StuffFile ) if( Cmp == NULL ) continue; #if defined(DEBUG) printf( " %s %s\n", CONV_TO_UTF8(Cmp->m_Field[REFERENCE].m_Text), CONV_TO_UTF8(Cmp->m_Field[VALUE].m_Text) ); #endif TextField = &Cmp->m_Field[FOOTPRINT]; TextField->m_Text = CONV_FROM_UTF8( FootPrint ); /* Give a reasonnable value to the fied position, if * the text is empty at position 0, because it is probably not yet initialised */ if( Cmp->m_Field[FOOTPRINT].m_Text.IsEmpty() && ( Cmp->m_Field[FOOTPRINT].m_Pos == wxPoint( 0, 0 ) ) ) { Cmp->m_Field[FOOTPRINT].m_Pos = Cmp->m_Field[VALUE].m_Pos; Cmp->m_Field[FOOTPRINT].m_Pos.y -= 100; } Cmp->m_Field[FOOTPRINT].m_Text = CONV_FROM_UTF8( FootPrint ); } } Loading eeschema/build_BOM.cpp +50 −48 Original line number Diff line number Diff line Loading @@ -22,9 +22,11 @@ // Filename extension for BOM list #define EXT_LIST wxT( ".lst" ) // Exported functions int BuildComponentsListFromSchematic( ListComponent* List ); /* fonctions locales */ static int GenListeGLabels( ListLabel* List ); int GenListeCmp( ListComponent* List ); static int ListTriComposantByRef( ListComponent* Objet1, ListComponent* Objet2 ); static int ListTriComposantByVal( ListComponent* Objet1, Loading Loading @@ -117,7 +119,7 @@ void WinEDA_Build_BOM_Frame::CreateExportList( const wxString& FullFileName, return; } NbItems = GenListeCmp( NULL ); NbItems = BuildComponentsListFromSchematic( NULL ); if( NbItems ) { List = (ListComponent*) MyZMalloc( NbItems * sizeof(ListComponent) ); Loading @@ -127,18 +129,17 @@ void WinEDA_Build_BOM_Frame::CreateExportList( const wxString& FullFileName, return; } GenListeCmp( List ); BuildComponentsListFromSchematic( List ); /* sort component list */ qsort( List, NbItems, sizeof( ListComponent ), ( int( * ) ( const void*, const void* ) )ListTriComposantByRef ); // if( ! s_ListWithSubCmponents ) if( !aIncludeSubComponents ) DeleteSubCmp( List, NbItems ); /* create the file */ PrintListeCmpByRef( f, List, NbItems, TRUE, aIncludeSubComponents ); PrintComponentsListByRef( f, List, NbItems, TRUE, aIncludeSubComponents ); MyFree( List ); } Loading Loading @@ -173,7 +174,7 @@ void WinEDA_Build_BOM_Frame::GenereListeOfItems( const wxString& FullFileName, return; } NbItems = GenListeCmp( NULL ); NbItems = BuildComponentsListFromSchematic( NULL ); if( NbItems ) { List = (ListComponent*) MyZMalloc( NbItems * sizeof(ListComponent) ); Loading @@ -183,7 +184,7 @@ void WinEDA_Build_BOM_Frame::GenereListeOfItems( const wxString& FullFileName, return; } GenListeCmp( List ); BuildComponentsListFromSchematic( List ); /* generation du fichier listing */ DateAndTime( Line ); Loading @@ -201,7 +202,7 @@ void WinEDA_Build_BOM_Frame::GenereListeOfItems( const wxString& FullFileName, // if( s_ListByRef ) if( m_ListCmpbyRefItems->GetValue() ) { PrintListeCmpByRef( f, List, NbItems, false, aIncludeSubComponents ); PrintComponentsListByRef( f, List, NbItems, false, aIncludeSubComponents ); } // if( s_ListByValue ) Loading @@ -209,7 +210,7 @@ void WinEDA_Build_BOM_Frame::GenereListeOfItems( const wxString& FullFileName, { qsort( List, NbItems, sizeof( ListComponent ), ( int( * ) ( const void*, const void* ) )ListTriComposantByVal ); PrintListeCmpByVal( f, List, NbItems, aIncludeSubComponents ); PrintComponentsListByVal( f, List, NbItems, aIncludeSubComponents ); } MyFree( List ); } Loading Loading @@ -265,13 +266,12 @@ void WinEDA_Build_BOM_Frame::GenereListeOfItems( const wxString& FullFileName, } /****************************************/ int GenListeCmp( ListComponent* List ) /****************************************/ /*********************************************************/ int BuildComponentsListFromSchematic( ListComponent* List ) /*********************************************************/ /* Creates the list of components in the schematic /* Creates the list of components found in the whole schematic * * routine for generating a list of the used components. * if List == null, just returns the count. if not, fills the list. * goes through the sheets, not the screens, so that we account for * multiple instances of a given screen. Loading Loading @@ -581,7 +581,7 @@ void WinEDA_Build_BOM_Frame::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem bool CompactForm ) /*******************************************************************************************/ { wxCheckBox* FieldListCtrl[FIELD8 - FIELD1 + 1] = { wxCheckBox* FieldListCtrl[] = { m_AddField1, m_AddField2, m_AddField3, Loading @@ -599,6 +599,8 @@ void WinEDA_Build_BOM_Frame::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem fprintf( f, "%c%s", s_ExportSeparatorSymbol, CONV_TO_UTF8( DrawLibItem->m_Field[FOOTPRINT].m_Text ) ); } else if( m_AddFootprintField->IsChecked() ) fprintf( f, "; %-12s", CONV_TO_UTF8( DrawLibItem->m_Field[FOOTPRINT].m_Text ) ); for( ii = FIELD1; ii <= FIELD8; ii++ ) { Loading @@ -617,7 +619,7 @@ void WinEDA_Build_BOM_Frame::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem /*********************************************************************************************/ int WinEDA_Build_BOM_Frame::PrintListeCmpByRef( FILE* f, ListComponent* List, int NbItems, int WinEDA_Build_BOM_Frame::PrintComponentsListByRef( FILE* f, ListComponent* List, int NbItems, bool CompactForm, bool aIncludeSubComponents ) /*********************************************************************************************/ Loading Loading @@ -732,7 +734,7 @@ int WinEDA_Build_BOM_Frame::PrintListeCmpByRef( FILE* f, ListComponent* List, in /*********************************************************************************************/ int WinEDA_Build_BOM_Frame::PrintListeCmpByVal( FILE* f, ListComponent* List, int NbItems, int WinEDA_Build_BOM_Frame::PrintComponentsListByVal( FILE* f, ListComponent* List, int NbItems, bool aIncludeSubComponents ) /**********************************************************************************************/ { Loading eeschema/dialog_build_BOM.cpp +5 −4 Original line number Diff line number Diff line Loading @@ -507,7 +507,8 @@ void WinEDA_Build_BOM_Frame::SavePreferences() if( s_OutputSeparatorOpt < 0 ) s_OutputSeparatorOpt = 0; // Determine current settings of all 8 "Fields to add" checkboxes // Determine current settings of all "Fields to add" checkboxes s_Add_FpField_state = m_AddFootprintField->GetValue(); s_Add_F1_state = m_AddField1->GetValue(); s_Add_F2_state = m_AddField2->GetValue(); s_Add_F3_state = m_AddField3->GetValue(); Loading @@ -521,7 +522,7 @@ void WinEDA_Build_BOM_Frame::SavePreferences() m_Parent->m_Parent->m_EDA_Config->Write( OPTION_BOM_FORMAT, (long) s_OutputFormOpt ); m_Parent->m_Parent->m_EDA_Config->Write( OPTION_BOM_SEPARATOR, (long) s_OutputSeparatorOpt ); // Now save current settings of all 8 "Fields to add" checkboxes // Now save current settings of all "Fields to add" checkboxes long addfields = 0; for( int ii = 0, bitmask = 1; s_AddFieldList[ii] != NULL; ii++ ) { Loading eeschema/dialog_build_BOM.h +2 −2 Original line number Diff line number Diff line Loading @@ -134,9 +134,9 @@ public: bool aRunBrowser); void GenereListeOfItems(const wxString & FullFileName, bool aIncludeSubComponents ); void CreateExportList(const wxString & FullFileName, bool aIncludeSubComponents); int PrintListeCmpByRef( FILE * f, ListComponent * List, int NbItems, int PrintComponentsListByRef( FILE * f, ListComponent * List, int NbItems, bool CompactForm, bool aIncludeSubComponents ); int PrintListeCmpByVal( FILE *f, ListComponent * List, int NbItems, int PrintComponentsListByVal( FILE *f, ListComponent * List, int NbItems, bool aIncludeSubComponents); void PrintFieldData(FILE * f, SCH_COMPONENT * DrawLibItem, bool CompactForm = FALSE); void SavePreferences(); Loading eeschema/libarch.cpp +6 −7 Original line number Diff line number Diff line Loading @@ -14,13 +14,12 @@ #include "protos.h" /* fonctions exportees */ /* Imported functions */ int BuildComponentsListFromSchematic( ListComponent* List ); /* fonctions locales */ static int TriListEntry(EDA_LibComponentStruct **Objet1, EDA_LibComponentStruct **Objet2); /* Local functions*/ static int TriListEntry(EDA_LibComponentStruct **Objet1, EDA_LibComponentStruct **Objet2); /* Variable locales */ /*******************************************************************/ Loading @@ -42,14 +41,14 @@ const wxChar * Text; /* Creation de la liste des elements */ NbItems = GenListeCmp(NULL ); // Comptage des composants NbItems = BuildComponentsListFromSchematic(NULL ); // Comptage des composants if ( NbItems == 0 ) return FALSE; List = (ListComponent *) MyZMalloc( NbItems * sizeof( ListComponent ) ); if (List == NULL ) return FALSE; /* Calcul de la liste des composants */ GenListeCmp(List); BuildComponentsListFromSchematic(List); /* Calcul de la liste des Entrees de librairie et Remplacement des alias par les composants "Root" */ Loading Loading
eeschema/backanno.cpp +44 −29 Original line number Diff line number Diff line Loading @@ -38,17 +38,28 @@ SCH_COMPONENT * WinEDA_SchematicFrame::FindComponentByRef( } } } return NULL; } /**************************************************************/ bool WinEDA_SchematicFrame::ProcessStuffFile( FILE* StuffFile ) /**************************************************************/ /* Read a "stuff" file created by cvpcb. * That file has lines like: * comp = "C1" module = "CP6" * comp = "C2" module = "C1" * comp = "C3" module = "C1" * "comp =" gives the component reference * "module =" gives the footprint name * */ { int LineNum = 0; char* cp, Ref[256], FootPrint[256], Line[1024]; SCH_COMPONENT* Cmp; PartTextStruct* TextField; while( GetLine( StuffFile, Line, &LineNum, sizeof(Line) ) ) { Loading @@ -68,12 +79,16 @@ bool WinEDA_SchematicFrame::ProcessStuffFile( FILE* StuffFile ) if( Cmp == NULL ) continue; #if defined(DEBUG) printf( " %s %s\n", CONV_TO_UTF8(Cmp->m_Field[REFERENCE].m_Text), CONV_TO_UTF8(Cmp->m_Field[VALUE].m_Text) ); #endif TextField = &Cmp->m_Field[FOOTPRINT]; TextField->m_Text = CONV_FROM_UTF8( FootPrint ); /* Give a reasonnable value to the fied position, if * the text is empty at position 0, because it is probably not yet initialised */ if( Cmp->m_Field[FOOTPRINT].m_Text.IsEmpty() && ( Cmp->m_Field[FOOTPRINT].m_Pos == wxPoint( 0, 0 ) ) ) { Cmp->m_Field[FOOTPRINT].m_Pos = Cmp->m_Field[VALUE].m_Pos; Cmp->m_Field[FOOTPRINT].m_Pos.y -= 100; } Cmp->m_Field[FOOTPRINT].m_Text = CONV_FROM_UTF8( FootPrint ); } } Loading
eeschema/build_BOM.cpp +50 −48 Original line number Diff line number Diff line Loading @@ -22,9 +22,11 @@ // Filename extension for BOM list #define EXT_LIST wxT( ".lst" ) // Exported functions int BuildComponentsListFromSchematic( ListComponent* List ); /* fonctions locales */ static int GenListeGLabels( ListLabel* List ); int GenListeCmp( ListComponent* List ); static int ListTriComposantByRef( ListComponent* Objet1, ListComponent* Objet2 ); static int ListTriComposantByVal( ListComponent* Objet1, Loading Loading @@ -117,7 +119,7 @@ void WinEDA_Build_BOM_Frame::CreateExportList( const wxString& FullFileName, return; } NbItems = GenListeCmp( NULL ); NbItems = BuildComponentsListFromSchematic( NULL ); if( NbItems ) { List = (ListComponent*) MyZMalloc( NbItems * sizeof(ListComponent) ); Loading @@ -127,18 +129,17 @@ void WinEDA_Build_BOM_Frame::CreateExportList( const wxString& FullFileName, return; } GenListeCmp( List ); BuildComponentsListFromSchematic( List ); /* sort component list */ qsort( List, NbItems, sizeof( ListComponent ), ( int( * ) ( const void*, const void* ) )ListTriComposantByRef ); // if( ! s_ListWithSubCmponents ) if( !aIncludeSubComponents ) DeleteSubCmp( List, NbItems ); /* create the file */ PrintListeCmpByRef( f, List, NbItems, TRUE, aIncludeSubComponents ); PrintComponentsListByRef( f, List, NbItems, TRUE, aIncludeSubComponents ); MyFree( List ); } Loading Loading @@ -173,7 +174,7 @@ void WinEDA_Build_BOM_Frame::GenereListeOfItems( const wxString& FullFileName, return; } NbItems = GenListeCmp( NULL ); NbItems = BuildComponentsListFromSchematic( NULL ); if( NbItems ) { List = (ListComponent*) MyZMalloc( NbItems * sizeof(ListComponent) ); Loading @@ -183,7 +184,7 @@ void WinEDA_Build_BOM_Frame::GenereListeOfItems( const wxString& FullFileName, return; } GenListeCmp( List ); BuildComponentsListFromSchematic( List ); /* generation du fichier listing */ DateAndTime( Line ); Loading @@ -201,7 +202,7 @@ void WinEDA_Build_BOM_Frame::GenereListeOfItems( const wxString& FullFileName, // if( s_ListByRef ) if( m_ListCmpbyRefItems->GetValue() ) { PrintListeCmpByRef( f, List, NbItems, false, aIncludeSubComponents ); PrintComponentsListByRef( f, List, NbItems, false, aIncludeSubComponents ); } // if( s_ListByValue ) Loading @@ -209,7 +210,7 @@ void WinEDA_Build_BOM_Frame::GenereListeOfItems( const wxString& FullFileName, { qsort( List, NbItems, sizeof( ListComponent ), ( int( * ) ( const void*, const void* ) )ListTriComposantByVal ); PrintListeCmpByVal( f, List, NbItems, aIncludeSubComponents ); PrintComponentsListByVal( f, List, NbItems, aIncludeSubComponents ); } MyFree( List ); } Loading Loading @@ -265,13 +266,12 @@ void WinEDA_Build_BOM_Frame::GenereListeOfItems( const wxString& FullFileName, } /****************************************/ int GenListeCmp( ListComponent* List ) /****************************************/ /*********************************************************/ int BuildComponentsListFromSchematic( ListComponent* List ) /*********************************************************/ /* Creates the list of components in the schematic /* Creates the list of components found in the whole schematic * * routine for generating a list of the used components. * if List == null, just returns the count. if not, fills the list. * goes through the sheets, not the screens, so that we account for * multiple instances of a given screen. Loading Loading @@ -581,7 +581,7 @@ void WinEDA_Build_BOM_Frame::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem bool CompactForm ) /*******************************************************************************************/ { wxCheckBox* FieldListCtrl[FIELD8 - FIELD1 + 1] = { wxCheckBox* FieldListCtrl[] = { m_AddField1, m_AddField2, m_AddField3, Loading @@ -599,6 +599,8 @@ void WinEDA_Build_BOM_Frame::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem fprintf( f, "%c%s", s_ExportSeparatorSymbol, CONV_TO_UTF8( DrawLibItem->m_Field[FOOTPRINT].m_Text ) ); } else if( m_AddFootprintField->IsChecked() ) fprintf( f, "; %-12s", CONV_TO_UTF8( DrawLibItem->m_Field[FOOTPRINT].m_Text ) ); for( ii = FIELD1; ii <= FIELD8; ii++ ) { Loading @@ -617,7 +619,7 @@ void WinEDA_Build_BOM_Frame::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem /*********************************************************************************************/ int WinEDA_Build_BOM_Frame::PrintListeCmpByRef( FILE* f, ListComponent* List, int NbItems, int WinEDA_Build_BOM_Frame::PrintComponentsListByRef( FILE* f, ListComponent* List, int NbItems, bool CompactForm, bool aIncludeSubComponents ) /*********************************************************************************************/ Loading Loading @@ -732,7 +734,7 @@ int WinEDA_Build_BOM_Frame::PrintListeCmpByRef( FILE* f, ListComponent* List, in /*********************************************************************************************/ int WinEDA_Build_BOM_Frame::PrintListeCmpByVal( FILE* f, ListComponent* List, int NbItems, int WinEDA_Build_BOM_Frame::PrintComponentsListByVal( FILE* f, ListComponent* List, int NbItems, bool aIncludeSubComponents ) /**********************************************************************************************/ { Loading
eeschema/dialog_build_BOM.cpp +5 −4 Original line number Diff line number Diff line Loading @@ -507,7 +507,8 @@ void WinEDA_Build_BOM_Frame::SavePreferences() if( s_OutputSeparatorOpt < 0 ) s_OutputSeparatorOpt = 0; // Determine current settings of all 8 "Fields to add" checkboxes // Determine current settings of all "Fields to add" checkboxes s_Add_FpField_state = m_AddFootprintField->GetValue(); s_Add_F1_state = m_AddField1->GetValue(); s_Add_F2_state = m_AddField2->GetValue(); s_Add_F3_state = m_AddField3->GetValue(); Loading @@ -521,7 +522,7 @@ void WinEDA_Build_BOM_Frame::SavePreferences() m_Parent->m_Parent->m_EDA_Config->Write( OPTION_BOM_FORMAT, (long) s_OutputFormOpt ); m_Parent->m_Parent->m_EDA_Config->Write( OPTION_BOM_SEPARATOR, (long) s_OutputSeparatorOpt ); // Now save current settings of all 8 "Fields to add" checkboxes // Now save current settings of all "Fields to add" checkboxes long addfields = 0; for( int ii = 0, bitmask = 1; s_AddFieldList[ii] != NULL; ii++ ) { Loading
eeschema/dialog_build_BOM.h +2 −2 Original line number Diff line number Diff line Loading @@ -134,9 +134,9 @@ public: bool aRunBrowser); void GenereListeOfItems(const wxString & FullFileName, bool aIncludeSubComponents ); void CreateExportList(const wxString & FullFileName, bool aIncludeSubComponents); int PrintListeCmpByRef( FILE * f, ListComponent * List, int NbItems, int PrintComponentsListByRef( FILE * f, ListComponent * List, int NbItems, bool CompactForm, bool aIncludeSubComponents ); int PrintListeCmpByVal( FILE *f, ListComponent * List, int NbItems, int PrintComponentsListByVal( FILE *f, ListComponent * List, int NbItems, bool aIncludeSubComponents); void PrintFieldData(FILE * f, SCH_COMPONENT * DrawLibItem, bool CompactForm = FALSE); void SavePreferences(); Loading
eeschema/libarch.cpp +6 −7 Original line number Diff line number Diff line Loading @@ -14,13 +14,12 @@ #include "protos.h" /* fonctions exportees */ /* Imported functions */ int BuildComponentsListFromSchematic( ListComponent* List ); /* fonctions locales */ static int TriListEntry(EDA_LibComponentStruct **Objet1, EDA_LibComponentStruct **Objet2); /* Local functions*/ static int TriListEntry(EDA_LibComponentStruct **Objet1, EDA_LibComponentStruct **Objet2); /* Variable locales */ /*******************************************************************/ Loading @@ -42,14 +41,14 @@ const wxChar * Text; /* Creation de la liste des elements */ NbItems = GenListeCmp(NULL ); // Comptage des composants NbItems = BuildComponentsListFromSchematic(NULL ); // Comptage des composants if ( NbItems == 0 ) return FALSE; List = (ListComponent *) MyZMalloc( NbItems * sizeof( ListComponent ) ); if (List == NULL ) return FALSE; /* Calcul de la liste des composants */ GenListeCmp(List); BuildComponentsListFromSchematic(List); /* Calcul de la liste des Entrees de librairie et Remplacement des alias par les composants "Root" */ Loading