Empty branches are always unscrolled after import, relinking to scrolled branch doesn't open branch, starting DBUS implementation
1 #include "ornamentedobj.h"
2 #include "linkablemapobj.h"
5 /////////////////////////////////////////////////////////////////
7 /////////////////////////////////////////////////////////////////
9 OrnamentedObj::OrnamentedObj():LinkableMapObj()
11 // cout << "Const OrnamentedObj ()\n";
15 OrnamentedObj::OrnamentedObj(QGraphicsScene* s) :LinkableMapObj(s)
17 // cout << "Const OrnamentedObj (s)\n";
21 OrnamentedObj::OrnamentedObj (OrnamentedObj* lmo) : LinkableMapObj (lmo->scene)
26 OrnamentedObj::~OrnamentedObj()
35 void OrnamentedObj::init ()
37 heading = new HeadingObj(scene);
38 heading->move (absPos.x(), absPos.y());
40 systemFlags=new FlagRowObj(scene);
41 standardFlags=new FlagRowObj(scene);
43 frame = new FrameObj (scene);
46 void OrnamentedObj::copy (OrnamentedObj* other)
48 LinkableMapObj::copy(other);
49 heading->copy(other->heading);
50 setColor (other->heading->getColor());
52 systemFlags->copy (other->systemFlags);
53 standardFlags->copy (other->standardFlags);
55 ornamentsBBox=other->ornamentsBBox;
58 void OrnamentedObj::setLinkColor()
60 VymModel *model=treeItem->getModel();
62 if (model->getMapLinkColorHint()==HeadingColor)
63 LinkableMapObj::setLinkColor (heading->getColor());
65 LinkableMapObj::setLinkColor (model->getMapDefLinkColor());
68 void OrnamentedObj::setColor (QColor col)
70 heading->setColor(col);
74 QColor OrnamentedObj::getColor ()
76 return heading->getColor();
79 FrameObj* OrnamentedObj::getFrame()
84 FrameObj::FrameType OrnamentedObj::getFrameType()
86 return frame->getFrameType();
89 QString OrnamentedObj::getFrameTypeName()
91 return frame->getFrameTypeName();
94 void OrnamentedObj::setFrameType(const FrameObj::FrameType &t)
96 frame->setFrameType(t);
97 if (t == FrameObj::NoFrame)
98 linkpos=LinkableMapObj::Bottom;
100 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 void OrnamentedObj::positionContents()
168 double d=frame->getPadding()/2;
172 double ox,oy; // Offset due to padding
177 systemFlags-> move (ox +x , oy + y );
179 // vertical align heading to bottom
180 heading->move (ox + x + systemFlags->getBBox().width(),
181 oy + y + ornamentsBBox.height() - heading->getHeight()
183 standardFlags->move (ox +x + heading->getWidth() + systemFlags->getBBox().width() , oy + y );
185 ornamentsBBox.moveTopLeft ( QPointF ((int)(ox+x),(int)(oy+y)));
186 clickBox.moveTopLeft (QPointF ((int)(ox + x), (int)(oy + y)));
189 void OrnamentedObj::move (double x, double y)
193 updateLinkGeometry();
197 void OrnamentedObj::move (QPointF p)
202 void OrnamentedObj::moveBy (double x, double y)
205 MapObj::moveBy (x,y);
207 systemFlags->moveBy (x,y);
208 standardFlags->moveBy (x,y);
209 heading->moveBy (x,y);
210 updateLinkGeometry();
214 void OrnamentedObj::moveBy (QPointF p)
216 moveBy (p.x(), p.y());
219 void OrnamentedObj::move2RelPos(double x, double y)
221 setRelPos (QPointF(x,y));
224 QPointF p=parObj->getChildPos();
225 move (p.x()+x, p.y() +y);
229 void OrnamentedObj::move2RelPos(QPointF p)
231 move2RelPos (p.x(),p.y());
234 void OrnamentedObj::activateStandardFlag(Flag *flag)
236 standardFlags->activate(flag);
239 move (absPos.x(), absPos.y() );
243 void OrnamentedObj::deactivateStandardFlag(const QString &name)
245 standardFlags->deactivate(name);
248 move (absPos.x(), absPos.y() );
253 QString OrnamentedObj::getSystemFlagName(const QPointF &p) //FIXME-3
255 return systemFlags->getFlagName(p);