0000807: Image plane duplication

This commit is contained in:
wmayer
2012-07-31 11:23:36 +02:00
parent acb1205d5d
commit 78cbe72dee
3 changed files with 17 additions and 14 deletions

View File

@@ -1516,10 +1516,10 @@ DocumentObject* Document::_copyObject(DocumentObject* obj, std::map<DocumentObje
// remove number from end to avoid lengthy names
std::string objname = obj->getNameInDocument();
if (!keepdigitsatend) {
size_t lastpos = objname.length()-1;
while (objname[lastpos] >= 48 && objname[lastpos] <= 57)
lastpos--;
objname = objname.substr(0, lastpos+1);
size_t lastpos = objname.length()-1;
while (objname[lastpos] >= 48 && objname[lastpos] <= 57)
lastpos--;
objname = objname.substr(0, lastpos+1);
}
DocumentObject* copy = addObject(obj->getTypeId().getName(),objname.c_str());
if (!copy) return 0;

View File

@@ -346,10 +346,10 @@ void PropertyFileIncluded::RestoreDocFile(Base::Reader &reader)
Property *PropertyFileIncluded::Copy(void) const
{
PropertyFileIncluded *p= new PropertyFileIncluded();
PropertyFileIncluded *prop = new PropertyFileIncluded();
// remember the base name
p->_BaseFileName = _BaseFileName;
prop->_BaseFileName = _BaseFileName;
if (!_cValue.empty()) {
Base::FileInfo file(_cValue);
@@ -361,11 +361,11 @@ Property *PropertyFileIncluded::Copy(void) const
bool done = file.renameFile(NewName.filePath().c_str());
assert(done);
// remember the new name for the Undo
Base::Console().Log("Copy this=%p Before=%s After=%s\n",p,p->_cValue.c_str(),NewName.filePath().c_str());
p->_cValue = NewName.filePath().c_str();
Base::Console().Log("Copy this=%p Before=%s After=%s\n",prop,prop->_cValue.c_str(),NewName.filePath().c_str());
prop->_cValue = NewName.filePath().c_str();
}
return p;
return prop;
}
void PropertyFileIncluded::Paste(const Property &from)
@@ -376,6 +376,9 @@ void PropertyFileIncluded::Paste(const Property &from)
file.deleteFile();
const PropertyFileIncluded &fileInc = dynamic_cast<const PropertyFileIncluded&>(from);
// set the base name
_BaseFileName = fileInc._BaseFileName;
if (!fileInc._cValue.empty()) {
// move the saved files back in place
Base::FileInfo NewFile(fileInc._cValue);