KiCad PCB EDA Suite
list_operations.h File Reference

Go to the source code of this file.

Namespaces

 KIGFX
 Class CAIRO_GAL is the cairo implementation of the graphics abstraction layer.
 

Functions

void SetSchItemParent (SCH_ITEM *Struct, SCH_SCREEN *Screen)
 
void RotateListOfItems (PICKED_ITEMS_LIST &aItemsList, const wxPoint &rotationPoint)
 
void MirrorY (PICKED_ITEMS_LIST &aItemsList, const wxPoint &aMirrorPoint)
 
void MirrorX (PICKED_ITEMS_LIST &aItemsList, const wxPoint &aMirrorPoint)
 
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...
 
void DuplicateItemsInList (SCH_SCREEN *screen, PICKED_ITEMS_LIST &aItemsList, const wxPoint &aMoveVector)
 Routine to copy a new entity of an object for each object in list and reposition it. More...
 
SCH_ITEMDuplicateStruct (SCH_ITEM *aDrawStruct, bool aClone=false)
 Routine to create a new copy of given struct. More...
 
void DrawDanglingSymbol (EDA_DRAW_PANEL *panel, wxDC *DC, const wxPoint &pos, const KIGFX::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.

void DrawDanglingSymbol ( EDA_DRAW_PANEL panel,
wxDC *  DC,
const wxPoint pos,
const KIGFX::COLOR4D Color 
)

Definition at line 37 of file eeredraw.cpp.

References DANGLING_SYMBOL_SIZE, EDA_DRAW_PANEL::GetClipBox(), EDA_DRAW_PANEL::GetScreen(), GRRect(), BASE_SCREEN::m_IsPrinting, wxPoint::x, and wxPoint::y.

Referenced by SCH_LINE::Draw(), SCH_TEXT::Draw(), SCH_GLOBALLABEL::Draw(), and SCH_HIERLABEL::Draw().

38 {
39  BASE_SCREEN* screen = panel->GetScreen();
40 
41  if( !screen->m_IsPrinting ) /* Draw but do not print the Dangling Symbol */
42  {
43  GRRect( panel->GetClipBox(), DC,
46  0, Color );
47  }
48 }
virtual BASE_SCREEN * GetScreen()=0
#define DANGLING_SYMBOL_SIZE
Definition: general.h:43
virtual EDA_RECT * GetClipBox()
void GRRect(EDA_RECT *aClipBox, wxDC *aDC, int x1, int y1, int x2, int y2, COLOR4D aColor)
Definition: gr_basic.cpp:1003
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:76
bool m_IsPrinting
Definition: base_screen.h:220
void DuplicateItemsInList ( SCH_SCREEN screen,
PICKED_ITEMS_LIST aItemsList,
const wxPoint aMoveVector 
)

Routine to copy a new entity of an object for each object in list and reposition it.

Return the new created object list in aItemsList

SCH_ITEM* DuplicateStruct ( SCH_ITEM aDrawStruct,
bool  aClone = false 
)

Routine to create 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 295 of file operations_on_items_lists.cpp.

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

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

296 {
297  wxCHECK_MSG( aDrawStruct != NULL, NULL,
298  wxT( "Cannot duplicate NULL schematic item! Bad programmer." ) );
299 
300  SCH_ITEM* NewDrawStruct = (SCH_ITEM*) aDrawStruct->Clone();
301 
302  if( aClone )
303  NewDrawStruct->SetTimeStamp( aDrawStruct->GetTimeStamp() );
304 
305  return NewDrawStruct;
306 }
virtual EDA_ITEM * Clone() const
Function Clone creates a duplicate of this item with linked list members set to NULL.
Class SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container clas...
timestamp_t GetTimeStamp() const
Definition: base_struct.h:207
void SetTimeStamp(timestamp_t aNewTimeStamp)
Definition: base_struct.h:206
void MirrorX ( PICKED_ITEMS_LIST aItemsList,
const wxPoint aMirrorPoint 
)

Definition at line 97 of file operations_on_items_lists.cpp.

References EDA_ITEM::ClearFlags(), PICKED_ITEMS_LIST::GetCount(), PICKED_ITEMS_LIST::GetPickedItem(), SCH_ITEM::MirrorX(), and wxPoint::y.

Referenced by SCH_ITEM::GetPenSize(), and SCH_EDIT_FRAME::OnOrient().

98 {
99  for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ )
100  {
101  SCH_ITEM* item = static_cast<SCH_ITEM*>( aItemsList.GetPickedItem( ii ) );
102  item->MirrorX( aMirrorPoint.y ); // Place it in its new position.
103  item->ClearFlags();
104  }
105 }
virtual void MirrorX(int aXaxis_position)=0
Function MirrorX mirrors item relative to the X axis about aXaxis_position.
unsigned GetCount() const
Function GetCount.
EDA_ITEM * GetPickedItem(unsigned int aIdx) const
Function GetPickedItem.
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:257
Class SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container clas...
void MirrorY ( PICKED_ITEMS_LIST aItemsList,
const wxPoint aMirrorPoint 
)

