linkablemapobj.cpp
changeset 175 728f51b71e71
parent 166 325958acb69b
child 218 160459d924a1
     1.1 --- a/linkablemapobj.cpp	Tue Jan 03 09:44:41 2006 +0000
     1.2 +++ b/linkablemapobj.cpp	Tue Jan 03 09:44:41 2006 +0000
     1.3 @@ -94,6 +94,8 @@
     1.4  
     1.5  	hideLinkUnselected=false;
     1.6  
     1.7 +	topPad=botPad=leftPad=rightPad=0;
     1.8 +
     1.9  	// initialize frame
    1.10  	frame = new FrameObj (canvas);
    1.11  	
    1.12 @@ -133,6 +135,21 @@
    1.13  	return false;
    1.14  }
    1.15  
    1.16 +int LinkableMapObj::getTopPad()
    1.17 +{
    1.18 +	return topPad;
    1.19 +}
    1.20 +
    1.21 +int LinkableMapObj::getLeftPad()
    1.22 +{
    1.23 +	return leftPad;
    1.24 +}
    1.25 +
    1.26 +int LinkableMapObj::getRightPad()
    1.27 +{
    1.28 +	return rightPad;
    1.29 +}
    1.30 +
    1.31  LinkStyle LinkableMapObj::getDefLinkStyle ()
    1.32  {
    1.33  	if (!mapEditor) return StyleUndef;
    1.34 @@ -417,7 +434,7 @@
    1.35      //	orientation
    1.36      //	childPos
    1.37      //	parPos
    1.38 -	//  offset
    1.39 +	//  bottomlineY
    1.40      //	drawing of the link itself
    1.41  
    1.42  
    1.43 @@ -432,10 +449,10 @@
    1.44  	switch (linkpos)
    1.45  	{
    1.46  		case LinkMiddle:
    1.47 -			offset=bbox.height() /2;
    1.48 +			bottomlineY=clickBox.top()+clickBox.height() /2;	// draw link to middle (of frame)
    1.49  			break;
    1.50  		default :
    1.51 -			offset=bbox.height()-1;			// draw link to bottom of bbox
    1.52 +			bottomlineY=clickBox.bottom()-1;	// draw link to bottom of bbox
    1.53  			break;
    1.54  	}
    1.55  	
    1.56 @@ -478,12 +495,12 @@
    1.57  	
    1.58      if (orientation==OrientLeftOfCenter )
    1.59      {
    1.60 -		childPos=QPoint (absPos.x(),absPos.y()+offset);
    1.61 -		parPos=QPoint (absPos.x()+ bbox.width(), absPos.y() + offset );
    1.62 +		childPos=QPoint (absPos.x(),bottomlineY);
    1.63 +		parPos=QPoint (absPos.x()+ bbox.width(),  bottomlineY );
    1.64      } else
    1.65      {
    1.66 -		childPos=QPoint (absPos.x()+ bbox.width(), absPos.y() + offset ); 
    1.67 -		parPos=QPoint (absPos.x(),absPos.y()+offset);
    1.68 +		childPos=QPoint (absPos.x()+ bbox.width(), bottomlineY ); 
    1.69 +		parPos=QPoint (absPos.x(),bottomlineY);
    1.70      }
    1.71  
    1.72  	double p1x=parPos.x();	// Link is drawn from P1 to P2
    1.73 @@ -715,9 +732,9 @@
    1.74  
    1.75  void LinkableMapObj::setSelBox()
    1.76  {
    1.77 -    selbox->setX (bbox.x() );
    1.78 -    selbox->setY (bbox.y() );
    1.79 -    selbox->setSize (bbox.width(), bbox.height() );
    1.80 +    selbox->setX (clickBox.x() );
    1.81 +    selbox->setY (clickBox.y() );
    1.82 +    selbox->setSize (clickBox.width(), clickBox.height() );
    1.83  }
    1.84  
    1.85  void LinkableMapObj::select()
    1.86 @@ -767,13 +784,9 @@
    1.87  
    1.88  QString LinkableMapObj::getLinkAttr ()
    1.89  {
    1.90 -	QString hideAttr;
    1.91  	if (hideLinkUnselected)
    1.92 -		// Since this is currently the
    1.93 -		// only attribut and it is switched off by default
    1.94 -		// don't write <link>  at all if it is missing
    1.95 -		return attribut ("hideLinkUnselected","true");
    1.96 +		return attribut ("hideLink","true");
    1.97  	else
    1.98 -		return "";
    1.99 +		return attribut ("hideLink","false");
   1.100  	
   1.101  }