MCPcopy Create free account
hub / github.com/FreeCAD/FreeCAD / Save

Method Save

src/Gui/Document.cpp:1883–1911  ·  view source on GitHub ↗

* Adds a separate XML file to the projects file that contains information about the view providers. */

Source from the content-addressed store, hash-verified

1881 * Adds a separate XML file to the projects file that contains information about the view providers.
1882 */
1883void Document::Save(Base::Writer& writer) const
1884{
1885 // It's only possible to add extra information if force of XML is disabled
1886 if (!writer.isForceXML()) {
1887 writer.addFile("GuiDocument.xml", this);
1888
1889 ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath(
1890 "User parameter:BaseApp/Preferences/Document"
1891 );
1892 if (hGrp->GetBool("SaveThumbnail", true)) {
1893 int size = hGrp->GetInt("ThumbnailSize", 256);
1894 size = Base::clamp<int>(size, 64, 512);
1895 std::list<MDIView*> mdi = getMDIViews();
1896
1897 View3DInventorViewer* view = nullptr;
1898 for (const auto& it : mdi) {
1899 if (it->isDerivedFrom<View3DInventor>()) {
1900 view = static_cast<View3DInventor*>(it)->getViewer();
1901 break;
1902 }
1903 }
1904
1905 d->thumb.setFileName(d->_pcDocument->FileName.getValue());
1906 d->thumb.setSize(size);
1907 d->thumb.setViewer(view);
1908 d->thumb.Save(writer);
1909 }
1910 }
1911}
1912
1913/**
1914 * Loads a separate XML file from the projects file with information about the view providers.

Callers 2

SaveDocFileMethod · 0.45
exportObjectsMethod · 0.45

Calls 10

isForceXMLMethod · 0.80
GetBoolMethod · 0.80
GetIntMethod · 0.80
addFileMethod · 0.45
getViewerMethod · 0.45
setFileNameMethod · 0.45
getValueMethod · 0.45
setSizeMethod · 0.45
setViewerMethod · 0.45

Tested by

no test coverage detected