61#include <dialogs/dialog_text_properties.h>
62#include <dialogs/dialog_tablecell_properties.h>
63#include <dialogs/dialog_table_properties.h>
69#include <wx/textdlg.h>
101 const int unit = symbol->
GetUnit();
105 for(
int ii = 0; ii < nUnits; ii++ )
109 if( missingUnits.count( ii + 1 ) == 0 )
110 unit_text +=
_(
" (already placed)" );
124 if( !missingUnits.empty() )
128 for(
int unitNumber : missingUnits )
130 wxString placeText = wxString::Format(
_(
"Place unit %s" ),
180 wxEmptyString, wxITEM_CHECK );
219 if(
pin->GetAlt().IsEmpty() || (
pin->GetAlt() == libPin->
GetName() ) )
266 if( !
pin && !sheetPin )
294 wxASSERT_MSG( drawingTools,
"eeshema.InteractiveDrawing tool is not available" );
299 return !
m_frame->GetScreen()->Items().empty();
302 auto sheetHasUndefinedPins =
305 if( aSel.Size() == 1 && aSel.Front()->Type() ==
SCH_SHEET_T )
314 return std::all_of( aSel.Items().begin(), aSel.Items().end(),
317 return !item->IsType( { SCH_SYMBOL_T } )
318 ||
static_cast<const SCH_SYMBOL*
>( item )->GetDNP();
322 auto attribExcludeFromSimCond =
325 return std::all_of( aSel.Items().begin(), aSel.Items().end(),
328 return !item->IsType( { SCH_SYMBOL_T } )
329 ||
static_cast<const SCH_SYMBOL*
>( item )->GetExcludedFromSim();
333 auto attribExcludeFromBOMCond =
336 return std::all_of( aSel.Items().begin(), aSel.Items().end(),
339 return !item->IsType( { SCH_SYMBOL_T } )
340 ||
static_cast<const SCH_SYMBOL*
>( item )->GetExcludedFromBOM();
345 auto attribExcludeFromBoardCond =
348 return std::all_of( aSel.Items().begin(), aSel.Items().end(),
351 return !item->IsType( { SCH_SYMBOL_T } )
352 ||
static_cast<const SCH_SYMBOL*
>( item )->GetExcludedFromBoard();
378 auto duplicateCondition =
387 auto orientCondition =
396 auto propertiesCondition =
399 if( aSel.GetSize() == 0 )
416 if( !firstItem || !eeSelection )
419 switch( firstItem->
Type() )
437 return aSel.GetSize() == 1;
442 if( std::all_of( aSel.Items().begin(), aSel.Items().end(),
445 return item->Type() == SCH_LINE_T
446 && static_cast<const SCH_LINE*>( item )->IsGraphicLine();
451 else if( std::all_of( aSel.Items().begin(), aSel.Items().end(),
454 return item->Type() == SCH_JUNCTION_T;
459 else if( std::all_of( aSel.Items().begin(), aSel.Items().end(),
462 const SCH_ITEM* schItem = dynamic_cast<const SCH_ITEM*>( item );
464 wxCHECK( schItem, false );
466 return ( schItem->HasLineStroke() && schItem->IsConnectable() )
467 || item->Type() == SCH_JUNCTION_T;
480 auto autoplaceCondition =
494 static const std::vector<KICAD_T> allTextTypes = {
SCH_LABEL_T,
512 static const std::vector<KICAD_T> toCLabelTypes = {
SCH_LABEL_T,
521 static const std::vector<KICAD_T> toHLabelTypes = {
SCH_LABEL_T,
530 static const std::vector<KICAD_T> toGLabelTypes = {
SCH_LABEL_T,
539 static const std::vector<KICAD_T> toTextTypes = {
SCH_LABEL_T,
548 static const std::vector<KICAD_T> toTextBoxTypes = {
SCH_LABEL_T,
563 auto makeSymbolUnitMenu =
566 std::shared_ptr<SYMBOL_UNIT_MENU> menu = std::make_shared<SYMBOL_UNIT_MENU>();
567 menu->SetTool( tool );
568 tool->GetToolMenu().RegisterSubMenu( menu );
572 auto makeBodyStyleMenu =
575 std::shared_ptr<BODY_STYLE_MENU> menu = std::make_shared<BODY_STYLE_MENU>();
576 menu->SetTool( tool );
577 tool->GetToolMenu().RegisterSubMenu( menu );
581 auto makePinFunctionMenu =
584 std::shared_ptr<ALT_PIN_FUNCTION_MENU> menu = std::make_shared<ALT_PIN_FUNCTION_MENU>();
585 menu->SetTool( tool );
586 tool->GetToolMenu().RegisterSubMenu( menu );
590 auto makePinTricksMenu =
593 std::shared_ptr<PIN_TRICKS_MENU> menu = std::make_shared<PIN_TRICKS_MENU>();
594 menu->SetTool( tool );
595 tool->GetToolMenu().RegisterSubMenu( menu );
599 auto makeTransformMenu =
603 menu->
SetTitle(
_(
"Transform Selection" ) );
613 auto makeAttributesMenu =
627 auto makeEditFieldsMenu =
631 menu->
SetTitle(
_(
"Edit Main Fields" ) );
640 auto makeConvertToMenu =
680 moveMenu.AddMenu( makeTransformMenu(), orientCondition, 200 );
686 moveMenu.AddSeparator();
707 drawMenu.
AddMenu( makeTransformMenu(), orientCondition, 200 );
731 selToolMenu.
AddMenu( makeTransformMenu(), orientCondition, 200 );
743 selToolMenu.
AddMenu( makeConvertToMenu(), toChangeCondition, 200 );
806 int principalItemCount = 0;
813 commit = &localCommit;
815 for(
unsigned ii = 0; ii < selection.
GetSize(); ii++ )
822 principalItemCount++;
831 if( principalItemCount == 1 )
843 switch( head->
Type() )
849 symbol->
Rotate( rotPoint, !clockwise );
851 if(
m_frame->eeconfig()->m_AutoplaceFields.enable )
912 head->
Rotate( rotPoint, !clockwise );
934 head->
Rotate( rotPoint, !clockwise );
942 rotPoint =
m_frame->GetNearestHalfGridPosition(
group->GetPosition() );
944 group->Rotate( rotPoint, !clockwise );
946 group->Move( rotPoint -
m_frame->GetNearestHalfGridPosition(
group->GetPosition() ) );
955 rotPoint =
m_frame->GetNearestHalfGridPosition(
table->GetCenter() );
957 table->Rotate( rotPoint, !clockwise );
959 table->Move( rotPoint -
m_frame->GetNearestHalfGridPosition(
table->GetCenter() ) );
965 head->
Rotate( rotPoint, !clockwise );
977 sheet->
Rotate( rotPoint, !clockwise );
986 m_frame->UpdateItem( head,
false,
true );
996 for(
EDA_ITEM* edaItem : selection )
1012 line->
Rotate( rotPoint, !clockwise );
1039 field->
Rotate( rotPoint, !clockwise );
1050 table->Rotate( rotPoint, !clockwise );
1053 table->Move( beforeCenter -
table->GetCenter() );
1057 item->
Rotate( rotPoint, !clockwise );
1060 m_frame->UpdateItem( item,
false,
true );
1079 m_frame->Schematic().CleanUp( commit );
1081 if( !localCommit.
Empty() )
1082 localCommit.
Push(
_(
"Rotate" ) );
1093 if( selection.
GetSize() == 0 )
1098 bool connections =
false;
1104 commit = &localCommit;
1106 if( selection.
GetSize() == 1 )
1111 switch( item->
Type() )
1199 m_frame->UpdateItem( item,
false,
true );
1201 else if( selection.
GetSize() > 1 )
1205 for(
EDA_ITEM* edaItem : selection )
1207 item =
static_cast<SCH_ITEM*
>( edaItem );
1251 m_frame->UpdateItem( item,
false,
true );
1256 for(
EDA_ITEM* selected : selection )
1276 m_frame->Schematic().CleanUp( commit );
1279 if( !localCommit.
Empty() )
1280 localCommit.
Push(
_(
"Mirror" ) );
1317 std::vector<SCH_FIELD>& aBFields,
1318 unsigned aFallbackRotationsCCW )
1320 std::set<wxString> handledKeys;
1329 const VECTOR2I bRelPos = bField.GetPosition() - bField.GetParentPosition();
1332 const EDA_ANGLE bTextAngle = bField.GetTextAngle();
1339 bField.SetPosition( bField.GetParentPosition() + aRelPos );
1340 bField.SetHorizJustify( aTextJustifyH );
1341 bField.SetVertJustify( aTextJustifyV );
1342 bField.SetTextAngle( aTextAngle );
1349 auto it = std::find_if( aBFields.begin(), aBFields.end(),
1352 return bField.GetCanonicalName() == name;
1355 if( it != aBFields.end() )
1359 swapFieldTextProps( aField, bField );
1364 for(
unsigned ii = 0; ii < aFallbackRotationsCCW; ii++ )
1371 handledKeys.insert(
name );
1378 const wxString bName = bField.GetCanonicalName();
1379 if( handledKeys.find( bName ) == handledKeys.end() )
1381 for(
unsigned ii = 0; ii < aFallbackRotationsCCW; ii++ )
1383 bField.Rotate( bField.GetParentPosition(),
false );
1409 if(
pin->GetParent() != parent )
1414 if( selection.
Size() < 2 )
1418 bool appendUndo = isMoving;
1419 bool connections =
false;
1421 for(
size_t i = 0; i < sorted.size() - 1; i++ )
1427 std::swap( aPos, bPos );
1440 std::swap( aSide, bSide );
1468 std::vector<SCH_FIELD>& aFields = aLabelBase.
GetFields();
1469 std::vector<SCH_FIELD>& bFields = bLabelBase.
GetFields();
1471 const unsigned rotationsAtoB = aSpinStyle.
CCWRotationsTo( bSpinStyle );
1481 std::swap( aOrient, bOrient );
1492 m_frame->UpdateItem( a,
false,
true );
1493 m_frame->UpdateItem( b,
false,
true );
1497 for(
EDA_ITEM* selected : selection )
1521 const std::vector<std::unique_ptr<SCH_ITEM>>& sourceItems =
m_frame->GetRepeatItems();
1523 if( sourceItems.empty() )
1532 for(
const std::unique_ptr<SCH_ITEM>& item : sourceItems )
1535 bool restore_state =
false;
1546 enteredGroup->AddItem( newItem );
1555 if( !label->IncrementLabel( cfg->m_Drawing.repeat_label_increment ) )
1556 m_frame->ShowInfoBarWarning(
_(
"Label value cannot go below zero" ),
true );
1569 schIUScale.MilsToIU( cfg->m_Drawing.default_repeat_offset_y ) ) );
1578 if(
m_frame->CheckSheetForRecursion( sheet, currentSheet ) )
1581 const wxString originalFileName = sheet->
GetFileName();
1586 restore_state = !
m_frame->EditSheetProperties( sheet, currentSheet );
1599 commit.Added( newItem,
m_frame->GetScreen() );
1608 if(
m_frame->eeconfig()->m_AnnotatePanel.automatic )
1610 static_cast<SCH_SYMBOL*
>( newItem )->ClearAnnotation(
nullptr,
false );
1614 annotateAlgo,
true ,
1615 annotateStartNum,
false,
false, reporter );
1630 newItems.
Add( newItem );
1636 m_frame->Schematic().CleanUp( &commit );
1637 commit.Push(
_(
"Repeat Item" ) );
1641 if( !newItems.
Empty() )
1642 m_frame->SaveCopyForRepeatItem(
static_cast<SCH_ITEM*
>( newItems[0] ) );
1644 for(
size_t ii = 1; ii < newItems.
GetSize(); ++ii )
1645 m_frame->AddCopyForRepeatItem(
static_cast<SCH_ITEM*
>( newItems[ii] ) );
1656 std::vector<VECTOR2I> pts;
1657 bool updateHierarchy =
false;
1678 pts.insert( pts.end(), tmp_pts.begin(), tmp_pts.end() );
1701 static_cast<SCH_FIELD*
>( sch_item )->SetVisible(
false );
1707 static_cast<SCH_TABLECELL*
>( sch_item )->SetText( wxEmptyString );
1744 m_frame->DeleteJunction( &commit, junction );
1747 commit.
Push(
_(
"Delete" ) );
1749 if( updateHierarchy )
1750 m_frame->UpdateHierarchyNavigator();
1774 caption.Printf(
_(
"Edit %s Field" ),
TitleCaps( fieldName ) );
1778 caption.Printf(
_(
"Edit '%s' Field" ), aField->
GetName() );
1798 if( !commit.
Empty() )
1799 commit.
Push( caption );
1809 if( sel.
Size() != 1 )
1812 bool clearSelection = sel.
IsHover();
1828 if( item ==
nullptr )
1860 clearSelection =
true;
1884 if( clearSelection )
1896 bool moving = head && head->
IsMoving();
1898 if( selection.
Empty() )
1901 std::vector<SCH_ITEM*> autoplaceItems;
1903 for(
unsigned ii = 0; ii < selection.
GetSize(); ii++ )
1908 autoplaceItems.push_back( item );
1913 for(
SCH_ITEM* sch_item : autoplaceItems )
1915 if( !moving && !sch_item->IsNew() )
1929 if( !commit.
Empty() )
1930 commit.
Push(
_(
"Autoplace Fields" ) );
1945 if( !selection.
Empty() )
1969 if( selection.
Empty() )
1975 if( !symbol->
IsNew() )
1983 m_frame->SelectBodyStyle( symbol, nextBodyStyle );
1985 if( symbol->
IsNew() )
1988 if( !commit.
Empty() )
1989 commit.
Push(
_(
"Change Body Style" ) );
2001 bool clearSelection = selection.
IsHover();
2003 if( selection.
Empty() )
2028 switch( curr_item->
Type() )
2037 if( selection.
Size() > 1 )
2043 switch( curr_item->
Type() )
2064 if(
m_frame->eeconfig()->m_AutoplaceFields.enable )
2080 if( wxWindow* blocking_win =
editor->Kiway().GetBlockingDialog() )
2081 blocking_win->Close(
true );
2087 editor->LoadSymbolFromSchematic( symbol );
2098 if( wxWindow* blocking_win =
editor->Kiway().GetBlockingDialog() )
2099 blocking_win->Close(
true );
2123 bool isUndoable =
false;
2124 bool doClearAnnotation =
false;
2125 bool okPressed =
false;
2126 bool updateHierarchyNavigator =
false;
2136 okPressed =
m_frame->EditSheetProperties( sheet, &
m_frame->GetCurrentSheet(), &isUndoable,
2137 &doClearAnnotation, &updateHierarchyNavigator );
2143 commit.
Push(
_(
"Edit Sheet Properties" ) );
2147 std::vector<SCH_ITEM*> items;
2149 items.emplace_back( sheet );
2150 m_frame->Schematic().OnItemsRemoved( items );
2151 m_frame->Schematic().OnItemsAdded( items );
2153 m_frame->Schematic().RefreshHierarchy();
2154 m_frame->UpdateHierarchyNavigator();
2167 if( doClearAnnotation )
2181 m_frame->GetCanvas()->Refresh();
2183 if( updateHierarchyNavigator )
2184 m_frame->UpdateHierarchyNavigator();
2212 std::vector<SCH_TABLECELL*> cells;
2260 clearSelection =
true;
2290 dlg.SetTitle(
_(
"Rule Area Properties" ) );
2301 std::deque<SCH_LINE*> lines;
2304 lines.push_back(
static_cast<SCH_LINE*
>( selItem ) );
2312 std::deque<SCH_JUNCTION*> junctions;
2315 junctions.push_back(
static_cast<SCH_JUNCTION*
>( selItem ) );
2326 std::deque<SCH_ITEM*> items;
2329 items.push_back(
static_cast<SCH_ITEM*
>( selItem ) );
2347 if( inspectionTool )
2363 wxFAIL_MSG( wxString(
"Cannot edit schematic item type " ) + curr_item->
GetClass() );
2368 if( clearSelection )
2385 commit = &localCommit;
2387 for(
unsigned int i = 0; i < selection.GetSize(); ++i )
2391 if( item && item->
Type() != convertTo )
2402 wxCHECK2( sourceText,
continue );
2404 switch( item->
Type() )
2424 txt =
_(
"<empty>" );
2435 txt =
text->GetText();
2436 href =
text->GetHyperlink();
2456 int textSize =
text->GetTextSize().y;
2489 position =
m_frame->GetNearestGridPosition( position );
2499 auto getValidNetname =
2500 [](
const wxString& aText )
2502 wxString local_txt = aText;
2503 local_txt.Replace(
"\n",
"_" );
2504 local_txt.Replace(
"\r",
"_" );
2505 local_txt.Replace(
"\t",
"_" );
2509 local_txt.Replace(
" ",
"_" );
2514 if( local_txt.IsEmpty() )
2515 return _(
"<empty>" );
2543 newtext = new_label;
2568 newtext = new_label;
2593 newtext = new_label;
2610 new_label->
GetFields().push_back( netclass );
2617 newtext = new_label;
2637 bbox.
Inflate( -label->GetLabelBoxExpansion() );
2668 new_textbox->
SetEnd( botRight );
2671 newtext = new_textbox;
2680 wxCHECK2( newtext,
continue );
2691 wxCHECK2( eda_text && new_eda_text,
continue );
2706 if( label && new_label )
2715 return field.GetId() == FIELD_T::INTERSHEET_REFS
2716 && new_label->Type() != SCH_GLOBAL_LABEL_T;
2738 if( !localCommit.
Empty() )
2739 localCommit.
Push(
_(
"Change To" ) );
2741 if( selection.IsHover() )
2750 static std::vector<KICAD_T> justifiableItems = {
2759 if( selection.
GetSize() == 0 )
2768 commit = &localCommit;
2781 for(
EDA_ITEM* edaItem : selection )
2783 item =
static_cast<SCH_ITEM*
>( edaItem );
2790 setJustify(
static_cast<SCH_FIELD*
>( item ) );
2797 setJustify(
static_cast<SCH_TEXT*
>( item ) );
2808 setJustify( label );
2811 m_frame->UpdateItem( item,
false,
true );
2815 for(
EDA_ITEM* selected : selection )
2829 if( !localCommit.
Empty() )
2832 localCommit.
Push(
_(
"Left Justify" ) );
2834 localCommit.
Push(
_(
"Center Justify" ) );
2836 localCommit.
Push(
_(
"Right Justify" ) );
2853 std::vector<SCH_LINE*> lines;
2857 static bool lineModeChanged =
false;
2859 auto revertLineMode =
2862 if( lineModeChanged )
2869 lineModeChanged =
false;
2876 lines.push_back(
static_cast<SCH_LINE*
>( item ) );
2886 if( lines.size() == 1 && line->HitTest( cursorPos ) && !line->IsEndPoint( cursorPos ) )
2887 lwbTool->
BreakSegment( &commit, line, cursorPos, &newLine, screen );
2889 lwbTool->
BreakSegment( &commit, line, line->GetMidPoint(), &newLine, screen );
2907 if( !lines.empty() )
2913 lineMode = (
enum LINE_MODE) cfg->m_Drawing.line_mode;
2914 lineModeChanged =
true;
2923 commit.
Push( isSlice ?
_(
"Slice Wire" ) :
_(
"Break Wire" ) );
2954 if( !
IsOK(
m_frame,
_(
"Do you wish to delete the unreferenced pins from this sheet?" ) ) )
2963 commit.
Push(
_(
"Cleanup Sheet Pins" ) );
2988 screen =
m_frame->GetScreen();
2997 if( prevInstance.
size() )
3005 screen =
m_frame->GetScreen();
3008 sheet =
m_frame->GetCurrentSheet().Last();
3015 msg.Printf(
_(
"Enter page number for sheet path%s" ),
3016 ( sheetPath.Length() > 20 ) ?
"\n" + sheetPath :
" " + sheetPath );
3018 wxTextEntryDialog dlg(
m_frame, msg,
_(
"Edit Sheet Page Number" ), pageNumber );
3020 dlg.SetTextValidator( wxFILTER_ALPHANUMERIC );
3022 if( dlg.ShowModal() == wxID_CANCEL || dlg.GetValue() == instance.
GetPageNumber() )
3027 commit.
Modify( sheet, screen );
3031 if( instance ==
m_frame->GetCurrentSheet() )
3033 m_frame->GetScreen()->SetPageNumber( dlg.GetValue() );
3034 m_frame->OnPageSettingsChange();
3037 commit.
Push( wxS(
"Change Sheet Page Number" ) );
3054 wxString* filename = aEvent.
Parameter<wxString*>();
3061 if( !
image->GetReferenceImage().ReadImageFile( *filename ) )
3063 wxMessageBox( wxString::Format(
_(
"Could not load image from '%s'." ), *filename ) );
3073 std::set<std::pair<SCH_SYMBOL*, SCH_SCREEN*>>& aCollectedUnits )
3081 aCollectedUnits.insert( { symbol,
m_frame->GetScreen() } );
3087 wxString ref = symbol->
GetRef( &
m_frame->GetCurrentSheet() );
3094 std::vector<SCH_SYMBOL*> otherUnits;
3099 aCollectedUnits.insert( { otherUnit, screen } );
3112 std::set<std::pair<SCH_SYMBOL*, SCH_SCREEN*>> collectedUnits;
3115 bool new_state =
false;
3117 for(
const auto& [symbol,
_] : collectedUnits )
3129 for(
const auto& [symbol, screen] : collectedUnits )
3131 commit.
Modify( symbol, screen );
3134 symbol->SetDNP( new_state );
3137 symbol->SetExcludedFromSim( new_state );
3140 symbol->SetExcludedFromBOM( new_state );
3143 symbol->SetExcludedFromBoard( new_state );
3146 if( !commit.
Empty() )
3147 commit.
Push(
_(
"Toggle Attribute" ) );
constexpr EDA_IU_SCALE schIUScale
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 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 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...
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 & Removed(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
int GetStatus(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Returns status of an item.
Dialog to update or change schematic library symbols.
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.
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
virtual bool IsType(const std::vector< KICAD_T > &aScanTypes) const
Check whether the item is one of the listed types.
virtual void SetParent(EDA_ITEM *aParent)
EDA_ITEM * GetParent() const
bool HasFlag(EDA_ITEM_FLAGS aFlag) const
void SetEnd(const VECTOR2I &aEnd)
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
const EDA_ANGLE & GetTextAngle() const
void SetTextSize(VECTOR2I aNewSize, bool aEnforceMinTextSize=true)
virtual const wxString & GetText() const
Return the string associated with the text object.
virtual bool IsVisible() const
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
void SetTextThickness(int aWidth)
The TextThickness is that set by the user.
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 void SetTextAngle(const EDA_ANGLE &aAngle)
int GetTextThickness() const
void SetItalic(bool aItalic)
Set the text to be italic - this will also update the font if needed.
void SetFont(KIFONT::FONT *aFont)
VECTOR2I GetTextSize() const
void SetHorizJustify(GR_TEXT_H_ALIGN_T aType)
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.
int GetUnitCount() const override
static bool ParseBusGroup(const wxString &aGroup, wxString *name, std::vector< wxString > *aMemberList)
Parse a bus group label into the name and a list of components.
A singleton reporter that reports to nowhere.
These are loaded from Eeschema settings but then overwritten by the project settings.
SCHEMATIC_SETTINGS & Settings() const
static TOOL_ACTION rotateCCW
static TOOL_ACTION placeClassLabel
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 properties
static TOOL_ACTION editReference
static TOOL_ACTION breakWire
static TOOL_ACTION placeHierLabel
static TOOL_ACTION placeLabel
static TOOL_ACTION toText
static TOOL_ACTION toHLabel
static TOOL_ACTION lineMode45
static TOOL_ACTION rotateCW
static TOOL_ACTION importSheet
static TOOL_ACTION toLabel
static TOOL_ACTION setDNP
static TOOL_ACTION placeImage
static TOOL_ACTION editWithLibEdit
static TOOL_ACTION cleanupSheetPins
static TOOL_ACTION toDLabel
static TOOL_ACTION cycleBodyStyle
static TOOL_ACTION mirrorH
static TOOL_ACTION setExcludeFromSimulation
static TOOL_ACTION lineMode90
static TOOL_ACTION ddAppendFile
static TOOL_ACTION placeSchematicText
static TOOL_ACTION toTextBox
static TOOL_ACTION lineModeFree
static TOOL_ACTION updateSymbols
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
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
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 SingleSymbolOrPower
static SELECTION_CONDITION SingleMultiUnitSymbol
static SELECTION_CONDITION SingleMultiBodyStyleSymbol
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 GetCanonicalName() const
Get a non-language-specific name for a field which can be used for storage, variable look-up,...
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,...
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.
virtual void Move(const VECTOR2I &aMoveVector)
Move the item by aMoveVector to a new position.
void SetConnectivityDirty(bool aDirty=true)
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
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.
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
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
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...
wxString PathHumanReadable(bool aUseShortRootName=true, bool aStripTrailingSeparator=false) const
Return the sheet path in a human readable form made from the sheet names.
SCH_SCREEN * LastScreen()
wxString GetPageNumber() const
void SetPageNumber(const wxString &aPageNumber)
Set the sheet instance user definable page number.
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
SCH_SHEET * GetParent() const
Get the parent sheet object of this sheet pin.
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.
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.
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
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 IsAnnotated(const SCH_SHEET_PATH *aSheet) const
Check if the symbol has a valid annotation (reference) for the given sheet path.
bool IsMultiBodyStyle() const override
void AutoplaceFields(SCH_SCREEN *aScreen, AUTOPLACE_ALGO aAlgo) override
Automatically orient all the fields in the symbol.
wxString GetBodyStyleDescription(int aBodyStyle, bool aLabel) const override
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()
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const override
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)
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
unsigned CCWRotationsTo(const SPIN_STYLE &aOther) const
Get CCW rotation needed to get to the given spin style.
The symbol library editor main window.
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Display a yes/no dialog with aMessage and returns the user response.
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_EDIT_LIBRARY_SYMBOL
static constexpr EDA_ANGLE ANGLE_90
static constexpr EDA_ANGLE ANGLE_VERTICAL
static constexpr EDA_ANGLE ANGLE_HORIZONTAL
#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
@ FRAME_SCH_SYMBOL_EDITOR
@ 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.
ANNOTATE_ORDER_T
Schematic annotation order options.
@ ANNOTATE_SELECTION
Annotate the selection.
ANNOTATE_ALGO_T
Schematic annotation type options.
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:...
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, bool aTranslateForHI)
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".
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
VECTOR2< int32_t > VECTOR2I
VECTOR2< double > VECTOR2D