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  return 0;
240 }
241 
242 
244 {
245  return m_selection;
246 }
247 
248 
249 bool GERBVIEW_SELECTION_TOOL::selectPoint( const VECTOR2I& aWhere, bool aOnDrag )
250 {
251  EDA_ITEM* item = NULL;
252  GERBER_COLLECTOR collector;
253  EDA_ITEM* model = getModel<EDA_ITEM>();
254 
255  collector.Collect( model, GERBER_COLLECTOR::AllItems, wxPoint( aWhere.x, aWhere.y ) );
256 
257  // Remove unselectable items
258  for( int i = collector.GetCount() - 1; i >= 0; --i )
259  {
260  if( !selectable( collector[i] ) )
261  collector.Remove( i );
262  }
263 
264  if( collector.GetCount() > 1 )
265  {
266  if( aOnDrag )
268 
269  item = disambiguationMenu( &collector );
270 
271  if( item )
272  {
273  collector.Empty();
274  collector.Append( item );
275  }
276  }
277 
279  clearSelection();
280 
281  if( collector.GetCount() == 1 )
282  {
283  item = collector[ 0 ];
284 
285  if( m_subtractive || ( m_exclusive_or && item->IsSelected() ) )
286  {
287  unselect( item );
289  return false;
290  }
291  else
292  {
293  select( item );
295  return true;
296  }
297  }
298 
299  return false;
300 }
301 
302 
303 bool GERBVIEW_SELECTION_TOOL::selectCursor( bool aSelectAlways )
304 {
305  if( aSelectAlways || m_selection.Empty() )
306  {
307  clearSelection();
308  selectPoint( getViewControls()->GetCursorPosition( false ) );
309  }
310 
311  return !m_selection.Empty();
312 }
313 
314 
316 {
323 }
324 
325 
327 {
328  clearSelection();
329 
330  return 0;
331 }
332 
333 
335 {
336  std::vector<EDA_ITEM*>* items = aEvent.Parameter<std::vector<EDA_ITEM*>*>();
337 
338  if( items )
339  {
340  // Perform individual selection of each item before processing the event.
341  for( auto item : *items )
342  select( item );
343 
345  }
346 
347  return 0;
348 }
349 
350 
352 {
353  // Check if there is an item to be selected
354  EDA_ITEM* item = aEvent.Parameter<EDA_ITEM*>();
355 
356  if( item )
357  {
358  select( item );
359 
360  // Inform other potentially interested tools
362  }
363 
364  return 0;
365 }
366 
367 
369 {
370  std::vector<EDA_ITEM*>* items = aEvent.Parameter<std::vector<EDA_ITEM*>*>();
371 
372  if( items )
373  {
374  // Perform individual unselection of each item before processing the event
375  for( auto item : *items )
376  unselect( item );
377 
379  }
380 
381  return 0;
382 }
383 
384 
386 {
387  // Check if there is an item to be selected
388  EDA_ITEM* item = aEvent.Parameter<EDA_ITEM*>();
389 
390  if( item )
391  {
392  unselect( item );
393 
394  // Inform other potentially interested tools
396  }
397 
398  return 0;
399 }
400 
401 
403 {
404  if( m_selection.Empty() )
405  return;
406 
407  for( auto item : m_selection )
408  unselectVisually( static_cast<EDA_ITEM*>( item ) );
409 
410  m_selection.Clear();
411 
412  // Inform other potentially interested tools
414 }
415 
416 
418 {
419  EDA_ITEM* current = NULL;
420  KIGFX::VIEW_GROUP highlightGroup;
421  ACTION_MENU menu( true );
422 
423  highlightGroup.SetLayer( LAYER_SELECT_OVERLAY );
424  getView()->Add( &highlightGroup );
425 
426  int limit = std::min( 10, aCollector->GetCount() );
427 
428  for( int i = 0; i < limit; ++i )
429  {
430  wxString text;
431  EDA_ITEM* item = ( *aCollector )[i];
432  text = item->GetSelectMenuText( m_frame->GetUserUnits() );
433  menu.Add( text, i + 1, item->GetMenuImage() );
434  }
435 
436  menu.SetTitle( _( "Clarify selection" ) );
437  menu.SetIcon( info_xpm );
438  menu.DisplayTitle( true );
439  SetContextMenu( &menu, CMENU_NOW );
440 
441  while( TOOL_EVENT* evt = Wait() )
442  {
443  if( evt->Action() == TA_CHOICE_MENU_UPDATE )
444  {
445  if( current )
446  {
447  current->ClearBrightened();
448  getView()->Hide( current, false );
449  highlightGroup.Remove( current );
451  }
452 
453  int id = *evt->GetCommandId();
454 
455  // User has pointed an item, so show it in a different way
456  if( id > 0 && id <= limit )
457  {
458  current = ( *aCollector )[id - 1];
459  current->SetBrightened();
460  getView()->Hide( current, true );
461  highlightGroup.Add( current );
463  }
464  else
465  {
466  current = NULL;
467  }
468  }
469  else if( evt->Action() == TA_CHOICE_MENU_CHOICE )
470  {
471  OPT<int> id = evt->GetCommandId();
472 
473  // User has selected an item, so this one will be returned
474  if( id && ( *id > 0 ) )
475  current = ( *aCollector )[*id - 1];
476  else
477  current = NULL;
478 
479  break;
480  }
481  }
482 
483  if( current && current->IsBrightened() )
484  {
485  current->ClearBrightened();
486  getView()->Hide( current, false );
488  }
489 
490  getView()->Remove( &highlightGroup );
491 
492  return current;
493 }
494 
495 
497 {
498  GERBVIEW_FRAME* frame = getEditFrame<GERBVIEW_FRAME>();
499  const GERBER_DRAW_ITEM* item = static_cast<const GERBER_DRAW_ITEM*>( aItem );
500  int layer = item->GetLayer();
501 
502 
503  if( item->GetLayerPolarity() )
504  {
505  // Don't allow selection of invisible negative items
506  auto rs = static_cast<KIGFX::GERBVIEW_RENDER_SETTINGS*>( getView()->GetPainter()->GetSettings() );
507  if( !rs->IsShowNegativeItems() )
508  return false;
509  }
510 
511  // We do not want to select items that are in the background
512  if( frame->GetDisplayOptions().m_HighContrastMode && layer != frame->GetActiveLayer() )
513  return false;
514 
515  return frame->IsLayerVisible( layer );
516 }
517 
518 
520 {
521  if( aItem->IsSelected() )
522  return;
523 
524  m_selection.Add( aItem );
525  getView()->Add( &m_selection, std::numeric_limits<int>::max() );
526  selectVisually( aItem );
527 }
528 
529 
531 {
532  if( !aItem->IsSelected() )
533  return;
534 
535  unselectVisually( aItem );
536  m_selection.Remove( aItem );
537 
538  if( m_selection.Empty() )
539  getView()->Remove( &m_selection );
540 }
541 
542 
544 {
545  // Move the item's layer to the front
546  int layer = static_cast<GERBER_DRAW_ITEM*>( aItem )->GetLayer();
547  m_frame->SetActiveLayer( layer, true );
548 
549  // Hide the original item, so it is shown only on overlay
550  aItem->SetSelected();
551  getView()->Hide( aItem, true );
552 
553  getView()->Update( &m_selection );
554 }
555 
556 
558 {
559  // Restore original item visibility
560  aItem->ClearSelected();
561  getView()->Hide( aItem, false );
562  getView()->Update( aItem, KIGFX::ALL );
563 
564  getView()->Update( &m_selection );
565 }
566 
567 
569 {
570  auto& view = *getView();
571  auto& controls = *getViewControls();
572  auto previous_settings = controls.GetSettings();
573 
574  std::string tool = aEvent.GetCommandStr().get();
575  m_frame->PushTool( tool );
576  Activate();
577 
579  KIGFX::PREVIEW::RULER_ITEM ruler( twoPtMgr, m_frame->GetUserUnits() );
580 
581  view.Add( &ruler );
582  view.SetVisible( &ruler, false );
583 
584  bool originSet = false;
585 
586  controls.ShowCursor( true );
587  controls.SetSnapping( true );
588  controls.SetAdditionalPanButtons( false, true );
589 
590  while( TOOL_EVENT* evt = Wait() )
591  {
592  m_frame->GetCanvas()->SetCurrentCursor( wxCURSOR_ARROW );
593  const VECTOR2I cursorPos = controls.GetCursorPosition();
594 
595  auto clearRuler = [&] () {
596  view.SetVisible( &ruler, false );
597  controls.SetAutoPan( false );
598  controls.CaptureCursor( false );
599  originSet = false;
600  };
601 
602  if( evt->IsCancelInteractive() )
603  {
604  if( originSet )
605  clearRuler();
606  else
607  {
608  m_frame->PopTool( tool );
609  break;
610  }
611  }
612 
613  else if( evt->IsActivate() )
614  {
615  if( originSet )
616  clearRuler();
617 
618  if( evt->IsMoveTool() )
619  {
620  // leave ourselves on the stack so we come back after the move
621  break;
622  }
623  else
624  {
625  m_frame->PopTool( tool );
626  break;
627  }
628  }
629 
630  // click or drag starts
631  else if( !originSet && ( evt->IsDrag( BUT_LEFT ) || evt->IsClick( BUT_LEFT ) ) )
632  {
633  if( !evt->IsDrag( BUT_LEFT ) )
634  {
635  twoPtMgr.SetOrigin( cursorPos );
636  twoPtMgr.SetEnd( cursorPos );
637  }
638 
639  controls.CaptureCursor( true );
640  controls.SetAutoPan( true );
641 
642  originSet = true;
643  }
644 
645  else if( !originSet && evt->IsMotion() )
646  {
647  // make sure the origin is set before a drag starts
648  // otherwise you can miss a step
649  twoPtMgr.SetOrigin( cursorPos );
650  twoPtMgr.SetEnd( cursorPos );
651  }
652 
653  // second click or mouse up after drag ends
654  else if( originSet && ( evt->IsClick( BUT_LEFT ) || evt->IsMouseUp( BUT_LEFT ) ) )
655  {
656  originSet = false;
657 
658  controls.SetAutoPan( false );
659  controls.CaptureCursor( false );
660 
661  view.SetVisible( &ruler, false );
662  }
663 
664  // move or drag when origin set updates rules
665  else if( originSet && ( evt->IsMotion() || evt->IsDrag( BUT_LEFT ) ) )
666  {
667  twoPtMgr.SetAngleSnap( evt->Modifier( MD_CTRL ) );
668  twoPtMgr.SetEnd( cursorPos );
669 
670  view.SetVisible( &ruler, true );
671  view.Update( &ruler, KIGFX::GEOMETRY );
672  }
673 
674  else if( evt->IsClick( BUT_RIGHT ) )
675  {
677  }
678 
679  else
680  evt->SetPassEvent();
681  }
682 
683  view.SetVisible( &ruler, false );
684  view.Remove( &ruler );
685  controls.ApplySettings( previous_settings );
686  return 0;
687 }
688 
689 
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()
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:201
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:94
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:225
Model changes (required full reload)
Definition: tool_base.h:81
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:202
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:235
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:218
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:233
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
Function GetDisplayOptions returns the display options current in use.
bool IsBrightened() const
Definition: base_struct.h:228
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: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:65
virtual void Add(EDA_ITEM *aItem)
Definition: selection.h:75
void ClearBrightened()
Definition: base_struct.h:237
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:231
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:136
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:435
void SetIcon(const BITMAP_OPAQUE *aIcon)
Function SetIcon() Assigns an icon for the entry.
Definition: action_menu.cpp:68
TOOL_EVENT.
Definition: tool_event.h:171
void SetOrigin(const VECTOR2I &aOrigin)
Set the origin of the ruler (the fixed end)
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:203
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:120
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
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...
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
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
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:166
RESET_REASON
Determines the reason of reset for a tool
Definition: tool_base.h:78
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
EDA_UNITS GetUserUnits() const
Return the user units currently in use.
static TOOL_ACTION selectionTool
Definition: actions.h:146
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:97
static TOOL_ACTION highlightComponent
virtual void Remove(EDA_ITEM *aItem)
Definition: selection.h:86