From: <xm...@us...> - 2014-02-03 14:15:18
|
Revision: 1899 http://sourceforge.net/p/scstudio/code/1899 Author: xmalota Date: 2014-02-03 14:15:15 +0000 (Mon, 03 Feb 2014) Log Message: ----------- Bug #87 HMSC connection fixed, also fixed HMSC reference and condition: connection points hold still default position Modified Paths: -------------- trunk/src/view/visio/addon/addon.cpp trunk/src/view/visio/addon/shapeutils.cpp trunk/src/view/visio/addon/shapeutils.h Modified: trunk/src/view/visio/addon/addon.cpp =================================================================== --- trunk/src/view/visio/addon/addon.cpp 2014-02-03 13:23:45 UTC (rev 1898) +++ trunk/src/view/visio/addon/addon.cpp 2014-02-03 14:15:15 UTC (rev 1899) @@ -668,12 +668,12 @@ m_bShapeChanged = true; } - /*if(get_shape_type(vsoShape) == ST_HMSC_CONNECTION || + if(get_shape_type(vsoShape) == ST_HMSC_CONNECTION || get_shape_type(vsoShape) == ST_HMSC_REFERENCE || get_shape_type(vsoShape) == ST_MSC_CONDITION) { CShapeUtils::replaceConnectionPoints(vsoShape); - }*/ + } //HACK: cell changed so update mouse position (because when changing end points, MouseMove event won't trigger) Modified: trunk/src/view/visio/addon/shapeutils.cpp =================================================================== --- trunk/src/view/visio/addon/shapeutils.cpp 2014-02-03 13:23:45 UTC (rev 1898) +++ trunk/src/view/visio/addon/shapeutils.cpp 2014-02-03 14:15:15 UTC (rev 1899) @@ -173,7 +173,7 @@ Visio::IVCellPtr cell = shape->CellsSRC[visSectionObject][visRowLine][visLineColor]; - BSTR str = cell->ResultStrU[visUnitsColor].GetBSTR(); + BSTR str = cell->ResultStr[visUnitsColor].GetBSTR(); wchar_t *endP; //parse string RGB(r, g, b) into numbers r,g,b endP = wcsstr(str,L"RGB"); @@ -552,6 +552,54 @@ return false; } +bool CShapeUtils::replaceConnectionPoints(Visio::IVShapePtr vsoShape) +{ + //(get_shape_type(vsoShape) == ST_HMSC_CONNECTION || + // get_shape_type(vsoShape) == ST_HMSC_REFERENCE || + // get_shape_type(vsoShape) == ST_MSC_CONDITION) + Visio::IVCellPtr connectionX1, connectionY1; + Visio::IVCellPtr connectionX2, connectionY2; + Visio::IVCellPtr connectionX3, connectionY3; + Visio::IVCellPtr connectionX4, connectionY4; + + if(get_shape_type(vsoShape) == ST_HMSC_CONNECTION) + { + connectionX1 = vsoShape->GetCells("Connections.X1"); + connectionY1 = vsoShape->GetCells("Connections.Y1"); + connectionX2 = vsoShape->GetCells("Connections.X2"); + connectionY2 = vsoShape->GetCells("Connections.Y2"); + connectionX3 = vsoShape->GetCells("Connections.X3"); + connectionY3 = vsoShape->GetCells("Connections.Y3"); + connectionX4 = vsoShape->GetCells("Connections.X4"); + connectionY4 = vsoShape->GetCells("Connections.Y4"); + + connectionX1->PutFormulaU("Width*0.5"); + connectionY1->PutFormulaU("Width*0"); + connectionX2->PutFormulaU("Width*0"); + connectionY2->PutFormulaU("Width*0.5"); + connectionX3->PutFormulaU("Width*1"); + connectionY3->PutFormulaU("Width*0.5"); + connectionX4->PutFormulaU("Width*0.5"); + connectionY4->PutFormulaU("Width*1"); + } + + if(get_shape_type(vsoShape) == ST_HMSC_REFERENCE || + get_shape_type(vsoShape) == ST_MSC_CONDITION) + { + connectionX1 = vsoShape->GetCells("Connections.X1"); + connectionY1 = vsoShape->GetCells("Connections.Y1"); + connectionX2 = vsoShape->GetCells("Connections.X2"); + connectionY2 = vsoShape->GetCells("Connections.Y2"); + + connectionX1->PutFormulaU("Width*0.5"); + connectionY1->PutFormulaU("Height*1"); + connectionX2->PutFormulaU("Width*0.5"); + connectionY2->PutFormulaU("Height*0"); + } + + return true; +} + bool CShapeComparator::operator()(const Visio::IVShapePtr shapeOne, const Visio::IVShapePtr shapeTwo) { if (direction == ORDER_ASC) Modified: trunk/src/view/visio/addon/shapeutils.h =================================================================== --- trunk/src/view/visio/addon/shapeutils.h 2014-02-03 13:23:45 UTC (rev 1898) +++ trunk/src/view/visio/addon/shapeutils.h 2014-02-03 14:15:15 UTC (rev 1899) @@ -130,6 +130,11 @@ */ static bool unglueShape(Visio::IVShapePtr fromShape, const _bstr_t & fromCell, Visio::IVShapePtr toShape); + /* + * Replace connection point that is wrongly situated to the proper place + */ + static bool CShapeUtils::replaceConnectionPoints(Visio::IVShapePtr vsoShape); + }; /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |