Move the unit schema into Project Information and remove all Project Unit System code (#11266)
* Add unit system to Project Information and store with document. * Remove the project unit system * Restore correct document activation signalling to fix test fail * Remove commented out dead lines * Restore ignore option for project unit schemas * Whitespace fix * Refresh after changing units * Remove field label * Property editor changes applied to unit system
This commit is contained in:
@@ -106,9 +106,6 @@ struct DocumentP
|
||||
std::map<std::string,ViewProvider*> _ViewProviderMapAnnotation;
|
||||
std::list<ViewProviderDocumentObject*> _redoViewProviders;
|
||||
|
||||
int projectUnitSystem = -1;
|
||||
bool projectUnitSystemIgnore = false;
|
||||
|
||||
using Connection = boost::signals2::connection;
|
||||
Connection connectNewObject;
|
||||
Connection connectDelObject;
|
||||
@@ -651,30 +648,6 @@ void Document::setPos(const char* name, const Base::Matrix4D& rclMtrx)
|
||||
|
||||
}
|
||||
|
||||
void Document::setProjectUnitSystem(int pUS)
|
||||
{
|
||||
if (pUS != d->projectUnitSystem && pUS >= 0) {
|
||||
d->projectUnitSystem = pUS;
|
||||
setModified(true);
|
||||
}
|
||||
}
|
||||
|
||||
int Document::getProjectUnitSystem() const
|
||||
{
|
||||
return d->projectUnitSystem;
|
||||
}
|
||||
|
||||
void Document::setProjectUnitSystemIgnore(bool ignore)
|
||||
{
|
||||
d->projectUnitSystemIgnore = ignore;
|
||||
setModified(true);
|
||||
}
|
||||
|
||||
bool Document::getProjectUnitSystemIgnore() const
|
||||
{
|
||||
return d->projectUnitSystemIgnore;
|
||||
}
|
||||
|
||||
//*****************************************************************************************************
|
||||
// Document
|
||||
//*****************************************************************************************************
|
||||
@@ -1485,14 +1458,6 @@ void Document::RestoreDocFile(Base::Reader &reader)
|
||||
Base::Console().Error("%s\n", e.what());
|
||||
}
|
||||
}
|
||||
|
||||
if (localreader->readNextElement()) {
|
||||
if (strcmp(localreader->localName(), "ProjectUnitSystem") == 0) {
|
||||
d->projectUnitSystem = localreader->getAttributeAsInteger("US");
|
||||
d->projectUnitSystemIgnore = localreader->getAttributeAsInteger("ignore");
|
||||
localreader->readEndElement("Document");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
reader.initLocalReader(localreader);
|
||||
@@ -1615,14 +1580,6 @@ void Document::SaveDocFile (Base::Writer &writer) const
|
||||
<< encodeAttribute(getCameraSettings()) << "\"/>\n";
|
||||
writer.decInd(); // indentation for camera settings
|
||||
|
||||
if (d->projectUnitSystem >= 0) {
|
||||
writer.incInd();
|
||||
writer.Stream() << writer.ind() << "<ProjectUnitSystem US=\""
|
||||
<< d->projectUnitSystem << "\" ignore=\""
|
||||
<< d->projectUnitSystemIgnore << "\"/>\n";
|
||||
writer.decInd();
|
||||
}
|
||||
|
||||
writer.Stream() << "</Document>" << std::endl;
|
||||
}
|
||||
|
||||
@@ -2558,5 +2515,6 @@ void Document::slotChangePropertyEditor(const App::Document &doc, const App::Pro
|
||||
if(getDocument() == &doc) {
|
||||
FC_LOG(Prop.getFullName() << " editor changed");
|
||||
setModified(true);
|
||||
getMainWindow()->setUserSchema(doc.UnitSystem.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user