|
From: <ob...@us...> - 2010-05-12 15:16:29
|
Revision: 763
http://scstudio.svn.sourceforge.net/scstudio/?rev=763&view=rev
Author: obouda
Date: 2010-05-12 15:16:23 +0000 (Wed, 12 May 2010)
Log Message:
-----------
Message Sequence: If there are more than 2 instances selected, message sequence takes place exactly among these selected instances.
Modified Paths:
--------------
trunk/src/view/visio/addon/document.cpp
trunk/src/view/visio/addon/document.h
Modified: trunk/src/view/visio/addon/document.cpp
===================================================================
--- trunk/src/view/visio/addon/document.cpp 2010-05-11 21:31:30 UTC (rev 762)
+++ trunk/src/view/visio/addon/document.cpp 2010-05-12 15:16:23 UTC (rev 763)
@@ -1045,25 +1045,51 @@
qualified.push_back(boundaryOne);
qualified.push_back(boundaryTwo);
- Visio::IVPagePtr page = boundaryOne->ContainingPage;
- // push back all qualifying shapes based on X-coord and Y-coord
- for (int i=1; i <= page->Shapes->Count; i++)
+ const Visio::IVSelectionPtr selection = CPageUtils::FilterSelection(boundaryOne->Application->ActiveWindow->Selection, ST_BMSC_INSTANCE);
+ if (selection->Count > 2)
{
- Visio::IVShapePtr shape = page->Shapes->Item[i];
+ // special care when there are more than 2 instances selected
+ // exactly the selected instances should be the subject of message sequence
+ // if any of them does not meet the criteria (vertical, intersects yCoord), report an error
+ for (int i=1; i<=selection->Count; i++) {
+ Visio::IVShapePtr shape = selection->Item[i];
- if (get_shape_type(shape) != ST_BMSC_INSTANCE) continue;
+ double bX = CShapeUtils::GetShapeBeginX(shape);
+ double eX = CShapeUtils::GetShapeEndX(shape);
+ double bY = CShapeUtils::GetShapeBeginY(shape);
+ double eY = CShapeUtils::GetShapeEndY(shape);
- double bX = CShapeUtils::GetShapeBeginX(shape);
- double eX = CShapeUtils::GetShapeEndX(shape);
- double bY = CShapeUtils::GetShapeBeginY(shape);
- double eY = CShapeUtils::GetShapeEndY(shape);
+ // must be vertical and at right yCoord
+ if (fabs(bX - eX) > EPSILON || bY < yCoord || eY > yCoord)
+ {
+ return std::vector<Visio::IVShapePtr>(); // error - a member of selection should have qualified
+ }
+ qualified.push_back(shape);
+ }
+ }
+ else
+ {
+ // there are no more than 2 instances selected - scan the whole page
+ Visio::IVPagePtr page = boundaryOne->ContainingPage;
+ // push back all qualifying shapes based on X-coord and Y-coord
+ for (int i=1; i <= page->Shapes->Count; i++)
+ {
+ Visio::IVShapePtr shape = page->Shapes->Item[i];
- if (fabs(bX - eX) > EPSILON) continue; // not vertical
- if (bY < yCoord || eY > yCoord) continue; // wrong yCoord
+ if (get_shape_type(shape) != ST_BMSC_INSTANCE) continue;
- if ((fromX < bX && bX < toX) || (fromX > bX && bX > toX))
- {
- qualified.push_back(shape);
+ double bX = CShapeUtils::GetShapeBeginX(shape);
+ double eX = CShapeUtils::GetShapeEndX(shape);
+ double bY = CShapeUtils::GetShapeBeginY(shape);
+ double eY = CShapeUtils::GetShapeEndY(shape);
+
+ if (fabs(bX - eX) > EPSILON) continue; // not vertical
+ if (bY < yCoord || eY > yCoord) continue; // wrong yCoord
+
+ if ((fromX < bX && bX < toX) || (fromX > bX && bX > toX))
+ {
+ qualified.push_back(shape);
+ }
}
}
@@ -1144,7 +1170,6 @@
{
swap(orderedBoundaries);
}
-
// order the pair so that we get the right direction by iterating the resulting list
if (direction == MSDIR_LEFT || direction == MSDIR_LEFT_RIGHT)
{
@@ -1155,7 +1180,7 @@
if (instList.size() == 0)
{
MessageBox(GetActiveWindow(),
- _T("No instances matching the criteria.\nMaybe the Y-start (mouse position) is wrong?"),
+ _T("No instances matching the criteria.\nSome of the selected instances are out of Y-start (mouse position)."),
_T("Error"), MB_OK | MB_ICONEXCLAMATION);
return VAORC_FAILURE;
}
Modified: trunk/src/view/visio/addon/document.h
===================================================================
--- trunk/src/view/visio/addon/document.h 2010-05-11 21:31:30 UTC (rev 762)
+++ trunk/src/view/visio/addon/document.h 2010-05-12 15:16:23 UTC (rev 763)
@@ -257,8 +257,11 @@
* Gets all instances between some two instances at a given height.
*
* Taken are all instances with x-coords between x-coords of the two instances given and
- * y-coords beginning above yCoord and ending below yCoords (imagine a line at height yCoord -
- * then the instances taken into account are only these intersecting this line).
+ * y-coords beginning above yCoord and ending below yCoords (imagine a horizontal line at
+ * height yCoord - then the instances taken into account are only these intersecting this line).
+ *
+ * Furthermore, if there is a selection of at least 3 instances on the page, only those instances
+ * present in this selection are chosen.
*
* The function respects the order of boundaries: if boundaryOne is the left of the two,
* all instances returned are ordered by the x-coords in the ascending direction; otherwise,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|