|
From: <mar...@us...> - 2010-03-07 21:26:48
|
Revision: 668
http://scstudio.svn.sourceforge.net/scstudio/?rev=668&view=rev
Author: martinnrt
Date: 2010-03-07 21:26:40 +0000 (Sun, 07 Mar 2010)
Log Message:
-----------
Modified Paths:
--------------
trunk/src/check/time/CMakeLists.txt
trunk/tests/CMakeLists.txt
Added Paths:
-----------
trunk/src/check/time/find_block.cpp
trunk/src/check/time/find_block.cpp~
trunk/src/check/time/find_block.h
trunk/src/check/time/find_block.h~
trunk/tests/acyclic_checker_test
trunk/tests/find_block_test.cpp
Modified: trunk/src/check/time/CMakeLists.txt
===================================================================
--- trunk/src/check/time/CMakeLists.txt 2010-03-06 12:19:42 UTC (rev 667)
+++ trunk/src/check/time/CMakeLists.txt 2010-03-07 21:26:40 UTC (rev 668)
@@ -12,6 +12,8 @@
time_trace_race.h
hmsc_all_paths.h
hmsc_all_paths.cpp
+ find_block.h
+ find_block.cpp
)
TARGET_LINK_LIBRARIES(sctime
Added: trunk/src/check/time/find_block.cpp
===================================================================
--- trunk/src/check/time/find_block.cpp (rev 0)
+++ trunk/src/check/time/find_block.cpp 2010-03-07 21:26:40 UTC (rev 668)
@@ -0,0 +1,179 @@
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2010 Martin Vodila <fp...@ma...>
+ *
+ * $Id:
+ */
+
+
+#include "check/time/find_block.h"
+
+void MyTraverse::on_white_node_found(HMscNode* n)
+ {
+ //int last_block=trav.m_last_block;
+ //TimeRelationEventPtrList open_constraints=trav.m_open_constraints;
+ //counter_of_blocks=TraversAndBlocks::counter_of_blocks;
+
+ //n.found_with_block_number=last_block;
+
+ n->set_attribute<int>("found_with_block_number",trav->m_last_block);
+ //n.found_with_constraints=open_constraints;
+ n->set_attribute<TimeRelationRefNodePtrSet>("found_with_open_constraints",trav->m_open_constraints);
+ update_constraints(n);
+ }
+
+/*void MyTraverse::grey_node_found(HMscNode* n)
+{
+}
+
+void MyTraverse::black_node_found(HMscNode* n)
+{
+}*/
+
+void MyTraverse::on_node_finished(HMscNode* n)
+{
+ //int last_block=trav.m_last_block;
+ //TimeRelationEventPtrList open_constraints=trav.m_open_constraints;
+ //std::list<Block> list_of_blocks=trav.m_list_of_blocks;
+ for (std::list<Block>::iterator it = trav->m_list_of_blocks.begin(); it != trav->m_list_of_blocks.end(); it++) //iterate blocks
+ {
+ if (((*it).get_number()==trav->m_last_block) && ((*it).get_if_end()==0)) //find the right one, and check if end node has been set
+ {
+ (*it).set_end(dynamic_cast<ReferenceNode*>(n)); //if it hasn't, then set it
+ (*it).set_if_end(1);
+ continue;
+ }
+ }
+ trav->m_last_block=n->get_attribute<int>("found_with_block_number",0);
+ trav->m_open_constraints=n->get_attribute<TimeRelationRefNodePtrSet>("found_with_open_constraints",trav->m_open_constraints);
+ n->remove_attribute<int>("found_with_block_number");
+ n->remove_attribute<TimeRelationRefNodePtrSet>("found_with_open_constraints");
+}
+
+void MyTraverse::update_constraints(HMscNode* v)
+{
+ ReferenceNode* n= dynamic_cast<ReferenceNode*>(v);
+ TimeRelationRefNodePtrSet node_constraints;
+ TimeRelationRefNodePtrSet bottom;
+ TimeRelationRefNodePtrSet top;
+ //node_constraints=new TimeRelationRefNodePtrSet();
+ node_constraints.erase(node_constraints.begin(), node_constraints.end());
+
+ if (n!=NULL)
+ {
+
+/* std::cout << "Tu sme este dosli2" << std::endl;
+
+ n->get_time_relations_bottom();
+
+ std::cout << "Tu sme este dosli3" << std::endl;
+
+ bottom= n->get_time_relations_bottom();
+ top= n->get_time_relations_top();
+
+ for (std::set<TimeRelationRefNodePtr>::iterator it = top.begin(); it != top.end(); it++)
+ {
+ node_constraints.insert(*it);
+ }
+
+ for (std::set<TimeRelationRefNodePtr>::iterator it = bottom.begin(); it != bottom.end(); it++)
+ {
+ node_constraints.insert(*it);
+ }*/
+
+ node_constraints.insert(n->get_time_relations_top().begin(), n->get_time_relations_top().end()); //TODO tunak to hadze seg fault
+
+ //std::list<TimeRelationEvent> node_constraints;
+ //std::list<TimeRelationEvent> list_of_relations;
+ //int last_block=TraversAndMarkBlocks::last_block;
+ //TimeRelationEventPtrList open_constraints=TraversAndMarkBlocks::open_constraints;
+ //int counter_of_blocks=TraversAndMarkBlocks::counter_of_blocks;
+ //std::list<Block> list_of_blocks=TraversAndMarkBlocks::list_of_blocks;
+
+
+ node_constraints.insert(n->get_time_relations_bottom().begin(), n->get_time_relations_bottom().end());
+
+ //node_constraints=v->get_time_relations_top();
+ //node_constraints.splice( node_constraints.end() , v->get_time_relations_bottom() );
+
+ /*list_of_relations=v.get_time_relations_top(); //nejak zmaknut aby to ziskal node constraints
+ for (list<TimeRelationRefNodePtrSet>::iterator it = list_of_relations.begin(); it != list_of_relations.end(); it++)
+ {
+ if ( it&.get_begin() != it&.get_end() ) node_constraints.push_back(it&);
+ }
+ list_of_relations=v.get_time_relations_bottom();
+ for (list<TimeRelationRefNodePtrSet>::iterator it = list_of_relations.begin(); it != list_of_relations.end(); it++)
+ {list<TimeRelationRefNodePtrSet>::iterator it = list_of_relations.begin(); it != list_of_relations.end(); it++
+ if ( it&.get_begin() != it&.get_end() ) node_constraints.push_back(it&);
+ }
+ //node_constraints=constraints_in_v; zjavne kravina :)*/
+
+
+ if (trav->m_open_constraints.empty())
+ {
+ trav->m_counter_of_blocks++;
+
+ //ukladat pociatocne uzly bloku
+ if (trav->m_counter_of_blocks!=0)
+ {
+ for (std::list<Block>::iterator it = trav->m_list_of_blocks.begin(); it != trav->m_list_of_blocks.end(); it++)
+ {
+ if (((*it).get_number()==trav->m_last_block)&&((*it).get_if_end()==0))
+ {
+ (*it).set_if_end(1);
+ }
+ }
+ }
+ Block* block= new Block(trav->m_counter_of_blocks, n, n, 0);
+ trav->m_list_of_blocks.push_back(*block);
+
+ trav->m_last_block=trav->m_counter_of_blocks;
+ trav->m_open_constraints.insert(node_constraints.begin(), node_constraints.end());
+ }
+ else
+ {
+ for (std::list<Block>::iterator it = trav->m_list_of_blocks.begin(); it != trav->m_list_of_blocks.end(); it++) //iterate blocks
+ {
+ if (((*it).get_if_end()==0)&&((*it).get_number()==trav->m_last_block)) //find the right one, and check if end node has been set
+ {
+ (*it).set_end(n); //if it hasn't, then set it
+ continue;
+ }
+ }
+ for (std::set<TimeRelationRefNodePtr>::iterator it = trav->m_open_constraints.begin(); it != trav->m_open_constraints.end(); it++)
+ {
+ for (std::set<TimeRelationRefNodePtr>::iterator it_2 = node_constraints.begin(); it_2 != node_constraints.end(); it_2++)
+ {
+ if (*it==*it_2)
+ {
+ trav->m_open_constraints.erase(it);
+ node_constraints.erase(it_2);
+ }
+ }
+ }
+ trav->m_open_constraints.insert(node_constraints.begin(), node_constraints.end());
+ }
+ }
+ else if (!(dynamic_cast<ConnectionNode*>(v)
+ || dynamic_cast<StartNode*>(v)
+ || dynamic_cast<EndNode*>(v)
+ || dynamic_cast<ConditionNode*>(v)))
+ {
+ throw std::runtime_error("Unknown type");
+ }
+
+}
+
+
+
Added: trunk/src/check/time/find_block.cpp~
===================================================================
--- trunk/src/check/time/find_block.cpp~ (rev 0)
+++ trunk/src/check/time/find_block.cpp~ 2010-03-07 21:26:40 UTC (rev 668)
@@ -0,0 +1,184 @@
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2010 Martin Vodila <fp...@ma...>
+ *
+ * $Id:
+ */
+
+
+#include "check/time/find_block.h"
+
+void MyTraverse::on_white_node_found(HMscNode* n)
+ {
+ //int last_block=trav.m_last_block;
+ //TimeRelationEventPtrList open_constraints=trav.m_open_constraints;
+ //counter_of_blocks=TraversAndBlocks::counter_of_blocks;
+
+ //n.found_with_block_number=last_block;
+
+ std::cout << "Tu sme este dosli-WNFL" << std::endl;
+
+ n->set_attribute<int>("found_with_block_number",trav->m_last_block);
+ //n.found_with_constraints=open_constraints;
+ n->set_attribute<TimeRelationRefNodePtrSet>("found_with_open_constraints",trav->m_open_constraints);
+ update_constraints(n);
+ }
+
+/*void MyTraverse::grey_node_found(HMscNode* n)
+{
+}
+
+void MyTraverse::black_node_found(HMscNode* n)
+{
+}*/
+
+void MyTraverse::on_node_finished(HMscNode* n)
+{
+ //int last_block=trav.m_last_block;
+ //TimeRelationEventPtrList open_constraints=trav.m_open_constraints;
+ //std::list<Block> list_of_blocks=trav.m_list_of_blocks;
+ for (std::list<Block>::iterator it = trav->m_list_of_blocks.begin(); it != trav->m_list_of_blocks.end(); it++) //iterate blocks
+ {
+ if (((*it).get_number()==trav->m_last_block) && ((*it).get_if_end()==0)) //find the right one, and check if end node has been set
+ {
+ (*it).set_end(dynamic_cast<ReferenceNode*>(n)); //if it hasn't, then set it
+ (*it).set_if_end(1);
+ continue;
+ }
+ }
+ trav->m_last_block=n->get_attribute<int>("found_with_block_number",0);
+ trav->m_open_constraints=n->get_attribute<TimeRelationRefNodePtrSet>("found_with_open_constraints",trav->m_open_constraints);
+ n->remove_attribute<int>("found_with_block_number");
+ n->remove_attribute<TimeRelationRefNodePtrSet>("found_with_open_constraints");
+}
+
+void MyTraverse::update_constraints(HMscNode* v)
+{
+ ReferenceNode* n= dynamic_cast<ReferenceNode*>(v);
+ TimeRelationRefNodePtrSet node_constraints;
+ TimeRelationRefNodePtrSet bottom;
+ TimeRelationRefNodePtrSet top;
+ //node_constraints=new TimeRelationRefNodePtrSet();
+ node_constraints.erase(node_constraints.begin(), node_constraints.end());
+
+ if (n!=NULL)
+ {
+
+/* std::cout << "Tu sme este dosli2" << std::endl;
+
+ n->get_time_relations_bottom();
+
+ std::cout << "Tu sme este dosli3" << std::endl;
+
+ bottom= n->get_time_relations_bottom();
+ top= n->get_time_relations_top();
+
+ for (std::set<TimeRelationRefNodePtr>::iterator it = top.begin(); it != top.end(); it++)
+ {
+ node_constraints.insert(*it);
+ }
+
+ for (std::set<TimeRelationRefNodePtr>::iterator it = bottom.begin(); it != bottom.end(); it++)
+ {
+ node_constraints.insert(*it);
+ }*/
+
+ node_constraints.insert(n->get_time_relations_top().begin(), n->get_time_relations_top().end()); //TODO tunak to hadze seg fault
+
+ //std::list<TimeRelationEvent> node_constraints;
+ //std::list<TimeRelationEvent> list_of_relations;
+ //int last_block=TraversAndMarkBlocks::last_block;
+ //TimeRelationEventPtrList open_constraints=TraversAndMarkBlocks::open_constraints;
+ //int counter_of_blocks=TraversAndMarkBlocks::counter_of_blocks;
+ //std::list<Block> list_of_blocks=TraversAndMarkBlocks::list_of_blocks;
+
+ std::cout << "Tu sme este dosli-4" << std::endl;
+
+ node_constraints.insert(n->get_time_relations_bottom().begin(), n->get_time_relations_bottom().end());
+
+ //node_constraints=v->get_time_relations_top();
+ //node_constraints.splice( node_constraints.end() , v->get_time_relations_bottom() );
+
+ /*list_of_relations=v.get_time_relations_top(); //nejak zmaknut aby to ziskal node constraints
+ for (list<TimeRelationRefNodePtrSet>::iterator it = list_of_relations.begin(); it != list_of_relations.end(); it++)
+ {
+ if ( it&.get_begin() != it&.get_end() ) node_constraints.push_back(it&);
+ }
+ list_of_relations=v.get_time_relations_bottom();
+ for (list<TimeRelationRefNodePtrSet>::iterator it = list_of_relations.begin(); it != list_of_relations.end(); it++)
+ {list<TimeRelationRefNodePtrSet>::iterator it = list_of_relations.begin(); it != list_of_relations.end(); it++
+ if ( it&.get_begin() != it&.get_end() ) node_constraints.push_back(it&);
+ }
+ //node_constraints=constraints_in_v; zjavne kravina :)*/
+
+ std::cout << "Tu sme este dosli-5" << std::endl;
+
+ if (trav->m_open_constraints.empty())
+ {
+ trav->m_counter_of_blocks++;
+
+ //ukladat pociatocne uzly bloku
+ if (trav->m_counter_of_blocks!=0)
+ {
+ for (std::list<Block>::iterator it = trav->m_list_of_blocks.begin(); it != trav->m_list_of_blocks.end(); it++)
+ {
+ if (((*it).get_number()==trav->m_last_block)&&((*it).get_if_end()==0))
+ {
+ (*it).set_if_end(1);
+ }
+ }
+ }
+ Block* block= new Block(trav->m_counter_of_blocks, n, n, 0);
+ trav->m_list_of_blocks.push_back(*block);
+
+ trav->m_last_block=trav->m_counter_of_blocks;
+ trav->m_open_constraints.insert(node_constraints.begin(), node_constraints.end());
+ }
+ else
+ {
+ for (std::list<Block>::iterator it = trav->m_list_of_blocks.begin(); it != trav->m_list_of_blocks.end(); it++) //iterate blocks
+ {
+ if (((*it).get_if_end()==0)&&((*it).get_number()==trav->m_last_block)) //find the right one, and check if end node has been set
+ {
+ (*it).set_end(n); //if it hasn't, then set it
+ continue;
+ }
+ }
+ for (std::set<TimeRelationRefNodePtr>::iterator it = trav->m_open_constraints.begin(); it != trav->m_open_constraints.end(); it++)
+ {
+ for (std::set<TimeRelationRefNodePtr>::iterator it_2 = node_constraints.begin(); it_2 != node_constraints.end(); it_2++)
+ {
+ if (*it==*it_2)
+ {
+ trav->m_open_constraints.erase(it);
+ node_constraints.erase(it_2);
+ }
+ }
+ }
+ trav->m_open_constraints.insert(node_constraints.begin(), node_constraints.end());
+ }
+ std::cout << "Tu sme este dosli" << std::endl;
+ }
+ else if (!(dynamic_cast<ConnectionNode*>(v)
+ || dynamic_cast<StartNode*>(v)
+ || dynamic_cast<EndNode*>(v)
+ || dynamic_cast<ConditionNode*>(v)))
+ {
+ throw std::runtime_error("Unknown type");
+ }
+
+}
+
+
+
Added: trunk/src/check/time/find_block.h
===================================================================
--- trunk/src/check/time/find_block.h (rev 0)
+++ trunk/src/check/time/find_block.h 2010-03-07 21:26:40 UTC (rev 668)
@@ -0,0 +1,147 @@
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2010 Martin Vodila <fp...@ma...>
+ *
+ * $Id:
+ */
+
+#ifndef _FIND_BLOCK_H
+#define _FIND_BLOCK_H
+
+#include "data/time.h"
+#include "data/msc.h"
+#include "data/dfs_bmsc_graph_traverser.h"
+#include "check/pseudocode/msc_duplicators.h"
+
+#include <list>
+
+class TraverseAndMarkBlocks;
+
+class MyTraverse:public WhiteNodeFoundListener, public NodeFinishedListener{
+
+public:
+ TraverseAndMarkBlocks* trav;
+
+ MyTraverse() {};
+
+ MyTraverse(TraverseAndMarkBlocks* t) {
+ trav=t;
+ }
+ ~MyTraverse() {};
+
+ void on_white_node_found(HMscNode* n);
+ //void grey_node_found(HMscNode* n);
+ //void black_node_found(HMscNode* n);
+ void on_node_finished(HMscNode* n);
+ void update_constraints(HMscNode* n);
+};
+
+
+
+
+class Block
+{
+private:
+int number;
+ReferenceNode* begin;
+ReferenceNode* end;
+bool if_end;
+public:
+ Block(int n, ReferenceNode* begin, ReferenceNode* end, bool if_end) {
+ this->number=n;
+ this->begin=begin;
+ this->end=end;
+ this->if_end=if_end;
+ }
+ int get_number() {
+ return this->number;
+ }
+ void set_number(int n) {
+ this->number=n;
+ }
+ ReferenceNode* get_begin() {
+ return this->begin;
+ }
+ void set_begin(ReferenceNode* b) {
+ this->begin=b;
+ }
+ ReferenceNode* get_end() {
+ return this->end;
+ }
+ void set_end(ReferenceNode* e) {
+ this->end=e;
+ }
+ bool get_if_end() {
+ return this->if_end;
+ }
+ void set_if_end(bool i) {
+ this->if_end=i;
+ }
+};
+
+/* nakoniec nie je potrebna tato trieda :)
+class MscGraphBlocks
+{
+private:
+
+//list dvojic (cislo, zaciatok, koniec)
+list<Block> list_of_blocks;
+
+public:
+
+ Block get_i-th_block(int i) { //vrati smernik na blok
+ for (list<Block>::iterator it = list_of_blocks.begin(); it != list_of_blocks.end(); it++) {
+ if (it.get_number()==i) return it;
+ }
+ }
+ void add_block(Block block) { //prida blok do zoznamu
+ list_of_blocks.push_back(block);
+ }
+ void remove_block(Block block) { //odstrani blok zo zoznamu
+ list_of_blocks.remove(block);
+ }
+}*/
+
+
+class TraverseAndMarkBlocks
+{
+private:
+
+public:
+ std::list<Block> m_list_of_blocks;
+ int m_last_block;
+ int m_counter_of_blocks;
+ TimeRelationRefNodePtrSet m_open_constraints;
+ //std::list<TimeRelationEvent> open_constraints; //pozret si time relation event
+
+ TraverseAndMarkBlocks() {
+ this->m_last_block=0;
+ this->m_counter_of_blocks=0;
+ }
+
+ void travers_and_mark_blocks(HMscPtr m_msc) //dfs prehladanie a cez listener rata k uzlu prislusny blok
+ {
+ //BMscGraphDuplicator* duplicator= new BMscGraphDuplicator();
+ //m_msc=duplicator->duplicate_hmsc(m_msc);
+ DFSBMscGraphTraverser* traverser_block= new DFSBMscGraphTraverser();
+ MyTraverse* my_trav= new MyTraverse(this);
+ traverser_block->add_white_node_found_listener(my_trav);
+ traverser_block->add_node_finished_listener(my_trav);
+ //list_of_blocks= new MscGraphBlock();
+ traverser_block->traverse(m_msc);
+ }
+};
+
+#endif /* _FIND_BLOCK_H */
+
Added: trunk/src/check/time/find_block.h~
===================================================================
--- trunk/src/check/time/find_block.h~ (rev 0)
+++ trunk/src/check/time/find_block.h~ 2010-03-07 21:26:40 UTC (rev 668)
@@ -0,0 +1,148 @@
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2010 Martin Vodila <fp...@ma...>
+ *
+ * $Id:
+ */
+
+#ifndef _FIND_BLOCK_H
+#define _FIND_BLOCK_H
+
+#include "data/time.h"
+#include "data/msc.h"
+#include "data/dfs_bmsc_graph_traverser.h"
+#include "check/pseudocode/msc_duplicators.h"
+#include "find_block.moc"
+
+#include <list>
+
+class TraverseAndMarkBlocks;
+
+class MyTraverse:public WhiteNodeFoundListener, public NodeFinishedListener{
+
+public:
+ TraverseAndMarkBlocks* trav;
+
+ MyTraverse() {};
+
+ MyTraverse(TraverseAndMarkBlocks* t) {
+ trav=t;
+ }
+ ~MyTraverse() {};
+
+ void on_white_node_found(HMscNode* n);
+ //void grey_node_found(HMscNode* n);
+ //void black_node_found(HMscNode* n);
+ void on_node_finished(HMscNode* n);
+ void update_constraints(HMscNode* n);
+};
+
+
+
+
+class Block
+{
+private:
+int number;
+ReferenceNode* begin;
+ReferenceNode* end;
+bool if_end;
+public:
+ Block(int n, ReferenceNode* begin, ReferenceNode* end, bool if_end) {
+ this->number=n;
+ this->begin=begin;
+ this->end=end;
+ this->if_end=if_end;
+ }
+ int get_number() {
+ return this->number;
+ }
+ void set_number(int n) {
+ this->number=n;
+ }
+ ReferenceNode* get_begin() {
+ return this->begin;
+ }
+ void set_begin(ReferenceNode* b) {
+ this->begin=b;
+ }
+ ReferenceNode* get_end() {
+ return this->end;
+ }
+ void set_end(ReferenceNode* e) {
+ this->end=e;
+ }
+ bool get_if_end() {
+ return this->if_end;
+ }
+ void set_if_end(bool i) {
+ this->if_end=i;
+ }
+};
+
+/* nakoniec nie je potrebna tato trieda :)
+class MscGraphBlocks
+{
+private:
+
+//list dvojic (cislo, zaciatok, koniec)
+list<Block> list_of_blocks;
+
+public:
+
+ Block get_i-th_block(int i) { //vrati smernik na blok
+ for (list<Block>::iterator it = list_of_blocks.begin(); it != list_of_blocks.end(); it++) {
+ if (it.get_number()==i) return it;
+ }
+ }
+ void add_block(Block block) { //prida blok do zoznamu
+ list_of_blocks.push_back(block);
+ }
+ void remove_block(Block block) { //odstrani blok zo zoznamu
+ list_of_blocks.remove(block);
+ }
+}*/
+
+
+class TraverseAndMarkBlocks
+{
+private:
+
+public:
+ std::list<Block> m_list_of_blocks;
+ int m_last_block;
+ int m_counter_of_blocks;
+ TimeRelationRefNodePtrSet m_open_constraints;
+ //std::list<TimeRelationEvent> open_constraints; //pozret si time relation event
+
+ TraverseAndMarkBlocks() {
+ this->m_last_block=0;
+ this->m_counter_of_blocks=0;
+ }
+
+ void travers_and_mark_blocks(HMscPtr m_msc) //dfs prehladanie a cez listener rata k uzlu prislusny blok
+ {
+ //BMscGraphDuplicator* duplicator= new BMscGraphDuplicator();
+ //m_msc=duplicator->duplicate_hmsc(m_msc);
+ DFSBMscGraphTraverser* traverser_block= new DFSBMscGraphTraverser();
+ MyTraverse* my_trav= new MyTraverse(this);
+ traverser_block->add_white_node_found_listener(my_trav);
+ traverser_block->add_node_finished_listener(my_trav);
+ //list_of_blocks= new MscGraphBlock();
+ traverser_block->traverse(m_msc);
+ }
+};
+
+#endif /* _FIND_BLOCK_H */
+
Modified: trunk/tests/CMakeLists.txt
===================================================================
--- trunk/tests/CMakeLists.txt 2010-03-06 12:19:42 UTC (rev 667)
+++ trunk/tests/CMakeLists.txt 2010-03-07 21:26:40 UTC (rev 668)
@@ -56,10 +56,26 @@
TARGET_LINK_LIBRARIES(acyclic_checker_test
scorder
scmsc
+ sctime
scpseudocode
)
ADD_TEST(acyclic_checker ${EXECUTABLE_OUTPUT_PATH}/acyclic_checker_test)
+
+
+ADD_EXECUTABLE(find_block_test
+ find_block_test.cpp
+)
+TARGET_LINK_LIBRARIES(find_block_test
+ scmsc
+ sctime
+ scpseudocode
+ scorder
+)
+ADD_TEST(find_block ${EXECUTABLE_OUTPUT_PATH}/find_block_test)
+
+
+
ADD_EXECUTABLE(race_checker_test
race_checker_test.cpp
)
@@ -198,6 +214,8 @@
)
ENDIF(ANTLR_FOUND)
+
+
#ADD_EXECUTABLE(duplicator_test
# duplicator_test.cpp
Added: trunk/tests/acyclic_checker_test
===================================================================
(Binary files differ)
Property changes on: trunk/tests/acyclic_checker_test
___________________________________________________________________
Added: svn:executable
+ *
Added: svn:mime-type
+ application/octet-stream
Added: trunk/tests/find_block_test.cpp
===================================================================
--- trunk/tests/find_block_test.cpp (rev 0)
+++ trunk/tests/find_block_test.cpp 2010-03-07 21:26:40 UTC (rev 668)
@@ -0,0 +1,78 @@
+
+
+#include "data/msc.h"
+#include "check/time/find_block.h"
+#include "check/time/tightening.h"
+#include "check/liveness/deadlock_checker.h"
+#include <string>
+#include <iostream>
+
+
+int main(int argc, char** argv) {
+
+
+ std::cout << "Test of find_block: " << std::endl;
+ std::cout << "h1: " << std::endl;
+ std::cout << " start " << std::endl;
+ std::cout << " | " << std::endl;
+ std::cout << " p1 " << std::endl;
+ std::cout << " / \\ " << std::endl;
+ std::cout << " p2 p3 " << std::endl;
+ std::cout << " | \\ " << std::endl;
+ std::cout << " p5 p4 " << std::endl;
+ std::cout << " | / " << std::endl;
+ std::cout << " \\ / " << std::endl;
+ std::cout << " p6 " << std::endl;
+ std::cout << " | " << std::endl;
+ std::cout << " end1 " << std::endl;
+
+ HMscPtr h1(new HMsc(L"h1"));
+
+
+
+ StartNodePtr start1 = new StartNode();
+ h1->set_start(start1);
+ EndNodePtr end1(new EndNode);
+ h1->add_node(end1);
+ ReferenceNodePtr p1(new ReferenceNode());h1->add_node(p1);
+ ReferenceNodePtr p2(new ReferenceNode());h1->add_node(p2);
+ ReferenceNodePtr p3(new ReferenceNode());h1->add_node(p3);
+ ReferenceNodePtr p4(new ReferenceNode());h1->add_node(p4);
+ ReferenceNodePtr p5(new ReferenceNode());h1->add_node(p5);
+ ReferenceNodePtr p6(new ReferenceNode());h1->add_node(p6);
+
+
+ start1->add_successor(p1.get());
+ p1->add_successor(p2.get());
+ p1->add_successor(p3.get());
+ p3->add_successor(p4.get());
+ p2->add_successor(p5.get());
+ p5->add_successor(p6.get());
+ p4->add_successor(p6.get());
+ p6->add_successor(end1.get());
+
+
+ MscTimeIntervalD in6(10,20);
+ MscTimeIntervalSetD ins1;
+ ins1.insert(in6);
+
+/* MscTimeIntervalD in7(10,20);
+ MscTimeIntervalSetD ins2;
+ ins2.insert(in7); */
+
+ TimeRelationRefNodePtr rel1a = new TimeRelationRefNode(ins1);
+ rel1a->glue_ref_nodes(0,p1.get(),0,p6.get());
+
+/* TimeRelationRefNodePtr rel1a2 = new TimeRelationRefNode(ins2);
+ rel1a2->glue_ref_nodes(0,p3.get(),0,p4.get()); */
+
+ TraverseAndMarkBlocks* trav_mark = new TraverseAndMarkBlocks();
+ trav_mark->travers_and_mark_blocks(h1); //TODO tu sa tiez robilo
+
+ for (std::list<Block>::iterator it = trav_mark->m_list_of_blocks.begin(); it != trav_mark->m_list_of_blocks.end(); it++)
+ {
+ std::cout << "Blok:" << (*it).get_number() << std::endl;
+ }
+ return 0;
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mar...@us...> - 2010-03-07 21:31:43
|
Revision: 669
http://scstudio.svn.sourceforge.net/scstudio/?rev=669&view=rev
Author: martinnrt
Date: 2010-03-07 21:31:37 +0000 (Sun, 07 Mar 2010)
Log Message:
-----------
Removed Paths:
-------------
trunk/src/check/time/find_block.cpp~
trunk/src/check/time/find_block.h~
trunk/tests/acyclic_checker_test
Deleted: trunk/src/check/time/find_block.cpp~
===================================================================
--- trunk/src/check/time/find_block.cpp~ 2010-03-07 21:26:40 UTC (rev 668)
+++ trunk/src/check/time/find_block.cpp~ 2010-03-07 21:31:37 UTC (rev 669)
@@ -1,184 +0,0 @@
-/*
- * scstudio - Sequence Chart Studio
- * http://scstudio.sourceforge.net
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * Copyright (c) 2010 Martin Vodila <fp...@ma...>
- *
- * $Id:
- */
-
-
-#include "check/time/find_block.h"
-
-void MyTraverse::on_white_node_found(HMscNode* n)
- {
- //int last_block=trav.m_last_block;
- //TimeRelationEventPtrList open_constraints=trav.m_open_constraints;
- //counter_of_blocks=TraversAndBlocks::counter_of_blocks;
-
- //n.found_with_block_number=last_block;
-
- std::cout << "Tu sme este dosli-WNFL" << std::endl;
-
- n->set_attribute<int>("found_with_block_number",trav->m_last_block);
- //n.found_with_constraints=open_constraints;
- n->set_attribute<TimeRelationRefNodePtrSet>("found_with_open_constraints",trav->m_open_constraints);
- update_constraints(n);
- }
-
-/*void MyTraverse::grey_node_found(HMscNode* n)
-{
-}
-
-void MyTraverse::black_node_found(HMscNode* n)
-{
-}*/
-
-void MyTraverse::on_node_finished(HMscNode* n)
-{
- //int last_block=trav.m_last_block;
- //TimeRelationEventPtrList open_constraints=trav.m_open_constraints;
- //std::list<Block> list_of_blocks=trav.m_list_of_blocks;
- for (std::list<Block>::iterator it = trav->m_list_of_blocks.begin(); it != trav->m_list_of_blocks.end(); it++) //iterate blocks
- {
- if (((*it).get_number()==trav->m_last_block) && ((*it).get_if_end()==0)) //find the right one, and check if end node has been set
- {
- (*it).set_end(dynamic_cast<ReferenceNode*>(n)); //if it hasn't, then set it
- (*it).set_if_end(1);
- continue;
- }
- }
- trav->m_last_block=n->get_attribute<int>("found_with_block_number",0);
- trav->m_open_constraints=n->get_attribute<TimeRelationRefNodePtrSet>("found_with_open_constraints",trav->m_open_constraints);
- n->remove_attribute<int>("found_with_block_number");
- n->remove_attribute<TimeRelationRefNodePtrSet>("found_with_open_constraints");
-}
-
-void MyTraverse::update_constraints(HMscNode* v)
-{
- ReferenceNode* n= dynamic_cast<ReferenceNode*>(v);
- TimeRelationRefNodePtrSet node_constraints;
- TimeRelationRefNodePtrSet bottom;
- TimeRelationRefNodePtrSet top;
- //node_constraints=new TimeRelationRefNodePtrSet();
- node_constraints.erase(node_constraints.begin(), node_constraints.end());
-
- if (n!=NULL)
- {
-
-/* std::cout << "Tu sme este dosli2" << std::endl;
-
- n->get_time_relations_bottom();
-
- std::cout << "Tu sme este dosli3" << std::endl;
-
- bottom= n->get_time_relations_bottom();
- top= n->get_time_relations_top();
-
- for (std::set<TimeRelationRefNodePtr>::iterator it = top.begin(); it != top.end(); it++)
- {
- node_constraints.insert(*it);
- }
-
- for (std::set<TimeRelationRefNodePtr>::iterator it = bottom.begin(); it != bottom.end(); it++)
- {
- node_constraints.insert(*it);
- }*/
-
- node_constraints.insert(n->get_time_relations_top().begin(), n->get_time_relations_top().end()); //TODO tunak to hadze seg fault
-
- //std::list<TimeRelationEvent> node_constraints;
- //std::list<TimeRelationEvent> list_of_relations;
- //int last_block=TraversAndMarkBlocks::last_block;
- //TimeRelationEventPtrList open_constraints=TraversAndMarkBlocks::open_constraints;
- //int counter_of_blocks=TraversAndMarkBlocks::counter_of_blocks;
- //std::list<Block> list_of_blocks=TraversAndMarkBlocks::list_of_blocks;
-
- std::cout << "Tu sme este dosli-4" << std::endl;
-
- node_constraints.insert(n->get_time_relations_bottom().begin(), n->get_time_relations_bottom().end());
-
- //node_constraints=v->get_time_relations_top();
- //node_constraints.splice( node_constraints.end() , v->get_time_relations_bottom() );
-
- /*list_of_relations=v.get_time_relations_top(); //nejak zmaknut aby to ziskal node constraints
- for (list<TimeRelationRefNodePtrSet>::iterator it = list_of_relations.begin(); it != list_of_relations.end(); it++)
- {
- if ( it&.get_begin() != it&.get_end() ) node_constraints.push_back(it&);
- }
- list_of_relations=v.get_time_relations_bottom();
- for (list<TimeRelationRefNodePtrSet>::iterator it = list_of_relations.begin(); it != list_of_relations.end(); it++)
- {list<TimeRelationRefNodePtrSet>::iterator it = list_of_relations.begin(); it != list_of_relations.end(); it++
- if ( it&.get_begin() != it&.get_end() ) node_constraints.push_back(it&);
- }
- //node_constraints=constraints_in_v; zjavne kravina :)*/
-
- std::cout << "Tu sme este dosli-5" << std::endl;
-
- if (trav->m_open_constraints.empty())
- {
- trav->m_counter_of_blocks++;
-
- //ukladat pociatocne uzly bloku
- if (trav->m_counter_of_blocks!=0)
- {
- for (std::list<Block>::iterator it = trav->m_list_of_blocks.begin(); it != trav->m_list_of_blocks.end(); it++)
- {
- if (((*it).get_number()==trav->m_last_block)&&((*it).get_if_end()==0))
- {
- (*it).set_if_end(1);
- }
- }
- }
- Block* block= new Block(trav->m_counter_of_blocks, n, n, 0);
- trav->m_list_of_blocks.push_back(*block);
-
- trav->m_last_block=trav->m_counter_of_blocks;
- trav->m_open_constraints.insert(node_constraints.begin(), node_constraints.end());
- }
- else
- {
- for (std::list<Block>::iterator it = trav->m_list_of_blocks.begin(); it != trav->m_list_of_blocks.end(); it++) //iterate blocks
- {
- if (((*it).get_if_end()==0)&&((*it).get_number()==trav->m_last_block)) //find the right one, and check if end node has been set
- {
- (*it).set_end(n); //if it hasn't, then set it
- continue;
- }
- }
- for (std::set<TimeRelationRefNodePtr>::iterator it = trav->m_open_constraints.begin(); it != trav->m_open_constraints.end(); it++)
- {
- for (std::set<TimeRelationRefNodePtr>::iterator it_2 = node_constraints.begin(); it_2 != node_constraints.end(); it_2++)
- {
- if (*it==*it_2)
- {
- trav->m_open_constraints.erase(it);
- node_constraints.erase(it_2);
- }
- }
- }
- trav->m_open_constraints.insert(node_constraints.begin(), node_constraints.end());
- }
- std::cout << "Tu sme este dosli" << std::endl;
- }
- else if (!(dynamic_cast<ConnectionNode*>(v)
- || dynamic_cast<StartNode*>(v)
- || dynamic_cast<EndNode*>(v)
- || dynamic_cast<ConditionNode*>(v)))
- {
- throw std::runtime_error("Unknown type");
- }
-
-}
-
-
-
Deleted: trunk/src/check/time/find_block.h~
===================================================================
--- trunk/src/check/time/find_block.h~ 2010-03-07 21:26:40 UTC (rev 668)
+++ trunk/src/check/time/find_block.h~ 2010-03-07 21:31:37 UTC (rev 669)
@@ -1,148 +0,0 @@
-/*
- * scstudio - Sequence Chart Studio
- * http://scstudio.sourceforge.net
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * Copyright (c) 2010 Martin Vodila <fp...@ma...>
- *
- * $Id:
- */
-
-#ifndef _FIND_BLOCK_H
-#define _FIND_BLOCK_H
-
-#include "data/time.h"
-#include "data/msc.h"
-#include "data/dfs_bmsc_graph_traverser.h"
-#include "check/pseudocode/msc_duplicators.h"
-#include "find_block.moc"
-
-#include <list>
-
-class TraverseAndMarkBlocks;
-
-class MyTraverse:public WhiteNodeFoundListener, public NodeFinishedListener{
-
-public:
- TraverseAndMarkBlocks* trav;
-
- MyTraverse() {};
-
- MyTraverse(TraverseAndMarkBlocks* t) {
- trav=t;
- }
- ~MyTraverse() {};
-
- void on_white_node_found(HMscNode* n);
- //void grey_node_found(HMscNode* n);
- //void black_node_found(HMscNode* n);
- void on_node_finished(HMscNode* n);
- void update_constraints(HMscNode* n);
-};
-
-
-
-
-class Block
-{
-private:
-int number;
-ReferenceNode* begin;
-ReferenceNode* end;
-bool if_end;
-public:
- Block(int n, ReferenceNode* begin, ReferenceNode* end, bool if_end) {
- this->number=n;
- this->begin=begin;
- this->end=end;
- this->if_end=if_end;
- }
- int get_number() {
- return this->number;
- }
- void set_number(int n) {
- this->number=n;
- }
- ReferenceNode* get_begin() {
- return this->begin;
- }
- void set_begin(ReferenceNode* b) {
- this->begin=b;
- }
- ReferenceNode* get_end() {
- return this->end;
- }
- void set_end(ReferenceNode* e) {
- this->end=e;
- }
- bool get_if_end() {
- return this->if_end;
- }
- void set_if_end(bool i) {
- this->if_end=i;
- }
-};
-
-/* nakoniec nie je potrebna tato trieda :)
-class MscGraphBlocks
-{
-private:
-
-//list dvojic (cislo, zaciatok, koniec)
-list<Block> list_of_blocks;
-
-public:
-
- Block get_i-th_block(int i) { //vrati smernik na blok
- for (list<Block>::iterator it = list_of_blocks.begin(); it != list_of_blocks.end(); it++) {
- if (it.get_number()==i) return it;
- }
- }
- void add_block(Block block) { //prida blok do zoznamu
- list_of_blocks.push_back(block);
- }
- void remove_block(Block block) { //odstrani blok zo zoznamu
- list_of_blocks.remove(block);
- }
-}*/
-
-
-class TraverseAndMarkBlocks
-{
-private:
-
-public:
- std::list<Block> m_list_of_blocks;
- int m_last_block;
- int m_counter_of_blocks;
- TimeRelationRefNodePtrSet m_open_constraints;
- //std::list<TimeRelationEvent> open_constraints; //pozret si time relation event
-
- TraverseAndMarkBlocks() {
- this->m_last_block=0;
- this->m_counter_of_blocks=0;
- }
-
- void travers_and_mark_blocks(HMscPtr m_msc) //dfs prehladanie a cez listener rata k uzlu prislusny blok
- {
- //BMscGraphDuplicator* duplicator= new BMscGraphDuplicator();
- //m_msc=duplicator->duplicate_hmsc(m_msc);
- DFSBMscGraphTraverser* traverser_block= new DFSBMscGraphTraverser();
- MyTraverse* my_trav= new MyTraverse(this);
- traverser_block->add_white_node_found_listener(my_trav);
- traverser_block->add_node_finished_listener(my_trav);
- //list_of_blocks= new MscGraphBlock();
- traverser_block->traverse(m_msc);
- }
-};
-
-#endif /* _FIND_BLOCK_H */
-
Deleted: trunk/tests/acyclic_checker_test
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mar...@us...> - 2010-03-08 10:05:57
|
Revision: 670
http://scstudio.svn.sourceforge.net/scstudio/?rev=670&view=rev
Author: martinnrt
Date: 2010-03-08 10:05:47 +0000 (Mon, 08 Mar 2010)
Log Message:
-----------
Modified Paths:
--------------
trunk/src/check/time/find_block.cpp
trunk/src/check/time/find_block.h
trunk/tests/find_block_test.cpp
Modified: trunk/src/check/time/find_block.cpp
===================================================================
--- trunk/src/check/time/find_block.cpp 2010-03-07 21:31:37 UTC (rev 669)
+++ trunk/src/check/time/find_block.cpp 2010-03-08 10:05:47 UTC (rev 670)
@@ -1,178 +1,90 @@
-/*
- * scstudio - Sequence Chart Studio
- * http://scstudio.sourceforge.net
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * Copyright (c) 2010 Martin Vodila <fp...@ma...>
- *
- * $Id:
- */
-
#include "check/time/find_block.h"
void MyTraverse::on_white_node_found(HMscNode* n)
- {
- //int last_block=trav.m_last_block;
- //TimeRelationEventPtrList open_constraints=trav.m_open_constraints;
- //counter_of_blocks=TraversAndBlocks::counter_of_blocks;
-
- //n.found_with_block_number=last_block;
-
- n->set_attribute<int>("found_with_block_number",trav->m_last_block);
- //n.found_with_constraints=open_constraints;
- n->set_attribute<TimeRelationRefNodePtrSet>("found_with_open_constraints",trav->m_open_constraints);
- update_constraints(n);
- }
-
-/*void MyTraverse::grey_node_found(HMscNode* n)
{
+ n->set_attribute<int>("found_with_block_number",trav->m_last_block);
+ n->set_attribute<TimeRelationRefNodePtrSet>("found_with_open_constraints",trav->m_open_constraints);
+ update_constraints(n);
}
-void MyTraverse::black_node_found(HMscNode* n)
-{
-}*/
-
void MyTraverse::on_node_finished(HMscNode* n)
{
- //int last_block=trav.m_last_block;
- //TimeRelationEventPtrList open_constraints=trav.m_open_constraints;
- //std::list<Block> list_of_blocks=trav.m_list_of_blocks;
- for (std::list<Block>::iterator it = trav->m_list_of_blocks.begin(); it != trav->m_list_of_blocks.end(); it++) //iterate blocks
- {
- if (((*it).get_number()==trav->m_last_block) && ((*it).get_if_end()==0)) //find the right one, and check if end node has been set
- {
- (*it).set_end(dynamic_cast<ReferenceNode*>(n)); //if it hasn't, then set it
- (*it).set_if_end(1);
- continue;
- }
- }
- trav->m_last_block=n->get_attribute<int>("found_with_block_number",0);
- trav->m_open_constraints=n->get_attribute<TimeRelationRefNodePtrSet>("found_with_open_constraints",trav->m_open_constraints);
- n->remove_attribute<int>("found_with_block_number");
- n->remove_attribute<TimeRelationRefNodePtrSet>("found_with_open_constraints");
+ for (std::list<Block>::iterator it = trav->m_list_of_blocks.begin(); it != trav->m_list_of_blocks.end(); it++) //iterate blocks
+ {
+ if (((*it).get_number()==trav->m_last_block) && ((*it).get_if_end()==0)) //find the right one, and check if end node has been set
+ {
+ (*it).set_end(dynamic_cast<ReferenceNode*>(n)); //if it hasn't, then set it
+ (*it).set_if_end(1); //mark block, now we know that end node of block has been set and won't be changed
+ continue;
+ }
+ }
+ trav->m_last_block=n->get_attribute<int>("found_with_block_number",0);
+ trav->m_open_constraints=n->get_attribute<TimeRelationRefNodePtrSet>("found_with_open_constraints",trav->m_open_constraints);
+ n->remove_attribute<int>("found_with_block_number");
+ n->remove_attribute<TimeRelationRefNodePtrSet>("found_with_open_constraints");
}
void MyTraverse::update_constraints(HMscNode* v)
{
- ReferenceNode* n= dynamic_cast<ReferenceNode*>(v);
- TimeRelationRefNodePtrSet node_constraints;
- TimeRelationRefNodePtrSet bottom;
- TimeRelationRefNodePtrSet top;
- //node_constraints=new TimeRelationRefNodePtrSet();
- node_constraints.erase(node_constraints.begin(), node_constraints.end());
+ ReferenceNode* n= dynamic_cast<ReferenceNode*>(v);
+ TimeRelationRefNodePtrSet node_constraints;
+ node_constraints.erase(node_constraints.begin(), node_constraints.end());
- if (n!=NULL)
- {
-
-/* std::cout << "Tu sme este dosli2" << std::endl;
-
- n->get_time_relations_bottom();
-
- std::cout << "Tu sme este dosli3" << std::endl;
-
- bottom= n->get_time_relations_bottom();
- top= n->get_time_relations_top();
-
- for (std::set<TimeRelationRefNodePtr>::iterator it = top.begin(); it != top.end(); it++)
- {
- node_constraints.insert(*it);
- }
-
- for (std::set<TimeRelationRefNodePtr>::iterator it = bottom.begin(); it != bottom.end(); it++)
- {
- node_constraints.insert(*it);
- }*/
-
- node_constraints.insert(n->get_time_relations_top().begin(), n->get_time_relations_top().end()); //TODO tunak to hadze seg fault
-
- //std::list<TimeRelationEvent> node_constraints;
- //std::list<TimeRelationEvent> list_of_relations;
- //int last_block=TraversAndMarkBlocks::last_block;
- //TimeRelationEventPtrList open_constraints=TraversAndMarkBlocks::open_constraints;
- //int counter_of_blocks=TraversAndMarkBlocks::counter_of_blocks;
- //std::list<Block> list_of_blocks=TraversAndMarkBlocks::list_of_blocks;
-
-
- node_constraints.insert(n->get_time_relations_bottom().begin(), n->get_time_relations_bottom().end());
-
- //node_constraints=v->get_time_relations_top();
- //node_constraints.splice( node_constraints.end() , v->get_time_relations_bottom() );
-
- /*list_of_relations=v.get_time_relations_top(); //nejak zmaknut aby to ziskal node constraints
- for (list<TimeRelationRefNodePtrSet>::iterator it = list_of_relations.begin(); it != list_of_relations.end(); it++)
- {
- if ( it&.get_begin() != it&.get_end() ) node_constraints.push_back(it&);
- }
- list_of_relations=v.get_time_relations_bottom();
- for (list<TimeRelationRefNodePtrSet>::iterator it = list_of_relations.begin(); it != list_of_relations.end(); it++)
- {list<TimeRelationRefNodePtrSet>::iterator it = list_of_relations.begin(); it != list_of_relations.end(); it++
- if ( it&.get_begin() != it&.get_end() ) node_constraints.push_back(it&);
- }
- //node_constraints=constraints_in_v; zjavne kravina :)*/
-
-
- if (trav->m_open_constraints.empty())
- {
- trav->m_counter_of_blocks++;
-
- //ukladat pociatocne uzly bloku
- if (trav->m_counter_of_blocks!=0)
- {
- for (std::list<Block>::iterator it = trav->m_list_of_blocks.begin(); it != trav->m_list_of_blocks.end(); it++)
- {
- if (((*it).get_number()==trav->m_last_block)&&((*it).get_if_end()==0))
- {
- (*it).set_if_end(1);
- }
- }
- }
- Block* block= new Block(trav->m_counter_of_blocks, n, n, 0);
- trav->m_list_of_blocks.push_back(*block);
-
- trav->m_last_block=trav->m_counter_of_blocks;
- trav->m_open_constraints.insert(node_constraints.begin(), node_constraints.end());
- }
- else
- {
- for (std::list<Block>::iterator it = trav->m_list_of_blocks.begin(); it != trav->m_list_of_blocks.end(); it++) //iterate blocks
- {
- if (((*it).get_if_end()==0)&&((*it).get_number()==trav->m_last_block)) //find the right one, and check if end node has been set
- {
- (*it).set_end(n); //if it hasn't, then set it
- continue;
- }
- }
- for (std::set<TimeRelationRefNodePtr>::iterator it = trav->m_open_constraints.begin(); it != trav->m_open_constraints.end(); it++)
- {
- for (std::set<TimeRelationRefNodePtr>::iterator it_2 = node_constraints.begin(); it_2 != node_constraints.end(); it_2++)
- {
- if (*it==*it_2)
- {
- trav->m_open_constraints.erase(it);
- node_constraints.erase(it_2);
- }
- }
- }
- trav->m_open_constraints.insert(node_constraints.begin(), node_constraints.end());
- }
- }
- else if (!(dynamic_cast<ConnectionNode*>(v)
- || dynamic_cast<StartNode*>(v)
- || dynamic_cast<EndNode*>(v)
- || dynamic_cast<ConditionNode*>(v)))
- {
- throw std::runtime_error("Unknown type");
- }
-
+ if (n!=NULL) //test if node v is also ReferenceNode
+ {
+ node_constraints.insert(n->get_time_relations_top().begin(), n->get_time_relations_top().end()); //fill with contraints in node v
+ node_constraints.insert(n->get_time_relations_bottom().begin(), n->get_time_relations_bottom().end()); //fill with contraints in node v
+ if (trav->m_open_constraints.empty())
+ {
+ trav->m_counter_of_blocks++;
+ if (trav->m_counter_of_blocks!=0)
+ {
+ for (std::list<Block>::iterator it = trav->m_list_of_blocks.begin(); it != trav->m_list_of_blocks.end(); it++) //iterate blocks
+ {
+ if (((*it).get_number()==trav->m_last_block)&&((*it).get_if_end()==0)) //find the one, we are looking for
+ {
+ (*it).set_if_end(1); //find new block, so we must close previous block, to prevent any changes
+ }
+ }
+ }
+ Block* block= new Block(trav->m_counter_of_blocks, n, n, 0);
+ trav->m_list_of_blocks.push_back(*block);
+ trav->m_last_block=trav->m_counter_of_blocks;
+ trav->m_open_constraints.insert(node_constraints.begin(), node_constraints.end());
+ }
+ else
+ {
+ for (std::list<Block>::iterator it = trav->m_list_of_blocks.begin(); it != trav->m_list_of_blocks.end(); it++) //iterate blocks
+ {
+ if (((*it).get_if_end()==0)&&((*it).get_number()==trav->m_last_block)) //find the right one, and check if end node has been set
+ {
+ (*it).set_end(n); //if it hasn't, then set it as temporal
+ continue;
+ }
+ }
+ for (std::set<TimeRelationRefNodePtr>::iterator it = trav->m_open_constraints.begin(); it != trav->m_open_constraints.end(); it++) //itarate open constraints
+ {
+ for (std::set<TimeRelationRefNodePtr>::iterator it_2 = node_constraints.begin(); it_2 != node_constraints.end(); it_2++) //iterate node constraints
+ {
+ if (*it==*it_2)
+ {
+ //erase constraint from open constraints, if same one is in node constraints
+ trav->m_open_constraints.erase(it);
+ node_constraints.erase(it_2);
+ }
+ }
+ }
+ trav->m_open_constraints.insert(node_constraints.begin(), node_constraints.end());
+ }
+ }
+ else if (!(dynamic_cast<ConnectionNode*>(v)
+ || dynamic_cast<StartNode*>(v)
+ || dynamic_cast<EndNode*>(v)
+ || dynamic_cast<ConditionNode*>(v)))
+ {
+ throw std::runtime_error("Unknown type");
+ }
}
Modified: trunk/src/check/time/find_block.h
===================================================================
--- trunk/src/check/time/find_block.h 2010-03-07 21:31:37 UTC (rev 669)
+++ trunk/src/check/time/find_block.h 2010-03-08 10:05:47 UTC (rev 670)
@@ -1,20 +1,3 @@
-/*
- * scstudio - Sequence Chart Studio
- * http://scstudio.sourceforge.net
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * Copyright (c) 2010 Martin Vodila <fp...@ma...>
- *
- * $Id:
- */
#ifndef _FIND_BLOCK_H
#define _FIND_BLOCK_H
@@ -28,23 +11,23 @@
class TraverseAndMarkBlocks;
-class MyTraverse:public WhiteNodeFoundListener, public NodeFinishedListener{
+//complete virtual methods from WNFlistener and NFlistener
+class MyTraverse:public WhiteNodeFoundListener, public NodeFinishedListener
+{
public:
- TraverseAndMarkBlocks* trav;
-
- MyTraverse() {};
-
- MyTraverse(TraverseAndMarkBlocks* t) {
- trav=t;
- }
- ~MyTraverse() {};
-
- void on_white_node_found(HMscNode* n);
- //void grey_node_found(HMscNode* n);
- //void black_node_found(HMscNode* n);
- void on_node_finished(HMscNode* n);
- void update_constraints(HMscNode* n);
+ TraverseAndMarkBlocks* trav;
+ MyTraverse() {};
+ MyTraverse(TraverseAndMarkBlocks* t)
+ {
+ trav=t;
+ }
+ ~MyTraverse()
+ {
+ };
+ void on_white_node_found(HMscNode* n);
+ void on_node_finished(HMscNode* n);
+ void update_constraints(HMscNode* n);
};
@@ -53,94 +36,85 @@
class Block
{
private:
-int number;
-ReferenceNode* begin;
-ReferenceNode* end;
-bool if_end;
+ int number; //number of block
+ ReferenceNode* begin; //begin node of block
+ ReferenceNode* end; //end node of block
+ bool if_end; //test variable - if true, then end has been set
public:
- Block(int n, ReferenceNode* begin, ReferenceNode* end, bool if_end) {
- this->number=n;
- this->begin=begin;
- this->end=end;
- this->if_end=if_end;
- }
- int get_number() {
- return this->number;
- }
- void set_number(int n) {
- this->number=n;
- }
- ReferenceNode* get_begin() {
- return this->begin;
- }
- void set_begin(ReferenceNode* b) {
- this->begin=b;
- }
- ReferenceNode* get_end() {
- return this->end;
- }
- void set_end(ReferenceNode* e) {
- this->end=e;
- }
- bool get_if_end() {
- return this->if_end;
- }
- void set_if_end(bool i) {
- this->if_end=i;
- }
+ Block(int n, ReferenceNode* begin, ReferenceNode* end, bool if_end)
+ {
+ this->number=n;
+ this->begin=begin;
+ this->end=end;
+ this->if_end=if_end;
+ }
+ int get_number()
+ {
+ return this->number;
+ }
+ void set_number(int n)
+ {
+ this->number=n;
+ }
+ ReferenceNode* get_begin()
+ {
+ return this->begin;
+ }
+ void set_begin(ReferenceNode* b)
+ {
+ this->begin=b;
+ }
+ ReferenceNode* get_end()
+ {
+ return this->end;
+ }
+ void set_end(ReferenceNode* e)
+ {
+ this->end=e;
+ }
+ bool get_if_end()
+ {
+ return this->if_end;
+ }
+ void set_if_end(bool i)
+ {
+ this->if_end=i;
+ }
};
-/* nakoniec nie je potrebna tato trieda :)
-class MscGraphBlocks
-{
-private:
-//list dvojic (cislo, zaciatok, koniec)
-list<Block> list_of_blocks;
-
-public:
-
- Block get_i-th_block(int i) { //vrati smernik na blok
- for (list<Block>::iterator it = list_of_blocks.begin(); it != list_of_blocks.end(); it++) {
- if (it.get_number()==i) return it;
- }
- }
- void add_block(Block block) { //prida blok do zoznamu
- list_of_blocks.push_back(block);
- }
- void remove_block(Block block) { //odstrani blok zo zoznamu
- list_of_blocks.remove(block);
- }
-}*/
-
-
class TraverseAndMarkBlocks
{
private:
public:
- std::list<Block> m_list_of_blocks;
- int m_last_block;
- int m_counter_of_blocks;
- TimeRelationRefNodePtrSet m_open_constraints;
- //std::list<TimeRelationEvent> open_constraints; //pozret si time relation event
+ std::list<Block> m_list_of_blocks;
+ int m_last_block;
+ int m_counter_of_blocks;
+ TimeRelationRefNodePtrSet m_open_constraints;
- TraverseAndMarkBlocks() {
- this->m_last_block=0;
- this->m_counter_of_blocks=0;
- }
+//constructor - initializes variables
+ TraverseAndMarkBlocks()
+ {
+ this->m_last_block=0;
+ this->m_counter_of_blocks=0;
+ }
- void travers_and_mark_blocks(HMscPtr m_msc) //dfs prehladanie a cez listener rata k uzlu prislusny blok
- {
- //BMscGraphDuplicator* duplicator= new BMscGraphDuplicator();
- //m_msc=duplicator->duplicate_hmsc(m_msc);
- DFSBMscGraphTraverser* traverser_block= new DFSBMscGraphTraverser();
- MyTraverse* my_trav= new MyTraverse(this);
- traverser_block->add_white_node_found_listener(my_trav);
- traverser_block->add_node_finished_listener(my_trav);
- //list_of_blocks= new MscGraphBlock();
- traverser_block->traverse(m_msc);
- }
+
+/*
+At first duplicates graph,
+then travers graph, using only white_node_found_listener and node_finished_listener.
+*/
+ void travers_and_mark_blocks(HMscPtr m_msc)
+ {
+ //BMscGraphDuplicator* duplicator= new BMscGraphDuplicator();
+ //m_msc=duplicator->duplicate_hmsc(m_msc);
+ DFSBMscGraphTraverser* traverser_block= new DFSBMscGraphTraverser();
+ MyTraverse* my_trav= new MyTraverse(this);
+ traverser_block->add_white_node_found_listener(my_trav);
+ traverser_block->add_node_finished_listener(my_trav);
+ traverser_block->traverse(m_msc);
+ }
};
#endif /* _FIND_BLOCK_H */
Modified: trunk/tests/find_block_test.cpp
===================================================================
--- trunk/tests/find_block_test.cpp 2010-03-07 21:31:37 UTC (rev 669)
+++ trunk/tests/find_block_test.cpp 2010-03-08 10:05:47 UTC (rev 670)
@@ -67,12 +67,11 @@
rel1a2->glue_ref_nodes(0,p3.get(),0,p4.get()); */
TraverseAndMarkBlocks* trav_mark = new TraverseAndMarkBlocks();
- trav_mark->travers_and_mark_blocks(h1); //TODO tu sa tiez robilo
+ trav_mark->travers_and_mark_blocks(h1);
for (std::list<Block>::iterator it = trav_mark->m_list_of_blocks.begin(); it != trav_mark->m_list_of_blocks.end(); it++)
- {
- std::cout << "Blok:" << (*it).get_number() << std::endl;
- }
+ {
+ std::cout << "Blok:" << (*it).get_number() << std::endl;
+ }
return 0;
-
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <got...@us...> - 2010-03-09 20:32:04
|
Revision: 674
http://scstudio.svn.sourceforge.net/scstudio/?rev=674&view=rev
Author: gotthardp
Date: 2010-03-09 20:31:52 +0000 (Tue, 09 Mar 2010)
Log Message:
-----------
Was printed like this:
/* MARKED */
bottom top L1 [1,3)/* MARKED */
, top L1 [2,5);
Changed to save the /* MARKED */ sign closed to the marked time constraint, i.e. after comma.
Modified Paths:
--------------
trunk/src/data/Z120/z120_save.cpp
trunk/tests/time_constraints/proper_neg1.mpr.result
trunk/tests/time_constraints/proper_neg10.mpr.result
trunk/tests/time_constraints/proper_neg11.mpr.result
trunk/tests/time_constraints/proper_neg12.mpr.result
trunk/tests/time_constraints/proper_neg13.mpr.result
trunk/tests/time_constraints/proper_neg14.mpr.result
trunk/tests/time_constraints/proper_neg15.mpr.result
trunk/tests/time_constraints/proper_neg16.mpr.result
trunk/tests/time_constraints/proper_neg17.mpr.result
trunk/tests/time_constraints/proper_neg18.mpr.result
trunk/tests/time_constraints/proper_neg19.mpr.result
trunk/tests/time_constraints/proper_neg2.mpr.result
trunk/tests/time_constraints/proper_neg20.mpr.result
trunk/tests/time_constraints/proper_neg21.mpr.result
trunk/tests/time_constraints/proper_neg22.mpr.result
trunk/tests/time_constraints/proper_neg23.mpr.result
trunk/tests/time_constraints/proper_neg24.mpr.result
trunk/tests/time_constraints/proper_neg25.mpr.result
trunk/tests/time_constraints/proper_neg26.mpr.result
trunk/tests/time_constraints/proper_neg26.mpr.result.1
trunk/tests/time_constraints/proper_neg27.mpr.result
trunk/tests/time_constraints/proper_neg27.mpr.result.1
trunk/tests/time_constraints/proper_neg28.mpr.result
trunk/tests/time_constraints/proper_neg3.mpr.result
trunk/tests/time_constraints/proper_neg31.mpr.result
trunk/tests/time_constraints/proper_neg35.mpr.result
trunk/tests/time_constraints/proper_neg4.mpr.result
trunk/tests/time_constraints/proper_neg5.mpr.result
trunk/tests/time_constraints/proper_neg6.mpr.result
trunk/tests/time_constraints/proper_neg7.mpr.result
trunk/tests/time_constraints/proper_neg8.mpr.result
trunk/tests/time_constraints/proper_neg9.mpr.result
Modified: trunk/src/data/Z120/z120_save.cpp
===================================================================
--- trunk/src/data/Z120/z120_save.cpp 2010-03-09 17:40:52 UTC (rev 673)
+++ trunk/src/data/Z120/z120_save.cpp 2010-03-09 20:31:52 UTC (rev 674)
@@ -377,16 +377,16 @@
if((*rpos)->get_event_a() != event)
continue;
- print_element_attributes(stream, *rpos);
-
// is it a first item being printed?
if(!printed++)
- stream << "time ";
+ stream << "time";
else
- stream << ", ";
+ stream << ",";
- stream << "e" << event_id_map.get_id((*rpos)->get_event_b());
+ print_element_attributes(stream, *rpos);
+ stream << " e" << event_id_map.get_id((*rpos)->get_event_b());
+
if((*rpos)->is_directed())
stream << " origin";
@@ -483,18 +483,18 @@
for(CoregEventRelPtrVector::const_iterator spos = (*epos)->get_successors().begin();
spos != (*epos)->get_successors().end(); spos++)
{
- print_element_attributes(stream, *spos);
-
CoregionEventPtr successor = (*spos)->get_successor();
// is it a first item being printed?
if(spos == (*epos)->get_successors().begin())
- stream << " before ";
+ stream << " before";
else
- stream << ", ";
+ stream << ",";
- stream << "e" << event_id_map.get_id(successor);
+ print_element_attributes(stream, *spos);
+ stream << " e" << event_id_map.get_id(successor);
+
// add successors of this event to the stack
// note: std::list<>::push_back doesn't invalidate iterators
push_back_if_unique<CoregionEventPtr>(event_stack, successor);
@@ -529,15 +529,15 @@
if((*rpos)->get_ref_node_a() != (*rpos)->get_ref_node_b())
continue;
- print_element_attributes(stream, *rpos);
-
// is it a first item being printed?
if(!printed++)
- stream << " time ";
+ stream << " time";
else
- stream << ", ";
+ stream << ",";
- stream << (*rpos)->get_label();
+ print_element_attributes(stream, *rpos);
+
+ stream << " " << (*rpos)->get_label();
}
if(printed)
@@ -562,14 +562,14 @@
if((*rpos)->get_ref_node_a() != reference_node)
continue;
- print_element_attributes(stream, *rpos);
-
// is it a first item being printed?
if(!printed++)
stream << " " << title;
else
stream << ",";
+ print_element_attributes(stream, *rpos);
+
if((*rpos)->get_ref_node_b() == NULL)
throw std::invalid_argument("Disconnected time constraint.");
@@ -693,18 +693,18 @@
for(NodeRelationPtrVector::const_iterator spos = predecessor_node->get_successors().begin();
spos != predecessor_node->get_successors().end(); spos++)
{
- print_element_attributes(stream, *spos);
-
SuccessorNode *successor = (*spos)->get_successor();
// is it a first item being printed?
if(spos == predecessor_node->get_successors().begin())
- stream << " connect ";
+ stream << " connect";
else
- stream << ", ";
+ stream << ",";
+ print_element_attributes(stream, *spos);
+
HMscNode *successor_node = dynamic_cast<HMscNode*>(successor);
- stream << "L" << node_id_map.get_id(successor_node);
+ stream << " L" << node_id_map.get_id(successor_node);
// add successors of this node to the stack
// note: std::list<>::push_back doesn't invalidate iterators
Modified: trunk/tests/time_constraints/proper_neg1.mpr.result
===================================================================
--- trunk/tests/time_constraints/proper_neg1.mpr.result 2010-03-09 17:40:52 UTC (rev 673)
+++ trunk/tests/time_constraints/proper_neg1.mpr.result 2010-03-09 20:31:52 UTC (rev 674)
@@ -3,8 +3,8 @@
mscdocument counter_example;
msc Stranka_1;
initial connect L0;
-L0: reference bMSC1/* MARKED */
- top bottom L1 [0,inf);
+L0: reference bMSC1 top/* MARKED */
+ bottom L1 [0,inf);
connect L1, L2;
L1: reference bMSC2 connect L3;
L2: reference bMSC3 connect L4;
Modified: trunk/tests/time_constraints/proper_neg10.mpr.result
===================================================================
--- trunk/tests/time_constraints/proper_neg10.mpr.result 2010-03-09 17:40:52 UTC (rev 673)
+++ trunk/tests/time_constraints/proper_neg10.mpr.result 2010-03-09 20:31:52 UTC (rev 674)
@@ -3,8 +3,8 @@
mscdocument counter_example;
msc Stranka_1;
initial connect L0;
-L0: reference bMSC/* MARKED */
- top bottom L1 [0,inf);
+L0: reference bMSC top/* MARKED */
+ bottom L1 [0,inf);
connect L2, L3;
L2: reference bMSC connect L4;
L3: reference bMSC connect L1;
Modified: trunk/tests/time_constraints/proper_neg11.mpr.result
===================================================================
--- trunk/tests/time_constraints/proper_neg11.mpr.result 2010-03-09 17:40:52 UTC (rev 673)
+++ trunk/tests/time_constraints/proper_neg11.mpr.result 2010-03-09 20:31:52 UTC (rev 674)
@@ -5,8 +5,8 @@
initial connect L0;
L0: reference bMSC connect L1, L2;
L1: reference bMSC connect L3;
-L2: reference bMSC/* MARKED */
- top bottom L4 [0,inf);
+L2: reference bMSC top/* MARKED */
+ bottom L4 [0,inf);
connect L4;
L3: final;
L4: reference bMSC connect L3, L4;
Modified: trunk/tests/time_constraints/proper_neg12.mpr.result
===================================================================
--- trunk/tests/time_constraints/proper_neg12.mpr.result 2010-03-09 17:40:52 UTC (rev 673)
+++ trunk/tests/time_constraints/proper_neg12.mpr.result 2010-03-09 20:31:52 UTC (rev 674)
@@ -4,15 +4,15 @@
msc Stranka_1;
initial connect L0;
L0: reference NAME time [0,inf);
-/* MARKED */
- top top L1 [0,inf);
-/* MARKED */
- bottom top L1 [2,5)/* MARKED */
-, top L1 [1,3);
+ top/* MARKED */
+ top L1 [0,inf);
+ bottom/* MARKED */
+ top L1 [2,5),/* MARKED */
+ top L1 [1,3);
connect L1;
L1: reference NAME time [0,inf), [0,inf);
-/* MARKED */
- top bottom L2 [0,inf);
+ top/* MARKED */
+ bottom L2 [0,inf);
connect L3;
L3: connect L2, L4;
/* MARKED */
@@ -37,8 +37,8 @@
NAME: instance;
label e0;
in NAME,0 from asd;
-/* MARKED */
-time e1 [0,inf);
+time/* MARKED */
+ e1 [0,inf);
endinstance;
asd: instance;
out NAME,0 to NAME;
Modified: trunk/tests/time_constraints/proper_neg13.mpr.result
===================================================================
--- trunk/tests/time_constraints/proper_neg13.mpr.result 2010-03-09 17:40:52 UTC (rev 673)
+++ trunk/tests/time_constraints/proper_neg13.mpr.result 2010-03-09 20:31:52 UTC (rev 674)
@@ -4,15 +4,15 @@
msc Stranka_1;
initial connect L0;
L0: reference NAME time [0,inf);
-/* MARKED */
- top top L1 [0,inf);
-/* MARKED */
- bottom top L1 [2,5)/* MARKED */
-, top L1 [1,3);
+ top/* MARKED */
+ top L1 [0,inf);
+ bottom/* MARKED */
+ top L1 [2,5),/* MARKED */
+ top L1 [1,3);
connect L1, L2;
L1: reference NAME time [0,inf), [0,inf);
-/* MARKED */
- top bottom L3 [0,inf);
+ top/* MARKED */
+ bottom L3 [0,inf);
connect L4;
L2: reference NAME time [0,inf);
connect L5;
@@ -39,8 +39,8 @@
NAME: instance;
label e0;
in NAME,0 from asd;
-/* MARKED */
-time e1 [0,inf);
+time/* MARKED */
+ e1 [0,inf);
endinstance;
asd: instance;
out NAME,0 to NAME;
Modified: trunk/tests/time_constraints/proper_neg14.mpr.result
===================================================================
--- trunk/tests/time_constraints/proper_neg14.mpr.result 2010-03-09 17:40:52 UTC (rev 673)
+++ trunk/tests/time_constraints/proper_neg14.mpr.result 2010-03-09 20:31:52 UTC (rev 674)
@@ -22,8 +22,8 @@
b: instance;
label e1;
in NAME,1 from c;
-/* MARKED */
-time e0 [0,inf);
+time/* MARKED */
+ e0 [0,inf);
endinstance;
c: instance;
out NAME,1 to b;
Modified: trunk/tests/time_constraints/proper_neg15.mpr.result
===================================================================
--- trunk/tests/time_constraints/proper_neg15.mpr.result 2010-03-09 17:40:52 UTC (rev 673)
+++ trunk/tests/time_constraints/proper_neg15.mpr.result 2010-03-09 20:31:52 UTC (rev 674)
@@ -13,14 +13,14 @@
initial connect L0, L1;
/* MARKED */
L0: reference A time [0,inf);
-/* MARKED */
- top top L1 [0,inf)/* MARKED */
-, bottom L1 [0,inf);
+ top/* MARKED */
+ top L1 [0,inf),/* MARKED */
+ bottom L1 [0,inf);
connect L2;
/* MARKED */
L1: reference NAME time [0,inf);
-/* MARKED */
- bottom bottom L0 [0,inf);
+ bottom/* MARKED */
+ bottom L0 [0,inf);
connect L2;
L2: final;
endmsc;
@@ -35,8 +35,8 @@
b: instance;
label e1;
in NAME,1 from c;
-/* MARKED */
-time e0 [0,inf);
+time/* MARKED */
+ e0 [0,inf);
endinstance;
c: instance;
out NAME,1 to b;
Modified: trunk/tests/time_constraints/proper_neg16.mpr.result
===================================================================
--- trunk/tests/time_constraints/proper_neg16.mpr.result 2010-03-09 17:40:52 UTC (rev 673)
+++ trunk/tests/time_constraints/proper_neg16.mpr.result 2010-03-09 20:31:52 UTC (rev 674)
@@ -13,8 +13,8 @@
/* MARKED */
L0: reference A connect L2;
/* MARKED */
-L1: reference NAME/* MARKED */
- bottom bottom L0 [0,inf);
+L1: reference NAME bottom/* MARKED */
+ bottom L0 [0,inf);
connect L2;
L2: final;
endmsc;
@@ -31,8 +31,8 @@
out NAME,2 to c;
label e0;
in NAME,3 from c;
-/* MARKED */
-time e1 [0,inf);
+time/* MARKED */
+ e1 [0,inf);
endinstance;
c: instance;
out NAME,3 to b;
Modified: trunk/tests/time_constraints/proper_neg17.mpr.result
===================================================================
--- trunk/tests/time_constraints/proper_neg17.mpr.result 2010-03-09 17:40:52 UTC (rev 673)
+++ trunk/tests/time_constraints/proper_neg17.mpr.result 2010-03-09 20:31:52 UTC (rev 674)
@@ -35,8 +35,8 @@
b: instance;
label e1;
in NAME,1 from c;
-/* MARKED */
-time e0 [0,inf);
+time/* MARKED */
+ e0 [0,inf);
endinstance;
c: instance;
out NAME,1 to b;
Modified: trunk/tests/time_constraints/proper_neg18.mpr.result
===================================================================
--- trunk/tests/time_constraints/proper_neg18.mpr.result 2010-03-09 17:40:52 UTC (rev 673)
+++ trunk/tests/time_constraints/proper_neg18.mpr.result 2010-03-09 20:31:52 UTC (rev 674)
@@ -19,8 +19,8 @@
/* MARKED */
L0: reference A time [0,inf);
connect L2;
-L1: reference NAME/* MARKED */
- bottom top L0 [0,inf);
+L1: reference NAME bottom/* MARKED */
+ top L0 [0,inf);
connect L2;
L2: final;
endmsc;
Modified: trunk/tests/time_constraints/proper_neg19.mpr.result
===================================================================
--- trunk/tests/time_constraints/proper_neg19.mpr.result 2010-03-09 17:40:52 UTC (rev 673)
+++ trunk/tests/time_constraints/proper_neg19.mpr.result 2010-03-09 20:31:52 UTC (rev 674)
@@ -22,8 +22,8 @@
msc NAME;
initial connect L0;
/* MARKED */
-L0: reference A/* MARKED */
- top bottom L1 [0,inf);
+L0: reference A top/* MARKED */
+ bottom L1 [0,inf);
connect L1, L2;
/* MARKED */
L1: reference NAME connect L3;
Modified: trunk/tests/time_constraints/proper_neg2.mpr.result
===================================================================
--- trunk/tests/time_constraints/proper_neg2.mpr.result 2010-03-09 17:40:52 UTC (rev 673)
+++ trunk/tests/time_constraints/proper_neg2.mpr.result 2010-03-09 20:31:52 UTC (rev 674)
@@ -4,8 +4,8 @@
msc Stranka_1;
initial connect L0;
L0: reference bMSC1 connect L1, L2;
-L1: reference bMSC2/* MARKED */
- top bottom L2 [0,inf);
+L1: reference bMSC2 top/* MARKED */
+ bottom L2 [0,inf);
connect L3;
L2: reference bMSC3 connect L4;
L3: final;
Modified: trunk/tests/time_constraints/proper_neg20.mpr.result
===================================================================
--- trunk/tests/time_constraints/proper_neg20.mpr.result 2010-03-09 17:40:52 UTC (rev 673)
+++ trunk/tests/time_constraints/proper_neg20.mpr.result 2010-03-09 20:31:52 UTC (rev 674)
@@ -6,8 +6,8 @@
mscdocument counter_example;
msc NAME;
initial connect L0;
-L0: reference A/* MARKED */
- top bottom L1 [0,inf);
+L0: reference A top/* MARKED */
+ bottom L1 [0,inf);
connect L1, L2;
/* MARKED */
L1: reference NAME connect L3;
Modified: trunk/tests/time_constraints/proper_neg21.mpr.result
===================================================================
--- trunk/tests/time_constraints/proper_neg21.mpr.result 2010-03-09 17:40:52 UTC (rev 673)
+++ trunk/tests/time_constraints/proper_neg21.mpr.result 2010-03-09 20:31:52 UTC (rev 674)
@@ -7,20 +7,20 @@
msc A;
initial connect L0;
/* MARKED */
-L0: reference A/* MARKED */
- top top L1 [0,inf)/* MARKED */
-, bottom L2 [0,inf);
-/* MARKED */
- bottom top L3 [0,inf);
+L0: reference A top/* MARKED */
+ top L1 [0,inf),/* MARKED */
+ bottom L2 [0,inf);
+ bottom/* MARKED */
+ top L3 [0,inf);
connect L1, L4;
L1: reference NAME time [0,inf);
-/* MARKED */
- bottom bottom L3 [0,inf);
+ bottom/* MARKED */
+ bottom L3 [0,inf);
connect L4, L3, L5;
L4: connect L1, L3;
L3: reference NAME time [0,inf);
-/* MARKED */
- top top L2 [0,inf);
+ top/* MARKED */
+ top L2 [0,inf);
connect L6;
L5: condition aa connect L2;
L6: final;
Modified: trunk/tests/time_constraints/proper_neg22.mpr.result
===================================================================
--- trunk/tests/time_constraints/proper_neg22.mpr.result 2010-03-09 17:40:52 UTC (rev 673)
+++ trunk/tests/time_constraints/proper_neg22.mpr.result 2010-03-09 20:31:52 UTC (rev 674)
@@ -7,8 +7,8 @@
msc A;
initial connect L0;
/* MARKED */
-L0: reference A bottom top L1 [0,inf)/* MARKED */
-, top L2 [0,inf);
+L0: reference A bottom top L1 [0,inf),/* MARKED */
+ top L2 [0,inf);
connect L2, L3;
L2: reference NAME time [0,inf);
connect L1;
Modified: trunk/tests/time_constraints/proper_neg23.mpr.result
===================================================================
--- trunk/tests/time_constraints/proper_neg23.mpr.result 2010-03-09 17:40:52 UTC (rev 673)
+++ trunk/tests/time_constraints/proper_neg23.mpr.result 2010-03-09 20:31:52 UTC (rev 674)
@@ -7,8 +7,8 @@
msc A;
initial connect L0;
/* MARKED */
-L0: reference A bottom top L1 [0,inf)/* MARKED */
-, top L2 [0,inf);
+L0: reference A bottom top L1 [0,inf),/* MARKED */
+ top L2 [0,inf);
connect L2, L3;
L2: reference NAME time [0,inf);
connect L1;
Modified: trunk/tests/time_constraints/proper_neg24.mpr.result
===================================================================
--- trunk/tests/time_constraints/proper_neg24.mpr.result 2010-03-09 17:40:52 UTC (rev 673)
+++ trunk/tests/time_constraints/proper_neg24.mpr.result 2010-03-09 20:31:52 UTC (rev 674)
@@ -7,8 +7,8 @@
msc A;
initial connect L0;
/* MARKED */
-L0: reference A bottom top L1 [0,inf)/* MARKED */
-, top L2 [0,inf);
+L0: reference A bottom top L1 [0,inf),/* MARKED */
+ top L2 [0,inf);
connect L2, L3;
L2: reference NAME time [0,inf);
connect L1;
Modified: trunk/tests/time_constraints/proper_neg25.mpr.result
===================================================================
--- trunk/tests/time_constraints/proper_neg25.mpr.result 2010-03-09 17:40:52 UTC (rev 673)
+++ trunk/tests/time_constraints/proper_neg25.mpr.result 2010-03-09 20:31:52 UTC (rev 674)
@@ -10,8 +10,8 @@
L0: reference A bottom top L1 [0,inf);
connect L2, L3;
L2: reference NAME time [0,inf);
-/* MARKED */
- top bottom L4 [0,inf);
+ top/* MARKED */
+ bottom L4 [0,inf);
connect L1;
L3: connect L2, L1;
L1: reference NAME time [0,inf);
Modified: trunk/tests/time_constraints/proper_neg26.mpr.result
===================================================================
--- trunk/tests/time_constraints/proper_neg26.mpr.result 2010-03-09 17:40:52 UTC (rev 673)
+++ trunk/tests/time_constraints/proper_neg26.mpr.result 2010-03-09 20:31:52 UTC (rev 674)
@@ -30,8 +30,8 @@
dsrgdf: instance;
label e0;
in NAME,0 from asd;
-/* MARKED */
-time e1 [0,inf);
+time/* MARKED */
+ e1 [0,inf);
in NAME,1 from NAME;
endinstance;
NAME: instance;
Modified: trunk/tests/time_constraints/proper_neg26.mpr.result.1
===================================================================
--- trunk/tests/time_constraints/proper_neg26.mpr.result.1 2010-03-09 17:40:52 UTC (rev 673)
+++ trunk/tests/time_constraints/proper_neg26.mpr.result.1 2010-03-09 20:31:52 UTC (rev 674)
@@ -46,8 +46,8 @@
dsrgdf: instance;
label e0;
in NAME,0 from asd;
-/* MARKED */
-time e1 [0,inf);
+time/* MARKED */
+ e1 [0,inf);
in NAME,1 from NAME;
endinstance;
NAME: instance;
Modified: trunk/tests/time_constraints/proper_neg27.mpr.result
===================================================================
--- trunk/tests/time_constraints/proper_neg27.mpr.result 2010-03-09 17:40:52 UTC (rev 673)
+++ trunk/tests/time_constraints/proper_neg27.mpr.result 2010-03-09 20:31:52 UTC (rev 674)
@@ -30,8 +30,8 @@
dsrgdf: instance;
label e0;
in NAME,0 from asd;
-/* MARKED */
-time e1 [0,inf);
+time/* MARKED */
+ e1 [0,inf);
in NAME,1 from NAME;
endinstance;
NAME: instance;
Modified: trunk/tests/time_constraints/proper_neg27.mpr.result.1
===================================================================
--- trunk/tests/time_constraints/proper_neg27.mpr.result.1 2010-03-09 17:40:52 UTC (rev 673)
+++ trunk/tests/time_constraints/proper_neg27.mpr.result.1 2010-03-09 20:31:52 UTC (rev 674)
@@ -42,8 +42,8 @@
dsrgdf: instance;
label e0;
in NAME,0 from asd;
-/* MARKED */
-time e1 [0,inf);
+time/* MARKED */
+ e1 [0,inf);
in NAME,1 from NAME;
endinstance;
NAME: instance;
Modified: trunk/tests/time_constraints/proper_neg28.mpr.result
===================================================================
--- trunk/tests/time_constraints/proper_neg28.mpr.result 2010-03-09 17:40:52 UTC (rev 673)
+++ trunk/tests/time_constraints/proper_neg28.mpr.result 2010-03-09 20:31:52 UTC (rev 674)
@@ -16,8 +16,8 @@
dsrgdf: instance;
label e0;
in NAME,0 from asd;
-/* MARKED */
-time e1 [0,inf);
+time/* MARKED */
+ e1 [0,inf);
in NAME,1 from NAME;
endinstance;
NAME: instance;
Modified: trunk/tests/time_constraints/proper_neg3.mpr.result
===================================================================
--- trunk/tests/time_constraints/proper_neg3.mpr.result 2010-03-09 17:40:52 UTC (rev 673)
+++ trunk/tests/time_constraints/proper_neg3.mpr.result 2010-03-09 20:31:52 UTC (rev 674)
@@ -5,8 +5,8 @@
initial connect L0;
L0: reference bMSC1 connect L1, L2;
L1: reference bMSC2 connect L3;
-L2: reference bMSC3/* MARKED */
- top bottom L4 [0,inf);
+L2: reference bMSC3 top/* MARKED */
+ bottom L4 [0,inf);
connect L2, L4;
L3: final;
L4: reference bMSC4 connect L3;
Modified: trunk/tests/time_constraints/proper_neg31.mpr.result
===================================================================
--- trunk/tests/time_constraints/proper_neg31.mpr.result 2010-03-09 17:40:52 UTC (rev 673)
+++ trunk/tests/time_constraints/proper_neg31.mpr.result 2010-03-09 20:31:52 UTC (rev 674)
@@ -5,8 +5,8 @@
p: instance;
label e0;
out NAME,0 to q;
-/* MARKED */
-time e1 (-inf,-1], e2 [1];
+time/* MARKED */
+ e1 (-inf,-1], e2 [1];
label e1;
out NAME,1 to q;
time e3 [100];
Modified: trunk/tests/time_constraints/proper_neg35.mpr.result
===================================================================
--- trunk/tests/time_constraints/proper_neg35.mpr.result 2010-03-09 17:40:52 UTC (rev 673)
+++ trunk/tests/time_constraints/proper_neg35.mpr.result 2010-03-09 20:31:52 UTC (rev 674)
@@ -9,8 +9,8 @@
concurrent;
label e0;
out x,0 to c;
-/* MARKED */
-time e1 [0,inf);
+time/* MARKED */
+ e1 [0,inf);
label e1;
in y,1 from b;
endconcurrent;
Modified: trunk/tests/time_constraints/proper_neg4.mpr.result
===================================================================
--- trunk/tests/time_constraints/proper_neg4.mpr.result 2010-03-09 17:40:52 UTC (rev 673)
+++ trunk/tests/time_constraints/proper_neg4.mpr.result 2010-03-09 20:31:52 UTC (rev 674)
@@ -5,8 +5,8 @@
initial connect L0;
L0: reference bMSC1 connect L1, L2;
L1: reference bMSC2 connect L3;
-L2: reference bMSC3/* MARKED */
- top bottom L4 [0,inf);
+L2: reference bMSC3 top/* MARKED */
+ bottom L4 [0,inf);
connect L4;
L3: final;
L4: reference bMSC4 connect L3, L4;
Modified: trunk/tests/time_constraints/proper_neg5.mpr.result
===================================================================
--- trunk/tests/time_constraints/proper_neg5.mpr.result 2010-03-09 17:40:52 UTC (rev 673)
+++ trunk/tests/time_constraints/proper_neg5.mpr.result 2010-03-09 20:31:52 UTC (rev 674)
@@ -5,8 +5,8 @@
initial connect L0;
L0: reference bMSC1 connect L1, L2;
L1: reference bMSC2 connect L3;
-L2: reference bMSC3/* MARKED */
- bottom top L4 [0,inf);
+L2: reference bMSC3 bottom/* MARKED */
+ top L4 [0,inf);
connect L4;
L3: final;
L4: reference bMSC4 connect L3, L4;
Modified: trunk/tests/time_constraints/proper_neg6.mpr.result
===================================================================
--- trunk/tests/time_constraints/proper_neg6.mpr.result 2010-03-09 17:40:52 UTC (rev 673)
+++ trunk/tests/time_constraints/proper_neg6.mpr.result 2010-03-09 20:31:52 UTC (rev 674)
@@ -5,8 +5,8 @@
initial connect L0;
L0: reference bMSC1 connect L1, L2;
L1: reference bMSC2 connect L3;
-L2: reference bMSC3/* MARKED */
- bottom top L4 [0,inf);
+L2: reference bMSC3 bottom/* MARKED */
+ top L4 [0,inf);
connect L4;
L3: final;
L4: reference bMSC4 connect L3, L2, L4;
Modified: trunk/tests/time_constraints/proper_neg7.mpr.result
===================================================================
--- trunk/tests/time_constraints/proper_neg7.mpr.result 2010-03-09 17:40:52 UTC (rev 673)
+++ trunk/tests/time_constraints/proper_neg7.mpr.result 2010-03-09 20:31:52 UTC (rev 674)
@@ -5,8 +5,8 @@
initial connect L0;
L0: reference bMSC1 connect L1, L2;
L1: reference bMSC2 connect L3;
-L2: reference bMSC3/* MARKED */
- top bottom L4 [0,inf);
+L2: reference bMSC3 top/* MARKED */
+ bottom L4 [0,inf);
connect L4;
L3: final;
L4: reference bMSC4 connect L3, L2, L4;
Modified: trunk/tests/time_constraints/proper_neg8.mpr.result
===================================================================
--- trunk/tests/time_constraints/proper_neg8.mpr.result 2010-03-09 17:40:52 UTC (rev 673)
+++ trunk/tests/time_constraints/proper_neg8.mpr.result 2010-03-09 20:31:52 UTC (rev 674)
@@ -13,8 +13,8 @@
connect L2;
L2: reference NAME connect L3;
L3: connect L1, L4;
-L1: reference NAME2/* MARKED */
- bottom top L2 [0,inf);
+L1: reference NAME2 bottom/* MARKED */
+ top L2 [0,inf);
connect L5;
L4: connect L2;
L5: final;
Modified: trunk/tests/time_constraints/proper_neg9.mpr.result
===================================================================
--- trunk/tests/time_constraints/proper_neg9.mpr.result 2010-03-09 17:40:52 UTC (rev 673)
+++ trunk/tests/time_constraints/proper_neg9.mpr.result 2010-03-09 20:31:52 UTC (rev 674)
@@ -5,8 +5,8 @@
initial connect L0;
L0: reference bMSC connect L1, L2;
L1: reference bMSC connect L3;
-L2: reference bMSC/* MARKED */
- top bottom L4 [0,inf);
+L2: reference bMSC top/* MARKED */
+ bottom L4 [0,inf);
connect L4;
L3: final;
L4: reference bMSC connect L3, L2, L4;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mar...@us...> - 2010-03-09 22:38:25
|
Revision: 675
http://scstudio.svn.sourceforge.net/scstudio/?rev=675&view=rev
Author: martinnrt
Date: 2010-03-09 22:38:17 +0000 (Tue, 09 Mar 2010)
Log Message:
-----------
Modified Paths:
--------------
trunk/src/check/time/find_block.cpp
trunk/src/check/time/find_block.h
trunk/tests/find_block_test.cpp
Modified: trunk/src/check/time/find_block.cpp
===================================================================
--- trunk/src/check/time/find_block.cpp 2010-03-09 20:31:52 UTC (rev 674)
+++ trunk/src/check/time/find_block.cpp 2010-03-09 22:38:17 UTC (rev 675)
@@ -1,3 +1,20 @@
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2010 Martin Vodila <fp...@ma...>
+ *
+ * $Id:
+ */
#include "check/time/find_block.h"
@@ -48,8 +65,8 @@
}
}
}
- Block* block= new Block(trav->m_counter_of_blocks, n, n, 0);
- trav->m_list_of_blocks.push_back(*block);
+ Block block= Block(trav->m_counter_of_blocks, n, n, 0);
+ trav->m_list_of_blocks.push_back(block);
trav->m_last_block=trav->m_counter_of_blocks;
trav->m_open_constraints.insert(node_constraints.begin(), node_constraints.end());
}
@@ -72,19 +89,31 @@
//erase constraint from open constraints, if same one is in node constraints
trav->m_open_constraints.erase(it);
node_constraints.erase(it_2);
+ std::set<TimeRelationRefNodePtr>::iterator it=trav->m_open_constraints.begin();
+ std::set<TimeRelationRefNodePtr>::iterator it_2=node_constraints.begin();
}
}
}
trav->m_open_constraints.insert(node_constraints.begin(), node_constraints.end());
}
}
- else if (!(dynamic_cast<ConnectionNode*>(v)
- || dynamic_cast<StartNode*>(v)
- || dynamic_cast<EndNode*>(v)
- || dynamic_cast<ConditionNode*>(v)))
+ else if (dynamic_cast<EndNode*>(v)!=NULL)
{
- throw std::runtime_error("Unknown type");
+ for (std::list<Block>::iterator it = trav->m_list_of_blocks.begin(); it != trav->m_list_of_blocks.end(); it++) //iterate blocks
+ {
+ if (((*it).get_if_end()==0)&&((*it).get_number()==trav->m_last_block)) //find the right one, and check if end node has been set
+ {
+ (*it).set_if_end(1); //close changing end_node of last_block
+ continue;
+ }
+ }
}
+ else if (!(dynamic_cast<ConnectionNode*>(v)
+ || dynamic_cast<StartNode*>(v)
+ || dynamic_cast<ConditionNode*>(v)))
+ {
+ throw std::runtime_error("Unknown type");
+ }
}
Modified: trunk/src/check/time/find_block.h
===================================================================
--- trunk/src/check/time/find_block.h 2010-03-09 20:31:52 UTC (rev 674)
+++ trunk/src/check/time/find_block.h 2010-03-09 22:38:17 UTC (rev 675)
@@ -1,3 +1,20 @@
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2010 Martin Vodila <fp...@ma...>
+ *
+ * $Id:
+ */
#ifndef _FIND_BLOCK_H
#define _FIND_BLOCK_H
Modified: trunk/tests/find_block_test.cpp
===================================================================
--- trunk/tests/find_block_test.cpp 2010-03-09 20:31:52 UTC (rev 674)
+++ trunk/tests/find_block_test.cpp 2010-03-09 22:38:17 UTC (rev 675)
@@ -8,7 +8,8 @@
#include <iostream>
-int main(int argc, char** argv) {
+int main(int argc, char** argv)
+{
std::cout << "Test of find_block: " << std::endl;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mar...@us...> - 2010-03-09 22:53:45
|
Revision: 676
http://scstudio.svn.sourceforge.net/scstudio/?rev=676&view=rev
Author: martinnrt
Date: 2010-03-09 22:53:38 +0000 (Tue, 09 Mar 2010)
Log Message:
-----------
Modified Paths:
--------------
trunk/src/check/time/find_block.cpp
trunk/src/check/time/find_block.h
trunk/tests/find_block_test.cpp
Modified: trunk/src/check/time/find_block.cpp
===================================================================
--- trunk/src/check/time/find_block.cpp 2010-03-09 22:38:17 UTC (rev 675)
+++ trunk/src/check/time/find_block.cpp 2010-03-09 22:53:38 UTC (rev 676)
@@ -28,14 +28,14 @@
void MyTraverse::on_node_finished(HMscNode* n)
{
for (std::list<Block>::iterator it = trav->m_list_of_blocks.begin(); it != trav->m_list_of_blocks.end(); it++) //iterate blocks
+ {
+ if (((*it).get_number()==trav->m_last_block) && ((*it).get_if_end()==0)) //find the right one, and check if end node has been set
{
- if (((*it).get_number()==trav->m_last_block) && ((*it).get_if_end()==0)) //find the right one, and check if end node has been set
- {
(*it).set_end(dynamic_cast<ReferenceNode*>(n)); //if it hasn't, then set it
(*it).set_if_end(1); //mark block, now we know that end node of block has been set and won't be changed
continue;
- }
}
+ }
trav->m_last_block=n->get_attribute<int>("found_with_block_number",0);
trav->m_open_constraints=n->get_attribute<TimeRelationRefNodePtrSet>("found_with_open_constraints",trav->m_open_constraints);
n->remove_attribute<int>("found_with_block_number");
@@ -49,71 +49,71 @@
node_constraints.erase(node_constraints.begin(), node_constraints.end());
if (n!=NULL) //test if node v is also ReferenceNode
- {
+ {
node_constraints.insert(n->get_time_relations_top().begin(), n->get_time_relations_top().end()); //fill with contraints in node v
node_constraints.insert(n->get_time_relations_bottom().begin(), n->get_time_relations_bottom().end()); //fill with contraints in node v
if (trav->m_open_constraints.empty())
- {
+ {
trav->m_counter_of_blocks++;
if (trav->m_counter_of_blocks!=0)
+ {
+ for (std::list<Block>::iterator it = trav->m_list_of_blocks.begin(); it != trav->m_list_of_blocks.end(); it++) //iterate blocks
{
- for (std::list<Block>::iterator it = trav->m_list_of_blocks.begin(); it != trav->m_list_of_blocks.end(); it++) //iterate blocks
+ if (((*it).get_number()==trav->m_last_block)&&((*it).get_if_end()==0)) //find the one, we are looking for
{
- if (((*it).get_number()==trav->m_last_block)&&((*it).get_if_end()==0)) //find the one, we are looking for
- {
(*it).set_if_end(1); //find new block, so we must close previous block, to prevent any changes
- }
}
}
- Block block= Block(trav->m_counter_of_blocks, n, n, 0);
- trav->m_list_of_blocks.push_back(block);
- trav->m_last_block=trav->m_counter_of_blocks;
- trav->m_open_constraints.insert(node_constraints.begin(), node_constraints.end());
+ }
+ Block block= Block(trav->m_counter_of_blocks, n, n, 0);
+ trav->m_list_of_blocks.push_back(block);
+ trav->m_last_block=trav->m_counter_of_blocks;
+ trav->m_open_constraints.insert(node_constraints.begin(), node_constraints.end());
}
else
+ {
+ for (std::list<Block>::iterator it = trav->m_list_of_blocks.begin(); it != trav->m_list_of_blocks.end(); it++) //iterate blocks
{
- for (std::list<Block>::iterator it = trav->m_list_of_blocks.begin(); it != trav->m_list_of_blocks.end(); it++) //iterate blocks
+ if (((*it).get_if_end()==0)&&((*it).get_number()==trav->m_last_block)) //find the right one, and check if end node has been set
{
- if (((*it).get_if_end()==0)&&((*it).get_number()==trav->m_last_block)) //find the right one, and check if end node has been set
- {
(*it).set_end(n); //if it hasn't, then set it as temporal
continue;
- }
}
+ }
for (std::set<TimeRelationRefNodePtr>::iterator it = trav->m_open_constraints.begin(); it != trav->m_open_constraints.end(); it++) //itarate open constraints
+ {
+ for (std::set<TimeRelationRefNodePtr>::iterator it_2 = node_constraints.begin(); it_2 != node_constraints.end(); it_2++) //iterate node constraints
{
- for (std::set<TimeRelationRefNodePtr>::iterator it_2 = node_constraints.begin(); it_2 != node_constraints.end(); it_2++) //iterate node constraints
+ if (*it==*it_2)
{
- if (*it==*it_2)
- {
//erase constraint from open constraints, if same one is in node constraints
trav->m_open_constraints.erase(it);
node_constraints.erase(it_2);
std::set<TimeRelationRefNodePtr>::iterator it=trav->m_open_constraints.begin();
std::set<TimeRelationRefNodePtr>::iterator it_2=node_constraints.begin();
- }
}
}
+ }
trav->m_open_constraints.insert(node_constraints.begin(), node_constraints.end());
- }
+ }
}
else if (dynamic_cast<EndNode*>(v)!=NULL)
+ {
+ for (std::list<Block>::iterator it = trav->m_list_of_blocks.begin(); it != trav->m_list_of_blocks.end(); it++) //iterate blocks
{
- for (std::list<Block>::iterator it = trav->m_list_of_blocks.begin(); it != trav->m_list_of_blocks.end(); it++) //iterate blocks
+ if (((*it).get_if_end()==0)&&((*it).get_number()==trav->m_last_block)) //find the right one, and check if end node has been set
{
- if (((*it).get_if_end()==0)&&((*it).get_number()==trav->m_last_block)) //find the right one, and check if end node has been set
- {
(*it).set_if_end(1); //close changing end_node of last_block
continue;
- }
}
}
+ }
else if (!(dynamic_cast<ConnectionNode*>(v)
|| dynamic_cast<StartNode*>(v)
|| dynamic_cast<ConditionNode*>(v)))
- {
+ {
throw std::runtime_error("Unknown type");
- }
+ }
}
Modified: trunk/src/check/time/find_block.h
===================================================================
--- trunk/src/check/time/find_block.h 2010-03-09 22:38:17 UTC (rev 675)
+++ trunk/src/check/time/find_block.h 2010-03-09 22:53:38 UTC (rev 676)
@@ -39,12 +39,11 @@
{}
MyTraverse(TraverseAndMarkBlocks* t)
- {
+ {
trav=t;
- }
+ }
virtual ~MyTraverse()
- {
- }
+ {}
virtual void on_white_node_found(HMscNode* n);
virtual void on_node_finished(HMscNode* n);
@@ -63,44 +62,44 @@
bool if_end; //test variable - if true, then end has been set
public:
Block(int n, ReferenceNode* begin, ReferenceNode* end, bool if_end)
- {
+ {
this->number=n;
this->begin=begin;
this->end=end;
this->if_end=if_end;
- }
+ }
int get_number()
- {
+ {
return this->number;
- }
+ }
void set_number(int n)
- {
+ {
this->number=n;
- }
+ }
ReferenceNode* get_begin()
- {
+ {
return this->begin;
- }
+ }
void set_begin(ReferenceNode* b)
- {
+ {
this->begin=b;
- }
+ }
ReferenceNode* get_end()
- {
+ {
return this->end;
- }
+ }
void set_end(ReferenceNode* e)
- {
+ {
this->end=e;
- }
+ }
bool get_if_end()
- {
+ {
return this->if_end;
- }
+ }
void set_if_end(bool i)
- {
+ {
this->if_end=i;
- }
+ }
};
@@ -116,10 +115,10 @@
//constructor - initializes variables
TraverseAndMarkBlocks()
- {
+ {
this->m_last_block=0;
this->m_counter_of_blocks=0;
- }
+ }
/*
@@ -127,7 +126,7 @@
then travers graph, using only white_node_found_listener and node_finished_listener.
*/
void travers_and_mark_blocks(HMscPtr m_msc)
- {
+ {
//BMscGraphDuplicator* duplicator= new BMscGraphDuplicator();
//m_msc=duplicator->duplicate_hmsc(m_msc);
DFSBMscGraphTraverser* traverser_block= new DFSBMscGraphTraverser();
@@ -135,7 +134,7 @@
traverser_block->add_white_node_found_listener(my_trav);
traverser_block->add_node_finished_listener(my_trav);
traverser_block->traverse(m_msc);
- }
+ }
};
#endif /* _FIND_BLOCK_H */
Modified: trunk/tests/find_block_test.cpp
===================================================================
--- trunk/tests/find_block_test.cpp 2010-03-09 22:38:17 UTC (rev 675)
+++ trunk/tests/find_block_test.cpp 2010-03-09 22:53:38 UTC (rev 676)
@@ -72,7 +72,7 @@
for (std::list<Block>::iterator it = trav_mark->m_list_of_blocks.begin(); it != trav_mark->m_list_of_blocks.end(); it++)
{
- std::cout << "Blok:" << (*it).get_number() << std::endl;
+ std::cout << "Blok:" << (*it).get_number() << " if_end:" << (*it).get_if_end() << std::endl;
}
return 0;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mar...@us...> - 2010-03-10 17:39:16
|
Revision: 681
http://scstudio.svn.sourceforge.net/scstudio/?rev=681&view=rev
Author: martinnrt
Date: 2010-03-10 17:38:58 +0000 (Wed, 10 Mar 2010)
Log Message:
-----------
Modified Paths:
--------------
trunk/src/check/time/CMakeLists.txt
trunk/src/check/time/hmsc_all_paths.cpp
trunk/tests/find_block_test.cpp
Modified: trunk/src/check/time/CMakeLists.txt
===================================================================
--- trunk/src/check/time/CMakeLists.txt 2010-03-10 16:04:21 UTC (rev 680)
+++ trunk/src/check/time/CMakeLists.txt 2010-03-10 17:38:58 UTC (rev 681)
@@ -14,7 +14,8 @@
hmsc_all_paths.cpp
find_block.cpp
find_block.h
-
+ hmsc_block_paths.h
+ hmsc_block_paths.cpp
)
TARGET_LINK_LIBRARIES(sctime
Modified: trunk/src/check/time/hmsc_all_paths.cpp
===================================================================
--- trunk/src/check/time/hmsc_all_paths.cpp 2010-03-10 16:04:21 UTC (rev 680)
+++ trunk/src/check/time/hmsc_all_paths.cpp 2010-03-10 17:38:58 UTC (rev 681)
@@ -23,6 +23,7 @@
std::list<PathFoundListener*>::iterator listener_it;
path_prefix2.push_back(node.get());
+
//check whether node is the one of last nodes
@@ -78,4 +79,4 @@
path_prefix2.pop_back();
set_number(node, get_number(node)-1);
return;
-}
\ No newline at end of file
+}
Modified: trunk/tests/find_block_test.cpp
===================================================================
--- trunk/tests/find_block_test.cpp 2010-03-10 16:04:21 UTC (rev 680)
+++ trunk/tests/find_block_test.cpp 2010-03-10 17:38:58 UTC (rev 681)
@@ -3,6 +3,7 @@
#include "data/msc.h"
#include "check/time/find_block.h"
#include "check/time/tightening.h"
+#include "check/time/hmsc_block_paths.h"
#include "check/liveness/deadlock_checker.h"
#include <string>
#include <iostream>
@@ -57,15 +58,15 @@
MscTimeIntervalSetD ins1;
ins1.insert(in6);
-/* MscTimeIntervalD in7(10,20);
+ MscTimeIntervalD in7(10,20);
MscTimeIntervalSetD ins2;
- ins2.insert(in7); */
+ ins2.insert(in7);
TimeRelationRefNodePtr rel1a = new TimeRelationRefNode(ins1);
- rel1a->glue_ref_nodes(0,p1.get(),0,p6.get());
+ rel1a->glue_ref_nodes(0,p2.get(),0,p5.get());
-/* TimeRelationRefNodePtr rel1a2 = new TimeRelationRefNode(ins2);
- rel1a2->glue_ref_nodes(0,p3.get(),0,p4.get()); */
+ TimeRelationRefNodePtr rel1a2 = new TimeRelationRefNode(ins2);
+ rel1a2->glue_ref_nodes(0,p3.get(),0,p4.get());
TraverseAndMarkBlocks* trav_mark = new TraverseAndMarkBlocks();
trav_mark->travers_and_mark_blocks(h1);
@@ -74,5 +75,9 @@
{
std::cout << "Blok:" << (*it).get_number() << " if_end:" << (*it).get_if_end() << std::endl;
}
+ AllPathsAllBlocks* apab= new AllPathsAllBlocks(trav_mark->m_list_of_blocks, h1);
+ apab->all_paths_all_blocks();
+
+
return 0;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <koc...@us...> - 2010-03-11 15:08:07
|
Revision: 686
http://scstudio.svn.sourceforge.net/scstudio/?rev=686&view=rev
Author: kocianon
Date: 2010-03-11 15:08:00 +0000 (Thu, 11 Mar 2010)
Log Message:
-----------
Add part of hmsc tightening.
Modified Paths:
--------------
trunk/src/check/pseudocode/msc_duplicators.cpp
trunk/src/check/time/tightening.h
trunk/src/check/time/time_pseudocode.h
trunk/tests/interval_set_test.cpp
trunk/tests/tighten_msc_test.cpp
Modified: trunk/src/check/pseudocode/msc_duplicators.cpp
===================================================================
--- trunk/src/check/pseudocode/msc_duplicators.cpp 2010-03-11 08:14:39 UTC (rev 685)
+++ trunk/src/check/pseudocode/msc_duplicators.cpp 2010-03-11 15:08:00 UTC (rev 686)
@@ -448,6 +448,7 @@
{
CoregionEvent* preceding_new = dynamic_cast<CoregionEvent*>(m_duplicator->get_event_copy(preceding));
preceding_new->add_successor(coreg_new);
+ std::cerr << "creating coreg rel " << preceding_new << " -> " << coreg_new << std::endl;
}
}
}
Modified: trunk/src/check/time/tightening.h
===================================================================
--- trunk/src/check/time/tightening.h 2010-03-11 08:14:39 UTC (rev 685)
+++ trunk/src/check/time/tightening.h 2010-03-11 15:08:00 UTC (rev 686)
@@ -30,6 +30,83 @@
* \brief tightens BMsc
*/
+class AllCombination: public std::vector<std::pair<EventP,EventP> >
+{
+private:
+ std::list<std::vector<std::pair<EventP,EventP> > > lists;
+
+ std::vector<std::vector<std::pair<EventP,EventP> > >* v_lists;
+ std::vector<size_type>* iterators;
+ bool ini;
+
+ void set_value(size_t to)
+ {
+ for(size_t i= 0; i<= to;i++)
+ {
+ at(i)=((*v_lists)[i])[(*iterators)[i]];
+ }
+
+ }
+
+ bool move_next(size_t i)
+ {
+ if(i>=v_lists->size())
+ {
+ return false;
+ }
+
+ (*iterators)[i]++;
+
+ if((*iterators)[i]>=(*v_lists)[i].size())
+ {
+ (*iterators)[i]=0;
+ return move_next(++i);
+ }
+ set_value(i);
+ return true;
+ }
+
+public:
+ AllCombination():v_lists(NULL),iterators(NULL),ini(false)
+ {
+
+ }
+
+ ~AllCombination()
+ {
+ if(ini)
+ {
+ delete v_lists;
+ delete iterators;
+ }
+ }
+
+ void add_list(std::vector<std::pair<EventP,EventP> > floor)
+ {
+ lists.push_back(floor);
+ }
+
+ void init()
+ {
+ if(ini)
+ throw std::runtime_error("Already allocated!");
+ else
+ ini = true;
+
+ v_lists = new std::vector<std::vector<std::pair<EventP,EventP> > >(lists.begin(),lists.end());
+ resize(lists.size());
+ iterators = new std::vector<size_type>(lists.size(),0);
+ set_value(lists.size()-1);
+ }
+
+ bool move_next()
+ {
+ return move_next(0);
+ }
+
+};
+
+
class TightenBMsc
{
@@ -90,8 +167,179 @@
BMscPtr transform(BMscPtr bmsc);
};
+/*
+class SCTIME_EXPORT HMscTighter //:public Transformer // , public BMscTransformer
+{
+public:
+ HMscTighter()
+ {
+ }
+
+ ~HMscTighter()
+ {
+
+ }
+
+ HMscPtr transform(HMscPtr bmsc)
+ {
+
+ return NULL;
+ }
+
+ void tight_path(std::list<MscElement*> path)
+ {
+
+ std::list<EventP> events_to_delete;
+ HMscFlatPathToBMscDuplicator duplicator;
+ BMscPtr bmsc = duplicator.duplicate_path(path);
+
+ BMscIntervalSetMatrix b_matrix(bmsc); // create matrix
+ std::map<BMsc*,int> bmsc_to_count;
+ std::map<TimeRelationRefNodePtrSet*,EventP> rel_to_event;
+ std::set<TimeRelationRefNode*> open_rel;
+
+ Event* a;
+ AllCombination combination;
+ for(std::list<MscElement*>::iterator it=path.begin();it!=path.end();it++)
+ {
+ ReferenceNode* ref = dynamic_cast<ReferenceNode*>(*it);
+ if(ref==NULL)
+ continue;
+ BMscPtr in = ref->get_bmsc();
+ bmsc_to_count[in.get()]++; // @Warning initial integer number = 0?
+ TimeRelationRefNodePtrSet top = ref->get_time_relations_top();
+ TimeRelationRefNodePtrSet bottom = ref->get_time_relations_bottom();
+
+ if(top.size()>0)
+ {
+ a = new StrictEvent();
+ b_matrix.add_event(a);
+ events_to_delete.push_back(a);
+ rel_to_event[&top] = a;
+
+
+ MinimalEventPList min(in);
+ std::vector<std::pair<EventP,EventP> > floor(min.size());
+ for(MinimalEventPList::iterator m=min.begin();m=min.end();m++)
+ {
+ Event* copy = duplicator.get_copy(*m,bmsc_to_count[in]);
+ b_matrix.fill(a,copy,MscTimeIntervalD(0,D::infinity()));
+ floor.push_back(std::make_pair<EventP,EventP>(a,copy));
+ }
+ combination.add_list(floor);
+
+ }
+ // open/close relations
+ for(TimeRelationRefNodePtrSet::iterator it=top.begin();it!=top.end();it++)
+ {
+ if(open_rel.find(it->get())!=top.end())
+ {
+ TimeRelationRefNodePtrSet other;
+ if(ref==(*it)->get_ref_node_a()&&(*it)->is_top_node_a())
+ {
+ if((*it)->is_top_node_b())
+ other = (*it)->get_ref_node_b()->get_time_relations_top();
+ else
+ other = (*it)->get_ref_node_b()->get_time_relations_bottom();
+ }
+ else
+ {
+ if((*it)->is_top_node_a())
+ other = (*it)->get_ref_node_a()->get_time_relations_top();
+ else
+ other = (*it)->get_ref_node_a()->get_time_relations_bottom();
+ }
+
+ b_matrix.tied_rel_to_cell(*it,rel_to_event[other],a);
+
+ }
+ else
+ open_rel.insert(*it);
+ }
+
+ if(bottom.size()>0)
+ {
+ a = new Event();
+ b_matrix.add_event(a);
+ events_to_delete.push_back(a);
+ rel_to_event[&bottom] = a;
+ MaximalEventPList max(in);
+ std::vector<std::pair<EventP,EventP> > floor(max.size());
+ for(MaximalEventPList::iterator m=max.begin();m=max.end();m++)
+ {
+ Event* copy = duplicator.get_copy(*m,bmsc_to_count[in]);
+ b_matrix.fill(copy,a,MscTimeIntervalD(0,D::infinity()));
+ floor.push_back(std::make_pair<EventP,EventP>(copy,a));
+ }
+ combination.add_list(floor);
+ }
+
+ // open/close relations
+ for(TimeRelationRefNodePtrSet::iterator it=bottom.begin();it!=bottom.end();it++)
+ {
+ if(open_rel.find(it->get())!=top.end())
+ {
+ TimeRelationRefNodePtrSet other;
+ if(ref==(*it)->get_ref_node_a()&&(*it)->is_bottom_node_a())
+ {
+ if((*it)->is_top_node_b())
+ other = (*it)->get_ref_node_b()->get_time_relations_top();
+ else
+ other = (*it)->get_ref_node_b()->get_time_relations_bottom();
+ }
+ else
+ {
+ if((*it)->is_top_node_a())
+ other = (*it)->get_ref_node_a()->get_time_relations_top();
+ else
+ other = (*it)->get_ref_node_a()->get_time_relations_bottom();
+ }
+
+ b_matrix.tied_rel_to_cell(*it,rel_to_event[other],a);
+
+ }
+ else
+ open_rel.insert(*it);
+ }
+
+
+ }
+ IntervalSetMatrix result;
+ result.resize(b_matrix.size1());
+ combination.init();
+ do
+ {
+ // push there [0,0] interval
+ for(size_t i=0;i<combination.size();i++)
+ {
+ b_matrix.fill(combination[i].first,combination[i].second,MscTimeIntervalD(0,0));
+ }
+ MscSolveTCSP solve;
+ MscSolveTCSPReport report = solve.solveTCSP(b_matrix);
+ IntervalSetMatrix new_result = report.m_matrix_result;
+
+ for(unsigned i=0;i<new_result.size1();i++)
+ for(unsigned j=0;j<new_result.size1();j++)
+ result(i,j) = MscTimeIntervalSetD::set_union(result(i,j),new_result(i,j));
+
+ //return back previous value
+ for(size_t i=0;i<combination.size();i++)
+ {
+ b_matrix.fill(combination[i].first,combination[i].second,MscTimeIntervalD(0,D::infinity()));
+ }
+
+ } while(combination.move_next());
+
+ std::map<TimeRelation*, std::pair<unsigned,unsigned> > relations = b_matrix.get_tied_time_relations();
+
+ }
+
+};
+
+
+*/
class SCTIME_EXPORT Tighter:public Transformer
{
Modified: trunk/src/check/time/time_pseudocode.h
===================================================================
--- trunk/src/check/time/time_pseudocode.h 2010-03-11 08:14:39 UTC (rev 685)
+++ trunk/src/check/time/time_pseudocode.h 2010-03-11 15:08:00 UTC (rev 686)
@@ -230,7 +230,7 @@
using IntervalSetMatrix::operator();
//! return number of event in matrix
- unsigned get_number(EventP e)
+ const unsigned get_number(EventP e)
{
return m_event_to_number[e];
}
@@ -329,10 +329,21 @@
}
//! ties time relation to the cell
- void tied_rel_to_cell(TimeRelationPtr relation, size_t i, size_t j)
+ void tied_rel_to_cell(TimeRelationPtr relation, const size_t i, const size_t j)
{
m_rel_to_position[relation.get()]=std::make_pair<size_t,size_t>(i,j);
}
+
+ void tied_rel_to_cell(TimeRelationPtr relation, EventP i, EventP j)
+ {
+ tied_rel_to_cell(relation,get_number(i),get_number(j));
+ }
+
+ std::map<TimeRelation*, std::pair<unsigned,unsigned> > get_tied_time_relations()
+ {
+ return m_rel_to_position;
+ }
+
//! add event to the matrix (adding new row and column), returns column/row number in matrix
const size_t add_event(EventP event)
@@ -494,7 +505,7 @@
return e->set_attribute<int>(m_number,number);
}
- int get_number(HMscNodePtr e)
+ const int get_number(HMscNodePtr e)
{
return e->get_attribute<int>(m_number,0);
}
Modified: trunk/tests/interval_set_test.cpp
===================================================================
--- trunk/tests/interval_set_test.cpp 2010-03-11 08:14:39 UTC (rev 685)
+++ trunk/tests/interval_set_test.cpp 2010-03-11 15:08:00 UTC (rev 686)
@@ -120,6 +120,8 @@
MscTimeInterval<double> i3(6,10);
MscTimeInterval<double> i4(1,2);
MscTimeInterval<double> i5(3,4);
+ MscTimeInterval<double> i6("(0,inf)");
+ MscTimeInterval<double> i7("[-1]");
s1.insert(i1);
s2.insert(i2);
s3.insert(i3);
@@ -132,6 +134,6 @@
std::cerr << std::endl;
std::cerr << s3 << std::endl;
std::cerr << s4 << std::endl;
- std::cerr << MscTimeIntervalSet<double>::set_intersection(s3,s4) << std::endl;
+ std::cerr <<"intersection: " << MscTimeIntervalSet<double>::set_intersection(i6,i7) << std::endl;
return 0;
}
Modified: trunk/tests/tighten_msc_test.cpp
===================================================================
--- trunk/tests/tighten_msc_test.cpp 2010-03-11 08:14:39 UTC (rev 685)
+++ trunk/tests/tighten_msc_test.cpp 2010-03-11 15:08:00 UTC (rev 686)
@@ -130,6 +130,7 @@
Z120 z120;
// z120.save_msc(std::cout,L"original",bmsc);
// z120.save_msc(std::cout,L"result",result);
+/*
std::vector<MscPtr> mscs = z120.load_msc("cons_neg_1.mpr");
std::cout << mscs.size() << std::endl;
BMscPtr b = boost::dynamic_pointer_cast<BMsc>(mscs[0]);
@@ -145,11 +146,22 @@
}
else
std::cout << "neni" << std::endl;
-
+*/
// tight.max_tightener(min,max,sol.solve(conv.get_matrix()),i,bmsc,conv);
// std::pair<MscTimeIntervalSetD,IntervalSetMatrix> max_tightener(EventPList min, EventPList max,IntervalSetMatrix t_matrix,MscTimeIntervalSetD i,BMsc bmsc)
//
//std::cerr << pair.first << std::endl << pair.second << std::endl;
+ // z120.save_msc(std::cout,L"original",bmsc);
+ // z120.save_msc(std::cout,L"result",result);
+ std::vector<MscPtr> mscs = z120.load_msc("cons_neg_1.mpr");
+ BMscPtr b = boost::dynamic_pointer_cast<BMsc>(mscs[0]);
+ ConsistencyChecker con;
+ ChannelMapperPtr mapper;
+ con.check(b,mapper);
+ BMscPtr n = BMscDuplicator::duplicate(b);
+ z120.save_msc(std::cout,L"original",b);
+ z120.save_msc(std::cout,L"result",n);
+
return 0;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mar...@us...> - 2010-03-11 15:24:02
|
Revision: 687
http://scstudio.svn.sourceforge.net/scstudio/?rev=687&view=rev
Author: martinnrt
Date: 2010-03-11 15:23:54 +0000 (Thu, 11 Mar 2010)
Log Message:
-----------
add 2 files | traverse_erase - removes constraints in all hmsc | changed find_block_test, to be able to test new added files
Modified Paths:
--------------
trunk/src/check/time/CMakeLists.txt
trunk/src/check/time/hmsc_block_paths.cpp
trunk/tests/find_block_test.cpp
Added Paths:
-----------
trunk/src/check/time/traverse_erase.cpp
trunk/src/check/time/traverse_erase.h
Modified: trunk/src/check/time/CMakeLists.txt
===================================================================
--- trunk/src/check/time/CMakeLists.txt 2010-03-11 15:08:00 UTC (rev 686)
+++ trunk/src/check/time/CMakeLists.txt 2010-03-11 15:23:54 UTC (rev 687)
@@ -16,6 +16,8 @@
find_block.h
hmsc_block_paths.h
hmsc_block_paths.cpp
+ traverse_erase.h
+ traverse_erase.cpp
)
TARGET_LINK_LIBRARIES(sctime
Modified: trunk/src/check/time/hmsc_block_paths.cpp
===================================================================
--- trunk/src/check/time/hmsc_block_paths.cpp 2010-03-11 15:08:00 UTC (rev 686)
+++ trunk/src/check/time/hmsc_block_paths.cpp 2010-03-11 15:23:54 UTC (rev 687)
@@ -24,7 +24,6 @@
allpaths.add_path_found_listener(l);
allpaths.traverse();
m_last.clear();
- std::cout << "dojdeme na koniec aspon" << std::endl;
//don't know exatly what is result of allpaths.traverse() -- maybe list of path found listener??
}
}
Added: trunk/src/check/time/traverse_erase.cpp
===================================================================
--- trunk/src/check/time/traverse_erase.cpp (rev 0)
+++ trunk/src/check/time/traverse_erase.cpp 2010-03-11 15:23:54 UTC (rev 687)
@@ -0,0 +1,61 @@
+#include "check/time/traverse_erase.h"
+
+
+void TraverseErase::on_white_node_found(HMscNode* n)
+{
+ ReferenceNode* v= dynamic_cast<ReferenceNode*>(n);
+ if (v!=NULL)
+ {
+ erase_hmsc_constraints(v);
+ BMscPtr bmsc= v->get_bmsc();
+ if (bmsc!=NULL)
+ {
+ traverse_erase_bmsc(bmsc);
+ }
+ }
+}
+
+void TraverseErase::erase_hmsc_constraints(ReferenceNode* n)
+{
+ TimeRelationRefNodePtrSet node_constraints_bottom;
+ TimeRelationRefNodePtrSet node_constraints_top;
+ node_constraints_top.insert(n->get_time_relations_top().begin(), n->get_time_relations_top().end()); //fill with contraints in node v
+ node_constraints_bottom.insert(n->get_time_relations_bottom().begin(), n->get_time_relations_bottom().end()); //fill with contraints in node v
+ for (std::set<TimeRelationRefNodePtr>::iterator it = node_constraints_bottom.begin(); it != node_constraints_bottom.end(); it++) //iterate node constraints
+ {
+ n->remove_time_relation_bottom(*it);
+ }
+ for (std::set<TimeRelationRefNodePtr>::iterator it = node_constraints_top.begin(); it != node_constraints_top.end(); it++) //iterate node constraints
+ {
+ n->remove_time_relation_top(*it);
+ }
+
+std::cout << "Tu vymazane hmsc cons" << std::endl;
+ //erase top and bottom contraints
+}
+
+void TraverseErase::traverse_erase_bmsc(BMscPtr bmsc)
+{
+ DFSEventsTraverser* trav_bmsc_erase= new DFSEventsTraverser();
+ BmscTraverseErase* my_bmsc_trav= new BmscTraverseErase();
+ trav_bmsc_erase->add_white_event_found_listener(my_bmsc_trav);
+ trav_bmsc_erase->traverse(bmsc);
+}
+
+void BmscTraverseErase::on_white_event_found(Event* e)
+{
+ erase_bmsc_constraints(e);
+}
+
+void BmscTraverseErase::erase_bmsc_constraints(Event* e)
+{
+ e->clear_time_relations();
+ std::cout << "Tu vymazane bmsc cons" << std::endl;
+}
+
+
+
+
+
+
+
Added: trunk/src/check/time/traverse_erase.h
===================================================================
--- trunk/src/check/time/traverse_erase.h (rev 0)
+++ trunk/src/check/time/traverse_erase.h 2010-03-11 15:23:54 UTC (rev 687)
@@ -0,0 +1,50 @@
+
+#include "data/dfs_bmsc_graph_traverser.h" //hmsc traverser
+#include "data/dfs_events_traverser.h"
+#include "export.h"
+
+
+class SCTIME_EXPORT TraverseErase: public WhiteNodeFoundListener
+{
+public:
+ TraverseErase()
+ {}
+ virtual ~TraverseErase()
+ {}
+
+ virtual void on_white_node_found(HMscNode* n);
+ void erase_hmsc_constraints(ReferenceNode* n);
+ void traverse_erase_bmsc(BMscPtr bmsc);
+};
+
+class SCMSC_EXPORT BmscTraverseErase:public WhiteEventFoundListener//dfs event traverser
+{
+public:
+ BmscTraverseErase()
+ {}
+ virtual ~BmscTraverseErase()
+ {}
+
+ virtual void on_white_event_found(Event* e);
+ void erase_bmsc_constraints(Event* e);
+};
+
+class EraseAllConstraints
+{
+public:
+ EraseAllConstraints()
+ {}
+
+ void erase_all_constraints(HMscPtr hmsc)
+ {
+ DFSBMscGraphTraverser* trav_erase= new DFSBMscGraphTraverser();
+ TraverseErase* my_trav= new TraverseErase();
+ trav_erase->add_white_node_found_listener(my_trav);
+ trav_erase->traverse(hmsc);
+ }
+};
+
+
+
+
+
Modified: trunk/tests/find_block_test.cpp
===================================================================
--- trunk/tests/find_block_test.cpp 2010-03-11 15:08:00 UTC (rev 686)
+++ trunk/tests/find_block_test.cpp 2010-03-11 15:23:54 UTC (rev 687)
@@ -2,6 +2,7 @@
#include "data/msc.h"
#include "check/time/find_block.h"
+#include "check/time/traverse_erase.h"
#include "check/time/tightening.h"
#include "check/time/hmsc_block_paths.h"
#include "check/liveness/deadlock_checker.h"
@@ -75,9 +76,20 @@
{
std::cout << "Blok:" << (*it).get_number() << " if_end:" << (*it).get_if_end() << std::endl;
}
- AllPathsAllBlocks* apab= new AllPathsAllBlocks(trav_mark->m_list_of_blocks, h1);
- apab->all_paths_all_blocks();
+// AllPathsAllBlocks* apab= new AllPathsAllBlocks(trav_mark->m_list_of_blocks, h1);
+// apab->all_paths_all_blocks();
+
+
+
+
+
+
+
+ EraseAllConstraints* eac= new EraseAllConstraints();
+ eac->erase_all_constraints(h1);
+
+
return 0;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <koc...@us...> - 2010-03-12 05:21:29
|
Revision: 695
http://scstudio.svn.sourceforge.net/scstudio/?rev=695&view=rev
Author: kocianon
Date: 2010-03-12 05:21:23 +0000 (Fri, 12 Mar 2010)
Log Message:
-----------
hmsc tightening fix.
Modified Paths:
--------------
trunk/src/check/time/hmsc_all_paths.h
trunk/src/check/time/hmsc_block_paths.cpp
trunk/src/check/time/hmsc_block_paths.h
trunk/src/check/time/tightening.h
trunk/tests/tighten_hmsc_test.cpp
Modified: trunk/src/check/time/hmsc_all_paths.h
===================================================================
--- trunk/src/check/time/hmsc_all_paths.h 2010-03-12 02:41:10 UTC (rev 694)
+++ trunk/src/check/time/hmsc_all_paths.h 2010-03-12 05:21:23 UTC (rev 695)
@@ -1,7 +1,6 @@
#ifndef _AllPaths_
#define _AllPaths_
-#include "time_consistency.h"
#include "time_pseudocode.h"
//typedef std::pair<std::list<HMscNodePtr>,bool> HMscPath;
@@ -22,7 +21,7 @@
std::string m_number; //TODO rename to "name" ask Ondra, whether I didn't miss anything
std::list<PathFoundListener*> m_path_found_listeners;
-
+
//preconditions: every path from node first to end node should go through some node from last
public:
AllPaths(HMscPtr hmsc, //TimeRelationRefNodePtr relation,
@@ -30,7 +29,7 @@
const std::string& number="AllPathAlg")
:m_hmsc(hmsc),m_first(first),m_last(last),m_occurence(occurence),m_number(number)
{
-
+
}
~AllPaths()
@@ -54,7 +53,7 @@
for(node=m_nodes_set.begin();node!=m_nodes_set.end();node++)
(*node)->remove_attribute<int>(m_number);
}
-
+
/**
* Traverses given BMscGraph and calls on_path_found method of every added PathFoundListener on all paths, such:
* - the path starts from node first
@@ -62,7 +61,7 @@
* - the path does not contain more than occurence times of same node.
*/
static void traverse(
- HMscPtr hmsc,
+ HMscPtr hmsc,
HMscNodePtr first,
HMscNodePtrSet last,
int occurence
@@ -72,7 +71,7 @@
allpaths.traverse();
}
- void traverse();
+ void traverse();
void all_paths(HMscNodePtr, MscElementPList);
@@ -92,14 +91,14 @@
class PathFoundListener
{
public:
-
+
virtual ~PathFoundListener()
{
-
+
}
-
+
virtual void on_path_found(MscElementPList& path)=0;
-
+
};
#endif
\ No newline at end of file
Modified: trunk/src/check/time/hmsc_block_paths.cpp
===================================================================
--- trunk/src/check/time/hmsc_block_paths.cpp 2010-03-12 02:41:10 UTC (rev 694)
+++ trunk/src/check/time/hmsc_block_paths.cpp 2010-03-12 05:21:23 UTC (rev 695)
@@ -1,16 +1,18 @@
#include "check/time/hmsc_block_paths.h"
+
+/*
void BlockPathFoundListener::on_path_found(MscElementPList& path)
{
std::cout << "mam cestu" << std::endl;
//from hmsc path to bmsc ??
//then tighten ??
}
+*/
-
void AllPathsAllBlocks::all_paths_all_blocks()
-{
+{
// m_hmsc= AllPathsAllBlocks::m_hmsc;
// m_list_of_blocks= AllPathsAllBlocks::m_list_of_blocks;
int i=0;
@@ -20,8 +22,8 @@
std::cout << "Cesty v " << i << " bloku" << std::endl;
m_last.insert(it->get_end());
AllPaths allpaths = AllPaths(m_hmsc, it->get_begin(), m_last, 1);
- BlockPathFoundListener* l= new BlockPathFoundListener();
- allpaths.add_path_found_listener(l);
+
+ allpaths.add_path_found_listener(m_listener);
allpaths.traverse();
m_last.clear();
//don't know exatly what is result of allpaths.traverse() -- maybe list of path found listener??
Modified: trunk/src/check/time/hmsc_block_paths.h
===================================================================
--- trunk/src/check/time/hmsc_block_paths.h 2010-03-12 02:41:10 UTC (rev 694)
+++ trunk/src/check/time/hmsc_block_paths.h 2010-03-12 05:21:23 UTC (rev 695)
@@ -1,31 +1,44 @@
+#ifndef _HMSC_BLOCKPATHS_H_
+#define _HMSC_BLOCKPATHS_H_
-
#include "check/time/hmsc_all_paths.h"
#include "check/time/find_block.h"
class SCTIME_EXPORT BlockPathFoundListener:public PathFoundListener
{
public:
+ BlockPathFoundListener()
+ {}
+
virtual ~BlockPathFoundListener()
{}
- void on_path_found(MscElementPList& path);
+
+ virtual void on_path_found(MscElementPList& path)=0;
};
class AllPathsAllBlocks
{
private:
- HMscPtr m_hmsc;
+ HMscPtr m_hmsc;
HMscNodePtr m_first;
HMscNodePtrSet m_last;
+ PathFoundListener* m_listener;
// int m_occurence;
std::list<Block> m_list_of_blocks;
+
+
public:
- AllPathsAllBlocks(std::list<Block> list_of_blocks, HMscPtr hmsc)//(Block* block, HMscPtr hmsc)
+ AllPathsAllBlocks(std::list<Block> list_of_blocks, HMscPtr hmsc):m_hmsc(hmsc),m_list_of_blocks(list_of_blocks)//(Block* block, HMscPtr hmsc)
{
- this->m_list_of_blocks=list_of_blocks;
- this->m_hmsc=hmsc;
}
void all_paths_all_blocks();
+ void set_listener(PathFoundListener* l)
+ {
+ m_listener = l;
+ }
+
};
+
+#endif // _HMSC_BLOCKPATHS_H_
Modified: trunk/src/check/time/tightening.h
===================================================================
--- trunk/src/check/time/tightening.h 2010-03-12 02:41:10 UTC (rev 694)
+++ trunk/src/check/time/tightening.h 2010-03-12 05:21:23 UTC (rev 695)
@@ -24,7 +24,7 @@
#include "check/pseudocode/msc_duplicators.h"
#include "data/transformer.h"
#include "hmsc_all_paths.h"
-//#include "hmsc_block_paths.h"
+#include "hmsc_block_paths.h"
#include <vector>
@@ -175,7 +175,7 @@
BMscPtr transform(BMscPtr bmsc);
};
-class SCTIME_EXPORT HMscTighter //:public Transformer // , public BMscTransformer
+class SCTIME_EXPORT HMscTighter: public PathFoundListener //:public Transformer // , public BMscTransformer
{
public:
@@ -191,23 +191,30 @@
HMscPtr transform(HMscPtr h)
{
- /*
+ HMscDuplicator duplicator;
+ HMscPtr result = duplicator.duplicate(h);
BMscGraphDuplicator graph_dup;
- HMscPtr bmsc_graph = graph_dup.duplicate_hmsc(h);
- AllPaths all_paths;
- all_paths.
- */
- return NULL;
+ HMscPtr bmsc_graph = graph_dup.duplicate_hmsc(result);
+ TraverseAndMarkBlocks block_marker;
+ block_marker.travers_and_mark_blocks(bmsc_graph);
+
+
+ AllPathsAllBlocks block_to_path(block_marker.m_list_of_blocks,bmsc_graph);
+ block_to_path.set_listener(this);
+ block_to_path.all_paths_all_blocks();
+
+
+ return result;
}
- IntervalSetMatrix tight_path(std::list<MscElement*> path)
+ virtual void on_path_found(std::list<MscElement*>& path)
{
std::list<EventP> events_to_delete;
HMscFlatPathToBMscDuplicator duplicator;
BMscPtr bmsc = duplicator.duplicate_path(path);
-
+
BMscIntervalSetMatrix b_matrix(bmsc); // create matrix
std::map<BMsc*,int> bmsc_to_count;
@@ -232,7 +239,7 @@
b_matrix.add_event(a);
events_to_delete.push_back(a);
rel_to_event[top] = a;
-
+
MinimalEventPList min(in);
std::vector<std::pair<EventP,EventP> > floor(min.size());
for(MinimalEventPList::iterator m=min.begin();m!=min.end();m++)
@@ -254,14 +261,14 @@
{
if((*it)->is_top_node_b())
other = &((*it)->get_ref_node_b()->get_time_relations_top());
- else
+ else
other = &((*it)->get_ref_node_b()->get_time_relations_bottom());
}
- else
+ else
{
if((*it)->is_top_node_a())
other = &((*it)->get_ref_node_a()->get_time_relations_top());
- else
+ else
other = &((*it)->get_ref_node_a()->get_time_relations_bottom());
}
b_matrix.fill(a,rel_to_event[other],(*it)->get_interval_set());
@@ -298,25 +305,25 @@
{
if((*it)->is_top_node_b())
other = &((*it)->get_ref_node_b()->get_time_relations_top());
- else
+ else
other = &((*it)->get_ref_node_b()->get_time_relations_bottom());
}
- else
+ else
{
if((*it)->is_top_node_a())
other = &((*it)->get_ref_node_a()->get_time_relations_top());
- else
+ else
other = &((*it)->get_ref_node_a()->get_time_relations_bottom());
}
b_matrix.fill(rel_to_event[other],a,(*it)->get_interval_set());
}
else
open_rel.insert((*it).get());
- }
+ }
}
b_matrix.build_up();
-
+
IntervalSetMatrix result;
result.resize(b_matrix.size1());
combination.init();
@@ -337,7 +344,7 @@
IntervalSetMatrix new_result = report.m_matrix_result;
-
+
for(unsigned i=0;i<new_result.size1();i++)
for(unsigned j=0;j<new_result.size1();j++)
result(i,j) = MscTimeIntervalSetD::set_union(result(i,j),new_result(i,j));
@@ -349,7 +356,7 @@
}
} while(combination.move_next());
- /*
+
std::map<TimeRelation*, std::pair<unsigned,unsigned> > relations = b_matrix.get_tied_time_relations();
for(std::map<TimeRelation*, std::pair<unsigned,unsigned> >::iterator it=relations.begin();it!=relations.end();it++)
@@ -365,8 +372,6 @@
copy->get_interval_set() = MscTimeIntervalSetD::set_union(copy->get_interval_set(),result(it->second.first,it->second.second));
}
- */
- return result;
}
Modified: trunk/tests/tighten_hmsc_test.cpp
===================================================================
--- trunk/tests/tighten_hmsc_test.cpp 2010-03-12 02:41:10 UTC (rev 694)
+++ trunk/tests/tighten_hmsc_test.cpp 2010-03-12 05:21:23 UTC (rev 695)
@@ -65,8 +65,8 @@
CompleteMessagePtr m21 = new CompleteMessage(L"hi1");
m21->glue_events(e20, e21);
-
-
+
+
MscTimeIntervalD in6(0,5);
MscTimeIntervalD in8(5,10);
MscTimeIntervalD in9(7,D::infinity());
@@ -80,7 +80,7 @@
ins1.insert(in6);
ins1.insert(in9);
-
+
ins2.insert(in10);
ins3.insert(in8);
@@ -91,7 +91,7 @@
TimeRelationEventPtr rel2 = new TimeRelationEvent(ins2);
rel2->glue_events(e20.get(),e21.get());
-
+
Z120 z120;
z120.save_msc(std::cout,L"original 1",bmsc);
@@ -102,12 +102,12 @@
// // SRMChannelMapperPtr srlm = SRMChannelMapper::instance(); //sender-receiver-label
HMscPtr h1(new HMsc(L"h1"));
-
+
StartNodePtr start1 = new StartNode(); h1->set_start(start1);
EndNodePtr end1(new EndNode);h1->add_node(end1);
ReferenceNodePtr p1(new ReferenceNode());h1->add_node(p1);
ReferenceNodePtr p2(new ReferenceNode());h1->add_node(p2);
-
+
start1->add_successor(p1.get());
p1->add_successor(p2.get());
p1->add_successor(p1.get());
@@ -116,10 +116,10 @@
p1->set_msc(bmsc);
p2->set_msc(bmsc2);
-
+
TimeRelationRefNodePtr rel3 = new TimeRelationRefNode(ins3);
rel3->glue_ref_nodes(0,p1.get(),1,p2.get());
-
+
std::cout << " " << std::endl;
std::list<MscElement*> path_list;
@@ -127,27 +127,28 @@
path_list.push_back(p2.get());
HMscTighter* tighter = new HMscTighter();
- IntervalSetMatrix result = tighter->tight_path(path_list);
+ //IntervalSetMatrix result =
+ tighter->on_path_found(path_list);
- std::cout<< "matrix result:" << std::endl;
- std::cout<< result << std::endl;
+ std::cout<< "matrix result:" << std::endl;
+ // std::cout<< result << std::endl;
-
+
HMscFlatPathToBMscDuplicator duplicator;
bmsc2 = duplicator.duplicate_path(path_list);
p1->set_msc(bmsc2);
path_list.clear();
path_list.push_back(p1.get());
rel3->glue_ref_nodes(0,p1.get(),1,p1.get());
- result = tighter->tight_path(path_list);
- std::cout<< result << std::endl;
-
-
+ // result = tighter->tight_path(path_list);
+ // std::cout<< result << std::endl;
- std::cout<< "test finished" << std::endl;
+
+ std::cout<< "test finished" << std::endl;
+
return 0;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <koc...@us...> - 2010-03-12 10:19:35
|
Revision: 698
http://scstudio.svn.sourceforge.net/scstudio/?rev=698&view=rev
Author: kocianon
Date: 2010-03-12 10:19:27 +0000 (Fri, 12 Mar 2010)
Log Message:
-----------
hmsc tightening - windows compilation fix
Modified Paths:
--------------
trunk/src/check/time/CMakeLists.txt
trunk/src/check/time/tightening.h
trunk/src/check/time/traverse_erase.cpp
trunk/src/check/time/traverse_erase.h
trunk/src/data/msc.h
trunk/tests/CMakeLists.txt
Modified: trunk/src/check/time/CMakeLists.txt
===================================================================
--- trunk/src/check/time/CMakeLists.txt 2010-03-12 06:05:28 UTC (rev 697)
+++ trunk/src/check/time/CMakeLists.txt 2010-03-12 10:19:27 UTC (rev 698)
@@ -5,6 +5,8 @@
time_pseudocode.h
time_consistency.cpp
time_consistency.h
+ traverse_erase.cpp
+ traverse_erase.h
tightening.cpp
tightening.h
constraint_syntax.cpp
@@ -14,10 +16,10 @@
hmsc_all_paths.cpp
find_block.cpp
find_block.h
+ hmsc_block_paths.cpp
hmsc_block_paths.h
- hmsc_block_paths.cpp
- traverse_erase.h
- traverse_erase.cpp
+
+
)
TARGET_LINK_LIBRARIES(sctime
Modified: trunk/src/check/time/tightening.h
===================================================================
--- trunk/src/check/time/tightening.h 2010-03-12 06:05:28 UTC (rev 697)
+++ trunk/src/check/time/tightening.h 2010-03-12 10:19:27 UTC (rev 698)
@@ -25,6 +25,7 @@
#include "data/transformer.h"
#include "hmsc_all_paths.h"
#include "hmsc_block_paths.h"
+#include "traverse_erase.h"
#include <vector>
@@ -193,6 +194,8 @@
{
HMscDuplicator duplicator;
HMscPtr result = duplicator.duplicate(h);
+ // EraseAllConstraints erase;
+ // erase.erase_all_constraints(result);
BMscGraphDuplicator graph_dup;
HMscPtr bmsc_graph = graph_dup.duplicate_hmsc(result);
@@ -230,8 +233,8 @@
continue;
BMscPtr in = ref->get_bmsc();
bmsc_to_count[in.get()]++; // @Warning initial integer number = 0?
- const TimeRelationRefNodePtrSet* top = &ref->get_time_relations_top();
- const TimeRelationRefNodePtrSet* bottom = &ref->get_time_relations_bottom();
+ TimeRelationRefNodePtrSet* top = &(ref->get_time_relations_top());
+ TimeRelationRefNodePtrSet* bottom = &(ref->get_time_relations_bottom());
if(top->size()>0)
{
@@ -252,7 +255,7 @@
}
// open/close relations
- for(TimeRelationRefNodePtrSet::iterator it=top->begin();it!=top->end();it++)
+ for(TimeRelationRefNodePtrSet::const_iterator it=top->begin();it!=top->end();it++)
{
if(open_rel.find(it->get()) != open_rel.end())
{
@@ -272,6 +275,7 @@
other = &((*it)->get_ref_node_a()->get_time_relations_bottom());
}
b_matrix.fill(a,rel_to_event[other],(*it)->get_interval_set());
+ b_matrix.tied_rel_to_cell(*it,a, rel_to_event[other]);
}
else
open_rel.insert((*it).get());
@@ -316,6 +320,7 @@
other = &((*it)->get_ref_node_a()->get_time_relations_bottom());
}
b_matrix.fill(rel_to_event[other],a,(*it)->get_interval_set());
+ b_matrix.tied_rel_to_cell(*it,rel_to_event[other],a);
}
else
open_rel.insert((*it).get());
@@ -362,7 +367,7 @@
for(std::map<TimeRelation*, std::pair<unsigned,unsigned> >::iterator it=relations.begin();it!=relations.end();it++)
{
TimeRelation* copy = it->first;
- if(copy->get_original()==NULL || copy->get_original()->get_original()!=NULL)
+ if(copy->get_original()==NULL || copy->get_original()->get_original()==NULL)
throw std::runtime_error("To close to original time relation, something went wrong");
while(copy->get_original()->get_original()!=NULL)
Modified: trunk/src/check/time/traverse_erase.cpp
===================================================================
--- trunk/src/check/time/traverse_erase.cpp 2010-03-12 06:05:28 UTC (rev 697)
+++ trunk/src/check/time/traverse_erase.cpp 2010-03-12 10:19:27 UTC (rev 698)
@@ -36,10 +36,10 @@
void TraverseErase::traverse_erase_bmsc(BMscPtr bmsc)
{
- DFSEventsTraverser* trav_bmsc_erase= new DFSEventsTraverser();
- BmscTraverseErase* my_bmsc_trav= new BmscTraverseErase();
- trav_bmsc_erase->add_white_event_found_listener(my_bmsc_trav);
- trav_bmsc_erase->traverse(bmsc);
+ DFSEventsTraverser trav_bmsc_erase;
+ BmscTraverseErase my_bmsc_trav;
+ trav_bmsc_erase.add_white_event_found_listener(&my_bmsc_trav);
+ trav_bmsc_erase.traverse(bmsc);
}
void BmscTraverseErase::on_white_event_found(Event* e)
Modified: trunk/src/check/time/traverse_erase.h
===================================================================
--- trunk/src/check/time/traverse_erase.h 2010-03-12 06:05:28 UTC (rev 697)
+++ trunk/src/check/time/traverse_erase.h 2010-03-12 10:19:27 UTC (rev 698)
@@ -1,3 +1,5 @@
+#ifndef _TRAVERSE_ERASE_H_
+#define _TRAVERSE_ERASE_H_
#include "data/dfs_bmsc_graph_traverser.h" //hmsc traverser
#include "data/dfs_events_traverser.h"
@@ -17,7 +19,7 @@
void traverse_erase_bmsc(BMscPtr bmsc);
};
-class SCMSC_EXPORT BmscTraverseErase:public WhiteEventFoundListener//dfs event traverser
+class SCTIME_EXPORT BmscTraverseErase:public WhiteEventFoundListener //dfs event traverser
{
public:
BmscTraverseErase()
@@ -37,10 +39,10 @@
void erase_all_constraints(HMscPtr hmsc)
{
- DFSBMscGraphTraverser* trav_erase= new DFSBMscGraphTraverser();
- TraverseErase* my_trav= new TraverseErase();
- trav_erase->add_white_node_found_listener(my_trav);
- trav_erase->traverse(hmsc);
+ DFSBMscGraphTraverser trav_erase;
+ TraverseErase my_trav;
+ trav_erase.add_white_node_found_listener(&my_trav);
+ trav_erase.traverse(hmsc);
}
};
@@ -48,3 +50,4 @@
+#endif // _TRAVERSE_ERASE_H_
Modified: trunk/src/data/msc.h
===================================================================
--- trunk/src/data/msc.h 2010-03-12 06:05:28 UTC (rev 697)
+++ trunk/src/data/msc.h 2010-03-12 10:19:27 UTC (rev 698)
@@ -1065,11 +1065,20 @@
return m_time_relation_set_top;
}
+ TimeRelationRefNodePtrSet& get_time_relations_top()
+ {
+ return m_time_relation_set_top;
+ }
+
const TimeRelationRefNodePtrSet& get_time_relations_bottom() const
{
return m_time_relation_set_bottom;
}
+ TimeRelationRefNodePtrSet& get_time_relations_bottom()
+ {
+ return m_time_relation_set_bottom;
+ }
#endif
};
Modified: trunk/tests/CMakeLists.txt
===================================================================
--- trunk/tests/CMakeLists.txt 2010-03-12 06:05:28 UTC (rev 697)
+++ trunk/tests/CMakeLists.txt 2010-03-12 10:19:27 UTC (rev 698)
@@ -70,7 +70,6 @@
scmsc
sctime
scpseudocode
- scorder
)
ADD_TEST(find_block ${EXECUTABLE_OUTPUT_PATH}/find_block_test)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2010-03-14 23:34:26
|
Revision: 699
http://scstudio.svn.sourceforge.net/scstudio/?rev=699&view=rev
Author: madzin
Date: 2010-03-14 23:34:18 +0000 (Sun, 14 Mar 2010)
Log Message:
-----------
Adds time to membership algorithm
Modified Paths:
--------------
trunk/src/membership/membership_alg.cpp
trunk/src/membership/membership_alg.h
trunk/tests/membership/CMakeLists.txt
Modified: trunk/src/membership/membership_alg.cpp
===================================================================
--- trunk/src/membership/membership_alg.cpp 2010-03-12 10:19:27 UTC (rev 698)
+++ trunk/src/membership/membership_alg.cpp 2010-03-14 23:34:18 UTC (rev 699)
@@ -21,8 +21,12 @@
// map of bmsc names and configurations which were checked
std::map<std::wstring, std::set<ConfigurationPtr> > checked;
+std::map<TimeRelationRefNodePtr, ConfigurationPtr> top_time_references;
+std::map<TimeRelationRefNodePtr, ConfigurationPtr> bottom_time_references;
+
//identification for receive events
int max_id;
+BMscPtr global_bmsc;
InstancePtr find_instance(InstancePtrList instances, std::wstring name);
@@ -65,6 +69,18 @@
bool is_strict_area_null(StrictOrderAreaPtr strict);
+bool check_node_time(ReferenceNodePtr node, ConfigurationPtr conf);
+
+int get_max_interval(ReferenceNodePtr node, ConfigurationPtr conf);
+
+int get_min_interval(ConfigurationPtr conf);
+
+Event* get_last_instance_event(Event* start, int id = INT_MAX);
+
+bool compare_events_time_relations(Event* a, Event* b);
+
+Event* find_event_on_instance_by_id(std::wstring label, int id);
+
/*
* Returns precondition list of the membership algorithm
*/
@@ -89,6 +105,8 @@
return NULL;
}
+ global_bmsc = bmsc_f;
+
if (hmsc != NULL)
return search_hmsc(hmsc, bmsc_f);
else
@@ -108,14 +126,33 @@
BMscGraphDuplicator duplicator;
HMscPtr dup_hmsc;
- dup_hmsc = duplicator.duplicate(hmsc);
+/*
+StartNodePtr start = hmsc->get_start();
+NodeRelationPtrVector succ = start->get_successors();
+SuccessorNode* hmsc_node = succ.front()->get_successor();
+ReferenceNode* node = dynamic_cast<ReferenceNode*> (hmsc_node);
+std::wcerr << L"node_time " << node->get_msc()->get_label() << std::endl;
+TimeRelationRefNodePtrSet top = node->get_time_relations_top();
+std::cout << "top size " << top.size() << std::endl;
+*/
+dup_hmsc = hmsc; // dup_hmsc = duplicator.duplicate(hmsc);
+
+/*
+start = dup_hmsc->get_start();
+succ = start->get_successors();
+hmsc_node = succ.front()->get_successor();
+node = dynamic_cast<ReferenceNode*> (hmsc_node);
+std::wcerr << L"node_time " << node->get_msc()->get_label() << std::endl;
+top = node->get_time_relations_top();
+std::cout << "top size " << top.size() << std::endl;
+*/
+
+
//creates configuration of defined bMSC
ConfigurationPtr searched_conf = new Configuration(bmsc_f->get_instances());
StartNodePtr start_node = dup_hmsc->get_start();
- NodeRelationPtrVector successors = start_node->get_successors();
- NodeRelationPtrVector::iterator it;
if (check_branch(start_node, searched_conf))
{
@@ -186,14 +223,20 @@
if (!look_at_checked_conf(node, b))
return false;
- ConfigurationPtr old_config = new Configuration(b);
+ ConfigurationPtr old_config_I, old_config_II;
+ old_config_I = new Configuration(b);
+ old_config_II = new Configuration(b);
+
if (!check_node(node, membership, b))
return false;
- if (!check_node(node, receive_ordering, old_config))
+ if(!check_node_time(node, old_config_II))
return false;
+ if (!check_node(node, receive_ordering, old_config_I))
+ return false;
+
NodeRelationPtrVector successors = node->get_successors();
NodeRelationPtrVector::iterator it;
SuccessorNode* succ;
@@ -551,6 +594,7 @@
return true;
}
+//parameters node_e, b_e
bool compare_events_attribute(Event* a, Event* b)
{
IncompleteMessagePtr incom_a = boost::dynamic_pointer_cast<IncompleteMessage > (a->get_message());
@@ -585,9 +629,159 @@
if (a_set || b_set || a_id != b_id)
return false;
- return true;
+ return compare_events_time_relations(a,b);
}
+//parameters node_e, b_e
+bool compare_events_time_relations(Event* a, Event* b)
+{
+ TimeRelationEventPtrList node_intervals = a->get_time_relations();
+ TimeRelationEventPtrList::iterator it;
+ int time_b_id;
+
+ for(it = node_intervals.begin(); it != node_intervals.end(); it++)
+ {
+ if((*it)->get_event_a() == a)
+ {
+ bool time_b_id_set = true;
+
+ time_b_id = (*it)->get_event_b()->get_attribute("identification", -1, time_b_id_set);
+
+ if(time_b_id_set)
+ {
+ std::cerr << "Error: Unexpected behaviour 3" << std::endl;
+ return false;
+ }
+
+ Event* bmsc_b_event = find_event_on_instance_by_id((*it)->get_event_b()->get_instance()->get_label(), time_b_id);
+
+ if(bmsc_b_event == NULL)
+ return false;
+
+ TimeRelationEventPtrList time_a_intervals = b->get_time_relations();
+ TimeRelationEventPtrList time_b_intervals = bmsc_b_event->get_time_relations();
+
+ if(time_a_intervals.size() == 0 || time_b_intervals.size() == 0)
+ {
+ std::cerr << "Error: Events in bmsc has to have time relation." << std::endl;
+ return false;
+ }
+
+ MscTimeIntervalSetD time_a_set = time_a_intervals.front()->get_interval_set();
+ MscTimeIntervalSetD time_b_set = time_b_intervals.front()->get_interval_set();
+
+ if(time_a_set.is_empty() || time_b_set.is_empty())
+ {
+ std::cerr << "Error: Time interval is corrupted" << std::endl;
+ return false;
+ }
+
+ MscTimeInterval<double> a_interval = time_a_set.get_set().front();
+ MscTimeInterval<double> b_interval = time_b_set.get_set().front();
+
+ double a_time = a_interval.get_begin_value();
+ double b_time = b_interval.get_begin_value();
+
+ if(time_a_intervals.size() > 1)
+ a_time = 0;
+
+ if(time_b_intervals.size() > 1)
+ b_time = 0;
+
+ double bmsc_inter = b_time - a_time;
+
+ MscTimeIntervalSetD hmsc_inter = (*it)->get_interval_set();
+ MscTimeIntervalSetD result, bmsc_inter_set;
+
+ bmsc_inter_set.insert(*(new MscTimeInterval<double>(bmsc_inter)));
+ result = MscTimeIntervalSetD::set_intersection(hmsc_inter, bmsc_inter_set);
+
+ if(result.is_empty())
+ return false;
+ }
+ }
+
+ return true;
+}
+
+Event* find_event_on_instance_by_id(std::wstring label, int id)
+{
+ InstancePtrList instances = global_bmsc->get_instances();
+ InstancePtrList::iterator it;
+ InstancePtr instance;
+
+ for(it = instances.begin(); it != instances.end(); it++)
+ {
+ if((*it)->get_label() == label)
+ {
+ instance = *it;
+ break;
+ }
+ }
+
+ EventAreaPtr first = instance->get_first();
+ StrictOrderAreaPtr strict = boost::dynamic_pointer_cast<StrictOrderArea>(first);
+
+ StrictEventPtr str = strict->get_first();
+
+ if(str == NULL)
+ {
+ std::cerr << "Error: Unexpected behaviour 5" << std::endl;
+ return NULL;
+ }
+
+ int event_id;
+ bool event_set = true;
+
+ event_id = str->get_attribute("identification", -1, event_set);
+
+ if(event_set)
+ {
+ std::cerr << "Error: Unexpected behaviour 4" << std::endl;
+ return NULL;
+ }
+
+ StrictEventPtr old;
+
+ while(event_id != id)
+ {
+ old = str;
+ str = str->get_successor();
+
+ if(str == NULL)
+ {
+ EventAreaPtr area = old->get_general_area();
+ area = area->get_next();
+
+ strict = boost::dynamic_pointer_cast<StrictOrderArea>(area);
+
+ if(strict == NULL)
+ {
+ std::cerr << "Error: Node was not found" << std::endl;
+ return NULL;
+ }
+
+ str = strict->get_first();
+
+ if(str == NULL)
+ {
+ std::cerr << "Error: Node was not found" << std::endl;
+ return NULL;
+ }
+ }
+
+ event_id = str->get_attribute("identification", -1, event_set);
+
+ if(event_set)
+ {
+ std::cerr << "Error: Unexpected behaviour 4" << std::endl;
+ return NULL;
+ }
+ }
+
+ return str.get();
+}
+
/*
* Tries finding bMSC in bMSC
*
@@ -615,7 +809,7 @@
node->add_successor(succ);
else
{
- std::cout << "unexpected error" << std::endl;
+ std::cout << "Error: Unexpected behaviour" << std::endl;
return false;
}
@@ -630,7 +824,7 @@
node->add_successor(succ);
else
{
- std::cout << "unexpected error" << std::endl;
+ std::cout << "Error: Unexpected behaviour" << std::endl;
return false;
}
@@ -777,7 +971,7 @@
if (node_events.empty())
node_events.push_back(node_strict->get_first().get());
else
- std::cout << "node_events should be empty" << std::endl;
+ std::cout << "Error: Unexpected error" << std::endl;
}
bool result;
@@ -881,7 +1075,6 @@
bool check_node(ReferenceNodePtr node, enum check_type type, ConfigurationPtr conf)
{
//get msc from the node
-
ConfigurationPtr old_conf = new Configuration(conf);
MscPtr msc = node->get_msc();
@@ -1023,6 +1216,9 @@
bool is_cor_area_null(CoregionAreaPtr cor)
{
+ if(cor == NULL)
+ return true;
+
if(!cor->get_minimal_events().empty())
return false;
@@ -1031,8 +1227,442 @@
bool is_strict_area_null(StrictOrderAreaPtr strict)
{
+ if(strict == NULL)
+ return true;
+
if(strict->get_first() != NULL)
return false;
return true;
}
+
+bool check_node_time(ReferenceNodePtr node, ConfigurationPtr conf)
+{
+//std::wcerr << L"node_time " << node->get_msc()->get_label() << std::endl;
+
+ TimeRelationRefNodePtrSet top = node->get_time_relations_top();
+ TimeRelationRefNodePtrSet bottom = node->get_time_relations_bottom();
+ TimeRelationRefNodePtrSet::iterator it;
+
+ std::vector<TimeRelationRefNodePtr> top_vec, bottom_vec, themself_vec;
+
+//top_time_references, bottom_time_references su tam ulozene uzly kde sa zacina casovy interval, a su usporiadane podla top/bottom. To znamena casovy interval na node_a je pripojeny na top/bottom.
+
+//top_vec, bottom_vec su tam ulozene intervaly kde je aktualny node pripojeny ako koniec intervalu, su usporiadane podla top/bottom.
+
+ for(it = top.begin(); it!=top.end(); it++)
+ {
+ if((*it)->get_ref_node_b() == node.get())
+ {
+ if((*it)->get_ref_node_b() == (*it)->get_ref_node_a())
+ themself_vec.push_back(*it);
+ else
+ top_vec.push_back(*it);
+ }
+ else
+ top_time_references.insert(std::make_pair(*it, conf));
+ }
+
+ for(it = bottom.begin(); it!=bottom.end(); it++)
+ {
+ if((*it)->get_ref_node_b() == node.get())
+ {
+ if((*it)->get_ref_node_b() != (*it)->get_ref_node_a())
+ bottom_vec.push_back(*it);
+ }
+ else
+ bottom_time_references.insert(std::make_pair(*it, conf));
+ }
+
+ int max_a, max_b, min_a, min_b;
+
+ if(!themself_vec.empty())
+ {
+ if(themself_vec.size() > 1)
+ {
+ std::cerr << "Error: more time intervals between top and bottom of one reference node" << std::endl;
+ return false;
+ }
+
+ min_a = get_min_interval(conf);
+ max_b = get_max_interval(node, conf);
+
+ int bmsc_inter = max_b - min_a;
+
+ TimeRelationRefNodePtr relation = themself_vec.front();
+
+ if(relation == NULL)
+ {
+ std::cout<<"Error: Unexpected program's behaviour"<<std::endl;
+ return false;
+ }
+
+ MscTimeIntervalSetD hmsc_inter = relation->get_interval_set();
+ MscTimeIntervalSetD result, bmsc_inter_set;
+
+ bmsc_inter_set.insert(*(new MscTimeInterval<double>(bmsc_inter)));
+ result = MscTimeIntervalSetD::set_intersection(hmsc_inter, bmsc_inter_set);
+
+ if(result.is_empty())
+ return false;
+ }
+
+ if(!top_vec.empty())
+ min_b = get_min_interval(conf);
+
+ if(!bottom_vec.empty())
+ max_b = get_max_interval(node, conf);
+
+ std::vector<TimeRelationRefNodePtr>::iterator it_vec;
+ std::map<TimeRelationRefNodePtr, ConfigurationPtr>::iterator it_map;
+
+ if(max_b != INT_MAX)
+ {
+ for(it_vec = bottom_vec.begin(); it_vec != bottom_vec.end(); it_vec++)
+ {
+ it_map = top_time_references.find(*it_vec);
+
+ if(it_map == top_time_references.end())
+ continue;
+
+ int bmsc_inter;
+
+ min_a = get_min_interval(it_map->second);
+ bmsc_inter = max_b - min_a;
+
+ MscTimeIntervalSetD hmsc_inter = (*it_vec)->get_interval_set();
+ MscTimeIntervalSetD result;
+ MscTimeIntervalSetD bmsc_inter_set;
+ bmsc_inter_set.insert(*(new MscTimeInterval<double>(bmsc_inter)));
+
+ result = MscTimeIntervalSetD::set_intersection(hmsc_inter, bmsc_inter_set);
+
+ if(result.is_empty())
+ return false;
+ }
+
+ for(it_vec = bottom_vec.begin(); it_vec != bottom_vec.end(); it_vec++)
+ {
+ it_map = bottom_time_references.find(*it_vec);
+
+ if(it_map == bottom_time_references.end())
+ continue;
+
+ int bmsc_inter;
+
+ max_a = get_max_interval(it_map->first->get_ref_node_a(), it_map->second);
+ bmsc_inter = max_b - max_a;
+
+ MscTimeIntervalSetD hmsc_inter = (*it_vec)->get_interval_set();
+ MscTimeIntervalSetD result, bmsc_inter_set;
+
+ bmsc_inter_set.insert(*(new MscTimeInterval<double>(bmsc_inter)));
+
+ result = MscTimeIntervalSetD::set_intersection(hmsc_inter, bmsc_inter_set);
+ if(result.is_empty())
+ return false;
+ }
+
+ }
+
+ if(min_b != INT_MAX)
+ {
+ for(it_vec = top_vec.begin(); it_vec != top_vec.end(); it_vec++)
+ {
+ it_map = bottom_time_references.find(*it_vec);
+
+ if(it_map == bottom_time_references.end())
+ continue;
+
+ int bmsc_inter;
+
+ max_a = get_max_interval(it_map->first->get_ref_node_a(), it_map->second);
+ bmsc_inter = min_b - max_a;
+
+ MscTimeIntervalSetD hmsc_inter = (*it_vec)->get_interval_set();
+ MscTimeIntervalSetD result, bmsc_inter_set;
+
+ bmsc_inter_set.insert(*(new MscTimeInterval<double>(bmsc_inter)));
+
+ result = MscTimeIntervalSetD::set_intersection(hmsc_inter, bmsc_inter_set);
+ if(result.is_empty())
+ return false;
+ }
+
+ for(it_vec = top_vec.begin(); it_vec != top_vec.end(); it_vec++)
+ {
+ it_map = top_time_references.find(*it_vec);
+
+ if(it_map == top_time_references.end())
+ continue;
+
+ int bmsc_inter;
+
+ min_a = get_min_interval(it_map->second);
+ bmsc_inter = min_b - min_a;
+
+ MscTimeIntervalSetD hmsc_inter = (*it_vec)->get_interval_set();
+ MscTimeIntervalSetD result, bmsc_inter_set;
+
+ bmsc_inter_set.insert(*(new MscTimeInterval<double>(bmsc_inter)));
+
+ result = MscTimeIntervalSetD::set_intersection(hmsc_inter, bmsc_inter_set);
+
+ if(result.is_empty())
+ return false;
+ }
+ }
+
+ return true;
+
+}
+
+bool check_interval(TimeRelationRefNodePtr relation, TopBottom point)
+{
+ return false;
+}
+
+int get_min_interval(ConfigurationPtr conf)
+{
+ std::set<PositionPtr> positions = conf->get_positions();
+ std::set<PositionPtr>::iterator it;
+ TimeRelationEventPtrList time_intervals;
+ MscTimeIntervalSetD minimal;
+ int min = INT_MAX;
+
+ minimal.insert(*(new MscTimeInterval<double> ("(-inf,inf)")));
+
+ for(it = positions.begin(); it != positions.end(); it++)
+ {
+ std::vector<Event*> events = (*it)->get_events();
+
+ if(events.size() == 0)
+ continue;
+
+ time_intervals = events.front()->get_time_relations();
+
+ if(time_intervals.size() > 1)
+ min = 0;
+
+ MscTimeIntervalSetD time_set = time_intervals.front()->get_interval_set();
+
+ if(time_set.is_empty())
+ {
+ std::cerr << "Error: Unexpected behaviour " << std::endl;
+ }
+
+ MscTimeInterval<double> temp = time_set.get_set().front();
+
+ if(min > temp.get_begin_value())
+ min = temp.get_begin_value();
+ }
+
+ return min;
+}
+
+int get_max_interval(ReferenceNodePtr node, ConfigurationPtr conf)
+{
+ std::set<PositionPtr> positions = conf->get_positions();
+ std::set<PositionPtr>::iterator it;
+ TimeRelationEventPtrList time_intervals;
+ MscTimeIntervalSetD maximal;
+ int max = INT_MIN;
+
+ MscPtr msc = node->get_msc();
+
+ BMscPtr bmsc = boost::dynamic_pointer_cast<BMsc>(msc);
+
+ if(bmsc == NULL)
+ std::cerr << "Error: Unexpected behaviur" << std::endl;
+
+ InstancePtrList instances = bmsc->get_instances();
+ InstancePtrList::iterator inst_it;
+
+ //name of instance, event identification
+ std::map<std::wstring, std::vector<int> > node_last_events;
+ EventPtr start;
+ EventArea* area;
+ StrictOrderArea* strict;
+ CoregionArea* cor;
+
+ for(inst_it = instances.begin(); inst_it != instances.end(); inst_it++)
+ {
+ area = (*inst_it)->get_first().get();
+ strict = dynamic_cast<StrictOrderArea*>(area);
+
+ if(strict != NULL)
+ {
+ start = strict->get_first();
+ std::vector<int> identifications;
+ Event* e = get_last_instance_event(start.get());
+
+ if(e == NULL)
+ continue;
+
+ int it_id;
+ bool it_set = true;
+
+ it_id = e->get_attribute("identification", -1, it_set);
+
+ if(!it_set)
+ identifications.push_back(it_id);
+
+ node_last_events.insert(std::make_pair((*inst_it)->get_label(), identifications));
+ }
+
+ cor = dynamic_cast<CoregionArea*>(area);
+
+ if(cor != NULL)
+ {
+std::cout << "Coregion time intervals: This funcion is not currently supported." << std::endl;
+/*
+ vector<Event*> events = cor->get_minimal();
+ vector<Event*>::iterator event_it;
+ vector<int> identifications;
+
+ for(event_it = events.begin(); event_it != events.end(); event_it++)
+ {
+ Event* e = get_last_instance_event(start);
+
+ int it_id;
+ bool it_set = true;
+
+ it_id = e->get_attribute("identification", -1, it_set);
+
+ if(!it_set)
+ identifications.push_back(it_id);
+ }
+*/
+ }
+
+ }
+
+ maximal.insert(*(new MscTimeInterval<double> ("(-inf,inf)")));
+
+ for(it = positions.begin(); it != positions.end(); it++)
+ {
+ std::vector<Event*> events = (*it)->get_events();
+
+ if(events.empty())
+ {
+ continue;
+ }
+
+ Event* e = events.front();
+
+ std::map <std::wstring, std::vector<int> >::iterator node_last_it;
+ node_last_it = node_last_events.find(e->get_instance()->get_label());
+
+ if(node_last_it == node_last_events.end())
+ continue;
+
+ std::vector<int> node_events;
+ node_events = node_last_it->second;
+
+ for(unsigned int i = 0; i < node_events.size(); i++)
+ {
+
+ Event* last = get_last_instance_event(e, node_events[i]);
+
+ if(last == NULL)
+ continue;
+
+ time_intervals = last->get_time_relations();
+
+ MscTimeIntervalSetD time_set = time_intervals.front()->get_interval_set();
+
+ if(time_set.is_empty())
+ {
+ std::cerr << "Error: Unexpected behaviour" << std::endl;
+ }
+
+ MscTimeInterval<double> temp = time_set.get_set().front();
+
+ if(max < temp.get_begin_value())
+ max = temp.get_begin_value();
+ }
+ }
+
+ return max;
+}
+
+Event* get_last_instance_event(Event* start, int id)
+{
+ if(start == NULL)
+ return NULL;
+
+ EventArea* area = start->get_general_area();
+
+ if(area->get_next() == NULL)
+ {
+ StrictOrderArea* str = dynamic_cast<StrictOrderArea*>(area);
+
+ if(!is_strict_area_null(str))
+ {
+ if(id != INT_MAX)
+ {
+ StrictEventPtr e = str->get_first();
+
+ int it_id;
+ bool it_set = true;
+
+ it_id = e->get_attribute("identification", -1, it_set);
+
+ while(!it_set && it_id != id)
+ {
+ e = e->get_successor();
+ it_id = e->get_attribute("identification", -1, it_set);
+ }
+
+ if(it_set)
+ std::cerr << "Error: Unexpected behaviour" << std::endl;
+ else
+ return e.get();
+ }
+ }
+ }
+
+
+ while (area->get_next() != NULL)
+ {
+ StrictOrderArea* str = dynamic_cast<StrictOrderArea*>(area->get_next().get());
+
+ if(!is_strict_area_null(str))
+ {
+ if(id != INT_MAX)
+ {
+ StrictEventPtr e = str->get_first();
+
+ int it_id;
+ bool it_set = true;
+
+ it_id = e->get_attribute("identification", -1, it_set);
+
+ while(!it_set && it_id != id)
+ {
+ e = e->get_successor();
+
+ if(e == NULL)
+ break;
+
+ it_id = e->get_attribute("identification", -1, it_set);
+ }
+
+ if(it_set)
+ std::cerr << "Error: Unexpected behaviour" << std::endl;
+ else
+ return e.get();
+ }
+ else
+ area = area->get_next().get();
+ }
+
+ }
+
+ StrictOrderArea* strict = dynamic_cast<StrictOrderArea*>(area);
+
+ if(strict == NULL)
+ std::cerr << "Error: Pattern bMSC contains coretion" << std::endl;
+
+ return strict->get_last().get();
+}
Modified: trunk/src/membership/membership_alg.h
===================================================================
--- trunk/src/membership/membership_alg.h 2010-03-12 10:19:27 UTC (rev 698)
+++ trunk/src/membership/membership_alg.h 2010-03-14 23:34:18 UTC (rev 699)
@@ -27,6 +27,7 @@
class Configuration;
class Membership;
enum check_type {membership, receive_ordering};
+enum TopBottom {top, bottom};
typedef boost::intrusive_ptr<Position> PositionPtr;
typedef boost::intrusive_ptr<Configuration> ConfigurationPtr;
Modified: trunk/tests/membership/CMakeLists.txt
===================================================================
--- trunk/tests/membership/CMakeLists.txt 2010-03-12 10:19:27 UTC (rev 698)
+++ trunk/tests/membership/CMakeLists.txt 2010-03-14 23:34:18 UTC (rev 699)
@@ -166,3 +166,21 @@
ADD_TEST(membership_test-70 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/hard_pos_hmsc.mpr ${CMAKE_CURRENT_SOURCE_DIR}/hard_pos_pat.mpr 1)
+#Lubos' time tests
+ADD_TEST(membership_test-71 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/time_simple1_pos_hmsc.mpr ${CMAKE_CURRENT_SOURCE_DIR}/time_simple1_pos_pat.mpr 1)
+
+ADD_TEST(membership_test-72 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/time_simple1_neg_hmsc.mpr ${CMAKE_CURRENT_SOURCE_DIR}/time_simple1_neg_pat.mpr 0)
+
+ADD_TEST(membership_test-73 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/time_simple2_pos_hmsc.mpr ${CMAKE_CURRENT_SOURCE_DIR}/time_simple2_pos_pat.mpr 1)
+
+ADD_TEST(membership_test-74 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/time_simple2_neg_hmsc.mpr ${CMAKE_CURRENT_SOURCE_DIR}/time_simple2_neg_pat.mpr 0)
+
+ADD_TEST(membership_test-75 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/time_cycle_neg_hmsc.mpr ${CMAKE_CURRENT_SOURCE_DIR}/time_cycle_neg_pat.mpr 0)
+
+ADD_TEST(membership_test-76 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/time_cycle_pos_hmsc.mpr ${CMAKE_CURRENT_SOURCE_DIR}/time_cycle_pos_pat.mpr 1)
+
+ADD_TEST(membership_test-77 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/time_cycleWithEmpty_pos_hmsc.mpr ${CMAKE_CURRENT_SOURCE_DIR}/time_cycleWithEmpty_pos_pat.mpr 1)
+
+ADD_TEST(membership_test-78 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/time_cycleWithEmpty_neg_hmsc.mpr ${CMAKE_CURRENT_SOURCE_DIR}/time_cycleWithEmpty_neg_pat.mpr 0)
+
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <va...@us...> - 2010-04-01 10:41:10
|
Revision: 711
http://scstudio.svn.sourceforge.net/scstudio/?rev=711&view=rev
Author: vacek
Date: 2010-04-01 10:41:01 +0000 (Thu, 01 Apr 2010)
Log Message:
-----------
ElementaryCyclesTraverser: g++ warnings solved; LivelockChecker tests fixed.
Modified Paths:
--------------
trunk/src/data/elementary_cycles_traverser.h
trunk/tests/livelock_checker_test.cpp
Modified: trunk/src/data/elementary_cycles_traverser.h
===================================================================
--- trunk/src/data/elementary_cycles_traverser.h 2010-03-30 16:54:45 UTC (rev 710)
+++ trunk/src/data/elementary_cycles_traverser.h 2010-04-01 10:41:01 UTC (rev 711)
@@ -53,7 +53,7 @@
public:
MscElementPListList circuit_enumeration(HMscNode *n);
TarjanCycles(unsigned vertex_count, std::string restriction)
- :m_vertex_count(vertex_count), m_restriction(restriction)
+ :m_restriction(restriction), m_vertex_count(vertex_count)
{}
private:
std::string m_restriction;
@@ -103,7 +103,7 @@
}
void traverse(HMscPtr hmsc);
ElementaryCyclesTraverser(void)
- :m_traverser("EC_color"), m_restriction_enabled(false)
+ :m_traverser("EC_color"), m_restriction_enabled(false), m_restriction_name("")
{}
void cleanup_traversing_attributes(void)
{
@@ -132,7 +132,7 @@
public:
void on_white_node_found(HMscNode *n);
CycleListener(unsigned vertex_count, const ElementaryCycleListenerPList &listeners, const std::string &restriction)
- :m_vertex_count(vertex_count), m_listeners(listeners), m_restriction(restriction)
+ :m_vertex_count(vertex_count), m_restriction(restriction), m_listeners(listeners)
{}
private:
Modified: trunk/tests/livelock_checker_test.cpp
===================================================================
--- trunk/tests/livelock_checker_test.cpp 2010-03-30 16:54:45 UTC (rev 710)
+++ trunk/tests/livelock_checker_test.cpp 2010-04-01 10:41:01 UTC (rev 711)
@@ -21,18 +21,25 @@
HMscPtr h1(new HMsc(L"h1"));
HMscPtr h2(new HMsc(L"h2"));
+ BMscPtr bmsc(new BMsc());
StartNodePtr start1 = new StartNode(); h1->set_start(start1);
EndNodePtr end1(new EndNode);h1->add_node(end1);
ReferenceNodePtr p1(new ReferenceNode());h1->add_node(p1);
+ p1->set_msc(bmsc);
ReferenceNodePtr p2(new ReferenceNode());h1->add_node(p2);
+ p2->set_msc(bmsc);
ReferenceNodePtr p3(new ReferenceNode());h1->add_node(p3);
ReferenceNodePtr p4(new ReferenceNode());h1->add_node(p4);
+ p4->set_msc(bmsc);
StartNodePtr start2 = new StartNode(); h2->set_start(start2);
ReferenceNodePtr n1(new ReferenceNode());h2->add_node(n1);
+ n1->set_msc(bmsc);
ReferenceNodePtr n2(new ReferenceNode());h2->add_node(n2);
+ n2->set_msc(bmsc);
ReferenceNodePtr n3(new ReferenceNode());h2->add_node(n3);
+ n3->set_msc(bmsc);
start1->add_successor(p1.get());
p1->add_successor(p2.get());
@@ -69,11 +76,14 @@
std::cout << " end " << std::endl;
HMscPtr h1(new HMsc(L"h1"));
+ BMscPtr bmsc(new BMsc());
StartNodePtr start1 = new StartNode(); h1->set_start(start1);
EndNodePtr end1(new EndNode);h1->add_node(end1);
ReferenceNodePtr p1(new ReferenceNode());h1->add_node(p1);
+ p1->set_msc(bmsc);
ReferenceNodePtr p2(new ReferenceNode());h1->add_node(p2);
+ p2->set_msc(bmsc);
start1->add_successor(p1.get());
p1->add_successor(p2.get());
@@ -102,11 +112,14 @@
std::cout << " end " << std::endl;
HMscPtr h1(new HMsc(L"h1"));
+ BMscPtr bmsc(new BMsc());
StartNodePtr start1 = new StartNode(); h1->set_start(start1);
EndNodePtr end1(new EndNode);h1->add_node(end1);
ReferenceNodePtr p1(new ReferenceNode());h1->add_node(p1);
+ p1->set_msc(bmsc);
ReferenceNodePtr p2(new ReferenceNode());h1->add_node(p2);
+ p2->set_msc(bmsc);
start1->add_successor(p1.get());
p1->add_successor(end1.get());
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ob...@us...> - 2010-04-10 22:50:35
|
Revision: 715
http://scstudio.svn.sourceforge.net/scstudio/?rev=715&view=rev
Author: obouda
Date: 2010-04-10 22:50:23 +0000 (Sat, 10 Apr 2010)
Log Message:
-----------
Add Instances function: added fixed default values - now the instances fit in the page entirely; added HTML help
Modified Paths:
--------------
trunk/doc/help/frontend.html
trunk/doc/help/help.css
trunk/src/view/visio/addon/instancesfielddlg.cpp
trunk/src/view/visio/addon/instancesfielddlg.h
Modified: trunk/doc/help/frontend.html
===================================================================
--- trunk/doc/help/frontend.html 2010-04-06 08:29:29 UTC (rev 714)
+++ trunk/doc/help/frontend.html 2010-04-10 22:50:23 UTC (rev 715)
@@ -13,6 +13,9 @@
are available:</p>
<img class="big" src="pictures/frontend.png" alt="SCStudio toolbar and menu in MS Visio">
+<h2>Shape Selection</h2>
+<p>On top of standard Visio functions for selecting shapes (such as <code>Ctrl+A</code>
+shortcut for selecting all shapes), SCStudio offers several useful selection functions.</p>
<p>The first toolbar button
<img src="pictures/icon_select_instances.png" alt="Select instances button">
selects all instances in the current page of active document. The second button
@@ -32,6 +35,35 @@
selection.</p>
+<h2>Automatic drawing</h2>
+<p>With all required shapes available in the BMSC and HMSC stencils, it is possible
+to draw virtually any MSC diagram. In practice, there are many stereotypes, however.
+SCStudio helps the user draw some frequently used patterns by several automatic
+drawing functions.</p>
+<h3>Add Instances</h3>
+<p>The first of them is the <code>Add Instances</code> function accessible via menu
+<code>Check → Drawing → Add Instances</code>, or <code>Ctrl+Alt+F</code>
+keyboard shortcut. It is available in the context (right-click) menu of the document, too.
+The function draws a given number of instances on the active
+page of the document, with constant or dynamic space between each two of them.</p>
+<p>When invoked, the following dialog appears:</p>
+<img class="big" src="pictures/add_instances_options.png" alt="Add Instances options dialog">
+<p>The first two fields set the number of instances to be drawn and their length.
+Next two fields set the starting point from which to start drawing. If the cursor
+was in the document drawing area in the time of Add Instances invocation (that is,
+the keyboard shortcut or context-menu was used), the start position fields are
+filled with the cursor position, i.e. drawing will start from the point where
+the cursor was.</p>
+<p>In the Options panel, if the Total width switch is chosen, all the instances
+will be drawn in the place of a width given, so the gaps between instances will be
+calculated to fit this area. On the contrary, the Spacing switch sets constant gaps
+between the instances not limiting the total width.</p>
+<p>All numbers in the dialog are in units of the current page of the document.</p>
+
+<h3>Message Sequence</h3>
+<p><i>Under development…</i></p>
+
+
</body>
</html>
Modified: trunk/doc/help/help.css
===================================================================
--- trunk/doc/help/help.css 2010-04-06 08:29:29 UTC (rev 714)
+++ trunk/doc/help/help.css 2010-04-10 22:50:23 UTC (rev 715)
@@ -8,10 +8,10 @@
margin-bottom: 0.7em;
}
h1 {
- font-size: 1.2em;
+ font-size: 1.4em;
}
h2 {
- font-size: 1.0em;
+ font-size: 1.2em;
}
h3 {
font-size: 1.0em;
Modified: trunk/src/view/visio/addon/instancesfielddlg.cpp
===================================================================
--- trunk/src/view/visio/addon/instancesfielddlg.cpp 2010-04-06 08:29:29 UTC (rev 714)
+++ trunk/src/view/visio/addon/instancesfielddlg.cpp 2010-04-10 22:50:23 UTC (rev 715)
@@ -131,11 +131,13 @@
LRESULT CInstancesFieldDlg::OnDefaultCmd(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
{
m_start_pos_x = 0.0f;
- m_start_pos_y = m_pageHeight;
- m_total_width = (m_pageWidth > 0 ? m_pageWidth :
+ m_start_pos_y = m_pageHeight - CPageUtils::ConvertUnits(m_vsoApp->ActivePage, IF_BORDER, 0, visPageUnits);
+ m_total_width = (m_pageWidth > 0 ?
+ m_pageWidth :
CPageUtils::ConvertUnits(m_vsoApp->ActivePage, DEFAULT_IF_TOTAL_WIDTH, 0, visPageUnits)
);
- m_instance_length = (m_pageHeight > 0 ? m_pageHeight :
+ m_instance_length = (m_pageHeight > 0 ?
+ m_pageHeight - 2 * CPageUtils::ConvertUnits(m_vsoApp->ActivePage, IF_BORDER, 0, visPageUnits) :
CPageUtils::ConvertUnits(m_vsoApp->ActivePage, DEFAULT_IF_INSTANCE_LENGTH, 0, visPageUnits)
);
Modified: trunk/src/view/visio/addon/instancesfielddlg.h
===================================================================
--- trunk/src/view/visio/addon/instancesfielddlg.h 2010-04-06 08:29:29 UTC (rev 714)
+++ trunk/src/view/visio/addon/instancesfielddlg.h 2010-04-10 22:50:23 UTC (rev 715)
@@ -132,5 +132,6 @@
static const float DEFAULT_IF_TOTAL_WIDTH = 7.8740157480314960f; // 200 mm
static const float DEFAULT_IF_SPACING = 1.18110236220472f; // 30 mm
static const bool DEFAULT_IF_OPTIONS_VISIBLE = false;
+static const float IF_BORDER = 0.0787401574803149f; // 2 mm border for the default command
// $Id$
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ob...@us...> - 2010-04-20 09:07:18
|
Revision: 722
http://scstudio.svn.sourceforge.net/scstudio/?rev=722&view=rev
Author: obouda
Date: 2010-04-20 09:07:09 +0000 (Tue, 20 Apr 2010)
Log Message:
-----------
addition of forgotten files to r721 and r715
Added Paths:
-----------
trunk/doc/help/pictures/add_instances_options.png
trunk/src/view/visio/addon/shapeutils.h
Added: trunk/doc/help/pictures/add_instances_options.png
===================================================================
(Binary files differ)
Property changes on: trunk/doc/help/pictures/add_instances_options.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/src/view/visio/addon/shapeutils.h
===================================================================
--- trunk/src/view/visio/addon/shapeutils.h (rev 0)
+++ trunk/src/view/visio/addon/shapeutils.h 2010-04-20 09:07:09 UTC (rev 722)
@@ -0,0 +1,73 @@
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2010 Ondrej Bouda <ond...@wh...>
+ *
+ * $$
+ */
+
+#pragma once
+#include "stdafx.h"
+#include "extract.h"
+
+enum TOrderingDirection {
+ ORDER_ASC,
+ ORDER_DESC,
+};
+
+/**
+ * A utility class for functionality on a Visio Shape.
+ */
+class CShapeUtils
+{
+public:
+
+ static double GetShapeBeginX(Visio::IVShapePtr shape) { return shape->CellsSRC[visSectionObject][visRowXForm1D][vis1DBeginX]->Result[""]; }
+ static double GetShapeEndX(Visio::IVShapePtr shape) { return shape->CellsSRC[visSectionObject][visRowXForm1D][vis1DEndX]->Result[""]; }
+ static double GetShapeBeginY(Visio::IVShapePtr shape) { return shape->CellsSRC[visSectionObject][visRowXForm1D][vis1DBeginY]->Result[""]; }
+ static double GetShapeEndY(Visio::IVShapePtr shape) { return shape->CellsSRC[visSectionObject][visRowXForm1D][vis1DEndY]->Result[""]; }
+
+};
+
+/**
+ * Orders two shapes according to their X-coordinate
+ */
+bool operator < (const Visio::IVShapePtr shapeOne, const Visio::IVShapePtr shapeTwo)
+{
+ return CShapeUtils::GetShapeBeginX(shapeOne) < CShapeUtils::GetShapeBeginX(shapeTwo);
+}
+
+bool operator > (const Visio::IVShapePtr shapeOne, const Visio::IVShapePtr shapeTwo)
+{
+ return CShapeUtils::GetShapeBeginX(shapeTwo) < CShapeUtils::GetShapeBeginX(shapeOne);
+}
+
+/**
+ * Shape comparator suitable for sorting. Allows for ascending or descending order.
+ */
+class CShapeComparator
+{
+ TOrderingDirection direction;
+public:
+ CShapeComparator(TOrderingDirection direction=ORDER_ASC) : direction(direction) {}
+
+ bool operator()(const Visio::IVShapePtr shapeOne, const Visio::IVShapePtr shapeTwo)
+ {
+ if (direction == ORDER_ASC)
+ return (shapeOne < shapeTwo);
+ else
+ return (shapeTwo < shapeOne);
+ }
+};
+
+// $Id$
Property changes on: trunk/src/view/visio/addon/shapeutils.h
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <got...@us...> - 2010-05-08 12:14:45
|
Revision: 746
http://scstudio.svn.sourceforge.net/scstudio/?rev=746&view=rev
Author: gotthardp
Date: 2010-05-08 12:14:32 +0000 (Sat, 08 May 2010)
Log Message:
-----------
Fixed some warnings and file properties.
Modified Paths:
--------------
trunk/src/check/time/hmsc_all_paths.h
trunk/src/check/time/time_trace_race.h
trunk/src/data/beautify/length_optimizer.cpp
trunk/src/data/beautify/length_optimizer.h
trunk/src/data/beautify/unoverlaying_messages.cpp
trunk/src/data/beautify/unoverlaying_messages.h
trunk/src/data/elementary_cycles_traverser.cpp
trunk/src/data/elementary_cycles_traverser.h
trunk/tests/membership/test_bmsc11_1.mpr
trunk/tests/membership/test_bmsc11_2.mpr
trunk/tests/membership/test_bmsc11_3.mpr
trunk/tests/membership/test_bmsc11_4.mpr
trunk/tests/membership/test_bmsc12_1.mpr
trunk/tests/membership/test_bmsc12_2.mpr
trunk/tests/membership/test_bmsc12_3.mpr
trunk/tests/membership/test_bmsc12_4.mpr
trunk/tests/membership/test_bmsc12_5.mpr
trunk/tests/membership/test_bmsc13_1.mpr
trunk/tests/membership/test_bmsc13_2.mpr
trunk/tests/membership/test_bmsc13_3.mpr
trunk/tests/membership/test_bmsc14_1.mpr
trunk/tests/membership/test_bmsc14_2.mpr
trunk/tests/membership/test_bmsc14_3.mpr
trunk/tests/membership/test_bmsc14_4.mpr
trunk/tests/membership/test_bmsc15_1.mpr
trunk/tests/membership/test_bmsc15_2.mpr
trunk/tests/membership/test_bmsc16_1.mpr
trunk/tests/membership/test_bmsc16_2.mpr
trunk/tests/membership/test_bmsc16_3.mpr
trunk/tests/membership/test_bmsc18_1.mpr
trunk/tests/membership/test_bmsc18_2.mpr
trunk/tests/membership/test_bmsc18_3.mpr
trunk/tests/membership/test_bmsc19.mpr
trunk/tests/membership/test_bmsc26_1.mpr
trunk/tests/membership/test_bmsc26_2.mpr
trunk/tests/membership/test_bmsc27.mpr
trunk/tests/membership/test_bmsc27_1.mpr
trunk/tests/membership/test_hmsc11.mpr
trunk/tests/membership/test_hmsc12.mpr
trunk/tests/membership/test_hmsc13.mpr
trunk/tests/membership/test_hmsc14.mpr
trunk/tests/membership/test_hmsc15.mpr
trunk/tests/membership/test_hmsc16.mpr
trunk/tests/membership/test_hmsc18.mpr
trunk/tests/membership/test_hmsc19.mpr
trunk/tests/membership/test_hmsc26.mpr
trunk/tests/membership/time_cycleWithEmpty_neg_hmsc.mpr
trunk/tests/membership/time_cycleWithEmpty_neg_pat.mpr
trunk/tests/membership/time_cycleWithEmpty_pos_hmsc.mpr
trunk/tests/membership/time_cycleWithEmpty_pos_pat.mpr
trunk/tests/membership/time_cycle_neg_hmsc.mpr
trunk/tests/membership/time_cycle_neg_pat.mpr
trunk/tests/membership/time_cycle_pos_hmsc.mpr
trunk/tests/membership/time_cycle_pos_pat.mpr
trunk/tests/membership/time_simple1_neg_hmsc.mpr
trunk/tests/membership/time_simple1_neg_pat.mpr
trunk/tests/membership/time_simple1_pos_hmsc.mpr
trunk/tests/membership/time_simple1_pos_pat.mpr
trunk/tests/membership/time_simple2_neg_hmsc.mpr
trunk/tests/membership/time_simple2_neg_pat.mpr
trunk/tests/membership/time_simple2_pos_hmsc.mpr
trunk/tests/membership/time_simple2_pos_pat.mpr
trunk/tests/time/consistency/cons_neg_1.mpr
trunk/tests/time/consistency/cons_neg_11.mpr
trunk/tests/time/consistency/cons_neg_12.mpr
trunk/tests/time/consistency/cons_neg_13.mpr
trunk/tests/time/consistency/cons_neg_15.mpr
trunk/tests/time/consistency/cons_neg_16.mpr
trunk/tests/time/consistency/cons_neg_17.mpr
trunk/tests/time/consistency/cons_neg_2.mpr
trunk/tests/time/consistency/cons_neg_3.mpr
trunk/tests/time/consistency/cons_neg_4.mpr
trunk/tests/time/consistency/cons_neg_5.mpr
trunk/tests/time/consistency/cons_neg_6.mpr
trunk/tests/time/consistency/cons_neg_7.mpr
trunk/tests/time/consistency/cons_neg_8.mpr
trunk/tests/time/consistency/cons_neg_9.mpr
trunk/tests/time/time_race/race_neg1.mpr
trunk/tests/time/time_race/race_neg2.mpr
trunk/tests/time/time_race/race_neg3.mpr
trunk/tests/time/time_race/race_neg4.mpr
trunk/tests/time/time_race/race_neg5.mpr
trunk/tests/time/time_race/race_neg6.mpr
trunk/tests/time/time_race/race_neg7.mpr
trunk/tests/time/time_race/race_pos1.mpr
trunk/tests/time/time_race/race_pos10.mpr
trunk/tests/time/time_race/race_pos11.mpr
trunk/tests/time/time_race/race_pos12.mpr
trunk/tests/time/time_race/race_pos13.mpr
trunk/tests/time/time_race/race_pos14.mpr
trunk/tests/time/time_race/race_pos2.mpr
trunk/tests/time/time_race/race_pos3.mpr
trunk/tests/time/time_race/race_pos4.mpr
trunk/tests/time/time_race/race_pos5.mpr
trunk/tests/time/time_race/race_pos6.mpr
trunk/tests/time/time_race/race_pos7.mpr
trunk/tests/time/time_race/race_pos8.mpr
trunk/tests/time/time_race/race_pos9.mpr
trunk/tests/time_constraints/proper_neg29.mpr
trunk/tests/time_constraints/proper_neg30.mpr
trunk/tests/time_constraints/proper_neg31.mpr
trunk/tests/time_constraints/proper_neg32.mpr
trunk/tests/time_constraints/proper_neg33.mpr
trunk/tests/time_constraints/proper_neg34.mpr
trunk/tests/time_constraints/proper_neg35.mpr
Property Changed:
----------------
trunk/src/check/time/find_block.cpp
trunk/src/check/time/find_block.h
trunk/src/check/time/hmsc_all_paths.cpp
trunk/src/check/time/hmsc_all_paths.h
trunk/src/check/time/hmsc_block_paths.cpp
trunk/src/check/time/hmsc_block_paths.h
trunk/src/check/time/time_trace_race.h
trunk/src/check/time/traverse_erase.cpp
trunk/src/check/time/traverse_erase.h
trunk/src/data/beautify/length_optimizer.cpp
trunk/src/data/beautify/length_optimizer.h
trunk/src/data/beautify/unoverlaying_messages.cpp
trunk/src/data/beautify/unoverlaying_messages.h
trunk/src/data/elementary_cycles_traverser.cpp
trunk/src/data/elementary_cycles_traverser.h
trunk/tests/find_block_test.cpp
trunk/tests/membership/test_bmsc08.mpr
trunk/tests/membership/test_bmsc09.mpr
trunk/tests/membership/test_bmsc10.mpr
trunk/tests/membership/test_bmsc11_1.mpr
trunk/tests/membership/test_bmsc11_2.mpr
trunk/tests/membership/test_bmsc11_3.mpr
trunk/tests/membership/test_bmsc11_4.mpr
trunk/tests/membership/test_bmsc11_5.mpr
trunk/tests/membership/test_bmsc12_1.mpr
trunk/tests/membership/test_bmsc12_2.mpr
trunk/tests/membership/test_bmsc12_3.mpr
trunk/tests/membership/test_bmsc12_4.mpr
trunk/tests/membership/test_bmsc12_5.mpr
trunk/tests/membership/test_bmsc13_1.mpr
trunk/tests/membership/test_bmsc13_2.mpr
trunk/tests/membership/test_bmsc13_3.mpr
trunk/tests/membership/test_bmsc14_1.mpr
trunk/tests/membership/test_bmsc14_2.mpr
trunk/tests/membership/test_bmsc14_3.mpr
trunk/tests/membership/test_bmsc14_4.mpr
trunk/tests/membership/test_bmsc15_1.mpr
trunk/tests/membership/test_bmsc15_2.mpr
trunk/tests/membership/test_bmsc16_1.mpr
trunk/tests/membership/test_bmsc16_2.mpr
trunk/tests/membership/test_bmsc16_3.mpr
trunk/tests/membership/test_bmsc17_1.mpr
trunk/tests/membership/test_bmsc17_2.mpr
trunk/tests/membership/test_bmsc18_1.mpr
trunk/tests/membership/test_bmsc18_2.mpr
trunk/tests/membership/test_bmsc18_3.mpr
trunk/tests/membership/test_bmsc19.mpr
trunk/tests/membership/test_bmsc20_1.mpr
trunk/tests/membership/test_bmsc20_2.mpr
trunk/tests/membership/test_bmsc21_1.mpr
trunk/tests/membership/test_bmsc21_2.mpr
trunk/tests/membership/test_bmsc21_3.mpr
trunk/tests/membership/test_bmsc21_4.mpr
trunk/tests/membership/test_bmsc22_1.mpr
trunk/tests/membership/test_bmsc22_2.mpr
trunk/tests/membership/test_bmsc22_3.mpr
trunk/tests/membership/test_bmsc22_4.mpr
trunk/tests/membership/test_bmsc23_1.mpr
trunk/tests/membership/test_bmsc23_2.mpr
trunk/tests/membership/test_bmsc23_3.mpr
trunk/tests/membership/test_bmsc23_4.mpr
trunk/tests/membership/test_bmsc24_1.mpr
trunk/tests/membership/test_bmsc24_2.mpr
trunk/tests/membership/test_bmsc25_1.mpr
trunk/tests/membership/test_bmsc25_2.mpr
trunk/tests/membership/test_bmsc26_1.mpr
trunk/tests/membership/test_bmsc26_2.mpr
trunk/tests/membership/test_bmsc27.mpr
trunk/tests/membership/test_bmsc27_1.mpr
trunk/tests/membership/test_hmsc08.mpr
trunk/tests/membership/test_hmsc09.mpr
trunk/tests/membership/test_hmsc10.mpr
trunk/tests/membership/test_hmsc11.mpr
trunk/tests/membership/test_hmsc12.mpr
trunk/tests/membership/test_hmsc13.mpr
trunk/tests/membership/test_hmsc14.mpr
trunk/tests/membership/test_hmsc15.mpr
trunk/tests/membership/test_hmsc16.mpr
trunk/tests/membership/test_hmsc17.mpr
trunk/tests/membership/test_hmsc18.mpr
trunk/tests/membership/test_hmsc19.mpr
trunk/tests/membership/test_hmsc20.mpr
trunk/tests/membership/test_hmsc21.mpr
trunk/tests/membership/test_hmsc22.mpr
trunk/tests/membership/test_hmsc23.mpr
trunk/tests/membership/test_hmsc24.mpr
trunk/tests/membership/test_hmsc25.mpr
trunk/tests/membership/test_hmsc26.mpr
trunk/tests/membership/time_cycleWithEmpty_neg_hmsc.mpr
trunk/tests/membership/time_cycleWithEmpty_neg_pat.mpr
trunk/tests/membership/time_cycleWithEmpty_pos_hmsc.mpr
trunk/tests/membership/time_cycleWithEmpty_pos_pat.mpr
trunk/tests/membership/time_cycle_neg_hmsc.mpr
trunk/tests/membership/time_cycle_neg_pat.mpr
trunk/tests/membership/time_cycle_pos_hmsc.mpr
trunk/tests/membership/time_cycle_pos_pat.mpr
trunk/tests/membership/time_simple1_neg_hmsc.mpr
trunk/tests/membership/time_simple1_neg_pat.mpr
trunk/tests/membership/time_simple1_pos_hmsc.mpr
trunk/tests/membership/time_simple1_pos_pat.mpr
trunk/tests/membership/time_simple2_neg_hmsc.mpr
trunk/tests/membership/time_simple2_neg_pat.mpr
trunk/tests/membership/time_simple2_pos_hmsc.mpr
trunk/tests/membership/time_simple2_pos_pat.mpr
trunk/tests/tighten_hmsc_test.cpp
trunk/tests/time/consistency/cons_neg_1.mpr
trunk/tests/time/consistency/cons_neg_11.mpr
trunk/tests/time/consistency/cons_neg_12.mpr
trunk/tests/time/consistency/cons_neg_13.mpr
trunk/tests/time/consistency/cons_neg_15.mpr
trunk/tests/time/consistency/cons_neg_16.mpr
trunk/tests/time/consistency/cons_neg_17.mpr
trunk/tests/time/consistency/cons_neg_2.mpr
trunk/tests/time/consistency/cons_neg_3.mpr
trunk/tests/time/consistency/cons_neg_4.mpr
trunk/tests/time/consistency/cons_neg_5.mpr
trunk/tests/time/consistency/cons_neg_6.mpr
trunk/tests/time/consistency/cons_neg_7.mpr
trunk/tests/time/consistency/cons_neg_8.mpr
trunk/tests/time/consistency/cons_neg_9.mpr
trunk/tests/time/time_race/race_neg1.mpr
trunk/tests/time/time_race/race_neg2.mpr
trunk/tests/time/time_race/race_neg3.mpr
trunk/tests/time/time_race/race_neg4.mpr
trunk/tests/time/time_race/race_neg5.mpr
trunk/tests/time/time_race/race_neg6.mpr
trunk/tests/time/time_race/race_neg7.mpr
trunk/tests/time/time_race/race_pos1.mpr
trunk/tests/time/time_race/race_pos10.mpr
trunk/tests/time/time_race/race_pos11.mpr
trunk/tests/time/time_race/race_pos12.mpr
trunk/tests/time/time_race/race_pos13.mpr
trunk/tests/time/time_race/race_pos14.mpr
trunk/tests/time/time_race/race_pos2.mpr
trunk/tests/time/time_race/race_pos3.mpr
trunk/tests/time/time_race/race_pos4.mpr
trunk/tests/time/time_race/race_pos5.mpr
trunk/tests/time/time_race/race_pos6.mpr
trunk/tests/time/time_race/race_pos7.mpr
trunk/tests/time/time_race/race_pos8.mpr
trunk/tests/time/time_race/race_pos9.mpr
trunk/tests/time_constraints/proper_neg29.mpr
trunk/tests/time_constraints/proper_neg30.mpr
trunk/tests/time_constraints/proper_neg31.mpr
trunk/tests/time_constraints/proper_neg32.mpr
trunk/tests/time_constraints/proper_neg33.mpr
trunk/tests/time_constraints/proper_neg34.mpr
trunk/tests/time_constraints/proper_neg35.mpr
Property changes on: trunk/src/check/time/find_block.cpp
___________________________________________________________________
Added: svn:keywords
+ Id
Property changes on: trunk/src/check/time/find_block.h
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Property changes on: trunk/src/check/time/hmsc_all_paths.cpp
___________________________________________________________________
Added: svn:keywords
+ Id
Modified: trunk/src/check/time/hmsc_all_paths.h
===================================================================
--- trunk/src/check/time/hmsc_all_paths.h 2010-05-08 12:09:38 UTC (rev 745)
+++ trunk/src/check/time/hmsc_all_paths.h 2010-05-08 12:14:32 UTC (rev 746)
@@ -101,4 +101,5 @@
};
-#endif
\ No newline at end of file
+#endif
+
Property changes on: trunk/src/check/time/hmsc_all_paths.h
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Property changes on: trunk/src/check/time/hmsc_block_paths.cpp
___________________________________________________________________
Added: svn:keywords
+ Id
Property changes on: trunk/src/check/time/hmsc_block_paths.h
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Modified: trunk/src/check/time/time_trace_race.h
===================================================================
--- trunk/src/check/time/time_trace_race.h 2010-05-08 12:09:38 UTC (rev 745)
+++ trunk/src/check/time/time_trace_race.h 2010-05-08 12:14:32 UTC (rev 746)
@@ -13,7 +13,7 @@
*
* Copyright (c) 2009 Ondrej Kocian <koc...@ma...>
*
- * $Id: time_pseudocode.h 569 2010-02-06 10:28:26Z kocianon $
+ * $Id$
*/
#ifndef _TIME_TRACE_RACE_H_
Property changes on: trunk/src/check/time/time_trace_race.h
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Property changes on: trunk/src/check/time/traverse_erase.cpp
___________________________________________________________________
Added: svn:keywords
+ Id
Property changes on: trunk/src/check/time/traverse_erase.h
___________________________________________________________________
Added: svn:keywords
+ Id
Modified: trunk/src/data/beautify/length_optimizer.cpp
===================================================================
--- trunk/src/data/beautify/length_optimizer.cpp 2010-05-08 12:09:38 UTC (rev 745)
+++ trunk/src/data/beautify/length_optimizer.cpp 2010-05-08 12:14:32 UTC (rev 746)
@@ -1,90 +1,91 @@
-/*
- * scstudio - Sequence Chart Studio
- * http://scstudio.sourceforge.net
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * Copyright (c) 2009 Zuzana Pekarcikova <20...@ma...>
- *
- * $Id: length_optimizer.cpp 660 2010-03-05 12:21:53Z xpekarc $
- */
-
-#include "length_optimizer.h"
-
-LengthOptimizer::LengthOptimizer(ConfigProvider *config_provider) :
- ConfigReader(config_provider)
-{
- // minimal distance between the instance bottom and the last event on this instance [mm]
- m_min_instance_bottom_distance = (float)get_config_long(L"Beautify", L"MinInstanceBottomDistance", 8);
-}
-
-int LengthOptimizer::process(BMscPtr bmsc)
-{
- InstancePtrList instances;
- InstancePtrList::const_iterator it;
- DFSInstanceEventsTraverser traverser;
- MscPoint coord_begin, coord_end;
- GetLengthInstances inst_listener;
-
- for(it = bmsc->get_instances().begin(); it != bmsc->get_instances().end(); it++)
- {
- instances.push_back(*it);
- }
- SortByX compare;
- instances.sort(compare);
- int max_length = 0;
-
- traverser.add_white_event_found_listener(&inst_listener);
- for(it = instances.begin(); it != instances.end();it++)
- {
- if((*it)->get_height() > max_length)
- {
- max_length = (int)((*it)->get_height());
- }
- traverser.traverse(it->get());
- }
-
-
- static const int min_length = 20;
- Coordinate inst_length = 0;
- // set base length of instances
- if(inst_listener.get_max_inst())
- inst_length = inst_listener.get_max_length_y() + m_min_instance_bottom_distance;
- // avoid very small instances
- inst_length = (int(inst_length) < min_length) ? min_length : inst_length;
- inst_length = (int(inst_length) < max_length) ? max_length : inst_length;
-
- it = instances.begin();
- coord_begin = (*it)->get_line_begin();
- coord_end = (*it)->get_line_end();
-
- // move instance if it or its label is not in the window
- if(coord_begin.get_y() < 5)
- {
- coord_begin.set_y(5);
- }
-
- // align instances and set the same height
- for(; it != instances.end(); it++)
- {
- coord_end.set_x(coord_begin.get_x());
- coord_end.set_y(coord_begin.get_y() + inst_length);
-
- (*it)->set_line_end(coord_end);
- (*it)->set_line_begin(coord_begin);
- (*it)->set_width(10);
-
- coord_begin.set_x(coord_begin.get_x() + 20);
- }
-
- return 0;
-}
-
-// $Id: $
\ No newline at end of file
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2009 Zuzana Pekarcikova <20...@ma...>
+ *
+ * $Id$
+ */
+
+#include "length_optimizer.h"
+
+LengthOptimizer::LengthOptimizer(ConfigProvider *config_provider) :
+ ConfigReader(config_provider)
+{
+ // minimal distance between the instance bottom and the last event on this instance [mm]
+ m_min_instance_bottom_distance = (float)get_config_long(L"Beautify", L"MinInstanceBottomDistance", 8);
+}
+
+int LengthOptimizer::process(BMscPtr bmsc)
+{
+ InstancePtrList instances;
+ InstancePtrList::const_iterator it;
+ DFSInstanceEventsTraverser traverser;
+ MscPoint coord_begin, coord_end;
+ GetLengthInstances inst_listener;
+
+ for(it = bmsc->get_instances().begin(); it != bmsc->get_instances().end(); it++)
+ {
+ instances.push_back(*it);
+ }
+ SortByX compare;
+ instances.sort(compare);
+ int max_length = 0;
+
+ traverser.add_white_event_found_listener(&inst_listener);
+ for(it = instances.begin(); it != instances.end();it++)
+ {
+ if((*it)->get_height() > max_length)
+ {
+ max_length = (int)((*it)->get_height());
+ }
+ traverser.traverse(it->get());
+ }
+
+
+ static const int min_length = 20;
+ Coordinate inst_length = 0;
+ // set base length of instances
+ if(inst_listener.get_max_inst())
+ inst_length = inst_listener.get_max_length_y() + m_min_instance_bottom_distance;
+ // avoid very small instances
+ inst_length = (int(inst_length) < min_length) ? min_length : inst_length;
+ inst_length = (int(inst_length) < max_length) ? max_length : inst_length;
+
+ it = instances.begin();
+ coord_begin = (*it)->get_line_begin();
+ coord_end = (*it)->get_line_end();
+
+ // move instance if it or its label is not in the window
+ if(coord_begin.get_y() < 5)
+ {
+ coord_begin.set_y(5);
+ }
+
+ // align instances and set the same height
+ for(; it != instances.end(); it++)
+ {
+ coord_end.set_x(coord_begin.get_x());
+ coord_end.set_y(coord_begin.get_y() + inst_length);
+
+ (*it)->set_line_end(coord_end);
+ (*it)->set_line_begin(coord_begin);
+ (*it)->set_width(10);
+
+ coord_begin.set_x(coord_begin.get_x() + 20);
+ }
+
+ return 0;
+}
+
+// $Id$
+
Property changes on: trunk/src/data/beautify/length_optimizer.cpp
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Modified: trunk/src/data/beautify/length_optimizer.h
===================================================================
--- trunk/src/data/beautify/length_optimizer.h 2010-05-08 12:09:38 UTC (rev 745)
+++ trunk/src/data/beautify/length_optimizer.h 2010-05-08 12:14:32 UTC (rev 746)
@@ -1,71 +1,72 @@
-/*
- * scstudio - Sequence Chart Studio
- * http://scstudio.sourceforge.net
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * Copyright (c) 2009 Zuzana Pekarcikova <20...@ma...>
- *
- * $Id: length_optimizer.h 660 2010-03-05 12:21:53Z xpekarc $
- */
-
-#include "data/msc.h"
-#include <set>
-#include "data/configurator.h"
-#include "data/dfs_instance_events_traverser.h"
-
-class LengthOptimizer : public ConfigReader
-{
-public:
- float m_min_instance_bottom_distance;
- LengthOptimizer(ConfigProvider* config_provider);
- int process(BMscPtr bmsc);
-};
-
-class SortByX
-{
-public:
- bool operator() (InstancePtr i, InstancePtr j)
- {
- return (i->get_line_begin().get_x() < j->get_line_begin().get_x());
- }
-};
-
-class GetLengthInstances : public WhiteEventFoundListener
-{
-private:
- Coordinate m_max_length_y;
- Instance* m_max_inst;
-public:
- void on_white_event_found(Event *e)
- {
- if(m_max_length_y < e->get_position().get_y())
- {
- m_max_length_y = e->get_position().get_y();
- m_max_inst = e->get_instance();
- }
-
- }
- GetLengthInstances():
- m_max_length_y(0), m_max_inst(NULL)
- {}
-
- Coordinate get_max_length_y(void)
- {
- return m_max_length_y;
- }
-
- Instance* get_max_inst(void)
- {
- return m_max_inst;
- }
-};
-
-// $Id: $
\ No newline at end of file
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2009 Zuzana Pekarcikova <20...@ma...>
+ *
+ * $Id$
+ */
+
+#include "data/msc.h"
+#include <set>
+#include "data/configurator.h"
+#include "data/dfs_instance_events_traverser.h"
+
+class LengthOptimizer : public ConfigReader
+{
+public:
+ float m_min_instance_bottom_distance;
+ LengthOptimizer(ConfigProvider* config_provider);
+ int process(BMscPtr bmsc);
+};
+
+class SortByX
+{
+public:
+ bool operator() (InstancePtr i, InstancePtr j)
+ {
+ return (i->get_line_begin().get_x() < j->get_line_begin().get_x());
+ }
+};
+
+class GetLengthInstances : public WhiteEventFoundListener
+{
+private:
+ Coordinate m_max_length_y;
+ Instance* m_max_inst;
+public:
+ void on_white_event_found(Event *e)
+ {
+ if(m_max_length_y < e->get_position().get_y())
+ {
+ m_max_length_y = e->get_position().get_y();
+ m_max_inst = e->get_instance();
+ }
+
+ }
+ GetLengthInstances():
+ m_max_length_y(0), m_max_inst(NULL)
+ {}
+
+ Coordinate get_max_length_y(void)
+ {
+ return m_max_length_y;
+ }
+
+ Instance* get_max_inst(void)
+ {
+ return m_max_inst;
+ }
+};
+
+// $Id$
+
Property changes on: trunk/src/data/beautify/length_optimizer.h
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Modified: trunk/src/data/beautify/unoverlaying_messages.cpp
===================================================================
--- trunk/src/data/beautify/unoverlaying_messages.cpp 2010-05-08 12:09:38 UTC (rev 745)
+++ trunk/src/data/beautify/unoverlaying_messages.cpp 2010-05-08 12:14:32 UTC (rev 746)
@@ -1,251 +1,252 @@
-/*
- * scstudio - Sequence Chart Studio
- * http://scstudio.sourceforge.net
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * Copyright (c) 2009 Zuzana Pekarcikova <20...@ma...>
- *
- * $Id: unoverlaying_messages.cpp 660 2010-03-05 12:21:53Z xpekarc $
- */
-
-#include "unoverlaying_messages.h"
-#include "layout_optimizer.h"
-
-int UnoverlayingMessages::shift(BMscPtr bmsc, EventPtr e)
-{
-{
- LayoutOptimizer optimizer(this->get_config_provider());
-
- //set attributes of event to false
- SetAttribute set_attributes_listaner;
- DFSInstanceEventsTraverser set_attributes_traverser;
- set_attributes_traverser.add_white_event_found_listener(&set_attributes_listaner);
- for(InstancePtrList::const_iterator it = bmsc->get_instances().begin();it != bmsc->get_instances().end(); it++ )
- {
- set_attributes_traverser.traverse(it->get());
- (*it)->set_attribute("limit", 0);
- }
-
- InstancePtrList untreated;
- untreated.push_back(e->get_instance());
- //set limit on this instance
- e->get_instance()->set_attribute("limit",(int)(e->get_position().get_y()+0.5));
-
-
- std::set<InstancePtr> treated;
-
- while(!untreated.empty())
- {
- // inicialize
- InstancePtrList::const_iterator instance;
- instance = untreated.begin();
- treated.insert(*instance);
-
- DFSInstanceEventsTraverser inst_traverser;
- InstanceEvents inst_listener;
- inst_traverser.add_white_event_found_listener(&inst_listener);
- inst_traverser.traverse(instance->get());
-
- // all which is bigger of equel to limit has to be shift
- int limit;
- limit = (*instance)->get_attribute("limit", limit);
-
- SortEventByY compare_y;
- EventPtrList events = inst_listener.get_instance_events();
- events.sort(compare_y);
-
- for(EventPtrList::const_iterator ev=events.begin(); ev!=events.end(); ev++)
- {
- // ev is bigger or equal to limit
- if((int)((*ev)->get_position().get_y()+0.5) >= limit)
- {
- (*ev)->set_attribute("id", true);
-
- // put instance of matching event into untreated
- // note: event must be matched, message must be straight, instance of matching
- // event must not have been treated yet and must not to be in untreated yet
- if((*ev)->is_matched())
- if((int)((*ev)->get_matching_event()->get_position().get_y()+0.5) == (int)((*ev)->get_position().get_y()+0.5))
- if(treated.find((*ev)->get_matching_event()->get_instance()) == treated.end())
- {
- int attribute;
- if((*ev)->get_matching_event()->get_instance()->get_attribute("limit",attribute) == 0)
- {
- // set limit for instance of matching event
- (*ev)->get_matching_event()->get_instance()->set_attribute("limit",
- (int)((*ev)->get_matching_event()->get_position().get_y()+0.5));
- untreated.push_back((*ev)->get_matching_event()->get_instance());
- }
- }
- }
- }
- untreated.pop_front();
- }
-
- MoveListener movement;
- DFSInstanceEventsTraverser move_traverser;
-
- //move all events with attribute true and remove attributes
- move_traverser.add_white_event_found_listener(&movement);
- movement.distance = optimizer.m_successor_distance;
- for(InstancePtrList::const_iterator it_inst=bmsc->get_instances().begin(); it_inst!=bmsc->get_instances().end(); it_inst++)
- {
- move_traverser.traverse(it_inst->get());
- (*it_inst)->remove_attribute<int>("limit");
- }
-
-
- return 0;
-}
-}
-
-EventPtrList get_events_with_equal_y(EventPtrList e_list, int y)
-{
- EventPtrList list;
- for(EventPtrList::const_iterator it = e_list.begin(); it != e_list.end(); it++)
- {
- if((int)(*it)->get_position().get_y() == y)
- list.push_back(*it);
- }
- return list;
-}
-
-bool UnoverlayingMessages::solve_coregions_edges(BMscPtr bmsc, EventPtr e, std::set<CoregionArea*> &coregions)
-{
- bool conflict = false;
- std::set<CoregionArea*>coregions2 = coregions;
- int level = (int)(e->get_position().get_y()+0.5);
- int x1, x2, xcoreg;
- for(std::set<CoregionArea*>::const_iterator coregion=coregions.begin(); coregion!=coregions.end(); coregion++)
- {
- if(level > int((*coregion)->get_end_height()+0.5))
- coregions2.erase(*coregion);
- x1 = (int)(e->get_instance()->get_line_begin().get_x()+0.5);
- xcoreg = (int)((*coregion)->get_instance()->get_line_begin().get_x()+0.5);
- if(e->is_matched())
- x2 = (int)(e->get_matching_event()->get_instance()->get_line_begin().get_x()+0.5);
- else
- x2 = (int)(e->get_incomplete_message()->get_dot_position().get_x() + x1 + 0.5);
- if((level == int((*coregion)->get_end_height()+0.5)) ||
- level == int((*coregion)->get_begin_height()+0.5))
- {
- if((x1<xcoreg && xcoreg<x2) ||
- (x2<xcoreg && xcoreg<x1))
- {
- shift(bmsc, e);
- conflict = true;
- break;
- }
- }
- }
-
- coregions = coregions2;
- return conflict;
-}
-
-int UnoverlayingMessages::process(BMscPtr bmsc)
-{
- DFSInstanceEventsTraverser traverser;
- GetEventsList event_listener;
- SortEventByY e_compare_y;
- SortEventByX e_compare_x;
- int level;
- m_events.clear...
[truncated message content] |
|
From: <got...@us...> - 2010-05-08 16:31:27
|
Revision: 750
http://scstudio.svn.sourceforge.net/scstudio/?rev=750&view=rev
Author: gotthardp
Date: 2010-05-08 16:31:21 +0000 (Sat, 08 May 2010)
Log Message:
-----------
Fixed file properties.
Modified Paths:
--------------
trunk/src/check/localchoice/CMakeLists.txt
trunk/src/check/realizability/CMakeLists.txt
trunk/src/check/structure/CMakeLists.txt
trunk/src/data/modelchecking/CMakeLists.txt
trunk/tests/tighten_hmsc_test.cpp
trunk/tests/universal_boundedness/CMakeLists.txt
Property Changed:
----------------
trunk/src/check/localchoice/CMakeLists.txt
trunk/src/check/realizability/CMakeLists.txt
trunk/src/check/structure/CMakeLists.txt
trunk/src/check/time/find_block.cpp
trunk/src/check/time/hmsc_all_paths.cpp
trunk/src/check/time/hmsc_block_paths.cpp
trunk/src/check/time/traverse_erase.cpp
trunk/src/data/modelchecking/CMakeLists.txt
trunk/tests/deadlock/CMakeLists.txt
trunk/tests/find_block_test.cpp
trunk/tests/race/CMakeLists.txt
trunk/tests/tighten_hmsc_test.cpp
trunk/tests/time/consistency/CMakeLists.txt
trunk/tests/time_constraints/proper_neg13.mpr.result1
trunk/tests/time_constraints/proper_neg26.mpr.result.1
trunk/tests/time_constraints/proper_neg27.mpr.result.1
trunk/tests/time_constraints/proper_neg29.mpr.result
trunk/tests/time_constraints/proper_neg30.mpr.result
trunk/tests/time_constraints/proper_neg31.mpr.result
trunk/tests/time_constraints/proper_neg32.mpr.result
trunk/tests/time_constraints/proper_neg33.mpr.result
trunk/tests/time_constraints/proper_neg34.mpr.result
trunk/tests/time_constraints/proper_neg35.mpr.result
trunk/tests/universal_boundedness/CMakeLists.txt
trunk/tests/z120_test/z120_time26.mpr.result1
trunk/tests/z120_test/z120_time29.mpr.result1
trunk/tests/z120_test/z120_time30.mpr.result1
Modified: trunk/src/check/localchoice/CMakeLists.txt
===================================================================
--- trunk/src/check/localchoice/CMakeLists.txt 2010-05-08 12:59:37 UTC (rev 749)
+++ trunk/src/check/localchoice/CMakeLists.txt 2010-05-08 16:31:21 UTC (rev 750)
@@ -1,18 +1,18 @@
-ADD_LIBRARY(sclocalchoice SHARED
- export.h
- module.cpp
- local_choice_checker.cpp
- local_choice_checker.h
-)
-
-TARGET_LINK_LIBRARIES(sclocalchoice
- scmsc
- scpseudocode
-)
-
-INSTALL(TARGETS sclocalchoice
- RUNTIME DESTINATION bin
- LIBRARY DESTINATION lib
- ARCHIVE DESTINATION lib)
-
-# $Id:$
+ADD_LIBRARY(sclocalchoice SHARED
+ export.h
+ module.cpp
+ local_choice_checker.cpp
+ local_choice_checker.h
+)
+
+TARGET_LINK_LIBRARIES(sclocalchoice
+ scmsc
+ scpseudocode
+)
+
+INSTALL(TARGETS sclocalchoice
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib)
+
+# $Id:$
Property changes on: trunk/src/check/localchoice/CMakeLists.txt
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Modified: trunk/src/check/realizability/CMakeLists.txt
===================================================================
--- trunk/src/check/realizability/CMakeLists.txt 2010-05-08 12:59:37 UTC (rev 749)
+++ trunk/src/check/realizability/CMakeLists.txt 2010-05-08 16:31:21 UTC (rev 750)
@@ -1,18 +1,18 @@
-ADD_LIBRARY(screalizability SHARED
- export.h
- module.cpp
- realizability_checker.cpp
- realizability_checker.h
-)
-
-TARGET_LINK_LIBRARIES(screalizability
- scmsc
- scpseudocode
-)
-
-INSTALL(TARGETS screalizability
- RUNTIME DESTINATION bin
- LIBRARY DESTINATION lib
- ARCHIVE DESTINATION lib)
-
-# $Id:$
+ADD_LIBRARY(screalizability SHARED
+ export.h
+ module.cpp
+ realizability_checker.cpp
+ realizability_checker.h
+)
+
+TARGET_LINK_LIBRARIES(screalizability
+ scmsc
+ scpseudocode
+)
+
+INSTALL(TARGETS screalizability
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib)
+
+# $Id:$
Property changes on: trunk/src/check/realizability/CMakeLists.txt
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Modified: trunk/src/check/structure/CMakeLists.txt
===================================================================
--- trunk/src/check/structure/CMakeLists.txt 2010-05-08 12:59:37 UTC (rev 749)
+++ trunk/src/check/structure/CMakeLists.txt 2010-05-08 16:31:21 UTC (rev 750)
@@ -1,20 +1,20 @@
-ADD_LIBRARY(scstructure SHARED
- export.h
- module.cpp
- name_checker.cpp
- name_checker.h
- nonrecursivity_checker.cpp
- nonrecursivity_checker.h
-)
-
-TARGET_LINK_LIBRARIES(scstructure
- scpseudocode
- scmsc
-)
-
-INSTALL(TARGETS scstructure
- RUNTIME DESTINATION bin
- LIBRARY DESTINATION lib
- ARCHIVE DESTINATION lib)
-
-# $Id: CMakeLists.txt 206 2009-03-25 17:03:43Z vacek $
+ADD_LIBRARY(scstructure SHARED
+ export.h
+ module.cpp
+ name_checker.cpp
+ name_checker.h
+ nonrecursivity_checker.cpp
+ nonrecursivity_checker.h
+)
+
+TARGET_LINK_LIBRARIES(scstructure
+ scpseudocode
+ scmsc
+)
+
+INSTALL(TARGETS scstructure
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib)
+
+# $Id$
Property changes on: trunk/src/check/structure/CMakeLists.txt
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Property changes on: trunk/src/check/time/find_block.cpp
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: trunk/src/check/time/hmsc_all_paths.cpp
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: trunk/src/check/time/hmsc_block_paths.cpp
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: trunk/src/check/time/traverse_erase.cpp
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: trunk/src/data/modelchecking/CMakeLists.txt
===================================================================
--- trunk/src/data/modelchecking/CMakeLists.txt 2010-05-08 12:59:37 UTC (rev 749)
+++ trunk/src/data/modelchecking/CMakeLists.txt 2010-05-08 16:31:21 UTC (rev 750)
@@ -1,16 +1,16 @@
-ADD_LIBRARY(scmodelchecking SHARED
- export.h
- module.cpp
- divine.h
- divine.cpp
-)
-
-TARGET_LINK_LIBRARIES(scmodelchecking
- scmsc
- scpseudocode
-)
-
-INSTALL(TARGETS scmodelchecking
- RUNTIME DESTINATION bin
- LIBRARY DESTINATION lib
- ARCHIVE DESTINATION lib)
+ADD_LIBRARY(scmodelchecking SHARED
+ export.h
+ module.cpp
+ divine.h
+ divine.cpp
+)
+
+TARGET_LINK_LIBRARIES(scmodelchecking
+ scmsc
+ scpseudocode
+)
+
+INSTALL(TARGETS scmodelchecking
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib)
Property changes on: trunk/src/data/modelchecking/CMakeLists.txt
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Property changes on: trunk/tests/deadlock/CMakeLists.txt
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Property changes on: trunk/tests/find_block_test.cpp
___________________________________________________________________
Added: svn:keywords
+ Id
Property changes on: trunk/tests/race/CMakeLists.txt
___________________________________________________________________
Modified: svn:keywords
- Date Revision Author HeadURL Id
+ Id
Modified: trunk/tests/tighten_hmsc_test.cpp
===================================================================
--- trunk/tests/tighten_hmsc_test.cpp 2010-05-08 12:59:37 UTC (rev 749)
+++ trunk/tests/tighten_hmsc_test.cpp 2010-05-08 16:31:21 UTC (rev 750)
@@ -13,7 +13,7 @@
*
* Copyright (c) LK
*
- * $Id: tighten_msc_test.cpp 602 2010-02-20 11:38:10Z kocianon $
+ * $Id$
*/
#include <iostream>
@@ -153,4 +153,4 @@
}
-// $Id: tighten_msc_test.cpp 602 2010-02-20 11:38:10Z kocianon $
+// $Id$
Property changes on: trunk/tests/tighten_hmsc_test.cpp
___________________________________________________________________
Added: svn:keywords
+ Id
Property changes on: trunk/tests/time/consistency/CMakeLists.txt
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Property changes on: trunk/tests/time_constraints/proper_neg13.mpr.result1
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: trunk/tests/time_constraints/proper_neg26.mpr.result.1
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: trunk/tests/time_constraints/proper_neg27.mpr.result.1
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: trunk/tests/time_constraints/proper_neg29.mpr.result
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: trunk/tests/time_constraints/proper_neg30.mpr.result
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: trunk/tests/time_constraints/proper_neg31.mpr.result
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: trunk/tests/time_constraints/proper_neg32.mpr.result
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: trunk/tests/time_constraints/proper_neg33.mpr.result
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: trunk/tests/time_constraints/proper_neg34.mpr.result
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: trunk/tests/time_constraints/proper_neg35.mpr.result
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: trunk/tests/universal_boundedness/CMakeLists.txt
===================================================================
--- trunk/tests/universal_boundedness/CMakeLists.txt 2010-05-08 12:59:37 UTC (rev 749)
+++ trunk/tests/universal_boundedness/CMakeLists.txt 2010-05-08 16:31:21 UTC (rev 750)
@@ -1,10 +1,10 @@
-ADD_CHECKER_TEST(scboundedness "Universal Boundedness" bounded.mpr 1)
-ADD_CHECKER_TEST(scboundedness "Universal Boundedness" bounded2.mpr 1)
-ADD_CHECKER_TEST(scboundedness "Universal Boundedness" bounded3.mpr 1)
-ADD_CHECKER_TEST(scboundedness "Universal Boundedness" bounded4.mpr 1)
-ADD_CHECKER_TEST(scboundedness "Universal Boundedness" bounded5.mpr 1)
-ADD_CHECKER_TEST(scboundedness "Universal Boundedness" unbounded.mpr 0)
-ADD_CHECKER_TEST(scboundedness "Universal Boundedness" unbounded2.mpr 0)
-ADD_CHECKER_TEST(scboundedness "Universal Boundedness" unbounded3.mpr 0)
-ADD_CHECKER_TEST(scboundedness "Universal Boundedness" unbounded4.mpr 0)
-ADD_CHECKER_TEST(scboundedness "Universal Boundedness" unbounded5.mpr 0)
+ADD_CHECKER_TEST(scboundedness "Universal Boundedness" bounded.mpr 1)
+ADD_CHECKER_TEST(scboundedness "Universal Boundedness" bounded2.mpr 1)
+ADD_CHECKER_TEST(scboundedness "Universal Boundedness" bounded3.mpr 1)
+ADD_CHECKER_TEST(scboundedness "Universal Boundedness" bounded4.mpr 1)
+ADD_CHECKER_TEST(scboundedness "Universal Boundedness" bounded5.mpr 1)
+ADD_CHECKER_TEST(scboundedness "Universal Boundedness" unbounded.mpr 0)
+ADD_CHECKER_TEST(scboundedness "Universal Boundedness" unbounded2.mpr 0)
+ADD_CHECKER_TEST(scboundedness "Universal Boundedness" unbounded3.mpr 0)
+ADD_CHECKER_TEST(scboundedness "Universal Boundedness" unbounded4.mpr 0)
+ADD_CHECKER_TEST(scboundedness "Universal Boundedness" unbounded5.mpr 0)
Property changes on: trunk/tests/universal_boundedness/CMakeLists.txt
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Property changes on: trunk/tests/z120_test/z120_time26.mpr.result1
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: trunk/tests/z120_test/z120_time29.mpr.result1
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: trunk/tests/z120_test/z120_time30.mpr.result1
___________________________________________________________________
Added: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2010-05-10 23:14:25
|
Revision: 754
http://scstudio.svn.sourceforge.net/scstudio/?rev=754&view=rev
Author: madzin
Date: 2010-05-10 23:14:18 +0000 (Mon, 10 May 2010)
Log Message:
-----------
Some refactoring of membership
Modified Paths:
--------------
trunk/src/membership/membership_alg.cpp
trunk/tests/membership/CMakeLists.txt
Modified: trunk/src/membership/membership_alg.cpp
===================================================================
--- trunk/src/membership/membership_alg.cpp 2010-05-10 21:55:44 UTC (rev 753)
+++ trunk/src/membership/membership_alg.cpp 2010-05-10 23:14:18 UTC (rev 754)
@@ -35,55 +35,173 @@
HMscPtr search_bmsc(BMscPtr bmsc, BMscPtr bmsc_f);
HMscPtr search_hmsc(HMscPtr hmsc, BMscPtr bmsc_f);
+/*
+ * checks whole branch from defined node in HMSC
+ */
bool check_branch(HMscNodePtr node, ConfigurationPtr b);
+/*
+ * adds searched configuration to map of checked configurations
+ *
+ * configuration - state of node in searched HMSC and state of bMSC which is looked for
+ */
void add_checked_branch(ReferenceNodePtr ref_node, ConfigurationPtr searched_conf);
+/*
+ * checks if instance contains any event
+ */
bool is_empty_instance(InstancePtrList node_instances, InstancePtrList b_instances);
+/*
+ * compares strict order area from HMSC node with matching strict order area from bMSC which is looked for
+ *
+ * parameters: node_events - events of HMSC node cut
+ * b_events - events of bMSC cut
+ * type: membership - checks matching events and adds receive ordering
+ * receive_ordering - checks receive ordering
+ */
bool strict_strict(std::vector<Event*>& node_events, std::vector<Event*>& b_events, enum check_type type);
+/*
+ * compares coregion area from HMSC node with matching strict order area from bMSC which is looked for
+ *
+ * parameters: node_events - events of HMSC node cut
+ * b_events - events of bMSC cut
+ * type: membership - checks matching events and adds receive ordering
+ * receive_ordering - checks receive ordering
+ */
+bool coregion_strict(std::vector<Event*>& node_events, std::vector<Event*>& b_events, enum check_type type);
+
+/*
+ * compares strict order area from HMSC node and coregion area from bMSC which is looked for
+ *
+ * DEVELOPMENT WAS STOPPED
+ */
bool strict_coregion(StrictOrderAreaPtr node_strict, std::vector<Event*>& node_events,
CoregionAreaPtr b_coregion, std::vector<Event*>& b_events);
-bool coregion_strict(std::vector<Event*>& node_events, std::vector<Event*>& b_events, enum check_type type);
-
+/*
+ * compares coretion area from HMSC node and coregion area from bMSC which is looked for
+ *
+ * DEVELOPMENT WAS STOPPED
+ */
bool coregion_coretion(CoregionAreaPtr node_coregion, std::vector<Event*>& node_events,
CoregionAreaPtr b_coregion, std::vector<Event*>& b_events);
+/*
+ * compares two events
+ */
bool compare_events(Event* a, Event* b);
+/*
+ * compares events attributes
+ */
bool compare_events_attribute(Event* a, Event* b);
+/*
+ * tries to find configuration into map of seared configuration
+ */
bool look_at_checked_conf(ReferenceNodePtr node, ConfigurationPtr b);
+/*
+ * compares one instance from HMSC node with matching instance from bMSC which is looked for
+ *
+ * parameters: node_instance - instance from HMSC node
+ * type: membership - checks matching events and adds receive ordering
+ * receive_ordering - checks receive ordering
+ * old_position - events where the checking starts
+ */
bool check_instance(InstancePtr node_instance, enum check_type type, PositionPtr old_position);
+/*
+ * compares bMsc from HMSC node with matching scenario in bMSC which is looked for
+ * parameters: node - HMSC node
+ * type: membership - checks matching events and adds receive ordering
+ * receive_ordering - checks receive ordering
+ * old_conf - HMSC node configuration of start searching
+ */
bool check_node(ReferenceNodePtr node, enum check_type type, ConfigurationPtr old_conf);
+/*
+ * in case events are send events, adds attribute to both events and to both receive event in case messages are complete
+ *
+ * parameters: node_e - event from HMSC node
+ * b_e - event from bMSC
+ */
void set_identification(Event* node_e, Event* b_e);
+/*
+ * checks whether node has null pointer to reference bMSC
+ */
bool is_node_null(ReferenceNodePtr node);
+/*
+ * checks whether instance contains any event
+ */
bool is_instance_null(InstancePtr instance);
+/*
+ * checks whether coregion area contains any event
+ */
bool is_cor_area_null(CoregionAreaPtr cor);
+/*
+ * checks whether strict order area contains any event
+ */
bool is_strict_area_null(StrictOrderAreaPtr strict);
+/*
+ * checks time constraints in HMSC node
+ *
+ */
+//TODO skontrolovat co to vlastne robi, a kde kontrolujem casove obmedzenia v ramci bMSC z dajakeho HMSC nodu
bool check_node_time(ReferenceNodePtr node, ConfigurationPtr conf);
+/*
+ * finds the maximum event of HMSC node and returns time interval value of matching event in bMSC
+ *
+ * !!TIME MEMBERSHIP WORKS IF EACH EVENT IN bMSC HAS GOT TIME INTERVAL WITH ONE EVENT (the same for all events) AND NO MORE!!
+ */
int get_max_interval(ReferenceNodePtr node, ConfigurationPtr conf);
+/*
+ * finds the minimum event of HMSC node and returns time interval value of matching event in bMSC
+ *
+ * !!TIME MEMBERSHIP WORKS IF EACH EVENT IN bMSC HAS GOT TIME INTERVAL WITH ONE EVENT (the same for all events) AND NO MORE!!
+ */
int get_min_interval(ConfigurationPtr conf);
-Event* get_last_instance_event(Event* start, int id = INT_MAX);
+/*
+ * returns the last event on instance
+ */
+std::vector<Event*> get_last_instance_event(Event* start);
+/*
+ * returns maximal events of coregion area
+ */
+std::vector<Event*> get_last_coregion_events(CoregionArea* cor);
+
+/*
+ * compares events time relations
+ *
+ * paramterers: a - HMSC node
+ * b - bMSC node
+ */
bool compare_events_time_relations(Event* a, Event* b);
-Event* find_event_on_instance_by_id(std::wstring label, int id);
+/*
+ * finds event in bMSC on instance by id
+ *
+ * parameters: label - label of instance where the event should be
+ * id - id of event which is looked for
+ */
+Event* find_event_on_instance_by_id(std::wstring label, int id, StrictEventPtr start_event = NULL);
+/*
+ * removes event attribute "indentification"
+ */
void remove_events_attributes(std::vector<Event*> vec);
+
/*
* Returns precondition list of the membership algorithm
*/
@@ -104,7 +222,7 @@
if (bmsc_f == NULL)
{
print_report(RS_ERROR,
- stringize() << "Searched flow must be a basic MSC.");
+ stringize() << "MSC which is looked for, must be bMSC.");
return NULL;
}
@@ -115,12 +233,18 @@
else
{
BMscPtr bmsc = boost::dynamic_pointer_cast<BMsc > (msc);
- return search_bmsc(bmsc, bmsc_f);
+ if(bmsc != NULL)
+ return search_bmsc(bmsc, bmsc_f);
+ else
+ {
+ print_report(RS_ERROR, stringize() << "Membership algorithm cannot recognize a type of browsed MSC");
+ return NULL;
+ }
}
}
/*
- * Tries finding bMSC in HMSC
+ * Tries to find bMSC in HMSC
*/
HMscPtr search_hmsc(HMscPtr hmsc, BMscPtr bmsc_f)
{
@@ -139,7 +263,9 @@
std::cout << "top size " << top.size() << std::endl;
*/
-dup_hmsc = hmsc; // dup_hmsc = duplicator.duplicate(hmsc);
+ //dup_hmsc should be MSC graph. Due to that duplicatior throws exception during copying time intervals, membership workes just with MSC graphs.
+ dup_hmsc = hmsc;
+// dup_hmsc = dup_hmsc = duplicator.duplicate(hmsc);
/*
start = dup_hmsc->get_start();
@@ -157,6 +283,7 @@
StartNodePtr start_node = dup_hmsc->get_start();
+ //strt of searching
if (check_branch(start_node, searched_conf))
{
return new HMsc(); //TODO return path in hmsc
@@ -177,8 +304,9 @@
*/
bool check_branch(HMscNodePtr hmsc_node, ConfigurationPtr b)
{
+ //remove attributes from previous computation
if(!attributed_events.empty())
- std::cerr << "Internal warning: some event has got attribute" << std::endl;
+ remove_events_attributes(attributed_events);
//checks end node
EndNodePtr end = boost::dynamic_pointer_cast<EndNode > (hmsc_node);
@@ -218,8 +346,6 @@
}
else
{
- //TODO add this check to while cycle
-
//when deosn't exist empty path to EndNode
if (b->is_null() && !is_node_null(node))
return false;
@@ -233,18 +359,21 @@
old_config_I = new Configuration(b);
old_config_II = new Configuration(b);
+ //tries to matching events between searched MSC and bMSC which is looked for
if (!check_node(node, membership, b))
{
remove_events_attributes(attributed_events);
return false;
}
+ //checks time constraints for this node
if(!check_node_time(node, old_config_II))
{
remove_events_attributes(attributed_events);
return false;
}
+ //checks the ordering of events (by attribute which was set at check_node(node, membership,b))
if (!check_node(node, receive_ordering, old_config_I))
{
remove_events_attributes(attributed_events);
@@ -258,6 +387,7 @@
SuccessorNode* succ;
HMscNode* hmsc_succ;
+ //continue with browsing node's seccessors
for (it = successors.begin(); it != successors.end(); it++)
{
succ = (*it)->get_successor();
@@ -547,6 +677,9 @@
*/
}
+/*
+ * finds instance by the name
+ */
InstancePtr find_instance(InstancePtrList instances, std::wstring name)
{
@@ -561,13 +694,27 @@
return NULL;
}
-//TODO
-
/*
* Add checked branch to map of checked branches
*/
void add_checked_branch(ReferenceNodePtr ref_node, ConfigurationPtr conf)
{
+ BMscPtr bmsc = ref_node->get_bmsc();
+
+ if(bmsc == NULL)
+ {
+ std::cerr << "Internal error: checked_branch" << std::endl;
+ return;
+ }
+
+ std::wstring bmsc_name = bmsc->get_label();
+ std::set<ConfigurationPtr> conf_set;
+ conf_set.insert(conf);
+
+ if(checked.find(bmsc_name) == checked.end())
+ checked.insert(std::make_pair(bmsc_name, conf_set));
+ else
+ checked.find(bmsc_name)->second.insert(conf);
}
/*
@@ -698,6 +845,7 @@
double a_time = a_interval.get_begin_value();
double b_time = b_interval.get_begin_value();
+//TODO skontrolovat, nepaci sa mi ze by sa na evente z HMSC nastavovala nula
if(time_a_intervals.size() > 1)
a_time = 0;
@@ -721,29 +869,40 @@
return true;
}
-Event* find_event_on_instance_by_id(std::wstring label, int id)
+Event* find_event_on_instance_by_id(std::wstring label, int id, StrictEventPtr start_event)
{
- InstancePtrList instances = global_bmsc->get_instances();
- InstancePtrList::iterator it;
- InstancePtr instance;
+ EventAreaPtr first;
- for(it = instances.begin(); it != instances.end(); it++)
+ if(start_event == NULL)
{
- if((*it)->get_label() == label)
+ InstancePtrList instances = global_bmsc->get_instances();
+ InstancePtrList::iterator it;
+ InstancePtr instance;
+
+ for(it = instances.begin(); it != instances.end(); it++)
{
- instance = *it;
- break;
+ if((*it)->get_label() == label)
+ {
+ instance = *it;
+ break;
+ }
}
+
+ first = instance->get_first();
}
+ else
+ {
+ first = start_event->get_general_area();
+ }
- EventAreaPtr first = instance->get_first();
StrictOrderAreaPtr strict = boost::dynamic_pointer_cast<StrictOrderArea>(first);
StrictEventPtr str = strict->get_first();
+ //function finds event only in bMSC which is looked for, so coregion area is not allowed
if(str == NULL)
{
- std::cerr << "Error: Unexpected behaviour 5" << std::endl;
+ std::cerr << "Error: bMSC which is looked for contains coregion area" << std::endl;
return NULL;
}
@@ -752,12 +911,6 @@
event_id = str->get_attribute("identification", -1, event_set);
- if(event_set)
- {
- std::cerr << "Error: Unexpected behaviour 4" << std::endl;
- return NULL;
- }
-
StrictEventPtr old;
while(event_id != id)
@@ -788,12 +941,6 @@
}
event_id = str->get_attribute("identification", -1, event_set);
-
- if(event_set)
- {
- std::cerr << "Error: Unexpected behaviour 4" << std::endl;
- return NULL;
- }
}
return str.get();
@@ -826,7 +973,7 @@
node->add_successor(succ);
else
{
- std::cout << "Error: Unexpected behaviour" << std::endl;
+ std::cout << "Error: Unexpected behaviour 43" << std::endl;
return false;
}
@@ -841,7 +988,7 @@
node->add_successor(succ);
else
{
- std::cout << "Error: Unexpected behaviour" << std::endl;
+ std::cout << "Error: Unexpected behaviour 23" << std::endl;
return false;
}
@@ -988,7 +1135,7 @@
if (node_events.empty())
node_events.push_back(node_strict->get_first().get());
else
- std::cout << "Error: Unexpected error" << std::endl;
+ std::cout << "Error: Unexpected error 24" << std::endl;
}
bool result;
@@ -1098,7 +1245,11 @@
BMscPtr bmsc = boost::dynamic_pointer_cast<BMsc > (msc);
if (bmsc == NULL)
+ {
+// print_report(RS_ERROR, stringize() << "Error: Some reference node does not refers to bMSC");
+ std::cerr << "Error: Some reference node does not refers to bMSC." << std::endl;
return false;
+ }
InstancePtrList node_instances = bmsc->get_instances();
InstancePtrList b_instances = conf->get_instances();
@@ -1444,11 +1595,6 @@
}
-bool check_interval(TimeRelationRefNodePtr relation, TopBottom point)
-{
- return false;
-}
-
int get_min_interval(ConfigurationPtr conf)
{
std::set<PositionPtr> positions = conf->get_positions();
@@ -1463,22 +1609,31 @@
if(events.size() == 0)
continue;
+//TODO dopracovat coregiony => events.size mozeb byt > 1
time_intervals = events.front()->get_time_relations();
if(time_intervals.size() > 1)
min = 0;
+ if(time_intervals.size() == 0)
+ {
+ std::cerr << "Error: Unexpected behaviour, some event in bMSC, which is looked for, has not got time interval" << std::endl;
+ return min;
+ }
+
MscTimeIntervalSetD time_set = time_intervals.front()->get_interval_set();
if(time_set.is_empty())
{
- std::cerr << "Error: Unexpected behaviour " << std::endl;
+ std::cerr << "Error: Unexpected behaviour, some time interval of event in bMSC, which is looked for, is empty" << std::endl;
+ return min;
}
MscTimeInterval<double> temp = time_set.get_set().front();
+ //this implementation assumes that each time interval is defined as [number].
if(min > temp.get_begin_value())
- min = (int)temp.get_begin_value();
+ min = temp.get_begin_value();
}
return min;
@@ -1496,7 +1651,7 @@
BMscPtr bmsc = boost::dynamic_pointer_cast<BMsc>(msc);
if(bmsc == NULL)
- std::cerr << "Error: Unexpected behaviur" << std::endl;
+ std::cerr << "Error: Unexpected behaviur 35" << std::endl;
InstancePtrList instances = bmsc->get_instances();
InstancePtrList::iterator inst_it;
@@ -1508,6 +1663,7 @@
StrictOrderArea* strict;
CoregionArea* cor;
+ //mozna uprava, brat instancie z conf a ked sa instancia nenachadza v HMSC node tak sa berie event z conf
for(inst_it = instances.begin(); inst_it != instances.end(); inst_it++)
{
area = (*inst_it)->get_first().get();
@@ -1517,7 +1673,9 @@
{
start = strict->get_first();
std::vector<int> identifications;
- Event* e = get_last_instance_event(start.get());
+ std::vector<Event*> e_set = get_last_instance_event(start.get());
+//TODO dopracovat coregiony
+ Event* e = e_set.front();
if(e == NULL)
continue;
@@ -1525,6 +1683,7 @@
int it_id;
bool it_set = true;
+ //mozno by to chcelo prerobit na is_set_attribure aby sa tu zbytocne nedavali nove hodnoty do attributu, potom by sa mohlo zmazat remove_attribure z check node.
it_id = e->get_attribute("identification", -1, it_set);
if(!it_set)
@@ -1569,7 +1728,9 @@
continue;
}
+ //spoliehame sa na strict order area takze tam vzdy bude iba jeden event
Event* e = events.front();
+ StrictEvent* s_e = dynamic_cast<StrictEvent*> (e);
std::map <std::wstring, std::vector<int> >::iterator node_last_it;
node_last_it = node_last_events.find(e->get_instance()->get_label());
@@ -1582,8 +1743,8 @@
for(unsigned int i = 0; i < node_events.size(); i++)
{
-
- Event* last = get_last_instance_event(e, node_events[i]);
+ //porozmyslat ci by sa to nedalo nahradit pomocou find_event_on_instance_by_id
+ Event* last = find_event_on_instance_by_id(e->get_instance()->get_label(), node_events[i], s_e);
if(last == NULL)
continue;
@@ -1594,103 +1755,83 @@
if(time_set.is_empty())
{
- std::cerr << "Error: Unexpected behaviour" << std::endl;
+ std::cerr << "Error: Unexpected behaviour 53" << std::endl;
}
+ //spoliehame sa na to ze casy su zadane takto: [number]
MscTimeInterval<double> temp = time_set.get_set().front();
if(max < temp.get_begin_value())
- max = (int)temp.get_begin_value();
+ max = temp.get_begin_value();
}
}
return max;
}
-Event* get_last_instance_event(Event* start, int id)
+std::vector<Event*> get_last_instance_event(Event* start)
{
+ std::vector<Event*> result;
+
if(start == NULL)
- return NULL;
+ return result;
EventArea* area = start->get_general_area();
+ EventArea* not_null_area = area;
- if(area->get_next() == NULL)
+ StrictOrderArea* str;
+ CoregionArea* cor;
+
+ while(area->get_next() != NULL)
{
- StrictOrderArea* str = dynamic_cast<StrictOrderArea*>(area);
-
- if(!is_strict_area_null(str))
+ area = area->get_next().get();
+ str = dynamic_cast<StrictOrderArea*>(area);
+ cor = dynamic_cast<CoregionArea*>(area);
+
+ if(str == NULL)
{
- if(id != INT_MAX)
- {
- StrictEventPtr e = str->get_first();
-
- int it_id;
- bool it_set = true;
-
- it_id = e->get_attribute("identification", -1, it_set);
-
- while(!it_set && it_id != id)
- {
- e = e->get_successor();
- it_id = e->get_attribute("identification", -1, it_set);
- }
-
- if(it_set)
- std::cerr << "Error: Unexpected behaviour" << std::endl;
- else
- return e.get();
- }
+ if(!is_strict_area_null(str))
+ not_null_area = str;
}
+ else
+ if(!is_cor_area_null(cor))
+ not_null_area = cor;
}
+ str = dynamic_cast<StrictOrderArea*>(not_null_area);
+ cor = dynamic_cast<CoregionArea*>(not_null_area);
- while (area->get_next() != NULL)
+ if(str != NULL)
{
- StrictOrderArea* str = dynamic_cast<StrictOrderArea*>(area->get_next().get());
+ result.push_back(str->get_last().get());
+ return result;
+ }
+ else
+ return get_last_coregion_events(cor);
+}
- if(!is_strict_area_null(str))
- {
- if(id != INT_MAX)
- {
- StrictEventPtr e = str->get_first();
+std::vector<Event*> get_last_coregion_events(CoregionArea* cor)
+{
+ std::vector<Event*> result;
- int it_id;
- bool it_set = true;
+ CoregionEventPVector vec = cor->get_maximal_events();
+ CoregionEventPVector::iterator it;
- it_id = e->get_attribute("identification", -1, it_set);
-
- while(!it_set && it_id != id)
- {
- e = e->get_successor();
-
- if(e == NULL)
- break;
-
- it_id = e->get_attribute("identification", -1, it_set);
- }
-
- if(it_set)
- std::cerr << "Error: Unexpected behaviour" << std::endl;
- else
- return e.get();
- }
- else
- area = area->get_next().get();
- }
-
+ for(it = vec.begin(); it != vec.end(); it++)
+ {
+ EventPtr e = *it;
+ result.push_back(e.get());
}
-
- StrictOrderArea* strict = dynamic_cast<StrictOrderArea*>(area);
-
- if(strict == NULL)
- std::cerr << "Error: Pattern bMSC contains coretion" << std::endl;
-
- return strict->get_last().get();
+
+ return result;
}
void remove_events_attributes(std::vector<Event*> vec)
{
std::vector<Event*>::iterator it;
+
for(it = vec.begin(); it != vec.end(); it++)
(*it)->remove_attribute<int>("identification");
+
+ vec.clear();
}
Modified: trunk/tests/membership/CMakeLists.txt
===================================================================
--- trunk/tests/membership/CMakeLists.txt 2010-05-10 21:55:44 UTC (rev 753)
+++ trunk/tests/membership/CMakeLists.txt 2010-05-10 23:14:18 UTC (rev 754)
@@ -92,7 +92,9 @@
ADD_TEST(membership_test-37 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_hmsc18.mpr ${CMAKE_CURRENT_SOURCE_DIR}/test_bmsc18_3.mpr 0)
-ADD_TEST(membership_test-38 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_hmsc19.mpr ${CMAKE_CURRENT_SOURCE_DIR}/test_bmsc19.mpr 1)
+#due to duplicator, membership works only over MSC graph
+#ADD_TEST(membership_test-38 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_hmsc19.mpr ${CMAKE_CURRENT_SOURCE_DIR}/test_bmsc19.mpr 1)
+ADD_TEST(membership_test-38 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_hmsc19.mpr ${CMAKE_CURRENT_SOURCE_DIR}/test_bmsc19.mpr 0)
#test bMSC x bMSC
ADD_TEST(membership_test-39 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_bmsc19.mpr ${CMAKE_CURRENT_SOURCE_DIR}/test_bmsc19.mpr 1)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mbe...@us...> - 2010-05-12 21:29:15
|
Revision: 769
http://scstudio.svn.sourceforge.net/scstudio/?rev=769&view=rev
Author: mbezdeka
Date: 2010-05-12 21:29:09 +0000 (Wed, 12 May 2010)
Log Message:
-----------
message numbering added
Modified Paths:
--------------
trunk/doc/help/frontend.html
trunk/doc/help/pictures/frontend.png
trunk/src/view/visio/addon/addon.cpp
trunk/src/view/visio/addon/addon.h
trunk/src/view/visio/addon/dllmodule.rc
trunk/src/view/visio/addon/document.cpp
trunk/src/view/visio/addon/document.h
trunk/src/view/visio/addon/document_check.cpp
trunk/src/view/visio/addon/resource.h
trunk/src/view/visio/addon/scstudio.vcproj
Added Paths:
-----------
trunk/doc/help/pictures/
trunk/doc/help/pictures/icon_message_enumeration.png
trunk/doc/help/pictures/icon_message_enumeration_disable.png
trunk/doc/help/pictures/message_numbering_options.png
trunk/src/view/visio/addon/enumerateUtils.cpp
trunk/src/view/visio/addon/enumerateUtils.h
trunk/src/view/visio/addon/enumerationDlg.cpp
trunk/src/view/visio/addon/enumerationDlg.h
trunk/src/view/visio/addon/icon_message_enumeration.ico
trunk/src/view/visio/addon/icon_message_enumeration_disable.ico
Modified: trunk/doc/help/frontend.html
===================================================================
--- trunk/doc/help/frontend.html 2010-05-12 20:30:56 UTC (rev 768)
+++ trunk/doc/help/frontend.html 2010-05-12 21:29:09 UTC (rev 769)
@@ -23,5 +23,21 @@
See the <a href="frontend/shortcuts.html">Keyboard accelerators</a> section to
list all of them.</p>
+<h2>Message Numbering</h2>
+<p>Message numbering allows users to enumerate all types of message shapes (left, right, lost, found).<br>
+You can enumerate all messages on the active page (if no messages are selected) or the selection. <br>
+
+<p>By pressing Message numbering button <img src="pictures/icon_message_enumeration.png" alt="Message Numbering"> or by using hotkey <Code>Ctrl+Alt+E</Code> the dialog with options will be shown:</p>
+
+<p>
+<img src="pictures/message_numbering_options.png" alt="Message Numbering options dialog">
+</p>
+
+<p>You can choose specific numbering type (numbers, letters, capital letters, romans), starting index (1-9999) and additional string following the index such as ".", ",", …</p>
+
+<p>If <code>automatically enumerate new messages</code> is checked, any newly dropped messages will be enumerate according to the nearest numbered group.</p>
+
+<p>Numbering can be deleted by pressing Delete numbering button <img src="pictures/icon_message_enumeration_disable.png" alt="Disable message numbering"> on the toolbar or by using hotkey <Code>Ctrl+Alt+D.</Code></p>
+
</body>
</html>
Modified: trunk/doc/help/pictures/frontend.png
===================================================================
(Binary files differ)
Added: trunk/doc/help/pictures/icon_message_enumeration.png
===================================================================
(Binary files differ)
Property changes on: trunk/doc/help/pictures/icon_message_enumeration.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/doc/help/pictures/icon_message_enumeration_disable.png
===================================================================
(Binary files differ)
Property changes on: trunk/doc/help/pictures/icon_message_enumeration_disable.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/doc/help/pictures/message_numbering_options.png
===================================================================
(Binary files differ)
Property changes on: trunk/doc/help/pictures/message_numbering_options.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/src/view/visio/addon/addon.cpp
===================================================================
--- trunk/src/view/visio/addon/addon.cpp 2010-05-12 20:30:56 UTC (rev 768)
+++ trunk/src/view/visio/addon/addon.cpp 2010-05-12 21:29:09 UTC (rev 769)
@@ -59,6 +59,8 @@
m_pIAddonSink = NULL;
m_keyButtonState = 0;
m_mousePosX = m_mousePosY = 0.0;
+ m_bCellChanged = false;
+ m_bShapeDeleted = false;
};
VAORC CStudioAddon::About(LPVAOV2LSTRUCT pV2L)
@@ -276,6 +278,9 @@
case CDocumentMonitor::MENU_MESSAGE_SEQUENCE: // 103
TRACE("CStudioAddon::Run() menu item 'Check--Drawing--Message Sequence'");
return pDocumentMonitor->OnMenuMessageSequence(vsoApp);
+ case CDocumentMonitor::MENU_SELECT_NUMBERED_GROUP: //104
+ TRACE("CStudioAddon::Run() menu item 'context menu - select numbering group'");
+ return pDocumentMonitor->OnMenuSelectNumberedGroup(vsoApp);
// 2xx events
case CDocumentMonitor::MENU_WINDOWS_REPORTER:
@@ -320,6 +325,12 @@
case CDocumentMonitor::MENU_SELECT_ADD_ALL_MESSAGES:
TRACE("CStudioAddon::Run() add all messages to the current selection");
return pDocumentMonitor->OnMenuSelectAllMessages(vsoApp, SELECTION_ADD);
+ case CDocumentMonitor::MENU_ENABLE_MESSAGE_ENUMERATION:
+ TRACE("CStudioAddon::Run() enable message enumeration");
+ return pDocumentMonitor->OnMenuEnableMessageEnumeration(vsoApp);
+ case CDocumentMonitor::MENU_DISABLE_MESSAGE_ENUMERATION:
+ TRACE("CStudioAddon::Run() disable message enumeration");
+ return pDocumentMonitor->OnMenuDisableMessageEnumeration(vsoApp);
default:
TRACE("CStudioAddon::Run() unexpected event id=" << iEvent);
@@ -467,7 +478,28 @@
TRACE("CStudioAddon::HandleVisioEvent() visEvtCodeWinSelChange");
HandleWinSelChange(pSourceObj);
break;
+ case Visio::visEvtCodeShapeBeforeTextEdit:
+ TRACE("CStudioAddon::HandleVisioEvent() visEvtCodeShapeBeforeTextEdit");
+ HandleBeforeTextEdit(pSubjectObj, pSourceObj);
+ break;
+ case Visio::visEvtCodeShapeExitTextEdit:
+ TRACE("CStudioAddon::HandleVisioEvent() visEvtCodeShapeExitTextEdit");
+ HandleAfterTextEdit(pSubjectObj, pSourceObj);
+ break;
+ case Visio::visEvtDel+Visio::visEvtShape:
+ TRACE("CStudioAddon::HandleVisioEvent() visEvtCodeShapeDelete");
+ HandleBeforeShapeDeleted(pSubjectObj, pSourceObj);
+ break;
+
+ case visEvtApp+visEvtNonePending:
+ TRACE("CStudioAddon::HandleVisioEvent() visEvtNonePending");
+ HandleNonePending(pSourceObj);
+ break;
+ case visEvtMod+visEvtText:
+ HandleTextChanged(pSubjectObj,pSourceObj);
+ break;
+
default:
TRACE("CStudioAddon::HandleVisioEvent() unexpected event id="
<< std::ios::hex << event);
@@ -507,8 +539,18 @@
if(get_shape_type(fromConnect->FromSheet) == ST_BMSC_COREGION)
fromConnect->FromSheet->CellsSRC[visSectionObject][visRowXFormOut][visXFormHeight]->ResultIU = value*2;
}
- }
+ }
}
+
+ //Message enumeration
+ if((_tcsicmp(vsoCell->Name,_T("PinX")) == 0 || _tcsicmp(vsoCell->Name,_T("PinY")) == 0) &&
+ (GetDocumentMonitor(vsoCell->Application,vsoCell->Application->ActiveDocument)->isMessageShape(vsoCell->Shape)) &&
+ (_tcsicmp(vsoCell->Shape->Data1,_T("1")) == 0))
+ {
+ //vlozit do mnoziny
+ m_enumerationGroups.insert(vsoCell->Shape->Data3);
+ m_bCellChanged = true;
+ }
}
void CStudioAddon::HandleConnectionsAdded(Visio::IVConnectsPtr vsoConnects)
@@ -602,6 +644,86 @@
}
}
+void CStudioAddon::HandleNonePending(Visio::IVApplicationPtr vsoApp)
+{
+ if(m_bShapeDeleted || m_bCellChanged)
+ {
+ Visio::IVShapesPtr shapesPtr = vsoApp->ActivePage->Shapes;
+
+ for(std::set<_bstr_t>::iterator it = m_enumerationGroups.begin(); it != m_enumerationGroups.end(); it++)
+ GetDocumentMonitor(vsoApp,vsoApp->ActiveDocument)->drawNumbers(shapesPtr,*it);
+
+ m_enumerationGroups.clear();
+
+ //for(int i=1; i<=shapesPtr->Count; i++)
+ //{
+ // Visio::IVShapePtr shape = shapesPtr->Item[i];
+ // if(!GetDocumentMonitor(vsoApp,vsoApp->ActiveDocument)->isMessageShape(shape) || !_tcsicmp(shape->Data1,_T("1")) == 0)
+ // continue;
+ //
+ // GetDocumentMonitor(vsoApp,vsoApp->ActiveDocument)->OnMenuDisableMessageEnumeration(vsoApp);
+ // break;
+ //}
+ m_bShapeDeleted = m_bCellChanged = false;
+ }
+ //if(m_bTextChanged)
+ //{
+ // for(std::set<_bstr_t>::iterator it = m_enumerationGroups.begin(); it != m_enumerationGroups.end(); it++)
+ // GetDocumentMonitor(vsoApp,vsoApp->ActiveDocument)->drawNumbers(vsoApp->ActivePage->Shapes,*it);
+
+ // m_enumerationGroups.clear();
+ // m_bTextChanged = false;
+ //}
+}
+
+void CStudioAddon::HandleBeforeTextEdit(Visio::IVShapePtr shapePtr, Visio::IVApplicationPtr vsoApp)
+{
+ if(GetDocumentMonitor(vsoApp,vsoApp->ActiveDocument)->isMessageShape(shapePtr) && _tcsicmp(shapePtr->Data1,_T("1")) == 0)
+ {
+ GetDocumentMonitor(vsoApp,vsoApp->ActiveDocument)->ToogleNumeration(false);
+ shapePtr->Text = shapePtr->Data2;
+ m_bMessageTextEdited = true;
+ }
+ /*else if(_tcsicmp(shapePtr->Data1,_T("")) != 0)
+ MessageBox(GetActiveWindow(),_T("Corrupted enumeration! Data1 has wrong format"),_T("Error"),MB_OK | MB_ICONERROR);*/
+}
+
+void CStudioAddon::HandleAfterTextEdit(Visio::IVShapePtr shapePtr, Visio::IVApplicationPtr vsoApp)
+{
+ if(m_bMessageTextEdited)
+ {
+ shapePtr->Data2 = shapePtr->Text;
+ GetDocumentMonitor(vsoApp,vsoApp->ActiveDocument)->drawNumbers(vsoApp->ActivePage->Shapes, shapePtr->Data3);
+ m_bMessageTextEdited = false;
+ }
+ GetDocumentMonitor(vsoApp,vsoApp->ActiveDocument)->ToogleNumeration(true);
+}
+
+void CStudioAddon::HandleBeforeShapeDeleted(Visio::IVShapePtr shapePtr, Visio::IVApplicationPtr vsoApp)
+{
+ if(GetDocumentMonitor(vsoApp,vsoApp->ActiveDocument)->isMessageShape(shapePtr) && _tcsicmp(shapePtr->Data1,_T("1")) == 0)
+ {
+ m_enumerationGroups.insert(shapePtr->Data3);
+ m_bShapeDeleted = true;
+ }
+}
+
+void CStudioAddon::HandleTextChanged(Visio::IVShapePtr shapePtr,Visio::IVDocumentPtr vsoDocument)
+{
+ //if(m_bMessageTextEdited)
+ // return;
+
+ //if(vsoDocument->Application->IsUndoingOrRedoing == VARIANT_TRUE)
+ // return;
+
+ //if(GetDocumentMonitor(vsoDocument->Application,vsoDocument)->isMessageShape(shapePtr) && _tcsicmp(shapePtr->Data1,_T("1")) == 0)
+ //{
+ // shapePtr->Data2 = shapePtr->Text;
+ // m_enumerationGroups.insert(shapePtr->Data3);
+ // m_bTextChanged = true;
+ //}
+}
+
void CStudioAddon::RegisterPersistentEvents(Visio::IVDocumentPtr vsoDocument)
{
Visio::IVEventPtr vsoDocumentCreateEvent = NULL;
@@ -673,6 +795,11 @@
vsoApp->EventList->AddAdvise(Visio::visEvtCodeKeyDown, varSink, _T(""), _T("KeyDown"));
vsoApp->EventList->AddAdvise(Visio::visEvtCodeKeyUp, varSink, _T(""), _T("KeyUp"));
vsoApp->EventList->AddAdvise(Visio::visEvtCodeMouseMove, varSink, _T(""), _T("MouseMove"));
+ // Message enumeration events
+ vsoApp->EventList->AddAdvise(Visio::visEvtCodeShapeBeforeTextEdit, varSink, _T(""), _T("BeforeTextEdit"));
+ vsoApp->EventList->AddAdvise(Visio::visEvtCodeShapeExitTextEdit, varSink, _T(""), _T("AfterTextEdit"));
+ vsoApp->EventList->AddAdvise(visEvtApp+visEvtNonePending, varSink, _T(""), _T("NonePending"));
+ vsoApp->EventList->AddAdvise(visEvtDel+visEvtShape, varSink, _T(""), _T("ShapeDeleted"));
vsoApp->EventList->AddAdvise(visEvtCodeWinSelChange, varSink, _T(""), _T("SelectionChanges"));
@@ -689,6 +816,7 @@
vsoEvent = vsoDocumentEventList->AddAdvise(visEvtPageAdded, varSink, _T(""), _T(""));
pDocumentMonitor->m_vsoPageAddedEvent = vsoEvent;
+ vsoDocumentEventList->AddAdvise(visEvtMod+visEvtText, varSink, _T(""), _T("TextChanged"));
vsoDocumentEventList->AddAdvise(visEvtCellChanged, varSink, _T(""), _T("CellChanged"));
vsoDocumentEventList->AddAdvise(visEvtConnectionsAdded, varSink, _T(""), _T("ConnectionsAdded"));
vsoDocumentEventList->AddAdvise(visEvtConnectionsDeleted, varSink, _T(""), _T("ConnectionsDeleted"));
Modified: trunk/src/view/visio/addon/addon.h
===================================================================
--- trunk/src/view/visio/addon/addon.h 2010-05-12 20:30:56 UTC (rev 768)
+++ trunk/src/view/visio/addon/addon.h 2010-05-12 21:29:09 UTC (rev 769)
@@ -19,6 +19,7 @@
#pragma once
#include <map>
+#include <set>
class CReportView;
class CDocumentMonitor;
@@ -55,6 +56,11 @@
void HandleKeyUp(Visio::IVKeyboardEventPtr vsoKeyboardEvent, Visio::IVApplicationPtr vsoApp);
void HandleMouseMove(Visio::IVMouseEventPtr vsoMouseEvent, Visio::IVApplicationPtr vsoApp);
void HandleWinSelChange(Visio::IVApplicationPtr vsoApp);
+ void HandleBeforeTextEdit(Visio::IVShapePtr shapePtr, Visio::IVApplicationPtr vsoApp);
+ void HandleAfterTextEdit(Visio::IVShapePtr shapePtr, Visio::IVApplicationPtr vsoApp);
+ void HandleBeforeShapeDeleted(Visio::IVShapePtr shapePtr, Visio::IVApplicationPtr vsoApp);
+ void HandleTextChanged(Visio::IVShapePtr shapePtr,Visio::IVDocumentPtr vsoDocument);
+ void HandleNonePending(Visio::IVApplicationPtr vsoApp);
void RegisterPersistentEvents(Visio::IVDocumentPtr vsoDocument);
CDocumentMonitor *GetDocumentMonitor(Visio::IVApplicationPtr vsoApp, Visio::IVDocumentPtr vsoDocument);
@@ -124,6 +130,11 @@
std::map<long, Visio::IVSelectionPtr> m_oldSelections;
std::map<long, Visio::IVSelectionPtr> m_curSelections;
std::map<long, double> m_prevMousePosX;
+ //Message enumeration
+ bool m_bMessageTextEdited;
+ bool m_bCellChanged;
+ bool m_bShapeDeleted;
+ std::set<_bstr_t> m_enumerationGroups;
std::map<long, double> m_prevMousePosY;
};
Modified: trunk/src/view/visio/addon/dllmodule.rc
===================================================================
--- trunk/src/view/visio/addon/dllmodule.rc 2010-05-12 20:30:56 UTC (rev 768)
+++ trunk/src/view/visio/addon/dllmodule.rc 2010-05-12 21:29:09 UTC (rev 769)
@@ -26,31 +26,26 @@
// Dialog
//
-IDD_MESSAGE_SEQUENCE_OPTIONS DIALOGEX 0, 0, 506, 146
+IDD_MESSAGE_SEQUENCE_OPTIONS DIALOGEX 0, 0, 311, 113
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Message Sequence Options"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
- DEFPUSHBUTTON "OK",IDOK,449,7,50,14
- PUSHBUTTON "Cancel",IDCANCEL,449,25,50,14
- GROUPBOX "Direction:",IDC_STATIC,7,7,432,64
- CONTROL "Right only",IDC_MS_DIR_RIGHT,"Button",BS_AUTORADIOBUTTON,13,19,48,10
- CONTROL "Left only",IDC_MS_DIR_LEFT,"Button",BS_AUTORADIOBUTTON,13,31,44,10
- CONTROL "Right, Left",IDC_MS_DIR_RIGHT_LEFT,"Button",BS_AUTORADIOBUTTON,13,43,50,10
- CONTROL "Left, Right",IDC_MS_DIR_LEFT_RIGHT,"Button",BS_AUTORADIOBUTTON,13,55,50,10
- LTEXT "Right Message Captions:",IDC_STATIC,90,19,80,8
- EDITTEXT IDC_MS_RIGHT_MESSAGE,171,17,259,14,ES_AUTOHSCROLL
- LTEXT "Left Message Captions:",IDC_STATIC,90,43,76,8
- EDITTEXT IDC_MS_LEFT_MESSAGE,171,41,259,14,ES_AUTOHSCROLL
+ DEFPUSHBUTTON "OK",IDOK,254,7,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,254,25,50,14
+ GROUPBOX "Direction:",IDC_STATIC,7,7,241,64
+ CONTROL "Left only",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON,13,19,44,10
+ CONTROL "Right only",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,13,31,48,10
+ CONTROL "Left, Right",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,13,43,50,10
+ CONTROL "Right, Left",IDC_RADIO4,"Button",BS_AUTORADIOBUTTON,13,55,50,10
+ LTEXT "Left Message Captions:",IDC_STATIC,90,19,76,8
+ EDITTEXT IDC_MC_LEFT_MESSAGE,171,17,67,14,ES_AUTOHSCROLL
+ LTEXT "Right Message Captions:",IDC_STATIC,90,43,80,8
+ EDITTEXT IDC_MS_RIGHT_MESSAGE,171,41,67,14,ES_AUTOHSCROLL
LTEXT "Starting Y-position:",IDC_STATIC,7,78,62,8
LTEXT "Vertical space between messages:",IDC_STATIC,7,94,111,8
- EDITTEXT IDC_MS_START_POS_Y,164,76,40,14,ES_AUTOHSCROLL
- EDITTEXT IDC_MS_VERTICAL_SPACE,164,92,40,14,ES_AUTOHSCROLL
- LTEXT "Vertical space between left and right sequence:",IDC_STATIC,7,110,154,8
- EDITTEXT IDC_MS_VERTICAL_SPACE_LEFT_RIGHT,164,108,40,14,ES_AUTOHSCROLL
- LTEXT "<units>",IDC_MS_UNITS0,207,78,27,8
- LTEXT "<units>",IDC_MS_UNITS1,207,94,27,8
- LTEXT "<units>",IDC_MS_UNITS2,207,110,27,8
+ EDITTEXT IDC_EDIT2,121,76,40,14,ES_AUTOHSCROLL
+ EDITTEXT IDC_EDIT3,121,92,40,14,ES_AUTOHSCROLL
END
@@ -65,11 +60,10 @@
IDD_MESSAGE_SEQUENCE_OPTIONS, DIALOG
BEGIN
LEFTMARGIN, 7
- RIGHTMARGIN, 499
+ RIGHTMARGIN, 304
VERTGUIDE, 13
- VERTGUIDE, 430
TOPMARGIN, 7
- BOTTOMMARGIN, 139
+ BOTTOMMARGIN, 106
END
END
#endif // APSTUDIO_INVOKED
@@ -146,16 +140,16 @@
CONTROL "",IDC_DRAWING2,"SysTreeView32",TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_SHOWSELALWAYS | WS_BORDER | WS_HSCROLL | WS_TABSTOP,110,14,100,92
END
-IDD_INSTANCES_FIELD_OPTIONS DIALOGEX 0, 0, 210, 127
+IDD_INSTANCES_FIELD_OPTIONS DIALOGEX 0, 0, 201, 127
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Add Instances Options"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
- DEFPUSHBUTTON "OK",IDOK,155,5,50,14
- PUSHBUTTON "Cancel",IDCANCEL,155,25,50,14
+ DEFPUSHBUTTON "OK",IDOK,146,5,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,146,25,50,14
LTEXT "Number of instances:",IDC_STATIC,5,5,70,12,SS_CENTERIMAGE
EDITTEXT IDC_IF_INSTANCES_CNT,80,5,43,14,ES_AUTOHSCROLL
- GROUPBOX "",IDC_OPTIONS_GROUP_BOX,5,73,200,50
+ GROUPBOX "",IDC_OPTIONS_GROUP_BOX,5,73,191,50
LTEXT " Options ",IDC_OPTIONS_SWITCH_LBL,19,73,30,8
LTEXT "Instance length:",IDC_STATIC,5,23,70,12,SS_CENTERIMAGE
EDITTEXT IDC_IF_INSTANCE_LENGTH,80,23,43,14,ES_AUTOHSCROLL
@@ -167,17 +161,30 @@
CONTROL "Spacing:",IDC_SPACING_RDO,"Button",BS_AUTORADIOBUTTON,10,104,43,10
EDITTEXT IDC_IF_TOTAL_WIDTH,63,88,40,14,ES_AUTOHSCROLL
EDITTEXT IDC_IF_SPACING,63,103,40,14,ES_AUTOHSCROLL
- PUSHBUTTON "Default values",IDC_DEFAULT_BTN,140,88,58,14
+ PUSHBUTTON "Default values",IDC_DEFAULT_BTN,131,88,58,14
LTEXT "x:",IDC_STATIC,64,40,9,12,SS_CENTERIMAGE
LTEXT "y:",IDC_STATIC,64,54,9,12,SS_CENTERIMAGE
- LTEXT "<units>",IDC_IF_UNITS0,127,24,27,8
- LTEXT "<units>",IDC_IF_UNITS1,127,41,27,8
- LTEXT "<units>",IDC_IF_UNITS2,127,55,27,8
- LTEXT "<units>",IDC_IF_UNITS3,107,90,27,8
- LTEXT "<units>",IDC_IF_UNITS4,107,104,27,8
END
+IDD_ENUMERATION_OPTIONS DIALOGEX 0, 0, 236, 75
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Message numbering"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ DEFPUSHBUTTON "OK",IDOK,179,10,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,179,27,50,14
+ GROUPBOX "Options",IDC_STATIC,6,7,168,65
+ COMBOBOX IDC_COMBO_NUMBERING,48,18,71,66,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
+ LTEXT "Type:",IDC_STATIC,11,20,24,8,SS_CENTERIMAGE
+ CTEXT "+",IDC_STATIC,125,18,12,12,SS_CENTERIMAGE
+ EDITTEXT IDC_ADDITION,143,18,25,14,ES_AUTOHSCROLL | ES_NOHIDESEL
+ EDITTEXT IDC_STARTING_INDEX,63,36,25,14,ES_AUTOHSCROLL | ES_NUMBER
+ LTEXT "Starting index:",IDC_STATIC,11,39,50,8,SS_CENTERIMAGE
+ CONTROL "automatically enumerate new messages",IDC_CHECK_ENUMERATE_NEW,
+ "Button",BS_AUTOCHECKBOX | BS_LEFT | BS_VCENTER | WS_TABSTOP,12,54,144,12
+END
+
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
@@ -213,7 +220,7 @@
IDD_INSTANCES_FIELD_OPTIONS, DIALOG
BEGIN
LEFTMARGIN, 5
- RIGHTMARGIN, 205
+ RIGHTMARGIN, 196
VERTGUIDE, 10
VERTGUIDE, 19
VERTGUIDE, 48
@@ -224,6 +231,14 @@
BOTTOMMARGIN, 122
HORZGUIDE, 54
END
+
+ IDD_ENUMERATION_OPTIONS, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 229
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 68
+ END
END
#endif // APSTUDIO_INVOKED
@@ -243,6 +258,8 @@
IDI_ICON_SIMULATION_STOP ICON "icon_simulation_stop.ico"
IDI_ICON_SELECT_ADD_INSTANCES ICON "icon_select_add_instances.ico"
IDI_ICON_SELECT_ADD_MESSAGES ICON "icon_select_add_messages.ico"
+IDI_ICON_ENABLE_MESSAGE_ENUMERATION ICON "icon_message_enumeration.ico"
+IDI_ICON_DISABLE_MESSAGE_ENUMERATION ICON "icon_message_enumeration_disable.ico"
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
Modified: trunk/src/view/visio/addon/document.cpp
===================================================================
--- trunk/src/view/visio/addon/document.cpp 2010-05-12 20:30:56 UTC (rev 768)
+++ trunk/src/view/visio/addon/document.cpp 2010-05-12 21:29:09 UTC (rev 769)
@@ -25,6 +25,7 @@
#include "visualize.h"
#include "finddlg.h"
#include "messagesequencedlg.h"
+#include "enumerationDlg.h"
#include <fstream>
#include "shapeutils.h"
@@ -70,6 +71,9 @@
LoadModulesFromRegistry(HKEY_LOCAL_MACHINE);
LoadModulesFromRegistry(HKEY_CURRENT_USER);
+
+
+ ID = 1; // message group ID
}
CDocumentMonitor::~CDocumentMonitor()
@@ -256,6 +260,24 @@
case ST_BMSC_MESSAGE_FOUND:
if(vsoShape->Text.length() == 0)
vsoShape->Text = _T("NAME");
+ //DODELAT!!
+ {
+ bool bEnumNewMsg = false;
+ int temp;
+ std::wstring tempString;
+
+ Visio::IVShapePtr closestShape = CEnumerateUtils::getClosestMessage(m_vsoApp,vsoShape);
+ if(closestShape)
+ {
+ _bstr_t groupID = closestShape->Data3;
+ CEnumerateUtils::loadGroupSettings(m_vsoApp,groupID,temp,temp,bEnumNewMsg,tempString);
+
+ if(bEnumNewMsg)
+ enumerate(m_vsoApp,groupID,true,true);
+ else
+ enumerate(m_vsoApp,groupID,false,true);
+ }
+ }
break;
case ST_COMMENT:
@@ -426,6 +448,25 @@
stringize() << L"/event=" << 300+(tpos-m_transformers.begin());
}
+ itemMessageEnumerating = itemDrawing->MenuItems->Add();
+ itemMessageEnumerating->Caption = "&Message numbering";
+ itemMessageEnumerating->BeginGroup = true;
+ itemMessageEnumerating->CmdNum = Visio::visCmdHierarchical;
+
+ Visio::IVMenuItemPtr itemEnableEnumerating = itemMessageEnumerating->MenuItems->Add();
+ itemEnableEnumerating->Caption = "&Message numbering";
+ itemEnableEnumerating->AddOnName = ADDON_NAME;
+ itemEnableEnumerating->AddOnArgs = stringize() << L"/event=" << MENU_ENABLE_MESSAGE_ENUMERATION;
+ vslIconFile = vslFileName+_T(",8");
+ itemEnableEnumerating->IconFileName(vslIconFile.c_str());
+
+ Visio::IVMenuItemPtr itemDisableEnumerating = itemMessageEnumerating->MenuItems->Add();
+ itemDisableEnumerating->Caption = "&Delete numbering";
+ itemDisableEnumerating->AddOnName = ADDON_NAME;
+ itemDisableEnumerating->AddOnArgs = stringize() << L"/event=" << MENU_DISABLE_MESSAGE_ENUMERATION;
+ vslIconFile = vslFileName+_T(",9");
+ itemDisableEnumerating->IconFileName(vslIconFile.c_str());
+
Visio::IVMenuItemPtr itemFindFlow = menu->MenuItems->Add();
itemFindFlow->Caption = "&Find Flow...";
itemFindFlow->AddOnName = ADDON_NAME;
@@ -501,6 +542,29 @@
accelItemMessageSequence->Control = true;
accelItemMessageSequence->Alt = true;
+ accelItemMessageEnumeration = accelTable->AccelItems->Add();
+ accelItemMessageEnumeration->CmdNum = itemEnableEnumerating->CmdNum;
+ accelItemMessageEnumeration->Key = 'E';
+ accelItemMessageEnumeration->Control = true;
+ accelItemMessageEnumeration->Alt = true;
+
+ accelItemMessageEnumerationDisable = accelTable->AccelItems->Add();
+ accelItemMessageEnumerationDisable->CmdNum = itemDisableEnumerating->CmdNum;
+ accelItemMessageEnumerationDisable->Key = 'D';
+ accelItemMessageEnumerationDisable->Control = true;
+ accelItemMessageEnumerationDisable->Alt = true;
+
+ //Visio::IVMenuSetsPtr visMenuSets = vsoMenus->MenuSets;
+
+ //Visio::IVMenuSetPtr visMenuSet = visMenuSets->ItemAtID[visUIObjSetCntx_DrawObjSel];
+ //Visio::IVMenusPtr visMenus = visMenuSet->Menus;
+ //Visio::IVMenuPtr visMenu = visMenus->Item[0];
+ //visMenuItems = visMenu->MenuItems;
+
+ //visMenuItems->AddAt(0);
+ //visMenuItems->Item[0]->Caption = _T("Select numbering group");
+ //visMenuItems->Item[0]->Visible = false;
+
m_vsoDocument->SetCustomMenus(vsoMenus);
}
@@ -578,6 +642,24 @@
vslIconFile = vslFileName+_T(",5");
m_simulationStopToolbarItem->IconFileName(vslIconFile.c_str());
+ m_enableMessageEnumerationToolbarItem = m_toolbar->ToolbarItems->Add();
+ m_enableMessageEnumerationToolbarItem->Caption = "Message numbering";
+ m_enableMessageEnumerationToolbarItem->AddOnName = ADDON_NAME;
+ m_enableMessageEnumerationToolbarItem->AddOnArgs = stringize() << L"/event=" << MENU_ENABLE_MESSAGE_ENUMERATION;
+ m_enableMessageEnumerationToolbarItem->Visible = true;
+ m_enableMessageEnumerationToolbarItem->Enabled = true;
+ vslIconFile = vslFileName+_T(",8");
+ m_enableMessageEnumerationToolbarItem->IconFileName(vslIconFile.c_str());
+
+ m_disableMessageEnumerationToolbarItem = m_toolbar->ToolbarItems->Add();
+ m_disableMessageEnumerationToolbarItem->Caption = "Delete numbering";
+ m_disableMessageEnumerationToolbarItem->AddOnName = ADDON_NAME;
+ m_disableMessageEnumerationToolbarItem->AddOnArgs = stringize() << L"/event=" << MENU_DISABLE_MESSAGE_ENUMERATION;
+ m_disableMessageEnumerationToolbarItem->Visible = true;
+ m_disableMessageEnumerationToolbarItem->Enabled = true;
+ vslIconFile = vslFileName+_T(",9");
+ m_disableMessageEnumerationToolbarItem->IconFileName(vslIconFile.c_str());
+
Visio::IVToolbarItemPtr itemVerify = m_toolbar->ToolbarItems->Add();
itemVerify->Caption = "Verify";
itemVerify->AddOnName = ADDON_NAME;
@@ -599,6 +681,20 @@
m_vsoDocument->CustomToolbars->UpdateUI();
}
+void CDocumentMonitor::ToogleNumeration(bool enabled)
+{
+ m_enableMessageEnumerationToolbarItem->Enabled = enabled;
+ m_disableMessageEnumerationToolbarItem->Enabled = enabled;
+ itemMessageEnumerating->Enabled = enabled;
+
+ //DODELAT HORKE KLAVESY!!!!
+ accelItemMessageEnumeration->Control = enabled;
+ accelItemMessageEnumerationDisable->Control = enabled;
+
+ m_vsoDocument->CustomToolbars->UpdateUI();
+ m_vsoDocument->CustomMenus->UpdateUI();
+}
+
VAORC CDocumentMonitor::DrawInstancesField(Visio::IVApplicationPtr vsoApp, int instancesCnt, Coordinate instanceLength, Coordinate instanceWidth, Coordinate startX, Coordinate startY, bool useConstSpacing, Coordinate spacingOrWidth)
{
TRACE("CDocumentMonitor::DrawInstancesField() Drawing instances field");
@@ -851,7 +947,9 @@
}
VAORC CDocumentMonitor::OnMenuRepaint(Visio::IVApplicationPtr vsoApp)
-{
+{
+ selectAll(vsoApp,false,SelectionType::SELECTION_REPLACE);
+ OnMenuDisableMessageEnumeration(vsoApp);
// clear the verification report
m_reportView->Reset();
@@ -875,6 +973,7 @@
m_reportView->Print(RS_ERROR,
stringize() << "Repaint failed.");
+
return VAORC_FAILURE;
}
@@ -889,11 +988,14 @@
m_reportView->Print(RS_NOTICE,
stringize() << "Repaint completed.");
+
return VAORC_SUCCESS;
}
VAORC CDocumentMonitor::OnMenuTransform(Visio::IVApplicationPtr vsoApp, int index)
{
+ selectAll(vsoApp,false,SelectionType::SELECTION_REPLACE);
+ OnMenuDisableMessageEnumeration(vsoApp);
// clear the verification report
m_reportView->Reset();
@@ -915,6 +1017,7 @@
m_reportView->Print(RS_ERROR,
stringize() << transformer->get_name() << " failed.");
+
return VAORC_FAILURE;
}
@@ -927,7 +1030,7 @@
m_vsoApp->EndUndoScope(scope_id, false);
m_reportView->Print(RS_ERROR,
- stringize() << transformer->get_name() << " failed.");
+ stringize() << transformer->get_name() << " failed.");
return VAORC_FAILURE;
}
@@ -942,6 +1045,7 @@
m_reportView->Print(RS_NOTICE,
stringize() << transformer->get_name() << " completed.");
+
return VAORC_SUCCESS;
}
@@ -1253,6 +1357,247 @@
return VAORC_SUCCESS;
}
+VAORC CDocumentMonitor::OnMenuEnableMessageEnumeration(Visio::IVApplicationPtr vsoApp)
+{
+ static int startingIndex = 1;
+ static int numberingType = 0;
+ static bool enumerateNew = false;
+ static BSTR add = _T(". ");
+
+ CEnumerationDlg options(startingIndex,numberingType, enumerateNew, add);
+ if(options.DoModal() != IDOK)
+ return VAORC_FAILURE;
+
+ int ID = CEnumerateUtils::getGroupCount(vsoApp);
+
+ _bstr_t groupID = stringize() << _T("Enum") << ++ID;
+
+ startingIndex = options.getStartingIndex();
+ numberingType = options.getNumberingType();
+ enumerateNew = options.getEnumerateNew();
+ add = options.getAddition();
+
+ CEnumerateUtils::saveGroupSettings(vsoApp,groupID,startingIndex,numberingType,enumerateNew,add);
+
+ if (vsoApp->ActiveWindow->Selection->Count)
+ {
+ enumerate(vsoApp, groupID, true,true);
+ }
+ else
+ enumerate(vsoApp, groupID, true,false);
+
+ CEnumerateUtils::setGroupCount(vsoApp,ID);
+
+ return VAORC_SUCCESS;
+}
+VAORC CDocumentMonitor::OnMenuDisableMessageEnumeration(Visio::IVApplicationPtr vsoApp)
+{
+ Visio::IVSelectionPtr selection = vsoApp->ActiveWindow->Selection;
+ Visio::IVShapePtr page = vsoApp->ActivePage->PageSheet;
+ std::set<_bstr_t> groups;
+ int ID = CEnumerateUtils::getGroupCount(vsoApp);
+
+ //get all numbered messages on the page
+ int numberedMessages = 0;
+ for(int i=1; i<=page->Shapes->Count; i++)
+ {
+ Visio::IVShapePtr shape = page->Shapes->Item[i];
+ if(isMessageShape(shape) && _tcsicmp(shape->Data1,_T("1")) == 0)
+ numberedMessages++;
+ }
+
+ //get all SELECTED numbered messages on the page
+ int selectedMessages = 0;
+ for(int i=1; i<=selection->Count; i++)
+ {
+ Visio::IVShapePtr shape = selection->Item[i];
+ if(isMessageShape(shape) && _tcsicmp(shape->Data1,_T("1")) == 0)
+ selectedMessages++;
+ }
+
+ if (selection->Count && (selectedMessages != numberedMessages))
+ {
+ //get which groups are selected
+ for(int i=1; i<= selection->Count; i++)
+ if(_tcsic...
[truncated message content] |
|
From: <mbe...@us...> - 2010-05-13 18:38:53
|
Revision: 775
http://scstudio.svn.sourceforge.net/scstudio/?rev=775&view=rev
Author: mbezdeka
Date: 2010-05-13 18:38:46 +0000 (Thu, 13 May 2010)
Log Message:
-----------
global settings dialog added
Modified Paths:
--------------
trunk/doc/help/frontend/shortcuts.html
trunk/doc/help/frontend.html
trunk/doc/help/scstudio.hhc
trunk/src/view/visio/addon/addon.cpp
trunk/src/view/visio/addon/dllmodule.rc
trunk/src/view/visio/addon/document.cpp
trunk/src/view/visio/addon/document.h
trunk/src/view/visio/addon/enumerationDlg.h
trunk/src/view/visio/addon/messagesequencedlg.cpp
trunk/src/view/visio/addon/resource.h
trunk/src/view/visio/addon/scstudio.vcproj
Added Paths:
-----------
trunk/doc/help/frontend/message-numbering.html
trunk/doc/help/frontend/pictures/icon_message_enumeration.png
trunk/doc/help/frontend/pictures/icon_message_enumeration_disable.png
trunk/doc/help/frontend/pictures/message_numbering_options.png
trunk/src/view/visio/addon/GlobalSettingsDlg.cpp
trunk/src/view/visio/addon/GlobalSettingsDlg.h
trunk/src/view/visio/addon/numberingGlobalDlg.cpp
trunk/src/view/visio/addon/numberingGlobalDlg.h
Removed Paths:
-------------
trunk/doc/help/pictures/icon_message_enumeration.png
trunk/doc/help/pictures/icon_message_enumeration_disable.png
trunk/doc/help/pictures/message_numbering_options.png
Added: trunk/doc/help/frontend/message-numbering.html
===================================================================
--- trunk/doc/help/frontend/message-numbering.html (rev 0)
+++ trunk/doc/help/frontend/message-numbering.html 2010-05-13 18:38:46 UTC (rev 775)
@@ -0,0 +1,25 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+<title>Shape Selection – SCStudio frontend</title>
+<link href="../help.css" rel="stylesheet" type="text/css">
+</head>
+<body>
+<h1>Message Numbering</h1>
+<p>Message numbering allows users to enumerate all types of message shapes (left, right, lost, found).<br>
+You can enumerate all messages on the active page (if no messages are selected) or the selection. <br>
+
+<p>By pressing Message numbering button <img src="pictures/icon_message_enumeration.png" alt="Message Numbering"> or by using hotkey <Code>Ctrl+Alt+E</Code> the dialog with options will be shown:</p>
+
+<p>
+<img src="pictures/message_numbering_options.png" alt="Message Numbering options dialog">
+</p>
+
+<p>You can choose specific numbering type (numbers, letters, capital letters, romans), starting index (1-9999) and additional string following the index such as ".", ",", …</p>
+
+<p>If <code>automatically enumerate new messages</code> is checked, any newly dropped messages will be enumerate according to the nearest numbered group.</p>
+
+<p>Numbering can be deleted by pressing Delete numbering button <img src="pictures/icon_message_enumeration_disable.png" alt="Disable message numbering"> on the toolbar or by using hotkey <Code>Ctrl+Alt+D.</Code></p>
+
+</body>
+</html>
\ No newline at end of file
Added: trunk/doc/help/frontend/pictures/icon_message_enumeration.png
===================================================================
(Binary files differ)
Property changes on: trunk/doc/help/frontend/pictures/icon_message_enumeration.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/doc/help/frontend/pictures/icon_message_enumeration_disable.png
===================================================================
(Binary files differ)
Property changes on: trunk/doc/help/frontend/pictures/icon_message_enumeration_disable.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/doc/help/frontend/pictures/message_numbering_options.png
===================================================================
(Binary files differ)
Property changes on: trunk/doc/help/frontend/pictures/message_numbering_options.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/doc/help/frontend/shortcuts.html
===================================================================
--- trunk/doc/help/frontend/shortcuts.html 2010-05-13 16:46:24 UTC (rev 774)
+++ trunk/doc/help/frontend/shortcuts.html 2010-05-13 18:38:46 UTC (rev 775)
@@ -13,6 +13,8 @@
<tr><td><code>Ctrl+Alt+M</code></td><td><a href="shape-selection.html">Select all message</a></td></tr>
<tr><td><code>Ctrl+Alt+F</code></td><td><a href="automatic-drawing.html#add_instances">Add instances</a></td></tr>
<tr><td><code>Ctrl+Alt+S</code></td><td><a href="automatic-drawing.html#message_sequence">Message sequence</a></td></tr>
+<tr><td><code>Ctrl+Alt+E</code></td><td><a href="message-numbering.html">Message Numbering</a></td></tr>
+<tr><td><code>Ctrl+Alt+D</code></td><td><a href="message-numbering.html">Delete Message Numbering</a></td></tr>
</table>
</body>
Modified: trunk/doc/help/frontend.html
===================================================================
--- trunk/doc/help/frontend.html 2010-05-13 16:46:24 UTC (rev 774)
+++ trunk/doc/help/frontend.html 2010-05-13 18:38:46 UTC (rev 775)
@@ -23,21 +23,5 @@
See the <a href="frontend/shortcuts.html">Keyboard accelerators</a> section to
list all of them.</p>
-<h2>Message Numbering</h2>
-<p>Message numbering allows users to enumerate all types of message shapes (left, right, lost, found).<br>
-You can enumerate all messages on the active page (if no messages are selected) or the selection. <br>
-
-<p>By pressing Message numbering button <img src="pictures/icon_message_enumeration.png" alt="Message Numbering"> or by using hotkey <Code>Ctrl+Alt+E</Code> the dialog with options will be shown:</p>
-
-<p>
-<img src="pictures/message_numbering_options.png" alt="Message Numbering options dialog">
-</p>
-
-<p>You can choose specific numbering type (numbers, letters, capital letters, romans), starting index (1-9999) and additional string following the index such as ".", ",", …</p>
-
-<p>If <code>automatically enumerate new messages</code> is checked, any newly dropped messages will be enumerate according to the nearest numbered group.</p>
-
-<p>Numbering can be deleted by pressing Delete numbering button <img src="pictures/icon_message_enumeration_disable.png" alt="Disable message numbering"> on the toolbar or by using hotkey <Code>Ctrl+Alt+D.</Code></p>
-
</body>
</html>
Deleted: trunk/doc/help/pictures/icon_message_enumeration.png
===================================================================
(Binary files differ)
Deleted: trunk/doc/help/pictures/icon_message_enumeration_disable.png
===================================================================
(Binary files differ)
Deleted: trunk/doc/help/pictures/message_numbering_options.png
===================================================================
(Binary files differ)
Modified: trunk/doc/help/scstudio.hhc
===================================================================
--- trunk/doc/help/scstudio.hhc 2010-05-13 16:46:24 UTC (rev 774)
+++ trunk/doc/help/scstudio.hhc 2010-05-13 18:38:46 UTC (rev 775)
@@ -22,6 +22,10 @@
<param name="Local" value="frontend\automatic-drawing.html">
</OBJECT>
<LI> <OBJECT type="text/sitemap">
+ <param name="Name" value="Message Numbering">
+ <param name="Local" value="frontend\message-numbering.html">
+ </OBJECT>
+ <LI> <OBJECT type="text/sitemap">
<param name="Name" value="Keyboard accelerators">
<param name="Local" value="frontend\shortcuts.html">
</OBJECT>
Added: trunk/src/view/visio/addon/GlobalSettingsDlg.cpp
===================================================================
--- trunk/src/view/visio/addon/GlobalSettingsDlg.cpp (rev 0)
+++ trunk/src/view/visio/addon/GlobalSettingsDlg.cpp 2010-05-13 18:38:46 UTC (rev 775)
@@ -0,0 +1,124 @@
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2010 Martin Bezdeka <mbe...@se...>
+ *
+ */
+#include "stdafx.h"
+#include "dllmodule.h"
+#include "GlobalSettingsDlg.h"
+
+
+
+CTabCtrlMSC::CTabCtrlMSC()
+{
+ dialogs[0] = new CNumberingGlobalDlg;
+
+ m_nNumberOfPages = 1;
+}
+
+CTabCtrlMSC::~CTabCtrlMSC()
+{
+ for(int i=0; i<m_nNumberOfPages; i++)
+ delete dialogs[i];
+}
+
+void CTabCtrlMSC::Init()
+{
+ m_tabCurrent = 0;
+ dialogs[0]->Create(this->m_hWnd,NULL);
+ dialogs[0]->ShowWindow(SW_SHOW);
+
+ SetRectangle();
+}
+
+void CTabCtrlMSC::SetRectangle()
+{
+ RECT tabRect, itemRect;
+ int nX, nY, nXc, nYc;
+
+ GetClientRect(&tabRect);
+ GetItemRect(0, &itemRect);
+
+ nX=itemRect.left;
+ nY=itemRect.bottom+2;
+ nXc=tabRect.right-itemRect.left-3;
+ nYc=tabRect.bottom-nY-3;
+
+ dialogs[0]->SetWindowPos(HWND_TOP, nX, nY, nXc, nYc, SWP_SHOWWINDOW);
+ //hiding other windows
+ for(int i=1; i < m_nNumberOfPages; i++)
+ {
+ dialogs[i]->SetWindowPos(HWND_TOP, nX, nY, nXc, nYc, SWP_HIDEWINDOW);
+ }
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// CMyTabCtrl message handlers
+
+LRESULT CTabCtrlMSC::OnLButtonDown(UINT nFlags, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
+{
+ //not implemented yet!
+
+ /*CTabCtrl::OnLButtonDown(nFlags, point);
+
+ if(m_tabCurrent != this->GetCurFocus() != 0)
+ {
+ dialogs[0]->ShowWindow(SW_HIDE);
+ }*/
+
+ return 0;
+}
+
+//////////////////////////////
+// GLOBAL SETTINGS DIALOG
+
+LRESULT CGlobalSettingsDlg::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
+{
+ CenterWindow(GetParent());
+
+ DoDataExchange();
+ LoadRegistryData();
+
+
+ return bHandled = FALSE;
+}
+
+LRESULT CGlobalSettingsDlg::OnCloseCmd(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
+{
+ if(wID == IDOK)
+ {
+ DoDataExchange(TRUE);
+ if(SaveRegistryData() == 0)
+ EndDialog(wID);
+ }
+ else if(wID == IDCANCEL)
+ EndDialog(wID);
+
+ return 0;
+}
+
+int CGlobalSettingsDlg::LoadRegistryData()
+{
+ m_tabSettings.AddItem(_T("Numbering"));
+ m_tabSettings.Init();
+
+ DoDataExchange();
+
+ return 0;
+}
+
+int CGlobalSettingsDlg::SaveRegistryData()
+{
+ return 0;
+}
Added: trunk/src/view/visio/addon/GlobalSettingsDlg.h
===================================================================
--- trunk/src/view/visio/addon/GlobalSettingsDlg.h (rev 0)
+++ trunk/src/view/visio/addon/GlobalSettingsDlg.h 2010-05-13 18:38:46 UTC (rev 775)
@@ -0,0 +1,83 @@
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2010 Martin Bezdeka <mbe...@se...>
+ *
+ */
+
+#pragma once
+
+#include <atldlgs.h>
+#include <atlctrls.h>
+#include <atlddx.h>
+#include <string>
+#include <sstream>
+#include "data/msc.h"
+#include "GlobalSettingsDlg.h"
+#include "numberingGlobalDlg.h"
+
+class CTabCtrlMSC : public ATL::CWindowImpl<CTabCtrlMSC, CTabCtrl>
+{
+// Construction
+public:
+ CTabCtrlMSC();
+ virtual ~CTabCtrlMSC();
+
+ int m_tabCurrent;
+ int m_nNumberOfPages;
+ //Add your specific dialog on the tab
+ CNumberingGlobalDlg* dialogs[1];
+
+ void Init();
+ void SetRectangle();
+
+protected:
+ BEGIN_MSG_MAP(CTabCtrlMSC)
+ MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown)
+ END_MSG_MAP()
+
+ LRESULT OnLButtonDown(UINT, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
+};
+
+/////////////////////////////////////
+// GLOBAL SETTINGS DIALOG
+
+class CGlobalSettingsDlg
+ : public ATL::CDialogImpl<CGlobalSettingsDlg>, public CWinDataExchange<CGlobalSettingsDlg>
+{
+public:
+ //CGlobalSettingsDlg();
+ enum { IDD = IDD_GLOBAL_SETTINGS };
+
+ CTabCtrlMSC m_tabSettings;
+
+protected:
+BEGIN_DDX_MAP(CGlobalSettingsDlg)
+ DDX_CONTROL(IDC_TAB_SETTINGS, m_tabSettings);
+END_DDX_MAP()
+
+BEGIN_MSG_MAP(CGlobalSettingsDlg)
+ MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
+ COMMAND_ID_HANDLER(IDOK, OnCloseCmd)
+ COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd)
+END_MSG_MAP()
+
+// Handler prototypes:
+
+ LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
+ LRESULT OnCloseCmd(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
+
+ int LoadRegistryData();
+ int SaveRegistryData();
+
+};
\ No newline at end of file
Modified: trunk/src/view/visio/addon/addon.cpp
===================================================================
--- trunk/src/view/visio/addon/addon.cpp 2010-05-13 16:46:24 UTC (rev 774)
+++ trunk/src/view/visio/addon/addon.cpp 2010-05-13 18:38:46 UTC (rev 775)
@@ -331,6 +331,9 @@
case CDocumentMonitor::MENU_DISABLE_MESSAGE_ENUMERATION:
TRACE("CStudioAddon::Run() disable message enumeration");
return pDocumentMonitor->OnMenuDisableMessageEnumeration(vsoApp);
+ case CDocumentMonitor::MENU_GLOBAL_SETTINGS:
+ TRACE("CStudioAddon::Run() global settings");
+ return pDocumentMonitor->OnMenuGlobalSettings(vsoApp);
default:
TRACE("CStudioAddon::Run() unexpected event id=" << iEvent);
@@ -478,19 +481,22 @@
TRACE("CStudioAddon::HandleVisioEvent() visEvtCodeWinSelChange");
HandleWinSelChange(pSourceObj);
break;
+
case Visio::visEvtCodeShapeBeforeTextEdit:
TRACE("CStudioAddon::HandleVisioEvent() visEvtCodeShapeBeforeTextEdit");
HandleBeforeTextEdit(pSubjectObj, pSourceObj);
break;
+
case Visio::visEvtCodeShapeExitTextEdit:
TRACE("CStudioAddon::HandleVisioEvent() visEvtCodeShapeExitTextEdit");
HandleAfterTextEdit(pSubjectObj, pSourceObj);
break;
+
case Visio::visEvtDel+Visio::visEvtShape:
TRACE("CStudioAddon::HandleVisioEvent() visEvtCodeShapeDelete");
HandleBeforeShapeDeleted(pSubjectObj, pSourceObj);
break;
-
+
case visEvtApp+visEvtNonePending:
TRACE("CStudioAddon::HandleVisioEvent() visEvtNonePending");
HandleNonePending(pSourceObj);
@@ -547,7 +553,7 @@
(GetDocumentMonitor(vsoCell->Application,vsoCell->Application->ActiveDocument)->isMessageShape(vsoCell->Shape)) &&
(_tcsicmp(vsoCell->Shape->Data1,_T("1")) == 0))
{
- //vlozit do mnoziny
+ //add to set
m_enumerationGroups.insert(vsoCell->Shape->Data3);
m_bCellChanged = true;
}
@@ -655,25 +661,8 @@
m_enumerationGroups.clear();
- //for(int i=1; i<=shapesPtr->Count; i++)
- //{
- // Visio::IVShapePtr shape = shapesPtr->Item[i];
- // if(!GetDocumentMonitor(vsoApp,vsoApp->ActiveDocument)->isMessageShape(shape) || !_tcsicmp(shape->Data1,_T("1")) == 0)
- // continue;
- //
- // GetDocumentMonitor(vsoApp,vsoApp->ActiveDocument)->OnMenuDisableMessageEnumeration(vsoApp);
- // break;
- //}
m_bShapeDeleted = m_bCellChanged = false;
}
- //if(m_bTextChanged)
- //{
- // for(std::set<_bstr_t>::iterator it = m_enumerationGroups.begin(); it != m_enumerationGroups.end(); it++)
- // GetDocumentMonitor(vsoApp,vsoApp->ActiveDocument)->drawNumbers(vsoApp->ActivePage->Shapes,*it);
-
- // m_enumerationGroups.clear();
- // m_bTextChanged = false;
- //}
}
void CStudioAddon::HandleBeforeTextEdit(Visio::IVShapePtr shapePtr, Visio::IVApplicationPtr vsoApp)
@@ -684,8 +673,6 @@
shapePtr->Text = shapePtr->Data2;
m_bMessageTextEdited = true;
}
- /*else if(_tcsicmp(shapePtr->Data1,_T("")) != 0)
- MessageBox(GetActiveWindow(),_T("Corrupted enumeration! Data1 has wrong format"),_T("Error"),MB_OK | MB_ICONERROR);*/
}
void CStudioAddon::HandleAfterTextEdit(Visio::IVShapePtr shapePtr, Visio::IVApplicationPtr vsoApp)
@@ -710,18 +697,6 @@
void CStudioAddon::HandleTextChanged(Visio::IVShapePtr shapePtr,Visio::IVDocumentPtr vsoDocument)
{
- //if(m_bMessageTextEdited)
- // return;
-
- //if(vsoDocument->Application->IsUndoingOrRedoing == VARIANT_TRUE)
- // return;
-
- //if(GetDocumentMonitor(vsoDocument->Application,vsoDocument)->isMessageShape(shapePtr) && _tcsicmp(shapePtr->Data1,_T("1")) == 0)
- //{
- // shapePtr->Data2 = shapePtr->Text;
- // m_enumerationGroups.insert(shapePtr->Data3);
- // m_bTextChanged = true;
- //}
}
void CStudioAddon::RegisterPersistentEvents(Visio::IVDocumentPtr vsoDocument)
Modified: trunk/src/view/visio/addon/dllmodule.rc
===================================================================
--- trunk/src/view/visio/addon/dllmodule.rc 2010-05-13 16:46:24 UTC (rev 774)
+++ trunk/src/view/visio/addon/dllmodule.rc 2010-05-13 18:38:46 UTC (rev 775)
@@ -206,7 +206,37 @@
"Button",BS_AUTOCHECKBOX | BS_LEFT | BS_VCENTER | WS_TABSTOP,12,54,144,12
END
+IDD_GLOBAL_SETTINGS DIALOGEX 0, 0, 311, 202
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Settings"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ DEFPUSHBUTTON "OK",IDOK,200,180,50,15
+ PUSHBUTTON "Cancel",IDCANCEL,254,180,50,15
+ CONTROL "",IDC_TAB_SETTINGS,"SysTabControl32",0x0,7,7,297,170
+END
+IDD_NUMBERING_GLOBAL DIALOGEX 0, 0, 289, 134
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+EXSTYLE WS_EX_TRANSPARENT
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ GROUPBOX "",IDC_STATIC,7,7,275,119
+ CONTROL "automatic numbering new messages",IDC_CHECK2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,7,126,10
+ CONTROL "as nearest message",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON,24,26,80,10
+ CONTROL "as nearest numbered message",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,24,40,114,10
+ GROUPBOX "If no nearest (numbered) message found:",IDC_STATIC,14,65,261,53,WS_GROUP
+ CONTROL "don't number",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,24,81,58,10
+ CONTROL "use numbering style:",IDC_RADIO4,"Button",BS_AUTORADIOBUTTON,24,97,83,10
+ GROUPBOX "",IDC_STATIC,14,16,128,42,WS_GROUP
+ COMBOBOX IDC_COMBO_NUMBERING_GLOBAL,107,95,71,66,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
+ CTEXT "+",IDC_STATIC,179,95,12,12,SS_CENTERIMAGE
+ EDITTEXT IDC_ADDITION_GLOBAL,191,95,25,14,ES_AUTOHSCROLL | ES_NOHIDESEL
+ EDITTEXT IDC_STARTING_INDEX,244,95,25,14,ES_AUTOHSCROLL | ES_NUMBER
+ LTEXT "Index:",IDC_STATIC,221,97,21,8,SS_CENTERIMAGE
+END
+
+
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
@@ -261,6 +291,27 @@
TOPMARGIN, 7
BOTTOMMARGIN, 68
END
+
+ IDD_GLOBAL_SETTINGS, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 304
+ VERTGUIDE, 200
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 195
+ HORZGUIDE, 177
+ HORZGUIDE, 180
+ END
+
+ IDD_NUMBERING_GLOBAL, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 282
+ VERTGUIDE, 14
+ VERTGUIDE, 24
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 127
+ END
END
#endif // APSTUDIO_INVOKED
Modified: trunk/src/view/visio/addon/document.cpp
===================================================================
--- trunk/src/view/visio/addon/document.cpp 2010-05-13 16:46:24 UTC (rev 774)
+++ trunk/src/view/visio/addon/document.cpp 2010-05-13 18:38:46 UTC (rev 775)
@@ -24,8 +24,12 @@
#include "extract.h"
#include "visualize.h"
#include "finddlg.h"
+
+//Dialog classes
#include "messagesequencedlg.h"
#include "enumerationDlg.h"
+#include "GlobalSettingsDlg.h"
+
#include <fstream>
#include "shapeutils.h"
@@ -71,9 +75,6 @@
LoadModulesFromRegistry(HKEY_LOCAL_MACHINE);
LoadModulesFromRegistry(HKEY_CURRENT_USER);
-
-
- ID = 1; // message group ID
}
CDocumentMonitor::~CDocumentMonitor()
@@ -513,6 +514,12 @@
itemCheckOptions->AddOnName = ADDON_NAME;
itemCheckOptions->AddOnArgs = stringize() << L"/event=" << MENU_CHECK_OPTIONS;
+ Visio::IVMenuItemPtr globalSettings = itemDrawing->MenuItems->Add();
+ globalSettings->Caption = "&Settings...";
+ globalSettings->AddOnName = ADDON_NAME;
+ globalSettings->BeginGroup = true;
+ globalSettings->AddOnArgs = stringize() << L"/event=" << MENU_GLOBAL_SETTINGS;
+
// step 2: create accelerators
// note: the accelerators must be created in this custom menu set
// note: the accelerators are bound with menu items via CmdNum property
@@ -554,17 +561,6 @@
accelItemMessageEnumerationDisable->Control = true;
accelItemMessageEnumerationDisable->Alt = true;
- //Visio::IVMenuSetsPtr visMenuSets = vsoMenus->MenuSets;
-
- //Visio::IVMenuSetPtr visMenuSet = visMenuSets->ItemAtID[visUIObjSetCntx_DrawObjSel];
- //Visio::IVMenusPtr visMenus = visMenuSet->Menus;
- //Visio::IVMenuPtr visMenu = visMenus->Item[0];
- //visMenuItems = visMenu->MenuItems;
-
- //visMenuItems->AddAt(0);
- //visMenuItems->Item[0]->Caption = _T("Select numbering group");
- //visMenuItems->Item[0]->Visible = false;
-
m_vsoDocument->SetCustomMenus(vsoMenus);
}
@@ -687,7 +683,7 @@
m_disableMessageEnumerationToolbarItem->Enabled = enabled;
itemMessageEnumerating->Enabled = enabled;
- //DODELAT HORKE KLAVESY!!!!
+ //TODO: add hot keys!
accelItemMessageEnumeration->Control = enabled;
accelItemMessageEnumerationDisable->Control = enabled;
@@ -1246,7 +1242,7 @@
_T("Error"), MB_OK | MB_ICONEXCLAMATION);
return VAORC_FAILURE;
}
-
+
// step 3: dialog
CShapeComparator instanceCmp;
MsgSeqDirection origDir = (instanceCmp(boundaries.first, boundaries.second) ? MSDIR_RIGHT : MSDIR_LEFT);
@@ -1621,6 +1617,14 @@
return false;
}
+VAORC CDocumentMonitor::OnMenuGlobalSettings(Visio::IVApplicationPtr vsoApp)
+{
+ CGlobalSettingsDlg dlg;
+
+ dlg.DoModal();
+ return VAORC_SUCCESS;
+}
+
void CDocumentMonitor::ShowReportView()
{
if(m_reportVisible)
Modified: trunk/src/view/visio/addon/document.h
===================================================================
--- trunk/src/view/visio/addon/document.h 2010-05-13 16:46:24 UTC (rev 774)
+++ trunk/src/view/visio/addon/document.h 2010-05-13 18:38:46 UTC (rev 775)
@@ -82,6 +82,7 @@
MENU_SELECT_ADD_ALL_MESSAGES,
MENU_ENABLE_MESSAGE_ENUMERATION,
MENU_DISABLE_MESSAGE_ENUMERATION,
+ MENU_GLOBAL_SETTINGS,
};
VAORC OnMenuWindowsReporter(Visio::IVApplicationPtr vsoApp);
@@ -99,6 +100,7 @@
VAORC OnMenuEnableMessageEnumeration(Visio::IVApplicationPtr vsoApp);
VAORC OnMenuDisableMessageEnumeration(Visio::IVApplicationPtr vsoApp);
VAORC OnMenuSelectNumberedGroup(Visio::IVApplicationPtr vsoApp);
+ VAORC OnMenuGlobalSettings(Visio::IVApplicationPtr vsoApp);
void ShowReportView();
void OnHideReportView();
@@ -301,12 +303,7 @@
Visio::IVShapePtr DrawMessage(Visio::IVMasterPtr msgMaster, Visio::IVShapePtr from, Visio::IVShapePtr to, double yCoord, const TCHAR* caption, MsgSeqCoregionTreatment coregionTreatment);
public:
- /**
- *******************************
- * Message enumeration functions
- *******************************
- *
- *
+ /*
* Returns whether shape is message (ordinary, lost, found)
* @param shape a shape to check
*/
@@ -326,8 +323,6 @@
void enumerate(Visio::IVApplicationPtr vsoApp, _bstr_t groupID, bool enable, bool onlySelected);
bool temporaryDisableEnumeration(Visio::IVApplicationPtr vsoApp);
void restoreDisabledEnumeration(Visio::IVApplicationPtr vsoApp, bool UndoEnumNewMsg);
-
- int ID;
Visio::IVMenuItemsPtr visMenuItems;
Visio::IVMenuItemPtr itemMessageEnumerating;
Modified: trunk/src/view/visio/addon/enumerationDlg.h
===================================================================
--- trunk/src/view/visio/addon/enumerationDlg.h 2010-05-13 16:46:24 UTC (rev 774)
+++ trunk/src/view/visio/addon/enumerationDlg.h 2010-05-13 18:38:46 UTC (rev 775)
@@ -44,14 +44,14 @@
CButton m_enumerateNew;
protected:
-BEGIN_DDX_MAP(CNumberMessage)
+BEGIN_DDX_MAP(CEnumerationDlg)
DDX_CONTROL_HANDLE(IDC_COMBO_NUMBERING, m_numbering);
DDX_CONTROL_HANDLE(IDC_ADDITION, m_addition);
DDX_CONTROL_HANDLE(IDC_STARTING_INDEX, m_index);
DDX_CONTROL_HANDLE(IDC_CHECK_ENUMERATE_NEW, m_enumerateNew);
END_DDX_MAP()
-BEGIN_MSG_MAP(CNumberMessage)
+BEGIN_MSG_MAP(CEnumerationDlg)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
COMMAND_ID_HANDLER(IDOK, OnCloseCmd)
COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd)
Modified: trunk/src/view/visio/addon/messagesequencedlg.cpp
===================================================================
--- trunk/src/view/visio/addon/messagesequencedlg.cpp 2010-05-13 16:46:24 UTC (rev 774)
+++ trunk/src/view/visio/addon/messagesequencedlg.cpp 2010-05-13 18:38:46 UTC (rev 775)
@@ -131,7 +131,7 @@
sMsg = "Unknown error";
TRACE("CMessageSequenceDlg::OnDataValidateError() does not have a validation error message for a control");
}
-
+
MessageBox(sMsg, _T("Message Sequence Error"), MB_ICONEXCLAMATION);
}
Added: trunk/src/view/visio/addon/numberingGlobalDlg.cpp
===================================================================
--- trunk/src/view/visio/addon/numberingGlobalDlg.cpp (rev 0)
+++ trunk/src/view/visio/addon/numberingGlobalDlg.cpp 2010-05-13 18:38:46 UTC (rev 775)
@@ -0,0 +1,57 @@
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2010 Martin Bezdeka <mbe...@se...>
+ *
+ */
+
+#include "stdafx.h"
+#include "dllmodule.h"
+#include "numberingGlobalDlg.h"
+
+
+LRESULT CNumberingGlobalDlg::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
+{
+ CenterWindow(GetParent());
+
+ DoDataExchange();
+ LoadRegistryData();
+
+ return bHandled = FALSE;
+}
+
+LRESULT CNumberingGlobalDlg::OnCloseCmd(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
+{
+ if(wID == IDOK)
+ {
+ DoDataExchange(TRUE);
+ if(SaveRegistryData() == 0)
+ EndDialog(wID);
+ }
+ else if(wID == IDCANCEL)
+ EndDialog(wID);
+
+ return 0;
+}
+
+int CNumberingGlobalDlg::LoadRegistryData()
+{
+
+ return 0;
+}
+
+int CNumberingGlobalDlg::SaveRegistryData()
+{
+
+ return 0;
+}
Added: trunk/src/view/visio/addon/numberingGlobalDlg.h
===================================================================
--- trunk/src/view/visio/addon/numberingGlobalDlg.h (rev 0)
+++ trunk/src/view/visio/addon/numberingGlobalDlg.h 2010-05-13 18:38:46 UTC (rev 775)
@@ -0,0 +1,58 @@
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2010 Martin Bezdeka <mbe...@se...>
+ *
+ */
+
+#pragma once
+
+#include <atldlgs.h>
+#include <atlctrls.h>
+#include <atlddx.h>
+#include <string>
+#include <sstream>
+#include "data/msc.h"
+
+class CNumberingGlobalDlg
+ : public ATL::CDialogImpl<CNumberingGlobalDlg>, public CWinDataExchange<CNumberingGlobalDlg>
+{
+public:
+ //CNumberingGlobalDlg(int startIndex, int enumType, bool enumNew, BSTR addition);
+ enum { IDD = IDD_NUMBERING_GLOBAL };
+
+protected:
+BEGIN_DDX_MAP(CNumberingGlobalDlg)
+ //DDX_CONTROL_HANDLE(IDC_COMBO_NUMBERING, m_numbering);
+ //DDX_CONTROL_HANDLE(IDC_ADDITION, m_addition);
+ //DDX_CONTROL_HANDLE(IDC_STARTING_INDEX, m_index);
+ //DDX_CONTROL_HANDLE(IDC_CHECK_ENUMERATE_NEW, m_enumerateNew);
+END_DDX_MAP()
+
+BEGIN_MSG_MAP(CNumberingGlobalDlg)
+ MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
+ COMMAND_ID_HANDLER(IDOK, OnCloseCmd)
+ COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd)
+END_MSG_MAP()
+
+// Handler prototypes:
+
+ LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
+ LRESULT OnCloseCmd(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
+
+ int LoadRegistryData();
+ int SaveRegistryData();
+
+public:
+
+};
Modified: trunk/src/view/visio/addon/resource.h
===================================================================
--- trunk/src/view/visio/addon/resource.h 2010-05-13 16:46:24 UTC (rev 774)
+++ trunk/src/view/visio/addon/resource.h 2010-05-13 18:38:46 UTC (rev 775)
@@ -40,6 +40,8 @@
#define IDC_IF_START_POS_X 223
#define IDI_ICON_DISABLE_MESSAGE_ENUMERATION 223
#define IDI_MESSAGE_NUMBERING_DISABLE 224
+#define IDD_GLOBAL_SETTINGS 224
+#define IDD_NUMBERING_GLOBAL 225
#define IDC_OPTIONS_SWITCH_BTN 226
#define IDC_OPTIONS_SWITCH_LBL 227
#define IDC_OPTIONS_GROUP_BOX 228
@@ -56,6 +58,7 @@
#define IDC_TOTAL_WIDTH_RDO 242
#define IDC_RADIO2 243
#define IDC_SPACING_RDO 243
+#define IDC_MS_DIR_RIGHT 243
#define IDC_IF_TOTAL_WIDTH 244
#define IDC_DEFAULT_BTN 245
#define IDC...
[truncated message content] |
|
From: <mbe...@us...> - 2010-05-14 09:48:37
|
Revision: 780
http://scstudio.svn.sourceforge.net/scstudio/?rev=780&view=rev
Author: mbezdeka
Date: 2010-05-14 09:48:31 +0000 (Fri, 14 May 2010)
Log Message:
-----------
- message numbering bugs fixed
- help: new frontend picture, some text changes in messsage numbering help and shortcuts
Modified Paths:
--------------
trunk/doc/help/frontend/message-numbering.html
trunk/doc/help/frontend/pictures/frontend.png
trunk/doc/help/frontend/pictures/message_numbering_options.png
trunk/doc/help/frontend/shortcuts.html
trunk/doc/help/frontend.html
trunk/src/view/visio/addon/GlobalSettingsDlg.cpp
trunk/src/view/visio/addon/document.cpp
trunk/src/view/visio/addon/numberingGlobalDlg.cpp
Modified: trunk/doc/help/frontend/message-numbering.html
===================================================================
--- trunk/doc/help/frontend/message-numbering.html 2010-05-14 01:07:15 UTC (rev 779)
+++ trunk/doc/help/frontend/message-numbering.html 2010-05-14 09:48:31 UTC (rev 780)
@@ -15,10 +15,8 @@
<img src="pictures/message_numbering_options.png" alt="Message Numbering options dialog">
</p>
-<p>You can choose specific numbering type (numbers, letters, capital letters, romans), starting index (1-9999) and additional string following the index such as ".", ",", …</p>
+<p>You can choose specific numbering type (numbers, letters, capital letters, romans), starting index (1-9999) and additional string following the index such as ".", "-", …</p>
-<p>If <code>automatically enumerate new messages</code> is checked, any newly dropped messages will be enumerate according to the nearest numbered group.</p>
-
<p>Numbering can be deleted by pressing Delete numbering button <img src="pictures/icon_message_enumeration_disable.png" alt="Disable message numbering"> on the toolbar or by using hotkey <Code>Ctrl+Alt+D.</Code></p>
</body>
Modified: trunk/doc/help/frontend/pictures/frontend.png
===================================================================
(Binary files differ)
Modified: trunk/doc/help/frontend/pictures/message_numbering_options.png
===================================================================
(Binary files differ)
Modified: trunk/doc/help/frontend/shortcuts.html
===================================================================
--- trunk/doc/help/frontend/shortcuts.html 2010-05-14 01:07:15 UTC (rev 779)
+++ trunk/doc/help/frontend/shortcuts.html 2010-05-14 09:48:31 UTC (rev 780)
@@ -14,7 +14,7 @@
<tr><td><code>Ctrl+Alt+F</code></td><td><a href="automatic-drawing.html#add_instances">Add instances</a></td></tr>
<tr><td><code>Ctrl+Alt+S</code></td><td><a href="automatic-drawing.html#message_sequence">Message sequence</a></td></tr>
<tr><td><code>Ctrl+Alt+E</code></td><td><a href="message-numbering.html">Message Numbering</a></td></tr>
-<tr><td><code>Ctrl+Alt+D</code></td><td><a href="message-numbering.html">Delete Message Numbering</a></td></tr>
+<tr><td><code>Ctrl+Alt+D</code></td><td><a href="message-numbering.html">Delete message numbering</a></td></tr>
</table>
</body>
Modified: trunk/doc/help/frontend.html
===================================================================
--- trunk/doc/help/frontend.html 2010-05-14 01:07:15 UTC (rev 779)
+++ trunk/doc/help/frontend.html 2010-05-14 09:48:31 UTC (rev 780)
@@ -17,6 +17,7 @@
<ul>
<li><a href="frontend/shape-selection.html">Shape selection</a></li>
<li><a href="frontend/automatic-drawing.html">Automatic drawing</a></li>
+<li><a href="frontend/message-numbering.html">Message numbering</a></li>
</ul>
<p>Many SCStudio functions define their own keyboard accelerators.
Modified: trunk/src/view/visio/addon/GlobalSettingsDlg.cpp
===================================================================
--- trunk/src/view/visio/addon/GlobalSettingsDlg.cpp 2010-05-14 01:07:15 UTC (rev 779)
+++ trunk/src/view/visio/addon/GlobalSettingsDlg.cpp 2010-05-14 09:48:31 UTC (rev 780)
@@ -119,6 +119,6 @@
}
int CGlobalSettingsDlg::SaveRegistryData()
-{
+{
return 0;
}
Modified: trunk/src/view/visio/addon/document.cpp
===================================================================
--- trunk/src/view/visio/addon/document.cpp 2010-05-14 01:07:15 UTC (rev 779)
+++ trunk/src/view/visio/addon/document.cpp 2010-05-14 09:48:31 UTC (rev 780)
@@ -260,17 +260,8 @@
case ST_BMSC_MESSAGE_FOUND:
if(vsoShape->Text.length() == 0)
vsoShape->Text = _T("NAME");
-
- //Message numbering
- // if(m_vsoApp->ActivePage->PageSheet->GetCellExists(_T("User.AutoEnum1"),0))
- //autoEnumerate(vsoShape);
- // else if(m_vsoApp->ActivePage->PageSheet->GetCellExists(_T("User.AutoEnum2"),0))
- // {
-
- // }
- if((_tcsicmp(vsoShape->Data3,_T("")) != 0) && (_tcsicmp(vsoShape->Data1,_T("")) != 0))
- enumerate(m_vsoApp,vsoShape->Data3,false,true);
-
+ if((_tcsicmp(vsoShape->Data3,_T("")) != 0) && (_tcsicmp(vsoShape->Data1,_T("")) != 0))
+ drawNumbers(m_vsoApp->ActivePage->Shapes,vsoShape->Data3);
break;
case ST_COMMENT:
@@ -442,12 +433,12 @@
}
itemMessageEnumerating = itemDrawing->MenuItems->Add();
- itemMessageEnumerating->Caption = "&Message numbering";
+ itemMessageEnumerating->Caption = "Message &numbering";
itemMessageEnumerating->BeginGroup = true;
itemMessageEnumerating->CmdNum = Visio::visCmdHierarchical;
Visio::IVMenuItemPtr itemEnableEnumerating = itemMessageEnumerating->MenuItems->Add();
- itemEnableEnumerating->Caption = "&Message numbering";
+ itemEnableEnumerating->Caption = "Message &numbering";
itemEnableEnumerating->AddOnName = ADDON_NAME;
itemEnableEnumerating->AddOnArgs = stringize() << L"/event=" << MENU_ENABLE_MESSAGE_ENUMERATION;
vslIconFile = vslFileName+_T(",8");
@@ -506,11 +497,12 @@
itemCheckOptions->AddOnName = ADDON_NAME;
itemCheckOptions->AddOnArgs = stringize() << L"/event=" << MENU_CHECK_OPTIONS;
- Visio::IVMenuItemPtr globalSettings = itemDrawing->MenuItems->Add();
- globalSettings->Caption = "&Settings...";
- globalSettings->AddOnName = ADDON_NAME;
- globalSettings->BeginGroup = true;
- globalSettings->AddOnArgs = stringize() << L"/event=" << MENU_GLOBAL_SETTINGS;
+ //TODO: Dialog for message numbering global settings
+ //Visio::IVMenuItemPtr globalSettings = itemDrawing->MenuItems->Add();
+ //globalSettings->Caption = "&Settings...";
+ //globalSettings->AddOnName = ADDON_NAME;
+ //globalSettings->BeginGroup = true;
+ //globalSettings->AddOnArgs = stringize() << L"/event=" << MENU_GLOBAL_SETTINGS;
// step 2: create accelerators
// note: the accelerators must be created in this custom menu set
@@ -1398,7 +1390,7 @@
{
static int startingIndex = 1;
static int numberingType = 0;
- static BSTR add = _T(". ");
+ static BSTR add = _T(".");
CEnumerationDlg options(startingIndex,numberingType, add);
if(options.DoModal() != IDOK)
@@ -1430,6 +1422,9 @@
Visio::IVSelectionPtr selection = vsoApp->ActiveWindow->Selection;
Visio::IVShapePtr page = vsoApp->ActivePage->PageSheet;
std::set<_bstr_t> groups;
+
+ long undo_id = vsoApp->BeginUndoScope("DeleteNumbering");
+
int ID = CEnumerateUtils::getGroupCount(vsoApp);
//get all numbered messages on the page
@@ -1450,7 +1445,7 @@
selectedMessages++;
}
- if (selection->Count && (selectedMessages != numberedMessages))
+ if (selection->Count && (selectedMessages != numberedMessages) && (selectedMessages > 0))
{
//get which groups are selected
for(int i=1; i<= selection->Count; i++)
@@ -1476,6 +1471,8 @@
CEnumerateUtils::setGroupCount(vsoApp,0);
}
+ vsoApp->EndUndoScope(undo_id,true);
+
return VAORC_SUCCESS;
}
@@ -1609,7 +1606,7 @@
//Default values
int index = 1;
int enumerationType = 0;
- std::wstring addition = _T(". ");
+ std::wstring addition = _T("");
CEnumerateUtils::loadGroupSettings(shapesOnPage->Application,groupID,index,enumerationType,addition);
//for all message shapes check whether they are checked as numbered (Data1 == 1)
Modified: trunk/src/view/visio/addon/numberingGlobalDlg.cpp
===================================================================
--- trunk/src/view/visio/addon/numberingGlobalDlg.cpp 2010-05-14 01:07:15 UTC (rev 779)
+++ trunk/src/view/visio/addon/numberingGlobalDlg.cpp 2010-05-14 09:48:31 UTC (rev 780)
@@ -41,6 +41,8 @@
else if(wID == IDCANCEL)
EndDialog(wID);
+ SaveRegistryData();
+
return 0;
}
@@ -66,11 +68,12 @@
int CNumberingGlobalDlg::SaveRegistryData()
{
- if(getAutoEnumEnabled() == 1)
- {
+ //if(getAutoEnumEnabled() == 1)
+ //{
SetRegistry<int>(HKEY_CURRENT_USER, GetRegistryFolder(), _T("AutoEnum1"), getAutoEnum1Type());
SetRegistry<int>(HKEY_CURRENT_USER, GetRegistryFolder(), _T("AutoEnum2"), getAutoEnum2Type());
- }
+ MessageBox(_T("Done!"));
+ //}
return 0;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mar...@us...> - 2010-05-15 10:31:48
|
Revision: 783
http://scstudio.svn.sourceforge.net/scstudio/?rev=783&view=rev
Author: martinnrt
Date: 2010-05-15 10:31:41 +0000 (Sat, 15 May 2010)
Log Message:
-----------
Memory leak is repaired.
Modified Paths:
--------------
trunk/src/check/time/find_block.cpp
trunk/src/check/time/hmsc_all_paths.cpp
trunk/tests/find_block_test.cpp
Modified: trunk/src/check/time/find_block.cpp
===================================================================
--- trunk/src/check/time/find_block.cpp 2010-05-14 21:06:48 UTC (rev 782)
+++ trunk/src/check/time/find_block.cpp 2010-05-15 10:31:41 UTC (rev 783)
@@ -46,6 +46,10 @@
{
ReferenceNode* n= dynamic_cast<ReferenceNode*>(v);
TimeRelationRefNodePtrSet node_constraints;
+ TimeRelationRefNodePtrSet toerase;
+ TimeRelationRefNodePtrSet toadd;
+ TimeRelationRefNodePtrSet toadd2;
+ // std::set<std::pair<TimeRelationRefNodePtr,int>> forerase;
node_constraints.erase(node_constraints.begin(), node_constraints.end());
if (n!=NULL) //test if node v is also ReferenceNode
@@ -86,15 +90,36 @@
{
if (*it==*it_2)
{
- //erase constraint from open constraints, if same one is in node constraints
- trav->m_open_constraints.erase(it);
- node_constraints.erase(it_2);
- std::set<TimeRelationRefNodePtr>::iterator it=trav->m_open_constraints.begin();
- std::set<TimeRelationRefNodePtr>::iterator it_2=node_constraints.begin();
+ toerase.insert(*it_2);
}
}
}
- trav->m_open_constraints.insert(node_constraints.begin(), node_constraints.end());
+
+ for (std::set<TimeRelationRefNodePtr>::iterator it = trav->m_open_constraints.begin(); it != trav->m_open_constraints.end(); it++) //itarate open constraints
+ {
+ int x=0;
+ for (std::set<TimeRelationRefNodePtr>::iterator it_2 = toerase.begin(); it_2 != toerase.end(); it_2++) //iterate node constraints
+ {
+ if (*it==*it_2) x=1;
+ }
+ if (x==0) toadd.insert(*it);
+ }
+ for (std::set<TimeRelationRefNodePtr>::iterator it = node_constraints.begin(); it != node_constraints.end(); it++) //itarate open constraints
+ {
+ int x=0;
+ for (std::set<TimeRelationRefNodePtr>::iterator it_2 = toerase.begin(); it_2 != toerase.end(); it_2++) //iterate node constraints
+ {
+ if (*it==*it_2) x=1;
+ }
+ if (x==0) toadd2.insert(*it);
+ }
+
+ trav->m_open_constraints.clear();
+ trav->m_open_constraints.insert(toadd.begin(),toadd.end());
+ trav->m_open_constraints.insert(toadd2.begin(),toadd2.end());
+ toadd.clear();
+ toadd2.clear();
+ node_constraints.clear();
}
}
else if (dynamic_cast<EndNode*>(v)!=NULL)
Modified: trunk/src/check/time/hmsc_all_paths.cpp
===================================================================
--- trunk/src/check/time/hmsc_all_paths.cpp 2010-05-14 21:06:48 UTC (rev 782)
+++ trunk/src/check/time/hmsc_all_paths.cpp 2010-05-15 10:31:41 UTC (rev 783)
@@ -38,9 +38,11 @@
}
path_prefix2.pop_back();
//keep poping until hmsc node is reached
- while(!dynamic_cast<HMscNode*>(path_prefix2.back()))
+ std::cout << "b\n";
+ while(!((HMscNode*)(path_prefix2.back())))
path_prefix2.pop_back();
- return; //TODO check- I think it should be here
+ std::cout << "c\n";
+ return; //TODO check- I think it should be here
}
}
Modified: trunk/tests/find_block_test.cpp
===================================================================
--- trunk/tests/find_block_test.cpp 2010-05-14 21:06:48 UTC (rev 782)
+++ trunk/tests/find_block_test.cpp 2010-05-15 10:31:41 UTC (rev 783)
@@ -90,6 +90,8 @@
EraseAllConstraints* eac= new EraseAllConstraints();
eac->erase_all_constraints(h1);
+ delete trav_mark;
+ delete eac;
return 0;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <va...@us...> - 2010-05-16 20:44:36
|
Revision: 789
http://scstudio.svn.sourceforge.net/scstudio/?rev=789&view=rev
Author: vacek
Date: 2010-05-16 20:44:30 +0000 (Sun, 16 May 2010)
Log Message:
-----------
Brief help for checkers. Maybe not properly integrated.
Modified Paths:
--------------
trunk/doc/help/CMakeLists.txt
trunk/doc/help/algorithms.html
trunk/doc/help/scstudio.hhc
trunk/src/check/boundedness/universal_boundedness_checker.h
trunk/src/check/liveness/deadlock_checker.h
trunk/src/check/liveness/livelock_checker.h
trunk/src/check/race/race_checker.h
trunk/src/check/realizability/realizability_checker.h
Added Paths:
-----------
trunk/doc/help/boundedness/
trunk/doc/help/boundedness/boundedness.html
trunk/doc/help/deadlock/
trunk/doc/help/deadlock/deadlock.html
trunk/doc/help/livelock/
trunk/doc/help/livelock/livelock.html
trunk/doc/help/race/
trunk/doc/help/race/race.html
trunk/doc/help/realizability/
trunk/doc/help/realizability/realizability.html
Modified: trunk/doc/help/CMakeLists.txt
===================================================================
--- trunk/doc/help/CMakeLists.txt 2010-05-16 18:43:16 UTC (rev 788)
+++ trunk/doc/help/CMakeLists.txt 2010-05-16 20:44:30 UTC (rev 789)
@@ -14,6 +14,11 @@
localChoice/localchoice.html
membership/membership.html
fifo/fifo.html
+ deadlock/deadlock.html
+ livelock/livelock.html
+ race/race.html
+ realizability/realizability.html
+ boundedness/boundedness.html
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
ENDIF(HTML_HELP_COMPILER)
Modified: trunk/doc/help/algorithms.html
===================================================================
--- trunk/doc/help/algorithms.html 2010-05-16 18:43:16 UTC (rev 788)
+++ trunk/doc/help/algorithms.html 2010-05-16 20:44:30 UTC (rev 789)
@@ -10,6 +10,11 @@
<li><a href="fifo/fifo.html">FIFO property</a></li>
<li><a href="localchoice/localchoice.html">Nonlocal Choice</a></li>
<li><a href="membership/membership.html">Membership</a></li>
+<li><a href="race/race.html">Race Condition</a></li>
+<li><a href="livelock/livelock.html">Livelock</a></li>
+<li><a href="deadlock/deadlock.html">Deadlock</a></li>
+<li><a href="boundedness/boundedness.html">Universal Boundedness</a></li>
+<li><a href="realizability/realizability.html">Strong Realizablilty</a></li>
</ul>
</body>
</html>
Added: trunk/doc/help/boundedness/boundedness.html
===================================================================
--- trunk/doc/help/boundedness/boundedness.html (rev 0)
+++ trunk/doc/help/boundedness/boundedness.html 2010-05-16 20:44:30 UTC (rev 789)
@@ -0,0 +1,14 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+<HEAD>
+ <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
+ <TITLE>Universal Boundedness</TITLE>
+ <meta name="author" content="Martin Chmelik">
+ <LINK href="../help.css" rel="stylesheet" type="text/css"/>
+</HEAD>
+<BODY>
+<H1>Universal Boundedness</H1>
+<P>is a property of an HMSC. An HMSC is universally bounded if there exists an upper limit on size of communication buffers of all involved processes. Informally, each instance waits for a response before sending the same message again. A dialogue is an example of bounded communication. E-mail spam is an example of unbounded comuunication - actually, it is not rare that an input buffer (mailbox) gets full in this case. </P>
+
+<P>When all the possible executions of an HMSC are finite, the HMSC is universally bounded. Therefore only HMSCs containing a cycle may be unbounded. Every cycle whose repetitive execution may lead to unbounded grow of an input buffer is found and displayed by SCStudio.</P>
+</BODY>
Added: trunk/doc/help/deadlock/deadlock.html
===================================================================
--- trunk/doc/help/deadlock/deadlock.html (rev 0)
+++ trunk/doc/help/deadlock/deadlock.html 2010-05-16 20:44:30 UTC (rev 789)
@@ -0,0 +1,17 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+<HEAD>
+ <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
+ <TITLE>Deadlock</TITLE>
+ <meta name="author" content="Martin Chmelik">
+ <LINK href="../help.css" rel="stylesheet" type="text/css"/>
+</HEAD>
+<BODY>
+<H1>Deadlock</H1>
+<P>is a property of an HMSC node. An HMSC node is deadlocked if there is no reference node or end node reachable from the node, i.e. after the execution of the MSC referenced by a deadlocked node, there is no node to continue with.</P>
+
+<P>
+SCStudio finds all deadlocked nodes in a given HMSC. For each deadlocked node a path from the start node to the node is available.
+</P>
+
+</BODY>
Added: trunk/doc/help/livelock/livelock.html
===================================================================
--- trunk/doc/help/livelock/livelock.html (rev 0)
+++ trunk/doc/help/livelock/livelock.html 2010-05-16 20:44:30 UTC (rev 789)
@@ -0,0 +1,14 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+<HEAD>
+ <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
+ <TITLE>Livelock</TITLE>
+ <meta name="author" content="Martin Chmelik">
+ <LINK href="../help.css" rel="stylesheet" type="text/css"/>
+</HEAD>
+<BODY>
+<H1>Livelock</H1>
+<P>is a property of an HMSC. An HMSC contains a livelock if there exists a cycle of nodes from which no endnode is reachable. It is required that the cycle contains at least one reference node.</P>
+
+<P>SCStudio finds and displays all such cycles is a given HMSC.</P>
+</BODY>
Added: trunk/doc/help/race/race.html
===================================================================
--- trunk/doc/help/race/race.html (rev 0)
+++ trunk/doc/help/race/race.html 2010-05-16 20:44:30 UTC (rev 789)
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+<HEAD>
+ <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
+ <TITLE>Race Condition</TITLE>
+ <meta name="author" content="Martin Chmelik">
+ <LINK href="../help.css" rel="stylesheet" type="text/css"/>
+</HEAD>
+<BODY>
+<H1>Race Condition</H1>
+<P>occurs in an MSC if a pair of events is drawn in a particular order but the events may occur in the other order during an execution of the MSC. If the real implementation is based on the drawing, it may lead to a system failure. Please don't mix up race condition with FIFO; race condition is only applicable for MSCs that satisfy FIFO.</P>
+<P>SCStudio currently finds all such pairs of events is a given BMSC and also in BMSCs referenced by a HMSC. The race condition may also occur between events from different BMSC. SCStudio is capable of finding one such occurence.</P>
+</BODY>
Added: trunk/doc/help/realizability/realizability.html
===================================================================
--- trunk/doc/help/realizability/realizability.html (rev 0)
+++ trunk/doc/help/realizability/realizability.html 2010-05-16 20:44:30 UTC (rev 789)
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+<HEAD>
+ <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
+ <TITLE>Strong realizability</TITLE>
+ <meta name="author" content="Martin Chmelik">
+ <LINK href="../help.css" rel="stylesheet" type="text/css"/>
+</HEAD>
+<BODY>
+<H1>Strong realizability</H1>
+<P>is a property of an HMSC. An HMSC is strongly realizable iff it is univerally bounded and local-choice.</P>
+
+</BODY>
Modified: trunk/doc/help/scstudio.hhc
===================================================================
--- trunk/doc/help/scstudio.hhc 2010-05-16 18:43:16 UTC (rev 788)
+++ trunk/doc/help/scstudio.hhc 2010-05-16 20:44:30 UTC (rev 789)
@@ -51,6 +51,26 @@
<param name="Name" value="Membership">
<param name="Local" value="membership\membership.html">
</OBJECT>
+ <LI> <OBJECT type="text/sitemap">
+ <param name="Name" value="Race Condition">
+ <param name="Local" value="race\race.html">
+ </OBJECT>
+ <LI> <OBJECT type="text/sitemap">
+ <param name="Name" value="Deadlock Property">
+ <param name="Local" value="deadlock\deadlock.html">
+ </OBJECT>
+ <LI> <OBJECT type="text/sitemap">
+ <param name="Name" value="Livelock Property">
+ <param name="Local" value="livelock\livelock.html">
+ </OBJECT>
+ <LI> <OBJECT type="text/sitemap">
+ <param name="Name" value="Universal Boundedness">
+ <param name="Local" value="boundedness\boundedness.html">
+ </OBJECT>
+ <LI> <OBJECT type="text/sitemap">
+ <param name="Name" value="Strong Realizability">
+ <param name="Local" value="realizability\realizability.html">
+ </OBJECT>
</UL>
</UL>
</BODY></HTML>
Modified: trunk/src/check/boundedness/universal_boundedness_checker.h
===================================================================
--- trunk/src/check/boundedness/universal_boundedness_checker.h 2010-05-16 18:43:16 UTC (rev 788)
+++ trunk/src/check/boundedness/universal_boundedness_checker.h 2010-05-16 20:44:30 UTC (rev 789)
@@ -153,7 +153,7 @@
* Ralative path to a HTML file displayed as help.
*/
virtual std::wstring get_help_filename() const
- { return L""; }
+ { return L"boundedness/boundedness.html"; }
virtual PreconditionList get_preconditions(MscPtr msc) const;
Modified: trunk/src/check/liveness/deadlock_checker.h
===================================================================
--- trunk/src/check/liveness/deadlock_checker.h 2010-05-16 18:43:16 UTC (rev 788)
+++ trunk/src/check/liveness/deadlock_checker.h 2010-05-16 20:44:30 UTC (rev 789)
@@ -88,7 +88,7 @@
* Ralative path to a HTML file displayed as help.
*/
virtual std::wstring get_help_filename() const
- { return L""; }
+ { return L"deadlock/deadlock.html"; }
virtual PreconditionList get_preconditions(MscPtr msc) const;
Modified: trunk/src/check/liveness/livelock_checker.h
===================================================================
--- trunk/src/check/liveness/livelock_checker.h 2010-05-16 18:43:16 UTC (rev 788)
+++ trunk/src/check/liveness/livelock_checker.h 2010-05-16 20:44:30 UTC (rev 789)
@@ -126,7 +126,7 @@
* Ralative path to a HTML file displayed as help.
*/
virtual std::wstring get_help_filename() const
- { return L""; }
+ { return L"livelock/livelock.html"; }
virtual PreconditionList get_preconditions(MscPtr msc) const;
Modified: trunk/src/check/race/race_checker.h
===================================================================
--- trunk/src/check/race/race_checker.h 2010-05-16 18:43:16 UTC (rev 788)
+++ trunk/src/check/race/race_checker.h 2010-05-16 20:44:30 UTC (rev 789)
@@ -241,7 +241,7 @@
* Ralative path to a HTML file displayed as help.
*/
virtual std::wstring get_help_filename() const
- { return L""; }
+ { return L"race/race.html"; }
virtual PreconditionList get_preconditions(MscPtr msc) const;
Modified: trunk/src/check/realizability/realizability_checker.h
===================================================================
--- trunk/src/check/realizability/realizability_checker.h 2010-05-16 18:43:16 UTC (rev 788)
+++ trunk/src/check/realizability/realizability_checker.h 2010-05-16 20:44:30 UTC (rev 789)
@@ -52,7 +52,7 @@
* Ralative path to a HTML file displayed as help.
*/
virtual std::wstring get_help_filename() const
- { return L""; }
+ { return L"realizability/realizability.html"; }
virtual PreconditionList get_preconditions(MscPtr msc) const;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mbe...@us...> - 2010-07-05 22:56:34
|
Revision: 826
http://scstudio.svn.sourceforge.net/scstudio/?rev=826&view=rev
Author: mbezdeka
Date: 2010-07-05 22:56:28 +0000 (Mon, 05 Jul 2010)
Log Message:
-----------
Message numbering
- auto numbering help added
- rest of functionality of global numbering dialog added
Modified Paths:
--------------
trunk/doc/help/frontend/message-numbering.html
trunk/src/view/visio/addon/dllmodule.rc
trunk/src/view/visio/addon/document.cpp
trunk/src/view/visio/addon/enumerateUtils.cpp
trunk/src/view/visio/addon/enumerateUtils.h
trunk/src/view/visio/addon/globalSettingsDlg.h
trunk/src/view/visio/addon/numberingGlobalDlg.cpp
trunk/src/view/visio/addon/numberingGlobalDlg.h
trunk/src/view/visio/addon/resource.h
Added Paths:
-----------
trunk/doc/help/frontend/pictures/message_numbering_autoenum_options.png
Modified: trunk/doc/help/frontend/message-numbering.html
===================================================================
--- trunk/doc/help/frontend/message-numbering.html 2010-07-04 14:02:59 UTC (rev 825)
+++ trunk/doc/help/frontend/message-numbering.html 2010-07-05 22:56:28 UTC (rev 826)
@@ -1,25 +1,26 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
-<title>Shape Selection – SCStudio frontend</title>
-<link href="../help.css" rel="stylesheet" type="text/css">
+<title>Message Numbering – SCStudio frontend</title>
+<link href="../help.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<h1>Message Numbering</h1>
-<p>Message numbering allows users to enumerate all types of message shapes (left, right, lost, found).<br>
-You can enumerate all messages on the active page (if no messages are selected) or the selection.<br>
+<p>Message numbering allows users to enumerate all types of message shapes (left, right, lost, found).<br/>
+You can enumerate all messages on the active page (if no messages are selected) or the selection.<br/>
+</p>
-<h3>Enable message numbering</h3>
-<p>By pressing Message numbering button <img src="pictures/icon_message_enumeration.png" alt="Message Numbering">, via menu <code>Check->Drawing->Message numbering->Message numbering</code> or by using hotkey <Code>Ctrl+Alt+E</Code> the dialog with options will be shown:</p>
+<h2>Enable message numbering</h2>
+<p>By pressing Message numbering button <img src="pictures/icon_message_enumeration.png" alt="Message Numbering" />, via menu <code>Check->Drawing->Message numbering->Message numbering</code> or by using hotkey <Code>Ctrl+Alt+E</Code> the dialog with options will be shown:</p>
<p>
-<img src="pictures/message_numbering_options.png" alt="Message Numbering options dialog">
+<img src="pictures/message_numbering_options.png" alt="Message Numbering options dialog"/>
</p>
-<p>You can choose:<br>
-- specific numbering type (numbers, letters, capital letters, romans)<br>
-- starting index (1-9999)<br>
-- and additional string following the index such as ".", "-", … (max 4 chars)<br>
+<p>You can choose:<br/>
+- specific numbering type (numbers, letters, capital letters, romans)<br/>
+- starting index (1-9999)<br/>
+- and additional string following the index such as ".", "-", … (max 4 chars)<br/>
</p>
<p>
@@ -27,7 +28,7 @@
Already numbered messages will be overwritten by new numbering.
</p>
-<h3>Disable message numbering</h3>
+<h2>Disable message numbering</h2>
<p>Numbering can be deleted by pressing Delete numbering button <img src="pictures/icon_message_enumeration_disable.png" alt="Disable message numbering"> on the toolbar, via menu <code>Check->Drawing->Message numbering->Delete numbering</code> or by using hotkey <Code>Ctrl+Alt+D.</Code></p>
<p>
@@ -35,12 +36,35 @@
If no selection is used all numbering indexes will be deleted.
</p>
-<h3>Numbering group selection</h3>
+<h2>Numbering group selection</h2>
<p>When a group of messages is numbered, user can select it by right-click on any of numbered messages from group and choose <code>Select numbering group</code> from context menu. Example is shown in the following picture:</p>
<p>
-<img src="pictures/select_numbering_group.png" alt="Select numbering group">
+<img src="pictures/select_numbering_group.png" alt="Select numbering group" />
</p>
+<h2>Auto numbering</h2>
+<p>New messages can be automatically numbered after they are dropped on the page. Specific behavior can be set via menu <code>Check->Drawing->Settings</code>, tab Numbering. Following dialog will be shown:</p>
+
+<p>
+<img src="pictures/message_numbering_autoenum_options.png" alt="Auto numbering options" />
+</p>
+
+<p>
+Options are:<br />
+<p/>
+
+<p>
+<code>automatic numbering new messages</code><br />
+ - sets whether auto numbering is enabled, otherwise all other options are disabled.<br /><br />
+<code>as nearest message</code><br />
+ - new messages will be numbered according to the group of the closest message on the active page. All message indexes in the current group will be recounted. If the closest message isn't numbered, new one won't be either. <br />
+<code>as nearest numbered message</code><br />
+ - new messages will be numbered according to the closest <b>numbered</b> message on the active page. If there are no numbered messages on the active page you can choose between: <br /><br />
+ <code>don't number</code><br />
+ - don't number new messages if there are no numbered messages on the page.<br />
+ <code>use numbering style</code><br />
+ - use specific numbering style if there are no numbered messages on the page.<br />
+</p>
</body>
</html>
\ No newline at end of file
Added: trunk/doc/help/frontend/pictures/message_numbering_autoenum_options.png
===================================================================
(Binary files differ)
Property changes on: trunk/doc/help/frontend/pictures/message_numbering_autoenum_options.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/src/view/visio/addon/dllmodule.rc
===================================================================
--- trunk/src/view/visio/addon/dllmodule.rc 2010-07-04 14:02:59 UTC (rev 825)
+++ trunk/src/view/visio/addon/dllmodule.rc 2010-07-05 22:56:28 UTC (rev 826)
@@ -204,25 +204,24 @@
LTEXT "Starting index:",IDC_STATIC,11,39,50,8,SS_CENTERIMAGE
END
-IDD_NUMBERING_GLOBAL DIALOGEX 0, 0, 289, 134
+IDD_NUMBERING_GLOBAL DIALOGEX 0, 0, 275, 126
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION
EXSTYLE WS_EX_TRANSPARENT
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
- GROUPBOX "",IDC_STATIC,7,7,275,120
- CONTROL "automatic numbering new messages",IDC_ENUM_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,6,128,10
- CONTROL "as nearest message",IDC_NEAREST_MSG,"Button",BS_AUTORADIOBUTTON,24,26,80,10
+ CONTROL "as nearest message",IDC_NEAREST_MSG,"Button",BS_AUTORADIOBUTTON | WS_GROUP,17,27,80,10
CONTROL "as nearest numbered message",IDC_NEAREST_NUMBERED_MSG,
- "Button",BS_AUTORADIOBUTTON,24,40,114,10
- GROUPBOX "If no nearest (numbered) message found:",IDC_STATIC,14,65,261,53,WS_GROUP
- CONTROL "don't number",IDC_DONT_NUMBER,"Button",BS_AUTORADIOBUTTON,24,81,58,10
- CONTROL "use numbering style:",IDC_USE_NUMBERING_STYLE,"Button",BS_AUTORADIOBUTTON,24,97,83,10
- GROUPBOX "",IDC_STATIC,14,16,128,42,WS_GROUP
- COMBOBOX IDC_COMBO_NUMBERING_GLOBAL,107,95,71,66,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
- CTEXT "+",IDC_STATIC,179,95,12,12,SS_CENTERIMAGE
- EDITTEXT IDC_ADDITION_GLOBAL,191,95,25,14,ES_AUTOHSCROLL | ES_NOHIDESEL
- EDITTEXT IDC_STARTING_INDEX_GLOBAL,244,95,25,14,ES_AUTOHSCROLL | ES_NUMBER
- LTEXT "Index:",IDC_STATIC,221,97,21,8,SS_CENTERIMAGE
+ "Button",BS_AUTORADIOBUTTON,17,41,114,10
+ CONTROL "don't number",IDC_DONT_NUMBER,"Button",BS_AUTORADIOBUTTON | WS_GROUP,17,81,58,10
+ CONTROL "use numbering style:",IDC_USE_NUMBERING_STYLE,"Button",BS_AUTORADIOBUTTON,17,97,83,10
+ GROUPBOX "",IDC_STATIC,7,17,261,42,WS_GROUP
+ COMBOBOX IDC_COMBO_NUMBERING_GLOBAL,101,95,71,66,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
+ CTEXT "+",IDC_STATIC,173,95,12,12,SS_CENTERIMAGE
+ EDITTEXT IDC_ADDITION_GLOBAL,185,95,25,14,ES_AUTOHSCROLL | ES_NOHIDESEL
+ EDITTEXT IDC_STARTING_INDEX_GLOBAL,237,95,25,14,ES_AUTOHSCROLL | ES_NUMBER
+ LTEXT "Index:",IDC_STATIC,215,97,21,8,SS_CENTERIMAGE
+ CONTROL "automatic numbering new messages",IDC_ENUM_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,7,131,10
+ GROUPBOX "If no nearest (numbered) message found:",IDC_STATIC,7,65,261,54,WS_GROUP
END
@@ -284,11 +283,11 @@
IDD_NUMBERING_GLOBAL, DIALOG
BEGIN
LEFTMARGIN, 7
- RIGHTMARGIN, 282
+ RIGHTMARGIN, 268
VERTGUIDE, 14
VERTGUIDE, 24
TOPMARGIN, 7
- BOTTOMMARGIN, 127
+ BOTTOMMARGIN, 119
END
END
#endif // APSTUDIO_INVOKED
Modified: trunk/src/view/visio/addon/document.cpp
===================================================================
--- trunk/src/view/visio/addon/document.cpp 2010-07-04 14:02:59 UTC (rev 825)
+++ trunk/src/view/visio/addon/document.cpp 2010-07-05 22:56:28 UTC (rev 826)
@@ -1466,6 +1466,8 @@
continue;
page->DeleteRow(visSectionUser,page->GetCells(userGroupID)->Row);
}
+ //erase AutoNumbering information if exists
+ CEnumerateUtils::eraseAutoEnumGroup(vsoApp);
//restore IDs
CEnumerateUtils::setGroupCount(vsoApp,0);
}
@@ -1491,8 +1493,67 @@
int bAutoEnumType = GetRegistry<bool>(regFolder, NULL, _T("AutoEnumType"), 0);
closestMsg = CEnumerateUtils::getClosestMessage(msgShape->Application,msgShape,bAutoEnumType ? true : false);
+ //enumerate according to closest message
if(closestMsg && _tcsicmp(closestMsg->Data3,_T("")) != 0)
+ {
enumerate(msgShape->Application,closestMsg->Data3,true,true);
+ }
+ //or use numbering style
+ else if(GetRegistry<bool>(regFolder, NULL, _T("AutoEnumStyleEnabled"), 0) && bAutoEnumType)
+ {
+ int autoEnumGroupID = CEnumerateUtils::getAutoEnumGroup(m_vsoApp);
+ if(autoEnumGroupID == -1)
+ {
+ int ID = CEnumerateUtils::getGroupCount(m_vsoApp);
+ _bstr_t groupID = stringize() << _T("Enum") << ++ID;
+
+ //addition string
+ HKEY hKey;
+ if(RegCreateKey(HKEY_CURRENT_USER, regFolder,&hKey) != ERROR_SUCCESS)
+ {
+ MessageBox(GetActiveWindow(), _T("Failed load key for addition string!"), _T("Error"), MB_OK);
+ return;
+ }
+
+ DWORD dwType = 0;
+ wchar_t buffer[5] = {0};
+ DWORD dwSize = sizeof(buffer);
+ if(!RegQueryValueEx(hKey,_T("AutoEnumStyleAddition"),0,&dwType, (LPBYTE)buffer, &dwSize) == ERROR_SUCCESS)
+ {
+ RegCloseKey(hKey);
+ return;
+ }
+ RegCloseKey(hKey);
+
+ //save group setting into page sheet
+ CEnumerateUtils::saveGroupSettings(m_vsoApp, groupID,
+ GetRegistry<int>(regFolder, NULL, _T("AutoEnumStyleIndex"), 1),
+ GetRegistry<int>(regFolder, NULL, _T("AutoEnumStyleNumType"), 0),
+ buffer);
+
+ enumerate(m_vsoApp, groupID, true,true);
+
+ CEnumerateUtils::setGroupCount(m_vsoApp,ID);
+ pageSheet->AddNamedRow(visSectionUser,_T("AutoEnumGroupID"),visTagDefault);
+ pageSheet->Cells["User.AutoEnumGroupID"]->FormulaU = stringize() << ID;
+ }
+ else
+ {
+ _bstr_t groupID = stringize() << _T("Enum") << autoEnumGroupID;
+ enumerate(m_vsoApp, groupID, true,true);
+ }
+
+ //MessageBox(GetActiveWindow(),temp.c_str(),NULL,MB_OK);
+ //if group for auto numbering doesn't exists yet, create a new one
+ /*int ID = GetRegistry<int>(regFolder, NULL, _T("AutoEnumGroupID"), -1)
+ if(ID == -1)
+ {
+ ID = CEnumerateUtils::getGroupCount(m_vsoApp);
+ SetRegistry<int>
+
+ }
+ MessageBox(GetActiveWindow(),_T("The group doesn't exists yet!"),NULL, MB_OK);*/
+ }
}
//Check which groups have changed
@@ -1659,6 +1720,14 @@
{
CGlobalSettingsDlg sheet(_T("Settings"));
sheet.DoModal();
+
+ //Message Numbering processing
+ const TCHAR* regFolder = _T("Software\\Sequence Chart Studio\\MessageNumbering");
+ if(GetRegistry<bool>(regFolder, NULL, _T("AutoEnumStyleIndexChanged"), 0))
+ {
+ CEnumerateUtils::eraseAutoEnumGroup(vsoApp);
+ SetRegistry<bool>(HKEY_CURRENT_USER, regFolder, _T("AutoEnumStyleIndexChanged"), false);
+ }
return VAORC_SUCCESS;
}
Modified: trunk/src/view/visio/addon/enumerateUtils.cpp
===================================================================
--- trunk/src/view/visio/addon/enumerateUtils.cpp 2010-07-04 14:02:59 UTC (rev 825)
+++ trunk/src/view/visio/addon/enumerateUtils.cpp 2010-07-05 22:56:28 UTC (rev 826)
@@ -239,6 +239,25 @@
pagesheet->Cells["User.EnumCount"]->FormulaU = stringize() << count;
}
+int CEnumerateUtils::getAutoEnumGroup(Visio::IVApplicationPtr vsoApp)
+{
+ Visio::IVShapePtr pagesheet = vsoApp->ActivePage->PageSheet;
+
+ if(pagesheet->GetCellExists(_T("User.AutoEnumGroupID"),0))
+ {
+ return pagesheet->Cells["User.AutoEnumGroupID"]->ResultInt[visNone][visTruncate];
+ }
+
+ return -1;
+}
+
+void CEnumerateUtils::eraseAutoEnumGroup(Visio::IVApplicationPtr vsoApp)
+{
+ Visio::IVShapePtr pagesheet = vsoApp->ActivePage->PageSheet;
+ if(getAutoEnumGroup(vsoApp) != -1)
+ pagesheet->DeleteRow(visSectionUser,pagesheet->CellsRowIndex["User.AutoEnumGroupID"]);
+}
+
VAORC CEnumerateUtils::enableEnumeration(Visio::IVShapePtr shape, _bstr_t groupID, std::set<_bstr_t>& formerGroups)
{
if(_tcsicmp(shape->Data1,_T("")) == 0)
Modified: trunk/src/view/visio/addon/enumerateUtils.h
===================================================================
--- trunk/src/view/visio/addon/enumerateUtils.h 2010-07-04 14:02:59 UTC (rev 825)
+++ trunk/src/view/visio/addon/enumerateUtils.h 2010-07-05 22:56:28 UTC (rev 826)
@@ -42,15 +42,24 @@
* @return whether first shape is "smaller" then the second one
*/
static bool messageCompare(Visio::IVShapePtr p1, Visio::IVShapePtr p2);
- static bool loadGroupSettings(Visio::IVApplicationPtr vsoApp, _bstr_t groupID, int& startIndex, int& numberingType, std::wstring& addition);
+
+ static bool loadGroupSettings(Visio::IVApplicationPtr vsoApp, _bstr_t groupID, int& startIndex, int& numberingType, std::wstring& addition);
static bool saveGroupSettings(Visio::IVApplicationPtr vsoApp, _bstr_t groupID, int startIndex, int numberingType, BSTR addition);
- static void selectGroup(Visio::IVApplicationPtr vsoApp, _bstr_t groupID);
- static Visio::IVShapePtr getClosestMessage(Visio::IVApplicationPtr vsoApp, const Visio::IVShapePtr shapePtr, bool onlyNumbered);
- static int getGroupCount(Visio::IVApplicationPtr vsoApp);
+
+ static void selectGroup(Visio::IVApplicationPtr vsoApp, _bstr_t groupID);
+
+ static Visio::IVShapePtr getClosestMessage(Visio::IVApplicationPtr vsoApp, const Visio::IVShapePtr shapePtr, bool onlyNumbered);
+
+ static int getGroupCount(Visio::IVApplicationPtr vsoApp);
static void setGroupCount(Visio::IVApplicationPtr vsoApp, int count);
- static VAORC disableEnumeration(Visio::IVShapePtr shape);
+
+ static VAORC disableEnumeration(Visio::IVShapePtr shape);
static VAORC enableEnumeration(Visio::IVShapePtr shape, _bstr_t groupID, std::set<_bstr_t>& formerGroups);
- static void fillComboWithTypes(WTL::CComboBox& combo);
+
+ static void fillComboWithTypes(WTL::CComboBox& combo);
+
+ static int getAutoEnumGroup(Visio::IVApplicationPtr vsoApp);
+ static void eraseAutoEnumGroup(Visio::IVApplicationPtr vsoApp);
};
// $Id$
\ No newline at end of file
Modified: trunk/src/view/visio/addon/globalSettingsDlg.h
===================================================================
--- trunk/src/view/visio/addon/globalSettingsDlg.h 2010-07-04 14:02:59 UTC (rev 825)
+++ trunk/src/view/visio/addon/globalSettingsDlg.h 2010-07-05 22:56:28 UTC (rev 826)
@@ -42,7 +42,6 @@
//Pages of property sheet
CNumberingGlobalDlg page1;
- CPropertyPage<IDD_CHECK_OPTIONS> page2;
};
// $Id$
\ No newline at end of file
Modified: trunk/src/view/visio/addon/numberingGlobalDlg.cpp
===================================================================
--- trunk/src/view/visio/addon/numberingGlobalDlg.cpp 2010-07-04 14:02:59 UTC (rev 825)
+++ trunk/src/view/visio/addon/numberingGlobalDlg.cpp 2010-07-05 22:56:28 UTC (rev 826)
@@ -31,40 +31,40 @@
//Number according to nearest msg OR nearest numbered msg
if(GetRegistry<bool>(GetRegistryFolder(), NULL, _T("AutoEnumType"), 0))
- m_nearestNumberedMsg.SetCheck(BST_CHECKED);
+ m_nearestNumberedMsg.SetCheck(BST_CHECKED);
else
{
- m_nearestMsg.SetCheck(BST_CHECKED);
- EnableNearestNumberedMsgControls(false);
+ m_nearestMsg.SetCheck(BST_CHECKED);
+ EnableNearestNumberedMsgControls(false);
}
//don't number OR use numbering style
if(GetRegistry<bool>(GetRegistryFolder(), NULL, _T("AutoEnumStyleEnabled"), 0))
- m_useNumberingStyle.SetCheck(BST_CHECKED);
+ m_useNumberingStyle.SetCheck(BST_CHECKED);
else
- m_dontNumber.SetCheck(BST_CHECKED);
+ m_dontNumber.SetCheck(BST_CHECKED);
//Numbering type
- m_numberingTypeCombo.SetCurSel(GetRegistry<int>(GetRegistryFolder(), NULL, _T("AutoEnumStyleNumType"), 0));
+ m_numberingTypeCombo.SetCurSel((m_iNumberingTypeCombo = GetRegistry<int>(GetRegistryFolder(), NULL, _T("AutoEnumStyleNumType"), 0)));
//Numbering index
- std::wstring strIndex = stringize() << GetRegistry<int>(GetRegistryFolder(), NULL, _T("AutoEnumStyleIndex"), 1);
+ std::wstring strIndex = stringize() << (m_iIndex = GetRegistry<int>(GetRegistryFolder(), NULL, _T("AutoEnumStyleIndex"), 1));
m_index.SetWindowText(strIndex.c_str());
//Addition string
HKEY hKey;
if(RegCreateKey(HKEY_CURRENT_USER, GetRegistryFolder(),&hKey) != ERROR_SUCCESS)
{
- MessageBox(_T("Failed load key for addition string!"));
- return FALSE;
+ MessageBox(_T("Failed load key for addition string!"));
+ return FALSE;
}
DWORD dwType = 0;
wchar_t buffer[5] = {0};
DWORD dwSize = sizeof(buffer);
if(RegQueryValueEx(hKey,_T("AutoEnumStyleAddition"),0,&dwType, (LPBYTE)buffer, &dwSize) == ERROR_SUCCESS)
- m_addition.SetWindowText(_bstr_t(buffer));
+ m_addition.SetWindowText((m_szAddition = _bstr_t(buffer)));
else
- m_addition.SetWindowText(_T(". "));
+ m_addition.SetWindowText(m_szAddition = _T("."));
RegCloseKey(hKey);
@@ -88,34 +88,38 @@
if(index <= 0 || index > 9999)
{
MessageBox(_T("Starting index must be in range of 1-9999!"), _T("Error"), MB_OK | MB_ICONERROR);
- return PSNRET_INVALID;
+ return PSNRET_INVALID;
}
if(index > 3999 && m_numberingTypeCombo.GetCurSel() == 1)
{
MessageBox(_T("Index too big! Use another type of enumeration. Roman index can be from 0-3999."),
_T("Error"),MB_OK | MB_ICONERROR);
- return PSNRET_INVALID;
+ return PSNRET_INVALID;
}
if(bResult)
{
- SetRegistry<bool>(HKEY_CURRENT_USER, GetRegistryFolder(), _T("AutoEnum"), m_bAutoEnum);
- SetRegistry<bool>(HKEY_CURRENT_USER, GetRegistryFolder(), _T("AutoEnumType"),m_nearestNumberedMsg.GetCheck() == BST_CHECKED);
- SetRegistry<bool>(HKEY_CURRENT_USER, GetRegistryFolder(), _T("AutoEnumStyleEnabled"),m_useNumberingStyle.GetCheck() == BST_CHECKED);
- SetRegistry<int>(HKEY_CURRENT_USER, GetRegistryFolder(), _T("AutoEnumStyleNumType"),m_numberingTypeCombo.GetCurSel());
- SetRegistry<int>(HKEY_CURRENT_USER, GetRegistryFolder(), _T("AutoEnumStyleIndex"),index);
-
- //Store addition string
- m_addition.GetWindowTextW(temp);
- if(!temp) temp = _T("");
- HKEY hKey;
- if(RegCreateKey(HKEY_CURRENT_USER, GetRegistryFolder(), &hKey) != ERROR_SUCCESS)
- MessageBox(_T("Failed to create key for addition string!"));
- else if(RegSetValueEx(hKey,_T("AutoEnumStyleAddition"),0, REG_SZ, (CONST LPBYTE)temp, 2*sizeof(BSTR)) != ERROR_SUCCESS)
- MessageBox(_T("Failed to set registry key for addition string!"));
- RegCloseKey(hKey);
+ SetRegistry<bool>(HKEY_CURRENT_USER, GetRegistryFolder(), _T("AutoEnum"), m_bAutoEnum);
+ SetRegistry<bool>(HKEY_CURRENT_USER, GetRegistryFolder(), _T("AutoEnumType"),m_nearestNumberedMsg.GetCheck() == BST_CHECKED);
+ SetRegistry<bool>(HKEY_CURRENT_USER, GetRegistryFolder(), _T("AutoEnumStyleEnabled"),m_useNumberingStyle.GetCheck() == BST_CHECKED);
+ SetRegistry<int>(HKEY_CURRENT_USER, GetRegistryFolder(), _T("AutoEnumStyleNumType"),m_numberingTypeCombo.GetCurSel());
+ SetRegistry<int>(HKEY_CURRENT_USER, GetRegistryFolder(), _T("AutoEnumStyleIndex"),index);
+
+ //Store addition string
+ m_addition.GetWindowTextW(temp);
+ if(!temp) temp = _T("");
+ HKEY hKey;
+ if(RegCreateKey(HKEY_CURRENT_USER, GetRegistryFolder(), &hKey) != ERROR_SUCCESS)
+ MessageBox(_T("Failed to create key for addition string!"));
+ else if(RegSetValueEx(hKey,_T("AutoEnumStyleAddition"),0, REG_SZ, (CONST LPBYTE)temp, 2*sizeof(BSTR)) != ERROR_SUCCESS)
+ MessageBox(_T("Failed to set registry key for addition string!"));
+ RegCloseKey(hKey);
- return PSNRET_NOERROR;
+ //If numbering style changed, erase autoNumberingGroupID -> force creating new autoNumbering style
+ if((_tcsicmp(temp,m_szAddition) != 0) || (m_iIndex != index) || m_iNumberingTypeCombo != m_numberingTypeCombo.GetCurSel())
+ SetRegistry<bool>(HKEY_CURRENT_USER, GetRegistryFolder(), _T("AutoEnumStyleIndexChanged"), true);
+
+ return PSNRET_NOERROR;
}
return PSNRET_INVALID;
Modified: trunk/src/view/visio/addon/numberingGlobalDlg.h
===================================================================
--- trunk/src/view/visio/addon/numberingGlobalDlg.h 2010-07-04 14:02:59 UTC (rev 825)
+++ trunk/src/view/visio/addon/numberingGlobalDlg.h 2010-07-05 22:56:28 UTC (rev 826)
@@ -67,6 +67,9 @@
CEdit m_index;
bool m_bAutoEnum;
+ int m_iNumberingTypeCombo;
+ int m_iIndex;
+ _bstr_t m_szAddition;
LRESULT OnBnClickedEnumCheck(WORD, WORD, HWND, BOOL&);
LRESULT OnBnClickedNearestMsg(WORD, WORD, HWND, BOOL&);
Modified: trunk/src/view/visio/addon/resource.h
===================================================================
--- trunk/src/view/visio/addon/resource.h 2010-07-04 14:02:59 UTC (rev 825)
+++ trunk/src/view/visio/addon/resource.h 2010-07-05 22:56:28 UTC (rev 826)
@@ -100,6 +100,7 @@
#define IDC_COMBO_NUMBERING_GLOBAL 276
#define IDC_ADDITION_GLOBAL 277
#define IDC_STARTING_INDEX_GLOBAL 278
+#define IDC_CHECK1 279
// Next default values for new objects
//
@@ -107,7 +108,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 227
#define _APS_NEXT_COMMAND_VALUE 32768
-#define _APS_NEXT_CONTROL_VALUE 279
+#define _APS_NEXT_CONTROL_VALUE 280
#define _APS_NEXT_SYMED_VALUE 105
#endif
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mbe...@us...> - 2010-07-06 19:26:29
|
Revision: 827
http://scstudio.svn.sourceforge.net/scstudio/?rev=827&view=rev
Author: mbezdeka
Date: 2010-07-06 19:26:23 +0000 (Tue, 06 Jul 2010)
Log Message:
-----------
Message numbering - bugs fixed
Modified Paths:
--------------
trunk/doc/help/frontend/message-numbering.html
trunk/src/view/visio/addon/addon.cpp
trunk/src/view/visio/addon/document.cpp
trunk/src/view/visio/addon/document.h
trunk/src/view/visio/addon/document_check.cpp
trunk/src/view/visio/addon/enumerateUtils.cpp
trunk/src/view/visio/addon/enumerateUtils.h
Modified: trunk/doc/help/frontend/message-numbering.html
===================================================================
--- trunk/doc/help/frontend/message-numbering.html 2010-07-05 22:56:28 UTC (rev 826)
+++ trunk/doc/help/frontend/message-numbering.html 2010-07-06 19:26:23 UTC (rev 827)
@@ -19,8 +19,8 @@
<p>You can choose:<br/>
- specific numbering type (numbers, letters, capital letters, romans)<br/>
-- starting index (1-9999)<br/>
-- and additional string following the index such as ".", "-", … (max 4 chars)<br/>
+- starting index (1-9999 for number, letters and capital letters and 1-3999 for romans)<br/>
+- and additional string following the index such as ".", "-", … (max 4 chars). A space between the index and the message label is added automatically.<br/>
</p>
<p>
Modified: trunk/src/view/visio/addon/addon.cpp
===================================================================
--- trunk/src/view/visio/addon/addon.cpp 2010-07-05 22:56:28 UTC (rev 826)
+++ trunk/src/view/visio/addon/addon.cpp 2010-07-06 19:26:23 UTC (rev 827)
@@ -54,7 +54,7 @@
const unsigned short visEvtConnectionsDeleted = Visio::visEvtDel | Visio::visEvtConnect;
CStudioAddon::CStudioAddon(LPCTSTR pName, UINT uIDLocalName)
- : VAddon(VAO_AOATTS_ISACTION | VAO_AOATTS_HASABOUT, VAO_ENABLEALWAYS, 0, 0, pName, uIDLocalName)
+: VAddon(VAO_AOATTS_ISACTION | VAO_AOATTS_HASABOUT, VAO_ENABLEALWAYS, 0, 0, pName, uIDLocalName)
{
m_pIAddonSink = NULL;
m_keyButtonState = 0;
@@ -206,30 +206,30 @@
switch(args.OptionId())
{
- case OPT_VISIO:
- iVisio = _tstol(args.OptionArg());
- break;
- case OPT_EVENT:
- iEvent = _tstol(args.OptionArg());
- break;
- case OPT_EVENTID:
- // FIXME: what is this parameter for?
- break;
- case OPT_DOC:
- iDocumentIndex = _tstol(args.OptionArg());
- break;
- case OPT_PAGE:
- iPageIndex = _tstol(args.OptionArg());
- break;
- case OPT_SHAPE:
- sShape = args.OptionArg();
- break;
- case OPT_SHAPEU:
- sShapeU = args.OptionArg();
- break;
- default:
- TRACE("CStudioAddon::Run() unexpected argument id=" << args.OptionId());
- break;
+ case OPT_VISIO:
+ iVisio = _tstol(args.OptionArg());
+ break;
+ case OPT_EVENT:
+ iEvent = _tstol(args.OptionArg());
+ break;
+ case OPT_EVENTID:
+ // FIXME: what is this parameter for?
+ break;
+ case OPT_DOC:
+ iDocumentIndex = _tstol(args.OptionArg());
+ break;
+ case OPT_PAGE:
+ iPageIndex = _tstol(args.OptionArg());
+ break;
+ case OPT_SHAPE:
+ sShape = args.OptionArg();
+ break;
+ case OPT_SHAPEU:
+ sShapeU = args.OptionArg();
+ break;
+ default:
+ TRACE("CStudioAddon::Run() unexpected argument id=" << args.OptionId());
+ break;
}
}
free(cmdline);
@@ -260,84 +260,84 @@
// execute the relevant event handler
switch(iEvent)
{
- case 1: // DocumentCreate
- case 2: // DocumentOpen
- return VAORC_SUCCESS;
+ case 1: // DocumentCreate
+ case 2: // DocumentOpen
+ return VAORC_SUCCESS;
// 1xx events
// note: to keep stencil compatibility, the 1xx events must not be renumbered
- case 100:
- TRACE("CStudioAddon::Run() stencil event 'OnDrop'");
- return pDocumentMonitor->OnDropShape(iDocumentIndex, iPageIndex, sShapeU);
- case 101:
- TRACE("CStudioAddon::Run() reference action 'Open Reference'");
- return pDocumentMonitor->OnOpenReference(iDocumentIndex, iPageIndex, sShapeU);
- case CDocumentMonitor::MENU_ADD_INSTANCES: // 102
- TRACE("CStudioAddon::Run() menu item 'Check--Drawing--Add Instances'");
- return DoInstancesField(pDocumentMonitor, vsoApp);
- case CDocumentMonitor::MENU_MESSAGE_SEQUENCE: // 103
- TRACE("CStudioAddon::Run() menu item 'Check--Drawing--Message Sequence'");
- return pDocumentMonitor->OnMenuMessageSequence(vsoApp);
- case CDocumentMonitor::MENU_SELECT_NUMBERED_GROUP: //104
- TRACE("CStudioAddon::Run() menu item 'context menu - select numbering group'");
- return pDocumentMonitor->OnMenuSelectNumberedGroup(vsoApp);
+ case 100:
+ TRACE("CStudioAddon::Run() stencil event 'OnDrop'");
+ return pDocumentMonitor->OnDropShape(iDocumentIndex, iPageIndex, sShapeU);
+ case 101:
+ TRACE("CStudioAddon::Run() reference action 'Open Reference'");
+ return pDocumentMonitor->OnOpenReference(iDocumentIndex, iPageIndex, sShapeU);
+ case CDocumentMonitor::MENU_ADD_INSTANCES: // 102
+ TRACE("CStudioAddon::Run() menu item 'Check--Drawing--Add Instances'");
+ return DoInstancesField(pDocumentMonitor, vsoApp);
+ case CDocumentMonitor::MENU_MESSAGE_SEQUENCE: // 103
+ TRACE("CStudioAddon::Run() menu item 'Check--Drawing--Message Sequence'");
+ return pDocumentMonitor->OnMenuMessageSequence(vsoApp);
+ case CDocumentMonitor::MENU_SELECT_NUMBERED_GROUP: //104
+ TRACE("CStudioAddon::Run() menu item 'context menu - select numbering group'");
+ return pDocumentMonitor->OnMenuSelectNumberedGroup(vsoApp);
// 2xx events
- case CDocumentMonitor::MENU_WINDOWS_REPORTER:
- TRACE("CStudioAddon::Run() menu item 'Check--Windows--Verification Report'");
- return pDocumentMonitor->OnMenuWindowsReporter(vsoApp);
- case CDocumentMonitor::MENU_IMPORT:
- TRACE("CStudioAddon::Run() menu item 'Check--Drawing--Import'");
- return pDocumentMonitor->OnMenuImport(vsoApp);
- case CDocumentMonitor::MENU_EXPORT:
- TRACE("CStudioAddon::Run() menu item 'Check--Drawing--Export'");
- return pDocumentMonitor->OnMenuExport(vsoApp);
- case CDocumentMonitor::MENU_REPAINT:
- TRACE("CStudioAddon::Run() menu item 'Check--Drawing--Repaint'");
- return pDocumentMonitor->OnMenuRepaint(vsoApp);
- case CDocumentMonitor::MENU_FIND_FLOW:
- TRACE("CStudioAddon::Run() menu item 'Check--Drawing--Find Flow'");
- return pDocumentMonitor->OnMenuFindFlow(vsoApp);
- case CDocumentMonitor::MENU_SIMULATION_START:
- TRACE("CStudioAddon::Run() menu item 'Check--Start Simulation'");
- return pDocumentMonitor->OnMenuSimulationStart(vsoApp);
- case CDocumentMonitor::MENU_SIMULATION_STOP:
- TRACE("CStudioAddon::Run() menu item 'Check--Stop Simulation'");
- return pDocumentMonitor->OnMenuSimulationStop(vsoApp);
- case CDocumentMonitor::MENU_SIMULATOR_OPTIONS:
- TRACE("CStudioAddon::Run() menu item 'Check--Simulator Options'");
- return DisplaySimulatorOptions();
- case CDocumentMonitor::MENU_VERIFY:
- TRACE("CStudioAddon::Run() menu item 'Check--Verify'");
- return pDocumentMonitor->OnMenuVerify(vsoApp);
- case CDocumentMonitor::MENU_CHECK_OPTIONS:
- TRACE("CStudioAddon::Run() menu item 'Check--Options'");
- return DisplayCheckOptions();
- case CDocumentMonitor::MENU_SELECT_ALL_INSTANCES:
- TRACE("CStudioAddon::Run() menu item 'Check--Drawing--Select--All Instances'");
- return pDocumentMonitor->OnMenuSelectAllInstances(vsoApp, SELECTION_REPLACE);
- case CDocumentMonitor::MENU_SELECT_ALL_MESSAGES:
- TRACE("CStudioAddon::Run() menu item 'Check--Drawing--Select--All Messages'");
- return pDocumentMonitor->OnMenuSelectAllMessages(vsoApp, SELECTION_REPLACE);
- case CDocumentMonitor::MENU_SELECT_ADD_ALL_INSTANCES:
- TRACE("CStudioAddon::Run() add all instances to the current selection");
- return pDocumentMonitor->OnMenuSelectAllInstances(vsoApp, SELECTION_ADD);
- case CDocumentMonitor::MENU_SELECT_ADD_ALL_MESSAGES:
- TRACE("CStudioAddon::Run() add all messages to the current selection");
- return pDocumentMonitor->OnMenuSelectAllMessages(vsoApp, SELECTION_ADD);
- case CDocumentMonitor::MENU_ENABLE_MESSAGE_ENUMERATION:
- TRACE("CStudioAddon::Run() enable message enumeration");
- return pDocumentMonitor->OnMenuEnableMessageEnumeration(vsoApp);
- case CDocumentMonitor::MENU_DISABLE_MESSAGE_ENUMERATION:
- TRACE("CStudioAddon::Run() disable message enumeration");
- return pDocumentMonitor->OnMenuDisableMessageEnumeration(vsoApp);
- case CDocumentMonitor::MENU_GLOBAL_SETTINGS:
- TRACE("CStudioAddon::Run() global settings");
- return pDocumentMonitor->OnMenuGlobalSettings(vsoApp);
+ case CDocumentMonitor::MENU_WINDOWS_REPORTER:
+ TRACE("CStudioAddon::Run() menu item 'Check--Windows--Verification Report'");
+ return pDocumentMonitor->OnMenuWindowsReporter(vsoApp);
+ case CDocumentMonitor::MENU_IMPORT:
+ TRACE("CStudioAddon::Run() menu item 'Check--Drawing--Import'");
+ return pDocumentMonitor->OnMenuImport(vsoApp);
+ case CDocumentMonitor::MENU_EXPORT:
+ TRACE("CStudioAddon::Run() menu item 'Check--Drawing--Export'");
+ return pDocumentMonitor->OnMenuExport(vsoApp);
+ case CDocumentMonitor::MENU_REPAINT:
+ TRACE("CStudioAddon::Run() menu item 'Check--Drawing--Repaint'");
+ return pDocumentMonitor->OnMenuRepaint(vsoApp);
+ case CDocumentMonitor::MENU_FIND_FLOW:
+ TRACE("CStudioAddon::Run() menu item 'Check--Drawing--Find Flow'");
+ return pDocumentMonitor->OnMenuFindFlow(vsoApp);
+ case CDocumentMonitor::MENU_SIMULATION_START:
+ TRACE("CStudioAddon::Run() menu item 'Check--Start Simulation'");
+ return pDocumentMonitor->OnMenuSimulationStart(vsoApp);
+ case CDocumentMonitor::MENU_SIMULATION_STOP:
+ TRACE("CStudioAddon::Run() menu item 'Check--Stop Simulation'");
+ return pDocumentMonitor->OnMenuSimulationStop(vsoApp);
+ case CDocumentMonitor::MENU_SIMULATOR_OPTIONS:
+ TRACE("CStudioAddon::Run() menu item 'Check--Simulator Options'");
+ return DisplaySimulatorOptions();
+ case CDocumentMonitor::MENU_VERIFY:
+ TRACE("CStudioAddon::Run() menu item 'Check--Verify'");
+ return pDocumentMonitor->OnMenuVerify(vsoApp);
+ case CDocumentMonitor::MENU_CHECK_OPTIONS:
+ TRACE("CStudioAddon::Run() menu item 'Check--Options'");
+ return DisplayCheckOptions();
+ case CDocumentMonitor::MENU_SELECT_ALL_INSTANCES:
+ TRACE("CStudioAddon::Run() menu item 'Check--Drawing--Select--All Instances'");
+ return pDocumentMonitor->OnMenuSelectAllInstances(vsoApp, SELECTION_REPLACE);
+ case CDocumentMonitor::MENU_SELECT_ALL_MESSAGES:
+ TRACE("CStudioAddon::Run() menu item 'Check--Drawing--Select--All Messages'");
+ return pDocumentMonitor->OnMenuSelectAllMessages(vsoApp, SELECTION_REPLACE);
+ case CDocumentMonitor::MENU_SELECT_ADD_ALL_INSTANCES:
+ TRACE("CStudioAddon::Run() add all instances to the current selection");
+ return pDocumentMonitor->OnMenuSelectAllInstances(vsoApp, SELECTION_ADD);
+ case CDocumentMonitor::MENU_SELECT_ADD_ALL_MESSAGES:
+ TRACE("CStudioAddon::Run() add all messages to the current selection");
+ return pDocumentMonitor->OnMenuSelectAllMessages(vsoApp, SELECTION_ADD);
+ case CDocumentMonitor::MENU_ENABLE_MESSAGE_ENUMERATION:
+ TRACE("CStudioAddon::Run() enable message enumeration");
+ return pDocumentMonitor->OnMenuEnableMessageEnumeration(vsoApp);
+ case CDocumentMonitor::MENU_DISABLE_MESSAGE_ENUMERATION:
+ TRACE("CStudioAddon::Run() disable message enumeration");
+ return pDocumentMonitor->OnMenuDisableMessageEnumeration(vsoApp);
+ case CDocumentMonitor::MENU_GLOBAL_SETTINGS:
+ TRACE("CStudioAddon::Run() global settings");
+ return pDocumentMonitor->OnMenuGlobalSettings(vsoApp);
- default:
- TRACE("CStudioAddon::Run() unexpected event id=" << iEvent);
- return VAORC_FAILURE;
+ default:
+ TRACE("CStudioAddon::Run() unexpected event id=" << iEvent);
+ return VAORC_FAILURE;
}
}
}
@@ -416,16 +416,16 @@
CPageUtils::ConvertUnits(vsoApp, dlg.m_instance_width, visPageUnits, visMillimeters),
CPageUtils::ConvertUnits(vsoApp, dlg.m_start_pos_x, visPageUnits, visMillimeters),
CPageUtils::ConvertUnits(vsoApp,
- (CPageUtils::GetPageHeight(vsoApp->ActivePage) - dlg.m_start_pos_y), // the drawing y-coordinates are upside down
- visPageUnits, visMillimeters),
+ (CPageUtils::GetPageHeight(vsoApp->ActivePage) - dlg.m_start_pos_y), // the drawing y-coordinates are upside down
+ visPageUnits, visMillimeters),
dlg.m_use_const_spacing,
CPageUtils::ConvertUnits(vsoApp, (dlg.m_use_const_spacing ? dlg.m_spacing : dlg.m_total_width), visPageUnits, visMillimeters)
);
}
HRESULT CStudioAddon::HandleVisioEvent(
- IUnknown *ipSink, short nEventCode, IDispatch *pSourceObj, long nEventID,
- long nEventSeqNum, IDispatch *pSubjectObj, VARIANT vMoreInfo, VARIANT *pvResult)
+ IUnknown *ipSink, short nEventCode, IDispatch *pSourceObj, long nEventID,
+ long nEventSeqNum, IDispatch *pSubjectObj, VARIANT vMoreInfo, VARIANT *pvResult)
{
try
{
@@ -438,78 +438,78 @@
unsigned short event = nEventCode;
switch (event)
{
- case visEvtBeforeDocumentClose:
- TRACE("CStudioAddon::HandleVisioEvent() visEvtBeforeDocumentClose");
- break;
- case visEvtPageAdded:
- TRACE("CStudioAddon::HandleVisioEvent() visEvtPageAdded");
- break;
+ case visEvtBeforeDocumentClose:
+ TRACE("CStudioAddon::HandleVisioEvent() visEvtBeforeDocumentClose");
+ break;
+ case visEvtPageAdded:
+ TRACE("CStudioAddon::HandleVisioEvent() visEvtPageAdded");
+ break;
- case visEvtCellChanged:
- HandleCellChanged(pSubjectObj);
- break;
+ case visEvtCellChanged:
+ HandleCellChanged(pSubjectObj);
+ break;
- case visEvtConnectionsAdded:
- TRACE("CStudioAddon::HandleVisioEvent() visEvtConnectionsAdded");
- HandleConnectionsAdded(pSubjectObj);
- break;
- case visEvtConnectionsDeleted:
- TRACE("CStudioAddon::HandleVisioEvent() visEvtConnectionsDeleted");
- break;
+ case visEvtConnectionsAdded:
+ TRACE("CStudioAddon::HandleVisioEvent() visEvtConnectionsAdded");
+ HandleConnectionsAdded(pSubjectObj);
+ break;
+ case visEvtConnectionsDeleted:
+ TRACE("CStudioAddon::HandleVisioEvent() visEvtConnectionsDeleted");
+ break;
- case visEvtApp|visEvtMarker:
- TRACE("CStudioAddon::HandleVisioEvent() visEvtMarker");
- HandleMarker(pSubjectObj);
- break;
-
- case Visio::visEvtCodeKeyDown:
- TRACE("CStudioAddon::HandleVisioEvent() visEvtCodeKeyDown");
- HandleKeyDown(pSubjectObj, pSourceObj);
- break;
+ case visEvtApp|visEvtMarker:
+ TRACE("CStudioAddon::HandleVisioEvent() visEvtMarker");
+ HandleMarker(pSubjectObj);
+ break;
- case Visio::visEvtCodeKeyUp:
- TRACE("CStudioAddon::HandleVisioEvent() visEvtCodeKeyUp");
- HandleKeyUp(pSubjectObj, pSourceObj);
- break;
+ case Visio::visEvtCodeKeyDown:
+ TRACE("CStudioAddon::HandleVisioEvent() visEvtCodeKeyDown");
+ HandleKeyDown(pSubjectObj, pSourceObj);
+ break;
- case Visio::visEvtCodeMouseMove:
- //TRACE("CStudioAddon::HandleVisioEvent() visEvtCodeMouseMove");
- HandleMouseMove(pSubjectObj, pSourceObj);
- break;
+ case Visio::visEvtCodeKeyUp:
+ TRACE("CStudioAddon::HandleVisioEvent() visEvtCodeKeyUp");
+ HandleKeyUp(pSubjectObj, pSourceObj);
+ break;
- case Visio::visEvtCodeWinSelChange:
- TRACE("CStudioAddon::HandleVisioEvent() visEvtCodeWinSelChange");
- HandleWinSelChange(pSourceObj);
- break;
+ case Visio::visEvtCodeMouseMove:
+ //TRACE("CStudioAddon::HandleVisioEvent() visEvtCodeMouseMove");
+ HandleMouseMove(pSubjectObj, pSourceObj);
+ break;
- case Visio::visEvtCodeShapeBeforeTextEdit:
- TRACE("CStudioAddon::HandleVisioEvent() visEvtCodeShapeBeforeTextEdit");
- HandleBeforeTextEdit(pSubjectObj, pSourceObj);
- break;
+ case Visio::visEvtCodeWinSelChange:
+ TRACE("CStudioAddon::HandleVisioEvent() visEvtCodeWinSelChange");
+ HandleWinSelChange(pSourceObj);
+ break;
- case Visio::visEvtCodeShapeExitTextEdit:
- TRACE("CStudioAddon::HandleVisioEvent() visEvtCodeShapeExitTextEdit");
- HandleAfterTextEdit(pSubjectObj, pSourceObj);
- break;
+ case Visio::visEvtCodeShapeBeforeTextEdit:
+ TRACE("CStudioAddon::HandleVisioEvent() visEvtCodeShapeBeforeTextEdit");
+ HandleBeforeTextEdit(pSubjectObj, pSourceObj);
+ break;
- case Visio::visEvtDel+Visio::visEvtShape:
- TRACE("CStudioAddon::HandleVisioEvent() visEvtCodeShapeDelete");
- HandleBeforeShapeDeleted(pSubjectObj, pSourceObj);
- break;
+ case Visio::visEvtCodeShapeExitTextEdit:
+ TRACE("CStudioAddon::HandleVisioEvent() visEvtCodeShapeExitTextEdit");
+ HandleAfterTextEdit(pSubjectObj, pSourceObj);
+ break;
- case visEvtApp+visEvtNonePending:
- TRACE("CStudioAddon::HandleVisioEvent() visEvtNonePending");
- HandleNonePending(pSourceObj);
- break;
+ case Visio::visEvtDel+Visio::visEvtShape:
+ TRACE("CStudioAddon::HandleVisioEvent() visEvtCodeShapeDelete");
+ HandleBeforeShapeDeleted(pSubjectObj, pSourceObj);
+ break;
- case visEvtMod+visEvtText:
- HandleTextChanged(pSubjectObj,pSourceObj);
- break;
+ case visEvtApp+visEvtNonePending:
+ TRACE("CStudioAddon::HandleVisioEvent() visEvtNonePending");
+ HandleNonePending(pSourceObj);
+ break;
- default:
- TRACE("CStudioAddon::HandleVisioEvent() unexpected event id="
- << std::ios::hex << event);
- break;
+ case visEvtMod+visEvtText:
+ HandleTextChanged(pSubjectObj,pSourceObj);
+ break;
+
+ default:
+ TRACE("CStudioAddon::HandleVisioEvent() unexpected event id="
+ << std::ios::hex << event);
+ break;
}
return NOERROR;
@@ -545,18 +545,18 @@
if(get_shape_type(fromConnect->FromSheet) == ST_BMSC_COREGION)
fromConnect->FromSheet->CellsSRC[visSectionObject][visRowXFormOut][visXFormHeight]->ResultIU = value*2;
}
- }
+ }
}
//Message enumeration
if((_tcsicmp(vsoCell->Name,_T("PinX")) == 0 || _tcsicmp(vsoCell->Name,_T("PinY")) == 0) &&
- (GetDocumentMonitor(vsoCell->Application,vsoCell->Application->ActiveDocument)->isMessageShape(vsoCell->Shape)) &&
- (_tcsicmp(vsoCell->Shape->Data1,_T("1")) == 0))
- {
- //add to set
- m_enumerationGroups.insert(vsoCell->Shape->Data3);
- m_bCellChanged = true;
- }
+ (GetDocumentMonitor(vsoCell->Application,vsoCell->Application->ActiveDocument)->isMessageShape(vsoCell->Shape)) &&
+ (_tcsicmp(vsoCell->Shape->Data1,_T("1")) == 0))
+ {
+ //add to set
+ m_enumerationGroups.insert(vsoCell->Shape->Data3);
+ m_bCellChanged = true;
+ }
}
void CStudioAddon::HandleConnectionsAdded(Visio::IVConnectsPtr vsoConnects)
@@ -652,47 +652,63 @@
void CStudioAddon::HandleNonePending(Visio::IVApplicationPtr vsoApp)
{
- if(m_bShapeDeleted || m_bCellChanged)
- {
- Visio::IVShapesPtr shapesPtr = vsoApp->ActivePage->Shapes;
+ if(m_bShapeDeleted || m_bCellChanged)
+ {
+ Visio::IVShapesPtr shapesPtr = vsoApp->ActivePage->Shapes;
+ CDocumentMonitor* docMon = GetDocumentMonitor(vsoApp,vsoApp->ActiveDocument);
- for(std::set<_bstr_t>::iterator it = m_enumerationGroups.begin(); it != m_enumerationGroups.end(); it++)
- GetDocumentMonitor(vsoApp,vsoApp->ActiveDocument)->drawNumbers(shapesPtr,*it);
+ for(std::set<_bstr_t>::iterator it = m_enumerationGroups.begin(); it != m_enumerationGroups.end(); it++)
+ docMon->drawNumbers(shapesPtr,*it);
- m_enumerationGroups.clear();
+ m_enumerationGroups.clear();
- m_bShapeDeleted = m_bCellChanged = false;
- }
+ //Check whether there are still some numbered messages, otherwise erase enum info
+ bool bNumberedMsg = false;
+ for(int i=1; i<=vsoApp->ActivePage->Shapes->Count; i++)
+ {
+ Visio::IVShapePtr shape = vsoApp->ActivePage->Shapes->Item[i];
+ if(docMon->isMessageShape(shape) && _tcsicmp(shape->Data1,_T("1")) == 0)
+ {
+ bNumberedMsg = true;
+ break;
+ }
+ }
+ if(!bNumberedMsg)
+ CEnumerateUtils::eraseEnumInfo(vsoApp);
+
+ //Set variables to false to prevent this function from loop
+ m_bShapeDeleted = m_bCellChanged = false;
+ }
}
void CStudioAddon::HandleBeforeTextEdit(Visio::IVShapePtr shapePtr, Visio::IVApplicationPtr vsoApp)
{
- if(GetDocumentMonitor(vsoApp,vsoApp->ActiveDocument)->isMessageShape(shapePtr) && _tcsicmp(shapePtr->Data1,_T("1")) == 0)
- {
- GetDocumentMonitor(vsoApp,vsoApp->ActiveDocument)->ToogleNumeration(false);
- shapePtr->Text = shapePtr->Data2;
- m_bMessageTextEdited = true;
- }
+ if(GetDocumentMonitor(vsoApp,vsoApp->ActiveDocument)->isMessageShape(shapePtr) && _tcsicmp(shapePtr->Data1,_T("1")) == 0)
+ {
+ GetDocumentMonitor(vsoApp,vsoApp->ActiveDocument)->ToogleNumeration(false);
+ shapePtr->Text = shapePtr->Data2;
+ m_bMessageTextEdited = true;
+ }
}
void CStudioAddon::HandleAfterTextEdit(Visio::IVShapePtr shapePtr, Visio::IVApplicationPtr vsoApp)
{
- if(m_bMessageTextEdited)
- {
- shapePtr->Data2 = shapePtr->Text;
- GetDocumentMonitor(vsoApp,vsoApp->ActiveDocument)->drawNumbers(vsoApp->ActivePage->Shapes, shapePtr->Data3);
- m_bMessageTextEdited = false;
- }
- GetDocumentMonitor(vsoApp,vsoApp->ActiveDocument)->ToogleNumeration(true);
+ if(m_bMessageTextEdited)
+ {
+ shapePtr->Data2 = shapePtr->Text;
+ GetDocumentMonitor(vsoApp,vsoApp->ActiveDocument)->drawNumbers(vsoApp->ActivePage->Shapes, shapePtr->Data3);
+ m_bMessageTextEdited = false;
+ }
+ GetDocumentMonitor(vsoApp,vsoApp->ActiveDocument)->ToogleNumeration(true);
}
void CStudioAddon::HandleBeforeShapeDeleted(Visio::IVShapePtr shapePtr, Visio::IVApplicationPtr vsoApp)
{
- if(GetDocumentMonitor(vsoApp,vsoApp->ActiveDocument)->isMessageShape(shapePtr) && _tcsicmp(shapePtr->Data1,_T("1")) == 0)
- {
- m_enumerationGroups.insert(shapePtr->Data3);
- m_bShapeDeleted = true;
- }
+ if(GetDocumentMonitor(vsoApp,vsoApp->ActiveDocument)->isMessageShape(shapePtr) && _tcsicmp(shapePtr->Data1,_T("1")) == 0)
+ {
+ m_enumerationGroups.insert(shapePtr->Data3);
+ m_bShapeDeleted = true;
+ }
}
void CStudioAddon::HandleTextChanged(Visio::IVShapePtr shapePtr,Visio::IVDocumentPtr vsoDocument)
@@ -770,11 +786,11 @@
vsoApp->EventList->AddAdvise(Visio::visEvtCodeKeyDown, varSink, _T(""), _T("KeyDown"));
vsoApp->EventList->AddAdvise(Visio::visEvtCodeKeyUp, varSink, _T(""), _T("KeyUp"));
vsoApp->EventList->AddAdvise(Visio::visEvtCodeMouseMove, varSink, _T(""), _T("MouseMove"));
- // Message enumeration events
- vsoApp->EventList->AddAdvise(Visio::visEvtCodeShapeBeforeTextEdit, varSink, _T(""), _T("BeforeTextEdit"));
- vsoApp->EventList->AddAdvise(Visio::visEvtCodeShapeExitTextEdit, varSink, _T(""), _T("AfterTextEdit"));
- vsoApp->EventList->AddAdvise(visEvtApp+visEvtNonePending, varSink, _T(""), _T("NonePending"));
- vsoApp->EventList->AddAdvise(visEvtDel+visEvtShape, varSink, _T(""), _T("ShapeDeleted"));
+ // Message enumeration events
+ vsoApp->EventList->AddAdvise(Visio::visEvtCodeShapeBeforeTextEdit, varSink, _T(""), _T("BeforeTextEdit"));
+ vsoApp->EventList->AddAdvise(Visio::visEvtCodeShapeExitTextEdit, varSink, _T(""), _T("AfterTextEdit"));
+ vsoApp->EventList->AddAdvise(visEvtApp+visEvtNonePending, varSink, _T(""), _T("NonePending"));
+ vsoApp->EventList->AddAdvise(visEvtDel+visEvtShape, varSink, _T(""), _T("ShapeDeleted"));
vsoApp->EventList->AddAdvise(visEvtCodeWinSelChange, varSink, _T(""), _T("SelectionChanges"));
@@ -791,7 +807,7 @@
vsoEvent = vsoDocumentEventList->AddAdvise(visEvtPageAdded, varSink, _T(""), _T(""));
pDocumentMonitor->m_vsoPageAddedEvent = vsoEvent;
- vsoDocumentEventList->AddAdvise(visEvtMod+visEvtText, varSink, _T(""), _T("TextChanged"));
+ vsoDocumentEventList->AddAdvise(visEvtMod+visEvtText, varSink, _T(""), _T("TextChanged"));
vsoDocumentEventList->AddAdvise(visEvtCellChanged, varSink, _T(""), _T("CellChanged"));
vsoDocumentEventList->AddAdvise(visEvtConnectionsAdded, varSink, _T(""), _T("ConnectionsAdded"));
vsoDocumentEventList->AddAdvise(visEvtConnectionsDeleted, varSink, _T(""), _T("ConnectionsDeleted"));
Modified: trunk/src/view/visio/addon/document.cpp
===================================================================
--- trunk/src/view/visio/addon/document.cpp 2010-07-05 22:56:28 UTC (rev 826)
+++ trunk/src/view/visio/addon/document.cpp 2010-07-06 19:26:23 UTC (rev 827)
@@ -666,7 +666,6 @@
m_disableMessageEnumerationToolbarItem->Enabled = enabled;
itemMessageEnumerating->Enabled = enabled;
- //TODO: add hot keys!
accelItemMessageEnumeration->Control = enabled;
accelItemMessageEnumerationDisable->Control = enabled;
@@ -1387,94 +1386,107 @@
VAORC CDocumentMonitor::OnMenuEnableMessageEnumeration(Visio::IVApplicationPtr vsoApp)
{
- static int startingIndex = 1;
- static int numberingType = 0;
- static BSTR add = _T(".");
+ //Static variables so dialog can use them to get previous choice
+ static int startingIndex = 1;
+ static int numberingType = 0;
+ static BSTR add = _T(".");
- CEnumerationDlg options(startingIndex,numberingType, add);
- if(options.DoModal() != IDOK)
- return VAORC_FAILURE;
-
- int ID = CEnumerateUtils::getGroupCount(vsoApp);
-
- _bstr_t groupID = stringize() << _T("Enum") << ++ID;
+ //Check if there are any messages on the page to be numbered
+ Visio::IVShapesPtr shapes = vsoApp->ActivePage->PageSheet->Shapes;
+ bool bMsgExists = false;
+ for(int i=1; i<=shapes->Count; i++)
+ {
+ Visio::IVShapePtr shape = shapes->Item[i];
+ if(isMessageShape(shape))
+ {
+ bMsgExists = true;
+ break;
+ }
+ }
+ if(!bMsgExists)
+ {
+ MessageBox(GetActiveWindow(),_T("There are no messages in the current drawing!"),
+ _T("Error"), MB_ICONWARNING | MB_OK);
+ return VAORC_FAILURE;
+ }
- startingIndex = options.getStartingIndex();
- numberingType = options.getNumberingType();
- add = options.getAddition();
+ CEnumerationDlg options(startingIndex,numberingType, add);
+ if(options.DoModal() != IDOK)
+ return VAORC_FAILURE;
- CEnumerateUtils::saveGroupSettings(vsoApp,groupID,startingIndex,numberingType,add);
-
- if (vsoApp->ActiveWindow->Selection->Count)
- {
- enumerate(vsoApp, groupID, true,true);
- }
- else
- enumerate(vsoApp, groupID, true,false);
+ int ID = CEnumerateUtils::getGroupCount(vsoApp);
- CEnumerateUtils::setGroupCount(vsoApp,ID);
+ _bstr_t groupID = stringize() << _T("Enum") << ++ID;
- return VAORC_SUCCESS;
+ startingIndex = options.getStartingIndex();
+ numberingType = options.getNumberingType();
+ add = options.getAddition();
+
+ CEnumerateUtils::saveGroupSettings(vsoApp,groupID,startingIndex,numberingType,add);
+
+ if (vsoApp->ActiveWindow->Selection->Count)
+ enumerate(vsoApp, groupID, true,true);
+ else
+ enumerate(vsoApp, groupID, true,false);
+
+ CEnumerateUtils::setGroupCount(vsoApp,ID);
+
+ return VAORC_SUCCESS;
}
VAORC CDocumentMonitor::OnMenuDisableMessageEnumeration(Visio::IVApplicationPtr vsoApp)
{
- Visio::IVSelectionPtr selection = vsoApp->ActiveWindow->Selection;
- Visio::IVShapePtr page = vsoApp->ActivePage->PageSheet;
- std::set<_bstr_t> groups;
+ Visio::IVSelectionPtr selection = vsoApp->ActiveWindow->Selection;
+ Visio::IVShapePtr page = vsoApp->ActivePage->PageSheet;
+ std::set<_bstr_t> groups;
- long undo_id = vsoApp->BeginUndoScope("DeleteNumbering");
+ long undo_id = vsoApp->BeginUndoScope("DeleteNumbering");
- int ID = CEnumerateUtils::getGroupCount(vsoApp);
+ //int ID = CEnumerateUtils::getGroupCount(vsoApp);
- //get all numbered messages on the page
- int numberedMessages = 0;
- for(int i=1; i<=page->Shapes->Count; i++)
- {
- Visio::IVShapePtr shape = page->Shapes->Item[i];
- if(isMessageShape(shape) && _tcsicmp(shape->Data1,_T("1")) == 0)
- numberedMessages++;
- }
+ //get all NUMBERED messages on the page
+ int numberedMessages = 0;
+ for(int i=1; i<=page->Shapes->Count; i++)
+ {
+ Visio::IVShapePtr shape = page->Shapes->Item[i];
+ if(isMessageShape(shape) && _tcsicmp(shape->Data1,_T("1")) == 0)
+ numberedMessages++;
+ }
- //get all SELECTED numbered messages on the page
- int selectedMessages = 0;
- for(int i=1; i<=selection->Count; i++)
- {
- Visio::IVShapePtr shape = selection->Item[i];
- if(isMessageShape(shape) && _tcsicmp(shape->Data1,_T("1")) == 0)
- selectedMessages++;
- }
+ int messagesOnSelection = 0; //number of messages in current selection
+ int selectedNumberedMessages = 0; //number of numbered messages in current selection
+ for(int i=1; i<=selection->Count; i++)
+ {
+ Visio::IVShapePtr shape = selection->Item[i];
+ if(isMessageShape(shape))
+ {
+ messagesOnSelection++;
+ if(_tcsicmp(shape->Data1,_T("1")) == 0)
+ selectedNumberedMessages++;
+ }
+ }
- if (selection->Count && (selectedMessages != numberedMessages) && (selectedMessages > 0))
- {
- //get which groups...
[truncated message content] |