1.1 --- a/branchobj.cpp Fri Feb 24 11:21:15 2006 +0000
1.2 +++ b/branchobj.cpp Wed Mar 08 12:59:08 2006 +0000
1.3 @@ -575,21 +575,9 @@
1.4
1.5 void BranchObj::positionBBox()
1.6 {
1.7 - /*// TODO testing (optimization)
1.8 - QString h=getHeading();
1.9 - if (!h.isEmpty())
1.10 - cout << "BO::positionBBox("<<h<<")\n";
1.11 - else
1.12 - cout << "BO::positionBBox (noHeading)\n";
1.13 -*/
1.14 -
1.15 + QPoint ap=getAbsPos();
1.16 + bbox.moveTopLeft (ap);
1.17 positionContents();
1.18 -
1.19 - int d=frame->getBorder()/2;
1.20 -
1.21 - bbox.moveTopLeft (QPoint (absPos.x(), absPos.y() - topPad));
1.22 - clickBox.moveTopLeft(QPoint (absPos.x()+d, absPos.y()+d ));
1.23 -
1.24 setSelBox();
1.25
1.26 // set the frame
1.27 @@ -604,8 +592,8 @@
1.28 void BranchObj::calcBBoxSize()
1.29 {
1.30 QSize heading_r=heading->getSize();
1.31 - int heading_w=static_cast <int> (heading_r.width() );
1.32 - int heading_h=static_cast <int> (heading_r.height() );
1.33 + int heading_w=(int) heading_r.width() ;
1.34 + int heading_h=(int) heading_r.height() ;
1.35 QSize sysflags_r=systemFlags->getSize();
1.36 int sysflags_h=sysflags_r.height();
1.37 int sysflags_w=sysflags_r.width();
1.38 @@ -621,7 +609,11 @@
1.39 h=max (sysflags_h,stanflags_h);
1.40 h=max (h,heading_h);
1.41
1.42 - clickBox.setSize (QSize (w,h));
1.43 + // Save the dimension of flags and heading
1.44 + ornamentsBBox.setSize ( QSize(w,h));
1.45 +
1.46 + // clickBox includes Flags and Heading
1.47 + clickBox.setSize (ornamentsBBox.size() );
1.48
1.49 // Floatimages
1.50 QPoint rp;
1.51 @@ -638,16 +630,25 @@
1.52 if (includeImagesVer)
1.53 {
1.54 if (rp.y() < 0)
1.55 - topPad=max (topPad,-rp.y());
1.56 - if (rp.y()+foi->height() > h)
1.57 - botPad=max (botPad,rp.y()+foi->height()-h);
1.58 + topPad=max (topPad,-rp.y()-h);
1.59 + if (rp.y()+foi->height() > 0)
1.60 + botPad=max (botPad,rp.y()+foi->height());
1.61 }
1.62 if (includeImagesHor)
1.63 {
1.64 - if (rp.x() < 0)
1.65 - leftPad=max (leftPad,-rp.x());
1.66 - if (rp.x()+foi->width() > w)
1.67 - rightPad=max (rightPad,rp.x()+foi->width()-w);
1.68 + if (orientation==OrientRightOfCenter)
1.69 + {
1.70 + if (-rp.x()-w > 0)
1.71 + leftPad=max (leftPad,-rp.x()-w);
1.72 + if (rp.x()+foi->width() > 0)
1.73 + rightPad=max (rightPad,rp.x()+foi->width());
1.74 + } else
1.75 + {
1.76 + if (rp.x()< 0)
1.77 + leftPad=max (leftPad,-rp.x());
1.78 + if (rp.x()+foi->width() > w)
1.79 + rightPad=max (rightPad,rp.x()+foi->width()-w);
1.80 + }
1.81 }
1.82 }
1.83 }
1.84 @@ -663,6 +664,18 @@
1.85 bbox.setSize (QSize (w,h));
1.86 }
1.87
1.88 +void BranchObj::setDockPos()
1.89 +{
1.90 + if (getOrientation()==OrientLeftOfCenter )
1.91 + {
1.92 + childPos=QPoint (ornamentsBBox.bottomLeft().x(), ornamentsBBox.bottomLeft().y() );
1.93 + parPos=QPoint (ornamentsBBox.bottomRight().x(),ornamentsBBox.bottomRight().y() );
1.94 + } else
1.95 + {
1.96 + childPos=QPoint (ornamentsBBox.bottomRight().x(), ornamentsBBox.bottomRight().y() );
1.97 + parPos=QPoint (ornamentsBBox.bottomLeft().x(),ornamentsBBox.bottomLeft().y() );
1.98 + }
1.99 +}
1.100 LinkableMapObj* BranchObj::findMapObj(QPoint p, LinkableMapObj* excludeLMO)
1.101 {
1.102 // Search branches
1.103 @@ -871,6 +884,7 @@
1.104 return xlink.count();
1.105 }
1.106
1.107 +
1.108 BranchObj* BranchObj::XLinkTargetAt (int i)
1.109 {
1.110 if (xlink.at(i))
1.111 @@ -1223,18 +1237,16 @@
1.112 void BranchObj::alignRelativeTo (QPoint ref)
1.113 {
1.114 int th = bboxTotal.height();
1.115 -/* TODO testing
1.116 - if (!getHeading().isEmpty())
1.117 - cout << "BO::alignRelTo "<<getHeading()<<endl;
1.118 - else
1.119 - cout << "BO::alignRelTo ???"<<endl;
1.120 +// TODO testing
1.121 +/*
1.122 + cout << "BO::alignRelTo "<<getHeading()<<endl;
1.123 cout << " d="<<depth<<
1.124 - // " ref="<<ref<<
1.125 - // " bbTot="<<bboxTotal.topLeft()<<
1.126 - // " absPos="<<absPos<<
1.127 + " ref="<<ref<<
1.128 + " bbTot="<<bboxTotal.topLeft()<<
1.129 + " absPos="<<absPos<<
1.130 " pad="<<topPad<<","<<botPad<<","<<leftPad<<","<<rightPad<<
1.131 " th="<<th<<endl;
1.132 -*/
1.133 +*/
1.134
1.135 // If I am the mapcenter or a mainbranch, reposition heading
1.136 if (depth<2)
1.137 @@ -1256,13 +1268,13 @@
1.138 switch (orientation)
1.139 {
1.140 case OrientLeftOfCenter:
1.141 - move (ref.x() + rightPad - bbox.width(), ref.y() + (th-bbox.height())/2 +topPad);
1.142 + move (ref.x() - bbox.width(), ref.y() + (th-bbox.height())/2 );
1.143 break;
1.144 case OrientRightOfCenter:
1.145 - move (ref.x() + rightPad, ref.y() + (th-bbox.height())/2 + topPad);
1.146 + move (ref.x() , ref.y() + (th-bbox.height())/2 );
1.147 break;
1.148 default:
1.149 - cout <<"LMO::alignRelativeTo: oops, no orientation given...\n";
1.150 + qWarning ("LMO::alignRelativeTo: oops, no orientation given...");
1.151 break;
1.152 }
1.153 }
1.154 @@ -1272,9 +1284,9 @@
1.155 // Set reference point for alignment of childs
1.156 QPoint ref2;
1.157 if (orientation==OrientLeftOfCenter)
1.158 - ref2.setX(childPos.x() - linkwidth);
1.159 + ref2.setX(bbox.topLeft().x() - linkwidth);
1.160 else
1.161 - ref2.setX(childPos.x() + linkwidth);
1.162 + ref2.setX(bbox.topRight().x() + linkwidth);
1.163
1.164 if (depth==1)
1.165 ref2.setY(absPos.y()-(bboxTotal.height()-bbox.height())/2);
1.166 @@ -1308,10 +1320,12 @@
1.167 alignRelativeTo ( QPoint (absPos.x(),
1.168 absPos.y()-(bboxTotal.height()-bbox.height())/2) );
1.169 branch.sort();
1.170 + updateLink(); // This update is needed if the canvas is resized
1.171 + // due to excessive moving of a FIO
1.172
1.173 // After load, the floats might be at wrong position, force
1.174 // them to move, too
1.175 - move (absPos);
1.176 + //move (absPos); // FIXME really still needed to position floats?
1.177 } else
1.178 {
1.179 // This is only important for moving branches: