72 if( aSel.GetSize() == 1 )
86 return aSel.GetSize() == 1 && aSel.Front()->Type() ==
SCH_SYMBOL_T;
92 if( aSel.GetSize() == 1 )
106 if( aSel.GetSize() == 1 )
120 if( aSel.GetSize() == 1 )
124 if(
pin &&
pin->GetLibPin() )
125 return !
pin->GetLibPin()->GetAlternates().empty();
137 return !
static_cast<SCH_MARKER*
>( aSel.Front() )->IsExcluded();
143 return aSel.GetSize() > 1 && aSel.OnlyContains( {
SCH_SYMBOL_T } );
149 return aSel.GetSize() >= 1 && aSel.OnlyContains( {
SCH_PIN_T } );
159#define HITTEST_THRESHOLD_PIXELS 5
166 m_isSymbolEditor( false ),
167 m_isSymbolViewer( false ),
220 m_frame = getEditFrame<SCH_BASE_FRAME>();
225 if( symbolEditorFrame )
243 auto schEditSheetPageNumberCondition =
252 auto schEditCondition =
258 auto belowRootSheetCondition =
282 auto symbolDisplayNameIsEditable =
290 return symbEditorFrame
306 menu.AddSeparator( 100 );
310 menu.AddSeparator( 100 );
319 menu.AddSeparator( 200 );
332 menu.AddSeparator( 400 );
338 menu.AddSeparator( 1000 );
351 m_frame = getEditFrame<SCH_BASE_FRAME>();
370 if( symbolEditFrame )
395 auto pinOrientation =
405 return pin->GetOrientation();
410 return dummy.GetOrientation();
421 case SHEET_SIDE::LEFT:
return PIN_ORIENTATION::PIN_RIGHT;
422 case SHEET_SIDE::RIGHT:
return PIN_ORIENTATION::PIN_LEFT;
423 case SHEET_SIDE::TOP:
return PIN_ORIENTATION::PIN_DOWN;
424 case SHEET_SIDE::BOTTOM:
return PIN_ORIENTATION::PIN_UP;
428 return PIN_ORIENTATION::PIN_LEFT;
434 bool selCancelled =
false;
435 bool displayWireCursor =
false;
436 bool displayBusCursor =
false;
437 bool displayLineCursor =
false;
438 KIID rolloverItem = lastRolloverItem;
442 evt->Modifier(
MD_ALT ) );
482 schframe->FocusOnItem(
nullptr );
506 else if( collector[0]->IsHypertext() )
508 collector[ 0 ]->DoHypertextAction(
m_frame );
511 else if( collector[0]->IsBrightened() )
518 schframe->SelectNetNavigatorItem( &itemData );
538 SelectPoint( evt->Position(), { SCH_LOCATE_ANY_T },
nullptr, &selCancelled );
551 if(
CollectHits( collector, evt->Position(), { SCH_LOCATE_ANY_T } ) )
555 SelectPoint( evt->Position(), { SCH_LOCATE_ANY_T },
nullptr, &selCancelled );
563 else if( evt->IsDblClick(
BUT_LEFT ) )
569 schframe->FocusOnItem(
nullptr );
605 schframe->FocusOnItem(
nullptr );
609 if(
CollectHits( collector, evt->DragOrigin(), { SCH_TABLECELL_T } ) )
613 else if(
hasModifier() || drag_action == MOUSE_DRAG_ACTION::SELECT )
617 else if(
m_selection.
Empty() && drag_action != MOUSE_DRAG_ACTION::DRAG_ANY )
660 else if( evt->IsMouseDown(
BUT_AUX1 ) )
664 else if( evt->IsMouseDown(
BUT_AUX2 ) )
695 wxString alt = *evt->Parameter<wxString*>();
719 newItems.push_back( nc );
722 commit.
Push( wxS(
"No Connect Pins" ) );
727 VECTOR2I wireGrid =
grid.GetGridSize( GRID_HELPER_GRIDS::GRID_WIRES );
737 switch( pinOrientation( item ) )
740 case PIN_ORIENTATION::PIN_RIGHT:
743 case PIN_ORIENTATION::PIN_LEFT:
746 case PIN_ORIENTATION::PIN_UP:
749 case PIN_ORIENTATION::PIN_DOWN:
758 newItems.push_back( wire );
776 commit.
Push( wxS(
"Wire Pins" ) );
794 labelText =
pin->GetShownName();
795 else if( sheetPin && sf )
798 switch( *evt->GetCommandId() )
801 label =
new SCH_LABEL( item->GetPosition(), labelText );
812 switch( pinOrientation( item ) )
815 case PIN_ORIENTATION::PIN_RIGHT:
818 case PIN_ORIENTATION::PIN_LEFT:
821 case PIN_ORIENTATION::PIN_UP:
824 case PIN_ORIENTATION::PIN_DOWN:
833 pinType =
pin->GetType();
839 case LABEL_INPUT: pinType = ELECTRICAL_PINTYPE::PT_INPUT;
break;
840 case LABEL_OUTPUT: pinType = ELECTRICAL_PINTYPE::PT_OUTPUT;
break;
841 case LABEL_BIDI: pinType = ELECTRICAL_PINTYPE::PT_BIDI;
break;
842 case LABEL_TRISTATE: pinType = ELECTRICAL_PINTYPE::PT_TRISTATE;
break;
843 case LABEL_PASSIVE: pinType = ELECTRICAL_PINTYPE::PT_PASSIVE;
break;
849 case ELECTRICAL_PINTYPE::PT_BIDI:
850 label->
SetShape( LABEL_FLAG_SHAPE::L_BIDI );
852 case ELECTRICAL_PINTYPE::PT_INPUT:
853 label->
SetShape( LABEL_FLAG_SHAPE::L_INPUT );
855 case ELECTRICAL_PINTYPE::PT_OUTPUT:
856 label->
SetShape( LABEL_FLAG_SHAPE::L_OUTPUT );
858 case ELECTRICAL_PINTYPE::PT_TRISTATE:
859 label->
SetShape( LABEL_FLAG_SHAPE::L_TRISTATE );
861 case ELECTRICAL_PINTYPE::PT_UNSPECIFIED:
862 label->
SetShape( LABEL_FLAG_SHAPE::L_UNSPECIFIED );
865 label->
SetShape( LABEL_FLAG_SHAPE::L_INPUT );
869 newItems.push_back( label );
872 commit.
Push( wxS(
"Label Pins" ) );
883 wxString* net =
new wxString( *evt->Parameter<wxString*>() );
887 else if( evt->IsCancelInteractive() )
897 schframe->FocusOnItem(
nullptr );
903 else if( evt->FirstResponder() ==
this && evt->GetCommandId() == (
int) WXK_ESCAPE )
908 editor->ClearHighlight( *evt );
914 schframe->FocusOnItem(
nullptr );
916 else if( evt->IsMotion() && !
m_isSymbolEditor && evt->FirstResponder() == this )
935 displayBusCursor =
true;
937 displayWireCursor =
true;
939 displayLineCursor =
true;
941 else if( collector[0]->IsHypertext() && !collector[0]->IsSelected() )
943 rolloverItem = collector[0]->m_Uuid;
953 if( rolloverItem != lastRolloverItem )
974 lastRolloverItem = rolloverItem;
985 if( displayWireCursor )
989 else if( displayBusCursor )
993 else if( displayLineCursor )
997 else if( rolloverItem !=
niluuid )
1002 && drag_action == MOUSE_DRAG_ACTION::DRAG_SELECTED
1003 && evt->HasPosition()
1015 m_disambiguateTimer.Stop();
1018 m_selection.Clear();
1062 if( possibleConnection.
IsBus() )
1073 if( !
pin->IsVisible()
1081 newEvt->SetMousePosition( pos );
1082 newEvt->SetHasPosition(
true );
1083 newEvt->SetForceImmediate(
true );
1096 wxMouseState keyboardState = wxGetMouseState();
1099 keyboardState.AltDown() );
1114 wxMouseState keyboardState = wxGetMouseState();
1117 keyboardState.AltDown() );
1138 const std::vector<KICAD_T>& aScanTypes )
1141 int gridThreshold =
KiROUND(
getView()->GetGAL()->GetGridSize().EuclideanNorm() / 2 );
1142 aCollector.
m_Threshold = std::max( pixelThreshold, gridThreshold );
1162 int originalCount = aCollector.
GetCount();
1164 for(
int ii = 0; ii < originalCount; ++ii )
1166 if( aCollector[ii]->Type() ==
SCH_PIN_T )
1170 if( !aCollector.
HasItem(
pin->GetParentSymbol() ) )
1171 aCollector.
Append(
pin->GetParentSymbol() );
1182 bool aCheckLocked,
bool aSelectedOnly )
1186 for(
int i = collector.
GetCount() - 1; i >= 0; --i )
1188 if( symbolEditorFrame )
1219 if( aCheckLocked && collector[i]->IsLocked() )
1231 if( aSelectedOnly && !collector[i]->IsSelected() )
1245 EDA_ITEM** aItem,
bool* aSelectionCancelledFlag,
bool aAdd,
1246 bool aSubtract,
bool aExclusiveOr )
1264 if( aSelectionCancelledFlag )
1265 *aSelectionCancelledFlag =
true;
1271 if( !aAdd && !aSubtract && !aExclusiveOr )
1275 bool anySubtracted =
false;
1279 for(
int i = 0; i < aCollector.
GetCount(); ++i )
1282 bool isLine = aCollector[i]->Type() ==
SCH_LINE_T;
1298 || ( aExclusiveOr && aCollector[i]->IsSelected()
1299 && ( !isLine || ( isLine && aCollector[i]->HasFlag( flags ) ) ) ) )
1301 aCollector[i]->ClearFlags( flags );
1311 anySubtracted =
true;
1316 aCollector[i]->SetFlags( flags );
1323 if( addedCount == 1 )
1327 if( aItem && aCollector.
GetCount() == 1 )
1328 *aItem = aCollector[0];
1332 else if( addedCount > 1 )
1337 else if( anySubtracted )
1348 const std::vector<KICAD_T>& aScanTypes,
1349 EDA_ITEM** aItem,
bool* aSelectionCancelledFlag,
1350 bool aCheckLocked,
bool aAdd,
bool aSubtract,
1355 if( !
CollectHits( collector, aWhere, aScanTypes ) )
1360 return selectPoint( collector, aWhere, aItem, aSelectionCancelledFlag, aAdd, aSubtract,
1371 std::vector<KIGFX::VIEW::LAYER_ITEM_PAIR> selectedItems;
1372 std::vector<KIGFX::VIEW::LAYER_ITEM_PAIR> sheetPins;
1378 view->
Query( selectionBox, selectedItems );
1387 int layer = pair.second;
1394 selectedItems.insert( selectedItems.end(), sheetPins.begin(), sheetPins.end() );
1396 for(
const std::pair<KIGFX::VIEW_ITEM*, int>& item_pair : selectedItems )
1423 std::vector<KIGFX::VIEW::LAYER_ITEM_PAIR> selectedItems;
1429 view->
Query( selectionBox, selectedItems );
1464 std::set<EDA_ITEM*> exactHits;
1466 for(
int i = collector.
GetCount() - 1; i >= 0; --i )
1474 if( line || ( shape && shape->
GetShape() == SHAPE_T::POLY )
1475 || ( shape && shape->
GetShape() == SHAPE_T::ARC ) )
1479 if( item->
HitTest( aPos, pixelThreshold ) )
1480 exactHits.insert( item );
1492 if( item->
HitTest( aPos, 0 ) )
1493 exactHits.insert( item );
1499 if( exactHits.size() > 0 && exactHits.size() < (
unsigned) collector.
GetCount() )
1501 for(
int i = collector.
GetCount() - 1; i >= 0; --i )
1505 if( !exactHits.contains( item ) )
1511 SEG poss( aPos, aPos );
1513 int closestDist = INT_MAX / 4;
1517 BOX2I bbox = item->GetBoundingBox();
1518 int dist = INT_MAX / 4;
1523 bool dominating =
false;
1525 if( exactHits.contains( item ) )
1560 ->Collide( poss, INT_MAX / 4, &dist );
1564 text->GetEffectiveTextShape(
false )->Collide( poss, INT_MAX / 4, &dist );
1570 for(
SHAPE* s : shapes )
1572 int shapeDist = dist;
1573 s->Collide( poss, INT_MAX / 4, &shapeDist );
1575 if( shapeDist < dist )
1593 rect.
Collide( poss, closestDist, &dist );
1611 if( dist == closestDist )
1613 if( item->GetParent() == closest )
1616 else if( dist < closestDist )
1632 for(
int i = collector.
GetCount() - 1; i >= 0; --i )
1636 if( item == closest )
1639 if( !item->
HitTest( tightBox,
true ) )
1647 bool aPromoteCellSelections )
1649 bool anyUnselected =
false;
1650 bool anySelected =
false;
1663 bool isMoving =
false;
1668 isMoving |=
static_cast<SCH_ITEM*
>( item )->IsMoving();
1670 if( !item->
IsType( aScanTypes ) )
1673 anyUnselected =
true;
1681 if( aPromoteCellSelections )
1683 std::set<EDA_ITEM*> parents;
1693 anyUnselected =
true;
1699 if( !parent->IsSelected() )
1731 switch( aItem->
Type() )
1749 switch(
static_cast<SCH_LINE*
>( aItem )->GetLayer() )
1833 bool cancelled =
false;
1849 bool isGreedy = width < 0;
1852 isGreedy = !isGreedy;
1855 : KICURSOR::SELECT_WINDOW );
1857 if( evt->IsCancelInteractive() || evt->IsActivate() )
1870 area.
SetEnd( evt->Position() );
1888 std::vector<KIGFX::VIEW::LAYER_ITEM_PAIR> nearbyViewItems;
1892 std::unordered_set<EDA_ITEM*> nearbyItems;
1893 std::vector<EDA_ITEM*> nearbyChildren;
1894 std::vector<EDA_ITEM*> flaggedItems;
1900 if( nearbyItems.insert( item ).second )
1906 sch_item->RunOnChildren(
1912 int unit =
pin->GetLibPin()->GetUnit();
1914 if( unit && unit !=
pin->GetParentSymbol()->GetUnit() )
1918 nearbyChildren.push_back( aChild );
1928 bool anyAdded =
false;
1929 bool anySubtracted =
false;
1944 anySubtracted =
true;
1949 if( flags && !anySubtracted )
1960 for(
EDA_ITEM* item : nearbyItems )
1962 bool selected =
false;
1974 if( ( isGreedy && line->
HitTest( selectionRect,
false ) )
1981 else if( !isGreedy )
2000 selected = item->HitTest( selectionRect, !isGreedy );
2007 flaggedItems.push_back( item );
2008 selectItem( item, flags );
2014 for(
EDA_ITEM* item : nearbyChildren )
2021 && !item->GetParent()->HasFlag(
CANDIDATE )
2022 && item->HitTest( selectionRect, !isGreedy ) )
2024 selectItem( item, 0 );
2030 for(
EDA_ITEM* item : flaggedItems )
2050 evt->SetPassEvent();
2071 bool cancelled =
false;
2076 if( cell->IsSelected() )
2085 return ( aItem->GetFlags() &
CANDIDATE ) > 0;
2090 if( evt->IsCancelInteractive() || evt->IsActivate() )
2099 BOX2I selectionRect( evt->DragOrigin(), evt->Position() - evt->DragOrigin() );
2104 bool doSelect =
false;
2106 if( cell->HitTest( selectionRect,
false ) )
2111 doSelect = !wasSelected( cell );
2115 else if( wasSelected( cell ) )
2120 if( doSelect && !cell->IsSelected() )
2122 else if( !doSelect && cell->IsSelected() )
2126 else if( evt->IsMouseUp(
BUT_LEFT ) )
2130 bool anyAdded =
false;
2131 bool anySubtracted =
false;
2135 if( cell->IsSelected() && !wasSelected( cell ) )
2137 else if( wasSelected( cell ) && !cell->IsSelected() )
2138 anySubtracted =
true;
2157 evt->SetPassEvent();
2181 int gridThreshold =
KiROUND(
getView()->GetGAL()->GetGridSize().EuclideanNorm() );
2182 int thresholdMax = std::max( pixelThreshold, gridThreshold );
2184 for(
int threshold : { 0, thresholdMax/4, thresholdMax/2, thresholdMax } )
2193 return collector.
GetCount() ? collector[ 0 ] :
nullptr;
2214 unsigned done =
false;
2228 if( item->IsType( { SCH_ITEM_LOCATE_WIRE_T, SCH_ITEM_LOCATE_BUS_T,
2229 SCH_ITEM_LOCATE_GRAPHIC_LINE_T } )
2230 && !item->IsSelected() )
2256 std::set<std::pair<SCH_TABLE*, int>> columns;
2264 columns.insert( std::make_pair( table, cell->GetColumn() ) );
2268 for(
auto& [ table, col ] : columns )
2270 for(
int row = 0; row < table->GetRowCount(); ++row )
2276 select( table->GetCell( row, col ) );
2291 std::set<std::pair<SCH_TABLE*, int>> rows;
2299 rows.insert( std::make_pair( table, cell->GetRow() ) );
2303 for(
auto& [ table, row ] : rows )
2305 for(
int col = 0; col < table->GetColCount(); ++col )
2311 select( table->GetCell( row, col ) );
2326 std::set<SCH_TABLE*> tables;
2332 tables.insert(
static_cast<SCH_TABLE*
>( cell->GetParent() ) );
2339 if( !table->IsSelected() )
2382 double compRatio = bbSize.
y / currTextHeight;
2383 double compRatioBent = 1.0;
2389 std::vector<std::pair<double, double>> lut{ { 1.25, 16 },
2398 std::vector<std::pair<double, double>>::iterator it;
2401 compRatioBent = lut.back().second;
2405 if( compRatio >= lut.front().first )
2407 for( it = lut.begin(); it < lut.end() - 1; ++it )
2409 if( it->first <= compRatio &&
next( it )->first >= compRatio )
2411 double diffx = compRatio - it->first;
2412 double diffn =
next( it )->first - it->first;
2414 compRatioBent = it->second + (
next( it )->second - it->second ) * diffx / diffn;
2421 compRatioBent = lut.front().second;
2430 screenSize.
x = std::max( 10.0, screenSize.
x );
2431 screenSize.
y = std::max( 10.0, screenSize.
y );
2432 double ratio = std::max( -1.0, fabs( bbSize.
y / screenSize.
y ) );
2435 double kicadRatio = std::max( fabs( bbSize.
x / screenSize.
x ),
2436 fabs( bbSize.
y / screenSize.
y ) );
2441 if( bbSize.
x > screenSize.
x * ratio * compRatioBent )
2445 compRatioBent = 1.0;
2446 wxLogTrace(
"CROSS_PROBE_SCALE",
2447 "Part TOO WIDE for screen. Using normal KiCad zoom ratio: %1.5f", ratio );
2452 ratio *= compRatioBent;
2454 bool alwaysZoom =
false;
2457 if( ( ratio < 0.5 || ratio > 1.0 ) || alwaysZoom )
2463 SCH_ITEM* focusItem,
const std::vector<SCH_ITEM*>& items )
2522 if( item.IsSelected() )
2531 if( item->IsSelected() )
2537 item->RunOnChildren(
2555 bool checkVisibilityOnly )
const
2566 switch( aItem->
Type() )
2574 if(
pin->GetUnit() &&
pin->GetUnit() != symEditFrame->
GetUnit() )
2592 if(
pin->IsPointClickableAnchor(
grid.BestSnapAnchor( *aPos, pinGrid ) ) )
2697 aGroup->
Add( aItem );
2703 sch_item->RunOnChildren(
2752 sch_item->RunOnChildren(
2766 aGroup->
Remove( aChild );
2779 const unsigned GRIP_MARGIN = 20;
2785 BOX2I itemBox = item->ViewBBox();
constexpr EDA_IU_SCALE schIUScale
static TOOL_ACTION unselectAll
static TOOL_ACTION cursorLeft
static TOOL_ACTION zoomOutCenter
static TOOL_ACTION zoomIn
static TOOL_ACTION cursorLeftFast
static TOOL_ACTION selectColumns
static TOOL_ACTION cursorDown
static TOOL_ACTION zoomOut
static TOOL_ACTION cursorRightFast
static TOOL_ACTION zoomCenter
static TOOL_ACTION panDown
static TOOL_ACTION cursorDownFast
static TOOL_ACTION selectRows
static TOOL_ACTION cursorUpFast
static TOOL_ACTION panLeft
static TOOL_ACTION updateMenu
static TOOL_ACTION zoomFitScreen
static TOOL_ACTION zoomFitObjects
static TOOL_ACTION zoomInCenter
static TOOL_ACTION panRight
static TOOL_ACTION selectTable
static TOOL_ACTION cursorUp
Cursor control with keyboard.
static TOOL_ACTION finishInteractive
static TOOL_ACTION cursorRight
static TOOL_ACTION selectAll
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
CROSS_PROBING_SETTINGS m_CrossProbing
BOX2< Vec > & Normalize()
Ensure that the height and width are positive.
const Vec & GetPosition() const
const SizeVec & GetSize() const
size_type GetHeight() const
const Vec GetCenter() const
size_type GetWidth() const
bool Contains(const Vec &aPoint) const
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
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.
bool HasItem(const EDA_ITEM *aItem) const
Tests if aItem has already been collected.
void Remove(int aIndex)
Remove the item at aIndex (first position is 0).
void Append(EDA_ITEM *item)
Add an item to the end of the list.
COMMIT & Added(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Remove a new item from the model.
COMMIT & Add(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Notify observers that aItem has been added.
bool IsHorizontal() const
void AddStandardSubMenus(TOOL_MENU &aMenu)
Construct a "basic" menu for a tool, containing only items that apply to all tools (e....
void FocusOnLocation(const VECTOR2I &aPos)
Useful to focus on a particular location, in find functions.
virtual EDA_ITEM * GetItem(const KIID &aId) const
Fetch an item by KIID.
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 const BOX2I GetBoundingBox() const
Return the orthogonal bounding box of this object for display purposes.
void SetFlags(EDA_ITEM_FLAGS aMask)
KICAD_T Type() const
Returns the type of object.
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
virtual bool IsType(const std::vector< KICAD_T > &aScanTypes) const
Check whether the item is one of the listed types.
virtual bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const
Test if aPosition is inside or on the boundary of this item.
EDA_ITEM * GetParent() const
bool HasFlag(EDA_ITEM_FLAGS aFlag) const
void XorFlags(EDA_ITEM_FLAGS aMask)
EDA_ITEM_FLAGS GetFlags() const
virtual std::vector< SHAPE * > MakeEffectiveShapes(bool aEdgeOnly=false) const
Make a set of SHAPE objects representing the EDA_SHAPE.
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
const EDA_ANGLE & GetTextAngle() const
virtual bool IsVisible() const
std::shared_ptr< SHAPE_COMPOUND > GetEffectiveTextShape(bool aTriangulate=true, const BOX2I &aBBox=BOX2I(), const EDA_ANGLE &aAngle=ANGLE_0) const
build a list of segments (SHAPE_SEGMENT) to describe a text shape.
static TOOL_ACTION selectionActivate
Activation of the selection tool.
static TOOL_ACTION properties
static TOOL_ACTION addItemsToSel
Selects a list of items (specified as the event parameter)
static TOOL_ACTION clearHighlight
static TOOL_ACTION selectConnection
If current selection is a wire or bus, expand to entire connection.
static TOOL_ACTION pinTable
static TOOL_ACTION navigateForward
static TOOL_ACTION assignNetclass
static TOOL_ACTION clearSelection
Clears the current selection.
static TOOL_ACTION navigateBack
static TOOL_ACTION selectionMenu
Runs a selection menu to select from a list of items.
static TOOL_ACTION placeClassLabel
static TOOL_ACTION drawWire
static TOOL_ACTION removeItemsFromSel
static TOOL_ACTION drawBus
static TOOL_ACTION selectNode
Select the junction, wire or bus segment under the cursor.
static TOOL_ACTION breakWire
static TOOL_ACTION placeSheetPin
static TOOL_ACTION drawLines
static TOOL_ACTION syncSheetPins
static TOOL_ACTION selectOnPCB
static TOOL_ACTION leaveSheet
static TOOL_ACTION placeGlobalLabel
static TOOL_ACTION removeItemFromSel
static TOOL_ACTION placeHierLabel
static TOOL_ACTION addItemToSel
Selects an item (specified as the event parameter).
static TOOL_ACTION symbolProperties
static TOOL_ACTION editPageNumber
static TOOL_ACTION enterSheet
static TOOL_ACTION setUnitDisplayName
static TOOL_ACTION unfoldBus
static TOOL_ACTION placeLabel
static TOOL_ACTION placeJunction
bool m_ShowPinElectricalTypes
static const std::vector< KICAD_T > MovableItems
void Collect(SCH_SCREEN *aScreen, const std::vector< KICAD_T > &aScanTypes, const VECTOR2I &aPos, int aUnit=0, int aConvert=0)
Scan a EDA_ITEM using this class's Inspector method which does the collection.
static SELECTION_CONDITION SingleSymbol
static SELECTION_CONDITION AllPinsOrSheetPins
static SELECTION_CONDITION SingleMultiFunctionPin
static SELECTION_CONDITION SingleSymbolOrPower
static SELECTION_CONDITION SingleMultiUnitSymbol
static SELECTION_CONDITION SingleNonExcludedMarker
static SELECTION_CONDITION SingleDeMorganSymbol
static SELECTION_CONDITION AllPins
static SELECTION_CONDITION MultipleSymbolsOrPower
GRID_HELPER_GRIDS GetItemGrid(const EDA_ITEM *aItem) const override
Gets the coarsest grid that applies to an item.
VECTOR2I BestSnapAnchor(const VECTOR2I &aOrigin, GRID_HELPER_GRIDS aGrid, SCH_ITEM *aSkip)
Tool that displays edit points allowing to modify items by dragging the points.
bool HasPoint()
Indicate the cursor is over an edit point.
BOX2I GetBoundingBox(bool aOnlyVisible=false) const override
EDA_ITEM * GetTopLeftItem(bool onlyModules=false) const override
static const TOOL_EVENT DisambiguatePoint
Used for hotkey feedback.
static const TOOL_EVENT ClearedEvent
static const TOOL_EVENT SelectedEvent
static const TOOL_EVENT PointSelectedEvent
static const TOOL_EVENT UnselectedEvent
virtual RENDER_SETTINGS * GetSettings()=0
Return a pointer to current settings that are going to be used when drawing items.
Represent a selection area (currently a rectangle) in a VIEW, drawn corner-to-corner between two poin...
VECTOR2I GetOrigin() const
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.
void SetHighlight(bool aEnabled, int aNetcode=-1, bool aMulti=false)
Turns on/off highlighting.
virtual void CaptureCursor(bool aEnabled)
Force the cursor to stay within the drawing panel area.
virtual void ForceCursorPosition(bool aEnabled, const VECTOR2D &aPosition=VECTOR2D(0, 0))
Place the cursor immediately at a given point.
virtual void WarpMouseCursor(const VECTOR2D &aPosition, bool aWorldCoordinates=false, bool aWarpView=false)=0
If enabled (.
virtual void SetCrossHairCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true)=0
Move the graphic crosshair cursor to the requested position expressed in world coordinates.
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...
BOX2D GetViewport() const
Return the current viewport visible area rectangle.
virtual void SetScale(double aScale, VECTOR2D aAnchor={ 0, 0 })
Set the scaling factor, zooming around a given anchor point.
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.
int Query(const BOX2I &aRect, std::vector< LAYER_ITEM_PAIR > &aResult) const
Find all visible items that touch or are within the rectangle aRect.
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...
bool IsMirroredX() const
Return true if view is flipped across the X axis.
std::pair< VIEW_ITEM *, int > LAYER_ITEM_PAIR
void Hide(VIEW_ITEM *aItem, bool aHide=true, bool aHideOverlay=false)
Temporarily hide the item in the view (e.g.
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
void SetVisible(VIEW_ITEM *aItem, bool aIsVisible=true)
Set the item visibility.
Define a library symbol object.
bool IsMulti() const override
LIB_ITEMS_CONTAINER & GetDrawItems()
Return a reference to the draw item list.
Tree view item data for the net navigator.
SCH_SHEET_PATH & CurrentSheet() const override
CONNECTION_GRAPH * ConnectionGraph() const override
void SetCurrentSheet(const SCH_SHEET_PATH &aPath) override
SCH_RENDER_SETTINGS * GetRenderSettings()
void AddToScreen(EDA_ITEM *aItem, SCH_SCREEN *aScreen=nullptr)
Add an item to the screen (and view) aScreen is the screen the item is located on,...
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
EESCHEMA_SETTINGS * eeconfig() const
virtual bool GetShowAllPins() const
Allow some frames to show/hide hidden pins.
Class for a wire to bus entry.
SCH_ITEM * m_connected_bus_item
Pointer to the bus item (usually a bus wire) connected to this bus-wire entry, if it is connected to ...
virtual void Push(const wxString &aMessage=wxT("A commit"), int aCommitFlags=0) override
Revert the commit by restoring the modified items state.
virtual void Revert() override
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
void ConfigureFromLabel(const wxString &aLabel)
Configures the connection given a label.
KIGFX::SCH_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
Handle actions specific to the schematic editor.
Schematic editor (Eeschema) main window.
SCH_SHEET_PATH & GetCurrentSheet() const
SCHEMATIC & Schematic() const
void FlipBodyStyle(SCH_SYMBOL *aSymbol)
void DisplayCurrentSheet()
Draw the current sheet on the display.
const wxString & GetHighlightedConnection() const
void FocusOnItem(SCH_ITEM *aItem)
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Base class for any item which can be embedded within the SCHEMATIC container class,...
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
virtual bool IsPointClickableAnchor(const VECTOR2I &aPos) const
wxString GetShownText(const SCH_SHEET_PATH *aPath, bool aAllowExtraText, int aDepth=0) const override
void SetShape(LABEL_FLAG_SHAPE aShape)
LABEL_SHAPE GetLabelShape() const
virtual void SetSpinStyle(SPIN_STYLE aSpinStyle)
Segment description base class to describe items which have 2 end points (track, wire,...
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
bool IsStartDangling() const
VECTOR2I GetEndPoint() const
VECTOR2I GetStartPoint() const
SEG GetSeg() const
Get the geometric aspect of the wire as a SEG.
bool IsEndDangling() const
bool IsBus() const
Return true if the line is a bus.
bool IsGraphicLine() const
Return if the line is a graphic (non electrical line)
void SetEndPoint(const VECTOR2I &aPosition)
bool m_ShowPinsElectricalType
void ClearDrawingState()
Clear the state flags of all the items in the screen.
EE_RTREE & Items()
Gets the full RTree, usually for iterating.
std::set< SCH_ITEM * > MarkConnections(SCH_LINE *aSegment, bool aSecondPass)
Return all wires and junctions connected to aSegment which are not connected any symbol pin.
bool CheckIfOnDrawList(const SCH_ITEM *aItem) const
SCH_SHEET * Last() const
Return a pointer to the last SCH_SHEET of the list.
Define a sheet pin (label) used in sheets to create hierarchical schematics.
SHEET_SIDE GetSide() const
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
std::vector< SCH_SHEET_PIN * > & GetPins()
int GetOrientation() const
Get the display symbol orientation.
SCH_PIN * GetPin(const wxString &number) const
Find a symbol pin by number.
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
BOX2I GetBodyBoundingBox() const
Return a bounding box for the symbol body but not the pins or fields.
std::vector< SCH_TABLECELL * > GetCells() const
int Distance(const SEG &aSeg) const
Compute minimum Euclidean distance to segment aSeg.
static SELECTION_CONDITION HasTypes(std::vector< KICAD_T > aTypes)
Create a functor that tests if among the selected items there is at least one of a given types.
static bool Empty(const SELECTION &aSelection)
Test if there are no items selected.
static SELECTION_CONDITION MoreThan(int aNumber)
Create a functor that tests if the number of selected items is greater than the value given as parame...
static bool Idle(const SELECTION &aSelection)
Test if there no items selected or being edited.
static SELECTION_CONDITION LessThan(int aNumber)
Create a functor that tests if the number of selected items is smaller than the value given as parame...
static SELECTION_CONDITION Count(int aNumber)
Create a functor that tests if the number of selected items is equal to the value given as parameter.
static SELECTION_CONDITION OnlyTypes(std::vector< KICAD_T > aTypes)
Create a functor that tests if the selected items are only of given types.
virtual void Add(EDA_ITEM *aItem)
virtual KIGFX::VIEW_ITEM * GetItem(unsigned int aIdx) const override
const std::deque< EDA_ITEM * > GetItems() const
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.
int Size() const
Returns the number of selected parts.
void ClearReferencePoint()
bool OnlyContains(std::vector< KICAD_T > aList) const
Checks if all items in the selection have a type in aList.
void SetReferencePoint(const VECTOR2I &aP)
bool Empty() const
Checks if there is anything selected.
bool Collide(const SHAPE *aShape, int aClearance, VECTOR2I *aMTV) const override
Check if the boundary of shape (this) lies closer to the shape aShape than aClearance,...
An abstract shape on 2D plane.
The symbol library editor main window.
bool GetShowInvisibleFields()
bool IsSymbolAlias() const
Return true if aLibId is an alias for the editor screen symbol.
bool IsSymbolEditable() const
Test if a symbol is loaded and can be edited.
LIB_SYMBOL * GetCurSymbol() const
Return the current symbol being edited or NULL if none selected.
bool GetShowInvisiblePins()
Symbol library viewer main window.
double Distance(const VECTOR2< extended_type > &aVector) const
Compute the distance between two vectors.
#define DEFAULT_TEXT_SIZE
Ratio of the font height to the baseline of the text above the wire.
static constexpr EDA_ANGLE ANGLE_VERTICAL
static constexpr EDA_ANGLE ANGLE_HORIZONTAL
std::vector< EDA_ITEM * > EDA_ITEMS
Define list of drawing items for screens.
#define BRIGHTENED
item is drawn with a bright contour
#define IS_NEW
New item, just created.
#define SELECTED
Item was manually selected by the user.
#define ENDPOINT
ends. (Used to support dragging.)
std::uint32_t EDA_ITEM_FLAGS
#define CANDIDATE
flag indicating that the structure is connected
#define IS_ROLLOVER
Rollover active. Used for hyperlink highlighting.
#define IS_MOVING
Item being moved.
#define SHOW_ELEC_TYPE
Show pin electrical type. Shared with IS_ROLLOVER.
#define STARTPOINT
When a line is selected, these flags indicate which.
@ ID_POPUP_SCH_PIN_TRICKS_START
@ ID_POPUP_SCH_PIN_TRICKS_HIER_LABEL
@ ID_POPUP_SCH_PIN_TRICKS_WIRE
@ ID_POPUP_SCH_ALT_PIN_FUNCTION
@ ID_POPUP_SCH_UNFOLD_BUS_END
@ ID_POPUP_SCH_SELECT_UNIT
@ ID_POPUP_SCH_SELECT_BASE
@ ID_POPUP_SCH_SELECT_ALT
@ ID_POPUP_SCH_PIN_TRICKS_NET_LABEL
@ ID_POPUP_SCH_PIN_TRICKS_NO_CONNECT
@ ID_POPUP_SCH_UNFOLD_BUS
@ ID_POPUP_SCH_SELECT_UNIT_END
@ ID_POPUP_SCH_ALT_PIN_FUNCTION_END
@ ID_POPUP_SCH_PIN_TRICKS_GLOBAL_LABEL
@ ID_POPUP_SCH_PIN_TRICKS_END
@ REPAINT
Item needs to be redrawn.
ELECTRICAL_PINTYPE
The symbol library pin object electrical types used in ERC tests.
std::function< bool(const SELECTION &)> SELECTION_CONDITION
Functor type that checks a specific condition for selected items.
std::vector< FAB_LAYER_COLOR > dummy
bool zoom_to_fit
Zoom to fit items (ignored if center_on_items is off)
bool center_on_items
Automatically pan to cross-probed items.
constexpr int MilsToIU(int mils) const
bool show_directive_labels
bool text
Text and fields.
bool symbols
Allow selecting symbols and sheet symbols.
bool labels
Net and bus labels.
bool pins
Symbol and sheet pins.
bool graphics
Graphic lines, shapes, polygons.
bool lockedItems
Allow selecting locked items.
bool images
Bitmap/vector images.
bool otherItems
Anything not fitting one of the above categories.
bool wires
Net and bus wires and junctions.
@ SCH_ITEM_LOCATE_GRAPHIC_LINE_T
@ SCH_SYMBOL_LOCATE_POWER_T
constexpr ret_type KiROUND(fp_type v, bool aQuiet=false)
Round a floating point number to an integer using "round halfway cases away from zero".
VECTOR2< int32_t > VECTOR2I