[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [calligra] karbon/ui: fix separating a path into its subpath
From: Jan Hambrecht <jaham () gmx ! net>
Date: 2012-06-09 21:52:53
Message-ID: 20120609215253.CF95EA60C4 () git ! kde ! org
[Download RAW message or body]
Git commit 9cbc7b9eaece9f67458348a3cc7a5ee4808b7ba3 by Jan Hambrecht.
Committed on 09/06/2012 at 00:06.
Pushed by jaham into branch 'master'.
fix separating a path into its subpath
do not use the buggy KoPathSeparateCommand, rather create
a macro ommand using alreday existing create and delete commands
BUG:301307
M +26 -3 karbon/ui/KarbonView.cpp
http://commits.kde.org/calligra/9cbc7b9eaece9f67458348a3cc7a5ee4808b7ba3
diff --git a/karbon/ui/KarbonView.cpp b/karbon/ui/KarbonView.cpp
index 4faedb8..d82e637 100644
--- a/karbon/ui/KarbonView.cpp
+++ b/karbon/ui/KarbonView.cpp
@@ -93,10 +93,10 @@
#include <KoPathShape.h>
#include <KoPathPointData.h>
#include <KoPathCombineCommand.h>
-#include <KoPathSeparateCommand.h>
#include <KoPathReverseCommand.h>
#include <KoPathPointMoveCommand.h>
#include <KoShapeTransformCommand.h>
+#include <KoShapeGroupCommand.h>
#include <KoToolBoxFactory.h>
#include <KoParameterShape.h>
#include <KoRulerController.h>
@@ -830,8 +830,31 @@ void KarbonView::separatePath()
}
}
- if (paths.size())
- d->canvas->addCommand(new KoPathSeparateCommand(part(), paths));
+ if (!paths.size()) {
+ return;
+ }
+
+ KUndo2Command *cmd = new KUndo2Command;
+ cmd->setText(i18nc("(qtundo-format)", "Separate paths"));
+
+ foreach(KoPathShape* p, paths) {
+ QList<KoPathShape*> separatedPaths;
+ QList<KoShape*> newShapes;
+ if (p->separate(separatedPaths)) {
+ foreach(KoPathShape *subPath, separatedPaths) {
+ new KoShapeCreateCommand(part(), subPath, cmd);
+ newShapes << subPath;
+ }
+ // make sure we put the new subpaths into the parent
+ // of the original path
+ KoShapeGroup *parentGroup = dynamic_cast<KoShapeGroup*>(p->parent());
+ if (parentGroup) {
+ new KoShapeGroupCommand(parentGroup, newShapes, cmd);
+ }
+ new KoShapeDeleteCommand(part(), p, cmd);
+ }
+ }
+ d->canvas->addCommand(cmd);
}
void KarbonView::reversePath()
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic