mapeditor.cpp
changeset 814 31de6677aa96
parent 810 a9295db4dcbf
child 815 2881c4424190
     1.1 --- a/mapeditor.cpp	Tue Dec 01 11:06:15 2009 +0000
     1.2 +++ b/mapeditor.cpp	Thu Dec 03 22:32:24 2009 +0000
     1.3 @@ -1045,14 +1045,46 @@
     1.4  				mainWindow->editOpenVymLink();
     1.5  				// tabWidget may change, better return now
     1.6  				// before segfaulting...
     1.7 -			} else if (foname=="note")
     1.8 +			} else if (foname=="system-note")
     1.9  				mainWindow->windowToggleNoteEditor();
    1.10  			else if (foname=="hideInExport")		
    1.11  				model->toggleHideExport();
    1.12  			// FIXME-3 needed? xelection.update();	
    1.13  			return;	
    1.14 -		} 
    1.15 +		} else
    1.16 +		{
    1.17 +			// Take care of xLink
    1.18 +			if (ti->xlinkCount()>0 && lmo->getBBox().width()>30)
    1.19 +			{
    1.20 +				if ((lmo->getOrientation()==LinkableMapObj::RightOfCenter && p.x() > lmo->getBBox().right()-20)  ||
    1.21 +				    (lmo->getOrientation()==LinkableMapObj::LeftOfCenter && p.x() < lmo->getBBox().left()+20) ) 
    1.22 +				{
    1.23 +					if (ti->xlinkCount()>1)
    1.24 +					{
    1.25 +						QMenu menu;
    1.26 +						QList <QAction*> alist;
    1.27 +						for (int i=0;i<ti->xlinkCount();i++)
    1.28 +							alist.append (new QAction(ti->getXLinkNum(i)->getOtherBranch(ti)->getHeading(),&menu));
    1.29 +						menu.addActions (alist);	
    1.30 +						QAction *ra=menu.exec (e->globalPos() );
    1.31 +						if (ra)
    1.32 +							model->select (ti->getXLinkNum(alist.indexOf(ra))->getOtherBranch (ti));
    1.33 +						while (!alist.isEmpty())
    1.34 +						{
    1.35 +							QAction *a=alist.takeFirst();
    1.36 +							delete a;
    1.37 +						}	
    1.38 +						return;
    1.39 +					} else
    1.40 +					{
    1.41 +						model->select (ti->getXLinkNum(0)->getOtherBranch (ti));
    1.42 +						return;
    1.43 +					}
    1.44 +				}	
    1.45 +			}
    1.46 +		}
    1.47  	}	
    1.48 +
    1.49  	// No system flag clicked, take care of modmodes (CTRL-Click)
    1.50  	if (e->state() & Qt::ControlModifier)
    1.51  	{
    1.52 @@ -1216,9 +1248,11 @@
    1.53  		{	// selection != a FloatObj
    1.54  			if (seli->depth()==0)		
    1.55  			{
    1.56 +				// Move mapcenter
    1.57  				lmosel->move   (p-movingObj_start);		
    1.58  				if (e->buttons()== Qt::LeftButton && e->modifiers()==Qt::ShiftModifier) 
    1.59  				{
    1.60 +					// Move only mapcenter, leave its children where they are
    1.61  					QPointF v;
    1.62  					v=lmosel->getAbsPos();
    1.63  					for (int i=0; i<seli->branchCount(); ++i)
    1.64 @@ -1232,7 +1266,8 @@
    1.65  				if (seli->depth()==1)
    1.66  				{
    1.67  					// Move mainbranch
    1.68 -					lmosel->move(p-movingObj_start);		
    1.69 +					if (!lmosel->hasParObjTmp())
    1.70 +						lmosel->move(p-movingObj_start);		
    1.71  					lmosel->setRelPos();
    1.72  				} else
    1.73  				{
    1.74 @@ -1254,8 +1289,7 @@
    1.75  					{
    1.76  						// Special case: CTRL to link below dst
    1.77  						lmosel->setParObjTmp (dst,p,+1);
    1.78 -					}
    1.79 -					else if (e->modifiers()==Qt::ShiftModifier)
    1.80 +					} else if (e->modifiers()==Qt::ShiftModifier)
    1.81  						lmosel->setParObjTmp (dst,p,-1);
    1.82  					else
    1.83  						lmosel->setParObjTmp (dst,p,0);
    1.84 @@ -1451,7 +1485,7 @@
    1.85  				}
    1.86  			} else
    1.87  			{
    1.88 -				// No destination, undo  temporary move
    1.89 +				// No destination, undo  temporary move	// FIXME-1 animation missing now?
    1.90  
    1.91  				if (seli->depth()==1)
    1.92  				{