Commit dbea3bdd authored by WINTZ Julien's avatar WINTZ Julien

Handling of reparenting nodes within composer scene.

parent 635b4912
......@@ -4,9 +4,9 @@
* Copyright (C) 2011 - Thibaud Kloczko, Inria.
* Created: Mon Jan 30 10:34:49 2012 (+0100)
* Version: $Id$
* Last-Updated: Wed Mar 21 15:00:44 2012 (+0100)
* Last-Updated: Fri Mar 23 13:32:04 2012 (+0100)
* By: Julien Wintz
* Update #: 200
* Update #: 201
*/
/* Commentary:
......@@ -211,6 +211,11 @@ void dtkComposer::next(void)
d->graph->update();
}
void dtkComposer::stop(void)
{
}
dtkComposerEvaluator *dtkComposer::evaluator(void)
{
return d->evaluator;
......
......@@ -4,9 +4,9 @@
* Copyright (C) 2011 - Thibaud Kloczko, Inria.
* Created: Mon Jan 30 10:34:34 2012 (+0100)
* Version: $Id$
* Last-Updated: Wed Mar 21 14:45:10 2012 (+0100)
* Last-Updated: Fri Mar 23 13:31:52 2012 (+0100)
* By: Julien Wintz
* Update #: 46
* Update #: 47
*/
/* Commentary:
......@@ -54,6 +54,7 @@ public slots:
void step(void);
void cont(void);
void next(void);
void stop(void);
signals:
void modified(bool);
......
......@@ -4,9 +4,9 @@
* Copyright (C) 2012 - Nicolas Niclausse, Inria.
* Created: 2012/01/30 10:13:25
* Version: $Id$
* Last-Updated: jeu. mars 22 17:08:58 2012 (+0100)
* By: Nicolas Niclausse
* Update #: 2064
* Last-Updated: Fri Mar 23 14:13:02 2012 (+0100)
* By: Julien Wintz
* Update #: 2098
*/
/* Commentary:
......@@ -769,7 +769,7 @@ dtkComposerSceneNode *dtkComposerScene::nodeAt(const QPointF& point, dtkComposer
}
}
return NULL;
return d->current_node;
}
dtkComposerScenePort *dtkComposerScene::portAt(const QPointF& point) const
......@@ -787,50 +787,34 @@ dtkComposerSceneNodeComposite *dtkComposerScene::parentAt(const QPointF& point)
{
dtkComposerSceneNode *node = this->nodeAt(point);
if(!node) {
// qDebug() << __func__ << "current node";
if(!node)
return d->current_node;
}
if(dtkComposerSceneNodeLeaf *leaf = dynamic_cast<dtkComposerSceneNodeLeaf *>(node)) {
// qDebug() << __func__ << "leaf node's parent";
if(dtkComposerSceneNodeLeaf *leaf = dynamic_cast<dtkComposerSceneNodeLeaf *>(node))
return dynamic_cast<dtkComposerSceneNodeComposite *>(leaf->parent());
}
if(dtkComposerSceneNodeComposite *composite = dynamic_cast<dtkComposerSceneNodeComposite *>(node)) {
if(composite->flattened()) {
// qDebug() << __func__ << "flattened composite node";
if(composite->flattened())
return composite;
}
if(composite->entered()) {
// qDebug() << __func__ << "entered composite node";
if(composite->entered())
return composite;
}
if(!composite->flattened() && !composite->entered()) {
// qDebug() << __func__ << "unrevealed composite node's parent";
if(!composite->flattened() && !composite->entered())
return composite;
}
}
if(dtkComposerSceneNodeControl *control = dynamic_cast<dtkComposerSceneNodeControl *>(node)) {
dtkComposerSceneNodeComposite *block = control->blockAt(control->mapFromScene(point));
if(!block) {
// qDebug() << __func__ << "control node's parent" << control->parent()->title();
if(!block)
return dynamic_cast<dtkComposerSceneNodeComposite *>(control->parent());
}
// qDebug() << __func__ << "control node's block" << block->title();
return block;
}
// qDebug() << __func__ << "NO PARENT FOUND - DRAMATIC";
return NULL;
}
......
......@@ -4,9 +4,9 @@
* Copyright (C) 2012 - Nicolas Niclausse, Inria.
* Created: 2012/01/30 10:11:39
* Version: $Id$
* Last-Updated: Wed Feb 22 15:15:15 2012 (+0100)
* Last-Updated: Fri Mar 23 14:12:35 2012 (+0100)
* By: Julien Wintz
* Update #: 183
* Update #: 189
*/
/* Commentary:
......@@ -119,6 +119,7 @@ protected:
dtkComposerScenePort *portAt(const QPointF& point) const;
dtkComposerSceneNodeComposite *parentAt(const QPointF& point) const;
// #pragma mark -
// #pragma mark - Internal sigs handling
......
......@@ -4,9 +4,9 @@
* Copyright (C) 2008-2011 - Julien Wintz, Inria.
* Created: Tue Jan 31 18:17:43 2012 (+0100)
* Version: $Id$
* Last-Updated: jeu. mars 22 15:29:13 2012 (+0100)
* By: Nicolas Niclausse
* Update #: 3078
* Last-Updated: Fri Mar 23 15:14:03 2012 (+0100)
* By: Julien Wintz
* Update #: 3135
*/
/* Commentary:
......@@ -1311,10 +1311,16 @@ void dtkComposerStackCommandEnterGroup::redo(void)
d->scene->removeItem(e->former);
e->node->enter();
e->node->layout();
d->scene->addItem(e->node);
d->scene->setCurrent(e->node);
e->node->layout();
e->node->parent()->layout();
if (e->former)
e->former->layout();
d->scene->update();
}
......@@ -1326,10 +1332,13 @@ void dtkComposerStackCommandEnterGroup::undo(void)
d->scene->removeItem(e->node);
e->node->leave();
e->node->layout();
d->scene->addItem(e->former);
d->scene->setCurrent(e->former);
e->node->layout();
e->former->layout();
d->scene->update();
}
......@@ -1383,10 +1392,16 @@ void dtkComposerStackCommandLeaveGroup::redo(void)
d->scene->removeItem(e->node);
e->node->leave();
e->node->layout();
d->scene->addItem(e->former);
d->scene->setCurrent(e->former);
e->node->layout();
e->node->parent()->layout();
if (e->former)
e->former->layout();
d->scene->update();
}
......@@ -1402,6 +1417,10 @@ void dtkComposerStackCommandLeaveGroup::undo(void)
d->scene->addItem(e->node);
d->scene->setCurrent(e->node);
e->node->layout();
e->former->layout();
d->scene->update();
}
......@@ -1444,6 +1463,11 @@ void dtkComposerStackCommandFlattenGroup::redo(void)
e->node->flatten();
d->scene->addItem(e->node);
foreach(dtkComposerSceneEdge *edge, e->node->edges())
edge->adjust();
d->scene->update();
}
void dtkComposerStackCommandFlattenGroup::undo(void)
......@@ -1456,6 +1480,11 @@ void dtkComposerStackCommandFlattenGroup::undo(void)
e->node->unflatten();
d->scene->addItem(e->node);
foreach(dtkComposerSceneEdge *edge, e->node->edges())
edge->adjust();
d->scene->update();
}
// /////////////////////////////////////////////////////////////////
......@@ -1497,6 +1526,11 @@ void dtkComposerStackCommandUnflattenGroup::redo(void)
e->node->unflatten();
d->scene->addItem(e->node);
foreach(dtkComposerSceneEdge *edge, e->node->edges())
edge->adjust();
d->scene->update();
}
void dtkComposerStackCommandUnflattenGroup::undo(void)
......@@ -1509,6 +1543,11 @@ void dtkComposerStackCommandUnflattenGroup::undo(void)
e->node->flatten();
d->scene->addItem(e->node);
foreach(dtkComposerSceneEdge *edge, e->node->edges())
edge->adjust();
d->scene->update();
}
// /////////////////////////////////////////////////////////////////
......@@ -2168,7 +2207,7 @@ void dtkComposerStackCommandReparentNode::redo(void)
target->addNode(e->origin);
if (target->flattened()) {
if (target->flattened() || target == d->scene->current()) {
d->scene->addItem(e->origin);
// target->layout();
}
......
......@@ -4,9 +4,9 @@
* Copyright (C) 2008 - Julien Wintz, Inria.
* Created: Tue Oct 7 09:25:06 2008 (+0200)
* Version: $Id$
* Last-Updated: Fri Mar 18 00:29:14 2011 (+0100)
* Last-Updated: Fri Mar 23 13:31:15 2012 (+0100)
* By: Julien Wintz
* Update #: 25
* Update #: 26
*/
/* Commentary:
......@@ -21,6 +21,7 @@
dtkSpacer::dtkSpacer(QWidget *parent, int width, int height) : QWidget(parent)
{
this->setAttribute(Qt::WA_TransparentForMouseEvents, true);
this->setMinimumSize(width, height);
if(width && !height)
......
......@@ -8,9 +8,9 @@
<file>pixmaps/dtkCreatorToolbarButton-small-Active.tif</file>
<file>pixmaps/dtkCreatorToolbarButton-small-Inactive.tif</file>
<file>pixmaps/dtkCreatorToolbarButton-small-Pressed.tif</file>
<file>pixmaps/dtkCreatorToolbarButton_Continue_Active.png</file>
<file>pixmaps/dtkCreatorToolbarButton_Continue_Inactive.png</file>
<file>pixmaps/dtkCreatorToolbarButton_Continue_Pressed.png</file>
<file>pixmaps/dtkCreatorToolbarButton_Step_Active.png</file>
<file>pixmaps/dtkCreatorToolbarButton_Step_Inactive.png</file>
<file>pixmaps/dtkCreatorToolbarButton_Step_Pressed.png</file>
<file>pixmaps/dtkCreatorToolbarButton_Pause_Active.png</file>
<file>pixmaps/dtkCreatorToolbarButton_Pause_Inactive.png</file>
<file>pixmaps/dtkCreatorToolbarButton_Pause_Pressed.png</file>
......@@ -20,5 +20,9 @@
<file>pixmaps/dtkCreatorToolbarButton_Stop_Active.png</file>
<file>pixmaps/dtkCreatorToolbarButton_Stop_Inactive.png</file>
<file>pixmaps/dtkCreatorToolbarButton_Stop_Pressed.png</file>
<file>pixmaps/dtkCreatorToolbarButton_Continue_Active.png</file>
<file>pixmaps/dtkCreatorToolbarControls_Background_Active.png</file>
<file>pixmaps/dtkCreatorToolbarControls_Background_Inactive.png</file>
</qresource>
</RCC>
......@@ -4,9 +4,9 @@
;; Copyright (C) 2008-2011 - Julien Wintz, Inria.
;; Created: Thu Mar 15 12:05:17 2012 (+0100)
;; Version: $Id$
;; Last-Updated: Tue Mar 20 22:23:44 2012 (+0100)
;; Last-Updated: Fri Mar 23 13:57:06 2012 (+0100)
;; By: Julien Wintz
;; Update #: 137
;; Update #: 161
*/
/*Commentary:
......@@ -17,3 +17,22 @@
;;
*/
/* dtkCreatorMainWindowControls ***************/
dtkCreatorMainWindowControls:active {
color: black;
border-image: url(:dtkCreator/pixmaps/dtkCreatorToolbarControls_Background_Active.png) 5 5 7 5;
border-top: 5px transparent;
border-right: 5px transparent;
border-bottom: 7px transparent;
border-left: 5px transparent;
}
dtkCreatorMainWindowControls:!active {
color: black;
border-image: url(:dtkCreator/pixmaps/dtkCreatorToolbarControls_Background_Inactive.png) 5 5 7 5;
border-top: 5px transparent;
border-right: 5px transparent;
border-bottom: 7px transparent;
border-left: 5px transparent
}
......@@ -4,9 +4,9 @@
* Copyright (C) 2008 - Julien Wintz, Inria.
* Created: Mon Aug 3 17:40:34 2009 (+0200)
* Version: $Id$
* Last-Updated: Wed Mar 21 15:00:51 2012 (+0100)
* Last-Updated: Fri Mar 23 13:44:20 2012 (+0100)
* By: Julien Wintz
* Update #: 1310
* Update #: 1369
*/
/* Commentary:
......@@ -34,6 +34,7 @@
#include <dtkComposer/dtkComposerView.h>
#include <dtkGui/dtkRecentFilesMenu.h>
#include <dtkGui/dtkSpacer.h>
#include <dtkGui/dtkSplitter.h>
#include <dtkCore/dtkGlobal.h>
......@@ -44,6 +45,27 @@
#include <QtCore>
#include <QtGui>
// /////////////////////////////////////////////////////////////////
// dtkCreatorMainWindowControls
// /////////////////////////////////////////////////////////////////
dtkCreatorMainWindowControls::dtkCreatorMainWindowControls(QWidget *parent) : QFrame(parent)
{
this->setFixedHeight(46);
this->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
}
dtkCreatorMainWindowControls::~dtkCreatorMainWindowControls(void)
{
}
QSize dtkCreatorMainWindowControls::sizeHint(void) const
{
return QSize(350, 46);
}
// /////////////////////////////////////////////////////////////////
// dtkCreatorMainWindowPrivate
// /////////////////////////////////////////////////////////////////
......@@ -164,6 +186,29 @@ dtkCreatorMainWindow::dtkCreatorMainWindow(QWidget *parent) : QMainWindow(parent
this->addAction(switchToCompoAction);
this->addAction(switchToDebugAction);
// -- Toolbar
QToolBar *mainToolBar;
mainToolBar = this->addToolBar(tr("Main"));
mainToolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
mainToolBar->setIconSize(QSize(32, 32));
QAction *run_action = mainToolBar->addAction(QIcon(":dtkCreator/pixmaps/dtkCreatorToolbarButton_Run_Active.png"), "Run");
run_action->setShortcut(Qt::ControlModifier + Qt::AltModifier + Qt::Key_R);
QAction *step_action = mainToolBar->addAction(QIcon(":dtkCreator/pixmaps/dtkCreatorToolbarButton_Step_Active.png"), "Step");
step_action->setShortcut(Qt::ControlModifier + Qt::AltModifier + Qt::Key_N);
QAction *continue_action = mainToolBar->addAction(QIcon(":dtkCreator/pixmaps/dtkCreatorToolbarButton_Continue_Active.png"), "Continue");
continue_action->setShortcut(Qt::ControlModifier + Qt::AltModifier + Qt::Key_C);
QAction *stop_action = mainToolBar->addAction(QIcon(":dtkCreator/pixmaps/dtkCreatorToolbarButton_Stop_Active.png"), "Stop");
stop_action->setShortcut(Qt::ControlModifier + Qt::AltModifier + Qt::Key_Period);
mainToolBar->addWidget(new dtkSpacer(this));
mainToolBar->addWidget(new dtkCreatorMainWindowControls(this));
mainToolBar->addWidget(new dtkSpacer(this));
// -- Menus
QMenuBar *menu_bar = this->menuBar();
......@@ -184,26 +229,22 @@ dtkCreatorMainWindow::dtkCreatorMainWindow(QWidget *parent) : QMainWindow(parent
d->edit_menu->addAction(d->undo_action);
d->edit_menu->addAction(d->redo_action);
// -- Toolbar
QMenu *view_menu = menu_bar->addMenu("View");
view_menu->addAction(switchToCompoAction);
view_menu->addAction(switchToDebugAction);
QToolBar *mainToolBar;
mainToolBar = this->addToolBar(tr("Main"));
mainToolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
mainToolBar->setIconSize(QSize(32, 32));
QAction *run_action = mainToolBar->addAction(QIcon(":dtkCreator/pixmaps/dtkCreatorToolbarButton_Run_Active.png"), "Run");
run_action->setShortcut(Qt::ControlModifier + Qt::Key_R);
QAction *step_action = mainToolBar->addAction(QIcon(":dtkCreator/pixmaps/dtkCreatorToolbarButton_Continue_Active.png"), "Step");
step_action->setShortcut(Qt::ControlModifier + Qt::Key_N);
QAction *stop_action = mainToolBar->addAction(QIcon(":dtkCreator/pixmaps/dtkCreatorToolbarButton_Stop_Active.png"), "Stop");
stop_action->setShortcut(Qt::ControlModifier + Qt::Key_Period);
QMenu *debug_menu = menu_bar->addMenu("Debug");
debug_menu->addAction(run_action);
debug_menu->addAction(step_action);
debug_menu->addAction(continue_action);
debug_menu->addAction(stop_action);
// -- Connections
connect(run_action, SIGNAL(triggered()), d->composer, SLOT(run()));
connect(step_action, SIGNAL(triggered()), d->composer, SLOT(step()));
connect(continue_action, SIGNAL(triggered()), d->composer, SLOT(cont()));
connect(stop_action, SIGNAL(triggered()), d->composer, SLOT(stop()));
connect(switchToCompoAction, SIGNAL(triggered()), this, SLOT(switchToCompo()));
connect(switchToDebugAction, SIGNAL(triggered()), this, SLOT(switchToDebug()));
......
......@@ -4,9 +4,9 @@
* Copyright (C) 2008-2011 - Julien Wintz, Inria.
* Created: Wed Feb 1 12:37:28 2012 (+0100)
* Version: $Id$
* Last-Updated: Wed Mar 21 12:34:19 2012 (+0100)
* Last-Updated: Fri Mar 23 11:50:00 2012 (+0100)
* By: Julien Wintz
* Update #: 113
* Update #: 117
*/
/* Commentary:
......@@ -39,6 +39,22 @@ class dtkSplitter;
class dtkCreatorMainWindow;
// /////////////////////////////////////////////////////////////////
// dtkCreatorMainWindowControls
// /////////////////////////////////////////////////////////////////
class dtkCreatorMainWindowControls : public QFrame
{
Q_OBJECT
public:
dtkCreatorMainWindowControls(QWidget *parent = 0);
~dtkCreatorMainWindowControls(void);
public:
QSize sizeHint(void) const;
};
// /////////////////////////////////////////////////////////////////
// dtkCreatorMainWindowPrivate
// /////////////////////////////////////////////////////////////////
......
Markdown is supported
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