44#define HITTEST_THRESHOLD_PIXELS 3
56 m_frame = getEditFrame<PL_EDITOR_FRAME>();
58 auto& menu =
m_menu->GetMenu();
60 menu.AddSeparator( 200 );
66 menu.AddSeparator( 1000 );
80 m_frame = getEditFrame<PL_EDITOR_FRAME>();
123 bool selectionCancelled =
false;
127 SelectPoint( evt->Position(), &selectionCancelled );
134 if( !selectionCancelled )
139 else if( evt->IsDblClick(
BUT_LEFT ) )
175 else if( evt->IsCancelInteractive() )
195 && evt->HasPosition()
220 wxMouseState keyboardState = wxGetMouseState();
223 keyboardState.AltDown() );
250 if( drawItem->HitTest( aWhere, threshold ) )
251 collector.
Append( drawItem );
268 if( aSelectionCancelledFlag )
269 *aSelectionCancelledFlag =
true;
275 bool anyAdded =
false;
276 bool anySubtracted =
false;
282 anySubtracted =
true;
289 for(
int i = 0; i < collector.
GetCount(); ++i )
294 anySubtracted =
true;
317 for(
int i = 0; collector.
GetCount() == 2 && i < 2; ++i )
320 EDA_ITEM* other = collector[ ( i + 1 ) % 2 ];
346 bool cancelled =
false;
362 : KICURSOR::SELECT_LASSO );
364 if( evt->IsCancelInteractive() || evt->IsActivate() )
377 area.
SetEnd( evt->Position() );
381 area.
SetMode( windowSelection ? SELECTION_MODE::INSIDE_RECTANGLE
382 : SELECTION_MODE::TOUCHING_RECTANGLE );
396 bool anyAdded =
false;
397 bool anySubtracted =
false;
408 if( item->HitTest( selectionRect, windowSelection ) )
413 anySubtracted =
true;
463 if( item->IsSelected() )
508 aGroup->
Add( aItem );
530 const unsigned GRIP_MARGIN = 20;
536 BOX2I itemBox = item->ViewBBox();
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
static TOOL_ACTION selectItem
Select an item (specified as the event parameter).
static TOOL_ACTION unselectItem
static TOOL_ACTION selectionActivate
Activation of the selection tool.
static TOOL_ACTION selectionMenu
Run a selection menu to select from a list of items.
static TOOL_ACTION updateMenu
static TOOL_ACTION zoomFitScreen
static TOOL_ACTION selectionClear
Clear the current selection.
static TOOL_ACTION unselectItems
static TOOL_ACTION selectItems
Select a list of items (specified as the event parameter)
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
constexpr BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
constexpr BOX2< Vec > & Normalize()
Ensure that the height and width are positive.
constexpr bool Contains(const Vec &aPoint) const
An abstract class that will find and hold all the objects according to an inspection done by the Insp...
void Transfer(int aIndex)
Move the item at aIndex (first position is 0) to the backup list.
int GetCount() const
Return the number of objects in the list.
void Append(EDA_ITEM *item)
Add an item to the end of the list.
Drawing sheet structure type definitions.
static DS_DATA_MODEL & GetTheInstance()
Return the instance of DS_DATA_MODEL used in the application.
Base class to handle basic graphic items.
void AddStandardSubMenus(TOOL_MENU &aMenu)
Construct a "basic" menu for a tool, containing only items that apply to all tools (e....
void ForceRefresh()
Force a redraw.
void SetCurrentCursor(KICURSOR aCursor)
Set the current cursor shape for this panel.
A base class for most all the KiCad significant classes used in schematics and boards.
virtual bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const
Test if aPosition is inside or on the boundary of this item.
static const TOOL_EVENT DisambiguatePoint
Used for hotkey feedback.
static const TOOL_EVENT ClearedEvent
static const TOOL_EVENT SelectedEvent
static const TOOL_EVENT UnselectedEvent
Represent a selection area (currently a rectangle) in a VIEW, drawn corner-to-corner between two poin...
VECTOR2I GetOrigin() const
void SetMode(SELECTION_MODE aMode)
void SetSubtractive(bool aSubtractive)
void SetAdditive(bool aAdditive)
void SetOrigin(const VECTOR2I &aOrigin)
const BOX2I ViewBBox() const override
Set the origin of the rectangle (the fixed corner)
void SetExclusiveOr(bool aExclusiveOr)
void SetEnd(const VECTOR2I &aEnd)
Set the current end of the rectangle (the corner that moves with the cursor.
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.
virtual void SetAutoPan(bool aEnabled)
Turn on/off auto panning (this feature is used when there is a tool active (eg.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
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...
VECTOR2D ToWorld(const VECTOR2D &aCoord, bool aAbsolute=true) const
Converts a screen space point/vector to a point/vector in world space coordinates.
void SetVisible(VIEW_ITEM *aItem, bool aIsVisible=true)
Set the item visibility.
static TOOL_ACTION placeImage
static TOOL_ACTION drawRectangle
static TOOL_ACTION placeText
static TOOL_ACTION drawLine
PL_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
Tool that displays edit points allowing to modify items by dragging the points.
bool HasPoint()
Indicate the cursor is over an edit point.
static bool Empty(const SELECTION &aSelection)
Test if there are no items selected.
virtual void Add(EDA_ITEM *aItem)
void SetIsHover(bool aIsHover)
virtual void Remove(EDA_ITEM *aItem)
virtual unsigned int GetSize() const override
Return the number of stored items.
virtual void Clear() override
Remove all the stored items from the group.
void ClearReferencePoint()
bool Empty() const
Checks if there is anything selected.
#define BRIGHTENED
item is drawn with a bright contour
#define SELECTED
Item was manually selected by the user.
int m_DisambiguationMenuDelay
The number of milliseconds to wait in a click before showing a disambiguation menu.
VECTOR2< int32_t > VECTOR2I