KiCad PCB EDA Suite
gerbview_selection_tool.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) 2017 Jon Evans <jon@craftyjon.com>
5  * Copyright (C) 2017-2019 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  * This program is free software: you can redistribute it and/or modify it
8  * under the terms of the GNU General Public License as published by the
9  * Free Software Foundation, either version 3 of the License, or (at your
10  * option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #include <limits>
22 #include <functional>
23 using namespace std::placeholders;
24 
25 #include <base_struct.h>
26 #include <bitmaps.h>
27 #include <gerber_collectors.h>
28 #include <class_draw_panel_gal.h>
29 #include <view/view.h>
30 #include <view/view_controls.h>
31 #include <view/view_group.h>
32 #include <painter.h>
33 #include <bitmaps.h>
34 #include <tool/tool_event.h>
35 #include <tool/tool_manager.h>
38 #include <gerbview_id.h>
39 #include <gerbview_painter.h>
41 #include "gerbview_actions.h"
42 
43 
45 {
46 public:
48  ACTION_MENU( true )
49  {
50  SetIcon( net_highlight_schematic_xpm );
51  SetTitle( _( "Highlight" ) );
52  }
53 
54 private:
55 
56  void update() override
57  {
58  bool addSeparator = false;
59 
60  Clear();
61 
62  const auto& selection = getToolManager()->GetTool<GERBVIEW_SELECTION_TOOL>()->GetSelection();
63 
64  if( selection.Size() == 1 )
65  {
66  auto item = static_cast<GERBER_DRAW_ITEM*>( selection[0] );
67  const auto& net_attr = item->GetNetAttributes();
68 
69  if( ( net_attr.m_NetAttribType & GBR_NETLIST_METADATA::GBR_NETINFO_PAD ) ||
70  ( net_attr.m_NetAttribType & GBR_NETLIST_METADATA::GBR_NETINFO_CMP ) )
71  {
72  auto menuEntry = Add( GERBVIEW_ACTIONS::highlightComponent );
73  menuEntry->SetItemLabel( wxString::Format( _( "Highlight Items of Component \"%s\"" ),
74  GetChars( net_attr.m_Cmpref ) ) );
75  addSeparator = true;
76  }
77 
78  if( ( net_attr.m_NetAttribType & GBR_NETLIST_METADATA::GBR_NETINFO_NET ) )
79  {
80  auto menuEntry = Add( GERBVIEW_ACTIONS::highlightNet );
81  menuEntry->SetItemLabel( wxString::Format( _( "Highlight Items of Net \"%s\"" ),
82  UnescapeString( net_attr.m_Netname ) ) );
83  addSeparator = true;
84  }
85 
86  D_CODE* apertDescr = item->GetDcodeDescr();
87 
88  if( apertDescr && !apertDescr->m_AperFunction.IsEmpty() )
89  {
90  auto menuEntry = Add( GERBVIEW_ACTIONS::highlightAttribute );
91  menuEntry->SetItemLabel( wxString::Format( _( "Highlight Aperture Type \"%s\"" ),
92  GetChars( apertDescr->m_AperFunction ) ) );
93  addSeparator = true;
94  }
95  }
96 
97  if( addSeparator )
98  AppendSeparator();
99 
101  }
102 
103  ACTION_MENU* create() const override
104  {
105  return new HIGHLIGHT_MENU();
106  }
107 };
108 
109 
111  TOOL_INTERACTIVE( "gerbview.InteractiveSelection" ),
112  m_frame( NULL ),
113  m_additive( false ),
114  m_subtractive( false ),
115  m_exclusive_or( false )
116 {
117  m_preliminary = true;
118 }
119 
120 
122 {
123  ACTION_MENU* actionMenu = aEvent.Parameter<ACTION_MENU*>();
124  CONDITIONAL_MENU* conditionalMenu = dynamic_cast<CONDITIONAL_MENU*>( actionMenu );
125 
126  if( conditionalMenu )
127  conditionalMenu->Evaluate( m_selection );
128 
129  if( actionMenu )
130  actionMenu->UpdateAll();
131 
132  return 0;
133 }
134 
135 
137 {
138  getView()->Remove( &m_selection );
139 }
140 
141 
143 {
144  auto selectMenu = std::make_shared<HIGHLIGHT_MENU>();
145  selectMenu->SetTool( this );
146  m_menu.AddSubMenu( selectMenu );
147 
148  auto& menu = m_menu.GetMenu();
149 
150  menu.AddMenu( selectMenu.get() );
151  menu.AddSeparator( 1000 );
152 
153  getEditFrame<GERBVIEW_FRAME>()->AddStandardSubMenus( m_menu );
154 
155  return true;
156 }
157 
158 
160 {
161  m_frame = getEditFrame<GERBVIEW_FRAME>();
162  m_preliminary = true;
163 
164  if( aReason == TOOL_BASE::MODEL_RELOAD )
165  {
166  // Remove pointers to the selected items from containers
167  // without changing their properties (as they are already deleted
168  // while a new file is loaded)
169  m_selection.Clear();
170  getView()->GetPainter()->GetSettings()->SetHighlight( false );
171  }
172  else
173  // Restore previous properties of selected items and remove them from containers
174  clearSelection();
175 
176  // Reinsert the VIEW_GROUP, in case it was removed from the VIEW
177  getView()->Remove( &m_selection );
178  getView()->Add( &m_selection );
179 }
180 
181 
183 {
184  // Main loop: keep receiving events
185  while( TOOL_EVENT* evt = Wait() )
186  {
187  if( m_frame->ToolStackIsEmpty() )
188  m_frame->GetCanvas()->SetCurrentCursor( wxCURSOR_ARROW );
189 
191 
192  if( evt->Modifier( MD_SHIFT ) && evt->Modifier( MD_CTRL ) )
193  m_subtractive = true;
194  else if( evt->Modifier( MD_SHIFT ) )
195  m_additive = true;
196  else if( evt->Modifier( MD_CTRL ) )
197  m_exclusive_or = true;
198 
199  // single click? Select single object
200  if( evt->IsClick( BUT_LEFT ) )
201  {
202  selectPoint( evt->Position() );
203  }
204 
205  // right click? if there is any object - show the context menu
206  else if( evt->IsClick( BUT_RIGHT ) )
207  {
208  if( m_selection.Empty() )
209  {
210  selectPoint( evt->Position() );
211  m_selection.SetIsHover( true );
212  }
213 
215  }
216 
217  else if( evt->IsCancel() || evt->Action() == TA_UNDO_REDO_PRE )
218  {
219  clearSelection();
220  }
221 
222  else
223  evt->SetPassEvent();
224  }
225 
226  return 0;
227 }
228 
229 
231 {
232  return m_selection;
233 }
234 
235 
236 bool GERBVIEW_SELECTION_TOOL::selectPoint( const VECTOR2I& aWhere, bool aOnDrag )
237 {
238  EDA_ITEM* item = NULL;
239  GERBER_COLLECTOR collector;
240  EDA_ITEM* model = getModel<EDA_ITEM>();
241 
242  collector.Collect( model, GERBER_COLLECTOR::AllItems, wxPoint( aWhere.x, aWhere.y ) );
243 
244  // Remove unselectable items
245  for( int i = collector.GetCount() - 1; i >= 0; --i )
246  {
247  if( !selectable( collector[i] ) )
248  collector.Remove( i );
249  }
250 
251  if( collector.GetCount() > 1 )
252  {
253  if( aOnDrag )
255 
256  item = disambiguationMenu( &collector );
257 
258  if( item )
259  {
260  collector.Empty();
261  collector.Append( item );
262  }
263  }
264 
266  clearSelection();
267 
268  if( collector.GetCount() == 1 )
269  {
270  item = collector[ 0 ];
271 
272  if( m_subtractive || ( m_exclusive_or && item->IsSelected() ) )
273  {
274  unselect( item );
276  return false;
277  }
278  else
279  {
280  select( item );
282  return true;
283  }
284  }
285 
286  return false;
287 }
288 
289 
290 bool GERBVIEW_SELECTION_TOOL::selectCursor( bool aSelectAlways )
291 {
292  if( aSelectAlways || m_selection.Empty() )
293  {
294  clearSelection();
295  selectPoint( getViewControls()->GetCursorPosition( false ) );
296  }
297 
298  return !m_selection.Empty();
299 }
300 
301 
303 {
310 }
311 
312 
314 {
315  clearSelection();
316 
317  return 0;
318 }
319 
320 
322 {
323  std::vector<EDA_ITEM*>* items = aEvent.Parameter<std::vector<EDA_ITEM*>*>();
324 
325  if( items )
326  {
327  // Perform individual selection of each item before processing the event.
328  for( auto item : *items )
329  select( item );
330 
332  }
333 
334  return 0;
335 }
336 
337 
339 {
340  // Check if there is an item to be selected
341  EDA_ITEM* item = aEvent.Parameter<EDA_ITEM*>();
342 
343  if( item )
344  {
345  select( item );
346 
347  // Inform other potentially interested tools
349  }
350 
351  return 0;
352 }
353 
354 
356 {
357  std::vector<EDA_ITEM*>* items = aEvent.Parameter<std::vector<EDA_ITEM*>*>();
358 
359  if( items )
360  {
361  // Perform individual unselection of each item before processing the event
362  for( auto item : *items )
363  unselect( item );
364 
366  }
367 
368  return 0;
369 }
370 
371 
373 {
374  // Check if there is an item to be selected
375  EDA_ITEM* item = aEvent.Parameter<EDA_ITEM*>();
376 
377  if( item )
378  {
379  unselect( item );
380 
381  // Inform other potentially interested tools
383  }
384 
385  return 0;
386 }
387 
388 
390 {
391  if( m_selection.Empty() )
392  return;
393 
394  for( auto item : m_selection )
395  unselectVisually( static_cast<EDA_ITEM*>( item ) );
396 
397  m_selection.Clear();
398 
399  // Inform other potentially interested tools
401 }
402 
403 
405 {
406  EDA_ITEM* current = NULL;
407  KIGFX::VIEW_GROUP highlightGroup;
408  ACTION_MENU menu( true );
409 
410  highlightGroup.SetLayer( LAYER_SELECT_OVERLAY );
411  getView()->Add( &highlightGroup );
412 
413  int limit = std::min( 10, aCollector->GetCount() );
414 
415  for( int i = 0; i < limit; ++i )
416  {
417  wxString text;
418  EDA_ITEM* item = ( *aCollector )[i];
419  text = item->GetSelectMenuText( m_frame->GetUserUnits() );
420  menu.Add( text, i + 1, item->GetMenuImage() );
421  }
422 
423  menu.SetTitle( _( "Clarify selection" ) );
424  menu.SetIcon( info_xpm );
425  menu.DisplayTitle( true );
426  SetContextMenu( &menu, CMENU_NOW );
427 
428  while( TOOL_EVENT* evt = Wait() )
429  {
430  if( evt->Action() == TA_CHOICE_MENU_UPDATE )
431  {
432  if( current )
433  {
434  current->ClearBrightened();
435  getView()->Hide( current, false );
436  highlightGroup.Remove( current );
438  }
439 
440  int id = *evt->GetCommandId();
441 
442  // User has pointed an item, so show it in a different way
443  if( id > 0 && id <= limit )
444  {
445  current = ( *aCollector )[id - 1];
446  current->SetBrightened();
447  getView()->Hide( current, true );
448  highlightGroup.Add( current );
450  }
451  else
452  {
453  current = NULL;
454  }
455  }
456  else if( evt->Action() == TA_CHOICE_MENU_CHOICE )
457  {
458  OPT<int> id = evt->GetCommandId();
459 
460  // User has selected an item, so this one will be returned
461  if( id && ( *id > 0 ) )
462  current = ( *aCollector )[*id - 1];
463  else
464  current = NULL;
465 
466  break;
467  }
468  }
469 
470  if( current && current->IsBrightened() )
471  {
472  current->ClearBrightened();
473  getView()->Hide( current, false );
475  }
476 
477  getView()->Remove( &highlightGroup );
478 
479  return current;
480 }
481 
482 
484 {
485  GERBVIEW_FRAME* frame = getEditFrame<GERBVIEW_FRAME>();
486  const GERBER_DRAW_ITEM* item = static_cast<const GERBER_DRAW_ITEM*>( aItem );
487  int layer = item->GetLayer();
488 
489 
490  if( item->GetLayerPolarity() )
491  {
492  // Don't allow selection of invisible negative items
493  auto rs = static_cast<KIGFX::GERBVIEW_RENDER_SETTINGS*>( getView()->GetPainter()->GetSettings() );
494  if( !rs->IsShowNegativeItems() )
495  return false;
496  }
497 
498  // We do not want to select items that are in the background
499  if( frame->GetDisplayOptions().m_HighContrastMode && layer != frame->GetActiveLayer() )
500  return false;
501 
502  return frame->IsLayerVisible( layer );
503 }
504 
505 
507 {
508  if( aItem->IsSelected() )
509  return;
510 
511  m_selection.Add( aItem );
512  getView()->Add( &m_selection, std::numeric_limits<int>::max() );
513  selectVisually( aItem );
514 }
515 
516 
518 {
519  if( !aItem->IsSelected() )
520  return;
521 
522  unselectVisually( aItem );
523  m_selection.Remove( aItem );
524 
525  if( m_selection.Empty() )
526  getView()->Remove( &m_selection );
527 }
528 
529 
531 {
532  // Move the item's layer to the front
533  int layer = static_cast<GERBER_DRAW_ITEM*>( aItem )->GetLayer();
534  m_frame->SetActiveLayer( layer, true );
535 
536  // Hide the original item, so it is shown only on overlay
537  aItem->SetSelected();
538  getView()->Hide( aItem, true );
539 
540  getView()->Update( &m_selection );
541 }
542 
543 
545 {
546  // Restore original item visibility
547  aItem->ClearSelected();
548  getView()->Hide( aItem, false );
549  getView()->Update( aItem, KIGFX::ALL );
550 
551  getView()->Update( &m_selection );
552 }
553 
554 
556 {
557  auto& view = *getView();
558  auto& controls = *getViewControls();
559  auto previous_settings = controls.GetSettings();
560 
561  std::string tool = aEvent.GetCommandStr().get();
562  m_frame->PushTool( tool );
563  Activate();
564 
566  KIGFX::PREVIEW::RULER_ITEM ruler( twoPtMgr, m_frame->GetUserUnits() );
567 
568  view.Add( &ruler );
569  view.SetVisible( &ruler, false );
570 
571  bool originSet = false;
572 
573  controls.ShowCursor( true );
574 
575  while( TOOL_EVENT* evt = Wait() )
576  {
577  m_frame->GetCanvas()->SetCurrentCursor( wxCURSOR_ARROW );
578  const VECTOR2I cursorPos = controls.GetCursorPosition();
579 
580  auto clearRuler = [&] () {
581  view.SetVisible( &ruler, false );
582  controls.SetAutoPan( false );
583  controls.CaptureCursor( false );
584  originSet = false;
585  };
586 
587  if( evt->IsCancelInteractive() )
588  {
589  if( originSet )
590  clearRuler();
591  else
592  {
593  m_frame->PopTool( tool );
594  break;
595  }
596  }
597 
598  else if( evt->IsActivate() )
599  {
600  if( originSet )
601  clearRuler();
602 
603  if( evt->IsMoveTool() )
604  {
605  // leave ourselves on the stack so we come back after the move
606  break;
607  }
608  else
609  {
610  m_frame->PopTool( tool );
611  break;
612  }
613  }
614 
615  // click or drag starts
616  else if( !originSet && ( evt->IsDrag( BUT_LEFT ) || evt->IsClick( BUT_LEFT ) ) )
617  {
618  if( !evt->IsDrag( BUT_LEFT ) )
619  {
620  twoPtMgr.SetOrigin( cursorPos );
621  twoPtMgr.SetEnd( cursorPos );
622  }
623 
624  controls.CaptureCursor( true );
625  controls.SetAutoPan( true );
626 
627  originSet = true;
628  }
629 
630  else if( !originSet && evt->IsMotion() )
631  {
632  // make sure the origin is set before a drag starts
633  // otherwise you can miss a step
634  twoPtMgr.SetOrigin( cursorPos );
635  twoPtMgr.SetEnd( cursorPos );
636  }
637 
638  // second click or mouse up after drag ends
639  else if( originSet && ( evt->IsClick( BUT_LEFT ) || evt->IsMouseUp( BUT_LEFT ) ) )
640  {
641  originSet = false;
642 
643  controls.SetAutoPan( false );
644  controls.CaptureCursor( false );
645 
646  view.SetVisible( &ruler, false );
647  }
648 
649  // move or drag when origin set updates rules
650  else if( originSet && ( evt->IsMotion() || evt->IsDrag( BUT_LEFT ) ) )
651  {
652  twoPtMgr.SetAngleSnap( evt->Modifier( MD_CTRL ) );
653  twoPtMgr.SetEnd( cursorPos );
654 
655  view.SetVisible( &ruler, true );
656  view.Update( &ruler, KIGFX::GEOMETRY );
657  }
658 
659  else if( evt->IsClick( BUT_RIGHT ) )
660  {
662  }
663 
664  else
665  evt->SetPassEvent();
666  }
667 
668  view.SetVisible( &ruler, false );
669  view.Remove( &ruler );
670  controls.ApplySettings( previous_settings );
671  return 0;
672 }
673 
674 
ACTION_MENU * create() const override
Returns an instance of this class. It has to be overridden in inheriting classes.
void Empty()
Function Empty sets the list to empty.
Definition: collector.h:110
void Hide(VIEW_ITEM *aItem, bool aHide=true)
Temporarily hides the item in the view (e.g.
Definition: view.cpp:1498
void AddMenu(ACTION_MENU *aMenu, const SELECTION_CONDITION &aCondition=SELECTION_CONDITIONS::ShowAlways, int aOrder=ANY_ORDER)
Adds a submenu to the menu.
wxMenuItem * Add(const wxString &aLabel, int aId, const BITMAP_OPAQUE *aIcon)
Adds a wxWidgets-style entry to the menu.
static TOOL_ACTION selectionClear
Clears the current selection.
static const TOOL_EVENT SelectedEvent
Definition: actions.h:206
TOOL_MENU m_menu
functions below are not yet implemented - their interface may change
virtual void Clear() override
Function Clear() Removes all the stored items from the group.
Definition: selection.h:95
bool Init() override
Function Init() Init() is called once upon a registration of the tool.
TOOL_EVENT * Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
bool selectPoint(const VECTOR2I &aWhere, bool aOnDrag=false)
Function selectPoint() Selects an item pointed by the parameter aWhere.
bool IsSelected() const
Definition: base_struct.h:203
Model changes (required full reload)
Definition: tool_base.h:82
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:207
Defines the structure of a menu based on ACTIONs.
Definition: action_menu.h:43
print info associated to a component (TO.C attribute)
bool selectable(const EDA_ITEM *aItem) const
Function selectable() Checks conditions for an item to be selected.
void update() override
Update menu state stub.
void ClearSelected()
Definition: base_struct.h:211
void SetCurrentCursor(wxStockCursor aStockCursorID)
Function SetCurrentCursor Set the current cursor shape for this panel.
VIEW_CONTROLS class definition.
GERBER_COLLECTOR is intended for use when the right click button is pressed, or when the plain "arrow...
EDA_ITEM * disambiguationMenu(GERBER_COLLECTOR *aItems)
Function disambiguationMenu() Handles the menu that allows one to select one of many items in case th...
CONDITIONAL_MENU & GetMenu()
Function GetMenu.
Definition: tool_menu.cpp:46
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
int GetLayer() const
Function GetLayer returns the layer this item is on.
virtual void PushTool(const std::string &actionName)
NB: the definition of "tool" is different at the user level.
virtual void Remove(VIEW_ITEM *aItem)
Function Remove() Removes a VIEW_ITEM from the view.
Definition: view.cpp:375
void SetActiveLayer(int aLayer, bool doLayerWidgetUpdate=true)
Function SetActiveLayer will change the currently active layer to aLayer and update the GERBER_LAYER_...
void SetBrightened()
Definition: base_struct.h:209
void selectVisually(EDA_ITEM *aItem)
Function selectVisually() Marks item as selected, but does not add it to the ITEMS_PICKED_LIST.
int Main(const TOOL_EVENT &aEvent)
Function Main()
const GBR_DISPLAY_OPTIONS & GetDisplayOptions() const
bool IsBrightened() const
Definition: base_struct.h:205
void UpdateAll()
Runs update handlers for the menu and its submenus.
bool m_HighContrastMode
High contrast mode (dim un-highlighted objects)
void SetContextMenu(ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger=CMENU_BUTTON)
Function SetContextMenu()
Item needs to be redrawn.
Definition: view_item.h:63
static TOOL_ACTION selectItem
Selects an item (specified as the event parameter).
static const KICAD_T AllItems[]
A scan list for all selectable gerber items.
static TOOL_ACTION highlightNet
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Function Go()
void Remove(int aIndex)
Function Remove removes the item at aIndex (first position is 0);.
Definition: collector.h:130
PAINTER * GetPainter() const
Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS.
Definition: view.h:199
void SetIsHover(bool aIsHover)
Definition: selection.h:66
virtual void Add(EDA_ITEM *aItem)
Definition: selection.h:76
void ClearBrightened()
Definition: base_struct.h:212
void Append(EDA_ITEM *item)
Function Append adds an item to the end of the list.
Definition: collector.h:120
int GetCount() const
Function GetCount returns the number of objects in the list.
Definition: collector.h:101
int UnselectItem(const TOOL_EVENT &aEvent)
static TOOL_ACTION measureTool
Definition: actions.h:150
void setTransitions() override
Sets up handlers for various events.
void Reset(RESET_REASON aReason) override
Function Reset() Brings the tool to a known, initial state.
#define NULL
void Collect(EDA_ITEM *aItem, const KICAD_T aScanList[], const wxPoint &aRefPos)
Function Collect scans an EDA_ITEM using this class's Inspector method, which does the collection.
void SetSelected()
Definition: base_struct.h:208
void MarkTargetDirty(int aTarget)
Function MarkTargetDirty() Sets or clears target 'dirty' flag.
Definition: view.h:574
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagates an event to tools that requested events of matching type(s).
virtual void PopTool(const std::string &actionName)
static TOOL_ACTION highlightAttribute
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:435
void SetIcon(const BITMAP_OPAQUE *aIcon)
Assigns an icon for the entry.
Definition: action_menu.cpp:71
TOOL_EVENT.
Definition: tool_event.h:171
void SetOrigin(const VECTOR2I &aOrigin)
Set the origin of the ruler (the fixed end)
bool ToolStackIsEmpty()
Definition: tools_holder.h:117
const BITMAP_OPAQUE net_highlight_schematic_xpm[1]
Items that may change while the view stays the same (noncached)
Definition: definitions.h:50
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.
static const TOOL_EVENT ClearedEvent
Definition: actions.h:208
void unselect(EDA_ITEM *aItem)
Function unselect() Takes necessary action mark an item as unselected.
int UpdateMenu(const TOOL_EVENT &aEvent)
void unselectVisually(EDA_ITEM *aItem)
Function unselectVisually() Marks item as selected, but does not add it to the ITEMS_PICKED_LIST.
GERBVIEW_SELECTION & GetSelection()
Function GetSelection()
static TOOL_ACTION updateMenu
Definition: actions.h:165
virtual void Add(VIEW_ITEM *aItem)
Function Add() Adds an item to the group.
Definition: view_group.cpp:55
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:1531
const BITMAP_OPAQUE info_xpm[1]
Definition: info.cpp:75
virtual void SetLayer(int aLayer)
Function SetLayer() Sets layer used to draw the group.
Definition: view_group.h:115
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:121
wxString m_AperFunction
the aperture attribute (created by a TA.AperFunction command) attached to the D_CODE
Definition: dcode.h:105
int SelectItems(const TOOL_EVENT &aEvent)
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:463
int MeasureTool(const TOOL_EVENT &aEvent)
Launches a tool to measure between points
int SelectItem(const TOOL_EVENT &aEvent)
virtual RENDER_SETTINGS * GetSettings()=0
Function GetAdapter Returns pointer to current settings that are going to be used when drawing items.
int GetActiveLayer() const
Function SetActiveLayer returns the active layer.
GERBVIEW_SELECTION_TOOL.
void SetTitle(const wxString &aTitle) override
Sets title for the menu.
Definition: action_menu.cpp:89
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:153
D_CODE holds a gerber DCODE (also called Aperture) definition.
Definition: dcode.h:82
void SetHighlight(bool aEnabled, int aNetcode=-1, bool aMulti=false)
Function SetHighlight Turns on/off highlighting - it may be done for the active layer or the specifie...
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:201
static TOOL_ACTION highlightClear
#define _(s)
Definition: 3d_actions.cpp:33
int UnselectItems(const TOOL_EVENT &aEvent)
wxString UnescapeString(const wxString &aSource)
Definition: string.cpp:152
virtual wxString GetSelectMenuText(EDA_UNITS aUnits) const
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
static TOOL_ACTION selectionActivate
Activation of the selection tool.
static TOOL_ACTION unselectItem
Unselects an item (specified as the event parameter).
void AddSubMenu(std::shared_ptr< ACTION_MENU > aSubMenu)
Function CreateSubMenu.
Definition: tool_menu.cpp:52
bool selectCursor(bool aSelectAlways=false)
Function selectCursor() Selects an item under the cursor unless there is something already selected o...
currently selected items overlay
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:159
RESET_REASON
Determines the reason of reset for a tool
Definition: tool_base.h:79
void select(EDA_ITEM *aItem)
Function select() Takes necessary action mark an item as selected.
boost::optional< T > OPT
Definition: optional.h:7
void clearSelection()
Function clearSelection() Clears the current selection.
void Activate()
Function Activate() Runs the tool.
print info associated to a flashed pad (TO.P attribute)
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Function Add() Adds a VIEW_ITEM to the view.
Definition: view.cpp:345
int ClearSelection(const TOOL_EVENT &aEvent)
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:42
bool IsLayerVisible(int aLayer) const
Function IsLayerVisible tests whether a given layer is visible.
virtual BITMAP_DEF GetMenuImage() const
Function GetMenuImage returns a pointer to an image to be used in menus.
print info associated to a net (TO.N attribute)
bool GetLayerPolarity() const
void ShowContextMenu(SELECTION &aSelection)
Function ShowContextMenu.
Definition: tool_menu.cpp:59
EDA_UNITS GetUserUnits() const
Return the user units currently in use.
void SetEnd(const VECTOR2I &aEnd)
Set the current end of the rectangle (the end that moves with the cursor.
Color has changed.
Definition: view_item.h:59
void DisplayTitle(bool aDisplay=true)
Decides whether a title for a pop up menu should be displayed.
static TOOL_ACTION highlightComponent
virtual void Remove(EDA_ITEM *aItem)
Definition: selection.h:87