Index: trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/include/window.h
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/include/window.h	(revision 21)
+++ trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/include/window.h	(revision 26)
@@ -97,9 +97,11 @@
   void _signal_name(); //show or hide the signals name
 
-  void _back();
+  void _back();//return to the previous view
+  void _cancel_selection();
+  void _apply();
 
  protected :
-  void mousePressEvent (QMouseEvent *); //mouse handler
- 
+  void mousePressEvent (QMouseEvent *); //mouse handler when mouse pressed
+  void mouseMoveEvent (QMouseEvent *); //mouse handler in other case
  private :
   void wparameters(); // parameters window builder
@@ -111,5 +113,7 @@
   void write_position(int x, int y);//write the position of the position clicked in the informations window
   void write_size(int x, int y);//write the size of the component clicked in the informations window
-  void write_ports(int x);//write the number of the component clicked in the informations window
+  void write_comment(string comment);
+  void erase_position();
+  void erase_size();
 
   QList <Port> port_east; //ports lists
@@ -144,14 +148,14 @@
   QString current_name; //name of the current file opened
 
-  /*items of the informations window*/
-  QLabel *lname; //name of the component clicked
+  /*items of the parameters window*/
   QLineEdit *positionX; //x position
   QLineEdit *positionY;//y position
   QLineEdit *sizeX;//x size
   QLineEdit *sizeY;//y size
-  QLineEdit *nb_ports;
-
-  int cpt_ports;//nb ports of component clicked
-
+  
+  /*items of the informations window*/
+  QLabel *lname;//name of the component clicked
+  QLineEdit *comment;//comment associated with the component clicked
+  int level; //level of architecture
   int mouseX; //mouse position
   int mouseY;
@@ -167,4 +171,7 @@
   int tailleX;
   int tailleY;
+
+  int cpt_level;
+  QString tab[50];
 
   QString father;//father name
@@ -188,4 +195,6 @@
   bool charg_open;//back chargement message box opened or not
   bool mess_open;//chargment message box opened or not
+  bool component_clicked;//if user clicked on a component to modify its parameters
+
 
 };
Index: trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/src/Graphics_drawAll.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/src/Graphics_drawAll.cpp	(revision 21)
+++ trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/src/Graphics_drawAll.cpp	(revision 26)
@@ -12,9 +12,8 @@
     
   if(paint){
-
     painter.begin(this);
     painter.setPen(Qt::blue);
     painter.drawRect(MARGEX,MARGEY,MARGEX+450,MARGEY+450);
-    cpt_ports = 0;
+
     
     for(QList<Port>::iterator it=port_east.begin(); it!=port_east.end(); ++it){
@@ -22,5 +21,5 @@
       portY = it->get_y();
       drawPort(portX + MARGEX,portY + MARGEY ,EAST,it->getDirection());
-      cpt_ports++;
+
     } 
     
@@ -29,5 +28,5 @@
       portY = it->get_y() ;
       drawPort(portX + MARGEX,portY + MARGEY, WEST, it->getDirection());
-      cpt_ports++;
+
     }
 
@@ -36,5 +35,5 @@
       portY = it->get_y() ;
       drawPort(portX + MARGEX ,portY+MARGEY,NORTH,it->getDirection());
-      cpt_ports++;
+
     }
 
@@ -43,9 +42,7 @@
       portY = it->get_y() ;
       drawPort(portX + MARGEX,portY+MARGEY,SOUTH,it->getDirection());
-      cpt_ports++;
+
     }
     
