1 #include "ornamentedobj.h"
2 #include "linkablemapobj.h"
5 /////////////////////////////////////////////////////////////////
7 /////////////////////////////////////////////////////////////////
10 OrnamentedObj::OrnamentedObj(QGraphicsScene* s,TreeItem *ti) :LinkableMapObj(s,ti)
12 // cout << "Const OrnamentedObj (s)\n";
16 OrnamentedObj::OrnamentedObj (OrnamentedObj* lmo) : LinkableMapObj (lmo->scene)
21 OrnamentedObj::~OrnamentedObj()
30 void OrnamentedObj::init ()
32 heading = new HeadingObj(scene);
33 heading->move (absPos.x(), absPos.y());
35 systemFlags=new FlagRowObj(scene);
36 standardFlags=new FlagRowObj(scene);
38 frame = new FrameObj (scene);
41 void OrnamentedObj::copy (OrnamentedObj* other)
43 LinkableMapObj::copy(other);
44 heading->copy(other->heading);
45 setColor (other->heading->getColor());
47 systemFlags->copy (other->systemFlags);
48 standardFlags->copy (other->standardFlags);
50 ornamentsBBox=other->ornamentsBBox;
53 void OrnamentedObj::setLinkColor()
55 VymModel *model=treeItem->getModel();
57 if (model->getMapLinkColorHint()==HeadingColor)
58 LinkableMapObj::setLinkColor (heading->getColor());
60 LinkableMapObj::setLinkColor (model->getMapDefLinkColor());
63 void OrnamentedObj::setColor (QColor col)
65 heading->setColor(col);
69 QColor OrnamentedObj::getColor ()
71 return heading->getColor();
74 FrameObj* OrnamentedObj::getFrame()
79 FrameObj::FrameType OrnamentedObj::getFrameType()
81 return frame->getFrameType();
84 QString OrnamentedObj::getFrameTypeName()
86 return frame->getFrameTypeName();
89 void OrnamentedObj::setFrameType(const FrameObj::FrameType &t)
91 frame->setFrameType(t);
92 if (t == FrameObj::NoFrame)
94 linkpos=LinkableMapObj::Bottom;
98 linkpos=LinkableMapObj::Middle;
107 void OrnamentedObj::setFrameType(const QString &t)
109 frame->setFrameType(t);
110 if (frame->getFrameType() == FrameObj::NoFrame)
111 linkpos=LinkableMapObj::Bottom;
113 linkpos=LinkableMapObj::Middle;
120 void OrnamentedObj::setFramePadding (const int &i)
122 frame->setPadding (i);
128 int OrnamentedObj::getFramePadding ()
130 return frame->getPadding();
133 void OrnamentedObj::setFrameBorderWidth (const int &i)
135 frame->setBorderWidth(i);
141 int OrnamentedObj::getFrameBorderWidth()
143 return frame->getBorderWidth();
146 void OrnamentedObj::setFramePenColor(QColor col)
148 frame->setPenColor (col);
151 QColor OrnamentedObj::getFramePenColor()
153 return frame->getPenColor ();
156 void OrnamentedObj::setFrameBrushColor(QColor col)
158 frame->setBrushColor (col);
161 QColor OrnamentedObj::getFrameBrushColor()
163 return frame->getBrushColor ();
166 //#include <iostream>
167 //using namespace std;
168 void OrnamentedObj::positionContents() //FIXME-4 called multiple times for each object after moving an image with mouse
170 //cout << "OO::positionContents topPad="<<topPad<<" botPad="<<botPad<<" "<<treeItem->getHeadingStd()<<endl;
171 double d=frame->getPadding()/2;
175 double ox,oy; // Offset due to padding
180 systemFlags-> move (ox +x , oy + y );
182 // vertical align heading to bottom
183 heading->move (ox + x + systemFlags->getBBox().width(),
184 oy + y + ornamentsBBox.height() - heading->getHeight()
186 standardFlags->move (ox +x + heading->getWidth() + systemFlags->getBBox().width() , oy + y );
188 ornamentsBBox.moveTopLeft ( QPointF (ox+x,oy+y));
189 clickBox.moveTopLeft (QPointF (ox + x, oy + y));
192 void OrnamentedObj::move (double x, double y)
196 updateLinkGeometry();
200 void OrnamentedObj::move (QPointF p)
205 void OrnamentedObj::moveBy (double x, double y)
208 MapObj::moveBy (x,y);
210 systemFlags->moveBy (x,y);
211 standardFlags->moveBy (x,y);
212 heading->moveBy (x,y);
213 updateLinkGeometry();
217 void OrnamentedObj::moveBy (QPointF p)
219 moveBy (p.x(), p.y());
222 void OrnamentedObj::move2RelPos(double x, double y)
224 setRelPos (QPointF(x,y));
227 QPointF p=parObj->getChildPos();
228 move (p.x()+x, p.y() +y);
232 void OrnamentedObj::move2RelPos(QPointF p)
234 move2RelPos (p.x(),p.y());
237 void OrnamentedObj::activateStandardFlag(Flag *flag)
239 standardFlags->activate(flag);
242 move (absPos.x(), absPos.y() );
246 void OrnamentedObj::deactivateStandardFlag(const QString &name)
248 standardFlags->deactivate(name);
251 move (absPos.x(), absPos.y() );
256 QString OrnamentedObj::getSystemFlagName(const QPointF &p) //FIXME-3
258 return systemFlags->getFlagName(p);