* Adds a separate XML file to the projects file that contains information about the view providers. */
| 1881 | * Adds a separate XML file to the projects file that contains information about the view providers. |
| 1882 | */ |
| 1883 | void 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. |
no test coverage detected