|
From: <got...@us...> - 2009-09-21 19:42:57
|
Revision: 353
http://scstudio.svn.sourceforge.net/scstudio/?rev=353&view=rev
Author: gotthardp
Date: 2009-09-21 19:42:51 +0000 (Mon, 21 Sep 2009)
Log Message:
-----------
New feature: MSC and HMSC comments (text "xxx") are now supported by msc.h and Visio add-on.
Modified Paths:
--------------
trunk/src/view/visio/addon/dllmodule.rc
trunk/src/view/visio/addon/extract.cpp
trunk/src/view/visio/addon/extract.h
trunk/src/view/visio/addon/visualize.cpp
trunk/src/view/visio/addon/visualize.h
trunk/src/view/visio/scstudio.nsi
Modified: trunk/src/view/visio/addon/dllmodule.rc
===================================================================
--- trunk/src/view/visio/addon/dllmodule.rc 2009-09-21 17:12:52 UTC (rev 352)
+++ trunk/src/view/visio/addon/dllmodule.rc 2009-09-21 19:42:51 UTC (rev 353)
@@ -89,8 +89,8 @@
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 0,3,10,0
- PRODUCTVERSION 0,3,10,0
+ FILEVERSION 0,3,11,0
+ PRODUCTVERSION 0,3,11,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x9L
@@ -107,13 +107,13 @@
BEGIN
VALUE "CompanyName", "Masaryk University Brno"
VALUE "FileDescription", "Microsoft Visio add-on for design and verification of Message Sequence Charts (MSC)."
- VALUE "FileVersion", "0.3.10"
+ VALUE "FileVersion", "0.3.11"
VALUE "InternalName", "scstudio.vsl"
VALUE "LegalCopyright", "(c) Petr Gotthard. All rights reserved."
VALUE "OriginalFilename", "scstudio.vsl"
VALUE "PrivateBuild", "$Revision$"
VALUE "ProductName", "Sequence Chart Studio"
- VALUE "ProductVersion", "0.3.10"
+ VALUE "ProductVersion", "0.3.11"
END
END
BLOCK "VarFileInfo"
Modified: trunk/src/view/visio/addon/extract.cpp
===================================================================
--- trunk/src/view/visio/addon/extract.cpp 2009-09-21 17:12:52 UTC (rev 352)
+++ trunk/src/view/visio/addon/extract.cpp 2009-09-21 19:42:51 UTC (rev 353)
@@ -208,11 +208,6 @@
page_height - shape->CellsSRC[visSectionObject][visRowXFormOut][visXFormPinY]->Result[visMillimeters]);
}
-Coordinate CDrawingExtractor::GetWidth(Visio::IVShapePtr shape)
-{
- return shape->CellsSRC[visSectionObject][visRowXFormOut][visXFormWidth]->Result[visMillimeters];
-}
-
Coordinate CDrawingExtractor::GetControlPos(Visio::IVShapePtr shape, const wchar_t* row)
{
// walk though all controls
@@ -483,6 +478,7 @@
std::map<long,InstancePtr> instances;
MscMessageMap messages;
TimeRelationEventMap time_relations;
+ std::map<long,CommentPtr> comments;
// first walk through all shapes: create objects
for(int i = 1; i <= vsoPage->Shapes->Count; i++)
@@ -533,16 +529,23 @@
case ST_BMSC_COREGION:
case ST_BMSC_ORDER_LINE:
case ST_BMSC_ORDER_ARROW:
- case ST_COMMENT:
// ignore other basic MSC symbols
break;
+ case ST_COMMENT:
+ {
+ Comment* new_comment = new Comment((const wchar_t*)shape->Text);
+ new_comment->set_position(GetLineEnd(shape));
+ // note: this shape is rotated by 90 degrees
+ new_comment->set_width(GetHeight(shape));
+ comments[shape->ID] = new_comment;
+ break;
+ }
case ST_TEXT:
{
Comment* new_comment = new Comment((const wchar_t*)shape->Text);
new_comment->set_position(GetPinPos(shape));
new_comment->set_width(GetWidth(shape));
-
bmsc->add_comment(new_comment);
break;
}
@@ -898,6 +901,33 @@
rpos->second->glue_events(event_a->second.get(), event_b->second.get());
}
+ // walk though all detected comments
+ for(std::map<long,CommentPtr>::iterator cpos = comments.begin();
+ cpos != comments.end(); cpos++)
+ {
+ Visio::IVShapePtr shape = vsoPage->Shapes->ItemFromID[cpos->first];
+
+ // (1) check if the comment is connected to an event
+ SPoint point;
+ point.m_x = shape->CellsSRC[visSectionObject][visRowXForm1D][vis1DBeginX]->Result[0];
+ point.m_y = shape->CellsSRC[visSectionObject][visRowXForm1D][vis1DBeginY]->Result[0];
+ // find event at the point
+ EventPointMap::iterator event = events.find(point);
+
+ if(event != events.end())
+ {
+ // connect comment to the events
+ event->second->add_comment(cpos->second);
+ continue;
+ }
+
+ // TODO: Comments may be connected to other elements (e.g. instances)
+
+ PrintError(stringize() << page_name << ": "
+ << "Disconnected comment '" << shape->Name << "'",
+ shapelist() << shape);
+ }
+
// return NULL on error
if(m_was_error)
{
@@ -1128,6 +1158,7 @@
std::map<long,HMscNodePtr> nodes;
std::map<long,NodeRelationPtr> relations;
TimeRelationRefNodeMap time_relations;
+ std::map<long,CommentPtr> comments;
// first walk through all shapes: create objects
for(int i = 1; i <= vsoPage->Shapes->Count; i++)
@@ -1149,15 +1180,19 @@
break;
case ST_COMMENT:
- // ignore text and comments
+ {
+ Comment* new_comment = new Comment((const wchar_t*)shape->Text);
+ new_comment->set_position(GetLineEnd(shape));
+ // note: this shape is rotated by 90 degrees
+ new_comment->set_width(GetHeight(shape));
+ comments[shape->ID] = new_comment;
break;
-
+ }
case ST_TEXT:
{
Comment* new_comment = new Comment((const wchar_t*)shape->Text);
new_comment->set_position(GetPinPos(shape));
new_comment->set_width(GetWidth(shape));
-
hmsc->add_comment(new_comment);
break;
}
@@ -1414,6 +1449,42 @@
dir2 == TD_BOTTOM, node2.get());
}
+ // walk though all detected comments
+ for(std::map<long,CommentPtr>::iterator cpos = comments.begin();
+ cpos != comments.end(); cpos++)
+ {
+ Visio::IVShapePtr comment = vsoPage->Shapes->ItemFromID[cpos->first];
+ // check the comment is properly connected
+ if(comment->Connects->Count < 1)
+ {
+ PrintError(stringize() << page_name << ": "
+ << "Disconnected comment '" << comment->Name << "'",
+ shapelist() << comment);
+ continue;
+ }
+ else if(comment->Connects->Count > 1)
+ {
+ PrintError(stringize() << page_name << ": "
+ << "Wrongly attached comment.",
+ shapelist() << comment);
+ continue;
+ }
+
+ Visio::IVConnectPtr connect = comment->Connects->Item[1];
+ Visio::IVShapePtr shape = connect->ToSheet;
+
+ std::map<long,HMscNodePtr>::iterator npos = nodes.find(shape->ID);
+ if(npos == nodes.end() || connect->FromPart != visBegin)
+ {
+ PrintError(stringize() << page_name << ": "
+ << "Wrongly attached comment.",
+ shapelist() << comment);
+ continue;
+ }
+
+ (*npos).second->add_comment((*cpos).second);
+ }
+
// return NULL on error
if(m_was_error)
{
Modified: trunk/src/view/visio/addon/extract.h
===================================================================
--- trunk/src/view/visio/addon/extract.h 2009-09-21 17:12:52 UTC (rev 352)
+++ trunk/src/view/visio/addon/extract.h 2009-09-21 19:42:51 UTC (rev 353)
@@ -131,7 +131,14 @@
MscPoint GetLineBegin(Visio::IVShapePtr shape);
MscPoint GetLineEnd(Visio::IVShapePtr shape);
MscPoint GetPinPos(Visio::IVShapePtr shape);
- Coordinate GetWidth(Visio::IVShapePtr shape);
+ Coordinate GetWidth(Visio::IVShapePtr shape)
+ {
+ return shape->CellsSRC[visSectionObject][visRowXFormOut][visXFormWidth]->Result[visMillimeters];
+ }
+ Coordinate GetHeight(Visio::IVShapePtr shape)
+ {
+ return shape->CellsSRC[visSectionObject][visRowXFormOut][visXFormHeight]->Result[visMillimeters];
+ }
Coordinate GetControlPos(Visio::IVShapePtr shape, const wchar_t* row);
//! assert the given shape has no connections to its sub-shapes
Modified: trunk/src/view/visio/addon/visualize.cpp
===================================================================
--- trunk/src/view/visio/addon/visualize.cpp 2009-09-21 17:12:52 UTC (rev 352)
+++ trunk/src/view/visio/addon/visualize.cpp 2009-09-21 19:42:51 UTC (rev 353)
@@ -151,6 +151,17 @@
cell->GlueToPos(where, pos.get_y()/max(1.0,width), pos.get_x()/max(1.0,height));
}
+void GlueBeginToShape(Visio::IVShapePtr what, Visio::IVShapePtr where)
+{
+ double height = where->CellsSRC[visSectionObject][visRowXFormOut][visXFormHeight]->Result[visMillimeters];
+ double width = where->CellsSRC[visSectionObject][visRowXFormOut][visXFormWidth]->Result[visMillimeters];
+
+ Visio::IVCellPtr from_cell = what->CellsSRC[visSectionObject][visRowXForm1D][vis1DBeginX];
+ Visio::IVCellPtr to_cell = where->CellsSRC[visSectionObject][visRowXFormOut][visXFormPinX];
+
+ from_cell->GlueTo(to_cell);
+}
+
void GlueEndToPos(Visio::IVShapePtr what, Visio::IVShapePtr where, const MscPoint& pos)
{
double height = where->CellsSRC[visSectionObject][visRowXFormOut][visXFormHeight]->Result[visMillimeters];
@@ -230,6 +241,15 @@
Visio::IVShapePtr marker = vsoPage->Drop(marker_master, posX, posY);
}
+
+ for(CommentPtrSet::const_iterator cpos = event->get_comments().begin();
+ cpos != event->get_comments().end(); cpos++)
+ {
+ Visio::IVShapePtr comment = DropComment(vsoPage, *cpos);
+
+ GlueBeginToPos(comment, parent, event->get_position());
+ SetLineEnd(comment, (*cpos)->get_position());
+ }
}
Visio::IVShapePtr CDrawingVisualizer::connect_events(Visio::IVPagePtr vsoPage,
@@ -610,6 +630,15 @@
show_time_relations2(vsoPage, nodes, reference_node, shape, tops);
show_time_relations2(vsoPage, nodes, reference_node, shape, bottoms);
}
+
+ for(CommentPtrSet::const_iterator cpos = (*npos)->get_comments().begin();
+ cpos != (*npos)->get_comments().end(); cpos++)
+ {
+ Visio::IVShapePtr comment = DropComment(vsoPage, *cpos);
+
+ GlueBeginToShape(comment, shape);
+ SetLineEnd(comment, (*cpos)->get_position());
+ }
}
}
Modified: trunk/src/view/visio/addon/visualize.h
===================================================================
--- trunk/src/view/visio/addon/visualize.h 2009-09-21 17:12:52 UTC (rev 352)
+++ trunk/src/view/visio/addon/visualize.h 2009-09-21 19:42:51 UTC (rev 353)
@@ -69,6 +69,19 @@
void show_time_relations(Visio::IVPagePtr vsoPage, TimeRelationEventPtrMap& time_relations,
Visio::IVShapePtr parent, EventPtr event);
+ template<class C>
+ Visio::IVShapePtr DropComment(Visio::IVPagePtr vsoPage, boost::intrusive_ptr<C> comment)
+ {
+ Visio::IVShapePtr result = vsoPage->Drop(m_comment_master, 0, 0);
+ result->Text = comment->get_text().c_str();
+ result->CellsSRC[visSectionObject][visRowXFormOut][visXFormHeight]->Result[visMillimeters] = comment->get_width();
+
+ if(comment->get_marked())
+ MarkShape(result);
+
+ return result;
+ }
+
void visualize_msc_base(Visio::IVPagePtr vsoPage, const MscPtr& msc);
void visualize_bmsc(Visio::IVPagePtr vsoPage, const BMscPtr& bmsc);
Modified: trunk/src/view/visio/scstudio.nsi
===================================================================
--- trunk/src/view/visio/scstudio.nsi 2009-09-21 17:12:52 UTC (rev 352)
+++ trunk/src/view/visio/scstudio.nsi 2009-09-21 19:42:51 UTC (rev 353)
@@ -21,7 +21,7 @@
; -- General ---------------------------
-!define VERSION "0.3.10"
+!define VERSION "0.3.11"
Name "Sequence Chart Studio"
OutFile "scstudio-setup-${VERSION}.exe"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|