1.1 --- a/linkablemapobj.cpp Sat Mar 31 09:28:27 2007 +0000
1.2 +++ b/linkablemapobj.cpp Wed Apr 25 16:02:54 2007 +0000
1.3 @@ -35,16 +35,16 @@
1.4 {
1.5 switch (style)
1.6 {
1.7 - case StyleLine:
1.8 + case Line:
1.9 delete (l);
1.10 break;
1.11 - case StyleParabel:
1.12 + case Parabel:
1.13 while (!segment.isEmpty()) delete segment.takeFirst();
1.14 break;
1.15 - case StylePolyLine:
1.16 + case PolyLine:
1.17 delete (p);
1.18 break;
1.19 - case StylePolyParabel:
1.20 + case PolyParabel:
1.21 delete (p);
1.22 break;
1.23 default:
1.24 @@ -63,11 +63,11 @@
1.25 childPos=QPointF(0,0);
1.26 link2ParPos=false;
1.27 l=NULL;
1.28 - orientation=OrientUndef;
1.29 + orientation=UndefinedOrientation;
1.30 linkwidth=20;
1.31 thickness_start=8;
1.32 - style=StyleUndef;
1.33 - linkpos=LinkBottom;
1.34 + style=UndefinedStyle;
1.35 + linkpos=Bottom;
1.36 arcsegs=13;
1.37
1.38 // TODO instead of linkcolor pen.color() could be used all around
1.39 @@ -181,37 +181,37 @@
1.40 return rightPad;
1.41 }
1.42
1.43 -LinkStyle LinkableMapObj::getDefLinkStyle ()
1.44 +LinkableMapObj::Style LinkableMapObj::getDefLinkStyle ()
1.45 {
1.46 - if (mapEditor==0) return StyleUndef;
1.47 - LinkStyle ls=mapEditor->getMapLinkStyle();
1.48 + if (mapEditor==0) return UndefinedStyle;
1.49 + Style ls=mapEditor->getMapLinkStyle();
1.50 switch (ls)
1.51 {
1.52 - case StyleLine:
1.53 + case Line:
1.54 return ls;
1.55 break;
1.56 - case StyleParabel:
1.57 + case Parabel:
1.58 return ls;
1.59 break;
1.60 - case StylePolyLine:
1.61 + case PolyLine:
1.62 if (depth>1)
1.63 - return StyleLine;
1.64 + return Line;
1.65 else
1.66 return ls;
1.67 break;
1.68 - case StylePolyParabel:
1.69 + case PolyParabel:
1.70 if (depth>1)
1.71 - return StyleParabel;
1.72 + return Parabel;
1.73 else
1.74 return ls;
1.75 break;
1.76 default:
1.77 break;
1.78 }
1.79 - return StyleUndef;
1.80 + return UndefinedStyle;
1.81 }
1.82
1.83 -void LinkableMapObj::setLinkStyle(LinkStyle newstyle)
1.84 +void LinkableMapObj::setLinkStyle(Style newstyle)
1.85 {
1.86 //if (newstyle=style) return;
1.87 delLink();
1.88 @@ -223,10 +223,10 @@
1.89 QGraphicsLineItem *cl;
1.90 switch (style)
1.91 {
1.92 - case StyleUndef:
1.93 + case UndefinedStyle:
1.94 bottomline->hide();
1.95 break;
1.96 - case StyleLine:
1.97 + case Line:
1.98 l = scene->addLine(QLineF(1,1,1,1),pen);
1.99 l->setZValue(Z_LINK);
1.100 if (visible)
1.101 @@ -234,7 +234,7 @@
1.102 else
1.103 l->hide();
1.104 break;
1.105 - case StyleParabel:
1.106 + case Parabel:
1.107 for (int i=0;i<arcsegs;i++)
1.108 {
1.109 cl = scene->addLine(QLineF(i*5,0,i*10,100),pen);
1.110 @@ -247,7 +247,7 @@
1.111 }
1.112 pa0.resize (arcsegs+1);
1.113 break;
1.114 - case StylePolyLine:
1.115 + case PolyLine:
1.116 p =scene->addPolygon(QPolygonF(),pen,linkcolor);
1.117 p->setZValue(Z_LINK);
1.118 if (visible)
1.119 @@ -256,7 +256,7 @@
1.120 p->hide();
1.121 pa0.resize (3);
1.122 break;
1.123 - case StylePolyParabel:
1.124 + case PolyParabel:
1.125 p = scene->addPolygon(QPolygonF(),pen,linkcolor);
1.126 p->setZValue(Z_LINK);
1.127 if (visible)
1.128 @@ -273,7 +273,7 @@
1.129 }
1.130 }
1.131
1.132 -LinkStyle LinkableMapObj::getLinkStyle()
1.133 +LinkableMapObj::Style LinkableMapObj::getLinkStyle()
1.134 {
1.135 return style;
1.136 }
1.137 @@ -290,12 +290,12 @@
1.138 return hideLinkUnselected;
1.139 }
1.140
1.141 -void LinkableMapObj::setLinkPos(LinkPos lp)
1.142 +void LinkableMapObj::setLinkPos(Position lp)
1.143 {
1.144 linkpos=lp;
1.145 }
1.146
1.147 -LinkPos LinkableMapObj::getLinkPos()
1.148 +LinkableMapObj::Position LinkableMapObj::getLinkPos()
1.149 {
1.150 return linkpos;
1.151 }
1.152 @@ -316,17 +316,17 @@
1.153 bottomline->setPen( pen );
1.154 switch (style)
1.155 {
1.156 - case StyleLine:
1.157 + case Line:
1.158 l->setPen( pen);
1.159 break;
1.160 - case StyleParabel:
1.161 + case Parabel:
1.162 for (int i=0; i<segment.size(); ++i)
1.163 segment.at(i)->setPen( pen);
1.164 break;
1.165 - case StylePolyLine:
1.166 + case PolyLine:
1.167 p->setBrush( QBrush(col));
1.168 break;
1.169 - case StylePolyParabel:
1.170 + case PolyParabel:
1.171 p->setBrush( QBrush(col));
1.172 break;
1.173 default:
1.174 @@ -353,17 +353,17 @@
1.175 bottomline->show();
1.176 switch (style)
1.177 {
1.178 - case StyleLine:
1.179 + case Line:
1.180 if (l) l->show();
1.181 break;
1.182 - case StyleParabel:
1.183 + case Parabel:
1.184 for (int i=0; i<segment.size(); ++i)
1.185 segment.at(i)->show();
1.186 break;
1.187 - case StylePolyLine:
1.188 + case PolyLine:
1.189 if (p) p->show();
1.190 break;
1.191 - case StylePolyParabel:
1.192 + case PolyParabel:
1.193 if (p) p->show();
1.194 break;
1.195 default:
1.196 @@ -374,17 +374,17 @@
1.197 bottomline->hide();
1.198 switch (style)
1.199 {
1.200 - case StyleLine:
1.201 + case Line:
1.202 if (l) l->hide();
1.203 break;
1.204 - case StyleParabel:
1.205 + case Parabel:
1.206 for (int i=0; i<segment.size(); ++i)
1.207 segment.at(i)->hide();
1.208 break;
1.209 - case StylePolyLine:
1.210 + case PolyLine:
1.211 if (p) p->hide();
1.212 break;
1.213 - case StylePolyParabel:
1.214 + case PolyParabel:
1.215 if (p) p->hide();
1.216 break;
1.217 default:
1.218 @@ -395,25 +395,25 @@
1.219
1.220 void LinkableMapObj::setOrientation()
1.221 {
1.222 - LinkOrient orientOld=orientation;
1.223 + Orientation orientOld=orientation;
1.224
1.225 if (!parObj)
1.226 {
1.227 - orientation=OrientUndef;
1.228 + orientation=UndefinedOrientation;
1.229 return;
1.230 }
1.231
1.232 // Set orientation, first look for orientation of parent
1.233 - if (parObj->getOrientation() != OrientUndef )
1.234 + if (parObj->getOrientation() != UndefinedOrientation )
1.235 // use the orientation of the parent:
1.236 orientation=parObj->getOrientation();
1.237 else
1.238 {
1.239 // calc orientation depending on position rel to parent
1.240 if (absPos.x() < QPointF(parObj->getChildPos() ).x() )
1.241 - orientation=OrientLeftOfCenter;
1.242 + orientation=LeftOfCenter;
1.243 else
1.244 - orientation=OrientRightOfCenter;
1.245 + orientation=RightOfCenter;
1.246 }
1.247 if (orientOld!=orientation) requestReposition();
1.248 }
1.249 @@ -434,14 +434,14 @@
1.250
1.251 // updateLink is called from move, but called from constructor we don't
1.252 // have parents yet...
1.253 - if (style==StyleUndef) return;
1.254 + if (style==UndefinedStyle) return;
1.255
1.256 switch (linkpos)
1.257 {
1.258 - case LinkMiddle:
1.259 + case Middle:
1.260 bottomlineY=bbox.top() + bbox.height()/2; // draw link to middle (of frame)
1.261 break;
1.262 - case LinkBottom:
1.263 + case Bottom:
1.264 bottomlineY=bbox.bottom()-1; // draw link to bottom of box
1.265 break;
1.266 }
1.267 @@ -484,14 +484,14 @@
1.268 // Draw the link
1.269 switch (style)
1.270 {
1.271 - case StyleLine:
1.272 + case Line:
1.273 //l->prepareGeometryChange();
1.274 l->setLine( QLine(qRound (parPos.x()),
1.275 qRound(parPos.y()),
1.276 qRound(p2x),
1.277 qRound(p2y) ));
1.278 break;
1.279 - case StyleParabel:
1.280 + case Parabel:
1.281 parabel (pa0, p1x,p1y,p2x,p2y);
1.282 for (int i=0; i<segment.size(); ++i)
1.283 {
1.284 @@ -499,7 +499,7 @@
1.285 segment.at(i)->setLine(QLineF( pa0.at(i).x(), pa0.at(i).y(),pa0.at(i+1).x(),pa0.at(i+1).y()));
1.286 }
1.287 break;
1.288 - case StylePolyLine:
1.289 + case PolyLine:
1.290 pa0.clear();
1.291 pa0<<QPointF (qRound(p2x+tp.x()), qRound(p2y+tp.y()));
1.292 pa0<<QPointF (qRound(p2x-tp.x()), qRound(p2y-tp.y()));
1.293 @@ -507,7 +507,7 @@
1.294 //p->prepareGeometryChange();
1.295 p->setPolygon(QPolygonF (pa0));
1.296 break;
1.297 - case StylePolyParabel:
1.298 + case PolyParabel:
1.299 parabel (pa1, p1x,p1y,p2x+tp.x(),p2y+tp.y());
1.300 parabel (pa2, p1x,p1y,p2x-tp.x(),p2y-tp.y());
1.301 pa0.clear();
1.302 @@ -585,7 +585,7 @@
1.303 }
1.304 }
1.305
1.306 -LinkOrient LinkableMapObj::getOrientation()
1.307 +LinkableMapObj::Orientation LinkableMapObj::getOrientation()
1.308 {
1.309 return orientation;
1.310 }
1.311 @@ -656,6 +656,8 @@
1.312
1.313 void LinkableMapObj::select()
1.314 {
1.315 + // select and unselect are still needed to
1.316 + // handle hiding of links
1.317 selected=true;
1.318 setVisibility (visible);
1.319 }
1.320 @@ -705,3 +707,4 @@
1.321 return attribut ("hideLink","false");
1.322
1.323 }
1.324 +