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

- 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
Loading
Loading
Loading
Loading
+45 −30
Original line number Diff line number Diff line
@@ -197,12 +197,13 @@ class NETLIST_EXPORT_TOOL
     * 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
     * or in XML if we put the tree built here into a wxXmlDocument.
     * @return XNODE* - the root nodes
     */
    XNODE* makeGenericRoot();

    /**
     * Function makeGenericComponents
     * returns a sub-tree holding all the schematic components.
     * @return XNODE* - returns a sub-tree holding all the schematic components.
     */
    XNODE* makeGenericComponents();

@@ -216,12 +217,14 @@ class NETLIST_EXPORT_TOOL
    /**
     * Function makeGenericLibParts
     * fills out an XML node with the unique library parts and returns it.
     * @return XNODE* - the library parts nodes
     */
    XNODE* makeGenericLibParts();

    /**
     * Function makeGenericListOfNets
     * fills out an XML node with a list of nets and returns it.
     * @return XNODE* - the list of nets nodes
     */
    XNODE* makeGenericListOfNets();

@@ -229,6 +232,7 @@ class NETLIST_EXPORT_TOOL
     * Function makeGenericLibraries
     * fills out an XML node with a list of used libraries and returns it.
     * Must have called makeGenericLibParts() before this function.
     * @return XNODE* - the library nodes
     */
    XNODE* makeGenericLibraries();

