Commit fc64c93d authored by KLOCZKO Thibaud's avatar KLOCZKO Thibaud
Browse files

Still enhancing navigation through composite.

parent 0417fca8
......@@ -4,9 +4,9 @@
* Copyright (C) 2008-2011 - Julien Wintz, Inria.
* Created: Fri Feb 3 14:01:41 2012 (+0100)
* Version: $Id$
* Last-Updated: Wed Mar 28 12:29:13 2012 (+0200)
* Last-Updated: Wed Mar 28 15:50:09 2012 (+0200)
* By: tkloczko
* Update #: 635
* Update #: 659
*/
/* Commentary:
......@@ -272,8 +272,6 @@ void dtkComposerSceneNodeComposite::setRoot(bool root)
void dtkComposerSceneNodeComposite::layout(void)
{
QRectF updateRect;
if (this->embedded() && !d->entered)
goto port_location;
......@@ -326,30 +324,17 @@ port_location:
this->outputPorts().at(i)->setPos(QPointF(d->rect.right() - port_margin_left - this->outputPorts().at(i)->boundingRect().width(), i*this->outputPorts().at(i)->boundingRect().height() + i*port_spacing + port_margin_top + header));
// /////////////////////////////////////////////////////////////////
// Update edges geometry
// Redraw parent
// /////////////////////////////////////////////////////////////////
foreach(dtkComposerSceneEdge *edge, this->inputEdges()) {
edge->adjust();
updateRect |= edge->boundingRect();
}
foreach(dtkComposerSceneEdge *edge, d->edges) {
edge->adjust();
updateRect |= edge->boundingRect();
}
foreach(dtkComposerSceneEdge *edge, this->outputEdges()) {
edge->adjust();
updateRect |= edge->boundingRect();
if (dtkComposerSceneNodeComposite *parent = dynamic_cast<dtkComposerSceneNodeComposite *>(this->parent())) {
if(!parent->root()) {
if (parent->entered() || (parent->flattened() && !parent->embedded())) {
parent->layout();
}
}
}
this->update(updateRect);
// /////////////////////////////////////////////////////////////////
//
// /////////////////////////////////////////////////////////////////
if(this->embedded())
goto update;
......@@ -368,7 +353,28 @@ port_location:
}
update:
this->update();
// /////////////////////////////////////////////////////////////////
// Update edges geometry
// /////////////////////////////////////////////////////////////////
QRectF updateRect;
foreach(dtkComposerSceneEdge *edge, this->inputEdges()) {
edge->adjust();
updateRect |= edge->boundingRect();
}
foreach(dtkComposerSceneEdge *edge, d->edges) {
edge->adjust();
updateRect |= edge->boundingRect();
}
foreach(dtkComposerSceneEdge *edge, this->outputEdges()) {
edge->adjust();
updateRect |= edge->boundingRect();
}
this->update(updateRect);
}
void dtkComposerSceneNodeComposite::resize(qreal width, qreal height)
......
......@@ -4,9 +4,9 @@
* Copyright (C) 2008-2011 - Julien Wintz, Inria.
* Created: Wed Feb 8 15:53:59 2012 (+0100)
* Version: $Id$
* Last-Updated: Wed Mar 28 12:33:23 2012 (+0200)
* Last-Updated: Wed Mar 28 15:48:53 2012 (+0200)
* By: tkloczko
* Update #: 503
* Update #: 506
*/
/* Commentary:
......@@ -201,6 +201,25 @@ void dtkComposerSceneNodeControl::layout(void)
d->footer->resize(d->rect.size().width(), h);
}
// /////////////////////////////////////////////////////////////////
// Redraw parent
// /////////////////////////////////////////////////////////////////
dtkComposerSceneNode *node = this;
if (dtkComposerSceneNodeComposite *parent = dynamic_cast<dtkComposerSceneNodeComposite *>(node->parent())) {
if(!parent->root()){
if (parent->entered() || (parent->flattened() && !parent->embedded()))
parent->layout();
}
}
// /////////////////////////////////////////////////////////////////
//
// /////////////////////////////////////////////////////////////////
this->update();
}
......
......@@ -4,9 +4,9 @@
* Copyright (C) 2008-2011 - Julien Wintz, Inria.
* Created: Fri Feb 3 14:02:14 2012 (+0100)
* Version: $Id$
* Last-Updated: Fri Mar 23 15:56:05 2012 (+0100)
* By: Julien Wintz
* Update #: 209
* Last-Updated: Wed Mar 28 15:55:19 2012 (+0200)
* By: tkloczko
* Update #: 214
*/
/* Commentary:
......@@ -77,7 +77,9 @@ void dtkComposerSceneNodeLeaf::layout(void)
int port_margin_left = 10;
int port_spacing = 10;
// Setting up port position
// /////////////////////////////////////////////////////////////////
// Setting up port position
// /////////////////////////////////////////////////////////////////
for(int i = 0; i < this->inputPorts().count(); i++)
this->inputPorts().at(i)->setPos(QPointF(port_margin_left, i*this->inputPorts().at(i)->boundingRect().height() + i*port_spacing + port_margin_top + header));
......@@ -85,7 +87,9 @@ void dtkComposerSceneNodeLeaf::layout(void)
for(int i = 0; i < this->outputPorts().count(); i++)
this->outputPorts().at(i)->setPos(QPointF(d->rect.right() - port_margin_left - this->outputPorts().at(i)->boundingRect().width(), i*this->outputPorts().at(i)->boundingRect().height() + i*port_spacing + port_margin_top + header));
// Height calculation
// /////////////////////////////////////////////////////////////////
// Height calculation
// /////////////////////////////////////////////////////////////////
if(this->inputPorts().count() || this->outputPorts().count())
if(this->inputPorts().count() >= this->outputPorts().count())
......@@ -96,24 +100,30 @@ void dtkComposerSceneNodeLeaf::layout(void)
else if(this->embedded())
d->rect = QRectF(d->rect.topLeft(), QSize(d->rect.width(), port_margin_top + port_margin_bottom + 10));
// --
// /////////////////////////////////////////////////////////////////
// Redraw parent
// /////////////////////////////////////////////////////////////////
dtkComposerSceneNode *node = this;
if (dtkComposerSceneNodeComposite *parent = dynamic_cast<dtkComposerSceneNodeComposite *>(node->parent())) {
if(!parent->root())
node->parent()->layout();
if (dtkComposerSceneNodeComposite *parent = dynamic_cast<dtkComposerSceneNodeComposite *>(this->parent())) {
if(!parent->root()) {
if (parent->entered() || (parent->flattened() && !parent->embedded())) {
parent->layout();
}
}
}
// /////////////////////////////////////////////////////////////////
// Update edges geometry
// /////////////////////////////////////////////////////////////////
QRectF updateRect;
foreach(dtkComposerSceneEdge *edge, node->inputEdges()) {
foreach(dtkComposerSceneEdge *edge, this->inputEdges()) {
edge->adjust();
updateRect |= edge->boundingRect();
}
foreach(dtkComposerSceneEdge *edge, node->outputEdges()) {
foreach(dtkComposerSceneEdge *edge, this->outputEdges()) {
edge->adjust();
updateRect |= edge->boundingRect();
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment