floatobj.cpp
branchqt4-port
changeset 14 f4c37956d28d
parent 0 7a96bd401351
     1.1 --- a/floatobj.cpp	Sun Jan 30 12:58:47 2005 +0000
     1.2 +++ b/floatobj.cpp	Tue Aug 15 11:43:21 2006 +0000
     1.3 @@ -6,7 +6,7 @@
     1.4  // FloatObj
     1.5  /////////////////////////////////////////////////////////////////
     1.6  
     1.7 -FloatObj::FloatObj ():LinkableMapObj() 
     1.8 +FloatObj::FloatObj ():OrnamentedObj() 
     1.9  {
    1.10  //    cout << "Const FloatObj ()\n";
    1.11      setParObj (this);	
    1.12 @@ -14,7 +14,7 @@
    1.13      depth=-1;
    1.14  }
    1.15  
    1.16 -FloatObj::FloatObj (QCanvas* c):LinkableMapObj(c)
    1.17 +FloatObj::FloatObj (Q3Canvas* c):OrnamentedObj(c)
    1.18  {
    1.19  //	cout << "Const FloatObj (c)  called from MapCenterObj (c)\n";
    1.20      setParObj (this);	
    1.21 @@ -22,7 +22,7 @@
    1.22      depth=-1;
    1.23  }
    1.24  
    1.25 -FloatObj::FloatObj (QCanvas* c, LinkableMapObj* p):LinkableMapObj (c)
    1.26 +FloatObj::FloatObj (Q3Canvas* c, LinkableMapObj* p):OrnamentedObj (c)
    1.27  {
    1.28  //    cout << "Const FloatObj (c,p)\n";
    1.29      setParObj (p);	
    1.30 @@ -38,39 +38,18 @@
    1.31  void FloatObj::init () 
    1.32  {
    1.33      setChildObj(this);
    1.34 -	relPos=getRandPos();
    1.35 -	useOrientation=true;
    1.36  	floatExport=true;
    1.37  	zPlane=Z_ICON;
    1.38 +	setLinkStyle (StyleParabel);
    1.39 +	setHideLinkUnselected(true);
    1.40  }
    1.41  
    1.42  void FloatObj::copy (FloatObj* other)
    1.43  {
    1.44  	LinkableMapObj::copy (other);
    1.45 -	relPos=other->relPos;
    1.46 -	useOrientation=other->useOrientation;
    1.47  	setVisibility (other->visible);
    1.48  }
    1.49  
    1.50 -void FloatObj::setRelPos()
    1.51 -{
    1.52 -	if (useOrientation)
    1.53 -	{
    1.54 -		if (parObj->getOrientation()==OrientLeftOfCenter)
    1.55 -			relPos.setX ( parObj->x() +parObj->width() - bbox.width() -absPos.x());
    1.56 -		else	
    1.57 -			relPos.setX (absPos.x() - parObj->x() );
    1.58 -	}
    1.59 -	else
    1.60 -		relPos.setX (absPos.x() - parObj->x() );
    1.61 -	relPos.setY (absPos.y() - parObj->y() );
    1.62 -}
    1.63 -
    1.64 -void FloatObj::setRelPos(const QPoint &p)
    1.65 -{
    1.66 -	relPos=p;
    1.67 -}
    1.68 -
    1.69  void FloatObj::setZ(const int &i)
    1.70  {
    1.71  	zPlane=i;
    1.72 @@ -81,16 +60,6 @@
    1.73  	return zPlane;
    1.74  }
    1.75  
    1.76 -
    1.77 -void FloatObj::setUseOrientation (const bool &b)
    1.78 -{	
    1.79 -	if (useOrientation!=b)
    1.80 -	{
    1.81 -		useOrientation=b;
    1.82 -		requestReposition();
    1.83 -	}	
    1.84 -}
    1.85 -
    1.86  void FloatObj::setFloatExport(const bool& b)
    1.87  {
    1.88  	floatExport=b;
    1.89 @@ -112,17 +81,15 @@
    1.90  	move (p.x(), p.y());
    1.91  }
    1.92  
    1.93 +void FloatObj::setDockPos()
    1.94 +{
    1.95 +	parPos=absPos;
    1.96 +	childPos=absPos;
    1.97 +}
    1.98 +
    1.99  void FloatObj::reposition()
   1.100  {
   1.101 -	if (useOrientation)
   1.102 -	{
   1.103 -		if (parObj->getOrientation()==OrientLeftOfCenter)
   1.104 -			move (parObj->x() - relPos.x() + parObj->width() - bbox.width(), parObj->y()+relPos.y());
   1.105 -		else	
   1.106 -			move (parObj->x()+relPos.x(), parObj->y()+relPos.y());
   1.107 -	}		
   1.108 -	else
   1.109 -		move (parObj->x()+relPos.x(), parObj->y()+relPos.y());
   1.110 +	move (parObj->getChildPos().x()+relPos.x(), parObj->getChildPos().y()+relPos.y());
   1.111  	updateLink();	
   1.112  }
   1.113  
   1.114 @@ -139,25 +106,11 @@
   1.115  void FloatObj::select()
   1.116  {
   1.117      LinkableMapObj::select();
   1.118 -	// Temporary draw the link while FO is selected
   1.119 -	if (style==StyleUndef) 
   1.120 -	{
   1.121 -		setLinkStyle(getDefLinkStyle());
   1.122 -		setLinkColor(parObj->getLinkColor());
   1.123 -	}	
   1.124 -
   1.125 -	// Update FloatExport switch in context menu
   1.126 -	if (floatExport)
   1.127 -		actionEditToggleFloatExport->setEnabled (true);
   1.128 -	else	
   1.129 -		actionEditToggleFloatExport->setEnabled (true);
   1.130 -
   1.131 -
   1.132 +	LinkableMapObj::setLinkColor(parObj->getLinkColor());
   1.133  }
   1.134  
   1.135  void FloatObj::unselect()
   1.136  {
   1.137  	LinkableMapObj::unselect();
   1.138 -	setLinkStyle (StyleUndef);
   1.139  }
   1.140