Feature: Better handling of xLinks
authorinsilmaril
Thu, 03 Dec 2009 22:32:24 +0000
changeset 81431de6677aa96
parent 813 82ebfc46233b
child 815 2881c4424190
Feature: Better handling of xLinks
branchobj.cpp
demos/vym-contribute.vym
mapeditor.cpp
tex/vym.changelog
version.h
xlinkitem.cpp
xlinkitem.h
     1.1 --- a/branchobj.cpp	Tue Dec 01 11:06:15 2009 +0000
     1.2 +++ b/branchobj.cpp	Thu Dec 03 22:32:24 2009 +0000
     1.3 @@ -141,18 +141,20 @@
     1.4  	parObj=bo;
     1.5  
     1.6  	setLinkStyle (dst->getDefLinkStyle (dsti));
     1.7 -
     1.8 + 
     1.9  	// Move temporary to new position at destination
    1.10  	// Usually the positioning would be done by reposition(),
    1.11  	// but then also the destination branch would "Jump" around...
    1.12  	// Better just do it approximately
    1.13 -	if (parObj->getTreeItem()->depth()==0)	
    1.14 +	cout << "BO::setTmp  d="<<dsti->depth();
    1.15 +	if (dsti->depth()==0)	
    1.16  	{	// new parent is a mapcenter
    1.17  		Vector v= ( m - bo->getChildPos());
    1.18  		if (v.x()<0) v.setX( v.x()-bbox.width() );
    1.19  		v.normalize();
    1.20  		v.scale (100);
    1.21  		move2RelPos (v.toQPointF());
    1.22 +		cout << "  v="<<v<<endl;
    1.23  	} else
    1.24  	{	
    1.25  		qreal y;
     2.1 Binary file demos/vym-contribute.vym has changed
     3.1 --- a/mapeditor.cpp	Tue Dec 01 11:06:15 2009 +0000
     3.2 +++ b/mapeditor.cpp	Thu Dec 03 22:32:24 2009 +0000
     3.3 @@ -1045,14 +1045,46 @@
     3.4  				mainWindow->editOpenVymLink();
     3.5  				// tabWidget may change, better return now
     3.6  				// before segfaulting...
     3.7 -			} else if (foname=="note")
     3.8 +			} else if (foname=="system-note")
     3.9  				mainWindow->windowToggleNoteEditor();
    3.10  			else if (foname=="hideInExport")		
    3.11  				model->toggleHideExport();
    3.12  			// FIXME-3 needed? xelection.update();	
    3.13  			return;	
    3.14 -		} 
    3.15 +		} else
    3.16 +		{
    3.17 +			// Take care of xLink
    3.18 +			if (ti->xlinkCount()>0 && lmo->getBBox().width()>30)
    3.19 +			{
    3.20 +				if ((lmo->getOrientation()==LinkableMapObj::RightOfCenter && p.x() > lmo->getBBox().right()-20)  ||
    3.21 +				    (lmo->getOrientation()==LinkableMapObj::LeftOfCenter && p.x() < lmo->getBBox().left()+20) ) 
    3.22 +				{
    3.23 +					if (ti->xlinkCount()>1)
    3.24 +					{
    3.25 +						QMenu menu;
    3.26 +						QList <QAction*> alist;
    3.27 +						for (int i=0;i<ti->xlinkCount();i++)
    3.28 +							alist.append (new QAction(ti->getXLinkNum(i)->getOtherBranch(ti)->getHeading(),&menu));
    3.29 +						menu.addActions (alist);	
    3.30 +						QAction *ra=menu.exec (e->globalPos() );
    3.31 +						if (ra)
    3.32 +							model->select (ti->getXLinkNum(alist.indexOf(ra))->getOtherBranch (ti));
    3.33 +						while (!alist.isEmpty())
    3.34 +						{
    3.35 +							QAction *a=alist.takeFirst();
    3.36 +							delete a;
    3.37 +						}	
    3.38 +						return;
    3.39 +					} else
    3.40 +					{
    3.41 +						model->select (ti->getXLinkNum(0)->getOtherBranch (ti));
    3.42 +						return;
    3.43 +					}
    3.44 +				}	
    3.45 +			}
    3.46 +		}
    3.47  	}	
    3.48 +
    3.49  	// No system flag clicked, take care of modmodes (CTRL-Click)
    3.50  	if (e->state() & Qt::ControlModifier)
    3.51  	{
    3.52 @@ -1216,9 +1248,11 @@
    3.53  		{	// selection != a FloatObj
    3.54  			if (seli->depth()==0)		
    3.55  			{
    3.56 +				// Move mapcenter
    3.57  				lmosel->move   (p-movingObj_start);		
    3.58  				if (e->buttons()== Qt::LeftButton && e->modifiers()==Qt::ShiftModifier) 
    3.59  				{
    3.60 +					// Move only mapcenter, leave its children where they are
    3.61  					QPointF v;
    3.62  					v=lmosel->getAbsPos();
    3.63  					for (int i=0; i<seli->branchCount(); ++i)
    3.64 @@ -1232,7 +1266,8 @@
    3.65  				if (seli->depth()==1)
    3.66  				{
    3.67  					// Move mainbranch
    3.68 -					lmosel->move(p-movingObj_start);		
    3.69 +					if (!lmosel->hasParObjTmp())
    3.70 +						lmosel->move(p-movingObj_start);		
    3.71  					lmosel->setRelPos();
    3.72  				} else
    3.73  				{
    3.74 @@ -1254,8 +1289,7 @@
    3.75  					{
    3.76  						// Special case: CTRL to link below dst
    3.77  						lmosel->setParObjTmp (dst,p,+1);
    3.78 -					}
    3.79 -					else if (e->modifiers()==Qt::ShiftModifier)
    3.80 +					} else if (e->modifiers()==Qt::ShiftModifier)
    3.81  						lmosel->setParObjTmp (dst,p,-1);
    3.82  					else
    3.83  						lmosel->setParObjTmp (dst,p,0);
    3.84 @@ -1451,7 +1485,7 @@
    3.85  				}
    3.86  			} else
    3.87  			{
    3.88 -				// No destination, undo  temporary move
    3.89 +				// No destination, undo  temporary move	// FIXME-1 animation missing now?
    3.90  
    3.91  				if (seli->depth()==1)
    3.92  				{
     4.1 --- a/tex/vym.changelog	Tue Dec 01 11:06:15 2009 +0000
     4.2 +++ b/tex/vym.changelog	Thu Dec 03 22:32:24 2009 +0000
     4.3 @@ -1,3 +1,14 @@
     4.4 +-------------------------------------------------------------------
     4.5 +Thu Dec  3 23:17:57 CET 2009 - vym@insilmaril.de
     4.6 +
     4.7 +- Feature: Following xLinks is now possible by clicking in the 
     4.8 +           part of a branch near to beginning of branch (20 pixels)
     4.9 +
    4.10 +-------------------------------------------------------------------
    4.11 +Thu Dec  3 17:26:59 CET 2009 - vym@insilmaril.de
    4.12 +
    4.13 +- Bugfix: Clicking the note flag opens the note editor again
    4.14 +
    4.15  -------------------------------------------------------------------
    4.16  Tue Dec  1 12:03:42 CET 2009 - vym@insilmaril.de
    4.17  
     5.1 --- a/version.h	Tue Dec 01 11:06:15 2009 +0000
     5.2 +++ b/version.h	Thu Dec 03 22:32:24 2009 +0000
     5.3 @@ -7,7 +7,7 @@
     5.4  #define __VYM_VERSION "1.13.0"
     5.5  //#define __VYM_CODENAME "Codename: RC-1"
     5.6  #define __VYM_CODENAME "Codename: development version, not for production!"
     5.7 -#define __VYM_BUILD_DATE "2009-12-01"
     5.8 +#define __VYM_BUILD_DATE "2009-12-03"
     5.9  
    5.10  
    5.11  bool checkVersion(const QString &);
     6.1 --- a/xlinkitem.cpp	Tue Dec 01 11:06:15 2009 +0000
     6.2 +++ b/xlinkitem.cpp	Thu Dec 03 22:32:24 2009 +0000
     6.3 @@ -173,6 +173,18 @@
     6.4  		return beginBranch;
     6.5  }
     6.6  
     6.7 +BranchItem* XLinkItem::getOtherBranch(TreeItem *ti)
     6.8 +{
     6.9 +	BranchItem *pb=getPartnerBranch();
    6.10 +	if (!pb) return NULL;
    6.11 +
    6.12 +	if (ti==beginBranch)
    6.13 +		return endBranch;
    6.14 +	else
    6.15 +		return beginBranch;
    6.16 +}
    6.17 +
    6.18 +
    6.19  
    6.20  XLinkItem* XLinkItem::getPartnerXLink()
    6.21  {
     7.1 --- a/xlinkitem.h	Tue Dec 01 11:06:15 2009 +0000
     7.2 +++ b/xlinkitem.h	Thu Dec 03 22:32:24 2009 +0000
     7.3 @@ -31,6 +31,7 @@
     7.4  	void updateXLink();
     7.5  	virtual void updateVisibility();	// FIXME-3 not really needed atm...
     7.6  	BranchItem* getPartnerBranch ();
     7.7 +	BranchItem* getOtherBranch (TreeItem *ti);
     7.8  	XLinkItem *getPartnerXLink();	//! Partner XLink
     7.9  	QString saveToDir ();
    7.10  	virtual XLinkObj* createMapObj(QGraphicsScene *scene);