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  const auto& selection = getToolManager()->GetTool<GERBVIEW_SELECTION_TOOL>()->GetSelection();
61 
62  if( selection.Size() == 1 )
63  {
64  auto item = static_cast<GERBER_DRAW_ITEM*>( selection[0] );
65  const auto& net_attr = item->GetNetAttributes();
66 
67  if( ( net_attr.m_NetAttribType & GBR_NETLIST_METADATA::GBR_NETINFO_PAD ) ||
68  ( net_attr.m_NetAttribType & GBR_NETLIST_METADATA::GBR_NETINFO_CMP ) )
69  {
70  auto menuEntry = Add( GERBVIEW_ACTIONS::highlightComponent );
71  menuEntry->SetItemLabel( wxString::Format( _( "Highlight Items of Component \"%s\"" ),
72  GetChars( net_attr.m_Cmpref ) ) );
73  addSeparator = true;
74  }
75 
76  if( ( net_attr.m_NetAttribType & GBR_NETLIST_METADATA::GBR_NETINFO_NET ) )
77  {
78  auto menuEntry = Add( GERBVIEW_ACTIONS::highlightNet );
79  menuEntry->SetItemLabel( wxString::Format( _( "Highlight Items of Net \"%s\"" ),
80  UnescapeString( net_attr.m_Netname ) ) );
81  addSeparator = true;
82  }
83 
84  D_CODE* apertDescr = item->GetDcodeDescr();
85 
86  if( apertDescr && !apertDescr->m_AperFunction.IsEmpty() )
87  {
88  auto menuEntry = Add( GERBVIEW_ACTIONS::highlightAttribute );
89  menuEntry->SetItemLabel( wxString::Format( _( "Highlight Aperture Type \"%s\"" ),
90  GetChars( apertDescr->m_AperFunction ) ) );
91  addSeparator = true;
92  }
93  }
94 
95  if( addSeparator )
96  AppendSeparator();
97 
99  }
100 
101  ACTION_MENU* create() const override
102  {
103  return new HIGHLIGHT_MENU();
104  }
105 };
106 
107 
109  TOOL_INTERACTIVE( "gerbview.InteractiveSelection" ),
110  m_frame( NULL ),
111  m_additive( false ),
112  m_subtractive( false ),
113  m_exclusive_or( false )
114 {
115  m_preliminary = true;
116 }
117 
118 
120 {
121  ACTION_MENU* actionMenu = aEvent.Parameter<ACTION_MENU*>();
122  CONDITIONAL_MENU* conditionalMenu = dynamic_cast<CONDITIONAL_MENU*>( actionMenu );
123 
124  if( conditionalMenu )
125  conditionalMenu->Evaluate( m_selection );
126 
127  if( actionMenu )
128  actionMenu->UpdateAll();
129 
130  return 0;
131 }
132 
133 
135 {
136  getView()->Remove( &m_selection );
137 }
138 
139 
141 {
142  auto selectMenu = std::make_shared<HIGHLIGHT_MENU>();
143  selectMenu->SetTool( this );
144  m_menu.AddSubMenu( selectMenu );
145 
146  auto& menu = m_menu.GetMenu();
147 
148  menu.AddMenu( selectMenu.get() );
149  menu.AddSeparator( 1000 );
150 
151  getEditFrame<GERBVIEW_FRAME>()->AddStandardSubMenus( m_menu );
152 
153  return true;
154 }
155 
156 
158 {
159  m_frame = getEditFrame<GERBVIEW_FRAME>();
160  m_preliminary = true;
161 
162  if( aReason == TOOL_BASE::MODEL_RELOAD )
163  {
164  // Remove pointers to the selected items from containers
165  // without changing their properties (as they are already deleted
166  // while a new file is loaded)
167  m_selection.Clear();
168  getView()->GetPainter()->GetSettings()->SetHighlight( false );
169  }
170  else
171  // Restore previous properties of selected items and remove them from containers
172  clearSelection();
173 
174  // Reinsert the VIEW_GROUP, in case it was removed from the VIEW
175  getView()->Remove( &m_selection );
176  getView()->Add( &m_selection );
177 }
178 
179 
181 {
182  // Main loop: keep receiving events
183  while( TOOL_EVENT* evt = Wait() )
184  {
185  if( m_frame->ToolStackIsEmpty() )
186  m_frame->GetCanvas()->SetCurrentCursor( wxCURSOR_ARROW );
187 
189 
190  if( evt->Modifier( MD_SHIFT ) && evt->Modifier( MD_CTRL ) )
191  m_subtractive = true;
192  else if( evt->Modifier( MD_SHIFT ) )
193  m_additive = true;
194  else if( evt->Modifier( MD_CTRL ) )
195  m_exclusive_or = true;
196 
197  // single click? Select single object
198  if( evt->IsClick( BUT_LEFT ) )
199  {
200  selectPoint( evt->Position() );
201  }
202 
203  // right click? if there is any object - show the context menu
204  else if( evt->IsClick( BUT_RIGHT ) )
205  {
206  if( m_selection.Empty() )
207  {
208  selectPoint( evt->Position() );
209  m_selection.SetIsHover( true );
210  }
211 
213  }
214 
215  else if( evt->IsCancel() || evt->Action() == TA_UNDO_REDO_PRE )
216  {
217  clearSelection();
218  }
219 
220  else
221  evt->SetPassEvent();
222  }
223 
224  return 0;
225 }
226 
227 
229 {
230  return m_selection;
231 }
232 
233 
234 bool GERBVIEW_SELECTION_TOOL::selectPoint( const VECTOR2I& aWhere, bool aOnDrag )
235 {
236  EDA_ITEM* item = NULL;
237  GERBER_COLLECTOR collector;
238  EDA_ITEM* model = getModel<EDA_ITEM>();
239 
240  collector.Collect( model, GERBER_COLLECTOR::AllItems, wxPoint( aWhere.x, aWhere.y ) );
241 
242  // Remove unselectable items
243  for( int i = collector.GetCount() - 1; i >= 0; --i )
244  {
245  if( !selectable( collector[i] ) )
246  collector.Remove( i );
247  }
248 
249  if( collector.GetCount() > 1 )
250  {
251  if( aOnDrag )
253 
254  item = disambiguationMenu( &collector );
255 
256  if( item )
257  {
258  collector.Empty();
259  collector.Append( item );
260  }
261  }
262 
264  clearSelection();
265 
266  if( collector.GetCount() == 1 )
267  {
268  item = collector[ 0 ];
269 
270  if( m_subtractive || ( m_exclusive_or && item->IsSelected() ) )
271  {
272  unselect( item );
274  return false;
275  }
276  else
277  {
278  select( item );
280  return true;
281  }
282  }
283 
284  return false;
285 }
286 
287 
288 bool GERBVIEW_SELECTION_TOOL::selectCursor( bool aSelectAlways )
289 {
290  if( aSelectAlways || m_selection.Empty() )
291  {
292  clearSelection();
293  selectPoint( getViewControls()->GetCursorPosition( false ) );
294  }
295 
296  return !m_selection.Empty();
297 }
298 
299 
301 {
308 }
309 
310 
312 {
313  clearSelection();
314 
315  return 0;
316 }
317 
318 
320 {
321  std::vector<EDA_ITEM*>* items = aEvent.Parameter<std::vector<EDA_ITEM*>*>();
322 
323  if( items )
324  {
325  // Perform individual selection of each item before processing the event.
326  for( auto item : *items )
327  select( item );
328 
330  }
331 
332  return 0;
333 }
334 
335 
337 {
338  // Check if there is an item to be selected
339  EDA_ITEM* item = aEvent.Parameter<EDA_ITEM*>();
340 
341  if( item )
342  {
343  select( item );
344 
345  // Inform other potentially interested tools
347  }
348 
349  return 0;
350 }
351 
352 
354 {
355  std::vector<EDA_ITEM*>* items = aEvent.Parameter<std::vector<EDA_ITEM*>*>();
356 
357  if( items )
358  {
359  // Perform individual unselection of each item before processing the event
360  for( auto item : *items )
361  unselect( item );
362 
364  }
365 
366  return 0;
367 }
368 
369 
371 {
372  // Check if there is an item to be selected
373  EDA_ITEM* item = aEvent.Parameter<EDA_ITEM*>();
374 
375  if( item )
376  {
377  unselect( item );
378 
379  // Inform other potentially interested tools
381  }
382 
383  return 0;
384 }
385 
386 
388 {
389  if( m_selection.Empty() )
390  return;
391 
392  for( auto item : m_selection )
393  unselectVisually( static_cast<EDA_ITEM*>( item ) );
394 
395  m_selection.Clear();
396 
397  // Inform other potentially interested tools
399 }
400 
401 
403 {
404  EDA_ITEM* current = NULL;
405  KIGFX::VIEW_GROUP highlightGroup;
406  ACTION_MENU menu( true );
407 
408  highlightGroup.SetLayer( LAYER_SELECT_OVERLAY );
409  getView()->Add( &highlightGroup );
410 
411  int limit = std::min( 10, aCollector->GetCount() );
412 
413  for( int i = 0; i < limit; ++i )
414  {
415  wxString text;
416  EDA_ITEM* item = ( *aCollector )[i];
417  text = item->GetSelectMenuText( m_frame->GetUserUnits() );
418  menu.Add( text, i + 1, item->GetMenuImage() );
419  }
420 
421  menu.SetTitle( _( "Clarify selection" ) );
422  menu.SetIcon( info_xpm );
423  menu.DisplayTitle( true );
424  SetContextMenu( &menu, CMENU_NOW );
425 
426  while( TOOL_EVENT* evt = Wait() )
427  {
428  if( evt->Action() == TA_CHOICE_MENU_UPDATE )
429  {
430  if( current )
431  {
432  current->ClearBrightened();
433  getView()->Hide( current, false );
434  highlightGroup.Remove( current );
436  }
437 
438  int id = *evt->GetCommandId();
439 
440  // User has pointed an item, so show it in a different way
441  if( id > 0 && id <= limit )
442  {
443  current = ( *aCollector )[id - 1];
444  current->SetBrightened();
445  getView()->Hide( current, true );
446  highlightGroup.Add( current );
448  }
449  else
450  {
451  current = NULL;
452  }
453  }
454  else if( evt->Action() == TA_CHOICE_MENU_CHOICE )
455  {
456  OPT<int> id = evt->GetCommandId();
457 
458  // User has selected an item, so this one will be returned
459  if( id && ( *id > 0 ) )
460  current = ( *aCollector )[*id - 1];
461  else
462  current = NULL;
463 
464  break;
465  }
466  }
467 
468  if( current && current->IsBrightened() )
469  {
470  current->ClearBrightened();
471  getView()->Hide( current, false );
473  }
474 
475  getView()->Remove( &highlightGroup );
476 
477  return current;
478 }
479 
480 
482 {
483  GERBVIEW_FRAME* frame = getEditFrame<GERBVIEW_FRAME>();
484  const GERBER_DRAW_ITEM* item = static_cast<const GERBER_DRAW_ITEM*>( aItem );
485  int layer = item->GetLayer();
486 
487 
488  if( item->GetLayerPolarity() )
489  {
490  // Don't allow selection of invisible negative items
491  auto rs = static_cast<KIGFX::GERBVIEW_RENDER_SETTINGS*>( getView()->GetPainter()->GetSettings() );
492  if( !rs->IsShowNegativeItems() )
493  return false;
494  }
495 
496  // We do not want to select items that are in the background
497  if( frame->GetDisplayOptions().m_HighContrastMode && layer != frame->GetActiveLayer() )
498  return false;
499 
500  return frame->IsLayerVisible( layer );
501 }
502 
503 
505 {
506  if( aItem->IsSelected() )
507  return;
508 
509  m_selection.Add( aItem );
510  getView()->Add( &m_selection, std::numeric_limits<int>::max() );
511  selectVisually( aItem );
512 }
513 
514 
516 {
517  if( !aItem->IsSelected() )
518  return;
519 
520  unselectVisually( aItem );
521  m_selection.Remove( aItem );
522 
523  if( m_selection.Empty() )
524  getView()->Remove( &m_selection );
525 }
526 
527 
529 {
530  // Move the item's layer to the front
531  int layer = static_cast<GERBER_DRAW_ITEM*>( aItem )->GetLayer();
532  m_frame->SetActiveLayer( layer, true );
533 
534  // Hide the original item, so it is shown only on overlay
535  aItem->SetSelected();
536  getView()->Hide( aItem, true );
537 
538  getView()->Update( &m_selection );
539 }
540 
541 
543 {
544  // Restore original item visibility
545  aItem->ClearSelected();
546  getView()->Hide( aItem, false );
547  getView()->Update( aItem, KIGFX::ALL );
548 
549  getView()->Update( &m_selection );
550 }
551 
552 
554 {
555  auto& view = *getView();
556  auto& controls = *getViewControls();
557  auto previous_settings = controls.GetSettings();
558 
559  std::string tool = aEvent.GetCommandStr().get();
560  m_frame->PushTool( tool );
561  Activate();
562 
564  KIGFX::PREVIEW::RULER_ITEM ruler( twoPtMgr, m_frame->GetUserUnits() );
565 
566  view.Add( &ruler );
567  view.SetVisible( &ruler, false );
568 
569  bool originSet = false;
570 
571  controls.ShowCursor( true );
572  controls.SetSnapping( true );
573 
574  while( TOOL_EVENT* evt = Wait() )
575  {
576  m_frame->GetCanvas()->SetCurrentCursor( wxCURSOR_ARROW );
577  const VECTOR2I cursorPos = controls.GetCursorPosition();
578 
579  auto clearRuler = [&] () {
580  view.SetVisible( &ruler, false );
581  controls.SetAutoPan( false );
582  controls.CaptureCursor( false );
583  originSet = false;
584  };
585 
586  if( evt->IsCancelInteractive() )
587  {
588  if( originSet )
589  clearRuler();
590  else
591  {
592  m_frame->PopTool( tool );
593  break;
594  }
595  }
596 
597  else if( evt->IsActivate() )
598  {
599  if( originSet )
600  clearRuler();
601 
602  if( evt->IsMoveTool() )
603  {
604  // leave ourselves on the stack so we come back after the move
605  break;
606  }
607  else
608  {
609  m_frame->PopTool( tool );
610  break;
611  }
612  }
613 
614  // click or drag starts
615  else if( !originSet && ( evt->IsDrag( BUT_LEFT ) || evt->IsClick( BUT_LEFT ) ) )
616  {
617  if( !evt->IsDrag( BUT_LEFT ) )
618  {
619  twoPtMgr.SetOrigin( cursorPos );
620  twoPtMgr.SetEnd( cursorPos );
621  }
622 
623  controls.CaptureCursor( true );
624  controls.SetAutoPan( true );
625 
626  originSet = true;
627  }
628 
629  else if( !originSet && evt->IsMotion() )
630  {
631  // make sure the origin is set before a drag starts
632  // otherwise you can miss a step
633  twoPtMgr.SetOrigin( cursorPos );
634  twoPtMgr.SetEnd( cursorPos );
635  }
636 
637  // second click or mouse up after drag ends
638  else if( originSet && ( evt->IsClick( BUT_LEFT ) || evt->IsMouseUp( BUT_LEFT ) ) )
639  {
640  originSet = false;
641 
642  controls.SetAutoPan( false );
643  controls.CaptureCursor( false );
644 
645  view.SetVisible( &ruler, false );
646  }
647 
648  // move or drag when origin set updates rules
649  else if( originSet && ( evt->IsMotion() || evt->IsDrag( BUT_LEFT ) ) )
650  {
651  twoPtMgr.SetAngleSnap( evt->Modifier( MD_CTRL ) );
652  twoPtMgr.SetEnd( cursorPos );
653 
654  view.SetVisible( &ruler, true );
655  view.Update( &ruler, KIGFX::GEOMETRY );
656  }
657 
658  else if( evt->IsClick( BUT_RIGHT ) )
659  {
661  }
662 
663  else
664  evt->SetPassEvent();
665  }
666 
667  view.SetVisible( &ruler, false );
668  view.Remove( &ruler );
669  controls.ApplySettings( previous_settings );
670  return 0;
671 }
672 
673 
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:109
void Hide(VIEW_ITEM *aItem, bool aHide=true)
Temporarily hides the item in the view (e.g.
Definition: view.cpp:1507
void AddMenu(ACTION_MENU *aMenu, const SELECTION_CONDITION &aCondition=SELECTION_CONDITIONS::ShowAlways, int aOrder=ANY_ORDER)
Function AddMenu()
wxMenuItem * Add(const wxString &aLabel, int aId, const BITMAP_OPAQUE *aIcon)
Function Add() Adds a wxWidgets-style entry to the menu.
static TOOL_ACTION selectionClear
Clears the current selection.
static const TOOL_EVENT SelectedEvent
Definition: actions.h:202
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:203
ACTION_MENU.
Definition: action_menu.h:44
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:376
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()
Function 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:61
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:129
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:119
int GetCount() const
Function GetCount returns the number of objects in the list.
Definition: collector.h:100
int UnselectItem(const TOOL_EVENT &aEvent)
static TOOL_ACTION measureTool
Definition: actions.h:147
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:585
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)
Function SetIcon() Assigns an icon for the entry.
Definition: action_menu.cpp:70
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:84
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:204
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:162
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:1540
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
Function SetTitle() Sets title for the menu.
Definition: action_menu.cpp:88
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:205
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:131
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:346
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:57
void DisplayTitle(bool aDisplay=true)
Function DisplayTitle() Decides whether a title for a pop up menu should be displayed.
Definition: action_menu.cpp:99
static TOOL_ACTION highlightComponent
virtual void Remove(EDA_ITEM *aItem)
Definition: selection.h:87