|
From: <xm...@us...> - 2013-11-28 12:18:23
|
Revision: 1876
http://sourceforge.net/p/scstudio/code/1876
Author: xmalota
Date: 2013-11-28 12:18:20 +0000 (Thu, 28 Nov 2013)
Log Message:
-----------
time shapes are automatically disconnected from unfitting shapes, also bug with end point of absolute time removed
Modified Paths:
--------------
trunk/src/view/visio/addon/timeSnapping.cpp
Modified: trunk/src/view/visio/addon/timeSnapping.cpp
===================================================================
--- trunk/src/view/visio/addon/timeSnapping.cpp 2013-11-28 11:23:22 UTC (rev 1875)
+++ trunk/src/view/visio/addon/timeSnapping.cpp 2013-11-28 12:18:20 UTC (rev 1876)
@@ -31,7 +31,6 @@
switch(get_shape_type(shape))
{
case ST_HMSC_REFERENCE:
- case ST_MSC_CONDITION:
case ST_BMSC_MESSAGE:
case ST_BMSC_MESSAGE_FOUND:
case ST_BMSC_MESSAGE_LOST:
@@ -67,19 +66,38 @@
{
pointX = CShapeUtils::getShapeCell(timeShape, "BeginX");
pointY = CShapeUtils::getShapeCell(timeShape, "BeginY");
+
+ switch(get_shape_type(to))
+ {
+ case ST_MSC_CONDITION:
+ pointY -= 1;
+ break;
+ case ST_HMSC_CONNECTION:
+ pointY -= 1;
+ }
}
else
{
pointX = CShapeUtils::getShapeCell(timeShape, "EndX");
pointY = CShapeUtils::getShapeCell(timeShape, "EndY");
+
+ switch(get_shape_type(to))
+ {
+ case ST_MSC_CONDITION:
+ pointY += 1;
+ break;
+ case ST_HMSC_CONNECTION:
+ pointY += 1;
+ break;
+ }
}
switch(get_shape_type(to))
{
case ST_HMSC_START:
- pointY -= 5;
+ pointY -= 1;
break;
case ST_HMSC_END:
- pointY += 5;
+ pointY += 1;
break;
}
if(begin)
@@ -100,20 +118,18 @@
if(!timeShape)
return;
- bool interval = get_shape_type(timeShape) == ST_TIME_INTERVAL;
-
+ bool interval;
+ interval = get_shape_type(timeShape) == ST_TIME_INTERVAL;
+ //Both shapes has begin and end connection points
//Check if shape is already connected
Visio::IVConnectsPtr connects = timeShape->Connects;
- Visio::IVCellPtr beginCell = timeShape->GetCells("BeginX");
- Visio::IVCellPtr endCell;
+ Visio::IVCellPtr beginCell, endCell;
+ beginCell = timeShape->GetCells("BeginX");
+ endCell = timeShape->GetCells("EndX");
+
bool badBegin = true, badEnd = true;
- if(interval)
- {
- endCell = timeShape->GetCells("EndX");
- }
-
Visio::IVCellPtr from;
for (int i=connects->Count; i>0; --i)
@@ -134,20 +150,17 @@
}
continue;
}
- if(interval)
+ if(_tcsicmp(from->Name, endCell->Name) == 0)
{
- if(_tcsicmp(from->Name, endCell->Name) == 0)
+ if (isTimeAcceptingShape(connShape))
{
- if (isTimeAcceptingShape(connShape))
- {
- badEnd = false;
- }
- else
- {
- //unglue shape
- disconnectShape(timeShape,false,connShape);
- }
+ badEnd = false;
}
+ else
+ {
+ //unglue shape
+ disconnectShape(timeShape,false,connShape);
+ }
}
}
@@ -160,13 +173,9 @@
//get time shape coordinates
beginX = CShapeUtils::getShapeCell(timeShape, "BeginX");
beginY = CShapeUtils::getShapeCell(timeShape, "BeginY");
+ endX = CShapeUtils::getShapeCell(timeShape, "EndX");
+ endY = CShapeUtils::getShapeCell(timeShape, "EndY");
- if(interval)
- {
- endX = CShapeUtils::getShapeCell(timeShape, "EndX");
- endY = CShapeUtils::getShapeCell(timeShape, "EndY");
- }
-
std::pair<double,Visio::IVCellPtr> closestBegin, closestEnd;
closestBegin.first = 0;
closestBegin.second = NULL;
@@ -185,12 +194,6 @@
connectionDownX = CShapeUtils::getShapeCell(*it, "PinX");
connectionDownY = CShapeUtils::getShapeCell(*it, "PinY") - CShapeUtils::getShapeCell(*it, "Height")/2;
break;
- case ST_MSC_CONDITION:
- connectionUpX = CShapeUtils::getShapeCell(*it, "PinX");
- connectionUpY = CShapeUtils::getShapeCell(*it, "PinY") + CShapeUtils::getShapeCell(*it, "Width")/2;
- connectionDownX = CShapeUtils::getShapeCell(*it, "PinX");
- connectionDownY = CShapeUtils::getShapeCell(*it, "PinY") - CShapeUtils::getShapeCell(*it, "Width")/2;
- break;
case ST_BMSC_MESSAGE:
connectionUpX = CShapeUtils::getShapeCell(*it, "BeginX");
connectionUpY = CShapeUtils::getShapeCell(*it, "BeginY");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|