@@ -655,12 +659,11 @@ XNODE* NETLIST_EXPORT_TOOL::makeGenericDesignHeader()
{
    SCH_SCREEN* screen;
    XNODE*     xdesign = node( wxT("design") );
    XNODE*  xsheetInfo;
    XNODE*  xcommentNode;
    XNODE*  xpagesNode;
    XNODE*  xpageNode;
    wxString    sheetNumTxt;
    wxString    sheetNumTxtFormat = wxT( "%d" );
    XNODE*     xtitleBlock;
    XNODE*     xsheet;
    XNODE*     xcomment;
    wxString   sheetTxt;
    wxFileName sourceFileName;

    // the root sheet is a special sheet, call it source
    xdesign->AddChild( node( wxT( "source" ), g_RootSheet->GetScreen()->GetFileName() ) );
@@ -674,38 +677,50 @@ XNODE* NETLIST_EXPORT_TOOL::makeGenericDesignHeader()
        Export the sheets information
    */
    SCH_SHEET_LIST sheetList;
    xdesign->AddChild( xpagesNode = node( wxT( "sheets" ) ) );

    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. 
        // Note that sheet->GetIndex() is zero index base and we need to increment the number by one to make 
        // 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();

        xpageNode->AddChild( xsheetInfo = node( wxT( "page" ) ) );
        xsheet->AddChild( xtitleBlock = node( wxT( "title_block" ) ) );
    
        xtitleBlock->AddChild( node( wxT( "title" ), tb.GetTitle() ) );
        xtitleBlock->AddChild( node( wxT( "company" ), tb.GetCompany() ) );
        xtitleBlock->AddChild( node( wxT( "rev" ), tb.GetRevision() ) );
        xtitleBlock->AddChild( node( wxT( "date" ), tb.GetDate() ) );

        // We are going to remove the fileName directories.
        sourceFileName = wxFileName( screen->GetFileName() );
        xtitleBlock->AddChild( node( wxT( "source" ), sourceFileName.GetFullName() ) );
   
        xtitleBlock->AddChild( xcomment = node( wxT( "comment" ) ) );
        xcomment->AddAttribute( wxT("number"), wxT("1") );
        xcomment->AddAttribute( wxT( "value" ), tb.GetComment1() );

        xsheetInfo->AddChild( node( wxT( "title" ), tb.GetTitle() ) );
        xsheetInfo->AddChild( node( wxT( "company" ), tb.GetCompany() ) );
        xsheetInfo->AddChild( node( wxT( "revision" ), tb.GetRevision() ) );
        xsheetInfo->AddChild( node( wxT( "issueDate" ), tb.GetDate() ) );
        xsheetInfo->AddChild( node( wxT( "source" ), screen->GetFileName() ) );
        xtitleBlock->AddChild( xcomment = node( wxT( "comment" ) ) );
        xcomment->AddAttribute( wxT("number"), wxT("2") );
        xcomment->AddAttribute( wxT( "value" ), tb.GetComment2() );

        xsheetInfo->AddChild( xcommentNode = node( wxT( "comments" ) ) );
        xcommentNode->AddChild( node( wxT( "comment" ), tb.GetComment1() ) );
        xcommentNode->AddChild( node( wxT( "comment" ), tb.GetComment2() ) );
        xcommentNode->AddChild( node( wxT( "comment" ), tb.GetComment3() ) );
        xcommentNode->AddChild( node( wxT( "comment" ), tb.GetComment4() ) );
        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;
+16 −15
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@
        
        Title, the project's tile
        Company, the project's company
        Revision, the project's revision
        Rev, the project's revision
        Date Source, project's issue date
        Comment, This is comment 1
        Comment, This is comment 2
@@ -52,7 +52,7 @@
        <xsl:text>&nl;</xsl:text>
        
        <!-- 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>
        
@@ -70,11 +70,11 @@
    </xsl:template>
    
    <!-- generate the Root sheet project information -->
    <xsl:template match="/export/design/sheets/sheet[1]">
    <xsl:template match="/export/design/sheet[1]">
        
        <xsl:choose>
            <xsl:when test="page/title !=''">
                <xsl:text>Title,</xsl:text><xsl:value-of  select="page/title"/><xsl:text>&nl;</xsl:text>
            <xsl:when test="title_block/title !=''">
                <xsl:text>Title,</xsl:text><xsl:value-of  select="title_block/title"/><xsl:text>&nl;</xsl:text>
            </xsl:when>
            <xsl:otherwise>
                <xsl:text>Title,Not Set</xsl:text><xsl:text>&nl;</xsl:text>
@@ -83,8 +83,8 @@
        
   
        <xsl:choose>
            <xsl:when test="page/company !=''">
                <xsl:text>Company,</xsl:text><xsl:value-of  select="page/company"/><xsl:text>&nl;</xsl:text>
            <xsl:when test="title_block/company !=''">
                <xsl:text>Company,</xsl:text><xsl:value-of  select="title_block/company"/><xsl:text>&nl;</xsl:text>
            </xsl:when>
            <xsl:otherwise>
                <xsl:text>Company,Not Set</xsl:text><xsl:text>&nl;</xsl:text>
@@ -92,8 +92,8 @@
        </xsl:choose>
        
        <xsl:choose>
            <xsl:when test="page/revision !=''">
                <xsl:text>Revision,</xsl:text><xsl:value-of  select="page/revision"/><xsl:text>&nl;</xsl:text>
            <xsl:when test="title_block/rev !=''">
                <xsl:text>Revision,</xsl:text><xsl:value-of  select="title_block/rev"/><xsl:text>&nl;</xsl:text>
            </xsl:when>
            <xsl:otherwise>
                <xsl:text>Revision,Not Set</xsl:text><xsl:text>&nl;</xsl:text>
@@ -101,21 +101,22 @@
        </xsl:choose>
        
        <xsl:choose>
            <xsl:when test="page/issueDate !=''">
                <xsl:text>Date Issue,</xsl:text><xsl:value-of  select="page/issueDate"/><xsl:text>&nl;</xsl:text>
            <xsl:when test="title_block/date !=''">
                <xsl:text>Date Issue,</xsl:text><xsl:value-of  select="title_block/date"/><xsl:text>&nl;</xsl:text>
            </xsl:when>
            <xsl:otherwise>
                <xsl:text>Date Issue,Not Set</xsl:text><xsl:text>&nl;</xsl:text>
            </xsl:otherwise>
        </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 match="page/comments/comment">
    <xsl:template match="title_block/comment">
        <xsl:choose>
            <xsl:when test=". !=''">
            <xsl:text>Comment,</xsl:text><xsl:value-of  select="."/><xsl:text>&nl;</xsl:text>
            <xsl:when test="@value !=''">
            <xsl:text>Comment,</xsl:text><xsl:value-of  select="@value"/><xsl:text>&nl;</xsl:text>
            </xsl:when>
        </xsl:choose>
    </xsl:template>