KiCad PCB EDA Suite
block_libedit.cpp
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
5  * Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
6  * Copyright (C) 2004-2017 KiCad Developers, see AUTHORS.txt for contributors.
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, you may find one here:
20  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21  * or you may search the http://www.gnu.org website for the version 2 license,
22  * or you may write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24  */
25 
30 #include <fctsys.h>
31 #include <gr_basic.h>
32 #include <sch_draw_panel.h>
33 #include <confirm.h>
34 
35 #include <general.h>
36 #include <class_library.h>
37 #include <lib_edit_frame.h>
38 
40 #include <sch_view.h>
41 #include <view/view_group.h>
42 
43 static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
44  bool aErase );
45 
46 
47 int LIB_EDIT_FRAME::BlockSelectItems( LIB_PART* aPart, BLOCK_SELECTOR* aBlock, int aUnit, int aConvert, bool aSyncPinEdit )
48 {
49  int itemCount = 0;
50 
51  for( LIB_ITEM& item : aPart->GetDrawItems() )
52  {
53  item.ClearFlags( SELECTED );
54 
55  if( ( item.GetUnit() && item.GetUnit() != aUnit )
56  || ( item.GetConvert() && item.GetConvert() != aConvert ) )
57  {
58  if( item.Type() != LIB_PIN_T )
59  continue;
60 
61  // Specific rules for pins:
62  // - do not select pins in other units when synchronized pin edit mode is disabled
63  // - do not select pins in other units when units are not interchangeable
64  // - in other cases verify if the pin belongs to the requested unit
65  if( !aSyncPinEdit || aPart->UnitsLocked()
66  || ( item.GetConvert() && item.GetConvert() != aConvert ) )
67  continue;
68  }
69 
70  if( item.Inside( *aBlock ) )
71  {
72  auto picker = ITEM_PICKER( &item );
73  aBlock->PushItem( picker );
74  item.SetFlags( SELECTED );
75  itemCount++;
76  }
77  }
78 
79  return itemCount;
80 }
81 
82 
84 {
85  for( LIB_ITEM& item : aPart->GetDrawItems() )
86  {
87  item.ClearFlags();
88  }
89  aBlock->ClearItemsList();
90 }
91 
92 
94 {
95  for( LIB_ITEM& item : aPart->GetDrawItems() )
96  {
97  if( !item.IsSelected() )
98  continue;
99 
100  item.SetOffset( aOffset );
101  item.ClearFlags();
102  }
103 
104  // view update
105 }
106 
107 
109 {
111 
112  // We *do not* remove the 2 mandatory fields: reference and value
113  // so skip them (do not remove) if they are flagged selected.
114  // Skip also not visible items.
115  // But I think fields must not be deleted by a block delete command or other global command
116  // because they are not really graphic items
117  while( item != aPart->GetDrawItems().end() )
118  {
119  if( item->Type() == LIB_FIELD_T )
120  {
121  item->ClearFlags( SELECTED );
122  }
123 
124  if( !item->IsSelected() )
125  ++item;
126  else
127  item = aPart->GetDrawItems().erase( item );
128  }
129 
130  // view update
131 
132 }
133 
134 
136 {
137  PICKED_ITEMS_LIST& aItemsList = aBlock->GetItems();
138  LIB_ITEM* oldItem;
139  LIB_ITEM* newItem;
140 
141  for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ )
142  {
143  oldItem = dynamic_cast<LIB_ITEM*>( aItemsList.GetPickedItem( ii ) );
144 
145  // We *do not* copy fields because they are unique for the whole component
146  // so skip them (do not duplicate) if they are flagged selected.
147  if( oldItem->Type() == LIB_FIELD_T )
148  oldItem->ClearFlags( SELECTED );
149 
150  if( !oldItem->IsSelected() )
151  continue;
152 
153  newItem = (LIB_ITEM*) oldItem->Clone();
154  newItem->SetFlags( SELECTED );
155  oldItem->ClearFlags( SELECTED );
156 
157  newItem->SetOffset( aBlock->GetMoveVector() );
158 
159  aItemsList.SetPickedItem( newItem, ii );
160  aItemsList.SetPickedItemStatus( UR_NEW, ii );
161 
162  aPart->GetDrawItems().push_back( newItem );
163  }
164 }
165 
166 
168 {
169  int cmd = BLOCK_IDLE;
170 
171  switch( key )
172  {
173  default:
174  cmd = key & 0xFF;
175  break;
176 
177  case EDA_KEY_C( 0xffffffff ): // -1
178  // Historically, -1 has been used as a key, which can cause bit flag
179  // clashes with unaware code. On debug builds, catch any old code that
180  // might still be doing this. TODO: remove if sure all this old code is gone.
181  wxFAIL_MSG( "negative EDA_KEY value should be converted to GR_KEY_INVALID" );
182  // fall through on release builds
183 
184  case GR_KEY_INVALID:
185  cmd = BLOCK_PRESELECT_MOVE;
186  break;
187 
188  case GR_KEY_NONE:
189  cmd = BLOCK_MOVE;
190  break;
191 
192  case GR_KB_SHIFT:
193  cmd = BLOCK_DUPLICATE;
194  break;
195 
196  case GR_KB_ALT:
197  cmd = BLOCK_ROTATE;
198  break;
199 
200  case GR_KB_SHIFTCTRL:
201  cmd = BLOCK_DELETE;
202  break;
203 
204  case GR_KB_CTRL:
205  cmd = BLOCK_MIRROR_Y;
206  break;
207 
208  case MOUSE_MIDDLE:
209  cmd = BLOCK_ZOOM;
210  break;
211  }
212 
213  return cmd;
214 }
215 
216 
218 {
219  int ItemCount = 0;
220  bool nextCmd = false;
222  wxPoint pt;
223 
224  auto panel =static_cast<SCH_DRAW_PANEL*>(m_canvas);
225  auto view = panel->GetView();
226  auto area = view->GetSelectionArea();
227 
228  auto start = area->GetOrigin();
229  auto end = area->GetEnd();
230 
231  block->SetOrigin( wxPoint( start.x, start.y ) );
232  block->SetEnd( wxPoint( end.x, end.y ) );
233 
234  view->ShowSelectionArea( false );
235  view->ClearHiddenFlags();
236 
237  if( block->GetCount() )
238  {
239  BLOCK_STATE_T state = block->GetState();
240  BLOCK_COMMAND_T command = block->GetCommand();
241 
243 
244  block->SetState( state );
245  block->SetCommand( command );
247 
248  if( block->GetCommand() != BLOCK_ABORT
249  && block->GetCommand() != BLOCK_DUPLICATE
250  && block->GetCommand() != BLOCK_COPY
251  && block->GetCommand() != BLOCK_CUT
252  && block->GetCommand() != BLOCK_DELETE )
253  {
254  SetCrossHairPosition( block->GetEnd() );
256  }
257  }
258 
259  if( m_canvas->IsMouseCaptured() )
260  {
261  switch( block->GetCommand() )
262  {
263  case BLOCK_IDLE:
264  DisplayError( this, wxT( "Error in HandleBlockPLace" ) );
265  break;
266 
267  case BLOCK_DRAG: // Drag
268  case BLOCK_DRAG_ITEM:
269  case BLOCK_MOVE: // Move
270  case BLOCK_DUPLICATE: // Duplicate
271  if( GetCurPart() )
272  ItemCount = BlockSelectItems( GetCurPart(), block, m_unit, m_convert, m_syncPinEdit );
273 
274  if( ItemCount )
275  {
276  nextCmd = true;
277  block->SetState( STATE_BLOCK_MOVE );
278 
279  if( block->GetCommand() == BLOCK_DUPLICATE )
280  {
281  if( block->AppendUndo() )
282  ; // UR_LIBEDIT saves entire state, so no need to append anything more
283  else
284  {
286  block->SetAppendUndo();
287  }
288 
289  BlockCopySelectedItems( pt, GetCurPart(), block );
291  }
292 
294  m_canvas->CallMouseCapture( aDC, wxDefaultPosition, false );
295  }
296  else
297  {
298  m_canvas->CallMouseCapture( aDC, wxDefaultPosition, false );
299  m_canvas->SetMouseCapture( NULL, NULL );
300  }
301  break;
302 
303  case BLOCK_COPY: // Save a copy of items in the clipboard buffer
304  case BLOCK_CUT:
305  if( GetCurPart() )
306  ItemCount = BlockSelectItems( GetCurPart(), block, m_unit, m_convert, m_syncPinEdit );
307 
308  if( ItemCount )
309  {
311  auto cmd = block->GetCommand();
312 
313  if( cmd == BLOCK_COPY )
314  {
316  block->ClearItemsList();
317  }
318  else if( cmd == BLOCK_CUT )
319  {
320  if( block->AppendUndo() )
321  ; // UR_LIBEDIT saves entire state, so no need to append anything more
322  else
323  {
325  block->SetAppendUndo();
326  }
327 
329  RebuildView();
330  GetCanvas()->Refresh();
331  OnModify();
332  }
333  }
334  break;
335 
336  case BLOCK_DELETE: // Delete
337  if( GetCurPart() )
338  ItemCount = BlockSelectItems( GetCurPart(), block, m_unit, m_convert, m_syncPinEdit );
339 
340  if( block->AppendUndo() )
341  ; // UR_LIBEDIT saves entire state, so no need to append anything more
342  else if( ItemCount )
343  {
345  block->SetAppendUndo();
346  }
347 
348  if( GetCurPart() )
349  {
351  RebuildView();
352  GetCanvas()->Refresh();
353  OnModify();
354  }
355  break;
356 
357  case BLOCK_PASTE:
358  case BLOCK_ROTATE:
359  case BLOCK_MIRROR_X:
360  case BLOCK_MIRROR_Y:
361  case BLOCK_FLIP:
362  wxFAIL; // should not happen
363  break;
364 
365  case BLOCK_ZOOM: // Window Zoom
366  Window_Zoom( *block );
367  break;
368 
369  case BLOCK_ABORT:
370  break;
371 
373  break;
374 
375  case BLOCK_PRESELECT_MOVE: // not used in LibEdit
376  case BLOCK_DUPLICATE_AND_INCREMENT: // not used in Eeschema
377  case BLOCK_MOVE_EXACT: // not used in Eeschema
378  break;
379  }
380  }
381 
382  if( block->GetCommand() == BLOCK_ABORT )
383  {
385  }
386 
387  if( !nextCmd )
388  {
389  if( block->GetCommand() != BLOCK_SELECT_ITEMS_ONLY && GetCurPart() )
391 
392  block->SetState( STATE_NO_BLOCK );
393  block->SetCommand( BLOCK_IDLE );
394  GetScreen()->SetCurItem( NULL );
395  m_canvas->EndMouseCapture( GetToolId(), GetGalCanvas()->GetCurrentCursor(), wxEmptyString,
396  false );
397  }
398 
399  view->ShowSelectionArea( false );
400  view->ShowPreview( nextCmd );
401 
402  return nextCmd;
403 }
404 
405 
407 {
409  wxPoint pt;
410 
411  if( !m_canvas->IsMouseCaptured() )
412  {
413  DisplayError( this, wxT( "HandleBlockPLace : m_mouseCaptureCallback = NULL" ) );
414  }
415 
416  block->SetState( STATE_BLOCK_STOP );
417 
418  switch( block->GetCommand() )
419  {
420  case BLOCK_IDLE:
421  break;
422 
423  case BLOCK_DRAG: // Drag
424  case BLOCK_DRAG_ITEM:
425  case BLOCK_MOVE: // Move
426  case BLOCK_DUPLICATE: // Duplicate
427  if( GetCurPart() && !block->AppendUndo() )
429 
430  pt = block->GetMoveVector();
431 
432  if( GetCurPart() )
433  BlockMoveSelectedItems( pt, GetCurPart(), block );
434 
435  block->ClearItemsList();
436  break;
437 
438  case BLOCK_PASTE: // Paste (recopy the last block saved)
439  if( GetCurPart() )
441 
442  pt = block->GetMoveVector();
443 
444  pasteClipboard( pt );
445 
446  block->ClearItemsList();
447  break;
448 
449  case BLOCK_ZOOM: // Handled by HandleBlockEnd
450  case BLOCK_DELETE:
451  case BLOCK_COPY:
452  case BLOCK_ABORT:
453  default:
454  break;
455  }
456 
457  RebuildView();
458  GetCanvas()->Refresh();
459  OnModify();
460 
461  block->SetState( STATE_NO_BLOCK );
462  block->SetCommand( BLOCK_IDLE );
463  GetScreen()->SetCurItem( NULL );
464  m_canvas->EndMouseCapture( GetToolId(), GetGalCanvas()->GetCurrentCursor(), wxEmptyString, false );
465 
468 }
469 
470 
472 {
474 
475  // Copy the clipboard contents to the screen block selector
476  // (only the copy, the new instances will be appended to the part once the items are placed)
477  block.GetItems().CopyList( m_clipboard.GetItems() );
478 
479  // Set block items to the current unit & DeMorgan variant
480  for( size_t i = 0; i < m_clipboard.GetItems().GetCount(); ++i )
481  {
482  LIB_ITEM* item = dynamic_cast<LIB_ITEM*>( m_clipboard.GetItem( i ) );
483 
484  if( item )
485  {
486  item->SetUnit( m_unit );
487  item->SetConvert( m_convert );
488  }
489  }
490 
491  // Set the paste reference point
494 }
495 
496 
498 {
499  LIB_PART* part = GetCurPart();
500 
501  if( !part )
502  return;
503 
504  m_clipboard.ClearListAndDeleteItems(); // delete previous saved list, if exists
505  m_clipboard.SetLastCursorPosition( GetScreen()->m_BlockLocate.GetEnd() ); // store the reference point
506 
507  for( LIB_ITEM& item : part->GetDrawItems() )
508  {
509  // We *do not* copy fields because they are unique for the whole component
510  // so skip them (do not duplicate) if they are flagged selected.
511  if( item.Type() == LIB_FIELD_T )
512  item.ClearFlags( SELECTED );
513 
514  if( !item.IsSelected() )
515  continue;
516 
517  // Do not clear the 'selected' flag. It is required to have items drawn when they are pasted.
518  LIB_ITEM* copy = (LIB_ITEM*) item.Clone();
519  copy->SetFlags( copy->GetFlags() | UR_TRANSIENT );
520  ITEM_PICKER picker( copy, UR_NEW );
521  m_clipboard.PushItem( picker );
522  }
523 }
524 
525 
527 {
528  LIB_PART* part = GetCurPart();
529 
530  if( !part || m_clipboard.GetCount() == 0 )
531  return;
532 
533  for( unsigned int i = 0; i < m_clipboard.GetCount(); i++ )
534  {
535  // Append a copy to the current part, so the clipboard buffer might be pasted multiple times
536  LIB_ITEM* item = (LIB_ITEM*) m_clipboard.GetItem( i )->Clone();
537  item->SetParent( part );
538  item->SetSelected();
539  item->SetUnit( GetUnit() );
540  part->AddDrawItem( item );
541  }
542 
543  BlockMoveSelectedItems( aOffset, GetCurPart(), &GetScreen()->m_BlockLocate );
544  RebuildView();
545  GetCanvas()->Refresh();
546  OnModify();
547 }
548 
549 
550 /*
551  * Traces the outline of the search block structures
552  * The entire block follows the cursor
553  */
554 void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
555  bool aErase )
556 {
557  SCH_DRAW_PANEL* panel =static_cast<SCH_DRAW_PANEL*>( aPanel );
558  LIB_EDIT_FRAME* frame = (LIB_EDIT_FRAME*) aPanel->GetParent();
559  KIGFX::SCH_VIEW* view = panel->GetView();
560  KIGFX::VIEW_GROUP* preview = view->GetPreview();
561 
562  BASE_SCREEN* screen = aPanel->GetScreen();
563  BLOCK_SELECTOR* block = &screen->m_BlockLocate;
564  LIB_PART* component = frame->GetCurPart();
565 
566  if( component == NULL )
567  return;
568 
569  block->SetMoveVector( frame->GetCrossHairPosition( true ) - block->GetLastCursorPosition() );
570 
571  preview->Clear();
572  view->SetVisible( preview, true );
573 
574  for( unsigned ii = 0; ii < block->GetCount(); ii++ )
575  {
576  LIB_ITEM* libItem = (LIB_ITEM*) block->GetItem( ii );
577  LIB_ITEM* copy = static_cast<LIB_ITEM*>( libItem->Clone() );
578 
579  copy->Move( copy->GetPosition() + block->GetMoveVector() );
580  copy->SetFlags( IS_MOVED );
581  preview->Add( copy );
582 
583  view->Hide( libItem );
584  }
585 
586  view->Update( preview );
587 }
virtual BASE_SCREEN * GetScreen()=0
virtual wxPoint GetPosition() const =0
Return the current draw object position.
#define GR_KB_ALT
void Hide(VIEW_ITEM *aItem, bool aHide=true)
Temporarily hides the item in the view (e.g.
Definition: view.cpp:1497
KICAD_T Type() const
Function Type()
Definition: base_struct.h:201
bool UnitsLocked() const
Check whether part units are interchangeable.
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:258
#define MOUSE_MIDDLE
ITERATOR begin(int aType=UNDEFINED_TYPE)
Definition: multivector.h:183
BLOCK_SELECTOR m_BlockLocate
Block description for block commands.
Definition: base_screen.h:214
void ClearHiddenFlags()
Definition: sch_view.cpp:177
int BlockSelectItems(LIB_PART *aPart, BLOCK_SELECTOR *aBlock, int aUnit, int aConvert, bool aSyncPinEdit)
Checks all draw objects of part to see if they are with block.
virtual int BlockCommand(EDA_KEY aKey) override
Returns the block command (BLOCK_MOVE, BLOCK_DUPLICATE...) corresponding to the aKey (ALT...
static int m_convert
bool AppendUndo() const
This file is part of the common library.
KIGFX::PREVIEW::SELECTION_AREA * GetSelectionArea() const
Definition: sch_view.h:84
virtual EDA_ITEM * Clone() const
Function Clone creates a duplicate of this item with linked list members set to NULL.
void AbortBlockCurrentCommand(EDA_DRAW_PANEL *aPanel, wxDC *aDC)
Function AbortBlockCurrentCommand cancels the current block operation.
bool m_syncPinEdit
Set to true to not synchronize pins at the same position when editing symbols with multiple units or ...
virtual void Move(const wxPoint &aPosition)=0
Move a draw object to aPosition.
void SetMoveVector(const wxPoint &aMoveVector)
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
virtual void Window_Zoom(EDA_RECT &aRect) override
bool IsSelected() const
Definition: base_struct.h:224
virtual void EndMouseCapture(int aId=-1, int aCursorId=-1, const wxString &aTitle=wxEmptyString, bool aCallEndFunc=true)
Function EndMouseCapture ends mouse a capture.
BLOCK_COMMAND_T
#define GR_KB_CTRL
void SetOrigin(const wxPoint &pos)
Definition: eda_rect.h:124
void OnModify()
Must be called after a schematic change in order to set the "modify" flag of the current screen...
virtual void Clear()
Function Clear() Removes all the stored items from the group.
Definition: view_group.cpp:74
void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
EDA_ITEM * GetItem(unsigned aIndex)
void BlockClearSelectedItems(LIB_PART *aPart, BLOCK_SELECTOR *aBlock)
Clears all the draw items marked by a block select.
BLOCK_STATE_T
#define EDA_KEY_C
virtual void MoveCursorToCrossHair()
Function MoveCursorToCrossHair warps the cursor to the current cross hair position.
void copySelectedItems()
Copies items selected in the current part to the internal clipboard.
virtual void CallEndMouseCapture(wxDC *aDC)
Function CallEndMouseCapture calls the end mouse capture callback.
virtual bool HandleBlockEnd(wxDC *DC) override
Performs a block end command.
The base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:67
void ClearItemsList()
Function ClearItemsList clear only the list of EDA_ITEM pointers, it does NOT delete the EDA_ITEM obj...
KIGFX::VIEW_GROUP * GetPreview() const
Definition: sch_view.h:86
virtual void SetOffset(const wxPoint &aOffset)=0
Set the drawing object by aOffset from the current position.
ITERATOR end(int aType=UNDEFINED_TYPE)
Definition: multivector.h:189
void AddDrawItem(LIB_ITEM *aItem)
Add a new draw aItem to the draw object list.
void pasteClipboard(const wxPoint &aOffset)
Pastes items from the internal clipboard to the current part.
virtual EDA_DRAW_FRAME * GetParent() const =0
void SetState(BLOCK_STATE_T aState)
#define SELECTED
Definition: base_struct.h:121
void CopyList(const PICKED_ITEMS_LIST &aSource)
Function CopyList copies all data from aSource to the list.
LIB_PART * GetCurPart() const
Return the current part being edited or NULL if none selected.
void ClearListAndDeleteItems()
Function ClearListAndDeleteItems deletes only the list of EDA_ITEM * pointers, AND the data printed b...
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:256
void SetSelected()
Definition: base_struct.h:230
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:216
bool SetPickedItem(EDA_ITEM *aItem, unsigned aIdx)
Function SetPickedItem.
LIB_ITEMS_CONTAINER & GetDrawItems()
Return a reference to the draw item list.
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:76
void push_back(T *aItem)
Definition: multivector.h:169
void SetEnd(int x, int y)
Definition: eda_rect.h:134
virtual void SetMouseCapture(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback, END_MOUSE_CAPTURE_CALLBACK aEndMouseCaptureCallback)
Function SetMouseCapture sets the mouse capture and end mouse capture callbacks to aMouseCaptureCallb...
SCH_DRAW_PANEL * GetCanvas() const override
void ClearPreview()
Definition: sch_view.cpp:131
virtual void CallMouseCapture(wxDC *aDC, const wxPoint &aPosition, bool aErase)
Function CallMouseCapture calls the mouse capture callback.
void DrawAndSizingBlockOutlines(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aPosition, bool aErase)
Function DrawAndSizingBlockOutlines redraws the outlines of the block which shows the search area for...
Define a library symbol object.
uint32_t EDA_KEY
Definition: common.h:73
#define GR_KEY_INVALID
VIEW_GROUP extends VIEW_ITEM by possibility of grouping items into a single object.
Class PICKED_ITEMS_LIST is a holder to handle information on schematic or board items.
#define GR_KB_SHIFT
#define GR_KEY_NONE
virtual void Add(VIEW_ITEM *aItem)
Function Add() Adds an item to the group.
Definition: view_group.cpp:55
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags)
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: view.cpp:1530
KIGFX::SCH_VIEW * GetView() const
Definition: solve.cpp:178
const wxPoint GetEnd() const
Definition: eda_rect.h:114
ITERATOR erase(const ITERATOR &aIterator)
Definition: multivector.h:174
unsigned GetCount() const
Function GetCount.
void SetConvert(int aConvert)
void BlockCopySelectedItems(const wxPoint &aOffset, LIB_PART *aPart, BLOCK_SELECTOR *aBlock)
ITERATOR_BASE< LIB_ITEM, MULTIVECTOR< LIB_ITEM, FIRST_TYPE_VAL, LAST_TYPE_VAL >, typename ITEM_PTR_VECTOR::iterator > ITERATOR
The non-const iterator
Definition: multivector.h:160
wxPoint GetLastCursorPosition() const
void BlockMoveSelectedItems(const wxPoint &aOffset, LIB_PART *aPart, BLOCK_SELECTOR *aBlock)
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:123
void SetUnit(int aUnit)
#define GR_KB_SHIFTCTRL
The symbol library editor main window.
BLOCK_SELECTOR m_clipboard
Clipboard buffer storing LIB_ITEMs
static int m_unit
bool SetPickedItemStatus(UNDO_REDO_T aStatus, unsigned aIdx)
Function SetPickedItemStatus sets the type of undo/redo operation for a given picked item...
EDA_ITEM * GetPickedItem(unsigned int aIdx) const
Function GetPickedItem.
BLOCK_STATE_T GetState() const
virtual void HandleBlockPlace(wxDC *DC) override
Handles the block place command.
int GetToolId() const
Definition: draw_frame.h:519
void SaveCopyInUndoList(EDA_ITEM *ItemToCopy, UNDO_REDO_T undoType=UR_LIBEDIT)
Create a copy of the current component, and save it in the undo list.
void SetCurItem(SCH_ITEM *aItem)
Sets the currently selected object, m_CurrentItem.
Definition: sch_screen.h:204
size_t i
Definition: json11.cpp:597
void BlockDeleteSelectedItems(LIB_PART *aPart, BLOCK_SELECTOR *aBlock)
void InitBlockPasteInfos() override
PICKED_ITEMS_LIST & GetItems()
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:257
void SetVisible(VIEW_ITEM *aItem, bool aIsVisible=true)
Sets the item visibility.
Definition: view.cpp:1476
#define UR_TRANSIENT
indicates the item is owned by the undo/redo stack
Definition: base_struct.h:142
Definition of class LIB_EDIT_FRAME.
static void DrawMovingBlockOutlines(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aPosition, bool aErase)
BLOCK_COMMAND_T GetCommand() const
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:928
void ClearDrawingState()
Clear the state flags of all the items in the screen.
Definition: sch_screen.cpp:561
Definition for part library class.
void SetCrossHairPosition(const wxPoint &aPosition, bool aSnapToGrid=true)
Set the screen cross hair position to aPosition in logical (drawing) units.
void SetLastCursorPosition(const wxPoint &aPosition)
Function SetLastCursorPosition sets the last cursor position to aPosition.
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:245
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Return the current cross hair position in logical (drawing) coordinates.
unsigned GetCount() const
virtual void SetMouseCaptureCallback(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback)
void SetCommand(BLOCK_COMMAND_T aCommand)
wxPoint GetMoveVector() const
void PushItem(ITEM_PICKER &aItem)
Function PushItem adds aItem to the list of items.
#define IS_MOVED
Item being moved.
Definition: base_struct.h:113