Commit 64507e39 authored by Ronald Sousa's avatar Ronald Sousa

- changes sheet number, path, and timestamp from nodes to attributes

- changes comment number and value from nodes to attibutes
- UPdate bom_with_title_block_2_csv to use the changes made for sheet and comment
parent d4135f5d
...@@ -197,12 +197,13 @@ class NETLIST_EXPORT_TOOL ...@@ -197,12 +197,13 @@ class NETLIST_EXPORT_TOOL
* builds the entire document tree for the generic export. This is factored * builds the entire document tree for the generic export. This is factored
* out here so we can write the tree in either S-expression file format * out here so we can write the tree in either S-expression file format
* or in XML if we put the tree built here into a wxXmlDocument. * or in XML if we put the tree built here into a wxXmlDocument.
* @return XNODE* - the root nodes
*/ */
XNODE* makeGenericRoot(); XNODE* makeGenericRoot();
/** /**
* Function makeGenericComponents * Function makeGenericComponents
* returns a sub-tree holding all the schematic components. * @return XNODE* - returns a sub-tree holding all the schematic components.
*/ */
XNODE* makeGenericComponents(); XNODE* makeGenericComponents();
...@@ -216,12 +217,14 @@ class NETLIST_EXPORT_TOOL ...@@ -216,12 +217,14 @@ class NETLIST_EXPORT_TOOL
/** /**
* Function makeGenericLibParts * Function makeGenericLibParts
* fills out an XML node with the unique library parts and returns it. * fills out an XML node with the unique library parts and returns it.
* @return XNODE* - the library parts nodes
*/ */
XNODE* makeGenericLibParts(); XNODE* makeGenericLibParts();
/** /**
* Function makeGenericListOfNets * Function makeGenericListOfNets
* fills out an XML node with a list of nets and returns it. * fills out an XML node with a list of nets and returns it.
* @return XNODE* - the list of nets nodes
*/ */
XNODE* makeGenericListOfNets(); XNODE* makeGenericListOfNets();
...@@ -229,6 +232,7 @@ class NETLIST_EXPORT_TOOL ...@@ -229,6 +232,7 @@ class NETLIST_EXPORT_TOOL
* Function makeGenericLibraries * Function makeGenericLibraries
* fills out an XML node with a list of used libraries and returns it. * fills out an XML node with a list of used libraries and returns it.
* Must have called makeGenericLibParts() before this function. * Must have called makeGenericLibParts() before this function.
* @return XNODE* - the library nodes
*/ */
XNODE* makeGenericLibraries(); XNODE* makeGenericLibraries();
...@@ -654,13 +658,12 @@ static XNODE* node( const wxString& aName, const wxString& aTextualContent = wxE ...@@ -654,13 +658,12 @@ static XNODE* node( const wxString& aName, const wxString& aTextualContent = wxE
XNODE* NETLIST_EXPORT_TOOL::makeGenericDesignHeader() XNODE* NETLIST_EXPORT_TOOL::makeGenericDesignHeader()
{ {
SCH_SCREEN* screen; SCH_SCREEN* screen;
XNODE* xdesign = node( wxT("design") ); XNODE* xdesign = node( wxT("design") );
XNODE* xsheetInfo; XNODE* xtitleBlock;
XNODE* xcommentNode; XNODE* xsheet;
XNODE* xpagesNode; XNODE* xcomment;
XNODE* xpageNode; wxString sheetTxt;
wxString sheetNumTxt; wxFileName sourceFileName;
wxString sheetNumTxtFormat = wxT( "%d" );
// the root sheet is a special sheet, call it source // the root sheet is a special sheet, call it source
xdesign->AddChild( node( wxT( "source" ), g_RootSheet->GetScreen()->GetFileName() ) ); xdesign->AddChild( node( wxT( "source" ), g_RootSheet->GetScreen()->GetFileName() ) );
...@@ -674,39 +677,51 @@ XNODE* NETLIST_EXPORT_TOOL::makeGenericDesignHeader() ...@@ -674,39 +677,51 @@ XNODE* NETLIST_EXPORT_TOOL::makeGenericDesignHeader()
Export the sheets information Export the sheets information
*/ */
SCH_SHEET_LIST sheetList; SCH_SHEET_LIST sheetList;
xdesign->AddChild( xpagesNode = node( wxT( "sheets" ) ) );
for( SCH_SHEET_PATH* sheet = sheetList.GetFirst(); sheet; sheet = sheetList.GetNext() ) for( SCH_SHEET_PATH* sheet = sheetList.GetFirst(); sheet; sheet = sheetList.GetNext() )
{ {
xpagesNode->AddChild( xpageNode = node( wxT( "sheet" ) ) ); screen = sheet->LastScreen();
xdesign->AddChild( xsheet = node( wxT( "sheet" ) ) );
// get the string representation of the sheet index number. // get the string representation of the sheet index number.
// Note that sheet->GetIndex() is zero index base and we need to increment the number by one to make // Note that sheet->GetIndex() is zero index base and we need to increment the number by one to make
// human readable // human readable
sheetNumTxt.Printf( sheetNumTxtFormat, ( sheetList.GetIndex() + 1 ) ); sheetTxt.Printf( wxT( "%d" ), ( sheetList.GetIndex() + 1 ) );
xsheet->AddAttribute( wxT( "number" ), sheetTxt );
xsheet->AddAttribute( wxT( "name" ), sheet->PathHumanReadable() );
xsheet->AddAttribute( wxT( "tstamps" ), sheet->Path() );
xpageNode->AddChild( node( wxT( "number" ), sheetNumTxt ) );
xpageNode->AddChild( node( wxT( "name" ), sheet->PathHumanReadable() ) );
xpageNode->AddChild( node( wxT( "tstamps" ), sheet->Path() ) );
screen = sheet->LastScreen();
TITLE_BLOCK tb = screen->GetTitleBlock(); TITLE_BLOCK tb = screen->GetTitleBlock();
xpageNode->AddChild( xsheetInfo = node( wxT( "page" ) ) ); xsheet->AddChild( xtitleBlock = node( wxT( "title_block" ) ) );
xsheetInfo->AddChild( node( wxT( "title" ), tb.GetTitle() ) ); xtitleBlock->AddChild( node( wxT( "title" ), tb.GetTitle() ) );
xsheetInfo->AddChild( node( wxT( "company" ), tb.GetCompany() ) ); xtitleBlock->AddChild( node( wxT( "company" ), tb.GetCompany() ) );
xsheetInfo->AddChild( node( wxT( "revision" ), tb.GetRevision() ) ); xtitleBlock->AddChild( node( wxT( "rev" ), tb.GetRevision() ) );
xsheetInfo->AddChild( node( wxT( "issueDate" ), tb.GetDate() ) ); xtitleBlock->AddChild( node( wxT( "date" ), tb.GetDate() ) );
xsheetInfo->AddChild( node( wxT( "source" ), screen->GetFileName() ) );
// We are going to remove the fileName directories.
xsheetInfo->AddChild( xcommentNode = node( wxT( "comments" ) ) ); sourceFileName = wxFileName( screen->GetFileName() );
xcommentNode->AddChild( node( wxT( "comment" ), tb.GetComment1() ) ); xtitleBlock->AddChild( node( wxT( "source" ), sourceFileName.GetFullName() ) );
xcommentNode->AddChild( node( wxT( "comment" ), tb.GetComment2() ) );
xcommentNode->AddChild( node( wxT( "comment" ), tb.GetComment3() ) ); xtitleBlock->AddChild( xcomment = node( wxT( "comment" ) ) );
xcommentNode->AddChild( node( wxT( "comment" ), tb.GetComment4() ) ); xcomment->AddAttribute( wxT("number"), wxT("1") );
xcomment->AddAttribute( wxT( "value" ), tb.GetComment1() );
}
xtitleBlock->AddChild( xcomment = node( wxT( "comment" ) ) );
xcomment->AddAttribute( wxT("number"), wxT("2") );
xcomment->AddAttribute( wxT( "value" ), tb.GetComment2() );
xtitleBlock->AddChild( xcomment = node( wxT( "comment" ) ) );
xcomment->AddAttribute( wxT("number"), wxT("3") );
xcomment->AddAttribute( wxT( "value" ), tb.GetComment3() );
xtitleBlock->AddChild( xcomment = node( wxT( "comment" ) ) );
xcomment->AddAttribute( wxT("number"), wxT("4") );
xcomment->AddAttribute( wxT( "value" ), tb.GetComment4() );
}
return xdesign; return xdesign;
} }
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
Title, the project's tile Title, the project's tile
Company, the project's company Company, the project's company
Revision, the project's revision Rev, the project's revision
Date Source, project's issue date Date Source, project's issue date
Comment, This is comment 1 Comment, This is comment 1
Comment, This is comment 2 Comment, This is comment 2
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
<xsl:text>&nl;</xsl:text> <xsl:text>&nl;</xsl:text>
<!-- Ouput Root sheet project information --> <!-- Ouput Root sheet project information -->
<xsl:apply-templates select="/export/design/sheets/sheet[1]"/> <xsl:apply-templates select="/export/design/sheet[1]"/>
<xsl:text>&nl;</xsl:text> <xsl:text>&nl;</xsl:text>
...@@ -70,11 +70,11 @@ ...@@ -70,11 +70,11 @@
</xsl:template> </xsl:template>
<!-- generate the Root sheet project information --> <!-- generate the Root sheet project information -->
<xsl:template match="/export/design/sheets/sheet[1]"> <xsl:template match="/export/design/sheet[1]">
<xsl:choose> <xsl:choose>
<xsl:when test="page/title !=''"> <xsl:when test="title_block/title !=''">
<xsl:text>Title,</xsl:text><xsl:value-of select="page/title"/><xsl:text>&nl;</xsl:text> <xsl:text>Title,</xsl:text><xsl:value-of select="title_block/title"/><xsl:text>&nl;</xsl:text>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:text>Title,Not Set</xsl:text><xsl:text>&nl;</xsl:text> <xsl:text>Title,Not Set</xsl:text><xsl:text>&nl;</xsl:text>
...@@ -83,8 +83,8 @@ ...@@ -83,8 +83,8 @@
<xsl:choose> <xsl:choose>
<xsl:when test="page/company !=''"> <xsl:when test="title_block/company !=''">
<xsl:text>Company,</xsl:text><xsl:value-of select="page/company"/><xsl:text>&nl;</xsl:text> <xsl:text>Company,</xsl:text><xsl:value-of select="title_block/company"/><xsl:text>&nl;</xsl:text>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:text>Company,Not Set</xsl:text><xsl:text>&nl;</xsl:text> <xsl:text>Company,Not Set</xsl:text><xsl:text>&nl;</xsl:text>
...@@ -92,8 +92,8 @@ ...@@ -92,8 +92,8 @@
</xsl:choose> </xsl:choose>
<xsl:choose> <xsl:choose>
<xsl:when test="page/revision !=''"> <xsl:when test="title_block/rev !=''">
<xsl:text>Revision,</xsl:text><xsl:value-of select="page/revision"/><xsl:text>&nl;</xsl:text> <xsl:text>Revision,</xsl:text><xsl:value-of select="title_block/rev"/><xsl:text>&nl;</xsl:text>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:text>Revision,Not Set</xsl:text><xsl:text>&nl;</xsl:text> <xsl:text>Revision,Not Set</xsl:text><xsl:text>&nl;</xsl:text>
...@@ -101,21 +101,22 @@ ...@@ -101,21 +101,22 @@
</xsl:choose> </xsl:choose>
<xsl:choose> <xsl:choose>
<xsl:when test="page/issueDate !=''"> <xsl:when test="title_block/date !=''">
<xsl:text>Date Issue,</xsl:text><xsl:value-of select="page/issueDate"/><xsl:text>&nl;</xsl:text> <xsl:text>Date Issue,</xsl:text><xsl:value-of select="title_block/date"/><xsl:text>&nl;</xsl:text>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:text>Date Issue,Not Set</xsl:text><xsl:text>&nl;</xsl:text> <xsl:text>Date Issue,Not Set</xsl:text><xsl:text>&nl;</xsl:text>
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
<xsl:apply-templates select="page/comments/comment"/><xsl:text>&nl;</xsl:text> <xsl:apply-templates select="title_block/comment"/>
</xsl:template> </xsl:template>
<xsl:template match="page/comments/comment"> <xsl:template match="title_block/comment">
<xsl:choose> <xsl:choose>
<xsl:when test=". !=''"> <xsl:when test="@value !=''">
<xsl:text>Comment,</xsl:text><xsl:value-of select="."/><xsl:text>&nl;</xsl:text> <xsl:text>Comment,</xsl:text><xsl:value-of select="@value"/><xsl:text>&nl;</xsl:text>
</xsl:when> </xsl:when>
</xsl:choose> </xsl:choose>
</xsl:template> </xsl:template>
......
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