KiCad PCB EDA Suite
eeschema/block.cpp
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2009 Wayne Stambaugh <stambaughw@gmail.com>
6  * Copyright (C) 2004-2018 KiCad Developers, see change_log.txt for contributors.
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, you may find one here:
20  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21  * or you may search the http://www.gnu.org website for the version 2 license,
22  * or you may write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24  */
25 
30 #include <fctsys.h>
31 #include <pgm_base.h>
32 #include <gr_basic.h>
33 #include <sch_draw_panel.h>
34 #include <confirm.h>
35 #include <sch_edit_frame.h>
36 
37 #include <general.h>
38 #include <class_library.h>
39 #include <lib_pin.h>
40 #include <list_operations.h>
41 #include <sch_bus_entry.h>
42 #include <sch_marker.h>
43 #include <sch_junction.h>
44 #include <sch_line.h>
45 #include <sch_no_connect.h>
46 #include <sch_text.h>
47 #include <sch_component.h>
48 #include <sch_sheet.h>
49 #include <sch_sheet_path.h>
50 #include <list_operations.h>
51 
53 #include <sch_view.h>
54 #include <view/view_group.h>
55 
56 static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
57  const wxPoint& aPosition, bool aErase );
58 
60 {
61  int cmd = BLOCK_IDLE;
62 
63  switch( key )
64  {
65  default:
66  cmd = key & 0xFF;
67  break;
68 
69  case 0:
70  cmd = BLOCK_MOVE;
71  break;
72 
73  case GR_KB_SHIFT:
74  cmd = BLOCK_DUPLICATE;
75  break;
76 
77  case GR_KB_CTRL:
78  cmd = BLOCK_DRAG;
79  break;
80 
81  case GR_KB_SHIFTCTRL:
82  cmd = BLOCK_DELETE;
83  break;
84 
85  case MOUSE_MIDDLE:
86  cmd = BLOCK_ZOOM;
87  break;
88  }
89 
90  return cmd;
91 }
92 
93 
95 {
97 
98  block->GetItems().CopyList( m_blockItems.GetItems() );
100 }
101 
102 
104 {
106 
107  wxCHECK_RET( m_canvas->IsMouseCaptured(), "No block mouse capture callback is set" );
108 
109  if( block->GetCount() == 0 )
110  {
111  wxString msg;
112  msg.Printf( wxT( "HandleBlockPLace() error : no items to place (cmd %d, state %d)" ),
113  block->GetCommand(), block->GetState() );
114  wxFAIL_MSG( msg );
115  }
116 
117  block->SetState( STATE_BLOCK_STOP );
118 
119  switch( block->GetCommand() )
120  {
121  case BLOCK_DRAG: // Drag from mouse
122  case BLOCK_DRAG_ITEM: // Drag from a component selection and drag command
123  case BLOCK_MOVE:
124  case BLOCK_DUPLICATE: /* Duplicate */
125  if( m_canvas->IsMouseCaptured() )
126  m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
127 
128  // If the block wasn't changed, don't update the schematic
129  if( block->GetMoveVector() == wxPoint( 0, 0 ) )
130  {
131  // This calls the block-abort command routine on cleanup
132  m_canvas->EndMouseCapture( GetToolId(), GetGalCanvas()->GetCurrentCursor() );
133  return;
134  }
135 
136  if( block->GetCommand() != BLOCK_DUPLICATE )
137  SaveCopyInUndoList( block->GetItems(), UR_CHANGED, block->AppendUndo(), block->GetMoveVector() );
138 
139  for( unsigned ii = 0; ii < block->GetItems().GetCount(); ii++ )
140  {
141  SCH_ITEM* item = dynamic_cast<SCH_ITEM*>( block->GetItems().GetPickedItem( ii ) );
142  item->Move( block->GetMoveVector() );
143  item->SetFlags( IS_MOVED );
144  GetCanvas()->GetView()->Update( item, KIGFX::GEOMETRY );
145  }
146  break;
147 
148  case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
149  if( m_canvas->IsMouseCaptured() )
150  m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
151 
152  DuplicateItemsInList( GetScreen(), block->GetItems(), block->GetMoveVector() );
153 
154  SaveCopyInUndoList( block->GetItems(), UR_CHANGED, block->AppendUndo() );
155  break;
156 
157  case BLOCK_PASTE:
158  if( m_canvas->IsMouseCaptured() )
159  m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
160 
161  PasteListOfItems( DC );
162  break;
163 
164  default: // others are handled by HandleBlockEnd()
165  break;
166  }
167 
168  CheckListConnections( block->GetItems(), true );
169  block->ClearItemsList();
170  SchematicCleanUp( true );
172  OnModify();
173 
174  // clear dome flags and pointers
177  GetScreen()->SetCurItem( NULL );
178 
179  m_canvas->EndMouseCapture( GetToolId(), GetGalCanvas()->GetCurrentCursor(), wxEmptyString, false );
180 
183 }
184 
185 
187 {
188  bool nextcmd = false;
189  bool append = false;
191 
192  auto panel =static_cast<SCH_DRAW_PANEL*>(m_canvas);
193  auto view = panel->GetView();
194 
195  view->ShowSelectionArea( false );
196  view->ClearHiddenFlags();
197 
198  if( block->GetCount() )
199  {
200  BLOCK_STATE_T state = block->GetState();
201  BLOCK_COMMAND_T command = block->GetCommand();
202 
204 
205  block->SetState( state );
206  block->SetCommand( command );
208  SetCrossHairPosition( block->GetEnd() );
209 
210  if( block->GetCommand() != BLOCK_ABORT )
212  }
213 
214  if( m_canvas->IsMouseCaptured() )
215  {
216  switch( block->GetCommand() )
217  {
218  case BLOCK_IDLE:
219  DisplayError( this, wxT( "Error in HandleBlockPLace()" ) );
220  break;
221 
222  case BLOCK_DRAG:
223  case BLOCK_DRAG_ITEM: // Drag from a drag command
224  case BLOCK_MOVE:
225  case BLOCK_DUPLICATE:
227  if( block->GetCommand() == BLOCK_DRAG_ITEM )
228  {
229  // This is a drag command, not a mouse block command
230  // Only this item is put in list
231  if( GetScreen()->GetCurItem() )
232  {
233  ITEM_PICKER picker;
234  picker.SetItem( GetScreen()->GetCurItem() );
235  block->PushItem( picker );
236  }
237  }
238  else if( block->GetCommand() != BLOCK_PRESELECT_MOVE )
239  {
240  // Collect all items in the locate block
242  }
243 
245 
246  if( block->GetCommand() == BLOCK_DUPLICATE )
247  {
248  DuplicateItemsInList( GetScreen(), block->GetItems(), block->GetMoveVector() );
249  SaveCopyInUndoList( block->GetItems(), UR_NEW );
250  }
251 
252  if( block->GetCount() )
253  {
254  nextcmd = true;
255  block->SetState( STATE_BLOCK_MOVE );
256 
258  m_canvas->CallMouseCapture( aDC, wxDefaultPosition, false );
259  }
260  else
261  {
262  m_canvas->CallMouseCapture( aDC, wxDefaultPosition, false );
263  m_canvas->SetMouseCapture( NULL, NULL );
264  }
265  break;
266 
267  case BLOCK_CUT:
268  case BLOCK_DELETE:
270  DrawAndSizingBlockOutlines( m_canvas, aDC, wxDefaultPosition, false );
271 
272  // The CUT variant needs to copy the items from their originial position
273  if( ( block->GetCommand() == BLOCK_CUT ) && block->GetCount() )
274  {
276  copyBlockItems( block->GetItems(), move_vector );
277  }
278 
279  // We set this in a while loop to catch any newly created items
280  // as a result of the delete (e.g. merged wires)
281  while( block->GetCount() )
282  {
283  DeleteItemsInList( block->GetItems(), append );
284  SchematicCleanUp( true );
285  OnModify();
286  block->ClearItemsList();
288  append = true;
289  }
290 
292  break;
293 
294  case BLOCK_COPY: // Save a copy of items in paste buffer
296  DrawAndSizingBlockOutlines( m_canvas, aDC, wxDefaultPosition, false );
297 
298  if( block->GetCount() )
299  {
301  copyBlockItems( block->GetItems(), move_vector );
302  }
303 
304  block->ClearItemsList();
305  break;
306 
307  case BLOCK_ZOOM:
308  Window_Zoom( GetScreen()->m_BlockLocate );
309  break;
310 
311  default:
312  break;
313  }
314  }
315 
316  if( !nextcmd )
317  {
318  block->SetState( STATE_NO_BLOCK );
319  block->SetCommand( BLOCK_IDLE );
321  GetScreen()->SetCurItem( NULL );
322  m_canvas->EndMouseCapture( GetToolId(), GetGalCanvas()->GetCurrentCursor(), wxEmptyString,
323  false );
324  }
325 
326  view->ShowSelectionArea( false );
327  view->ShowPreview( nextcmd );
328 
329  return nextcmd;
330 }
331 
332 
333 /* Traces the outline of the search block structures
334  * The entire block follows the cursor
335  */
336 static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
337  bool aErase )
338 {
339  SCH_DRAW_PANEL* panel =static_cast<SCH_DRAW_PANEL*>( aPanel );
340  KIGFX::SCH_VIEW* view = panel->GetView();
341  KIGFX::VIEW_GROUP* preview = view->GetPreview();
342 
343  BASE_SCREEN* screen = aPanel->GetScreen();
344  BLOCK_SELECTOR* block = &screen->m_BlockLocate;
345  SCH_ITEM* schitem;
346 
347  block->SetMoveVector( panel->GetParent()->GetCrossHairPosition() - block->GetLastCursorPosition() );
348 
349  preview->Clear();
350  view->SetVisible( preview, true );
351 
352  for( unsigned ii = 0; ii < block->GetCount(); ii++ )
353  {
354  schitem = (SCH_ITEM*) block->GetItem( ii );
355  SCH_ITEM* copy = static_cast<SCH_ITEM*>( schitem->Clone() );
356 
357  copy->Move( block->GetMoveVector() );
358  copy->SetFlags( IS_MOVED );
359  preview->Add( copy );
360 
361  view->Hide( schitem );
362  }
363 
364  view->Update( preview );
365 }
366 
367 
368 void SCH_EDIT_FRAME::copyBlockItems( PICKED_ITEMS_LIST& aItemsList, const wxPoint& aMoveVector )
369 {
370  m_blockItems.ClearListAndDeleteItems(); // delete previous saved list, if exists
371 
372  for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ )
373  {
374  // Clear m_Flag member of selected items:
375  aItemsList.GetPickedItem( ii )->ClearFlags();
376 
377  /* Make a copy of the original picked item. */
378  SCH_ITEM* copy = DuplicateStruct( (SCH_ITEM*) aItemsList.GetPickedItem( ii ) );
379  copy->SetParent( NULL );
380  copy->SetFlags( copy->GetFlags() | UR_TRANSIENT );
381  copy->Move( aMoveVector );
382  ITEM_PICKER item( copy, UR_NEW );
383 
384  m_blockItems.PushItem( item );
385  }
386 }
387 
388 
390 {
391  unsigned i;
392  SCH_ITEM* item;
393  SCH_SHEET_LIST hierarchy( g_RootSheet ); // This is the entire schematic hierarcy.
394 
395  if( m_blockItems.GetCount() == 0 )
396  {
397  DisplayError( this, _( "No item to paste." ) );
398  return;
399  }
400 
401  wxFileName destFn = m_CurrentSheet->Last()->GetFileName();
402 
403  if( destFn.IsRelative() )
404  destFn.MakeAbsolute( Prj().GetProjectPath() );
405 
406  // Make sure any sheets in the block to be pasted will not cause recursion in
407  // the destination sheet. Moreover new sheets create new sheetpaths, and component
408  // alternante references must be created and cleared
409  bool hasSheetPasted = false;
410  // Keep trace of existing sheet paths. Paste block can modify this list
411  SCH_SHEET_LIST initial_sheetpathList( g_RootSheet );
412 
413  for( i = 0; i < m_blockItems.GetCount(); i++ )
414  {
415  item = (SCH_ITEM*) m_blockItems.GetItem( i );
416 
417  if( item->Type() == SCH_SHEET_T )
418  {
419  SCH_SHEET* sheet = (SCH_SHEET*)item;
420  wxFileName srcFn = sheet->GetFileName();
421 
422  if( srcFn.IsRelative() )
423  srcFn.MakeAbsolute( Prj().GetProjectPath() );
424 
425  SCH_SHEET_LIST sheetHierarchy( sheet );
426 
427  if( hierarchy.TestForRecursion( sheetHierarchy,
428  destFn.GetFullPath( wxPATH_UNIX ) ) )
429  {
430  wxString msg;
431 
432  msg.Printf( _( "The sheet changes cannot be made because the destination "
433  "sheet already has the sheet \"%s\" or one of it's subsheets "
434  "as a parent somewhere in the schematic hierarchy." ),
435  GetChars( sheet->GetFileName() ) );
436  DisplayError( this, msg );
437  return;
438  }
439 
440  // Duplicate sheet names and sheet time stamps are not valid. Use a time stamp
441  // based sheet name and update the time stamp for each sheet in the block.
442  timestamp_t timeStamp = GetNewTimeStamp();
443 
444  sheet->SetName( wxString::Format( wxT( "sheet%8.8lX" ), (unsigned long)timeStamp ) );
445  sheet->SetTimeStamp( timeStamp );
446  hasSheetPasted = true;
447  }
448  }
449 
450  PICKED_ITEMS_LIST picklist;
451 
452  for( i = 0; i < m_blockItems.GetCount(); i++ )
453  {
454  item = DuplicateStruct( (SCH_ITEM*) m_blockItems.GetItem( i ) );
455 
456  // Creates data, and push it as new data in undo item list buffer
457  ITEM_PICKER picker( item, UR_NEW );
458  picklist.PushItem( picker );
459 
460  // Clear annotation and init new time stamp for the new components and sheets:
461  if( item->Type() == SCH_COMPONENT_T )
462  {
463  SCH_COMPONENT* cmp = static_cast<SCH_COMPONENT*>( item );
464  cmp->SetTimeStamp( GetNewTimeStamp() );
465 
466  // clear the annotation, but preserve the selected unit
467  int unit = cmp->GetUnit();
468  cmp->ClearAnnotation( NULL );
469  cmp->SetUnit( unit );
470  }
471  else if( item->Type() == SCH_SHEET_T )
472  {
473  ( (SCH_SHEET*) item )->SetTimeStamp( GetNewTimeStamp() );
474  }
475  }
476 
477  SaveCopyInUndoList( picklist, UR_NEW );
478 
479  for( i = 0; i < picklist.GetCount(); ++i )
480  {
481  item = (SCH_ITEM*) picklist.GetPickedItem( i );
482 
483  item->Move( GetScreen()->m_BlockLocate.GetMoveVector() );
484 
485  SetSchItemParent( item, GetScreen() );
486  AddToScreen( item );
487  }
488 
489  if( hasSheetPasted )
490  {
491  // We clear annotation of new sheet paths.
492  // Annotation of new components added in current sheet is already cleared.
493  SCH_SCREENS screensList( g_RootSheet );
494  screensList.ClearAnnotationOfNewSheetPaths( initial_sheetpathList );
495  }
496 
497  // Clear flags for all items.
499 
500  OnModify();
501 }
502 
503 void DrawAndSizingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
504  bool aErase )
505 {
506  auto panel =static_cast<SCH_DRAW_PANEL*>(aPanel);
507  auto area = panel->GetView()->GetSelectionArea();
508  auto frame = static_cast<EDA_BASE_FRAME*>(aPanel->GetParent());
509 
511  bool isLibEdit = frame->IsType( FRAME_SCH_LIB_EDITOR );
512 
513  block = &aPanel->GetScreen()->m_BlockLocate;
514  block->SetMoveVector( wxPoint( 0, 0 ) );
515  block->SetLastCursorPosition( aPanel->GetParent()->GetCrossHairPosition( isLibEdit ) );
516  block->SetEnd( aPanel->GetParent()->GetCrossHairPosition() );
517 
518  panel->GetView()->ClearPreview();
519  panel->GetView()->ClearHiddenFlags();
520 
521  area->SetOrigin( block->GetOrigin() );;
522  area->SetEnd( block->GetEnd() );
523 
524  panel->GetView()->SetVisible( area );
525  panel->GetView()->Hide( area, false );
526  panel->GetView()->Update( area );
527 
528  if( block->GetState() == STATE_BLOCK_INIT )
529  {
530  if( block->GetWidth() || block->GetHeight() )
531  // 2nd point exists: the rectangle is not surface anywhere
532  block->SetState( STATE_BLOCK_END );
533  }
534 }
virtual BASE_SCREEN * GetScreen()=0
Definition of the SCH_SHEET class for Eeschema.
void Hide(VIEW_ITEM *aItem, bool aHide=true)
Temporarily hides the item in the view (e.g.
Definition: view.cpp:1505
Class SCH_SHEET_LIST.
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
void SetTimeStamp(timestamp_t aNewTimeStamp)
Change the time stamp to aNewTimeStamp and updates the reference path.
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:255
#define MOUSE_MIDDLE
bool SchematicCleanUp(bool aAppend=false)
Performs routine schematic cleaning including breaking wire and buses and deleting identical objects ...
BLOCK_SELECTOR m_BlockLocate
Block description for block commands.
Definition: base_screen.h:214
void ClearHiddenFlags()
Definition: sch_view.cpp:151
const wxPoint GetOrigin() const
Definition: eda_rect.h:112
bool AppendUndo() const
long timestamp_t
timestamp_t is our type to represent unique IDs for all kinds of elements; historically simply the ti...
Definition: common.h:52
virtual EDA_DRAW_FRAME * GetParent() const override
This file is part of the common library.
void OnModify()
Must be called after a schematic change in order to set the "modify" flag of the current screen* and ...
void DuplicateItemsInList(SCH_SCREEN *screen, PICKED_ITEMS_LIST &aItemsList, const wxPoint &aMoveVector)
KIGFX::PREVIEW::SELECTION_AREA * GetSelectionArea() const
Definition: sch_view.h:53
virtual EDA_ITEM * Clone() const
Function Clone creates a duplicate of this item with linked list members set to NULL.
virtual int BlockCommand(EDA_KEY aKey) override
Return the block command internal code (BLOCK_MOVE, BLOCK_DUPLICATE...) corresponding to the keys pre...
void AbortBlockCurrentCommand(EDA_DRAW_PANEL *aPanel, wxDC *aDC)
Function AbortBlockCurrentCommand cancels the current block operation.
void SetMoveVector(const wxPoint &aMoveVector)
virtual void Window_Zoom(EDA_RECT &aRect) override
int GetHeight() const
Definition: eda_rect.h:118
virtual void EndMouseCapture(int aId=-1, int aCursorId=-1, const wxString &aTitle=wxEmptyString, bool aCallEndFunc=true)
Function EndMouseCapture ends mouse a capture.
void ShowSelectionArea(bool aShow=true)
Definition: sch_view.cpp:131
BLOCK_COMMAND_T
#define GR_KB_CTRL
void PushItem(const ITEM_PICKER &aItem)
Function PushItem pushes aItem to the top of the list.
virtual void Clear()
Function Clear() Removes all the stored items from the group.
Definition: view_group.cpp:74
bool TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
void ClearBlockCommand()
Definition: base_screen.h:501
virtual void HandleBlockPlace(wxDC *DC) override
Call after HandleBlockEnd, when a block command needs to be executed after the block is moved to its ...
EDA_ITEM * GetItem(unsigned aIndex)
BLOCK_STATE_T
virtual void MoveCursorToCrossHair()
Function MoveCursorToCrossHair warps the cursor to the current cross hair position.
virtual 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...
KIGFX::VIEW_GROUP * GetPreview() const
Definition: sch_view.h:55
virtual EDA_DRAW_FRAME * GetParent() const =0
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:187
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:253
SCH_SHEET * g_RootSheet
Definition: eeschema.cpp:56
int UpdatePickList()
Add all the items in the screen within the block selection rectangle to the pick list.
Definition: sch_screen.cpp:874
void SetName(const wxString &aName)
Definition: sch_sheet.h:269
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:213
SCH_ITEM * GetCurItem() const
Return the currently selected SCH_ITEM, overriding BASE_SCREEN::GetCurItem().
Definition: sch_screen.h:196
SCH_ITEM * DuplicateStruct(SCH_ITEM *aDrawStruct, bool aClone=false)
Routine to create a new copy of given struct.
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:76
void SetEnd(int x, int y)
Definition: eda_rect.h:134
virtual void SetMouseCapture(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback, END_MOUSE_CAPTURE_CALLBACK aEndMouseCaptureCallback)
Function SetMouseCapture sets the mouse capture and end mouse capture callbacks to aMouseCaptureCallb...
SCH_DRAW_PANEL * GetCanvas() const override
void SaveCopyInUndoList(SCH_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, bool aAppend=false, const wxPoint &aTransformPoint=wxPoint(0, 0))
Create a copy of the current schematic item, and put it in the undo list.
void ClearPreview()
Definition: sch_view.cpp:105
virtual void CallMouseCapture(wxDC *aDC, const wxPoint &aPosition, bool aErase)
Function CallMouseCapture calls the mouse capture callback.
void DrawAndSizingBlockOutlines(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aPosition, bool aErase)
Function DrawAndSizingBlockOutlines redraws the outlines of the block which shows the search area for...
uint32_t EDA_KEY
Definition: common.h:73
VIEW_GROUP extends VIEW_ITEM by possibility of grouping items into a single object.
void SetUnit(int aUnit)
Change the unit number to aUnit.
int GetUnit() const
Class PICKED_ITEMS_LIST is a holder to handle information on schematic or board items.
#define GR_KB_SHIFT
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...
virtual void Add(VIEW_ITEM *aItem)
Function Add() Adds an item to the group.
Definition: view_group.cpp:55
void ClearAnnotation(SCH_SHEET_PATH *aSheetPath)
Clear exiting component annotation.
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags)
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: view.cpp:1538
void SetItem(EDA_ITEM *aItem)
void SelectBlockItems()
Create a list of items found when a block command is initiated.
Definition: sch_screen.cpp:730
KIGFX::SCH_VIEW * GetView() const
wxString GetFileName(void) const
Return the filename corresponding to this sheet.
Definition: sch_sheet.cpp:661
Definition: solve.cpp:178
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 AddToScreen(SCH_ITEM *aItem)
Add an item to the screen (and view)
wxPoint GetLastCursorPosition() const
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:108
void copyBlockItems(PICKED_ITEMS_LIST &aItemsList, const wxPoint &aMoveVector)
Copy the list of block item.
Definition the SCH_COMPONENT class for Eeschema.
#define GR_KB_SHIFTCTRL
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
see class PGM_BASE
void CheckListConnections(PICKED_ITEMS_LIST &aItemsList, bool aAppend=false)
Adds junctions if needed to each item in the list after they have been moved.
BLOCK_SELECTOR m_blockItems
List of selected items.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
EDA_ITEM * GetPickedItem(unsigned int aIdx) const
Function GetPickedItem.
BLOCK_STATE_T GetState() const
int GetToolId() const
Definition: draw_frame.h:512
Class EDA_BASE_FRAME is the base frame for deriving all KiCad main window classes.
void SetCurItem(SCH_ITEM *aItem)
Sets the currently selected object, m_CurrentItem.
Definition: sch_screen.h:204
size_t i
Definition: json11.cpp:597
void DeleteItemsInList(PICKED_ITEMS_LIST &aItemsList, bool aAppend=false)
Removes all items (and unused junctions that connect to them) and saves each in the undo list...
Class SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:69
int GetWidth() const
Definition: eda_rect.h:117
PICKED_ITEMS_LIST & GetItems()
void PasteListOfItems(wxDC *DC)
Paste a list of items from the block stack.
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:254
void SetVisible(VIEW_ITEM *aItem, bool aIsVisible=true)
Sets the item visibility.
Definition: view.cpp:1484
#define UR_TRANSIENT
indicates the item is owned by the undo/redo stack
Definition: base_struct.h:139
BLOCK_COMMAND_T GetCommand() const
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:924
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:562
Definition for part library class.
void ClearAnnotationOfNewSheetPaths(SCH_SHEET_LIST &aInitialSheetPathList)
Clear the annotation for the components inside new sheetpaths when a complex hierarchy is modified an...
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
void SetCrossHairPosition(const wxPoint &aPosition, bool aSnapToGrid=true)
Function SetCrossHairPosition sets the screen cross hair position to aPosition in logical (drawing) u...
void SetLastCursorPosition(const wxPoint &aPosition)
Function SetLastCursorPosition sets the last cursor position to aPosition.
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:245
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
void SetSchItemParent(SCH_ITEM *Struct, SCH_SCREEN *Screen)
static void DrawMovingBlockOutlines(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aPosition, bool aErase)
virtual void SetMouseCaptureCallback(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback)
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:523
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:203
Color has changed.
Definition: view_item.h:57
void PushItem(ITEM_PICKER &aItem)
Function PushItem adds aItem to the list of items.
#define IS_MOVED
Item being moved.
Definition: base_struct.h:110
virtual void Move(const wxPoint &aMoveVector)=0
Function Move moves the item by aMoveVector to a new position.