62#include <wx/filedlg.h>
63#include <wx/filename.h>
95 wxCommandEvent* evt =
new wxCommandEvent( EDA_EVT_CLOSE_ERC_DIALOG, wxID_ANY );
125 if( wxButton* okButton =
dynamic_cast<wxButton*
>( dlg->FindWindow( wxID_OK ) ) )
128 okButton->SetDefault();
174 wxCHECK( selectionTool, 0 );
183 if( dlg && dlg->IsShownOnScreen() )
204 if( !dlg->IsShownOnScreen() )
226 return wxEmptyString;
256 if( selection.GetSize() == 1 && selection.Front()->Type() ==
SCH_MARKER_T )
257 marker =
static_cast<SCH_MARKER*
>( selection.Front() );
272 if( marker !=
nullptr )
275 m_frame->GetCanvas()->GetView()->Update( marker );
276 m_frame->GetCanvas()->Refresh();
294 std::vector<wxString> messages;
295 const int grid_size =
KiROUND(
getView()->GetGAL()->GetGridSize().x );
299 if( messages.empty() )
307 for(
const wxString& single_msg : messages )
335 wxCHECK( schEditorFrame, 0 );
339 if( selection.
Empty() )
341 m_frame->ShowInfoBarError(
_(
"Select a symbol to diff against its library equivalent." ) );
354 wxCHECK( schEditorFrame, );
363 wxString symbolDesc = wxString::Format(
_(
"Symbol %s" ),
371 r->
Report( wxS(
"<h7>" ) +
_(
"Schematic vs library diff for:" ) + wxS(
"</h7>" ) );
373 + wxS(
"<li>" ) +
_(
"Library: " ) +
EscapeHTML( libName ) + wxS(
"</li>" )
374 + wxS(
"<li>" ) +
_(
"Library item: " ) +
EscapeHTML( symbolName )
375 + wxS(
"</li></ul>" ) );
383 r->
Report(
_(
"The library is not included in the current configuration." )
384 + wxS(
"  " )
385 + wxS(
"<a href='$CONFIG'>" ) +
_(
"Manage Symbol Libraries" ) + wxS(
"</a>" ) );
389 r->
Report(
_(
"The library is not enabled in the current configuration." )
390 + wxS(
"  " )
391 + wxS(
"<a href='$CONFIG'>" ) +
_(
"Manage Symbol Libraries" ) + wxS(
"</a>" ) );
395 std::unique_ptr<LIB_SYMBOL> flattenedLibSymbol;
401 flattenedLibSymbol = libAlias->Flatten();
407 if( !flattenedLibSymbol )
409 r->
Report( wxString::Format(
_(
"The library no longer contains the item %s." ),
414 std::vector<SCH_FIELD> fields;
418 fields.emplace_back(
SCH_FIELD( flattenedLibSymbol.get(), field.GetId(),
419 field.GetName(
false ) ) );
420 fields.back().CopyText( field );
421 fields.back().SetAttributes( field );
425 flattenedSchSymbol->SetFields( fields );
430 r->
Report(
_(
"No relevant differences detected." ) );
436 diff->
DisplayDiff( flattenedSchSymbol.release(), flattenedLibSymbol.release(),
444 dialog->
Show(
true );
450 wxBoxSizer* sizer =
new wxBoxSizer( wxVERTICAL );
455 sizer->Add( diffWidget, 1, wxEXPAND | wxALL, 5 );
456 aParentPanel->SetSizer( sizer );
457 aParentPanel->Layout();
466 std::map<KIID, KIGFX::COLOR4D>& aRefO, std::map<KIID, KIGFX::COLOR4D>& aCompO,
467 std::map<KIID, KICAD_DIFF::CATEGORY>& aCats )
475 if( !aChange.id.empty() )
477 const KIID& kiid = aChange.id.back();
480 switch( aChange.kind )
508 std::map<KIID, KIGFX::COLOR4D> aRefOverrides,
509 std::map<KIID, KIGFX::COLOR4D> aCompOverrides,
510 std::map<KIID, KICAD_DIFF::CATEGORY> aCategories,
513 auto holder = std::make_shared<std::vector<std::unique_ptr<SCH_ITEM>>>();
515 return [aRef, aComp, modifiedColor = aTheme.
modified, removedColor = aTheme.
removed,
516 refO = std::move( aRefOverrides ), compO = std::move( aCompOverrides ), cats = std::move( aCategories ),
522 if( !aSheetPath.empty() )
525 compScreen = sp->LastScreen();
528 refScreen = sp->LastScreen();
535 for(
const auto& [kiid, c] : refO )
537 if( c != removedColor )
542 if( item && item->m_Uuid == kiid )
544 if(
auto* clone =
dynamic_cast<SCH_ITEM*
>( item->Clone() ) )
545 holder->emplace_back( clone );
553 std::vector<KIGFX::VIEW_ITEM*> extras;
555 for(
const auto& clone : *holder )
556 extras.push_back( clone.get() );
569 wxCHECK( schEditorFrame, 0 );
571 wxFileDialog dlg( schEditorFrame,
_(
"Choose Schematic to Compare With" ), wxEmptyString,
573 wxFD_OPEN | wxFD_FILE_MUST_EXIST );
575 if( dlg.ShowModal() != wxID_OK )
578 wxFileName otherFn( dlg.GetPath() );
579 otherFn.MakeAbsolute();
584 _(
"Select a KiCad s-expression schematic file (.kicad_sch)." ) );
588 const wxString otherPath = otherFn.GetFullPath();
590 wxFileName projectFn = otherFn;
592 const wxString projectPath = projectFn.GetFullPath();
595 activeProjectFn.MakeAbsolute();
599 if( projectFn.SameAs( activeProjectFn ) )
602 _(
"Select a schematic file from another project to compare." ) );
611 const wxString& aComparisonLabel )
615 wxCHECK( schEditorFrame, 0 );
624 bool projectLoadOk = mgr->
LoadProject( aProjectPath,
false );
629 schEditorFrame->
ShowInfoBarError( wxString::Format(
_(
"Failed to load project for %s" ), aOtherPath ) );
633 if( !projectLoadOk && wxFileName( aProjectPath ).FileExists() )
636 schEditorFrame->
ShowInfoBarError( wxString::Format(
_(
"Failed to load project for %s" ), aOtherPath ) );
653 schEditorFrame->
ShowInfoBarError( wxString::Format(
_(
"Failed to load %s" ), aOtherPath ) );
665 if( loadedSchematic == mySch )
668 _(
"Select a schematic file from another project to compare." ) );
673 std::unique_ptr<SCHEMATIC> otherSchematic{ loadedSchematic };
675 if( !otherSchematic )
677 schEditorFrame->
ShowInfoBarError( wxString::Format(
_(
"Failed to load %s" ), aOtherPath ) );
687 const SCH_SHEET_LIST otherSheets = otherSchematic->BuildSheetListSortedByPageNumbers();
690 if(
auto sp = otherSchematic->Hierarchy().GetSheetPathByKIIDPath( scopeBefore,
true ) )
691 scopeAfter = sp->Path();
692 else if( !otherSheets.empty() )
693 scopeAfter = otherSheets.front().Path();
695 if( !scopeBefore.empty() && !scopeAfter.empty() )
696 differ.
SetScope( scopeBefore, scopeAfter );
702 std::map<KIID, KIGFX::COLOR4D> refOverrides;
703 std::map<KIID, KIGFX::COLOR4D> compOverrides;
704 std::map<KIID, KICAD_DIFF::CATEGORY> kiidCategories;
706 buildSchOverrides(
result, theme, refOverrides, compOverrides, kiidCategories );
713 auto initialSwitcher =
714 makeSchSwitcher( mySch, otherSchematic.get(), refOverrides, compOverrides, kiidCategories, theme );
721 std::move( compGeometry ), std::move( initialSwitcher ), std::move( initialSheet ) );
730 std::vector<std::unique_ptr<SCHEMATIC>> ownedSchs;
733 DRILL_STATE drillState;
735 drillState.compSch = otherSchematic.get();
736 drillState.compFile = aOtherPath;
737 drillState.ownedSchs.push_back( std::move( otherSchematic ) );
741 canvas->SetDoubleClickHandler(
742 [&dlgDiff, &drillState, mySch, otherPrj, theme, schEditorFrame](
KIGFX::VIEW_ITEM* aItem )
744 auto* sheet =
dynamic_cast<SCH_SHEET*
>( aItem );
751 if( sheetFile.IsEmpty() )
754 KIID_PATH newEditorKiid = drillState.editorPath.Path();
755 newEditorKiid.push_back( sheet->m_Uuid );
759 if( !newEditorSheet )
765 wxString compFile = drillState.compFile;
771 scopeAfter = compMatch->Path();
773 if(
SCH_SCREEN* compMatchScreen = compMatch->LastScreen() )
774 compFile = compMatchScreen->GetFileName();
778 wxFileName newCompFn( wxFileName( drillState.compFile ).GetPath(), sheetFile );
779 newCompFn.MakeAbsolute();
789 wxString::Format(
_(
"Failed to load %s" ), newCompFn.GetFullPath() ) );
795 if( !loadedSheets.empty() )
796 scopeAfter = loadedSheets.front().Path();
798 drillState.ownedSchs.emplace_back( loaded );
800 compFile = newCompFn.GetFullPath();
805 if( !scopeBefore.empty() && !scopeAfter.empty() )
806 newDiffer.
SetScope( scopeBefore, scopeAfter );
810 std::map<KIID, KIGFX::COLOR4D> newRefO;
811 std::map<KIID, KIGFX::COLOR4D> newCompO;
812 std::map<KIID, KICAD_DIFF::CATEGORY> newCats;
813 buildSchOverrides( newDiff, theme, newRefO, newCompO, newCats );
815 auto newSwitcher = makeSchSwitcher( mySch, compSch, newRefO, newCompO, newCats, theme );
817 drillState.editorPath = *newEditorSheet;
818 drillState.compSch = compSch;
819 drillState.compFile = compFile;
821 SCH_SCREEN* newRefScreen = newEditorSheet->LastScreen();
822 wxString newRefLabel = newRefScreen ? newRefScreen->
GetFileName() : wxString();
824 dlgDiff.
Reload( newRefLabel, compFile, std::move( newDiff ),
825 {}, {}, std::move( newSwitcher ),
834 for(
auto& sch : drillState.ownedSchs )
837 sch->SetProject(
nullptr );
840 drillState.ownedSchs.clear();
852 wxCHECK( schEditorFrame, 0 );
858 schEditorFrame->
ShowInfoBarError(
_(
"Save the schematic before comparing against local history." ) );
865 std::vector<LOCAL_HISTORY_SNAPSHOT_INFO> snapshots = history.
GetSnapshots( projectPath );
867 if( snapshots.empty() )
869 schEditorFrame->
ShowInfoBarError(
_(
"No local history snapshots for this project." ) );
877 auto relTo = [&](
const wxString& aFull )
879 wxFileName fn( aFull );
880 fn.MakeRelativeTo( projectPath );
881 return fn.GetFullPath( wxPATH_UNIX );
884 const wxString rootRel = relTo( mySch->
GetFileName() );
890 std::vector<LOCAL_HISTORY_SNAPSHOT_INFO> filtered;
891 wxString prevFingerprint;
895 wxString fingerprint = history.
TreeFingerprint( projectPath, s.hash, wxS(
".kicad_sch" ) );
897 if( fingerprint.IsEmpty() || fingerprint == prevFingerprint )
900 prevFingerprint = fingerprint;
901 filtered.push_back( s );
904 if( filtered.empty() )
906 schEditorFrame->
ShowInfoBarError(
_(
"No local history snapshots change this schematic." ) );
910 snapshots = std::move( filtered );
912 std::vector<wxString> labels;
916 wxString summary = s.summary.IsEmpty() ? s.message.BeforeFirst(
'\n' ) : s.summary;
917 labels.push_back( wxString::Format( wxS(
"%s (%s)" ), summary, s.hash.Left( 8 ) ) );
931 auto buildView = [&](
SCHEMATIC* aComp,
const wxString& aPath ) -> SCH_DIFF_VIEW
940 scopeAfter = sp->Path();
946 if( !sheets.empty() )
947 scopeAfter = sheets.front().Path();
950 if( !scopeBefore.empty() && !scopeAfter.empty() )
951 differ.
SetScope( scopeBefore, scopeAfter );
953 view.result = differ.
Diff();
955 std::map<KIID, KIGFX::COLOR4D> refO;
956 std::map<KIID, KIGFX::COLOR4D> compO;
957 std::map<KIID, KICAD_DIFF::CATEGORY> cats;
958 buildSchOverrides( view.result, theme, refO, compO, cats );
962 view.switcher = makeSchSwitcher( mySch, aComp, refO, compO, cats, theme );
968 std::unique_ptr<SCHEMATIC> curSch;
976 wxString drillCompFile;
977 std::vector<std::unique_ptr<SCHEMATIC>> drilledSchs;
979 auto cleanupCurrent = [&]()
981 for(
auto& sch : drilledSchs )
984 sch->SetProject(
nullptr );
991 curSch->SetProject(
nullptr );
1001 if( !curTempDir.IsEmpty() )
1003 wxFileName::Rmdir( curTempDir, wxPATH_RMDIR_RECURSIVE );
1010 auto loadRevision = [&](
int aIndex, std::unique_ptr<SCHEMATIC>& aSch,
PROJECT*& aPrj, wxString& aTempDir ) ->
bool
1012 const wxString hash = snapshots[aIndex].hash;
1014 dirFn.AssignDir( wxFileName::GetTempDir() );
1015 dirFn.AppendDir( wxS(
"kicad-history-" ) + hash.Left( 8 ) );
1016 const wxString tempDir = dirFn.GetPath();
1021 { wxS(
".kicad_sch" ), wxS(
".kicad_pro" ) } ) )
1023 wxFileName::Rmdir( tempDir, wxPATH_RMDIR_RECURSIVE );
1027 const wxString root = tempDir + wxS(
"/" ) + rootRel;
1028 const wxString proj = tempDir + wxS(
"/" ) + projRel;
1035 wxFileName::Rmdir( tempDir, wxPATH_RMDIR_RECURSIVE );
1049 wxFileName::Rmdir( tempDir, wxPATH_RMDIR_RECURSIVE );
1053 if( !loaded || loaded == mySch )
1056 wxFileName::Rmdir( tempDir, wxPATH_RMDIR_RECURSIVE );
1060 aSch.reset( loaded );
1066 auto loadView = [&](
int aIndex, std::unique_ptr<SCHEMATIC>& aSch,
PROJECT*& aPrj, wxString& aTempDir,
1067 SCH_DIFF_VIEW& aView ) ->
bool
1069 if( !loadRevision( aIndex, aSch, aPrj, aTempDir ) )
1074 aView = buildView( aSch.get(), aTempDir + wxS(
"/" ) + rootRel );
1078 aSch->SetProject(
nullptr );
1082 wxFileName::Rmdir( aTempDir, wxPATH_RMDIR_RECURSIVE );
1093 if( !loadView( 0, curSch, curPrj, curTempDir, view ) )
1095 schEditorFrame->
ShowInfoBarError(
_(
"Could not compare against the selected snapshot." ) );
1101 while( view.result.Empty() && startIndex + 1 <
static_cast<int>( snapshots.size() ) )
1103 std::unique_ptr<SCHEMATIC> nextSch;
1105 wxString nextTempDir;
1106 SCH_DIFF_VIEW nextView;
1108 if( !loadView( startIndex + 1, nextSch, nextPrj, nextTempDir, nextView ) )
1112 view = std::move( nextView );
1113 curSch = std::move( nextSch );
1115 curTempDir = nextTempDir;
1119 drillCompSch = curSch.get();
1120 drillCompFile = curTempDir + wxS(
"/" ) + rootRel;
1125 auto dlgDiff = std::make_unique<DIALOG_KICAD_DIFF>( schEditorFrame, referenceLabel, labels[startIndex], view.result,
1126 view.refGeom, view.compGeom, view.switcher, scopeBefore );
1132 canvas->SetDoubleClickHandler(
1135 auto* sheet =
dynamic_cast<SCH_SHEET*
>( aItem );
1137 if( !sheet || sheet->GetFileName().IsEmpty() )
1141 newEditorKiid.push_back( sheet->m_Uuid );
1145 if( !newEditorSheet )
1149 wxString compFile = drillCompFile;
1150 KIID_PATH drillScopeBefore = newEditorKiid;
1155 drillScopeAfter = compMatch->Path();
1157 if(
SCH_SCREEN* matchScreen = compMatch->LastScreen() )
1158 compFile = matchScreen->GetFileName();
1162 wxFileName subFn( wxFileName( drillCompFile ).GetPath(), sheet->GetFileName() );
1163 subFn.MakeAbsolute();
1178 if( !loaded || loaded == mySch )
1181 wxString::Format(
_(
"Failed to load %s" ), subFn.GetFullPath() ) );
1187 if( !loadedSheets.empty() )
1188 drillScopeAfter = loadedSheets.front().Path();
1190 drilledSchs.emplace_back( loaded );
1192 compFile = subFn.GetFullPath();
1199 if( !drillScopeBefore.empty() && !drillScopeAfter.empty() )
1200 newDiffer.
SetScope( drillScopeBefore, drillScopeAfter );
1204 std::map<KIID, KIGFX::COLOR4D> newRefO;
1205 std::map<KIID, KIGFX::COLOR4D> newCompO;
1206 std::map<KIID, KICAD_DIFF::CATEGORY> newCats;
1207 buildSchOverrides( newDiff, theme, newRefO, newCompO, newCats );
1209 auto newSwitcher = makeSchSwitcher( mySch, compSch, newRefO, newCompO, newCats, theme );
1211 SCH_SCREEN* newRefScreen = newEditorSheet->LastScreen();
1212 wxString newRefLabel = newRefScreen ? newRefScreen->
GetFileName() : wxString();
1214 dlgDiff->Reload( newRefLabel, compFile, std::move( newDiff ), {},
1215 {}, std::move( newSwitcher ), drillScopeBefore );
1219 schEditorFrame->
ShowInfoBarError(
_(
"Could not open this sheet for comparison." ) );
1223 drillEditorPath = *newEditorSheet;
1224 drillCompSch = compSch;
1225 drillCompFile = compFile;
1229 dlgDiff->SetRevisionChooser( labels, startIndex,
1232 std::unique_ptr<SCHEMATIC> newSch;
1234 wxString newTempDir;
1235 SCH_DIFF_VIEW newView;
1237 if( !loadView( aIndex, newSch, newPrj, newTempDir, newView ) )
1240 _(
"Could not compare against the selected snapshot." ) );
1244 dlgDiff->Reload( referenceLabel, labels[aIndex], newView.result, newView.refGeom,
1245 newView.compGeom, newView.switcher, scopeBefore );
1248 view = std::move( newView );
1249 curSch = std::move( newSch );
1251 curTempDir = newTempDir;
1255 drillCompSch = curSch.get();
1256 drillCompFile = curTempDir + wxS(
"/" ) + rootRel;
1259 dlgDiff->ShowModal();
1277 blocking_win->Close(
true );
1279 simFrame->Show(
true );
1282 if( simFrame->IsIconized() )
1283 simFrame->Iconize(
false );
1294 std::vector<EMBEDDED_FILES*> filesStack;
1304 filesStack.push_back( symbol );
1314 filesStack.push_back( entry );
1320 if( selection.
Empty() )
1329 filesStack.push_back( symbol->
Schematic() );
1337 m_frame->ShowInfoBarError(
_(
"No datasheet defined." ) );
1358 if( symbolEditFrame || schEditFrame )
1360 if( selection.GetSize() == 1 )
1363 std::vector<MSG_PANEL_ITEM> msgItems;
1366 msgItems.emplace_back(
_(
"UUID" ), *uuid );
1369 m_frame->SetMsgPanel( msgItems );
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
static TOOL_ACTION excludeMarker
static TOOL_ACTION nextMarker
static TOOL_ACTION showDatasheet
static TOOL_ACTION prevMarker
wxPanel * AddBlankPage(const wxString &aTitle)
WX_HTML_REPORT_BOX * AddHTMLPage(const wxString &aTitle)
void SetUserItemID(const KIID &aID)
void ExcludeMarker(SCH_MARKER *aMarker=nullptr)
Exclude aMarker from the ERC list.
void SelectMarker(const SCH_MARKER *aMarker)
File-compare dialog (Phase 7).
std::function< void(WIDGET_DIFF_CANVAS &, const KIID_PATH &)> SHEET_SWITCHER
WIDGET_DIFF_CANVAS * DiffCanvas() const
void Reload(const wxString &aReferencePath, const wxString &aComparisonPath, KICAD_DIFF::DOCUMENT_DIFF aDiff, KICAD_DIFF::DOCUMENT_GEOMETRY aReferenceGeometry, KICAD_DIFF::DOCUMENT_GEOMETRY aComparisonGeometry, SHEET_SWITCHER aSheetSwitcher, KIID_PATH aInitialSheet)
Swap in a fresh diff with new schematics.
bool Show(bool show) override
SETTINGS_MANAGER * GetSettingsManager() const
void ShowInfoBarError(const wxString &aErrorMsg, bool aShowCloseButton=false, INFOBAR_MESSAGE_TYPE aType=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...
A base class for most all the KiCad significant classes used in schematics and boards.
KICAD_T Type() const
Returns the type of object.
virtual void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList)
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
static SCHEMATIC * LoadSchematic(const wxString &aFileName, bool aSetActive, bool aForceDefaultProject, PROJECT *aProject=nullptr, bool aCalculateConnectivity=true)
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
void AddHTML_Text(const wxString &message)
Add HTML text (without any change) to message list.
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Diff two already-parsed SCHEMATICs and produce a DOCUMENT_DIFF.
void SetScope(const KIID_PATH &aBeforeScope, const KIID_PATH &aAfterScope)
Restrict the diff to one sheet on each side.
DOCUMENT_DIFF Diff() override
Produce a DOCUMENT_DIFF of the inputs the concrete differ was constructed with.
An abstract base class for deriving all objects that can be added to a VIEW.
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.
wxWindow * GetBlockingDialog()
Gets the window pointer to the blocking dialog (to send it signals)
LOCAL_HISTORY & LocalHistory()
Return the LOCAL_HISTORY associated with this KIWAY.
bool HasLibrary(const wxString &aNickname, bool aCheckEnabled=false) const
Test for the existence of aNickname in the library tables.
A logical library item identifier and consists of various portions much like a URI.
const UTF8 & GetLibItemName() const
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Define a library symbol object.
SCH_FIELD & GetDatasheetField()
Return reference to the datasheet field.
std::unique_ptr< LIB_SYMBOL > Flatten() const
Return a flattened symbol inheritance to the caller.
Simple local history manager built on libgit2.
std::vector< LOCAL_HISTORY_SNAPSHOT_INFO > GetSnapshots(const wxString &aProjectPath)
Snapshots (commits) for the project, newest first.
wxString TreeFingerprint(const wxString &aProjectPath, const wxString &aHash, const wxString &aExtension)
Fingerprint of all files ending in aExtension recorded by commit aHash (sorted path:blob pairs).
bool ExtractAllFilesAtCommit(const wxString &aProjectPath, const wxString &aHash, const wxString &aDestDir, const std::vector< wxString > &aExtensions={})
Write files recorded at aHash into aDestDir, recreating the project's relative folder structure.
void SetExcluded(bool aExcluded, const wxString &aComment=wxEmptyString)
static SYMBOL_LIBRARY_ADAPTER * SymbolLibAdapter(PROJECT *aProject)
Accessor for project symbol library manager adapter.
static SEARCH_STACK * SchSearchS(PROJECT *aProject)
Accessor for Eeschema search stack.
Container for project specific data.
virtual const wxString GetProjectFullName() const
Return the full path and name of the project.
virtual const wxString GetProjectPath() const
Return the full path of the project.
Holds all the data relating to one schematic.
SCH_SHEET_LIST BuildSheetListSortedByPageNumbers() const
wxString GetFileName() const
Helper to retrieve the filename from the root sheet screen.
SCH_SHEET_LIST Hierarchy() const
Return the full schematic flattened hierarchical sheet list.
SCH_SCREEN * RootScreen() const
Helper to retrieve the screen of the root sheet.
SCH_SHEET_PATH & CurrentSheet() const
static TOOL_ACTION compareSchematicWithHistory
static TOOL_ACTION showBusSyntaxHelp
static TOOL_ACTION checkSymbol
static TOOL_ACTION compareSchematicWithFile
static TOOL_ACTION showSimulator
static TOOL_ACTION runERC
Inspection and Editing.
static TOOL_ACTION diffSymbol
A shim class between EDA_DRAW_FRAME and several derived classes: SYMBOL_EDIT_FRAME,...
static SELECTION_CONDITION SingleSymbol
static SELECTION_CONDITION SingleNonExcludedMarker
Schematic editor (Eeschema) main window.
void UpdateHierarchySelection()
Update the hierarchy navigation tree selection (cross-probe from schematic to hierarchy pane).
SCH_SHEET_PATH & GetCurrentSheet() const
SCHEMATIC & Schematic() const
DIALOG_BOOK_REPORTER * GetSymbolDiffDialog()
DIALOG_ERC * GetErcDialog()
EDA_ITEM * ResolveItem(const KIID &aId, bool aAllowNullptrReturn=false) const override
Fetch an item by KIID.
void UpdateNetHighlightStatus()
virtual const wxString & GetText() const override
Return the string associated with the text object.
wxString GetShownText(const SCH_SHEET_PATH *aPath, bool aAllowExtraText, int aDepth=0, const wxString &aVariantName=wxEmptyString) const
Base class for any item which can be embedded within the SCHEMATIC container class,...
SCHEMATIC * Schematic() const
Search the item hierarchy to find a SCHEMATIC.
EE_RTREE & Items()
Get the full RTree, usually for iterating.
const wxString & GetFileName() const
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
std::optional< SCH_SHEET_PATH > GetSheetPathByKIIDPath(const KIID_PATH &aPath, bool aIncludeLastSheet=true) const
Finds a SCH_SHEET_PATH that matches the provided KIID_PATH.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
KIID_PATH Path() const
Get the sheet path as an KIID_PATH.
SCH_SCREEN * LastScreen()
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.
void GetFields(std::vector< SCH_FIELD * > &aVector, bool aVisibleOnly) const override
Populate a std::vector with SCH_FIELDs, sorted in ordinal order.
VECTOR2I GetPosition() const override
const LIB_ID & GetLibId() const override
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
SCH_FIELD * GetField(FIELD_T aFieldType)
Return a mandatory field in this symbol.
static HTML_MESSAGE_BOX * ShowSyntaxHelp(wxWindow *aParentWindow)
static bool Idle(const SELECTION &aSelection)
Test if there no items selected or being edited.
virtual unsigned int GetSize() const override
Return the number of stored items.
bool Empty() const
Checks if there is anything selected.
bool LoadProject(const wxString &aFullPath, bool aSetActive=true)
Load a project or sets up a new project with a specified path.
bool IsProjectLoaded(PROJECT *aProject) const
True if aProject is still owned by the manager.
PROJECT * GetProject(const wxString &aFullPath) const
Retrieve a loaded project by name.
bool UnloadProject(PROJECT *aProject, bool aSave=true)
Save, unload and unregister the given PROJECT.
The SIMULATOR_FRAME holds the main user-interface for running simulations.
The symbol library editor main window.
An interface to the global shared library manager that is schematic-specific and linked to one projec...
LIB_SYMBOL * LoadSymbol(const wxString &aNickname, const wxString &aName)
Load a LIB_SYMBOL having aName from the library given by aNickname.
Symbol library viewer main window.
A slimmed down version of WX_HTML_REPORT_PANEL.
REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED) override
Report a string with a given severity.
void Flush()
Build the HTML messages page.
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
This file is part of the common library.
bool GetAssociatedDocument(wxWindow *aParent, const wxString &aDocName, PROJECT *aProject, SEARCH_STACK *aPaths, std::vector< EMBEDDED_FILES * > aFilesStack)
Open a document (file) with the suitable browser.
This file is part of the common library.
@ ERCE_BUS_TO_NET_CONFLICT
A bus wire is graphically connected to a net port/pin (or vice versa).
@ ERCE_LIB_SYMBOL_MISMATCH
Symbol doesn't match copy in library.
@ FRAME_SCH_SYMBOL_EDITOR
static const std::string ProjectFileExtension
static const std::string KiCadSchematicFileExtension
static wxString KiCadSchematicFileWildcard()
std::optional< wxString > GetMsgPanelDisplayUuid(const KIID &aKiid)
Get a formatted UUID string for display in the message panel, according to the current advanced confi...
void ConfigureSchDiffCanvasContext(WIDGET_DIFF_CANVAS &aCanvas, SCHEMATIC *aReference, SCHEMATIC *aComparison, const KIGFX::COLOR4D &aColor, const std::map< KIID, KIGFX::COLOR4D > &aOverrides, const std::vector< KIGFX::VIEW_ITEM * > &aExtraItems, const std::map< KIID, KICAD_DIFF::CATEGORY > &aCategories, SCH_SCREEN *aReferenceScreen, SCH_SCREEN *aComparisonScreen)
DOCUMENT_GEOMETRY ExtractSchematicGeometry(const SCHEMATIC &aSchematic, const KIGFX::COLOR4D &aColor, const std::map< KIID, KIGFX::COLOR4D > &aOverrides, bool aOnlyOverrides)
Extract a coarse outline of a SCHEMATIC into a DOCUMENT_GEOMETRY for use as background context in DIF...
CATEGORY CategoryFor(CHANGE_KIND aKind)
Map a CHANGE_KIND to the visual category it belongs to.
wxString EscapeHTML(const wxString &aString)
Return a new wxString escaped for embedding in HTML.
KIGFX::COLOR4D reference
Default color for source-document context geometry.
KIGFX::COLOR4D comparison
The full set of changes between two parsed documents of one type.
std::vector< ITEM_CHANGE > changes
Aggregate of background geometry extracted from one source document.
One change record on a single item.
std::vector< ITEM_CHANGE > children
void CheckLibSymbol(LIB_SYMBOL *aSymbol, std::vector< wxString > &aMessages, int aGridForPins, UNITS_PROVIDER *aUnitsProvider)
Check a library symbol to find incorrect settings.
@ DATASHEET
name of datasheet
@ REFERENCE
Field Reference of part, i.e. "IC21".
wxString result
Test unit parsing edge cases and error handling.
Definition of file extensions used in Kicad.