60#include <dialogs/dialog_text_properties.h>
61#include <dialogs/dialog_tablecell_properties.h>
62#include <dialogs/dialog_table_properties.h>
68#include <wx/textdlg.h>
78 SetIcon( BITMAPS::component_select_unit );
99 const int unit = symbol->
GetUnit();
103 for(
int ii = 0; ii < nUnits; ii++ )
110 unit_text.Printf(
_(
"Unit %s" ), symbol->
SubReference( ii + 1,
false ) );
112 if( missingUnits.count( ii + 1 ) == 0 )
113 unit_text +=
_(
" (already placed)" );
131 item->Enable( missingUnits.size() );
143 SetIcon( BITMAPS::body_style );
166 item->Check( symbol->
GetBodyStyle() == BODY_STYLE::BASE );
169 item->Check( symbol->
GetBodyStyle() != BODY_STYLE::BASE );
180 SetIcon( BITMAPS::component_select_unit );
205 if(
pin->GetAlt().IsEmpty() || (
pin->GetAlt() == libPin->
GetName() ) )
252 if( !
pin && !sheetPin )
280 wxASSERT_MSG( drawingTools,
"eeshema.InteractiveDrawing tool is not available" );
288 auto sheetHasUndefinedPins =
291 if( aSel.Size() == 1 && aSel.Front()->Type() ==
SCH_SHEET_T )
292 return static_cast<SCH_SHEET*
>( aSel.Front() )->HasUndefinedPins();
300 return std::all_of( aSel.Items().begin(), aSel.Items().end(),
303 return !item->IsType( { SCH_SYMBOL_T } )
304 ||
static_cast<const SCH_SYMBOL*
>( item )->GetDNP();
308 auto attribExcludeFromSimCond =
311 return std::all_of( aSel.Items().begin(), aSel.Items().end(),
314 return !item->IsType( { SCH_SYMBOL_T } )
315 ||
static_cast<const SCH_SYMBOL*
>( item )->GetExcludedFromSim();
319 auto attribExcludeFromBOMCond =
322 return std::all_of( aSel.Items().begin(), aSel.Items().end(),
325 return !item->IsType( { SCH_SYMBOL_T } )
326 ||
static_cast<const SCH_SYMBOL*
>( item )->GetExcludedFromBOM();
331 auto attribExcludeFromBoardCond =
334 return std::all_of( aSel.Items().begin(), aSel.Items().end(),
337 return !item->IsType( { SCH_SYMBOL_T } )
338 ||
static_cast<const SCH_SYMBOL*
>( item )->GetExcludedFromBoard();
364 auto duplicateCondition =
373 auto orientCondition =
382 auto propertiesCondition =
385 if( aSel.GetSize() == 0 )
402 if( !firstItem || !eeSelection )
405 switch( firstItem->
Type() )
423 return aSel.GetSize() == 1;
428 if( std::all_of( aSel.Items().begin(), aSel.Items().end(),
432 &&
static_cast<const SCH_LINE*
>( item )->IsGraphicLine();
437 else if( std::all_of( aSel.Items().begin(), aSel.Items().end(),
445 else if( std::all_of( aSel.Items().begin(), aSel.Items().end(),
450 wxCHECK( schItem,
false );
466 auto autoplaceCondition =
480 static const std::vector<KICAD_T> allTextTypes = {
SCH_LABEL_T,
498 static const std::vector<KICAD_T> toCLabelTypes = {
SCH_LABEL_T,
507 static const std::vector<KICAD_T> toHLabelTypes = {
SCH_LABEL_T,
516 static const std::vector<KICAD_T> toGLabelTypes = {
SCH_LABEL_T,
525 static const std::vector<KICAD_T> toTextTypes = {
SCH_LABEL_T,
534 static const std::vector<KICAD_T> toTextBoxTypes = {
SCH_LABEL_T,
549 auto makeSymbolUnitMenu =
552 std::shared_ptr<SYMBOL_UNIT_MENU> menu = std::make_shared<SYMBOL_UNIT_MENU>();
553 menu->SetTool( tool );
554 tool->GetToolMenu().RegisterSubMenu( menu );
558 auto makeBodyStyleMenu =
561 std::shared_ptr<BODY_STYLE_MENU> menu = std::make_shared<BODY_STYLE_MENU>();
562 menu->SetTool( tool );
563 tool->GetToolMenu().RegisterSubMenu( menu );
567 auto makePinFunctionMenu =
570 std::shared_ptr<ALT_PIN_FUNCTION_MENU> menu = std::make_shared<ALT_PIN_FUNCTION_MENU>();
571 menu->SetTool( tool );
572 tool->GetToolMenu().RegisterSubMenu( menu );
576 auto makePinTricksMenu =
579 std::shared_ptr<PIN_TRICKS_MENU> menu = std::make_shared<PIN_TRICKS_MENU>();
580 menu->SetTool( tool );
581 tool->GetToolMenu().RegisterSubMenu( menu );
585 auto makeTransformMenu =
589 menu->
SetTitle(
_(
"Transform Selection" ) );
599 auto makeAttributesMenu =
613 auto makeEditFieldsMenu =
617 menu->
SetTitle(
_(
"Edit Main Fields" ) );
626 auto makeConvertToMenu =
666 moveMenu.AddMenu( makeTransformMenu(), orientCondition, 200 );
672 moveMenu.AddSeparator();
693 drawMenu.
AddMenu( makeTransformMenu(), orientCondition, 200 );
717 selToolMenu.
AddMenu( makeTransformMenu(), orientCondition, 200 );
729 selToolMenu.
AddMenu( makeConvertToMenu(), toChangeCondition, 200 );
792 int principalItemCount = 0;
799 commit = &localCommit;
801 for(
unsigned ii = 0; ii < selection.
GetSize(); ii++ )
808 principalItemCount++;
817 if( principalItemCount == 1 )
829 switch( head->
Type() )
835 symbol->
Rotate( rotPoint, !clockwise );
898 head->
Rotate( rotPoint, !clockwise );
920 head->
Rotate( rotPoint, !clockwise );
930 group->Rotate( rotPoint, !clockwise );
943 table->Rotate( rotPoint, !clockwise );
951 head->
Rotate( rotPoint, !clockwise );
963 sheet->
Rotate( rotPoint, !clockwise );
982 for(
EDA_ITEM* edaItem : selection )
998 line->
Rotate( rotPoint, !clockwise );
1025 field->
Rotate( rotPoint, !clockwise );
1036 table->Rotate( rotPoint, !clockwise );
1039 table->Move( beforeCenter -
table->GetCenter() );
1043 item->
Rotate( rotPoint, !clockwise );
1067 if( !localCommit.
Empty() )
1068 localCommit.
Push(
_(
"Rotate" ) );
1079 if( selection.
GetSize() == 0 )
1084 bool connections =
false;
1090 commit = &localCommit;
1092 if( selection.
GetSize() == 1 )
1097 switch( item->
Type() )
1187 else if( selection.
GetSize() > 1 )
1191 for(
EDA_ITEM* edaItem : selection )
1193 item =
static_cast<SCH_ITEM*
>( edaItem );
1242 for(
EDA_ITEM* selected : selection )
1265 if( !localCommit.
Empty() )
1266 localCommit.
Push(
_(
"Mirror" ) );
1303 std::vector<SCH_FIELD>& aBFields,
1304 unsigned aFallbackRotationsCCW )
1306 std::set<wxString> handledKeys;
1315 const VECTOR2I bRelPos = bField.GetPosition() - bField.GetParentPosition();
1318 const EDA_ANGLE bTextAngle = bField.GetTextAngle();
1325 bField.SetPosition( bField.GetParentPosition() + aRelPos );
1326 bField.SetHorizJustify( aTextJustifyH );
1327 bField.SetVertJustify( aTextJustifyV );
1328 bField.SetTextAngle( aTextAngle );
1335 auto it = std::find_if( aBFields.begin(), aBFields.end(),
1338 return bField.GetCanonicalName() == name;
1341 if( it != aBFields.end() )
1345 swapFieldTextProps( aField, bField );
1350 for(
unsigned ii = 0; ii < aFallbackRotationsCCW; ii++ )
1357 handledKeys.insert(
name );
1364 const wxString bName = bField.GetCanonicalName();
1365 if( handledKeys.find( bName ) == handledKeys.end() )
1367 for(
unsigned ii = 0; ii < aFallbackRotationsCCW; ii++ )
1369 bField.Rotate( bField.GetParentPosition(),
false );
1395 if(
pin->GetParent() != parent )
1400 if( selection.
Size() < 2 )
1404 bool appendUndo = isMoving;
1405 bool connections =
false;
1407 for(
size_t i = 0; i < sorted.size() - 1; i++ )
1413 std::swap( aPos, bPos );
1426 std::swap( aSide, bSide );
1454 std::vector<SCH_FIELD>& aFields = aLabelBase.
GetFields();
1455 std::vector<SCH_FIELD>& bFields = bLabelBase.
GetFields();
1457 const unsigned rotationsAtoB = aSpinStyle.
CCWRotationsTo( bSpinStyle );
1467 std::swap( aOrient, bOrient );
1483 for(
EDA_ITEM* selected : selection )
1509 if( sourceItems.empty() )
1517 for(
const std::unique_ptr<SCH_ITEM>& item : sourceItems )
1522 bool restore_state =
false;
1557 const wxString originalFileName = sheet->
GetFileName();
1585 static_cast<SCH_SYMBOL*
>( newItem )->ClearAnnotation(
nullptr,
false );
1590 annotateStartNum,
false,
false, reporter );
1605 newItems.
Add( newItem );
1612 commit.
Push(
_(
"Repeat Item" ) );
1617 if( !newItems.
Empty() )
1620 for(
size_t ii = 1; ii < newItems.
GetSize(); ++ii )
1659 std::vector<VECTOR2I> pts;
1660 bool updateHierarchy =
false;
1681 pts.insert( pts.end(), tmp_pts.begin(), tmp_pts.end() );
1704 static_cast<SCH_FIELD*
>( sch_item )->SetVisible(
false );
1710 static_cast<SCH_TABLECELL*
>( sch_item )->SetText( wxEmptyString );
1725 RECURSE_MODE::RECURSE );
1733 RECURSE_MODE::RECURSE );
1757 commit.
Push(
_(
"Delete" ) );
1759 if( updateHierarchy )
1766#define HITTEST_THRESHOLD_PIXELS 5
1783 [
this](
const VECTOR2D& aPosition ) ->
bool
1822 [
this](
const int& aFinalState )
1855 caption.Printf(
_(
"Edit %s Field" ),
TitleCaps( fieldName ) );
1859 caption.Printf(
_(
"Edit '%s' Field" ), aField->
GetName() );
1879 if( !commit.
Empty() )
1880 commit.
Push( caption );
1890 if( sel.
Size() != 1 )
1893 bool clearSelection = sel.
IsHover();
1935 clearSelection =
true;
1959 if( clearSelection )
1971 bool moving = head && head->
IsMoving();
1973 if( selection.
Empty() )
1976 std::vector<SCH_ITEM*> autoplaceItems;
1978 for(
unsigned ii = 0; ii < selection.
GetSize(); ii++ )
1983 autoplaceItems.push_back( item );
1988 for(
SCH_ITEM* sch_item : autoplaceItems )
1990 if( !moving && !sch_item->IsNew() )
2004 if( !commit.
Empty() )
2005 commit.
Push(
_(
"Autoplace Fields" ) );
2020 if( !selection.
Empty() )
2047 if( selection.
Empty() )
2066 if( !symbol->
IsNew() )
2071 if( symbol->
IsNew() )
2074 if( !commit.
Empty() )
2075 commit.
Push(
_(
"Change Body Style" ) );
2087 bool clearSelection = selection.
IsHover();
2089 if( selection.
Empty() )
2114 switch( curr_item->
Type() )
2123 if( selection.
Size() > 1 )
2129 switch( curr_item->
Type() )
2166 if( wxWindow* blocking_win =
editor->Kiway().GetBlockingDialog() )
2167 blocking_win->Close(
true );
2173 editor->LoadSymbolFromSchematic( symbol );
2184 if( wxWindow* blocking_win =
editor->Kiway().GetBlockingDialog() )
2185 blocking_win->Close(
true );
2209 bool isUndoable =
false;
2210 bool doClearAnnotation =
false;
2211 bool okPressed =
false;
2212 bool updateHierarchyNavigator =
false;
2223 &doClearAnnotation, &updateHierarchyNavigator );
2229 commit.
Push(
_(
"Edit Sheet Properties" ) );
2233 std::vector<SCH_ITEM*> items;
2235 items.emplace_back( sheet );
2253 if( doClearAnnotation )
2269 if( updateHierarchyNavigator )
2298 std::vector<SCH_TABLECELL*> cells;
2346 clearSelection =
true;
2376 dlg.SetTitle(
_(
"Rule Area Properties" ) );
2387 std::deque<SCH_LINE*> lines;
2390 lines.push_back(
static_cast<SCH_LINE*
>( selItem ) );
2398 std::deque<SCH_JUNCTION*> junctions;
2401 junctions.push_back(
static_cast<SCH_JUNCTION*
>( selItem ) );
2412 std::deque<SCH_ITEM*> items;
2415 items.push_back(
static_cast<SCH_ITEM*
>( selItem ) );
2433 if( inspectionTool )
2449 wxFAIL_MSG( wxString(
"Cannot edit schematic item type " ) + curr_item->
GetClass() );
2454 if( clearSelection )
2469 for(
unsigned int i = 0; i < selection.GetSize(); ++i )
2473 if( item && item->
Type() != convertTo )
2484 switch( item->
Type() )
2504 txt =
_(
"<empty>" );
2515 txt =
text->GetText();
2516 href =
text->GetHyperlink();
2536 int textSize =
text->GetTextSize().y;
2579 auto getValidNetname =
2580 [](
const wxString& aText )
2582 wxString local_txt = aText;
2583 local_txt.Replace(
"\n",
"_" );
2584 local_txt.Replace(
"\r",
"_" );
2585 local_txt.Replace(
"\t",
"_" );
2589 local_txt.Replace(
" ",
"_" );
2594 if( local_txt.IsEmpty() )
2595 return _(
"<empty>" );
2623 newtext = new_label;
2648 newtext = new_label;
2673 newtext = new_label;
2687 SCH_FIELD netclass( new_label, FIELD_T::USER, wxT(
"Netclass" ) );
2690 new_label->
GetFields().push_back( netclass );
2693 new_label->
SetShape( LABEL_FLAG_SHAPE::F_ROUND );
2697 newtext = new_label;
2717 bbox.
Inflate( -label->GetLabelBoxExpansion() );
2748 new_textbox->
SetEnd( botRight );
2751 newtext = new_textbox;
2760 wxCHECK2( newtext,
continue );
2771 wxCHECK2( eda_text && new_eda_text,
continue );
2786 if( label && new_label )
2795 return field.GetId() == FIELD_T::INTERSHEET_REFS
2796 && new_label->Type() != SCH_GLOBAL_LABEL_T;
2803 if( !item->
IsNew() )
2821 if( !commit.
Empty() )
2822 commit.
Push(
_(
"Change To" ) );
2824 if( selection.IsHover() )
2833 static std::vector<KICAD_T> justifiableItems = {
2842 if( selection.
GetSize() == 0 )
2851 commit = &localCommit;
2864 for(
EDA_ITEM* edaItem : selection )
2866 item =
static_cast<SCH_ITEM*
>( edaItem );
2873 setJustify(
static_cast<SCH_FIELD*
>( item ) );
2880 setJustify(
static_cast<SCH_TEXT*
>( item ) );
2891 setJustify( label );
2898 for(
EDA_ITEM* selected : selection )
2912 if( !localCommit.
Empty() )
2915 localCommit.
Push(
_(
"Left Justify" ) );
2917 localCommit.
Push(
_(
"Center Justify" ) );
2919 localCommit.
Push(
_(
"Right Justify" ) );
2934 std::vector<SCH_LINE*> lines;
2943 lines.push_back( line );
2954 if( lines.size() == 1 && line->HitTest( cursorPos ) )
2977 if( !lines.empty() )
2982 commit.
Push( isSlice ?
_(
"Slice Wire" ) :
_(
"Break Wire" ) );
3003 if( !
IsOK(
m_frame,
_(
"Do you wish to delete the unreferenced pins from this sheet?" ) ) )
3012 commit.
Push(
_(
"Cleanup Sheet Pins" ) );
3046 if( prevInstance.
size() )
3064 msg.Printf(
_(
"Enter page number for sheet path%s" ),
3065 ( sheetPath.Length() > 20 ) ?
"\n" + sheetPath :
" " + sheetPath );
3067 wxTextEntryDialog dlg(
m_frame, msg,
_(
"Edit Sheet Page Number" ), pageNumber );
3069 dlg.SetTextValidator( wxFILTER_ALPHANUMERIC );
3071 if( dlg.ShowModal() == wxID_CANCEL || dlg.GetValue() == instance.
GetPageNumber() )
3076 commit.
Modify( sheet, screen );
3086 commit.
Push( wxS(
"Change Sheet Page Number" ) );
3102 if( selection.
Empty() )
3106 bool allSameType =
true;
3110 if( item->Type() != type )
3112 allSameType =
false;
3132 commit = &localCommit;
3134 const auto modifyItem =
3145 switch( item->Type() )
3160 modifyItem( label );
3171 commit->
Push(
_(
"Increment" ) );
3187 std::set<std::pair<SCH_SYMBOL*, SCH_SCREEN*>>& aCollectedUnits )
3208 std::vector<SCH_SYMBOL*> otherUnits;
3213 aCollectedUnits.insert( { otherUnit, screen } );
3226 std::set<std::pair<SCH_SYMBOL*, SCH_SCREEN*>> collectedUnits;
3229 bool new_state =
false;
3231 for(
const auto& [symbol,
_] : collectedUnits )
3243 for(
const auto& [symbol, screen] : collectedUnits )
3245 commit.
Modify( symbol, screen );
3248 symbol->SetDNP( new_state );
3251 symbol->SetExcludedFromSim( new_state );
3254 symbol->SetExcludedFromBOM( new_state );
3257 symbol->SetExcludedFromBoard( new_state );
3260 if( !commit.
Empty() )
3261 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 pickerTool
static TOOL_ACTION pasteSpecial
static TOOL_ACTION groupProperties
static TOOL_ACTION rightJustify
static TOOL_ACTION pageSettings
static TOOL_ACTION selectionActivate
Activation of the selection tool.
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 SetPageNumber(const wxString &aPageNumber)
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
int GetCount() const
Return the number of objects in the list.
COMMIT & Remove(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Remove a new item from the model.
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Modify a given item in the model.
COMMIT & Added(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Notify observers that aItem has been added.
COMMIT & Removed(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
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
virtual void ClearUndoRedoList()
Clear the undo and redo list using ClearUndoORRedoList()
void ShowInfoBarWarning(const wxString &aWarningMsg, bool aShowCloseButton=false)
Show the WX_INFOBAR displayed on the top of the canvas with a message and a warning icon on the left ...
VECTOR2I GetNearestGridPosition(const VECTOR2I &aPosition) const
Return the nearest aGridSize location to aPosition.
VECTOR2I GetNearestHalfGridPosition(const VECTOR2I &aPosition) const
Return the nearest aGridSize / 2 location to aPosition.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
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
virtual wxString GetClass() const =0
Return the class name.
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 SetText(const wxString &aText)
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)
PANEL_ANNOTATE m_AnnotatePanel
AUTOPLACE_FIELDS m_AutoplaceFields
DS_PROXY_VIEW_ITEM * GetDrawingSheet() const
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.
void RecacheAllItems()
Rebuild GAL display lists.
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
A logical library item identifier and consists of various portions much like a URI.
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.
virtual SETTINGS_MANAGER & GetSettingsManager() const
These are loaded from Eeschema settings but then overwritten by the project settings.
void OnItemsAdded(std::vector< SCH_ITEM * > &aNewItems)
Must be used if Add() is used using a BULK_x ADD_MODE to generate a change event for listeners.
void OnItemsRemoved(std::vector< SCH_ITEM * > &aRemovedItems)
Must be used if Remove() is used using a BULK_x REMOVE_MODE to generate a change event for listeners.
SCHEMATIC_SETTINGS & Settings() const
SCH_SHEET_LIST Hierarchy() const
Return the full schematic flattened hierarchical sheet list.
static TOOL_ACTION rotateCCW
static TOOL_ACTION placeClassLabel
static TOOL_ACTION placeNextSymbolUnit
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 showDeMorganAlternate
static TOOL_ACTION toCLabel
static TOOL_ACTION properties
static TOOL_ACTION editReference
static TOOL_ACTION breakWire
static TOOL_ACTION toggleDeMorgan
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 toLabel
static TOOL_ACTION setDNP
static TOOL_ACTION editWithLibEdit
static TOOL_ACTION cleanupSheetPins
static TOOL_ACTION mirrorH
static TOOL_ACTION setExcludeFromSimulation
static TOOL_ACTION ddAppendFile
static TOOL_ACTION placeSchematicText
static TOOL_ACTION toTextBox
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 showDeMorganStandard
static TOOL_ACTION toGLabel
static TOOL_ACTION setExcludeFromBoard
void AddToScreen(EDA_ITEM *aItem, SCH_SCREEN *aScreen=nullptr)
Add an item to the screen (and view) aScreen is the screen the item is located on,...
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
EESCHEMA_SETTINGS * eeconfig() const
void RemoveFromScreen(EDA_ITEM *aItem, SCH_SCREEN *aScreen)
Remove an item from the screen (and view) aScreen is the screen the item is located on,...
Object to handle a bitmap image that can be inserted in a schematic.
static const std::vector< KICAD_T > FieldOwners
void Collect(SCH_SCREEN *aScreen, const std::vector< KICAD_T > &aScanTypes, const VECTOR2I &aPos, int aUnit=0, int aConvert=0)
Scan a EDA_ITEM using this class's Inspector method which does the collection.
virtual void Push(const wxString &aMessage=wxT("A commit"), int aCommitFlags=0) override
Execute the changes.
COMMIT & Stage(EDA_ITEM *aItem, CHANGE_TYPE aChangeType, BASE_SCREEN *aScreen=nullptr) override
Add a change of the item aItem of type aChangeType to the change list.
virtual void Revert() override
Revert the commit by restoring the modified items state.
static SELECTION_CONDITION SingleMultiFunctionPin
static SELECTION_CONDITION SingleSymbol
static SELECTION_CONDITION MultipleSymbolsOrPower
static SELECTION_CONDITION AllPinsOrSheetPins
static SELECTION_CONDITION SingleDeMorganSymbol
static SELECTION_CONDITION SingleSymbolOrPower
static SELECTION_CONDITION SingleMultiUnitSymbol
KIGFX::SCH_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
Schematic editor (Eeschema) main window.
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag and update other data struc...
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void SchematicCleanUp(SCH_COMMIT *aCommit, SCH_SCREEN *aScreen=nullptr)
Perform routine schematic cleaning including breaking wire and buses and deleting identical objects s...
void AnnotateSymbols(SCH_COMMIT *aCommit, ANNOTATE_SCOPE_T aAnnotateScope, ANNOTATE_ORDER_T aSortOption, ANNOTATE_ALGO_T aAlgoOption, bool aRecursive, int aStartNumber, bool aResetAnnotation, bool aRepairTimestamps, REPORTER &aReporter)
Annotate the symbols in the schematic that are not currently annotated.
SCH_SHEET_PATH & GetCurrentSheet() const
SCHEMATIC & Schematic() const
const std::vector< std::unique_ptr< SCH_ITEM > > & GetRepeatItems() const
Return the items which are to be repeated with the insert key.
bool EditSheetProperties(SCH_SHEET *aSheet, SCH_SHEET_PATH *aHierarchy, bool *aIsUndoable=nullptr, bool *aClearAnnotationNewItems=nullptr, bool *aUpdateHierarchyNavigator=nullptr, wxString *aSourceSheetFilename=nullptr)
Edit an existing sheet or add a new sheet to the schematic.
void UpdateHierarchyNavigator(bool aRefreshNetNavigator=true, bool aClear=false)
Update the hierarchy navigation tree and history.
void FlipBodyStyle(SCH_SYMBOL *aSymbol)
void OnPageSettingsChange() override
Called when modifying the page settings.
bool CheckSheetForRecursion(SCH_SHEET *aSheet, SCH_SHEET_PATH *aCurrentSheet)
Verify that aSheet will not cause a recursion error in aCurrentSheet.
void BreakSegment(SCH_COMMIT *aCommit, SCH_LINE *aSegment, const VECTOR2I &aPoint, SCH_LINE **aNewSegment, SCH_SCREEN *aScreen)
Break a single segment into two at the specified point.
const wxString & GetHighlightedConnection() const
void UpdateItem(EDA_ITEM *aItem, bool isAddOrDelete=false, bool aUpdateRtree=false) override
Mark an item for refresh.
void AddCopyForRepeatItem(const SCH_ITEM *aItem)
void TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
void DeleteJunction(SCH_COMMIT *aCommit, SCH_ITEM *aItem)
Remove a given junction and heals any wire segments under the junction.
void SaveCopyForRepeatItem(const SCH_ITEM *aItem)
Clone aItem and owns that clone in this container.
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 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.
virtual bool HasLineStroke() const
Check if this schematic item has line stoke properties.
virtual std::vector< VECTOR2I > GetConnectionPoints() const
Add all the connection points for this item to aPoints.
SCH_ITEM * Duplicate(bool doClone=false) const
Routine to create a new copy of given item.
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
bool IsEndPoint(const VECTOR2I &aPoint) const override
Test if aPt is an end point of this schematic object.
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.
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
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.
SCH_SHEET * Last() const
Return a pointer to the last SCH_SHEET of the list.
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 SubReference(int aUnit, bool aAddSeparator=true) const
bool IsAnnotated(const SCH_SHEET_PATH *aSheet) const
Check if the symbol has a valid annotation (reference) for the given sheet path.
void AutoplaceFields(SCH_SCREEN *aScreen, AUTOPLACE_ALGO aAlgo) override
Automatically orient all the fields in 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
const std::deque< EDA_ITEM * > GetItems() const
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
T * GetAppSettings(const char *aFilename)
Return a handle to the a given settings by type.
unsigned CCWRotationsTo(const SPIN_STYLE &aOther) const
Get CCW rotation needed to get to the given spin style.
Heuristically increment a string's n'th part from the right.
void SetSkipIOSQXZ(bool aSkip)
If a alphabetic part is found, skip the letters I, O, S, Q, X, Z.
std::optional< wxString > Increment(const wxString &aStr, int aDelta, size_t aRightIndex) const
Increment the n-th part from the right of the given string.
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 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_BASE
@ ID_POPUP_SCH_SELECT_ALT
@ 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)
void delete_if(_Container &__c, _Function &&__f)
Deletes all values from __c for which __f returns true.
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
PGM_BASE & Pgm()
The global program "get" accessor.
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.
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 ...
constexpr int MilsToIU(int mils) const
int default_repeat_offset_x
int default_repeat_offset_y
int repeat_label_increment
wxString GetDefaultFieldName(FIELD_T aFieldId, bool aTranslateForHI)
Return a default symbol field name for a mandatory field type.
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