Definition at line 86 of file operations_on_items_lists.cpp.

References EDA_ITEM::ClearFlags(), PICKED_ITEMS_LIST::GetCount(), PICKED_ITEMS_LIST::GetPickedItem(), SCH_ITEM::MirrorY(), and wxPoint::x.

Referenced by SCH_ITEM::GetPenSize(), and SCH_EDIT_FRAME::OnOrient().

87 {
88  for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ )
89  {
90  SCH_ITEM* item = static_cast<SCH_ITEM*>( aItemsList.GetPickedItem( ii ) );
91  item->MirrorY( aMirrorPoint.x ); // Place it in its new position.
92  item->ClearFlags();
93  }
94 }
virtual void MirrorY(int aYaxis_position)=0
Function MirrorY mirrors item relative to the Y axis about aYaxis_position.
unsigned GetCount() const
Function GetCount.
EDA_ITEM * GetPickedItem(unsigned int aIdx) const
Function GetPickedItem.
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:257
Class SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container clas...
void RotateListOfItems ( PICKED_ITEMS_LIST aItemsList,
const wxPoint rotationPoint 
)

Definition at line 75 of file operations_on_items_lists.cpp.

References EDA_ITEM::ClearFlags(), PICKED_ITEMS_LIST::GetCount(), PICKED_ITEMS_LIST::GetPickedItem(), and SCH_ITEM::Rotate().

Referenced by SCH_EDIT_FRAME::OnRotate().

76 {
77  for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ )
78  {
79  SCH_ITEM* item = static_cast<SCH_ITEM*>( aItemsList.GetPickedItem( ii ) );
80  item->Rotate( rotationPoint ); // Place it in its new position.
81  item->ClearFlags();
82  }
83 }
virtual void Rotate(wxPoint aPosition)=0
Function Rotate rotates the item around aPosition 90 degrees in the clockwise direction.
unsigned GetCount() const
Function GetCount.
EDA_ITEM * GetPickedItem(unsigned int aIdx) const
Function GetPickedItem.
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:257
Class SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container clas...
void SetSchItemParent ( SCH_ITEM Struct,
SCH_SCREEN Screen 
)

Definition at line 47 of file operations_on_items_lists.cpp.

References SCH_BUS_BUS_ENTRY_T, SCH_BUS_WIRE_ENTRY_T, SCH_COMPONENT_T, SCH_GLOBAL_LABEL_T, SCH_HIERARCHICAL_LABEL_T, SCH_JUNCTION_T, SCH_LABEL_T, SCH_LINE_T, SCH_MARKER_T, SCH_NO_CONNECT_T, SCH_SHEET_PIN_T, SCH_SHEET_T, SCH_TEXT_T, EDA_ITEM::SetParent(), and EDA_ITEM::Type().

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

48 {
49  switch( Struct->Type() )
50  {
51  case SCH_JUNCTION_T:
52  case SCH_TEXT_T:
53  case SCH_LABEL_T:
54  case SCH_GLOBAL_LABEL_T:
56  case SCH_COMPONENT_T:
57  case SCH_LINE_T:
60  case SCH_SHEET_T:
61  case SCH_MARKER_T:
62  case SCH_NO_CONNECT_T:
63  Struct->SetParent( Screen );
64  break;
65 
66  case SCH_SHEET_PIN_T:
67  break;
68 
69  default:
70  break;
71  }
72 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:201
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:216