1.1 --- a/linkablemapobj.cpp Thu Sep 14 11:38:17 2006 +0000
1.2 +++ b/linkablemapobj.cpp Thu Sep 14 11:38:18 2006 +0000
1.3 @@ -154,10 +154,8 @@
1.4 {
1.5 if (parObj)
1.6 {
1.7 - relPos=getRelPos();
1.8 -
1.9 + getRelPos();
1.10 parObj->calcBBoxSize();
1.11 - parObj->requestReposition();
1.12 }
1.13 }
1.14
1.15 @@ -165,8 +163,9 @@
1.16 {
1.17 relPos=p;
1.18 if (parObj)
1.19 - { parObj->calcBBoxSize();
1.20 - parObj->requestReposition();
1.21 + {
1.22 + parObj->calcBBoxSize();
1.23 + requestReposition();
1.24 }
1.25 }
1.26
1.27 @@ -468,6 +467,31 @@
1.28 }
1.29 }
1.30
1.31 +void LinkableMapObj::setOrientation()
1.32 +{
1.33 + LinkOrient orientOld=orientation;
1.34 +
1.35 + if (!parObj)
1.36 + {
1.37 + orientation=OrientUndef;
1.38 + return;
1.39 + }
1.40 +
1.41 + // Set orientation, first look for orientation of parent
1.42 + if (parObj->getOrientation() != OrientUndef )
1.43 + // use the orientation of the parent:
1.44 + orientation=parObj->getOrientation();
1.45 + else
1.46 + {
1.47 + // calc orientation depending on position rel to parent
1.48 + if (absPos.x() < QPoint(parObj->getChildPos() ).x() )
1.49 + orientation=OrientLeftOfCenter;
1.50 + else
1.51 + orientation=OrientRightOfCenter;
1.52 + }
1.53 + if (orientOld!=orientation) requestReposition();
1.54 +}
1.55 +
1.56 void LinkableMapObj::updateLink()
1.57 {
1.58 // needs:
1.59 @@ -511,21 +535,11 @@
1.60 p2y=QPoint( parObj->getParPos() ).y();
1.61 }
1.62
1.63 +
1.64 +
1.65 + setDockPos(); // Call overloaded method
1.66 +/* FIXME not needed?
1.67 LinkOrient orientOld=orientation;
1.68 -
1.69 - // Set orientation, first look for orientation of parent
1.70 - if (parObj->getOrientation() != OrientUndef )
1.71 - // use the orientation of the parent:
1.72 - orientation=parObj->getOrientation();
1.73 - else
1.74 - {
1.75 - // calc orientation depending on position rel to mapCenter
1.76 - if (absPos.x() < QPoint(parObj->getChildPos() ).x() )
1.77 - orientation=OrientLeftOfCenter;
1.78 - else
1.79 - orientation=OrientRightOfCenter;
1.80 - }
1.81 -
1.82 if ((orientation!=orientOld) && (orientOld!= OrientUndef))
1.83 {
1.84 // Orientation just changed. Reorient this subbranch, because move is called
1.85 @@ -534,10 +548,11 @@
1.86 //
1.87 // Also possible: called in BranchObj::init(), then orientOld==OrientUndef,
1.88 // no need to reposition now
1.89 + cout <<"Trying to reorientate... orient="<<orientation<<endl;
1.90 reposition();
1.91 }
1.92
1.93 - setDockPos();
1.94 +*/
1.95
1.96 double p1x=parPos.x(); // Link is drawn from P1 to P2
1.97 double p1y=parPos.y();
1.98 @@ -657,11 +672,6 @@
1.99 return lmo;
1.100 }
1.101
1.102 -void LinkableMapObj::setDockPos()
1.103 -{
1.104 - cout <<"LMO::setDockPos()\n";
1.105 -}
1.106 -
1.107 QPoint LinkableMapObj::getChildPos()
1.108 {
1.109 return childPos;
1.110 @@ -709,14 +719,19 @@
1.111 (int)( + 150*sin (a)));
1.112 }
1.113
1.114 +/*
1.115 void LinkableMapObj::alignRelativeTo (QPoint ref)
1.116 {
1.117 - // FIXME testing, seems not to be used right now...
1.118 - cout << "LMO::alignRelTo ref="<<ref<<endl;
1.119 + // Overloaded, only called for BO, FIO, ...
1.120 + // FIXME not needed?
1.121 }
1.122 +*/
1.123
1.124 void LinkableMapObj::reposition()
1.125 {
1.126 + // FIXME not needed? Is overloaded in BranchObj...
1.127 + /*
1.128 + cout << "LMO::reposition\n";
1.129 if (depth==0)
1.130 {
1.131 // only calculate the sizes once. If the deepest LMO changes its height,
1.132 @@ -729,9 +744,11 @@
1.133 {
1.134 // This is only important for moving branches:
1.135 // For editing a branch it isn't called...
1.136 + cout << " reposition to abs "<<absPos<<endl;
1.137 alignRelativeTo ( QPoint (absPos.x(),
1.138 absPos.y()-(bboxTotal.height()-bbox.height())/2) );
1.139 }
1.140 + */
1.141 }
1.142
1.143 void LinkableMapObj::requestReposition()