48 #define MAX_SELECT_ITEM_IDS 40 49 #define HITTEST_THRESHOLD_PIXELS 3 61 m_frame = getEditFrame<PL_EDITOR_FRAME>();
71 menu.AddSeparator( 1000 );
84 m_frame = getEditFrame<PL_EDITOR_FRAME>();
91 CONDITIONAL_MENU* conditionalMenu = dynamic_cast<CONDITIONAL_MENU*>( actionMenu );
110 evt->Modifier(
MD_ALT ) );
144 bool selectionCancelled =
false;
148 SelectPoint( evt->Position(), &selectionCancelled );
152 if( !selectionCancelled )
157 else if( evt->IsDblClick(
BUT_LEFT ) )
193 else if( evt->IsCancelInteractive() )
210 if( !modifier_enabled
213 && evt->HasPosition()
238 wxMouseState keyboardState = wxGetMouseState();
241 keyboardState.AltDown() );
274 if( drawItem->HitTest( (wxPoint) aWhere, threshold ) )
275 collector.
Append( drawItem );
294 if( aSelectionCancelledFlag )
295 *aSelectionCancelledFlag =
true;
301 bool anyAdded =
false;
302 bool anySubtracted =
false;
308 anySubtracted =
true;
315 for(
int i = 0; i < collector.
GetCount(); ++i )
320 anySubtracted =
true;
343 for(
int i = 0; collector.
GetCount() == 2 && i < 2; ++i )
346 EDA_ITEM* other = collector[ ( i + 1 ) % 2 ];
348 if( item->
HitTest( (wxPoint) aPos, 0 ) && !other->
HitTest( (wxPoint) aPos, 0 ) )
372 bool cancelled =
false;
387 bool windowSelection = width >= 0 ? true :
false;
392 if( evt->IsCancelInteractive() || evt->IsActivate() )
405 area.
SetEnd( evt->Position() );
424 bool anyAdded =
false;
425 bool anySubtracted =
false;
436 if( item->HitTest( selectionRect, windowSelection ) )
441 anySubtracted =
true;
585 if( item->IsSelected() )
612 for(
int i = 0; i < limit; ++i )
615 EDA_ITEM* item = ( *aCollector )[i];
622 menu.AppendSeparator();
638 bool selectAll =
false;
646 for(
int i = 0; i < aCollector->
GetCount(); ++i )
654 int id = *evt->GetCommandId();
657 if(
id > 0 &&
id <= limit )
659 current = ( *aCollector )[
id - 1];
667 if(
id == limit + 1 )
669 for(
int i = 0; i < aCollector->
GetCount(); ++i )
683 for(
int i = 0; i < aCollector->
GetCount(); ++i )
694 if(
id == limit + 1 )
699 else if(
id && ( *
id > 0 ) && ( *
id <= limit ) )
702 current = ( *aCollector )[*
id - 1];
731 aCollector->
Append( current );
777 aGroup->
Add( aItem );
799 const unsigned GRIP_MARGIN = 20;
805 BOX2I itemBox = item->ViewBBox();
void Empty()
Clear the list.
void SetEnd(const VECTOR2I &aEnd)
Set the current end of the rectangle (the corner that moves with the cursor.
void ClearReferencePoint()
void AddStandardSubMenus(TOOL_MENU &aMenu)
Construct a "basic" menu for a tool, containing only items that apply to all tools (e....
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.
PL_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
static const TOOL_EVENT UnselectedEvent
VECTOR2D ToWorld(const VECTOR2D &aCoord, bool aAbsolute=true) const
Converts a screen space point/vector to a point/vector in world space coordinates.
virtual void Add(EDA_ITEM *aItem)
static const TOOL_EVENT DisambiguatePoint
static TOOL_ACTION drawLine
static TOOL_ACTION addItemsToSel
Select a list of items (specified as the event parameter)
static TOOL_ACTION placeImage
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
static TOOL_ACTION zoomFitScreen
void SetExclusiveOr(bool aExclusiveOr)
static TOOL_ACTION placeText
void SetIsHover(bool aIsHover)
void Append(EDA_ITEM *item)
Add an item to the end of the list.
void SetAdditive(bool aAdditive)
virtual bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const
Test if aPosition is inside or on the boundary of this item.
Base class to handle basic graphic items.
static TOOL_ACTION selectionActivate
Activation of the selection tool.
int GetCount() const
Return the number of objects in the list.
static TOOL_ACTION addItemToSel
Select an item (specified as the event parameter).
void SetOrigin(const VECTOR2I &aOrigin)
void Transfer(int aIndex)
Move the item at aIndex (first position is 0) to the backup list.
static TOOL_ACTION removeItemsFromSel
bool HasPoint()
Indicate the cursor is over an edit point.
static DS_DATA_MODEL & GetTheInstance()
static function: returns the instance of DS_DATA_MODEL used in the application
bool Contains(const Vec &aPoint) const
static TOOL_ACTION selectionMenu
Run a selection menu to select from a list of items.
static const TOOL_EVENT ClearedEvent
Selected item had a property changed (except movement)
void UpdateItems()
Iterate through the list of items that asked for updating and updates them.
std::vector< EDA_ITEM * > EDA_ITEMS
Define list of drawing items for screens.
static TOOL_ACTION drawRectangle
static TOOL_ACTION updateMenu
virtual void SetAutoPan(bool aEnabled)
Turn on/off auto panning (this feature is used when there is a tool active (eg.
bool Empty() const
Checks if there is anything selected.
static TOOL_ACTION clearSelection
Clear the current selection.
void SetSubtractive(bool aSubtractive)
virtual unsigned int GetSize() const override
Return the number of stored items.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
void Normalize()
Ensures that the height ant width are positive.
static TOOL_ACTION removeItemFromSel
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
Drawing sheet structure type definitions.
virtual wxString GetSelectMenuText(EDA_UNITS aUnits) const
Return the text to display to be used in the selection clarification context menu when multiple items...
virtual BITMAPS GetMenuImage() const
Return a pointer to an image to be used in menus.
virtual void Remove(EDA_ITEM *aItem)
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
Handle the component boundary box.
VECTOR2I GetOrigin() const
static bool Empty(const SELECTION &aSelection)
Test if there are no items selected.
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
A base class for most all the KiCad significant classes used in schematics and boards.
An abstract class that will find and hold all the objects according to an inspection done by the Insp...
void SetVisible(VIEW_ITEM *aItem, bool aIsVisible=true)
Set the item visibility.
Represent a selection area (currently a rectangle) in a VIEW, drawn corner-to-corner between two poin...
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
EDA_UNITS GetUserUnits() const
Return the user units currently in use.
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.
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...
Tool that displays edit points allowing to modify items by dragging the points.
#define BRIGHTENED
item is drawn with a bright contour