KiCad PCB EDA Suite
Loading...
Searching...
No Matches
SCH_API_SAVE Namespace Reference

Functions

bool SaveSheetToFile (SCH_SHEET *aSheet, SCHEMATIC &aSchematic, const wxString &aPath)
 Write a single sheet to disk via SCH_IO.
 
void UpdateProjectFile (SCHEMATIC &aSchematic, PROJECT &aProject)
 Sync schematic metadata into the project file (.kicad_pro) and save it.
 
bool SaveSchematic (SCHEMATIC &aSchematic, PROJECT &aProject)
 Save every screen in the hierarchy to its current path, then update the project file.
 
bool SaveSchematicCopy (SCHEMATIC &aSchematic, PROJECT &aProject, const wxString &aFileName, bool aCreateProject)
 Save the root schematic to aFileName without changing the open document.
 
bool SaveSchematicAs (SCHEMATIC &aSchematic, PROJECT &aProject, const wxString &aFileName)
 Save the schematic to aFileName and adopt it: the root sheet and screen are re-homed to the new path, the whole hierarchy is written, and the project is re-targeted to the new location (creating a project file if none exists there).
 

Function Documentation

◆ SaveSchematic()

◆ SaveSchematicAs()

bool SCH_API_SAVE::SaveSchematicAs ( SCHEMATIC & aSchematic,
PROJECT & aProject,
const wxString & aFileName )

Save the schematic to aFileName and adopt it: the root sheet and screen are re-homed to the new path, the whole hierarchy is written, and the project is re-targeted to the new location (creating a project file if none exists there).

Used by the headless IPC API SaveDocumentAs handler; there is no frame, so no lock or file history is updated.

Returns
true if the schematic was saved and the project re-targeted.

Definition at line 235 of file sch_api_save.cpp.

References EnsureFileExtension(), PGM_BASE::GetSettingsManager(), FILEEXT::KiCadSchematicFileExtension, Pgm(), FILEEXT::ProjectFileExtension, SCHEMATIC::Root(), SCHEMATIC::RootScreen(), SETTINGS_MANAGER::SaveProjectAs(), SaveSchematic(), SCH_SCREEN::SetFileName(), SCH_SHEET::SetFileName(), and PROJECT::SetReadOnly().

Referenced by HEADLESS_SCH_CONTEXT::SaveSchematicAs().

◆ SaveSchematicCopy()

bool SCH_API_SAVE::SaveSchematicCopy ( SCHEMATIC & aSchematic,
PROJECT & aProject,
const wxString & aFileName,
bool aCreateProject )

Save the root schematic to aFileName without changing the open document.

If aFileName matches the open root schematic, this delegates to SaveSchematic(). Otherwise only the root sheet is written (subsheets are not remapped).

When aCreateProject is true and the destination project file does not exist yet, a copy of the current project is written alongside the new schematic.

Definition at line 198 of file sch_api_save.cpp.

References SCH_SCREEN::GetFileName(), SCHEMATIC::GetTopLevelSheet(), Pgm(), FILEEXT::ProjectFileExtension, SCHEMATIC::RootScreen(), SaveSchematic(), and SaveSheetToFile().

Referenced by BOOST_AUTO_TEST_CASE(), HEADLESS_SCH_CONTEXT::SaveSchematicCopy(), and SCH_EDIT_FRAME_CONTEXT::SaveSchematicCopy().

◆ SaveSheetToFile()

bool SCH_API_SAVE::SaveSheetToFile ( SCH_SHEET * aSheet,
SCHEMATIC & aSchematic,
const wxString & aPath )

Write a single sheet to disk via SCH_IO.

Definition at line 44 of file sch_api_save.cpp.

References SCH_IO_MGR::GuessPluginTypeFromSchPath(), KIPLATFORM::IO::MakeWriteable(), and IO_ERROR::What().

Referenced by SaveSchematic(), and SaveSchematicCopy().

◆ UpdateProjectFile()