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  PCB_TOOL( "pcbnew.ModuleEditor" )
84 {
85 }
86 
87 
89 {
90 }
91 
92 
94 {
95 }
96 
97 
98 
100 {
101  struct PAD_PLACER : public INTERACTIVE_PLACER_BASE
102  {
103  std::unique_ptr<BOARD_ITEM> CreateItem() override
104  {
105  D_PAD* pad = new D_PAD ( m_board->m_Modules );
106  m_frame->Import_Pad_Settings( pad, false ); // use the global settings for pad
107  pad->IncrementPadName( true, true );
108  return std::unique_ptr<BOARD_ITEM>( pad );
109  }
110  };
111 
112  PAD_PLACER placer;
113 
114  frame()->SetToolID( ID_MODEDIT_PAD_TOOL, wxCURSOR_PENCIL, _( "Add pads" ) );
115 
116  assert( board()->m_Modules );
117 
119 
121 
122  return 0;
123 }
124 
125 
127 {
128  if( !board()->m_Modules || !board()->m_Modules->PadsList() )
129  return 0;
130 
131  DIALOG_ENUM_PADS settingsDlg( frame() );
132 
133  if( settingsDlg.ShowModal() != wxID_OK )
134  return 0;
135 
136  Activate();
137 
138  GENERAL_COLLECTOR collector;
139  const KICAD_T types[] = { PCB_PAD_T, EOT };
140 
142  guide.SetIgnoreMTextsMarkedNoShow( true );
143  guide.SetIgnoreMTextsOnBack( true );
144  guide.SetIgnoreMTextsOnFront( true );
145  guide.SetIgnoreModulesVals( true );
146  guide.SetIgnoreModulesRefs( true );
147 
148  int padNumber = settingsDlg.GetStartNumber();
149  wxString padPrefix = settingsDlg.GetPrefix();
150 
151  frame()->DisplayToolMsg( _(
152  "Hold left mouse button and move cursor over pads to enumerate them" ) );
153 
155  getViewControls()->ShowCursor( true );
156  frame()->GetGalCanvas()->SetCursor( wxCURSOR_HAND );
157 
159  VECTOR2I oldCursorPos; // store the previous mouse cursor position, during mouse drag
160  std::list<D_PAD*> selectedPads;
161  BOARD_COMMIT commit( frame() );
162  std::map<wxString, wxString> oldNames;
163  bool isFirstPoint = true; // used to be sure oldCursorPos will be initialized at least once.
164 
165  while( OPT_TOOL_EVENT evt = Wait() )
166  {
167  if( evt->IsDrag( BUT_LEFT ) )
168  {
169  selectedPads.clear();
170  VECTOR2I cursorPos = getViewControls()->GetCursorPosition();
171 
172  // Be sure the old cursor mouse position was initialized:
173  if( isFirstPoint )
174  {
175  oldCursorPos = cursorPos;
176  isFirstPoint = false;
177  }
178 
179  // wxWidgets deliver mouse move events not frequently enough, resulting in skipping
180  // pads if the user moves cursor too fast. To solve it, create a line that approximates
181  // the mouse move and search pads that are on the line.
182  int distance = ( cursorPos - oldCursorPos ).EuclideanNorm();
183  // Search will be made every 0.1 mm:
184  int segments = distance / int( 0.1*IU_PER_MM ) + 1;
185  const wxPoint line_step( ( cursorPos - oldCursorPos ) / segments );
186 
187  collector.Empty();
188 
189  for( int j = 0; j < segments; ++j )
190  {
191  wxPoint testpoint( cursorPos.x - j * line_step.x,
192  cursorPos.y - j * line_step.y );
193  collector.Collect( board(), types, testpoint, guide );
194 
195  for( int i = 0; i < collector.GetCount(); ++i )
196  {
197  selectedPads.push_back( static_cast<D_PAD*>( collector[i] ) );
198  }
199  }
200 
201  selectedPads.unique();
202 
203  for( D_PAD* pad : selectedPads )
204  {
205  // If pad was not selected, then enumerate it
206  if( !pad->IsSelected() )
207  {
208  commit.Modify( pad );
209 
210  // Rename pad and store the old name
211  wxString newName = wxString::Format( wxT( "%s%d" ), padPrefix.c_str(), padNumber++ );
212  oldNames[newName] = pad->GetPadName();
213  pad->SetPadName( newName );
214  pad->SetSelected();
215  getView()->Update( pad );
216  }
217 
218  // ..or restore the old name if it was enumerated and clicked again
219  else if( pad->IsSelected() && evt->IsClick( BUT_LEFT ) )
220  {
221  auto it = oldNames.find( pad->GetPadName() );
222  wxASSERT( it != oldNames.end() );
223 
224  if( it != oldNames.end() )
225  {
226  pad->SetPadName( it->second );
227  oldNames.erase( it );
228  }
229 
230  pad->ClearSelected();
231  getView()->Update( pad );
232  }
233  }
234  }
235 
236  else if( ( evt->IsKeyPressed() && evt->KeyCode() == WXK_RETURN ) ||
237  evt->IsDblClick( BUT_LEFT ) )
238  {
239  commit.Push( _( "Enumerate pads" ) );
240  break;
241  }
242 
243  else if( evt->IsCancel() || evt->IsActivate() )
244  {
245  commit.Revert();
246  break;
247  }
248 
249  // Prepare the next loop by updating the old cursor mouse position
250  // to this last mouse cursor position
251  oldCursorPos = getViewControls()->GetCursorPosition();
252  }
253 
254  for( auto p : board()->m_Modules->Pads() )
255  {
256  p->ClearSelected();
257  view->Update( p );
258  }
259 
260  frame()->DisplayToolMsg( wxEmptyString );
261  frame()->GetGalCanvas()->SetCursor( wxCURSOR_ARROW );
262 
263  return 0;
264 }
265 
266 
268 {
269  const SELECTION& selection = m_toolMgr->GetTool<SELECTION_TOOL>()->GetSelection();
270 
271  Activate();
272 
273  getViewControls()->SetSnapping( true );
274  getViewControls()->ShowCursor( true );
275  getViewControls()->SetAutoPan( true );
276 
277  frame()->DisplayToolMsg( _( "Select reference point" ) );
278 
279  bool cancelled = false;
280  VECTOR2I cursorPos = getViewControls()->GetCursorPosition();
281 
282  while( OPT_TOOL_EVENT evt = Wait() )
283  {
284  if( evt->IsMotion() )
285  {
286  cursorPos = getViewControls()->GetCursorPosition();
287  }
288  else if( evt->IsClick( BUT_LEFT ) )
289  {
290  break;
291  }
292  else if( evt->IsCancel() || evt->IsActivate() )
293  {
294  cancelled = true;
295  break;
296  }
297  }
298 
299  if( !cancelled )
300  {
302 
303  // Create a temporary module that contains selected items to ease serialization
304  MODULE module( board() );
305 
306  for( auto item : selection )
307  {
308  auto clone = static_cast<BOARD_ITEM*>( item->Clone() );
309 
310  // Do not add reference/value - convert them to the common type
311  if( TEXTE_MODULE* text = dyn_cast<TEXTE_MODULE*>( clone ) )
312  text->SetType( TEXTE_MODULE::TEXT_is_DIVERS );
313 
314  module.Add( clone );
315  }
316 
317  // Set the new relative internal local coordinates of copied items
318  MODULE* editedModule = board()->m_Modules;
319  wxPoint moveVector = module.GetPosition() + editedModule->GetPosition() -
320  wxPoint( cursorPos.x, cursorPos.y );
321  module.MoveAnchorPosition( moveVector );
322 
323  io.Format( &module, 0 );
324  std::string data = io.GetStringOutput( true );
325  m_toolMgr->SaveClipboard( data );
326  }
327 
328  frame()->DisplayToolMsg( wxString::Format( _( "Copied %d item(s)" ), selection.Size() ) );
329 
330  return 0;
331 }
332 
333 
335 {
336  // Parse clipboard
338  MODULE* pastedModule = NULL;
339 
340  try
341  {
342  BOARD_ITEM* item = io.Parse( wxString( m_toolMgr->GetClipboard().c_str(), wxConvUTF8 ) );
343  assert( item->Type() == PCB_MODULE_T );
344  pastedModule = dyn_cast<MODULE*>( item );
345  }
346  catch( ... )
347  {
348  frame()->DisplayToolMsg( _( "Invalid clipboard contents" ) );
349  return 0;
350  }
351 
352  // Placement tool part
353  VECTOR2I cursorPos = getViewControls()->GetCursorPosition();
354 
355  // Add a VIEW_GROUP that serves as a preview for the new item
356  KIGFX::VIEW_GROUP preview( view() );
357  pastedModule->SetParent( board() );
358  pastedModule->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
359  pastedModule->RunOnChildren( std::bind( &KIGFX::VIEW_GROUP::Add,
360  std::ref( preview ), _1 ) );
361  preview.Add( pastedModule );
362  view()->Add( &preview );
363 
365  getViewControls()->ShowCursor( true );
366  getViewControls()->SetSnapping( true );
367  getViewControls()->SetAutoPan( true );
368 
369  Activate();
370 
371  // Main loop: keep receiving events
372  while( OPT_TOOL_EVENT evt = Wait() )
373  {
374  cursorPos = getViewControls()->GetCursorPosition();
375 
376  if( evt->IsMotion() )
377  {
378  pastedModule->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
379  view()->Update( &preview );
380  }
381 
382  else if( evt->Category() == TC_COMMAND )
383  {
384  if( TOOL_EVT_UTILS::IsRotateToolEvt( *evt ) )
385  {
386  const auto rotationAngle = TOOL_EVT_UTILS::GetEventRotationAngle(
387  *frame(), *evt );
388  pastedModule->Rotate( pastedModule->GetPosition(), rotationAngle );
389  view()->Update( &preview );
390  }
391  else if( evt->IsAction( &PCB_ACTIONS::flip ) )
392  {
393  pastedModule->Flip( pastedModule->GetPosition() );
394  view()->Update( &preview );
395  }
396  else if( evt->IsCancel() || evt->IsActivate() )
397  {
398  preview.Clear();
399  break;
400  }
401  }
402 
403  else if( evt->IsClick( BUT_LEFT ) )
404  {
405  BOARD_COMMIT commit( frame() );
406 
407  board()->m_Status_Pcb = 0; // I have no clue why, but it is done in the legacy view
408 
409  // MODULE::RunOnChildren is infeasible here: we need to create copies of items, do not
410  // directly modify them
411 
412  for( auto pad : pastedModule->Pads() )
413  {
414  D_PAD* clone = static_cast<D_PAD*>( pad->Clone() );
415  commit.Add( clone );
416  }
417 
418  for( auto drawing : pastedModule->GraphicalItems() )
419  {
420  BOARD_ITEM* clone = static_cast<BOARD_ITEM*>( drawing->Clone() );
421 
422  if( TEXTE_MODULE* text = dyn_cast<TEXTE_MODULE*>( clone ) )
423  {
424  // Do not add reference/value - convert them to the common type
425  text->SetType( TEXTE_MODULE::TEXT_is_DIVERS );
426 
427  // Whyyyyyyyyyyyyyyyyyyyyyy?! All other items conform to rotation performed
428  // on its parent module, but texts are so independent..
429  text->Rotate( text->GetPosition(), pastedModule->GetOrientation() );
430  commit.Add( text );
431  }
432 
433  commit.Add( clone );
434  }
435 
436  commit.Push( _( "Paste clipboard contents" ) );
437  preview.Clear();
438 
439  break;
440  }
441  }
442 
443  delete pastedModule;
444  view()->Remove( &preview );
445 
446  return 0;
447 }
448 
449 
451 {
452  KIGFX::VIEW* view = getView();
453  KIGFX::PCB_RENDER_SETTINGS* settings =
454  static_cast<KIGFX::PCB_RENDER_SETTINGS*>( view->GetPainter()->GetSettings() );
455 
456  const LAYER_NUM layers[] = { LAYER_MOD_TEXT_BK,
461 
462  bool enable = !settings->GetSketchMode( layers[0] );
463 
464  for( LAYER_NUM layer : layers )
465  settings->SetSketchMode( layer, enable );
466 
467  for( auto module : board()->Modules() )
468  {
469  for( auto item : module->GraphicalItems() )
470  {
471  if( item->Type() == PCB_MODULE_TEXT_T )
472  view->Update( item, KIGFX::GEOMETRY );
473  }
474 
475  view->Update( &module->Reference(), KIGFX::GEOMETRY );
476  view->Update( &module->Value(), KIGFX::GEOMETRY );
477  }
478 
479  frame()->GetGalCanvas()->Refresh();
480 
481  return 0;
482 }
483 
484 
486 {
487  KIGFX::VIEW* view = getView();
488  KIGFX::PCB_RENDER_SETTINGS* settings =
489  static_cast<KIGFX::PCB_RENDER_SETTINGS*>( view->GetPainter()->GetSettings() );
490 
491  const PCB_LAYER_ID layers[] = { F_Adhes, B_Adhes, F_Paste, B_Paste,
494 
495  bool enable = !settings->GetSketchMode( layers[0] );
496 
497  for( LAYER_NUM layer : layers )
498  settings->SetSketchMode( layer, enable );
499 
500  for( auto module : board()->Modules() )
501  {
502  for( auto item : module->GraphicalItems() )
503  {
504  if( item->Type() == PCB_MODULE_EDGE_T )
505  view->Update( item, KIGFX::GEOMETRY );
506  }
507  }
508 
509  frame()->GetGalCanvas()->Refresh();
510 
511  return 0;
512 }
513 
514 
516 {
523 }
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
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:475
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
KIGFX::VIEW * view() const
Definition: pcb_tool.h:123
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.
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:155
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:284
void Remove(VIEW_ITEM *aItem)
Function Remove() Removes a VIEW_ITEM from the view.
Definition: view.cpp:341
DLIST_ITERATOR_WRAPPER< D_PAD > Pads()
Definition: class_module.h:140
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)
static TOOL_ACTION placePad
Activation of the drawing tool (placing a PAD)
Definition: pcb_actions.h:281
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:290
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.
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.
int PasteItems(const TOOL_EVENT &aEvent)
Function PastePad()
Class PCB_RENDER_SETTINGS Stores PCB specific render settings.
Definition: pcb_painter.h:62
DLIST_ITERATOR_WRAPPER< BOARD_ITEM > GraphicalItems()
Definition: class_module.h:145
static TOOL_ACTION pasteItems
Pasting module items from clipboard.
Definition: pcb_actions.h:293
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()
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_INSERT) override
>
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
std::string GetStringOutput(bool doClear)
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:213
double GetOrientation() const
Definition: class_module.h:160
#define CTL_FOR_CLIPBOARD
Format output for the clipboard instead of footprint library or BOARD.
void SetIgnoreMTextsOnFront(bool ignore)
Definition: collectors.h:542
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.
PCB_EDIT_FRAME * frame() const
Definition: pcb_tool.h:125
Class TOOL_EVENT.
Definition: tool_event.h:162
int CopyItems(const TOOL_EVENT &aEvent)
Function CopyItems()
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 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:1385
void Format(BOARD_ITEM *aItem, int aNestLevel=0) const
Function Format outputs aItem to aFormatter in s-expression format.
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:296
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:299
static TOOL_ACTION flip
Flipping of selected objects.
Definition: pcb_actions.h:96
virtual void SetNoToolSelected()
Select the ID_NO_TOOL_SELECTED id tool (Idle tool)
Definition: draw_frame.cpp:560
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
DLIST< MODULE > m_Modules
Definition: class_board.h:245
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:817
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
Module description (excepted pads)
void doInteractiveItemPlacement(INTERACTIVE_PLACER_BASE *aPlacer, const wxString &aCommitMessage, int aOptions=IPO_ROTATE|IPO_FLIP|IPO_REPEAT)
Helper function for performing a common interactive idiom: wait for a left click, place an item there...
Definition: pcb_tool.cpp:38
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()
show modules references (when texts are visibles)
Color has changed.
Definition: view_item.h:57
BOARD * board() const
Definition: pcb_tool.h:126
int m_Status_Pcb
Flags used in ratsnest calculation and update.
Definition: class_board.h:237