Commit aaa1cc3e authored by Wayne Stambaugh's avatar Wayne Stambaugh

Eeschema object list and other minor improvements.

* Convert Eeschema from manually linked list to DLIST for storing
  SCH_ITEM objects.
* Add helper functions to SCH_SCREEN for appending list of SCH_ITEM
  objects.
* Fix bug in wire editing code for accurate undo/redo behavior.
* Add member to DLIST to append another DLIST.
* Other minor code cleaning.
parent a1ff3261
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2008-20011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -217,15 +216,14 @@ EDA_ITEM& EDA_ITEM::operator=( const EDA_ITEM& aItem ) ...@@ -217,15 +216,14 @@ EDA_ITEM& EDA_ITEM::operator=( const EDA_ITEM& aItem )
{ {
if( &aItem != this ) if( &aItem != this )
{ {
m_StructType = aItem.Type(); m_Image = aItem.m_Image;
Pnext = aItem.Pnext;
Pback = aItem.Pback;
m_StructType = aItem.m_StructType; m_StructType = aItem.m_StructType;
m_Parent = aItem.m_Parent; m_Parent = aItem.m_Parent;
m_Son = aItem.m_Son; m_Son = aItem.m_Son;
m_Flags = aItem.m_Flags; m_Flags = aItem.m_Flags;
SetTimeStamp( aItem.m_TimeStamp ); m_TimeStamp = aItem.m_TimeStamp;
m_Status = aItem.m_Status; m_Status = aItem.m_Status;
m_forceVisible = aItem.m_forceVisible;
} }
return *this; return *this;
......
...@@ -85,6 +85,36 @@ void DHEAD::append( EDA_ITEM* aNewElement ) ...@@ -85,6 +85,36 @@ void DHEAD::append( EDA_ITEM* aNewElement )
} }
void DHEAD::append( DHEAD& aList )
{
wxCHECK_RET( aList.GetCount() != 0, wxT( "Attempt to append empty list." ) );
// Change the item's list to me.
for( EDA_ITEM* item = aList.first; item != NULL; item = item->Next() )
item->SetList( this );
if( first ) // list is not empty, set last item's next to the first item in aList
{
wxCHECK_RET( last != NULL, wxT( "Last list element not set." ) );
last->SetNext( aList.first );
aList.first->SetBack( last );
last = aList.last;
}
else // list is empty, first and last are same as aList
{
first = aList.first;
last = aList.last;
}
count += aList.count;
aList.count = 0;
aList.first = NULL;
aList.last = NULL;
}
void DHEAD::insert( EDA_ITEM* aNewElement, EDA_ITEM* aAfterMe ) void DHEAD::insert( EDA_ITEM* aNewElement, EDA_ITEM* aAfterMe )
{ {
wxASSERT( aNewElement != NULL ); wxASSERT( aNewElement != NULL );
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2006 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2006 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -102,23 +101,6 @@ bool SCH_ITEM::operator < ( const SCH_ITEM& aItem ) const ...@@ -102,23 +101,6 @@ bool SCH_ITEM::operator < ( const SCH_ITEM& aItem ) const
} }
SCH_ITEM& SCH_ITEM::operator=( const SCH_ITEM& aItem )
{
wxCHECK_MSG( Type() == aItem.Type(), *this,
wxT( "Cannot assign object type " ) + aItem.GetClass() + wxT( " to type " ) +
GetClass() );
if( &aItem != this )
{
EDA_ITEM::operator=( aItem );
m_Layer = aItem.m_Layer;
m_connections = aItem.m_connections;
}
return *this;
}
void SCH_ITEM::doPlot( PLOTTER* aPlotter ) void SCH_ITEM::doPlot( PLOTTER* aPlotter )
{ {
wxFAIL_MSG( wxT( "doPlot() method not implemented for class " ) + GetClass() ); wxFAIL_MSG( wxT( "doPlot() method not implemented for class " ) + GetClass() );
......
...@@ -559,8 +559,7 @@ void SCH_EDIT_FRAME::PasteListOfItems( wxDC* DC ) ...@@ -559,8 +559,7 @@ void SCH_EDIT_FRAME::PasteListOfItems( wxDC* DC )
SetSchItemParent( Struct, GetScreen() ); SetSchItemParent( Struct, GetScreen() );
Struct->Draw( m_canvas, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); Struct->Draw( m_canvas, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
Struct->SetNext( GetScreen()->GetDrawItems() ); GetScreen()->Append( Struct );
GetScreen()->SetDrawItems( Struct );
} }
SaveCopyInUndoList( picklist, UR_NEW ); SaveCopyInUndoList( picklist, UR_NEW );
......
This diff is collapsed.
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -224,9 +223,8 @@ void SCH_EDIT_FRAME::OnConvertTextType( wxCommandEvent& aEvent ) ...@@ -224,9 +223,8 @@ void SCH_EDIT_FRAME::OnConvertTextType( wxCommandEvent& aEvent )
m_canvas->CrossHairOff( &dc ); // Erase schematic cursor m_canvas->CrossHairOff( &dc ); // Erase schematic cursor
text->Draw( m_canvas, &dc, wxPoint( 0, 0 ), g_XorMode ); text->Draw( m_canvas, &dc, wxPoint( 0, 0 ), g_XorMode );
screen->RemoveFromDrawList( text ); screen->Remove( text );
screen->AddToDrawList( newtext ); screen->Append( newtext );
GetScreen()->SetCurItem( newtext );
m_itemToRepeat = NULL; m_itemToRepeat = NULL;
OnModify(); OnModify();
newtext->Draw( m_canvas, &dc, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); newtext->Draw( m_canvas, &dc, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
......
...@@ -211,8 +211,7 @@ int TestDuplicateSheetNames( bool aCreateMarker ) ...@@ -211,8 +211,7 @@ int TestDuplicateSheetNames( bool aCreateMarker )
( (SCH_SHEET*) test_item )->GetPosition() ); ( (SCH_SHEET*) test_item )->GetPosition() );
marker->SetMarkerType( MARK_ERC ); marker->SetMarkerType( MARK_ERC );
marker->SetErrorLevel( ERR ); marker->SetErrorLevel( ERR );
marker->SetNext( screen->GetDrawItems() ); screen->Append( marker );
screen->SetDrawItems( marker );
} }
err_count++; err_count++;
...@@ -242,8 +241,7 @@ void Diagnose( NETLIST_OBJECT* aNetItemRef, NETLIST_OBJECT* aNetItemTst, ...@@ -242,8 +241,7 @@ void Diagnose( NETLIST_OBJECT* aNetItemRef, NETLIST_OBJECT* aNetItemTst,
marker->SetMarkerType( MARK_ERC ); marker->SetMarkerType( MARK_ERC );
marker->SetErrorLevel( WAR ); marker->SetErrorLevel( WAR );
screen = aNetItemRef->m_SheetList.LastScreen(); screen = aNetItemRef->m_SheetList.LastScreen();
marker->SetNext( screen->GetDrawItems() ); screen->Append( marker );
screen->SetDrawItems( marker );
wxString msg; wxString msg;
......
...@@ -57,8 +57,6 @@ bool SCH_EDIT_FRAME::LoadOneEEFile( SCH_SCREEN* aScreen, const wxString& aFullFi ...@@ -57,8 +57,6 @@ bool SCH_EDIT_FRAME::LoadOneEEFile( SCH_SCREEN* aScreen, const wxString& aFullFi
{ {
char Name1[256]; char Name1[256];
bool itemLoaded = false; bool itemLoaded = false;
SCH_ITEM* Phead;
SCH_ITEM* Pnext;
SCH_ITEM* item; SCH_ITEM* item;
wxString MsgDiag; // Error and log messages wxString MsgDiag; // Error and log messages
char* line; char* line;
...@@ -228,8 +226,7 @@ again." ); ...@@ -228,8 +226,7 @@ again." );
} }
else else
{ {
item->SetNext( aScreen->GetDrawItems() ); aScreen->Append( item );
aScreen->SetDrawItems( item );
} }
} }
...@@ -240,19 +237,6 @@ again." ); ...@@ -240,19 +237,6 @@ again." );
} }
} }
/* GetDrawItems() was constructed in reverse order - reverse it back: */
Phead = NULL;
while( aScreen->GetDrawItems() )
{
Pnext = aScreen->GetDrawItems();
aScreen->SetDrawItems( aScreen->GetDrawItems()->Next() );
Pnext->SetNext( Phead );
Phead = Pnext;
}
aScreen->SetDrawItems( Phead );
#if 0 && defined (DEBUG) #if 0 && defined (DEBUG)
aScreen->Show( 0, std::cout ); aScreen->Show( 0, std::cout );
#endif #endif
......
...@@ -126,11 +126,9 @@ void DeleteItemsInList( EDA_DRAW_PANEL* panel, PICKED_ITEMS_LIST& aItemsList ) ...@@ -126,11 +126,9 @@ void DeleteItemsInList( EDA_DRAW_PANEL* panel, PICKED_ITEMS_LIST& aItemsList )
} }
else else
{ {
screen->RemoveFromDrawList( item ); screen->Remove( item );
/* Unlink the structure */ /* Unlink the structure */
item->SetNext( 0 );
item->SetBack( 0 );
itemsList.PushItem( itemWrapper ); itemsList.PushItem( itemWrapper );
} }
} }
...@@ -160,11 +158,7 @@ void SCH_EDIT_FRAME::DeleteItem( SCH_ITEM* aItem ) ...@@ -160,11 +158,7 @@ void SCH_EDIT_FRAME::DeleteItem( SCH_ITEM* aItem )
} }
else else
{ {
screen->RemoveFromDrawList( aItem ); screen->Remove( aItem );
aItem->SetNext( NULL );
aItem->SetBack( NULL ); // Only one struct -> no link
SaveCopyInUndoList( aItem, UR_DELETED ); SaveCopyInUndoList( aItem, UR_DELETED );
m_canvas->RefreshDrawingRect( aItem->GetBoundingBox() ); m_canvas->RefreshDrawingRect( aItem->GetBoundingBox() );
} }
...@@ -220,8 +214,7 @@ void DuplicateItemsInList( SCH_SCREEN* screen, PICKED_ITEMS_LIST& aItemsList, ...@@ -220,8 +214,7 @@ void DuplicateItemsInList( SCH_SCREEN* screen, PICKED_ITEMS_LIST& aItemsList,
} }
SetSchItemParent( newitem, screen ); SetSchItemParent( newitem, screen );
newitem->SetNext( screen->GetDrawItems() ); screen->Append( newitem );
screen->SetDrawItems( newitem );
} }
} }
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -37,7 +36,7 @@ ...@@ -37,7 +36,7 @@
class SCH_POLYLINE : public SCH_ITEM class SCH_POLYLINE : public SCH_ITEM
{ {
int m_width; /* Thickness */ int m_width; // Thickness
std::vector<wxPoint> m_points; // list of points (>= 2) std::vector<wxPoint> m_points; // list of points (>= 2)
public: public:
......
This diff is collapsed.
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 Kicad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2011 Kicad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2006 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2006 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
......
...@@ -178,12 +178,27 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -178,12 +178,27 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_BREAK_WIRE: case ID_POPUP_SCH_BREAK_WIRE:
{ {
DLIST< SCH_ITEM > oldWires;
oldWires.SetOwnership( false ); // Prevent DLIST for deleting items in destructor.
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
SCH_ITEM* oldWiresList = screen->ExtractWires( true ); screen->ExtractWires( oldWires, true );
screen->BreakSegment( screen->GetCrossHairPosition() ); screen->BreakSegment( screen->GetCrossHairPosition() );
if( oldWiresList ) if( oldWires.GetCount() != 0 )
SaveCopyInUndoList( oldWiresList, UR_WIRE_IMAGE ); {
PICKED_ITEMS_LIST oldItems;
oldItems.m_Status = UR_WIRE_IMAGE;
while( oldWires.GetCount() != 0 )
{
ITEM_PICKER picker = ITEM_PICKER( oldWires.PopFront(), UR_WIRE_IMAGE );
oldItems.PushItem( picker );
}
SaveCopyInUndoList( oldItems, UR_WIRE_IMAGE );
}
screen->TestDanglingEnds( m_canvas, &dc ); screen->TestDanglingEnds( m_canvas, &dc );
} }
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -112,13 +111,11 @@ void SCH_EDIT_FRAME::SaveCopyInUndoList( SCH_ITEM* aItem, ...@@ -112,13 +111,11 @@ void SCH_EDIT_FRAME::SaveCopyInUndoList( SCH_ITEM* aItem,
UNDO_REDO_T aCommandType, UNDO_REDO_T aCommandType,
const wxPoint& aTransformPoint ) const wxPoint& aTransformPoint )
{ {
/* Does not save a null item. /* Does not save a null item or a UR_WIRE_IMAGE command type. UR_WIRE_IMAGE commands
* but if aCommandType == UR_WIRE_IMAGE, we must save null item. * are handled by the overloaded version of SaveCopyInUndoList that takes a reference
* It happens for the first wire entered in schematic: * to a PICKED_ITEMS_LIST.
* To undo this first command, the previous state is a NULL item,
* and we accept this
*/ */
if( aItem == NULL && ( aCommandType != UR_WIRE_IMAGE ) ) if( aItem == NULL || aCommandType == UR_WIRE_IMAGE )
return; return;
PICKED_ITEMS_LIST* commandToUndo = new PICKED_ITEMS_LIST(); PICKED_ITEMS_LIST* commandToUndo = new PICKED_ITEMS_LIST();
...@@ -137,7 +134,6 @@ void SCH_EDIT_FRAME::SaveCopyInUndoList( SCH_ITEM* aItem, ...@@ -137,7 +134,6 @@ void SCH_EDIT_FRAME::SaveCopyInUndoList( SCH_ITEM* aItem,
break; break;
case UR_NEW: case UR_NEW:
case UR_WIRE_IMAGE:
case UR_DELETED: case UR_DELETED:
case UR_ROTATED: case UR_ROTATED:
case UR_MOVED: case UR_MOVED:
...@@ -145,12 +141,8 @@ void SCH_EDIT_FRAME::SaveCopyInUndoList( SCH_ITEM* aItem, ...@@ -145,12 +141,8 @@ void SCH_EDIT_FRAME::SaveCopyInUndoList( SCH_ITEM* aItem,
break; break;
default: default:
{ wxFAIL_MSG( wxString::Format( wxT( "SaveCopyInUndoList() error (unknown code %X)" ),
wxString msg; aCommandType ) );
msg.Printf( wxT( "SaveCopyInUndoList() error (unknown code %X)" ),
aCommandType );
wxMessageBox( msg );
}
break; break;
} }
...@@ -163,7 +155,9 @@ void SCH_EDIT_FRAME::SaveCopyInUndoList( SCH_ITEM* aItem, ...@@ -163,7 +155,9 @@ void SCH_EDIT_FRAME::SaveCopyInUndoList( SCH_ITEM* aItem,
GetScreen()->ClearUndoORRedoList( GetScreen()->m_RedoList ); GetScreen()->ClearUndoORRedoList( GetScreen()->m_RedoList );
} }
else else
{
delete commandToUndo; delete commandToUndo;
}
} }
...@@ -174,6 +168,7 @@ void SCH_EDIT_FRAME::SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList, ...@@ -174,6 +168,7 @@ void SCH_EDIT_FRAME::SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList,
PICKED_ITEMS_LIST* commandToUndo = new PICKED_ITEMS_LIST(); PICKED_ITEMS_LIST* commandToUndo = new PICKED_ITEMS_LIST();
commandToUndo->m_TransformPoint = aTransformPoint; commandToUndo->m_TransformPoint = aTransformPoint;
commandToUndo->m_Status = aTypeCommand;
// Copy picker list: // Copy picker list:
commandToUndo->CopyList( aItemsList ); commandToUndo->CopyList( aItemsList );
...@@ -202,6 +197,7 @@ void SCH_EDIT_FRAME::SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList, ...@@ -202,6 +197,7 @@ void SCH_EDIT_FRAME::SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList,
*/ */
if( commandToUndo->GetPickedItemLink( ii ) == NULL ) if( commandToUndo->GetPickedItemLink( ii ) == NULL )
commandToUndo->SetPickedItemLink( DuplicateStruct( item, true ), ii ); commandToUndo->SetPickedItemLink( DuplicateStruct( item, true ), ii );
wxASSERT( commandToUndo->GetPickedItemLink( ii ) ); wxASSERT( commandToUndo->GetPickedItemLink( ii ) );
break; break;
...@@ -212,6 +208,7 @@ void SCH_EDIT_FRAME::SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList, ...@@ -212,6 +208,7 @@ void SCH_EDIT_FRAME::SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList,
case UR_NEW: case UR_NEW:
case UR_DELETED: case UR_DELETED:
case UR_EXCHANGE_T: case UR_EXCHANGE_T:
case UR_WIRE_IMAGE:
break; break;
default: default:
...@@ -220,7 +217,7 @@ void SCH_EDIT_FRAME::SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList, ...@@ -220,7 +217,7 @@ void SCH_EDIT_FRAME::SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList,
} }
} }
if( commandToUndo->GetCount() ) if( commandToUndo->GetCount() || aTypeCommand == UR_WIRE_IMAGE )
{ {
/* Save the copy in undo list */ /* Save the copy in undo list */
GetScreen()->PushCommandToUndoList( commandToUndo ); GetScreen()->PushCommandToUndoList( commandToUndo );
...@@ -229,7 +226,9 @@ void SCH_EDIT_FRAME::SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList, ...@@ -229,7 +226,9 @@ void SCH_EDIT_FRAME::SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList,
GetScreen()->ClearUndoORRedoList( GetScreen()->m_RedoList ); GetScreen()->ClearUndoORRedoList( GetScreen()->m_RedoList );
} }
else // Should not occur else // Should not occur
{
delete commandToUndo; delete commandToUndo;
}
} }
...@@ -238,9 +237,36 @@ void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRed ...@@ -238,9 +237,36 @@ void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRed
SCH_ITEM* item; SCH_ITEM* item;
SCH_ITEM* alt_item; SCH_ITEM* alt_item;
// Undo in the reverse order of list creation: (this can allow stacked // Exchange the current wires, buses, and junctions with the copy save by the last edit.
// changes like the same item can be changes and deleted in the same if( aList->m_Status == UR_WIRE_IMAGE )
// complex command {
DLIST< SCH_ITEM > oldWires;
// Prevent items from being deleted when the DLIST goes out of scope.
oldWires.SetOwnership( false );
// Remove all of the wires, buses, and junctions from the current screen.
GetScreen()->ExtractWires( oldWires, false );
// Copy the saved wires, buses, and junctions to the current screen.
for( unsigned int i = 0; i < aList->GetCount(); i++ )
GetScreen()->Append( (SCH_ITEM*) aList->GetPickedItem( i ) );
aList->ClearItemsList();
// Copy the previous wires, buses, and junctions to the picked item list for the
// redo operation.
while( oldWires.GetCount() != 0 )
{
ITEM_PICKER picker = ITEM_PICKER( oldWires.PopFront(), UR_WIRE_IMAGE );
aList->PushItem( picker );
}
return;
}
// Undo in the reverse order of list creation: (this can allow stacked changes like the
// same item can be changes and deleted in the same complex command.
for( int ii = aList->GetCount() - 1; ii >= 0; ii-- ) for( int ii = aList->GetCount() - 1; ii >= 0; ii-- )
{ {
item = (SCH_ITEM*) aList->GetPickedItem( ii ); item = (SCH_ITEM*) aList->GetPickedItem( ii );
...@@ -253,18 +279,21 @@ void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRed ...@@ -253,18 +279,21 @@ void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRed
switch( aList->GetPickedItemStatus( ii ) ) switch( aList->GetPickedItemStatus( ii ) )
{ {
case UR_CHANGED: /* Exchange old and new data for each item */ case UR_CHANGED: /* Exchange old and new data for each item */
// tmp = item->Clone();
// *item = *image;
// *image = *tmp;
// delete tmp;
item->SwapData( image ); item->SwapData( image );
break; break;
case UR_NEW: /* new items are deleted */ case UR_NEW: /* new items are deleted */
aList->SetPickedItemStatus( UR_DELETED, ii ); aList->SetPickedItemStatus( UR_DELETED, ii );
GetScreen()->RemoveFromDrawList( item ); GetScreen()->Remove( item );
break; break;
case UR_DELETED: /* deleted items are put in EEdrawList, as new items */ case UR_DELETED: /* deleted items are put in the draw item list, as new items */
aList->SetPickedItemStatus( UR_NEW, ii ); aList->SetPickedItemStatus( UR_NEW, ii );
item->SetNext( GetScreen()->GetDrawItems() ); GetScreen()->Append( item );
GetScreen()->SetDrawItems( item );
break; break;
case UR_MOVED: case UR_MOVED:
...@@ -275,55 +304,32 @@ void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRed ...@@ -275,55 +304,32 @@ void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRed
break; break;
case UR_MIRRORED_Y: case UR_MIRRORED_Y:
{ item->Mirror_Y( aList->m_TransformPoint.x );
wxPoint mirrorPoint = aList->m_TransformPoint;
item->Mirror_Y( mirrorPoint.x );
}
break; break;
case UR_MIRRORED_X: case UR_MIRRORED_X:
{ item->Mirror_X( aList->m_TransformPoint.y );
wxPoint mirrorPoint = aList->m_TransformPoint;
item->Mirror_X( mirrorPoint.y );
}
break; break;
case UR_ROTATED: case UR_ROTATED:
{
// To undo a rotate 90 deg transform we must rotate 270 deg to undo // To undo a rotate 90 deg transform we must rotate 270 deg to undo
// and 90 deg to redo: // and 90 deg to redo:
wxPoint RotationPoint = aList->m_TransformPoint; item->Rotate( aList->m_TransformPoint );
item->Rotate( RotationPoint );
if( aRedoCommand ) if( aRedoCommand )
break; // A only one rotate transform is OK break; // A only one rotate transform is OK
// Make 3 rotate 90 deg transforms is this is actually an undo command
item->Rotate( RotationPoint );
item->Rotate( RotationPoint );
}
break;
case UR_WIRE_IMAGE:
/* Exchange the current wires and the old wires */
alt_item = GetScreen()->ExtractWires( false );
aList->SetPickedItem( alt_item, ii );
while( item )
{
SCH_ITEM* nextitem = item->Next();
item->SetNext( GetScreen()->GetDrawItems() );
GetScreen()->SetDrawItems( item );
item->ClearFlags();
item = nextitem;
}
// Make 3 rotate 90 deg transforms is this is actually an undo command
item->Rotate( aList->m_TransformPoint );
item->Rotate( aList->m_TransformPoint );
break; break;
case UR_EXCHANGE_T: case UR_EXCHANGE_T:
alt_item = (SCH_ITEM*) aList->GetPickedItemLink( ii ); alt_item = (SCH_ITEM*) aList->GetPickedItemLink( ii );
alt_item->SetNext( NULL ); alt_item->SetNext( NULL );
alt_item->SetBack( NULL ); alt_item->SetBack( NULL );
GetScreen()->RemoveFromDrawList( item ); GetScreen()->Remove( item );
GetScreen()->AddToDrawList( alt_item ); GetScreen()->Append( alt_item );
aList->SetPickedItem( alt_item, ii ); aList->SetPickedItem( alt_item, ii );
aList->SetPickedItemLink( item, ii ); aList->SetPickedItemLink( item, ii );
break; break;
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -930,7 +929,7 @@ void SCH_EDIT_FRAME::addCurrentItemToList( wxDC* aDC ) ...@@ -930,7 +929,7 @@ void SCH_EDIT_FRAME::addCurrentItemToList( wxDC* aDC )
if( undoItem == item ) if( undoItem == item )
{ {
if( !screen->CheckIfOnDrawList( item ) ) // don't want a loop! if( !screen->CheckIfOnDrawList( item ) ) // don't want a loop!
screen->AddToDrawList( item ); screen->Append( item );
SetRepeatItem( item ); SetRepeatItem( item );
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2006 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2006 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2009-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -282,14 +281,14 @@ static void ExitSheet( EDA_DRAW_PANEL* aPanel, wxDC* aDC ) ...@@ -282,14 +281,14 @@ static void ExitSheet( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
} }
else if( item->IsMoving() || item->IsResized() ) else if( item->IsMoving() || item->IsResized() )
{ {
screen->RemoveFromDrawList( item ); screen->Remove( item );
delete item; delete item;
item = parent->GetUndoItem(); item = parent->GetUndoItem();
wxCHECK_RET( item != NULL, wxT( "Cannot restore undefined last sheet item." ) ); wxCHECK_RET( item != NULL, wxT( "Cannot restore undefined last sheet item." ) );
screen->AddToDrawList( item ); screen->Append( item );
// the owner of item is no more parent, this is the draw list of screen: // the owner of item is no more parent, this is the draw list of screen:
parent->SetUndoItem( NULL ); parent->SetUndoItem( NULL );
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -32,6 +31,7 @@ ...@@ -32,6 +31,7 @@
#define CLASS_SCREEN_H #define CLASS_SCREEN_H
#include <macros.h> #include <macros.h>
#include <dlist.h>
#include <sch_item_struct.h> #include <sch_item_struct.h>
#include <class_base_screen.h> #include <class_base_screen.h>
#include <class_title_block.h> #include <class_title_block.h>
...@@ -73,7 +73,7 @@ class SCH_SCREEN : public BASE_SCREEN ...@@ -73,7 +73,7 @@ class SCH_SCREEN : public BASE_SCREEN
/// Position of the origin axis, which is used in exports mostly, but not yet in EESCHEMA /// Position of the origin axis, which is used in exports mostly, but not yet in EESCHEMA
wxPoint m_originAxisPosition; wxPoint m_originAxisPosition;
SCH_ITEM* m_drawList; ///< Object list for the screen. DLIST< SCH_ITEM > m_drawList; ///< Object list for the screen.
/// @todo use DLIST<SCH_ITEM> or superior container /// @todo use DLIST<SCH_ITEM> or superior container
/** /**
...@@ -122,8 +122,17 @@ public: ...@@ -122,8 +122,17 @@ public:
* Function GetDrawItems(). * Function GetDrawItems().
* @return - A pointer to the first item in the linked list of draw items. * @return - A pointer to the first item in the linked list of draw items.
*/ */
SCH_ITEM* GetDrawItems() const { return m_drawList; } SCH_ITEM* GetDrawItems() const { return m_drawList.begin(); }
void SetDrawItems( SCH_ITEM* aItem ) { m_drawList = aItem; }
void Append( SCH_ITEM* aItem ) { m_drawList.Append( aItem ); }
/**
* Function Append
* adds \a aList of SCH_ITEM objects to the list for draw items for the sheet.
*
* @param aList A reference to a #DLIST containing the #SCH_ITEM to add to the sheet.
*/
void Append( DLIST< SCH_ITEM >& aList ) { m_drawList.Append( aList ); }
/** /**
* Function GetCurItem * Function GetCurItem
...@@ -184,11 +193,13 @@ public: ...@@ -184,11 +193,13 @@ public:
void Plot( PLOTTER* aPlotter ); void Plot( PLOTTER* aPlotter );
/** /**
* Remove \a aItem from the schematic associated with this screen. * Function Remove
* removes \a aItem from the schematic associated with this screen.
* *
* @param aItem - Item to be removed from schematic. * @note The removed item is not deleted. It is only unlinked from the item list.
* @param aItem Item to be removed from schematic.
*/ */
void RemoveFromDrawList( SCH_ITEM* aItem ); void Remove( SCH_ITEM* aItem );
/** /**
* Function DeleteItem * Function DeleteItem
...@@ -201,8 +212,6 @@ public: ...@@ -201,8 +212,6 @@ public:
bool CheckIfOnDrawList( SCH_ITEM* st ); bool CheckIfOnDrawList( SCH_ITEM* st );
void AddToDrawList( SCH_ITEM* st );
/** /**
* Function SchematicCleanUp * Function SchematicCleanUp
* performs routine schematic cleaning including breaking wire and buses and * performs routine schematic cleaning including breaking wire and buses and
...@@ -226,23 +235,24 @@ public: ...@@ -226,23 +235,24 @@ public:
/** /**
* Function ExtractWires * Function ExtractWires
* extracts the old wires, junctions and buses. If \a aCreateCopy is true, replace * extracts the old wires, junctions and buses. If \a aCreateCopy is true, replace
* them with a copy. Old item must be put in undo list, and the new ones can be * extracted items with a copy of the original. Old items are to be put in undo list,
* modified by clean up safely. If an abort command is made, old wires must be put * and the new ones can be modified by clean up safely. If an abort draw segmat command
* in GetDrawItems(), and copies must be deleted. This is because previously stored * is made, the old wires must be put back into #m_drawList, and the copies must be
* undo commands can handle pointers on wires or buses, and we do not delete wires or * deleted. This is because previously stored undo commands can handle pointers on wires
* buss-es, we must put they in undo list. * or buses, and we do not delete wires or buses, we must put them in undo list.
* *
* Because cleanup delete and/or modify bus and wires, the it is easier is to put * Because cleanup deletes and/or modify bus and wires, it is easier is to put
* all wires in undo list and use a new copy of wires for cleanup. * all the existing wires in undo list and use a new copy of wires for cleanup.
*/ */
SCH_ITEM* ExtractWires( bool aCreateCopy ); void ExtractWires( DLIST< SCH_ITEM >& aList, bool aCreateCopy );
/** /**
* Function ReplaceWires * Function ReplaceWires
* replaces all of the wires and junction in the screen with \a aWireList. * replaces all of the wires, buses, and junctions in the screen with \a aWireList.
* @param aWireList List of wire to replace the existing wires with. *
* @param aWireList List of wires to replace the existing wires with.
*/ */
void ReplaceWires( SCH_ITEM* aWireList ); void ReplaceWires( DLIST< SCH_ITEM >& aWireList );
/** /**
* Function MarkConnections * Function MarkConnections
......
...@@ -63,22 +63,31 @@ protected: ...@@ -63,22 +63,31 @@ protected:
/** /**
* Function append * Function append
* adds \a aNewElement to the end of the list. * adds \a aNewElement to the end of the list.
* @param aNewElement The element to insert.
*/ */
void append( EDA_ITEM* aNewElement ); void append( EDA_ITEM* aNewElement );
/**
* Function append
* adds \a aList to the end of the list.
* @param aList The list to aList.
*/
void append( DHEAD& aList );
/** /**
* Function insert * Function insert
* puts aNewElement just in front of aElementAfterMe in the list sequence. * puts \a aNewElement just in front of \a aElementAfterMe in the list sequence.
* If aElementAfterMe is NULL, then simply append(). * If \a aElementAfterMe is NULL, then simply append().
* @param aNewElement The element to insert. * @param aNewElement The element to insert.
* @param aElementAfterMe The element to insert \a aNewElement before, * @param aElementAfterMe The element to insert \a aNewElement before,
* if NULL then append aNewElement onto end of list. * if NULL then append \a aNewElement onto end of list.
*/ */
void insert( EDA_ITEM* aNewElement, EDA_ITEM* aElementAfterMe ); void insert( EDA_ITEM* aNewElement, EDA_ITEM* aElementAfterMe );
/** /**
* Function insert * Function insert
* puts aNewElement in front of list sequence. * puts \a aNewElement in front of list sequence.
* @param aNewElement The element to insert.
*/ */
void insert( EDA_ITEM* aNewElement ) void insert( EDA_ITEM* aNewElement )
{ {
...@@ -88,6 +97,7 @@ protected: ...@@ -88,6 +97,7 @@ protected:
/** /**
* Function remove * Function remove
* removes \a aElement from the list, but does not delete it. * removes \a aElement from the list, but does not delete it.
* @param aElement The element to remove.
*/ */
void remove( EDA_ITEM* aElement ); void remove( EDA_ITEM* aElement );
...@@ -162,16 +172,30 @@ public: ...@@ -162,16 +172,30 @@ public:
/** /**
* Function Append * Function Append
* adds \a aNewElement to the end of the list. * adds \a aNewElement to the end of the list.
* @param aNewElement The element to insert.
*/ */
void Append( T* aNewElement ) void Append( T* aNewElement )
{ {
append( aNewElement ); append( aNewElement );
} }
/**
* Function Append
* adds \a aList to the end of the list.
* @param aList The list to append to the end of the list.
*/
void Append( DLIST& aList )
{
append( aList );
}
/** /**
* Function Insert * Function Insert
* puts aNewElement just in front of aElementAfterMe in the list sequence. * puts \a aNewElement just in front of \a aElementAfterMe in the list sequence.
* If aElementAfterMe is NULL, then simply Append() * If aElementAfterMe is NULL, then simply Append()
* @param aNewElement The element to insert.
* @param aElementAfterMe The element to insert \a aNewElement before,
* if NULL then append \a aNewElement onto end of list.
*/ */
void Insert( T* aNewElement, T* aElementAfterMe ) void Insert( T* aNewElement, T* aElementAfterMe )
{ {
...@@ -181,6 +205,7 @@ public: ...@@ -181,6 +205,7 @@ public:
/** /**
* Function Remove * Function Remove
* removes \a aElement from the list, but does not delete it. * removes \a aElement from the list, but does not delete it.
* @param aElement The element to remove from the list.
* @return T* - the removed element, so you can easily delete it upon return. * @return T* - the removed element, so you can easily delete it upon return.
*/ */
T* Remove( T* aElement ) T* Remove( T* aElement )
...@@ -210,6 +235,7 @@ public: ...@@ -210,6 +235,7 @@ public:
/** /**
* Function PushFront * Function PushFront
* puts aNewElement at front of list sequence. * puts aNewElement at front of list sequence.
* @param aNewElement The element to insert at the front of the list.
*/ */
void PushFront( T* aNewElement ) void PushFront( T* aNewElement )
{ {
...@@ -219,6 +245,7 @@ public: ...@@ -219,6 +245,7 @@ public:
/** /**
* Function PushBack * Function PushBack
* puts aNewElement at the end of the list sequence. * puts aNewElement at the end of the list sequence.
* @param aNewElement The element to push to the end of the list.
*/ */
void PushBack( T* aNewElement ) void PushBack( T* aNewElement )
{ {
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -352,8 +351,6 @@ public: ...@@ -352,8 +351,6 @@ public:
virtual bool operator <( const SCH_ITEM& aItem ) const; virtual bool operator <( const SCH_ITEM& aItem ) const;
virtual SCH_ITEM& operator=( const SCH_ITEM& aItem );
/** /**
* @note - The DoXXX() functions below are used to enforce the interface while retaining * @note - The DoXXX() functions below are used to enforce the interface while retaining
* the ability of change the implementation behavior of derived classes. See * the ability of change the implementation behavior of derived classes. See
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment