# HG changeset patch # User insilmaril # Date 1141223944 0 # Node ID e03b393e4e51c550ef321994e9df8772e8f366c4 # Parent 4b872954721bea2c843bad0b152095ab8bb34380 1.7.10 includeImagesHorizontally implemented diff -r 4b872954721b -r e03b393e4e51 branchobj.cpp --- a/branchobj.cpp Fri Feb 24 11:22:50 2006 +0000 +++ b/branchobj.cpp Wed Mar 01 14:39:04 2006 +0000 @@ -575,21 +575,9 @@ void BranchObj::positionBBox() { - /*// TODO testing (optimization) - QString h=getHeading(); - if (!h.isEmpty()) - cout << "BO::positionBBox("<<h<<")\n"; - else - cout << "BO::positionBBox (noHeading)\n"; -*/ - + QPoint ap=getAbsPos(); + bbox.moveTopLeft (ap); positionContents(); - - int d=frame->getBorder()/2; - - bbox.moveTopLeft (QPoint (absPos.x(), absPos.y() - topPad)); - clickBox.moveTopLeft(QPoint (absPos.x()+d, absPos.y()+d )); - setSelBox(); // set the frame @@ -604,8 +592,8 @@ void BranchObj::calcBBoxSize() { QSize heading_r=heading->getSize(); - int heading_w=static_cast <int> (heading_r.width() ); - int heading_h=static_cast <int> (heading_r.height() ); + int heading_w=(int) heading_r.width() ; + int heading_h=(int) heading_r.height() ; QSize sysflags_r=systemFlags->getSize(); int sysflags_h=sysflags_r.height(); int sysflags_w=sysflags_r.width(); @@ -621,7 +609,11 @@ h=max (sysflags_h,stanflags_h); h=max (h,heading_h); - clickBox.setSize (QSize (w,h)); + // Save the dimension of flags and heading + ornamentsBBox.setSize ( QSize(w,h)); + + // clickBox includes Flags and Heading + clickBox.setSize (ornamentsBBox.size() ); // Floatimages QPoint rp; @@ -638,16 +630,25 @@ if (includeImagesVer) { if (rp.y() < 0) - topPad=max (topPad,-rp.y()); - if (rp.y()+foi->height() > h) - botPad=max (botPad,rp.y()+foi->height()-h); + topPad=max (topPad,-rp.y()-h); + if (rp.y()+foi->height() > 0) + botPad=max (botPad,rp.y()+foi->height()); } if (includeImagesHor) { - if (rp.x() < 0) - leftPad=max (leftPad,-rp.x()); - if (rp.x()+foi->width() > w) - rightPad=max (rightPad,rp.x()+foi->width()-w); + if (orientation==OrientRightOfCenter) + { + if (-rp.x()-w > 0) + leftPad=max (leftPad,-rp.x()-w); + if (rp.x()+foi->width() > 0) + rightPad=max (rightPad,rp.x()+foi->width()); + } else + { + if (rp.x()< 0) + leftPad=max (leftPad,-rp.x()); + if (rp.x()+foi->width() > w) + rightPad=max (rightPad,rp.x()+foi->width()-w); + } } } } @@ -663,6 +664,18 @@ bbox.setSize (QSize (w,h)); } +void BranchObj::setDockPos() +{ + if (getOrientation()==OrientLeftOfCenter ) + { + childPos=QPoint (ornamentsBBox.bottomLeft().x(), ornamentsBBox.bottomLeft().y() ); + parPos=QPoint (ornamentsBBox.bottomRight().x(),ornamentsBBox.bottomRight().y() ); + } else + { + childPos=QPoint (ornamentsBBox.bottomRight().x(), ornamentsBBox.bottomRight().y() ); + parPos=QPoint (ornamentsBBox.bottomLeft().x(),ornamentsBBox.bottomLeft().y() ); + } +} LinkableMapObj* BranchObj::findMapObj(QPoint p, LinkableMapObj* excludeLMO) { // Search branches @@ -871,6 +884,7 @@ return xlink.count(); } + BranchObj* BranchObj::XLinkTargetAt (int i) { if (xlink.at(i)) @@ -1223,18 +1237,16 @@ void BranchObj::alignRelativeTo (QPoint ref) { int th = bboxTotal.height(); -/* TODO testing - if (!getHeading().isEmpty()) - cout << "BO::alignRelTo "<<getHeading()<<endl; - else - cout << "BO::alignRelTo ???"<<endl; +// TODO testing +/* + cout << "BO::alignRelTo "<<getHeading()<<endl; cout << " d="<<depth<< - // " ref="<<ref<< - // " bbTot="<<bboxTotal.topLeft()<< - // " absPos="<<absPos<< + " ref="<<ref<< + " bbTot="<<bboxTotal.topLeft()<< + " absPos="<<absPos<< " pad="<<topPad<<","<<botPad<<","<<leftPad<<","<<rightPad<< " th="<<th<<endl; -*/ +*/ // If I am the mapcenter or a mainbranch, reposition heading if (depth<2) @@ -1256,13 +1268,13 @@ switch (orientation) { case OrientLeftOfCenter: - move (ref.x() + rightPad - bbox.width(), ref.y() + (th-bbox.height())/2 +topPad); + move (ref.x() - bbox.width(), ref.y() + (th-bbox.height())/2 ); break; case OrientRightOfCenter: - move (ref.x() + rightPad, ref.y() + (th-bbox.height())/2 + topPad); + move (ref.x() , ref.y() + (th-bbox.height())/2 ); break; default: - cout <<"LMO::alignRelativeTo: oops, no orientation given...\n"; + qWarning ("LMO::alignRelativeTo: oops, no orientation given..."); break; } } @@ -1272,9 +1284,9 @@ // Set reference point for alignment of childs QPoint ref2; if (orientation==OrientLeftOfCenter) - ref2.setX(childPos.x() - linkwidth); + ref2.setX(bbox.topLeft().x() - linkwidth); else - ref2.setX(childPos.x() + linkwidth); + ref2.setX(bbox.topRight().x() + linkwidth); if (depth==1) ref2.setY(absPos.y()-(bboxTotal.height()-bbox.height())/2); @@ -1308,10 +1320,12 @@ alignRelativeTo ( QPoint (absPos.x(), absPos.y()-(bboxTotal.height()-bbox.height())/2) ); branch.sort(); + updateLink(); // This update is needed if the canvas is resized + // due to excessive moving of a FIO // After load, the floats might be at wrong position, force // them to move, too - move (absPos); + //move (absPos); // FIXME really still needed to position floats? } else { // This is only important for moving branches: diff -r 4b872954721b -r e03b393e4e51 branchobj.h --- a/branchobj.h Fri Feb 24 11:22:50 2006 +0000 +++ b/branchobj.h Wed Mar 01 14:39:04 2006 +0000 @@ -59,6 +59,7 @@ virtual void moveBy (QPoint); virtual void positionBBox(); virtual void calcBBoxSize(); + virtual void setDockPos(); virtual LinkableMapObj* findMapObj(QPoint,LinkableMapObj*); // find MapObj virtual void setHeading (QString); virtual void setURL (QString); diff -r 4b872954721b -r e03b393e4e51 demos/todo.vym Binary file demos/todo.vym has changed diff -r 4b872954721b -r e03b393e4e51 floatobj.cpp --- a/floatobj.cpp Fri Feb 24 11:22:50 2006 +0000 +++ b/floatobj.cpp Wed Mar 01 14:39:04 2006 +0000 @@ -81,17 +81,25 @@ move (p.x(), p.y()); } +void FloatObj::setDockPos() +{ + childPos=QPoint (bbox.bottomRight().x(), bbox.bottomRight().y() ); + parPos=absPos; +} + void FloatObj::reposition() { + /* FIXME not needed? if (useOrientation) { if (parObj->getOrientation()==OrientLeftOfCenter) - move (parObj->x() - relPos.x() + parObj->width() - bbox.width(), parObj->y()+relPos.y()); + move (parObj->getChildPos().x() - relPos.x() + parObj->width() - bbox.width(), parObj->y()+relPos.y()); else - move (parObj->x()+relPos.x(), parObj->y()+relPos.y()); + move (parObj->x()+relPos.x(), parObj->getChildPos().y()+relPos.y()); } else - move (parObj->x()+relPos.x(), parObj->y()+relPos.y()); + */ + move (parObj->getChildPos().x()+relPos.x(), parObj->getChildPos().y()+relPos.y()); updateLink(); } diff -r 4b872954721b -r e03b393e4e51 floatobj.h --- a/floatobj.h Fri Feb 24 11:22:50 2006 +0000 +++ b/floatobj.h Wed Mar 01 14:39:04 2006 +0000 @@ -20,7 +20,7 @@ virtual void move (double,double); virtual void move (QPoint); - + virtual void setDockPos(); virtual void reposition(); virtual QRect getTotalBBox(); // return BBox including childs