mapeditor.cpp
changeset 848 e265f07f2173
parent 847 43268373032d
     1.1 --- a/mapeditor.cpp	Wed Jun 09 13:14:08 2010 +0000
     1.2 +++ b/mapeditor.cpp	Mon Jun 14 13:59:17 2010 +0000
     1.3 @@ -1149,10 +1149,10 @@
     1.4  				if (bi)
     1.5  				{
     1.6  					copyingObj=true;
     1.7 -					//FIXME-2   TreeItem::addBranch (BranchItem still missing) 
     1.8 -					//bi->addBranch (model->getSelectedBranch());
     1.9 -					model->unselect();
    1.10 -					model->select(bi->getLastBranch());
    1.11 +					//model->select(model->createBranch (bi));
    1.12 +					model->copy();
    1.13 +					model->paste();
    1.14 +					model->select (bi->getLastBranch());
    1.15  					model->reposition();
    1.16  				}
    1.17  			} 
    1.18 @@ -1200,10 +1200,11 @@
    1.19  		if (mainWindow->getModMode()!=Main::ModModeCopy)
    1.20  			setCursor (Qt::ArrowCursor);
    1.21  
    1.22 -		// Scroll if needed
    1.23 -		// To avoid jumping of the sceneView, only 
    1.24 -		// show selection, if not tmp linked
    1.25 -		model->emitShowSelection();
    1.26 +		if (!lmosel->hasParObjTmp())
    1.27 +			// Scroll if needed
    1.28 +			// To avoid jumping of the sceneView, only 
    1.29 +			// show selection, if not tmp linked
    1.30 +			model->emitShowSelection();
    1.31  		
    1.32  		// Now move the selection, but add relative position 
    1.33  		// (movingObj_start) where selection was chosen with 
    1.34 @@ -1292,27 +1293,30 @@
    1.35  				} 
    1.36  
    1.37  			} // depth>0
    1.38 -				// Maybe we can relink temporary?
    1.39 -				if (dsti)
    1.40 +
    1.41 +			// Maybe we can relink temporary?
    1.42 +			if (dsti)
    1.43 +			{
    1.44 +				if (e->modifiers()==Qt::ControlModifier)
    1.45  				{
    1.46 -					if (e->modifiers()==Qt::ControlModifier)
    1.47 -					{
    1.48 -						// Special case: CTRL to link below dst
    1.49 -						lmosel->setParObjTmp (dst,p,+1);
    1.50 -					} else if (e->modifiers()==Qt::ShiftModifier)
    1.51 -						lmosel->setParObjTmp (dst,p,-1);
    1.52 -					else
    1.53 -						lmosel->setParObjTmp (dst,p,0);
    1.54 -				} else	
    1.55 -				{
    1.56 -					lmosel->unsetParObjTmp();
    1.57 -				}		
    1.58 -				// reposition subbranch
    1.59 -				lmosel->reposition();	
    1.60 +					// Special case: CTRL to link below dst
    1.61 +					lmosel->setParObjTmp (dst,p,+1);
    1.62 +				} else if (e->modifiers()==Qt::ShiftModifier)
    1.63 +					lmosel->setParObjTmp (dst,p,-1);
    1.64 +				else
    1.65 +					lmosel->setParObjTmp (dst,p,0);
    1.66 +			} else	
    1.67 +			{
    1.68 +				lmosel->unsetParObjTmp();
    1.69 +			}		
    1.70 +			// reposition subbranch
    1.71 +			lmosel->reposition();
    1.72  
    1.73  			QItemSelection sel=model->getSelectionModel()->selection();
    1.74  			updateSelection(sel,sel);	// position has changed
    1.75  
    1.76 +			scrollTo (model->index (seli->parent()));
    1.77 +
    1.78  		} // no FloatImageObj
    1.79  
    1.80  		scene()->update();
    1.81 @@ -1379,13 +1383,11 @@
    1.82  			tmpLink->setEndBranch ( ((BranchItem*)dsti) );
    1.83  			tmpLink->updateLink();
    1.84  			model->createLink (tmpLink);
    1.85 -			/* FIXME-2 Link savestate missing, segfaulting on undo
    1.86 -			model->saveState(
    1.87 -				tmpXLink,QString("delete ()"),
    1.88 -				dsti,QString("addXLink (\"%1\",\"%2\")").arg(model->getSelectString(tmpXLink->getBegin())).arg(model->getSelectString(dsti)),
    1.89 -				QString("Add xLink from %1 to %2").arg(model->getObjectName(tmpXLink->getBegin())).arg(model->getObjectName(dsti)) 
    1.90 +			model->saveState(	//FIXME-2 wrong order of paramters
    1.91 +				dsti,QString("addXLink (\"%1\",\"%2\")").arg(model->getSelectString(tmpLink->getBeginLinkItem())).arg(model->getSelectString(dsti)),
    1.92 +				dsti,QString("Add xLink from %1 to %2").arg(model->getObjectName(tmpLink->getBeginLinkItem())).arg(model->getObjectName(dsti)) ,
    1.93 +				QString("Adding XLink()")
    1.94  			);	
    1.95 -			*/
    1.96  		} else
    1.97  		{
    1.98  			delete (tmpLink);
    1.99 @@ -1576,7 +1578,7 @@
   1.100  
   1.101  void MapEditor::wheelEvent(QWheelEvent* e)
   1.102  {
   1.103 -	//qDebug ()<<"ME::wheelEvent";	//FIXME-2 stop all animations in vymModel here
   1.104 +	//qDebug ()<<"ME::wheelEvent";	//FIXME-3 stop all animations in vymModel here
   1.105  	//model->stopAllAnimation();
   1.106  	QGraphicsView::wheelEvent (e);
   1.107  }