29#include <wx/hyperlink.h>
99#include <wx/combobox.h>
101#include <wx/wfstream.h>
102#include <wx/zipstrm.h>
118 virtual wxDirTraverseResult
OnFile(
const wxString& aFilename )
override
120 wxFileName fn( aFilename );
123 if( ext.CmpNoCase( fn.GetExt() ) == 0 )
124 m_files.push_back( aFilename );
126 return wxDIR_CONTINUE;
129 virtual wxDirTraverseResult
OnDir(
const wxString& WXUNUSED( aDirname ) )
override
131 return wxDIR_CONTINUE;
180 wxIconBundle icon_bundle;
183 icon_bundle.AddIcon( icon );
185 icon_bundle.AddIcon( icon );
187 icon_bundle.AddIcon( icon );
189 icon_bundle.AddIcon( icon );
191 icon_bundle.AddIcon( icon );
193 SetIcons( icon_bundle );
213 GetCanvas()->GetViewControls()->SetCrossHairCursorPosition(
VECTOR2D( 0, 0 ),
false );
248 .Bottom().Layer( 6 ) );
251 .Left().Layer( 2 ) );
254 .Right().Layer( 2 ) );
266 [
this](
int aIdx ) ->
bool
275 const std::vector<EDITOR_TABS_MODEL::ENTRY>& entries =
m_tabsPanel->Model().Entries();
277 if( aIdx < 0 || aIdx >=
static_cast<int>( entries.size() ) )
280 bool modified = entries[aIdx].modified;
283 modified = ctx->IsModified();
294 .TopDockable(
false ).BottomDockable(
false )
295 .Caption(
_(
"Libraries" ) )
297 .MinSize( FromDIP( 250 ), FromDIP( 80 ) )
298 .BestSize( FromDIP( 250 ), -1 ) );
310 m_auimgr.GetPane(
"TopMainToolbar" ).Top().Layer( 6 ).Position(0).Show(
true );
311 m_auimgr.GetPane(
"LeftToolbar" ).Position(0).Show(
true );
312 m_auimgr.GetPane(
"RightToolbar" ).Show(
true );
316 wxAuiPaneInfo& selectionFilterPane =
m_auimgr.GetPane( wxS(
"SelectionFilter" ) );
318 selectionFilterPane.dock_proportion = 0;
323 propertiesPaneInfo.Show(
m_settings->m_AuiPanels.show_properties );
340 GetCanvas()->GetView()->UseDrawPriority(
true );
341 GetCanvas()->GetGAL()->SetAxesEnabled(
true );
350 bbox.
SetOrigin( -max_size_x /2, -max_size_y/2 );
351 bbox.
SetSize( max_size_x, max_size_y );
352 GetCanvas()->GetView()->SetBoundary( bbox );
359 DragAcceptFiles(
true );
378 m_apiHandler = std::make_unique<API_HANDLER_SYMBOL>(
this );
434 for(
const std::unique_ptr<SYMBOL_EDITOR_TAB_CONTEXT>& ctx :
m_tabContexts )
448 wxCHECK_RET(
m_settings,
"Call to SYMBOL_EDIT_FRAME::LoadSettings with null m_settings" );
462 wxCHECK_RET(
m_settings,
"Call to SYMBOL_EDIT_FRAME:SaveSettings with null m_settings" );
471 wxAuiPaneInfo& filterPane =
m_auimgr.GetPane( wxS(
"SelectionFilter" ) );
473 const bool treeShown = treePane.IsShown();
474 const bool filterShown = filterPane.IsShown();
482 treePane.Show(
true );
490 treePane.Show( treeShown );
491 filterPane.Show( filterShown );
505 m_settings->m_AuiPanels.show_properties = prop_shown;
510 m_settings->m_SelectionFilter = selTool->GetFilter();
579#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
580#define CHECK( x ) ACTION_CONDITIONS().Check( x )
582 auto haveSymbolCond =
588 auto isGraphicallyEditableCond =
594 auto isEditableInAliasCond =
603 auto canUpdateFieldsCond =
609 auto revertableCondition =
624 auto libSelectedCondition =
630 auto canEditProperties =
636 auto symbolSelectedInTreeCondition =
643 auto saveSymbolAsCondition =
649 const auto isSymbolFromSchematicCond =
684 .HotkeyEnable( isEditableInAliasCond ) );
686 .HotkeyEnable( isEditableInAliasCond ) );
689 .HotkeyEnable( isGraphicallyEditableCond ) );
691 .HotkeyEnable( isGraphicallyEditableCond ) );
709 auto hiddenFieldCond =
715 auto showPinAltIconsCond =
721 auto showLibraryTreeCond =
727 auto propertiesCond =
741 auto multiUnitModeCond =
747 auto multiBodyStyleModeCond =
753 auto syncedPinsModeCond =
759 auto haveDatasheetCond =
776#define EDIT_TOOL( tool ) ACTION_CONDITIONS().Enable( isGraphicallyEditableCond ).Check( cond.CurrentTool( tool ) )
802 wxLogTrace(
traceApi,
"Symbol editor frame: EDA_EVT_PLUGIN_AVAILABILITY_CHANGED" );
813 wxString msg =
_(
"Save changes to '%s' before closing?" );
821 if( schframe && symbol )
862 wxString msg = wxString::Format(
_(
"Save changes to '%s' before closing?" ),
865 KIDIALOG dlg(
this, msg,
_(
"Confirmation" ), wxYES_NO | wxCANCEL | wxICON_WARNING );
866 dlg.SetYesNoCancelLabels(
_(
"Save" ),
_(
"Discard Changes" ),
_(
"Cancel" ) );
892 m_libMgr->GetAdapter()->SaveSettings();
902 if(
Pgm().ApiServerOrNull() )
940 for(
int i = 0; i <
m_symbol->GetUnitCount(); i++ )
968 for(
int i = 0; i <
m_symbol->GetBodyStyleCount(); i++ )
989 propertiesPaneInfo.Show( show );
1056 if( event.GetSelection() == wxNOT_FOUND )
1059 SetUnit( event.GetSelection() + 1 );
1071 if( event.GetSelection() == wxNOT_FOUND )
1084 if( std::optional<LIBRARY_TABLE_ROW*> row = adapter->
GetRow(
m_symbol->GetLibNickname() ); row.has_value() )
1105 int infobarFlags = wxICON_INFORMATION;
1106 wxString symbolName;
1112 libName =
m_symbol->GetLibId().GetLibNickname().wx_str();
1117 msgs.push_back( wxString::Format(
_(
"Editing %s from schematic. Saving will update the "
1118 "schematic only." ),
1122 [
this]( wxHyperlinkEvent& aEvent )
1129 msgs.push_back(
_(
"Symbols in legacy libraries are not editable. Use Manage Symbol "
1130 "Libraries to migrate to current format." ) );
1132 infobar.
AddLink(
_(
"Manage symbol libraries" ),
1133 [
this]( wxHyperlinkEvent& aEvent )
1140 msgs.push_back( wxString::Format(
_(
"Symbol %s is a derived symbol. Symbol graphics will "
1141 "not be editable." ),
1145 if( std::shared_ptr<LIB_SYMBOL> rootSymbol =
m_symbol->GetRootSymbol() )
1149 wxString rootSymbolName = rootSymbol->GetName();
1152 [
this, libName, rootSymbolName, unit, bodyStyle]( wxHyperlinkEvent& aEvent )
1161 &&
m_libMgr->IsLibraryReadOnly(
m_symbol->GetLibId().GetFullLibraryName() ) )
1163 msgs.push_back(
_(
"Library is read-only. Changes cannot be saved to this library." ) );
1165 infobar.
AddLink(
_(
"Create an editable copy" ),
1166 [
this, libName]( wxHyperlinkEvent& aEvent )
1168 wxString msg = wxString::Format(
_(
"Create an editable copy of the symbol or "
1169 "the entire library (%s)?" ),
1172 KIDIALOG errorDlg(
this, msg,
_(
"Select type of item to save" ),
1173 wxYES_NO | wxCANCEL | wxICON_QUESTION );
1175 errorDlg.SetYesNoCancelLabels(
_(
"Copy symbol" ),
_(
"Cancel" ),
_(
"Copy library" ) );
1189 if( local_infobar->IsShownOnScreen() && local_infobar->
HasCloseButton() )
1202 wxString msg = wxJoin( msgs,
'\n',
'\0' );
1290 wxCHECK( aUnit > 0 && aUnit <=
GetCurSymbol()->GetUnitCount(), );
1311 wxCHECK( aBodyStyle > 0 && aBodyStyle <=
GetCurSymbol()->GetBodyStyleCount(), );
1339 wxFileName fn =
m_libMgr->GetUniqueLibraryName();
1340 bool useGlobalTable =
true;
1348 return wxEmptyString;
1357 wxCHECK( optTable.has_value(), wxEmptyString );
1360 wxString libName = fn.GetName();
1362 if( libName.IsEmpty() )
1363 return wxEmptyString;
1369 DisplayError(
this, wxString::Format(
_(
"Library '%s' already exists." ), libName ) );
1370 return wxEmptyString;
1377 if( fn.FileExists() && !wxRemoveFile( fn.GetFullPath() ) )
1379 DisplayError(
this, wxString::Format(
_(
"Could not overwrite the library file '%s'.\n"
1380 "Make sure you have write permissions and try again." ),
1381 fn.GetFullPath() ) );
1382 return wxEmptyString;
1385 if( !
m_libMgr->CreateLibrary( fn.GetFullPath(), scope ) )
1387 DisplayError(
this, wxString::Format(
_(
"Could not create the library file '%s'.\n"
1388 "Make sure you have write permissions and try again." ),
1389 fn.GetFullPath() ) );
1390 return wxEmptyString;
1395 if( !
m_libMgr->AddLibrary( fn.GetFullPath(), scope ) )
1397 DisplayError(
this,
_(
"Could not open the library file." ) );
1398 return wxEmptyString;
1402 bool success =
true;
1406 wxCHECK( optTable.has_value(), wxEmptyString );
1407 table = optTable.value();
1409 table->Save().map_error(
1413 wxOK | wxICON_ERROR );
1414 dlg.SetExtendedMessage( aError.
message );
1421 adapter->
LoadOne( fn.GetName() );
1427 LIB_ID libId( fn.GetName(), wxEmptyString );
1432 return fn.GetFullPath();
1438 wxFileName fn = wxFileName( aLibFile );
1439 wxString libName = fn.GetName();
1441 if( libName.IsEmpty() )
1449 DisplayError(
this, wxString::Format(
_(
"Library '%s' already exists." ), libName ) );
1455 DisplayError(
this,
_(
"Could not open the library file." ) );
1460 wxCHECK( optTable.has_value(), );
1462 bool success =
true;
1464 table->Save().map_error(
1468 wxOK | wxICON_ERROR );
1469 dlg.SetExtendedMessage( aError.
message );
1478 std::string packet = fn.GetFullPath().ToStdString();
1531 std::vector<LIB_ID> ids;
1545 wxLogTrace( wxT(
"KICAD_TABS_DBG" ),
1546 wxT(
"SYMBOL_EDIT_FRAME::SyncLibraries enter (progress=%d, forceRefresh='%s')" ),
1547 aShowProgress, aForceRefresh );
1554 wxLogTrace( wxT(
"KICAD_TABS_DBG" ), wxT(
"SYMBOL_EDIT_FRAME::SyncLibraries re-entrant; skipping" ) );
1569 std::vector<LIB_ID> expanded;
1586 m_libMgr->GetAdapter()->GetLibrariesCount(),
this );
1588 THROTTLE progressThrottle( std::chrono::milliseconds( 350 ) );
1589 int pendingProgress = 0;
1590 bool callbackFired =
false;
1591 wxString pendingLibName;
1594 [&](
int progress,
int max,
const wxString& libName )
1596 pendingProgress = progress;
1597 pendingLibName = libName;
1598 callbackFired =
true;
1600 if( progressThrottle.
Ready() )
1601 progressDlg.
Update( progress, wxString::Format(
_(
"Loading library '%s'..." ), libName ) );
1605 progressDlg.
Update( pendingProgress, wxString::Format(
_(
"Loading library '%s'..." ), pendingLibName ) );
1607 else if( !aPreloadCancelled )
1609 m_libMgr->Sync( aForceRefresh, [&](
int progress,
int max,
const wxString& libName ) {} );
1614 wxDataViewItem found;
1620 found =
m_libMgr->GetAdapter()->FindItem( selected );
1626 wxLogTrace( wxT(
"KICAD_TABS_DBG" ), wxT(
"SYMBOL_EDIT_FRAME::SyncLibraries Regenerate" ) );
1630 for(
const LIB_ID& libId : expanded )
1638 if( !found && selected.
IsValid() )
1641 found =
m_libMgr->GetAdapter()->FindItem( selected );
1648 wxLogTrace( wxT(
"KICAD_TABS_DBG" ), wxT(
"SYMBOL_EDIT_FRAME::SyncLibraries exit" ) );
1666 if( aTreeItem.IsOk() )
1677 wxFileName backupFileName;
1679 if( !aOriginalFile.IsDir() && aOriginalFile.FileExists() )
1681 backupFileName = aOriginalFile;
1682 backupFileName.SetExt( wxT(
"bak" ) );
1684 if( backupFileName.FileExists() )
1686 if( !wxRemoveFile( backupFileName.GetFullPath() ) )
1688 aErrorMsg.Printf(
_(
"Failed to remove existing library backup file '%s'." ),
1689 backupFileName.GetFullPath() );
1694 if( !wxCopyFile( aOriginalFile.GetFullPath(), backupFileName.GetFullPath() ) )
1696 aErrorMsg.Printf(
_(
"Failed to save backup to '%s'." ), backupFileName.GetFullPath() );
1700 else if( aOriginalFile.IsDir() && aOriginalFile.DirExists() )
1702 backupFileName.SetPath( aOriginalFile.GetPath() );
1703 backupFileName.SetName( backupFileName.GetDirs().Last() + wxString(
"_backup" ) );
1704 backupFileName.SetExt(
"zip" );
1706 std::vector<wxString> libFiles;
1707 wxDir libDir( aOriginalFile.GetPath() );
1710 if( backupFileName.FileExists() )
1712 if( !wxRemoveFile( backupFileName.GetFullPath() ) )
1714 aErrorMsg.Printf(
_(
"Failed to remove existing library backup file '%s'." ),
1715 backupFileName.GetFullPath() );
1720 if( !libDir.IsOpened() )
1722 aErrorMsg.Printf(
_(
"Error opening unpacked library directory: '%s'." ), aOriginalFile.GetPath() );
1726 libDir.Traverse( libTraverser, wxEmptyString, wxDIR_FILES );
1728 wxFFileOutputStream ostream( backupFileName.GetFullPath() );
1730 if( !ostream.IsOk() )
1732 aErrorMsg.Printf(
_(
"Failed to create library backup file '%s'." ), backupFileName.GetFullPath() );
1737 if( FILE* fp = ostream.GetFile()->fp() )
1740 wxZipOutputStream zipstream( ostream, -1, wxConvUTF8 );
1742 for(
const wxString& fileName : libFiles )
1744 wxFileName fn( fileName );
1745 wxFileSystem fsFile;
1747 fn.MakeRelativeTo( aOriginalFile.GetPath() );
1749 wxString relativeFn = fn.GetFullPath();
1752 wxFSFile* infile =
nullptr;
1757 wxLogNull suppressSysErrorPopups;
1758 infile = fsFile.OpenFile( fileName );
1762 if(
unsigned long code = wxSysErrorCode() )
1763 sysError = wxSysErrorMsgStr( code );
1769 zipstream.PutNextEntry( relativeFn, infile->GetModificationTime() );
1770 infile->GetStream()->Read( zipstream );
1771 zipstream.CloseEntry();
1777 if( sysError.IsEmpty() )
1778 aErrorMsg.Printf(
_(
"Failed to archive file '%s'." ), relativeFn );
1780 aErrorMsg.Printf(
_(
"Failed to archive file '%s': %s" ), relativeFn, sysError );
1787 if( !zipstream.Close() )
1789 aErrorMsg.Printf(
_(
"Failed to create file '%s'." ), backupFileName.GetFullPath() );
1820 cfg->m_Window.grid.axes_enabled =
true;
1853 bool tree_shown = tree_pane_info.IsShown();
1854 tree_pane_info.Caption(
_(
"Libraries" ) );
1855 tree_pane_info.Show( tree_shown );
1917 item.ClearSelected();
1953 if( aItem !=
nullptr && !aItem->
IsSCH_ITEM() )
1960 if(
pin->m_Uuid == lastBrightenedItemID )
1964 std::vector<SCH_FIELD*> fields;
1969 if( field->m_Uuid == lastBrightenedItemID )
1974 if( lastItem && lastItem != aItem )
1979 lastBrightenedItemID =
niluuid;
1988 if(
int unit = item->
GetUnit() )
2000 lastBrightenedItemID = aItem->
m_Uuid;
2010 const std::string& payload = mail.
GetPayload();
2012 wxLogTrace( wxT(
"KICAD_TABS_DBG" ), wxT(
"SYMBOL_EDIT_FRAME::KiwayMailIn cmd=%d" ), (
int) mail.
Command() );
2017 if( !payload.empty() )
2019 wxString uri( payload );
2020 wxString libNickname;
2024 std::optional<const LIBRARY_TABLE_ROW*> libTableRow = adapter->
FindRowByURI( uri );
2028 msg.Printf(
_(
"The current configuration does not include the symbol library '%s'." ),
2030 msg += wxS(
"\n" ) +
_(
"Use Manage Symbol Libraries to edit the configuration." );
2035 libNickname = ( *libTableRow )->Nickname();
2037 if( !adapter->
HasLibrary( libNickname,
true ) )
2039 msg.Printf(
_(
"The symbol library '%s' is not enabled in the current configuration." ),
2041 msg += wxS(
"\n" ) +
_(
"Use Manage Symbol Libraries to edit the configuration." );
2048 LIB_ID id( libNickname, wxEmptyString );
2060 const int badPos = libId.
Parse( wxString::FromUTF8( payload ) );
2062 if( badPos == -1 && libId.
IsValid() )
2085 wxLogTrace( wxT(
"KICAD_TABS_DBG" ), wxT(
"SYMBOL_EDIT_FRAME::KiwayMailIn MAIL_RELOAD_LIB -> SyncLibraries" ) );
2096 std::set<wxString> keep;
2098 for(
const std::unique_ptr<SYMBOL_EDITOR_TAB_CONTEXT>& ctx :
m_tabContexts )
2101 keep.insert( ctx->GetLibrary() );
2108 std::shared_ptr<LIB_SYMBOL> heldParent =
refresh ? current->
GetParent().lock() :
nullptr;
2111 std::vector<wxString> dropped =
m_libMgr->DropUnmodifiedBuffers( keep );
2135 else if( heldParent )
2136 replacement = current->
Flatten().release();
2158 wxLogTrace(
traceLibWatch,
"Received refresh symbol request for %s", payload );
2165 const wxString refreshSymbolName = symbol->
GetName();
2169 if( !IsEnabled() ||
Kiway().HasBlockingDialog() )
2171 wxLogTrace(
traceLibWatch,
"Deferring symbol refresh; dialog is open on the symbol editor." );
2180 wxLogTrace(
traceLibWatch,
"Deferring symbol refresh; an interactive tool is active." );
2185 std::optional<const LIBRARY_TABLE_ROW*> row = adapter->
GetRow( libName );
2194 wxLogTrace(
traceLibWatch,
"Received refresh symbol request for %s, current symbols is %s",
2195 changedLib.GetFullPath(), libfullname.GetFullPath() );
2197 if( changedLib == libfullname )
2199 wxLogTrace(
traceLibWatch,
"Refreshing symbol %s", refreshSymbolName );
2201 m_libMgr->UpdateLibraryBuffer( libName );
2203 if(
LIB_SYMBOL* lib_symbol =
m_libMgr->GetBufferedSymbol( refreshSymbolName, libName ) )
2243 return m_libMgr->HasModifications();
2256 for(
const wxString& libName :
m_libMgr->GetLibraryNames() )
2258 if(
m_libMgr->IsLibraryModified( libName ) && !
m_libMgr->IsLibraryReadOnly( libName ) )
2275 if( aItemCount == 0 )
2282 if( aItemCount < 0 )
2288 for(
int ii = 0; ii < aItemCount; ii++ )
2290 if( list.m_CommandsList.size() == 0 )
2294 list.m_CommandsList.erase( list.m_CommandsList.begin() );
2296 for(
unsigned jj = 0; jj < curr_cmd->
GetCount(); ++jj )
2318 bool aRestorePending,
bool aTreeShownNow )
2326 return aWasFromSchematic && aRestorePending;
2335 symbol->SetLibId( aSymbol->
GetLibId() );
2342 std::vector<SCH_FIELD> fullSetOfFields;
2347 SCH_FIELD libField( symbol.get(), field.GetId() );
2362 std::swap( pos.
x, pos.
y );
2366 std::swap( pos.
x, pos.
y );
2379 fullSetOfFields.emplace_back( std::move( libField ) );
2382 symbol->SetFields( fullSetOfFields );
2384 const wxString reference = symbol->GetReferenceField().GetText();
2385 const int unit = std::max( 1, aSymbol->
GetUnit() );
2386 const int bodyStyle = std::max( 1, aSymbol->
GetBodyStyle() );
2400 aSymbol->
m_Uuid, reference, unit,
2436 wxFileName fn = aLibFile;
2438 wxString libNickname = fn.GetName();
2450 tmp.Printf(
"%s%d", fn.GetName(), suffix );
2457 wxCHECK( optTable.has_value(),
false );
2467 : wxString( wxEmptyString ) );
2472 bool success =
true;
2474 table->Save().map_error(
2478 wxOK | wxICON_ERROR );
2479 dlg.SetExtendedMessage( aError.
message );
2488 adapter->
LoadOne( libNickname );
2504 if( adapter->
GetRow( aLibNickname, scope ) )
2507 wxCHECK( optTable.has_value(),
false );
2508 table = optTable.value();
2514 if( adapter->
GetRow( aLibNickname, scope ) )
2518 if( optTable.has_value() )
2519 table = optTable.value();
2523 wxCHECK(
table,
false );
2525 std::optional<LIBRARY_TABLE_ROW*> optRow = adapter->
GetRow( aLibNickname, scope );
2526 wxCHECK( optRow.has_value(),
false );
2531 wxString projectPath;
2541 bool success =
true;
2543 table->Save().map_error(
2547 wxOK | wxICON_ERROR );
2548 dlg.SetExtendedMessage( aError.
message );
2557 adapter->
LoadOne( aLibNickname );
2590 eda_text->ClearBoundingBoxCache();
2591 eda_text->ClearRenderCache();
2600 wxAuiPaneInfo& selectionFilterPane =
m_auimgr.GetPane( wxS(
"SelectionFilter" ) );
2604 bool showFilter = ( treePane.IsShown() && treePane.IsDocked() )
2605 || ( propertiesPane.IsShown() && propertiesPane.IsDocked() );
2607 selectionFilterPane.Show( showFilter );
const KICOMMON_API wxEventTypeTag< wxCommandEvent > EDA_EVT_PLUGIN_AVAILABILITY_CHANGED
Notifies other parts of KiCad when plugin availability changes.
BASE_SCREEN class implementation.
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...
static TOOL_ACTION toggleGrid
static TOOL_ACTION cancelInteractive
static TOOL_ACTION unselectAll
static TOOL_ACTION revert
static TOOL_ACTION showLibraryTree
static TOOL_ACTION exportForOlderVersion
static TOOL_ACTION showDatasheet
static TOOL_ACTION toggleBoundingBoxes
static TOOL_ACTION saveAll
static TOOL_ACTION duplicate
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 ddAddLibrary
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...
wxProgressDialog with the option to also update the application progress on the taskbar
virtual bool Update(int aValue, const wxString &aNewMsg=wxEmptyString, bool *aSkip=nullptr) override
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
wxString m_ColorTheme
Active color theme name.
Handles how to draw a screen (a board, a schematic ...)
void SetContentModified(bool aModified=true)
constexpr void SetOrigin(const Vec &pos)
constexpr void SetSize(const SizeVec &size)
Color settings are a bit different than most of the settings objects in that there can be more than o...
Handle actions that are shared between different applications.
UNDO_REDO_CONTAINER m_undoList
void ShowChangedLanguage() override
Redraw the menus and what not in current language.
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
UNDO_REDO_LIST
Specify whether we are interacting with the undo or redo stacks.
virtual void OnModify()
Must be called after a model change in order to set the "modify" flag and do other frame-specific pro...
bool isBlockableSessionEnd() const
Return true when the session is ending on a platform that shows a shutdown block reason.
ACTION_TOOLBAR * m_tbRight
TOOLBAR_SETTINGS * m_toolbarSettings
void FinishAUIInitialization()
virtual void RecreateToolbars()
UNDO_REDO_CONTAINER m_redoList
ACTION_TOOLBAR * m_tbLeft
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.
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()
COLOR_SETTINGS * m_colorSettings
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 SwitchCanvas(EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
Change the current rendering backend.
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)
bool LibraryFileBrowser(const wxString &aTitle, bool doOpen, wxFileName &aFilename, const wxString &wildcard, const wxString &ext, bool isDirectory, FILEDLG_HOOK_NEW_LIBRARY *aFileDlgHook=nullptr)
void FocusOnLocation(const VECTOR2I &aPos, bool aAllowScroll=true)
Useful to focus on a particular location, in find functions.
PROPERTIES_PANEL * m_propertiesPanel
void ForceRefresh()
Force a redraw.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
KIGFX::GAL * GetGAL() const
Return a pointer to the GAL instance used in the panel.
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.
bool HasFlag(EDA_ITEM_FLAGS aFlag) const
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,...
Class that groups generic conditions for editor states.
SELECTION_CONDITION NoActiveTool()
Create a functor testing if there are no tools active in the frame.
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.
virtual SELECTION_CONDITION UndoAvailable()
Create a functor that tests if there are any items in the undo queue.
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.
The tab strip plus the single shared GAL canvas.
bool GetUseGlobalTable() const
void ReadWindowSettings(WINDOW_SETTINGS &aCfg)
Read GAL config options from application-level config.
void RegisterHandler(API_HANDLER *aHandler)
Adds a new request handler to the server.
void DeregisterHandler(API_HANDLER *aHandler)
Helper class to create more flexible dialogs, including 'do not show again' checkbox handling.
bool m_axesEnabled
Whether or not to draw the coordinate system axes.
void SetAxesEnabled(bool aAxesEnabled)
Enable drawing the axes.
void SetAxesColor(const COLOR4D &aAxesColor)
Set the axes color.
void SetDefaultFont(const wxString &aFont)
void ClearHiddenFlags()
Clear the hide flag of all items in the view.
void Clear()
Remove all items from the view.
void UpdateAllItems(int aUpdateFlags)
Update all items in the view according to the given flags.
Carry a payload from one KIWAY_PLAYER to another within a PROJECT.
std::string & GetPayload()
Return the payload, which can be any text but it typically self identifying s-expression.
void SetPayload(const std::string &aPayload)
MAIL_T Command()
Returns the MAIL_T associated with this mail.
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
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.
bool HasBlockingDialog() const
Module editor specific tools.
std::optional< LIBRARY_TABLE_ROW * > FindRowByURI(const wxString &aUri, LIBRARY_TABLE_SCOPE aScope=LIBRARY_TABLE_SCOPE::BOTH) const
Like LIBRARY_MANAGER::FindRowByURI but filtered to the LIBRARY_TABLE_TYPE of this adapter.
bool HasLibrary(const wxString &aNickname, bool aCheckEnabled=false) const
Test for the existence of aNickname in the library tables.
std::optional< LIBRARY_TABLE_ROW * > GetRow(const wxString &aNickname, LIBRARY_TABLE_SCOPE aScope=LIBRARY_TABLE_SCOPE::BOTH) const
Like LIBRARY_MANAGER::GetRow but filtered to the LIBRARY_TABLE_TYPE of this adapter.
void ReloadTables(LIBRARY_TABLE_SCOPE aScope, std::initializer_list< LIBRARY_TABLE_TYPE > aTablesToLoad={})
std::optional< LIBRARY_TABLE * > Table(LIBRARY_TABLE_TYPE aType, LIBRARY_TABLE_SCOPE aScope)
Retrieves a given table; creating a new empty project table if a valid project is loaded and the give...
std::optional< wxString > GetFullURI(LIBRARY_TABLE_TYPE aType, const wxString &aNickname, bool aSubstituted=false)
Return the full location specifying URI for the LIB, either in original UI form or in environment var...
void SetNickname(const wxString &aNickname)
void SetType(const wxString &aType)
void SetURI(const wxString &aUri)
A logical library item identifier and consists of various portions much like a URI.
int Parse(const UTF8 &aId, bool aFix=false)
Parse LIB_ID with the information from aId.
int SetLibItemName(const UTF8 &aLibItemName)
Override the library item name portion of the LIB_ID to aLibItemName.
bool IsValid() const
Check if this LID_ID is valid.
const UTF8 & GetLibItemName() const
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Symbol library management helper that is specific to the symbol library editor frame.
Define a library symbol object.
const LIB_ID & GetLibId() const override
std::weak_ptr< LIB_SYMBOL > & GetParent()
wxString GetName() const override
std::unique_ptr< LIB_SYMBOL > Flatten() const
Return a flattened symbol inheritance to the caller.
void Update(LIB_TREE_ITEM *aItem)
Update the node using data from a LIB_ALIAS object.
void RefreshLibTree()
Refresh the tree (mainly to update highlighting and asterisking)
void CenterLibId(const LIB_ID &aLibId)
Ensure that an item is visible (preferably centered).
int GetSelectionCount() const
void ShowChangedLanguage()
void FocusSearchFieldIfExists()
Focus the search widget if it exists.
std::vector< LIB_ID > GetExpandedLibraries() const
void SelectLibId(const LIB_ID &aLibId)
Select an item in the tree widget.
LIB_TREE_MODEL_ADAPTER::SORT_MODE GetSortMode() const
int GetSelectedLibIds(std::vector< LIB_ID > &aSelection, std::vector< int > *aUnit=nullptr) const
Retrieve a list of selections for trees that allow multi-selection.
void Unselect()
Unselect currently selected item in wxDataViewCtrl.
LIB_ID GetSelectedLibId(int *aUnit=nullptr) const
For multi-unit symbols, if the user selects the symbol itself rather than picking an individual unit,...
void ExpandLibId(const LIB_ID &aLibId)
Expand and item i the tree widget.
void Regenerate(bool aKeepState)
Regenerate the tree.
virtual ENV_VAR_MAP & GetLocalEnvVariables() const
KICAD_API_SERVER & GetApiServer()
virtual SETTINGS_MANAGER & GetSettingsManager() const
virtual LIBRARY_MANAGER & GetLibraryManager() const
A holder to handle information on schematic or board items.
unsigned GetCount() const
void ClearItemsList()
Delete only the list of pickers NOT the picked data itself.
EDA_ITEM * GetPickedItem(unsigned int aIdx) const
static SYMBOL_LIBRARY_ADAPTER * SymbolLibAdapter(PROJECT *aProject)
Accessor for project symbol library manager adapter.
virtual const wxString GetProjectPath() const
Return the full path of the project.
Gather all the actions that are shared by tools.
static TOOL_ACTION rotateCCW
static TOOL_ACTION editSymbolPinMaps
static TOOL_ACTION importSymbol
static TOOL_ACTION newSymbol
static TOOL_ACTION saveLibraryAs
static TOOL_ACTION mirrorV
static TOOL_ACTION drawEllipseArc
static TOOL_ACTION editLibSymbolWithLibEdit
static TOOL_ACTION drawArc
static TOOL_ACTION pinTable
static TOOL_ACTION drawSymbolLines
static TOOL_ACTION placeSymbolPin
static TOOL_ACTION drawSymbolTextBox
static TOOL_ACTION ddImportGraphics
static TOOL_ACTION drawRectangle
static TOOL_ACTION drawEllipse
static TOOL_ACTION drawCircle
static TOOL_ACTION importGraphics
static TOOL_ACTION drawBezier
static TOOL_ACTION saveSymbolCopyAs
static TOOL_ACTION rotateCW
static TOOL_ACTION showElectricalTypes
static TOOL_ACTION drawSymbolPolygon
static TOOL_ACTION showHiddenFields
static TOOL_ACTION placeSymbolAnchor
static TOOL_ACTION showHiddenPins
static TOOL_ACTION cycleBodyStyle
static TOOL_ACTION mirrorH
static TOOL_ACTION runERC
Inspection and Editing.
static TOOL_ACTION symbolProperties
static TOOL_ACTION placeSymbolText
static TOOL_ACTION toggleSyncedPinsMode
static TOOL_ACTION togglePinAltIcons
static TOOL_ACTION updateSymbolFields
static TOOL_ACTION saveSymbolAs
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()
virtual bool hasUnsavedLibraryEdits(const wxString &aLibNickname) const
Return true if reloading library aLibNickname from disk would discard unsaved edits.
void doCloseWindow() override
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
SYMBOL_EDITOR_SETTINGS * libeditconfig() const
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
void CommonSettingsChanged(int aFlags) override
Notification event that some of the common (suite-wide) settings have changed.
void SyncView()
Mark all items for refresh.
PANEL_SCH_SELECTION_FILTER * m_selectionFilterPanel
virtual void UpdateItem(EDA_ITEM *aItem, bool isAddOrDelete=false, bool aUpdateRtree=false)
Mark an item for refresh.
void setSymWatcher(const LIB_ID *aSymbol)
Creates (or removes) a watcher on the specified symbol library.
KIGFX::SCH_VIEW * GetView() const override
Return a pointer to the KIGFX::VIEW instance used in the panel.
void DisplaySymbol(LIB_SYMBOL *aSymbol)
Schematic editor (Eeschema) main window.
bool SaveSymbolToSchematic(const LIB_SYMBOL &aSymbol, const KIID &aSchematicSymbolUUID)
Update a schematic symbol from a LIB_SYMBOL.
void SetPosition(const VECTOR2I &aPosition) override
static const wxString ShowType(SCH_FILE_T aFileType)
Return a brief name for a plugin, given aFileType enum.
static SCH_FILE_T GuessPluginTypeFromLibPath(const wxString &aLibPath, int aCtl=0)
Return a plugin type given a symbol library using the file extension of aLibPath.
Base class for any item which can be embedded within the SCHEMATIC container class,...
Tool that displays edit points allowing to modify items by dragging the points.
bool m_ShowPinsElectricalType
bool m_ShowGraphicsDisabled
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
int GetOrientation() const override
Get the display symbol orientation.
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
static bool NotEmpty(const SELECTION &aSelection)
Test if there are any items selected.
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).
Handle actions for the various symbol editor and viewers.
bool m_ShowPinElectricalType
One open symbol tab owning a working LIB_SYMBOL and screen lent to the frame while active.
The symbol library editor main window.
std::vector< std::unique_ptr< SYMBOL_EDITOR_TAB_CONTEXT > > m_tabContexts
bool m_isSymbolFromSchematic
Flag if the symbol being edited was loaded directly from a schematic.
void restoreSymbolTabsFromSettings()
Recreate tabs from the persisted open-tab list once the libraries have loaded.
void OnExitKiCad(wxCommandEvent &event)
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
bool promptToSaveInactiveInstanceTabs()
Prompt to save each dirty instance (symbol from schematic) tab that is not the active one,...
std::unique_ptr< GRID_HELPER > MakeGridHelper() override
void UpdateItem(EDA_ITEM *aItem, bool isAddOrDelete=false, bool aUpdateRtree=false) override
Mark an item for refresh.
bool m_syncLibrariesInProgress
void setupUIConditions() override
Setup the UI conditions for the various actions and their controls in this frame.
APP_SETTINGS_BASE * config() const override
Return the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
std::unique_ptr< API_HANDLER_COMMON > m_apiHandlerCommon
bool hasDirtyInactiveInstanceTabs() const
True if any non-active instance (schematic) tab has unsaved edits.
bool IsLibraryTreeShown() const override
const BOX2I GetDocumentExtents(bool aIncludeAllVisible=true) const override
Return bounding box of document with option to not include some items.
SELECTION & GetCurrentSelection() override
Get the current selection from the canvas area.
wxString getTargetLib() const
Return either the library selected in the symbol tree, if context menu is active or the library that ...
bool LoadSymbolFromLib(const wxString &aLibName, const wxString &aSymbolName, int aUnit=0, int aBodyStyle=0)
Load a symbol from a library, optionally setting the selected unit and body style.
bool IsCurrentSymbol(const LIB_ID &aLibId) const
Return true if aLibId is an alias for the editor screen symbol.
bool backupLibrary(const wxFileName &aOriginalFile, wxString &aErrorMsg)
Create a backup copy of a symbol library.
static void freeTransientUndoCommands(UNDO_REDO_CONTAINER &aList, const LIB_SYMBOL *aLiveSymbol)
Free every command in the list and the UR_TRANSIENT-flagged copies it owns, which the shared deleters...
void OnSelectBodyStyle(wxCommandEvent &event)
wxString m_reference
RefDes of the symbol (only valid if symbol was loaded from schematic)
bool GetShowInvisibleFields()
EDITOR_TABS_PANEL * m_tabsPanel
SYMBOL_EDITOR_TAB_CONTEXT * findOrCreateSymbolInstanceTab(LIB_SYMBOL *aSymbol, SCH_SCREEN *aScreen, const KIID &aSchematicSymbolUUID, const wxString &aReference, int aUnit, int aBodyStyle)
Find or create the instance tab for a placed schematic symbol and make it active.
void RefreshLibraryTree()
Redisplay the library tree.
void updateSelectionFilterVisbility() override
Selection filter panel doesn't have a dedicated visibility control, so show it if any other AUI panel...
void CommonSettingsChanged(int aFlags) override
Called after the preferences dialog is run.
void FocusLibraryTreeInput() override
wxComboBox * m_unitSelectBox
bool m_drawSpecificBodyStyle
When editing a symbol: only apply new graphic items to the current body style.
void RebuildSymbolUnitAndBodyStyleLists()
int GetTreeLIBIDs(std::vector< LIB_ID > &aSelection) const
void OnTabCharHook(wxKeyEvent &aEvent)
Cycle symbol tabs from the char hook, since GTK cannot register WXK_TAB as an accelerator.
LIB_ID GetTreeLIBID(int *aUnit=nullptr) const
Return the LIB_ID of the library or symbol selected in the symbol tree.
LIB_SYMBOL_LIBRARY_MANAGER * m_libMgr
void FocusOnLibId(const LIB_ID &aLibID)
bool IsSymbolAlias() const
void SaveLibraryAs(SAVE_LIBRARY_AS aSaveType=SAVE_LIBRARY_AS::NEW)
Save the currently selected library to a new file.
void ToggleProperties() override
SYMBOL_EDITOR_SETTINGS * m_settings
void LoadSymbol(const wxString &aLibrary, const wxString &aSymbol, int Unit)
void onPluginAvailabilityChanged(wxCommandEvent &aEvt)
void HardRedraw() override
Rebuild the GAL and redraw the screen.
int GetTreeSelectionCount() const
bool addLibTableEntry(const wxString &aLibFile, LIBRARY_TABLE_SCOPE aScope=LIBRARY_TABLE_SCOPE::GLOBAL)
Add aLibFile to the symbol library table defined by aScope.
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
int m_unit
The unit number to edit and show.
bool CanCloseSymbolFromSchematic(bool doClose)
bool IsSymbolFromLegacyLibrary() const
bool replaceLibTableEntry(const wxString &aLibNickname, const wxString &aLibFile)
Replace the file path of the symbol library table entry aLibNickname with aLibFile.
bool IsSymbolFromSchematic() const
static bool m_showDeMorgan
void SetScreen(BASE_SCREEN *aScreen) override
void KiwayMailIn(KIWAY_MAIL_EVENT &mail) override
Receive KIWAY_MAIL_EVENT messages from other players.
SYMBOL_EDITOR_TAB_CONTEXT * m_activeTab
SYMBOL_EDITOR_SETTINGS * GetSettings() const
SCH_SCREEN * m_dummyScreen
Helper screen used when no symbol is loaded.
void SetCurSymbol(LIB_SYMBOL *aSymbol, bool aUpdateZoom)
Take ownership of aSymbol and notes that it is the one currently being edited.
KIID m_schematicSymbolUUID
SYMBOL_EDIT_FRAME(KIWAY *aKiway, wxWindow *aParent)
static bool libTreeAutoHiddenForSchematicEdit(bool aWasFromSchematic, bool aRestorePending, bool aTreeShownNow)
Resolve whether the library tree's auto-hide for a schematic edit still needs restoring on save.
bool IsSymbolEditable() const
Test if a symbol is loaded and can be edited.
std::unique_ptr< API_HANDLER_SYMBOL > m_apiHandler
std::vector< LIB_ID > GetSelectedLibIds() const
void SyncLibraries(bool aShowProgress, bool aPreloadCancelled=false, const wxString &aForceRefresh=wxEmptyString)
Synchronize the library manager to the symbol library table, and then the symbol tree to the library ...
void OnSelectUnit(wxCommandEvent &event)
void storeSymbolTabsToSettings()
Write the current tab set into the editor settings for the next session.
LIB_SYMBOL * GetCurSymbol() const
Return the current symbol being edited or NULL if none selected.
void UpdateSymbolMsgPanelInfo()
Display the documentation of the selected symbol.
bool canCloseWindow(wxCloseEvent &aCloseEvent) override
LIB_ID GetTargetLibId() const override
Return either the symbol selected in the symbol tree (if context menu is active) or the symbol on the...
bool m_libTreeAutoHiddenForSchematicEdit
True while a schematic-edit auto-hide of the library tree still needs restoring on save.
void SetBodyStyle(int aBodyStyle)
int m_bodyStyle
Show the normal shape (m_bodyStyle <= 1) or the DeMorgan converted shape (m_bodyStyle > 1)
bool saveAllLibraries(bool aRequireConfirmation)
Return true when the operation has succeeded (all requested libraries have been saved or none was sel...
bool GetShowInvisiblePins()
void UpdateMsgPanel() override
Redraw the message panel.
void ClearUndoORRedoList(UNDO_REDO_LIST whichList, int aItemCount=-1) override
Free the undo or redo list from aList element.
LIB_TREE * GetLibTree() const override
void UpdateTitle()
Update the main window title bar with the current library name and read only status of the library.
bool HasLibModifications() const
Check if any pending libraries have been modified.
std::unique_ptr< API_HANDLER_LIBRARIES > m_apiLibrariesHandler
bool promptAndCloseSymbolTab(int aIdx)
Prompt for unsaved changes on the tab and drop its context.
SYMBOL_TREE_PANE * m_treePane
void SetDrawSpecificUnit(bool aSpecific)
void LoadSymbolFromSchematic(SCH_SYMBOL *aSymbol)
Load a symbol from the schematic to edit in place.
bool m_drawSpecificUnit
When editing a symbol: only apply new graphic items to the current unit.
bool saveCurrentSymbol()
Save the current symbol.
bool IsSymbolGraphicallyEditable() const
Test if a symbol is loaded and can be edited graphically.
COLOR_SETTINGS * GetColorSettings(bool aForceRefresh=false) const override
Returns a pointer to the active color theme settings.
LIB_SYMBOL_LIBRARY_MANAGER & GetLibManager()
void OnUpdateBodyStyle(wxUpdateUIEvent &event)
void SaveSymbolCopyAs(bool aOpenCopy)
Save the currently selected symbol to a new name and/or location.
void SwitchCanvas(EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType) override
Switch currently used canvas ( Cairo / OpenGL).
void doCloseWindow() override
SYMBOL_EDITOR_TAB_CONTEXT * symbolTabContextForIndex(int aIdx) const
Resolve the tab context for a panel tab index, or nullptr.
static void clearSymbolTabUndoRedo(SYMBOL_EDITOR_TAB_CONTEXT &aContext)
Free a detached context's undo/redo, which the frame's own teardown path never reaches.
void DdAddLibrary(wxString aLibFile)
Add a library dropped file to the symbol library table.
wxString AddLibraryFile(bool aCreateNew)
Create or add an existing library to the symbol library table.
~SYMBOL_EDIT_FRAME() override
void FocusOnItem(EDA_ITEM *aItem, bool aAllowScroll=true) override
Focus on a particular canvas item.
void configureToolbars() override
bool hasUnsavedLibraryEdits(const wxString &aLibNickname) const override
Return true if reloading library aLibNickname from disk would discard unsaved edits.
void CloseWindow(wxCommandEvent &event)
Trigger the wxCloseEvent, which is handled by the function given to EVT_CLOSE() macro:
wxComboBox * m_bodyStyleSelectBox
void activateSymbolTab(SYMBOL_EDITOR_TAB_CONTEXT *aContext)
Make aContext the active tab, borrowing its working symbol, undo/redo, view and selection,...
void UpdateLibraryTree(const wxDataViewItem &aTreeItem, LIB_SYMBOL *aSymbol)
Update a symbol node in the library tree.
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current symbol.
void ShowChangedLanguage() override
Redraw the menus and what not in current language.
bool IsContentModified() const override
Get if any symbols or libraries have been modified but not saved.
void ToggleLibraryTree() override
LIB_SYMBOL * getTargetSymbol() const
Return currently edited symbol.
void OnUpdateUnitNumber(wxUpdateUIEvent &event)
An interface to the global shared library manager that is schematic-specific and linked to one projec...
std::optional< LIB_STATUS > LoadOne(LIB_DATA *aLib) override
Loads or reloads the given library, if it exists.
Library Editor pane with symbol tree and symbol library table selector.
Rate-limiter that fires at most once per interval.
A holder to handle a list of undo (or redo) commands.
A wxDirTraverser to filter out symbol (.kicad_sym) files in an unpacked symbol library.
std::vector< wxString > & m_files
virtual wxDirTraverseResult OnFile(const wxString &aFilename) override
virtual wxDirTraverseResult OnDir(const wxString &WXUNUSED(aDirname)) override
UNPACKED_SYMBOL_LIBRARY_DIR_TRAVERSER(std::vector< wxString > &aFiles)
A modified version of the wxInfoBar class that allows us to:
void RemoveAllButtons()
Remove all the buttons that have been added by the user.
bool HasCloseButton() const
void AddLink(const wxString &aLinkText, const std::function< void(wxHyperlinkEvent &)> &aFn)
Add a hypertext link to the infobar.
void Dismiss() override
Dismisses the infobar and updates the containing layout and AUI manager (if one is provided).
void AddCloseButton(const wxString &aTooltip=_("Hide this message."))
Add the default close button to the infobar on the right side.
void ShowMessage(const wxString &aMessage, int aFlags=wxICON_INFORMATION) override
Show the info bar with the provided message and icon.
bool HandleUnsavedChanges(wxWindow *aParent, const wxString &aMessage, const std::function< bool()> &aSaveFunction)
Display a dialog with Save, Cancel and Discard Changes buttons.
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
void DisplayError(wxWindow *aParent, const wxString &aText)
Display an error or warning message box with aMessage.
This file is part of the common library.
#define KICAD_MESSAGE_DIALOG
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
static bool empty(const wxTextEntryBase *aCtrl)
#define KICAD_DEFAULT_DRAWFRAME_STYLE
#define LIB_EDIT_FRAME_NAME
#define UR_TRANSIENT
indicates the item is owned by the undo/redo stack
@ ID_LIBEDIT_SELECT_UNIT_NUMBER
@ ID_LIBEDIT_SELECT_BODY_STYLE
const wxAuiPaneInfo & defaultSchSelectionFilterPaneInfo(wxWindow *aWindow)
const wxAuiPaneInfo & defaultPropertiesPaneInfo(wxWindow *aWindow)
wxString NormalizePath(const wxFileName &aFilePath, const ENV_VAR_MAP *aEnvVars, const wxString &aProjectPath)
Normalize a file path to an environmental variable, if possible.
Helper functions to substitute paths with environmental variables.
@ FRAME_SCH_SYMBOL_EDITOR
static const std::string SymbolLibraryTableFileName
static const std::string KiCadSymbolLibFileExtension
static const std::string SVGFileExtension
static wxString KiCadSymbolLibFileWildcard()
const wxChar *const traceLibWatch
Flag to enable debug output for library file watch refreshes.
const wxChar *const traceApi
Flag to enable debug output related to the IPC API and its plugin system.
std::map< wxString, ENV_VAR_ITEM > ENV_VAR_MAP
EVT_MENU(ID_COMPARE_PROJECT_BRANCHES, KICAD_MANAGER_FRAME::OnCompareProjectBranches) KICAD_MANAGER_FRAME
TAB_VISUAL_STATE ResolveTabVisualState(bool aPreview, bool aModified)
Resolve a tab's decorations from its document state flags.
@ LAYER_SCHEMATIC_GRID_AXES
@ ALL
All except INITIAL_ADD.
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
static std::string normalizedPath(std::string aPath)
void InvokeSchEditSymbolLibTable(KIWAY *aKiway, wxWindow *aParent)
PGM_BASE & Pgm()
The global program "get" accessor.
COLOR_SETTINGS * GetColorSettings(const wxString &aName)
T * GetToolbarSettings(const wxString &aFilename)
T * GetAppSettings(const char *aFilename)
KIWAY Kiway(KFCTL_STANDALONE)
wxString UnescapeString(const wxString &aSource)
Functors that can be used to figure out how the action controls should be displayed in the UI and if ...
Visual decorations derived from document state: preview is italic, modified is bold with a leading as...
static EDA_ORIENTATION orientation(double d)
wxLogTrace helper definitions.
VECTOR2< int32_t > VECTOR2I
VECTOR2< double > VECTOR2D
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.