Commit 00dadcbb authored by charras's avatar charras
Browse files

Print function now properly prints all sheets in a complex hierarchy.Plot functions not yet updated

parent 1b5baa6b
Loading
Loading
Loading
Loading
+7 −0
Original line number Original line Diff line number Diff line
@@ -5,6 +5,13 @@ Started 2007-June-11
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.


2009-Jan-07 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
++Eeschema:
    Print function now properly prints all sheets in a complex hierarchy
    Note: plot functions are not updated and do not plot all sheets.


2009-Jan-07 UPDATE Wayne Stambaugh <stambaughw@verizon.net>
2009-Jan-07 UPDATE Wayne Stambaugh <stambaughw@verizon.net>
================================================================================
================================================================================
++all
++all
+42 −22
Original line number Original line Diff line number Diff line
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////

// Name:        class_drawsheet.cpp
// Name:        class_drawsheet.cpp
// Purpose:		member functions for DrawSheetStruct
// Purpose:		member functions for DrawSheetStruct
//				header = class_drawsheet.h
//				header = class_drawsheet.h
// Author:      jean-pierre Charras
// Author:      jean-pierre Charras
// Modified by:
// Modified by:
// Created:     08/02/2006 18:37:02
// RCS-ID:
// Copyright:
// Licence:     License GNU
// Licence:     License GNU
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////


// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"

#ifdef __BORLANDC__
#pragma hdrstop
#endif

#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif

#include "fctsys.h"
#include "fctsys.h"


#include "common.h"
#include "common.h"
@@ -31,7 +16,7 @@




/**********************************************/
/**********************************************/
/* class to handle a series of sheets *********/
/* class to handle a serie of sheets *********/
/* a 'path' so to speak.. *********************/
/* a 'path' so to speak.. *********************/
/**********************************************/
/**********************************************/
DrawSheetPath::DrawSheetPath()
DrawSheetPath::DrawSheetPath()
@@ -42,6 +27,41 @@ DrawSheetPath::DrawSheetPath()
    m_numSheets = 0;
    m_numSheets = 0;
}
}


/*********************************************************************************************/
bool DrawSheetPath::BuildSheetPathInfoFromSheetPathValue(const wxString & aPath, bool aFound )
/*********************************************************************************************/
/** Function BuildSheetPathInfoFromSheetPathValue
 * Fill this with data to acces to the hierarchical sheet known by its path aPath
 * @param aPath = path of the sheet to reach (in non human readable format)
 * @return true if success else false
 */
{
    if ( aFound )
        return true;

    if (  GetSheetsCount() == 0 )
        Push( g_RootSheet );

    if  ( aPath == Path() )
        return true;

    SCH_ITEM* schitem = LastDrawList();
    while( schitem && GetSheetsCount() < NB_MAX_SHEET )
    {
        if( schitem->Type() == DRAW_SHEET_STRUCT_TYPE )
        {
            DrawSheetStruct* sheet = (DrawSheetStruct*) schitem;
            Push( sheet );
            if  ( aPath == Path() )
                return true;
            if ( BuildSheetPathInfoFromSheetPathValue( aPath ) )
                return true;
            Pop();
        }
        schitem = schitem->Next();
    }
    return false;
}


