|
From: <mbe...@us...> - 2010-09-16 21:53:09
|
Revision: 952
http://scstudio.svn.sourceforge.net/scstudio/?rev=952&view=rev
Author: mbezdeka
Date: 2010-09-16 21:53:03 +0000 (Thu, 16 Sep 2010)
Log Message:
-----------
- bug fixed
Modified Paths:
--------------
trunk/src/view/visio/addon/messageJump.cpp
trunk/src/view/visio/addon/messageSnapping.cpp
trunk/src/view/visio/addon/messageSnapping.h
Modified: trunk/src/view/visio/addon/messageJump.cpp
===================================================================
--- trunk/src/view/visio/addon/messageJump.cpp 2010-09-16 21:48:09 UTC (rev 951)
+++ trunk/src/view/visio/addon/messageJump.cpp 2010-09-16 21:53:03 UTC (rev 952)
@@ -103,22 +103,27 @@
TShapeType shapeType = closestLeft ? ST_BMSC_MESSAGE_LOST : ST_BMSC_MESSAGE_FOUND;
changeMsgType(msgShape, (getEdgeInstanceTreatment() == 1) ? shapeType : ST_BMSC_MESSAGE);
- if(getEdgeInstanceTreatment() == 0)
- setMsgNeedsResnap(msgShape, true);
}
//Glue messages to instances
- CMessageSnapping::glueMsgToInstancesPair(msgShape, closestLeft, closestRight, PinY, MSSNAP_PRESERVE_VERTICAL, false);
+ MsgConnectedEndpoints conn = CMessageSnapping::glueMsgToInstancesPair(msgShape, closestLeft, closestRight, PinY, MSSNAP_PRESERVE_VERTICAL, false);
//Preserve its length (If message is snapped only to one instance, preserve its length)
- MsgConnectedEndpoints conn = CShapeUtils::getConnectedEndpoints(msgShape);
-
- if(conn == MSCE_BEGIN) //LEFT point is snapped, adjust right point
- CMessageSnapping::setMsgLength(msgShape, msgVec, vis1DBeginX);
- else if(conn == MSCE_END) //RIGHT point is snapped, adjust left point
- CMessageSnapping::setMsgLength(msgShape, msgVec, vis1DEndX);
- else if(conn == MSCE_NONE)
+ switch(conn)
+ {
+ case MSCE_BEGIN: //LEFT point is snapped, adjust right point
+ case MSCE_END: //RIGHT point is snapped, adjust left point
+ if(origIntsLeft && origIntsRight)
+ changeMsgType(msgShape, get_shape_type(msgShape));
+ CMessageSnapping::setMsgLength(msgShape, msgVec, (conn == MSCE_BEGIN) ? vis1DBeginX : vis1DEndX);
+ if(origIntsLeft && origIntsRight)
+ CMessageSnapping::resnap(msgShape, msgShape->Application->ActivePage->Shapes, 0.0001);
+ if(getMsgNeedsResnap(msgShape) == 0)
+ setMsgNeedsResnap(msgShape, true);
+ break;
+ case MSCE_NONE:
return false;
+ }
return true;
}
Modified: trunk/src/view/visio/addon/messageSnapping.cpp
===================================================================
--- trunk/src/view/visio/addon/messageSnapping.cpp 2010-09-16 21:48:09 UTC (rev 951)
+++ trunk/src/view/visio/addon/messageSnapping.cpp 2010-09-16 21:53:03 UTC (rev 952)
@@ -184,12 +184,13 @@
return std::pair<Visio::IVShapePtr, Visio::IVShapePtr>(leftClosestInstance,rightClosestInstance);
}
-bool CMessageSnapping::glueMsgToInstancesPair(Visio::IVShapePtr msgShape, Visio::IVShapePtr leftInstance, Visio::IVShapePtr rightInstance,
+MsgConnectedEndpoints CMessageSnapping::glueMsgToInstancesPair(Visio::IVShapePtr msgShape, Visio::IVShapePtr leftInstance, Visio::IVShapePtr rightInstance,
double yPos, MsgSnapType snapType, bool dontGlueIfConnected)
{
+ int result = 0;
//if there are no instances, return
if(!leftInstance && !rightInstance)
- return false;
+ return (MsgConnectedEndpoints)result;
double yLeftPos, yRightPos;
@@ -214,10 +215,12 @@
MsgDirection msgDir = CShapeUtils::getMsgDirection(msgShape);
//Glue to left instance or to right instance (at least one endpoint must be snapped to return true)
- glueMsgToInstance(msgShape, leftInstance, "BeginX", yLeftPos, msgDir, dontGlueIfConnected);
- glueMsgToInstance(msgShape, rightInstance, "EndX", yRightPos, msgDir, dontGlueIfConnected);
+ if(glueMsgToInstance(msgShape, leftInstance, "BeginX", yLeftPos, msgDir, dontGlueIfConnected))
+ result++;
+ if(glueMsgToInstance(msgShape, rightInstance, "EndX", yRightPos, msgDir, dontGlueIfConnected))
+ result = (!result) ? 2 : 3;
- return true;
+ return (MsgConnectedEndpoints)result;
}
bool CMessageSnapping::glueMsgToInstance(Visio::IVShapePtr msgShape, Visio::IVShapePtr instanceShape,
Modified: trunk/src/view/visio/addon/messageSnapping.h
===================================================================
--- trunk/src/view/visio/addon/messageSnapping.h 2010-09-16 21:48:09 UTC (rev 951)
+++ trunk/src/view/visio/addon/messageSnapping.h 2010-09-16 21:53:03 UTC (rev 952)
@@ -51,7 +51,7 @@
* designed only for horizontal messages (diagonal messages will be snapped according their PinX point and reformed to horizontal messages)
* @param onlyOnInstanceLine if true avoid connection message on instace's "rectangles" on the top and the bottom
*/
- static bool glueMsgToInstancesPair(Visio::IVShapePtr msgShape, Visio::IVShapePtr leftInstance, Visio::IVShapePtr rightInstance,
+ static MsgConnectedEndpoints glueMsgToInstancesPair(Visio::IVShapePtr msgShape, Visio::IVShapePtr leftInstance, Visio::IVShapePtr rightInstance,
double yPos, MsgSnapType snapType, bool dontGlueIfConnected = true);
/**
* Glue given message to instance, but only to "line" of instance, rectangles at the bottom and top are ignored
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|