Commit 8d777fc6 authored by Dick Hollenbeck's avatar Dick Hollenbeck

Merge new generic netlist work, code cleaning, and BOM fixes

parents 217efaa8 4eb80203
...@@ -4,6 +4,20 @@ KiCad ChangeLog 2010 ...@@ -4,6 +4,20 @@ KiCad ChangeLog 2010
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2010-Jul-30 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
++eeschema:
* Now link with XML support within wxWidgets.
* Start of export the generic netlist in XML. Still need to rework the chain
loaded netlist plugin.
* OBJ_CMP_TO_LIST class now uses a std::string to hold the 8 bit string m_Ref,
but hides this behind accessors which provide for both Unicode and 8 bit
set and get functions.
* build_BOM.cpp retains the selected filename on subsequent runs as a default.
* Code cleaning, especially in build_BOM.cpp.
* Will work tomorrow also.
2010-jul-27, UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr> 2010-jul-27, UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================ ================================================================================
++all: ++all:
......
...@@ -134,9 +134,9 @@ check_find_package_result(OPENGL_FOUND "OpenGL") ...@@ -134,9 +134,9 @@ check_find_package_result(OPENGL_FOUND "OpenGL")
# On Apple only wxwidgets 2.9 or higher doesn't need to find aui part of base # On Apple only wxwidgets 2.9 or higher doesn't need to find aui part of base
if(APPLE) if(APPLE)
find_package(wxWidgets COMPONENTS gl adv html core net base QUIET) find_package(wxWidgets COMPONENTS gl adv html core net base xml QUIET)
else(APPLE) else(APPLE)
find_package(wxWidgets COMPONENTS gl aui adv html core net base QUIET) find_package(wxWidgets COMPONENTS gl aui adv html core net base xml QUIET)
endif(APPLE) endif(APPLE)
check_find_package_result(wxWidgets_FOUND "wxWidgets") check_find_package_result(wxWidgets_FOUND "wxWidgets")
......
...@@ -381,8 +381,7 @@ int AddComponentsInSheetToList( std::vector <OBJ_CMP_TO_LIST>& aComponentsList, ...@@ -381,8 +381,7 @@ int AddComponentsInSheetToList( std::vector <OBJ_CMP_TO_LIST>& aComponentsList,
if( DrawLibItem->GetRef( aSheet ).IsEmpty() ) if( DrawLibItem->GetRef( aSheet ).IsEmpty() )
DrawLibItem->SetRef( aSheet, wxT( "DefRef?" ) ); DrawLibItem->SetRef( aSheet, wxT( "DefRef?" ) );
strncpy( new_object.m_Reference, new_object.SetRef( DrawLibItem->GetRef( aSheet ) );
CONV_TO_UTF8( DrawLibItem->GetRef( aSheet ) ), 32 );
new_object.m_NumRef = -1; new_object.m_NumRef = -1;
...@@ -409,6 +408,7 @@ static void ReAnnotateComponents( std::vector <OBJ_CMP_TO_LIST>& aComponentsList ...@@ -409,6 +408,7 @@ static void ReAnnotateComponents( std::vector <OBJ_CMP_TO_LIST>& aComponentsList
/* update the reference numbers */ /* update the reference numbers */
for( unsigned ii = 0; ii < aComponentsList.size(); ii++ ) for( unsigned ii = 0; ii < aComponentsList.size(); ii++ )
{ {
#if 0
char* Text = aComponentsList[ii].m_Reference; char* Text = aComponentsList[ii].m_Reference;
SCH_COMPONENT* component = aComponentsList[ii].m_RootCmp; SCH_COMPONENT* component = aComponentsList[ii].m_RootCmp;
...@@ -419,8 +419,23 @@ static void ReAnnotateComponents( std::vector <OBJ_CMP_TO_LIST>& aComponentsList ...@@ -419,8 +419,23 @@ static void ReAnnotateComponents( std::vector <OBJ_CMP_TO_LIST>& aComponentsList
component->SetRef( &(aComponentsList[ii].m_SheetPath), component->SetRef( &(aComponentsList[ii].m_SheetPath),
CONV_FROM_UTF8( Text ) ); CONV_FROM_UTF8( Text ) );
#else
wxString ref = aComponentsList[ii].GetRef();
SCH_COMPONENT* component = aComponentsList[ii].m_RootCmp;
if( aComponentsList[ii].m_NumRef < 0 )
ref += wxChar( '?' );
else
ref << aComponentsList[ii].m_NumRef;
aComponentsList[ii].SetRef( ref );
component->SetRef( &aComponentsList[ii].m_SheetPath, ref );
#endif
component->m_Multi = aComponentsList[ii].m_Unit; component->m_Multi = aComponentsList[ii].m_Unit;
component->SetUnitSelection( &(aComponentsList[ii].m_SheetPath), component->SetUnitSelection( &aComponentsList[ii].m_SheetPath,
aComponentsList[ii].m_Unit ); aComponentsList[ii].m_Unit );
} }
} }
...@@ -437,42 +452,58 @@ static void ReAnnotateComponents( std::vector <OBJ_CMP_TO_LIST>& aComponentsList ...@@ -437,42 +452,58 @@ static void ReAnnotateComponents( std::vector <OBJ_CMP_TO_LIST>& aComponentsList
*/ */
void BreakReference( std::vector <OBJ_CMP_TO_LIST>& aComponentsList ) void BreakReference( std::vector <OBJ_CMP_TO_LIST>& aComponentsList )
{ {
char* Text; std::string refText; // construct once outside loop
for( unsigned ii = 0; ii < aComponentsList.size(); ii++ ) for( unsigned ii = 0; ii < aComponentsList.size(); ii++ )
{ {
aComponentsList[ii].m_NumRef = -1; aComponentsList[ii].m_NumRef = -1;
Text = aComponentsList[ii].m_Reference;
int ll = strlen( Text ) - 1; refText = aComponentsList[ii].GetRefStr();
if( Text[ll] == '?' )
int ll = refText.length() - 1;
if( refText[ll] == '?' )
{ {
aComponentsList[ii].m_IsNew = true; aComponentsList[ii].m_IsNew = true;
if( !aComponentsList[ii].IsPartsLocked() ) if( !aComponentsList[ii].IsPartsLocked() )
aComponentsList[ii].m_Unit = 0x7FFFFFFF; aComponentsList[ii].m_Unit = 0x7FFFFFFF;
Text[ll] = 0;
continue; refText.erase(ll); // delete last char
aComponentsList[ii].SetRefStr( refText );
} }
if( isdigit( Text[ll] ) == 0 ) else if( isdigit( refText[ll] ) == 0 )
{ {
aComponentsList[ii].m_IsNew = true; aComponentsList[ii].m_IsNew = true;
if( !aComponentsList[ii].IsPartsLocked() ) if( !aComponentsList[ii].IsPartsLocked() )
aComponentsList[ii].m_Unit = 0x7FFFFFFF; aComponentsList[ii].m_Unit = 0x7FFFFFFF;
continue;
} }
else
{
while( ll >= 0 ) while( ll >= 0 )
{ {
if( (Text[ll] <= ' ' ) || isdigit( Text[ll] ) ) if( (refText[ll] <= ' ' ) || isdigit( refText[ll] ) )
ll--; ll--;
else else
{ {
if( isdigit( Text[ll + 1] ) ) if( isdigit( refText[ll + 1] ) )
aComponentsList[ii].m_NumRef = atoi( &Text[ll + 1] ); {
Text[ll + 1] = 0; // nul terminated C string into cp
const char* cp = refText.c_str() + ll + 1;
aComponentsList[ii].m_NumRef = atoi( cp );
}
refText.erase( ll+1 ); // delete from ll+1 to end
break; break;
} }
} }
aComponentsList[ii].SetRefStr( refText );
}
} }
} }
...@@ -490,7 +521,7 @@ static void ComputeReferenceNumber( std::vector <OBJ_CMP_TO_LIST>& aComponentsLi ...@@ -490,7 +521,7 @@ static void ComputeReferenceNumber( std::vector <OBJ_CMP_TO_LIST>& aComponentsLi
*/ */
for( unsigned ii = 0; ii < aComponentsList.size(); ii++ ) for( unsigned ii = 0; ii < aComponentsList.size(); ii++ )
{ {
if( aComponentsList[ii].m_Reference[0] == '#' ) if( aComponentsList[ii].GetRefStr()[0] == '#' )
{ {
aComponentsList[ii].m_IsNew = true; aComponentsList[ii].m_IsNew = true;
aComponentsList[ii].m_NumRef = 0; aComponentsList[ii].m_NumRef = 0;
...@@ -716,9 +747,9 @@ int WinEDA_SchematicFrame::CheckAnnotate( wxArrayString* aMessageList, ...@@ -716,9 +747,9 @@ int WinEDA_SchematicFrame::CheckAnnotate( wxArrayString* aMessageList,
else else
Buff = wxT( "?" ); Buff = wxT( "?" );
cmpref = CONV_FROM_UTF8( ComponentsList[ii].m_Reference ); cmpref = ComponentsList[ii].GetRef();
msg.Printf( _( "item not annotated: %s%s" ), msg.Printf( _( "item not annotated: %s%s" ),
cmpref.GetData(), Buff.GetData() ); GetChars( cmpref ), GetChars( Buff ) );
if( ( ComponentsList[ii].m_Unit > 0 ) if( ( ComponentsList[ii].m_Unit > 0 )
&& ( ComponentsList[ii].m_Unit < 0x7FFFFFFF ) ) && ( ComponentsList[ii].m_Unit < 0x7FFFFFFF ) )
...@@ -748,9 +779,10 @@ int WinEDA_SchematicFrame::CheckAnnotate( wxArrayString* aMessageList, ...@@ -748,9 +779,10 @@ int WinEDA_SchematicFrame::CheckAnnotate( wxArrayString* aMessageList,
else else
Buff = wxT( "?" ); Buff = wxT( "?" );
cmpref = CONV_FROM_UTF8( ComponentsList[ii].m_Reference ); cmpref = ComponentsList[ii].GetRef();
msg.Printf( _( "Error item %s%s" ), cmpref.GetData(),
Buff.GetData() ); msg.Printf( _( "Error item %s%s" ), GetChars( cmpref ),
GetChars( Buff ) );
Buff.Printf( _( " unit %d and no more than %d parts" ), Buff.Printf( _( " unit %d and no more than %d parts" ),
ComponentsList[ii].m_Unit, ComponentsList[ii].m_Unit,
...@@ -789,9 +821,10 @@ int WinEDA_SchematicFrame::CheckAnnotate( wxArrayString* aMessageList, ...@@ -789,9 +821,10 @@ int WinEDA_SchematicFrame::CheckAnnotate( wxArrayString* aMessageList,
else else
Buff = wxT( "?" ); Buff = wxT( "?" );
cmpref = CONV_FROM_UTF8( ComponentsList[ii].m_Reference ); cmpref = ComponentsList[ii].GetRef();
msg.Printf( _( "Multiple item %s%s" ), msg.Printf( _( "Multiple item %s%s" ),
cmpref.GetData(), Buff.GetData() ); GetChars( cmpref ), GetChars( Buff ) );
if( ( ComponentsList[ii].m_Unit > 0 ) if( ( ComponentsList[ii].m_Unit > 0 )
&& ( ComponentsList[ii].m_Unit < 0x7FFFFFFF ) ) && ( ComponentsList[ii].m_Unit < 0x7FFFFFFF ) )
...@@ -819,9 +852,9 @@ int WinEDA_SchematicFrame::CheckAnnotate( wxArrayString* aMessageList, ...@@ -819,9 +852,9 @@ int WinEDA_SchematicFrame::CheckAnnotate( wxArrayString* aMessageList,
else else
Buff = wxT( "?" ); Buff = wxT( "?" );
cmpref = CONV_FROM_UTF8( ComponentsList[ii].m_Reference ); cmpref = ComponentsList[ii].GetRef();
msg.Printf( _( "Multiple item %s%s" ), msg.Printf( _( "Multiple item %s%s" ),
cmpref.GetData(), Buff.GetData() ); GetChars( cmpref ), GetChars( Buff ) );
if( ( ComponentsList[ii].m_Unit > 0 ) if( ( ComponentsList[ii].m_Unit > 0 )
&& ( ComponentsList[ii].m_Unit < 0x7FFFFFFF ) ) && ( ComponentsList[ii].m_Unit < 0x7FFFFFFF ) )
...@@ -846,16 +879,17 @@ int WinEDA_SchematicFrame::CheckAnnotate( wxArrayString* aMessageList, ...@@ -846,16 +879,17 @@ int WinEDA_SchematicFrame::CheckAnnotate( wxArrayString* aMessageList,
int next = ii + 1; int next = ii + 1;
if( ComponentsList[ii].CompareValue( ComponentsList[next] ) != 0 ) if( ComponentsList[ii].CompareValue( ComponentsList[next] ) != 0 )
{ {
wxString nextcmpref; wxString nextcmpref = ComponentsList[next].GetRef();
cmpref = CONV_FROM_UTF8( ComponentsList[ii].m_Reference );
nextcmpref = CONV_FROM_UTF8( ComponentsList[next].m_Reference ); cmpref = ComponentsList[ii].GetRef();
#if defined(KICAD_GOST) #if defined(KICAD_GOST)
msg.Printf( _( "Diff values for %s%d.%c (%s) and %s%d.%c (%s)" ), msg.Printf( _( "Diff values for %s%d.%c (%s) and %s%d.%c (%s)" ),
cmpref.GetData(), cmpref.GetData(),
ComponentsList[ii].m_NumRef, ComponentsList[ii].m_NumRef,
ComponentsList[ii].m_Unit + '1' - 1, ComponentsList[ii].m_Unit + '1' - 1,
ComponentsList[ii].m_Value->GetData(), GetChars( *ComponentsList[ii].m_Value ),
nextcmpref.GetData(), GetChars( nextcmpref ),
ComponentsList[next].m_NumRef, ComponentsList[next].m_NumRef,
ComponentsList[next].m_Unit + '1' - 1, ComponentsList[next].m_Unit + '1' - 1,
ComponentsList[next].m_Value->GetData() ); ComponentsList[next].m_Value->GetData() );
...@@ -864,11 +898,11 @@ int WinEDA_SchematicFrame::CheckAnnotate( wxArrayString* aMessageList, ...@@ -864,11 +898,11 @@ int WinEDA_SchematicFrame::CheckAnnotate( wxArrayString* aMessageList,
cmpref.GetData(), cmpref.GetData(),
ComponentsList[ii].m_NumRef, ComponentsList[ii].m_NumRef,
ComponentsList[ii].m_Unit + 'A' - 1, ComponentsList[ii].m_Unit + 'A' - 1,
ComponentsList[ii].m_Value->GetData(), GetChars( *ComponentsList[ii].m_Value ),
nextcmpref.GetData(), GetChars( nextcmpref ),
ComponentsList[next].m_NumRef, ComponentsList[next].m_NumRef,
ComponentsList[next].m_Unit + 'A' - 1, ComponentsList[next].m_Unit + 'A' - 1,
ComponentsList[next].m_Value->GetData() ); GetChars( *ComponentsList[next].m_Value ) );
#endif #endif
if( aMessageList ) if( aMessageList )
...@@ -897,15 +931,19 @@ int WinEDA_SchematicFrame::CheckAnnotate( wxArrayString* aMessageList, ...@@ -897,15 +931,19 @@ int WinEDA_SchematicFrame::CheckAnnotate( wxArrayString* aMessageList,
/* Same time stamp found. */ /* Same time stamp found. */
wxString nextcmpref; wxString nextcmpref;
wxString full_path; wxString full_path;
full_path.Printf( wxT( "%s%8.8X" ), full_path.Printf( wxT( "%s%8.8X" ),
ComponentsList[ii].m_SheetPath.Path().GetData(), GetChars( ComponentsList[ii].m_SheetPath.Path() ),
ComponentsList[ii].m_TimeStamp ); ComponentsList[ii].m_TimeStamp );
cmpref = CONV_FROM_UTF8( ComponentsList[ii].m_Reference );
nextcmpref = CONV_FROM_UTF8( ComponentsList[ii + 1].m_Reference ); cmpref = ComponentsList[ii].GetRef();
nextcmpref = ComponentsList[ii + 1].GetRef();
msg.Printf( _( "duplicate time stamp (%s) for %s%d and %s%d" ), msg.Printf( _( "duplicate time stamp (%s) for %s%d and %s%d" ),
full_path.GetData(), GetChars( full_path ),
cmpref.GetData(), ComponentsList[ii].m_NumRef, GetChars( cmpref ), ComponentsList[ii].m_NumRef,
nextcmpref.GetData(), ComponentsList[ii + 1].m_NumRef ); GetChars( nextcmpref ), ComponentsList[ii + 1].m_NumRef );
if( aMessageList ) if( aMessageList )
{ {
aMessageList->Add( msg + wxT( "\n" )); aMessageList->Add( msg + wxT( "\n" ));
......
This diff is collapsed.
...@@ -477,12 +477,6 @@ SCH_SHEET_PATH* SCH_SHEET_LIST::GetSheet( int aIndex ) ...@@ -477,12 +477,6 @@ SCH_SHEET_PATH* SCH_SHEET_LIST::GetSheet( int aIndex )
} }
/** Function BuildSheetList
* Build the list of sheets and their sheet path from the aSheet sheet
* if aSheet = g_RootSheet, the full sheet path list (and full sheet list) is
* built
* @param aSheet = the starting sheet to build list
*/
void SCH_SHEET_LIST::BuildSheetList( SCH_SHEET* aSheet ) void SCH_SHEET_LIST::BuildSheetList( SCH_SHEET* aSheet )
{ {
if( m_List == NULL ) if( m_List == NULL )
......
...@@ -53,18 +53,15 @@ ...@@ -53,18 +53,15 @@
class SCH_MARKER; class SCH_MARKER;
/****************************************/ /**
/* class to handle and access to a sheet */ * Class SCH_SHEET_PATH
/* a 'path' so to speak.. */ * handles access to a sheet by way of a path.
/****************************************/ * <p>
/*
* The member m_sheets stores the list of sheets from the first (usually * The member m_sheets stores the list of sheets from the first (usually
* g_RootSheet) * g_RootSheet) to a given sheet in last position.
* to a given sheet in last position. * The _last_ sheet is usually the sheet we want to select or reach (which is
* The last sheet is usually the sheet we want to select or reach. So Last() * what the function Last() returns).
* return this last sheet * Others sheets constitute the "path" from the first to the last sheet.
* Others sheets are the "path" from the first to the last sheet
*/ */
class SCH_SHEET_PATH class SCH_SHEET_PATH
{ {
...@@ -77,7 +74,7 @@ public: ...@@ -77,7 +74,7 @@ public:
public: public:
SCH_SHEET_PATH(); SCH_SHEET_PATH();
~SCH_SHEET_PATH() { }; // ~SCH_SHEET_PATH() { };
void Clear() void Clear()
{ {
...@@ -215,15 +212,14 @@ public: ...@@ -215,15 +212,14 @@ public:
}; };
/*******************************************************/ /**
/* Class to handle the list of *Sheets* in a hierarchy */ * Class SCH_SHEET_LIST
/*******************************************************/ * handles the list of Sheets in a hiearchy.
* Sheets are not unique, there can be many sheets with the same
/* sheets are not unique - can have many sheets with the same
* filename and the same SCH_SCREEN reference. * filename and the same SCH_SCREEN reference.
* the schematic (SCH_SCREEN) is shared between these sheets, * The schematic (SCH_SCREEN) is shared between these sheets,
* and component references are specific to a sheet path. * and component references are specific to a sheet path.
* When a sheet is entered, component references and sheet number are updated * When a sheet is entered, component references and sheet number are updated.
*/ */
class SCH_SHEET_LIST class SCH_SHEET_LIST
{ {
...@@ -243,9 +239,12 @@ private: ...@@ -243,9 +239,12 @@ private:
SCH_SHEET_PATH m_currList; SCH_SHEET_PATH m_currList;
public: public:
/* The constructor: build the list of sheets from aSheet.
* If aSheet == NULL (default) build the whole list of sheets in hierarchy /**
* So usually call it with no param. * Constructor
* builds the list of sheets from aSheet.
* If aSheet == NULL (default) build the whole list of sheets in hierarchy.
* So usually call it with no parameter.
*/ */
SCH_SHEET_LIST( SCH_SHEET* aSheet = NULL ); SCH_SHEET_LIST( SCH_SHEET* aSheet = NULL );
...@@ -256,40 +255,45 @@ public: ...@@ -256,40 +255,45 @@ public:
m_List = NULL; m_List = NULL;
} }
/**
/** Function GetCount() * Function GetCount()
* @return the number of sheets in list: * @return the number of sheets in list:
* usually the number of sheets found in the whole hierarchy * usually the number of sheets found in the whole hierarchy
*/ */
int GetCount() { return m_count; } int GetCount() { return m_count; }
/** Function GetFirst /**
* Function GetFirst
* @return the first item (sheet) in m_List and prepare calls to GetNext() * @return the first item (sheet) in m_List and prepare calls to GetNext()
*/ */
SCH_SHEET_PATH* GetFirst(); SCH_SHEET_PATH* GetFirst();
/** Function GetNext /**
* Function GetNext
* @return the next item (sheet) in m_List or NULL if no more item in * @return the next item (sheet) in m_List or NULL if no more item in
* sheet list * sheet list
*/ */
SCH_SHEET_PATH* GetNext(); SCH_SHEET_PATH* GetNext();
/** /**
* Get the last sheet in the sheet list. * Function GetLast
* returns the last sheet in the sheet list.
* *
* @return Last sheet in the list or NULL if sheet list is empty. * @return Last sheet in the list or NULL if sheet list is empty.
*/ */
SCH_SHEET_PATH* GetLast(); SCH_SHEET_PATH* GetLast();
/** /**
* Get the previous sheet in the sheet list. * Function GetPrevious
* returns the previous sheet in the sheet list.
* *
* @return The previous sheet in the sheet list or NULL if already at the * @return The previous sheet in the sheet list or NULL if already at the
* beginning of the list. * beginning of the list.
*/ */
SCH_SHEET_PATH* GetPrevious(); SCH_SHEET_PATH* GetPrevious();
/** Function GetSheet /**
* Function GetSheet
* @return the item (sheet) in aIndex position in m_List or NULL if less * @return the item (sheet) in aIndex position in m_List or NULL if less
* than index items * than index items
* @param aIndex = index in sheet list to get the sheet * @param aIndex = index in sheet list to get the sheet
...@@ -297,7 +301,8 @@ public: ...@@ -297,7 +301,8 @@ public:
SCH_SHEET_PATH* GetSheet( int aIndex ); SCH_SHEET_PATH* GetSheet( int aIndex );
/** /**
* Search the entire schematic for the next schematic object. * Function FindNextItem
* searches the entire schematic for the next schematic object.
* *
* @param aType - The type of schematic item to find. * @param aType - The type of schematic item to find.
* @param aSheetFound - The sheet the item was found in. NULL if the next item * @param aSheetFound - The sheet the item was found in. NULL if the next item
...@@ -310,7 +315,8 @@ public: ...@@ -310,7 +315,8 @@ public:
SCH_ITEM* aLastItem = NULL, bool aWrap = true ); SCH_ITEM* aLastItem = NULL, bool aWrap = true );
/** /**
* Search the entire schematic for the previous schematic item. * Function FindPreviousItem
* searches the entire schematic for the previous schematic item.
* *
* @param aType - The type of schematic item to find. * @param aType - The type of schematic item to find.
* @param aSheetFound - The sheet the item was found in. NULL if the previous item * @param aSheetFound - The sheet the item was found in. NULL if the previous item
...@@ -323,7 +329,8 @@ public: ...@@ -323,7 +329,8 @@ public:
SCH_ITEM* aLastItem = NULL, bool aWrap = true ); SCH_ITEM* aLastItem = NULL, bool aWrap = true );
/** /**
* Search the entire schematic for the next item that matches the search criteria. * Function MatchNextItem
* searches the entire schematic for the next item that matches the search criteria.
* *
* @param aSearchData - Criteria to search item against. * @param aSearchData - Criteria to search item against.
* @param aSheetFound - The sheet the item was found in. NULL if the next item * @param aSheetFound - The sheet the item was found in. NULL if the next item
...@@ -337,12 +344,15 @@ public: ...@@ -337,12 +344,15 @@ public:
private: private:
/** Function BuildSheetList /**
* Build the list of sheets and their sheet path from the aSheet sheet * Function BuildSheetList
* if aSheet = g_RootSheet, the full sheet path and sheet list is built * builds the list of sheets and their sheet path from \a aSheet.
* @param aSheet = the starting sheet from the built is made * If aSheet = g_RootSheet, the full sheet path and sheet list is built
*
* @param aSheet is the starting sheet from which the list is built,
* or NULL indicating that g_RootSheet should be used.
*/ */
void BuildSheetList( SCH_SHEET* sheet ); void BuildSheetList( SCH_SHEET* sheet );
}; };
#endif /* CLASS_DRAWSHEET_PATH_H */ #endif // CLASS_DRAWSHEET_PATH_H
...@@ -216,18 +216,6 @@ void SCH_FIELD::SwapData( SCH_FIELD* copyitem ) ...@@ -216,18 +216,6 @@ void SCH_FIELD::SwapData( SCH_FIELD* copyitem )
} }
/**
* return True if the field is void, i.e.:
* contains "~" or ""
*/
bool SCH_FIELD::IsVoid()
{
if( m_Text.IsEmpty() || m_Text == wxT( "~" ) )
return true;
return false;
}
/** /**
* Function GetBoundaryBox() * Function GetBoundaryBox()
* @return an EDA_Rect contains the real (user coordinates) boundary box for * @return an EDA_Rect contains the real (user coordinates) boundary box for
......
...@@ -47,11 +47,20 @@ public: ...@@ -47,11 +47,20 @@ public:
return wxT( "SCH_FIELD" ); return wxT( "SCH_FIELD" );
} }
void Place( WinEDA_SchematicFrame* frame, wxDC* DC ); void Place( WinEDA_SchematicFrame* frame, wxDC* DC );
EDA_Rect GetBoundaryBox() const; EDA_Rect GetBoundaryBox() const;
bool IsVoid();
/**
* Function IsVoid
* returns true if the field is either empty or holds "~".
*/
bool IsVoid()
{
size_t len = m_Text.Len();
return len == 0 || ( len == 1 && m_Text[0] == wxChar( '~' ) );
}
void SwapData( SCH_FIELD* copyitem ); void SwapData( SCH_FIELD* copyitem );
/** Function ImportValues /** Function ImportValues
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "dialog_build_BOM_base.h" #include "dialog_build_BOM_base.h"
class DIALOG_BUILD_BOM : public DIALOG_BUILD_BOM_BASE class DIALOG_BUILD_BOM : public DIALOG_BUILD_BOM_BASE
{ {
private: private:
...@@ -22,30 +23,41 @@ private: ...@@ -22,30 +23,41 @@ private:
void OnCancelClick( wxCommandEvent& event ); void OnCancelClick( wxCommandEvent& event );
void SavePreferences(); void SavePreferences();
void Init( ); void Init();
void Create_BOM_Lists(int aTypeFile, void Create_BOM_Lists(int aTypeFile,
bool aIncludeSubComponents, bool aIncludeSubComponents,
char aExportSeparatorSymbol, char aExportSeparatorSymbol,
bool aRunBrowser); bool aRunBrowser);
void GenereListeOfItems(const wxString & FullFileName, bool aIncludeSubComponents ); void GenereListeOfItems(const wxString & FullFileName, bool aIncludeSubComponents );
void CreateExportList(const wxString & FullFileName, bool aIncludeSubComponents); void CreateExportList(const wxString & FullFileName, bool aIncludeSubComponents);
void CreatePartsList(const wxString & FullFileName, bool aIncludeSubComponents);
/**
* Function CreateParstList
* prints a list of components, in a form which can be imported by a
* spreadsheet. Form is:
* cmp value; number of components; <footprint>; <field1>; ...;
* list of references having the same value
*/
void CreatePartsList( const wxString& aFullFileName, bool aIncludeSubComponents );
int PrintComponentsListByRef( FILE * f, std::vector <OBJ_CMP_TO_LIST>& aList, int PrintComponentsListByRef( FILE * f, std::vector <OBJ_CMP_TO_LIST>& aList,
bool CompactForm, bool aIncludeSubComponents ); bool CompactForm, bool aIncludeSubComponents );
int PrintComponentsListByVal( FILE *f, std::vector <OBJ_CMP_TO_LIST>& aList, int PrintComponentsListByVal( FILE *f, std::vector <OBJ_CMP_TO_LIST>& aList,
bool aIncludeSubComponents); bool aIncludeSubComponents);
int PrintComponentsListByPart( FILE *f, std::vector <OBJ_CMP_TO_LIST>& aList, int PrintComponentsListByPart( FILE *f, std::vector <OBJ_CMP_TO_LIST>& aList,
bool aIncludeSubComponents); bool aIncludeSubComponents);
void PrintFieldData(FILE * f, SCH_COMPONENT * DrawLibItem, bool CompactForm = FALSE); void PrintFieldData(FILE * f, SCH_COMPONENT * DrawLibItem, bool CompactForm = FALSE);
bool IsFieldChecked(int aFieldId);
bool IsFieldChecked(int aFieldId);
public: public:
DIALOG_BUILD_BOM( WinEDA_DrawFrame* parent ); DIALOG_BUILD_BOM( WinEDA_DrawFrame* parent );
~DIALOG_BUILD_BOM() {}; // ~DIALOG_BUILD_BOM() {};
}; };
#endif // _DIALOG_BUILD_BOM_H_
#endif
// _DIALOG_BUILD_BOM_H_
This diff is collapsed.
...@@ -45,6 +45,11 @@ enum TypeNetForm { ...@@ -45,6 +45,11 @@ enum TypeNetForm {
*/ */
class OBJ_CMP_TO_LIST class OBJ_CMP_TO_LIST
{ {
private:
/// Component reference prefix, without number (for IC1, this is IC) )
std::string m_Ref; // it's private, use the accessors please
public: public:
SCH_COMPONENT* m_RootCmp; // the component in schematic SCH_COMPONENT* m_RootCmp; // the component in schematic
LIB_COMPONENT* m_Entry; // the source component in library LIB_COMPONENT* m_Entry; // the source component in library
...@@ -57,8 +62,6 @@ public: ...@@ -57,8 +62,6 @@ public:
* components */ * components */
wxString* m_Value; /* Component value (same for all wxString* m_Value; /* Component value (same for all
* instances) */ * instances) */
char m_Reference[32]; /* Component reference prefix, without
* number (for IC1, this is IC) ) */
int m_NumRef; /* Reference number (for IC1, this is int m_NumRef; /* Reference number (for IC1, this is
* 1) ) depending on sheet path*/ * 1) ) depending on sheet path*/
int m_Flag; /* flag for computations */ int m_Flag; /* flag for computations */
...@@ -73,11 +76,32 @@ public: ...@@ -73,11 +76,32 @@ public:
m_TimeStamp = 0; m_TimeStamp = 0;
m_IsNew = false; m_IsNew = false;
m_Value = NULL; m_Value = NULL;
m_Reference[0] = 0;
m_NumRef = 0; m_NumRef = 0;
m_Flag = 0; m_Flag = 0;
} }
/* Some accessors which hide the strategy of how the reference is stored,
thereby making it easy to change that strategy.
*/
void SetRef( const wxString& aReference )
{
m_Ref = CONV_TO_UTF8( aReference );
}
wxString GetRef() const
{
return CONV_FROM_UTF8( m_Ref.c_str() );
}
void SetRefStr( const std::string& aReference )
{
m_Ref = aReference;
}
const char* GetRefStr() const
{
return m_Ref.c_str();
}
int CompareValue( const OBJ_CMP_TO_LIST& item ) const int CompareValue( const OBJ_CMP_TO_LIST& item ) const
{ {
...@@ -87,7 +111,7 @@ public: ...@@ -87,7 +111,7 @@ public:
int CompareRef( const OBJ_CMP_TO_LIST& item ) const int CompareRef( const OBJ_CMP_TO_LIST& item ) const
{ {
return strnicmp( m_Reference, item.m_Reference, 32 ); return m_Ref.compare( item.m_Ref );
} }
......
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