75#include <wx/filedlg.h>
110 wxFileDialog dlg(
m_frame,
_(
"Schematic Files" ), curr_fn.GetPath(),
112 wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
114 if( dlg.ShowModal() == wxID_CANCEL )
117 wxFileName newFileName = dlg.GetPath();
147 msg.Printf(
_(
"Revert '%s' (and all sub-sheets) to last version saved?" ),
156 screen->SetContentModified(
false );
185 if( dlg.ShowModal() == wxID_OK )
247 if( aRunningOnDemand )
346 std::map<LIB_ID, LIB_SYMBOL*> libSymbols;
347 std::map<LIB_ID, std::vector<SCH_SYMBOL*>> symbolMap;
349 for(
size_t i = 0; i < symbols.
GetCount(); ++i )
355 if( libSymbols.count(
id ) )
357 wxASSERT_MSG( libSymbols[
id]->Compare( *libSymbol, LIB_ITEM::COMPARE_FLAGS::ERC ) == 0,
358 "Two symbols have the same LIB_ID but are different!" );
362 libSymbols[id] = libSymbol;
365 symbolMap[id].emplace_back( symbol );
385 targetLib = fn.GetName();
387 if( libTable->
HasLibrary( targetLib,
false ) )
406 if( targetLib.IsEmpty() )
409 bool map =
IsOK(
m_frame,
_(
"Update symbols in schematic to refer to new library?" ) );
419 for(
const std::pair<const LIB_ID, LIB_SYMBOL*>& it : libSymbols )
432 for(
SCH_SYMBOL* symbol : symbolMap[it.first] )
435 symbol->SetLibId(
id );
450#define HITTEST_THRESHOLD_PIXELS 5
452int SCH_EDITOR_CONTROL::SimProbe(
const TOOL_EVENT& aEvent )
460 if( wxWindow* blocking_win = simFrame->Kiway().GetBlockingDialog() )
461 blocking_win->Close(
true );
470 [
this, simFrame](
const VECTOR2D& aPosition )
490 SIM_MODEL& model = mgr.CreateModel( &sheet, *symbol ).model;
492 if( reporter.HasMessage() )
496 spiceItem.
refName = std::string( symbol->
GetRef( &sheet ).ToUTF8() );
497 std::vector<std::string> currentNames =
500 if( currentNames.size() == 0 )
502 else if( currentNames.size() == 1 )
504 simFrame->AddCurrentPlot( currentNames.at( 0 ) );
513 wxString
name = currentNames.at( modelPinIndex );
514 simFrame->AddCurrentPlot(
name );
522 else if( item->IsType( { SCH_ITEM_LOCATE_WIRE_T } ) )
526 std::string spiceNet = std::string(
UnescapeString( conn->Name() ).ToUTF8() );
537 [
this, picker](
const VECTOR2D& aPos )
543 SCH_SHEET_PIN_T }, aPos );
585 [
this](
const int& aFinalState )
608int SCH_EDITOR_CONTROL::SimTune(
const TOOL_EVENT& aEvent )
630 item = item->GetParent();
643 blocking_win->Close(
true );
645 static_cast<SIM_PLOT_FRAME*
>( simFrame )->AddTuner( sheetPath, symbol );
679 [
this](
const int& aFinalState )
711 if( aPosition !=
CLEAR )
715 if(
erc.TestDuplicateSheetNames(
false ) > 0 )
717 wxMessageBox(
_(
"Error: duplicate sub-sheet names found in current sheet." ) );
737 std::vector<SCH_PIN*> pins = symbol->
GetPins();
739 if( pins.size() == 1 )
740 conn = pins[0]->Connection();
752 editFrame->SetStatusText( wxT(
"" ) );
765 editorControl->UpdateNetHighlighting(
dummy );
801 conn =
static_cast<SCH_ITEM*
>( item )->Connection();
818 wxString netName = conn->
Name();
826 netName = prefix + wxT(
"*" );
830 netName = prefix + wxT(
".*" );
842 [&](
const std::vector<wxString>& aNetNames )
844 for( SCH_ITEM* item : screen->Items() )
846 bool redraw = item->IsBrightened();
847 SCH_CONNECTION* itemConn = item->Connection();
849 if( itemConn && alg::contains( aNetNames, itemConn->Name() ) )
850 item->SetBrightened();
852 item->ClearBrightened();
854 redraw |= item->IsBrightened();
856 if( item->Type() == SCH_SYMBOL_T )
858 SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
860 redraw |= symbol->HasBrightenedPins();
862 symbol->ClearBrightenedPins();
864 for( SCH_PIN* pin : symbol->GetPins() )
866 SCH_CONNECTION* pin_conn = pin->Connection();
868 if( pin_conn && alg::contains( aNetNames, pin_conn->Name() ) )
870 pin->SetBrightened();
875 else if( item->Type() == SCH_SHEET_T )
877 for( SCH_SHEET_PIN* pin : static_cast<SCH_SHEET*>( item )->GetPins() )
879 SCH_CONNECTION* pin_conn = pin->Connection();
881 redraw |= pin->IsBrightened();
883 if( pin_conn && alg::contains( aNetNames, pin_conn->Name() ) )
884 pin->SetBrightened();
886 pin->ClearBrightened();
888 redraw |= pin->IsBrightened();
893 getView()->Update( item, KIGFX::VIEW_UPDATE_FLAGS::REPAINT );
899 if( dlg.ShowModal() )
901 getView()->UpdateAllItemsConditionally(
906 if(
dynamic_cast<SCH_LINE*
>( aItem ) )
917 if( text &&
text->HasTextVars() )
919 text->ClearRenderCache();
920 text->ClearBoundingBoxCache();
937 std::vector<EDA_ITEM*> itemsToRedraw;
943 bool selectedIsBus = selectedConn ? selectedConn->
IsBus() :
false;
944 wxString selectedName = selectedConn ? selectedConn->
Name() : wxString( wxS(
"" ) );
946 bool selectedIsNoNet =
false;
949 if( selectedConn && selectedConn->
Driver() ==
nullptr )
951 selectedIsNoNet =
true;
958 bool highlight =
false;
971 itemConn = item->Connection();
973 if( selectedIsNoNet && selectedSubgraph )
977 if( item == subgraphItem )
984 else if( selectedIsBus && itemConn && itemConn->
IsNet() )
986 for(
const std::shared_ptr<SCH_CONNECTION>& member : selectedConn->
Members() )
988 if( member->Name() == itemConn->
Name() )
993 else if( member->IsBus() )
995 for(
const std::shared_ptr<SCH_CONNECTION>& bus_member : member->Members() )
997 if( bus_member->Name() == itemConn->
Name() )
1006 else if( selectedConn && itemConn && selectedName == itemConn->
Name() )
1031 if( pin_conn && pin_conn->
Name() == selectedName )
1033 pin->SetBrightened();
1040 std::vector<SCH_FIELD>& fields = symbol->
GetFields();
1045 fields[
id].SetBrightened();
1047 fields[id].ClearBrightened();
1056 bool redrawPin =
pin->IsBrightened();
1058 if( pin_conn && pin_conn->
Name() == selectedName )
1059 pin->SetBrightened();
1061 pin->ClearBrightened();
1063 redrawPin ^=
pin->IsBrightened();
1064 redraw |= redrawPin;
1069 itemsToRedraw.push_back( item );
1075 for(
EDA_ITEM* redrawItem : itemsToRedraw )
1187 if( selection.Empty() )
1190 if( aUseDuplicateClipboard )
1216 plugin.
Format( &selection, &selPath, schematic, &formatter,
true );
1218 if( selection.IsHover() )
1221 if( aUseDuplicateClipboard )
1255 wxTextEntry* textEntry =
dynamic_cast<wxTextEntry*
>( wxWindow::FindFocus() );
1272 wxTextEntry* textEntry =
dynamic_cast<wxTextEntry*
>( wxWindow::FindFocus() );
1289 bool aForceKeepAnnotations )
1291 wxCHECK( aSymbol && aPasteScreen, );
1295 wxString reference, value, footprint;
1320 if( aForceKeepAnnotations && !reference.IsEmpty() )
1321 aSymbol->
SetRef( &aPastePath, reference );
1333 bool aForceKeepAnnotations,
1337 wxCHECK( aSheet && aPastedSheetsSoFar && aPastedSymbolsSoFar, aPastePath );
1342 aPastedSheetsSoFar->push_back( sheetPath );
1354 aForceKeepAnnotations );
1361 newClipPath.push_back( subsheet->
m_Uuid );
1364 aPastedSheetsSoFar, aPastedSymbolsSoFar );
1369 subSheetPath.
GetSymbols( *aPastedSymbolsSoFar );
1393 wxTextEntry* textEntry =
dynamic_cast<wxTextEntry*
>( wxWindow::FindFocus() );
1402 std::string content;
1410 if( content.empty() )
1437 tempScreen->
Append( text_item );
1452 if( dlg.ShowModal() == wxID_CANCEL )
1461 bool sheetsPasted =
false;
1466 if( destFn.IsRelative() )
1474 std::map<wxString, SCH_SCREEN*> loadedScreens;
1478 if( item.LastScreen() )
1479 loadedScreens[item.Last()->GetFileName()] = item.LastScreen();
1488 std::map<KIID, EDA_ITEM*> itemMap;
1492 std::map<SCH_SHEET_PATH, SCH_REFERENCE_LIST> pastedSymbols;
1493 std::map<SCH_SHEET_PATH, SCH_SHEET_LIST> pastedSheets;
1497 loadedItems.push_back( item );
1505 if( srcFn.IsRelative() )
1510 if( hierarchy.
TestForRecursion( sheetHierarchy, destFn.GetFullPath( wxPATH_UNIX ) ) )
1513 "was dropped because the destination already has "
1514 "the sheet or one of its subsheets as a parent." ),
1517 loadedItems.pop_back();
1523 tempScreen->
Clear(
false );
1525 for(
unsigned i = 0; i < loadedItems.size(); ++i )
1540 wxCHECK2( currentScreen,
continue );
1577 pastedSymbols[instance].AddItem( schReference );
1585 wxString baseName = nameField.
GetText();
1586 wxString candidateName = baseName;
1589 while( !baseName.IsEmpty() && wxIsdigit( baseName.Last() ) )
1591 number = baseName.Last() + number;
1592 baseName.RemoveLast();
1601 int uniquifier = std::max( 0, wxAtoi( number ) ) + 1;
1603 while( hierarchy.
NameExists( candidateName ) )
1606 nameField.
SetText( candidateName );
1614 if( !fn.IsAbsolute() )
1618 currentSheetFileName.GetPath() );
1625 if( loadedScreens.count( sheet->
GetFileName() ) > 0 )
1626 existingScreen = loadedScreens.at( sheet->
GetFileName() );
1631 if( existingScreen )
1641 sheetsPasted =
true;
1644 clipPath.push_back( sheet->
m_Uuid );
1658 ( forceKeepAnnotations &&
annotate.automatic ),
1659 &pastedSheets[instance],
1660 &pastedSymbols[instance] );
1662 sheetPath.
GetSymbols( pastedSymbols[instance] );
1673 if( srcItem && destItem )
1702 pastedSheets[instance].SortByPageNumbers();
1712 pastedSheet.SetPageNumber( pageNum );
1713 hierarchy.push_back( pastedSheet );
1725 std::map<SCH_SHEET_PATH, SCH_REFERENCE_LIST> annotatedSymbols;
1730 for(
size_t i = 0; i < pastedSymbols[sheetPath].GetCount(); i++ )
1734 || pastedSymbols[sheetPath][i].AlwaysAnnotate() )
1736 annotatedSymbols[sheetPath].AddItem( pastedSymbols[sheetPath][i] );
1741 if( !annotatedSymbols.empty() )
1745 annotatedSymbols[instance].SortByReferenceOnly();
1748 annotatedSymbols[instance].ReannotateDuplicates( existingRefs );
1752 annotateStartNum, existingRefs,
1756 annotatedSymbols[instance].UpdateAnnotation();
1759 for(
size_t i = 0; i < annotatedSymbols[instance].GetCount(); i++ )
1760 existingRefs.
AddItem( annotatedSymbols[instance][i] );
1772 if( !selection.
Empty() )
1776 int closest_dist = INT_MAX;
1783 if( dist < closest_dist )
1786 closest_dist = dist;
1808 if( closest_dist == INT_MAX )
1812 switch( item->
Type() )
1815 processPt(
static_cast<SCH_LINE*
>( item )->GetStartPoint() );
1816 processPt(
static_cast<SCH_LINE*
>( item )->GetEndPoint() );
1836 for(
int ii = 0; ii < shape->
GetPolyShape().TotalVertices(); ++ii )
1843 processPt( shape->
GetEnd() );
1880 if( selection.GetSize() >= 1 )
1883 if( selection.IsHover() )
1902 blocking_win->Close(
true );
1926 wxCommandEvent
dummy;
1934 wxCommandEvent
dummy;
1959 wxCommandEvent
dummy;
1967 wxCommandEvent
dummy;
2010 getEditFrame<SCH_EDIT_FRAME>()->ToggleSchematicHierarchy();
2123 std::map<KIID, EDA_ITEM*> ids;
2129 auto it = ids.find( aItem->m_Uuid );
2131 if( it != ids.end() && it->second != aItem )
2134 const_cast<KIID&
>( aItem->m_Uuid ) =
KIID();
2137 ids[ aItem->m_Uuid ] = aItem;
2149 processItem( item );
2162 processItem( item );
2164 item->RunOnChildren(
2167 processItem( item );
2182 errors += duplicates;
2190 wxString msg =
wxString::Format(
_(
"%d potential problems repaired." ), errors );
static TOOL_ACTION updatePcbFromSchematic
static TOOL_ACTION cancelInteractive
static TOOL_ACTION revert
static TOOL_ACTION saveAs
static TOOL_ACTION pickerTool
static TOOL_ACTION showSymbolEditor
static TOOL_ACTION pasteSpecial
static TOOL_ACTION pageSettings
static TOOL_ACTION duplicate
static TOOL_ACTION doDelete
static TOOL_ACTION updateSchematicFromPcb
static TOOL_ACTION refreshPreview
static wxString m_DrawingSheetFileName
the name of the drawing sheet file, or empty to use the default drawing sheet
int GetCount() const
Return the number of objects in the list.
Calculates the connectivity of a schematic and generates netlists.
CONNECTION_SUBGRAPH * GetSubgraphForItem(SCH_ITEM *aItem)
A subgraph is a set of items that are electrically connected on a single sheet.
PRIORITY GetDriverPriority()
std::vector< SCH_ITEM * > m_items
void SetWksFileName(const wxString &aFilename)
bool PrjConfigChanged()
Return true if the project configuration was modified.
virtual void PushCommandToUndoList(PICKED_ITEMS_LIST *aItem)
Add a command to undo in the undo list.
virtual int GetRedoCommandCount() const
UNDO_REDO_CONTAINER m_undoList
virtual void ClearUndoRedoList()
Clear the undo and redo list using ClearUndoORRedoList()
virtual PICKED_ITEMS_LIST * PopCommandFromRedoList()
Return the last command to undo and remove it from list, nothing is deleted.
virtual PICKED_ITEMS_LIST * PopCommandFromUndoList()
Return the last command to undo and remove it from list, nothing is deleted.
virtual int GetUndoCommandCount() const
virtual void PushCommandToRedoList(PICKED_ITEMS_LIST *aItem)
Add a command to redo in the redo list.
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...
void ReleaseFile()
Release the current file marked in use.
void ScriptingConsoleEnableDisable()
Toggles the scripting console visibility.
bool LibraryFileBrowser(bool doOpen, wxFileName &aFilename, const wxString &wildcard, const wxString &ext, bool isDirectory=false, bool aIsGlobal=false, const wxString &aGlobalPath=wxEmptyString)
GAL_TYPE GetBackend() const
Return the type of backend currently used by GAL canvas.
void ForceRefresh()
Force a redraw.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
A base class for most all the KiCad significant classes used in schematics and boards.
virtual VECTOR2I GetPosition() const
EDA_ITEM_FLAGS GetEditFlags() const
void SetFlags(EDA_ITEM_FLAGS aMask)
KICAD_T Type() const
Returns the type of object.
virtual void SetParent(EDA_ITEM *aParent)
EDA_ITEM * GetParent() const
bool IsBrightened() const
SHAPE_POLY_SET & GetPolyShape()
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
const VECTOR2I & GetStart() const
Return the starting point of the graphic.
std::vector< VECTOR2I > GetRectCorners() const
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
virtual const wxString & GetText() const
Return the string associated with the text object.
virtual void SetText(const wxString &aText)
PANEL_ANNOTATE m_AnnotatePanel
static TOOL_ACTION importFPAssignments
static TOOL_ACTION repairSchematic
static TOOL_ACTION remapSymbols
static TOOL_ACTION selectionActivate
Activation of the selection tool.
static TOOL_ACTION toggleAnnotateAuto
static TOOL_ACTION lineMode90
static TOOL_ACTION toggleHiddenPins
static TOOL_ACTION highlightNet
static TOOL_ACTION addItemsToSel
Selects a list of items (specified as the event parameter)
static TOOL_ACTION clearHighlight
static TOOL_ACTION assignNetclass
static TOOL_ACTION clearSelection
Clears the current selection.
static TOOL_ACTION showPythonConsole
static TOOL_ACTION toggleERCWarnings
static TOOL_ACTION simTune
static TOOL_ACTION toggleERCExclusions
static TOOL_ACTION lineModeNext
static TOOL_ACTION lineModeFree
static TOOL_ACTION editLibSymbolWithLibEdit
static TOOL_ACTION toggleERCErrors
static TOOL_ACTION highlightNetTool
static TOOL_ACTION updateNetHighlighting
static TOOL_ACTION exportNetlist
static TOOL_ACTION assignFootprints
static TOOL_ACTION selectOnPCB
static TOOL_ACTION rescueSymbols
static TOOL_ACTION toggleHiddenFields
static TOOL_ACTION editWithLibEdit
static TOOL_ACTION simProbe
static TOOL_ACTION exportSymbolsToLibrary
static TOOL_ACTION drawSheetOnClipboard
static TOOL_ACTION editSymbolFields
static TOOL_ACTION annotate
static TOOL_ACTION showHierarchy
static TOOL_ACTION lineMode45
static TOOL_ACTION editSymbolLibraryLinks
static TOOL_ACTION saveCurrSheetCopyAs
static TOOL_ACTION showPcbNew
static TOOL_ACTION generateBOM
static TOOL_ACTION schematicSetup
static TOOL_ACTION exportSymbolsToNewLibrary
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.
EE_TYPE OfType(KICAD_T aType) const
EDA_ITEM * GetTopLeftItem(bool onlyModules=false) const override
static const TOOL_EVENT ClearedEvent
static const TOOL_EVENT SelectedEvent
static const TOOL_EVENT SelectedItemsModified
Selected items were moved, this can be very high frequency on the canvas, use with care.
static const TOOL_EVENT PointSelectedEvent
static const TOOL_EVENT UnselectedEvent
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
virtual const wxString What() const
A composite of Problem() and Where()
An interface for classes handling user events controlling the view behavior such as zooming,...
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.
An abstract base class for deriving all objects that can be added to a VIEW.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
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 SetLayerVisible(int aLayer, bool aVisible=true)
Control the visibility of a particular layer.
void Hide(VIEW_ITEM *aItem, bool aHide=true)
Temporarily hide the item in the view (e.g.
void UpdateAllItems(int aUpdateFlags)
Update all items in the view according to the given flags.
void MarkDirty()
Force redraw of view on the next rendering.
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
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.
wxWindow * GetBlockingDialog()
Gets the window pointer to the blocking dialog (to send it signals)
A logical library item identifier and consists of various portions much like a URI.
int SetLibNickname(const UTF8 &aNickname)
Override the logical library name portion of the LIB_ID to aNickname.
VECTOR2I GetPosition() const override
Define a library symbol object.
LIB_ID GetLibId() const override
std::unique_ptr< LIB_SYMBOL > Flatten() const
Return a flattened symbol inheritance to the caller.
const wxString GetFullURI(bool aSubstituted=false) const
Return the full location specifying URI for the LIB, either in original UI form or in environment var...
bool HasLibrary(const wxString &aNickname, bool aCheckEnabled=false) const
Test for the existence of aNickname in the library table.
static void ConvertToSpiceMarkup(std::string &aNetName)
Remove formatting wrappers and replace illegal spice net name characters with underscores.
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.
static bool ParseBusVector(const wxString &aBus, wxString *aName, std::vector< wxString > *aMemberList)
Parse a bus vector (e.g.
static wxString GetDefaultUserSymbolsPath()
Gets the default path we point users to create projects.
A holder to handle information on schematic or board items.
void PushItem(const ITEM_PICKER &aItem)
Push aItem to the top of the list.
void ReversePickersListOrder()
Reverse the order of pickers stored in this list.
virtual const wxString GetProjectPath() const
Return the full path of the project.
virtual const wxString AbsolutePath(const wxString &aFileName) const
Fix up aFileName if it is relative to the project's directory to be an absolute path and filename.
static bool RescueProject(wxWindow *aParent, RESCUER &aRescuer, bool aRunningOnDemand)
size_t GetCandidateCount()
Return the number of rescue candidates found.
Holds all the data relating to one schematic.
SCH_SHEET_PATH & CurrentSheet() const override
wxString GetFileName() const override
Helper to retrieve the filename from the root sheet screen.
SCHEMATIC_SETTINGS & Settings() const
CONNECTION_GRAPH * ConnectionGraph() const override
SCH_SHEET_LIST GetSheets() const override
Builds and returns an updated schematic hierarchy TODO: can this be cached?
SCH_SCREEN * RootScreen() const
Helper to retrieve the screen of the root sheet.
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
SYMBOL_LIB_TABLE * SelectSymLibTable(bool aOptional=false)
Display a dialog asking the user to select a symbol library table.
wxString SelectLibraryFromList()
Display a list of loaded libraries and allows the user to select a library.
void SyncView()
Mark all items for refresh.
EESCHEMA_SETTINGS * eeconfig() const
Base class for a bus or wire entry.
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
SCH_ITEM * Parent() const
wxString Name(bool aIgnoreSheet=false) const
SCH_ITEM * Driver() const
std::vector< std::shared_ptr< SCH_CONNECTION > > & Members()
KIGFX::SCH_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
Handle actions specific to the schematic editor.
int PageSetup(const TOOL_EVENT &aEvent)
bool RescueLegacyProject(bool aRunningOnDemand)
int SaveAs(const TOOL_EVENT &aEvent)
int Annotate(const TOOL_EVENT &aEvent)
int ToggleAnnotateRecursive(const TOOL_EVENT &aEvent)
int ShowSchematicSetup(const TOOL_EVENT &aEvent)
int HighlightNet(const TOOL_EVENT &aEvent)
< Highlight net under the cursor.
int ClearHighlight(const TOOL_EVENT &aEvent)
Update net highlighting after an edit.
int EditSymbolFields(const TOOL_EVENT &aEvent)
bool m_duplicateIsHoverSelection
int HighlightNetCursor(const TOOL_EVENT &aEvent)
int ImportFPAssignments(const TOOL_EVENT &aEvent)
int ChangeLineMode(const TOOL_EVENT &aEvent)
void setClipboardInstances(const SCH_SCREEN *aPastedScreen)
void doCrossProbeSchToPcb(const TOOL_EVENT &aEvent, bool aForce)
int ExportSymbolsToLibrary(const TOOL_EVENT &aEvent)
int SaveCurrSheetCopyAs(const TOOL_EVENT &aEvent)
Saves the currently-open schematic sheet to an other name.
bool rescueProject(RESCUER &aRescuer, bool aRunningOnDemand)
int CrossProbeToPcb(const TOOL_EVENT &aEvent)
Equivalent to the above, but initiated by the user.
int Quit(const TOOL_EVENT &aEvent)
int RemapSymbols(const TOOL_EVENT &aEvent)
int DrawSheetOnClipboard(const TOOL_EVENT &aEvent)
int RescueSymbols(const TOOL_EVENT &aEvent)
Perform rescue operations to recover old projects from before certain changes were made.
std::map< KIID_PATH, SCH_SHEET_INSTANCE > m_clipboardSheetInstances
int AssignNetclass(const TOOL_EVENT &aEvent)
std::string m_duplicateClipboard
int ExportNetlist(const TOOL_EVENT &aEvent)
int Open(const TOOL_EVENT &aEvent)
int Paste(const TOOL_EVENT &aEvent)
int Copy(const TOOL_EVENT &aEvent)
int ToggleERCWarnings(const TOOL_EVENT &aEvent)
int NextLineMode(const TOOL_EVENT &aEvent)
int Redo(const TOOL_EVENT &aEvent)
Clipboard support.
int UpdatePCB(const TOOL_EVENT &aEvent)
int UpdateFromPCB(const TOOL_EVENT &aEvent)
int ToggleAnnotateAuto(const TOOL_EVENT &aEvent)
int ToggleHiddenPins(const TOOL_EVENT &aEvent)
int Duplicate(const TOOL_EVENT &aEvent)
bool searchSupplementaryClipboard(const wxString &aSheetFilename, SCH_SCREEN **aScreen)
int EditWithSymbolEditor(const TOOL_EVENT &aEvent)
int EditSymbolLibraryLinks(const TOOL_EVENT &aEvent)
int New(const TOOL_EVENT &aEvent)
std::map< wxString, SCH_SCREEN * > m_supplementaryClipboard
int ExplicitCrossProbeToPcb(const TOOL_EVENT &aEvent)
int ShowPcbNew(const TOOL_EVENT &aEvent)
int UpdateNetHighlighting(const TOOL_EVENT &aEvent)
Launch a tool to highlight nets.
int ToggleERCErrors(const TOOL_EVENT &aEvent)
int TogglePythonConsole(const TOOL_EVENT &aEvent)
int ShowHierarchy(const TOOL_EVENT &aEvent)
void setTransitions() override
This method is meant to be overridden in order to specify handlers for events.
void updatePastedSymbol(SCH_SYMBOL *aSymbol, SCH_SCREEN *aPasteScreen, const SCH_SHEET_PATH &aPastePath, const KIID_PATH &aClipPath, bool aForceKeepAnnotations)
int ShowCvpcb(const TOOL_EVENT &aEvent)
SCH_SHEET_PATH updatePastedSheet(const SCH_SHEET_PATH &aPastePath, const KIID_PATH &aClipPath, SCH_SHEET *aSheet, bool aForceKeepAnnotations, SCH_SHEET_LIST *aPastedSheetsSoFar, SCH_REFERENCE_LIST *aPastedSymbolsSoFar)
int RepairSchematic(const TOOL_EVENT &aEvent)
int Cut(const TOOL_EVENT &aEvent)
std::map< KIID_PATH, SCH_SYMBOL_INSTANCE > m_clipboardSymbolInstances
int Save(const TOOL_EVENT &aEvent)
bool RescueSymbolLibTableProject(bool aRunningOnDemand)
Notifies pcbnew about the selected item.
bool doCopy(bool aUseDuplicateClipboard=false)
< copy selection to clipboard or to m_duplicateClipboard
int Undo(const TOOL_EVENT &aEvent)
int ToggleERCExclusions(const TOOL_EVENT &aEvent)
int Plot(const TOOL_EVENT &aEvent)
int Print(const TOOL_EVENT &aEvent)
int Revert(const TOOL_EVENT &aEvent)
int GenerateBOM(const TOOL_EVENT &aEvent)
int ToggleHiddenFields(const TOOL_EVENT &aEvent)
Schematic editor (Eeschema) main window.
void ShowSchematicSetupDialog(const wxString &aInitialPage=wxEmptyString)
void RollbackSchematicFromUndo()
Perform an undo of the last edit WITHOUT logging a corresponding redo.
bool IsSyncingSelection()
bool LoadSheetFromFile(SCH_SHEET *aSheet, SCH_SHEET_PATH *aHierarchy, const wxString &aFileName)
Load a the KiCad schematic file aFileName into the sheet aSheet.
const SCH_CONNECTION * GetHighlightedConnection() const
void SaveProjectSettings() override
Save changes to the project settings to the project (.pro) file.
void OnOpenCvpcb(wxCommandEvent &event)
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag and update other data struc...
bool OpenProjectFiles(const std::vector< wxString > &aFileSet, int aCtl=0) override
Open a project or set of files given by aFileList.
void AddItemToScreenAndUndoList(SCH_SCREEN *aScreen, SCH_ITEM *aItem, bool aUndoAppend)
Add an item to the schematic and adds the changes to the undo/redo container.
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void InitSheet(SCH_SHEET *aSheet, const wxString &aNewFilename)
void SendSelectItemsToPcb(const std::vector< EDA_ITEM * > &aItems, bool aForce)
Sends items to Pcbnew for selection.
void SaveCopyInUndoList(SCH_SCREEN *aScreen, SCH_ITEM *aItemToCopy, UNDO_REDO aTypeCommand, bool aAppend, bool aDirtyConnectivity=true)
Create a copy of the current schematic item, and put it in the undo list.
void SendCrossProbeClearHighlight()
Tell Pcbnew to clear the existing highlighted net, if one exists.
void HardRedraw() override
Rebuild the GAL and redraw the screen.
SCH_SHEET_PATH & GetCurrentSheet() const
SCHEMATIC & Schematic() const
bool saveSchematicFile(SCH_SHEET *aSheet, const wxString &aSavePath)
Save aSheet to a schematic file.
void DrawCurrentSheetToClipboard()
Use the wxWidgets print code to draw an image of the current sheet onto the clipboard.
void OnUpdatePCB(wxCommandEvent &event)
void OnOpenPcbnew(wxCommandEvent &event)
void RecalculateConnections(SCH_CLEANUP_FLAGS aCleanupFlags)
Generate the connection data for the entire schematic hierarchy.
void OnAnnotate(wxCommandEvent &event)
void SetSheetNumberAndCount()
Set the m_ScreenNumber and m_NumberOfScreens members for screens.
void OnPageSettingsChange() override
Called when modifying the page settings.
void SetCurrentSheet(const SCH_SHEET_PATH &aSheet)
void SetHighlightedConnection(const SCH_CONNECTION *aConnection)
void DisplayCurrentSheet()
Draw the current sheet on the display.
void PutDataInPreviousState(PICKED_ITEMS_LIST *aList)
Restore an undo or redo command to put data pointed by aList in the previous state.
void UpdateNetHighlightStatus()
void UpdateHierarchyNavigator()
Update the hierarchy navigation tree and history.
void SetCrossProbeConnection(const SCH_CONNECTION *aConnection)
Send a connection (net or bus) to Pcbnew for highlighting.
void TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
bool SaveProject(bool aSaveAs=false)
Save the currently-open schematic (including its hierarchy) and associated project.
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
static SCH_FILE_T EnumFromStr(const wxString &aFileType)
Return the #SCH_FILE_T from the corresponding plugin type name: "kicad", "legacy",...
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 SetLastResolvedState(const SCH_ITEM *aItem)
void SetConnectivityDirty(bool aDirty=true)
bool IsConnectivityDirty() const
SCH_CONNECTION * Connection(const SCH_SHEET_PATH *aSheet=nullptr) const
Retrieve the connection associated with this object in the given sheet.
virtual std::vector< VECTOR2I > GetConnectionPoints() const
Add all the connection points for this item to aPoints.
Segment description base class to describe items which have 2 end points (track, wire,...
Helper object to release a SCH_PLUGIN in the context of a potential thrown exception through its dest...
virtual void SaveSymbol(const wxString &aLibraryPath, const LIB_SYMBOL *aSymbol, const STRING_UTF8_MAP *aProperties=nullptr)
Write aSymbol to an existing library located at aLibraryPath.
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 AddItem(const SCH_REFERENCE &aItem)
A helper to define a symbol's reference designator in a schematic.
void SetSheetNumber(int aSheetNumber)
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
void UpdateSymbolLinks(REPORTER *aReporter=nullptr)
Initialize the LIB_SYMBOL reference for each SCH_SYMBOL found in the full schematic.
bool HasNoFullyDefinedLibIds()
Test all of the schematic symbols to see if all LIB_ID objects library nickname is not set.
std::map< wxString, LIB_SYMBOL * > & GetLibSymbols()
Fetch a list of unique LIB_SYMBOL object pointers required to properly render each SCH_SYMBOL in this...
void Clear(bool aFree=true)
Delete all draw items and clears the project settings.
double m_LastZoomLevel
last value for the zoom level, useful in Eeschema when changing the current displayed sheet to reuse ...
EE_RTREE & Items()
Gets the full RTree, usually for iterating.
const wxString & GetFileName() const
const std::vector< SCH_SYMBOL_INSTANCE > & GetSymbolInstances() const
const std::vector< SCH_SHEET_INSTANCE > & GetSheetInstances() const
void MigrateSimModels()
Migrate any symbols having V6 simulation models to their V7 equivalents.
void Append(SCH_ITEM *aItem)
A SCH_PLUGIN derivation for loading schematic files using the new s-expression file format.
void Format(SCH_SHEET *aSheet)
void LoadContent(LINE_READER &aReader, SCH_SHEET *aSheet, int aVersion=SEXPR_SCHEMATIC_FILE_VERSION)
VECTOR2I GetCenter() const
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
void FillItemMap(std::map< KIID, EDA_ITEM * > &aMap)
Fill an item cache for temporary use when many items need to be fetched.
void SortByPageNumbers(bool aUpdateVirtualPageNums=true)
Sort the list of sheets by page number.
bool NameExists(const wxString &aSheetName) const
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.
bool PageNumberExists(const wxString &aPageNumber) const
bool TestForRecursion(const SCH_SHEET_LIST &aSrcSheetHierarchy, const wxString &aDestFileName)
Test every SCH_SHEET_PATH in this SCH_SHEET_LIST to verify if adding the sheets stored in aSrcSheetHi...
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
void GetSymbols(SCH_REFERENCE_LIST &aReferences, bool aIncludePowerSymbols=true, bool aForceIncludeOrphanSymbols=false) const
Adds SCH_REFERENCE object to aReferences for each symbol in the sheet.
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.
wxString GetFileName() const
Return the filename corresponding to this sheet.
std::vector< SCH_FIELD > & GetFields()
bool SearchHierarchy(const wxString &aFilename, SCH_SCREEN **aScreen)
Search the existing hierarchy for an instance of screen loaded from aFileName.
SCH_SCREEN * GetScreen() const
void SetScreen(SCH_SCREEN *aScreen)
Set the SCH_SCREEN associated with this sheet to aScreen.
std::vector< SCH_SHEET_PIN * > & GetPins()
wxString GetSchSymbolLibraryName() const
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const
Return the reference for the given sheet path.
void ClearBrightenedPins()
SCH_FIELD * GetField(MANDATORY_FIELD_T aFieldType)
Return a mandatory field in this symbol.
void SetRef(const SCH_SHEET_PATH *aSheet, const wxString &aReference)
Set the reference for the given sheet path for this symbol.
void ClearAnnotation(const SCH_SHEET_PATH *aSheetPath, bool aResetPrefix)
Clear exiting symbol annotation.
std::vector< SCH_PIN * > GetPins(const SCH_SHEET_PATH *aSheet=nullptr) const
Retrieve a list of the SCH_PINs for the given sheet path.
bool IsMissingLibSymbol() const
Check to see if the library symbol is set to the dummy library symbol.
void SetUnit(int aUnit)
Change the unit number to aUnit.
const LIB_ID & GetLibId() const
void GetFields(std::vector< SCH_FIELD * > &aVector, bool aVisibleOnly)
Populate a std::vector with SCH_FIELDs.
void SetUnitSelection(const SCH_SHEET_PATH *aSheet, int aUnitSelection)
Set the selected unit of this symbol on one sheet.
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
void SetLibSymbol(LIB_SYMBOL *aLibSymbol)
Set this schematic symbol library symbol reference to aLibSymbol.
virtual void SetTextSpinStyle(TEXT_SPIN_STYLE aSpinStyle)
Set a spin or rotation angle, along with specific horizontal and vertical justification styles with e...
void SetIsHover(bool aIsHover)
std::deque< EDA_ITEM * > & Items()
void SetReferencePoint(const VECTOR2I &aP)
bool Empty() const
Checks if there is anything selected.
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Return the aGlobalIndex-th vertex in the poly set.
int FindModelPinIndex(const std::string &aSymbolPinNumber)
const SPICE_GENERATOR & SpiceGenerator() const
Implementing SIM_PLOT_FRAME_BASE.
virtual std::vector< std::string > CurrentNames(const SPICE_ITEM &aItem) const
Is a LINE_READER that reads from a multiline 8 bit wide std::string.
The symbol library editor main window.
void LoadSymbol(const wxString &aLibrary, const wxString &aSymbol, int Unit)
bool IsSymbolTreeShown() const
void OnToggleSymbolTree(wxCommandEvent &event)
void LoadSymbolFromSchematic(SCH_SYMBOL *aSymbol)
Load a symbol from the schematic to edit in place.
Class to handle modifications to the symbol libraries.
bool CreateLibrary(const wxString &aFilePath, SYMBOL_LIB_TABLE *aTable)
Create an empty library and adds it to the library table.
SYMBOL_LIB_TABLE_ROW * GetLibrary(const wxString &aLibrary) const
Find a single library within the (aggregate) library table.
Hold a record identifying a symbol library accessed by the appropriate symbol library SCH_PLUGIN obje...
const wxString GetType() const override
Return the type of symbol library table represented by this row.
static SYMBOL_LIB_TABLE & GetGlobalLibTable()
Symbol library viewer main window.
std::vector< PICKED_ITEMS_LIST * > m_CommandsList
A wrapper for reporting to a wxString object.
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Display a yes/no dialog with aMessage and returns the user response.
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
This file is part of the common library.
int InvokeDialogCreateBOM(SCH_EDIT_FRAME *aCaller)
Create and show DIALOG_BOM and return whatever DIALOG_BOM::ShowModal() returns.
bool InvokeDialogEditSymbolsLibId(SCH_EDIT_FRAME *aCaller)
Run a dialog to modify the LIB_ID of symbols for instance when a symbol has moved from a symbol libra...
int InvokeDialogNetList(SCH_EDIT_FRAME *aCaller)
int InvokeDialogPrintUsingPrinter(SCH_EDIT_FRAME *aCaller)
Create and show DIALOG_PRINT_USING_PRINTER and return whatever DIALOG_PRINT_USING_PRINTER::ShowModal(...
std::vector< EDA_ITEM * > EDA_ITEMS
Define list of drawing items for screens.
#define IS_PASTED
Modifier on IS_NEW which indicates it came from clipboard.
#define IS_NEW
New item, just created.
#define ENDPOINT
ends. (Used to support dragging.)
#define IS_MOVING
Item being moved.
#define STARTPOINT
When a line is selected, these flags indicate which.
@ FRAME_SCH_SYMBOL_EDITOR
const std::string KiCadSymbolLibFileExtension
const std::string KiCadSchematicFileExtension
wxString KiCadSchematicFileWildcard()
wxString KiCadSymbolLibFileWildcard()
#define NET_PLUGIN_CHANGE
Create and shows DIALOG_EXPORT_NETLIST and returns whatever DIALOG_EXPORT_NETLIST::ShowModal() return...
#define THROW_IO_ERROR(msg)
@ REPAINT
Item needs to be redrawn.
@ GEOMETRY
Position or shape has changed.
#define MAX_PAGE_SIZE_EESCHEMA_MILS
#define NAMELESS_PROJECT
default name for nameless projects
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
static bool highlightNet(TOOL_MANAGER *aToolMgr, const VECTOR2D &aPosition)
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.
std::vector< FAB_LAYER_COLOR > dummy
wxString UnescapeString(const wxString &aSource)
A simple container for sheet instance information.
A simple container for schematic symbol instance information.
static constexpr auto NOT_CONNECTED
Definition for symbol library class.
@ FOOTPRINT_FIELD
Field Name Module PCB, i.e. "16DIP300".
@ VALUE_FIELD
Field Value of part, i.e. "3.3K".
@ REFERENCE_FIELD
Field Reference of part, i.e. "IC21".
double EuclideanNorm(const VECTOR2I &vector)
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition of file extensions used in Kicad.
#define FN_NORMALIZE_FLAGS
Default flags to pass to wxFileName::Normalize().