# HG changeset patch # User insilmaril # Date 1259879544 0 # Node ID 31de6677aa96f1b8bfa14693e8fde99c53fa3455 # Parent 82ebfc46233b133af8cebd3333b4704c0060d585 Feature: Better handling of xLinks diff -r 82ebfc46233b -r 31de6677aa96 branchobj.cpp --- a/branchobj.cpp Tue Dec 01 11:06:15 2009 +0000 +++ b/branchobj.cpp Thu Dec 03 22:32:24 2009 +0000 @@ -141,18 +141,20 @@ parObj=bo; setLinkStyle (dst->getDefLinkStyle (dsti)); - + // Move temporary to new position at destination // Usually the positioning would be done by reposition(), // but then also the destination branch would "Jump" around... // Better just do it approximately - if (parObj->getTreeItem()->depth()==0) + cout << "BO::setTmp d="<depth(); + if (dsti->depth()==0) { // new parent is a mapcenter Vector v= ( m - bo->getChildPos()); if (v.x()<0) v.setX( v.x()-bbox.width() ); v.normalize(); v.scale (100); move2RelPos (v.toQPointF()); + cout << " v="<editOpenVymLink(); // tabWidget may change, better return now // before segfaulting... - } else if (foname=="note") + } else if (foname=="system-note") mainWindow->windowToggleNoteEditor(); else if (foname=="hideInExport") model->toggleHideExport(); // FIXME-3 needed? xelection.update(); return; - } + } else + { + // Take care of xLink + if (ti->xlinkCount()>0 && lmo->getBBox().width()>30) + { + if ((lmo->getOrientation()==LinkableMapObj::RightOfCenter && p.x() > lmo->getBBox().right()-20) || + (lmo->getOrientation()==LinkableMapObj::LeftOfCenter && p.x() < lmo->getBBox().left()+20) ) + { + if (ti->xlinkCount()>1) + { + QMenu menu; + QList alist; + for (int i=0;ixlinkCount();i++) + alist.append (new QAction(ti->getXLinkNum(i)->getOtherBranch(ti)->getHeading(),&menu)); + menu.addActions (alist); + QAction *ra=menu.exec (e->globalPos() ); + if (ra) + model->select (ti->getXLinkNum(alist.indexOf(ra))->getOtherBranch (ti)); + while (!alist.isEmpty()) + { + QAction *a=alist.takeFirst(); + delete a; + } + return; + } else + { + model->select (ti->getXLinkNum(0)->getOtherBranch (ti)); + return; + } + } + } + } } + // No system flag clicked, take care of modmodes (CTRL-Click) if (e->state() & Qt::ControlModifier) { @@ -1216,9 +1248,11 @@ { // selection != a FloatObj if (seli->depth()==0) { + // Move mapcenter lmosel->move (p-movingObj_start); if (e->buttons()== Qt::LeftButton && e->modifiers()==Qt::ShiftModifier) { + // Move only mapcenter, leave its children where they are QPointF v; v=lmosel->getAbsPos(); for (int i=0; ibranchCount(); ++i) @@ -1232,7 +1266,8 @@ if (seli->depth()==1) { // Move mainbranch - lmosel->move(p-movingObj_start); + if (!lmosel->hasParObjTmp()) + lmosel->move(p-movingObj_start); lmosel->setRelPos(); } else { @@ -1254,8 +1289,7 @@ { // Special case: CTRL to link below dst lmosel->setParObjTmp (dst,p,+1); - } - else if (e->modifiers()==Qt::ShiftModifier) + } else if (e->modifiers()==Qt::ShiftModifier) lmosel->setParObjTmp (dst,p,-1); else lmosel->setParObjTmp (dst,p,0); @@ -1451,7 +1485,7 @@ } } else { - // No destination, undo temporary move + // No destination, undo temporary move // FIXME-1 animation missing now? if (seli->depth()==1) { diff -r 82ebfc46233b -r 31de6677aa96 tex/vym.changelog --- a/tex/vym.changelog Tue Dec 01 11:06:15 2009 +0000 +++ b/tex/vym.changelog Thu Dec 03 22:32:24 2009 +0000 @@ -1,3 +1,14 @@ +------------------------------------------------------------------- +Thu Dec 3 23:17:57 CET 2009 - vym@insilmaril.de + +- Feature: Following xLinks is now possible by clicking in the + part of a branch near to beginning of branch (20 pixels) + +------------------------------------------------------------------- +Thu Dec 3 17:26:59 CET 2009 - vym@insilmaril.de + +- Bugfix: Clicking the note flag opens the note editor again + ------------------------------------------------------------------- Tue Dec 1 12:03:42 CET 2009 - vym@insilmaril.de diff -r 82ebfc46233b -r 31de6677aa96 version.h --- a/version.h Tue Dec 01 11:06:15 2009 +0000 +++ b/version.h Thu Dec 03 22:32:24 2009 +0000 @@ -7,7 +7,7 @@ #define __VYM_VERSION "1.13.0" //#define __VYM_CODENAME "Codename: RC-1" #define __VYM_CODENAME "Codename: development version, not for production!" -#define __VYM_BUILD_DATE "2009-12-01" +#define __VYM_BUILD_DATE "2009-12-03" bool checkVersion(const QString &); diff -r 82ebfc46233b -r 31de6677aa96 xlinkitem.cpp --- a/xlinkitem.cpp Tue Dec 01 11:06:15 2009 +0000 +++ b/xlinkitem.cpp Thu Dec 03 22:32:24 2009 +0000 @@ -173,6 +173,18 @@ return beginBranch; } +BranchItem* XLinkItem::getOtherBranch(TreeItem *ti) +{ + BranchItem *pb=getPartnerBranch(); + if (!pb) return NULL; + + if (ti==beginBranch) + return endBranch; + else + return beginBranch; +} + + XLinkItem* XLinkItem::getPartnerXLink() { diff -r 82ebfc46233b -r 31de6677aa96 xlinkitem.h --- a/xlinkitem.h Tue Dec 01 11:06:15 2009 +0000 +++ b/xlinkitem.h Thu Dec 03 22:32:24 2009 +0000 @@ -31,6 +31,7 @@ void updateXLink(); virtual void updateVisibility(); // FIXME-3 not really needed atm... BranchItem* getPartnerBranch (); + BranchItem* getOtherBranch (TreeItem *ti); XLinkItem *getPartnerXLink(); //! Partner XLink QString saveToDir (); virtual XLinkObj* createMapObj(QGraphicsScene *scene);