Index: trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/src/Graphics_mouseEvent.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/src/Graphics_mouseEvent.cpp	(revision 26)
+++ trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/src/Graphics_mouseEvent.cpp	(revision 28)
@@ -104,4 +104,10 @@
 void Window::mouseMoveEvent(QMouseEvent *e){
 
+   bool b  = false;
+   bool b2 = false;
+   bool b3 = false;
+   int px,py,taillex,tailley,ppx,ppy;
+   string s,s2,c;
+
    if(paint && (p.getArchitecture() != NULL) && !component_clicked){
 
@@ -113,9 +119,4 @@
     mouseY = mouseEvent->y();
     
-    bool b  = false;
-    bool b2 = false;
-    int px,py,taillex,tailley,sx,sy,ppx,ppy;
-    string s,c;
-   
     for(QList<Component>::iterator it=compo->begin();it!=compo->end();++it){
       Coord *co = it->get_Position();
@@ -125,4 +126,6 @@
       tailley = co->get_size_y();
       
+      QList<PortMap> *pm=it->getPortMap();
+
       if(e->type() == QMouseEvent::MouseMove){
 	if(mouseX >= px + MARGEX  && mouseY >= py +MARGEY && mouseX <= px+taillex + MARGEX  && mouseY <= py+tailley + MARGEY) {
@@ -134,21 +137,17 @@
 	  ppx = px;
 	  ppy = py;
+	  break;
 	}
-      }
-    
-    
-
-      // QList<PortMap> *pm=it->getPortMap();
-//       for (QList<PortMap>::iterator it3=pm->begin();it3!=pm->end();++it3) {
-// 	Signal *sig=base->getSignal(it->getType(),new PortMap(*it3));
-// 	if(e->type() == QMouseEvent::MouseMove){
-// 	  if(mouseX >= sig->get_dest_x() - 5  + MARGEX  && mouseY >= sig->get_dest_x() - 5 +MARGEY && mouseX <= sig->get_dest_x() + 5  + MARGEX  && mouseY <= sig->get_dest_x() + 5 +MARGEY) {
-// 	    b2 = true;
-// 	    s = it3->getName();
-// 	    sx = portX;
-// 	    sy = portY;
-// 	  }
-// 	}
-//       }
+	else{
+	  for (QList<PortMap>::iterator it3=pm->begin();it3!=pm->end();++it3) {
+	  	Signal *sig=base->getSignal(&p,it->getName(),new PortMap(*it3));
+	  	if(mouseX >= sig->get_src_x() - 15  + MARGEX  && mouseY >= sig->get_src_y() - 15 + MARGEY && mouseX <= sig->get_src_x() + 15  + MARGEX  && mouseY <= sig->get_src_y() + 15 +MARGEY){
+		  b2 = true;
+	  	  s = it3->getName();
+		  break;
+	  	}
+	  }
+	}   
+      }
     }
     
@@ -158,72 +157,71 @@
       write_size(taillex,tailley);
       write_comment(c);
-    }
-    else{
+      b3 = false;
+      b2 = false;
+    }
+    
+    if(b2){
+      write_name(s);
+      erase_position();
+      write_comment("");
+      b3 = false;
+      b = false;
+    }
+
+    if(!b && !b2){
       write_name("");
       erase_position();
+      write_comment("");
       erase_size();
-      write_comment("");
-    }
-   
-    
-    // if(b2){
-//       write_name(s);
-//       write_position(sx,sy);
-//     }
-//     else{
-//       write_name("");
-//       erase_position();
-//     }
-    //  }
- 
-//    bool b3;
-//    int sx2,sy2;
-//    string s2;
-   
-//    for(QList<Port>::iterator it=port_east.begin(); it!=port_east.end(); ++it){
-//       portX = it->get_x();
-//       portY = it->get_y();
-//       if(mouseX >= portX - 10 && mouseY >= portY - 10 && mouseX <= portX + 10 && mouseY <= portY + 10){
-// 	b3 = true;
-// 	s2 = it->getName();
-// 	sx2 = portX;
-// 	sy2 = portY;
-//       }
-//     } 
-    
-//     for(QList<Port>::iterator it=port_west.begin(); it!=port_west.end(); ++it){
-//       portX = it->get_x() ;
-//       portY = it->get_y() ;
-//       if(mouseX >= portX - 5 && mouseY >= portY - 5 && mouseX <= portX + 5 && mouseY <= portY + 5){
-// 	b3 = true;
-// 	s2 = it->getName();
-// 	sx2 = portX;
-// 	sy2 = portY;
-//       }
-//     }
-    
-//     for(QList<Port>::iterator it=port_north.begin(); it!=port_north.end(); ++it){
-//       portX = it->get_x() ;
-//       portY = it->get_y() ;
-//       if(mouseX >= portX - 5 && mouseY >= portY - 5 && mouseX <= portX + 5 && mouseY <= portY + 5){
-// 	b3 = true;
-// 	s2 = it->getName();
-// 	sx2 = portX;
-// 	sy2 = portY;
-//       }
-//     }
-    
-//     for(QList<Port>::iterator it=port_south.begin(); it!=port_south.end(); ++it){
-//       portX = it->get_x() ;
-//       portY = it->get_y() ;
-//       if(mouseX >= portX - 5 && mouseY >= portY - 5 && mouseX <= portX + 5 && mouseY <= portY + 5){
-// 	b3 = true;
-// 	s2 = it->getName();
-// 	sx2 = portX;
-// 	sy2 = portY;
-//       }
-//     }
+    }
+      
    }
+  
+  
+   for(QList<Port>::iterator it=port_east.begin(); it!=port_east.end(); ++it){
+      portX = it->get_x();
+      portY = it->get_y();
+      if(mouseX >= portX - 15 + MARGEX && mouseY >= portY - 15 + MARGEY && mouseX <= portX + 15 +MARGEX && mouseY <= portY + 15 + MARGEY){
+	b3 = true;
+	s2 = it->getName();
+      }
+   } 
+   
+   for(QList<Port>::iterator it=port_west.begin(); it!=port_west.end(); ++it){
+     portX = it->get_x() ;
+     portY = it->get_y() ;
+     if(mouseX >= portX - 15 + MARGEX && mouseY >= portY - 15 + MARGEY && mouseX <= portX + 15 + MARGEX && mouseY <= portY + 15 + MARGEY){
+       b3 = true;
+       s2 = it->getName();
+     }
+   }
+   
+   for(QList<Port>::iterator it=port_north.begin(); it!=port_north.end(); ++it){
+     portX = it->get_x() ;
+     portY = it->get_y() ;
+     if(mouseX >= portX - 15 + MARGEX && mouseY >= portY - 15 +MARGEY && mouseX <= portX + 15 + MARGEX && mouseY <= portY + 15 +MARGEY){
+	b3 = true;
+	s2 = it->getName();
+     }
+   }
+   
+    for(QList<Port>::iterator it=port_south.begin(); it!=port_south.end(); ++it){
+      portX = it->get_x() ;
+      portY = it->get_y() ;
+      if(mouseX >= portX - 15 + MARGEX && mouseY >= portY - 15 + MARGEY && mouseX <= portX + 15 +MARGEX && mouseY <= portY + 15 + MARGEY){
+	b3 = true;
+	s2 = it->getName();
+      }
+    }
+    if(b3){
+      b = false;
+      write_name("");
+      erase_position();
+      write_name(s2);
+      erase_size();
+    }
 }
+
+
    
  
