38#include <wx/snglinst.h>
45#include <wx/checkbox.h>
46#include <wx/stdpaths.h>
66#include <wx/wupdlock.h>
67#include <wx/filedlg.h>
68#include <wx/wfstream.h>
69#include <wx/txtstrm.h>
71#if wxCHECK_VERSION( 3, 1, 7 )
72#include "widgets/filedlg_hook_save_project.h"
74#include "widgets/legacyfiledlg_save_project.h"
78#define USE_INSTRUMENTATION 0
91 bool aKicadFilesOnly )
134 wxFileName fileName( *aFileName );
135 wxString fileFilters;
137 if( aKicadFilesOnly )
139 std::vector<std::string> fileExtensions;
141 for(
unsigned ii = 0; ii < 2; ++ii )
143 if( !fileFilters.IsEmpty() )
144 fileFilters += wxChar(
'|' );
146 fileFilters += wxGetTranslation( loaders[ii].
filter );
149 wxCHECK( plugin,
false );
154 + wxT(
"|" ) + fileFilters;
158 wxString allWildcards;
160 for(
unsigned ii = 2; ii <
arrayDim( loaders ); ++ii )
162 if( !fileFilters.IsEmpty() )
163 fileFilters += wxChar(
'|' );
165 fileFilters += wxGetTranslation( loaders[ii].
filter );
168 wxCHECK( plugin,
false );
173 fileFilters =
_(
"All supported formats" ) + wxT(
"|" ) + allWildcards + wxT(
"|" ) +
181 if( fileName.FileExists() )
183 path = fileName.GetPath();
184 name = fileName.GetFullName();
195 wxFileDialog dlg( aParent,
196 aKicadFilesOnly ?
_(
"Open Board File" ) :
_(
"Import Non KiCad Board File" ),
197 path,
name, fileFilters, wxFD_OPEN | wxFD_FILE_MUST_EXIST );
199 if( dlg.ShowModal() == wxID_OK )
205 *aFileName = dlg.GetPath();
206 aParent->
SetMruPath( wxFileName( dlg.GetPath() ).GetPath() );
228 wxFileName fn = *aFileName;
232 wxFileDialog dlg( aParent,
_(
"Save Board File As" ), fn.GetPath(), fn.GetFullName(), wildcard,
233 wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
236#if wxCHECK_VERSION( 3, 1, 7 )
240 dlg.SetCustomizeHook( newProjectHook );
247 if( dlg.ShowModal() != wxID_OK )
255 *aFileName = fn.GetFullPath();
257#if wxCHECK_VERSION( 3, 1, 7 )
261 *aCreateProject =
true;
263 if( wxWindow* ec = dlg.GetExtraControl() )
266 *aCreateProject =
true;
281 if( !wxFileName::IsFileReadable( fn ) )
300 int id =
event.GetId();
332 wxFileName fn = currfn;
335 fn.SetName( rec_name );
337 if( !fn.FileExists() )
339 msg.Printf(
_(
"Recovery file '%s' not found." ), fn.GetFullPath() );
344 msg.Printf(
_(
"OK to load recovery file '%s'?" ), fn.GetFullPath() );
346 if( !
IsOK(
this, msg ) )
366 msg.Printf(
_(
"Revert '%s' to last version saved?" ), fn.GetFullPath() );
368 if( !
IsOK(
this, msg ) )
383 wxString saveMsg =
_(
"Current board will be closed, save changes to '%s' before "
389 return Files_io_from_id( ID_SAVE_BOARD );
397 if( !
IsOK(
this,
_(
"Current Board will be closed. Continue?" ) ) )
422 if( !
GetBoard()->GetFileName().IsEmpty() )
441 wxFileName::SplitPath(
GetBoard()->GetFileName(),
nullptr,
nullptr, &orig_name,
nullptr );
443 if( orig_name.IsEmpty() )
446 wxFileName savePath(
Prj().GetProjectFullName() );
448 if( !savePath.IsOk() || !savePath.IsDirWritable() )
452 if( !savePath.IsOk() || !savePath.IsDirWritable() )
457 wxString filename = fn.GetFullPath();
458 bool createProject =
false;
459 bool success =
false;
469 success =
SavePcbFile( filename, addToHistory, createProject );
492 wxFileName fn = aFileName;
500 wxFileInputStream input( aFileName );
501 bool is_legacy =
true;
503 if(input.IsOk() && !input.Eof() )
505 wxTextInputStream
text( input );
506 wxString line =
text.ReadLine();
508 if( !line.StartsWith( wxT(
"PCBNEW" ) ) )
558 for(
int i = 0; i < collector.
GetCount(); i++ )
562 int itemWidth =
static_cast<PCB_SHAPE*
>( collector[i] )->GetWidth();
564 if( edgeWidth != -1 && edgeWidth != itemWidth )
567 edgeWidth = std::max( edgeWidth, itemWidth );
571 edgeWidth = itemWidth;
579 DisplayInfoMessage(
this,
_(
"If the zones on this board are refilled the Copper Edge Clearance "
580 "setting will be used (see Board Setup > Design Rules > Constraints).\n"
581 "This may result in different fills from previous KiCad versions which "
582 "used the line thicknesses of the board boundary on the Edge Cuts "
586 return std::max( 0, edgeWidth / 2 );
593 if( aFileSet.size() != 1 )
595 UTF8 msg =
StrPrintf(
"Pcbnew:%s() takes a single filename", __func__ );
600 wxString fullFileName( aFileSet[0] );
601 wxFileName wx_filename( fullFileName );
608 wxASSERT_MSG( wx_filename.IsAbsolute(), wxT(
"Path is not absolute!" ) );
610 std::unique_ptr<wxSingleInstanceChecker> lockFile =
::LockFile( fullFileName );
612 if( !lockFile || lockFile->IsAnotherRunning() )
614 msg.Printf(
_(
"PCB '%s' is already open." ), wx_filename.GetFullName() );
635 wxFileName pro = fullFileName;
638 bool is_new = !wxFileName::IsFileReadable( fullFileName );
644 msg.Printf(
_(
"PCB '%s' does not exist. Do you wish to create it?" ), fullFileName );
646 if( !
IsOK(
this, msg ) )
654 :
_(
"Loading PCB" ), 1 );
701 BOARD* loadedBoard =
nullptr;
707 if( layerRemappablePlugin )
716 bool failedLoad =
false;
728 props[
"page_width"] = xbuf;
729 props[
"page_height"] = ybuf;
732 [&]( wxString aTitle,
int aIcon, wxString aMessage, wxString aAction ) ->
bool
734 KIDIALOG dlg(
nullptr, aMessage, aTitle, wxOK | wxCANCEL | aIcon );
736 if( !aAction.IsEmpty() )
737 dlg.SetOKLabel( aAction );
744#if USE_INSTRUMENTATION
749 loadedBoard = pi->
Load( fullFileName,
nullptr, &props, &
Prj(), &progressReporter );
751#if USE_INSTRUMENTATION
753 printf(
"PLUGIN::Load(): %u usecs\n", stopTime - startTime );
758 msg.Printf(
_(
"Error loading PCB '%s'." ), fullFileName );
759 progressReporter.Hide();
766 if( ioe.
Problem() != wxT(
"CANCEL" ) )
768 msg.Printf(
_(
"Error loading PCB '%s'." ), fullFileName );
769 progressReporter.Hide();
775 catch(
const std::bad_alloc& )
777 msg.Printf(
_(
"Memory exhausted loading PCB '%s'" ), fullFileName );
778 progressReporter.Hide();
798 SetBoard( loadedBoard,
false, &progressReporter );
846 && loadedBoard->
GetGenerator().Lower() != wxT(
"gerbview" ) ) )
851 "It will be converted to the new format when saved." ),
861 wxFileName loadedBoardFn( fullFileName );
862 wxString libNickName = loadedBoardFn.GetName();
873 if( newLibPath.Length() > 0 )
877 for(
FOOTPRINT* footprint : loadedFootprints )
881 if( !footprint->GetFPID().GetLibItemName().empty() )
883 footprint->SetReference(
"REF**" );
890 wxLogError(
_(
"Error saving footprint %s to project specific library." )
892 footprint->GetFPID().GetUniStringLibItemName(),
899 wxString rel_path, env_path;
901 wxASSERT_MSG( wxGetEnv( project_env, &env_path ),
902 wxT(
"There is no project variable?" ) );
904 wxString result( newLibPath );
906 if( result.Replace( env_path, wxT(
"$(" ) + project_env + wxT(
")" ) ) )
910 wxT(
"KiCad" ), wxEmptyString );
921 wxLogError(
_(
"Error saving project specific footprint library table." )
929 LIB_ID libId = footprint->GetFPID();
935 footprint->SetFPID( libId );
942 wxFileName fn = fullFileName;
947 wxString fname = fn.GetFullPath();
960 std::vector<ZONE*> toFill;
976#if 0 && defined(DEBUG)
987 toFill.push_back( zone );
997 progressReporter.
Report(
_(
"Converting zone fills" ) );
1000 if( filler.
Fill( toFill ) )
1025 bool aChangeProject )
1028 wxFileName pcbFileName = aFileName;
1038 wxString msg =
wxString::Format(
_(
"Insufficient permissions to write file '%s'." ),
1039 pcbFileName.GetFullPath() );
1046 wxFileName projectFile( pcbFileName );
1047 wxFileName rulesFile( pcbFileName );
1053 if( !projectFile.FileExists() && aChangeProject )
1061 if( currentRules.FileExists() && !rulesFile.FileExists() && aChangeProject )
1062 KiCopyFile( currentRules.GetFullPath(), rulesFile.GetFullPath(), msg );
1064 if( !msg.IsEmpty() )
1067 rulesFile.GetFullPath() ) );
1070 if( projectFile.FileExists() )
1080 wxString tempFile = wxFileName::CreateTempFileName( wxS(
"pcbnew" ) );
1093 pcbFileName.GetFullPath(),
1096 lowerTxt.Printf(
_(
"Failed to create temporary file '%s'." ), tempFile );
1101 wxRemoveFile( tempFile );
1107 if( !wxRenameFile( tempFile, pcbFileName.GetFullPath() ) )
1110 "Failed to rename temporary file '%s." ),
1111 pcbFileName.GetFullPath(),
1114 lowerTxt.Printf(
_(
"Failed to rename temporary file '%s'." ),
1122 if( !
Kiface().IsSingle() )
1133 LockFile( pcbFileName.GetFullPath() );
1140 wxFileName autoSaveFileName = pcbFileName;
1144 if( autoSaveFileName.FileExists() )
1145 wxRemoveFile( autoSaveFileName.GetFullPath() );
1147 lowerTxt.Printf(
_(
"File '%s' saved." ), pcbFileName.GetFullPath() );
1149 SetStatusText( lowerTxt, 0 );
1166 wxFileName pcbFileName = aFileName;
1174 pcbFileName.GetFullPath() ) );
1188 wxASSERT( pcbFileName.IsAbsolute() );
1190 pi->
Save( pcbFileName.GetFullPath(),
GetBoard(),
nullptr );
1195 pcbFileName.GetFullPath(),
1201 wxFileName projectFile( pcbFileName );
1202 wxFileName rulesFile( pcbFileName );
1208 if( aCreateProject && !projectFile.FileExists() )
1213 if( aCreateProject && currentRules.FileExists() && !rulesFile.FileExists() )
1214 KiCopyFile( currentRules.GetFullPath(), rulesFile.GetFullPath(), msg );
1216 if( !msg.IsEmpty() )
1219 rulesFile.GetFullPath() ) );
1223 pcbFileName.GetFullPath() ) );
1231 wxFileName tmpFileName;
1237 wxString title = GetTitle();
1239 if(
GetBoard()->GetFileName().IsEmpty() )
1250 wxFileName autoSaveFileName = tmpFileName;
1255 if( !autoSaveFileName.IsOk() )
1260 if( !autoSaveFileName.IsDirWritable() )
1262 autoSaveFileName.SetPath( wxFileName::GetTempDir() );
1264 if( !autoSaveFileName.IsOk() || !autoSaveFileName.IsDirWritable() )
1269 wxT(
"Creating auto save file <" ) + autoSaveFileName.GetFullPath() + wxT(
">" ) );
1271 if(
SavePcbFile( autoSaveFileName.GetFullPath(),
false,
false ) )
1279 if( !
Kiface().IsSingle() &&
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Returns # of elements in an array.
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
#define SKIP_CONNECTIVITY
Pcbnew PLUGIN for CADSTAR PCB Archive (*.cpa) format: an ASCII format based on S-expressions.
void SetContentModified(bool aModified=true)
virtual void Push(const wxString &aMessage=wxT("A commit"), int aCommitFlags=0) override
Revert the commit by restoring the modified items state.
int m_CopperEdgeClearance
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
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.
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
void SynchronizeProperties()
Copy the current project's text variables into the boards property cache.
bool m_LegacyCopperEdgeClearanceLoaded
int GetCount() const
Return the number of objects in the list.
static std::map< wxString, PCB_LAYER_ID > GetMapModal(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 void CheckForAutoSaveFile(const wxFileName &aFileName)
Check if an auto save file exists for aFileName and takes the appropriate action depending on the use...
SETTINGS_MANAGER * GetSettingsManager() const
void UpdateFileHistory(const wxString &FullFileName, FILE_HISTORY *aFileHistory=nullptr)
Update the list of recently opened files.
void ClearFileHistory(FILE_HISTORY *aFileHistory=nullptr)
Removes all files from the file history.
wxString GetMruPath() const
bool IsWritable(const wxFileName &aFileName, bool aVerbose=true)
Checks if aFileName can be written.
wxString GetFileFromHistory(int cmdId, const wxString &type, FILE_HISTORY *aFileHistory=nullptr)
Fetches the file name from the file history list.
static wxString GetAutoSaveFilePrefix()
void SetMruPath(const wxString &aPath)
WX_INFOBAR * GetInfoBar()
void ReleaseFile()
Release the current file marked in use.
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
bool LockFile(const wxString &aFileName)
Mark a schematic file as being in use.
std::unique_ptr< wxSingleInstanceChecker > m_file_checker
bool GetCreateNewProject() const
Gets if this hook has attached controls to a dialog box.
bool IsAttachedToDialog() const
Hold a record identifying a library accessed by the appropriate footprint library PLUGIN object in th...
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?
static const wxString GetFileExtension(PCB_FILE_T aFileType)
Return the file extension for aFileType.
PCB_FILE_T
The set of file types that the IO_MGR knows about, and for which there has been a plugin written.
@ LEGACY
Legacy Pcbnew file formats prior to s-expression.
@ KICAD_SEXP
S-expression Pcbnew file format.
static PLUGIN * PluginFind(PCB_FILE_T aFileType)
Return a PLUGIN which the caller can use to import, export, save, or load design documents.
Helper class to create more flexible dialogs, including 'do not show again' checkbox handling.
void DoNotShowCheckbox(wxString file, int line)
Checks the 'do not show again' setting for the dialog.
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
Plugin class for import plugins that support remappable layers.
virtual void RegisterLayerMappingCallback(LAYER_MAPPING_HANDLER aLayerMappingHandler)
Register a different handler to be called when mapping of input layers to KiCad layers occurs.
< Helper widget to select whether a new project should be created for a file when saving
static wxWindow * Create(wxWindow *aParent)
A logical library item identifier and consists of various portions much like a URI.
int SetLibNickname(const UTF8 &aNickname)
Override the logical library name portion of the LIB_ID to aNickname.
const UTF8 & GetLibItemName() const
bool InsertRow(LIB_TABLE_ROW *aRow, bool doReplace=false)
Adds aRow if it does not already exist or if doReplace is true.
void Save(const wxString &aFileName) const
Write this library table to aFileName in s-expression form.
static REPORTER & GetInstance()
static wxString GetDefaultUserProjectsPath()
Gets the default path we point users to create projects.
static TOOL_ACTION repairBoard
wxString GetDesignRulesPath()
Return the absolute path to the design rules file for the currently-loaded board.
wxString CreateNewProjectLibrary(const wxString &aLibName=wxEmptyString, const wxString &aProposedName=wxEmptyString)
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.
const wxSize GetPageSizeIU() const override
Works off of GetPageSettings() to return the size of the paper page in the internal units of this par...
EDA_3D_VIEWER_FRAME * Get3DViewerFrame()
void rebuildConnectivity()
The main frame for Pcbnew.
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.
bool doAutoSave() override
Perform auto save when the board has been modified and not saved within the auto save interval.
void OnModify() override
Must be called after a board change to set the modified flag.
void SaveProjectSettings() override
Save changes to the project settings to the project (.pro) file.
void OnClearFileHistory(wxCommandEvent &aEvent)
bool SavePcbCopy(const wxString &aFileName, bool aCreateProject=false)
Write the board data structures to aFileName.
bool OpenProjectFiles(const std::vector< wxString > &aFileSet, int aCtl=0) override
Load a KiCad board (.kicad_pcb) from aFileName.
bool importFile(const wxString &aFileName, int aFileType)
Load the given filename but sets the path to the current project path.
void onBoardLoaded()
Update the state of the GUI after a new board is loaded or created.
bool Clear_Pcb(bool aQuery, bool aFinal=false)
Delete all and reinitialize the current board.
bool Files_io_from_id(int aId)
Read and write board files according to aId.
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...
void Files_io(wxCommandEvent &event)
Call Files_io_from_id with the wxCommandEvent id.
void UpdateTitle()
Set the main window title bar text.
int inferLegacyEdgeClearance(BOARD *aBoard)
bool SavePcbFile(const wxString &aFileName, bool addToHistory=true, bool aChangeProject=true)
Write the board data structures to a aFileName.
void ResolveDRCExclusions()
Update markers to match recorded exclusions.
void OnFileHistory(wxCommandEvent &event)
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)
Releases a PLUGIN in the context of a potential thrown exception through its destructor.
A base class that BOARD loading and saving plugins should derive from.
virtual void SetQueryUserCallback(std::function< bool(wxString aTitle, int aIcon, wxString aMessage, wxString aAction)> aCallback)
Registers a KIDIALOG callback for collecting info from the user.
virtual void Save(const wxString &aFileName, BOARD *aBoard, const STRING_UTF8_MAP *aProperties=nullptr)
Write aBoard to a storage file in a format that this PLUGIN implementation knows about or it can be u...
virtual BOARD * Load(const wxString &aFileName, BOARD *aAppendToMe, const STRING_UTF8_MAP *aProperties=nullptr, PROJECT *aProject=nullptr, PROGRESS_REPORTER *aProgressReporter=nullptr)
Load information from some input file format that this PLUGIN implementation knows about into either ...
virtual void FootprintSave(const wxString &aLibraryPath, const FOOTPRINT *aFootprint, const STRING_UTF8_MAP *aProperties=nullptr)
Write aFootprint to an existing library located at aLibraryPath.
virtual std::vector< FOOTPRINT * > GetImportedCachedLibraryFootprints()
Return a container with the cached library footprints generated in the last call to Load.
virtual const wxString GetFileExtension() const =0
Returns the file extension for the PLUGIN.
virtual void Report(const wxString &aMessage) override
Display aMessage in the progress bar dialog.
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 FP_LIB_TABLE * PcbFootprintLibs(KIWAY &aKiway)
Return the table of footprint libraries.
virtual PROJECT_LOCAL_SETTINGS & GetLocalSettings() const
virtual const wxString FootprintLibTblName() const
Returns the path and filename of this project's footprint library table.
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.
virtual bool IsNullProject() const
Check if this project is a null project (i.e.
void SaveProjectAs(const wxString &aFullPath, PROJECT *aProject=nullptr)
Sets the currently loaded project path and saves it (pointers remain valid) Note that this will not m...
void SaveProjectCopy(const wxString &aFullPath, PROJECT *aProject=nullptr)
Saves a copy of the current project under the given path.
bool SaveProject(const wxString &aFullPath=wxEmptyString, PROJECT *aProject=nullptr)
Saves a loaded project.
bool LoadProject(const wxString &aFullPath, bool aSetActive=true)
Loads a project or sets up a new project with a specified path.
bool UnloadProject(PROJECT *aProject, bool aSave=true)
Saves, unloads and unregisters the given PROJECT.
bool TriggerBackupIfNeeded(REPORTER &aReporter) const
Calls BackupProject if a new backup is needed according to the current backup policy.
PROJECT & Prj() const
A helper while we are not MDI-capable – return the one and only project.
A name/value tuple with unique names and optional values.
An 8 bit string that is assuredly encoded in UTF8, and supplies special conversion support to and fro...
static void ResolvePossibleSymlinks(wxFileName &aFilename)
void RemoveAllButtons()
Remove all the buttons that have been added by the user.
bool HasCloseButton() const
@ OUTDATED_SAVE
OUTDATED_SAVE Messages that should be cleared on save.
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.
MESSAGE_TYPE GetMessageType() const
void ShowMessage(const wxString &aMessage, int aFlags=wxICON_INFORMATION) override
Show the info bar with the provided message and icon.
Multi-thread safe progress reporter dialog, intended for use of tasks that parallel reporting back of...
A wrapper for reporting to a wxString object.
void SetProgressReporter(PROGRESS_REPORTER *aReporter)
bool Fill(std::vector< ZONE * > &aZones, bool aCheck=false, wxWindow *aParent=nullptr)
Fills the given list of zones.
Handle a list of polygons defining a copper zone.
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Display a yes/no dialog with aMessage and returns the user response.
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
bool OverrideLock(wxWindow *aParent, const wxString &aMessage)
Display a dialog indicating the file is already open, with an option to reset the lock.
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.
This file is part of the common library.
#define CANDIDATE
flag indicating that the structure is connected
void KiCopyFile(const wxString &aSrcPath, const wxString &aDestPath, wxString &aErrors)
#define WIN_STRING_DIR_SEP
#define UNIX_STRING_DIR_SEP
const std::string LegacyPcbFileExtension
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.
const std::string KiCadPcbFileExtension
const std::string ProjectFileExtension
const std::string DesignRulesFileExtension
wxString LegacyPcbFileWildcard()
wxString CadstarPcbArchiveFileWildcard()
wxString AltiumDesignerPcbFileWildcard()
wxString PCadPcbFileWildcard()
wxString EaglePcbFileWildcard()
wxString FabmasterPcbFileWildcard()
wxString AltiumCircuitMakerPcbFileWildcard()
wxString AltiumCircuitStudioPcbFileWildcard()
wxString PcbFileWildcard()
const wxChar *const traceAutoSave
Flag to enable auto save feature debug tracing.
#define KICTL_CREATE
caller thinks requested project files may not exist.
#define KICTL_EAGLE_BRD
chosen *.brd file is Eagle according to user.
#define KICTL_IMPORT_LIB
import all footprints into a project library.
@ GAL_LAYER_ID_BITMASK_END
This is the end of the layers used for visibility bit masks in legacy board files.
#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 KI_FALLTHROUGH
The KI_FALLTHROUGH macro is to be used when switch statement cases should purposely fallthrough from ...
Message panel definition file.
#define SEXPR_BOARD_FILE_VERSION
Current s-expression file format version. 2 was the last legacy format version.
bool AskSaveBoardFileName(PCB_EDIT_FRAME *aParent, wxString *aFileName, bool *aCreateProject)
Put up a wxFileDialog asking for a BOARD filename to save.
bool AskLoadBoardFileName(PCB_EDIT_FRAME *aParent, int *aCtl, wxString *aFileName, bool aKicadFilesOnly)
Show a wxFileDialog asking for a BOARD filename to open.
IO_MGR::PCB_FILE_T plugin_type(const wxString &aFileName, int aCtl)
@ ID_IMPORT_NON_KICAD_BOARD
@ ID_MENU_RECOVER_BOARD_AUTOSAVE
unsigned 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
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Class that computes missing connections on a PCB.
int StrPrintf(std::string *result, const char *format,...)
This is like sprintf() but the output is appended to a std::string instead of to a character array.
wxLogTrace helper definitions.
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
Definition of file extensions used in Kicad.