/*******************************************************************/
/*******************************************************************/
int DrawSheetPath::Cmp( const DrawSheetPath& aSheetPathToTest ) const
int DrawSheetPath::Cmp( const DrawSheetPath& aSheetPathToTest ) const
@@ -59,7 +79,7 @@ int DrawSheetPath::Cmp( const DrawSheetPath& aSheetPathToTest ) const
        return -1;
        return -1;


    //otherwise, same number of sheets.
    //otherwise, same number of sheets.
    for( int i = 0; i<m_numSheets; i++ )
    for( unsigned i = 0; i<m_numSheets; i++ )
    {
    {
        if( m_sheets[i]->m_TimeStamp > aSheetPathToTest.m_sheets[i]->m_TimeStamp )
        if( m_sheets[i]->m_TimeStamp > aSheetPathToTest.m_sheets[i]->m_TimeStamp )
            return 1;
            return 1;
@@ -155,7 +175,7 @@ wxString DrawSheetPath::Path()
    //start at 1 to avoid the root sheet,
    //start at 1 to avoid the root sheet,
    //which does not need to be added to the path
    //which does not need to be added to the path
    //it's timestamp changes anyway.
    //it's timestamp changes anyway.
    for( int i = 1; i< m_numSheets; i++ )
    for( unsigned i = 1; i< m_numSheets; i++ )
    {
    {
        t.Printf( _( "%8.8lX/" ), m_sheets[i]->m_TimeStamp );
        t.Printf( _( "%8.8lX/" ), m_sheets[i]->m_TimeStamp );
        s = s + t;
        s = s + t;
@@ -180,7 +200,7 @@ wxString DrawSheetPath::PathHumanReadable()
    s = wxT( "/" );
    s = wxT( "/" );


    //start at 1 to avoid the root sheet, as above.
    //start at 1 to avoid the root sheet, as above.
    for( int i = 1; i< m_numSheets; i++ )
    for( unsigned i = 1; i< m_numSheets; i++ )
    {
    {
        s = s + m_sheets[i]->m_SheetName + wxT( "/" );
        s = s + m_sheets[i]->m_SheetName + wxT( "/" );
    }
    }
@@ -211,7 +231,7 @@ void DrawSheetPath::UpdateAllScreenReferences()
bool DrawSheetPath::operator=( const DrawSheetPath& d1 )
bool DrawSheetPath::operator=( const DrawSheetPath& d1 )
{
{
    m_numSheets = d1.m_numSheets;
    m_numSheets = d1.m_numSheets;
    int i;
    unsigned i;
    for( i = 0; i<m_numSheets; i++ )
    for( i = 0; i<m_numSheets; i++ )
    {
    {
        m_sheets[i] = d1.m_sheets[i];
        m_sheets[i] = d1.m_sheets[i];
@@ -230,7 +250,7 @@ bool DrawSheetPath::operator==( const DrawSheetPath& d1 )
{
{
    if( m_numSheets != d1.m_numSheets )
    if( m_numSheets != d1.m_numSheets )
        return false;
        return false;
    for( int i = 0; i<m_numSheets; i++ )
    for( unsigned i = 0; i<m_numSheets; i++ )
    {
    {
        if( m_sheets[i] != d1.m_sheets[i] )
        if( m_sheets[i] != d1.m_sheets[i] )
            return false;
            return false;
@@ -244,7 +264,7 @@ bool DrawSheetPath::operator!=( const DrawSheetPath& d1 )
{
{
    if( m_numSheets != d1.m_numSheets )
    if( m_numSheets != d1.m_numSheets )
        return true;
        return true;
    for( int i = 0; i<m_numSheets; i++ )
    for( unsigned i = 0; i<m_numSheets; i++ )
    {
    {
        if( m_sheets[i] != d1.m_sheets[i] )
        if( m_sheets[i] != d1.m_sheets[i] )
            return true;
            return true;
+18 −3
Original line number Original line Diff line number Diff line
@@ -60,16 +60,24 @@
 */
 */
class DrawSheetPath
class DrawSheetPath
{
{
public:
private:
    int m_numSheets;
    unsigned m_numSheets;


public:
#define DSLSZ 32          // Max number of levels for a sheet path
#define DSLSZ 32          // Max number of levels for a sheet path
    DrawSheetStruct* m_sheets[DSLSZ];
    DrawSheetStruct* m_sheets[DSLSZ];


public:
public:
    DrawSheetPath();
    DrawSheetPath();
    ~DrawSheetPath() { };
    ~DrawSheetPath() { };
    void                Clear() { m_numSheets = 0; }
    void                Clear()
    { m_numSheets = 0;
    }

    unsigned GetSheetsCount()
    {
        return m_numSheets;
    }


    /** Function Cmp
    /** Function Cmp
     * Compare if this is the same sheet path as aSheetPathToTest
     * Compare if this is the same sheet path as aSheetPathToTest
@@ -124,6 +132,13 @@ public:
     */
     */
    wxString            PathHumanReadable();
    wxString            PathHumanReadable();


    /** Function BuildSheetPathInfoFromSheetPathValue
     * Fill this with data to acces to the hierarchical sheet known by its path aPath
     * @param aPath = path of the sheet to reach (in non human readable format)
     * @return true if success else false
     */
    bool BuildSheetPathInfoFromSheetPathValue(const wxString & aPath, bool aFound = false );

    /**
    /**
     * Function UpdateAllScreenReferences
     * Function UpdateAllScreenReferences
     * updates the reference and the m_Multi parameter (part selection) for all
     * updates the reference and the m_Multi parameter (part selection) for all
+6 −5
Original line number Original line Diff line number Diff line
@@ -29,15 +29,16 @@ enum {


class WinEDA_HierFrame;
class WinEDA_HierFrame;


/* Cette classe permet de memoriser la feuille (sheet) associ�e a l'item
/* This class derived from wxTreeItemData stores the DrawSheetPath of each sheet in hierarcy
  * pour l'arbre de hierarchie */
 * in each TreeItem, in its associated data buffer
*/
class TreeItemData : public wxTreeItemData
class TreeItemData : public wxTreeItemData
{
{
public:
public:
    DrawSheetPath m_SheetList;
    DrawSheetPath m_SheetPath;
    TreeItemData( DrawSheetPath sheet ) : wxTreeItemData()
    TreeItemData( DrawSheetPath sheet ) : wxTreeItemData()
    {
    {
        m_SheetList = sheet;
        m_SheetPath = sheet;
    }
    }
};
};


@@ -250,7 +251,7 @@ void WinEDA_HierFrame::OnSelect( wxTreeEvent& event )
    wxTreeItemId ItemSel = m_Tree->GetSelection();
    wxTreeItemId ItemSel = m_Tree->GetSelection();


    *(m_Parent->m_CurrentSheet) =
    *(m_Parent->m_CurrentSheet) =
        ( (TreeItemData*) m_Tree->GetItemData( ItemSel ) )->m_SheetList;
        ( (TreeItemData*) m_Tree->GetItemData( ItemSel ) )->m_SheetPath;
    UpdateScreenFromSheet( m_Parent );
    UpdateScreenFromSheet( m_Parent );
    Close( TRUE );
    Close( TRUE );
}
}
+2 −2
Original line number Original line Diff line number Diff line
@@ -9,7 +9,7 @@ COMMON_GLOBL wxString g_BuildVersion
#    include "config.h"
#    include "config.h"
     (wxT(KICAD_SVN_VERSION))
     (wxT(KICAD_SVN_VERSION))
#  else
#  else
     (wxT("(20081229-unstable)")) /* main program version */
     (wxT("(20090107-unstable)")) /* main program version */
#  endif
#  endif
#endif
#endif
;
;
@@ -20,7 +20,7 @@ COMMON_GLOBL wxString g_BuildAboutVersion
#    include "config.h"
#    include "config.h"
     (wxT(KICAD_ABOUT_VERSION))
     (wxT(KICAD_ABOUT_VERSION))
#  else
#  else
     (wxT("(20081229-unstable)")) /* svn date & rev (normally overridden) */
     (wxT("(20090107-unstable)")) /* svn date & rev (normally overridden) */
#  endif
#  endif
#endif
#endif
;
;
Loading