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  // This is kind of hacky: activate RMB drag on any event.
198  // There doesn't seem to be any other good way to tell when another tool
199  // is canceled and control returns to the selection tool, except by the
200  // fact that the selection tool starts to get events again.
202  {
203  getViewControls()->SetAdditionalPanButtons( false, true );
204  }
205 
206  // Disable RMB pan for other tools; they can re-enable if desired
207  if( evt->IsActivate() )
208  {
209  getViewControls()->SetAdditionalPanButtons( false, false );
210  }
211 
212  // single click? Select single object
213  if( evt->IsClick( BUT_LEFT ) )
214  {
215  selectPoint( evt->Position() );
216  }
217 
218  // right click? if there is any object - show the context menu
219  else if( evt->IsClick( BUT_RIGHT ) )
220  {
221  if( m_selection.Empty() )
222  {
223  selectPoint( evt->Position() );
224  m_selection.SetIsHover( true );
225  }
226 
228  }
229 
230  else if( evt->IsCancel() || evt->Action() == TA_UNDO_REDO_PRE )
231  {
232  clearSelection();
233  }
234 
235  else
236  evt->SetPassEvent();
237  }
238 
239  // This tool is supposed to be active forever
240  assert( false );
241 
242  return 0;
243 }
244 
245 
247 {
248  return m_selection;
249 }
250 
251 
252 bool GERBVIEW_SELECTION_TOOL::selectPoint( const VECTOR2I& aWhere, bool aOnDrag )
253 {
254  EDA_ITEM* item = NULL;
255  GERBER_COLLECTOR collector;
256  EDA_ITEM* model = getModel<EDA_ITEM>();
257 
258  collector.Collect( model, GERBER_COLLECTOR::AllItems, wxPoint( aWhere.x, aWhere.y ) );
259 
260  // Remove unselectable items
261  for( int i = collector.GetCount() - 1; i >= 0; --i )
262  {
263  if( !selectable( collector[i] ) )
264  collector.Remove( i );
265  }
266 
267  if( collector.GetCount() > 1 )
268  {
269  if( aOnDrag )
271 
272  item = disambiguationMenu( &collector );
273 
274  if( item )
275  {
276  collector.Empty();
277  collector.Append( item );
278  }
279  }
280 
282  clearSelection();
283 
284  if( collector.GetCount() == 1 )
285  {
286  item = collector[ 0 ];
287 
288  if( m_subtractive || ( m_exclusive_or && item->IsSelected() ) )
289  {
290  unselect( item );
292  return false;
293  }
294  else
295  {
296  select( item );
298  return true;
299  }
300  }
301 
302  return false;
303 }
304 
305 
306 bool GERBVIEW_SELECTION_TOOL::selectCursor( bool aSelectAlways )
307 {
308  if( aSelectAlways || m_selection.Empty() )
309  {
310  clearSelection();
311  selectPoint( getViewControls()->GetCursorPosition( false ) );
312  }
313 
314  return !m_selection.Empty();
315 }
316 
317 
319 {
326 }
327 
328 
330 {
331  clearSelection();
332 
333  return 0;
334 }
335 
336 
338 {
339  std::vector<EDA_ITEM*>* items = aEvent.Parameter<std::vector<EDA_ITEM*>*>();
340 
341  if( items )
342  {
343  // Perform individual selection of each item before processing the event.
344  for( auto item : *items )
345  select( item );
346 
348  }
349 
350  return 0;
351 }
352 
353 
355 {
356  // Check if there is an item to be selected
357  EDA_ITEM* item = aEvent.Parameter<EDA_ITEM*>();
358 
359  if( item )
360  {
361  select( item );
362 
363  // Inform other potentially interested tools
365  }
366 
367  return 0;
368 }
369 
370 
372 {
373  std::vector<EDA_ITEM*>* items = aEvent.Parameter<std::vector<EDA_ITEM*>*>();
374 
375  if( items )
376  {
377  // Perform individual unselection of each item before processing the event
378  for( auto item : *items )
379  unselect( item );
380 
382  }
383 
384  return 0;
385 }
386 
387 
389 {
390  // Check if there is an item to be selected
391  EDA_ITEM* item = aEvent.Parameter<EDA_ITEM*>();
392 
393  if( item )
394  {
395  unselect( item );
396 
397  // Inform other potentially interested tools
399  }
400 
401  return 0;
402 }
403 
404 
406 {
407  if( m_selection.Empty() )
408  return;
409 
410  for( auto item : m_selection )
411  unselectVisually( static_cast<EDA_ITEM*>( item ) );
412 
413  m_selection.Clear();
414 
415  // Inform other potentially interested tools
417 }
418 
419 
421 {
422  EDA_ITEM* current = NULL;
423  KIGFX::VIEW_GROUP highlightGroup;
424  ACTION_MENU menu( true );
425 
426  highlightGroup.SetLayer( LAYER_SELECT_OVERLAY );
427  getView()->Add( &highlightGroup );
428 
429  int limit = std::min( 10, aCollector->GetCount() );
430 
431  for( int i = 0; i < limit; ++i )
432  {
433  wxString text;
434  EDA_ITEM* item = ( *aCollector )[i];
435  text = item->GetSelectMenuText( m_frame->GetUserUnits() );
436  menu.Add( text, i + 1, item->GetMenuImage() );
437  }
438 
439  menu.SetTitle( _( "Clarify selection" ) );
440  menu.SetIcon( info_xpm );
441  menu.DisplayTitle( true );
442  SetContextMenu( &menu, CMENU_NOW );
443 
444  while( TOOL_EVENT* evt = Wait() )
445  {
446  if( evt->Action() == TA_CHOICE_MENU_UPDATE )
447  {
448  if( current )
449  {
450  current->ClearBrightened();
451  getView()->Hide( current, false );
452  highlightGroup.Remove( current );
454  }
455 
456  int id = *evt->GetCommandId();
457 
458  // User has pointed an item, so show it in a different way
459  if( id > 0 && id <= limit )
460  {
461  current = ( *aCollector )[id - 1];
462  current->SetBrightened();
463  getView()->Hide( current, true );
464  highlightGroup.Add( current );
466  }
467  else
468  {
469  current = NULL;
470  }
471  }
472  else if( evt->Action() == TA_CHOICE_MENU_CHOICE )
473  {
474  OPT<int> id = evt->GetCommandId();
475 
476  // User has selected an item, so this one will be returned
477  if( id && ( *id > 0 ) )
478  current = ( *aCollector )[*id - 1];
479  else
480  current = NULL;
481 
482  break;
483  }
484  }
485 
486  if( current && current->IsBrightened() )
487  {
488  current->ClearBrightened();
489  getView()->Hide( current, false );
491  }
492 
493  getView()->Remove( &highlightGroup );
494 
495  return current;
496 }
497 
498 
500 {
501  GERBVIEW_FRAME* frame = getEditFrame<GERBVIEW_FRAME>();
502  const GERBER_DRAW_ITEM* item = static_cast<const GERBER_DRAW_ITEM*>( aItem );
503  int layer = item->GetLayer();
504 
505 
506  if( item->GetLayerPolarity() )
507  {
508  // Don't allow selection of invisible negative items
509  auto rs = static_cast<KIGFX::GERBVIEW_RENDER_SETTINGS*>( getView()->GetPainter()->GetSettings() );
510  if( !rs->IsShowNegativeItems() )
511  return false;
512  }
513 
514  // We do not want to select items that are in the background
515  if( frame->m_DisplayOptions.m_HighContrastMode && layer != frame->GetActiveLayer() )
516  return false;
517 
518  return frame->IsLayerVisible( layer );
519 }
520 
521 
523 {
524  if( aItem->IsSelected() )
525  return;
526 
527  m_selection.Add( aItem );
529  selectVisually( aItem );
530 }
531 
532 
534 {
535  if( !aItem->IsSelected() )
536  return;
537 
538  unselectVisually( aItem );
539  m_selection.Remove( aItem );
540 
541  if( m_selection.Empty() )
542  getView()->Remove( &m_selection );
543 }
544 
545 
547 {
548  // Move the item's layer to the front
549  int layer = static_cast<GERBER_DRAW_ITEM*>( aItem )->GetLayer();
550  m_frame->SetActiveLayer( layer, true );
551 
552  // Hide the original item, so it is shown only on overlay
553  aItem->SetSelected();
554  getView()->Hide( aItem, true );
555 
556  getView()->Update( &m_selection );
557 }
558 
559 
561 {
562  // Restore original item visibility
563  aItem->ClearSelected();
564  getView()->Hide( aItem, false );
565  getView()->Update( aItem, KIGFX::ALL );
566 
567  getView()->Update( &m_selection );
568 }
569 
570 
572 {
573  auto& view = *getView();
574  auto& controls = *getViewControls();
575  auto previous_settings = controls.GetSettings();
576 
577  std::string tool = aEvent.GetCommandStr().get();
578  m_frame->PushTool( tool );
579  Activate();
580 
582  KIGFX::PREVIEW::RULER_ITEM ruler( twoPtMgr, m_frame->GetUserUnits() );
583 
584  view.Add( &ruler );
585  view.SetVisible( &ruler, false );
586 
587  bool originSet = false;
588 
589  controls.ShowCursor( true );
590  controls.SetSnapping( true );
591  controls.SetAdditionalPanButtons( false, true );
592 
593  while( TOOL_EVENT* evt = Wait() )
594  {
595  m_frame->GetCanvas()->SetCurrentCursor( wxCURSOR_ARROW );
596  const VECTOR2I cursorPos = controls.GetCursorPosition();
597 
598  auto clearRuler = [&] () {
599  view.SetVisible( &ruler, false );
600  controls.SetAutoPan( false );
601  controls.CaptureCursor( false );
602  originSet = false;
603  };
604 
605  if( evt->IsCancelInteractive() )
606  {
607  if( originSet )
608  clearRuler();
609  else
610  {
611  m_frame->PopTool( tool );
612  break;
613  }
614  }
615 
616  else if( evt->IsActivate() )
617  {
618  if( originSet )
619  clearRuler();
620 
621  if( evt->IsMoveTool() )
622  {
623  // leave ourselves on the stack so we come back after the move
624  break;
625  }
626  else
627  {
628  m_frame->PopTool( tool );
629  break;
630  }
631  }
632 
633  // click or drag starts
634  else if( !originSet && ( evt->IsDrag( BUT_LEFT ) || evt->IsClick( BUT_LEFT ) ) )
635  {
636  if( !evt->IsDrag( BUT_LEFT ) )
637  {
638  twoPtMgr.SetOrigin( cursorPos );
639  twoPtMgr.SetEnd( cursorPos );
640  }
641 
642  controls.CaptureCursor( true );
643  controls.SetAutoPan( true );
644 
645  originSet = true;
646  }
647 
648  else if( !originSet && evt->IsMotion() )
649  {
650  // make sure the origin is set before a drag starts
651  // otherwise you can miss a step
652  twoPtMgr.SetOrigin( cursorPos );
653  twoPtMgr.SetEnd( cursorPos );
654  }
655 
656  // second click or mouse up after drag ends
657  else if( originSet && ( evt->IsClick( BUT_LEFT ) || evt->IsMouseUp( BUT_LEFT ) ) )
658  {
659  originSet = false;
660 
661  controls.SetAutoPan( false );
662  controls.CaptureCursor( false );
663 
664  view.SetVisible( &ruler, false );
665  }
666 
667  // move or drag when origin set updates rules
668  else if( originSet && ( evt->IsMotion() || evt->IsDrag( BUT_LEFT ) ) )
669  {
670  twoPtMgr.SetAngleSnap( evt->Modifier( MD_CTRL ) );
671  twoPtMgr.SetEnd( cursorPos );
672 
673  view.SetVisible( &ruler, true );
674  view.Update( &ruler, KIGFX::GEOMETRY );
675  }
676 
677  else if( evt->IsClick( BUT_RIGHT ) )
678  {
680  }
681 
682  else
683  evt->SetPassEvent();
684  }
685 
686  view.SetVisible( &ruler, false );
687  view.Remove( &ruler );
688  controls.ApplySettings( previous_settings );
689  return 0;
690 }
691 
692 
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:122
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()
virtual void PushTool(const std::string &actionName)
NB: the definition of "tool" is different at the user level.
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:197
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:93
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:233
Model changes (required full reload)
Definition: tool_base.h:82
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:198
Class ACTION_MENU.
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:243
void SetCurrentCursor(wxStockCursor aStockCursorID)
Function SetCurrentCursor Set the current cursor shape for this panel.
VIEW_CONTROLS class definition.
Class GERBER_COLLECTOR is intended for use when the right click button is pressed,...
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 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 also update the GERBER_L...
void SetBrightened()
Definition: base_struct.h:241
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()
bool IsBrightened() const
Definition: base_struct.h:236
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).
int GetActiveLayer()
Function SetActiveLayer returns the active layer.
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:142
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:64
virtual void Add(EDA_ITEM *aItem)
Definition: selection.h:74
void ClearBrightened()
Definition: base_struct.h:245
void Append(EDA_ITEM *item)
Function Append adds an item to the end of the list.
Definition: collector.h:132
int GetCount() const
Function GetCount returns the number of objects in the list.
Definition: collector.h:113
int UnselectItem(const TOOL_EVENT &aEvent)
static TOOL_ACTION measureTool
Definition: actions.h:144
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.
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:239
void SetHighlight(bool aEnabled, int aNetcode=-1, bool aHighlightItems=false)
Function SetHighlight Turns on/off highlighting - it may be done for the active layer,...
Definition: painter.h:141
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).
static TOOL_ACTION highlightAttribute
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:427
void SetIcon(const BITMAP_OPAQUE *aIcon)
Function SetIcon() Assigns an icon for the entry.
Definition: action_menu.cpp:68
GBR_DISPLAY_OPTIONS m_DisplayOptions
Class TOOL_EVENT.
Definition: tool_event.h:168
void SetOrigin(const VECTOR2I &aOrigin)
Set the origin of the ruler (the fixed end)
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:199
Class RULER_ITEM.
Definition: ruler_item.h:43
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:158
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
TOOL_SETTINGS & GetSettings()
Definition: tool_base.cpp:78
#define _(s)
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:119
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:455
int MeasureTool(const TOOL_EVENT &aEvent)
Launches a tool to measure between points
void SetAdditionalPanButtons(bool aLeft=false, bool aRight=false)
int SelectItem(const TOOL_EVENT &aEvent)
virtual RENDER_SETTINGS * GetSettings()=0
Function GetSettings Returns pointer to current settings that are going to be used when drawing items...
Class GERBVIEW_SELECTION_TOOL.
void SetTitle(const wxString &aTitle) override
Function SetTitle() Sets title for the menu.
Definition: action_menu.cpp:86
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:101
Class D_CODE holds a gerber DCODE (also called Aperture) definition.
Definition: dcode.h:82
bool ToolStackIsEmpty()
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
EDA_UNITS_T GetUserUnits() const
Return the user units currently in use.
#define max(a, b)
Definition: auxiliary.h:86
static TOOL_ACTION highlightClear
int UnselectItems(const TOOL_EVENT &aEvent)
wxString UnescapeString(const wxString &aSource)
Definition: string.cpp:131
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...
size_t i
Definition: json11.cpp:597
virtual wxString GetSelectMenuText(EDA_UNITS_T aUnits) const
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
currently selected items overlay
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:163
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
virtual void PopTool(const std::string &actionName)
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
bool IsCurrentTool(const TOOL_ACTION &aAction) const
void ShowContextMenu(SELECTION &aSelection)
Function ShowContextMenu.
Definition: tool_menu.cpp:59
static TOOL_ACTION selectionTool
Definition: actions.h:143
void SetEnd(const VECTOR2I &aEnd)
Set the current end of the rectangle (the end that moves with the cursor.
#define min(a, b)
Definition: auxiliary.h:85
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:97
static TOOL_ACTION highlightComponent
virtual void Remove(EDA_ITEM *aItem)
Definition: selection.h:85