66 #include <wx/filedlg.h> 101 wxFileDialog dlg(
m_frame,
_(
"Schematic Files" ), curr_fn.GetPath(),
103 wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
105 if( dlg.ShowModal() == wxID_CANCEL )
108 wxFileName newFileName = dlg.GetPath();
136 if( dlg.ShowModal() )
158 if( schematic.HasNoFullyDefinedLibIds() )
196 static_cast<SYMBOL_VIEWER_FRAME*>( viewer )->ReCreateLibList();
198 if( aRunningOnDemand )
297 && !data.GetFindString().IsEmpty()
298 && aItem->
Matches( data, aSheet ) )
341 SCH_ITEM* aAfter, wxFindReplaceData& aData )
343 bool past_item =
true;
345 if( aAfter !=
nullptr )
350 aAfter = static_cast<SCH_ITEM*>( aAfter->
GetParent() );
353 std::vector<SCH_ITEM*> sorted_items;
356 sorted_items.push_back( item );
358 std::sort( sorted_items.begin(), sorted_items.end(),
365 return a->
m_Uuid < b->m_Uuid;
374 for(
SCH_ITEM* item : sorted_items )
385 if( item->Matches( aData, aSheet ) )
390 SCH_SYMBOL* cmp = static_cast<SCH_SYMBOL*>( item );
394 if( field.Matches( aData, aSheet ) )
400 if(
pin->Matches( aData, aSheet ) )
407 SCH_SHEET* sheet = static_cast<SCH_SHEET*>( item );
411 if( field.Matches( aData, aSheet ) )
417 if(
pin->Matches( aData, aSheet ) )
431 static wxTimer wrapAroundTimer;
441 else if( data.GetFindString().IsEmpty() )
448 SCH_ITEM* afterItem = dynamic_cast<SCH_ITEM*>( selection.
Front() );
453 if( wrapAroundTimer.IsRunning() )
455 afterSheet =
nullptr;
457 wrapAroundTimer.Stop();
463 if( afterSheet || !searchAllSheets )
466 if( !item && searchAllSheets )
469 std::vector<SCH_SHEET_PATH*> paths;
473 for(
SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() )
476 paths.push_back( &sheet );
479 std::sort( paths.begin(), paths.end(), [] (
const SCH_SHEET_PATH* lhs,
486 else if( retval > 0 )
497 afterSheet =
nullptr;
504 item =
nextMatch( sheet->LastScreen(), sheet,
nullptr, data );
510 sheet->LastScreen()->TestDanglingEnds();
529 wxString msg = searchAllSheets ?
_(
"Reached end of schematic." )
530 :
_(
"Reached end of sheet." );
534 _(
"Find again to wrap around to the start." ), 4000 );
535 wrapAroundTimer.StartOnce( 4000 );
557 if( data.GetFindString().IsEmpty() )
560 if( item && item->
Matches( data, sheet ) )
562 SCH_ITEM* sch_item = static_cast<SCH_ITEM*>( item );
566 if( item->
Replace( data, sheet ) )
584 bool modified =
false;
586 if( data.GetFindString().IsEmpty() )
595 if( aItem->
Replace( aData, aSheet ) )
602 if( currentSheetOnly )
610 doReplace( item, currentSheet, data );
619 for(
SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() )
623 for(
unsigned ii = 0; ii < sheets.size(); ++ii )
631 doReplace( item, &sheets[0], data );
635 SCH_FIELD* field = static_cast<SCH_FIELD*>( item );
639 switch( field->
GetId() )
645 doReplace( field, &sheets[ii], data );
655 item =
nextMatch( screen, &sheets[ii], item, data );
719 switch( item->Type() )
723 if( item->GetParent() && item->GetParent()->Type() ==
SCH_SYMBOL_T )
757 #define HITTEST_THRESHOLD_PIXELS 5 760 int SCH_EDITOR_CONTROL::SimProbe(
const TOOL_EVENT& aEvent )
775 [
this, simFrame](
const VECTOR2D& aPosition )
783 if( item->IsType( wires ) )
785 if(
SCH_CONNECTION* conn = static_cast<SCH_ITEM*>( item )->Connection() )
797 primitive.LowerCase();
799 if( primitive == wxT(
"c" ) || primitive == wxT(
"l" ) || primitive == wxT(
"r" ) )
801 else if( primitive == wxT(
"d" ) )
806 simFrame->AddCurrentPlot( ref, param );
813 [
this, picker](
const VECTOR2D& aPos )
823 SCH_LINE* wire = dynamic_cast<SCH_LINE*>( item );
859 [
this](
const int& aFinalState )
883 int SCH_EDITOR_CONTROL::SimTune(
const TOOL_EVENT& aEvent )
898 selTool->
SelectPoint( aPosition, fieldsAndSymbols, &item );
905 item = item->GetParent();
911 SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
915 static_cast<SIM_PLOT_FRAME*>( simFrame )->AddTuner( symbol );
948 [
this](
const int& aFinalState )
981 if( aPosition !=
CLEAR )
985 if(
erc.TestDuplicateSheetNames(
false ) > 0 )
987 wxMessageBox(
_(
"Error: duplicate sub-sheet names found in current sheet." ) );
992 SCH_ITEM* item = static_cast<SCH_ITEM*>( selTool->GetNode( aPosition ) );
993 SCH_SYMBOL* symbol = dynamic_cast<SCH_SYMBOL*>( item );
998 symbol = dynamic_cast<SCH_SYMBOL*>( item->
GetParent() );
1000 if( symbol && symbol->GetLibSymbolRef() && symbol->GetLibSymbolRef()->IsPower() )
1002 std::vector<SCH_PIN*> pins = symbol->GetPins();
1004 if( pins.size() == 1 )
1005 conn = pins[0]->Connection();
1017 editFrame->SetStatusText( wxEmptyString );
1029 editorControl->UpdateNetHighlighting(
dummy );
1082 else if( conn->
IsBus() && conn->
Members().size() == 0 )
1089 wxArrayString netNames;
1093 for(
const std::shared_ptr<SCH_CONNECTION>& member : conn->
Members() )
1095 if( member->IsBus() )
1097 for(
const std::shared_ptr<SCH_CONNECTION>& subMember : member->Members() )
1098 netNames.Add( subMember->Name() );
1102 netNames.Add( member->Name() );
1108 netNames.Add( conn->
Name() );
1112 wxString netclassName = netSettings.
GetNetclassName( netNames.front() );
1114 wxArrayString headers;
1115 std::vector<wxArrayString> items;
1117 headers.Add(
_(
"Netclasses" ) );
1119 wxArrayString defaultItem;
1120 defaultItem.Add(
_(
"Default" ) );
1121 items.emplace_back( defaultItem );
1123 for(
const std::pair<const wxString, NETCLASSPTR>& ii : netSettings.
m_NetClasses )
1126 item.Add( ii.first );
1127 items.emplace_back( item );
1133 if( dlg.ShowModal() == wxID_OK )
1137 for(
const wxString& netName : netNames )
1143 NETCLASSPTR oldNetclass = netSettings.
m_NetClasses.
Find( oldNetclassName );
1146 oldNetclass->Remove( netName );
1153 newNetclass->Add( netName );
1169 std::vector<EDA_ITEM*> itemsToRedraw;
1175 bool selectedIsBus = selectedConn ? selectedConn->
IsBus() :
false;
1176 wxString selectedName = selectedConn ? selectedConn->
Name() :
"";
1178 bool selectedIsNoNet =
false;
1181 if( selectedConn && selectedConn->
Driver() == nullptr )
1183 selectedIsNoNet =
true;
1192 bool highlight =
false;
1195 symbol = static_cast<SCH_SYMBOL*>( item );
1200 itemConn = item->Connection();
1202 if( selectedIsNoNet && selectedSubgraph )
1206 if( item == subgraphItem )
1213 else if( selectedIsBus && itemConn && itemConn->
IsNet() )
1215 for(
const std::shared_ptr<SCH_CONNECTION>& member : selectedConn->
Members() )
1217 if( member->Name() == itemConn->
Name() )
1222 else if( member->IsBus() )
1224 for(
const std::shared_ptr<SCH_CONNECTION>& child_member : member->Members() )
1226 if( child_member->Name() == itemConn->
Name() )
1235 else if( selectedConn && itemConn && selectedName == itemConn->
Name() )
1258 if( pin_conn && pin_conn->
Name() == selectedName )
1260 pin->SetBrightened();
1267 std::vector<SCH_FIELD>& fields = symbol->
GetFields();
1272 fields[
id].SetBrightened();
1274 fields[id].ClearBrightened();
1283 bool redrawPin =
pin->IsBrightened();
1285 if( pin_conn && pin_conn->
Name() == selectedName )
1286 pin->SetBrightened();
1288 pin->ClearBrightened();
1290 redrawPin ^=
pin->IsBrightened();
1291 redraw |= redrawPin;
1296 itemsToRedraw.push_back( item );
1302 for(
EDA_ITEM* redrawItem : itemsToRedraw )
1419 if( !selection.GetSize() )
1439 plugin.
Format( &selection, &selPath, &hierarchy, &formatter );
1441 if( aUseLocalClipboard )
1475 wxTextEntry* textEntry = dynamic_cast<wxTextEntry*>( wxWindow::FindFocus() );
1492 wxTextEntry* textEntry = dynamic_cast<wxTextEntry*>( wxWindow::FindFocus() );
1509 bool aForceKeepAnnotations )
1512 clipItemPath.push_back( aSymbol->
m_Uuid );
1514 wxString reference, value, footprint;
1536 if( aForceKeepAnnotations && !reference.IsEmpty() )
1537 aSymbol->
SetRef( &aPastePath, reference );
1545 aSymbol->
SetValue( &aPastePath, value );
1552 bool aForceKeepAnnotations,
1566 pageNum =
wxString::Format( wxT(
"%d" ), static_cast<int>( aPastedSheetsSoFar->size() ) );
1569 aPastedSheetsSoFar->push_back( sheetPath );
1578 SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
1581 aForceKeepAnnotations );
1585 SCH_SHEET* subsheet = static_cast<SCH_SHEET*>( item );
1588 newClipPath.push_back( subsheet->
m_Uuid );
1591 aPastedSheetsSoFar, aPastedSymbolsSoFar );
1596 subSheetPath.
GetSymbols( *aPastedSymbolsSoFar );
1620 wxTextEntry* textEntry = dynamic_cast<wxTextEntry*>( wxWindow::FindFocus() );
1629 std::string content;
1636 if( content.empty() )
1657 tempScreen->
Append( text_item );
1669 if( dlg.ShowModal() == wxID_CANCEL )
1679 bool sheetsPasted =
false;
1684 if( destFn.IsRelative() )
1692 std::map<wxString, SCH_SCREEN*> loadedScreens;
1696 if( item.LastScreen() )
1697 loadedScreens[item.Last()->GetFileName()] = item.LastScreen();
1702 hierarchy.GetSymbols( existingRefs );
1706 std::map<KIID, EDA_ITEM*> itemMap;
1707 hierarchy.FillItemMap( itemMap );
1711 std::map<SCH_SHEET_PATH, SCH_REFERENCE_LIST> pastedSymbols;
1712 std::map<SCH_SHEET_PATH, SCH_SHEET_LIST> pastedSheets;
1716 loadedItems.push_back( item );
1721 SCH_SHEET* sheet = static_cast<SCH_SHEET*>( item );
1724 if( srcFn.IsRelative() )
1729 if( hierarchy.TestForRecursion( sheetHierarchy, destFn.GetFullPath( wxPATH_UNIX ) ) )
1732 "was dropped because the destination already has " 1733 "the sheet or one of its subsheets as a parent." ),
1736 loadedItems.pop_back();
1742 tempScreen->
Clear(
false );
1744 for(
unsigned i = 0; i < loadedItems.size(); ++i )
1751 SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
1759 wxCHECK2( currentScreen,
continue );
1787 const_cast<KIID&>(
pin->m_Uuid ) =
KIID();
1793 if( libSymbol && symbol->
GetRef( &instance )[0] != wxT(
'#' ) )
1797 pastedSymbols[instance].AddItem( schReference );
1805 wxString baseName = nameField.
GetText();
1806 wxString candidateName = baseName;
1809 while( !baseName.IsEmpty() && wxIsdigit( baseName.Last() ) )
1811 number = baseName.Last() + number;
1812 baseName.RemoveLast();
1820 int uniquifier = std::max( 0, wxAtoi( number ) ) + 1;
1822 while( hierarchy.NameExists( candidateName ) )
1825 nameField.
SetText( candidateName );
1833 if( !fn.IsAbsolute() )
1836 fn.Normalize( wxPATH_NORM_ALL, currentSheetFileName.GetPath() );
1843 if( loadedScreens.count( sheet->
GetFileName() ) > 0 )
1844 existingScreen = loadedScreens.at( sheet->
GetFileName() );
1849 if( existingScreen )
1859 sheetsPasted =
true;
1862 clipPath.push_back( sheet->
m_Uuid );
1869 const_cast<KIID&>(
pin->m_Uuid ) =
KIID();
1876 forceKeepAnnotations,
1877 &pastedSheets[instance],
1878 &pastedSymbols[instance] );
1880 sheetPath.
GetSymbols( pastedSymbols[instance] );
1885 SCH_ITEM* srcItem = dynamic_cast<SCH_ITEM*>( itemMap[ item->
m_Uuid ] );
1886 SCH_ITEM* destItem = dynamic_cast<SCH_ITEM*>( item );
1891 if( srcItem && destItem )
1914 pastedSymbols[instance].SortByReferenceOnly();
1915 pastedSymbols[instance].ReannotateDuplicates( existingRefs );
1916 pastedSymbols[instance].UpdateAnnotation();
1919 for(
size_t i = 0; i < pastedSymbols[instance].GetCount(); i++ )
1920 existingRefs.
AddItem( pastedSymbols[instance][i] );
1931 pastedSheets[instance].SortByPageNumbers();
1938 while( hierarchy.PageNumberExists( pageNum ) )
1941 pastedSheet.SetPageNumber( pageNum );
1942 hierarchy.push_back( pastedSheet );
1958 if( !selection.
Empty() )
1978 if( selection.GetSize() >= 1 )
2009 wxCommandEvent
dummy;
2017 wxCommandEvent
dummy;
2042 wxCommandEvent
dummy;
2050 wxCommandEvent
dummy;
2105 if( selection.GetSize() == 1 )
2194 std::map<KIID, EDA_ITEM*> ids;
2200 auto it = ids.find( aItem->m_Uuid );
2202 if( it != ids.end() && it->second != aItem )
2205 const_cast<KIID&>( aItem->m_Uuid ) =
KIID();
2208 ids[ aItem->m_Uuid ] = aItem;
2220 processItem( item );
2222 for(
SCH_PIN*
pin : static_cast<SCH_SYMBOL*>( item )->GetPins( &sheet ) )
2233 processItem( item );
2235 item->RunOnChildren(
2238 processItem( item );
2253 errors += duplicates;
2261 wxString msg =
wxString::Format(
_(
"%d potential problems repaired." ), errors );
Field Reference of part, i.e. "IC21".
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
int TogglePythonConsole(const TOOL_EVENT &aEvent)
int Save(const TOOL_EVENT &aEvent)
void Hide(VIEW_ITEM *aItem, bool aHide=true)
Temporarily hide the item in the view (e.g.
void SetSheetNumber(int aSheetNumber)
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
EE_TYPE OfType(KICAD_T aType) const
bool rescueProject(RESCUER &aRescuer, bool aRunningOnDemand)
KIGFX::SCH_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
void ShowFindReplaceStatus(const wxString &aMsg, int aStatusTime)
int EditWithSymbolEditor(const TOOL_EVENT &aEvent)
int FindAndReplace(const TOOL_EVENT &aEvent)
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
void OnOpenCvpcb(wxCommandEvent &event)
std::map< wxString, wxString > m_NetClassAssignments
const wxString & GetFileName() const
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
static TOOL_ACTION rescueSymbols
int Copy(const TOOL_EVENT &aEvent)
static const TOOL_EVENT SelectedEvent
virtual void SetLastResolvedState(const SCH_ITEM *aItem)
virtual bool Matches(const wxFindReplaceData &aSearchData, void *aAuxData) const
Compare the item against the search criteria in aSearchData.
void doCrossProbeSchToPcb(const TOOL_EVENT &aEvent, bool aForce)
bool RescueLegacyProject(bool aRunningOnDemand)
static TOOL_ACTION findAndReplace
bool SearchHierarchy(const wxString &aFilename, SCH_SCREEN **aScreen)
Search the existing hierarchy for an instance of screen loaded from aFileName.
void UpdateNetHighlightStatus()
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
static TOOL_ACTION exportNetlist
wxString GetTextSelection(int aColumn=0)
Return the selected text from aColumn in the wxListCtrl in the dialog.
static TOOL_ACTION navigateHierarchy
int ShowSchematicSetup(const TOOL_EVENT &aEvent)
NETCLASSPTR Find(const wxString &aName) const
Search this container for a NETCLASS given by aName.
int HighlightNetCursor(const TOOL_EVENT &aEvent)
static TOOL_ACTION assignFootprints
int ComparePageNum(const SCH_SHEET_PATH &aSheetPathToTest) const
Compare sheets by their page number.
static TOOL_ACTION pageSettings
void Format(SCH_SHEET *aSheet)
void RecalculateConnections(SCH_CLEANUP_FLAGS aCleanupFlags)
Generate the connection data for the entire schematic hierarchy.
SCH_FIELD * GetField(MANDATORY_FIELD_T aFieldType)
Return a mandatory field in this symbol.
void SaveProjectSettings() override
Save changes to the project settings to the project (.pro) file.
void SetUnit(int aUnit)
Change the unit number to aUnit.
Holds all the data relating to one schematic.
static const TOOL_EVENT UnselectedEvent
const wxString & GetNetclassName(const wxString &aNetName) const
#define IS_NEW
New item, just created.
CONNECTION_GRAPH * ConnectionGraph() const override
SCH_SHEET * Last() const
Return a pointer to the last SCH_SHEET of the list.
This file is part of the common library.
void ReversePickersListOrder()
Reverse the order of pickers stored in this list.
static TOOL_ACTION doDelete
Calculates the connectivity of a schematic and generates netlists.
void SetScreen(BASE_SCREEN *aScreen) override
const SCH_CONNECTION * GetHighlightedConnection() const
void Collect(SCH_SCREEN *aScreen, const KICAD_T aFilterList[], const wxPoint &aPos, int aUnit=0, int aConvert=0)
Scan a EDA_ITEM using this class's Inspector method which does the collection.
static TOOL_ACTION addItemsToSel
Selects a list of items (specified as the event parameter)
UNDO_REDO_CONTAINER m_undoList
static wxFindReplaceData g_markersOnly
bool PrjConfigChanged()
Return true if the project configuration was modified.
int Redo(const TOOL_EVENT &aEvent)
Clipboard support.
int NavigateHierarchy(const TOOL_EVENT &aEvent)
int EditSymbolFields(const TOOL_EVENT &aEvent)
void push_back(SCH_SHEET *aSheet)
Forwarded method from std::vector.
virtual PROJECT_FILE & GetProjectFile() const
virtual void PushCommandToRedoList(PICKED_ITEMS_LIST *aItem)
Add a command to redo in the redo list.
const std::vector< SYMBOL_INSTANCE_REFERENCE > & GetSymbolInstances() const
void SendCrossProbeClearHighlight()
Tell Pcbnew to clear the existing highlighted net, if one exists.
double m_LastZoomLevel
last value for the zoom level, useful in Eeschema when changing the current displayed sheet to reuse ...
void ClearAnnotation(const SCH_SHEET_PATH *aSheetPath)
Clear exiting symbol annotation.
void SetValue(const SCH_SHEET_PATH *sheet, const wxString &aValue)
void SetScreen(SCH_SCREEN *aScreen)
Set the SCH_SCREEN associated with this sheet to aScreen.
static TOOL_ACTION replaceAll
int ReplaceAndFindNext(const TOOL_EVENT &aEvent)
static TOOL_ACTION cancelInteractive
void updatePastedSymbol(SCH_SYMBOL *aSymbol, SCH_SCREEN *aPasteScreen, const SCH_SHEET_PATH &aPastePath, const KIID_PATH &aClipPath, bool aForceKeepAnnotations)
void UpdateAllItems(int aUpdateFlags)
Update all items in the view according to the given flags.
wxString KiCadSchematicFileWildcard()
void GetFields(std::vector< SCH_FIELD * > &aVector, bool aVisibleOnly)
Populate a std::vector with SCH_FIELDs.
void SetWksFileName(const wxString &aFilename)
void LoadSymbolFromSchematic(SCH_SYMBOL *aSymbol)
Load a symbol from the schematic to edit in place.
static TOOL_ACTION remapSymbols
void SetFlags(EDA_ITEM_FLAGS aMask)
void UpdateTitle()
Set the main window title bar text.
int New(const TOOL_EVENT &aEvent)
virtual void PushCommandToUndoList(PICKED_ITEMS_LIST *aItem)
Add a command to undo in the undo list.
void InitSheet(SCH_SHEET *aSheet, const wxString &aNewFilename)
void DrawCurrentSheetToClipboard()
Use the wxWidgets print code to draw an image of the current sheet onto the clipboard.
NET_SETTINGS & NetSettings()
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
virtual int GetRedoCommandCount() const
bool IsBrightened() const
void PushItem(const ITEM_PICKER &aItem)
Push aItem to the top of the list.
Schematic editor (Eeschema) main window.
int FindNext(const TOOL_EVENT &aEvent)
static TOOL_ACTION updatePcbFromSchematic
int InvokeDialogCreateBOM(SCH_EDIT_FRAME *aCaller)
Create and show DIALOG_BOM and return whatever DIALOG_BOM::ShowModal() returns.
int ExplicitCrossProbeToPcb(const TOOL_EVENT &aEvent)
virtual PICKED_ITEMS_LIST * PopCommandFromRedoList()
Return the last command to undo and remove it from list, nothing is deleted.
void OnPageSettingsChange() override
Called when modifying the page settings.
void AddItem(const SCH_REFERENCE &aItem)
void ScriptingConsoleEnableDisable()
Toggles the scripting console visibility.
bool searchSupplementaryClipboard(const wxString &aSheetFilename, SCH_SCREEN **aScreen)
virtual wxPoint GetPosition() const
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const
Return the reference for the given sheet path.
int Annotate(const TOOL_EVENT &aEvent)
void DisplayCurrentSheet()
Draw the current sheet on the display.
static const KICAD_T SheetsOnly[]
An abstract base class for deriving all objects that can be added to a VIEW.
int GenerateBOM(const TOOL_EVENT &aEvent)
void UpdateAllScreenReferences()
Update all the symbol references for this sheet path.
int EditSymbolLibraryLinks(const TOOL_EVENT &aEvent)
static TOOL_ACTION saveCurrSheetCopyAs
SCH_SCREEN * GetScreen() const
Define a library symbol object.
int CrossProbeToPcb(const TOOL_EVENT &aEvent)
Equivalent to the above, but initiated by the user.
void SetFootprint(const SCH_SHEET_PATH *sheet, const wxString &aFootprint)
static TOOL_ACTION updateNetHighlighting
void SetLibSymbol(LIB_SYMBOL *aLibSymbol)
Set this schematic symbol library symbol reference to aLibSymbol.
A subgraph is a set of items that are electrically connected on a single sheet.
void setTransitions() override
This method is meant to be overridden in order to specify handlers for events.
virtual const wxString GetProjectPath() const
Return the full path of the project.
int DrawSheetOnClipboard(const TOOL_EVENT &aEvent)
void SetUnitSelection(const SCH_SHEET_PATH *aSheet, int aUnitSelection)
Set the selected unit of this symbol on one sheet.
void SetPageNumber(const SCH_SHEET_PATH &aInstance, const wxString &aPageNumber)
Set the page number for the sheet instance aInstance.
search types array terminator (End Of Types)
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
static const TOOL_EVENT SelectedItemsModified
Selected items were moved, this can be very high frequency on the canvas, use with care.
virtual void SetParent(EDA_ITEM *aParent)
bool IsSymbolTreeShown() const
int SaveAs(const TOOL_EVENT &aEvent)
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
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.
wxFindReplaceData & GetFindReplaceData()
Container to create a flattened list of symbols because in a complex hierarchy, a symbol can be used ...
void Clear(bool aFree=true)
Delete all draw items and clears the project settings.
int ToggleForceHV(const TOOL_EVENT &aEvent)
void pop_back()
Forwarded method from std::vector.
int HighlightNet(const TOOL_EVENT &aEvent)
< Highlight net under the cursor.
static TOOL_ACTION leaveSheet
static TOOL_ACTION pickerTool
SCH_CONNECTION * Connection(const SCH_SHEET_PATH *aSheet=nullptr) const
Retrieve the connection associated with this object in the given sheet.
bool SaveProject(bool aSaveAs=false)
Save the currently-open schematic (including its hierarchy) and associated project.
static TOOL_ACTION updateFind
EESCHEMA_SETTINGS * eeconfig() const
static LIB_SYMBOL * dummy()
Used to draw a dummy shape when a LIB_SYMBOL is not found in library.
std::vector< SCH_FIELD > & GetFields()
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
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...
bool RescueSymbolLibTableProject(bool aRunningOnDemand)
static TOOL_ACTION annotate
Handle actions specific to the schematic editor.
int EnterSheet(const TOOL_EVENT &aEvent)
int GetCount() const
Return the number of objects in the list.
SCH_ITEM * nextMatch(SCH_SCREEN *aScreen, SCH_SHEET_PATH *aSheet, SCH_ITEM *aAfter, wxFindReplaceData &aData)
Advance the search and returns the next matching item after aAfter.
int ShowPcbNew(const TOOL_EVENT &aEvent)
std::map< wxString, SCH_SCREEN * > m_supplementaryClipboard
int Paste(const TOOL_EVENT &aEvent)
static bool RescueProject(wxWindow *aParent, RESCUER &aRescuer, bool aRunningOnDemand)
static TOOL_ACTION showPcbNew
void SetReferencePoint(const VECTOR2I &aP)
int UpdatePCB(const TOOL_EVENT &aEvent)
int ShowCvpcb(const TOOL_EVENT &aEvent)
void LoadSymbol(const wxString &aLibrary, const wxString &aSymbol, int Unit)
static TOOL_ACTION highlightNetTool
#define MAX_PAGE_SIZE_EESCHEMA_MILS
static TOOL_ACTION showBusManager
static TOOL_ACTION updateSchematicFromPcb
static TOOL_ACTION editSymbolFields
Item needs to be redrawn.
#define IS_PASTED
Modifier on IS_NEW which indicates it came from clipboard.
int InvokeDialogPrintUsingPrinter(SCH_EDIT_FRAME *aCaller)
Create and show DIALOG_PRINT_USING_PRINTER and return whatever DIALOG_PRINT_USING_PRINTER::ShowModal(...
bool LoadSheetFromFile(SCH_SHEET *aSheet, SCH_SHEET_PATH *aHierarchy, const wxString &aFileName)
Load a the KiCad schematic file aFileName into the sheet aSheet.
#define IS_MOVING
Item being moved.
wxString Name(bool aIgnoreSheet=false) const
Field Value of part, i.e. "3.3K".
virtual void SetText(const wxString &aText)
void TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
virtual int GetUndoCommandCount() const
int LeaveSheet(const TOOL_EVENT &aEvent)
int ToggleHiddenFields(const TOOL_EVENT &aEvent)
static TOOL_ACTION simTune
std::vector< PICKED_ITEMS_LIST * > m_CommandsList
int Print(const TOOL_EVENT &aEvent)
void HardRedraw() override
Rebuild the GAL and redraw the screen.
void SyncView()
Mark all items for refresh.
int ReplaceAll(const TOOL_EVENT &aEvent)
wxString GetSchSymbolLibraryName() const
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
std::vector< SCH_ITEM * > m_items
bool saveSchematicFile(SCH_SHEET *aSheet, const wxString &aSavePath)
Save aSheet to a schematic file.
static TOOL_ACTION explicitCrossProbe
wxString GetPageNumber() const
void SetForceVisible(bool aEnable)
Set and clear force visible flag used to force the item to be drawn even if it's draw attribute is se...
const std::vector< SCH_SHEET_INSTANCE > & GetSheetInstances() const
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
int UpdateFind(const TOOL_EVENT &aEvent)
Notifies pcbnew about the selected item.
Contains methods for drawing schematic-specific items.
size_t GetCandidateCount()
Return the number of rescue candidates found.
int Plot(const TOOL_EVENT &aEvent)
SCHEMATIC & Schematic() const
void UpdateHierarchyNavigator(bool aForceUpdate=false)
Run the Hierarchy Navigator dialog.
void BuildClientSheetPathList()
built the list of sheet paths sharing a screen for each screen in use
Definition of file extensions used in Kicad.
SCH_ITEM * Driver() const
static TOOL_ACTION showPythonConsole
bool doCopy(bool aUseLocalClipboard=false)
< copy selection to clipboard or to m_localClipboard if aUseLocalClipboard is true
int ImportFPAssignments(const TOOL_EVENT &aEvent)
virtual PICKED_ITEMS_LIST * PopCommandFromUndoList()
Return the last command to undo and remove it from list, nothing is deleted.
A simple container for schematic symbol instance information.
Definition for symbol library class.
EDA_ITEM * GetParent() const
An interface for classes handling user events controlling the view behavior such as zooming,...
void UpdateItem(EDA_ITEM *aItem, bool isAddOrDelete=false, bool aUpdateRtree=false)
Mark an item for refresh.
DIALOG_SCH_FIND * m_findReplaceDialog
NET_SETTINGS stores various net-related settings in a project context.
Subclass of SIM_PLOT_FRAME_BASE, which is generated by wxFormBuilder.
static const TOOL_EVENT ClearedEvent
Selected item had a property changed (except movement)
static TOOL_ACTION replaceAndFindNext
static bool highlightNet(TOOL_MANAGER *aToolMgr, const VECTOR2D &aPosition)
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 UpdateItems()
Iterate through the list of items that asked for updating and updates them.
static TOOL_ACTION selectionActivate
Activation of the selection tool.
Define a sheet pin (label) used in sheets to create hierarchical schematics.
std::vector< EDA_ITEM * > EDA_ITEMS
Define list of drawing items for screens.
static TOOL_ACTION clearSelection
Clears the current selection.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
EDA_ITEM_FLAGS GetEditFlags() const
int ToggleHiddenPins(const TOOL_EVENT &aEvent)
A holder to handle information on schematic or board items.
wxString GetFileName() const
Return the filename corresponding to this sheet.
int UpdateNetHighlighting(const TOOL_EVENT &aEvent)
Launch a tool to highlight nets.
void setClipboardInstances(const SCH_SCREEN *aPastedScreen)
int SaveCurrSheetCopyAs(const TOOL_EVENT &aEvent)
Saves the currently-open schematic sheet to an other name.
void OnToggleSymbolTree(wxCommandEvent &event)
static bool Replace(const wxFindReplaceData &aSearchData, wxString &aText)
Perform a text replace on aText using the find and replace criteria in aSearchData on items that supp...
void OnUpdatePCB(wxCommandEvent &event)
int RemapSymbols(const TOOL_EVENT &aEvent)
std::map< KIID_PATH, SCH_SHEET_INSTANCE > m_clipboardSheetInstances
int Duplicate(const TOOL_EVENT &aEvent)
A SCH_PLUGIN derivation for loading schematic files using the new s-expression file format.
std::map< KIID_PATH, SYMBOL_INSTANCE_REFERENCE > m_clipboardSymbolInstances
wxString UnescapeString(const wxString &aSource)
bool Empty() const
Checks if there is anything selected.
Implementing SIM_PLOT_FRAME_BASE.
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 AssignNetclass(const TOOL_EVENT &aEvent)
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
PROJECT & Prj() const override
Return a reference to the project this schematic is part of.
static TOOL_ACTION pasteSpecial
virtual unsigned int GetSize() const override
Return the number of stored items.
static wxString GetSpiceField(SPICE_FIELD aField, SCH_SYMBOL *aSymbol, unsigned aCtl)
Retrieve either the requested field value or the default value.
std::vector< SCH_SHEET_PIN * > & GetPins()
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
static bool m_allowRealTime
void OnAnnotate(wxCommandEvent &event)
virtual SCH_RENDER_SETTINGS * GetSettings() override
Return a pointer to current settings that are going to be used when drawing items.
int Open(const TOOL_EVENT &aEvent)
EDA_ITEM * GetTopLeftItem(bool onlyModules=false) const override
static TOOL_ACTION findNextMarker
void ClearBrightenedPins()
void LoadContent(LINE_READER &aReader, SCH_SHEET *aSheet, int aVersion=SEXPR_SCHEMATIC_FILE_VERSION)
SCH_SHEET_LIST GetSheets() const override
Builds and returns an updated schematic hierarchy TODO: can this be cached?
int PageSetup(const TOOL_EVENT &aEvent)
void ClearFindReplaceStatus()
void SetHighlightedConnection(const SCH_CONNECTION *aConnection)
std::string m_localClipboard
A simple container for sheet instance information.
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 Quit(const TOOL_EVENT &aEvent)
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 * LastScreen()
static TOOL_ACTION showSymbolEditor
Segment description base class to describe items which have 2 end points (track, wire,...
static TOOL_ACTION saveAs
void Append(SCH_ITEM *aItem)
void SetSheetNumberAndCount()
Set the m_ScreenNumber and m_NumberOfScreens members for screens.
static TOOL_ACTION toggleHiddenPins
void SortByReferenceOnly()
Sort the list of references by reference.
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
int ShowBusManager(const TOOL_EVENT &aEvent)
void SaveCopyInUndoList(SCH_SCREEN *aScreen, SCH_ITEM *aItemToCopy, UNDO_REDO aTypeCommand, bool aAppend)
Create a copy of the current schematic item, and put it in the undo list.
int Cut(const TOOL_EVENT &aEvent)
static TOOL_ACTION importFPAssignments
static wxString m_DrawingSheetFileName
the name of the drawing sheet file, or empty to use the default drawing sheet
static TOOL_ACTION assignNetclass
void RollbackSchematicFromUndo()
Perform an undo of the last edit WITHOUT logging a corresponding redo.
void SetRef(const SCH_SHEET_PATH *aSheet, const wxString &aReference)
Set the reference for the given sheet path for this symbol.
int RescueSymbols(const TOOL_EVENT &aEvent)
Perform rescue operations to recover old projects from before certain changes were made.
size_t GetCurrentHash() const
#define NAMELESS_PROJECT
default name for nameless projects
EE_RTREE & Items()
Gets the full RTree, usually for iterating.
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 SortByPageNumbers(bool aUpdateVirtualPageNums=true)
Sort the list of sheets by page number.
int ClearHighlight(const TOOL_EVENT &aEvent)
Update net highlighting after an edit.
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...
const std::string KiCadSchematicFileExtension
void ShowFindReplaceDialog(bool aReplace)
Run the Find or Find & Replace dialog.
void OnOpenPcbnew(wxCommandEvent &event)
#define NET_PLUGIN_CHANGE
Create and shows NETLIST_DIALOG and returns whatever NETLIST_DIALOG::ShowModal() returns.
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
void SetCrossProbeConnection(const SCH_CONNECTION *aConnection)
Send a connection (net or bus) to Pcbnew for highlighting.
void SetCurrentSheet(const SCH_SHEET_PATH &aPath) override
A base class for most all the KiCad significant classes used in schematics and boards.
static TOOL_ACTION drawSheetOnClipboard
SCH_ITEM * Parent() const
static TOOL_ACTION repairSchematic
int Undo(const TOOL_EVENT &aEvent)
static TOOL_ACTION enterSheet
std::vector< std::shared_ptr< SCH_CONNECTION > > & Members()
static TOOL_ACTION clearHighlight
SCH_SHEET_PATH & GetCurrentSheet() const
int RepairSchematic(const TOOL_EVENT &aEvent)
static const KICAD_T SymbolsOnly[]
static TOOL_ACTION editWithLibEdit
static TOOL_ACTION simProbe
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
static TOOL_ACTION editLibSymbolWithLibEdit
void PutDataInPreviousState(PICKED_ITEMS_LIST *aList)
Restore an undo or redo command to put data pointed by aList in the previous state.
void SendMessageToPCBNEW(EDA_ITEM *aObjectToSync, SCH_SYMBOL *aPart)
Send a message to Pcbnew via a socket connection.
static TOOL_ACTION generateBOM
CONNECTION_SUBGRAPH * GetSubgraphForItem(SCH_ITEM *aItem)
GAL_TYPE GetBackend() const
Return the type of backend currently used by GAL canvas.
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
static TOOL_ACTION highlightNet
void InvokeDialogBusManager(SCH_EDIT_FRAME *aCaller)
Create and show DIALOG_BUS_MANAGER.
static TOOL_ACTION schematicSetup
SCH_SCREEN * RootScreen() const
Helper to retrieve the screen of the root sheet.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
virtual void SetLabelSpinStyle(LABEL_SPIN_STYLE aSpinStyle)
Set a spin or rotation angle, along with specific horizontal and vertical justification styles with e...
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
void UpdateSymbolLinks(REPORTER *aReporter=nullptr)
Initialize the LIB_SYMBOL reference for each SCH_SYMBOL found in the full schematic.
void ShowSchematicSetupDialog(const wxString &aInitialPage=wxEmptyString)
static TOOL_ACTION editSymbolLibraryLinks
static TOOL_ACTION toggleForceHV
void FocusOnLocation(const wxPoint &aPos)
Useful to focus on a particular location, in find functions.
Is a LINE_READER that reads from a multiline 8 bit wide std::string.
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
int UpdateFromPCB(const TOOL_EVENT &aEvent)
bool m_RealTimeConnectivity
Do real-time connectivity.
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Base class for any item which can be embedded within the SCHEMATIC container class,...
static TOOL_ACTION findNext
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.
virtual void ClearUndoRedoList()
Clear the undo and redo list using ClearUndoORRedoList()
virtual const wxString & GetText() const
Return the string associated with the text object.
bool GetShowAllPins() const override
Allow edit frame to show/hide hidden pins.
static TOOL_ACTION duplicate
void MarkDirty()
Force redraw of view on the next rendering.
A helper to define a symbol's reference designator in a schematic.
PRIORITY GetDriverPriority()
std::vector< SCH_PIN * > GetPins(const SCH_SHEET_PATH *aSheet=nullptr) const
Retrieve a list of the SCH_PINs for the given sheet path.
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
int InvokeDialogNetList(SCH_EDIT_FRAME *aCaller)
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.
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...
int ExportNetlist(const TOOL_EVENT &aEvent)
void SetConnectivityDirty(bool aDirty=true)
KICAD_T Type() const
Returns the type of object.
bool AddInstance(const SCH_SHEET_PATH &aInstance)
Add a new instance aSheetPath to the instance list.
const LIB_ID & GetLibId() const
Field Name Module PCB, i.e. "16DIP300".
void SetListLabel(const wxString &aLabel)
The symbol library editor main window.
static TOOL_ACTION toggleHiddenFields