Commit 7f453831 authored by charras's avatar charras
Browse files

eeschema: code cleaning. SCH_ITEM class used for all schematic items in...

eeschema: code cleaning. SCH_ITEM class used for all schematic items in eeschema. Files reorganization.
parent 7bb6007a
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.

2008-Apr-14 UPDATE  Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+eeschema
    code cleaning. SCH_ITEM class used for all schematic items in eeschema.
    Files reorganization.


2008-Apr-09 UPDATE  Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+eeschema
+1 −0
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@ set(COMMON_SRCS
    basicframe.cpp
    bitmaps.cpp
    block_commande.cpp
    class_drawpickedstruct.cpp
    common.cpp
    common_plot_functions.cpp
    common_plotHPGL_functions.cpp
+0 −109
Original line number Diff line number Diff line
@@ -88,38 +88,6 @@ void EDA_BaseStruct::AddToChain( EDA_BaseStruct* laststruct )
}


/**************************************************************************************/
void EDA_BaseStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
                           int draw_mode, int Color )
/**************************************************************************************/

/* Virtual
 */
{
    wxString msg, name;

    msg.Printf( wxT(
            "EDA_BaseStruct::Draw() error. Method for struct type %d used but not implemented (" ),
        Type() );
    msg += GetClass() + wxT( ")\n" );
    printf( CONV_TO_UTF8( msg ) );
}


#if 0
/**************************************************************/
void EDA_BaseStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC )
/**************************************************************/

/* fonction virtuelle de placement: non utilisee en pcbnew (utilisee eeschema)
 *  ---- A mieux utiliser (TODO...)
 */
{
}


#endif


// see base_struct.h
SEARCH_RESULT EDA_BaseStruct::IterateForward( EDA_BaseStruct* listStart,
@@ -827,80 +795,3 @@ void EDA_Rect::Merge( const EDA_Rect& aRect )
    SetEnd( end );
}

/**************************/
/* class DrawPickedStruct */
/**************************/

/* This class has only one useful member: .m_PickedStruct, used as a link.
 *  It does not describe really an item.
 *  It is used to create a linked list of selected items (in block selection).
 *  Each DrawPickedStruct item has is member: .m_PickedStruct pointing the
 *  real selected item
 */

/*******************************************************************/
DrawPickedStruct::DrawPickedStruct( EDA_BaseStruct* pickedstruct ) :
    SCH_ITEM( NULL, DRAW_PICK_ITEM_STRUCT_TYPE )
/*******************************************************************/
{
    m_PickedStruct = pickedstruct;
}


DrawPickedStruct::~DrawPickedStruct()
{
}

#if defined(DEBUG)
void DrawPickedStruct::Show( int nestLevel, std::ostream& os )
{
    NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << "/>\n";
}
#endif


EDA_Rect DrawPickedStruct::GetBoundingBox()
{
    if( m_PickedStruct )
        return m_PickedStruct->GetBoundingBox();
    else
    {
        return EDA_Rect();      // empty rectangle
    }
}


EDA_Rect DrawPickedStruct::GetBoundingBoxUnion()
{
    EDA_Rect    ret;

    DrawPickedStruct*   cur = this;
    EDA_BaseStruct*     item;
    while( cur && (item = cur->m_PickedStruct) != NULL )
    {
        ret.Merge( item->GetBoundingBox() );

        cur = cur->Next();
    }

    return ret;
}


/*********************************************/
void DrawPickedStruct::DeleteWrapperList()
/*********************************************/

/* Delete this item all the items of the linked list
 *  Free the wrapper, but DOES NOT delete the picked items linked by .m_PickedStruct
 */
{
    DrawPickedStruct* wrapp_struct, * next_struct;

    for( wrapp_struct = Next(); wrapp_struct != NULL; wrapp_struct = next_struct )
    {
        next_struct = wrapp_struct->Next();
        delete wrapp_struct;
    }
}
+1 −0
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@
#include "gr_basic.h"
#include "wxstruct.h"
#include "common.h"
#include "sch_item_struct.h"
#include "macros.h"


+84 −0
Original line number Diff line number Diff line
/****************************************************/
/*	class_drawpickedstruct.cpp */
/****************************************************/

#include "fctsys.h"
#include "common.h"
#include "sch_item_struct.h"

/**************************/
/* class DrawPickedStruct */
/**************************/

/* This class has only one useful member: .m_PickedStruct, used as a link.
 *  It does not describe really an item.
 *  It is used to create a linked list of selected items (in block selection).
 *  Each DrawPickedStruct item has is member: .m_PickedStruct pointing the
 *  real selected item
 */

/*******************************************************************/
DrawPickedStruct::DrawPickedStruct( SCH_ITEM * pickedstruct ) :
    SCH_ITEM( NULL, DRAW_PICK_ITEM_STRUCT_TYPE )
/*******************************************************************/
{
    m_PickedStruct = pickedstruct;
}


DrawPickedStruct::~DrawPickedStruct()
{
}

#if defined(DEBUG)
void DrawPickedStruct::Show( int nestLevel, std::ostream& os )
{
    NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << "/>\n";
}
#endif


EDA_Rect DrawPickedStruct::GetBoundingBox()
{
    if( m_PickedStruct )
        return m_PickedStruct->GetBoundingBox();
    else
    {
        return EDA_Rect();      // empty rectangle
    }
}


EDA_Rect DrawPickedStruct::GetBoundingBoxUnion()
{
    EDA_Rect    ret;

    DrawPickedStruct*   cur = this;
    SCH_ITEM*           item;
    while( cur && (item = cur->m_PickedStruct) != NULL )
    {
        ret.Merge( item->GetBoundingBox() );

        cur = cur->Next();
    }

    return ret;
}


/*********************************************/
void DrawPickedStruct::DeleteWrapperList()
/*********************************************/

/* Delete this item all the items of the linked list
 *  Free the wrapper, but DOES NOT delete the picked items linked by .m_PickedStruct
 */
{
    DrawPickedStruct* wrapp_struct, * next_struct;

    for( wrapp_struct = Next(); wrapp_struct != NULL; wrapp_struct = next_struct )
    {
        next_struct = wrapp_struct->Next();
        delete wrapp_struct;
    }
}
Loading