KiCad PCB EDA Suite
eeschema/block.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) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2009 Wayne Stambaugh <stambaughw@gmail.com>
6  * Copyright (C) 2004-2018 KiCad Developers, see change_log.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 <pgm_base.h>
32 #include <gr_basic.h>
33 #include <sch_draw_panel.h>
34 #include <confirm.h>
35 #include <sch_edit_frame.h>
36 
37 #include <general.h>
38 #include <class_library.h>
39 #include <lib_pin.h>
40 #include <list_operations.h>
41 #include <sch_bus_entry.h>
42 #include <sch_marker.h>
43 #include <sch_junction.h>
44 #include <sch_line.h>
45 #include <sch_no_connect.h>
46 #include <sch_text.h>
47 #include <sch_component.h>
48 #include <sch_sheet.h>
49 #include <sch_sheet_path.h>
50 #include <list_operations.h>
51 
53 #include <sch_view.h>
54 #include <view/view_group.h>
55 
56 static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
57  const wxPoint& aPosition, bool aErase );
58 
60 {
61  int cmd = BLOCK_IDLE;
62 
63  switch( key )
64  {
65  default:
66  cmd = key & 0xFF;
67  break;
68 
69  case 0:
70  cmd = BLOCK_MOVE;
71  break;
72 
73  case GR_KB_SHIFT:
74  cmd = BLOCK_DUPLICATE;
75  break;
76 
77  case GR_KB_CTRL:
78  cmd = BLOCK_DRAG;
79  break;
80 
81  case GR_KB_SHIFTCTRL:
82  cmd = BLOCK_DELETE;
83  break;
84 
85  case MOUSE_MIDDLE:
86  cmd = BLOCK_ZOOM;
87  break;
88  }
89 
90  return cmd;
91 }
92 
93 
95 {
97 
98  block->GetItems().CopyList( m_blockItems.GetItems() );
100 }
101 
102 
104 {
106 
107  wxCHECK_RET( m_canvas->IsMouseCaptured(), "No block mouse capture callback is set" );
108 
109  if( block->GetCount() == 0 )
110  {
111  wxString msg;
112  msg.Printf( wxT( "HandleBlockPLace() error : no items to place (cmd %d, state %d)" ),
113  block->GetCommand(), block->GetState() );
114  wxFAIL_MSG( msg );
115  }
116 
117  block->SetState( STATE_BLOCK_STOP );
118 
119  switch( block->GetCommand() )
120  {
121  case BLOCK_DRAG: // Drag from mouse
122  case BLOCK_DRAG_ITEM: // Drag from a component selection and drag command
123  case BLOCK_MOVE:
124  case BLOCK_DUPLICATE: /* Duplicate */
125  if( m_canvas->IsMouseCaptured() )
126  m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
127 
128  // If the block wasn't changed, don't update the schematic
129  if( block->GetMoveVector() == wxPoint( 0, 0 ) && !block->AppendUndo() )
130  {
131  // This calls the block-abort command routine on cleanup
132  m_canvas->EndMouseCapture( GetToolId(), GetGalCanvas()->GetCurrentCursor() );
133  return;
134  }
135 
136  if( block->GetCommand() != BLOCK_DUPLICATE )
137  SaveCopyInUndoList( block->GetItems(), UR_CHANGED, block->AppendUndo(), block->GetMoveVector() );
138 
139  for( unsigned ii = 0; ii < block->GetItems().GetCount(); ii++ )
140  {
141  SCH_ITEM* item = static_cast<SCH_ITEM*>( block->GetItems().GetPickedItem( ii ) );
142  item->Move( block->GetMoveVector() );
143  item->SetFlags( IS_MOVED );
144  GetCanvas()->GetView()->Update( item, KIGFX::GEOMETRY );
145  }
146  break;
147 
148  case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
149  if( m_canvas->IsMouseCaptured() )
150  m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
151 
152  DuplicateItemsInList( GetScreen(), block->GetItems(), block->GetMoveVector() );
153 
154  SaveCopyInUndoList( block->GetItems(), UR_CHANGED, block->AppendUndo() );
155  break;
156 
157  case BLOCK_PASTE:
158  if( m_canvas->IsMouseCaptured() )
159  m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
160 
161  PasteListOfItems( DC );
162  break;
163 
164  default: // others are handled by HandleBlockEnd()
165  break;
166  }
167 
168  CheckListConnections( block->GetItems(), true );
169  block->ClearItemsList();
170  SchematicCleanUp( true );
172  OnModify();
173 
174  // clear dome flags and pointers
177  GetScreen()->SetCurItem( NULL );
178 
179  m_canvas->EndMouseCapture( GetToolId(), GetGalCanvas()->GetCurrentCursor(), wxEmptyString, false );
180 
183 }
184 
185 
187 {
188  bool nextcmd = false;
189  bool append = false;
191 
192  auto panel =static_cast<SCH_DRAW_PANEL*>(m_canvas);
193  auto view = panel->GetView();
194 
195  view->ShowSelectionArea( false );
196  view->ClearHiddenFlags();
197 
198  if( block->GetCount() )
199  {
200  BLOCK_STATE_T state = block->GetState();
201  BLOCK_COMMAND_T command = block->GetCommand();
202 
204 
205  block->SetState( state );
206  block->SetCommand( command );
208 
209  if( block->GetCommand() != BLOCK_ABORT
210  && block->GetCommand() != BLOCK_DUPLICATE
211  && block->GetCommand() != BLOCK_COPY
212  && block->GetCommand() != BLOCK_CUT
213  && block->GetCommand() != BLOCK_DELETE )
214  {
215  SetCrossHairPosition( block->GetEnd() );
217  }
218  }
219 
220  if( m_canvas->IsMouseCaptured() )
221  {
222  switch( block->GetCommand() )
223  {
224  case BLOCK_IDLE:
225  DisplayError( this, wxT( "Error in HandleBlockPLace()" ) );
226  break;
227 
228  case BLOCK_DRAG:
229  case BLOCK_DRAG_ITEM: // Drag from a drag command
230  case BLOCK_MOVE:
231  case BLOCK_DUPLICATE:
233  if( block->GetCommand() == BLOCK_DRAG_ITEM )
234  {
235  // This is a drag command, not a mouse block command
236  // Only this item is put in list
237  if( GetScreen()->GetCurItem() )
238  {
239  ITEM_PICKER picker;
240  picker.SetItem( GetScreen()->GetCurItem() );
241  block->PushItem( picker );
242  }
243  }
244  else if( block->GetCommand() != BLOCK_PRESELECT_MOVE )
245  {
246  // Collect all items in the locate block
248  }
249 
251 
252  if( block->GetCommand() == BLOCK_DUPLICATE )
253  {
254  DuplicateItemsInList( GetScreen(), block->GetItems(), block->GetMoveVector() );
255  block->SetLastCursorPosition( GetCrossHairPosition() );
256  SaveCopyInUndoList( block->GetItems(), UR_NEW );
257  block->SetAppendUndo();
258  }
259 
260  if( block->GetCount() )
261  {
262  nextcmd = true;
263  block->SetState( STATE_BLOCK_MOVE );
264 
265  if( block->GetCommand() != BLOCK_DRAG && block->GetCommand() != BLOCK_DRAG_ITEM )
266  {
267  // Mark dangling pins at the edges of the block:
268  std::vector<DANGLING_END_ITEM> internalPoints;
269 
270  for( unsigned i = 0; i < block->GetCount(); ++i )
271  {
272  auto item = static_cast<SCH_ITEM*>( block->GetItem( i ) );
273  item->GetEndPoints( internalPoints );
274  }
275 
276  for( unsigned i = 0; i < block->GetCount(); ++i )
277  {
278  auto item = static_cast<SCH_ITEM*>( block->GetItem( i ) );
279  item->UpdateDanglingState( internalPoints );
280  }
281  }
282 
284  m_canvas->CallMouseCapture( aDC, wxDefaultPosition, false );
285  }
286  else
287  {
288  m_canvas->CallMouseCapture( aDC, wxDefaultPosition, false );
289  m_canvas->SetMouseCapture( NULL, NULL );
290  }
291  break;
292 
293  case BLOCK_CUT:
294  case BLOCK_DELETE:
296  DrawAndSizingBlockOutlines( m_canvas, aDC, wxDefaultPosition, false );
297 
298  // The CUT variant needs to copy the items from their originial position
299  if( ( block->GetCommand() == BLOCK_CUT ) && block->GetCount() )
300  {
301  wxPoint move_vector = -GetScreen()->m_BlockLocate.GetLastCursorPosition();
302  copyBlockItems( block->GetItems(), move_vector );
303  }
304 
305  // We set this in a while loop to catch any newly created items
306  // as a result of the delete (e.g. merged wires)
307  while( block->GetCount() )
308  {
309  DeleteItemsInList( block->GetItems(), append );
310  SchematicCleanUp( true );
311  OnModify();
312  block->ClearItemsList();
314  append = true;
315  }
316 
318  break;
319 
320  case BLOCK_COPY: // Save a copy of items in paste buffer
322  DrawAndSizingBlockOutlines( m_canvas, aDC, wxDefaultPosition, false );
323 
324  if( block->GetCount() )
325  {
326  wxPoint move_vector = -GetScreen()->m_BlockLocate.GetLastCursorPosition();
327  copyBlockItems( block->GetItems(), move_vector );
328  }
329 
330  block->ClearItemsList();
331  break;
332 
333  case BLOCK_ZOOM:
334  Window_Zoom( GetScreen()->m_BlockLocate );
335  break;
336 
337  default:
338  break;
339  }
340  }
341 
342  if( block->GetCommand() == BLOCK_ABORT )
343  {
344  if( block->AppendUndo() )
345  {
347  PutDataInPreviousState( undo, false );
348  undo->ClearListAndDeleteItems();
349  delete undo;
350  }
351 
352  // We set the dangling ends to the block-scope, so we must set them back to
353  // schematic-scope.
355 
356  view->ShowSelectionArea( false );
357  view->ClearHiddenFlags();
358  }
359 
360  if( !nextcmd )
361  {
364  GetScreen()->SetCurItem( NULL );
365  m_canvas->EndMouseCapture( GetToolId(), GetGalCanvas()->GetCurrentCursor(), wxEmptyString,
366  false );
367  }
368 
369  view->ShowSelectionArea( false );
370  if( !nextcmd )
371  view->ClearPreview();
372  view->ShowPreview( nextcmd );
373 
374  return nextcmd;
375 }
376 
377 
378 /* Traces the outline of the search block structures
379  * The entire block follows the cursor
380  */
381 static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
382  bool aErase )
383 {
384  SCH_DRAW_PANEL* panel =static_cast<SCH_DRAW_PANEL*>( aPanel );
385  KIGFX::SCH_VIEW* view = panel->GetView();
386  KIGFX::VIEW_GROUP* preview = view->GetPreview();
387 
388  BASE_SCREEN* screen = aPanel->GetScreen();
389  BLOCK_SELECTOR* block = &screen->m_BlockLocate;
390  SCH_ITEM* schitem;
391 
392  block->SetMoveVector( panel->GetParent()->GetCrossHairPosition() - block->GetLastCursorPosition() );
393 
394  preview->Clear();
395  view->SetVisible( preview, true );
396 
397  for( unsigned ii = 0; ii < block->GetCount(); ii++ )
398  {
399  schitem = (SCH_ITEM*) block->GetItem( ii );
400  SCH_ITEM* copy = static_cast<SCH_ITEM*>( schitem->Clone() );
401 
402  copy->Move( block->GetMoveVector() );
403  copy->SetFlags( IS_MOVED );
404  preview->Add( copy );
405 
406  view->Hide( schitem );
407  }
408 
409  view->Update( preview );
410 }
411 
412 
413 void SCH_EDIT_FRAME::copyBlockItems( PICKED_ITEMS_LIST& aItemsList, const wxPoint& aMoveVector )
414 {
415  m_blockItems.ClearListAndDeleteItems(); // delete previous saved list, if exists
416 
417  wxRect bounds;
418 
419  if( aItemsList.GetCount() > 0 )
420  bounds = aItemsList.GetPickedItem( 0 )->GetBoundingBox();
421 
422  for( unsigned i = 1; i < aItemsList.GetCount(); ++i )
423  bounds.Union( aItemsList.GetPickedItem( i )->GetBoundingBox() );
424 
425  wxPoint center( ( bounds.GetLeft() + bounds.GetRight() ) / 2,
426  ( bounds.GetTop() + bounds.GetBottom() ) / 2 );
427  center = GetNearestGridPosition( center );
428 
429  for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ )
430  {
431  // Clear m_Flag member of selected items:
432  aItemsList.GetPickedItem( ii )->ClearFlags();
433 
434  /* Make a copy of the original picked item. */
435  SCH_ITEM* copy = DuplicateStruct( (SCH_ITEM*) aItemsList.GetPickedItem( ii ) );
436  copy->SetParent( NULL );
437  copy->SetFlags( copy->GetFlags() | UR_TRANSIENT );
438  copy->Move( -center );
439  ITEM_PICKER item( copy, UR_NEW );
440 
441  m_blockItems.PushItem( item );
442  }
443 }
444 
445 
447 {
448  unsigned i;
449  SCH_ITEM* item;
450  SCH_SHEET_LIST hierarchy( g_RootSheet ); // This is the entire schematic hierarcy.
451 
452  if( m_blockItems.GetCount() == 0 )
453  {
454  DisplayError( this, _( "No item to paste." ) );
455  return;
456  }
457 
458  wxFileName destFn = m_CurrentSheet->Last()->GetFileName();
459 
460  if( destFn.IsRelative() )
461  destFn.MakeAbsolute( Prj().GetProjectPath() );
462 
463  // Make sure any sheets in the block to be pasted will not cause recursion in
464  // the destination sheet. Moreover new sheets create new sheetpaths, and component
465  // alternante references must be created and cleared
466  bool hasSheetPasted = false;
467  // Keep trace of existing sheet paths. Paste block can modify this list
468  SCH_SHEET_LIST initial_sheetpathList( g_RootSheet );
469 
470  for( i = 0; i < m_blockItems.GetCount(); i++ )
471  {
472  item = (SCH_ITEM*) m_blockItems.GetItem( i );
473 
474  if( item->Type() == SCH_SHEET_T )
475  {
476  SCH_SHEET* sheet = (SCH_SHEET*)item;
477  wxFileName srcFn = sheet->GetFileName();
478 
479  if( srcFn.IsRelative() )
480  srcFn.MakeAbsolute( Prj().GetProjectPath() );
481 
482  SCH_SHEET_LIST sheetHierarchy( sheet );
483 
484  if( hierarchy.TestForRecursion( sheetHierarchy,
485  destFn.GetFullPath( wxPATH_UNIX ) ) )
486  {
487  wxString msg;
488 
489  msg.Printf( _( "The sheet changes cannot be made because the destination "
490  "sheet already has the sheet \"%s\" or one of it's subsheets "
491  "as a parent somewhere in the schematic hierarchy." ),
492  GetChars( sheet->GetFileName() ) );
493  DisplayError( this, msg );
494  return;
495  }
496 
497  // Duplicate sheet names and sheet time stamps are not valid. Use a time stamp
498  // based sheet name and update the time stamp for each sheet in the block.
499  timestamp_t timeStamp = GetNewTimeStamp();
500 
501  sheet->SetName( wxString::Format( wxT( "sheet%8.8lX" ), (unsigned long)timeStamp ) );
502  sheet->SetTimeStamp( timeStamp );
503  hasSheetPasted = true;
504  }
505  }
506 
507  PICKED_ITEMS_LIST picklist;
508 
509  for( i = 0; i < m_blockItems.GetCount(); i++ )
510  {
512 
513  // Creates data, and push it as new data in undo item list buffer
514  ITEM_PICKER picker( item, UR_NEW );
515  picklist.PushItem( picker );
516 
517  // Clear annotation and init new time stamp for the new components and sheets:
518  if( item->Type() == SCH_COMPONENT_T )
519  {
520  SCH_COMPONENT* cmp = static_cast<SCH_COMPONENT*>( item );
521  cmp->SetTimeStamp( GetNewTimeStamp() );
522 
523  // clear the annotation, but preserve the selected unit
524  int unit = cmp->GetUnit();
525  cmp->ClearAnnotation( NULL );
526  cmp->SetUnit( unit );
527  }
528  else if( item->Type() == SCH_SHEET_T )
529  {
530  ( (SCH_SHEET*) item )->SetTimeStamp( GetNewTimeStamp() );
531  }
532  }
533 
534  SaveCopyInUndoList( picklist, UR_NEW );
535 
536  for( i = 0; i < picklist.GetCount(); ++i )
537  {
538  item = (SCH_ITEM*) picklist.GetPickedItem( i );
539 
540  item->Move( GetScreen()->m_BlockLocate.GetMoveVector() );
541 
542  SetSchItemParent( item, GetScreen() );
543  AddToScreen( item );
544  }
545 
546  if( hasSheetPasted )
547  {
548  // We clear annotation of new sheet paths.
549  // Annotation of new components added in current sheet is already cleared.
550  SCH_SCREENS screensList( g_RootSheet );
551  screensList.ClearAnnotationOfNewSheetPaths( initial_sheetpathList );
552  }
553 
554  // Clear flags for all items.
556 
557  OnModify();
558 }
559 
560 void DrawAndSizingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
561  bool aErase )
562 {
563  auto panel =static_cast<SCH_DRAW_PANEL*>(aPanel);
564  auto area = panel->GetView()->GetSelectionArea();
565  auto frame = static_cast<EDA_BASE_FRAME*>(aPanel->GetParent());
566 
568  bool isLibEdit = frame->IsType( FRAME_SCH_LIB_EDITOR );
569 
570  block = &aPanel->GetScreen()->m_BlockLocate;
571  block->SetMoveVector( wxPoint( 0, 0 ) );
572  block->SetLastCursorPosition( aPanel->GetParent()->GetCrossHairPosition( isLibEdit ) );
573  block->SetEnd( aPanel->GetParent()->GetCrossHairPosition() );
574 
575  panel->GetView()->ClearPreview();
576  panel->GetView()->ClearHiddenFlags();
577 
578  area->SetOrigin( block->GetOrigin() );;
579  area->SetEnd( block->GetEnd() );
580 
581  panel->GetView()->SetVisible( area );
582  panel->GetView()->Hide( area, false );
583  panel->GetView()->Update( area );
584 
585  if( block->GetState() == STATE_BLOCK_INIT )
586  {
587  if( block->GetWidth() || block->GetHeight() )
588  // 2nd point exists: the rectangle is not surface anywhere
589  block->SetState( STATE_BLOCK_END );
590  }
591 }
virtual BASE_SCREEN * GetScreen()=0
Definition of the SCH_SHEET class for Eeschema.
void Hide(VIEW_ITEM *aItem, bool aHide=true)
Temporarily hides the item in the view (e.g.
Definition: view.cpp:1506
Class SCH_SHEET_LIST.
KIGFX::VIEW_GROUP * GetPreview() const
Definition: sch_view.h:88
#define MOUSE_MIDDLE
bool SchematicCleanUp(bool aAppend=false)
Performs routine schematic cleaning including breaking wire and buses and deleting identical objects ...
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
long timestamp_t
timestamp_t is our type to represent unique IDs for all kinds of elements; historically simply the ti...
Definition: common.h:53
virtual EDA_DRAW_FRAME * GetParent() const override
SCH_SHEET * Last() const
Function Last returns a pointer to the last sheet of the list One can see the others sheet as the "pa...
This file is part of the common library.
void OnModify()
Must be called after a schematic change in order to set the "modify" flag of the current screen* and ...
void DuplicateItemsInList(SCH_SCREEN *screen, PICKED_ITEMS_LIST &aItemsList, const wxPoint &aMoveVector)
virtual int BlockCommand(EDA_KEY aKey) override
Return the block command internal code (BLOCK_MOVE, BLOCK_DUPLICATE...) corresponding to the keys pre...
void AbortBlockCurrentCommand(EDA_DRAW_PANEL *aPanel, wxDC *aDC)
Function AbortBlockCurrentCommand cancels the current block operation.
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:935
SCH_MARKER class definition.
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 PushItem(const ITEM_PICKER &aItem)
Function PushItem pushes aItem to the top of the list.
virtual void Clear()
Function Clear() Removes all the stored items from the group.
Definition: view_group.cpp:74
bool TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
void ClearBlockCommand()
Definition: base_screen.h:501
virtual void HandleBlockPlace(wxDC *DC) override
Call after HandleBlockEnd, when a block command needs to be executed after the block is moved to its ...
EDA_ITEM * GetItem(unsigned aIndex)
BLOCK_STATE_T
virtual void MoveCursorToCrossHair()
Function MoveCursorToCrossHair warps the cursor to the current cross hair position.
wxPoint GetLastCursorPosition() const
unsigned GetCount() const
Function GetCount.
virtual void CallEndMouseCapture(wxDC *aDC)
Function CallEndMouseCapture calls the end mouse capture callback.
SCH_ITEM * GetCurItem() const
Return the currently selected SCH_ITEM, overriding BASE_SCREEN::GetCurItem().
Definition: sch_screen.h:196
virtual EDA_ITEM * Clone() const
Function Clone creates a duplicate of this item with linked list members set to NULL.
virtual PICKED_ITEMS_LIST * PopCommandFromUndoList()
PopCommandFromUndoList return the last command to undo and remove it from list nothing is deleted.
virtual EDA_DRAW_FRAME * GetParent() const =0
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
SCH_SHEET_PATH * m_CurrentSheet
which sheet we are presently working on.
timestamp_t GetNewTimeStamp()
Definition: common.cpp:216
void InitBlockPasteInfos() override
Initialize the parameters used by the block paste command.
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
SCH_SHEET * g_RootSheet
Definition: eeschema.cpp:56
int UpdatePickList()
Add all the items in the screen within the block selection rectangle to the pick list.
Definition: sch_screen.cpp:875
void SetName(const wxString &aName)
Definition: sch_sheet.h:269
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:216
SCH_ITEM * DuplicateStruct(SCH_ITEM *aDrawStruct, bool aClone=false)
Routine to create a new copy of given struct.
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:76
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 SaveCopyInUndoList(SCH_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, bool aAppend=false, const wxPoint &aTransformPoint=wxPoint(0, 0))
Create a copy of the current schematic item, and put it in the undo list.
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...
EDA_ITEM * GetPickedItem(unsigned int aIdx) const
Function GetPickedItem.
uint32_t EDA_KEY
Definition: common.h:74
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
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
void SetItem(EDA_ITEM *aItem)
void SelectBlockItems()
Create a list of items found when a block command is initiated.
Definition: sch_screen.cpp:731
Definition: solve.cpp:178
KIGFX::SCH_VIEW * GetView() const
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:209
void PutDataInPreviousState(PICKED_ITEMS_LIST *aList, bool aRedoCommand)
Restore an undo or redo command to put data pointed by aList in the previous state.
void AddToScreen(SCH_ITEM *aItem)
Add an item to the screen (and view)
wxString GetFileName(void) const
Return the filename corresponding to this sheet.
Definition: sch_sheet.cpp:662
wxPoint GetNearestGridPosition(const wxPoint &aPosition, wxRealPoint *aGridSize=NULL) const
Return the nearest aGridSize location to aPosition.
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:126
void copyBlockItems(PICKED_ITEMS_LIST &aItemsList, const wxPoint &aMoveVector)
Copy the list of block item.
Definition the SCH_COMPONENT class for Eeschema.
#define GR_KB_SHIFTCTRL
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
see class PGM_BASE
void CheckListConnections(PICKED_ITEMS_LIST &aItemsList, bool aAppend=false)
Adds junctions if needed to each item in the list after they have been moved.
BLOCK_SELECTOR m_blockItems
List of selected items.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
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 DeleteItemsInList(PICKED_ITEMS_LIST &aItemsList, bool aAppend=false)
Removes all items (and unused junctions that connect to them) and saves each in the undo list.
Class SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:70
PICKED_ITEMS_LIST & GetItems()
void PasteListOfItems(wxDC *DC)
Paste a list of items from the block stack.
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:257
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
virtual bool HandleBlockEnd(wxDC *aDC) override
Handle the "end" of a block command, i.e.
void ClearDrawingState()
Clear the state flags of all the items in the screen.
Definition: sch_screen.cpp:563
virtual const EDA_RECT GetBoundingBox() const
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.
Definition for part library class.
void ClearAnnotationOfNewSheetPaths(SCH_SHEET_LIST &aInitialSheetPathList)
Clear the annotation for the components inside new sheetpaths when a complex hierarchy is modified an...
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
void SetCrossHairPosition(const wxPoint &aPosition, bool aSnapToGrid=true)
Set the screen cross hair position to aPosition in logical (drawing) units.
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:258
bool TestForRecursion(const SCH_SHEET_LIST &aSrcSheetHierarchy, const wxString &aDestFileName) const
Function TestForRecursion.
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:243
Class SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container clas...
Implementation of the label properties dialog.
void SetSchItemParent(SCH_ITEM *Struct, SCH_SCREEN *Screen)
static void DrawMovingBlockOutlines(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aPosition, bool aErase)
virtual void SetMouseCaptureCallback(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback)
void ClearListAndDeleteItems()
Function ClearListAndDeleteItems deletes the list of pickers, AND the data pointed by m_PickedItem or...
int GetToolId() const
Definition: draw_frame.h:526
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:523
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:201
void SetTimeStamp(timestamp_t aNewTimeStamp)
Definition: base_struct.h:206
Color has changed.
Definition: view_item.h:57
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
virtual void Move(const wxPoint &aMoveVector)=0
Function Move moves the item by aMoveVector to a new position.