diff -r 83a3be747ad9 -r 8b9cfc26638c linkablemapobj.cpp --- a/linkablemapobj.cpp Wed Apr 25 16:02:54 2007 +0000 +++ b/linkablemapobj.cpp Wed Apr 25 16:02:54 2007 +0000 @@ -35,16 +35,16 @@ { switch (style) { - case StyleLine: + case Line: delete (l); break; - case StyleParabel: + case Parabel: while (!segment.isEmpty()) delete segment.takeFirst(); break; - case StylePolyLine: + case PolyLine: delete (p); break; - case StylePolyParabel: + case PolyParabel: delete (p); break; default: @@ -63,11 +63,11 @@ childPos=QPointF(0,0); link2ParPos=false; l=NULL; - orientation=OrientUndef; + orientation=UndefinedOrientation; linkwidth=20; thickness_start=8; - style=StyleUndef; - linkpos=LinkBottom; + style=UndefinedStyle; + linkpos=Bottom; arcsegs=13; // TODO instead of linkcolor pen.color() could be used all around @@ -181,37 +181,37 @@ return rightPad; } -LinkStyle LinkableMapObj::getDefLinkStyle () +LinkableMapObj::Style LinkableMapObj::getDefLinkStyle () { - if (mapEditor==0) return StyleUndef; - LinkStyle ls=mapEditor->getMapLinkStyle(); + if (mapEditor==0) return UndefinedStyle; + Style ls=mapEditor->getMapLinkStyle(); switch (ls) { - case StyleLine: + case Line: return ls; break; - case StyleParabel: + case Parabel: return ls; break; - case StylePolyLine: + case PolyLine: if (depth>1) - return StyleLine; + return Line; else return ls; break; - case StylePolyParabel: + case PolyParabel: if (depth>1) - return StyleParabel; + return Parabel; else return ls; break; default: break; } - return StyleUndef; + return UndefinedStyle; } -void LinkableMapObj::setLinkStyle(LinkStyle newstyle) +void LinkableMapObj::setLinkStyle(Style newstyle) { //if (newstyle=style) return; delLink(); @@ -223,10 +223,10 @@ QGraphicsLineItem *cl; switch (style) { - case StyleUndef: + case UndefinedStyle: bottomline->hide(); break; - case StyleLine: + case Line: l = scene->addLine(QLineF(1,1,1,1),pen); l->setZValue(Z_LINK); if (visible) @@ -234,7 +234,7 @@ else l->hide(); break; - case StyleParabel: + case Parabel: for (int i=0;iaddLine(QLineF(i*5,0,i*10,100),pen); @@ -247,7 +247,7 @@ } pa0.resize (arcsegs+1); break; - case StylePolyLine: + case PolyLine: p =scene->addPolygon(QPolygonF(),pen,linkcolor); p->setZValue(Z_LINK); if (visible) @@ -256,7 +256,7 @@ p->hide(); pa0.resize (3); break; - case StylePolyParabel: + case PolyParabel: p = scene->addPolygon(QPolygonF(),pen,linkcolor); p->setZValue(Z_LINK); if (visible) @@ -273,7 +273,7 @@ } } -LinkStyle LinkableMapObj::getLinkStyle() +LinkableMapObj::Style LinkableMapObj::getLinkStyle() { return style; } @@ -290,12 +290,12 @@ return hideLinkUnselected; } -void LinkableMapObj::setLinkPos(LinkPos lp) +void LinkableMapObj::setLinkPos(Position lp) { linkpos=lp; } -LinkPos LinkableMapObj::getLinkPos() +LinkableMapObj::Position LinkableMapObj::getLinkPos() { return linkpos; } @@ -316,17 +316,17 @@ bottomline->setPen( pen ); switch (style) { - case StyleLine: + case Line: l->setPen( pen); break; - case StyleParabel: + case Parabel: for (int i=0; isetPen( pen); break; - case StylePolyLine: + case PolyLine: p->setBrush( QBrush(col)); break; - case StylePolyParabel: + case PolyParabel: p->setBrush( QBrush(col)); break; default: @@ -353,17 +353,17 @@ bottomline->show(); switch (style) { - case StyleLine: + case Line: if (l) l->show(); break; - case StyleParabel: + case Parabel: for (int i=0; ishow(); break; - case StylePolyLine: + case PolyLine: if (p) p->show(); break; - case StylePolyParabel: + case PolyParabel: if (p) p->show(); break; default: @@ -374,17 +374,17 @@ bottomline->hide(); switch (style) { - case StyleLine: + case Line: if (l) l->hide(); break; - case StyleParabel: + case Parabel: for (int i=0; ihide(); break; - case StylePolyLine: + case PolyLine: if (p) p->hide(); break; - case StylePolyParabel: + case PolyParabel: if (p) p->hide(); break; default: @@ -395,25 +395,25 @@ void LinkableMapObj::setOrientation() { - LinkOrient orientOld=orientation; + Orientation orientOld=orientation; if (!parObj) { - orientation=OrientUndef; + orientation=UndefinedOrientation; return; } // Set orientation, first look for orientation of parent - if (parObj->getOrientation() != OrientUndef ) + if (parObj->getOrientation() != UndefinedOrientation ) // use the orientation of the parent: orientation=parObj->getOrientation(); else { // calc orientation depending on position rel to parent if (absPos.x() < QPointF(parObj->getChildPos() ).x() ) - orientation=OrientLeftOfCenter; + orientation=LeftOfCenter; else - orientation=OrientRightOfCenter; + orientation=RightOfCenter; } if (orientOld!=orientation) requestReposition(); } @@ -434,14 +434,14 @@ // updateLink is called from move, but called from constructor we don't // have parents yet... - if (style==StyleUndef) return; + if (style==UndefinedStyle) return; switch (linkpos) { - case LinkMiddle: + case Middle: bottomlineY=bbox.top() + bbox.height()/2; // draw link to middle (of frame) break; - case LinkBottom: + case Bottom: bottomlineY=bbox.bottom()-1; // draw link to bottom of box break; } @@ -484,14 +484,14 @@ // Draw the link switch (style) { - case StyleLine: + case Line: //l->prepareGeometryChange(); l->setLine( QLine(qRound (parPos.x()), qRound(parPos.y()), qRound(p2x), qRound(p2y) )); break; - case StyleParabel: + case Parabel: parabel (pa0, p1x,p1y,p2x,p2y); for (int i=0; isetLine(QLineF( pa0.at(i).x(), pa0.at(i).y(),pa0.at(i+1).x(),pa0.at(i+1).y())); } break; - case StylePolyLine: + case PolyLine: pa0.clear(); pa0<prepareGeometryChange(); p->setPolygon(QPolygonF (pa0)); break; - case StylePolyParabel: + case PolyParabel: parabel (pa1, p1x,p1y,p2x+tp.x(),p2y+tp.y()); parabel (pa2, p1x,p1y,p2x-tp.x(),p2y-tp.y()); pa0.clear(); @@ -585,7 +585,7 @@ } } -LinkOrient LinkableMapObj::getOrientation() +LinkableMapObj::Orientation LinkableMapObj::getOrientation() { return orientation; } @@ -656,6 +656,8 @@ void LinkableMapObj::select() { + // select and unselect are still needed to + // handle hiding of links selected=true; setVisibility (visible); } @@ -705,3 +707,4 @@ return attribut ("hideLink","false"); } +