Commit 5cb57e3b authored by CHARRAS's avatar CHARRAS

Gen Bom List now works in unicode build version

parent e2abaa81
...@@ -10,6 +10,8 @@ email address. ...@@ -10,6 +10,8 @@ email address.
+eeschema +eeschema
Renaming the sheet filename now works in simple and complex hierarchies. Renaming the sheet filename now works in simple and complex hierarchies.
Use carefully because this can change the whole schematic structure. Use carefully because this can change the whole schematic structure.
Gen Bom List now works in unicode build version
(label list generation crashed eeschema in unicode build version)
+all +all
Display filename and full sheet name ("sheet path") in sheet reference Display filename and full sheet name ("sheet path") in sheet reference
......
...@@ -728,9 +728,8 @@ void WinEDA_Build_BOM_Frame::GenereListeOfItems( const wxString& FullFileName ) ...@@ -728,9 +728,8 @@ void WinEDA_Build_BOM_Frame::GenereListeOfItems( const wxString& FullFileName )
NbItems = GenListeCmp( NULL ); NbItems = GenListeCmp( NULL );
if( NbItems ) if( NbItems )
{ {
List = (ListComponent*) List = (ListComponent*) MyZMalloc( NbItems * sizeof(ListComponent) );
MyZMalloc( NbItems * sizeof(ListComponent) ); if( List == NULL ) // Error memory alloc
if( List == NULL )
{ {
fclose( f ); fclose( f );
return; return;
...@@ -784,12 +783,10 @@ void WinEDA_Build_BOM_Frame::GenereListeOfItems( const wxString& FullFileName ) ...@@ -784,12 +783,10 @@ void WinEDA_Build_BOM_Frame::GenereListeOfItems( const wxString& FullFileName )
/***************************************/ /***************************************/
/* Generation liste des Labels globaux */ /* Generation liste des Labels globaux */
/***************************************/ /***************************************/
NbItems = GenListeGLabels( NULL ); NbItems = GenListeGLabels( NULL );
if( NbItems ) if( NbItems )
{ {
ListOfLabels = (ListLabel*) MyZMalloc( NbItems * sizeof(ListLabel) ); ListOfLabels = (ListLabel*) MyZMalloc( NbItems * sizeof(ListLabel) );
memset( (void*) ListOfLabels, 0, NbItems * sizeof(ListLabel) );
if( ListOfLabels == NULL ) if( ListOfLabels == NULL )
{ {
fclose( f ); fclose( f );
...@@ -806,7 +803,7 @@ void WinEDA_Build_BOM_Frame::GenereListeOfItems( const wxString& FullFileName ) ...@@ -806,7 +803,7 @@ void WinEDA_Build_BOM_Frame::GenereListeOfItems( const wxString& FullFileName )
qsort( ListOfLabels, NbItems, sizeof( ListLabel ), qsort( ListOfLabels, NbItems, sizeof( ListLabel ),
( int( * ) ( const void*, const void* ) )ListTriGLabelBySheet ); ( int( * ) ( const void*, const void* ) )ListTriGLabelBySheet );
msg.Printf( _( "\n#Glob labels ( order = Sheet Number ) count = %d\n" ), NbItems ); msg.Printf( _( "\n#Global, Hierarchical Labels and PinSheets ( order = Sheet Number ) count = %d\n" ), NbItems );
fprintf( f, "%s", CONV_TO_UTF8( msg ) ); fprintf( f, "%s", CONV_TO_UTF8( msg ) );
PrintListeGLabel( f, ListOfLabels, NbItems ); PrintListeGLabel( f, ListOfLabels, NbItems );
} }
...@@ -817,7 +814,7 @@ void WinEDA_Build_BOM_Frame::GenereListeOfItems( const wxString& FullFileName ) ...@@ -817,7 +814,7 @@ void WinEDA_Build_BOM_Frame::GenereListeOfItems( const wxString& FullFileName )
qsort( ListOfLabels, NbItems, sizeof( ListLabel ), qsort( ListOfLabels, NbItems, sizeof( ListLabel ),
( int( * ) ( const void*, const void* ) )ListTriGLabelByVal ); ( int( * ) ( const void*, const void* ) )ListTriGLabelByVal );
msg.Printf( _( "\n#Glob labels ( order = Alphab. ) count = %d\n\n" ), NbItems ); msg.Printf( _( "\n#Global, Hierarchical Labels and PinSheets ( order = Alphab. ) count = %d\n\n" ), NbItems );
fprintf( f, "%s", CONV_TO_UTF8( msg ) ); fprintf( f, "%s", CONV_TO_UTF8( msg ) );
PrintListeGLabel( f, ListOfLabels, NbItems ); PrintListeGLabel( f, ListOfLabels, NbItems );
} }
...@@ -1383,8 +1380,8 @@ static int PrintListeGLabel( FILE* f, ListLabel* List, int NbItems ) ...@@ -1383,8 +1380,8 @@ static int PrintListeGLabel( FILE* f, ListLabel* List, int NbItems )
DrawLabelStruct* DrawTextItem; DrawLabelStruct* DrawTextItem;
DrawSheetLabelStruct* DrawSheetLabel; DrawSheetLabelStruct* DrawSheetLabel;
ListLabel* LabelItem; ListLabel* LabelItem;
wxString msg; wxString msg, sheetpath;
char str[64]; wxString labeltype;
for( ii = 0; ii < NbItems; ii++ ) for( ii = 0; ii < NbItems; ii++ )
{ {
...@@ -1396,14 +1393,15 @@ static int PrintListeGLabel( FILE* f, ListLabel* List, int NbItems ) ...@@ -1396,14 +1393,15 @@ static int PrintListeGLabel( FILE* f, ListLabel* List, int NbItems )
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
DrawTextItem = (DrawLabelStruct*) (LabelItem->m_Label); DrawTextItem = (DrawLabelStruct*) (LabelItem->m_Label);
if( LabelItem->m_LabelType == DRAW_HIER_LABEL_STRUCT_TYPE ) if( LabelItem->m_LabelType == DRAW_HIER_LABEL_STRUCT_TYPE )
strncpy( str, "Hierarchical", sizeof(str) ); labeltype = wxT("Hierarchical");
else else
strncpy( str, "Global ", sizeof(str) ); labeltype = wxT("Global ");
sheetpath = CONV_FROM_UTF8(LabelItem->m_SheetPath);
msg.Printf( msg.Printf(
_( "> %-28.28s %s (Sheet %s) pos: %3.3f, %3.3f\n" ), _( "> %-28.28s %s (Sheet %s) pos: %3.3f, %3.3f\n" ),
DrawTextItem->m_Text.GetData(), DrawTextItem->m_Text.GetData(),
str, labeltype.GetData(),
LabelItem->m_SheetPath, sheetpath.GetData(),
(float) DrawTextItem->m_Pos.x / 1000, (float) DrawTextItem->m_Pos.x / 1000,
(float) DrawTextItem->m_Pos.y / 1000 ); (float) DrawTextItem->m_Pos.y / 1000 );
...@@ -1420,7 +1418,7 @@ static int PrintListeGLabel( FILE* f, ListLabel* List, int NbItems ) ...@@ -1420,7 +1418,7 @@ static int PrintListeGLabel( FILE* f, ListLabel* List, int NbItems )
jj = 4; jj = 4;
wxString labtype = CONV_FROM_UTF8( SheetLabelType[jj] ); wxString labtype = CONV_FROM_UTF8( SheetLabelType[jj] );
msg.Printf( msg.Printf(
_( "> %-28.28s Sheet %-7.7s (Sheet %s) pos: %3.3f, %3.3f\n" ), _( "> %-28.28s PinSheet %-7.7s (Sheet %s) pos: %3.3f, %3.3f\n" ),
DrawSheetLabel->m_Text.GetData(), DrawSheetLabel->m_Text.GetData(),
labtype.GetData(), labtype.GetData(),
LabelItem->m_SheetPath, LabelItem->m_SheetPath,
......
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