floatobj.cpp
author insilmaril
Tue, 07 Mar 2006 11:32:02 +0000
changeset 230 93a67eb55d2f
parent 223 e03b393e4e51
child 236 22a885118d50
permissions -rw-r--r--
Added xsl for Taskjuggler Export by Matt
     1 #include "floatobj.h"
     2 
     3 extern QAction* actionEditToggleFloatExport;
     4 
     5 /////////////////////////////////////////////////////////////////
     6 // FloatObj
     7 /////////////////////////////////////////////////////////////////
     8 
     9 FloatObj::FloatObj ():LinkableMapObj() 
    10 {
    11 //    cout << "Const FloatObj ()\n";
    12     setParObj (this);	
    13     init();
    14     depth=-1;
    15 }
    16 
    17 FloatObj::FloatObj (QCanvas* c):LinkableMapObj(c)
    18 {
    19 //	cout << "Const FloatObj (c)  called from MapCenterObj (c)\n";
    20     setParObj (this);	
    21     init();
    22     depth=-1;
    23 }
    24 
    25 FloatObj::FloatObj (QCanvas* c, LinkableMapObj* p):LinkableMapObj (c)
    26 {
    27 //    cout << "Const FloatObj (c,p)\n";
    28     setParObj (p);	
    29     depth=p->getDepth()+1;
    30     init();
    31 }
    32 
    33 FloatObj::~FloatObj ()
    34 {
    35 //   cout << "Destr FloatObj\n";
    36 }
    37 
    38 void FloatObj::init () 
    39 {
    40     setChildObj(this);
    41 	floatExport=true;
    42 	zPlane=Z_ICON;
    43 	setLinkStyle (StyleParabel);
    44 	setHideLinkUnselected(true);
    45 }
    46 
    47 void FloatObj::copy (FloatObj* other)
    48 {
    49 	LinkableMapObj::copy (other);
    50 	setVisibility (other->visible);
    51 }
    52 
    53 void FloatObj::setZ(const int &i)
    54 {
    55 	zPlane=i;
    56 }
    57 
    58 int FloatObj::z()
    59 {
    60 	return zPlane;
    61 }
    62 
    63 void FloatObj::setFloatExport(const bool& b)
    64 {
    65 	floatExport=b;
    66 }
    67 
    68 bool FloatObj::getFloatExport()
    69 {
    70 	return floatExport;
    71 }
    72 
    73 void FloatObj::move (double x, double y)
    74 {
    75 	MapObj::move(x,y);
    76 	selbox->move(x,y);
    77 }
    78 
    79 void FloatObj::move (QPoint p)
    80 {
    81 	move (p.x(), p.y());
    82 }
    83 
    84 void FloatObj::setDockPos()
    85 {
    86 	childPos=QPoint (bbox.bottomRight().x(), bbox.bottomRight().y() ); 
    87 	parPos=absPos;
    88 }
    89 
    90 void FloatObj::reposition()
    91 {
    92 	/* FIXME not needed?
    93 	if (useOrientation)
    94 	{
    95 		if (parObj->getOrientation()==OrientLeftOfCenter)
    96 			move (parObj->getChildPos().x() - relPos.x() + parObj->width() - bbox.width(), parObj->y()+relPos.y());
    97 		else	
    98 			move (parObj->x()+relPos.x(), parObj->getChildPos().y()+relPos.y());
    99 	}		
   100 	else
   101 	*/
   102 	move (parObj->getChildPos().x()+relPos.x(), parObj->getChildPos().y()+relPos.y());
   103 	updateLink();	
   104 }
   105 
   106 QRect FloatObj::getTotalBBox()
   107 {
   108 	return bbox;
   109 }
   110 
   111 QRect FloatObj::getBBoxSizeWithChilds()
   112 {
   113 	return bboxTotal;
   114 }
   115 
   116 void FloatObj::select()
   117 {
   118     LinkableMapObj::select();
   119 	setLinkColor(parObj->getLinkColor());
   120 
   121 	// Update FloatExport switch in context menu
   122 	if (floatExport)
   123 		actionEditToggleFloatExport->setEnabled (true);
   124 	else	
   125 		actionEditToggleFloatExport->setEnabled (true);
   126 
   127 
   128 }
   129 
   130 void FloatObj::unselect()
   131 {
   132 	LinkableMapObj::unselect();
   133 }
   134