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 <schframe.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  SaveCopyInUndoList( block->GetItems(), UR_CHANGED, false, block->GetMoveVector() );
131  MoveItemsInList( block->GetItems(), block->GetMoveVector() );
132  break;
133 
134  case BLOCK_DUPLICATE: /* Duplicate */
135  case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
136  if( m_canvas->IsMouseCaptured() )
137  m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
138 
139  DuplicateItemsInList( GetScreen(), block->GetItems(), block->GetMoveVector() );
140 
141  SaveCopyInUndoList( block->GetItems(),
142  ( block->GetCommand() == BLOCK_PRESELECT_MOVE ) ? UR_CHANGED : UR_NEW );
143  break;
144 
145  case BLOCK_PASTE:
146  if( m_canvas->IsMouseCaptured() )
147  m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
148 
149  PasteListOfItems( DC );
150  break;
151 
152  default: // others are handled by HandleBlockEnd()
153  break;
154  }
155 
156  CheckListConnections( block->GetItems(), true );
157  block->ClearItemsList();
158  SchematicCleanUp( true );
159  OnModify();
160 
161  // clear dome flags and pointers
164  GetScreen()->SetCurItem( NULL );
166 
167  if( block->GetCount() )
168  {
169  DisplayError( this, wxT( "HandleBlockPLace() error: some items left in buffer" ) );
170  block->ClearItemsList();
171  }
172 
173  m_canvas->EndMouseCapture( GetToolId(), m_canvas->GetCurrentCursor(), wxEmptyString, false );
174  m_canvas->Refresh();
175 }
176 
177 
179 {
180  bool nextcmd = false;
181  bool zoom_command = false;
183 
184  if( block->GetCount() )
185  {
186  BLOCK_STATE_T state = block->GetState();
187  BLOCK_COMMAND_T command = block->GetCommand();
188 
190 
191  block->SetState( state );
192  block->SetCommand( command );
194  SetCrossHairPosition( block->GetEnd() );
195 
196  if( block->GetCommand() != BLOCK_ABORT )
198  }
199 
200  if( m_canvas->IsMouseCaptured() )
201  {
202  switch( block->GetCommand() )
203  {
204  case BLOCK_IDLE:
205  DisplayError( this, wxT( "Error in HandleBlockPLace()" ) );
206  break;
207 
208  case BLOCK_ROTATE:
210  DrawAndSizingBlockOutlines( m_canvas, aDC, wxDefaultPosition, false );
211 
212  if( block->GetCount() )
213  {
214  // Compute the rotation center and put it on grid:
215  wxPoint rotationPoint = block->Centre();
216  rotationPoint = GetNearestGridPosition( rotationPoint );
217  SetCrossHairPosition( rotationPoint );
218  SaveCopyInUndoList( block->GetItems(), UR_ROTATED, false, rotationPoint );
219  RotateListOfItems( block->GetItems(), rotationPoint );
220  CheckListConnections( block->GetItems(), true );
221  SchematicCleanUp( true );
222  OnModify();
223  }
224 
225  block->ClearItemsList();
227  m_canvas->Refresh();
228  break;
229 
230  case BLOCK_DRAG:
231  case BLOCK_DRAG_ITEM: // Drag from a drag command
232  case BLOCK_MOVE:
233  case BLOCK_DUPLICATE:
234  if( block->GetCommand() == BLOCK_DRAG_ITEM &&
235  GetScreen()->GetCurItem() != NULL )
236  {
237  // This is a drag command, not a mouse block command
238  // Only this item is put in list
239  ITEM_PICKER picker;
240  picker.SetItem( GetScreen()->GetCurItem() );
241  block->PushItem( picker );
242  }
243  else
244  {
245  // Collect all items in the locate block
247  }
248  // fall through
249 
250  case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
251  if( block->GetCount() )
252  {
253  nextcmd = true;
255  m_canvas->CallMouseCapture( aDC, wxDefaultPosition, false );
257  m_canvas->CallMouseCapture( aDC, wxDefaultPosition, false );
258  block->SetState( STATE_BLOCK_MOVE );
259  }
260  else
261  {
262  m_canvas->CallMouseCapture( aDC, wxDefaultPosition, false );
263  m_canvas->SetMouseCapture( NULL, NULL );
264  }
265  break;
266 
267  case BLOCK_DELETE:
269  DrawAndSizingBlockOutlines( m_canvas, aDC, wxDefaultPosition, false );
270 
271  if( block->GetCount() )
272  {
273  DeleteItemsInList( block->GetItems() );
274  SchematicCleanUp( true );
275  OnModify();
276  }
277  block->ClearItemsList();
279  m_canvas->Refresh();
280  break;
281 
282  case BLOCK_COPY: // Save a copy of items in paste buffer
284  DrawAndSizingBlockOutlines( m_canvas, aDC, wxDefaultPosition, false );
285 
286  if( block->GetCount() )
287  {
289  copyBlockItems( block->GetItems() );
290  MoveItemsInList( m_blockItems.GetItems(), move_vector );
291  }
292 
293  block->ClearItemsList();
294  break;
295 
296  case BLOCK_CUT:
298  DrawAndSizingBlockOutlines( m_canvas, aDC, wxDefaultPosition, false );
299 
300  if( block->GetCount() )
301  {
303  copyBlockItems( block->GetItems() );
304  MoveItemsInList( m_blockItems.GetItems(), move_vector );
305  DeleteItemsInList( block->GetItems() );
306  SchematicCleanUp( true );
307  OnModify();
308  }
309 
310  block->ClearItemsList();
312  m_canvas->Refresh();
313  break;
314 
315  case BLOCK_PASTE:
316  block->SetState( STATE_BLOCK_MOVE );
317  break;
318 
319  case BLOCK_ZOOM:
320  zoom_command = true;
321  break;
322 
323  case BLOCK_MIRROR_X:
325  DrawAndSizingBlockOutlines( m_canvas, aDC, wxDefaultPosition, false );
326 
327  if( block->GetCount() )
328  {
329  // Compute the mirror center and put it on grid.
330  wxPoint mirrorPoint = block->Centre();
331  mirrorPoint = GetNearestGridPosition( mirrorPoint );
332  SetCrossHairPosition( mirrorPoint );
333  SaveCopyInUndoList( block->GetItems(), UR_MIRRORED_X, false, mirrorPoint );
334  MirrorX( block->GetItems(), mirrorPoint );
335  SchematicCleanUp( true );
336  OnModify();
337  }
338 
339  block->ClearItemsList();
341  m_canvas->Refresh();
342  break;
343 
344  case BLOCK_MIRROR_Y:
346  DrawAndSizingBlockOutlines( m_canvas, aDC, wxDefaultPosition, false );
347 
348  if( block->GetCount() )
349  {
350  // Compute the mirror center and put it on grid.
351  wxPoint mirrorPoint = block->Centre();
352  mirrorPoint = GetNearestGridPosition( mirrorPoint );
353  SetCrossHairPosition( mirrorPoint );
354  SaveCopyInUndoList( block->GetItems(), UR_MIRRORED_Y, false, mirrorPoint );
355  MirrorY( block->GetItems(), mirrorPoint );
356  SchematicCleanUp( true );
357  OnModify();
358  }
359 
360  block->ClearItemsList();
362  m_canvas->Refresh();
363  break;
364 
365  default:
366  break;
367  }
368  }
369 
370  if( block->GetCommand() == BLOCK_ABORT )
371  {
373  m_canvas->Refresh();
374  }
375 
376  if( ! nextcmd )
377  {
378  block->SetState( STATE_NO_BLOCK );
379  block->SetCommand( BLOCK_IDLE );
380  GetScreen()->SetCurItem( NULL );
382  false );
383  }
384 
385  if( zoom_command )
386  Window_Zoom( GetScreen()->m_BlockLocate );
387 
388  return nextcmd;
389 }
390 
391 
392 /* Traces the outline of the search block structures
393  * The entire block follows the cursor
394  */
395 static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
396  bool aErase )
397 {
398  BASE_SCREEN* screen = aPanel->GetScreen();
399  BLOCK_SELECTOR* block = &screen->m_BlockLocate;
400  SCH_ITEM* schitem;
401 
402  /* Erase old block contents. */
403  if( aErase )
404  {
405  block->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, block->GetColor() );
406 
407  for( unsigned ii = 0; ii < block->GetCount(); ii++ )
408  {
409  schitem = (SCH_ITEM*) block->GetItem( ii );
410 
411  if( schitem->Type() == SCH_COMPONENT_T )
412  ((SCH_COMPONENT*)schitem)->Draw( aPanel, aDC, block->GetMoveVector(),
413  g_XorMode, g_GhostColor, false );
414  else
415  schitem->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, g_GhostColor );
416  }
417  }
418 
419  /* Repaint new view. */
420  block->SetMoveVector( aPanel->GetParent()->GetCrossHairPosition() - block->GetLastCursorPosition() );
421  block->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, block->GetColor() );
422 
423  for( unsigned ii = 0; ii < block->GetCount(); ii++ )
424  {
425  schitem = (SCH_ITEM*) block->GetItem( ii );
426 
427  if( schitem->Type() == SCH_COMPONENT_T )
428  ((SCH_COMPONENT*)schitem)->Draw( aPanel, aDC, block->GetMoveVector(),
429  g_XorMode, g_GhostColor, false );
430  else
431  schitem->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, g_GhostColor );
432  }
433 }
434 
435 
437 {
438  m_blockItems.ClearListAndDeleteItems(); // delete previous saved list, if exists
439 
440  for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ )
441  {
442  // Clear m_Flag member of selected items:
443  aItemsList.GetPickedItem( ii )->ClearFlags();
444 
445  /* Make a copy of the original picked item. */
446  SCH_ITEM* copy = DuplicateStruct( (SCH_ITEM*) aItemsList.GetPickedItem( ii ) );
447  copy->SetParent( NULL );
448 
449  // In list the wrapper is owner of the schematic item, we can use the UR_DELETED
450  // status for the picker because pickers with this status are owner of the picked item
451  // (or TODO ?: create a new status like UR_DUPLICATE)
452  ITEM_PICKER item( copy, UR_DELETED );
453 
454  m_blockItems.PushItem( item );
455  }
456 }
457 
458 
460 {
461  unsigned i;
462  SCH_ITEM* item;
463  SCH_SHEET_LIST hierarchy( g_RootSheet ); // This is the entire schematic hierarcy.
464 
465  if( m_blockItems.GetCount() == 0 )
466  {
467  DisplayError( this, _( "No item to paste." ) );
468  return;
469  }
470 
471  wxFileName destFn = m_CurrentSheet->Last()->GetFileName();
472 
473  if( destFn.IsRelative() )
474  destFn.MakeAbsolute( Prj().GetProjectPath() );
475 
476  // Make sure any sheets in the block to be pasted will not cause recursion in
477  // the destination sheet.
478  for( i = 0; i < m_blockItems.GetCount(); i++ )
479  {
480  item = (SCH_ITEM*) m_blockItems.GetItem( i );
481 
482  if( item->Type() == SCH_SHEET_T )
483  {
484  SCH_SHEET* sheet = (SCH_SHEET*)item;
485  wxFileName srcFn = sheet->GetFileName();
486 
487  if( srcFn.IsRelative() )
488  srcFn.MakeAbsolute( Prj().GetProjectPath() );
489 
490  SCH_SHEET_LIST sheetHierarchy( sheet );
491 
492  if( hierarchy.TestForRecursion( sheetHierarchy,
493  destFn.GetFullPath( wxPATH_UNIX ) ) )
494  {
495  wxString msg;
496 
497  msg.Printf( _( "The sheet changes cannot be made because the destination "
498  "sheet already has the sheet \"%s\" or one of it's subsheets "
499  "as a parent somewhere in the schematic hierarchy." ),
500  GetChars( sheet->GetFileName() ) );
501  DisplayError( this, msg );
502  return;
503  }
504 
505  // Duplicate sheet names and sheet time stamps are not valid. Use a time stamp
506  // based sheet name and update the time stamp for each sheet in the block.
507  timestamp_t timeStamp = GetNewTimeStamp();
508 
509  sheet->SetName( wxString::Format( wxT( "sheet%8.8lX" ), (unsigned long)timeStamp ) );
510  sheet->SetTimeStamp( timeStamp );
511  }
512  }
513 
514  PICKED_ITEMS_LIST picklist;
515 
516  for( i = 0; i < m_blockItems.GetCount(); i++ )
517  {
518  item = DuplicateStruct( (SCH_ITEM*) m_blockItems.GetItem( i ) );
519 
520  // Creates data, and push it as new data in undo item list buffer
521  ITEM_PICKER picker( item, UR_NEW );
522  picklist.PushItem( picker );
523 
524  // Clear annotation and init new time stamp for the new components and sheets:
525  if( item->Type() == SCH_COMPONENT_T )
526  {
527  ( (SCH_COMPONENT*) item )->SetTimeStamp( GetNewTimeStamp() );
528  ( (SCH_COMPONENT*) item )->ClearAnnotation( NULL );
529  }
530  else if( item->Type() == SCH_SHEET_T )
531  {
532  ( (SCH_SHEET*) item )->SetTimeStamp( GetNewTimeStamp() );
533  }
534 
535  SetSchItemParent( item, GetScreen() );
536  item->Draw( m_canvas, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
537  GetScreen()->Append( item );
538  }
539 
540  SaveCopyInUndoList( picklist, UR_NEW );
541 
542  MoveItemsInList( picklist, GetScreen()->m_BlockLocate.GetMoveVector() );
543 
544  // Clear flags for all items.
546 
547  OnModify();
548 
549  return;
550 }
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:225
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:171
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.
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:332
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 ...
Definition: schframe.cpp:774
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()
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:354
#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.
Definition: schframe.cpp:533
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.
Definition: schframe.h:121
timestamp_t GetNewTimeStamp()
Definition: common.cpp:166
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...
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:879
void SetName(const wxString &aName)
Definition: sch_sheet.h:269
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:240
SCH_ITEM * GetCurItem() const
Return the currently selected SCH_ITEM, overriding BASE_SCREEN::GetCurItem().
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 ...)
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
EDA_DRAW_FRAME * GetParent() const
Definition: draw_panel.cpp:181
wxPoint Centre() const
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 SetItem(EDA_ITEM *aItem)
void SelectBlockItems()
Create a list of items found when a block command is initiated.
Definition: sch_screen.cpp:735
#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:645
Definition: solve.cpp:178
void AbortBlockCurrentCommand(EDA_DRAW_PANEL *aPanel, wxDC *aDC)
Function AbortBlockCurrentCommand cancels the current block operation.
const wxPoint GetEnd() const
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:93
#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.
Definition: schframe.h:140
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)
bool TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
Definition: sch_screen.cpp:915
int GetToolId() const
Definition: draw_frame.h:480
#define MOUSE_MIDDLE
Definition: common.h:68
void SetCurItem(SCH_ITEM *aItem)
Sets the currently selected object, m_CurrentItem.
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:194
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:281
void Window_Zoom(EDA_RECT &Rect)
Compute the zoom factor and the new draw offset to draw the selected area (Rect) in full window scree...
Definition: zoom.cpp:103
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:584
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:74
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:57
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:230
void PushItem(ITEM_PICKER &aItem)
Function PushItem adds aItem to the list of items.