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-2016 Wayne Stambaugh <stambaughw@verizon.net>
6  * Copyright (C) 2004-2016 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 <class_drawpanel.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 
52 static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
53  const wxPoint& aPosition, bool aErase );
54 
56 {
57  int cmd = BLOCK_IDLE;
58 
59  switch( key )
60  {
61  default:
62  cmd = key & 0xFF;
63  break;
64 
65  case 0:
66  cmd = BLOCK_MOVE;
67  break;
68 
69  case GR_KB_SHIFT:
70  cmd = BLOCK_DUPLICATE;
71  break;
72 
73  case GR_KB_ALT:
74  cmd = BLOCK_ROTATE;
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  if( !m_canvas->IsMouseCaptured() )
108  {
109  DisplayError( this, wxT( "HandleBlockPLace() : m_mouseCaptureCallback = NULL" ) );
110  }
111 
112  if( block->GetCount() == 0 )
113  {
114  wxString msg;
115  msg.Printf( wxT( "HandleBlockPLace() error : no items to place (cmd %d, state %d)" ),
116  block->GetCommand(), block->GetState() );
117  DisplayError( this, msg );
118  }
119 
120  block->SetState( STATE_BLOCK_STOP );
121 
122  switch( block->GetCommand() )
123  {
124  case BLOCK_DRAG: // Drag from mouse
125  case BLOCK_DRAG_ITEM: // Drag from a component selection and drag command
126  case BLOCK_MOVE:
127  if( m_canvas->IsMouseCaptured() )
128  m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
129 
130  // If the block wasn't changed, don't update the schematic
131  if( block->GetMoveVector() == wxPoint( 0, 0 ) )
132  {
133  // This calls the block-abort command routine on cleanup
135  return;
136  }
137 
138  SaveCopyInUndoList( block->GetItems(), UR_CHANGED, false, block->GetMoveVector() );
139  MoveItemsInList( block->GetItems(), block->GetMoveVector() );
140  break;
141 
142  case BLOCK_DUPLICATE: /* Duplicate */
143  case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
144  if( m_canvas->IsMouseCaptured() )
145  m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
146 
147  DuplicateItemsInList( GetScreen(), block->GetItems(), block->GetMoveVector() );
148 
149  SaveCopyInUndoList( block->GetItems(),
150  ( block->GetCommand() == BLOCK_PRESELECT_MOVE ) ? UR_CHANGED : UR_NEW );
151  break;
152 
153  case BLOCK_PASTE:
154  if( m_canvas->IsMouseCaptured() )
155  m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
156 
157  PasteListOfItems( DC );
158  break;
159 
160  default: // others are handled by HandleBlockEnd()
161  break;
162  }
163 
164  CheckListConnections( block->GetItems(), true );
165  block->ClearItemsList();
166  SchematicCleanUp( true );
167  OnModify();
168 
169  // clear dome flags and pointers
172  GetScreen()->SetCurItem( NULL );
174 
175  if( block->GetCount() )
176  {
177  DisplayError( this, wxT( "HandleBlockPLace() error: some items left in buffer" ) );
178  block->ClearItemsList();
179  }
180 
181  m_canvas->EndMouseCapture( GetToolId(), m_canvas->GetCurrentCursor(), wxEmptyString, false );
182  m_canvas->Refresh();
183 }
184 
185 
187 {
188  bool nextcmd = false;
189  bool zoom_command = false;
190  bool append = false;
192 
193  if( block->GetCount() )
194  {
195  BLOCK_STATE_T state = block->GetState();
196  BLOCK_COMMAND_T command = block->GetCommand();
197 
199 
200  block->SetState( state );
201  block->SetCommand( command );
203  SetCrossHairPosition( block->GetEnd() );
204 
205  if( block->GetCommand() != BLOCK_ABORT )
207  }
208 
209  if( m_canvas->IsMouseCaptured() )
210  {
211  switch( block->GetCommand() )
212  {
213  case BLOCK_IDLE:
214  DisplayError( this, wxT( "Error in HandleBlockPLace()" ) );
215  break;
216 
217  case BLOCK_ROTATE:
219  DrawAndSizingBlockOutlines( m_canvas, aDC, wxDefaultPosition, false );
220 
221  if( block->GetCount() )
222  {
223  // Compute the rotation center and put it on grid:
224  wxPoint rotationPoint = block->Centre();
225  rotationPoint = GetNearestGridPosition( rotationPoint );
226  SetCrossHairPosition( rotationPoint );
227  SaveCopyInUndoList( block->GetItems(), UR_ROTATED, false, rotationPoint );
228  RotateListOfItems( block->GetItems(), rotationPoint );
229  CheckListConnections( block->GetItems(), true );
230  SchematicCleanUp( true );
231  OnModify();
232  }
233 
234  block->ClearItemsList();
236  m_canvas->Refresh();
237  break;
238 
239  case BLOCK_DRAG:
240  case BLOCK_DRAG_ITEM: // Drag from a drag command
241  case BLOCK_MOVE:
242  case BLOCK_DUPLICATE:
243  if( block->GetCommand() == BLOCK_DRAG_ITEM &&
244  GetScreen()->GetCurItem() != NULL )
245  {
246  // This is a drag command, not a mouse block command
247  // Only this item is put in list
248  ITEM_PICKER picker;
249  picker.SetItem( GetScreen()->GetCurItem() );
250  block->PushItem( picker );
251  }
252  else
253  {
254  // Collect all items in the locate block
256  }
257  // fall through
258 
259  case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
260  if( block->GetCount() )
261  {
262  nextcmd = true;
264  if( block->GetCommand() != BLOCK_DUPLICATE )
265  block->SetFlags( IS_MOVED );
266 
267  m_canvas->CallMouseCapture( aDC, wxDefaultPosition, false );
269  m_canvas->CallMouseCapture( aDC, wxDefaultPosition, false );
270  block->SetState( STATE_BLOCK_MOVE );
271  }
272  else
273  {
274  m_canvas->CallMouseCapture( aDC, wxDefaultPosition, false );
275  m_canvas->SetMouseCapture( NULL, NULL );
276  }
277  break;
278 
279  case BLOCK_CUT:
280  case BLOCK_DELETE:
282  DrawAndSizingBlockOutlines( m_canvas, aDC, wxDefaultPosition, false );
283 
284  // The CUT variant needs to copy the items from their originial position
285  if( ( block->GetCommand() == BLOCK_CUT ) && block->GetCount() )
286  {
288  copyBlockItems( block->GetItems() );
289  MoveItemsInList( m_blockItems.GetItems(), move_vector );
290  }
291 
292  // We set this in a while loop to catch any newly created items
293  // as a result of the delete (e.g. merged wires)
294  while( block->GetCount() )
295  {
296  DeleteItemsInList( block->GetItems(), append );
297  SchematicCleanUp( true );
298  OnModify();
299  block->ClearItemsList();
301  append = true;
302  }
303 
305  m_canvas->Refresh();
306  break;
307 
308  case BLOCK_COPY: // Save a copy of items in paste buffer
310  DrawAndSizingBlockOutlines( m_canvas, aDC, wxDefaultPosition, false );
311 
312  if( block->GetCount() )
313  {
315  copyBlockItems( block->GetItems() );
316  MoveItemsInList( m_blockItems.GetItems(), move_vector );
317  }
318 
319  block->ClearItemsList();
320  break;
321 
322  case BLOCK_PASTE:
323  block->SetState( STATE_BLOCK_MOVE );
324  break;
325 
326  case BLOCK_ZOOM:
327  zoom_command = true;
328  break;
329 
330  case BLOCK_MIRROR_X:
332  DrawAndSizingBlockOutlines( m_canvas, aDC, wxDefaultPosition, false );
333 
334  if( block->GetCount() )
335  {
336  // Compute the mirror center and put it on grid.
337  wxPoint mirrorPoint = block->Centre();
338  mirrorPoint = GetNearestGridPosition( mirrorPoint );
339  SetCrossHairPosition( mirrorPoint );
340  SaveCopyInUndoList( block->GetItems(), UR_MIRRORED_X, false, mirrorPoint );
341  MirrorX( block->GetItems(), mirrorPoint );
342  SchematicCleanUp( true );
343  OnModify();
344  }
345 
346  block->ClearItemsList();
348  m_canvas->Refresh();
349  break;
350 
351  case BLOCK_MIRROR_Y:
353  DrawAndSizingBlockOutlines( m_canvas, aDC, wxDefaultPosition, false );
354 
355  if( block->GetCount() )
356  {
357  // Compute the mirror center and put it on grid.
358  wxPoint mirrorPoint = block->Centre();
359  mirrorPoint = GetNearestGridPosition( mirrorPoint );
360  SetCrossHairPosition( mirrorPoint );
361  SaveCopyInUndoList( block->GetItems(), UR_MIRRORED_Y, false, mirrorPoint );
362  MirrorY( block->GetItems(), mirrorPoint );
363  SchematicCleanUp( true );
364  OnModify();
365  }
366 
367  block->ClearItemsList();
369  m_canvas->Refresh();
370  break;
371 
372  default:
373  break;
374  }
375  }
376 
377  if( block->GetCommand() == BLOCK_ABORT )
378  {
380  m_canvas->Refresh();
381  }
382 
383  if( ! nextcmd )
384  {
385  block->SetState( STATE_NO_BLOCK );
386  block->SetCommand( BLOCK_IDLE );
387  GetScreen()->SetCurItem( NULL );
389  false );
390  }
391 
392  if( zoom_command )
393  Window_Zoom( GetScreen()->m_BlockLocate );
394 
395  return nextcmd;
396 }
397 
398 
399 /* Traces the outline of the search block structures
400  * The entire block follows the cursor
401  */
402 static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
403  bool aErase )
404 {
405  BASE_SCREEN* screen = aPanel->GetScreen();
406  BLOCK_SELECTOR* block = &screen->m_BlockLocate;
407  SCH_ITEM* schitem;
408 
409  /* Erase old block contents. */
410  if( aErase )
411  {
412  block->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, block->GetColor() );
413 
414  for( unsigned ii = 0; ii < block->GetCount(); ii++ )
415  {
416  schitem = (SCH_ITEM*) block->GetItem( ii );
417 
418  if( schitem->Type() == SCH_COMPONENT_T )
419  ((SCH_COMPONENT*)schitem)->Draw( aPanel, aDC, block->GetMoveVector(),
420  g_XorMode, g_GhostColor, false );
421  else
422  schitem->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, g_GhostColor );
423  }
424  }
425 
426  /* Repaint new view. */
427  block->SetMoveVector( aPanel->GetParent()->GetCrossHairPosition() - block->GetLastCursorPosition() );
428  block->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, block->GetColor() );
429 
430  for( unsigned ii = 0; ii < block->GetCount(); ii++ )
431  {
432  schitem = (SCH_ITEM*) block->GetItem( ii );
433 
434  if( schitem->Type() == SCH_COMPONENT_T )
435  ((SCH_COMPONENT*)schitem)->Draw( aPanel, aDC, block->GetMoveVector(),
436  g_XorMode, g_GhostColor, false );
437  else
438  schitem->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, g_GhostColor );
439  }
440 }
441 
442 
444 {
445  m_blockItems.ClearListAndDeleteItems(); // delete previous saved list, if exists
446 
447  for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ )
448  {
449  // Clear m_Flag member of selected items:
450  aItemsList.GetPickedItem( ii )->ClearFlags();
451 
452  /* Make a copy of the original picked item. */
453  SCH_ITEM* copy = DuplicateStruct( (SCH_ITEM*) aItemsList.GetPickedItem( ii ) );
454  copy->SetParent( NULL );
455  copy->SetFlags( copy->GetFlags() | UR_TRANSIENT );
456  ITEM_PICKER item( copy, UR_NEW );
457 
458  m_blockItems.PushItem( item );
459  }
460 }
461 
462 
464 {
465  unsigned i;
466  SCH_ITEM* item;
467  SCH_SHEET_LIST hierarchy( g_RootSheet ); // This is the entire schematic hierarcy.
468 
469  if( m_blockItems.GetCount() == 0 )
470  {
471  DisplayError( this, _( "No item to paste." ) );
472  return;
473  }
474 
475  wxFileName destFn = m_CurrentSheet->Last()->GetFileName();
476 
477  if( destFn.IsRelative() )
478  destFn.MakeAbsolute( Prj().GetProjectPath() );
479 
480  // Make sure any sheets in the block to be pasted will not cause recursion in
481  // the destination sheet.
482  for( i = 0; i < m_blockItems.GetCount(); i++ )
483  {
484  item = (SCH_ITEM*) m_blockItems.GetItem( i );
485 
486  if( item->Type() == SCH_SHEET_T )
487  {
488  SCH_SHEET* sheet = (SCH_SHEET*)item;
489  wxFileName srcFn = sheet->GetFileName();
490 
491  if( srcFn.IsRelative() )
492  srcFn.MakeAbsolute( Prj().GetProjectPath() );
493 
494  SCH_SHEET_LIST sheetHierarchy( sheet );
495 
496  if( hierarchy.TestForRecursion( sheetHierarchy,
497  destFn.GetFullPath( wxPATH_UNIX ) ) )
498  {
499  wxString msg;
500 
501  msg.Printf( _( "The sheet changes cannot be made because the destination "
502  "sheet already has the sheet \"%s\" or one of it's subsheets "
503  "as a parent somewhere in the schematic hierarchy." ),
504  GetChars( sheet->GetFileName() ) );
505  DisplayError( this, msg );
506  return;
507  }
508 
509  // Duplicate sheet names and sheet time stamps are not valid. Use a time stamp
510  // based sheet name and update the time stamp for each sheet in the block.
511  timestamp_t timeStamp = GetNewTimeStamp();
512 
513  sheet->SetName( wxString::Format( wxT( "sheet%8.8lX" ), (unsigned long)timeStamp ) );
514  sheet->SetTimeStamp( timeStamp );
515  }
516  }
517 
518  PICKED_ITEMS_LIST picklist;
519 
520  for( i = 0; i < m_blockItems.GetCount(); i++ )
521  {
522  item = DuplicateStruct( (SCH_ITEM*) m_blockItems.GetItem( i ) );
523 
524  // Creates data, and push it as new data in undo item list buffer
525  ITEM_PICKER picker( item, UR_NEW );
526  picklist.PushItem( picker );
527 
528  // Clear annotation and init new time stamp for the new components and sheets:
529  if( item->Type() == SCH_COMPONENT_T )
530  {
531  SCH_COMPONENT* cmp = static_cast<SCH_COMPONENT*>( item );
532  cmp->SetTimeStamp( GetNewTimeStamp() );
533 
534  // clear the annotation, but preserve the selected unit
535  int unit = cmp->GetUnit();
536  cmp->ClearAnnotation( NULL );
537  cmp->SetUnit( unit );
538  }
539  else if( item->Type() == SCH_SHEET_T )
540  {
541  ( (SCH_SHEET*) item )->SetTimeStamp( GetNewTimeStamp() );
542  }
543 
544  SetSchItemParent( item, GetScreen() );
545  item->Draw( m_canvas, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
546  GetScreen()->Append( item );
547  }
548 
549  SaveCopyInUndoList( picklist, UR_NEW );
550 
551  MoveItemsInList( picklist, GetScreen()->m_BlockLocate.GetMoveVector() );
552 
553  // Clear flags for all items.
555 
556  OnModify();
557 
558  return;
559 }
Definition of the SCH_SHEET class for Eeschema.
GR_DRAWMODE g_XorMode
Definition: gr_basic.cpp:73
Class SCH_SHEET_LIST.
KICAD_T Type() const
Function Type()
Definition: base_struct.h:209
void SetTimeStamp(timestamp_t aNewTimeStamp)
Change the time stamp to aNewTimeStamp and updates the reference path.
long timestamp_t
timestamp_t is our type to represent unique IDs for all kinds of elements; historically simply the ti...
Definition: base_struct.h:155
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:266
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 RotateListOfItems(PICKED_ITEMS_LIST &aItemsList, const wxPoint &rotationPoint)
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Update the board display after modifying it bu a python script (note: it is automatically called by a...
Definition: draw_panel.cpp:338
void Draw(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aOffset, GR_DRAWMODE aDrawMode, COLOR4D aColor)
This file is part of the common library.
void MirrorX(PICKED_ITEMS_LIST &aItemsList, const wxPoint &aMirrorPoint)
void OnModify()
Must be called after a schematic change in order to set the "modify" flag of the current screen* and ...
virtual int BlockCommand(EDA_KEY aKey) override
Return the block command internal code (BLOCK_MOVE, BLOCK_DUPLICATE...) corresponding to the keys pre...
int GetCurrentCursor() const
Function GetCurrentCursor.
void SetMoveVector(const wxPoint &aMoveVector)
void copyBlockItems(PICKED_ITEMS_LIST &aItemsList)
Copy the list of block item.
void EndMouseCapture(int aId=-1, int aCursorId=-1, const wxString &aTitle=wxEmptyString, bool aCallEndFunc=true)
Function EndMouseCapture ends mouse a capture.
BLOCK_COMMAND_T
void PushItem(const ITEM_PICKER &aItem)
Function PushItem pushes aItem to the top of the list.
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
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...
void MoveCursorToCrossHair()
Function MoveCursorToCrossHair warps the cursor to the current cross hair position.
Definition: draw_panel.cpp:360
#define GR_KB_ALT
Definition: common.h:65
void CallEndMouseCapture(wxDC *aDC)
Function CallEndMouseCapture calls the end mouse capture callback.
void ClearItemsList()
Function ClearItemsList clear only the list of EDA_ITEM pointers, it does NOT delete the EDA_ITEM obj...
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
void SetState(BLOCK_STATE_T aState)
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
SCH_SHEET_PATH * m_CurrentSheet
which sheet we are presently working on.
timestamp_t GetNewTimeStamp()
Definition: common.cpp:167
void CopyList(const PICKED_ITEMS_LIST &aSource)
Function CopyList copies all data from aSource to the list.
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:264
SCH_SHEET * g_RootSheet
Definition: eeschema.cpp:55
COLOR4D GetColor() const
int UpdatePickList()
Add all the items in the screen within the block selection rectangle to the pick list.
Definition: sch_screen.cpp:877
void SetName(const wxString &aName)
Definition: sch_sheet.h:269
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:224
SCH_ITEM * GetCurItem() const
Return the currently selected SCH_ITEM, overriding BASE_SCREEN::GetCurItem().
Definition: sch_screen.h:174
SCH_ITEM * DuplicateStruct(SCH_ITEM *aDrawStruct, bool aClone=false)
Routine to create a new copy of given struct.
#define GR_KB_SHIFT
Definition: common.h:66
bool IsMouseCaptured() const
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:76
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 CallMouseCapture(wxDC *aDC, const wxPoint &aPosition, bool aErase)
Function CallMouseCapture calls the mouse capture callback.
void DuplicateItemsInList(SCH_SCREEN *screen, PICKED_ITEMS_LIST &aItemsList, const wxPoint &aMoveVector)
Routine to copy a new entity of an object for each object in list and reposition it.
uint32_t EDA_KEY
Definition: common.h:52
void SetFlags(const STATUS_FLAGS aFlag)
Function SetFlags sets a status flag on each item in a block selector.
EDA_DRAW_FRAME * GetParent() const
Definition: draw_panel.cpp:180
void SetUnit(int aUnit)
Change the unit number to aUnit.
int GetUnit() const
wxPoint Centre() const
Definition: eda_rect.h:60
Class PICKED_ITEMS_LIST is a holder to handle information on schematic or board items.
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...
void ClearAnnotation(SCH_SHEET_PATH *aSheetPath)
Clear exiting component annotation.
void SetItem(EDA_ITEM *aItem)
void SelectBlockItems()
Create a list of items found when a block command is initiated.
Definition: sch_screen.cpp:733
#define GR_KB_SHIFTCTRL
Definition: common.h:67
void SetMouseCaptureCallback(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback)
wxString GetFileName(void) const
Return the filename corresponding to this sheet.
Definition: sch_sheet.cpp:646
Definition: solve.cpp:178
void AbortBlockCurrentCommand(EDA_DRAW_PANEL *aPanel, wxDC *aDC)
Function AbortBlockCurrentCommand cancels the current block operation.
const wxPoint GetEnd() const
Definition: eda_rect.h:114
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:209
unsigned GetCount() const
Function GetCount.
void MirrorY(PICKED_ITEMS_LIST &aItemsList, const wxPoint &aMirrorPoint)
wxPoint GetLastCursorPosition() const
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:98
#define GR_DEFAULT_DRAWMODE
Definition: general.h:70
Definition the SCH_COMPONENT class for Eeschema.
wxPoint GetNearestGridPosition(const wxPoint &aPosition, wxRealPoint *aGridSize=NULL) const
Function GetNearestGridPosition returns the nearest aGridSize location to aPosition.
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
EDA_ITEM * GetPickedItem(unsigned int aIdx) const
Function GetPickedItem.
BLOCK_STATE_T GetState() const
void Append(SCH_ITEM *aItem)
Definition: sch_screen.h:140
bool TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
Definition: sch_screen.cpp:913
int GetToolId() const
Definition: draw_frame.h:488
#define MOUSE_MIDDLE
Definition: common.h:68
void SetCurItem(SCH_ITEM *aItem)
Sets the currently selected object, m_CurrentItem.
Definition: sch_screen.h:182
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:69
BASE_SCREEN * GetScreen()
Definition: draw_panel.cpp:193
PICKED_ITEMS_LIST & GetItems()
void MoveItemsInList(PICKED_ITEMS_LIST &aItemsList, const wxPoint &aMoveVector)
Function MoveItemsInList Move a list of items to a given move vector.
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:265
#define UR_TRANSIENT
indicates the item is owned by the undo/redo stack
Definition: base_struct.h:137
void Window_Zoom(EDA_RECT &Rect)
Definition: zoom.cpp:124
BLOCK_COMMAND_T GetCommand() const
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:582
Definition for part library class.
void SetMouseCapture(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback, END_MOUSE_CAPTURE_CALLBACK aEndMouseCaptureCallback)
Function SetMouseCapture sets the mouse capture and end mouse capture callbacks to aMouseCaptureCallb...
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
void SetCrossHairPosition(const wxPoint &aPosition, bool aSnapToGrid=true)
Function SetCrossHairPosition sets the screen cross hair position to aPosition in logical (drawing) u...
#define GR_KB_CTRL
Definition: common.h:64
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:185
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
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.
unsigned GetCount() const
virtual void Draw(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aOffset, GR_DRAWMODE aDrawMode, COLOR4D aColor=COLOR4D::UNSPECIFIED)=0
Function Draw Draw a schematic item.
void SetSchItemParent(SCH_ITEM *Struct, SCH_SCREEN *Screen)
static void DrawMovingBlockOutlines(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aPosition, bool aErase)
COLOR4D g_GhostColor
Draw color for moving objects.
Definition: common.cpp:58
bool TestForRecursion(const SCH_SHEET_LIST &aSrcSheetHierarchy, const wxString &aDestFileName) const
Function TestForRecursion.
void SetCommand(BLOCK_COMMAND_T aCommand)
wxPoint GetMoveVector() const
void SetTimeStamp(timestamp_t aNewTimeStamp)
Definition: base_struct.h:214
void PushItem(ITEM_PICKER &aItem)
Function PushItem adds aItem to the list of items.
#define IS_MOVED
Item being moved.
Definition: base_struct.h:108