summaryrefslogtreecommitdiff
path: root/src/gui/undocommands.cpp
diff options
context:
space:
mode:
authorAleks Kissinger <aleks0@gmail.com>2020-04-13 16:21:39 +0100
committerAleks Kissinger <aleks0@gmail.com>2020-04-13 16:21:39 +0100
commit732499eead71b23a7ba551fe788b47a4cf45124e (patch)
treeac3a770f742a2ebc749afd273037ee60a326ed61 /src/gui/undocommands.cpp
parent6dda16a24dfe7cbd0d90b77c57f1cf789210feb5 (diff)
adding and drawing paths works
Diffstat (limited to 'src/gui/undocommands.cpp')
-rw-r--r--src/gui/undocommands.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/gui/undocommands.cpp b/src/gui/undocommands.cpp
index a07f251..87d5a13 100644
--- a/src/gui/undocommands.cpp
+++ b/src/gui/undocommands.cpp
@@ -102,6 +102,9 @@ void EdgeBendCommand::undo()
foreach(EdgeItem *ei, _scene->edgeItems()) {
if (ei->edge() == _edge) {
ei->readPos();
+
+ Path *p = ei->edge()->path();
+ if (p) _scene->pathItems()[p]->readPos();
break;
}
}
@@ -118,6 +121,9 @@ void EdgeBendCommand::redo()
foreach(EdgeItem *ei, _scene->edgeItems()) {
if (ei->edge() == _edge) {
ei->readPos();
+
+ Path *p = ei->edge()->path();
+ if (p) _scene->pathItems()[p]->readPos();
break;
}
}
@@ -287,6 +293,9 @@ void ChangeEdgeModeCommand::undo()
// FIXME: this act strangely sometimes
_edge->setBasicBendMode(!_edge->basicBendMode());
_scene->edgeItems()[_edge]->readPos();
+ Path *p = _edge->path();
+ if (p) _scene->pathItems()[p]->readPos();
+
GraphUpdateCommand::undo();
}
@@ -294,6 +303,9 @@ void ChangeEdgeModeCommand::redo()
{
_edge->setBasicBendMode(!_edge->basicBendMode());
_scene->edgeItems()[_edge]->readPos();
+ Path *p = _edge->path();
+ if (p) _scene->pathItems()[p]->readPos();
+
GraphUpdateCommand::redo();
}
@@ -607,6 +619,12 @@ MakePathCommand::MakePathCommand(TikzScene *scene,
void MakePathCommand::undo()
{
Path *p = _edgeList.first()->path();
+
+ PathItem *pi = _scene->pathItems()[p];
+ _scene->removeItem(pi);
+ _scene->pathItems().remove(p);
+ delete pi;
+
p->removeEdges();
_scene->graph()->removePath(p);
@@ -617,6 +635,7 @@ void MakePathCommand::undo()
}
}
+ _scene->refreshZIndices();
GraphUpdateCommand::undo();
}
@@ -640,5 +659,11 @@ void MakePathCommand::redo()
_scene->graph()->addPath(p);
+ PathItem *pi = new PathItem(p);
+ _scene->addItem(pi);
+ _scene->pathItems().insert(p, pi);
+ pi->readPos();
+
+ _scene->refreshZIndices();
GraphUpdateCommand::redo();
}