Commit 4715ea28 authored by dickelbeck's avatar dickelbeck
Browse files

delete hierarhical pin sheet bug

parent 6f4f6f6e
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -5,6 +5,22 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
email address.


2008-Apr-22 UPDATE   Dick Hollenbeck <dick@softplc.com>
================================================================================
+eeschema
  * Spent a 1/2 day tracking down two linked list bugs in deleting a
    DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE.   I cannot believe in the year
    2008 we should have to debug a linked list function.  This is stuff I expected
    to do 20 years ago, not today.  The function
    void WinEDA_SchematicFrame::DeleteSheetLabel( wxDC* DC,
              Hierarchical_PIN_Sheet_Struct* SheetLabelToDel ) never worked as
    far as I can tell.
    Should switch to boost::ptr_vector ASAP everywhere, and leave linked lists in the 1980's.
  * Hierarchical_PIN_Sheet_Struct::Hierarchical_PIN_Sheet_Struct() was not
    setting the m_Parent.


2008-Apr-21 UPDATE   Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+eeschema
+4 −15
Original line number Diff line number Diff line
@@ -161,22 +161,12 @@ std::ostream& operator<<( std::ostream& out, const wxPoint& pt )
 */
void EDA_BaseStruct::Show( int nestLevel, std::ostream& os )
{
    // for now, make it look like XML:
    // XML output:
    wxString s = GetClass();

    s = s + wxT( " " );
    NestedSpace( nestLevel, os ) << '<' << s.Lower().mb_str() << ">\n";

    /*
     * EDA_BaseStruct* kid = m_Son;
     * for( ; kid;  kid = kid->Pnext )
     * {
     * kid->Show( nestLevel+1, os );
     * }
     */
    NestedSpace( nestLevel + 1, os ) << "Need ::Show() override\n";

    NestedSpace( nestLevel, os ) << "</" << s.Lower().mb_str() << ">\n";
    NestedSpace( nestLevel, os ) << '<' << s.Lower().mb_str() << ">"
        << " Need ::Show() override for this class "
        << "</" << s.Lower().mb_str() << ">\n";
}


@@ -195,7 +185,6 @@ std::ostream& EDA_BaseStruct::NestedSpace( int nestLevel, std::ostream& os )
    return os;
}


#endif


+23 −0
Original line number Diff line number Diff line
@@ -631,6 +631,28 @@ bool DrawSheetStruct::ChangeFileName( WinEDA_SchematicFrame* aFrame, const wxStr
}


#if defined(DEBUG)
void DrawSheetStruct::Show( int nestLevel, std::ostream& os )
{
    // XML output:
    wxString s = GetClass();

    NestedSpace( nestLevel, os ) << '<' << s.Lower().mb_str() << ">"
        << " sheet_name=\"" << CONV_TO_UTF8( m_SheetName) << '"'
        << ">\n";

    // show all the pins, and check the linked list integrity
    Hierarchical_PIN_Sheet_Struct* label;
    for( label = m_Label;   label;   label=label->Next() )
    {
        label->Show( nestLevel+1, os );
    }

    NestedSpace( nestLevel, os ) << "</" << s.Lower().mb_str() << ">\n"
        << std::flush;
}
#endif


/**********************************************/
/* class to handle a series of sheets *********/
@@ -815,3 +837,4 @@ bool DrawSheetPath::operator!=( const DrawSheetPath& d1 )

    return false;
}
+15 −5
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ public:
                                   const wxString& text = wxEmptyString );

    ~Hierarchical_PIN_Sheet_Struct() { }

    virtual wxString GetClass() const
    {
        return wxT( "Hierarchical_PIN_Sheet_Struct" );
@@ -37,8 +38,7 @@ public:

    Hierarchical_PIN_Sheet_Struct*  GenCopy();

    Hierarchical_PIN_Sheet_Struct* Next()
    { return (Hierarchical_PIN_Sheet_Struct*) Pnext; }
    Hierarchical_PIN_Sheet_Struct* Next() { return (Hierarchical_PIN_Sheet_Struct*) Pnext; }

    void        Place( WinEDA_SchematicFrame* frame, wxDC* DC );
    void        Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
@@ -51,6 +51,11 @@ public:
     * @return bool - true if success writing else false.
     */
    bool        Save( FILE* aFile ) const;

#if defined(DEBUG)
    // comment inherited by Doxygen from Base_Struct
    void        Show( int nestLevel, std::ostream& os );
#endif
};


@@ -120,6 +125,11 @@ public:
    //void 		RemoveSheet(DrawSheetStruct* sheet);
    //to remove a sheet, just delete it
    //-- the destructor should take care of everything else.

#if defined(DEBUG)
    // comment inherited by Doxygen from Base_Struct
    void                Show( int nestLevel, std::ostream& os );
#endif
};


+19 −1
Original line number Diff line number Diff line
@@ -36,10 +36,12 @@
/*******************************************************************/
Hierarchical_PIN_Sheet_Struct::Hierarchical_PIN_Sheet_Struct( DrawSheetStruct* parent,
                                            const wxPoint& pos, const wxString& text ) :
    SCH_ITEM( NULL, DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE ),
    SCH_ITEM( parent, DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE ),
    EDA_TextStruct( text )
/*******************************************************************/
{
    wxASSERT( parent );
    wxASSERT( Pnext == NULL );
    m_Layer      = LAYER_SHEETLABEL;
    m_Pos        = pos;
    m_Edge       = 0;
@@ -199,3 +201,19 @@ bool Hierarchical_PIN_Sheet_Struct::Save( FILE* aFile ) const
    return true;
}

#if defined(DEBUG)
void Hierarchical_PIN_Sheet_Struct::Show( int nestLevel, std::ostream& os )
{
    // XML output:
    wxString s = GetClass();

    NestedSpace( nestLevel, os ) << '<' << s.Lower().mb_str() << ">"
        << " pin_name=\"" << CONV_TO_UTF8( m_Text ) << '"'
        << "/>\n"
        << std::flush;

//    NestedSpace( nestLevel, os ) << "</" << s.Lower().mb_str() << ">\n";

}

#endif
Loading