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 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
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>
================================================================================
++all
+42 −22
Original line number Diff line number Diff line
/////////////////////////////////////////////////////////////////////////////

// Name:        class_drawsheet.cpp
// Purpose:		member functions for DrawSheetStruct
//				header = class_drawsheet.h
// Author:      jean-pierre Charras
// Modified by:
// Created:     08/02/2006 18:37:02
// RCS-ID:
// Copyright:
// 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 "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.. *********************/
/**********************************************/
DrawSheetPath::DrawSheetPath()
@@ -42,6 +27,41 @@ DrawSheetPath::DrawSheetPath()
    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
@@ -59,7 +79,7 @@ int DrawSheetPath::Cmp( const DrawSheetPath& aSheetPathToTest ) const
        return -1;

    //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 )
            return 1;
@@ -155,7 +175,7 @@ wxString DrawSheetPath::Path()
    //start at 1 to avoid the root sheet,
    //which does not need to be added to the path
    //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 );
        s = s + t;
@@ -180,7 +200,7 @@ wxString DrawSheetPath::PathHumanReadable()
    s = wxT( "/" );

    //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( "/" );
    }
@@ -211,7 +231,7 @@ void DrawSheetPath::UpdateAllScreenReferences()
bool DrawSheetPath::operator=( const DrawSheetPath& d1 )
{
    m_numSheets = d1.m_numSheets;
    int i;
    unsigned i;
    for( i = 0; i<m_numSheets; i++ )
    {
        m_sheets[i] = d1.m_sheets[i];
@@ -230,7 +250,7 @@ bool DrawSheetPath::operator==( const DrawSheetPath& d1 )
{
    if( m_numSheets != d1.m_numSheets )
        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] )
            return false;
@@ -244,7 +264,7 @@ bool DrawSheetPath::operator!=( const DrawSheetPath& d1 )
{
    if( m_numSheets != d1.m_numSheets )
        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] )
            return true;
+18 −3
Original line number Diff line number Diff line
@@ -60,16 +60,24 @@
 */
class DrawSheetPath
{
public:
    int m_numSheets;
private:
    unsigned m_numSheets;

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

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

    unsigned GetSheetsCount()
    {
        return m_numSheets;
    }

    /** Function Cmp
     * Compare if this is the same sheet path as aSheetPathToTest
@@ -124,6 +132,13 @@ public:
     */
    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
     * updates the reference and the m_Multi parameter (part selection) for all
+6 −5
Original line number Diff line number Diff line
@@ -29,15 +29,16 @@ enum {

class WinEDA_HierFrame;

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

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