65 if( aSel.GetSize() == 1 )
79 return aSel.GetSize() == 1 && aSel.Front()->Type() ==
SCH_SYMBOL_T;
85 if( aSel.GetSize() == 1 )
99 if( aSel.GetSize() == 1 )
113 if( aSel.GetSize() == 1 )
117 if(
pin &&
pin->GetLibPin() )
118 return !
pin->GetLibPin()->GetAlternates().empty();
130 return !
static_cast<SCH_MARKER*
>( aSel.Front() )->IsExcluded();
136 return aSel.GetSize() > 1 && aSel.OnlyContains( {
SCH_SYMBOL_T } );
142 return aSel.GetSize() >= 1 && aSel.OnlyContains( {
SCH_PIN_T } );
152#define HITTEST_THRESHOLD_PIXELS 5
159 m_isSymbolEditor( false ),
160 m_isSymbolViewer( false ),
163 m_enteredGroup( nullptr ),
164 m_previous_first_cell( nullptr )
213 m_frame = getEditFrame<SCH_BASE_FRAME>();
218 if( symbolEditorFrame )
238 auto schEditSheetPageNumberCondition =
248 auto schEditCondition =
254 auto belowRootSheetCondition =
278 auto groupEnterCondition =
281 auto inGroupCondition =
287 auto symbolDisplayNameIsEditable =
295 return symbEditorFrame
302 auto& menu =
m_menu->GetMenu();
316 menu.AddSeparator( 100 );
320 menu.AddSeparator( 100 );
327 menu.AddSeparator( 200 );
341 menu.AddSeparator( 400 );
346 menu.AddSeparator( 1000 );
360 m_frame = getEditFrame<SCH_BASE_FRAME>();
382 if( symbolEditFrame )
409 auto pinOrientation =
419 return pin->GetOrientation();
424 return dummy.GetOrientation();
435 case SHEET_SIDE::LEFT:
return PIN_ORIENTATION::PIN_RIGHT;
436 case SHEET_SIDE::RIGHT:
return PIN_ORIENTATION::PIN_LEFT;
437 case SHEET_SIDE::TOP:
return PIN_ORIENTATION::PIN_DOWN;
438 case SHEET_SIDE::BOTTOM:
return PIN_ORIENTATION::PIN_UP;
442 return PIN_ORIENTATION::PIN_LEFT;
448 bool selCancelled =
false;
449 bool displayWireCursor =
false;
450 bool displayBusCursor =
false;
451 bool displayLineCursor =
false;
452 KIID rolloverItem = lastRolloverItem;
456 evt->Modifier(
MD_ALT ) );
496 schframe->ClearFocus();
508 bool allCellsFromSameTable =
true;
520 allCellsFromSameTable =
false;
564 else if( collector[0]->IsHypertext() )
566 collector[ 0 ]->DoHypertextAction(
m_frame );
569 else if( collector[0]->IsBrightened() )
576 schframe->SelectNetNavigatorItem( &itemData );
596 SelectPoint( evt->Position(), { SCH_LOCATE_ANY_T },
nullptr, &selCancelled );
609 if(
CollectHits( collector, evt->Position(), { SCH_LOCATE_ANY_T } ) )
613 SelectPoint( evt->Position(), { SCH_LOCATE_ANY_T },
nullptr, &selCancelled );
621 else if( evt->IsDblClick(
BUT_LEFT ) )
627 schframe->ClearFocus();
665 schframe->ClearFocus();
674 else if(
CollectHits( collector, evt->DragOrigin(), { SCH_TABLECELL_T } )
675 && ( collector[0]->GetParent()->GetParentGroup() ==
nullptr
676 || collector[0]->GetParent()->GetParentGroup() ==
m_enteredGroup ) )
680 else if(
hasModifier() || drag_action == MOUSE_DRAG_ACTION::SELECT )
684 else if(
m_selection.
Empty() && drag_action != MOUSE_DRAG_ACTION::DRAG_ANY )
727 else if( evt->IsMouseDown(
BUT_AUX1 ) )
731 else if( evt->IsMouseDown(
BUT_AUX2 ) )
747 const int delta = evt->Parameter<
int>();
783 wxString alt = *evt->Parameter<wxString*>();
807 newItems.push_back( nc );
810 if( !commit.
Empty() )
812 commit.
Push( wxS(
"No Connect Pins" ) );
818 VECTOR2I wireGrid =
grid.GetGridSize( GRID_HELPER_GRIDS::GRID_WIRES );
831 switch( pinOrientation( item ) )
834 case PIN_ORIENTATION::PIN_RIGHT:
837 case PIN_ORIENTATION::PIN_LEFT:
840 case PIN_ORIENTATION::PIN_UP:
843 case PIN_ORIENTATION::PIN_DOWN:
852 newItems.push_back( wire );
855 if( !commit.
Empty() )
873 commit.
Push( wxS(
"Wire Pins" ) );
893 labelText =
pin->GetShownName();
895 if( labelText.IsEmpty() )
897 labelText.Printf(
"%s_%s",
898 pin->GetParentSymbol()->GetRef( &sheetPath ),
904 labelText = sheetPin->
GetShownText( &sheetPath,
false );
911 switch( *evt->GetCommandId() )
914 label =
new SCH_LABEL( item->GetPosition(), labelText );
926 switch( pinOrientation( item ) )
929 case PIN_ORIENTATION::PIN_RIGHT:
932 case PIN_ORIENTATION::PIN_LEFT:
935 case PIN_ORIENTATION::PIN_UP:
938 case PIN_ORIENTATION::PIN_DOWN:
947 pinType =
pin->GetType();
953 case LABEL_INPUT: pinType = ELECTRICAL_PINTYPE::PT_INPUT;
break;
954 case LABEL_OUTPUT: pinType = ELECTRICAL_PINTYPE::PT_OUTPUT;
break;
955 case LABEL_BIDI: pinType = ELECTRICAL_PINTYPE::PT_BIDI;
break;
956 case LABEL_TRISTATE: pinType = ELECTRICAL_PINTYPE::PT_TRISTATE;
break;
957 case LABEL_PASSIVE: pinType = ELECTRICAL_PINTYPE::PT_PASSIVE;
break;
963 case ELECTRICAL_PINTYPE::PT_BIDI:
964 label->
SetShape( LABEL_FLAG_SHAPE::L_BIDI );
966 case ELECTRICAL_PINTYPE::PT_INPUT:
967 label->
SetShape( LABEL_FLAG_SHAPE::L_INPUT );
969 case ELECTRICAL_PINTYPE::PT_OUTPUT:
970 label->
SetShape( LABEL_FLAG_SHAPE::L_OUTPUT );
972 case ELECTRICAL_PINTYPE::PT_TRISTATE:
973 label->
SetShape( LABEL_FLAG_SHAPE::L_TRISTATE );
975 case ELECTRICAL_PINTYPE::PT_UNSPECIFIED:
976 label->
SetShape( LABEL_FLAG_SHAPE::L_UNSPECIFIED );
979 label->
SetShape( LABEL_FLAG_SHAPE::L_INPUT );
983 newItems.push_back( label );
986 if( !commit.
Empty() )
988 commit.
Push( wxS(
"Label Pins" ) );
1000 wxString* net =
new wxString( *evt->Parameter<wxString*>() );
1004 else if( evt->IsCancelInteractive() )
1014 schframe->ClearFocus();
1020 else if( evt->FirstResponder() ==
this && evt->GetCommandId() == (
int) WXK_ESCAPE )
1031 editor->ClearHighlight( *evt );
1038 schframe->ClearFocus();
1040 else if( evt->IsMotion() && !
m_isSymbolEditor && evt->FirstResponder() == this )
1059 displayBusCursor =
true;
1061 displayWireCursor =
true;
1063 displayLineCursor =
true;
1065 else if( collector[0]->IsHypertext() && !collector[0]->IsSelected() )
1067 rolloverItem = collector[0]->m_Uuid;
1074 evt->SetPassEvent();
1077 if( lastRolloverItem !=
niluuid && lastRolloverItem != rolloverItem )
1107 lastRolloverItem = rolloverItem;
1111 if( displayWireCursor )
1115 else if( displayBusCursor )
1119 else if( displayLineCursor )
1123 else if( rolloverItem !=
niluuid )
1128 && drag_action == MOUSE_DRAG_ACTION::DRAG_SELECTED
1129 && evt->HasPosition()
1154 wxT(
"EnterGroup called when selection is not a single group" ) );
1171 RECURSE_MODE::NO_RECURSE );
1241 if( possibleConnection.
IsBus() )
1249 if( !
pin || !
pin->IsPointClickableAnchor( pos ) )
1252 if( !
pin->IsVisible()
1260 newEvt->SetMousePosition( pos );
1261 newEvt->SetHasPosition(
true );
1262 newEvt->SetForceImmediate(
true );
1275 wxMouseState keyboardState = wxGetMouseState();
1278 keyboardState.AltDown() );
1293 wxMouseState keyboardState = wxGetMouseState();
1296 keyboardState.AltDown() );
1317 const std::vector<KICAD_T>& aScanTypes )
1320 int gridThreshold =
KiROUND(
getView()->GetGAL()->GetGridSize().EuclideanNorm() / 2.0 );
1321 aCollector.
m_Threshold = std::max( pixelThreshold, gridThreshold );
1341 int originalCount = aCollector.
GetCount();
1343 for(
int ii = 0; ii < originalCount; ++ii )
1345 if( aCollector[ii]->Type() ==
SCH_PIN_T )
1349 if( !aCollector.
HasItem(
pin->GetParentSymbol() ) )
1350 aCollector.
Append(
pin->GetParentSymbol() );
1361 bool aCheckLocked,
bool aSelectedOnly )
1365 for(
int i = collector.
GetCount() - 1; i >= 0; --i )
1367 if( symbolEditorFrame )
1398 if( aCheckLocked && collector[i]->IsLocked() )
1410 if( aSelectedOnly && !collector[i]->IsSelected() )
1426 EDA_ITEM** aItem,
bool* aSelectionCancelledFlag,
bool aAdd,
1427 bool aSubtract,
bool aExclusiveOr )
1445 if( aSelectionCancelledFlag )
1446 *aSelectionCancelledFlag =
true;
1452 if( !aAdd && !aSubtract && !aExclusiveOr )
1460 bool foundEnteredGroup =
false;
1465 foundEnteredGroup =
true;
1470 if( !foundEnteredGroup )
1477 bool anySubtracted =
false;
1481 for(
int i = 0; i < aCollector.
GetCount(); ++i )
1484 bool isLine = aCollector[i]->Type() ==
SCH_LINE_T;
1500 || ( aExclusiveOr && aCollector[i]->IsSelected()
1501 && ( !isLine || ( isLine && aCollector[i]->HasFlag( flags ) ) ) ) )
1503 aCollector[i]->ClearFlags( flags );
1513 anySubtracted =
true;
1518 aCollector[i]->SetFlags( flags );
1525 if( addedCount == 1 )
1529 if( aItem && aCollector.
GetCount() == 1 )
1530 *aItem = aCollector[0];
1534 else if( addedCount > 1 )
1539 else if( anySubtracted )
1551 const std::vector<KICAD_T>& aScanTypes,
1552 EDA_ITEM** aItem,
bool* aSelectionCancelledFlag,
1553 bool aCheckLocked,
bool aAdd,
bool aSubtract,
1558 if( !
CollectHits( collector, aWhere, aScanTypes ) )
1563 return selectPoint( collector, aWhere, aItem, aSelectionCancelledFlag, aAdd, aSubtract,
1574 std::vector<EDA_ITEM*> sheetPins;
1580 view->
Query( selectionBox,
1588 collection.
Append( item );
1602 sheetPins.emplace_back(
pin );
1633 std::vector<KIGFX::VIEW::LAYER_ITEM_PAIR> selectedItems;
1639 view->
Query( selectionBox, selectedItems );
1674 std::set<EDA_ITEM*> exactHits;
1676 for(
int i = collector.
GetCount() - 1; i >= 0; --i )
1684 if( line || ( shape && shape->
GetShape() == SHAPE_T::POLY )
1685 || ( shape && shape->
GetShape() == SHAPE_T::ARC ) )
1689 if( item->
HitTest( aPos, pixelThreshold ) )
1690 exactHits.insert( item );
1702 if( item->
HitTest( aPos, 0 ) )
1703 exactHits.insert( item );
1709 if( exactHits.size() > 0 && exactHits.size() < (
unsigned) collector.
GetCount() )
1711 for(
int i = collector.
GetCount() - 1; i >= 0; --i )
1715 if( !exactHits.contains( item ) )
1721 SEG poss( aPos, aPos );
1723 int closestDist = INT_MAX / 4;
1727 BOX2I bbox = item->GetBoundingBox();
1728 int dist = INT_MAX / 4;
1733 bool dominating =
false;
1735 if( exactHits.contains( item ) )
1770 ->Collide( poss, INT_MAX / 4, &dist );
1774 text->GetEffectiveTextShape(
false )->Collide( poss, INT_MAX / 4, &dist );
1780 for(
SHAPE* s : shapes )
1782 int shapeDist = dist;
1783 s->Collide( poss, INT_MAX / 4, &shapeDist );
1785 if( shapeDist < dist )
1803 rect.
Collide( poss, closestDist, &dist );
1821 if( dist == closestDist )
1823 if( item->GetParent() == closest )
1826 else if( dist < closestDist )
1842 for(
int i = collector.
GetCount() - 1; i >= 0; --i )
1846 if( item == closest )
1849 if( !item->
HitTest( tightBox,
true ) )
1857 bool aPromoteCellSelections,
1858 bool aPromoteGroups )
1860 bool anyUnselected =
false;
1861 bool anySelected =
false;
1874 bool isMoving =
false;
1879 isMoving |=
static_cast<SCH_ITEM*
>( item )->IsMoving();
1881 if( !item->
IsType( aScanTypes ) )
1884 anyUnselected =
true;
1892 if( aPromoteGroups )
1898 std::set<EDA_ITEM*> selectedChildren;
1904 if( aChild->
IsType( aScanTypes ) )
1905 selectedChildren.insert( aChild );
1907 RECURSE_MODE::RECURSE );
1909 anyUnselected =
true;
1912 for(
EDA_ITEM* child : selectedChildren )
1914 if( !child->IsSelected() )
1926 if( aPromoteCellSelections )
1928 std::set<EDA_ITEM*> parents;
1938 anyUnselected =
true;
1944 if( !parent->IsSelected() )
1967 std::set<EDA_ITEM*> rejected;
1972 rejected.insert( item );
1976 aCollector.
Remove( item );
1994 switch( aItem->
Type() )
2018 switch(
static_cast<SCH_LINE*
>( aItem )->GetLayer() )
2113 bool cancelled =
false;
2129 isGreedy = !isGreedy;
2132 : KICURSOR::SELECT_WINDOW );
2134 if( evt->IsCancelInteractive() || evt->IsActivate() )
2147 area.
SetEnd( evt->Position() );
2151 area.
SetMode( isGreedy ? SELECTION_MODE::TOUCHING_RECTANGLE
2152 : SELECTION_MODE::INSIDE_RECTANGLE );
2167 std::vector<KIGFX::VIEW::LAYER_ITEM_PAIR> candidates;
2169 view->
Query( selectionRect, candidates );
2172 std::set<SCH_ITEM*> uniqueCandidates;
2174 for(
const auto& [viewItem, layer] : candidates )
2176 if( viewItem->IsSCH_ITEM() )
2177 uniqueCandidates.insert(
static_cast<SCH_ITEM*
>( viewItem ) );
2190 uniqueCandidates.insert(
pin );
2199 uniqueCandidates.insert(
pin );
2207 std::set<EDA_ITEM*> group_items;
2217 std::unordered_set<EDA_ITEM*>& newset =
group->GetItems();
2221 if( !isGreedy && selectionRect.
Contains(
group->GetBoundingBox() ) && newset.size() )
2223 for(
EDA_ITEM* group_item : newset )
2225 if( !group_item->IsSCH_ITEM() )
2229 collector.
Append( *newset.begin() );
2233 for(
EDA_ITEM* group_item : newset )
2234 group_items.emplace( group_item );
2237 for(
SCH_ITEM* item : uniqueCandidates )
2242 && ( item->HitTest( selectionRect, !isGreedy ) || item->Type() ==
SCH_LINE_T )
2243 && ( isGreedy || !group_items.count( item ) ) )
2246 pinsCollector.
Append( item );
2248 collector.
Append( item );
2260 collector = pinsCollector;
2267 std::sort( collector.
begin(), collector.
end(),
2270 VECTOR2I aPos = a->GetPosition();
2271 VECTOR2I bPos = b->GetPosition();
2273 if( aPos.y == bPos.y )
2274 return aPos.x < bPos.x;
2276 return aPos.y < bPos.y;
2279 bool anyAdded =
false;
2280 bool anySubtracted =
false;
2295 anySubtracted =
true;
2300 if( flags && !anySubtracted )
2311 std::vector<EDA_ITEM*> flaggedItems;
2318 flaggedItems.push_back( item );
2327 if( ( isGreedy && line->
HitTest( selectionRect,
false ) )
2333 else if( !isGreedy )
2344 selectItem( item, flags );
2347 selectItem( item, flags );
2352 for(
EDA_ITEM* item : pinsCollector )
2358 && item->HitTest( selectionRect, !isGreedy ) )
2360 selectItem( item, 0 );
2366 for(
EDA_ITEM* item : flaggedItems )
2386 evt->SetPassEvent();
2406 bool aMultiselect )
const
2408 std::unordered_set<EDA_ITEM*> toAdd;
2412 for(
int j = 0; j < aCollector.
GetCount(); j++ )
2414 if( aCollector[j]->GetParent() )
2417 if( aCollector[j]->GetParentSymbol() )
2423 for(
int j = 0; j < aCollector.
GetCount(); j++ )
2427 for(
int j = 0; j < aCollector.
GetCount(); )
2439 aCollector.
Remove( item );
2447 if( top->AsEdaItem() != item )
2449 toAdd.insert( top->AsEdaItem() );
2452 aCollector.
Remove( item );
2461 aCollector.
Remove( item );
2470 if( !aCollector.
HasItem( item ) )
2471 aCollector.
Append( item );
2489 if( cell->IsSelected() )
2501 auto wasSelected = [](
EDA_ITEM* aItem )
2508 bool doSelect =
false;
2510 if( cell->HitTest( selectionRect,
false ) )
2515 doSelect = !wasSelected( cell );
2519 else if( wasSelected( cell ) )
2524 if( doSelect && !cell->IsSelected() )
2526 else if( !doSelect && cell->IsSelected() )
2533 bool cancelled =
false;
2540 if( evt->IsCancelInteractive() || evt->IsActivate() )
2548 SelectCellsBetween( evt->DragOrigin(), evt->Position() - evt->DragOrigin(), aTable );
2550 else if( evt->IsMouseUp(
BUT_LEFT ) )
2554 bool anyAdded =
false;
2555 bool anySubtracted =
false;
2562 anySubtracted =
true;
2578 evt->SetPassEvent();
2602 int gridThreshold =
KiROUND(
getView()->GetGAL()->GetGridSize().EuclideanNorm() );
2603 int thresholdMax = std::max( pixelThreshold, gridThreshold );
2605 for(
int threshold : { 0, thresholdMax/4, thresholdMax/2, thresholdMax } )
2614 return collector.
GetCount() ? collector[ 0 ] :
nullptr;
2659 std::set<std::pair<SCH_TABLE*, int>> columns;
2667 columns.insert( std::make_pair(
table, cell->GetColumn() ) );
2671 for(
auto& [
table, col ] : columns )
2673 for(
int row = 0; row <
table->GetRowCount(); ++row )
2694 std::set<std::pair<SCH_TABLE*, int>> rows;
2702 rows.insert( std::make_pair(
table, cell->GetRow() ) );
2706 for(
auto& [
table, row ] : rows )
2708 for(
int col = 0; col <
table->GetColCount(); ++col )
2729 std::set<SCH_TABLE*> tables;
2735 tables.insert(
static_cast<SCH_TABLE*
>( cell->GetParent() ) );
2742 if( !
table->IsSelected() )
2785 double compRatio = bbSize.
y / currTextHeight;
2786 double compRatioBent = 1.0;
2792 std::vector<std::pair<double, double>> lut{ { 1.25, 16 },
2801 std::vector<std::pair<double, double>>::iterator it;
2804 compRatioBent = lut.back().second;
2808 if( compRatio >= lut.front().first )
2810 for( it = lut.begin(); it < lut.end() - 1; ++it )
2812 if( it->first <= compRatio &&
next( it )->first >= compRatio )
2814 double diffx = compRatio - it->first;
2815 double diffn =
next( it )->first - it->first;
2817 compRatioBent = it->second + (
next( it )->second - it->second ) * diffx / diffn;
2824 compRatioBent = lut.front().second;
2833 screenSize.
x = std::max( 10.0, screenSize.
x );
2834 screenSize.
y = std::max( 10.0, screenSize.
y );
2835 double ratio = std::max( -1.0, fabs( bbSize.
y / screenSize.
y ) );
2838 double kicadRatio = std::max( fabs( bbSize.
x / screenSize.
x ),
2839 fabs( bbSize.
y / screenSize.
y ) );
2844 if( bbSize.
x > screenSize.
x * ratio * compRatioBent )
2848 compRatioBent = 1.0;
2849 wxLogTrace(
"CROSS_PROBE_SCALE",
2850 "Part TOO WIDE for screen. Using normal KiCad zoom ratio: %1.5f", ratio );
2855 ratio *= compRatioBent;
2857 bool alwaysZoom =
false;
2860 if( ( ratio < 0.5 || ratio > 1.0 ) || alwaysZoom )
2866 SCH_ITEM* focusItem,
const std::vector<SCH_ITEM*>& items )
2919 bool enteredGroupFound =
false;
2927 if( item.IsSelected() )
2935 enteredGroupFound =
true;
2949 if( item->IsSelected() )
2955 item->RunOnChildren(
2961 RECURSE_MODE::NO_RECURSE );
2969 enteredGroupFound =
true;
2981 if( !enteredGroupFound )
2993 bool checkVisibilityOnly )
const
3004 switch( aItem->
Type() )
3012 if(
pin->GetUnit() &&
pin->GetUnit() != symEditFrame->
GetUnit() )
3030 if(
pin->IsPointClickableAnchor(
grid.BestSnapAnchor( *aPos, pinGrid ) ) )
3146 aGroup->
Add( aItem );
3156 sch_item->RunOnChildren(
3169 RECURSE_MODE::NO_RECURSE );
3207 sch_item->RunOnChildren(
3221 aGroup->
Remove( aChild );
3223 RECURSE_MODE::NO_RECURSE );
3235 const unsigned GRIP_MARGIN = 20;
3241 BOX2I itemBox = item->ViewBBox();
constexpr EDA_IU_SCALE schIUScale
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
static TOOL_ACTION unselectAll
static TOOL_ACTION selectItem
Select an item (specified as the event parameter).
static TOOL_ACTION cursorLeft
static TOOL_ACTION zoomOutCenter
static TOOL_ACTION unselectItem
static TOOL_ACTION zoomIn
static TOOL_ACTION cursorLeftFast
static TOOL_ACTION groupEnter
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 selectionActivate
Activation of the selection tool.
static TOOL_ACTION cursorDownFast
static TOOL_ACTION selectionMenu
Run a selection menu to select from a list of items.
static TOOL_ACTION selectRows
static TOOL_ACTION cursorUpFast
static TOOL_ACTION panLeft
static TOOL_ACTION updateMenu
static TOOL_ACTION zoomFitScreen
static TOOL_ACTION increment
static TOOL_ACTION selectionClear
Clear the current selection.
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 groupLeave
static TOOL_ACTION finishInteractive
static TOOL_ACTION cursorRight
static TOOL_ACTION selectAll
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.
CROSS_PROBING_SETTINGS m_CrossProbing
constexpr const Vec & GetPosition() const
constexpr void SetMaximum()
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 size_type GetWidth() const
constexpr Vec Centre() const
constexpr const Vec GetCenter() const
constexpr size_type GetHeight() const
constexpr bool Contains(const Vec &aPoint) const
constexpr const SizeVec & GetSize() const
constexpr bool Intersects(const BOX2< Vec > &aRect) 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.
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)
Notify observers that aItem has been added.
COMMIT & Add(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Add a new item to the model.
bool IsHorizontal() const
bool IsType(FRAME_T aType) const
void AddStandardSubMenus(TOOL_MENU &aMenu)
Construct a "basic" menu for a tool, containing only items that apply to all tools (e....
virtual EDA_ITEM * ResolveItem(const KIID &aId, bool aAllowNullptrReturn=false) const
Fetch an item by KIID.
void FocusOnLocation(const VECTOR2I &aPos)
Useful to focus on a particular location, in find functions.
void ForceRefresh()
Force a redraw.
void SetCurrentCursor(KICURSOR aCursor)
Set the current cursor shape for this panel.
A set of EDA_ITEMs (i.e., without duplicates).
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)
void SetIsRollover(bool aIsRollover)
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
bool IsBrightened() 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.
virtual bool IsFilledForHitTesting() const
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.
GRID_HELPER_GRIDS GetItemGrid(const EDA_ITEM *aItem) const override
Get the coarsest grid that applies to an item.
VECTOR2I BestSnapAnchor(const VECTOR2I &aOrigin, GRID_HELPER_GRIDS aGrid, SCH_ITEM *aSkip)
EE_TYPE OfType(KICAD_T aType) const
static const TOOL_EVENT DisambiguatePoint
Used for hotkey feedback.
static const TOOL_EVENT ClearedEvent
static const TOOL_EVENT SelectedEvent
static const TOOL_EVENT SelectedItemsModified
Selected items were moved, this can be very high frequency on the canvas, use with care.
static const TOOL_EVENT PointSelectedEvent
static const TOOL_EVENT SelectedItemsMoved
Used to inform tools that the selection should temporarily be non-editable.
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 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.
void SetHighlight(bool aEnabled, int aNetcode=-1, bool aMulti=false)
Turns on/off highlighting.
void Update(const KIGFX::VIEW_ITEM *aItem, int aUpdateFlags) const override
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
An interface for classes handling user events controlling the view behavior such as zooming,...
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.
virtual void Clear()
Remove all the stored items from the group.
virtual void Add(VIEW_ITEM *aItem)
Add an item to the group.
An abstract base class for deriving all objects that can be added to a VIEW.
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.
CONNECTION_GRAPH * ConnectionGraph() const
SCH_SHEET_PATH & CurrentSheet() const
static TOOL_ACTION placeClassLabel
static TOOL_ACTION placeSheetPin
static TOOL_ACTION saveToLinkedDesignBlock
static TOOL_ACTION clearHighlight
static TOOL_ACTION placeGlobalLabel
static TOOL_ACTION pinTable
static TOOL_ACTION navigateBack
static TOOL_ACTION properties
static TOOL_ACTION leaveSheet
static TOOL_ACTION breakWire
static TOOL_ACTION autoplaceAllSheetPins
static TOOL_ACTION drawLines
static TOOL_ACTION placeHierLabel
static TOOL_ACTION selectConnection
If current selection is a wire or bus, expand to entire connection.
static TOOL_ACTION placeLabel
static TOOL_ACTION nextNetItem
static TOOL_ACTION drawWire
static TOOL_ACTION placeJunction
static TOOL_ACTION previousNetItem
static TOOL_ACTION navigateForward
static TOOL_ACTION setUnitDisplayName
static TOOL_ACTION placeLinkedDesignBlock
static TOOL_ACTION selectNode
Select the junction, wire or bus segment under the cursor.
static TOOL_ACTION unfoldBus
static TOOL_ACTION drawBus
static TOOL_ACTION symbolProperties
static TOOL_ACTION changeSheet
static TOOL_ACTION assignNetclass
static TOOL_ACTION enterSheet
static TOOL_ACTION editPageNumber
static TOOL_ACTION selectOnPCB
static TOOL_ACTION syncSheetPins
SCH_RENDER_SETTINGS * GetRenderSettings()
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.
void AddToScreen(EDA_ITEM *aItem, SCH_SCREEN *aScreen=nullptr) override
Add an item to the screen (and view) aScreen is the screen the item is located on,...
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 ...
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.
bool m_ShowPinElectricalTypes
static const std::vector< KICAD_T > MovableItems
virtual void Push(const wxString &aMessage=wxT("A commit"), int aCommitFlags=0) override
Execute the changes.
virtual void Revert() override
Revert the commit by restoring the modified items state.
static SELECTION_CONDITION SingleMultiFunctionPin
static SELECTION_CONDITION SingleSymbol
static SELECTION_CONDITION MultipleSymbolsOrPower
static SELECTION_CONDITION AllPinsOrSheetPins
static SELECTION_CONDITION SingleDeMorganSymbol
static SELECTION_CONDITION SingleSymbolOrPower
static SELECTION_CONDITION SingleNonExcludedMarker
static SELECTION_CONDITION SingleMultiUnitSymbol
static SELECTION_CONDITION AllPins
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_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
SCH_SHEET_PATH & GetCurrentSheet() const
SCHEMATIC & Schematic() const
wxTreeCtrl * GetNetNavigator()
void FlipBodyStyle(SCH_SYMBOL *aSymbol)
const SCH_ITEM * SelectNextPrevNetNavigatorItem(bool aNext)
const wxString & GetHighlightedConnection() const
void FocusOnItem(EDA_ITEM *aItem) override
Focus on a particular canvas item.
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
A set of SCH_ITEMs (i.e., without duplicates).
static bool WithinScope(SCH_ITEM *aItem, SCH_GROUP *aScope, bool isSymbolEditor)
void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction, RECURSE_MODE aMode) override
static EDA_GROUP * TopLevelGroup(SCH_ITEM *aItem, EDA_GROUP *aScope, bool isSymbolEditor)
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,...
const SYMBOL * GetParentSymbol() const
SCHEMATIC * Schematic() const
Search the item hierarchy to find a SCHEMATIC.
virtual bool IsPointClickableAnchor(const VECTOR2I &aPos) const
bool IsType(const std::vector< KICAD_T > &aScanTypes) const override
Check whether the item is one of the listed types.
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 IsConnectable() const override
bool IsGraphicLine() const
Return if the line is a graphic (non electrical line)
void SetEndPoint(const VECTOR2I &aPosition)
Tool that displays edit points allowing to modify items by dragging the points.
bool HasPoint()
Indicate the cursor is over an edit point.
bool m_ShowPinsElectricalType
void ClearDrawingState()
Clear the state flags of all the items in the screen.
EE_RTREE & Items()
Get 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 or all gr...
bool CheckIfOnDrawList(const SCH_ITEM *aItem) const
EDA_ITEM * GetTopLeftItem(bool onlyModules=false) const override
BOX2I GetBoundingBox() const override
VECTOR2I GetCenter() const
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
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()
std::vector< SCH_PIN * > GetPins(const SCH_SHEET_PATH *aSheet) const
Retrieve a list of the SCH_PINs for the given sheet path.
SCH_PIN * GetPin(const wxString &number) const
Find a symbol pin by number.
int GetOrientation() const override
Get the display symbol orientation.
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
BOX2I GetBodyBoundingBox() const override
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 SELECTION_CONDITION HasType(KICAD_T aType)
Create a functor that tests if among the selected items there is at least one of a given type.
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()
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.
A base class for LIB_SYMBOL and SCH_SYMBOL.
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 SELECTION_CANDIDATE
indicates an item is a candidate for selection
#define ENTERED
indicates a group has been entered
#define ENDPOINT
ends. (Used to support dragging.)
std::uint32_t EDA_ITEM_FLAGS
#define IS_MOVING
Item being moved.
#define SHOW_ELEC_TYPE
Show pin electrical type.
#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.
Class to handle a set of SCH_ITEMs.
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 ruleAreas
Rule areas.
bool wires
Net and bus wires and junctions.
@ NOT_USED
the 3d code uses this value
@ SCH_ITEM_LOCATE_GRAPHIC_LINE_T
@ SCH_SYMBOL_LOCATE_POWER_T
VECTOR2< int32_t > VECTOR2I