44#include <wx/snglinst.h>
84#include <wx/stdpaths.h>
86#include <wx/filedlg.h>
87#include <wx/txtstrm.h>
88#include <wx/wfstream.h>
89#include <wx/zipstrm.h>
95#define USE_INSTRUMENTATION 0
111 std::vector<IO_BASE::IO_FILE_DESC> descriptions;
124 wxCHECK( pi,
false );
131 descriptions.emplace_back( desc );
134 wxString fileFiltersStr;
135 std::vector<std::string> allExtensions;
136 std::set<wxString> allWildcardsSet;
140 if( !fileFiltersStr.IsEmpty() )
141 fileFiltersStr += wxChar(
'|' );
143 fileFiltersStr += desc.FileFilter();
145 for(
const std::string& ext : desc.m_FileExtensions )
147 allExtensions.emplace_back( ext );
152 wxString allWildcardsStr;
154 for(
const wxString& wildcard : allWildcardsSet )
155 allWildcardsStr << wildcard;
163 fileFiltersStr =
_(
"All supported formats" ) + wxT(
"|" ) + allWildcardsStr + wxT(
"|" )
167 wxFileName fileName( *aFileName );
171 if( fileName.FileExists() )
173 path = fileName.GetPath();
174 name = fileName.GetFullName();
187 wxFileDialog dlg( aParent, kicadFormat ?
_(
"Open Board File" ) :
_(
"Import Non KiCad Board File" ),
188 path,
name, fileFiltersStr, wxFD_OPEN | wxFD_FILE_MUST_EXIST );
193 dlg.SetCustomizeHook( importOptions );
197 if( dlg.ShowModal() == wxID_OK )
199 *aFileName = dlg.GetPath();
200 aParent->
SetMruPath( wxFileName( dlg.GetPath() ).GetPath() );
226 wxFileName fn = *aFileName;
230 wxFileDialog dlg( aParent,
_(
"Save Board File As" ), fn.GetPath(), fn.GetFullName(), wildcard,
231 wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
237 dlg.SetCustomizeHook( newProjectHook );
241 if( dlg.ShowModal() != wxID_OK )
244 *aFileName = dlg.GetPath();
250 *aCreateProject =
true;
260 if( !filename.IsEmpty() )
262 if( !wxFileName::IsFileReadable( filename ) )
282 if( !
Kiface().IsSingle() )
286 wxString fileName =
m_frame->Prj().AbsolutePath(
m_frame->GetBoard()->GetFileName() );
289 m_frame->OpenProjectFiles( std::vector<wxString>( 1, fileName ), open_ctl );
302 m_frame->OpenProjectFiles( std::vector<wxString>( 1, fileName ), open_ctl );
310 wxFileName fn =
m_frame->Prj().AbsolutePath(
m_frame->GetBoard()->GetFileName() );
312 if( !
IsOK(
m_frame, wxString::Format(
_(
"Revert '%s' to last version saved?" ), fn.GetFullPath() ) ) )
315 m_frame->GetScreen()->SetContentModified(
false );
328 if( !
Kiface().IsSingle() )
331 if(
m_frame->IsContentModified() )
333 wxFileName fileName =
m_frame->GetBoard()->GetFileName();
334 wxString saveMsg =
_(
"Current board will be closed, save changes to '%s' before "
340 return m_frame->SaveBoard();
346 else if( !
m_frame->GetBoard()->IsEmpty() )
348 if( !
IsOK(
m_frame,
_(
"Current Board will be closed. Continue?" ) ) )
352 m_frame->SaveProjectLocalSettings();
354 m_frame->GetBoard()->ClearProject();
357 if( !
m_frame->Clear_Pcb(
false ) )
360 m_frame->LoadProjectSettings();
374 if( !
GetBoard()->GetFileName().IsEmpty() )
388 wxFileName::SplitPath(
GetBoard()->GetFileName(),
nullptr,
nullptr, &orig_name,
nullptr );
390 if( orig_name.IsEmpty() )
393 wxFileName savePath(
Prj().GetProjectFullName() );
395 if( !savePath.IsOk() || !savePath.IsDirWritable() )
399 if( !savePath.IsOk() || !savePath.IsDirWritable() )
404 wxString filename = fn.GetFullPath();
405 bool createProject =
false;
406 bool success =
false;
416 success =
SavePcbFile( filename, aSaveAs, createProject );
437 for(
int i = 0; i < collector.
GetCount(); i++ )
441 int itemWidth =
static_cast<PCB_SHAPE*
>( collector[i] )->GetWidth();
443 if( edgeWidth != -1 && edgeWidth != itemWidth )
446 edgeWidth = std::max( edgeWidth, itemWidth );
450 edgeWidth = itemWidth;
455 if( mixed && aShowUserMsg )
459 _(
"If the zones on this board are refilled the Copper Edge "
460 "Clearance setting will be used (see Board Setup > Design "
461 "Rules > Constraints).\n This may result in different fills "
462 "from previous KiCad versions which used the line thicknesses "
463 "of the board boundary on the Edge Cuts layer." ) );
466 return std::max( 0, edgeWidth / 2 );
473 if( aFileSet.size() != 1 )
475 DisplayError(
this, wxString::Format(
"Pcbnew:%s() takes a single filename", __func__ ) );
479 wxString fullFileName( aFileSet[0] );
480 wxFileName wx_filename( fullFileName );
488 wxASSERT_MSG( wx_filename.IsAbsolute(), wxT(
"Path is not absolute!" ) );
490 std::unique_ptr<LOCKFILE> lock = std::make_unique<LOCKFILE>( fullFileName );
492 if( !lock->Valid() && lock->IsLockedByMe() )
498 if( !
Pgm().SingleInstance()->IsAnotherRunning() )
499 lock->OverrideLock();
505 if(
Prj().IsLockOverrideGranted() )
507 lock->OverrideLock();
511 msg.Printf(
_(
"PCB '%s' is already open by '%s' at '%s'." ),
512 wx_filename.GetFullName(),
514 lock->GetHostname() );
519 lock->OverrideLock();
535 wxFileName pro = fullFileName;
538 bool is_new = !wxFileName::IsFileReadable( fullFileName );
546 msg.Printf(
_(
"PCB '%s' does not exist. Do you wish to create it?" ), fullFileName );
548 if( !
IsOK(
this, msg ) )
556 statusBar->ClearWarningMessages(
"load" );
573 progressReporter.Hide();
634 BOARD* loadedBoard =
nullptr;
635 bool failedLoad =
false;
639 std::map<std::string, UTF8> props;
648#if USE_INSTRUMENTATION
656 ?
static_cast<REPORTER*
>( &loadReporter )
669 std::placeholders::_1 ) );
676 chooser_pi->RegisterCallback(
679 std::placeholders::_1 ) );
682 aPlugin.SetQueryUserCallback(
683 [&]( wxString aTitle,
int aIcon, wxString aMessage,
684 wxString aAction ) ->
bool
686 KIDIALOG dlg(
nullptr, aMessage, aTitle,
687 wxOK | wxCANCEL | aIcon );
689 if( !aAction.IsEmpty() )
690 dlg.SetOKLabel( aAction );
698 std::unique_ptr<BOARD> loaded =
700 loadedBoard = loaded.release();
702#if USE_INSTRUMENTATION
704 printf(
"PCB_IO::Load(): %u usecs\n", stopTime - startTime );
709 msg.Printf(
_(
"Error loading PCB '%s'." ), fullFileName );
710 progressReporter.Hide();
717 if( ioe.
Problem() != wxT(
"CANCEL" ) )
719 msg.Printf(
_(
"Error loading PCB '%s'." ), fullFileName );
720 progressReporter.Hide();
726 catch(
const std::bad_alloc& )
728 msg.Printf(
_(
"Memory exhausted loading PCB '%s'" ), fullFileName );
729 progressReporter.Hide();
735 if( failedLoad || !loadedBoard )
742 statusBar->AddWarningMessages(
"load", loadReporter.
GetMessages() );
764 SetBoard( loadedBoard,
false, &progressReporter );
766 postLoadTimer.
msecs(
true ) );
805 m_infoBar->ShowMessage(
_(
"Could not load component class assignment rules" ),
806 wxICON_WARNING, WX_INFOBAR::MESSAGE_TYPE::GENERIC );
812 postLoadTimer.
msecs(
true ) );
818 postLoadTimer.
msecs(
true ) );
824 postLoadTimer.
msecs(
true ) );
836 && loadedBoard->
GetGenerator().Lower() != wxT(
"gerbview" ) ) )
840 m_infoBar->ShowMessage(
_(
"This file was created by an older version of KiCad. "
841 "It will be converted to the new format when saved." ),
842 wxICON_WARNING, WX_INFOBAR::MESSAGE_TYPE::OUTDATED_SAVE );
854 wxFileName loadedBoardFn( fullFileName );
855 wxString libNickName = loadedBoardFn.GetName();
860 std::vector<FOOTPRINT*> loadedFootprints = pi->GetImportedCachedLibraryFootprints();
867 if( newLibPath.Length() > 0 )
871 for(
FOOTPRINT* footprint : loadedFootprints )
875 if( !footprint->GetFPID().GetLibItemName().empty() )
877 footprint->SetReference(
"REF**" );
878 piSexpr->FootprintSave( newLibPath, footprint );
884 wxLogError(
_(
"Error saving footprint %s to project specific library." )
886 footprint->GetFPID().GetUniStringLibItemName(),
891 FP_LIB_TABLE* prjlibtable = PROJECT_PCB::PcbFootprintLibs( &
Prj() );
893 wxString rel_path, env_path;
895 wxASSERT_MSG( wxGetEnv( project_env, &env_path ),
896 wxT(
"There is no project variable?" ) );
898 wxString
result( newLibPath );
900 if(
result.Replace( env_path, wxT(
"$(" ) + project_env + wxT(
")" ) ) )
903 FP_LIB_TABLE_ROW* row =
new FP_LIB_TABLE_ROW( libNickName, rel_path,
904 wxT(
"KiCad" ), wxEmptyString );
905 prjlibtable->InsertRow( row );
911 PROJECT_PCB::PcbFootprintLibs( &
Prj() )->Save( tblName );
915 wxLogError(
_(
"Error saving project specific footprint library table." )
923 LIB_ID libId = footprint->GetFPID();
929 footprint->SetFPID( libId );
941 fname = previousBoardFileName;
947 fn.SetPath(
Prj().GetProjectPath() );
948 fn.SetName(
Prj().GetProjectName() );
951 fname = fn.GetFullPath();
965 std::vector<ZONE*> toFill;
970 wxLogTrace(
traceAllegroPerf, wxT(
"Post-load BuildConnectivity: %.3f ms" ),
971 connectivityTimer.
msecs(
true ) );
976 wxLogTrace(
traceAllegroPerf, wxT(
"Post-load LoadProjectSettings+DrawingSheet: %.3f ms" ),
977 connectivityTimer.
msecs(
true ) );
987 wxLogTrace(
traceAllegroPerf, wxT(
"Post-load DRC+ComponentClass+Tuning caches: %.3f ms" ),
988 connectivityTimer.
msecs(
true ) );
993 connectivityTimer.
msecs(
true ) );
994 wxLogTrace(
traceAllegroPerf, wxT(
"=== Post-load pipeline total: %.3f ms ===" ),
995 connectivityTimer.
msecs() );
1002#if 0 && defined(DEBUG)
1031 statusBar->AddWarningMessages(
"load", loadReporter.
GetMessages() );
1038 bool aChangeProject )
1041 wxFileName pcbFileName = aFileName;
1051 wxString msg = wxString::Format(
_(
"Insufficient permissions to write file '%s'." ),
1052 pcbFileName.GetFullPath() );
1059 wxFileName projectFile( pcbFileName );
1060 wxFileName rulesFile( pcbFileName );
1066 if( projectFile.FileExists() )
1070 else if( aChangeProject )
1076 wxFileName currentRules(
GetBoard()->GetDesignRulesPath() );
1078 if( currentRules.FileExists() && !rulesFile.FileExists() && aChangeProject )
1079 KiCopyFile( currentRules.GetFullPath(), rulesFile.GetFullPath(), msg );
1081 if( !msg.IsEmpty() )
1083 DisplayError(
this, wxString::Format(
_(
"Error saving custom rules file '%s'." ),
1084 rulesFile.GetFullPath() ) );
1087 if( projectFile.FileExists() )
1102 if( pcbFileName.FileExists() )
1109 pi->SaveBoard( pcbFileName.GetFullPath(),
GetBoard(),
nullptr );
1113 DisplayError(
this, wxString::Format(
_(
"Error saving board file '%s'.\n%s" ),
1114 pcbFileName.GetFullPath(),
1119 if( !
Kiface().IsSingle() )
1126 SetStatusText( upperTxt, 1 );
1133 LockFile( pcbFileName.GetFullPath() );
1139 lowerTxt.Printf(
_(
"File '%s' saved." ), pcbFileName.GetFullPath() );
1141 SetStatusText( lowerTxt, 0 );
1144 if(
m_infoBar->GetMessageType() == WX_INFOBAR::MESSAGE_TYPE::OUTDATED_SAVE )
1157 if( !
Prj().IsNullProject() )
1179 wxFileName pcbFileName( aFileName );
1185 DisplayError(
this, wxString::Format(
_(
"Insufficient permissions to write file '%s'." ),
1186 pcbFileName.GetFullPath() ) );
1199 if( pcbFileName.FileExists() )
1206 wxASSERT( pcbFileName.IsAbsolute() );
1208 pi->SaveBoard( pcbFileName.GetFullPath(),
GetBoard(),
nullptr );
1214 DisplayError(
this, wxString::Format(
_(
"Error saving board file '%s'.\n%s" ),
1215 pcbFileName.GetFullPath(),
1222 wxFileName projectFile( pcbFileName );
1223 wxFileName rulesFile( pcbFileName );
1229 if( aCreateProject && !projectFile.FileExists() )
1232 wxFileName currentRules(
GetBoard()->GetDesignRulesPath() );
1234 if( aCreateProject && currentRules.FileExists() && !rulesFile.FileExists() )
1235 KiCopyFile( currentRules.GetFullPath(), rulesFile.GetFullPath(), msg );
1237 if( !msg.IsEmpty() && !aHeadless )
1239 DisplayError(
this, wxString::Format(
_(
"Error saving custom rules file '%s'." ),
1240 rulesFile.GetFullPath() ) );
1248 const std::map<std::string, UTF8>* aProperties )
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
void SetContentModified(bool aModified=true)
int m_CopperEdgeClearance
int GenerateODBPPFiles(const TOOL_EVENT &aEvent)
int New(const TOOL_EVENT &aEvent)
int Revert(const TOOL_EVENT &aEvent)
int GenIPC2581File(const TOOL_EVENT &aEvent)
int Open(const TOOL_EVENT &aEvent)
int OpenNonKicadBoard(const TOOL_EVENT &aEvent)
static std::unique_ptr< BOARD > Load(const wxString &aFileName, PCB_IO_MGR::PCB_FILE_T aFormat, PROJECT *aProject, const OPTIONS &aOptions)
Information pertinent to a Pcbnew printed circuit board.
bool m_LegacyDesignSettingsLoaded
True if the legacy board design settings were loaded from a file.
GAL_SET m_LegacyVisibleItems
LENGTH_DELAY_CALCULATION * GetLengthCalculation() const
Returns the track length calculator.
void SetFileName(const wxString &aFileName)
bool BuildConnectivity(PROGRESS_REPORTER *aReporter=nullptr)
Build or rebuild the board connectivity database for the board, especially the list of connected item...
void SynchronizeNetsAndNetClasses(bool aResetTrackAndViaSizes)
Copy NETCLASS info to each NET, based on NET membership in a NETCLASS.
bool SetLayerName(PCB_LAYER_ID aLayer, const wxString &aLayerName)
Changes the name of the layer given by aLayer.
LSET m_LegacyVisibleLayers
Visibility settings stored in board prior to 6.0, only used for loading legacy files.
void SetProject(PROJECT *aProject, bool aReferenceOnly=false)
Link a board to a given project.
const wxString & GetFileName() const
int GetFileFormatVersionAtLoad() const
const wxString & GetGenerator() const
Adds an item to the container.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
const LSET & GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
void SynchronizeProperties()
Copy the current project's text variables into the boards property cache.
COMPONENT_CLASS_MANAGER & GetComponentClassManager()
Gets the component class manager.
bool SynchronizeComponentClasses(const std::unordered_set< wxString > &aNewSheetPaths) const
Copy component class / component class generator information from the project settings.
bool m_LegacyCopperEdgeClearanceLoaded
int GetCount() const
Return the number of objects in the list.
void RebuildRequiredCaches(FOOTPRINT *aFootprint=nullptr) const
Rebuilds any caches that may be required by custom assignment rules.
static void GenerateODBPPFiles(const JOB_EXPORT_PCB_ODB &aJob, BOARD *aBoard, PCB_EDIT_FRAME *aParentFrame=nullptr, PROGRESS_REPORTER *aProgressReporter=nullptr, REPORTER *aErrorReporter=nullptr)
wxString GetOutputPath() const
int GetCompressFormat() const
wxString GetUnitsString() const
static std::vector< IMPORT_PROJECT_DESC > RunModal(wxWindow *aParent, const std::vector< IMPORT_PROJECT_DESC > &aProjectDesc)
Create and show a dialog (modal) and returns the data from it after completion.
static std::map< wxString, PCB_LAYER_ID > RunModal(wxWindow *aParent, const std::vector< INPUT_LAYER_DESC > &aLayerDesc)
Create and show a dialog (modal) and returns the data from it after completion.
Create and handle a window for the 3d viewer connected to a Kiway and a pcbboard.
void NewDisplay(bool aForceImmediateRedraw=false)
Reload and refresh (rebuild) the 3D scene.
virtual APP_SETTINGS_BASE * config() const
Return the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
void CheckForAutosaveFiles(const wxString &aProjectPath, const std::vector< wxString > &aExtensions)
Check for autosave files newer than their source files for the given project.
SETTINGS_MANAGER * GetSettingsManager() const
wxTimer * m_autoSaveTimer
void UpdateFileHistory(const wxString &FullFileName, FILE_HISTORY *aFileHistory=nullptr)
Update the list of recently opened files.
wxString GetMruPath() const
bool IsWritable(const wxFileName &aFileName, bool aVerbose=true)
Check if aFileName can be written.
virtual void ClearFileHistory()
Remove all files from the file history.
wxString GetFileFromHistory(int cmdId, const wxString &type, FILE_HISTORY *aFileHistory=nullptr)
Fetch the file name from the file history list.
void SetMruPath(const wxString &aPath)
WX_INFOBAR * GetInfoBar()
std::unique_ptr< LOCKFILE > m_file_checker
bool LockFile(const wxString &aFileName)
Mark a schematic file as being in use.
bool GetCreateNewProject() const
Gets the selected state of the copy subsheets option.
bool IsAttachedToDialog() const
bool GetShowIssues() const
static const std::vector< KICAD_T > AllBoardItems
A scan list for all editable board items.
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
virtual const wxString What() const
A composite of Problem() and Where()
virtual const wxString Problem() const
what was the problem?
ODB_COMPRESSION m_compressionMode
void SetConfiguredOutputPath(const wxString &aPath)
Sets the configured output path for the job, this path is always saved to file.
Helper class to create more flexible dialogs, including 'do not show again' checkbox handling.
void DoNotShowCheckbox(wxString file, int line)
Shows the 'do not show again' checkbox.
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
LOCAL_HISTORY & LocalHistory()
Return the LOCAL_HISTORY associated with this KIWAY.
Plugin class for import plugins that support remappable layers.
void SynchronizeTuningProfileProperties() const
Ensure time domain properties provider is synced with board / project settings if required.
A logical library item identifier and consists of various portions much like a URI.
int SetLibNickname(const UTF8 &aLibNickname)
Override the logical library name portion of the LIB_ID to aLibNickname.
const UTF8 & GetLibItemName() const
bool RunRegisteredSaversAndCommit(const wxString &aProjectPath, const wxString &aTitle, const wxString &aTagFileType=wxEmptyString)
Run all registered savers and, if any staged changes differ from HEAD, create a commit.
bool Init(const wxString &aProjectPath)
Initialize the local history repository for the given project path.
void RemoveAutosaveFiles(const wxString &aProjectPath) const
Remove every autosave file under the project at aProjectPath regardless of which source it shadowed.
LSEQ Seq(const LSEQ &aSequence) const
Return an LSEQ from the union of this LSET and a desired sequence.
static REPORTER & GetInstance()
static wxString GetDefaultUserProjectsPath()
Gets the default path we point users to create projects.
static TOOL_ACTION repairBoard
static TOOL_ACTION rehatchShapes
wxString CreateNewProjectLibrary(const wxString &aDialogTitle, const wxString &aLibName)
const VECTOR2I GetPageSizeIU() const override
Works off of GetPageSettings() to return the size of the paper page in the internal units of this par...
PCBNEW_SETTINGS * GetPcbNewSettings() const
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
EDA_3D_VIEWER_FRAME * Get3DViewerFrame()
virtual void UpdateStatusBar() override
Update the status bar information.
The main frame for Pcbnew.
void LoadDrawingSheet()
Load the drawing sheet file.
void ResolveDRCExclusions(bool aCreateMarkers)
If aCreateMarkers then create DRC exclusion markers from the serialized data.
void SetBoard(BOARD *aBoard, PROGRESS_REPORTER *aReporter=nullptr) override
Set the #m_Pcb member in such as way as to ensure deleting any previous BOARD.
void OnModify() override
Must be called after a board change to set the modified flag.
void OnClearFileHistory(wxCommandEvent &aEvent)
bool SaveBoard(bool aSaveAs=false, bool aSaveCopy=false)
bool OpenProjectFiles(const std::vector< wxString > &aFileSet, int aCtl=0) override
Load a KiCad board (.kicad_pcb) from aFileName.
void ProjectChanged() override
Notification event that the project has changed.
void SaveProjectLocalSettings() override
Save changes to the project local settings.
bool SavePcbCopy(const wxString &aFileName, bool aCreateProject=false, bool aHeadless=false)
Write the board data structures to aFileName.
bool IsContentModified() const override
Get if the current board has been modified but not saved.
bool LoadProjectSettings()
Load the current project's file configuration settings which are pertinent to this PCB_EDIT_FRAME ins...
bool Clear_Pcb(bool doAskAboutUnsavedChanges, bool aFinal=false)
Delete all and reinitialize the current board.
void OnBoardLoaded()
Update the state of the GUI after a new board is loaded or created.
void UpdateTitle()
Set the main window title bar text.
int inferLegacyEdgeClearance(BOARD *aBoard, bool aShowUserMsg=true)
const std::map< std::string, UTF8 > * m_importProperties
bool SavePcbFile(const wxString &aFileName, bool addToHistory=true, bool aChangeProject=true)
Write the board data structures to a aFileName.
bool importFile(const wxString &aFileName, int aFileType, const std::map< std::string, UTF8 > *aProperties=nullptr)
Load the given filename but sets the path to the current project path.
void saveProjectSettings() override
Save any design-related project settings associated with this frame.
void OnFileHistory(wxCommandEvent &event)
static PLUGIN_REGISTRY * Instance()
PCB_FILE_T
The set of file types that the PCB_IO_MGR knows about, and for which there has been a plugin written,...
@ KICAD_SEXP
S-expression Pcbnew file format.
@ GEDA_PCB
Geda PCB file formats.
@ LEGACY
Legacy Pcbnew file formats prior to s-expression.
static PCB_IO * FindPlugin(PCB_FILE_T aFileType)
Return a #PLUGIN which the caller can use to import, export, save, or load design documents.
static PCB_FILE_T FindPluginTypeFromBoardPath(const wxString &aFileName, int aCtl=0)
Return a plugin type given a path for a board file.
A base class that BOARD loading and saving plugins should derive from.
Collect all BOARD_ITEM objects on a given layer.
void Collect(BOARD_ITEM *aBoard, const std::vector< KICAD_T > &aTypes)
Test a BOARD_ITEM using this class's Inspector method, which does the collection.
void SetLayerId(PCB_LAYER_ID aLayerId)
void PreloadDesignBlockLibraries(KIWAY *aKiway)
Starts a background job to preload the global and project design block libraries.
A small class to help profiling.
double msecs(bool aSinceLast=false)
virtual void AdvancePhase() override
Use the next available virtual zone of the dialog progress bar.
void AddPhases(int aNumPhases) override
bool KeepRefreshing(bool aWait=false) override
Update the UI dialog.
Plugin class for import plugins that support choosing a project.
LSET m_VisibleLayers
Board settings.
GAL_SET m_VisibleItems
The GAL layers (aka items) that are turned on for viewing (.
virtual void SetReadOnly(bool aReadOnly=true)
virtual const wxString GetProjectFullName() const
Return the full path and name of the project.
virtual PROJECT_LOCAL_SETTINGS & GetLocalSettings() const
virtual const wxString FootprintLibTblName() const
Returns the path and filename of this project's footprint library table.
virtual bool IsNullProject() const
Check if this project is a null project (i.e.
A pure virtual class used to derive REPORTER objects from.
void SaveProjectAs(const wxString &aFullPath, PROJECT *aProject=nullptr)
Set the currently loaded project path and saves it (pointers remain valid).
bool SaveProject(const wxString &aFullPath=wxEmptyString, PROJECT *aProject=nullptr)
Save a loaded project.
bool SaveProjectCopy(const wxString &aFullPath, PROJECT *aProject=nullptr)
Save a copy of the current project under the given path.
bool LoadProject(const wxString &aFullPath, bool aSetActive=true)
Load a project or sets up a new project with a specified path.
bool UnloadProject(PROJECT *aProject, bool aSave=true)
Save, unload and unregister the given PROJECT.
PROJECT & Prj() const
A helper while we are not MDI-capable – return the one and only project.
static void ResolvePossibleSymlinks(wxFileName &aFilename)
void Dismiss() override
Dismisses the infobar and updates the containing layout and AUI manager (if one is provided).
Multi-thread safe progress reporter dialog, intended for use of tasks that parallel reporting back of...
A wrapper for reporting to a wxString object.
const wxString & GetMessages() const
wxString EnsureFileExtension(const wxString &aFilename, const wxString &aExtension)
It's annoying to throw up nag dialogs when the extension isn't right.
bool AskOverrideLock(wxWindow *aParent, const wxString &aMessage)
Display a dialog indicating the file is already open, with an option to reset the lock.
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Display a yes/no dialog with aMessage and returns the user response.
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
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.
Declaration of the eda_3d_viewer class.
void KiCopyFile(const wxString &aSrcPath, const wxString &aDestPath, wxString &aErrors)
#define WIN_STRING_DIR_SEP
#define UNIX_STRING_DIR_SEP
static const std::string ProjectFileExtension
static const std::string LegacyPcbFileExtension
static const std::string DesignRulesFileExtension
static const std::string KiCadPcbFileExtension
static wxString PcbFileWildcard()
std::unique_ptr< T > IO_RELEASER
Helper to hold and release an IO_BASE object when exceptions are thrown.
#define KICTL_CREATE
caller thinks requested project files may not exist.
#define KICTL_REVERT
reverting to a previously-saved (KiCad) file.
#define KICTL_IMPORT_LIB
import all footprints into a project library.
#define KICTL_KICAD_ONLY
chosen file is from KiCad according to user
#define KICTL_NONKICAD_ONLY
chosen file is non-KiCad according to user
@ GAL_LAYER_ID_BITMASK_END
This is the end of the layers used for visibility bit masks in legacy board files.
PCB_LAYER_ID
A quick note on layer IDs:
#define GAL_LAYER_INDEX(x)
Use this macro to convert a GAL layer to a 0-indexed offset from LAYER_VIAS.
This file contains miscellaneous commonly used macros and functions.
#define SEXPR_BOARD_FILE_VERSION
Current s-expression file format version. 2 was the last legacy format version.
bool AskLoadBoardFileName(PCB_EDIT_FRAME *aParent, wxString *aFileName, int aCtl=0)
Show a wxFileDialog asking for a BOARD filename to open.
bool AskSaveBoardFileName(PCB_EDIT_FRAME *aParent, wxString *aFileName, bool *aCreateProject)
Put up a wxFileDialog asking for a BOARD filename to save.
static const wxChar *const traceAllegroPerf
PGM_BASE & Pgm()
The global program "get" accessor.
int64_t GetRunningMicroSecs()
An alternate way to calculate an elapsed time (in microsecondes) to class PROF_COUNTER.
#define PROJECT_VAR_NAME
A variable name whose value holds the current project directory.
#define NAMELESS_PROJECT
default name for nameless projects
KIWAY Kiway(KFCTL_STANDALONE)
bool show_import_issues
Stored value for "show import issues" when importing non-KiCad designs to this application.
bool initialize_after_load
std::function< void(PCB_IO &)> plugin_configurator
const std::map< std::string, UTF8 > * properties
PROGRESS_REPORTER * progress_reporter
Container that describes file type info.
std::vector< std::string > m_FileExtensions
Filter used for file pickers if m_IsFile is true.
bool m_CanRead
Whether the IO can read this file type.
virtual void PreloadLibraries(KIWAY *aKiway)
IbisParser parser & reporter
wxString result
Test unit parsing edge cases and error handling.
wxLogTrace helper definitions.
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
wxString AddFileExtListToFilter(const std::vector< std::string > &aExts)
Build the wildcard extension file dialog wildcard filter to add to the base message dialog.
wxString formatWildcardExt(const wxString &aWildcard)
Format wildcard extension to support case sensitive file dialogs.
Definition of file extensions used in Kicad.