mapeditor.cpp
changeset 723 11f9124c1cca
parent 720 192e1392ba6a
child 726 7f43b93242aa
     1.1 --- a/mapeditor.cpp	Wed Jul 16 11:56:44 2008 +0000
     1.2 +++ b/mapeditor.cpp	Mon Aug 04 10:43:06 2008 +0000
     1.3 @@ -42,7 +42,6 @@
     1.4  
     1.5  	model=vm;
     1.6  	model->setScene (mapScene);
     1.7 -	model->setMapEditor (this);
     1.8  	model->registerEditor(this);
     1.9  	model->addMapCenter();	//  FIXME create this in MapEditor until BO and MCO are independent of scene
    1.10  	model->makeDefault();
    1.11 @@ -71,7 +70,7 @@
    1.12  
    1.13  	setAcceptDrops (true);	
    1.14  
    1.15 -	model->reposition();	//FIXME really still needed?
    1.16 +	//model->reposition();	//FIXME really still needed?
    1.17  
    1.18  
    1.19  	// Action to embed LineEdit for heading in Scene
    1.20 @@ -287,10 +286,30 @@
    1.21  
    1.22  void MapEditor::testFunction1()
    1.23  {
    1.24 -	BranchObj *bo=model->getSelectedBranch();
    1.25 +	//BranchObj *bo=model->getSelectedBranch();
    1.26  	//if (bo) model->moveAway (bo);
    1.27 -	if (bo) bo->setLinkStyle (LinkableMapObj::Line);
    1.28 +	//if (bo) bo->setLinkStyle (LinkableMapObj::Line);
    1.29  	
    1.30 +
    1.31 +	// Displacement and animation of all non-mainbranches
    1.32 +	QPointF p;
    1.33 +	QPointF q;
    1.34 +	BranchObj *bo;
    1.35 +	bo=model->first();
    1.36 +	while (bo) 
    1.37 +	{
    1.38 +		if (bo->getDepth() >0 && !bo->hasScrolledParent(bo) )
    1.39 +		{
    1.40 +			p=QPointF (qrand() %600-300, qrand () %600-300);
    1.41 +			bo->setRelPos();
    1.42 +			q=bo->getRelPos();
    1.43 +			model->startAnimation (bo,p, q);
    1.44 +		}
    1.45 +		bo=model->next(bo);
    1.46 +	}
    1.47 +
    1.48 +
    1.49 +
    1.50  /* TODO Hide hidden stuff temporary, maybe add this as regular function somewhere
    1.51  	if (hidemode==HideNone)
    1.52  	{
    1.53 @@ -400,8 +419,11 @@
    1.54  	{ // No MapObj found, we are on the Canvas itself
    1.55  		// Context Menu on scene
    1.56  		model->updateActions();
    1.57 -		contextMenuPos=p;
    1.58 -		canvasContextMenu->popup(e->globalPos() );
    1.59 +		
    1.60 +		// Open context menu synchronously to position new mapcenter
    1.61 +		model->setContextPos (p);
    1.62 +		canvasContextMenu->exec(e->globalPos() );
    1.63 +		model->unsetContextPos ();
    1.64      } 
    1.65  	e->accept();
    1.66  }
    1.67 @@ -796,9 +818,9 @@
    1.68                  QString pold=qpointfToString(movingObj_orgPos);
    1.69                  QString pnow=qpointfToString(bo->getAbsPos());
    1.70                  model->saveState(
    1.71 -                    fo,
    1.72 +                    bo,
    1.73                      "move "+pold,
    1.74 -                    fo,
    1.75 +                    bo,
    1.76                      "move "+pnow,
    1.77                      QString("Move mapcenter %1 to position %2").arg(getName(bo)).arg(pnow));
    1.78              }
    1.79 @@ -890,6 +912,7 @@
    1.80  			//		if (lmosel->getOrientation()==LinkableMapObj::LeftOfCenter) dst.setX (dst.x()+lmosel->width() );
    1.81  					
    1.82  					model->startAnimation(
    1.83 +						(BranchObj*)lmosel,
    1.84  						lmosel->getRelPos(),
    1.85  						movingObj_orgRelPos
    1.86  //						QPointF (movingObj_orgPos.x() - dst.x(), movingObj_orgPos.y() - dst.y() )