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  aItemsList.SetPickedItem( newItem, ii );
158  aItemsList.SetPickedItemStatus( UR_NEW, ii );
159 
160  aPart->GetDrawItems().push_back( newItem );
161  }
162 }
163 
164 
166 {
167  for( LIB_ITEM& item : aPart->GetDrawItems() )
168  {
169  if( !item.IsSelected() )
170  continue;
171 
172  item.MirrorHorizontal( aCenter );
173  item.ClearFlags();
174  }
175 }
176 
177 
179 {
180  for( LIB_ITEM& item : aPart->GetDrawItems() )
181  {
182  if( !item.IsSelected() )
183  continue;
184 
185  item.MirrorVertical( aCenter );
186  item.ClearFlags();
187  }
188 }
189 
190 
192 {
193  for( LIB_ITEM& item : aPart->GetDrawItems() )
194  {
195  if( !item.IsSelected() )
196  continue;
197 
198  item.Rotate( aCenter );
199  item.ClearFlags();
200  }
201 }
202 
203 
205 {
206  int cmd = BLOCK_IDLE;
207 
208  switch( key )
209  {
210  default:
211  cmd = key & 0xFF;
212  break;
213 
214  case EDA_KEY_C( 0xffffffff ): // -1
215  // Historically, -1 has been used as a key, which can cause bit flag
216  // clashes with unaware code. On debug builds, catch any old code that
217  // might still be doing this. TODO: remove if sure all this old code is gone.
218  wxFAIL_MSG( "negative EDA_KEY value should be converted to GR_KEY_INVALID" );
219  // fall through on release builds
220 
221  case GR_KEY_INVALID:
222  cmd = BLOCK_PRESELECT_MOVE;
223  break;
224 
225  case GR_KEY_NONE:
226  cmd = BLOCK_MOVE;
227  break;
228 
229  case GR_KB_SHIFT:
230  cmd = BLOCK_DUPLICATE;
231  break;
232 
233  case GR_KB_ALT:
234  cmd = BLOCK_ROTATE;
235  break;
236 
237  case GR_KB_SHIFTCTRL:
238  cmd = BLOCK_DELETE;
239  break;
240 
241  case GR_KB_CTRL:
242  cmd = BLOCK_MIRROR_Y;
243  break;
244 
245  case MOUSE_MIDDLE:
246  cmd = BLOCK_ZOOM;
247  break;
248  }
249 
250  return cmd;
251 }
252 
253 
255 {
256  int ItemCount = 0;
257  bool nextCmd = false;
259  wxPoint pt;
260 
261  auto panel =static_cast<SCH_DRAW_PANEL*>(m_canvas);
262  auto view = panel->GetView();
263  auto area = view->GetSelectionArea();
264 
265  auto start = area->GetOrigin();
266  auto end = area->GetEnd();
267 
268  block->SetOrigin( wxPoint( start.x, start.y ) );
269  block->SetEnd( wxPoint( end.x, end.y ) );
270 
271  view->ShowSelectionArea( false );
272  view->ClearHiddenFlags();
273 
274  if( block->GetCount() )
275  {
276  BLOCK_STATE_T state = block->GetState();
277  BLOCK_COMMAND_T command = block->GetCommand();
278 
280 
281  block->SetState( state );
282  block->SetCommand( command );
284  SetCrossHairPosition( wxPoint( block->GetRight(), block->GetBottom() ) );
285 
286  if( block->GetCommand() != BLOCK_ABORT )
288  }
289 
290  if( m_canvas->IsMouseCaptured() )
291  {
292  switch( block->GetCommand() )
293  {
294  case BLOCK_IDLE:
295  DisplayError( this, wxT( "Error in HandleBlockPLace" ) );
296  break;
297 
298  case BLOCK_DRAG: // Drag
299  case BLOCK_DRAG_ITEM:
300  case BLOCK_MOVE: // Move
301  case BLOCK_DUPLICATE: // Duplicate
302  if( GetCurPart() )
303  ItemCount = BlockSelectItems( GetCurPart(), block, m_unit, m_convert, m_syncPinEdit );
304 
305  if( ItemCount )
306  {
307  nextCmd = true;
308  block->SetState( STATE_BLOCK_MOVE );
309 
310  if( block->GetCommand() == BLOCK_DUPLICATE )
311  BlockCopySelectedItems( pt, GetCurPart(), block );
312 
314  m_canvas->CallMouseCapture( aDC, wxDefaultPosition, false );
315  }
316  else
317  {
318  m_canvas->CallMouseCapture( aDC, wxDefaultPosition, false );
319  m_canvas->SetMouseCapture( NULL, NULL );
320  }
321  break;
322 
323  case BLOCK_COPY: // Save a copy of items in the clipboard buffer
324  case BLOCK_CUT:
325  if( GetCurPart() )
326  ItemCount = BlockSelectItems( GetCurPart(), block, m_unit, m_convert, m_syncPinEdit );
327 
328  if( ItemCount )
329  {
331  auto cmd = block->GetCommand();
332 
333  if( cmd == BLOCK_COPY )
334  {
336  block->ClearItemsList();
337  }
338  else if( cmd == BLOCK_CUT )
339  {
340  if( block->AppendUndo() )
341  ; // UR_LIBEDIT saves entire state, so no need to append anything more
342  else
343  {
345  block->SetAppendUndo();
346  }
347 
349  OnModify();
350  }
351  }
352  break;
353 
354  case BLOCK_DELETE: // Delete
355  if( GetCurPart() )
356  ItemCount = BlockSelectItems( GetCurPart(), block, m_unit, m_convert, m_syncPinEdit );
357 
358  if( block->AppendUndo() )
359  ; // UR_LIBEDIT saves entire state, so no need to append anything more
360  else if( ItemCount )
361  {
363  block->SetAppendUndo();
364  }
365 
366  if( GetCurPart() )
367  {
369  OnModify();
370  }
371  break;
372 
373  case BLOCK_PASTE:
374  case BLOCK_ROTATE:
375  case BLOCK_MIRROR_X:
376  case BLOCK_MIRROR_Y:
377  case BLOCK_FLIP:
378  wxFAIL; // should not happen
379  break;
380 
381  case BLOCK_ZOOM: // Window Zoom
382  Window_Zoom( *block );
383  break;
384 
385  case BLOCK_ABORT:
386  break;
387 
389  break;
390 
391  case BLOCK_PRESELECT_MOVE: // not used in LibEdit
392  case BLOCK_DUPLICATE_AND_INCREMENT: // not used in Eeschema
393  case BLOCK_MOVE_EXACT: // not used in Eeschema
394  break;
395  }
396  }
397 
398  if( block->GetCommand() == BLOCK_ABORT )
399  {
401  }
402 
403  if( !nextCmd )
404  {
405  if( block->GetCommand() != BLOCK_SELECT_ITEMS_ONLY && GetCurPart() )
407 
408  block->SetState( STATE_NO_BLOCK );
409  block->SetCommand( BLOCK_IDLE );
410  GetScreen()->SetCurItem( NULL );
411  m_canvas->EndMouseCapture( GetToolId(), GetGalCanvas()->GetCurrentCursor(), wxEmptyString,
412  false );
413  }
414 
415  view->ShowSelectionArea( false );
416  view->ShowPreview( nextCmd );
417 
418  return nextCmd;
419 }
420 
421 
423 {
425  wxPoint pt;
426 
427  if( !m_canvas->IsMouseCaptured() )
428  {
429  DisplayError( this, wxT( "HandleBlockPLace : m_mouseCaptureCallback = NULL" ) );
430  }
431 
432  block->SetState( STATE_BLOCK_STOP );
433 
434  switch( block->GetCommand() )
435  {
436  case BLOCK_IDLE:
437  break;
438 
439  case BLOCK_DRAG: // Drag
440  case BLOCK_DRAG_ITEM:
441  case BLOCK_MOVE: // Move
442  case BLOCK_DUPLICATE: // Duplicate
443  if( GetCurPart() && !block->AppendUndo() )
445 
446  pt = block->GetMoveVector();
447 
448  if( GetCurPart() )
449  BlockMoveSelectedItems( pt, GetCurPart(), block );
450 
451  block->ClearItemsList();
452  m_canvas->Refresh( true );
453  break;
454 
455  case BLOCK_PASTE: // Paste (recopy the last block saved)
456  if( GetCurPart() )
458 
459  pt = block->GetMoveVector();
460 
461  pasteClipboard( pt );
462 
463  block->ClearItemsList();
464  m_canvas->Refresh( true );
465  break;
466 
467  case BLOCK_ZOOM: // Handled by HandleBlockEnd
468  case BLOCK_DELETE:
469  case BLOCK_COPY:
470  case BLOCK_ABORT:
471  default:
472  break;
473  }
474 
475  OnModify();
476 
477  block->SetState( STATE_NO_BLOCK );
478  block->SetCommand( BLOCK_IDLE );
479  GetScreen()->SetCurItem( NULL );
480  m_canvas->EndMouseCapture( GetToolId(), GetGalCanvas()->GetCurrentCursor(), wxEmptyString, false );
481 
484 
485  m_canvas->Refresh( true );
486 }
487 
488 
490 {
492 
493  // Copy the clipboard contents to the screen block selector
494  // (only the copy, the new instances will be appended to the part once the items are placed)
495  block.GetItems().CopyList( m_clipboard.GetItems() );
496 
497  // Set the pate reference point
500 }
501 
502 
504 {
505  LIB_PART* part = GetCurPart();
506 
507  if( !part )
508  return;
509 
510  m_clipboard.ClearListAndDeleteItems(); // delete previous saved list, if exists
511  m_clipboard.SetLastCursorPosition( GetScreen()->m_BlockLocate.GetEnd() ); // store the reference point
512 
513  for( LIB_ITEM& item : part->GetDrawItems() )
514  {
515  // We *do not* copy fields because they are unique for the whole component
516  // so skip them (do not duplicate) if they are flagged selected.
517  if( item.Type() == LIB_FIELD_T )
518  item.ClearFlags( SELECTED );
519 
520  if( !item.IsSelected() )
521  continue;
522 
523  // Do not clear the 'selected' flag. It is required to have items drawn when they are pasted.
524  LIB_ITEM* copy = (LIB_ITEM*) item.Clone();
525  copy->SetFlags( copy->GetFlags() | UR_TRANSIENT );
526  ITEM_PICKER picker( copy, UR_NEW );
527  m_clipboard.PushItem( picker );
528  }
529 }
530 
531 
533 {
534  LIB_PART* part = GetCurPart();
535 
536  if( !part || m_clipboard.GetCount() == 0 )
537  return;
538 
539  for( unsigned int i = 0; i < m_clipboard.GetCount(); i++ )
540  {
541  // Append a copy to the current part, so the clipboard buffer might be pasted multiple times
542  LIB_ITEM* item = (LIB_ITEM*) m_clipboard.GetItem( i )->Clone();
543  item->SetParent( part );
544  item->SetSelected();
545  item->SetUnit( GetUnit() );
546  part->AddDrawItem( item );
547  }
548 
549  BlockMoveSelectedItems( aOffset, GetCurPart(), &GetScreen()->m_BlockLocate );
550  OnModify();
551 }
552 
553 
554 /*
555  * Traces the outline of the search block structures
556  * The entire block follows the cursor
557  */
558 void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
559  bool aErase )
560 {
561  SCH_DRAW_PANEL* panel =static_cast<SCH_DRAW_PANEL*>( aPanel );
562  LIB_EDIT_FRAME* frame = (LIB_EDIT_FRAME*) aPanel->GetParent();
563  KIGFX::SCH_VIEW* view = panel->GetView();
564  KIGFX::VIEW_GROUP* preview = view->GetPreview();
565 
566  BASE_SCREEN* screen = aPanel->GetScreen();
567  BLOCK_SELECTOR* block = &screen->m_BlockLocate;
568  LIB_PART* component = frame->GetCurPart();
569 
570  if( component == NULL )
571  return;
572 
573  block->SetMoveVector( frame->GetCrossHairPosition( true ) - block->GetLastCursorPosition() );
574 
575  preview->Clear();
576  view->SetVisible( preview, true );
577 
578  for( unsigned ii = 0; ii < block->GetCount(); ii++ )
579  {
580  LIB_ITEM* libItem = (LIB_ITEM*) block->GetItem( ii );
581  LIB_ITEM* copy = static_cast<LIB_ITEM*>( libItem->Clone() );
582 
583  copy->Move( copy->GetPosition() + block->GetMoveVector() );
584  copy->SetFlags( IS_MOVED );
585  preview->Add( copy );
586 
587  view->Hide( libItem );
588  }
589 
590  view->Update( preview );
591 }
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:1505
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
bool UnitsLocked() const
Check whether part units are interchangeable.
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:255
#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:175
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:39
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)
void BlockRotateSelectedItems(const wxPoint &aCenter, LIB_PART *aPart, BLOCK_SELECTOR *aBlock)
SCH_SCREEN * GetScreen() const override
Function GetScreen returns 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:221
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
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:41
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:118
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:253
void SetSelected()
Definition: base_struct.h:227
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:213
bool SetPickedItem(EDA_ITEM *aItem, unsigned aIdx)
Function SetPickedItem.
void BlockMirrorSelectedItemsV(const wxPoint &aCenter, LIB_PART *aPart, BLOCK_SELECTOR *aBlock)
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:130
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.
void BlockMirrorSelectedItemsH(const wxPoint &aCenter, LIB_PART *aPart, BLOCK_SELECTOR *aBlock)
int GetBottom() const
Definition: eda_rect.h:122
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
int GetRight() const
Definition: eda_rect.h:119
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:1538
KIGFX::SCH_VIEW * GetView() const
Definition: solve.cpp:178
ITERATOR erase(const ITERATOR &aIterator)
Definition: multivector.h:174
unsigned GetCount() const
Function GetCount.
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:108
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:512
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:254
void SetVisible(VIEW_ITEM *aItem, bool aIsVisible=true)
Sets the item visibility.
Definition: view.cpp:1484
#define UR_TRANSIENT
indicates the item is owned by the undo/redo stack
Definition: base_struct.h:139
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
Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:924
void ClearDrawingState()
Clear the state flags of all the items in the screen.
Definition: sch_screen.cpp:561
Definition for part library class.
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL)
void SetCrossHairPosition(const wxPoint &aPosition, bool aSnapToGrid=true)
Function SetCrossHairPosition sets the screen cross hair position to aPosition in logical (drawing) u...
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
Function GetCrossHairPosition 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:110