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_COPY;
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_COPY: /* Copy */
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_COPY:
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_SAVE: // 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_PASTE:
308  block->SetState( STATE_BLOCK_MOVE );
309  break;
310 
311  case BLOCK_ZOOM:
312  zoom_command = true;
313  break;
314 
315  case BLOCK_MIRROR_X:
317  DrawAndSizingBlockOutlines( m_canvas, aDC, wxDefaultPosition, false );
318 
319  if( block->GetCount() )
320  {
321  // Compute the mirror center and put it on grid.
322  wxPoint mirrorPoint = block->Centre();
323  mirrorPoint = GetNearestGridPosition( mirrorPoint );
324  SetCrossHairPosition( mirrorPoint );
325  SaveCopyInUndoList( block->GetItems(), UR_MIRRORED_X, mirrorPoint );
326  MirrorX( block->GetItems(), mirrorPoint );
327  OnModify();
328  }
329 
331  m_canvas->Refresh();
332  break;
333 
334  case BLOCK_MIRROR_Y:
336  DrawAndSizingBlockOutlines( m_canvas, aDC, wxDefaultPosition, false );
337 
338  if( block->GetCount() )
339  {
340  // Compute the mirror center and put it on grid.
341  wxPoint mirrorPoint = block->Centre();
342  mirrorPoint = GetNearestGridPosition( mirrorPoint );
343  SetCrossHairPosition( mirrorPoint );
344  SaveCopyInUndoList( block->GetItems(), UR_MIRRORED_Y, mirrorPoint );
345  MirrorY( block->GetItems(), mirrorPoint );
346  OnModify();
347  }
348 
350  m_canvas->Refresh();
351  break;
352 
353  default:
354  break;
355  }
356  }
357 
358  if( block->GetCommand() == BLOCK_ABORT )
359  {
361  m_canvas->Refresh();
362  }
363 
364  if( ! nextcmd )
365  {
366  block->SetState( STATE_NO_BLOCK );
367  block->SetCommand( BLOCK_IDLE );
368  GetScreen()->SetCurItem( NULL );
370  false );
371  }
372 
373  if( zoom_command )
374  Window_Zoom( GetScreen()->m_BlockLocate );
375 
376  return nextcmd;
377 }
378 
379 
380 /* Traces the outline of the search block structures
381  * The entire block follows the cursor
382  */
383 static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
384  bool aErase )
385 {
386  BASE_SCREEN* screen = aPanel->GetScreen();
387  BLOCK_SELECTOR* block = &screen->m_BlockLocate;
388  SCH_ITEM* schitem;
389 
390  /* Erase old block contents. */
391  if( aErase )
392  {
393  block->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, block->GetColor() );
394 
395  for( unsigned ii = 0; ii < block->GetCount(); ii++ )
396  {
397  schitem = (SCH_ITEM*) block->GetItem( ii );
398 
399  if( schitem->Type() == SCH_COMPONENT_T )
400  ((SCH_COMPONENT*)schitem)->Draw( aPanel, aDC, block->GetMoveVector(),
401  g_XorMode, g_GhostColor, false );
402  else
403  schitem->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, g_GhostColor );
404  }
405  }
406 
407  /* Repaint new view. */
408  block->SetMoveVector( aPanel->GetParent()->GetCrossHairPosition() - block->GetLastCursorPosition() );
409  block->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, block->GetColor() );
410 
411  for( unsigned ii = 0; ii < block->GetCount(); ii++ )
412  {
413  schitem = (SCH_ITEM*) block->GetItem( ii );
414 
415  if( schitem->Type() == SCH_COMPONENT_T )
416  ((SCH_COMPONENT*)schitem)->Draw( aPanel, aDC, block->GetMoveVector(),
417  g_XorMode, g_GhostColor, false );
418  else
419  schitem->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, g_GhostColor );
420  }
421 }
422 
423 
425 {
426  m_blockItems.ClearListAndDeleteItems(); // delete previous saved list, if exists
427 
428  for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ )
429  {
430  // Clear m_Flag member of selected items:
431  aItemsList.GetPickedItem( ii )->ClearFlags();
432 
433  /* Make a copy of the original picked item. */
434  SCH_ITEM* copy = DuplicateStruct( (SCH_ITEM*) aItemsList.GetPickedItem( ii ) );
435  copy->SetParent( NULL );
436 
437  // In list the wrapper is owner of the schematic item, we can use the UR_DELETED
438  // status for the picker because pickers with this status are owner of the picked item
439  // (or TODO ?: create a new status like UR_DUPLICATE)
440  ITEM_PICKER item( copy, UR_DELETED );
441 
442  m_blockItems.PushItem( item );
443  }
444 }
445 
446 
448 {
449  unsigned i;
450  SCH_ITEM* item;
451  SCH_SHEET_LIST hierarchy( g_RootSheet ); // This is the entire schematic hierarcy.
452 
453  if( m_blockItems.GetCount() == 0 )
454  {
455  DisplayError( this, _( "No item to paste." ) );
456  return;
457  }
458 
459  wxFileName destFn = m_CurrentSheet->Last()->GetFileName();
460 
461  if( destFn.IsRelative() )
462  destFn.MakeAbsolute( Prj().GetProjectPath() );
463 
464  // Make sure any sheets in the block to be pasted will not cause recursion in
465  // the destination sheet.
466  for( i = 0; i < m_blockItems.GetCount(); i++ )
467  {
468  item = (SCH_ITEM*) m_blockItems.GetItem( i );
469 
470  if( item->Type() == SCH_SHEET_T )
471  {
472  SCH_SHEET* sheet = (SCH_SHEET*)item;
473  wxFileName srcFn = sheet->GetFileName();
474 
475  if( srcFn.IsRelative() )
476  srcFn.MakeAbsolute( Prj().GetProjectPath() );
477 
478  SCH_SHEET_LIST sheetHierarchy( sheet );
479 
480  if( hierarchy.TestForRecursion( sheetHierarchy,
481  destFn.GetFullPath( wxPATH_UNIX ) ) )
482  {
483  wxString msg;
484 
485  msg.Printf( _( "The sheet changes cannot be made because the destination "
486  "sheet already has the sheet <%s> or one of it's subsheets "
487  "as a parent somewhere in the schematic hierarchy." ),
488  GetChars( sheet->GetFileName() ) );
489  DisplayError( this, msg );
490  return;
491  }
492 
493  // Duplicate sheet names and sheet time stamps are not valid. Use a time stamp
494  // based sheet name and update the time stamp for each sheet in the block.
495  unsigned long timeStamp = (unsigned long)GetNewTimeStamp();
496 
497  sheet->SetName( wxString::Format( wxT( "sheet%8.8lX" ), timeStamp ) );
498  sheet->SetTimeStamp( (time_t)timeStamp );
499  }
500  }
501 
502  PICKED_ITEMS_LIST picklist;
503 
504  for( i = 0; i < m_blockItems.GetCount(); i++ )
505  {
506  item = DuplicateStruct( (SCH_ITEM*) m_blockItems.GetItem( i ) );
507 
508  // Creates data, and push it as new data in undo item list buffer
509  ITEM_PICKER picker( item, UR_NEW );
510  picklist.PushItem( picker );
511 
512  // Clear annotation and init new time stamp for the new components and sheets:
513  if( item->Type() == SCH_COMPONENT_T )
514  {
515  ( (SCH_COMPONENT*) item )->SetTimeStamp( GetNewTimeStamp() );
516  ( (SCH_COMPONENT*) item )->ClearAnnotation( NULL );
517  }
518  else if( item->Type() == SCH_SHEET_T )
519  {
520  ( (SCH_SHEET*) item )->SetTimeStamp( GetNewTimeStamp() );
521  }
522 
523  SetSchItemParent( item, GetScreen() );
524  item->Draw( m_canvas, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
525  GetScreen()->Append( item );
526  }
527 
528  SaveCopyInUndoList( picklist, UR_NEW );
529 
530  MoveItemsInList( picklist, GetScreen()->m_BlockLocate.GetMoveVector() );
531 
532  // Clear flags for all items.
534 
535  OnModify();
536 
537  return;
538 }
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:761
virtual int BlockCommand(EDA_KEY aKey) override
Function BlockCommand Returns the block command internat code (BLOCK_MOVE, BLOCK_COPY...) corresponding to the keys pressed (ALT, SHIFT, SHIFT ALT ..) when block command is started by dragging the mouse.
int GetCurrentCursor() const
Function GetCurrentCursor return the current cursor shape, depending on the current selected tool...
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:961
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:520
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:54
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:875
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:768
#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:69
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:911
int GetToolId() const
Definition: draw_frame.h:406
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:68
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:617
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:69
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...
static unsigned long timeStamp(CPTREE &aTree)
Make a unique time stamp.
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.