23 using namespace std::placeholders;
48 SetTitle(
_(
"Highlight" ) );
55 bool addSeparator =
false;
61 if( selection.Size() == 1 )
63 auto item = static_cast<GERBER_DRAW_ITEM*>( selection[0] );
64 const auto& net_attr = item->GetNetAttributes();
70 menuEntry->SetItemLabel(
wxString::Format(
_(
"Highlight Items of Component '%s'" ),
71 net_attr.m_Cmpref ) );
83 D_CODE* apertDescr = item->GetDcodeDescr();
126 CONDITIONAL_MENU* conditionalMenu = dynamic_cast<CONDITIONAL_MENU*>( actionMenu );
128 if( conditionalMenu )
146 auto selectMenu = std::make_shared<HIGHLIGHT_MENU>();
147 selectMenu->SetTool(
this );
152 menu.
AddMenu( selectMenu.get() );
153 menu.AddSeparator( 1000 );
155 getEditFrame<GERBVIEW_FRAME>()->AddStandardSubMenus(
m_menu );
163 m_frame = getEditFrame<GERBVIEW_FRAME>();
196 evt->Modifier(
MD_ALT ) );
243 EDA_ITEM* model = getModel<EDA_ITEM>();
248 for(
int i = collector.
GetCount() - 1; i >= 0; --i )
273 item = collector[ 0 ];
325 std::vector<EDA_ITEM*>* items = aEvent.
Parameter<std::vector<EDA_ITEM*>*>();
359 std::vector<EDA_ITEM*>* items = aEvent.
Parameter<std::vector<EDA_ITEM*>*>();
415 int limit = std::min( 10, aCollector->
GetCount() );
417 for(
int i = 0; i < limit; ++i )
420 EDA_ITEM* item = ( *aCollector )[i];
446 highlightGroup.
Remove( current );
450 int id = *evt->GetCommandId();
453 if(
id > 0 &&
id <= limit )
455 current = ( *aCollector )[
id - 1];
458 highlightGroup.
Add( current );
471 if(
id && ( *
id > 0 ) )
472 current = ( *aCollector )[*
id - 1];
496 const GERBER_DRAW_ITEM* item = static_cast<const GERBER_DRAW_ITEM*>( aItem );
503 auto rs = static_cast<KIGFX::GERBVIEW_RENDER_SETTINGS*>(
getView()->GetPainter()->GetSettings() );
505 if( !rs->IsShowNegativeItems() )
544 int layer = static_cast<GERBER_DRAW_ITEM*>( aItem )->GetLayer();
void Empty()
Clear the list.
void Hide(VIEW_ITEM *aItem, bool aHide=true)
Temporarily hide the item in the view (e.g.
currently selected items overlay
static TOOL_ACTION selectionClear
Clear the current selection.
static const TOOL_EVENT SelectedEvent
virtual void Clear() override
Remove all the stored items from the group.
void SetCurrentCursor(KICURSOR aCursor)
Set the current cursor shape for this panel.
static const TOOL_EVENT UnselectedEvent
virtual void Add(EDA_ITEM *aItem)
Use when the right click button is pressed or when the select tool is in effect.
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
int GetLayer() const
Return the layer this item is on.
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
void SetActiveLayer(int aLayer, bool doLayerWidgetUpdate=true)
change the currently active layer to aLayer and update the GERBER_LAYER_WIDGET.
static TOOL_ACTION zoomFitScreen
const GBR_DISPLAY_OPTIONS & GetDisplayOptions() const
bool IsBrightened() const
bool m_HighContrastMode
High contrast mode (dim un-highlighted objects)
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 Remove(int aIndex)
Remove the item at aIndex (first position is 0).
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
void SetIsHover(bool aIsHover)
void Append(EDA_ITEM *item)
Add an item to the end of the list.
int GetCount() const
Return the number of objects in the list.
void Collect(EDA_ITEM *aItem, const KICAD_T aScanList[], const wxPoint &aRefPos)
Scan an EDA_ITEM using this class's Inspector method, which does the collection.
void MarkTargetDirty(int aTarget)
Set or clear target 'dirty' flag.
static TOOL_ACTION highlightAttribute
int m_Num_Dcode
D code value ( >= 10 )
Extend VIEW_ITEM by possibility of grouping items into a single object.
Items that may change while the view stays the same (noncached)
virtual void Remove(VIEW_ITEM *aItem)
Remove an item from the group.
static const TOOL_EVENT ClearedEvent
Selected item had a property changed (except movement)
static TOOL_ACTION updateMenu
virtual void Add(VIEW_ITEM *aItem)
Add an item to the group.
virtual void SetLayer(int aLayer)
Set layer used to draw the group.
wxString UnescapeString(const wxString &aSource)
bool Empty() const
Checks if there is anything selected.
wxString m_AperFunction
the aperture attribute (created by a TA.AperFunction command).
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
virtual RENDER_SETTINGS * GetSettings()=0
Return a pointer to current settings that are going to be used when drawing items.
int GetActiveLayer() const
Return the active layer.
A gerber DCODE (also called Aperture) definition.
void SetHighlight(bool aEnabled, int aNetcode=-1, bool aMulti=false)
Turns on/off highlighting.
static TOOL_ACTION highlightClear
virtual wxString GetSelectMenuText(EDA_UNITS aUnits) const
Return the text to display to be used in the selection clarification context menu when multiple items...
static TOOL_ACTION selectionActivate
Activation of the selection tool.
static TOOL_ACTION unselectItem
Unselects an item (specified as the event parameter).
virtual BITMAPS GetMenuImage() const
Return a pointer to an image to be used in menus.
virtual void Remove(EDA_ITEM *aItem)
A base class for most all the KiCad significant classes used in schematics and boards.
static TOOL_ACTION highlightDCode
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
bool IsLayerVisible(int aLayer) const
Test whether a given layer is visible.
bool GetLayerPolarity() const
EDA_UNITS GetUserUnits() const
Return the user units currently in use.
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
static TOOL_ACTION highlightComponent