35#include <wx/srchctrl.h>
37#include <wx/clntdata.h>
108#include <unordered_set>
117#include <wx/cmdline.h>
119#include <wx/filedlg.h>
120#include <wx/socket.h>
128#include <wx/choicdlg.h>
129#include <wx/textdlg.h>
130#include <wx/generic/treectlg.h>
133#define DIFF_SYMBOLS_DIALOG_NAME wxT( "DiffSymbolsDialog" )
191 wxIconBundle icon_bundle;
194 icon_bundle.AddIcon( icon );
196 icon_bundle.AddIcon( icon );
198 icon_bundle.AddIcon( icon );
200 icon_bundle.AddIcon( icon );
202 icon_bundle.AddIcon( icon );
204 SetIcons( icon_bundle );
254 .Bottom().Layer( 6 ) );
258 .Caption(
_(
"Schematic Hierarchy" ) )
259 .Left().Layer( 3 ).Position( 1 )
260 .TopDockable(
false )
261 .BottomDockable(
false )
263 .MinSize( FromDIP( wxSize( 120, 60 ) ) )
264 .BestSize( FromDIP( wxSize( 200, 200 ) ) )
265 .FloatingSize( FromDIP( wxSize( 200, 200 ) ) )
266 .FloatingPosition( FromDIP( wxPoint( 50, 50 ) ) )
278 .Left().Layer( 2 ) );
281 .Right().Layer( 2 ) );
290 .Caption(
_(
"Search" ) )
292 .MinSize( FromDIP( wxSize( 180, 60 ) ) )
293 .BestSize( FromDIP( wxSize( 180, 100 ) ) )
294 .FloatingSize( FromDIP( wxSize( 480, 200 ) ) )
296 .DestroyOnClose(
false )
304 .Caption(
_(
"Version Control" ) )
306 .MinSize( wxSize(
m_gitCommitPane->GetMinDockWidth(), FromDIP( 120 ) ) )
307 .BestSize( wxSize( std::max(
m_gitCommitPane->GetMinDockWidth(), FromDIP( 300 ) ),
309 .FloatingSize( FromDIP( wxSize( 300, 400 ) ) )
310 .DestroyOnClose(
false )
323 wxAuiPaneInfo& selectionFilterPane =
m_auimgr.GetPane( wxS(
"SelectionFilter" ) );
334 remoteSymbolPane.Show(
false );
341 selectionFilterPane.dock_proportion = 0;
364 hierarchy_pane.Float();
383 netNavigatorPane.Float();
415 hierarchy_pane.Fixed();
417 netNavigatorPane.Fixed();
421 hierarchy_pane.Resizable();
422 netNavigatorPane.Resizable();
427 hierarchy_pane.MinSize( FromDIP( wxSize( 120, 60 ) ) );
428 netNavigatorPane.MinSize( FromDIP( wxSize( 120, 60 ) ) );
445 GetCanvas()->GetGAL()->SetAxesEnabled(
false );
474 m_apiHandler = std::make_unique<API_HANDLER_SCH>(
this );
496 DragAcceptFiles(
true );
503 wxPoint canvas_pos =
GetCanvas()->GetScreenPosition();
504 hierarchy_pane.FloatingPosition( canvas_pos.x + 10, canvas_pos.y + 10 );
514 if( !
eeconfig()->m_CrossProbing.flash_selection )
516 wxLogTrace(
traceCrossProbeFlash,
"StartCrossProbeFlash: aborted (setting disabled) items=%zu", aItems.size() );
533 wxLogTrace(
traceCrossProbeFlash,
"StartCrossProbeFlash: starting with %zu items", aItems.size() );
634 GetCanvas()->SetEvtHandlerEnabled(
false );
671 catch(
const std::runtime_error& e )
673 wxFAIL_MSG( wxString::Format( wxT(
"Settings exception occurred: %s" ), e.what() ) );
719 if( hierarchy_pane.rect.width > 50 )
722 hierarchy_pane.best_size.x = hierarchy_pane.rect.width;
784 auto searchPaneCond =
790 auto gitCommitPaneCond = [
this](
const SELECTION& )
795 auto propertiesCond =
801 auto hierarchyNavigatorCond =
807 auto netNavigatorCond =
813 auto designBlockCond =
819 auto remoteSymbolCond =
834 auto groupWithDesignBlockLink =
837 if( aSel.Size() != 1 )
845 return group->HasDesignBlockLink();
848#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
849#define CHECK( x ) ACTION_CONDITIONS().Check( x )
900 auto showHiddenPinsCond =
906 auto showHiddenFieldsCond =
913 auto showDirectiveLabelsCond =
920 auto showERCErrorsCond =
927 auto showERCWarningsCond =
934 auto showERCExclusionsCond =
941 auto markSimExclusionsCond =
948 auto showOPVoltagesCond =
955 auto showOPCurrentsCond =
962 auto showPinAltModeIconsCond =
969 auto showAnnotateAutomaticallyCond =
975 auto remapSymbolsCondition =
981 return schematic.HasNoFullyDefinedLibIds();
984 auto belowRootSheetCondition =
988 return navigateTool && navigateTool->
CanGoUp();
1018#define CURRENT_TOOL( action ) mgr->SetConditions( action, CHECK( cond.CurrentTool( action ) ) )
1086 repeatItem->ClearFlags();
1087 repeatItem->SetParent(
nullptr );
1156 "SCH_EDIT_FRAME::SetCurrentSheet: Changing from path='%s' (size=%zu) to path='%s' (size=%zu)",
1174 item->ClearCaches();
1176 for(
const std::pair<const wxString, LIB_SYMBOL*>& libSymbol : screen->
GetLibSymbols() )
1178 wxCHECK2( libSymbol.second,
continue );
1179 libSymbol.second->ClearCaches();
1182 if(
Schematic().Settings().m_IntersheetRefsShow )
1215 if(
Kiface().IsSingle() )
1219 if( symbolEditor && !symbolEditor->Close() )
1224 if( symbolViewer && !symbolViewer->Close() )
1231 if( chooser && !chooser->Close() )
1238 if( symbolEditor && symbolEditor->IsSymbolFromSchematic() )
1240 if( !symbolEditor->CanCloseSymbolFromSchematic(
true ) )
1261 wxString msg =
_(
"Save changes to '%s' before closing?" );
1266 return SaveProject();
1278 if( !projPath.IsEmpty() &&
Kiway().LocalHistory().HistoryExists( projPath ) )
1281 wxS(
"Discard unsaved schematic changes" ) );
1306 if( !
Prj().IsNullProject() )
1308 std::vector<wxString> sheetSrcs;
1309 sheetSrcs.reserve( sheetlist.size() );
1319 sheetSrcs.push_back(
Prj().AbsolutePath( screen->
GetFileName() ) );
1351 if(
Prj().GetLocalSettings().ShouldAutoSave() )
1359 if( hierarchy_pane.IsShown() && hierarchy_pane.IsFloating() )
1361 hierarchy_pane.Show(
false );
1418 if(
GetScreen() && !GetTitle().StartsWith( wxS(
"*" ) ) )
1425 if(
Kiface().IsSingle() )
1427 DisplayError(
this,
_(
"Cannot update the PCB because the Schematic Editor is opened in stand-alone "
1428 "mode. In order to create/update PCBs from schematics, launch the main KiCad "
1429 "application and create a project." ) );
1434 wxEventBlocker blocker(
this );
1439 fn.SetExt( FILEEXT::PcbFileExtension );
1451 if( !frame->IsVisible() )
1452 frame->Show(
true );
1455 if( frame->IsIconized() )
1456 frame->Iconize(
false );
1460 std::string payload;
1471 if( aRefreshNetNavigator )
1494 if( !filename.IsEmpty() )
1508 if( !
Kiface().IsSingle() )
1518 if( dlg.ShowModal() != wxID_CANCEL )
1523 if( create_me.FileExists() )
1526 msg.Printf(
_(
"Schematic file '%s' already exists." ), create_me.GetFullName() );
1532 wxASSERT_MSG( create_me.IsAbsolute(), wxS(
"wxFileDialog returned non-absolute path" ) );
1543 if( !
Kiface().IsSingle() )
1551 wxFileDialog dlg(
this,
_(
"Open Schematic" ), pro_dir, wxEmptyString, wildcards,
1552 wxFD_OPEN | wxFD_FILE_MUST_EXIST );
1556 if( dlg.ShowModal() != wxID_CANCEL )
1587 [
this](
const wxString& aProjectPath, std::vector<HISTORY_FILE_DATA>& aFileData )
1589 m_schematic->SaveToHistory( aProjectPath, aFileData );
1602 wxFileName kicad_board =
1605 if( kicad_board.IsOk() && !kicad_board.GetName().IsEmpty() )
1607 kicad_board.SetExt( FILEEXT::PcbFileExtension );
1608 wxFileName legacy_board( kicad_board );
1610 wxFileName& boardfn = legacy_board;
1612 if( !legacy_board.FileExists() || kicad_board.FileExists() )
1613 boardfn = kicad_board;
1615 if(
Kiface().IsSingle() )
1621 wxEventBlocker blocker(
this);
1633 frame->
OpenProjectFiles( std::vector<wxString>( 1, boardfn.GetFullPath() ) );
1636 if( !frame->IsVisible() )
1637 frame->Show(
true );
1640 if( frame->IsIconized() )
1641 frame->Iconize(
false );
1658 if( !
ReadyToNetlist(
_(
"Assigning footprints requires a fully annotated schematic." ) ) )
1674 player->Show(
true );
1690 if( event.GetId() == wxID_EXIT )
1693 if( event.GetId() == wxID_CLOSE ||
Kiface().IsSingle() )
1704 wxString variant =
m_schematic->GetCurrentVariant();
1717 auto invalidateTextVars =
1720 if(
text->HasTextVars() )
1722 text->ClearRenderCache();
1723 text->ClearBoundingBoxCache();
1730 item->RunOnChildren(
1731 [&invalidateTextVars](
SCH_ITEM* aChild )
1734 invalidateTextVars(
text );
1740 invalidateTextVars(
text );
1766 wxString ref = symbol->
GetRef( &sheetPath );
1767 std::vector<SCH_PIN*> pins = symbol->
GetPins( &sheetPath );
1776 if( !
pin->GetOperatingPoint().IsEmpty() )
1779 pin->SetOperatingPoint( wxEmptyString );
1782 if( pins.size() == 2 )
1786 if( !op.IsEmpty() && op != wxS(
"--" ) && op != wxS(
"?" ) )
1788 pins[0]->SetOperatingPoint( op );
1794 std::vector<EMBEDDED_FILES*> embeddedFilesStack;
1795 embeddedFilesStack.push_back(
m_schematic->GetEmbeddedFiles() );
1799 embeddedFilesStack.push_back( symbolEmbeddedFiles );
1809 ref =
model.SpiceGenerator().ItemName( spiceItem );
1811 for(
const auto& modelPin :
model.GetPins() )
1813 SCH_PIN* symbolPin = symbol->
GetPin( modelPin.get().symbolPinNumber );
1814 wxString netChainName = ref + wxS(
":" ) + modelPin.get().modelPinName;
1818 if( symbolPin && !op.IsEmpty() && op != wxS(
"--" ) && op != wxS(
"?" ) )
1828 for(
const auto& [ key, subgraphList ] :
m_schematic->m_connectionGraph->GetNetMap() )
1832 if( !op.IsEmpty() && op != wxS(
"--" ) && op != wxS(
"?" ) )
1837 double length = 0.0;
1839 if( subgraph->GetSheet().GetExcludedFromSim( variant ) )
1842 for(
SCH_ITEM* item : subgraph->GetItems() )
1886 if( otherLabel != label && otherLabel->
GetText() == label->
GetText() )
1906 bool readOnly =
false;
1907 bool unsaved =
false;
1917 title += fn.GetName();
1921 if( sheetPath != fn.GetName() )
1922 title += wxString::Format( wxT(
" [%s]" ), sheetPath );
1925 title += wxS(
" " ) +
_(
"[Read Only]" );
1928 title += wxS(
" " ) +
_(
"[Unsaved]" );
1932 title =
_(
"[no schematic loaded]" );
1935 title += wxT(
" \u2014 " ) +
_(
"Schematic Editor" );
1954 bool hasHighlightedConn = !highlightedConn.IsEmpty();
1955 bool itemsChanged =
false;
1957 std::function<void(
SCH_ITEM* )> changeHandler =
1958 [&](
SCH_ITEM* aChangedItem ) ->
void
1960 itemsChanged =
true;
1971 if( !hasHighlightedConn )
1977 else if( connection && ( connection->
Name() == highlightedConn
1995 catch(
const std::exception& error )
2001 wxLogTrace( wxS(
"KICAD_CONNECTIVITY" ), wxS(
"Connectivity recalculation failed: %s" ),
2002 wxString::FromUTF8( error.what() ) );
2010 || ( !itemsChanged &&
Schematic().Connectivity().Published().Changes().Empty() ) )
2045 std::set<KIID> repaintItems;
2046 const auto* changes = aChanges;
2055 if(
const auto instance = facade.Keys().FindInstance(
GetCurrentSheet().PathRef() ) )
2057 for(
const auto* items : { &changes->changedItems, &changes->driverChangedItems } )
2059 for(
const auto& key : *items )
2061 if( key.inst == *instance )
2062 repaintItems.insert( key.item );
2075 auto invalidateTextVars =
2078 if(
text->HasTextVars() )
2080 text->ClearRenderCache();
2081 text->ClearBoundingBoxCache();
2092 if( item && repaintItems.contains( item->
m_Uuid ) )
2098 [&invalidateTextVars](
SCH_ITEM* aChild )
2101 invalidateTextVars(
text );
2110 invalidateTextVars(
text );
2115 const bool changed = useEngine && !changes->Empty();
2117 const bool exists = useEngine ? highlightedConn.IsEmpty()
2129 std::vector<wxString> names;
2131 for(
auto name : changes->netsChanged )
2132 names.push_back( facade.Keys().Name(
name ) );
2203 item->ClearCaches();
2214 for(
const auto& [ libItemName, libSymbol ] : screen->
GetLibSymbols() )
2215 libSymbol->ClearCaches();
2247 bool panel_shown = design_blocks_pane_info.IsShown();
2248 design_blocks_pane_info.Caption(
_(
"Design Blocks" ) );
2249 design_blocks_pane_info.Show( panel_shown );
2268#if defined( __WXMSW__ )
2282 for(
const wxString& n : sig->GetNets() )
2284 if( !nets.IsEmpty() )
2285 nets += wxT(
", " );
2290 SetStatusText( wxString::Format(
_(
"Net chain members: %s" ), nets ) );
2297 SetStatusText( wxString::Format(
_(
"Highlighted net: %s" ),
2302 SetStatusText( wxT(
"" ) );
2333 if( aIncludeAllVisible )
2349 if( item != dsAsItem )
2350 bBoxDoc.
Merge( item->GetBoundingBox() );
2374 if( aItem !=
nullptr && !aItem->
IsSCH_ITEM() )
2381 if( lastItem && lastItem != aItem )
2386 lastBrightenedItemID =
niluuid;
2396 lastBrightenedItemID = aItem->
m_Uuid;
2416 const KIID& aSchematicSymbolUUID )
2424 if( !principalSymbol )
2427 wxString principalRef;
2429 if( principalSymbol->
IsAnnotated( &principalPath ) )
2430 principalRef = principalSymbol->
GetRef( &principalPath,
false );
2432 std::vector< std::pair<SCH_SYMBOL*, SCH_SHEET_PATH> > allUnits;
2440 if( candidateSymbol == principalSymbol
2442 && candidateSymbol->
GetRef( &
path,
false ) == principalRef ) )
2444 allUnits.emplace_back( candidateSymbol,
path );
2449 for(
auto& [ unit,
path ] : allUnits )
2453 path.LastScreen()->Remove( unit );
2455 if( !unit->IsNew() )
2458 unit->SetLibSymbol( aSymbol.
Flatten().release() );
2466 path.LastScreen()->Append( unit );
2473 wxString altName =
pin->GetAlt();
2475 if( altName.IsEmpty() )
2478 if(
pin->GetAlternates().count( altName ) == 0 )
2479 pin->SetAlt( wxEmptyString );
2482 if( !commit.
Empty() )
2483 commit.
Push(
_(
"Save Symbol to Schematic" ) );
2494 sch_item->ClearCaches();
2526 wxCHECK( selectionTool, );
2535 item->SetForceVisible(
true );
2538 else if( item->IsBrightened() )
2540 item->SetForceVisible(
false );
2549 item->RunOnChildren(
2577 wxCHECK( editTool, );
2596 _(
"Compare Symbol with Library" ) );
2611 if( aEvent.GetId() == wxID_APPLY )
2616 [
this, symbolUUID]()
2625 dlg.ShowQuasiModal();
2693 if( dlg->WasAborted() )
2744 wxPanel* panel =
new wxPanel(
this );
2746 wxBoxSizer* sizer =
new wxBoxSizer( wxVERTICAL );
2749 wxBoxSizer* searchSizer =
new wxBoxSizer( wxHORIZONTAL );
2761 sizer->Add( searchSizer, 0, wxEXPAND | wxALL, FromDIP( 2 ) );
2764 wxTR_DEFAULT_STYLE | wxNO_BORDER );
2765 sizer->Add(
m_netNavigator, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP( 2 ) );
2767 panel->SetSizer( sizer );
2769 panel->Bind( wxEVT_SHOW,
2770 [
this]( wxShowEvent& event )
2774 if( event.IsShown() )
2793 [
this]( wxMouseEvent& event )
2797 _(
"Wildcard Search" ) );
2799 _(
"Regex Search" ) );
2804 wildcardItem->Check();
2822 bool aForceNetNavigatorRefresh )
2828 if( connectionChanged || aForceNetNavigatorRefresh )
2844 bool refreshSelection = selection.IsOk() && selection !=
m_netNavigator->GetRootItem();
2846 if( refreshSelection )
2878 if( selection.IsOk() )
2883 selectionData = *tmp;
2884 selectionPtr = &selectionData;
2896 if( aEvent.GetKeyCode() == WXK_ESCAPE )
2926 wxPoint screenPos = aEvent.GetPosition();
2928 if( screenPos == wxDefaultPosition )
2929 screenPos = wxGetMousePosition();
2950 _(
"Find in Net Inspector" ) );
2951 menu.Append( findInInspector );
2957 wxTreeItemId netItem = aItem;
2963 while( parent.IsOk() && parent !=
m_netNavigator->GetRootItem() )
2971 if( wxStringClientData* data =
2972 dynamic_cast<wxStringClientData*
>(
m_netNavigator->GetItemData( netItem ) ) )
2974 netName = data->GetData();
2980 if( wxStringClientData* data =
2981 dynamic_cast<wxStringClientData*
>(
m_netNavigator->GetItemData( netItem ) ) )
2983 netName = data->GetData();
2996 if( netName.IsEmpty() )
2998 findInInspector->Enable(
false );
3015 switch( aEvent.GetId() )
3052 aEvent.Skip(
false );
3061 wxAuiPaneInfo& selectionFilterPane =
m_auimgr.GetPane( wxS(
"SelectionFilter" ) );
3065 bool showFilter = ( hierarchyPane.IsShown() && hierarchyPane.IsDocked() )
3066 || ( netNavigatorPane.IsShown() && netNavigatorPane.IsDocked() )
3067 || ( propertiesPane.IsShown() && propertiesPane.IsDocked() );
3069 selectionFilterPane.Show( showFilter );
3075 wxLogTrace(
traceApi,
"SCH frame: EDA_EVT_PLUGIN_AVAILABILITY_CHANGED" );
3130 propertiesPaneInfo.Show( show );
3156 hierarchy_pane.Show( !hierarchy_pane.IsShown() );
3160 if( hierarchy_pane.IsShown() )
3162 if( hierarchy_pane.IsFloating() )
3176 if( hierarchy_pane.IsFloating() )
3199 db_library_pane.Show( !db_library_pane.IsShown() );
3201 if( db_library_pane.IsShown() )
3203 if( db_library_pane.IsFloating() )
3218 if( db_library_pane.IsFloating() )
3241 remotePane.Show( !remotePane.IsShown() );
3243 if( remotePane.IsShown() )
3248 if( remotePane.IsFloating() )
3262 if( remotePane.IsFloating() )
3279 wxCHECK( aSchematic, );
3332 choices.RemoveAt( 0 );
3334 if( choices.IsEmpty() )
3340 wxSingleChoiceDialog chooser(
this,
_(
"Select variant to edit description:" ) + wxS(
" " ),
3341 _(
"Edit Variant Description" ), choices );
3344 if( chooser.ShowModal() == wxID_CANCEL )
3347 wxString variantName = chooser.GetStringSelection();
3349 if( variantName.IsEmpty() )
3354 wxDialog dlg(
this, wxID_ANY, wxString::Format(
_(
"Edit Description for '%s'" ), variantName ), wxDefaultPosition,
3355 wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER );
3357 wxBoxSizer* mainSizer =
new wxBoxSizer( wxVERTICAL );
3359 wxStaticText* label =
new wxStaticText( &dlg, wxID_ANY,
_(
"Description:" ) );
3360 mainSizer->Add( label, 0, wxLEFT | wxRIGHT | wxTOP | wxEXPAND, 10 );
3362 mainSizer->AddSpacer( 3 );
3364 wxTextCtrl* descCtrl =
new wxTextCtrl( &dlg, wxID_ANY, currentDesc, wxDefaultPosition, wxSize( 400, 60 ),
3366 mainSizer->Add( descCtrl, 1, wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 10 );
3368 wxStdDialogButtonSizer* btnSizer =
new wxStdDialogButtonSizer();
3369 btnSizer->AddButton(
new wxButton( &dlg, wxID_OK ) );
3370 btnSizer->AddButton(
new wxButton( &dlg, wxID_CANCEL ) );
3371 btnSizer->Realize();
3372 mainSizer->Add( btnSizer, 0, wxALL | wxALIGN_RIGHT, 5 );
3374 dlg.SetSizer( mainSizer );
3378 if( dlg.ShowModal() == wxID_CANCEL )
3381 wxString newDesc = descCtrl->GetValue().Trim().Trim(
false );
3397 choices.RemoveAt( 0 );
3401 wxSingleChoiceDialog dlg(
this,
_(
"Select variant name to remove:" ) + wxS(
" " ),
3402 _(
"Remove Design Variant" ), choices );
3405 if( dlg.ShowModal() == wxID_CANCEL )
3408 wxString variantName = dlg.GetStringSelection();
3410 if( variantName.IsEmpty() )
3415 bool append =
false;
3419 if( !commit.
Empty() )
3432 if(
Schematic().GetCurrentVariant() == variantName )
3443 if( aName.IsEmpty() )
3453 10000, wxICON_ERROR );
3457 for(
const wxString& existingName :
Schematic().GetVariantNames() )
3459 if( existingName.CmpNoCase( aName ) == 0 && existingName.CmpNoCase( aExcludeName ) != 0 )
3462 10000, wxICON_ERROR );
3476 choices.RemoveAt( 0 );
3478 if( choices.IsEmpty() )
3484 wxSingleChoiceDialog selDlg(
this,
_(
"Select variant to rename:" ) + wxS(
" " ),
3485 _(
"Rename Design Variant" ), choices );
3488 if( selDlg.ShowModal() == wxID_CANCEL )
3491 wxString oldName = selDlg.GetStringSelection();
3493 if( oldName.IsEmpty() )
3496 wxTextEntryDialog nameDlg(
this,
_(
"Enter new variant name:" ),
_(
"Rename Design Variant" ),
3497 oldName, wxOK | wxCANCEL | wxCENTER );
3499 if( nameDlg.ShowModal() == wxID_CANCEL )
3502 wxString newName = nameDlg.GetValue().Trim().Trim(
false );
3504 if( newName == oldName )
3516 bool append =
false;
3520 if( !commit.
Empty() )
3549 choices.RemoveAt( 0 );
3551 if( choices.IsEmpty() )
3557 wxSingleChoiceDialog selDlg(
this,
_(
"Select variant to copy:" ) + wxS(
" " ),
3558 _(
"Copy Design Variant" ), choices );
3561 if( selDlg.ShowModal() == wxID_CANCEL )
3564 wxString sourceName = selDlg.GetStringSelection();
3566 if( sourceName.IsEmpty() )
3569 wxTextEntryDialog nameDlg(
this,
_(
"Enter name for the copied variant:" ),
_(
"Copy Design Variant" ),
3570 sourceName + wxS(
"_copy" ), wxOK | wxCANCEL | wxCENTER );
3572 if( nameDlg.ShowModal() == wxID_CANCEL )
3575 wxString newName = nameDlg.GetValue().Trim().Trim(
false );
3582 bool append =
false;
3586 if( !commit.
Empty() )
3626 if( currentTool == pointEditor )
3627 return pointEditor && pointEditor->
IsDragging();
const KICOMMON_API wxEventTypeTag< wxCommandEvent > EDA_EVT_PLUGIN_AVAILABILITY_CHANGED
Notifies other parts of KiCad when plugin availability changes.
constexpr EDA_IU_SCALE schIUScale
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
static TOOL_ACTION toggleGrid
static TOOL_ACTION cancelInteractive
static TOOL_ACTION unselectAll
static TOOL_ACTION selectItem
Select an item (specified as the event parameter).
static TOOL_ACTION selectSetLasso
static TOOL_ACTION selectSetRect
Set lasso selection mode.
static TOOL_ACTION pasteSpecial
static TOOL_ACTION ungroup
static TOOL_ACTION toggleBoundingBoxes
static TOOL_ACTION showSearch
static TOOL_ACTION selectionActivate
Activation of the selection tool.
static TOOL_ACTION duplicate
static TOOL_ACTION showGitCommitPane
static TOOL_ACTION doDelete
static TOOL_ACTION selectionTool
static TOOL_ACTION zoomFitScreen
static TOOL_ACTION deleteTool
static TOOL_ACTION zoomTool
static TOOL_ACTION selectionClear
Clear the current selection.
static TOOL_ACTION showProperties
static TOOL_ACTION copyAsText
static TOOL_ACTION toggleGridOverrides
static TOOL_ACTION selectAll
Manage TOOL_ACTION objects.
void SetConditions(const TOOL_ACTION &aAction, const ACTION_CONDITIONS &aConditions)
Set the conditions the UI elements for activating a specific tool action should use for determining t...
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
Handles how to draw a screen (a board, a schematic ...)
bool IsContentModified() const
void SetContentModified(bool aModified=true)
constexpr BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr, RECURSE_MODE aRecurse=RECURSE_MODE::NO_RECURSE)
Modify a given item in the model.
Handle actions that are shared between different applications.
CONNECTION_SUBGRAPH * FindFirstSubgraphByName(const wxString &aNetName)
Retrieve a subgraph for the given net name, if one exists.
A subgraph is a set of items that are electrically connected on a single sheet.
Dialog to update or change schematic library symbols.
virtual bool doAutoSave()
This should be overridden by the derived class to handle the auto save feature.
virtual APP_SETTINGS_BASE * config() const
Return the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
virtual void ProjectChanged()
Notification event that the project has changed.
UNDO_REDO_CONTAINER m_undoList
void ShowChangedLanguage() override
Redraw the menus and what not in current language.
static const wxString GitCommitPaneName()
Named here rather than beside the editors' other panes, because the project manager docks this one to...
virtual void setupUIConditions()
Setup the UI conditions for the various actions and their controls in this frame.
virtual void ClearUndoRedoList()
Clear the undo and redo list using ClearUndoORRedoList()
SETTINGS_MANAGER * GetSettingsManager() const
virtual void OnModify()
Must be called after a model change in order to set the "modify" flag and do other frame-specific pro...
ACTION_TOOLBAR * m_tbRight
TOOLBAR_SETTINGS * m_toolbarSettings
void FinishAUIInitialization()
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...
void UpdateFileHistory(const wxString &FullFileName, FILE_HISTORY *aFileHistory=nullptr)
Update the list of recently opened files.
virtual bool CanAcceptApiCommands()
Check if this frame is ready to accept API commands.
virtual void RecreateToolbars()
ACTION_TOOLBAR * m_tbLeft
virtual void OnSize(wxSizeEvent &aEvent)
virtual void ClearFileHistory()
Remove all files from the file history.
virtual void OnDropFiles(wxDropFilesEvent &aEvent)
Handle event fired when a file is dropped to the window.
std::map< const wxString, TOOL_ACTION * > m_acceptedExts
Associate file extensions with action to execute.
wxString GetFileFromHistory(int cmdId, const wxString &type, FILE_HISTORY *aFileHistory=nullptr)
Fetch the file name from the file history list.
virtual int GetUndoCommandCount() const
ACTION_TOOLBAR * m_tbTopMain
bool m_isClosing
Set by the close window event handler after frames are asked if they can close.
void ReCreateMenuBar()
Recreate the menu bar.
WX_INFOBAR * GetInfoBar()
GIT_COMMIT_PANE * m_gitCommitPane
EDA_DRAW_PANEL_GAL::GAL_TYPE m_canvasType
The current canvas type.
void OnSelectGrid(wxCommandEvent &event)
Command event handler for selecting grid sizes.
void setupUnits(APP_SETTINGS_BASE *aCfg)
void setArcModeConditions(const TOOL_ACTION &aDrawArc, const std::function< bool(const SELECTION &)> &aEnable)
Check each arc mode's tool action while the arc tool runs in that mode.
virtual void OnSelectZoom(wxCommandEvent &event)
Set the zoom factor when selected by the zoom list box in the main tool bar.
GAL_DISPLAY_OPTIONS_IMPL & GetGalDisplayOptions()
Return a reference to the gal rendering options used by GAL for rendering.
virtual void resolveCanvasType()
Determine the canvas type to load (with prompt if required) and initializes m_canvasType.
static const wxString PropertiesPaneName()
EDA_MSG_PANEL * m_messagePanel
virtual void SetScreen(BASE_SCREEN *aScreen)
static const wxString RemoteSymbolPaneName()
virtual void UpdateMsgPanel()
Redraw the message panel.
void FocusOnLocation(const VECTOR2I &aPos, bool aAllowScroll=true)
Useful to focus on a particular location, in find functions.
virtual void ClearFocus()
SEARCH_PANE * m_searchPane
void unitsChangeRefresh() override
Called when when the units setting has changed to allow for any derived classes to handle refreshing ...
static const wxString DesignBlocksPaneName()
std::unique_ptr< EDA_SEARCH_DATA > m_findReplaceData
PROPERTIES_PANEL * m_propertiesPanel
bool m_showBorderAndTitleBlock
bool IsGitCommitPaneShown()
GAL_TYPE GetBackend() const
Return the type of backend currently used by GAL canvas.
void StopDrawing()
Prevent the GAL canvas from further drawing until it is recreated or StartDrawing() is called.
void ForceRefresh()
Force a redraw.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
void SetEventDispatcher(TOOL_DISPATCHER *aEventDispatcher)
Set a dispatcher that processes events and forwards them to tools.
A base class for most all the KiCad significant classes used in schematics and boards.
virtual const VECTOR2I GetFocusPosition() const
Similar to GetPosition() but allows items to return their visual center rather than their anchor.
KICAD_T Type() const
Returns the type of object.
bool IsBrightened() const
Specialization of the wxAuiPaneInfo class for KiCad panels.
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.
SELECTION_CONDITION BoundingBoxes()
SELECTION_CONDITION RedoAvailable()
Create a functor that tests if there are any items in the redo queue.
SELECTION_CONDITION CurrentTool(const TOOL_ACTION &aTool)
Create a functor testing if the specified tool is the current active tool in the frame.
SELECTION_CONDITION GridVisible()
Create a functor testing if the grid is visible in a frame.
SELECTION_CONDITION GridOverrides()
Create a functor testing if the grid overrides wires is enabled in a frame.
PANEL_ANNOTATE m_AnnotatePanel
EE_TYPE OfType(KICAD_T aType) const
SEVERITY GetSeverity(int aErrorCode) const
void ReadWindowSettings(WINDOW_SETTINGS &aCfg)
Read GAL config options from application-level config.
Docked panel for committing: the branch to commit to, a summary and description, the commit options,...
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
void RegisterHandler(API_HANDLER *aHandler)
Adds a new request handler to the server.
void DeregisterHandler(API_HANDLER *aHandler)
APP_SETTINGS_BASE * KifaceSettings() const
void SetDefaultFont(const wxString &aFont)
Contains methods for drawing schematic-specific items.
void SetSchematic(SCHEMATIC *aSchematic)
void Update(const KIGFX::VIEW_ITEM *aItem, int aUpdateFlags) const override
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
DS_PROXY_VIEW_ITEM * GetDrawingSheet() const
void SetScale(double aScale, VECTOR2D aAnchor={ 0, 0 }) override
Set the scaling factor, zooming around a given anchor point.
void DetachTextVarTracker()
Drop every cached reference into the currently-attached SCHEMATIC's TEXT_VAR_TRACKER: unregister the ...
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 Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
void SetLayerVisible(int aLayer, bool aVisible=true)
Control the visibility of a particular layer.
void UpdateAllItems(int aUpdateFlags)
Update all items in the view according to the given flags.
PAINTER * GetPainter() const
Return the painter object used by the view for drawing VIEW_ITEM objects.
void SetCenter(const VECTOR2D &aCenter)
Set the center point of the VIEW (i.e.
void UpdateAllItemsConditionally(int aUpdateFlags, std::function< bool(VIEW_ITEM *)> aCondition)
Update items in the view according to the given flags and condition.
wxString AsString() const
KIWAY_PLAYER(KIWAY *aKiway, wxWindow *aParent, FRAME_T aFrameType, const wxString &aTitle, const wxPoint &aPos, const wxSize &aSize, long aStyle, const wxString &aFrameName, const EDA_IU_SCALE &aIuScale)
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
virtual bool OpenProjectFiles(const std::vector< wxString > &aFileList, int aCtl=0)
Open a project or set of files given by aFileList.
void OnSockRequestServer(wxSocketEvent &evt)
void OnSockRequest(wxSocketEvent &evt)
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
virtual void ExpressMail(FRAME_T aDestination, MAIL_T aCommand, std::string &aPayload, wxWindow *aSource=nullptr, bool aFromOtherThread=false)
Send aPayload to aDestination from aSource.
virtual KIFACE * KiFACE(FACE_T aFaceId, bool doLoad=true)
Return the KIFACE* given a FACE_T.
LOCAL_HISTORY & LocalHistory()
Return the LOCAL_HISTORY associated with this KIWAY.
Define a library symbol object.
void AppendParentEmbeddedFiles(std::vector< EMBEDDED_FILES * > &aStack) const
std::unique_ptr< LIB_SYMBOL > Flatten() const
Return a flattened symbol inheritance to the caller.
bool CommitDuplicateOfLastSave(const wxString &aProjectPath, const wxString &aFileType, const wxString &aMessage)
Create a new commit duplicating the tree pointed to by Last_Save_<fileType> and move the Last_Save_<f...
void NoteFileChange(const wxString &aFile)
Record that a file has been modified and should be included in the next snapshot.
void RegisterSaver(const void *aSaverObject, const std::function< void(const wxString &, std::vector< HISTORY_FILE_DATA > &)> &aSaver, const std::weak_ptr< void > &aLifetime={})
Register a saver callback invoked during autosave history commits.
void UnregisterSaver(const void *aSaverObject)
Unregister a previously registered saver callback.
void RemoveAutosaveFiles(const wxString &aProjectPath) const
Remove every autosave file under the project at aProjectPath regardless of which source it shadowed.
Tree view item data for the net navigator.
The net navigator's tree control.
A singleton reporter that reports to nowhere.
int GetHeightIU(double aIUScale) const
Get the page height in IU.
int GetWidthIU(double aIUScale) const
Get the page width in IU.
void PreloadDesignBlockLibraries(KIWAY *aKiway)
Starts a background job to preload the global and project design block libraries.
KICAD_API_SERVER & GetApiServer()
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 SetDescription(const wxString &aDescription)
A progress reporter interface for use in multi-threaded environments.
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.
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.
These are loaded from Eeschema settings but then overwritten by the project settings.
bool m_IntersheetRefsShow
Holds all the data relating to one schematic.
void SetCurrentSheet(const SCH_SHEET_PATH &aPath)
void Reset()
Initialize this schematic to a blank one, unloading anything existing.
void DeleteVariant(const wxString &aVariantName, SCH_COMMIT *aCommit=nullptr)
Delete all information for aVariantName.
void RecomputeIntersheetRefs()
Update the schematic's page reference map for all global labels, and refresh the labels so that they ...
wxString GetVariantDescription(const wxString &aVariantName) const
Return the description for a variant.
wxString GetFileName() const
Helper to retrieve the filename from the root sheet screen.
void CopyVariant(const wxString &aSourceVariant, const wxString &aNewVariant, SCH_COMMIT *aCommit=nullptr)
Copy a variant from aSourceVariant to aNewVariant.
SCHEMATIC_SETTINGS & Settings() const
SCH_ITEM * ResolveItem(const KIID &aID, SCH_SHEET_PATH *aPathOut=nullptr, bool aAllowNullptrReturn=false) const
void RecordERCExclusions()
Scan existing markers and record data from any that are Excluded.
SCH_SHEET_LIST Hierarchy() const
Return the full schematic flattened hierarchical sheet list.
void RenameVariant(const wxString &aOldName, const wxString &aNewName, SCH_COMMIT *aCommit=nullptr)
Rename a variant from aOldName to aNewName.
SCH_CONNECTIVITY::FACADE & Connectivity() const
void SetProject(PROJECT *aPrj)
bool IsHierarchyModified() const
True when any sheet in the hierarchy has unsaved changes.
wxString GetCurrentVariant() const
Return the current variant being edited.
void CleanUpConnections(SCH_COMMIT *aCommit, SCH_CLEANUP_FLAGS aCleanupFlags, const std::set< SCH_SCREEN * > &aLocalScreens={})
CONNECTION_GRAPH * ConnectionGraph() const
SCH_SCREEN * RootScreen() const
Helper to retrieve the screen of the root sheet.
void SetVariantDescription(const wxString &aVariantName, const wxString &aDescription)
Set the description for a variant.
void RecalculateConnections(SCH_COMMIT *aCommit, SCH_CLEANUP_FLAGS aCleanupFlags, TOOL_MANAGER *aToolManager, PROGRESS_REPORTER *aProgressReporter=nullptr, KIGFX::SCH_VIEW *aSchView=nullptr, std::function< void(SCH_ITEM *)> *aChangedItemHandler=nullptr, PICKED_ITEMS_LIST *aLastChangeList=nullptr, bool aCleanupDone=false)
Generate the connection data for the entire schematic hierarchy.
wxArrayString GetVariantNamesForUI() const
Return an array of variant names for using in wxWidgets UI controls.
void SetSheetNumberAndCount()
Set the m_ScreenNumber and m_NumberOfScreens members for screens.
ERC_SETTINGS & ErcSettings() const
Gather all the actions that are shared by tools.
static TOOL_ACTION rotateCCW
static TOOL_ACTION placeClassLabel
static TOOL_ACTION placeSheetPin
static TOOL_ACTION saveSheetAsDesignBlock
static TOOL_ACTION mirrorV
static TOOL_ACTION drawSheetFromFile
static TOOL_ACTION toggleOPCurrents
static TOOL_ACTION saveToLinkedDesignBlock
static TOOL_ACTION saveSelectionAsDesignBlock
static TOOL_ACTION placeGlobalLabel
static TOOL_ACTION drawEllipseArc
static TOOL_ACTION drawTextBox
static TOOL_ACTION toggleAnnotateAuto
static TOOL_ACTION ddAddImage
static TOOL_ACTION drawArc
static TOOL_ACTION drawSheet
static TOOL_ACTION toggleERCWarnings
static TOOL_ACTION toggleDirectiveLabels
static TOOL_ACTION highlightNetTool
static TOOL_ACTION leaveSheet
static TOOL_ACTION ddImportGraphics
static TOOL_ACTION toggleHiddenFields
static TOOL_ACTION drawRectangle
static TOOL_ACTION drawLines
static TOOL_ACTION placeHierLabel
static TOOL_ACTION alignTop
static TOOL_ACTION alignRight
static TOOL_ACTION drawEllipse
static TOOL_ACTION placeLabel
static TOOL_ACTION drawCircle
static TOOL_ACTION placeBusWireEntry
static TOOL_ACTION showRemoteSymbolPanel
static TOOL_ACTION drawBezier
static TOOL_ACTION drawWire
static TOOL_ACTION remapSymbols
static TOOL_ACTION rotateCW
static TOOL_ACTION alignBottom
static TOOL_ACTION showHierarchy
static TOOL_ACTION showNetNavigator
static TOOL_ACTION placeJunction
static TOOL_ACTION markSimExclusions
static TOOL_ACTION drawRuleArea
static TOOL_ACTION placeSymbol
static TOOL_ACTION placeImage
static TOOL_ACTION alignLeft
static TOOL_ACTION toggleERCErrors
static TOOL_ACTION alignCenterX
static TOOL_ACTION angleSnapModeChanged
static TOOL_ACTION drawPolygon
static TOOL_ACTION placeLinkedDesignBlock
static TOOL_ACTION drawSheetFromDesignBlock
static TOOL_ACTION mirrorH
static TOOL_ACTION placeDesignBlock
static TOOL_ACTION toggleOPVoltages
static TOOL_ACTION drawBus
static TOOL_ACTION drawTable
static TOOL_ACTION ddAppendFile
static TOOL_ACTION placeSchematicText
static TOOL_ACTION showDesignBlockPanel
static TOOL_ACTION togglePinAltIcons
static TOOL_ACTION toggleERCExclusions
static TOOL_ACTION updateNetHighlighting
static TOOL_ACTION alignCenterY
static TOOL_ACTION placeNoConnect
static TOOL_ACTION toggleHiddenPins
static TOOL_ACTION syncSheetPins
static TOOL_ACTION placePower
A shim class between EDA_DRAW_FRAME and several derived classes: SYMBOL_EDIT_FRAME,...
SCH_BASE_FRAME(KIWAY *aKiway, wxWindow *aParent, FRAME_T aWindowType, const wxString &aTitle, const wxPoint &aPosition, const wxSize &aSize, long aStyle, const wxString &aFrameName)
SCH_RENDER_SETTINGS * GetRenderSettings()
void doCloseWindow() override
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
DIALOG_SCH_FIND * m_findReplaceDialog
void CommonSettingsChanged(int aFlags) override
Notification event that some of the common (suite-wide) settings have changed.
EESCHEMA_SETTINGS * eeconfig() const
PANEL_SCH_SELECTION_FILTER * m_selectionFilterPanel
virtual void UpdateItem(EDA_ITEM *aItem, bool isAddOrDelete=false, bool aUpdateRtree=false)
Mark an item for refresh.
Commit for the schematic and symbol editors.
void Push(const wxString &aMessage=wxEmptyString, int aCommitFlags=0) override
Execute the changes.
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
bool HasDriverChanged() const
wxString Name(bool aIgnoreSheet=false) const
void ClearDriverChanged()
std::optional< NET_GROUP > NetByName(const wxString &aName) const
const PUBLICATION & Published() const
SUBSCRIPTION Subscribe(std::function< void(const CHANGE_SET &)> aListener)
const CHANGE_SET & Changes() const
Handle design block actions in the schematic editor.
KIGFX::SCH_VIEW * GetView() const override
Return a pointer to the KIGFX::VIEW instance used in the panel.
void DisplaySheet(SCH_SCREEN *aScreen)
Group generic conditions for PCB editor states.
int UpdateNetHighlighting(const TOOL_EVENT &aEvent)
Update net highlighting after an edit.
Schematic editor (Eeschema) main window.
void DefaultExecFlags()
Reset the execution flags to defaults for external netlist and bom generators.
void OnCrossProbeFlashTimer(wxTimerEvent &aEvent)
int m_crossProbeFlashPhase
bool ValidateNewVariantName(const wxString &aName, const wxString &aExcludeName)
Validate a user-entered variant name for the rename/copy dialogs.
void ToggleProperties() override
bool interactiveOperationInProgress() const
Return true when a tool other than passive selection or an idle point editor is active.
bool IsContentModified() const override
Get if the current schematic has been modified but not saved.
void RefreshOperatingPointDisplay()
Refresh the display of any operating points.
wxPageSetupDialogData m_pageSetupData
wxString m_netNavigatorConnection
SELECTION & GetCurrentSelection() override
Get the current selection from the canvas area.
std::vector< std::unique_ptr< SCH_ITEM > > m_items_to_repeat
For the repeat-last-item cmd.
void subscribeConnectivity()
@ ID_NET_NAVIGATOR_EXPAND_ALL
@ ID_NET_NAVIGATOR_SEARCH_REGEX
@ ID_NET_NAVIGATOR_FIND_IN_INSPECTOR
@ ID_NET_NAVIGATOR_COLLAPSE_ALL
@ ID_NET_NAVIGATOR_SEARCH_WILDCARD
void FocusOnItem(EDA_ITEM *aItem, bool aAllowScroll=true) override
Focus on a particular canvas item.
void onResizeNetNavigator(wxSizeEvent &aEvent)
void updateSelectionFilterVisbility() override
Selection filter panel doesn't have a dedicated visibility control, so show it if any other AUI panel...
bool m_highlightedConnChanged
bool SaveSymbolToSchematic(const LIB_SYMBOL &aSymbol, const KIID &aSchematicSymbolUUID)
Update a schematic symbol from a LIB_SYMBOL.
void onNetNavigatorSelChanging(wxTreeEvent &aEvent)
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag and update other data struc...
void showNetNavigatorMenu(const wxTreeItemId &aItem)
void ShowAllIntersheetRefs(bool aShow)
void SaveProjectLocalSettings() override
Save changes to the project settings to the project (.pro) file.
bool OpenProjectFiles(const std::vector< wxString > &aFileSet, int aCtl=0) override
Open a project or set of files given by aFileList.
void doCloseWindow() override
std::unique_ptr< API_HANDLER_SCH > m_apiHandler
NET_NAVIGATOR_TREE * m_netNavigator
DIALOG_BOOK_REPORTER * m_diffSymbolDialog
void ToggleLibraryTree() override
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
wxWindow * createHighlightedNetNavigator()
void onCloseErcDialog(wxCommandEvent &aEvent)
void UpdateHierarchySelection()
Update the hierarchy navigation tree selection (cross-probe from schematic to hierarchy pane).
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.
bool m_syncingPcbToSchSelection
void RefreshNetNavigator(const NET_NAVIGATOR_ITEM_DATA *aSelection=nullptr, const std::vector< wxString > *aChangedNets=nullptr)
void SetScreen(BASE_SCREEN *aScreen) override
friend class SCH_EDITOR_CONTROL
void RefreshConnectivity(bool aForce=false, const SCH_CONNECTIVITY::CHANGE_SET *aChanges=nullptr)
bool doAutoSave() override
Save the schematic files that have been modified and not yet saved.
wxChoice * m_currentVariantCtrl
void SetCurrentVariant(const wxString &aVariantName)
void CommonSettingsChanged(int aFlags) override
Called after the preferences dialog is run.
void UpdateVariantSelectionCtrl(const wxArrayString &aVariantNames)
Update the variant name control on the main toolbar.
void ShowChangedLanguage() override
Redraw the menus and what not in current language.
bool canRunAutoSave() const override
Return true when it is safe to run an autosave snapshot right now.
BITMAP_BUTTON * m_netNavigatorMenuButton
bool RecalculateConnections(SCH_COMMIT *aCommit, SCH_CLEANUP_FLAGS aCleanupFlags, PROGRESS_REPORTER *aProgressReporter=nullptr, bool aCleanupDone=false)
Generate the connection data for the entire schematic hierarchy.
std::unique_ptr< API_HANDLER_COMMON > m_apiHandlerCommon
bool ReadyToNetlist(const wxString &aAnnotateMessage, bool *aUserCancelled=nullptr)
Check if we are ready to write a netlist file for the current schematic.
void onNetNavigatorKey(wxKeyEvent &aEvent)
void configureToolbars() override
std::vector< wxEvtHandler * > m_schematicChangeListeners
void HardRedraw() override
Rebuild the GAL and redraw the screen.
void OnClearFileHistory(wxCommandEvent &aEvent)
bool GetShowAllPins() const override
Allow edit frame to show/hide hidden pins.
void CreateDefaultScreens()
bool CanAcceptApiCommands() override
Check if this frame is ready to accept API commands.
PANEL_REMOTE_SYMBOL * m_remoteSymbolPane
SCHEMATIC * m_schematic
The currently loaded schematic.
void onNetNavigatorFilterChanged(wxCommandEvent &aEvent)
void onCloseSymbolFieldsTableDialog(wxCommandEvent &aEvent)
SCH_SHEET_PATH & GetCurrentSheet() const
wxString m_netNavigatorFilterValue
void ProjectChanged() override
Notification event that the project has changed.
void OnLoadFile(wxCommandEvent &event)
SCHEMATIC & Schematic() const
void updateTitle()
Set the main window title bar text.
void SetSchematic(SCHEMATIC *aSchematic)
void ToggleSearch()
Toggle the show/hide state of Search pane.
bool LoadProjectSettings()
Load the KiCad project file (*.pro) settings specific to Eeschema.
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
wxSearchCtrl * m_netNavigatorFilter
wxString GetFullScreenDesc() const override
static const wxString SearchPaneName()
DIALOG_BOOK_REPORTER * GetSymbolDiffDialog()
bool canCloseWindow(wxCloseEvent &aCloseEvent) override
void onNetNavigatorContextMenu(wxContextMenuEvent &aEvent)
void RecomputeIntersheetRefs()
Update the schematic's page reference map for all global labels, and refresh the labels so that they ...
const wxString & GetHighlightedNetChain() const
DIALOG_ERC * GetErcDialog()
void sendNetlistToCvpcb()
Send the KiCad netlist over to CVPCB.
SCH_DESIGN_BLOCK_PANE * m_designBlocksPane
void UpdateHierarchyNavigator(bool aRefreshNetNavigator=true, bool aClear=false)
Update the hierarchy navigation tree and history.
SCH_EDIT_FRAME(KIWAY *aKiway, wxWindow *aParent)
void ToggleSchematicHierarchy()
Toggle the show/hide state of the left side schematic navigation panel.
std::vector< KIID > m_crossProbeFlashItems
Items to flash.
void LoadDrawingSheet()
Load the drawing sheet file.
void onNetNavigatorMenuCommand(wxCommandEvent &aEvent)
void SetSheetNumberAndCount()
Set the m_ScreenNumber and m_NumberOfScreens members for screens.
std::vector< LIB_ID > m_designBlockHistoryList
void OnPageSettingsChange() override
Called when modifying the page settings.
void ClearRepeatItemsList()
Clear the list of items which are to be repeated with the insert key.
const BOX2I GetDocumentExtents(bool aIncludeAllVisible=true) const override
Return bounding box of document with option to not include some items.
std::unique_ptr< API_HANDLER_LIBRARIES > m_apiLibrariesHandler
void CaptureHierarchyPaneSize()
void StartCrossProbeFlash(const std::vector< SCH_ITEM * > &aItems)
void initScreenZoom()
Initialize the zoom value of the current screen and mark the screen as zoom-initialized.
void UpdateLabelsHierarchyNavigator()
Update the hierarchy navigation tree labels.
SCH_CONNECTIVITY::SUBSCRIPTION m_connectivitySubscription
static const wxString SchematicHierarchyPaneName()
void SetHighlightedConnection(const wxString &aConnection, const NET_NAVIGATOR_ITEM_DATA *aSelection=nullptr, bool aForceNetNavigatorRefresh=false)
void setupUIConditions() override
Setup the UI conditions for the various actions and their controls in this frame.
EDA_ITEM * ResolveItem(const KIID &aId, bool aAllowNullptrReturn=false) const override
Fetch an item by KIID.
wxString m_netNavigatorMenuNetName
void unitsChangeRefresh() override
Called when when the units setting has changed to allow for any derived classes to handle refreshing ...
void RemoveSchematicChangeListener(wxEvtHandler *aListener)
Remove aListener to from the schematic changed listener list.
void SetCurrentSheet(const SCH_SHEET_PATH &aSheet)
void DisplayCurrentSheet()
Draw the current sheet on the display.
~SCH_EDIT_FRAME() override
void onVariantSelected(wxCommandEvent &aEvent)
const wxString & GetHighlightedConnection() const
void UpdateItem(EDA_ITEM *aItem, bool isAddOrDelete=false, bool aUpdateRtree=false) override
Mark an item for refresh.
void UpdateNetHighlightStatus()
wxString GetScreenDesc() const override
Return a human-readable description of the current screen.
void EditVariantDescription()
void onNetNavigatorItemMenu(wxTreeEvent &aEvent)
void AddCopyForRepeatItem(const SCH_ITEM *aItem)
DIALOG_SYMBOL_FIELDS_TABLE * GetSymbolFieldsTableDialog()
void OnResizeHierarchyNavigator(wxSizeEvent &aEvent)
wxString GetCurrentFileName() const override
Get the full filename + path of the currently opened file in the frame.
wxString m_highlightedConn
The highlighted net or bus or empty string.
wxGenericTreeCtrl * GetNetNavigator()
static const wxString NetNavigatorPaneName()
void onNetNavigatorDPIChanged(wxDPIChangedEvent &aEvent)
void onCloseSymbolDiffDialog(wxCommandEvent &aEvent)
void IntersheetRefUpdate(SCH_GLOBALLABEL *aItem) override
Callback from schematic ref update.
void OnExit(wxCommandEvent &event)
void ToggleRemoteSymbolPanel()
void AutoRotateItem(SCH_SCREEN *aScreen, SCH_ITEM *aItem)
Automatically set the rotation of an item (if the item supports it).
wxTimer m_crossProbeFlashTimer
Timer to toggle selection visibility.
void AddSchematicChangeListener(wxEvtHandler *aListener)
Add aListener to post EDA_EVT_SCHEMATIC_CHANGED command events to.
HIERARCHY_PANE * m_hierarchy
DIALOG_SYMBOL_FIELDS_TABLE * m_symbolFieldsTableDialog
std::unique_ptr< GRID_HELPER > MakeGridHelper() override
void UpdateHopOveredWires(SCH_ITEM *aItem)
SEVERITY GetSeverity(int aErrorCode) const override
void onPluginAvailabilityChanged(wxCommandEvent &aEvt)
void onNetNavigatorSelection(wxTreeEvent &aEvent)
void FindNetInInspector(const wxString &aNetName)
void SaveCopyForRepeatItem(const SCH_ITEM *aItem)
Clone aItem and owns that clone in this container.
bool m_crossProbeFlashing
A set of SCH_ITEMs (i.e., without duplicates).
Base class for any item which can be embedded within the SCHEMATIC container class,...
SCH_ITEM * Duplicate(bool addToParentGroup, SCH_COMMIT *aCommit=nullptr, bool aDoClone=false) const
Routine to create a new copy of given item.
virtual void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction, RECURSE_MODE aMode)
SCH_CONNECTION * Connection(const SCH_SHEET_PATH *aSheet=nullptr) const
Retrieve the connection associated with this object in the given sheet.
bool ResolveExcludedFromSim(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
bool AutoRotateOnPlacement() const
autoRotateOnPlacement
SPIN_STYLE GetSpinStyle() const
void AutoplaceFields(SCH_SCREEN *aScreen, AUTOPLACE_ALGO aAlgo) override
virtual void SetSpinStyle(SPIN_STYLE aSpinStyle)
Segment description base class to describe items which have 2 end points (track, wire,...
void SetOperatingPoint(const wxString &aText)
bool IsWire() const
Return true if the line is a wire.
bool IsBus() const
Return true if the line is a bus.
const wxString & GetOperatingPoint() const
A net chain is a collection of nets that are connected together through passive components.
void SetOperatingPoint(const wxString &aText)
Tool that displays edit points allowing to modify items by dragging the points.
bool IsDragging() const
Return true while a point is actively being dragged (the model is mid-mutation between grab and relea...
bool m_ShowRemappedPinNumbers
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
void DeleteAllMarkers(enum MARKER_BASE::MARKER_T aMarkerType, bool aIncludeExclusions)
Delete all electronic rules check markers of aMarkerType from all the screens in the list.
const PAGE_INFO & GetPageSettings() const
void Clear(bool aFree=true)
Delete all draw items and clears the project settings.
void TestDanglingEnds(const SCH_SHEET_PATH *aPath=nullptr, std::function< void(SCH_ITEM *)> *aChangedHandler=nullptr) const
Test all of the connectable objects in the schematic for unused connection points.
const std::map< wxString, LIB_SYMBOL * > & GetLibSymbols() const
Fetch a list of unique LIB_SYMBOL object pointers required to properly render each SCH_SYMBOL in this...
double m_LastZoomLevel
last value for the zoom level, useful in Eeschema when changing the current displayed sheet to reuse ...
void UpdateDisplayBounds(SCH_ITEM *aItem)
Refresh display bounds only; the item's source and membership must be unchanged.
EE_RTREE & Items()
Get the full RTree, usually for iterating.
const wxString & GetFileName() const
SPIN_STYLE GetLabelOrientationForPoint(const VECTOR2I &aPosition, SPIN_STYLE aDefaultOrientation, const SCH_SHEET_PATH *aSheet) const
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
SCH_ITEM * ResolveItem(const KIID &aID, SCH_SHEET_PATH *aPathOut=nullptr, bool aAllowNullptrReturn=false) const
Fetch a SCH_ITEM by ID.
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.
void UpdateAllScreenReferences() const
Update all the symbol references for this sheet path.
SCH_SCREEN * LastScreen()
wxString PathHumanReadable(bool aUseShortRootName=true, bool aStripTrailingSeparator=false, bool aEscapeSheetNames=false) const
Return the sheet path in a human readable form made from the sheet names.
bool GetExcludedFromSim() const
SCH_SHEET * Last() const
Return a pointer to the last SCH_SHEET of the list.
void clear()
Forwarded method from std::vector.
size_t size() const
Forwarded method from std::vector.
EMBEDDED_FILES * GetEmbeddedFiles() override
SCH_SYMBOLs don't currently support embedded files, but their LIB_SYMBOL counterparts do.
bool IsAnnotated(const SCH_SHEET_PATH *aSheet) const
Check if the symbol has a valid annotation (reference) for the given sheet path.
std::vector< const SCH_PIN * > GetPins(const SCH_SHEET_PATH *aSheet) const
Retrieve a list of the SCH_PINs for the given sheet path.
std::vector< SCH_PIN * > GetGraphicalPins(int aUnit, int aBodyStyle) const override
SCH_PIN * GetPin(const wxString &number) const
Find a symbol pin by number.
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const override
VECTOR2I GetPosition() const override
static SELECTION_CONDITION HasType(KICAD_T aType)
Create a functor that tests if among the selected items there is at least one of a given type.
static bool NotEmpty(const SELECTION &aSelection)
Test if there are any items selected.
static SELECTION_CONDITION MoreThan(int aNumber)
Create a functor that tests if the number of selected items is greater than the value given as parame...
static bool Idle(const SELECTION &aSelection)
Test if there no items selected or being edited.
static bool ShowAlways(const SELECTION &aSelection)
The default condition function (always returns true).
bool UnloadProject(PROJECT *aProject, bool aSave=true)
Save, unload and unregister the given PROJECT.
SIM_MODEL & CreateModel(SIM_MODEL::TYPE aType, std::span< const wxString > aPins, REPORTER &aReporter)
void SetFilesStack(std::vector< EMBEDDED_FILES * > aFilesStack)
Spin style for labels of all kinds on schematics.
Symbol library viewer main window.
The symbol library editor main window.
Symbol library viewer main window.
void ShowMessageFor(const wxString &aMessage, int aTime, int aFlags=wxICON_INFORMATION, MESSAGE_TYPE aType=WX_INFOBAR::MESSAGE_TYPE::GENERIC)
Show the infobar with the provided message and icon for a specific period of time.
wxString EnsureFileExtension(const wxString &aFilename, const wxString &aExtension)
It's annoying to throw up nag dialogs when the extension isn't right.
bool HandleUnsavedChanges(wxWindow *aParent, const wxString &aMessage, const std::function< bool()> &aSaveFunction)
Display a dialog with Save, Cancel and Discard Changes buttons.
int GetLastUnsavedChangesResponse()
Return the result code from the last call to HandleUnsavedChanges(): wxID_YES, wxID_NO or wxID_CANCEL...
void DisplayError(wxWindow *aParent, const wxString &aText)
Display an error or warning message box with aMessage.
This file is part of the common library.
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
wxDEFINE_EVENT(wxEVT_REFRESH_CUSTOM_COMMAND, wxCommandEvent)
#define KICAD_DEFAULT_DRAWFRAME_STYLE
#define SCH_EDIT_FRAME_NAME
#define IGNORE_PARENT_GROUP
@ ID_TOOLBAR_SCH_SELECT_VARAIANT
const wxAuiPaneInfo & defaultSchSelectionFilterPaneInfo(wxWindow *aWindow)
const wxAuiPaneInfo & defaultPropertiesPaneInfo(wxWindow *aWindow)
const wxAuiPaneInfo & defaultNetNavigatorPaneInfo()
const wxAuiPaneInfo & defaultDesignBlocksPaneInfo(wxWindow *aWindow)
const wxAuiPaneInfo & defaultRemoteSymbolPaneInfo(wxWindow *aWindow)
EVT_MENU_RANGE(ID_GERBVIEW_DRILL_FILE1, ID_GERBVIEW_DRILL_FILEMAX, GERBVIEW_FRAME::OnDrlFileHistory) EVT_MENU_RANGE(ID_GERBVIEW_ZIP_FILE1
const wxString PCBNEW_EXE
@ FRAME_SCH_SYMBOL_EDITOR
int ExecuteFile(const wxString &aEditorName, const wxString &aFileName, wxProcess *aCallback, bool aFileForKicad)
Call the executable file aEditorName with the parameter aFileName.
bool m_ConnectivityEngine
Use the schematic connectivity engine instead of CONNECTION_GRAPH.
static const std::string NetlistFileExtension
static const std::string JpegFileExtension
static const std::string PngFileExtension
static const std::string LegacyPcbFileExtension
static const std::string KiCadSchematicFileExtension
static const std::string SVGFileExtension
static wxString LegacySchematicFileWildcard()
static wxString AllSchematicFilesWildcard()
static wxString KiCadSchematicFileWildcard()
const wxChar *const traceSchCurrentSheet
Flag to enable debug output of current sheet tracking in the schematic editor.
const wxChar *const traceCrossProbeFlash
Flag to enable debug output for cross-probe flash operations.
const wxChar *const traceApi
Flag to enable debug output related to the IPC API and its plugin system.
@ ID_EDA_SOCKET_EVENT_SERV
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
EVT_MENU(ID_COMPARE_PROJECT_BRANCHES, KICAD_MANAGER_FRAME::OnCompareProjectBranches) KICAD_MANAGER_FRAME
#define KICTL_CREATE
caller thinks requested project files may not exist.
#define KICTL_KICAD_ONLY
chosen file is from KiCad according to user
@ REPAINT
Item needs to be redrawn.
@ GEOMETRY
Position or shape has changed.
@ ALL
All except INITIAL_ADD.
PGM_BASE & Pgm()
The global program "get" accessor.
#define SKIP_CONNECTIVITY
#define DIFF_SYMBOLS_DIALOG_NAME
#define CURRENT_TOOL(action)
T * GetToolbarSettings(const wxString &aFilename)
T * GetAppSettings(const char *aFilename)
KIWAY Kiway(KFCTL_STANDALONE)
std::vector< FAB_LAYER_COLOR > dummy
wxString GetDefaultVariantName()
wxString UnescapeString(const wxString &aSource)
bool show_directive_labels
bool net_nav_search_mode_wildcard
int remote_symbol_panel_float_height
int design_blocks_panel_float_width
int hierarchy_panel_docked_width
int hierarchy_panel_float_width
int search_panel_dock_direction
int hierarchy_panel_docked_height
int hierarchy_panel_float_height
wxSize net_nav_panel_float_size
int design_blocks_panel_float_height
bool schematic_hierarchy_float
int design_blocks_panel_docked_width
int properties_panel_width
wxPoint net_nav_panel_float_pos
bool show_git_commit_pane
wxSize net_nav_panel_docked_size
int remote_symbol_panel_docked_width
int remote_symbol_panel_float_width
bool show_schematic_hierarchy
Implement a participant in the KIWAY alchemy.
virtual void PreloadLibraries(KIWAY *aKiway)
Difference between two publications.
wxLogTrace helper definitions.
VECTOR2< int32_t > VECTOR2I
Definition of file extensions used in Kicad.
void SetAuiPaneSize(wxAuiManager &aManager, wxAuiPaneInfo &aPane, int aWidth, int aHeight)
Sets the size of an AUI pane, working around http://trac.wxwidgets.org/ticket/13180.