81#include <wx/textdlg.h>
115 const int unit = symbol->
GetUnit();
119 for(
int ii = 0; ii < nUnits; ii++ )
123 if( missingUnits.count( ii + 1 ) == 0 )
124 unit_text +=
_(
" (already placed)" );
137 if( !missingUnits.empty() )
141 for(
int unitNumber : missingUnits )
190 wxEmptyString, wxITEM_CHECK );
225 if(
pin->GetAlt().IsEmpty() || (
pin->GetAlt() == libPin->
GetName() ) )
273 if( !
pin && !sheetPin )
322 wxASSERT_MSG( drawingTools,
"eeshema.InteractiveDrawing tool is not available" );
329 auto sheetHasUndefinedPins =
332 if( aSel.Size() == 1 && aSel.Front()->Type() ==
SCH_SHEET_T )
342 wxString variant =
m_frame->Schematic().GetCurrentVariant();
348 switch( item->Type() )
351 if(
static_cast<const SCH_SYMBOL*
>( item )->GetDNP( sheet, variant ) )
359 if(
static_cast<const SCH_SHEET*
>( item )->GetDNP( sheet, variant ) )
379 return checked > 0 && unchecked == 0;
382 auto attribExcludeFromSimCond =
386 wxString variant =
m_frame->Schematic().GetCurrentVariant();
392 switch( item->Type() )
395 if(
static_cast<const SCH_SYMBOL*
>( item )->GetExcludedFromSim( sheet, variant ) )
403 if(
static_cast<const SCH_SHEET*
>( item )->GetExcludedFromSim( sheet, variant ) )
411 if(
static_cast<const SCH_RULE_AREA*
>( item )->GetExcludedFromSim() )
423 return checked > 0 && unchecked == 0;
426 auto attribExcludeFromBOMCond =
430 wxString variant =
m_frame->Schematic().GetCurrentVariant();
436 switch( item->Type() )
439 if(
static_cast<const SCH_SYMBOL*
>( item )->GetExcludedFromBOM( sheet, variant ) )
447 if(
static_cast<const SCH_SHEET*
>( item )->GetExcludedFromBOM( sheet, variant ) )
455 if(
static_cast<const SCH_RULE_AREA*
>( item )->GetExcludedFromBOM() )
467 return checked > 0 && unchecked == 0;
471 auto attribExcludeFromBoardCond =
475 wxString variant =
m_frame->Schematic().GetCurrentVariant();
481 switch( item->Type() )
484 if(
static_cast<const SCH_SYMBOL*
>( item )->GetExcludedFromBoard( sheet, variant ) )
492 if(
static_cast<const SCH_SHEET*
>( item )->GetExcludedFromBoard( sheet, variant ) )
500 if(
static_cast<const SCH_RULE_AREA*
>( item )->GetExcludedFromBoard() )
512 return checked > 0 && unchecked == 0;
515 auto attribExcludeFromPosFilesCond = [
this](
const SELECTION& aSel )
518 wxString variant =
m_frame->Schematic().GetCurrentVariant();
526 if(
static_cast<const SCH_SYMBOL*
>( item )->GetExcludedFromPosFiles( sheet, variant ) )
533 return checked > 0 && unchecked == 0;
554 auto duplicateCondition =
563 auto orientCondition =
574 auto propertiesCondition =
577 if( aSel.GetSize() == 0 )
594 if( !firstItem || !eeSelection )
597 switch( firstItem->
Type() )
615 return aSel.GetSize() == 1;
620 if( std::all_of( aSel.Items().begin(), aSel.Items().end(),
623 return item->Type() == SCH_LINE_T
624 && static_cast<const SCH_LINE*>( item )->IsGraphicLine();
629 else if( std::all_of( aSel.Items().begin(), aSel.Items().end(),
632 return item->Type() == SCH_JUNCTION_T;
637 else if( std::all_of( aSel.Items().begin(), aSel.Items().end(),
640 const SCH_ITEM* schItem = dynamic_cast<const SCH_ITEM*>( item );
642 wxCHECK( schItem, false );
644 return ( schItem->HasLineStroke() && schItem->IsConnectable() )
645 || item->Type() == SCH_JUNCTION_T;
658 auto autoplaceCondition =
672 static const std::vector<KICAD_T> allTextTypes = {
SCH_LABEL_T,
690 static const std::vector<KICAD_T> toCLabelTypes = {
SCH_LABEL_T,
699 static const std::vector<KICAD_T> toHLabelTypes = {
SCH_LABEL_T,
708 static const std::vector<KICAD_T> toGLabelTypes = {
SCH_LABEL_T,
717 static const std::vector<KICAD_T> toTextTypes = {
SCH_LABEL_T,
726 static const std::vector<KICAD_T> toTextBoxTypes = {
SCH_LABEL_T,
741 auto variantActiveCondition =
744 return !
m_frame->Schematic().GetCurrentVariant().IsEmpty();
747 auto noVariantActiveCondition =
750 return m_frame->Schematic().GetCurrentVariant().IsEmpty();
753 auto symbolHasVariantSymbol =
756 if(
m_frame->Schematic().GetCurrentVariant().IsEmpty() || aSel.GetSize() != 1 )
766 std::optional<SCH_SYMBOL_VARIANT> variant =
769 return variant.has_value() && variant->m_SymbolOverride.has_value();
772 auto makeSymbolUnitMenu =
775 std::shared_ptr<SYMBOL_UNIT_MENU> menu = std::make_shared<SYMBOL_UNIT_MENU>();
776 menu->SetTool( tool );
777 tool->GetToolMenu().RegisterSubMenu( menu );
781 auto makeBodyStyleMenu =
784 std::shared_ptr<BODY_STYLE_MENU> menu = std::make_shared<BODY_STYLE_MENU>();
785 menu->SetTool( tool );
786 tool->GetToolMenu().RegisterSubMenu( menu );
790 auto makePinFunctionMenu =
793 std::shared_ptr<ALT_PIN_FUNCTION_MENU> menu = std::make_shared<ALT_PIN_FUNCTION_MENU>();
794 menu->SetTool( tool );
795 tool->GetToolMenu().RegisterSubMenu( menu );
799 auto makePinTricksMenu =
802 std::shared_ptr<PIN_TRICKS_MENU> menu = std::make_shared<PIN_TRICKS_MENU>();
803 menu->SetTool( tool );
804 tool->GetToolMenu().RegisterSubMenu( menu );
808 auto makeTransformMenu =
822 auto makeAttributesMenu =
837 auto makeEditFieldsMenu =
850 auto makeConvertToMenu =
869 std::shared_ptr<LOCK_CONTEXT_MENU> menu = std::make_shared<LOCK_CONTEXT_MENU>( tool );
870 tool->GetToolMenu().RegisterSubMenu( menu );
897 moveMenu.AddMenu( makeTransformMenu(), orientCondition, 200 );
898 moveMenu.AddMenu( makeAttributesMenu(),
S_C::HasTypes( attribTypes ), 200 );
903 moveMenu.AddSeparator();
924 drawMenu.
AddMenu( makeTransformMenu(), orientCondition, 200 );
948 selToolMenu.
AddMenu( makeTransformMenu(), orientCondition, 200 );
966 symbolHasVariantSymbol, 200 );
967 selToolMenu.
AddMenu( makeConvertToMenu(), toChangeCondition, 200 );
1049 wxLogTrace(
"KICAD_SCH_MOVE",
"SCH_EDIT_TOOL::Rotate: start, clockwise=%d, selection size=%u", clockwise,
1052 if( selection.
GetSize() == 0 )
1056 int principalItemCount = 0;
1058 bool moving =
false;
1063 std::map<SCH_SHEET_PIN*, SCH_NO_CONNECT*> noConnects;
1064 std::vector<SCH_SYMBOL*> autoplaceSymbols;
1067 commit = &localCommit;
1069 for(
unsigned ii = 0; ii < selection.
GetSize(); ii++ )
1076 principalItemCount++;
1083 autoplaceSymbols.push_back(
static_cast<SCH_SYMBOL*
>( item ) );
1091 autoplaceSymbols.push_back(
static_cast<SCH_SYMBOL*
>( aChild ) );
1100 if( principalItemCount == 1 )
1112 switch( head->
Type() )
1118 symbol->
Rotate( rotPoint, !clockwise );
1175 head->
Rotate( rotPoint, !clockwise );
1197 head->
Rotate( rotPoint, !clockwise );
1205 rotPoint =
m_frame->GetNearestHalfGridPosition(
group->GetPosition() );
1207 group->Rotate( rotPoint, !clockwise );
1209 group->Move( rotPoint -
m_frame->GetNearestHalfGridPosition(
group->GetPosition() ) );
1218 rotPoint =
m_frame->GetNearestHalfGridPosition(
table->GetCenter() );
1220 table->Rotate( rotPoint, !clockwise );
1222 table->Move( rotPoint -
m_frame->GetNearestHalfGridPosition(
table->GetCenter() ) );
1228 head->
Rotate( rotPoint, clockwise );
1242 sheet->
Rotate( rotPoint, !clockwise );
1251 m_frame->UpdateItem( head,
false,
true );
1261 for(
EDA_ITEM* edaItem : selection )
1277 line->
Rotate( rotPoint, !clockwise );
1307 field->
Rotate( rotPoint, !clockwise );
1318 table->Rotate( rotPoint, !clockwise );
1321 table->Move( beforeCenter -
table->GetCenter() );
1329 sheet->
Rotate( rotPoint, !clockwise );
1334 item->
Rotate( rotPoint, !clockwise );
1336 wxLogTrace(
"KICAD_SCH_MOVE",
" SCH_EDIT_TOOL::Rotate: item type=%d rotated, pos (%d,%d) -> (%d,%d)",
1337 item->
Type(), posBefore.
x, posBefore.
y, posAfter.
x, posAfter.
y );
1340 m_frame->UpdateItem( item,
false,
true );
1345 if(
m_frame->eeconfig()->m_AutoplaceFields.enable )
1353 symbol->AutoplaceFields( screen, fieldsAutoplaced );
1354 m_frame->UpdateItem( symbol,
false,
true );
1359 wxLogTrace(
"KICAD_SCH_MOVE",
"SCH_EDIT_TOOL::Rotate: complete, moving=%d", moving );
1363 wxLogTrace(
"KICAD_SCH_MOVE",
"SCH_EDIT_TOOL::Rotate: posting refreshPreview" );
1368 for(
auto& [sheetPin, noConnect] : noConnects )
1370 if( noConnect->GetPosition() != sheetPin->GetTextPos() )
1372 commit->
Modify( noConnect, screen );
1373 noConnect->SetPosition( sheetPin->GetTextPos() );
1387 m_frame->Schematic().CleanUp( commit );
1389 if( !localCommit.
Empty() )
1390 localCommit.
Push(
_(
"Rotate" ) );
1403 if( selection.
GetSize() == 0 )
1408 bool connections =
false;
1414 std::map<SCH_SHEET_PIN*, SCH_NO_CONNECT*> noConnects;
1417 commit = &localCommit;
1419 if( selection.
GetSize() == 1 )
1424 switch( item->
Type() )
1521 m_frame->UpdateItem( item,
false,
true );
1523 else if( selection.
GetSize() > 1 )
1527 for(
EDA_ITEM* edaItem : selection )
1529 item =
static_cast<SCH_ITEM*
>( edaItem );
1574 noConnects[
pin] = noConnect;
1594 m_frame->UpdateItem( item,
false,
true );
1599 for(
EDA_ITEM* selected : selection )
1608 for(
auto& [sheetPin, noConnect] : noConnects )
1610 if( noConnect->GetPosition() != sheetPin->GetTextPos() )
1612 commit->
Modify( noConnect, screen );
1613 noConnect->SetPosition( sheetPin->GetTextPos() );
1629 m_frame->Schematic().CleanUp( commit );
1632 if( !localCommit.
Empty() )
1633 localCommit.
Push(
_(
"Mirror" ) );
1649 unsigned aFallbackRotationsCCW )
1651 std::set<wxString> handledKeys;
1660 const VECTOR2I bRelPos = bField.GetPosition() - bField.GetParentPosition();
1663 const EDA_ANGLE bTextAngle = bField.GetTextAngle();
1670 bField.SetPosition( bField.GetParentPosition() + aRelPos );
1671 bField.SetHorizJustify( aTextJustifyH );
1672 bField.SetVertJustify( aTextJustifyV );
1673 bField.SetTextAngle( aTextAngle );
1680 auto it = std::find_if( aBFields.begin(), aBFields.end(),
1683 return bField.GetUntranslatedName() == name;
1686 if( it != aBFields.end() )
1690 swapFieldTextProps( aField, bField );
1695 for(
unsigned ii = 0; ii < aFallbackRotationsCCW; ii++ )
1702 handledKeys.insert(
name );
1709 const wxString bName = bField.GetUntranslatedName();
1710 if( handledKeys.find( bName ) == handledKeys.end() )
1712 for(
unsigned ii = 0; ii < aFallbackRotationsCCW; ii++ )
1714 bField.Rotate( bField.GetParentPosition(),
false );
1729 if( selection.
Size() < 2 )
1743 if( item->GetParent() != parent )
1749 bool connections =
false;
1755 commit = &localCommit;
1758 std::map<SCH_SHEET_PIN*, SCH_NO_CONNECT*> noConnects;
1766 std::map<SCH_SHEET_PIN*, SCH_NO_CONNECT*> sheetNoConnects =
1767 static_cast<SCH_SHEET*
>( item )->GetNoConnects();
1769 noConnects.insert( sheetNoConnects.begin(), sheetNoConnects.end() );
1781 for(
size_t i = 0; i < sorted.size() - 1; i++ )
1793 std::swap( aPos, bPos );
1802 std::swap( aSide, bSide );
1834 std::vector<SCH_FIELD>& aFields = aLabelBase.
GetFields();
1835 std::vector<SCH_FIELD>& bFields = bLabelBase.
GetFields();
1837 const unsigned rotationsAtoB = aSpinStyle.
CCWRotationsTo( bSpinStyle );
1848 if( !aText || !bText )
1874 std::swap( aOrient, bOrient );
1887 m_frame->UpdateItem( a,
false,
true );
1888 m_frame->UpdateItem( b,
false,
true );
1897 for(
auto& [sheetPin, noConnect] : noConnects )
1899 if( noConnect->GetPosition() != sheetPin->GetTextPos() )
1901 commit->
Modify( noConnect, screen );
1902 noConnect->SetPosition( sheetPin->GetTextPos() );
1914 if( !localCommit.
Empty() )
1915 localCommit.
Push(
_(
"Swap" ) );
1935 if( !
m_frame->eeconfig()->m_Input.allow_unconstrained_pin_swaps )
1942 if( selection.
Size() < 2 )
1955 if( item->GetParent() != parent )
1959 std::set<wxString> sharedSheetPaths;
1960 std::set<wxString> sharedProjectNames;
1963 &sharedProjectNames ) )
1967 std::set<wxString> friendlySheets;
1969 if( !sharedSheetPaths.empty() )
1972 if( !sharedProjectNames.empty() )
1976 if( projects.IsEmpty() )
1978 m_frame->ShowInfoBarError(
_(
"Pin swaps are disabled for symbols shared across other projects. "
1979 "Duplicate the sheet to edit pins independently." ) );
1984 wxString::Format(
_(
"Pin swaps are disabled for symbols shared across other projects (%s). "
1985 "Duplicate the sheet to edit pins independently." ),
1989 else if( !friendlySheets.empty() )
1994 wxString::Format(
_(
"Pin swaps are disabled for symbols used by multiple sheet instances (%s). "
1995 "Duplicate the sheet to edit pins independently." ),
2001 _(
"Pin swaps are disabled for shared symbols. Duplicate the sheet to edit pins independently." ) );
2007 bool connections =
false;
2013 commit = &localCommit;
2019 bool swappedLibPins =
false;
2021 for(
size_t i = 0; i < sorted.size() - 1; i++ )
2024 SCH_PIN* bPin =
static_cast<SCH_PIN*
>( sorted[( i + 1 ) % sorted.size()] );
2037 m_frame->UpdateItem( aPin,
false,
true );
2038 m_frame->UpdateItem( bPin,
false,
true );
2041 if( swappedLibPins )
2045 m_frame->UpdateItem( parentSymbol,
false,
true );
2058 m_frame->Schematic().CleanUp( commit );
2065 if( !localCommit.
Empty() )
2066 localCommit.
Push(
_(
"Swap Pins" ) );
2080 std::vector<SCH_ITEM*> items;
2085 std::set<SCH_ITEM*> seen{ aPin };
2086 std::vector<SCH_ITEM*> pending{ aPin };
2088 while( !pending.empty() )
2092 items.push_back( item );
2098 if( seen.insert( neighbor ).second )
2099 pending.push_back( neighbor );
2107 items.assign( sg->GetItems().begin(), sg->GetItems().end() );
2110 const auto isNet = [&](
SCH_ITEM* aItem )
2115 return connection && connection->IsNet();
2118 const SCH_CONNECTION* connection = aItem->Connection( &aSheetPath );
2119 return connection && connection->
IsNet();
2122 size_t pinCount = 0;
2130 if( !item->IsType( { SCH_LABEL_T, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T } ) || !isNet( item ) )
2151 if( orderedPins.size() < 2 )
2156 std::vector<SCH_LABEL_BASE*> labels;
2158 for(
EDA_ITEM* item : orderedPins )
2166 _(
"Each selected pin must have exactly one attached net label and no other pin connections." ) );
2170 labels.push_back( label );
2173 if( labels.size() >= 2 )
2180 for(
size_t i = 0; i < labels.size() - 1; ++i )
2184 wxString aText = a->
GetText();
2185 wxString bText = b->
GetText();
2190 commit.
Push(
_(
"Swap Pin Labels" ) );
2202 if( selectedUnits.size() < 2 )
2208 std::vector<std::vector<SCH_LABEL_BASE*>> symbolLabelVectors;
2212 std::vector<std::pair<VECTOR2I, SCH_LABEL_BASE*>> byPos;
2214 for(
SCH_PIN*
pin : symbol->GetPins( &sheetPath ) )
2220 m_frame->ShowInfoBarError(
_(
"Each pin of selected units must have exactly one attached net label and "
2221 "no other pin connections." ) );
2225 byPos.emplace_back(
pin->GetPosition(), label );
2229 std::sort( byPos.begin(), byPos.end(),
2230 [](
const auto& a,
const auto& b )
2232 if( a.first.x != b.first.x )
2233 return a.first.x < b.first.x;
2235 return a.first.y < b.first.y;
2239 std::vector<SCH_LABEL_BASE*> labels;
2241 for(
const auto& pr : byPos )
2242 labels.push_back( pr.second );
2244 symbolLabelVectors.push_back( labels );
2248 const size_t pinCount = symbolLabelVectors.front().size();
2253 for(
size_t pin = 0;
pin < pinCount;
pin++ )
2255 for(
auto& vec : symbolLabelVectors )
2258 wxString carry = symbolLabelVectors.back()[
pin]->GetText();
2260 for(
size_t i = 0; i < symbolLabelVectors.size(); i++ )
2269 if( !commit.
Empty() )
2270 commit.
Push(
_(
"Swap Unit Labels" ) );
2280 std::vector<std::unique_ptr<SCH_ITEM>> sourceItems(
m_frame->GetRepeatItems().size() );
2282 for(
int ii = 0; ii < (int) sourceItems.size(); ++ii )
2285 if( sourceItems.empty() )
2294 for(
const std::unique_ptr<SCH_ITEM>& item : sourceItems )
2297 int commitCheckpoint = commit.Checkpoint();
2298 bool restore_state =
false;
2309 enteredGroup->AddItem( newItem );
2318 if( !label->IncrementLabel( cfg->m_Drawing.repeat_label_increment ) )
2319 m_frame->ShowInfoBarWarning(
_(
"Label value cannot go below zero" ),
true );
2332 schIUScale.MilsToIU( cfg->m_Drawing.default_repeat_offset_y ) ) );
2341 if(
m_frame->CheckSheetForRecursion( sheet, currentSheet ) )
2344 const wxString originalFileName = sheet->
GetFileName();
2349 restore_state = !
m_frame->EditSheetProperties( sheet, currentSheet );
2362 commit.Added( newItem,
m_frame->GetScreen() );
2371 if(
m_frame->eeconfig()->m_AnnotatePanel.automatic )
2373 static_cast<SCH_SYMBOL*
>( newItem )->ClearAnnotation(
nullptr,
false );
2376 true , annotateStartNum,
false,
false,
false,
reporter );
2391 enteredGroup->RemoveItem( newItem );
2393 commit.RevertToCheckpoint( commitCheckpoint );
2397 newItems.
Add( newItem );
2401 if( !newItems.
Empty() )
2407 m_frame->Schematic().CleanUp( &commit );
2408 commit.Push(
_(
"Repeat Item" ) );
2410 m_frame->SaveCopyForRepeatItem(
static_cast<SCH_ITEM*
>( newItems[0] ) );
2412 for(
size_t ii = 1; ii < newItems.
GetSize(); ++ii )
2413 m_frame->AddCopyForRepeatItem(
static_cast<SCH_ITEM*
>( newItems[ii] ) );
2427 std::deque<EDA_ITEM*> items =
m_selectionTool->GetSelection().GetItems();
2429 std::vector<VECTOR2I> pts;
2430 bool updateHierarchy =
false;
2451 pts.insert( pts.end(), tmp_pts.begin(), tmp_pts.end() );
2474 static_cast<SCH_FIELD*
>( sch_item )->SetVisible(
false );
2480 static_cast<SCH_TABLECELL*
>( sch_item )->SetText( wxEmptyString );
2517 m_frame->DeleteJunction( &commit, junction );
2520 commit.
Push(
_(
"Delete" ) );
2522 if( updateHierarchy )
2523 m_frame->UpdateHierarchyNavigator();
2539 caption.Printf(
_(
"Edit %s Field" ),
TitleCaps( fieldName ) );
2543 caption.Printf(
_(
"Edit '%s' Field" ), aField->
GetName() );
2570 if( !commit.
Empty() )
2571 commit.
Push( caption );
2579 if( sel.
Size() != 1 )
2582 bool clearSelection = sel.
IsHover();
2598 if( item ==
nullptr )
2630 clearSelection =
true;
2654 if( clearSelection )
2666 bool moving = head && head->
IsMoving();
2668 if( selection.
Empty() )
2671 std::vector<SCH_ITEM*> autoplaceItems;
2673 for(
unsigned ii = 0; ii < selection.
GetSize(); ii++ )
2678 autoplaceItems.push_back( item );
2683 for(
SCH_ITEM* sch_item : autoplaceItems )
2685 if( sch_item->IsLocked() )
2688 if( !moving && !sch_item->IsNew() )
2702 if( !commit.
Empty() )
2703 commit.
Push(
_(
"Autoplace Fields" ) );
2718 if( !selection.
Empty() )
2727 if( !
m_frame->Schematic().GetCurrentVariant().IsEmpty() )
2730 _(
"Change Symbol is not available when a design variant is active. "
2731 "Use Set Variant Symbol or switch to the default variant first." ) );
2754 if( selection.
Empty() )
2762 wxString variantName =
m_frame->Schematic().GetCurrentVariant();
2764 if( variantName.IsEmpty() )
2773 std::shared_ptr<LIB_SYMBOL> baseFlat;
2780 baseFlat = baseSymbol->
Flatten();
2783 [baseFlat, adapter](
const LIB_ID& aCandidate )
2784 -> std::vector<VARIANT_COMPAT_RESULT>
2790 std::unique_ptr<LIB_SYMBOL> flat = raw->Flatten();
2803 std::vector<PICKED_SYMBOL> historyList;
2804 std::vector<PICKED_SYMBOL> alreadyPlaced;
2807 &symbol->
GetLibId(),
false, compatFunc );
2824 _(
"Could not load symbol '%s' from library." ), symLabel ) );
2831 std::unique_ptr<LIB_SYMBOL> candidateFlat = candidateRaw->
Flatten();
2835 std::vector<VARIANT_COMPAT_RESULT> issues =
2838 if( !issues.empty() )
2840 wxString msg = wxString::Format(
2841 _(
"The selected symbol '%s' is not pin-compatible with the base symbol "
2847 msg += wxS(
"\u2022 " ) + issue.detail + wxS(
"\n" );
2849 msg += wxS(
"\n" ) +
_(
"Choose a symbol with equivalent pins and pin positions." );
2850 wxMessageBox( msg,
_(
"Variant Symbol Compatibility" ), wxOK | wxICON_ERROR,
m_frame );
2863 commit.
Push(
_(
"Set Variant Symbol" ) );
2864 m_frame->GetCanvas()->Refresh();
2877 if( selection.
Empty() )
2885 wxString variantName =
m_frame->Schematic().GetCurrentVariant();
2887 if( variantName.IsEmpty() )
2892 std::optional<SCH_SYMBOL_VARIANT> existingVariant =
2893 symbol->
GetVariant( currentSheet, variantName );
2895 if( !existingVariant || !existingVariant->m_SymbolOverride.has_value() )
2904 commit.
Push(
_(
"Clear Variant Symbol" ) );
2905 m_frame->GetCanvas()->Refresh();
2918 if( selection.
Empty() )
2927 m_frame->SelectBodyStyle( symbol, nextBodyStyle );
2929 if( symbol->
IsNew() )
2942 bool clearSelection = selection.
IsHover();
2944 if( selection.
Empty() )
2969 switch( curr_item->
Type() )
2976 std::deque<SCH_LINE*> lines;
2979 lines.push_back(
static_cast<SCH_LINE*
>( selItem ) );
2987 std::deque<SCH_JUNCTION*> junctions;
2990 junctions.push_back(
static_cast<SCH_JUNCTION*
>( selItem ) );
3001 std::deque<SCH_ITEM*> items;
3004 items.push_back(
static_cast<SCH_ITEM*
>( selItem ) );
3012 frame()->ShowInfoBarMsg(
_(
"Use Properties panel to edit properties common to selected items." ) );
3023 if( inspectionTool )
3031 std::vector<SCH_TABLECELL*> cells;
3053 if( selection.
Size() > 1 )
3059 if( !
frame()->GetPropertiesPanel()->IsShownOnScreen() )
3061 infobar->
AddLink(
_(
"Show Properties panel" ),
3062 [
this]( wxHyperlinkEvent& )
3064 frame()->ToggleProperties();
3069 infobar->
ShowMessageFor(
_(
"Use Properties panel to edit properties common to selected items." ),
3070 8000, wxICON_INFORMATION );
3078 if( clearSelection )
3087 switch( aItem->
Type() )
3108 if(
m_frame->eeconfig()->m_AutoplaceFields.enable )
3124 if( wxWindow* blocking_win =
editor->Kiway().GetBlockingDialog() )
3125 blocking_win->Close(
true );
3131 editor->LoadSymbolFromSchematic( symbol );
3142 if( wxWindow* blocking_win =
editor->Kiway().GetBlockingDialog() )
3143 blocking_win->Close(
true );
3175 bool isUndoable =
false;
3176 bool doClearAnnotation =
false;
3177 bool okPressed =
false;
3178 bool updateHierarchyNavigator =
false;
3188 okPressed =
m_frame->EditSheetProperties( sheet, &
m_frame->GetCurrentSheet(), &isUndoable, &doClearAnnotation,
3189 &updateHierarchyNavigator );
3195 commit.
Push(
_(
"Edit Sheet Properties" ) );
3202 std::vector<SCH_ITEM*> items;
3204 items.emplace_back( sheet );
3205 m_frame->Schematic().OnItemsRemoved( items );
3206 m_frame->Schematic().OnItemsAdded( items );
3208 m_frame->Schematic().RefreshHierarchy();
3209 m_frame->UpdateHierarchyNavigator();
3216 if( doClearAnnotation )
3231 if( !okPressed || !isUndoable || doClearAnnotation )
3235 m_frame->GetCanvas()->Refresh();
3237 if( updateHierarchyNavigator )
3238 m_frame->UpdateHierarchyNavigator();
3321 dlg.SetTitle(
_(
"Rule Area Properties" ) );
3337 wxFAIL_MSG( wxString(
"Cannot edit schematic item type " ) + aItem->
GetClass() );
3345 m_frame->GetScreen()->UpdateDisplayBounds( schItem );
3359 commit = &localCommit;
3361 for(
unsigned int i = 0; i < selection.GetSize(); ++i )
3365 if( item && item->
Type() != convertTo )
3376 wxCHECK2( sourceText,
continue );
3378 switch( item->
Type() )
3398 txt =
_(
"<empty>" );
3409 txt =
text->GetText();
3410 href =
text->GetHyperlink();
3427 int textSize =
text->GetTextSize().y;
3460 position =
m_frame->GetNearestGridPosition( position );
3470 auto getValidNetname =
3471 [](
const wxString& aText )
3473 wxString local_txt = aText;
3474 local_txt.Replace(
"\n",
"_" );
3475 local_txt.Replace(
"\r",
"_" );
3476 local_txt.Replace(
"\t",
"_" );
3480 local_txt.Replace(
" ",
"_" );
3485 if( local_txt.IsEmpty() )
3486 return _(
"<empty>" );
3514 newtext = new_label;
3539 newtext = new_label;
3564 newtext = new_label;
3581 new_label->
GetFields().push_back( netclass );
3588 newtext = new_label;
3608 bbox.
Inflate( -label->GetLabelBoxExpansion() );
3639 new_textbox->
SetEnd( botRight );
3642 newtext = new_textbox;
3651 wxCHECK2( newtext,
continue );
3662 wxCHECK2( eda_text && new_eda_text,
continue );
3677 if( label && new_label )
3686 return field.GetId() == FIELD_T::INTERSHEET_REFS
3687 && new_label->Type() != SCH_GLOBAL_LABEL_T;
3709 if( !localCommit.
Empty() )
3710 localCommit.
Push(
_(
"Change To" ) );
3712 if( selection.IsHover() )
3725 if( selection.
GetSize() == 0 )
3734 commit = &localCommit;
3747 for(
EDA_ITEM* edaItem : selection )
3749 item =
static_cast<SCH_ITEM*
>( edaItem );
3756 setJustify(
static_cast<SCH_FIELD*
>( item ) );
3763 setJustify(
static_cast<SCH_TEXT*
>( item ) );
3774 setJustify( label );
3777 m_frame->UpdateItem( item,
false,
true );
3781 for(
EDA_ITEM* selected : selection )
3795 if( !localCommit.
Empty() )
3798 localCommit.
Push(
_(
"Left Justify" ) );
3800 localCommit.
Push(
_(
"Center Justify" ) );
3802 localCommit.
Push(
_(
"Right Justify" ) );
3819 if( !
IsOK(
m_frame,
_(
"Do you wish to delete the unreferenced pins from this sheet?" ) ) )
3828 commit.
Push(
_(
"Cleanup Sheet Pins" ) );
3853 screen =
m_frame->GetScreen();
3862 if( prevInstance.
size() )
3870 screen =
m_frame->GetScreen();
3873 sheet =
m_frame->GetCurrentSheet().Last();
3880 msg.Printf(
_(
"Enter page number for sheet path%s" ),
3881 ( sheetPath.Length() > 20 ) ?
"\n" + sheetPath :
" " + sheetPath );
3883 wxTextEntryDialog dlg(
m_frame, msg,
_(
"Edit Sheet Page Number" ), pageNumber );
3885 dlg.SetTextValidator( wxFILTER_ALPHANUMERIC );
3887 if( dlg.ShowModal() == wxID_CANCEL || dlg.GetValue() == instance.
GetPageNumber() )
3892 commit.
Modify( sheet, screen );
3896 if( instance ==
m_frame->GetCurrentSheet() )
3898 m_frame->GetScreen()->SetPageNumber( dlg.GetValue() );
3899 m_frame->OnPageSettingsChange();
3902 commit.
Push( wxS(
"Change Sheet Page Number" ) );
3933 auto showPreview = [&](
double aThreshold,
bool aInvert )
3937 m_frame->GetCanvas()->ForceRefresh();
3952 m_frame->GetCanvas()->ForceRefresh();
3959 double scaleX = (double) size.
x / bilevel.GetWidth();
3960 double scaleY = (double) size.
y / bilevel.GetHeight();
3964 wxString warnings =
reporter.GetMessages();
3968 const int icon = warnings.IsEmpty() ? wxICON_INFORMATION : wxICON_WARNING;
3972 wxString
message = warnings.IsEmpty() ?
_(
"No shapes to trace at this threshold." ) : warnings;
3974 m_frame->GetCanvas()->ForceRefresh();
3982 traced.
Move( origin );
3997 for(
int jj = 0; jj < outline.
PointCount(); jj++ )
4002 group->AddItem( shape );
4008 commit.
Push(
_(
"Convert Image to Outlines" ) );
4010 wxString
message = wxString::Format( wxPLURAL(
"Added %d shape.",
"Added %d shapes.", traced.
OutlineCount() ),
4013 if( !warnings.IsEmpty() )
4014 message << wxS(
" " ) << warnings;
4024 wxString* filename = aEvent.
Parameter<wxString*>();
4031 if( !
image->GetReferenceImage().ReadImageFile( *filename ) )
4033 wxMessageBox( wxString::Format(
_(
"Could not load image from '%s'." ), *filename ) );
4048 std::set<std::pair<SCH_ITEM*, SCH_SCREEN*>> collectedItems;
4054 collectedItems.insert( { symbol,
m_frame->GetScreen() } );
4058 if( symbol->IsAnnotated( &
m_frame->GetCurrentSheet() ) )
4060 wxString ref = symbol->GetRef( &
m_frame->GetCurrentSheet() );
4061 int unit = symbol->GetUnit();
4062 LIB_ID libId = symbol->GetLibId();
4067 std::vector<SCH_SYMBOL*> otherUnits;
4072 collectedItems.insert( { otherUnit, screen } );
4078 collectedItems.insert( { sheet,
m_frame->GetScreen() } );
4082 collectedItems.insert( { ruleArea,
m_frame->GetScreen() } );
4088 wxString variant =
m_frame->Schematic().GetCurrentVariant();
4089 bool new_state =
false;
4091 for(
const auto& [item,
_] : collectedItems )
4098 && !item->GetExcludedFromPosFiles( sheet, variant ) ) )
4105 for(
const auto& [item, screen] : collectedItems )
4107 commit.
Modify( item, screen );
4110 item->SetDNP( new_state, sheet, variant );
4113 item->SetExcludedFromSim( new_state, sheet, variant );
4116 item->SetExcludedFromBOM( new_state, sheet, variant );
4119 item->SetExcludedFromBoard( new_state, sheet, variant );
4122 item->SetExcludedFromPosFiles( new_state, sheet, variant );
4125 if( !commit.
Empty() )
4126 commit.
Push(
_(
"Toggle Attribute" ) );
4141 return _(
"Edit Symbol Properties..." );
4158 return _(
"Edit Netclasses..." );
4162 return _(
"Remove Empty Label" );
4165 return wxEmptyString;
4179 if(
EDA_ITEM* item =
frame->ResolveItem( aERCItem->GetMainItemID() ) )
4188 EDA_ITEM* item =
frame->ResolveItem( aERCItem->GetMainItemID() );
4203 frame->ShowSchematicSetupDialog(
_(
"Net Classes" ) );
4208 SCH_ITEM* item =
frame->Schematic().ResolveItem( aERCItem->GetMainItemID(), &sheetPath,
true );
4216 commit.
Push(
_(
"Remove Empty Label" ) );
4244 if( selection.
Empty() )
4247 if( selection.
Empty() )
4258 if( schItem->IsLocked() )
4267 wxString commitMsg = ( aMode ==
ON ) ?
_(
"Lock" ) :
_(
"Unlock" );
4280 schItem->SetLocked( aMode ==
ON );
4284 if( !commit.
Empty() )
4286 commit.
Push( commitMsg );
constexpr EDA_IU_SCALE schIUScale
wxImage ConvertImageToBilevel(const wxImage &aImage, double aThreshold, bool aInvert)
Reduce an image to pure black and white.
SHAPE_POLY_SET TraceBilevelImage(const wxImage &aBilevelImage, double aScaleX, double aScaleY, REPORTER &aReporter)
Trace the black regions of a black and white image into filled polygons.
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
static TOOL_ACTION decrementPrimary
static TOOL_ACTION unselectAll
static TOOL_ACTION decrementSecondary
static TOOL_ACTION selectItem
Select an item (specified as the event parameter).
static TOOL_ACTION unselectItem
static TOOL_ACTION showSymbolLibTable
static TOOL_ACTION pasteSpecial
static TOOL_ACTION groupProperties
static TOOL_ACTION rightJustify
static TOOL_ACTION pageSettings
static TOOL_ACTION incrementSecondary
static TOOL_ACTION duplicate
static TOOL_ACTION incrementPrimary
static TOOL_ACTION doDelete
static TOOL_ACTION cursorClick
static TOOL_ACTION deleteTool
static TOOL_ACTION increment
static TOOL_ACTION selectionClear
Clear the current selection.
static TOOL_ACTION leftJustify
static TOOL_ACTION copyAsText
static TOOL_ACTION refreshPreview
static TOOL_ACTION selectAll
static TOOL_ACTION centerJustify
Manage TOOL_ACTION objects.
void SetConditions(const TOOL_ACTION &aAction, const ACTION_CONDITIONS &aConditions)
Set the conditions the UI elements for activating a specific tool action should use for determining t...
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
This class handle bitmap images in KiCad.
void BeginPreviewImage(const wxImage &aImage)
Show finished pixels in place of the image, without disturbing the scale or the resolution.
void EndPreviewImage()
Put back the image a preview stood in for, and do nothing if none is showing.
void update() override
Update menu state stub.
ACTION_MENU * create() const override
Return an instance of this class. It has to be overridden in inheriting classes.
constexpr const Vec & GetPosition() const
constexpr BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
constexpr const Vec GetEnd() const
constexpr void SetOrigin(const Vec &pos)
constexpr Vec Centre() const
constexpr const Vec GetCenter() const
constexpr coord_type GetLeft() const
constexpr const Vec & GetOrigin() const
constexpr coord_type GetRight() const
constexpr void SetEnd(coord_type x, coord_type y)
constexpr coord_type GetTop() const
constexpr coord_type GetBottom() const
COMMIT & Remove(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Remove a new item from the model.
COMMIT & Added(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Notify observers that aItem has been added.
void Unstage(EDA_ITEM *aItem, BASE_SCREEN *aScreen)
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr, RECURSE_MODE aRecurse=RECURSE_MODE::NO_RECURSE)
Modify a given item in the model.
COMMIT & Add(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Add a new item to the model.
COMMIT & Removed(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Notify observers that aItem has been removed.
int GetStatus(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Returns status of an item.
Calculate the connectivity of a schematic and generate netlists.
A subgraph is a set of items that are electrically connected on a single sheet.
Dialog to update or change schematic library symbols.
Ask for the settings used to trace a placed image into outlines.
double GetThreshold() const
Brightness cut deciding which pixels are traced, from 0 to 1.
This class is setup in expectation of its children possibly using Kiway player so DIALOG_SHIM::ShowQu...
void UpdateField(SCH_FIELD *aField)
Dialog used to edit SCH_SYMBOL objects in a schematic.
@ TABLECELL_PROPS_EDIT_TABLE
enum TABLECELL_PROPS_RETVALUE GetReturnValue()
bool HitTestDrawingSheetItems(KIGFX::VIEW *aView, const VECTOR2I &aPosition)
bool IsHorizontal() const
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 VECTOR2I GetPosition() const
virtual void SetPosition(const VECTOR2I &aPos)
virtual const BOX2I GetBoundingBox() const
Return the orthogonal bounding box of this object for display purposes.
EDA_ITEM_FLAGS GetEditFlags() const
void SetFlags(EDA_ITEM_FLAGS aMask)
KICAD_T Type() const
Returns the type of object.
virtual bool IsType(const std::vector< KICAD_T > &aScanTypes) const
Check whether the item is one of the listed types.
EDA_ITEM * GetParent() const
bool HasFlag(EDA_ITEM_FLAGS aFlag) const
virtual void SetParent(EDA_ITEM *aParent)
virtual void SetEnd(const VECTOR2I &aEnd)
void SetFillMode(FILL_T aFill)
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
virtual VECTOR2I GetTextSize() const
virtual void SetTextSize(VECTOR2I aNewSize, bool aEnforceMinTextSize=true)
virtual const wxString & GetText() const
Return the string associated with the text object.
virtual bool IsVisible() const
virtual void SetTextPos(const VECTOR2I &aPoint)
KIFONT::FONT * GetFont() const
void SetAttributes(const EDA_TEXT &aSrc, bool aSetPosition=true)
Set the text attributes from another instance.
void SetVertJustify(GR_TEXT_V_ALIGN_T aType)
wxString GetHyperlink() const
GR_TEXT_H_ALIGN_T GetHorizJustify() const
virtual void SetTextThickness(int aWidth)
The TextThickness is that set by the user.
virtual EDA_ANGLE GetTextAngle() const
void SetBold(bool aBold)
Set the text to be bold - this will also update the font if needed.
void SetHyperlink(wxString aLink)
GR_TEXT_V_ALIGN_T GetVertJustify() const
virtual int GetTextThickness() const
virtual void SetText(const wxString &aText)
virtual void SetTextAngle(const EDA_ANGLE &aAngle)
void SetItalic(bool aItalic)
Set the text to be italic - this will also update the font if needed.
void SetFont(KIFONT::FONT *aFont)
void SetHorizJustify(GR_TEXT_H_ALIGN_T aType)
EE_TYPE Overlapping(const BOX2I &aRect) const
static const TOOL_EVENT SelectedEvent
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.
virtual wxString GetClass() const =0
Return the class name.
void RecacheAllItems()
Rebuild GAL display lists.
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
A logical library item identifier and consists of various portions much like a URI.
bool IsValid() const
Check if this LID_ID is valid.
const UTF8 & GetLibItemName() const
Define a library symbol object.
int GetUnitCount() const override
std::unique_ptr< LIB_SYMBOL > Flatten() const
Return a flattened symbol inheritance to the caller.
static bool ParseBusGroup(const wxString &aGroup, wxString *name, std::vector< wxString > *aMemberList, size_t *aPrefixEnd=nullptr)
Parse a bus group label into the name and a list of components.
A singleton reporter that reports to nowhere.
static SYMBOL_LIBRARY_ADAPTER * SymbolLibAdapter(PROJECT *aProject)
Accessor for project symbol library manager adapter.
A REFERENCE_IMAGE is a wrapper around a BITMAP_IMAGE that is displayed in an editor as a reference fo...
BITMAP_BASE & MutableImage() const
Only use this if you really need to modify the underlying image.
EDA_ANGLE GetOrientation() const
VECTOR2I GetPosition() const
These are loaded from Eeschema settings but then overwritten by the project settings.
Holds all the data relating to one schematic.
SCHEMATIC_SETTINGS & Settings() const
SCH_CONNECTIVITY::FACADE & Connectivity() const
CONNECTION_GRAPH * ConnectionGraph() const
static TOOL_ACTION rotateCCW
static TOOL_ACTION placeClassLabel
static TOOL_ACTION swapPins
static TOOL_ACTION editValue
static TOOL_ACTION setExcludeFromBOM
static TOOL_ACTION mirrorV
static TOOL_ACTION clearHighlight
static TOOL_ACTION placeGlobalLabel
static TOOL_ACTION changeSymbols
static TOOL_ACTION updateSymbol
static TOOL_ACTION autoplaceFields
static TOOL_ACTION changeSymbol
static TOOL_ACTION ddAddImage
static TOOL_ACTION convertImageToOutlines
static TOOL_ACTION properties
static TOOL_ACTION editReference
static TOOL_ACTION placeHierLabel
static TOOL_ACTION placeLabel
static TOOL_ACTION toText
static TOOL_ACTION toHLabel
static TOOL_ACTION rotateCW
static TOOL_ACTION importSheet
static TOOL_ACTION setExcludeFromSim
static TOOL_ACTION toLabel
static TOOL_ACTION setDNP
static TOOL_ACTION swapUnitLabels
static TOOL_ACTION placeImage
static TOOL_ACTION editWithLibEdit
static TOOL_ACTION cleanupSheetPins
static TOOL_ACTION toDLabel
static TOOL_ACTION clearVariantSymbol
static TOOL_ACTION setExcludeFromPosFiles
static TOOL_ACTION cycleBodyStyle
static TOOL_ACTION mirrorH
static TOOL_ACTION setVariantSymbol
static TOOL_ACTION ddAppendFile
static TOOL_ACTION placeSchematicText
static TOOL_ACTION toTextBox
static TOOL_ACTION unlock
static TOOL_ACTION annotate
static TOOL_ACTION updateSymbols
static TOOL_ACTION swapPinLabels
static TOOL_ACTION enterSheet
static TOOL_ACTION editFootprint
static TOOL_ACTION repeatDrawItem
static TOOL_ACTION editTextAndGraphics
static TOOL_ACTION editPageNumber
static TOOL_ACTION toGLabel
static TOOL_ACTION setExcludeFromBoard
static TOOL_ACTION toggleLock
Object to handle a bitmap image that can be inserted in a schematic.
static const std::vector< KICAD_T > FieldOwners
static const std::vector< KICAD_T > DeletableItems
Commit for the schematic and symbol editors.
void Push(const wxString &aMessage=wxEmptyString, int aCommitFlags=0) override
Execute the changes.
static SELECTION_CONDITION SingleMultiFunctionPin
static SELECTION_CONDITION SingleSymbol
static SELECTION_CONDITION MultipleSymbolsOrPower
static SELECTION_CONDITION HasLockedItems
static SELECTION_CONDITION AllPinsOrSheetPins
static SELECTION_CONDITION SingleSymbolOrPower
static SELECTION_CONDITION HasUnlockedItems
static SELECTION_CONDITION SingleMultiUnitSymbol
static SELECTION_CONDITION SingleMultiBodyStyleSymbol
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
std::optional< ITEM_VIEW > Connection(const KIID &aItem, const KIID_PATH &aPath) const
Schematic editor (Eeschema) main window.
const wxString & GetHighlightedConnection() const
void Rotate(const VECTOR2I &aCenter, bool aRotateCCW) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
VECTOR2I GetPosition() const override
wxString GetUntranslatedName() const
Get the untranslated field name for storage, variable look-up, etc.
wxString GetName(bool aUseDefaultName=true) const
Return the field name (not translated).
void SetPosition(const VECTOR2I &aPosition) override
void SetText(const wxString &aText) override
VECTOR2I GetParentPosition() const
A set of SCH_ITEMs (i.e., without duplicates).
Base class for any item which can be embedded within the SCHEMATIC container class,...
SCH_ITEM * Duplicate(bool addToParentGroup, SCH_COMMIT *aCommit=nullptr, bool aDoClone=false) const
Routine to create a new copy of given item.
virtual bool IsConnectable() const
virtual void AutoplaceFields(SCH_SCREEN *aScreen, AUTOPLACE_ALGO aAlgo)
virtual void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction, RECURSE_MODE aMode)
const SYMBOL * GetParentSymbol() const
SCHEMATIC * Schematic() const
Search the item hierarchy to find a SCHEMATIC.
virtual void MirrorHorizontally(int aCenter)
Mirror item horizontally about aCenter.
const std::vector< SCH_ITEM * > & ConnectedItems(const SCH_SHEET_PATH &aPath) const
Retrieve the set of items connected to this item on the given sheet.
virtual void Move(const VECTOR2I &aMoveVector)
Move the item by aMoveVector to a new position.
void SetConnectivityDirty(bool aDirty=true)
Set the dirty flag.
void SetFieldsAutoplaced(AUTOPLACE_ALGO aAlgo)
virtual void Rotate(const VECTOR2I &aCenter, bool aRotateCCW)
Rotate the item around aCenter 90 degrees in the clockwise direction.
AUTOPLACE_ALGO GetFieldsAutoplaced() const
Return whether the fields have been automatically placed.
wxString GetClass() const override
Return the class name.
bool IsGroupableType() const
virtual std::vector< VECTOR2I > GetConnectionPoints() const
Add all the connection points for this item to aPoints.
bool IsType(const std::vector< KICAD_T > &aScanTypes) const override
Check whether the item is one of the listed types.
virtual void MirrorVertically(int aCenter)
Mirror item vertically about aCenter.
void AddFields(const std::vector< SCH_FIELD > &aFields)
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
SPIN_STYLE GetSpinStyle() const
void SetShape(LABEL_FLAG_SHAPE aShape)
LABEL_FLAG_SHAPE GetShape() const
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
std::vector< SCH_FIELD > & GetFields()
virtual void SetSpinStyle(SPIN_STYLE aSpinStyle)
Segment description base class to describe items which have 2 end points (track, wire,...
void Rotate(const VECTOR2I &aCenter, bool aRotateCCW) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
VECTOR2I GetEndPoint() const
VECTOR2I GetStartPoint() const
const std::map< wxString, ALT > & GetAlternates() const
bool IsConnectable() const override
const wxString & GetName() const
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
void ClearAnnotationOfNewSheetPaths(SCH_SHEET_LIST &aInitialSheetPathList)
Clear the annotation for the symbols inside new sheetpaths when a complex hierarchy is modified and n...
bool IsExplicitJunction(const VECTOR2I &aPosition) const
Indicate that a junction dot is necessary at the given location.
EE_RTREE & Items()
Get the full RTree, usually for iterating.
const wxString & GetFileName() const
SCH_ITEM * GetItem(const VECTOR2I &aPosition, int aAccuracy=0, KICAD_T aType=SCH_LOCATE_ANY_T) const
Check aPosition within a distance of aAccuracy for items of type aFilter.
void SetFileName(const wxString &aFileName)
Set the file name for this screen to aFileName.
void ClearAnnotation(SCH_SHEET_PATH *aSheetPath, bool aResetPrefix)
Clear the annotation for the symbols in aSheetPath on the screen.
void SetPosition(const VECTOR2I &aPos) override
void SetStroke(const STROKE_PARAMS &aStroke) override
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
void AddPoint(const VECTOR2I &aPosition)
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
void BuildSheetList(SCH_SHEET *aSheet, bool aCheckIntegrity)
Build the list of sheets and their sheet path from aSheet.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
SCH_SCREEN * LastScreen()
wxString GetPageNumber() const
wxString PathHumanReadable(bool aUseShortRootName=true, bool aStripTrailingSeparator=false, bool aEscapeSheetNames=false) const
Return the sheet path in a human readable form made from the sheet names.
void SetPageNumber(const wxString &aPageNumber)
Set the sheet instance user definable page number.
const KIID_PATH & PathRef() const
Borrow the cached path until this sheet path is modified or destroyed.
void push_back(SCH_SHEET *aSheet)
Forwarded method from std::vector.
size_t size() const
Forwarded method from std::vector.
void pop_back()
Forwarded method from std::vector.
Define a sheet pin (label) used in sheets to create hierarchical schematics.
SHEET_SIDE GetSide() const
void SetSide(SHEET_SIDE aEdge)
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
void SetFileName(const wxString &aFilename)
wxString GetFileName() const
Return the filename corresponding to this sheet.
std::map< SCH_SHEET_PIN *, SCH_NO_CONNECT * > GetNoConnects() const
VECTOR2I GetRotationCenter() const
Rotating around the boundingBox's center can cause walking when the sheetname or filename is longer t...
void CleanupSheet()
Delete sheet label which do not have a corresponding hierarchical label.
void RemovePin(const SCH_SHEET_PIN *aSheetPin)
Remove aSheetPin from the sheet.
bool HasUndefinedPins() const
Check all sheet labels against schematic for undefined hierarchical labels.
SCH_SCREEN * GetScreen() const
const BOX2I GetBodyBoundingBox() const
Return a bounding box for the sheet body but not the fields.
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
void Rotate(const VECTOR2I &aCenter, bool aRotateCCW) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
wxString GetUnitDisplayName(int aUnit, bool aLabel) const override
Return the display name for a given unit aUnit.
bool ClearVariantSymbolOverride(const SCH_SHEET_PATH &aPath, const wxString &aVariantName)
Remove the alternate-symbol override for a given variant and sheet instance.
void SetVariantSymbolOverride(const SCH_SHEET_PATH &aPath, const wxString &aVariantName, const LIB_ID &aLibId)
Set the alternate-symbol override for a given variant and sheet instance.
bool IsMultiBodyStyle() const override
void AutoplaceFields(SCH_SCREEN *aScreen, AUTOPLACE_ALGO aAlgo) override
Automatically orient all the fields in the symbol.
void ClearCaches() override
std::optional< SCH_SYMBOL_VARIANT > GetVariant(const SCH_SHEET_PATH &aInstance, const wxString &aVariantName) const
wxString GetBodyStyleDescription(int aBodyStyle, bool aLabel) const override
void UpdatePins()
Updates the cache of SCH_PIN objects for each pin.
bool HasDeMorganBodyStyles() const override
int GetBodyStyleCount() const override
Return the number of body styles of the symbol.
void SetOrientation(int aOrientation)
Compute the new transform matrix based on aOrientation for the symbol which is applied to the current...
bool IsMissingLibSymbol() const
Check to see if the library symbol is set to the dummy library symbol.
const LIB_ID & GetLibId() const override
int GetOrientation() const override
Get the display symbol orientation.
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
void Rotate(const VECTOR2I &aCenter, bool aRotateCCW) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
bool IsPower() const override
SCH_FIELD * GetField(FIELD_T aFieldType)
Return a mandatory field in this symbol.
int GetMarginBottom() const
int GetLegacyTextMargin() const
int GetMarginLeft() const
int GetMarginRight() const
virtual void Rotate90(bool aClockwise)
virtual void MirrorSpinStyle(bool aLeftRight)
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 NotEmpty(const SELECTION &aSelection)
Test if there are any 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 bool IdleSelection(const SELECTION &aSelection)
Test if all selected items are not being edited.
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 bool ShowAlways(const SELECTION &aSelection)
The default condition function (always returns true).
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)
A null aItem is ignored; the selection never holds null members.
virtual KIGFX::VIEW_ITEM * GetItem(unsigned int aIdx) const override
VECTOR2I GetReferencePoint() const
virtual VECTOR2I GetCenter() const
Returns the center point of the selection area bounding box.
virtual unsigned int GetSize() const override
Return the number of stored items.
int Size() const
Returns the number of selected parts.
std::deque< EDA_ITEM * > & Items()
std::vector< EDA_ITEM * > GetItemsSortedBySelectionOrder() const
bool OnlyContains(std::vector< KICAD_T > aList) const
Checks if all items in the selection have a type in aList.
bool Empty() const
Checks if there is anything selected.
bool HasReferencePoint() const
size_t CountType(KICAD_T aType) const
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
int PointCount() const
Return the number of points (vertices) in this line chain.
const VECTOR2I & CPoint(int aIndex) const
Return a reference to a given point in the line chain.
Represent a set of closed polygons.
void Rotate(const EDA_ANGLE &aAngle, const VECTOR2I &aCenter={ 0, 0 }) override
Rotate all vertices by a given angle.
bool IsEmpty() const
Return true if the set is empty (no polygons at all)
SHAPE_LINE_CHAIN & Outline(int aIndex)
Return the reference to aIndex-th outline in the set.
int OutlineCount() const
Return the number of outlines in the set.
void Move(const VECTOR2I &aVector) override
Spin style for labels of all kinds on schematics.
unsigned CCWRotationsTo(const SPIN_STYLE &aOther) const
Get CCW rotation needed to get to the given spin style.
Simple container to manage line stroke parameters.
The symbol library editor main window.
An interface to the global shared library manager that is schematic-specific and linked to one projec...
LIB_SYMBOL * LoadSymbol(const wxString &aNickname, const wxString &aName)
Load a LIB_SYMBOL having aName from the library given by aNickname.
Helper object to filter a list of libraries.
A modified version of the wxInfoBar class that allows us to:
void RemoveAllButtons()
Remove all the buttons that have been added by the user.
void ShowMessageFor(const wxString &aMessage, int aTime, int aFlags=wxICON_INFORMATION, MESSAGE_TYPE aType=WX_INFOBAR::MESSAGE_TYPE::GENERIC)
Show the infobar with the provided message and icon for a specific period of time.
void AddLink(const wxString &aLinkText, const std::function< void(wxHyperlinkEvent &)> &aFn)
Add a hypertext link to the infobar.
void AddCloseButton(const wxString &aTooltip=_("Hide this message."))
Add the default close button to the infobar on the right side.
A wrapper for reporting to a wxString object.
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Display a yes/no dialog with aMessage and returns the user response.
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
This file is part of the common library.
@ SYMBOL_PROPS_EDIT_SCHEMATIC_SYMBOL
@ SYMBOL_PROPS_WANT_EXCHANGE_SYMBOL
@ SYMBOL_PROPS_WANT_UPDATE_SYMBOL
@ SYMBOL_PROPS_WANT_SET_VARIANT_SYMBOL
@ SYMBOL_PROPS_EDIT_LIBRARY_SYMBOL
@ SYMBOL_PROPS_WANT_CLEAR_VARIANT_SYMBOL
static constexpr EDA_ANGLE ANGLE_90
static constexpr EDA_ANGLE ANGLE_VERTICAL
static constexpr EDA_ANGLE ANGLE_HORIZONTAL
@ FILLED_SHAPE
Fill with object color.
#define IGNORE_PARENT_GROUP
#define IS_NEW
New item, just created.
#define SELECTED_BY_DRAG
Item was algorithmically selected as a dragged item.
#define STRUCT_DELETED
flag indication structures to be erased
#define ENDPOINT
ends. (Used to support dragging.)
#define STARTPOINT
When a line is selected, these flags indicate which.
@ ID_POPUP_SCH_PIN_TRICKS_HIER_LABEL
@ ID_POPUP_SCH_PIN_TRICKS_WIRE
@ ID_POPUP_SCH_ALT_PIN_FUNCTION
@ ID_POPUP_SCH_SELECT_UNIT1
@ ID_POPUP_SCH_SELECT_UNIT
@ ID_POPUP_SCH_SELECT_BODY_STYLE
@ ID_POPUP_SCH_PLACE_UNIT1
@ ID_POPUP_SCH_SELECT_BODY_STYLE1
@ ID_POPUP_SCH_PIN_TRICKS_NET_LABEL
@ ID_POPUP_SCH_PIN_TRICKS_NO_CONNECT
@ ID_POPUP_SCH_SELECT_UNIT_END
@ ID_POPUP_SCH_ALT_PIN_FUNCTION_END
@ ID_POPUP_SCH_PIN_TRICKS_GLOBAL_LABEL
@ ERCE_UNANNOTATED
Symbol has not been annotated.
@ ERCE_DUPLICATE_REFERENCE
More than one symbol with the same reference.
@ ERCE_EMPTY_LABEL_NAME
Label has an empty or whitespace-only name.
@ ERCE_FOOTPRINT_LINK_ISSUES
The footprint link is invalid, or points to a missing (or inactive) footprint or library.
@ ERCE_UNDEFINED_NETCLASS
A netclass was referenced but not defined.
@ ERCE_SIMULATION_MODEL
An error was found in the simulation model.
@ ERCE_LIB_SYMBOL_MISMATCH
Symbol doesn't match copy in library.
@ ERCE_LIB_SYMBOL_ISSUES
Symbol not found in active libraries.
@ ERCE_FOOTPRINT_FILTERS
The assigned footprint doesn't match the footprint filters.
@ FRAME_SCH_SYMBOL_EDITOR
bool m_ConnectivityEngine
Use the schematic connectivity engine instead of CONNECTION_GRAPH.
@ LAYER_SCHEMATIC_DRAWINGSHEET
#define KI_FALLTHROUGH
The KI_FALLTHROUGH macro is to be used when switch statement cases should purposely fallthrough from ...
#define UNIMPLEMENTED_FOR(type)
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
void CollectOtherUnits(const wxString &aRef, int aUnit, const LIB_ID &aLibId, SCH_SHEET_PATH &aSheet, std::vector< SCH_SYMBOL * > *otherUnits)
Class to handle a set of SCH_ITEMs.
LABEL_FLAG_SHAPE
Label and flag shapes used with text objects.
ANNOTATE_ORDER_T
Schematic annotation order options.
@ ANNOTATE_SELECTION
Annotate the selection.
ANNOTATE_ALGO_T
Schematic annotation type options.
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
SHEET_SIDE
Define the edge of the sheet that the sheet pin is positioned.
T * GetAppSettings(const char *aFilename)
wxString UnescapeString(const wxString &aSource)
wxString TitleCaps(const wxString &aString)
Capitalize the first letter in each word.
wxString EscapeString(const wxString &aSource, ESCAPE_CONTEXT aContext)
The Escape/Unescape routines use HTML-entity-reference-style encoding to handle characters which are:...
void AccumulateDescriptions(wxString &aDesc, const T &aItemCollection)
Build a comma-separated list from a collection of wxStrings.
Functors that can be used to figure out how the action controls should be displayed in the UI and if ...
wxString GetDefaultFieldName(FIELD_T aFieldId, TRANSLATION aTranslation)
Return a default symbol field name for a mandatory field type.
@ USER
The field ID hasn't been set yet; field is invalid.
@ FOOTPRINT
Field Name Module PCB, i.e. "16DIP300".
@ REFERENCE
Field Reference of part, i.e. "IC21".
@ VALUE
Field Value of part, i.e. "3.3K".
IbisParser parser & reporter
wxString result
Test unit parsing edge cases and error handling.
GR_TEXT_H_ALIGN_T
This is API surface mapped to common.types.HorizontalAlignment.
GR_TEXT_V_ALIGN_T
This is API surface mapped to common.types.VertialAlignment.
constexpr GR_TEXT_H_ALIGN_T GetFlippedAlignment(GR_TEXT_H_ALIGN_T aAlign)
Get the reverse alignment: left-right are swapped, others are unchanged.
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Calculate the new point of coord coord pX, pY, for a rotation center 0, 0.
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
@ SCH_ITEM_LOCATE_GRAPHIC_LINE_T
std::vector< VARIANT_COMPAT_RESULT > ValidateVariantSymbolCompatibility(const LIB_SYMBOL &aBase, const LIB_SYMBOL &aCandidate)
Check whether aCandidate can be used as a variant symbol override for aBase.
std::function< std::vector< VARIANT_COMPAT_RESULT >(const LIB_ID &)> SYMBOL_COMPAT_FUNC
Callback that evaluates variant symbol compatibility for a given candidate LIB_ID.
VECTOR2< int32_t > VECTOR2I
VECTOR2< double > VECTOR2D