341
341
EDA_BaseStruct* SchItem;
342
342
SCH_COMPONENT* DrawLibItem;
343
SCH_SHEET_PATH* sheet;
343
SCH_SHEET_PATH* sheetPath;
345
345
/* Build the sheet (not screen) list */
346
346
SCH_SHEET_LIST SheetList;
348
for( sheet = SheetList.GetFirst();
350
sheet = SheetList.GetNext() )
348
for( sheetPath = SheetList.GetFirst(); sheetPath != NULL; sheetPath = SheetList.GetNext() )
352
for( SchItem = sheet->LastDrawList(); SchItem;
353
SchItem = SchItem->Next() )
350
for( SchItem = sheetPath->LastDrawList(); SchItem; SchItem = SchItem->Next() )
355
352
if( SchItem->Type() != TYPE_SCH_COMPONENT )
358
355
DrawLibItem = (SCH_COMPONENT*) SchItem;
359
DrawLibItem->SetParent( sheet->LastScreen() );
356
DrawLibItem->SetParent( sheetPath->LastScreen() );
360
357
OBJ_CMP_TO_LIST item;
361
358
item.m_RootCmp = DrawLibItem;
362
item.m_SheetPath = *sheet;
363
item.m_Unit = DrawLibItem->GetUnitSelection( sheet );
359
item.m_SheetPath = *sheetPath;
360
item.m_Unit = DrawLibItem->GetUnitSelection( sheetPath );
365
362
strncpy( item.m_Reference,
366
CONV_TO_UTF8( DrawLibItem->GetRef( sheet ) ),
367
sizeof( item.m_Reference ) );
363
CONV_TO_UTF8( DrawLibItem->GetRef( sheetPath ) ),
364
sizeof( item.m_Reference ) );
369
366
// Ensure always null terminate m_Ref.
370
367
item.m_Reference[sizeof( item.m_Reference ) - 1 ] = 0;
384
381
static void GenListeGLabels( std::vector <LABEL_OBJECT>& aList )
386
383
SCH_ITEM* DrawList;
387
SCH_SHEET_PIN* PinLabel;
388
SCH_SHEET_PATH* sheet;
384
SCH_SHEET_PATH* sheetPath;
390
386
/* Build the sheet list */
391
387
SCH_SHEET_LIST SheetList;
393
389
LABEL_OBJECT labet_object;
395
for( sheet = SheetList.GetFirst();
397
sheet = SheetList.GetNext() )
391
for( sheetPath = SheetList.GetFirst(); sheetPath != NULL; sheetPath = SheetList.GetNext() )
399
DrawList = (SCH_ITEM*) sheet->LastDrawList();
393
DrawList = (SCH_ITEM*) sheetPath->LastDrawList();
400
395
while( DrawList )
402
397
switch( DrawList->Type() )
404
399
case TYPE_SCH_HIERLABEL:
405
400
case TYPE_SCH_GLOBALLABEL:
406
401
labet_object.m_LabelType = DrawList->Type();
407
labet_object.m_SheetPath = *sheet;
402
labet_object.m_SheetPath = *sheetPath;
408
403
labet_object.m_Label = DrawList;
409
404
aList.push_back( labet_object );
412
407
case DRAW_SHEET_STRUCT_TYPE:
414
PinLabel = ( (SCH_SHEET*) DrawList )->m_Label;
415
while( PinLabel != NULL )
409
SCH_SHEET* sheet = (SCH_SHEET*) DrawList;
411
BOOST_FOREACH( SCH_SHEET_PIN sheetLabel, sheet->GetSheetPins() )
417
labet_object.m_LabelType =
418
DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE;
419
labet_object.m_SheetPath = *sheet;
420
labet_object.m_Label = PinLabel;
413
labet_object.m_LabelType = DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE;
414
labet_object.m_SheetPath = *sheetPath;
415
labet_object.m_Label = &sheetLabel;
421
416
aList.push_back( labet_object );
422
PinLabel = PinLabel->Next();
797
791
// Store fields. Store non empty fields only.
798
792
for( int jj = FOOTPRINT; jj < currCmp->GetFieldCount(); jj++ )
794
//Ensure fields exists in dummy component
795
if( dummyCmp.GetFieldCount() <= jj )
796
dummyCmp.AddField( *currCmp->GetField( jj ) );
800
798
if( !currCmp->GetField( jj )->m_Text.IsEmpty() )
801
799
dummyCmp.GetField( jj )->m_Text = currCmp->GetField( jj )->m_Text;
845
843
CONV_TO_UTF8( currCmp->GetField( DATASHEET) ->m_Text ) );
846
fprintf( f, "%c%s", s_ExportSeparatorSymbol,
847
CONV_TO_UTF8( RNames ) );
848
849
// print fields, on demand
849
for( int jj = FIELD1; jj <= FIELD8 ; jj++ )
850
int last_nonempty_field_idx = 0;
851
for( int jj = FOOTPRINT; jj < dummyCmp.GetFieldCount(); jj++ )
852
if ( !dummyCmp.GetField( jj )->m_Text.IsEmpty() )
853
last_nonempty_field_idx = jj;
854
for( int jj = FIELD1; jj <= last_nonempty_field_idx ; jj++ )
851
856
if ( IsFieldChecked( jj ) )
852
857
fprintf( f, "%c%4s", s_ExportSeparatorSymbol,
853
858
CONV_TO_UTF8( dummyCmp.GetField( jj )->m_Text ) );
856
fprintf( f, "%c%s\n", s_ExportSeparatorSymbol,
857
CONV_TO_UTF8( RNames ) );
859
863
// Clear strings and values, to prepare next component
862
for( int jj = FOOTPRINT; jj < currCmp->GetFieldCount(); jj++ )
866
for( int jj = FOOTPRINT; jj < dummyCmp.GetFieldCount(); jj++ )
863
867
dummyCmp.GetField( jj )->m_Text.Empty();