KiCad PCB EDA Suite
eeschema/protos.h File Reference

Go to the source code of this file.

Functions

void DeleteItemsInList (EDA_DRAW_PANEL *panel, PICKED_ITEMS_LIST &aItemsList)
 Function DeleteItemsInList delete schematic items in aItemsList deleted items are put in undo list. More...
 
SCH_ITEMDuplicateStruct (SCH_ITEM *DrawStruct, bool aClone=false)
 Function DuplicateStruct creates a new copy of given struct. More...
 
void DrawDanglingSymbol (EDA_DRAW_PANEL *panel, wxDC *DC, const wxPoint &pos, COLOR4D Color)
 

Function Documentation

void DeleteItemsInList ( EDA_DRAW_PANEL panel,
PICKED_ITEMS_LIST aItemsList 
)

Function DeleteItemsInList delete schematic items in aItemsList deleted items are put in undo list.

Definition at line 129 of file operations_on_items_lists.cpp.

References PICKED_ITEMS_LIST::GetCount(), EDA_DRAW_PANEL::GetParent(), PICKED_ITEMS_LIST::GetPickedItem(), EDA_DRAW_PANEL::GetScreen(), PICKED_ITEMS_LIST::PushItem(), SCH_SCREEN::Remove(), SCH_EDIT_FRAME::SaveCopyInUndoList(), SCH_SHEET_PIN_T, EDA_ITEM::Type(), and UR_DELETED.

Referenced by SCH_EDIT_FRAME::DeleteConnection(), and SCH_EDIT_FRAME::HandleBlockEnd().

130 {
131  SCH_SCREEN* screen = (SCH_SCREEN*) panel->GetScreen();
132  SCH_EDIT_FRAME* frame = (SCH_EDIT_FRAME*) panel->GetParent();
133  PICKED_ITEMS_LIST itemsList;
134 
135  for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ )
136  {
137  SCH_ITEM* item = (SCH_ITEM*) aItemsList.GetPickedItem( ii );
138  ITEM_PICKER itemWrapper( item, UR_DELETED );
139 
140  if( item->Type() == SCH_SHEET_PIN_T )
141  {
142  /* this item is depending on a sheet, and is not in global list */
143  wxMessageBox( wxT( "DeleteItemsInList() err: unexpected SCH_SHEET_PIN_T" ) );
144  }
145  else
146  {
147  screen->Remove( item );
148 
149  /* Unlink the structure */
150  itemsList.PushItem( itemWrapper );
151  }
152  }
153 
154  frame->SaveCopyInUndoList( itemsList, UR_DELETED );
155 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:212
void SaveCopyInUndoList(SCH_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, const wxPoint &aTransformPoint=wxPoint(0, 0))
Function SaveCopyInUndoList.
void PushItem(const ITEM_PICKER &aItem)
Function PushItem pushes aItem to the top of the list.
Schematic editor (Eeschema) main window.
Definition: schframe.h:117
void Remove(SCH_ITEM *aItem)
Function Remove removes aItem from the schematic associated with this screen.
Definition: sch_screen.cpp:158
EDA_DRAW_FRAME * GetParent() const
Definition: draw_panel.cpp:174
Class PICKED_ITEMS_LIST is a holder to handle information on schematic or board items.
unsigned GetCount() const
Function GetCount.
EDA_ITEM * GetPickedItem(unsigned int aIdx) const
Function GetPickedItem.
BASE_SCREEN * GetScreen()
Definition: draw_panel.cpp:187
Class SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container clas...
void DrawDanglingSymbol ( EDA_DRAW_PANEL panel,
wxDC *  DC,
const wxPoint pos,
COLOR4D  Color 
)
SCH_ITEM* DuplicateStruct ( SCH_ITEM aDrawStruct,
bool  aClone 
)

Function DuplicateStruct creates a new copy of given struct.

Parameters
aDrawStruct= the SCH_ITEM to duplicate
aClone(defualt = true) if true duplicate also some parameters that must be unique (timestamp and sheet name) aClone must be false. use true only is undo/redo duplications

Function DuplicateStruct creates a new copy of given struct.

The new object is not put in draw list (not linked)

Parameters
aDrawStruct= the SCH_ITEM to duplicate
aClone(default = false) if true duplicate also some parameters that must be unique (timestamp and sheet name) aClone must be false. use true only is undo/redo duplications

Definition at line 251 of file operations_on_items_lists.cpp.

References EDA_ITEM::Clone(), EDA_ITEM::GetTimeStamp(), and EDA_ITEM::SetTimeStamp().

Referenced by SCH_EDIT_FRAME::copyBlockItems(), DuplicateItemsInList(), SCH_EDIT_FRAME::PasteListOfItems(), and SCH_EDIT_FRAME::SaveCopyInUndoList().

252 {
253  wxCHECK_MSG( aDrawStruct != NULL, NULL,
254  wxT( "Cannot duplicate NULL schematic item! Bad programmer." ) );
255 
256  SCH_ITEM* NewDrawStruct = (SCH_ITEM*) aDrawStruct->Clone();
257 
258  if( aClone )
259  NewDrawStruct->SetTimeStamp( aDrawStruct->GetTimeStamp() );
260 
261  return NewDrawStruct;
262 }
virtual EDA_ITEM * Clone() const
Function Clone creates a duplicate of this item with linked list members set to NULL.
void SetTimeStamp(time_t aNewTimeStamp)
Definition: base_struct.h:217
time_t GetTimeStamp() const
Definition: base_struct.h:218
Class SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container clas...