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 <protos.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 
51 // Imported functions:
52 extern void SetSchItemParent( SCH_ITEM* Struct, SCH_SCREEN* Screen );
53 extern void MoveItemsInList( PICKED_ITEMS_LIST& aItemsList, const wxPoint aMoveVector );
54 extern void RotateListOfItems( PICKED_ITEMS_LIST& aItemsList, wxPoint& Center );
55 extern void MirrorX( PICKED_ITEMS_LIST& aItemsList, wxPoint& aMirrorPoint );
56 extern void MirrorY( PICKED_ITEMS_LIST& aItemsList, wxPoint& Center );
57 extern void DuplicateItemsInList( SCH_SCREEN* screen,
58  PICKED_ITEMS_LIST& aItemsList,
59  const wxPoint aMoveVector );
60 
61 static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
62  const wxPoint& aPosition, bool aErase );
63 
64 
66 {
67  int cmd = BLOCK_IDLE;
68 
69  switch( key )
70  {
71  default:
72  cmd = key & 0xFF;
73  break;
74 
75  case 0:
76  cmd = BLOCK_MOVE;
77  break;
78 
79  case GR_KB_SHIFT:
80  cmd = BLOCK_DUPLICATE;
81  break;
82 
83  case GR_KB_ALT:
84  cmd = BLOCK_ROTATE;
85  break;
86 
87  case GR_KB_CTRL:
88  cmd = BLOCK_DRAG;
89  break;
90 
91  case GR_KB_SHIFTCTRL:
92  cmd = BLOCK_DELETE;
93  break;
94 
95  case MOUSE_MIDDLE:
96  cmd = BLOCK_ZOOM;
97  break;
98  }
99 
100  return cmd;
101 }
102 
103 
105 {
107 
108  block->GetItems().CopyList( m_blockItems.GetItems() );
110 }
111 
112 
114 {
116 
117  if( !m_canvas->IsMouseCaptured() )
118  {
119  DisplayError( this, wxT( "HandleBlockPLace() : m_mouseCaptureCallback = NULL" ) );
120  }
121 
122  if( block->GetCount() == 0 )
123  {
124  wxString msg;
125  msg.Printf( wxT( "HandleBlockPLace() error : no items to place (cmd %d, state %d)" ),
126  block->GetCommand(), block->GetState() );
127  DisplayError( this, msg );
128  }
129 
130  block->SetState( STATE_BLOCK_STOP );
131 
132  switch( block->GetCommand() )
133  {
134  case BLOCK_DRAG: // Drag from mouse
135  case BLOCK_DRAG_ITEM: // Drag from a component selection and drag command
136  case BLOCK_MOVE:
137  if( m_canvas->IsMouseCaptured() )
138  m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
139 
140  SaveCopyInUndoList( block->GetItems(), UR_MOVED, block->GetMoveVector() );
141  MoveItemsInList( block->GetItems(), block->GetMoveVector() );
142  block->ClearItemsList();
143  break;
144 
145  case BLOCK_DUPLICATE: /* Duplicate */
146  case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
147  if( m_canvas->IsMouseCaptured() )
148  m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
149 
150  DuplicateItemsInList( GetScreen(), block->GetItems(), block->GetMoveVector() );
151 
152  SaveCopyInUndoList( block->GetItems(),
153  ( block->GetCommand() == BLOCK_PRESELECT_MOVE ) ? UR_CHANGED : UR_NEW );
154 
155  block->ClearItemsList();
156  break;
157 
158  case BLOCK_PASTE:
159  if( m_canvas->IsMouseCaptured() )
160  m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
161 
162  PasteListOfItems( DC );
163  block->ClearItemsList();
164  break;
165 
166  default: // others are handled by HandleBlockEnd()
167  break;
168  }
169 
170  OnModify();
171 
172  // clear dome flags and pointers
175  GetScreen()->SetCurItem( NULL );
177 
178  if( block->GetCount() )
179  {
180  DisplayError( this, wxT( "HandleBlockPLace() error: some items left in buffer" ) );
181  block->ClearItemsList();
182  }
183 
184  m_canvas->EndMouseCapture( GetToolId(), m_canvas->GetCurrentCursor(), wxEmptyString, false );
185  m_canvas->Refresh();
186 }
187 
188 
190 {
191  bool nextcmd = false;
192  bool zoom_command = false;
194 
195  if( block->GetCount() )
196  {
197  BLOCK_STATE_T state = block->GetState();
198  BLOCK_COMMAND_T command = block->GetCommand();
199 
201 
202  block->SetState( state );
203  block->SetCommand( command );
205  SetCrossHairPosition( block->GetEnd() );
206 
207  if( block->GetCommand() != BLOCK_ABORT )
209  }
210 
211  if( m_canvas->IsMouseCaptured() )
212  {
213  switch( block->GetCommand() )
214  {
215  case BLOCK_IDLE:
216  DisplayError( this, wxT( "Error in HandleBlockPLace()" ) );
217  break;
218 
219  case BLOCK_ROTATE:
221  DrawAndSizingBlockOutlines( m_canvas, aDC, wxDefaultPosition, false );
222 
223  if( block->GetCount() )
224  {
225  // Compute the rotation center and put it on grid:
226  wxPoint rotationPoint = block->Centre();
227  rotationPoint = GetNearestGridPosition( rotationPoint );
228  SetCrossHairPosition( rotationPoint );
229  SaveCopyInUndoList( block->GetItems(), UR_ROTATED, rotationPoint );
230  RotateListOfItems( block->GetItems(), rotationPoint );
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
242  // fall through
243 
244  case BLOCK_MOVE:
245  case BLOCK_DUPLICATE:
246  if( block->GetCommand() == BLOCK_DRAG_ITEM &&
247  GetScreen()->GetCurItem() != NULL )
248  {
249  // This is a drag command, not a mouse block command
250  // Only this item is put in list
251  ITEM_PICKER picker;
252  picker.SetItem( GetScreen()->GetCurItem() );
253  block->PushItem( picker );
254  }
255  else
256  {
257  // Collect all items in the locate block
259  }
260  // fall through
261 
262  case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
263  if( block->GetCount() )
264  {
265  nextcmd = true;
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_DELETE:
281  DrawAndSizingBlockOutlines( m_canvas, aDC, wxDefaultPosition, false );
282 
283  if( block->GetCount() )
284  {
285  DeleteItemsInList( m_canvas, block->GetItems() );
286  OnModify();
287  }
288  block->ClearItemsList();
290  m_canvas->Refresh();
291  break;
292 
293  case BLOCK_COPY: // Save a copy of items in paste buffer
295  DrawAndSizingBlockOutlines( m_canvas, aDC, wxDefaultPosition, false );
296 
297  if( block->GetCount() )
298  {
300  copyBlockItems( block->GetItems() );
301  MoveItemsInList( m_blockItems.GetItems(), move_vector );
302  }
303 
304  block->ClearItemsList();
305  break;
306 
307  case BLOCK_CUT:
309  DrawAndSizingBlockOutlines( m_canvas, aDC, wxDefaultPosition, false );
310 
311  if( block->GetCount() )
312  {
314  copyBlockItems( block->GetItems() );
315  MoveItemsInList( m_blockItems.GetItems(), move_vector );
316  DeleteItemsInList( m_canvas, block->GetItems() );
317  OnModify();
318  }
319 
320  block->ClearItemsList();
322  m_canvas->Refresh();
323  break;
324 
325  case BLOCK_PASTE:
326  block->SetState( STATE_BLOCK_MOVE );
327  break;
328 
329  case BLOCK_ZOOM:
330  zoom_command = true;
331  break;
332 
333  case BLOCK_MIRROR_X:
335  DrawAndSizingBlockOutlines( m_canvas, aDC, wxDefaultPosition, false );
336 
337  if( block->GetCount() )
338  {
339  // Compute the mirror center and put it on grid.
340  wxPoint mirrorPoint = block->Centre();
341  mirrorPoint = GetNearestGridPosition( mirrorPoint );
342  SetCrossHairPosition( mirrorPoint );
343  SaveCopyInUndoList( block->GetItems(), UR_MIRRORED_X, mirrorPoint );
344  MirrorX( block->GetItems(), mirrorPoint );
345  OnModify();
346  }
347 
349  m_canvas->Refresh();
350  break;
351 
352  case BLOCK_MIRROR_Y:
354  DrawAndSizingBlockOutlines( m_canvas, aDC, wxDefaultPosition, false );
355 
356  if( block->GetCount() )
357  {
358  // Compute the mirror center and put it on grid.
359  wxPoint mirrorPoint = block->Centre();
360  mirrorPoint = GetNearestGridPosition( mirrorPoint );
361  SetCrossHairPosition( mirrorPoint );
362  SaveCopyInUndoList( block->GetItems(), UR_MIRRORED_Y, mirrorPoint );
363  MirrorY( block->GetItems(), mirrorPoint );
364  OnModify();
365  }
366 
368  m_canvas->Refresh();
369  break;
370 
371  default:
372  break;
373  }
374  }
375 
376  if( block->GetCommand() == BLOCK_ABORT )
377  {
379  m_canvas->Refresh();
380  }
381 
382  if( ! nextcmd )
383  {
384  block->SetState( STATE_NO_BLOCK );
385  block->SetCommand( BLOCK_IDLE );
386  GetScreen()->SetCurItem( NULL );
388  false );
389  }
390 
391  if( zoom_command )
392  Window_Zoom( GetScreen()->m_BlockLocate );
393 
394  return nextcmd;
395 }
396 
397 
398 /* Traces the outline of the search block structures
399  * The entire block follows the cursor
400  */
401 static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
402  bool aErase )
403 {
404  BASE_SCREEN* screen = aPanel->GetScreen();
405  BLOCK_SELECTOR* block = &screen->m_BlockLocate;
406  SCH_ITEM* schitem;
407 
408  /* Erase old block contents. */
409  if( aErase )
410  {
411  block->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, block->GetColor() );
412 
413  for( unsigned ii = 0; ii < block->GetCount(); ii++ )
414  {
415  schitem = (SCH_ITEM*) block->GetItem( ii );
416 
417  if( schitem->Type() == SCH_COMPONENT_T )
418  ((SCH_COMPONENT*)schitem)->Draw( aPanel, aDC, block->GetMoveVector(),
419  g_XorMode, g_GhostColor, false );
420  else
421  schitem->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, g_GhostColor );
422  }
423  }
424 
425  /* Repaint new view. */
426  block->SetMoveVector( aPanel->GetParent()->GetCrossHairPosition() - block->GetLastCursorPosition() );
427  block->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, block->GetColor() );
428 
429  for( unsigned ii = 0; ii < block->GetCount(); ii++ )
430  {
431  schitem = (SCH_ITEM*) block->GetItem( ii );
432 
433  if( schitem->Type() == SCH_COMPONENT_T )
434  ((SCH_COMPONENT*)schitem)->Draw( aPanel, aDC, block->GetMoveVector(),
435  g_XorMode, g_GhostColor, false );
436  else
437  schitem->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, g_GhostColor );
438  }
439 }
440 
441 
443 {
444  m_blockItems.ClearListAndDeleteItems(); // delete previous saved list, if exists
445 
446  for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ )
447  {
448  // Clear m_Flag member of selected items:
449  aItemsList.GetPickedItem( ii )->ClearFlags();
450 
451  /* Make a copy of the original picked item. */
452  SCH_ITEM* copy = DuplicateStruct( (SCH_ITEM*) aItemsList.GetPickedItem( ii ) );
453  copy->SetParent( NULL );
454 
455  // In list the wrapper is owner of the schematic item, we can use the UR_DELETED
456  // status for the picker because pickers with this status are owner of the picked item
457  // (or TODO ?: create a new status like UR_DUPLICATE)
458  ITEM_PICKER item( copy, UR_DELETED );
459 
460  m_blockItems.PushItem( item );
461  }
462 }
463 
464 
466 {
467  unsigned i;
468  SCH_ITEM* item;
469  SCH_SHEET_LIST hierarchy( g_RootSheet ); // This is the entire schematic hierarcy.
470 
471  if( m_blockItems.GetCount() == 0 )
472  {
473  DisplayError( this, _( "No item to paste." ) );
474  return;
475  }
476 
477  wxFileName destFn = m_CurrentSheet->Last()->GetFileName();
478 
479  if( destFn.IsRelative() )
480  destFn.MakeAbsolute( Prj().GetProjectPath() );
481 
482  // Make sure any sheets in the block to be pasted will not cause recursion in
483  // the destination sheet.
484  for( i = 0; i < m_blockItems.GetCount(); i++ )
485  {
486  item = (SCH_ITEM*) m_blockItems.GetItem( i );
487 
488  if( item->Type() == SCH_SHEET_T )
489  {
490  SCH_SHEET* sheet = (SCH_SHEET*)item;
491  wxFileName srcFn = sheet->GetFileName();
492 
493  if( srcFn.IsRelative() )
494  srcFn.MakeAbsolute( Prj().GetProjectPath() );
495 
496  SCH_SHEET_LIST sheetHierarchy( sheet );
497 
498  if( hierarchy.TestForRecursion( sheetHierarchy,
499  destFn.GetFullPath( wxPATH_UNIX ) ) )
500  {
501  wxString msg;
502 
503  msg.Printf( _( "The sheet changes cannot be made because the destination "
504  "sheet already has the sheet <%s> or one of it's subsheets "
505  "as a parent somewhere in the schematic hierarchy." ),
506  GetChars( sheet->GetFileName() ) );
507  DisplayError( this, msg );
508  return;
509  }
510 
511  // Duplicate sheet names and sheet time stamps are not valid. Use a time stamp
512  // based sheet name and update the time stamp for each sheet in the block.
513  unsigned long timeStamp = (unsigned long)GetNewTimeStamp();
514 
515  sheet->SetName( wxString::Format( wxT( "sheet%8.8lX" ), timeStamp ) );
516  sheet->SetTimeStamp( (time_t)timeStamp );
517  }
518  }
519 
520  PICKED_ITEMS_LIST picklist;
521 
522  for( i = 0; i < m_blockItems.GetCount(); i++ )
523  {
524  item = DuplicateStruct( (SCH_ITEM*) m_blockItems.GetItem( i ) );
525 
526  // Creates data, and push it as new data in undo item list buffer
527  ITEM_PICKER picker( item, UR_NEW );
528  picklist.PushItem( picker );
529 
530  // Clear annotation and init new time stamp for the new components and sheets:
531  if( item->Type() == SCH_COMPONENT_T )
532  {
533  ( (SCH_COMPONENT*) item )->SetTimeStamp( GetNewTimeStamp() );
534  ( (SCH_COMPONENT*) item )->ClearAnnotation( NULL );
535  }
536  else if( item->Type() == SCH_SHEET_T )
537  {
538  ( (SCH_SHEET*) item )->SetTimeStamp( GetNewTimeStamp() );
539  }
540 
541  SetSchItemParent( item, GetScreen() );
542  item->Draw( m_canvas, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
543  GetScreen()->Append( item );
544  }
545 
546  SaveCopyInUndoList( picklist, UR_NEW );
547 
548  MoveItemsInList( picklist, GetScreen()->m_BlockLocate.GetMoveVector() );
549 
550  // Clear flags for all items.
552 
553  OnModify();
554 
555  return;
556 }
Definition of the SCH_SHEET class for Eeschema.
GR_DRAWMODE g_XorMode
Definition: gr_basic.cpp:51
Class SCH_SHEET_LIST.
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
BLOCK_SELECTOR m_BlockLocate
Block description for block commands.
void RotateListOfItems(PICKED_ITEMS_LIST &aItemsList, wxPoint &Center)
void SaveCopyInUndoList(SCH_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, const wxPoint &aTransformPoint=wxPoint(0, 0))
Function SaveCopyInUndoList.
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Definition: draw_panel.cpp:326
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 SetSchItemParent(SCH_ITEM *Struct, SCH_SCREEN *Screen)
void OnModify()
Function OnModify Must be called after a schematic change in order to set the "modify" flag of the cu...
Definition: schframe.cpp:768
virtual int BlockCommand(EDA_KEY aKey) override
Function BlockCommand Returns the block command internat code (BLOCK_MOVE, BLOCK_DUPLICATE...) corresponding to the keys pressed (ALT, SHIFT, SHIFT ALT ..) when block command is started by dragging the mouse.
unsigned long timeStamp(wxXmlNode *aTree)
Make a unique time stamp.
int GetCurrentCursor() const
Function GetCurrentCursor.
void SetMoveVector(const wxPoint &aMoveVector)
void copyBlockItems(PICKED_ITEMS_LIST &aItemsList)
Function copyBlockItems copies the list of block item.
time_t GetNewTimeStamp()
Definition: common.cpp:166
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()
bool BreakSegmentsOnJunctions()
Function BreakSegmentsOnJunctions tests all junctions and bus entries in the schematic for intersecti...
Definition: sch_screen.cpp:965
virtual void HandleBlockPlace(wxDC *DC) override
Function HandleBlockPlace Called after HandleBlockEnd, when a block command needs to be executed afte...
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:348
#define GR_KB_ALT
Definition: common.h:65
void CallEndMouseCapture(wxDC *aDC)
Function CallEndMouseCapture calls the end mouse capture callback.
void SetTimeStamp(time_t aNewTimeStamp)
Definition: base_struct.h:203
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:527
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:120
void CopyList(const PICKED_ITEMS_LIST &aSource)
Function CopyList copies all data from aSource to the list.
void InitBlockPasteInfos() override
Function InitBlockPasteInfos initializes the parameters used by the block paste command.
void MirrorX(PICKED_ITEMS_LIST &aItemsList, wxPoint &aMirrorPoint)
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()
Function UpdatePickList adds all the items in the screen within the block selection rectangle to the ...
Definition: sch_screen.cpp:879
void SetName(const wxString &aName)
Definition: sch_sheet.h:276
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:213
SCH_ITEM * GetCurItem() const
Function GetCurItem returns the currently selected SCH_ITEM, overriding BASE_SCREEN::GetCurItem().
#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 CallMouseCapture(wxDC *aDC, const wxPoint &aPosition, bool aErase)
Function CallMouseCapture calls the mouse capture callback.
uint32_t EDA_KEY
Definition: common.h:52
void MoveItemsInList(PICKED_ITEMS_LIST &aItemsList, const wxPoint aMoveVector)
Function MoveItemsInList Move a list of items to a given move vector.
EDA_DRAW_FRAME * GetParent() const
Definition: draw_panel.cpp:175
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()
Function SelectBlockItems creates a list of items found when a block command is initiated.
Definition: sch_screen.cpp:772
#define GR_KB_SHIFTCTRL
Definition: common.h:67
void SetMouseCaptureCallback(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback)
wxString GetFileName(void) const
Function GetFileName return the filename corresponding to this sheet.
Definition: sch_sheet.cpp:849
void DuplicateItemsInList(SCH_SCREEN *screen, PICKED_ITEMS_LIST &aItemsList, const wxPoint aMoveVector)
Definition: solve.cpp:178
void AbortBlockCurrentCommand(EDA_DRAW_PANEL *aPanel, wxDC *aDC)
Function AbortBlockCurrentCommand cancels the current block operation.
const wxPoint GetEnd() const
Class SCH_SHEET is the sheet symbol placed in a schematic, and is the entry point for a sub schematic...
Definition: sch_sheet.h:216
unsigned GetCount() const
Function GetCount.
wxPoint GetLastCursorPosition() const
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
#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
BLOCK_SELECTOR m_blockItems
List of selected items.
Definition: schframe.h:139
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()
Function TestDanglingEnds tests all of the connectible objects in the schematic for unused connection...
Definition: sch_screen.cpp:915
int GetToolId() const
Definition: draw_frame.h:419
void DeleteItemsInList(EDA_DRAW_PANEL *panel, PICKED_ITEMS_LIST &aItemsList)
Function DeleteItemsInList delete schematic items in aItemsList deleted items are put in undo list...
#define MOUSE_MIDDLE
Definition: common.h:68
void SetCurItem(SCH_ITEM *aItem)
Function SetCurItem sets the currently selected object, m_CurrentItem.
void MirrorY(PICKED_ITEMS_LIST &aItemsList, wxPoint &Center)
Class SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:69
BASE_SCREEN * GetScreen()
Definition: draw_panel.cpp:188
PICKED_ITEMS_LIST & GetItems()
void PasteListOfItems(wxDC *DC)
Function PastListOfItems pastes a list of items from the block stack.
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:254
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
Function HandleBlockEnd 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:621
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:71
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.
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)
SCH_ITEM * DuplicateStruct(SCH_ITEM *aDrawStruct, bool aClone)
Function DuplicateStruct Routine to create a new copy of given struct.
wxPoint GetMoveVector() const
void PushItem(ITEM_PICKER &aItem)
Function PushItem adds aItem to the list of items.