]> Shamusworld >> Repos - architektonas/blobdiff - src/drawingview.cpp
Changed Actions to emit signal when needing a graphical update.
[architektonas] / src / drawingview.cpp
index 89c63ed429d9a95f71aa245160d09d95c6ca7e4b..656545b945c3738442e47513b96878f2843fe2f1 100644 (file)
@@ -41,6 +41,9 @@
 
 #define BACKGROUND_MAX_SIZE    512
 
+// Class variable
+//Container DrawingView::document(Vector(0, 0));
+
 
 DrawingView::DrawingView(QWidget * parent/*= NULL*/): QWidget(parent),
        // The value in the settings file will override this.
@@ -138,6 +141,7 @@ void DrawingView::SetToolActive(Action * action)
                toolAction = action;
                connect(toolAction, SIGNAL(ObjectReady(Object *)), this,
                        SLOT(AddNewObjectToDocument(Object *)));
+               connect(toolAction, SIGNAL(NeedRefresh()), this, SLOT(HandleActionUpdate()));
        }
 }
 
@@ -260,6 +264,12 @@ void DrawingView::AddNewObjectToDocument(Object * object)
 }
 
 
+void DrawingView::HandleActionUpdate(void)
+{
+       update();
+}
+
+
 void DrawingView::SetCurrentLayer(int layer)
 {
        Object::currentLayer = layer;
@@ -461,10 +471,10 @@ void DrawingView::keyPressEvent(QKeyEvent * event)
 {
        if (toolAction)
        {
-               bool needUpdate = toolAction->KeyDown(event->key());
+               /*bool needUpdate =*/ toolAction->KeyDown(event->key());
 
-               if (needUpdate)
-                       update();
+//             if (needUpdate)
+//                     update();
        }
 }
 
@@ -473,10 +483,10 @@ void DrawingView::keyReleaseEvent(QKeyEvent * event)
 {
        if (toolAction)
        {
-               bool needUpdate = toolAction->KeyReleased(event->key());
+               /*bool needUpdate =*/ toolAction->KeyReleased(event->key());
 
-               if (needUpdate)
-                       update();
+//             if (needUpdate)
+//                     update();
        }
 }