-    current = "Top Level";
-    father = " ";
     if(p.getArchitecture()!=NULL){
       compo = p.getComponent();
@@ -102,5 +99,5 @@
 	for (QList<PortMap>::iterator it3=pm->begin();it3!=pm->end();++it3) 
 	  {
-	    Signal *s=base->getSignal(it->getType(),new PortMap(*it3));
+	    Signal *s=base->getSignal(&p,it->getName(),new PortMap(*it3));
 	    painter.drawLine(s->get_src_x()+MARGEX,s->get_src_y()+MARGEY,s->get_dest_x()+MARGEX,s->get_dest_y()+MARGEY);
 
@@ -114,5 +111,5 @@
 
 	  }
-        if(charg_open){
+	if(charg_open){
 	  charg_open = false;
 	  mess_charg->close();
Index: trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/src/Graphics_file_actions.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/src/Graphics_file_actions.cpp	(revision 21)
+++ trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/src/Graphics_file_actions.cpp	(revision 26)
@@ -26,5 +26,4 @@
     tree->setRootIndex(dir->index("./data/"));
     file_name = new QLineEdit(wo);
-    file_name->setText("data/");
     QPushButton *ok_open = new QPushButton("ok",wo);
     connect(ok_open,SIGNAL(clicked()),this,SLOT(_open_end()));
@@ -67,5 +66,5 @@
     is_parse=true;
   }
-  if(parse->open_file( current_name.toStdString())==-1)
+  if(parse->open_file( current_name.toStdString(),0)==-1)
     _open_error();
   else{
@@ -79,9 +78,15 @@
   is_save = true;
   base = parse->getBaseV();//parse the base and open the file
-  //base->afficheBaseConsole();
+  #ifdef DEBUG_ALL
+  base->afficheBaseConsole();
+  #endif
+  cpt_level = 0;
+  
+  tab[cpt_level] = "";
   file_open = true;
   QList <BaseP> *liste_compo = base->getBaseP();
   p = liste_compo->at(0);
   entity = p.getEntity();
+  current = QString::fromStdString(entity->getName());
   c = new Coord(250,250,250,250);
   port_east = entity->getPortEast(c);
@@ -91,4 +96,5 @@
   paint = true;
   repaint();
+  setMouseTracking(true);
 }
 
Index: trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/src/Graphics_informations_window.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/src/Graphics_informations_window.cpp	(revision 21)
+++ trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/src/Graphics_informations_window.cpp	(revision 26)
@@ -12,8 +12,23 @@
   informations = new QBoxLayout(QBoxLayout::TopToBottom,0);
   winfo->setWindowTitle("informations");
-  winfo->setFixedSize(250,292);
-  winfo->move(678,50);
+  winfo->setFixedSize(350,292);
+  winfo->move(628,50);
+  lname = new QLabel();
+  lname->setText("");
+  comment = new QLineEdit();
+  comment->setText("");
+  informations->addWidget(lname);
+  informations->addWidget(comment);
   winfo->setLayout(informations);
   winfo->show();
 }
 
+void Window::write_comment(string cm){
+  QString c = QString::fromStdString(cm);
+  comment->setText(c);
+}
+
+void Window::write_name(string name){
+  QString n = QString::fromStdString(name);
+  lname->setText(n);
+}
Index: trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/src/Graphics_main.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/src/Graphics_main.cpp	(revision 21)
+++ trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/src/Graphics_main.cpp	(revision 26)
@@ -18,14 +18,15 @@
   if(argc>2){
     cout << "error : argument must be a file name or nothing" << endl;
+    cout << "usage : Viewer [file]" << endl;
     return 0;
   }
 
   Parse *par = new Parse();
-
+  
   
    QApplication *a=new QApplication (argc,argv);  
    
-   if(argc == 2){
-     if(par->open_file(argv[1])==-1){
+  if(argc == 2){
+     if(par->open_file(argv[1],0)==-1){
 	cout << "file doesn't exist or is not a valid format" << endl;  
 	exit(1);
Index: trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/src/Graphics_main_window.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/src/Graphics_main_window.cpp	(revision 21)
+++ trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/src/Graphics_main_window.cpp	(revision 26)
@@ -15,5 +15,7 @@
   charg_open = false;
   mess_open = false; 
- 
+  component_clicked = false;
+  cpt_level=0;
+  
   /*menu bar*/
   QMenuBar *menu_bar = new QMenuBar(this);
@@ -118,5 +120,5 @@
 
   /*defaut position*/
-  this->move(50,50);    
+  this->move(0,50);    
 
   /*main window title*/
@@ -140,6 +142,7 @@
   wa_open = false;
 
-  signalName = true;
-  componentName = true;
+  /*signals and components name hidden*/
+  signalName = false;
+  componentName = false;
 
   /*file unsaved at init*/
@@ -147,5 +150,4 @@
   first_save = false; //first_save = true for a new file
   
-
   current_name = name;
   if(current_name != NULL){
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 21)
+++ trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/src/Graphics_mouseEvent.cpp	(revision 26)
@@ -18,5 +18,9 @@
     mouseY = mouseEvent->y();
     
-    
+    bool bc = false;
+    int cx,cy,tx,ty;
+    string cc,nc;
+    bool found = false;
+
     for(QList<Component>::iterator it=compo->begin();it!=compo->end();++it){
       Coord *co = it->get_Position();
@@ -25,87 +29,240 @@
       int taillex = co->get_size_x();
       int tailley = co->get_size_y();
-      
+      QString t=QString::fromStdString(it->getType()).toLower();
       if(e->type() == QMouseEvent::MouseButtonDblClick && e->button() == Qt::LeftButton){
 	
 	if(mouseX >= px + MARGEX  && mouseY >= py +MARGEY && mouseX <= px+taillex + MARGEX  && mouseY <= py+tailley + MARGEY) {
 	  
+	  bc = false;
 	  paint = false;
 	  repaint();
-	   
-	  mess = new QWidget();
-      	  mess->setFixedSize(200,50);
-	  mess->move(200,50);
-	  QBoxLayout *b = new QBoxLayout(QBoxLayout::TopToBottom,0);
-   	  QLabel *l = new QLabel();
-	  l->setText("please wait while charging");
-	  b->addWidget(l);
- 	  mess->setLayout(b);
-	  mess->show();
-	  mess_open = true;
-	  
-	  p=base->get_BasePos(it->getType());
-	  entity = p.getEntity();
-	  c = new Coord(250,250,250,250);
-	  port_east = entity->getPortEast(c);
-	  port_west = entity->getPortWest(c);
-	  port_north = entity->getPortNorth(c);
-	  port_south = entity->getPortSouth(c);
-	  paint = true;
-	  father = current;
-	  current = QString::fromStdString(it->getName());
-	  repaint();
+          found=true;
+	  this->setDisabled(true);
 	}
       }
-
+      if(found){  
+       	mess = new QWidget();
+	mess->setFixedSize(200,50);
+	mess->move(200,50);
+	QBoxLayout *b = new QBoxLayout(QBoxLayout::TopToBottom,0);
+	QLabel *l = new QLabel();
+	l->setText("please wait while charging");
+	b->addWidget(l);
+	mess->setLayout(b);
+	mess->show();
+	mess_open = true;
+
+	p=base->get_BasePos(t.toStdString());
+	entity = p.getEntity();
+	c = new Coord(250,250,250,250);
+	port_east = entity->getPortEast(c);
+	port_west = entity->getPortWest(c);
+	port_north = entity->getPortNorth(c);
+	port_south = entity->getPortSouth(c);
+	if(cpt_level!=0)
+	  tab[cpt_level]=father;
+	father = current;
+	current = QString::fromStdString(t.toStdString());
+	cpt_level++;
+	tab[cpt_level] = father;
+	paint = true;
+	this->releaseMouse();
+	repaint();
+	write_name("");
+	write_comment("");
+	erase_position();
+	erase_size();
+	found = false;
+	this->setDisabled(false);
+      }
+      
       if(e->type() == QMouseEvent::MouseButtonPress && e->button() == Qt::LeftButton){
 	if(mouseX >= px + MARGEX  && mouseY >= py +MARGEY && mouseX <= px+taillex + MARGEX  && mouseY <= py+tailley + MARGEY) {
-	  write_name(it->getName());
-	  write_position(px,py);
-	  write_size(taillex,tailley);
-	  write_ports(cpt_ports);
-	}	
-      }
-      
+	  bc = true;
+	  nc = it->getName();
+	  cx = px;
+	  cy = py;
+	  tx = taillex;
+	  ty = tailley;
+	  BaseP tp = base->get_BasePos(t.toStdString());
+	  if(&tp != NULL)
+		cc=tp.getComment();
+	  component_clicked = true;
+	}
+      }
+    }
+    if(bc){
+      write_name(nc);
+      write_position(cx,cy);
+      write_size(tx,ty);
+      write_comment(cc);
     }
   }
 }
 
+
+void Window::mouseMoveEvent(QMouseEvent *e){
+
+   if(paint && (p.getArchitecture() != NULL) && !component_clicked){
+
+    compo = p.getComponent();
+    
+    QMouseEvent *mouseEvent = (QMouseEvent *) e;
+
+    mouseX = mouseEvent->x();
+    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();
+      px = co->get_hg_x();
+      py = co->get_hg_y();
+      taillex = co->get_size_x();
+      tailley = co->get_size_y();
+      
+      if(e->type() == QMouseEvent::MouseMove){
+	if(mouseX >= px + MARGEX  && mouseY >= py +MARGEY && mouseX <= px+taillex + MARGEX  && mouseY <= py+tailley + MARGEY) {
+	  b = true;
+	  s = it->getName();
+	  BaseP tp=base->get_BasePos(it->getName());
+	  if(&tp!=NULL)
+	    c=tp.getComment();
+	  ppx = px;
+	  ppy = py;
+	}
+      }
+    
+    
+
+      // 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;
+// 	  }
+// 	}
+//       }
+    }
+    
+    if(b){
+      write_name(s);
+      write_position(ppx,ppy);
+      write_size(taillex,tailley);
+      write_comment(c);
+    }
+    else{
+      write_name("");
+      erase_position();
+      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;
+//       }
+//     }
+   }
+}
+   
+ 
+void Window::_back(){
+  if(cpt_level==0){
+    QMessageBox *m = new QMessageBox(this);
+    m->setText("can't go up, you're on the top level !");
+    m->addButton("ok",QMessageBox::YesRole);
+    m->show();  
+  }
   
-void Window::_back(){
-  
-  paint = false;
-  repaint();
-  mess_charg = new QWidget();
-  mess_charg->setFixedSize(200,50);
-  mess_charg->move(200,50);
-  charg_open = true;
-  QBoxLayout *b = new QBoxLayout(QBoxLayout::TopToBottom,0);
-  QLabel *l = new QLabel();
-  l->setText("please wait while charging");
-  b->addWidget(l);
-  mess_charg->setLayout(b);
-  mess_charg->show();
-  
-  
-  
-  if(father==" "){
-    QList <BaseP> *liste_compo = base->getBaseP();  
-    p = liste_compo->at(0);  
+  else{
+    this->setDisabled(true);
+    paint = false;
+    repaint();
+    cpt_level--;
+    mess_charg = new QWidget();
+    mess_charg->setFixedSize(200,50);
+    mess_charg->move(200,50);
+    charg_open = true;
+    QBoxLayout *b = new QBoxLayout(QBoxLayout::TopToBottom,0);
+    QLabel *l = new QLabel();
+    l->setText("please wait while charging");
+    b->addWidget(l);
+    mess_charg->setLayout(b);
+    mess_charg->show();
+    
+    p = base->get_BasePos(father.toStdString());
+    entity = p.getEntity();
+    c = new Coord(250,250,250,250);
+    port_east = entity->getPortEast(c);
+    port_west = entity->getPortWest(c);
+    port_north = entity->getPortNorth(c);
+    port_south = entity->getPortSouth(c);
+    father = tab[cpt_level];
+    current = QString::fromStdString(entity->getName());
+    paint = true;
+    repaint();
+    this->setDisabled(false);
   }
-
-  else{
-    p = base->get_BasePos(father.toStdString());
-  }
-
-  entity = p.getEntity();
-  c = new Coord(250,250,250,250);
-  port_east = entity->getPortEast(c);
-  port_west = entity->getPortWest(c);
-  port_north = entity->getPortNorth(c);
-  port_south = entity->getPortSouth(c);
-  father = current;
-  current = QString::fromStdString(entity->getName());
-  paint = true;
-  repaint();
 }
 
Index: trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/src/Graphics_parameters_window.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/src/Graphics_parameters_window.cpp	(revision 21)
+++ trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/src/Graphics_parameters_window.cpp	(revision 26)
@@ -12,9 +12,6 @@
   parameters = new QBoxLayout(QBoxLayout::TopToBottom,0);
   wparam->setWindowTitle("parameters");
-  wparam->setFixedSize(250,300);
-  wparam->move(678,370);
-
-  lname = new QLabel(wparam);
-  lname->setText("");
+  wparam->setFixedSize(350,300);
+  wparam->move(628,370);
 
   QBoxLayout *bpos = new QBoxLayout(QBoxLayout::LeftToRight,0);
@@ -49,22 +46,16 @@
   bsize2->addWidget(sy);
   bsize2->addWidget(sizeY);
-  
-  QBoxLayout *bport = new QBoxLayout(QBoxLayout::LeftToRight,0);
-  QLabel *lport = new QLabel();
-  lport->setText("nb ports : ");
-  nb_ports = new QLineEdit();
-  nb_ports->setText("");
-  bport->addWidget(lport);
-  bport->addWidget(nb_ports);
-
-  parameters->addWidget(lname);
   parameters->addLayout(bpos);
   parameters->addLayout(bpos2);
   parameters->addLayout(bsize);
   parameters->addLayout(bsize2);
-  parameters->addLayout(bport);
+  QPushButton *noselect = new QPushButton("cancel selection",wparam);
   QPushButton *back = new QPushButton("back",wparam);
   QPushButton *apply = new QPushButton("apply",wparam);
   connect(back,SIGNAL(clicked()),this,SLOT(_back()));
+  connect(noselect,SIGNAL(clicked()),this,SLOT(_cancel_selection()));
+  connect(apply,SIGNAL(clicked()),this,SLOT(_apply()));
+  
+  parameters->addWidget(noselect);
   parameters->addWidget(back);
   parameters->addWidget(apply);
@@ -72,10 +63,4 @@
   wparam->setLayout(parameters);
   wparam->show();
-}
-
-void Window::write_name(string name){
-  QString n = QString::fromStdString(name);
-  lname->setText(n);
-  
 }
 
@@ -91,5 +76,9 @@
   str2 = out2.str();
   positionY->setText(QString::fromStdString(str2));
-  
+}
+
+void Window::erase_position(){
+  positionX->setText("");
+  positionY->setText("");
 }
 
@@ -107,12 +96,21 @@
 }
 
-void Window::write_ports(int x){
-  stringstream out;
-  string str;
-  out << x;
-  str = out.str();
-  nb_ports->setText(QString::fromStdString(str));
-  wparam->show();
+void Window::erase_size(){
+  sizeX->setText("");
+  sizeY->setText("");
 }
 
+void Window::_cancel_selection(){
+  component_clicked = false;
+}
 
+void Window::_apply(){
+  if(positionX->isModified())
+    cout << "positionX modified : " << positionX->text().toStdString() << endl;
+  if(positionY->isModified())
+    cout << "positionY modified : " << positionX->text().toStdString() << endl;
+  if(sizeX->isModified())
+    cout << "sizeX modified : " << sizeX->text().toStdString() << endl;
+  if(sizeY->isModified())
+    cout << "sizeY modified : " << sizeY->text().toStdString() << endl;
+}
