]> Shamusworld >> Repos - architektonas/blobdiff - src/drawingview.cpp
Fixed inconsistent tool states.
[architektonas] / src / drawingview.cpp
index f5ff2e35a5adaf917a0f3ec83ee15eb1d168a7b9..eccb0b170d2647c421d9269ae8701aad5aa199b5 100644 (file)
@@ -84,13 +84,17 @@ void DrawingView::SetRotateToolActive(bool state/*= true*/)
 
 void DrawingView::SetAddLineToolActive(bool state/*= true*/)
 {
-       if (state && toolAction == NULL)
+       if (state)// && toolAction == NULL)
        {
+               if (toolAction)
+                       delete toolAction;
+
+               addCircleTool = false;
                toolAction = new DrawLineAction();
                connect(toolAction, SIGNAL(ObjectReady(Object *)), this,
                        SLOT(AddNewObjectToDocument(Object *)));
        }
-       else if (!state && toolAction)
+       else if (!state && addLineTool && toolAction)
        {
                delete toolAction;
                toolAction = NULL;
@@ -103,13 +107,17 @@ void DrawingView::SetAddLineToolActive(bool state/*= true*/)
 
 void DrawingView::SetAddCircleToolActive(bool state/*= true*/)
 {
-       if (state && toolAction == NULL)
+       if (state)// && toolAction == NULL)
        {
+               if (toolAction)
+                       delete toolAction;
+
+               addLineTool = false;
                toolAction = new DrawCircleAction();
                connect(toolAction, SIGNAL(ObjectReady(Object *)), this,
                        SLOT(AddNewObjectToDocument(Object *)));
        }
-       else if (!state && toolAction)
+       else if (!state && addCircleTool && toolAction)
        {
                delete toolAction;
                toolAction = NULL;
@@ -117,7 +125,7 @@ void DrawingView::SetAddCircleToolActive(bool state/*= true*/)
 
        addCircleTool = state;
        update();
-//printf("DrawingView::SetAddLineToolActive(). toolAction=%08X\n", toolAction);
+//printf("DrawingView::SetAddCircleToolActive(). toolAction=%08X\n", toolAction);
 }
 
 void DrawingView::AddNewObjectToDocument(Object * object)