77#include <wx/filedlg.h>
79#include <wx/process.h>
91#include <ApplicationServices/ApplicationServices.h>
100#define EDITORS_CAPTION _( "Editors" )
101#define PROJECT_FILES_CAPTION _( "Project Files" )
103#define ID_INIT_WATCHED_PATHS 52913
105#define SEP() wxFileName::GetPathSeparator()
146#include <wx/xml/xml.h>
149 const wxSize& size ) :
152 m_openSavedWindows( false ),
153 m_restoredFromHistory( false ),
154 m_active_project( false ),
155 m_showHistoryPanel( false ),
156 m_showGitCommitPanel( true ),
157 m_projectTreePane( nullptr ),
158 m_historyPane( nullptr ),
159 m_gitCommitPane( nullptr ),
160 m_launcher( nullptr ),
161 m_lastToolbarIconSize( 0 ),
162 m_pcmButton( nullptr ),
163 m_pcmUpdateCount( 0 )
165 const int defaultLeftWinWidth = FromDIP( 250 );
167 m_leftWinWidth = defaultLeftWinWidth;
168 m_aboutTitle =
"KiCad";
183 CreateStatusBar( 2 );
191 wxIconBundle icon_bundle;
196 icon_bundle.AddIcon( icon );
198 icon_bundle.AddIcon( icon );
200 icon_bundle.AddIcon( icon );
202 icon_bundle.AddIcon( icon );
204 icon_bundle.AddIcon( icon );
209 icon_bundle.AddIcon( icon );
211 icon_bundle.AddIcon( icon );
213 icon_bundle.AddIcon( icon );
215 icon_bundle.AddIcon( icon );
217 icon_bundle.AddIcon( icon );
220 SetIcons( icon_bundle );
236 m_auimgr.SetManagedWindow(
this );
237 m_auimgr.SetFlags( wxAUI_MGR_LIVE_RESIZE );
239 m_auimgr.AddPane( m_tbLeft,
EDA_PANE().VToolbar().Name(
"TopMainToolbar" ).Left().Layer( 2 ) );
243 m_auimgr.AddPane( m_projectTreePane,
244 EDA_PANE().Palette().Name(
"ProjectTree" ).Left().Layer( 1 )
246 .MinSize( m_leftWinWidth, -1 ).Floatable(
false ).Movable(
false ) );
249 m_auimgr.AddPane( m_historyPane,
250 EDA_PANE().Palette().Name(
"LocalHistory" ).Left().Layer( 1 ).Position( 1 )
251 .Caption(
_(
"Local History" ) ).PaneBorder(
false )
252 .Floatable(
false ).Movable(
false ).CloseButton(
true ).Hide() );
254 if( m_showHistoryPanel )
255 m_auimgr.GetPane( m_historyPane ).Show();
258 m_auimgr.AddPane( m_gitCommitPane,
EDA_PANE()
260 .Name( GitCommitPaneName() )
264 .Caption(
_(
"Version Control" ) )
265 .MinSize( wxSize( m_gitCommitPane->GetMinDockWidth(), -1 ) )
272 if( m_showGitCommitPanel )
273 m_auimgr.GetPane( m_gitCommitPane ).Show();
277 Bind( wxEVT_ACTIVATE,
278 [
this]( wxActivateEvent& aEvent )
284 if( aEvent.GetActive() && GitCommitPaneShown() )
285 m_gitCommitPane->RefreshFileList();
288 wxSize client_size = GetClientSize();
289 m_notebook =
new wxAuiNotebook(
this, wxID_ANY, wxPoint( client_size.x, client_size.y ),
290 FromDIP( wxSize( 700, 590 ) ),
291 wxAUI_NB_TOP | wxAUI_NB_CLOSE_ON_ALL_TABS | wxAUI_NB_TAB_MOVE
292 | wxAUI_NB_SCROLL_BUTTONS | wxNO_BORDER );
300 m_notebook->Freeze();
301 m_launcher->SetClosable(
false );
303 m_notebook->SetTabCtrlHeight( 0 );
307 .PaneBorder(
false ).MinSize( m_notebook->GetBestSize() ) );
312 m_auimgr.GetPane( m_projectTreePane ).MinSize( defaultLeftWinWidth, FromDIP( 80 ) );
315 wxSizer* mainSizer = GetSizer();
318 if( mainSizer &&
config()->m_Window.state.size_x == 0 &&
config()->m_Window.state.size_y == 0 )
321 mainSizer->Fit(
this );
326 SetTitle( wxT(
"KiCad" ) );
331 m_projectTreePane->SetFocus();
343 DragAcceptFiles(
true );
364 m_pcm->StopBackgroundUpdate();
395 wxAuiNotebook* notebook = (wxAuiNotebook*) evt.GetEventObject();
396 wxWindow* page = notebook->GetPage( evt.GetSelection() );
400 if( panel->GetClosable() )
402 if( !panel->GetCanClose() )
420 const wxString&
name )
427 size_t sbFieldCnt =
static_cast<size_t>( sb->GetFieldsCount() );
428 std::vector<int> sbFieldSizes( sbFieldCnt );
430 for(
size_t i = 0; i < sbFieldCnt; i++ )
431 sbFieldSizes[i] = sb->GetStatusWidth(
static_cast<int>( i ) );
437 sbFieldSizes[0] = -1;
442 int watcherWidth = std::max(
KIUI::GetTextSize(
_(
"Local path: monitoring folder changes" ), sb ).x,
445 sbFieldSizes[1] = watcherWidth + margin;
460 m_pcm = std::make_shared<PLUGIN_CONTENT_MANAGER>(
461 [
this](
int aUpdateCount )
463 if(
Pgm().m_Quitting )
468 if( aUpdateCount > 0 )
472 _(
"PCM Updates Available" ),
473 wxString::Format(
_(
"%d package update(s) available" ), aUpdateCount ),
526#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
529 activeProjectCond.
Enable( activeProject );
546 auto gitCommitPaneCond = [
this](
const SELECTION& )
610 : wxString( wxEmptyString );
619 return fn.GetFullPath();
628 return fn.GetFullPath();
636 fn.SetExt( FILEEXT::PcbFileExtension );
637 return fn.GetFullPath();
646 return fn.GetFullPath();
684 wxString ext = fileName.GetExt();
688 wxString fn = fileName.GetFullPath();
696 wxString gerberFiles;
701 wxString ext = fileName.GetExt();
707 gerberFiles += wxT(
'\"' );
708 gerberFiles += fileName.GetFullPath() + wxT(
'\"' );
709 gerberFiles = gerberFiles.Pad( 1 );
713 wxString fn = fileName.GetFullPath();
719 if( !gerberFiles.IsEmpty() )
723 if( wxFileExists( fullEditorName ) )
725 wxString command = fullEditorName +
" " + gerberFiles;
737 for(
size_t i = 0; i <
m_notebook->GetPageCount(); i++ )
743 if( !panel->GetCanClose() )
753 aEvent.StopPropagation();
759 if( aEvent.CanVeto() )
777 static std::atomic<unsigned int> lock_close_event( 0 );
779 if( ++lock_close_event > 1 )
791 lock_close_event = 0;
805 for(
size_t i = 0; i <
m_notebook->GetPageCount(); i++ )
809 wxFileName jobsetFn(
jobset->GetFilePath() );
810 jobsetFn.MakeRelativeTo(
Prj().GetProjectPath() );
827 if( !
Kiway().PlayersClose(
false ) )
842 if(
Prj().GetLocalSettings().ShouldAutoSave() &&
Prj().GetProjectFile().ShouldAutoSave() )
859 if(
Pgm().GetCommonSettings()->AutosaveUsesLocalHistory()
860 && !projPath.IsEmpty() &&
Kiway().LocalHistory().HistoryExists( projPath ) )
862 if(
Kiway().LocalHistory().HeadNewerThanLastSave( projPath ) )
876 if(
Pgm().GetCommonSettings()
877 &&
Pgm().GetCommonSettings()->AutosaveUsesLocalHistory() )
881 if( limit > 0 &&
Kiway().LocalHistory().IsCompacting() )
905 for(
int i = (
int)
m_notebook->GetPageCount() - 1; i >= 0; i-- )
911 if( panel->GetProjectTied() )
925 for(
size_t i = 0; i <
m_notebook->GetPageCount(); i++ )
929 if( aFileName.GetFullPath() == panel->GetFilePath() )
939 std::unique_ptr<JOBSET> jobsFile = std::make_unique<JOBSET>( aFileName.GetFullPath().ToStdString() );
941 jobsFile->LoadFromFile();
943 if( aCreate && !aFileName.FileExists() )
945 JOBSET_DESTINATION* dest = jobsFile->AddNewDestination( JOBSET_DESTINATION_T::FOLDER );
947 jobsFile->SaveToFile( wxEmptyString,
true );
953 m_notebook->AddPage( jobPanel, aFileName.GetFullName(),
true );
956 if( aResaveProjectPreferences )
969 if( !aProjectFileName.Exists() )
972 wxString fullPath = aProjectFileName.GetFullPath();
977 bool lockOverrideGranted =
false;
979 if( !lockFile.
Valid() )
982 msg.Printf(
_(
"Project '%s' is already open by '%s' at '%s'." ),
994 lockOverrideGranted =
true;
1012 if( lockOverrideGranted )
1017 if( aProjectFileName.IsDirWritable() )
1020 if(
Pgm().GetCommonSettings()->AutosaveUsesLocalHistory()
1021 &&
Kiway().LocalHistory().HeadNewerThanLastSave(
Prj().GetProjectPath() ) )
1025 KICAD_MESSAGE_DIALOG dlg(
this,
_(
"KiCad found unsaved changes from your last session that are newer than "
1026 "the saved project files." ),
1027 _(
"Recover Unsaved Changes" ), wxYES_NO | wxICON_QUESTION );
1029 dlg.SetExtendedMessage(
_(
"This can happen if your previous session ended unexpectedly.\n\n"
1030 "Choose 'Restore' to recover those changes, or 'Discard' to keep the "
1031 "currently saved files." ) );
1033 dlg.SetYesNoLabels(
_(
"Restore" ),
_(
"Discard" ) );
1035 if( dlg.ShowModal() == wxID_YES )
1060 for(
const wxString&
jobset :
Prj().GetLocalSettings().m_OpenJobSets )
1062 wxFileName jobsetFn(
jobset );
1063 jobsetFn.MakeAbsolute(
Prj().GetProjectPath() );
1065 if( jobsetFn.Exists() )
1077 wxPostEvent(
this, cmd );
1095 wxCHECK_RET( aProjectFileName.DirExists() && aProjectFileName.IsDirWritable(),
1096 "Project folder must exist and be writable to create a new project." );
1099 if( !aProjectFileName.FileExists() )
1101 wxFileName legacyPro( aProjectFileName );
1104 if( legacyPro.FileExists() )
1109 wxRemoveFile( legacyPro.GetFullPath() );
1114 wxString srcFileName =
sys_search().FindValidPath(
"kicad.kicad_pro" );
1116 wxFileName destFileName( aProjectFileName );
1120 if( !wxFileName::FileExists( srcFileName )
1121 || !wxCopyFile( srcFileName, destFileName.GetFullPath() ) )
1123 wxFFile file( destFileName.GetFullPath(),
"wb" );
1125 if( file.IsOpened() )
1126 file.Write( wxT(
"{\n}\n") );
1136 if( aCreateStubFiles )
1138 wxFileName fn( aProjectFileName.GetFullPath() );
1143 if( !fn.FileExists() )
1145 wxFFile file( fn.GetFullPath(),
"wb" );
1147 if( file.IsOpened() )
1149 file.Write( wxString::Format(
"(kicad_sch\n"
1151 "\t(generator \"eeschema\")\n"
1152 "\t(generator_version \"%s\")\n"
1154 "\t(paper \"A4\")\n"
1156 "\t(sheet_instances\n"
1158 "\t\t\t(page \"1\")\n"
1161 "\t(embedded_fonts no)\n"
1165 KIID().AsString() ) );
1174 wxFileName leg_fn( fn );
1177 if( !fn.FileExists() && !leg_fn.FileExists() )
1179 wxFFile file( fn.GetFullPath(),
"wb" );
1181 if( file.IsOpened() )
1184 file.Write( wxString::Format(
"(kicad_pcb (version %d) (generator \"pcbnew\") (generator_version \"%s\")\n)",
1208 wxMessageBox(
_(
"Compare Project Branches requires a project that is "
1209 "tracked by git." ),
1210 _(
"Compare Branches" ),
1211 wxOK | wxICON_INFORMATION,
this );
1215 std::vector<wxString> refs;
1219 if( std::unique_lock<std::mutex> lock = gitCommon->TryLockAction(); lock.owns_lock() )
1223 refs.push_back( wxS(
"HEAD" ) );
1237 wxFileDialog dlg(
this,
_(
"Edit File in Text Editor" ), default_dir, wxEmptyString, wildcard,
1242 if( dlg.ShowModal() == wxID_CANCEL )
1245 wxString filename = dlg.GetPath();
1247 if( !dlg.GetPath().IsEmpty() && !
Pgm().GetTextEditor().IsEmpty() )
1277 if( pageId != wxNOT_FOUND )
1294 m_pcm->ReadEnvVar();
1321 if( !
Prj().IsNullProject() &&
1322 Prj().GetProjectLock() ==
nullptr )
1326 if( !lockFile.
Valid() )
1329 msg.Printf(
_(
"Project '%s' is already open by '%s' at '%s'." ),
1346 if( !file.IsEmpty() )
1348 wxFileName fn( file );
1350 title = fn.GetName();
1352 if(
Prj().IsReadOnly() )
1353 title += wxS(
" " ) +
_(
"[Read Only]" );
1357 title =
_(
"[no project loaded]" );
1361 title += wxT(
" \u2014 " ) + wxString( wxS(
"KiCad" ) );
1370 [
this](
const wxString& aProjectPath, std::vector<HISTORY_FILE_DATA>& aFileData )
1384 wxCHECK( settings, );
1398 wxCHECK( settings, );
1411 wxString status = wxString::Format(
_(
"Project: %s" ),
Prj().GetProjectFullName() );
1412 SetStatusText( status, 0 );
1434 if(
Pgm().GetCommonSettings()->m_Session.remember_open_files )
1436 int previousOpenCount = std::count_if(
Prj().GetLocalSettings().m_files.begin(),
1437 Prj().GetLocalSettings().m_files.end(),
1440 return !f.fileName.EndsWith( FILEEXT::ProjectFileExtension ) && f.open;
1443 if( previousOpenCount > 0 )
1445 APP_PROGRESS_DIALOG progressReporter(
_(
"Restoring session" ), wxEmptyString, previousOpenCount,
this );
1448 std::set<wxString> openedFiles;
1454 if( file.open && !openedFiles.count( file.fileName ) )
1456 progressReporter.
Update( i++, wxString::Format(
_(
"Restoring '%s'" ), file.fileName ) );
1458 openedFiles.insert( file.fileName );
1459 wxFileName fn( file.fileName );
1488 schFrame->OnModify();
1492 pcbFrame->OnModify();
1503 m_pcm->RunBackgroundUpdate();
1506#ifdef KICAD_UPDATE_CHECK
1563 bool show = !pane.IsShown();
1575 if( !
Kiway().PlayersClose(
true ) )
1578 if(
Kiway().LocalHistory().RestoreCommit(
Prj().GetProjectPath(), aHash,
this ) )
1598 bool show = !pane.IsShown();
constexpr EDA_IU_SCALE unityScale
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
wxString GetMajorMinorVersion()
Get only the major and minor version in a string major.minor.
bool IsNightlyVersion()
Check if the build is meant to be nightly.
static TOOL_ACTION saveAs
static TOOL_ACTION showGitCommitPane
Manage TOOL_ACTION objects.
void SetConditions(const TOOL_ACTION &aAction, const ACTION_CONDITIONS &aConditions)
Set the conditions the UI elements for activating a specific tool action should use for determining t...
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
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.
void UnregisterStatusBar(KISTATUSBAR *aStatusBar)
Removes status bar from handling.
void RegisterStatusBar(KISTATUSBAR *aStatusBar)
Add a status bar for handling.
Handle actions that are shared between different applications.
Git PR-style branch comparison dialog (Phase 10).
The base frame for deriving all KiCad main window classes.
void LoadWindowState(const wxString &aFileName)
void CommonSettingsChanged(int aFlags) override
Notification event that some of the common (suite-wide) settings have changed.
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.
std::vector< wxFileName > m_AcceptedFiles
SETTINGS_MANAGER * GetSettingsManager() const
virtual void RecreateToolbars()
virtual void LoadSettings(APP_SETTINGS_BASE *aCfg)
Load common frame parameters from a configuration file.
ACTION_TOOLBAR * m_tbLeft
std::map< const wxString, TOOL_ACTION * > m_acceptedExts
Associate file extensions with action to execute.
virtual void SaveSettings(APP_SETTINGS_BASE *aCfg)
Save common frame parameters to a configuration data file.
void SetMruPath(const wxString &aPath)
bool m_isClosing
Set by the close window event handler after frames are asked if they can close.
Specialization of the wxAuiPaneInfo class for KiCad panels.
Docked panel for committing: the branch to commit to, a summary and description, the commit options,...
void SetOutputPath(const wxString &aPath)
virtual bool SaveToFile(const wxString &aDirectory="", bool aForce=false)
Calls Store() and then writes the contents of the JSON document to a file.
static TOOL_ACTION viewDroppedGerbers
static TOOL_ACTION editPCB
static TOOL_ACTION loadProject
static TOOL_ACTION exportForOlderVersion
static TOOL_ACTION showLocalHistory
static TOOL_ACTION editSchematic
static TOOL_ACTION openTextEditor
static TOOL_ACTION archiveProject
static TOOL_ACTION closeProject
static TOOL_ACTION openJobsetFile
static TOOL_ACTION newJobsetFile
Handle actions in the kicad manager frame.
The main KiCad project manager frame.
std::shared_ptr< PLUGIN_CONTENT_MANAGER > m_pcm
void PreloadAllLibraries()
void SetPcmButton(BITMAP_BUTTON *aButton)
void doCloseWindow() override
void CreateNewProject(const wxFileName &aProjectFileName, bool aCreateStubFiles=true)
Creates a new project by setting up and initial project, schematic, and board files.
const SEARCH_STACK & sys_search() override
Return a SEARCH_STACK pertaining to entire program.
void OnImportEasyEdaProFiles(wxCommandEvent &event)
Open dialog to import EasyEDA Pro schematic and board files.
void ProjectChanged() override
Notification event that the project has changed.
void ShowChangedLanguage() override
Redraw the menus and what not in current language.
const wxString SchLegacyFileName()
wxWindow * GetToolCanvas() const override
Canvas access.
void OnImportEasyEdaFiles(wxCommandEvent &event)
Open dialog to import EasyEDA Std schematic and board files.
void OnImportPadsProjectFiles(wxCommandEvent &event)
Open dialog to import PADS Logic schematic and PCB files.
void ToggleLocalHistory()
void OnImportEasyPcFiles(wxCommandEvent &event)
Open dialog to import an Easy-PC / DesignSpark PCB project, schematic or board.
void OnImportAltiumProjectFiles(wxCommandEvent &event)
Open dialog to import Altium project files.
const wxString GetProjectFileName() const
void updatePcmButtonBadge()
KICAD_SETTINGS * kicadSettings() const
const wxString SchFileName()
void OnImportEagleFiles(wxCommandEvent &event)
Open dialog to import Eagle schematic and board files.
wxStatusBar * OnCreateStatusBar(int number, long style, wxWindowID id, const wxString &name) override
Create the status line (like a wxStatusBar).
void OnExit(wxCommandEvent &event)
void OpenJobsFile(const wxFileName &aFileName, bool aCreate=false, bool aResaveProjectPreferences=true)
bool canCloseWindow(wxCloseEvent &aCloseEvent) override
void OnSize(wxSizeEvent &event) override
GIT_COMMIT_PANE * m_gitCommitPane
virtual void setupUIConditions() override
Setup the UI conditions for the various actions and their controls in this frame.
PROJECT_TREE_PANE * m_projectTreePane
void OnImportGedaFiles(wxCommandEvent &event)
Open dialog to import gEDA/gaf schematic and PCB files.
void RestoreCommitFromHistory(const wxString &aHash)
bool GitCommitPaneShown()
void DoWithAcceptedFiles() override
Execute action on accepted dropped file.
void OnOpenFileInTextEditor(wxCommandEvent &event)
APP_SETTINGS_BASE * config() const override
Return the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
int m_lastToolbarIconSize
void OnImportOrcadFiles(wxCommandEvent &event)
Open dialog to import an OrCAD schematic file.
const wxString PcbLegacyFileName()
void OnEditAdvancedCfg(wxCommandEvent &event)
void OnImportPcadProjectFiles(wxCommandEvent &event)
void ToggleGitCommitPane()
KICAD_MANAGER_FRAME(wxWindow *parent, const wxString &title, const wxPoint &pos, const wxSize &size)
bool CloseProject(bool aSave)
Closes the project, and saves it if aSave is true;.
wxString GetCurrentFileName() const override
Get the full filename + path of the currently opened file in the frame.
void onNotebookPageCloseRequest(wxAuiNotebookEvent &evt)
void CommonSettingsChanged(int aFlags) override
Notification event that some of the common (suite-wide) settings have changed.
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
void OnIdle(wxIdleEvent &event)
void onToolbarSizeChanged()
void PrintPrjInfo()
Prints the current working directory name and the project name on the text panel.
bool m_showGitCommitPanel
void OnImportDipTraceFiles(wxCommandEvent &event)
Open dialog to import DipTrace schematic and board files.
void SaveOpenJobSetsToLocalSettings(bool aIsExplicitUserSave=false)
bool LoadProject(const wxFileName &aProjectFileName)
Loads a new project.
bool m_restoredFromHistory
Set after restore to mark editors dirty.
void onNotebookPageCountChanged(wxAuiNotebookEvent &evt)
LOCAL_HISTORY_PANE * m_historyPane
void OnImportCadstarArchiveFiles(wxCommandEvent &event)
Open dialog to import CADSTAR Schematic and PCB Archive files.
void OnImportTarget3001Files(wxCommandEvent &event)
void OnCompareProjectBranches(wxCommandEvent &event)
Open DIALOG_GIT_MR_REVIEW so the user can pick two refs and review the changed-file list between them...
void RefreshProjectTree()
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
BITMAP_BUTTON * m_pcmButton
PANEL_KICAD_LAUNCHER * m_launcher
void HideTabsIfNeeded()
Hides the tabs for Editor notebook if there is only 1 page.
wxString help_name() override
const wxString PcbFileName()
std::unique_ptr< UPDATE_MANAGER > m_updateManager
wxAuiNotebook * m_notebook
bool m_ShowGitCommitPanel
std::vector< wxString > m_OpenProjects
KISTATUSBAR is a wxStatusBar suitable for Kicad manager.
virtual void SetStatusWidths(int aSize, const int *aWidths) override
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
virtual KIFACE * KiFACE(FACE_T aFaceId, bool doLoad=true)
Return the KIFACE* given a FACE_T.
LOCAL_HISTORY & LocalHistory()
Return the LOCAL_HISTORY associated with this KIWAY.
void EnforceSizeLimitInBackground(const wxString &aProjectPath, size_t aMaxBytes)
Run EnforceSizeLimit without a reporter on a background thread, after any running compaction.
bool EnforceSizeLimit(const wxString &aProjectPath, size_t aMaxBytes, PROGRESS_REPORTER *aReporter=nullptr)
Enforce total size limit by rebuilding trimmed history keeping newest commits whose cumulative unique...
bool TagSave(const wxString &aProjectPath, const wxString &aFileType)
Tag a manual save in the local history repository.
wxString GetHeadHash(const wxString &aProjectPath)
Return the current head commit hash.
void WaitForPendingSave()
Block until any pending background save completes.
bool RestoreCommit(const wxString &aProjectPath, const wxString &aHash, wxWindow *aParent=nullptr, bool aConfirm=true)
Restore the project files to the state recorded by the given commit hash.
bool CommitFullProjectSnapshot(const wxString &aProjectPath, const wxString &aTitle)
Commit a snapshot of the entire project directory (excluding the .history directory and ignored trans...
void RegisterSaver(const void *aSaverObject, const std::function< void(const wxString &, std::vector< HISTORY_FILE_DATA > &)> &aSaver, const std::weak_ptr< void > &aLifetime={})
Register a saver callback invoked during autosave history commits.
void UnregisterSaver(const void *aSaverObject)
Unregister a previously registered saver callback.
Advisory lock over a file, taken by writing a sibling lock file and holding an exclusive lock on it f...
bool OverrideLock(bool aRemoveOnRelease=true)
Force the lock, overwriting the data that existed already.
static LOCKFILE Inspect(const wxString &aFilename)
Look at a lock without taking it: nothing is created, nothing is claimed and nothing is removed on re...
void RegisterStatusBar(KISTATUSBAR *aStatusBar)
Add a status bar for handling.
void CreateOrUpdate(const wxString &aKey, const wxString &aTitle, const wxString &aDescription, const wxString &aHref=wxEmptyString)
Create a notification with the given parameters or updates an existing one with the same key.
void Remove(const wxString &aKey)
Remove a notification by key.
void UnregisterStatusBar(KISTATUSBAR *aStatusBar)
Remove status bar from handling.
static REPORTER & GetInstance()
void SetClosable(bool aYes)
void SetProjectTied(bool aYes)
virtual COMMON_SETTINGS * GetCommonSettings() const
void PreloadDesignBlockLibraries(KIWAY *aKiway)
Starts a background job to preload the global and project design block libraries.
virtual BACKGROUND_JOBS_MONITOR & GetBackgroundJobMonitor() const
void UnregisterLibraryLoadStatusBar(KISTATUSBAR *aStatusBar)
Unregister a status bar from receiving library load warning messages.
void RegisterLibraryLoadStatusBar(KISTATUSBAR *aStatusBar)
Register a status bar to receive library load warning messages.
virtual NOTIFICATIONS_MANAGER & GetNotificationsManager() const
virtual SETTINGS_MANAGER & GetSettingsManager() const
wxString GetHelpFileName()
SEARCH_STACK & SysSearch()
APP_SETTINGS_BASE * PgmSettings()
The project local settings are things that are attached to a particular project, but also might be pa...
bool SaveToFile(const wxString &aDirectory="", bool aForce=false) override
Calls Store() and then writes the contents of the JSON document to a file.
bool ShouldAutoSave() const
std::vector< wxString > m_OpenJobSets
Window to display the tree files.
void SetProjectLock(LOCKFILE *aLockFile)
virtual void SetReadOnly(bool aReadOnly=true)
virtual std::shared_ptr< KIGIT_COMMON > GetGitCommon() const
This project's Git session, created empty on first use.
virtual const wxString GetProjectFullName() const
Return the full path and name of the project.
virtual const wxString GetProjectPath() const
Return the full path of the project.
virtual PROJECT_LOCAL_SETTINGS & GetLocalSettings() const
std::weak_ptr< void > GetHistoryLifetimeToken() const
Liveness token handed to LOCAL_HISTORY::RegisterSaver so a shared autosave timer skips this project's...
virtual void SetLockOverrideGranted(bool aGranted=true)
void SaveToHistory(const wxString &aProjectPath, std::vector< HISTORY_FILE_DATA > &aFileData)
Produce HISTORY_FILE_DATA entries for project files (.kicad_pro and .kicad_prl).
Look for files in a number of paths.
static bool ShowNever(const SELECTION &aSelection)
Always returns false.
bool SaveProject(const wxString &aFullPath=wxEmptyString, PROJECT *aProject=nullptr)
Save a loaded project.
bool LoadProject(const wxString &aFullPath, bool aSetActive=true)
Load a project or sets up a new project with a specified path.
bool IsProjectOpen() const
Helper for checking if we have a project open.
bool UnloadProject(PROJECT *aProject, bool aSave=true)
Save, unload and unregister the given PROJECT.
std::vector< wxString > GetOpenProjects() const
bool TriggerBackupIfNeeded(REPORTER &aReporter) const
Call BackupProject() if a new backup is needed according to the current backup policy.
Multi-thread safe progress reporter dialog, intended for use of tasks that parallel reporting back of...
bool AskOverrideLock(wxWindow *aParent, const wxString &aMessage)
Display a dialog indicating the file is already open, with an option to reset the lock.
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 KICAD_MESSAGE_DIALOG
Base window classes and related definitions.
#define KICAD_DEFAULT_DRAWFRAME_STYLE
#define KICAD_MANAGER_FRAME_NAME
EVT_MENU_RANGE(ID_GERBVIEW_DRILL_FILE1, ID_GERBVIEW_DRILL_FILEMAX, GERBVIEW_FRAME::OnDrlFileHistory) EVT_MENU_RANGE(ID_GERBVIEW_ZIP_FILE1
const wxString GERBVIEW_EXE
wxString FindKicadFile(const wxString &shortname)
Search the executable file shortname in KiCad binary path and return full file name if found or short...
static const std::string LegacySchematicFileExtension
static const std::string GerberJobFileExtension
static const std::string GerberFileExtension
static const std::string ProjectFileExtension
static const std::string LegacyPcbFileExtension
static const std::string LegacyProjectFileExtension
static const std::string KiCadSchematicFileExtension
static const std::string DrillFileExtension
static const std::string KiCadPcbFileExtension
static wxString AllFilesWildcard()
static bool IsGerberFileExtension(const wxString &ext)
@ ID_IMPORT_EASYPC_PROJECT
@ ID_IMPORT_DIPTRACE_PROJECT
@ ID_IMPORT_EAGLE_PROJECT
@ ID_IMPORT_EASYEDAPRO_PROJECT
@ ID_IMPORT_CADSTAR_ARCHIVE_PROJECT
@ ID_EDIT_LOCAL_FILE_IN_TEXT_EDITOR
@ ID_IMPORT_ORCAD_PROJECT
@ ID_IMPORT_EASYEDA_PROJECT
@ ID_IMPORT_ALTIUM_PROJECT
@ ID_COMPARE_PROJECT_BRANCHES
@ ID_IMPORT_TARGET3001_PROJECT
EVT_MENU(ID_COMPARE_PROJECT_BRANCHES, KICAD_MANAGER_FRAME::OnCompareProjectBranches) KICAD_MANAGER_FRAME
#define ID_INIT_WATCHED_PATHS
#define PROJECT_FILES_CAPTION
std::vector< wxString > CompareBranchRefs(git_repository *aRepo)
Refs to offer when comparing branches, base first and head second.
KICOMMON_API wxFont GetStatusFont(wxWindow *aWindow)
KICOMMON_API wxSize GetTextSize(const wxString &aSingleLine, wxWindow *aWindow)
Return the size of aSingleLine of text when it is rendered in aWindow using whatever font is currentl...
#define SEXPR_BOARD_FILE_VERSION
Current s-expression file format version. 2 was the last legacy format version.
PGM_BASE & Pgm()
The global program "get" accessor.
#define SEXPR_SCHEMATIC_FILE_VERSION
Schematic file version.
T * GetToolbarSettings(const wxString &aFilename)
KIWAY Kiway(KFCTL_STANDALONE)
std::vector< FAB_LAYER_COLOR > dummy
Functors that can be used to figure out how the action controls should be displayed in the UI and if ...
ACTION_CONDITIONS & Enable(const SELECTION_CONDITION &aCondition)
unsigned long long limit_total_size
Maximum total size of backups (bytes), 0 for unlimited.
std::shared_ptr< JOBS_OUTPUT_HANDLER > m_outputHandler
Implement a participant in the KIWAY alchemy.
virtual void PreloadLibraries(KIWAY *aKiway)
virtual void CancelPreload(bool aBlock=true)
IbisParser parser & reporter
Functions to provide common constants and other functions to assist in making a consistent UI.
Definition of file extensions used in Kicad.