diff -r 43268373032d -r e265f07f2173 mapeditor.cpp --- a/mapeditor.cpp Wed Jun 09 13:14:08 2010 +0000 +++ b/mapeditor.cpp Mon Jun 14 13:59:17 2010 +0000 @@ -1149,10 +1149,10 @@ if (bi) { copyingObj=true; - //FIXME-2 TreeItem::addBranch (BranchItem still missing) - //bi->addBranch (model->getSelectedBranch()); - model->unselect(); - model->select(bi->getLastBranch()); + //model->select(model->createBranch (bi)); + model->copy(); + model->paste(); + model->select (bi->getLastBranch()); model->reposition(); } } @@ -1200,10 +1200,11 @@ if (mainWindow->getModMode()!=Main::ModModeCopy) setCursor (Qt::ArrowCursor); - // Scroll if needed - // To avoid jumping of the sceneView, only - // show selection, if not tmp linked - model->emitShowSelection(); + if (!lmosel->hasParObjTmp()) + // Scroll if needed + // To avoid jumping of the sceneView, only + // show selection, if not tmp linked + model->emitShowSelection(); // Now move the selection, but add relative position // (movingObj_start) where selection was chosen with @@ -1292,27 +1293,30 @@ } } // depth>0 - // Maybe we can relink temporary? - if (dsti) + + // Maybe we can relink temporary? + if (dsti) + { + if (e->modifiers()==Qt::ControlModifier) { - if (e->modifiers()==Qt::ControlModifier) - { - // Special case: CTRL to link below dst - lmosel->setParObjTmp (dst,p,+1); - } else if (e->modifiers()==Qt::ShiftModifier) - lmosel->setParObjTmp (dst,p,-1); - else - lmosel->setParObjTmp (dst,p,0); - } else - { - lmosel->unsetParObjTmp(); - } - // reposition subbranch - lmosel->reposition(); + // Special case: CTRL to link below dst + lmosel->setParObjTmp (dst,p,+1); + } else if (e->modifiers()==Qt::ShiftModifier) + lmosel->setParObjTmp (dst,p,-1); + else + lmosel->setParObjTmp (dst,p,0); + } else + { + lmosel->unsetParObjTmp(); + } + // reposition subbranch + lmosel->reposition(); QItemSelection sel=model->getSelectionModel()->selection(); updateSelection(sel,sel); // position has changed + scrollTo (model->index (seli->parent())); + } // no FloatImageObj scene()->update(); @@ -1379,13 +1383,11 @@ tmpLink->setEndBranch ( ((BranchItem*)dsti) ); tmpLink->updateLink(); model->createLink (tmpLink); - /* FIXME-2 Link savestate missing, segfaulting on undo - model->saveState( - tmpXLink,QString("delete ()"), - dsti,QString("addXLink (\"%1\",\"%2\")").arg(model->getSelectString(tmpXLink->getBegin())).arg(model->getSelectString(dsti)), - QString("Add xLink from %1 to %2").arg(model->getObjectName(tmpXLink->getBegin())).arg(model->getObjectName(dsti)) + model->saveState( //FIXME-2 wrong order of paramters + dsti,QString("addXLink (\"%1\",\"%2\")").arg(model->getSelectString(tmpLink->getBeginLinkItem())).arg(model->getSelectString(dsti)), + dsti,QString("Add xLink from %1 to %2").arg(model->getObjectName(tmpLink->getBeginLinkItem())).arg(model->getObjectName(dsti)) , + QString("Adding XLink()") ); - */ } else { delete (tmpLink); @@ -1576,7 +1578,7 @@ void MapEditor::wheelEvent(QWheelEvent* e) { - //qDebug ()<<"ME::wheelEvent"; //FIXME-2 stop all animations in vymModel here + //qDebug ()<<"ME::wheelEvent"; //FIXME-3 stop all animations in vymModel here //model->stopAllAnimation(); QGraphicsView::wheelEvent (e); }