[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    playground/office/flake/lib
From:       Thomas Zander <zander () kde ! org>
Date:       2006-05-15 13:12:43
Message-ID: 1147698763.135071.31737.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 541062 by zander:

Rename ScaleStrategy to ResizeStrategy
Make resizes undo-able


 M  +31 -0     KoCommand.cpp  
 M  +12 -0     KoCommand.h  
 M  +2 -2      KoInteractionStrategy.cpp  
 A             KoShapeResizeStrategy.cpp   KoShapeScaleStrategy.cpp#541044 [License: \
LGPL (v2+)]  A             KoShapeResizeStrategy.h   KoShapeScaleStrategy.h#541044 \
[License: LGPL (v2+)]  D             KoShapeScaleStrategy.cpp  
 D             KoShapeScaleStrategy.h  
 M  +2 -2      lib.pro  


--- trunk/playground/office/flake/lib/KoCommand.cpp #541061:541062
@@ -65,6 +65,37 @@
 }
 
 
+KoShapeSizeCommand::KoShapeSizeCommand(const KoSelectionSet &shapes, QList<QSizeF> \
&previousSizes, QList<QSizeF> &newSizes) +: m_previousSizes(previousSizes)
+, m_newSizes(newSizes)
+{
+    m_shapes = shapes.toList();
+    Q_ASSERT(m_shapes.count() == m_previousSizes.count());
+    Q_ASSERT(m_shapes.count() == m_newSizes.count());
+}
+
+void KoShapeSizeCommand::execute () {
+    int i=0;
+    foreach(KoShape *shape, m_shapes) {
+        shape->repaint();
+        shape->resize(m_newSizes[i++]);
+        shape->repaint();
+    }
+}
+
+void KoShapeSizeCommand::unexecute () {
+    int i=0;
+    foreach(KoShape *shape, m_shapes) {
+        shape->repaint();
+        shape->resize(m_previousSizes[i++]);
+        shape->repaint();
+    }
+}
+
+QString KoShapeSizeCommand::name () const {
+}
+
+
 KoGroupShapesCommand::KoGroupShapesCommand(KoShapeContainer *container, \
QList<KoShape *> shapes, QList<bool> clipped)  : m_shapes(shapes)
 , m_clipped(clipped)
--- trunk/playground/office/flake/lib/KoCommand.h #541061:541062
@@ -65,6 +65,18 @@
     QList<double> m_previousAngles, m_newAngles;
 };
 
+/// The undo / redo command for shape sizing.
+class KoShapeSizeCommand : public KCommand {
+public:
+    KoShapeSizeCommand(const KoSelectionSet &shapes, QList<QSizeF> &previousSizes, \
QList<QSizeF> &newSizes); +    void execute ();
+    void unexecute ();
+    QString name () const;
+private:
+    QList<KoShape*> m_shapes;
+    QList<QSizeF> m_previousSizes, m_newSizes;
+};
+
 /// The undo / redo command for grouping shapes
 class KoGroupShapesCommand : public KCommand {
 public:
--- trunk/playground/office/flake/lib/KoInteractionStrategy.cpp #541061:541062
@@ -24,7 +24,7 @@
 #include "KoShapeRubberSelectStrategy.h"
 #include "KoShapeMoveStrategy.h"
 #include "KoShapeRotateStrategy.h"
-#include "KoShapeScaleStrategy.h"
+#include "KoShapeResizeStrategy.h"
 #include "KoInteractionTool.h"
 #include "KoCanvasBase.h"
 #include "KoTool.h"
@@ -71,7 +71,7 @@
         if(handle == KoInteractionTool::NoHandle)
             return new KoShapeMoveStrategy(parent, canvas, event->point);
         if(insideSelection)
-            return new KoShapeScaleStrategy(parent, canvas, event->point, handle);
+            return new KoShapeResizeStrategy(parent, canvas, event->point, handle);
 
     }
     else if(handle == KoInteractionTool::NoHandle) { // clicked on object which is \
                not selected
--- trunk/playground/office/flake/lib/lib.pro #541061:541062
@@ -11,10 +11,10 @@
            KoInteractionStrategy.h KoShapeMoveStrategy.h \
            KoShapeRubberSelectStrategy.h KoViewConverter.h \
            KoShapeRotateStrategy.h KoShapeGroup.h KoLineBorder.h \
-           KoShapeScaleStrategy.h
+           KoShapeResizeStrategy.h
 SOURCES += KoShape.cpp KoPathShape.cpp KoSelection.cpp \
            KoShapeManager.cpp KoShapeContainer.cpp KoRepaintManager.cpp \
            KoInteractionTool.cpp KoShapeMoveStrategy.cpp \
                KoShapeRubberSelectStrategy.cpp \
            KoRectangleShape.cpp KoCommand.cpp KoInteractionStrategy.cpp KoTool.cpp \
            KoShapeRotateStrategy.cpp KoShapeGroup.cpp KoLineBorder.cpp \
-           KoShapeScaleStrategy.cpp
+           KoShapeResizeStrategy.cpp


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic