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 
93 void LIB_EDIT_FRAME::BlockMoveSelectedItems( const wxPoint& aOffset, LIB_PART* aPart, BLOCK_SELECTOR* aBlock )
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 
135 void LIB_EDIT_FRAME::BlockCopySelectedItems( const wxPoint& aOffset, LIB_PART* aPart, BLOCK_SELECTOR* aBlock )
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 = static_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() )
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 
290  block->SetLastCursorPosition( GetCrossHairPosition( true ) );
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() )
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() )
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 
393  GetScreen()->SetCurItem( NULL );
394  m_canvas->EndMouseCapture( GetToolId(), GetGalCanvas()->GetCurrentCursor(), wxEmptyString,
395  false );
396  }
397 
398  view->ShowSelectionArea( false );
399  view->ShowPreview( nextCmd );
400 
401  return nextCmd;
402 }
403 
404 
406 {
408  wxPoint pt;
409 
410  if( !m_canvas->IsMouseCaptured() )
411  {
412  DisplayError( this, wxT( "HandleBlockPLace : m_mouseCaptureCallback = NULL" ) );
413  }
414 
415  block->SetState( STATE_BLOCK_STOP );
416 
417  switch( block->GetCommand() )
418  {
419  case BLOCK_IDLE:
420  break;
421 
422  case BLOCK_DRAG: // Drag
423  case BLOCK_DRAG_ITEM:
424  case BLOCK_MOVE: // Move
425  case BLOCK_DUPLICATE: // Duplicate
426  if( GetCurPart() && !block->AppendUndo() )
428 
429  pt = block->GetMoveVector();
430 
431  if( GetCurPart() )
433 
434  block->ClearItemsList();
435  break;
436 
437  case BLOCK_PASTE: // Paste (recopy the last block saved)
438  if( GetCurPart() )
440 
441  pt = block->GetMoveVector();
442 
443  pasteClipboard( pt );
444 
445  block->ClearItemsList();
446  break;
447 
448  case BLOCK_ZOOM: // Handled by HandleBlockEnd
449  case BLOCK_DELETE:
450  case BLOCK_COPY:
451  case BLOCK_ABORT:
452  default:
453  break;
454  }
455 
456  RebuildView();
457  GetCanvas()->Refresh();
458  OnModify();
459 
460  block->SetState( STATE_NO_BLOCK );
461  block->SetCommand( BLOCK_IDLE );
462  GetScreen()->SetCurItem( NULL );
463  m_canvas->EndMouseCapture( GetToolId(), GetGalCanvas()->GetCurrentCursor(), wxEmptyString, false );
464 
467 }
468 
469 
471 {
473 
474  // Copy the clipboard contents to the screen block selector
475  // (only the copy, the new instances will be appended to the part once the items are placed)
476  block.GetItems().CopyList( m_clipboard.GetItems() );
477 
478  // Reparent block items and set their current unit & DeMorgan variant
479  for( size_t i = 0; i < m_clipboard.GetItems().GetCount(); ++i )
480  {
481  LIB_ITEM* item = dynamic_cast<LIB_ITEM*>( m_clipboard.GetItem( i ) );
482 
483  if( item )
484  {
485  item->SetParent( GetCurPart() );
486 
487  item->SetUnit( m_unit );
488  item->SetConvert( m_convert );
489  }
490  }
491 
492  // Set the paste reference point
493  block.SetLastCursorPosition( m_clipboard.GetLastCursorPosition() );
495 }
496 
497 
499 {
500  LIB_PART* part = GetCurPart();
501 
502  if( !part )
503  return;
504 
505  m_clipboard.ClearListAndDeleteItems(); // delete previous saved list, if exists
506  m_clipboard.SetLastCursorPosition( GetScreen()->m_BlockLocate.GetEnd() ); // store the reference point
507 
508  for( LIB_ITEM& item : part->GetDrawItems() )
509  {
510  // We *do not* copy fields because they are unique for the whole component
511  // so skip them (do not duplicate) if they are flagged selected.
512  if( item.Type() == LIB_FIELD_T )
513  item.ClearFlags( SELECTED );
514 
515  if( !item.IsSelected() )
516  continue;
517 
518  // Do not clear the 'selected' flag. It is required to have items drawn when they are pasted.
519  LIB_ITEM* copy = (LIB_ITEM*) item.Clone();
520  copy->SetFlags( UR_TRANSIENT );
521  ITEM_PICKER picker( copy, UR_NEW );
522  m_clipboard.PushItem( picker );
523  }
524 }
525 
526 
527 void LIB_EDIT_FRAME::pasteClipboard( const wxPoint& aOffset )
528 {
529  LIB_PART* part = GetCurPart();
530 
531  if( !part || m_clipboard.GetCount() == 0 )
532  return;
533 
534  for( unsigned int i = 0; i < m_clipboard.GetCount(); i++ )
535  {
536  // Append a copy to the current part, so the clipboard buffer might be pasted multiple times
537  LIB_ITEM* item = (LIB_ITEM*) m_clipboard.GetItem( i )->Clone();
538  item->SetParent( part );
539  item->SetSelected();
540  item->SetUnit( GetUnit() );
541  part->AddDrawItem( item );
542  }
543 
544  BlockMoveSelectedItems( aOffset, GetCurPart(), &GetScreen()->m_BlockLocate );
545  RebuildView();
546  GetCanvas()->Refresh();
547  OnModify();
548 }
549 
550 
551 /*
552  * Traces the outline of the search block structures
553  * The entire block follows the cursor
554  */
555 void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
556  bool aErase )
557 {
558  SCH_DRAW_PANEL* panel =static_cast<SCH_DRAW_PANEL*>( aPanel );
559  LIB_EDIT_FRAME* frame = (LIB_EDIT_FRAME*) aPanel->GetParent();
560  KIGFX::SCH_VIEW* view = panel->GetView();
561  KIGFX::VIEW_GROUP* preview = view->GetPreview();
562 
563  BASE_SCREEN* screen = aPanel->GetScreen();
564  BLOCK_SELECTOR* block = &screen->m_BlockLocate;
565  LIB_PART* component = frame->GetCurPart();
566 
567  if( component == NULL )
568  return;
569 
570  block->SetMoveVector( frame->GetCrossHairPosition( true ) - block->GetLastCursorPosition() );
571 
572  preview->Clear();
573  view->SetVisible( preview, true );
574 
575  for( unsigned ii = 0; ii < block->GetCount(); ii++ )
576  {
577  LIB_ITEM* libItem = (LIB_ITEM*) block->GetItem( ii );
578  LIB_ITEM* copy = static_cast<LIB_ITEM*>( libItem->Clone() );
579 
580  copy->Move( copy->GetPosition() + block->GetMoveVector() );
581  copy->SetFlags( IS_MOVED );
582  preview->Add( copy );
583 
584  view->Hide( libItem );
585  }
586 
587  view->Update( preview );
588 }
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:1506
LIB_PART * GetCurPart() const
Return the current part being edited or NULL if none selected.
KIGFX::VIEW_GROUP * GetPreview() const
Definition: sch_view.h:88
#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()
Clear the hide flag of all items in the view.
Definition: sch_view.cpp:179
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 IsSelected() const
Definition: base_struct.h:227
This file is part of the common library.
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.
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:912
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
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 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 ClearBlockCommand()
Definition: base_screen.h:501
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.
wxPoint GetMoveVector() const
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.
wxPoint GetLastCursorPosition() const
unsigned GetCount() const
Function GetCount.
virtual void CallEndMouseCapture(wxDC *aDC)
Function CallEndMouseCapture calls the end mouse capture callback.
virtual bool HandleBlockEnd(wxDC *DC) override
Performs a block end command.
virtual EDA_ITEM * Clone() const
Function Clone creates a duplicate of this item with linked list members set to NULL.
The base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:68
void ClearItemsList()
Function ClearItemsList clear only the list of EDA_ITEM pointers, it does NOT delete the EDA_ITEM obj...
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
#define SELECTED
Definition: base_struct.h:121
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:259
void SetSelected()
Definition: base_struct.h:233
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:219
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
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:133
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.
EDA_ITEM * GetPickedItem(unsigned int aIdx) const
Function GetPickedItem.
uint32_t EDA_KEY
Definition: common.h:71
#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:1539
Definition: solve.cpp:178
KIGFX::SCH_VIEW * GetView() const
ITERATOR erase(const ITERATOR &aIterator)
Definition: multivector.h:174
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
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:126
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.
virtual void HandleBlockPlace(wxDC *DC) override
Handles the block place command.
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:211
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:260
unsigned GetCount() const
void SetVisible(VIEW_ITEM *aItem, bool aIsVisible=true)
Sets the item visibility.
Definition: view.cpp:1485
#define UR_TRANSIENT
indicates the item is owned by the undo/redo stack
Definition: base_struct.h:142
static void DrawMovingBlockOutlines(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aPosition, bool aErase)
void ClearDrawingState()
Clear the state flags of all the items in the screen.
Definition: sch_screen.cpp:594
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:243
bool UnitsLocked() const
Check whether part units are interchangeable.
virtual void SetMouseCaptureCallback(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback)
int GetToolId() const
Definition: draw_frame.h:520
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Return the current cross hair position in logical (drawing) coordinates.
KICAD_T Type() const
Function Type()
Definition: base_struct.h:204
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