KiCad PCB EDA Suite
module_editor_tools.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) 2014-2015 CERN
5  * @author Maciej Suminski <maciej.suminski@cern.ch>
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
25 #include "module_editor_tools.h"
26 #include "selection_tool.h"
27 #include "pcb_actions.h"
28 #include <tool/tool_manager.h>
29 
30 #include <class_draw_panel_gal.h>
31 #include <view/view_controls.h>
32 #include <view/view_group.h>
33 #include <pcb_painter.h>
34 #include <origin_viewitem.h>
35 
36 #include <kicad_plugin.h>
37 #include <pcbnew_id.h>
38 #include <collectors.h>
39 #include <confirm.h>
41 #include <hotkeys.h>
42 #include <bitmaps.h>
43 
44 #include <wxPcbStruct.h>
45 #include <class_board.h>
46 #include <class_module.h>
47 #include <class_edge_mod.h>
48 #include <board_commit.h>
49 
50 #include <tools/tool_event_utils.h>
51 
52 #include <functional>
53 using namespace std::placeholders;
54 #include <wx/defs.h>
55 
56 // Module editor tools
57 TOOL_ACTION PCB_ACTIONS::placePad( "pcbnew.ModuleEditor.placePad",
58  AS_GLOBAL, 0,
59  _( "Add Pad" ), _( "Add a pad" ), NULL, AF_ACTIVATE );
60 
61 TOOL_ACTION PCB_ACTIONS::enumeratePads( "pcbnew.ModuleEditor.enumeratePads",
62  AS_GLOBAL, 0,
63  _( "Enumerate Pads" ), _( "Enumerate pads" ), pad_enumerate_xpm, AF_ACTIVATE );
64 
65 TOOL_ACTION PCB_ACTIONS::copyItems( "pcbnew.ModuleEditor.copyItems",
67  _( "Copy" ), _( "Copy items" ), NULL, AF_ACTIVATE );
68 
69 TOOL_ACTION PCB_ACTIONS::pasteItems( "pcbnew.ModuleEditor.pasteItems",
70  AS_GLOBAL, MD_CTRL + int( 'V' ),
71  _( "Paste" ), _( "Paste items" ), NULL, AF_ACTIVATE );
72 
73 TOOL_ACTION PCB_ACTIONS::moduleEdgeOutlines( "pcbnew.ModuleEditor.graphicOutlines",
74  AS_GLOBAL, 0,
75  "", "" );
76 
77 TOOL_ACTION PCB_ACTIONS::moduleTextOutlines( "pcbnew.ModuleEditor.textOutlines",
78  AS_GLOBAL, 0,
79  "", "" );
80 
81 
83  TOOL_INTERACTIVE( "pcbnew.ModuleEditor" ), m_view( NULL ), m_controls( NULL ),
84  m_board( NULL ), m_frame( NULL )
85 {
86 }
87 
88 
90 {
91 }
92 
93 
95 {
96  // Init variables used by every drawing tool
97  m_view = getView();
99  m_board = getModel<BOARD>();
100  m_frame = getEditFrame<PCB_EDIT_FRAME>();
101 }
102 
103 
105 {
106  m_frame->SetToolID( ID_MODEDIT_PAD_TOOL, wxCURSOR_PENCIL, _( "Add pads" ) );
107 
108  assert( m_board->m_Modules );
109 
110  D_PAD* pad = new D_PAD( m_board->m_Modules );
111  m_frame->Import_Pad_Settings( pad, false ); // use the global settings for pad
112 
113  VECTOR2I cursorPos = m_controls->GetCursorPosition();
114  pad->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
115 
116  // Add a VIEW_GROUP that serves as a preview for the new item
117  KIGFX::VIEW_GROUP preview( m_view );
118  preview.Add( pad );
119  m_view->Add( &preview );
120 
122  m_controls->ShowCursor( true );
123  m_controls->SetSnapping( true );
124 
125  Activate();
126 
127  // Main loop: keep receiving events
128  while( OPT_TOOL_EVENT evt = Wait() )
129  {
130  cursorPos = m_controls->GetCursorPosition();
131 
132  if( evt->IsMotion() )
133  {
134  pad->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
135  m_view->Update( &preview );
136  }
137 
138  else if( evt->Category() == TC_COMMAND )
139  {
140  if( TOOL_EVT_UTILS::IsRotateToolEvt( *evt ) )
141  {
142  const auto rotationAngle = TOOL_EVT_UTILS::GetEventRotationAngle(
143  *m_frame, *evt );
144  pad->Rotate( pad->GetPosition(), rotationAngle );
145  m_view->Update( &preview );
146  }
147  else if( evt->IsAction( &PCB_ACTIONS::flip ) )
148  {
149  pad->Flip( pad->GetPosition() );
150  m_view->Update( &preview );
151  }
152  else if( evt->IsCancel() || evt->IsActivate() )
153  {
154  preview.Clear();
155  delete pad;
156  break;
157  }
158  }
159 
160  else if( evt->IsClick( BUT_LEFT ) )
161  {
162  BOARD_COMMIT commit( m_frame );
163  commit.Add( pad );
164 
165  m_board->m_Status_Pcb = 0; // I have no clue why, but it is done in the legacy view
166 
167  // Take the next available pad number
168  pad->IncrementPadName( true, true );
169 
170  // Handle the view aspect
171  preview.Remove( pad );
172  commit.Push( _( "Add a pad" ) );
173 
174  // Start placing next pad
175  pad = new D_PAD( m_board->m_Modules );
176  m_frame->Import_Pad_Settings( pad, false );
177  pad->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
178  preview.Add( pad );
179  }
180  }
181 
182  m_view->Remove( &preview );
183  m_frame->SetToolID( ID_NO_TOOL_SELECTED, wxCURSOR_DEFAULT, wxEmptyString );
184 
185  return 0;
186 }
187 
188 
190 {
191  if( !m_board->m_Modules || !m_board->m_Modules->Pads() )
192  return 0;
193 
194  Activate();
195 
196  GENERAL_COLLECTOR collector;
197  const KICAD_T types[] = { PCB_PAD_T, EOT };
198 
200  guide.SetIgnoreMTextsMarkedNoShow( true );
201  guide.SetIgnoreMTextsOnBack( true );
202  guide.SetIgnoreMTextsOnFront( true );
203  guide.SetIgnoreModulesVals( true );
204  guide.SetIgnoreModulesRefs( true );
205 
206  DIALOG_ENUM_PADS settingsDlg( m_frame );
207 
208  if( settingsDlg.ShowModal() == wxID_CANCEL )
209  return 0;
210 
211  int padNumber = settingsDlg.GetStartNumber();
212  wxString padPrefix = settingsDlg.GetPrefix();
213 
214  m_frame->DisplayToolMsg( _( "Hold left mouse button and move cursor over pads to enumerate them" ) );
215 
217  m_controls->ShowCursor( true );
218 
219  KIGFX::VIEW* view = m_toolMgr->GetView();
220  VECTOR2I oldCursorPos = m_controls->GetCursorPosition();
221  std::list<D_PAD*> selectedPads;
222  BOARD_COMMIT commit( m_frame );
223  std::map<wxString, wxString> oldNames;
224 
225  while( OPT_TOOL_EVENT evt = Wait() )
226  {
227  if( evt->IsDrag( BUT_LEFT ) || evt->IsClick( BUT_LEFT ) )
228  {
229  selectedPads.clear();
230  VECTOR2I cursorPos = m_controls->GetCursorPosition();
231 
232  if( evt->IsClick( BUT_LEFT ) )
233  {
234  oldCursorPos = m_controls->GetCursorPosition();
235  collector.Empty();
236  collector.Collect( m_board, types, wxPoint( cursorPos.x, cursorPos.y ), guide );
237 
238  for( int i = 0; i < collector.GetCount(); ++i )
239  {
240  if( collector[i]->Type() == PCB_PAD_T )
241  selectedPads.push_back( static_cast<D_PAD*>( collector[i] ) );
242  }
243  }
244  else //evt->IsDrag( BUT_LEFT )
245  {
246  // wxWidgets deliver mouse move events not frequently enough, resulting in skipping
247  // pads if the user moves cursor too fast. To solve it, create a line that approximates
248  // the mouse move and select items intersecting with the line.
249  int distance = ( cursorPos - oldCursorPos ).EuclideanNorm();
250  int segments = distance / 100000 + 1;
251  const wxPoint LINE_STEP( ( cursorPos - oldCursorPos ).x / segments,
252  ( cursorPos - oldCursorPos ).y / segments );
253 
254  collector.Empty();
255  for( int j = 0; j < segments; ++j ) {
256  collector.Collect( m_board, types,
257  wxPoint( oldCursorPos.x, oldCursorPos.y ) + j * LINE_STEP,
258  guide );
259 
260  for( int i = 0; i < collector.GetCount(); ++i )
261  {
262  if( collector[i]->Type() == PCB_PAD_T )
263  selectedPads.push_back( static_cast<D_PAD*>( collector[i] ) );
264  }
265  }
266 
267  selectedPads.unique();
268  }
269 
270  for( D_PAD* pad : selectedPads )
271  {
272  // If pad was not selected, then enumerate it
273  if( !pad->IsSelected() )
274  {
275  commit.Modify( pad );
276 
277  // Rename pad and store the old name
278  wxString newName = wxString::Format( wxT( "%s%d" ), padPrefix.c_str(), padNumber++ );
279  oldNames[newName] = pad->GetPadName();
280  pad->SetPadName( newName );
281  pad->SetSelected();
282  getView()->Update( pad );
283  }
284 
285  // ..or restore the old name if it was enumerated and clicked again
286  else if( pad->IsSelected() && evt->IsClick( BUT_LEFT ) )
287  {
288  auto it = oldNames.find( pad->GetPadName() );
289  wxASSERT( it != oldNames.end() );
290 
291  if( it != oldNames.end() )
292  {
293  pad->SetPadName( it->second );
294  oldNames.erase( it );
295  }
296 
297  pad->ClearSelected();
298  getView()->Update( pad );
299  }
300  }
301 
302  oldCursorPos = cursorPos;
303  }
304 
305  else if( ( evt->IsKeyPressed() && evt->KeyCode() == WXK_RETURN ) ||
306  evt->IsDblClick( BUT_LEFT ) )
307  {
308  commit.Push( _( "Enumerate pads" ) );
309  break;
310  }
311 
312  else if( evt->IsCancel() || evt->IsActivate() )
313  {
314  commit.Revert();
315  break;
316  }
317  }
318 
319  for( D_PAD* p = m_board->m_Modules->Pads(); p; p = p->Next() )
320  {
321  p->ClearSelected();
322  view->Update( p );
323  }
324 
325  m_frame->DisplayToolMsg( wxEmptyString );
326 
327  return 0;
328 }
329 
330 
332 {
333  const SELECTION& selection = m_toolMgr->GetTool<SELECTION_TOOL>()->GetSelection();
334 
335  Activate();
336 
337  m_controls->SetSnapping( true );
338  m_controls->ShowCursor( true );
339  m_controls->SetAutoPan( true );
340 
341  m_frame->DisplayToolMsg( _( "Select reference point" ) );
342 
343  bool cancelled = false;
344  VECTOR2I cursorPos = m_controls->GetCursorPosition();
345 
346  while( OPT_TOOL_EVENT evt = Wait() )
347  {
348  if( evt->IsMotion() )
349  {
350  cursorPos = m_controls->GetCursorPosition();
351  }
352  else if( evt->IsClick( BUT_LEFT ) )
353  {
354  break;
355  }
356  else if( evt->IsCancel() || evt->IsActivate() )
357  {
358  cancelled = true;
359  break;
360  }
361  }
362 
363  if( !cancelled )
364  {
366 
367  // Create a temporary module that contains selected items to ease serialization
368  MODULE module( m_board );
369 
370  for( auto item : selection )
371  {
372  auto clone = static_cast<BOARD_ITEM*>( item->Clone() );
373 
374  // Do not add reference/value - convert them to the common type
375  if( TEXTE_MODULE* text = dyn_cast<TEXTE_MODULE*>( clone ) )
376  text->SetType( TEXTE_MODULE::TEXT_is_DIVERS );
377 
378  module.Add( clone );
379  }
380 
381  // Set the new relative internal local coordinates of copied items
382  MODULE* editedModule = m_board->m_Modules;
383  wxPoint moveVector = module.GetPosition() + editedModule->GetPosition() -
384  wxPoint( cursorPos.x, cursorPos.y );
385  module.MoveAnchorPosition( moveVector );
386 
387  io.Format( &module, 0 );
388  std::string data = io.GetStringOutput( true );
389  m_toolMgr->SaveClipboard( data );
390  }
391 
392  m_frame->DisplayToolMsg( wxString::Format( _( "Copied %d item(s)" ), selection.Size() ) );
393 
394  return 0;
395 }
396 
397 
399 {
400  // Parse clipboard
402  MODULE* pastedModule = NULL;
403 
404  try
405  {
406  BOARD_ITEM* item = io.Parse( wxString( m_toolMgr->GetClipboard().c_str(), wxConvUTF8 ) );
407  assert( item->Type() == PCB_MODULE_T );
408  pastedModule = dyn_cast<MODULE*>( item );
409  }
410  catch( ... )
411  {
412  m_frame->DisplayToolMsg( _( "Invalid clipboard contents" ) );
413  return 0;
414  }
415 
416  // Placement tool part
417  VECTOR2I cursorPos = m_controls->GetCursorPosition();
418 
419  // Add a VIEW_GROUP that serves as a preview for the new item
420  KIGFX::VIEW_GROUP preview( m_view );
421  pastedModule->SetParent( m_board );
422  pastedModule->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
423  pastedModule->RunOnChildren( std::bind( &KIGFX::VIEW_GROUP::Add,
424  std::ref( preview ), _1 ) );
425  preview.Add( pastedModule );
426  m_view->Add( &preview );
427 
429  m_controls->ShowCursor( true );
430  m_controls->SetSnapping( true );
431  m_controls->SetAutoPan( true );
432 
433  Activate();
434 
435  // Main loop: keep receiving events
436  while( OPT_TOOL_EVENT evt = Wait() )
437  {
438  cursorPos = m_controls->GetCursorPosition();
439 
440  if( evt->IsMotion() )
441  {
442  pastedModule->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
443  m_view->Update( &preview );
444  }
445 
446  else if( evt->Category() == TC_COMMAND )
447  {
448  if( TOOL_EVT_UTILS::IsRotateToolEvt( *evt ) )
449  {
450  const auto rotationAngle = TOOL_EVT_UTILS::GetEventRotationAngle(
451  *m_frame, *evt );
452  pastedModule->Rotate( pastedModule->GetPosition(), rotationAngle );
453  m_view->Update( &preview );
454  }
455  else if( evt->IsAction( &PCB_ACTIONS::flip ) )
456  {
457  pastedModule->Flip( pastedModule->GetPosition() );
458  m_view->Update( &preview );
459  }
460  else if( evt->IsCancel() || evt->IsActivate() )
461  {
462  preview.Clear();
463  break;
464  }
465  }
466 
467  else if( evt->IsClick( BUT_LEFT ) )
468  {
469  BOARD_COMMIT commit( m_frame );
470 
471  m_board->m_Status_Pcb = 0; // I have no clue why, but it is done in the legacy view
472 
473  // MODULE::RunOnChildren is infeasible here: we need to create copies of items, do not
474  // directly modify them
475 
476  for( D_PAD* pad = pastedModule->Pads(); pad; pad = pad->Next() )
477  {
478  D_PAD* clone = static_cast<D_PAD*>( pad->Clone() );
479  commit.Add( clone );
480  }
481 
482  for( BOARD_ITEM* drawing = pastedModule->GraphicalItems();
483  drawing; drawing = drawing->Next() )
484  {
485  BOARD_ITEM* clone = static_cast<BOARD_ITEM*>( drawing->Clone() );
486 
487  if( TEXTE_MODULE* text = dyn_cast<TEXTE_MODULE*>( clone ) )
488  {
489  // Do not add reference/value - convert them to the common type
490  text->SetType( TEXTE_MODULE::TEXT_is_DIVERS );
491 
492  // Whyyyyyyyyyyyyyyyyyyyyyy?! All other items conform to rotation performed
493  // on its parent module, but texts are so independent..
494  text->Rotate( text->GetPosition(), pastedModule->GetOrientation() );
495  commit.Add( text );
496  }
497 
498  commit.Add( clone );
499  }
500 
501  commit.Push( _( "Paste clipboard contents" ) );
502  preview.Clear();
503 
504  break;
505  }
506  }
507 
508  delete pastedModule;
509  m_view->Remove( &preview );
510 
511  return 0;
512 }
513 
514 
516 {
517  KIGFX::VIEW* view = getView();
518  KIGFX::PCB_RENDER_SETTINGS* settings =
519  static_cast<KIGFX::PCB_RENDER_SETTINGS*>( view->GetPainter()->GetSettings() );
520 
521  const LAYER_NUM layers[] = { LAYER_MOD_TEXT_BK,
526 
527  bool enable = !settings->GetSketchMode( layers[0] );
528 
529  for( LAYER_NUM layer : layers )
530  settings->SetSketchMode( layer, enable );
531 
532  for( MODULE* module = getModel<BOARD>()->m_Modules; module; module = module->Next() )
533  {
534  for( BOARD_ITEM* item = module->GraphicalItems(); item; item = item ->Next() )
535  {
536  if( item->Type() == PCB_MODULE_TEXT_T )
537  view->Update( item, KIGFX::GEOMETRY );
538  }
539 
540  view->Update( &module->Reference(), KIGFX::GEOMETRY );
541  view->Update( &module->Value(), KIGFX::GEOMETRY );
542  }
543 
545 
546  return 0;
547 }
548 
549 
551 {
552  KIGFX::VIEW* view = getView();
553  KIGFX::PCB_RENDER_SETTINGS* settings =
554  static_cast<KIGFX::PCB_RENDER_SETTINGS*>( view->GetPainter()->GetSettings() );
555 
556  const PCB_LAYER_ID layers[] = { F_Adhes, B_Adhes, F_Paste, B_Paste,
559 
560  bool enable = !settings->GetSketchMode( layers[0] );
561 
562  for( LAYER_NUM layer : layers )
563  settings->SetSketchMode( layer, enable );
564 
565  for( MODULE* module = getModel<BOARD>()->m_Modules; module; module = module->Next() )
566  {
567  for( BOARD_ITEM* item = module->GraphicalItems(); item; item = item ->Next() )
568  {
569  if( item->Type() == PCB_MODULE_EDGE_T )
570  view->Update( item, KIGFX::GEOMETRY );
571  }
572  }
573 
575 
576  return 0;
577 }
578 
579 
581 {
588 }
double EuclideanNorm(const wxPoint &vector)
Euclidean norm of a 2D vector.
Definition: trigo.h:104
void Empty()
Function Empty sets the list to empty.
static TOOL_ACTION selectionClear
Clears the current selection.
Definition: pcb_actions.h:53
void Add(BOARD_ITEM *aBoardItem, ADD_MODE aMode=ADD_INSERT) override
>
virtual void ShowCursor(bool aEnabled)
Function ShowCursor() Enables or disables display of cursor.
bool IncrementPadName(bool aSkipUnconnectable, bool aFillSequenceGaps)
Function IncrementPadName.
Definition: class_pad.cpp:424
void Reset(RESET_REASON aReason) override
Function Reset() Brings the tool to a known, initial state.
int GetCount() const
Function GetCount returns the number of objects in the list.
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
COMMIT & Modify(EDA_ITEM *aItem)
Modifies a given item in the model.
Definition: commit.h:103
void RunOnChildren(std::function< void(BOARD_ITEM *)> aFunction)
Function RunOnChildren.
virtual void SetToolID(int aId, int aCursor, const wxString &aToolMsg) override
Function SetToolID sets the tool command ID to aId and sets the cursor to aCursor.
BOARD_ITEM * Parse(const wxString &aClipboardSourceInput)
Class PCB_IO is a PLUGIN derivation for saving and loading Pcbnew s-expression formatted files...
void Rotate(const wxPoint &aRotCentre, double aAngle) override
Function Rotate Rotate this object.
void Rotate(const wxPoint &aRotCentre, double aAngle) override
Function Rotate Rotate this object.
Definition: class_pad.cpp:836
This file is part of the common library.
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
bool SaveClipboard(const std::string &aText)
Stores an information to the system clipboard.
COMMIT & Add(EDA_ITEM *aItem)
Adds a new item to the model
Definition: commit.h:78
VIEW_CONTROLS class definition.
void Collect(BOARD_ITEM *aItem, const KICAD_T aScanList[], const wxPoint &aRefPos, const COLLECTORS_GUIDE &aGuide)
Function Collect scans a BOARD_ITEM using this class's Inspector method, which does the collection...
Definition: collectors.cpp:447
void SetIgnoreModulesVals(bool ignore)
Definition: collectors.h:577
void Flip(const wxPoint &aCentre) override
Function Flip Flip this object, i.e.
Class SELECTION_TOOL.
void SetTransitions() override
Sets up handlers for various events.
Class BOARD to handle a board.
const wxPoint & GetPosition() const override
Definition: class_module.h:143
virtual void Revert() override
Revertes the commit by restoring the modifed items state.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:220
static TOOL_ACTION enumeratePads
Tool for quick pad enumeration.
Definition: pcb_actions.h:270
MODULE * Next() const
Definition: class_module.h:99
void Remove(VIEW_ITEM *aItem)
Function Remove() Removes a VIEW_ITEM from the view.
Definition: view.cpp:341
OPT_TOOL_EVENT Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
wxString GetPrefix() const
Returns common prefix for all enumerated pads.
void SetIgnoreModulesRefs(bool ignore)
Definition: collectors.h:584
virtual void SetSnapping(bool aEnabled)
Function SetSnapping() Enables/disables snapping cursor to grid.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
static int LegacyHotKey(int aHotKey)
Creates a hot key code that refers to a legacy hot key setting, instead of a particular key...
Definition: tool_action.h:174
show modules values (when texts are visibles)
void SetPosition(const wxPoint &aPos) override
Definition: class_pad.h:169
static TOOL_ACTION placePad
Activation of the drawing tool (placing a PAD)
Definition: pcb_actions.h:267
class D_PAD, a pad in a footprint
Definition: typeinfo.h:102
virtual void Clear()
Function Clear() Removes all the stored items from the group.
Definition: view_group.cpp:74
static TOOL_ACTION copyItems
Copying module items to clipboard.
Definition: pcb_actions.h:276
bool IsRotateToolEvt(const TOOL_EVENT &aEvt)
Function isRotateToolEvt()
void MoveAnchorPosition(const wxPoint &aMoveVector)
Function MoveAnchorPosition Move the reference point of the footprint It looks like a move footprint:...
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Function Go()
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:106
Implementing DIALOG_ENUM_PADS_BASE.
DLIST< BOARD_ITEM > & GraphicalItems()
Definition: class_module.h:136
Casted dyn_cast(From aObject)
Function dyn_cast()
Definition: typeinfo.h:73
bool GetSketchMode(int aItemLayer) const
Function GetSketchMode Returns sketch mode setting for a given item layer.
Definition: pcb_painter.h:124
virtual void Push(const wxString &aMessage=wxT("A commit"), bool aCreateUndoEntry=true) override
Executes the changes.
search types array terminator (End Of Types)
Definition: typeinfo.h:94
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:90
Pcbnew hotkeys.
PCB_EDIT_FRAME * m_frame
BOARD_ITEM * Next() const
int PasteItems(const TOOL_EVENT &aEvent)
Function PastePad()
Class PCB_RENDER_SETTINGS Stores PCB specific render settings.
Definition: pcb_painter.h:62
static TOOL_ACTION pasteItems
Pasting module items from clipboard.
Definition: pcb_actions.h:279
class MODULE, a footprint
Definition: typeinfo.h:101
PCB_LAYER_ID
A quick note on layer IDs:
int ModuleTextOutlines(const TOOL_EVENT &aEvent)
Function ModuleTextOutlines()
GENERAL_COLLECTORS_GUIDE GetCollectorsGuide()
Function GetCollectorsGuide.
int PlacePad(const TOOL_EVENT &aEvent)
Function PlacePad() Places a pad in module editor.
void SetIgnoreMTextsOnBack(bool ignore)
Definition: collectors.h:535
virtual VECTOR2D GetCursorPosition() const =0
Function GetCursorPosition() Returns the current cursor position in world coordinates.
std::string GetStringOutput(bool doClear)
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:213
KIGFX::VIEW_CONTROLS * m_controls
double GetOrientation() const
Definition: class_module.h:147
#define CTL_FOR_CLIPBOARD
Format output for the clipboard instead of footprint library or BOARD.
void SetIgnoreMTextsOnFront(bool ignore)
Definition: collectors.h:542
const wxPoint & GetPosition() const override
Definition: class_pad.h:170
Class TOOL_EVENT.
Definition: tool_event.h:162
int CopyItems(const TOOL_EVENT &aEvent)
Function CopyItems()
D_PAD * Next() const
Definition: class_pad.h:106
virtual void Remove(VIEW_ITEM *aItem)
Function Remove() Removes an item from the group.
Definition: view_group.cpp:61
VIEW_GROUP extends VIEW_ITEM by possibility of grouping items into a single object.
virtual void Rotate(const wxPoint &aRotCentre, double aAngle)
Function Rotate Rotate this object.
void SetPosition(const wxPoint &aPos) override
PAINTER * GetPainter() const
Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS.
Definition: view.h:196
virtual void Add(VIEW_ITEM *aItem)
Function Add() Adds an item to the group.
Definition: view_group.cpp:55
All active tools
Definition: tool_event.h:138
void SetIgnoreMTextsMarkedNoShow(bool ignore)
Definition: collectors.h:528
void Format(BOARD_ITEM *aItem, int aNestLevel=0) const
Function Format outputs aItem to aFormatter in s-expression format.
void Update(VIEW_ITEM *aItem)
Function Update() For dynamic VIEWs, informs the associated VIEW that the graphical representation of...
Definition: view.cpp:1379
Subclass of DIALOG_ENUM_PADS_BASE, which is generated by wxFormBuilder.
std::string GetClipboard() const
Returns the information currently stored in the system clipboard.
virtual void SetAutoPan(bool aEnabled)
Function SetAutoPan Turns on/off auto panning (this feature is used when there is a tool active (eg...
void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:36
static TOOL_ACTION moduleEdgeOutlines
Display module edges as outlines.
Definition: pcb_actions.h:282
int LAYER_NUM
Type LAYER_NUM can be replaced with int and removed.
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:30
class TEXTE_MODULE, text in a footprint
Definition: typeinfo.h:105
int ModuleEdgeOutlines(const TOOL_EVENT &aEvent)
Function ModuleEdgeOutlines()
static TOOL_ACTION moduleTextOutlines
Display module texts as outlines.
Definition: pcb_actions.h:285
static TOOL_ACTION flip
Flipping of selected objects.
Definition: pcb_actions.h:90
int GetStartNumber() const
Returns the starting number that is going to be used for the first enumerated pad.
virtual RENDER_SETTINGS * GetSettings()=0
Function GetSettings Returns pointer to current settings that are going to be used when drawing items...
void DisplayToolMsg(const wxString &msg)
Definition: draw_frame.cpp:497
int EnumeratePads(const TOOL_EVENT &aEvent)
Function EnumeratePads() Tool for quick pad enumeration.
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
void Flip(const wxPoint &aCentre) override
Function Flip Flip this object, i.e.
Definition: class_pad.cpp:313
DLIST< MODULE > m_Modules
Definition: class_board.h:243
void SetSketchMode(int aItemLayer, bool aEnabled)
Function SetSketchMode Turns on/off sketch mode for given item layer.
Definition: pcb_painter.h:114
Class GENERAL_COLLECTOR is intended for use when the right click button is pressed, or when the plain "arrow" tool is in effect.
Definition: collectors.h:211
Class TOOL_ACTION.
Definition: tool_action.h:46
RESET_REASON
Determines the reason of reset for a tool
Definition: tool_base.h:80
void Activate()
Function Activate() Runs the tool.
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:803
int Size() const
Returns the number of selected parts.
Definition: selection.h:112
void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Function Add() Adds a VIEW_ITEM to the view.
Definition: view.cpp:311
DLIST< D_PAD > & Pads()
Definition: class_module.h:133
Module description (excepted pads)
Class VIEW.
Definition: view.h:58
Class GENERAL_COLLECTORS_GUIDE is a general implementation of a COLLECTORS_GUIDE. ...
Definition: collectors.h:378
KIGFX::VIEW * GetView() const
Definition: tool_manager.h:243
EDGE_MODULE class definition.
int GetEventRotationAngle(const PCB_BASE_EDIT_FRAME &aFrame, const TOOL_EVENT &aEvt)
Function getEventRotationAngle()
void Import_Pad_Settings(D_PAD *aPad, bool aDraw)
show modules references (when texts are visibles)
Color has changed.
Definition: view_item.h:57
int m_Status_Pcb
Flags used in ratsnest calculation and update.
Definition: class_board.h:240