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);

View File

@ -894,9 +894,9 @@ bool StdCmdPaste::isActive(void)
return getMainWindow()->canInsertFromMimeData(mime);
}
DEF_STD_CMD_A(StdCmdDDuplicateSelection);
DEF_STD_CMD_A(StdCmdDuplicateSelection);
StdCmdDDuplicateSelection::StdCmdDDuplicateSelection()
StdCmdDuplicateSelection::StdCmdDuplicateSelection()
:Command("Std_DuplicateSelection")
{
sAppModule = "Edit";
@ -907,7 +907,7 @@ StdCmdDDuplicateSelection::StdCmdDDuplicateSelection()
sStatusTip = QT_TR_NOOP("Put duplicates of the selected objects to the active document");
}
void StdCmdDDuplicateSelection::activated(int iMsg)
void StdCmdDuplicateSelection::activated(int iMsg)
{
App::Document* act = App::GetApplication().getActiveDocument();
if (!act)
@ -964,7 +964,7 @@ void StdCmdDDuplicateSelection::activated(int iMsg)
}
}
bool StdCmdDDuplicateSelection::isActive(void)
bool StdCmdDuplicateSelection::isActive(void)
{
return Gui::Selection().hasSelection();
}
@ -1275,7 +1275,7 @@ void CreateDocCommands(void)
rcCmdMgr.addCommand(new StdCmdCut());
rcCmdMgr.addCommand(new StdCmdCopy());
rcCmdMgr.addCommand(new StdCmdPaste());
rcCmdMgr.addCommand(new StdCmdDDuplicateSelection());
rcCmdMgr.addCommand(new StdCmdDuplicateSelection());
rcCmdMgr.addCommand(new StdCmdSelectAll());
rcCmdMgr.addCommand(new StdCmdDelete());
rcCmdMgr.addCommand(new StdCmdRefresh());