64#include <dialogs/dialog_text_properties.h>
67#include <dialogs/dialog_table_properties.h>
72#include <wx/filedlg.h>
81 m_lastTextBold( false ),
82 m_lastTextItalic( false ),
95 m_mruPath( wxEmptyString ),
96 m_lastAutoLabelRotateOnPlacement( false ),
97 m_drawingRuleArea( false ),
98 m_inDrawingTool( false )
107 auto belowRootSheetCondition =
113 auto inDrawingRuleArea =
132 std::vector<PICKED_SYMBOL>* historyList =
nullptr;
133 bool ignorePrimePosition =
false;
166 filter.FilterPowerSymbols(
true );
170 wxFAIL_MSG(
"PlaceSymbol(): unexpected request" );
195 : KICURSOR::COMPONENT );
206 existingRefs.
Clear();
228 existingRefs,
false, &hierarchy );
233 for(
size_t i = 0; i < refs.
GetCount(); i++ )
234 existingRefs.
AddItem( refs[i] );
263 ignorePrimePosition =
true;
271 grid.SetUseGrid(
getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
277 bool isSyntheticClick = symbol && evt->IsActivate() && evt->HasPosition()
280 if( evt->IsCancelInteractive() || ( symbol && evt->IsAction( &
ACTIONS::undo ) ) )
294 else if( evt->IsActivate() && !isSyntheticClick )
296 if( symbol && evt->IsMoveTool() )
299 evt->SetPassEvent(
false );
306 evt->SetPassEvent(
false );
310 if( evt->IsMoveTool() )
321 else if( evt->IsClick(
BUT_LEFT ) || evt->IsDblClick(
BUT_LEFT ) || isSyntheticClick )
330 auto compareByLibID =
333 return aFirst->
GetLibId().
Format() < aSecond->GetLibId().Format();
336 std::set<
LIB_SYMBOL*,
decltype( compareByLibID )> part_list( compareByLibID );
346 part_list.insert( libSymbol );
350 std::vector<PICKED_SYMBOL> alreadyPlaced;
355 pickedSymbol.
LibId = libSymbol->GetLibId();
356 alreadyPlaced.push_back( pickedSymbol );
374 if( evt->IsPrime() && !ignorePrimePosition )
376 cursorPos =
grid.Align( evt->Position(), GRID_HELPER_GRIDS::GRID_CONNECTABLE );
383 GRID_HELPER_GRIDS::GRID_CONNECTABLE );
393 existingRefs.
AddItem( placedSymbolReference );
413 commit.
Added( symbol, screen );
419 commit.
Push(
_(
"Place Symbol" ) );
426 int new_unit = symbol->
GetUnit();
442 nextSymbol->
SetUnit( new_unit );
449 addSymbol( nextSymbol );
455 existingRefs.
AddItem( placedSymbolReference );
547 bool immediateMode =
image !=
nullptr;
548 bool ignorePrimePosition =
false;
611 ignorePrimePosition =
true;
619 grid.SetUseGrid(
getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
625 bool isSyntheticClick =
image && evt->IsActivate() && evt->HasPosition()
626 && evt->Matches( aEvent );
648 else if( evt->IsActivate() && !isSyntheticClick )
650 if(
image && evt->IsMoveTool() )
653 evt->SetPassEvent(
false );
660 evt->SetPassEvent(
false );
664 if( evt->IsMoveTool() )
675 else if( evt->IsClick(
BUT_LEFT ) || evt->IsDblClick(
BUT_LEFT ) || isSyntheticClick )
682 _(
"Image Files" ) + wxS(
" " ) + wxImage::GetImageExtWildcard(),
685 if( dlg.ShowModal() != wxID_OK )
691 if( evt->IsPrime() && !ignorePrimePosition )
693 cursorPos =
grid.Align( evt->Position() );
702 wxString fullFilename = dlg.GetPath();
705 if( wxFileExists( fullFilename ) )
708 if( !
image || !
image->ReadImageFile( fullFilename ) )
710 wxMessageBox(
_(
"Could not load image from '%s'." ), fullFilename );
733 commit.
Push(
_(
"Place Image" ) );
772 image->SetPosition( cursorPos );
814 int dlgResult = dlg.ShowModal();
818 if( dlgResult != wxID_OK )
824 wxMessageBox(
_(
"No graphic items found in file." ) );
831 std::vector<SCH_ITEM*> newItems;
832 std::vector<SCH_ITEM*> selectedItems;
836 for( std::unique_ptr<EDA_ITEM>& ptr : list )
839 wxCHECK2( item,
continue );
841 newItems.push_back( item );
842 selectedItems.push_back( item );
854 commit.
Push(
_(
"Import Graphic" ) );
863 EDA_ITEMS selItems( selectedItems.begin(), selectedItems.end() );
868 auto setCursor = [&]()
888 for(
SCH_ITEM* item : selectedItems )
891 currentOffset +=
delta;
901 grid.SetUseGrid(
getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
906 if( evt->IsCancelInteractive() || evt->IsActivate() )
915 else if( evt->IsMotion() )
917 delta = cursorPos - currentOffset;
919 for(
SCH_ITEM* item : selectedItems )
922 currentOffset +=
delta;
936 commit.
Push(
_(
"Import Graphic" ) );
964 bool loggedInfoBarError =
false;
965 wxString description;
967 bool allowRepeat =
false;
993 description =
_(
"Add No Connect Flag" );
1000 description =
_(
"Add Junction" );
1006 description =
_(
"Add Wire to Bus Entry" );
1011 wxASSERT_MSG(
false,
"Unknown item type in SCH_DRAWING_TOOLS::SingleClickPlace" );
1049 grid.SetUseGrid(
getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
1051 cursorPos = evt->IsPrime() ? evt->Position() : controls->
GetMousePosition();
1052 cursorPos =
grid.BestSnapAnchor( cursorPos,
grid.GetItemGrid( previewItem ),
nullptr );
1055 if( evt->IsCancelInteractive() )
1060 else if( evt->IsActivate() )
1062 if( evt->IsMoveTool() )
1075 if( !screen->
GetItem( cursorPos, 0, type ) )
1082 "wires and/or pins." ) );
1083 loggedInfoBarError =
true;
1086 else if( loggedInfoBarError )
1102 commit.
Added( newItem, screen );
1106 commit.
Push( description );
1161 std::deque<SCH_ITEM*> strokeItems;
1162 strokeItems.push_back( previewItem );
1170 std::deque<SCH_JUNCTION*> junctions;
1171 junctions.push_back(
static_cast<SCH_JUNCTION*
>( previewItem ) );
1186 evt->SetPassEvent();
1191 evt->SetPassEvent();
1224 wxASSERT( aWire->
IsWire() );
1230 SCH_ITEM* wireDriver = wireConnection->Driver();
1232 if( wireDriver && wireDriver->
IsType( { SCH_LABEL_T, SCH_GLOBAL_LABEL_T } ) )
1233 return wireConnection->LocalName();
1236 return wxEmptyString;
1242 SCHEMATIC* schematic = getModel<SCHEMATIC>();
1251 textItem =
new SCH_TEXT( aPosition );
1256 textItem = labelItem;
1266 labelItem->
GetFields().emplace_back(
SCH_FIELD( {0,0}, 0, labelItem, wxT(
"Netclass" ) ) );
1267 labelItem->
GetFields().back().SetItalic(
true );
1268 labelItem->
GetFields().back().SetVisible(
true );
1269 textItem = labelItem;
1276 textItem = labelItem;
1284 textItem = labelItem;
1292 wxFAIL_MSG(
"SCH_EDIT_FRAME::CreateNewText() unknown layer type" );
1331 else if( !netName.IsEmpty() )
1392 pin->SetText( std::to_string( aSheet->
GetPins().size() + 1 ) );
1394 pin->SetPosition( aPosition );
1395 pin->ClearSelected();
1408 bool ignorePrimePosition =
false;
1411 wxString description;
1442 else if( isGlobalLabel )
1444 else if( isNetLabel )
1446 else if( isClassLabel )
1448 else if( isHierLabel )
1454 auto updatePreview =
1488 && ( isText || isGlobalLabel || isHierLabel || isClassLabel || isNetLabel ) )
1491 ignorePrimePosition =
true;
1499 grid.SetUseGrid(
getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
1502 cursorPos =
grid.BestSnapAnchor( cursorPos, snapGrid, item );
1506 bool isSyntheticClick = item && evt->IsActivate() && evt->HasPosition()
1509 if( evt->IsCancelInteractive() || evt->IsAction( &
ACTIONS::undo ) )
1523 else if( evt->IsActivate() && !isSyntheticClick )
1525 if( item && evt->IsMoveTool() )
1528 evt->SetPassEvent(
false );
1535 evt->SetPassEvent(
false );
1539 if( evt->IsPointEditor() )
1543 else if( evt->IsMoveTool() )
1554 else if( evt->IsClick(
BUT_LEFT ) || evt->IsDblClick(
BUT_LEFT ) || isSyntheticClick )
1564 description =
_(
"Add Text" );
1566 else if( isHierLabel )
1573 SCHEMATIC* schematic = getModel<SCHEMATIC>();
1591 description =
_(
"Add Hierarchical Label" );
1593 else if( isNetLabel )
1596 description =
_(
"Add Label" );
1598 else if( isGlobalLabel )
1601 description =
_(
"Add Label" );
1603 else if( isClassLabel )
1606 description =
_(
"Add Label" );
1608 else if( isSheetPin )
1621 + wxPoint( 20, 20 ) );
1634 pin->SetText( label->GetText() );
1635 pin->SetShape( label->GetShape() );
1639 description =
_(
"Add Sheet Pin" );
1645 if( evt->IsPrime() && !ignorePrimePosition )
1647 cursorPos =
grid.Align( evt->Position() );
1654 cursorPos =
grid.BestSnapAnchor( cursorPos, snapGrid, item );
1697 commit.
Push( description );
1731 else if( item && evt->IsSelectionEvent() )
1736 if( selection.
GetSize() == 1 )
1777 evt->SetPassEvent();
1802 SCHEMATIC* schematic = getModel<SCHEMATIC>();
1807 wxString description;
1857 grid.SetUseGrid(
getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
1863 bool isSyntheticClick = item && evt->IsActivate() && evt->HasPosition()
1866 if( evt->IsCancelInteractive() || ( item && evt->IsAction( &
ACTIONS::undo ) ) )
1878 else if( evt->IsActivate() && !isSyntheticClick )
1880 if( item && evt->IsMoveTool() )
1883 evt->SetPassEvent(
false );
1890 if( evt->IsPointEditor() )
1894 else if( evt->IsMoveTool() )
1905 else if( evt->IsClick(
BUT_LEFT ) && !item )
1928 description =
_(
"Add Text Box" );
1946 else if( item && ( evt->IsClick(
BUT_LEFT )
1992 commit.
Push( wxString::Format(
_(
"Draw %s" ), item->
GetClass() ) );
2023 else if( evt->IsDblClick(
BUT_LEFT ) && !item )
2041 evt->SetPassEvent();
2070 bool started =
false;
2086 auto cleanup = [&]()
2088 polyGeomMgr.
Reset();
2113 grid.SetUseGrid(
getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
2122 if( evt->IsCancelInteractive() )
2133 evt->SetPassEvent(
false );
2137 else if( evt->IsActivate() )
2142 if( evt->IsPointEditor() )
2146 else if( evt->IsMoveTool() )
2169 const bool endPolygon = evt->IsDblClick(
BUT_LEFT )
2176 polyGeomMgr.
Reset();
2183 else if( polyGeomMgr.
AddPoint( cursorPos ) )
2200 cursorPos = last.value();
2210 else if( started && ( evt->IsMotion() || evt->IsDrag(
BUT_LEFT ) ) )
2216 evt->SetPassEvent();
2230 SCHEMATIC* schematic = getModel<SCHEMATIC>();
2281 grid.SetUseGrid(
getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
2287 bool isSyntheticClick = table && evt->IsActivate() && evt->HasPosition()
2290 if( evt->IsCancelInteractive() || ( table && evt->IsAction( &
ACTIONS::undo ) ) )
2302 else if( evt->IsActivate() && !isSyntheticClick )
2304 if( table && evt->IsMoveTool() )
2307 evt->SetPassEvent(
false );
2314 if( evt->IsPointEditor() )
2318 else if( evt->IsMoveTool() )
2329 else if( evt->IsClick(
BUT_LEFT ) && !table )
2349 else if( table && ( evt->IsClick(
BUT_LEFT )
2365 commit.
Push(
_(
"Draw Table" ) );
2383 VECTOR2I requestedSize( cursorPos - origin );
2385 int colCount = std::max( 1, requestedSize.
x / ( fontSize * 15 ) );
2386 int rowCount = std::max( 1, requestedSize.
y / ( fontSize * 2 ) );
2388 VECTOR2I cellSize( std::max( gridSize.
x * 5, requestedSize.
x / colCount ),
2389 std::max( gridSize.
y * 2, requestedSize.
y / rowCount ) );
2391 cellSize.
x =
KiROUND( (
double) cellSize.
x / gridSize.
x ) * gridSize.
x;
2392 cellSize.
y =
KiROUND( (
double) cellSize.
y / gridSize.
y ) * gridSize.
y;
2397 for(
int col = 0; col < colCount; ++col )
2400 for(
int row = 0; row < rowCount; ++row )
2404 for(
int col = 0; col < colCount; ++col )
2420 else if( evt->IsDblClick(
BUT_LEFT ) && !table )
2438 evt->SetPassEvent();
2501 grid.SetUseGrid(
getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
2507 bool isSyntheticClick = sheet && evt->IsActivate() && evt->HasPosition()
2510 if( evt->IsCancelInteractive() || ( sheet && evt->IsAction( &
ACTIONS::undo ) ) )
2524 else if( evt->IsActivate() && !isSyntheticClick )
2526 if( sheet && evt->IsMoveTool() )
2529 evt->SetPassEvent(
false );
2536 evt->SetPassEvent(
false );
2540 if( evt->IsPointEditor() )
2544 else if( evt->IsMoveTool() )
2555 else if( !sheet && ( evt->IsClick(
BUT_LEFT ) || evt->IsDblClick(
BUT_LEFT ) ) )
2560 if( selection.
Size() == 1
2569 else if( evt->IsDblClick(
BUT_LEFT ) )
2591 else if( sheet && ( evt->IsClick(
BUT_LEFT )
2608 commit.
Push(
"Draw Sheet" );
2660 evt->SetPassEvent();
2691 if( !sheetPaths.size() )
2695 m_frame, std::move( sheetPaths ),
2696 std::make_shared<SHEET_SYNCHRONIZATION_AGENT>(
2706 commit.
Push(
_(
"Modify sheet pin" ) );
2712 commit.
Push(
_(
"Modify schematic item" ) );
2724 selectionTool->AddItemToSel( aItem,
true );
2794 static const std::function<void( std::list<SCH_SHEET_PATH>&,
SCH_SCREEN*,
2796 getSheetChildren = []( std::list<SCH_SHEET_PATH>& aPaths,
SCH_SCREEN* aScene,
2797 std::set<SCH_SCREEN*>& aVisited,
SCH_SHEET_PATH const& aCurPath )
2799 if( ! aScene || aVisited.find(aScene) != aVisited.end() )
2802 std::vector<SCH_ITEM*> sheetChildren;
2803 aScene->GetSheets( &sheetChildren );
2804 aVisited.insert( aScene );
2806 for(
SCH_ITEM* child : sheetChildren )
2811 aPaths.push_back( cp );
2812 getSheetChildren( aPaths, sheet->
GetScreen(), aVisited, cp );
2816 std::list<SCH_SHEET_PATH> sheetPaths;
2817 std::set<SCH_SCREEN*> visited;
constexpr EDA_IU_SCALE schIUScale
static TOOL_ACTION cancelInteractive
static TOOL_ACTION duplicate
static TOOL_ACTION activatePointEditor
static TOOL_ACTION doDelete
static TOOL_ACTION refreshPreview
static TOOL_ACTION finishInteractive
bool Contains(const Vec &aPoint) const
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Create an undo entry for an item that has been already modified.
COMMIT & Added(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Remove a new item from the model.
COMMIT & Add(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Notify observers that aItem has been added.
std::list< std::unique_ptr< EDA_ITEM > > & GetImportedItems()
bool IsPlacementInteractive()
void ShowInfoBarMsg(const wxString &aMsg, bool aShowCloseButton=false)
Show the WX_INFOBAR displayed on the top of the canvas with a message and an info icon on the left of...
void ShowInfoBarError(const wxString &aErrorMsg, bool aShowCloseButton=false, WX_INFOBAR::MESSAGE_TYPE aType=WX_INFOBAR::MESSAGE_TYPE::GENERIC)
Show the WX_INFOBAR displayed on the top of the canvas with a message and an error icon on the left o...
WX_INFOBAR * GetInfoBar()
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
VECTOR2I GetNearestGridPosition(const VECTOR2I &aPosition) const
Return the nearest aGridSize location to aPosition.
void SetCurrentCursor(KICURSOR aCursor)
Set the current cursor shape for this panel.
A base class for most all the KiCad significant classes used in schematics and boards.
virtual void ClearEditFlags()
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 Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const
Compare the item against the search criteria in aSearchData.
virtual void SetParent(EDA_ITEM *aParent)
virtual wxString GetFriendlyName() const
virtual EDA_ITEM * Clone() const
Create a duplicate of this item with linked list members set to NULL.
FILL_T GetFillMode() const
void SetFillColor(const COLOR4D &aColor)
COLOR4D GetFillColor() const
void SetEnd(const VECTOR2I &aEnd)
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.
void SetVertJustify(GR_TEXT_V_ALIGN_T aType)
GR_TEXT_H_ALIGN_T GetHorizJustify() const
void SetBold(bool aBold)
Set the text to be bold - this will also update the font if needed.
GR_TEXT_V_ALIGN_T GetVertJustify() 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 SetHorizJustify(GR_TEXT_H_ALIGN_T aType)
PANEL_ANNOTATE m_AnnotatePanel
PANEL_SYM_CHOOSER m_SymChooserPanel
AUTOPLACE_FIELDS m_AutoplaceFields
static TOOL_ACTION mirrorV
static TOOL_ACTION properties
static TOOL_ACTION addItemsToSel
Selects a list of items (specified as the event parameter)
static TOOL_ACTION changeSheet
static TOOL_ACTION drawTable
static TOOL_ACTION syncAllSheetsPins
static TOOL_ACTION placeSymbol
static TOOL_ACTION clearSelection
Clears the current selection.
static TOOL_ACTION drawRuleArea
static TOOL_ACTION placeClassLabel
static TOOL_ACTION closeOutline
static TOOL_ACTION drawCircle
static TOOL_ACTION rotateCCW
static TOOL_ACTION placePower
static TOOL_ACTION deleteLastPoint
static TOOL_ACTION placeSheetPin
static TOOL_ACTION mirrorH
static TOOL_ACTION syncSheetPins
static TOOL_ACTION rotateCW
static TOOL_ACTION importGraphics
static TOOL_ACTION leaveSheet
static TOOL_ACTION placeGlobalLabel
static TOOL_ACTION placeHierLabel
static TOOL_ACTION drawTextBox
static TOOL_ACTION drawRectangle
static TOOL_ACTION placeImage
static TOOL_ACTION enterSheet
static TOOL_ACTION placeSchematicText
static TOOL_ACTION drawArc
static TOOL_ACTION drawSheet
static TOOL_ACTION placeLabel
static TOOL_ACTION repeatDrawItem
static TOOL_ACTION placeBusWireEntry
static TOOL_ACTION placeJunction
static TOOL_ACTION placeNoConnect
EE_TYPE Overlapping(const BOX2I &aRect) const
A color representation with 4 components: red, green, blue, alpha.
An interface for classes handling user events controlling the view behavior such as zooming,...
virtual void CaptureCursor(bool aEnabled)
Force the cursor to stay within the drawing panel area.
virtual void ForceCursorPosition(bool aEnabled, const VECTOR2D &aPosition=VECTOR2D(0, 0))
Place the cursor immediately at a given point.
virtual void ShowCursor(bool aEnabled)
Enable or disables display of cursor.
virtual void WarpMouseCursor(const VECTOR2D &aPosition, bool aWorldCoordinates=false, bool aWarpView=false)=0
If enabled (.
virtual void SetCrossHairCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true)=0
Move the graphic crosshair cursor to the requested position expressed in world coordinates.
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.
virtual VECTOR2D GetMousePosition(bool aWorldCoordinates=true) const =0
Return the current mouse pointer position.
virtual void SetCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true, bool aTriggeredByArrows=false, long aArrowCommand=0)=0
Move cursor to the requested position expressed in world coordinates.
virtual void SetAutoPan(bool aEnabled)
Turn on/off auto panning (this feature is used when there is a tool active (eg.
virtual void PinCursorInsideNonAutoscrollArea(bool aWarpMouseCursor)=0
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
void RecacheAllItems()
Rebuild GAL display lists.
void AddToPreview(VIEW_ITEM *aItem, bool aTakeOwnership=true)
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
bool IsValid() const
Check if this LID_ID is valid.
Define a library symbol object.
const LIB_ID & GetLibId() const override
virtual COMMON_SETTINGS * GetCommonSettings() const
Class that handles the drawing of a polygon, including management of last corner deletion and drawing...
bool AddPoint(const VECTOR2I &aPt)
Lock in a polygon point.
@ DIRECT
Unconstrained point-to-point.
void SetCursorPosition(const VECTOR2I &aPos)
Set the current cursor position.
bool NewPointClosesOutline(const VECTOR2I &aPt) const
std::optional< VECTOR2I > DeleteLastCorner()
Remove the last-added point from the polygon.
void SetFinished()
Mark the polygon finished and update the client.
void SetLeaderMode(LEADER_MODE aMode)
Set the leader mode to use when calculating the leader/returner lines.
void Reset()
Clear the manager state and start again.
static SYMBOL_LIB_TABLE * SchSymbolLibTable(PROJECT *aProject)
Accessor for project symbol library table.
static SYMBOL_LIBS * SchLibs(PROJECT *aProject)
An adjunct helper to the DRAWING_TOOL interactive tool, which handles incoming geometry changes from ...
These are loaded from Eeschema settings but then overwritten by the project settings.
bool m_IntersheetRefsShow
Holds all the data relating to one schematic.
SCHEMATIC_SETTINGS & Settings() const
SCH_SHEET_LIST BuildSheetListSortedByPageNumbers() const override
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.
PICKED_SYMBOL PickSymbolFromLibrary(const SYMBOL_LIBRARY_FILTER *aFilter, std::vector< PICKED_SYMBOL > &aHistoryList, std::vector< PICKED_SYMBOL > &aAlreadyPlaced, bool aShowFootprints, const LIB_ID *aHighlight=nullptr, bool aAllowFields=true)
Call the library viewer to select symbol to import into schematic.
EESCHEMA_SETTINGS * eeconfig() const
LIB_SYMBOL * GetLibSymbol(const LIB_ID &aLibId, bool aUseCacheLib=false, bool aShowErrorMsg=false)
Load symbol from symbol library table.
Object to handle a bitmap image that can be inserted in a schematic.
Base class for a bus or wire entry.
VECTOR2I GetPosition() const override
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
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.
Class for a wire to bus entry.
virtual void Push(const wxString &aMessage=wxT("A commit"), int aCommitFlags=0) override
Revert the commit by restoring the modified items state.
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
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...
bool EditSheetProperties(SCH_SHEET *aSheet, SCH_SHEET_PATH *aHierarchy, bool *aIsUndoable=nullptr, bool *aClearAnnotationNewItems=nullptr, bool *aUpdateHierarchyNavigator=nullptr)
Edit an existing sheet or add a new sheet to the schematic.
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 UpdateHierarchyNavigator(bool aRefreshNetNavigator=true)
Update the hierarchy navigation tree and history.
SCH_SHEET_PATH & GetCurrentSheet() const
SCHEMATIC & Schematic() const
void FlipBodyStyle(SCH_SYMBOL *aSymbol)
void SelectUnit(SCH_SYMBOL *aSymbol, int aUnit)
void AutoRotateItem(SCH_SCREEN *aScreen, SCH_ITEM *aItem)
Automatically set the rotation of an item (if the item supports it)
void SaveCopyForRepeatItem(const SCH_ITEM *aItem)
Clone aItem and owns that clone in this container.
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
void SetSpinStyle(SPIN_STYLE aSpinStyle) override
Base class for any item which can be embedded within the SCHEMATIC container class,...
virtual bool IsConnectable() const
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
virtual void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction)
virtual void SetUnit(int aUnit)
virtual void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual)
SCH_CONNECTION * Connection(const SCH_SHEET_PATH *aSheet=nullptr) const
Retrieve the connection associated with this object in the given sheet.
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.
bool AutoRotateOnPlacement() const
autoRotateOnPlacement
SPIN_STYLE GetSpinStyle() const
void SetShape(LABEL_FLAG_SHAPE aShape)
LABEL_FLAG_SHAPE GetShape() const
void SetAutoRotateOnPlacement(bool autoRotate=true)
setAutoRotateOnPlacement
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,...
bool IsWire() const
Return true if the line is a wire.
VECTOR2I GetEndPoint() const
VECTOR2I GetStartPoint() const
Container to create a flattened list of symbols because in a complex hierarchy, a symbol can be used ...
void SortByReferenceOnly()
Sort the list of references by reference.
void ReannotateByOptions(ANNOTATE_ORDER_T aSortOption, ANNOTATE_ALGO_T aAlgoOption, int aStartNumber, const SCH_REFERENCE_LIST &aAdditionalRefs, bool aStartAtCurrent, SCH_SHEET_LIST *aHierarchy)
Forces reannotation of the provided references.
void AddItem(const SCH_REFERENCE &aItem)
void UpdateAnnotation()
Update the symbol references for the schematic project (or the current sheet).
A helper to define a symbol's reference designator in a schematic.
bool AlwaysAnnotate() const
Verify the reference should always be automatically annotated.
EE_RTREE & Items()
Gets the full RTree, usually for iterating.
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.
bool IsExplicitJunctionAllowed(const VECTOR2I &aPosition) const
Indicates that a juction dot may be placed at the given location.
void SetPosition(const VECTOR2I &aPos) override
void BeginEdit(const VECTOR2I &aStartPoint) override
Begin drawing a symbol library draw item at aPosition.
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
void EndEdit(bool aClosed=false) override
End an object editing action.
void SetStroke(const STROKE_PARAMS &aStroke) override
bool ContinueEdit(const VECTOR2I &aPosition) override
Continue an edit in progress at aPosition.
void CalcEdit(const VECTOR2I &aPosition) override
Calculate the attributes of an item at aPosition when it is being edited.
wxString GetClass() const override
Return the class name.
STROKE_PARAMS GetStroke() const override
VECTOR2I GetPosition() const override
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
void SortByPageNumbers(bool aUpdateVirtualPageNums=true)
Sort the list of sheets by page number.
SCH_SHEET_LIST FindAllSheetsForScreen(const SCH_SCREEN *aScreen) const
Return a SCH_SHEET_LIST with a copy of all the SCH_SHEET_PATH using a particular screen.
void GetSymbols(SCH_REFERENCE_LIST &aReferences, bool aIncludePowerSymbols=true, bool aForceIncludeOrphanSymbols=false) const
Add a SCH_REFERENCE object to aReferences for each symbol in the list of sheets.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
void UpdateAllScreenReferences() const
Update all the symbol references for this sheet path.
SCH_SCREEN * LastScreen()
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.
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
void SetBorderColor(KIGFX::COLOR4D aColor)
void AddPin(SCH_SHEET_PIN *aSheetPin)
Add aSheetPin to the sheet.
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const override
Compare the item against the search criteria in aSearchData.
std::vector< SCH_FIELD > & GetFields()
void SetBackgroundColor(KIGFX::COLOR4D aColor)
SCH_SCREEN * GetScreen() const
VECTOR2I GetPosition() const override
void SetScreen(SCH_SCREEN *aScreen)
Set the SCH_SCREEN associated with this sheet to aScreen.
void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual) override
void SetBorderWidth(int aWidth)
void Resize(const VECTOR2I &aSize)
Resize this sheet to aSize and adjust all of the labels accordingly.
std::vector< SCH_SHEET_PIN * > & GetPins()
void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual) override
Automatically orient all the fields in the symbol.
void SetPosition(const VECTOR2I &aPosition) override
bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const override
Compare the item against the search criteria in aSearchData.
void ClearAnnotation(const SCH_SHEET_PATH *aSheetPath, bool aResetPrefix)
Clear exiting symbol annotation.
const LIB_ID & GetLibId() const override
int GetUnitCount() const override
Return the number of units per package of the symbol.
void SetUnitSelection(const SCH_SHEET_PATH *aSheet, int aUnitSelection)
Set the selected unit of this symbol on one sheet.
void SetRowHeight(int aRow, int aHeight)
void SetColCount(int aCount)
void SetColWidth(int aCol, int aWidth)
void AddCell(SCH_TABLECELL *aCell)
VECTOR2I GetPosition() const override
bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const override
Compare the item against the search criteria in aSearchData.
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
void SetPosition(const VECTOR2I &aPos) override
RAII class that sets an value at construction and resets it to the original value at destruction.
const VECTOR2I NearestPoint(const VECTOR2I &aP) const
Compute a point on the segment (this) that is closest to point aP.
virtual void Add(EDA_ITEM *aItem)
virtual unsigned int GetSize() const override
Return the number of stored items.
virtual void Clear() override
Remove all the stored items from the group.
int Size() const
Returns the number of selected parts.
SHEET_SYNCHRONIZATION_PLACEMENT
std::function< void()> MODIFICATION
Helper object to filter a list of libraries.
SYMBOL_LIB * GetCacheLibrary()
Object used to load, save, search, and otherwise manipulate symbol library files.
void Dismiss() override
Dismisses the infobar and updates the containing layout and AUI manager (if one is provided).
This file is part of the common library.
static constexpr EDA_ANGLE ANGLE_0
std::vector< EDA_ITEM * > EDA_ITEMS
Define list of drawing items for screens.
#define IS_NEW
New item, just created.
#define STRUCT_DELETED
flag indication structures to be erased
#define IS_MOVING
Item being moved.
@ ID_POPUP_SCH_SELECT_UNIT
@ ID_POPUP_SCH_SELECT_BASE
@ ID_POPUP_SCH_SELECT_ALT
@ ID_POPUP_SCH_SELECT_UNIT_END
static const std::string KiCadSchematicFileExtension
PGM_BASE & Pgm()
The global Program "get" accessor.
LIB_SYMBOL * SchGetLibSymbol(const LIB_ID &aLibId, SYMBOL_LIB_TABLE *aLibTable, SYMBOL_LIB *aCacheLib, wxWindow *aParent, bool aShowErrorMsg)
Load symbol from symbol library table.
ANNOTATE_ORDER_T
Schematic annotation order options.
ANNOTATE_ALGO_T
Schematic annotation type options.
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
bool NoPrintableChars(const wxString &aString)
Return true if the string is empty or contains only whitespace.
LINE_STYLE
Dashed line types.
constexpr int MilsToIU(int mils) const
COLOR4D default_sheet_border_color
COLOR4D default_sheet_background_color
int default_line_thickness
Definition for symbol library class.
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
constexpr ret_type KiROUND(fp_type v, bool aQuiet=false)
Round a floating point number to an integer using "round halfway cases away from zero".
VECTOR2< int32_t > VECTOR2I
Definition of file extensions used in Kicad.