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

List:       kde-commits
Subject:    koffice/kivio
From:       Peter Simonsson <psn () linux ! se>
Date:       2005-12-16 12:17:55
Message-ID: 1134735475.946334.9904.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 488911 by psn:

* make the connector tool use the guides too.
* fix snapToGridAndGuides to actually snap to the guides
* clean up some includes


 M  +9 -1      kiviopart/kivio_canvas.cpp  
 M  +5 -3      plugins/kivioconnectortool/tool_connector.cpp  


--- trunk/koffice/kivio/kiviopart/kivio_canvas.cpp #488910:488911
@@ -912,8 +912,16 @@
   p = snapToGrid(p);
 
   bool snappedX, snappedY;
-  p = snapToGuides(p, snappedX, snappedY);
+  KoPoint guidePoint = snapToGuides(point, snappedX, snappedY);
 
+  if(snappedX) {
+    p.setX(guidePoint.x());
+  }
+
+  if(snappedY) {
+    p.setY(guidePoint.y());
+  }
+
   return p;
 }
 
--- trunk/koffice/kivio/plugins/kivioconnectortool/tool_connector.cpp #488910:488911
@@ -26,6 +26,7 @@
 #include <KoPoint.h>
 #include <kozoomhandler.h>
 #include <klocale.h>
+#include <koGuides.h>
 
 #include "kivio_view.h"
 #include "kivio_canvas.h"
@@ -283,7 +284,7 @@
   KoPoint endPoint = pPage->snapToTarget(canvas->mapFromScreen(e->pos()), 8.0, hit);
 
   if(!hit) {
-    endPoint = canvas->snapToGrid(endPoint);
+    endPoint = canvas->snapToGridAndGuides(endPoint);
   }
 
   m_pDragData->x = endPoint.x();
@@ -313,7 +314,7 @@
         endRubberBanding(e);
         break;
     }
-  
+
     view()->canvasWidget()->setCursor(*m_pConnectorCursor1);
     m_mode = stmNone;
   }
@@ -323,7 +324,8 @@
 {
   connector(view()->canvasWidget()->rect());
   m_pStencil = 0;
-  
+  view()->canvasWidget()->guideLines().repaintAfterSnapping();
+
   if(!m_permanent) {
     view()->pluginManager()->activateDefaultTool();
   }
[prev in list] [next in list] [prev in thread] [next in thread] 

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