Changeset 26 for trunk/IPs


Ignore:
Timestamp:
May 22, 2007, 1:09:15 PM (18 years ago)
Author:
chou
Message:

Release 3 du viewer:
Etape 1 et 2 du projet complet et à jour.

Location:
trunk/IPs/systemC/processor/Morpheo/Tools/Viewer
Files:
23 edited

Legend:

Unmodified
Added
Removed
  • trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Bdd/include/BaseV.h

    r20 r26  
    2828      //accesseurs
    2929      morpheo::tools::viewer::bdd::BaseP  get_BasePos(string v);
    30       morpheo::tools::viewer::bdd::Signal *getSignal(string c,PortMap *dest);
     30      morpheo::tools::viewer::bdd::Signal *getSignal(morpheo::tools::viewer::bdd::BaseP *top,string c,PortMap *dest);
    3131      QList<morpheo::tools::viewer::bdd::BaseP>  *getBaseP();
    3232      //morpheo::tools::viewer::bdd::Param get_Param(string v);
  • trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Bdd/include/Entity.h

    r20 r26  
    2727     
    2828    public:
    29       Entity(string n,int l);
     29      Entity(string n,string t,int l);
    3030      ~Entity();
    3131      string getComment();
    3232      string getName();
     33      string getType();
    3334      void setComment(string s);
    3435      int getSchema();
  • trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Bdd/src/BaseP_accessors.cpp

    r20 r26  
    1313    comment=s;
    1414  }
     15  void BaseP::setLevel(int s){
     16    level=s;
     17  }
     18 
    1519  void BaseP::setArchitecture(Architecture *a)
    1620  {
     
    3539    return comment;
    3640  }
     41  int BaseP::getLevel()
     42  {
     43    return level;
     44  }
    3745
    3846    QList<morpheo::tools::viewer::bdd::Component> *BaseP::getComponent()
  • trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Bdd/src/BaseV_accessors.cpp

    r20 r26  
    1010namespace bdd{     
    1111
    12  void BaseV::setComment(string s){
     12  void BaseV::setComment(string s){
    1313    comment=s;
    1414  }
  • trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Bdd/src/BaseV_afficheBaseConsole.cpp

    r20 r26  
    1  /*
     1/*
    22 *
    33 * [desc.]
     
    1313        = pos->begin(); it != pos->end(); ++it)
    1414    {
     15     
    1516      morpheo::tools::viewer::bdd::Entity *test=(it->getEntity());
    1617      string n2=test->getName();
     
    1819      cout << n << endl ;
    1920      cout << "----Entity-----------------------------------------" <<endl;
    20       cout << "Entity name:"<< n2<< endl;
     21      cout << "Entity name:"<< n2 <<" level:"<< it->getLevel()<< endl;
    2122      cout << "------------------ports east-----------------------" <<endl;
    2223     
     
    100101           cout << "port :" << it3->getPort() <<endl;
    101102           cout << "comment :" << it3->getComment() <<endl;
    102          
    103          
     103
     104           
    104105           
    105106             }
    106107         }
    107108      }//if
     109      cout << endl<< "************    fin BASEP  *******************"<<endl <<endl;
     110       
    108111    }//for
    109    
     112     
    110113  }
    111114 
  • trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Bdd/src/BaseV_getSignal.cpp

    r20 r26  
    99namespace viewer{
    1010namespace bdd{ 
    11 
    12   morpheo::tools::viewer::bdd::Signal *BaseV::getSignal(string c,morpheo::tools::viewer::bdd::PortMap *dest)
     11  /*
     12   * search and find the signal
     13   * top : actual component is viewed on screen
     14   * c: the component (source) which is connected to the dest
     15   * dest : the port destination informations
     16   */
     17  morpheo::tools::viewer::bdd::Signal *BaseV::getSignal(BaseP *top,string c,morpheo::tools::viewer::bdd::PortMap *dest)
    1318  {
    1419    int srcX,srcY,destX,destY;
    15     Architecture *aa=((pos->operator[](0)).getArchitecture());
     20    Architecture *aa=top->getArchitecture();
    1621    morpheo::tools::viewer::bdd::Component x=aa->getComponent(c);
    1722    // cout << dest->getName() <<endl; 
     
    1924    srcX=p->get_x();
    2025    srcY=p->get_y();
    21     // cout << dest->getComponent() <<endl; 
     26    //cout << dest->getComponent() <<endl; 
    2227    morpheo::tools::viewer::bdd::BaseP res=get_BasePos(dest->getComponent());
    2328    morpheo::tools::viewer::bdd::Port *pm=(res.getEntity())->searchPort(dest->getPort());
  • trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Bdd/src/BaseV_searchComponent.cpp

    r20 r26  
     1
    12 /*
    23 *
     
    1112
    1213  morpheo::tools::viewer::bdd::BaseP BaseV::get_BasePos(string v){
    13     return pos->operator[](listcomp->indexOf(v,0));
     14    int tmp=listcomp->indexOf(v,0);
     15    if(tmp==-1)
     16      return NULL;
     17    else
     18      return pos->operator[](tmp);
    1419  }
    1520
  • trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Bdd/src/Component_accessors.cpp

    r20 r26  
    1616  string Component::getComment(){ return comment;}
    1717  string Component::getName(){ return name;}
    18     string Component::getType(){ return type;}
     18  string Component::getType(){ return type;}
    1919  int Component::get_x(){return pos_x+size_x;}
    2020  int Component::get_y(){return pos_y+size_y;}
  • trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Bdd/src/Entity_accessors.cpp

    r20 r26  
    1818 
    1919  string Entity::getName(){ return name;}
     20  string Entity::getType(){ return type;}
    2021 
    2122  int Entity::getSchema(){return schema;}
  • trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Bdd/src/Entity_alloc.cpp

    r20 r26  
    1111
    1212
    13   Entity::Entity(string n,int l)
     13  Entity::Entity(string n,string t,int l)
    1414    :ListePorts()
    1515  {
    1616    name=n;
    1717    schema=l;
    18 
     18    type=t;
    1919  }
    2020 
  • trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/include/window.h

    r21 r26  
    9797  void _signal_name(); //show or hide the signals name
    9898
    99   void _back();
     99  void _back();//return to the previous view
     100  void _cancel_selection();
     101  void _apply();
    100102
    101103 protected :
    102   void mousePressEvent (QMouseEvent *); //mouse handler
    103  
     104  void mousePressEvent (QMouseEvent *); //mouse handler when mouse pressed
     105  void mouseMoveEvent (QMouseEvent *); //mouse handler in other case
    104106 private :
    105107  void wparameters(); // parameters window builder
     
    111113  void write_position(int x, int y);//write the position of the position clicked in the informations window
    112114  void write_size(int x, int y);//write the size of the component clicked in the informations window
    113   void write_ports(int x);//write the number of the component clicked in the informations window
     115  void write_comment(string comment);
     116  void erase_position();
     117  void erase_size();
    114118
    115119  QList <Port> port_east; //ports lists
     
    144148  QString current_name; //name of the current file opened
    145149
    146   /*items of the informations window*/
    147   QLabel *lname; //name of the component clicked
     150  /*items of the parameters window*/
    148151  QLineEdit *positionX; //x position
    149152  QLineEdit *positionY;//y position
    150153  QLineEdit *sizeX;//x size
    151154  QLineEdit *sizeY;//y size
    152   QLineEdit *nb_ports;
    153 
    154   int cpt_ports;//nb ports of component clicked
    155 
     155 
     156  /*items of the informations window*/
     157  QLabel *lname;//name of the component clicked
     158  QLineEdit *comment;//comment associated with the component clicked
     159  int level; //level of architecture
    156160  int mouseX; //mouse position
    157161  int mouseY;
     
    167171  int tailleX;
    168172  int tailleY;
     173
     174  int cpt_level;
     175  QString tab[50];
    169176
    170177  QString father;//father name
     
    188195  bool charg_open;//back chargement message box opened or not
    189196  bool mess_open;//chargment message box opened or not
     197  bool component_clicked;//if user clicked on a component to modify its parameters
     198
    190199
    191200};
  • trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/src/Graphics_drawAll.cpp

    r21 r26  
    1212   
    1313  if(paint){
    14 
    1514    painter.begin(this);
    1615    painter.setPen(Qt::blue);
    1716    painter.drawRect(MARGEX,MARGEY,MARGEX+450,MARGEY+450);
    18     cpt_ports = 0;
     17
    1918   
    2019    for(QList<Port>::iterator it=port_east.begin(); it!=port_east.end(); ++it){
     
    2221      portY = it->get_y();
    2322      drawPort(portX + MARGEX,portY + MARGEY ,EAST,it->getDirection());
    24       cpt_ports++;
     23
    2524    }
    2625   
     
    2928      portY = it->get_y() ;
    3029      drawPort(portX + MARGEX,portY + MARGEY, WEST, it->getDirection());
    31       cpt_ports++;
     30
    3231    }
    3332
     
    3635      portY = it->get_y() ;
    3736      drawPort(portX + MARGEX ,portY+MARGEY,NORTH,it->getDirection());
    38       cpt_ports++;
     37
    3938    }
    4039
     
    4342      portY = it->get_y() ;
    4443      drawPort(portX + MARGEX,portY+MARGEY,SOUTH,it->getDirection());
    45       cpt_ports++;
     44
    4645    }
    4746   
    48     current = "Top Level";
    49     father = " ";
    5047    if(p.getArchitecture()!=NULL){
    5148      compo = p.getComponent();
     
    10299        for (QList<PortMap>::iterator it3=pm->begin();it3!=pm->end();++it3)
    103100          {
    104             Signal *s=base->getSignal(it->getType(),new PortMap(*it3));
     101            Signal *s=base->getSignal(&p,it->getName(),new PortMap(*it3));
    105102            painter.drawLine(s->get_src_x()+MARGEX,s->get_src_y()+MARGEY,s->get_dest_x()+MARGEX,s->get_dest_y()+MARGEY);
    106103
     
    114111
    115112          }
    116         if(charg_open){
     113        if(charg_open){
    117114          charg_open = false;
    118115          mess_charg->close();
  • trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/src/Graphics_file_actions.cpp

    r21 r26  
    2626    tree->setRootIndex(dir->index("./data/"));
    2727    file_name = new QLineEdit(wo);
    28     file_name->setText("data/");
    2928    QPushButton *ok_open = new QPushButton("ok",wo);
    3029    connect(ok_open,SIGNAL(clicked()),this,SLOT(_open_end()));
     
    6766    is_parse=true;
    6867  }
    69   if(parse->open_file( current_name.toStdString())==-1)
     68  if(parse->open_file( current_name.toStdString(),0)==-1)
    7069    _open_error();
    7170  else{
     
    7978  is_save = true;
    8079  base = parse->getBaseV();//parse the base and open the file
    81   //base->afficheBaseConsole();
     80  #ifdef DEBUG_ALL
     81  base->afficheBaseConsole();
     82  #endif
     83  cpt_level = 0;
     84 
     85  tab[cpt_level] = "";
    8286  file_open = true;
    8387  QList <BaseP> *liste_compo = base->getBaseP();
    8488  p = liste_compo->at(0);
    8589  entity = p.getEntity();
     90  current = QString::fromStdString(entity->getName());
    8691  c = new Coord(250,250,250,250);
    8792  port_east = entity->getPortEast(c);
     
    9196  paint = true;
    9297  repaint();
     98  setMouseTracking(true);
    9399}
    94100
  • trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/src/Graphics_informations_window.cpp

    r21 r26  
    1212  informations = new QBoxLayout(QBoxLayout::TopToBottom,0);
    1313  winfo->setWindowTitle("informations");
    14   winfo->setFixedSize(250,292);
    15   winfo->move(678,50);
     14  winfo->setFixedSize(350,292);
     15  winfo->move(628,50);
     16  lname = new QLabel();
     17  lname->setText("");
     18  comment = new QLineEdit();
     19  comment->setText("");
     20  informations->addWidget(lname);
     21  informations->addWidget(comment);
    1622  winfo->setLayout(informations);
    1723  winfo->show();
    1824}
    1925
     26void Window::write_comment(string cm){
     27  QString c = QString::fromStdString(cm);
     28  comment->setText(c);
     29}
     30
     31void Window::write_name(string name){
     32  QString n = QString::fromStdString(name);
     33  lname->setText(n);
     34}
  • trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/src/Graphics_main.cpp

    r20 r26  
    1818  if(argc>2){
    1919    cout << "error : argument must be a file name or nothing" << endl;
     20    cout << "usage : Viewer [file]" << endl;
    2021    return 0;
    2122  }
    2223
    2324  Parse *par = new Parse();
    24 
     25 
    2526 
    2627   QApplication *a=new QApplication (argc,argv); 
    2728   
    28    if(argc == 2){
    29      if(par->open_file(argv[1])==-1){
     29  if(argc == 2){
     30     if(par->open_file(argv[1],0)==-1){
    3031        cout << "file doesn't exist or is not a valid format" << endl; 
    3132        exit(1);
  • trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/src/Graphics_main_window.cpp

    r21 r26  
    1515  charg_open = false;
    1616  mess_open = false;
    17  
     17  component_clicked = false;
     18  cpt_level=0;
     19 
    1820  /*menu bar*/
    1921  QMenuBar *menu_bar = new QMenuBar(this);
     
    118120
    119121  /*defaut position*/
    120   this->move(50,50);   
     122  this->move(0,50);   
    121123
    122124  /*main window title*/
     
    140142  wa_open = false;
    141143
    142   signalName = true;
    143   componentName = true;
     144  /*signals and components name hidden*/
     145  signalName = false;
     146  componentName = false;
    144147
    145148  /*file unsaved at init*/
     
    147150  first_save = false; //first_save = true for a new file
    148151 
    149 
    150152  current_name = name;
    151153  if(current_name != NULL){
  • trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/src/Graphics_mouseEvent.cpp

    r21 r26  
    1818    mouseY = mouseEvent->y();
    1919   
    20    
     20    bool bc = false;
     21    int cx,cy,tx,ty;
     22    string cc,nc;
     23    bool found = false;
     24
    2125    for(QList<Component>::iterator it=compo->begin();it!=compo->end();++it){
    2226      Coord *co = it->get_Position();
     
    2529      int taillex = co->get_size_x();
    2630      int tailley = co->get_size_y();
    27      
     31      QString t=QString::fromStdString(it->getType()).toLower();
    2832      if(e->type() == QMouseEvent::MouseButtonDblClick && e->button() == Qt::LeftButton){
    2933       
    3034        if(mouseX >= px + MARGEX  && mouseY >= py +MARGEY && mouseX <= px+taillex + MARGEX  && mouseY <= py+tailley + MARGEY) {
    3135         
     36          bc = false;
    3237          paint = false;
    3338          repaint();
    34            
    35           mess = new QWidget();
    36           mess->setFixedSize(200,50);
    37           mess->move(200,50);
    38           QBoxLayout *b = new QBoxLayout(QBoxLayout::TopToBottom,0);
    39           QLabel *l = new QLabel();
    40           l->setText("please wait while charging");
    41           b->addWidget(l);
    42           mess->setLayout(b);
    43           mess->show();
    44           mess_open = true;
    45          
    46           p=base->get_BasePos(it->getType());
    47           entity = p.getEntity();
    48           c = new Coord(250,250,250,250);
    49           port_east = entity->getPortEast(c);
    50           port_west = entity->getPortWest(c);
    51           port_north = entity->getPortNorth(c);
    52           port_south = entity->getPortSouth(c);
    53           paint = true;
    54           father = current;
    55           current = QString::fromStdString(it->getName());
    56           repaint();
     39          found=true;
     40          this->setDisabled(true);
    5741        }
    5842      }
    59 
     43      if(found){ 
     44        mess = new QWidget();
     45        mess->setFixedSize(200,50);
     46        mess->move(200,50);
     47        QBoxLayout *b = new QBoxLayout(QBoxLayout::TopToBottom,0);
     48        QLabel *l = new QLabel();
     49        l->setText("please wait while charging");
     50        b->addWidget(l);
     51        mess->setLayout(b);
     52        mess->show();
     53        mess_open = true;
     54
     55        p=base->get_BasePos(t.toStdString());
     56        entity = p.getEntity();
     57        c = new Coord(250,250,250,250);
     58        port_east = entity->getPortEast(c);
     59        port_west = entity->getPortWest(c);
     60        port_north = entity->getPortNorth(c);
     61        port_south = entity->getPortSouth(c);
     62        if(cpt_level!=0)
     63          tab[cpt_level]=father;
     64        father = current;
     65        current = QString::fromStdString(t.toStdString());
     66        cpt_level++;
     67        tab[cpt_level] = father;
     68        paint = true;
     69        this->releaseMouse();
     70        repaint();
     71        write_name("");
     72        write_comment("");
     73        erase_position();
     74        erase_size();
     75        found = false;
     76        this->setDisabled(false);
     77      }
     78     
    6079      if(e->type() == QMouseEvent::MouseButtonPress && e->button() == Qt::LeftButton){
    6180        if(mouseX >= px + MARGEX  && mouseY >= py +MARGEY && mouseX <= px+taillex + MARGEX  && mouseY <= py+tailley + MARGEY) {
    62           write_name(it->getName());
    63           write_position(px,py);
    64           write_size(taillex,tailley);
    65           write_ports(cpt_ports);
    66         }       
    67       }
    68      
     81          bc = true;
     82          nc = it->getName();
     83          cx = px;
     84          cy = py;
     85          tx = taillex;
     86          ty = tailley;
     87          BaseP tp = base->get_BasePos(t.toStdString());
     88          if(&tp != NULL)
     89                cc=tp.getComment();
     90          component_clicked = true;
     91        }
     92      }
     93    }
     94    if(bc){
     95      write_name(nc);
     96      write_position(cx,cy);
     97      write_size(tx,ty);
     98      write_comment(cc);
    6999    }
    70100  }
    71101}
    72102
     103
     104void Window::mouseMoveEvent(QMouseEvent *e){
     105
     106   if(paint && (p.getArchitecture() != NULL) && !component_clicked){
     107
     108    compo = p.getComponent();
     109   
     110    QMouseEvent *mouseEvent = (QMouseEvent *) e;
     111
     112    mouseX = mouseEvent->x();
     113    mouseY = mouseEvent->y();
     114   
     115    bool b  = false;
     116    bool b2 = false;
     117    int px,py,taillex,tailley,sx,sy,ppx,ppy;
     118    string s,c;
     119   
     120    for(QList<Component>::iterator it=compo->begin();it!=compo->end();++it){
     121      Coord *co = it->get_Position();
     122      px = co->get_hg_x();
     123      py = co->get_hg_y();
     124      taillex = co->get_size_x();
     125      tailley = co->get_size_y();
     126     
     127      if(e->type() == QMouseEvent::MouseMove){
     128        if(mouseX >= px + MARGEX  && mouseY >= py +MARGEY && mouseX <= px+taillex + MARGEX  && mouseY <= py+tailley + MARGEY) {
     129          b = true;
     130          s = it->getName();
     131          BaseP tp=base->get_BasePos(it->getName());
     132          if(&tp!=NULL)
     133            c=tp.getComment();
     134          ppx = px;
     135          ppy = py;
     136        }
     137      }
     138   
     139   
     140
     141      // QList<PortMap> *pm=it->getPortMap();
     142//       for (QList<PortMap>::iterator it3=pm->begin();it3!=pm->end();++it3) {
     143//      Signal *sig=base->getSignal(it->getType(),new PortMap(*it3));
     144//      if(e->type() == QMouseEvent::MouseMove){
     145//        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) {
     146//          b2 = true;
     147//          s = it3->getName();
     148//          sx = portX;
     149//          sy = portY;
     150//        }
     151//      }
     152//       }
     153    }
     154   
     155    if(b){
     156      write_name(s);
     157      write_position(ppx,ppy);
     158      write_size(taillex,tailley);
     159      write_comment(c);
     160    }
     161    else{
     162      write_name("");
     163      erase_position();
     164      erase_size();
     165      write_comment("");
     166    }
     167   
     168   
     169    // if(b2){
     170//       write_name(s);
     171//       write_position(sx,sy);
     172//     }
     173//     else{
     174//       write_name("");
     175//       erase_position();
     176//     }
     177    //  }
     178 
     179//    bool b3;
     180//    int sx2,sy2;
     181//    string s2;
     182   
     183//    for(QList<Port>::iterator it=port_east.begin(); it!=port_east.end(); ++it){
     184//       portX = it->get_x();
     185//       portY = it->get_y();
     186//       if(mouseX >= portX - 10 && mouseY >= portY - 10 && mouseX <= portX + 10 && mouseY <= portY + 10){
     187//      b3 = true;
     188//      s2 = it->getName();
     189//      sx2 = portX;
     190//      sy2 = portY;
     191//       }
     192//     }
     193   
     194//     for(QList<Port>::iterator it=port_west.begin(); it!=port_west.end(); ++it){
     195//       portX = it->get_x() ;
     196//       portY = it->get_y() ;
     197//       if(mouseX >= portX - 5 && mouseY >= portY - 5 && mouseX <= portX + 5 && mouseY <= portY + 5){
     198//      b3 = true;
     199//      s2 = it->getName();
     200//      sx2 = portX;
     201//      sy2 = portY;
     202//       }
     203//     }
     204   
     205//     for(QList<Port>::iterator it=port_north.begin(); it!=port_north.end(); ++it){
     206//       portX = it->get_x() ;
     207//       portY = it->get_y() ;
     208//       if(mouseX >= portX - 5 && mouseY >= portY - 5 && mouseX <= portX + 5 && mouseY <= portY + 5){
     209//      b3 = true;
     210//      s2 = it->getName();
     211//      sx2 = portX;
     212//      sy2 = portY;
     213//       }
     214//     }
     215   
     216//     for(QList<Port>::iterator it=port_south.begin(); it!=port_south.end(); ++it){
     217//       portX = it->get_x() ;
     218//       portY = it->get_y() ;
     219//       if(mouseX >= portX - 5 && mouseY >= portY - 5 && mouseX <= portX + 5 && mouseY <= portY + 5){
     220//      b3 = true;
     221//      s2 = it->getName();
     222//      sx2 = portX;
     223//      sy2 = portY;
     224//       }
     225//     }
     226   }
     227}
     228   
     229 
     230void Window::_back(){
     231  if(cpt_level==0){
     232    QMessageBox *m = new QMessageBox(this);
     233    m->setText("can't go up, you're on the top level !");
     234    m->addButton("ok",QMessageBox::YesRole);
     235    m->show(); 
     236  }
    73237 
    74 void Window::_back(){
    75  
    76   paint = false;
    77   repaint();
    78   mess_charg = new QWidget();
    79   mess_charg->setFixedSize(200,50);
    80   mess_charg->move(200,50);
    81   charg_open = true;
    82   QBoxLayout *b = new QBoxLayout(QBoxLayout::TopToBottom,0);
    83   QLabel *l = new QLabel();
    84   l->setText("please wait while charging");
    85   b->addWidget(l);
    86   mess_charg->setLayout(b);
    87   mess_charg->show();
    88  
    89  
    90  
    91   if(father==" "){
    92     QList <BaseP> *liste_compo = base->getBaseP(); 
    93     p = liste_compo->at(0); 
     238  else{
     239    this->setDisabled(true);
     240    paint = false;
     241    repaint();
     242    cpt_level--;
     243    mess_charg = new QWidget();
     244    mess_charg->setFixedSize(200,50);
     245    mess_charg->move(200,50);
     246    charg_open = true;
     247    QBoxLayout *b = new QBoxLayout(QBoxLayout::TopToBottom,0);
     248    QLabel *l = new QLabel();
     249    l->setText("please wait while charging");
     250    b->addWidget(l);
     251    mess_charg->setLayout(b);
     252    mess_charg->show();
     253   
     254    p = base->get_BasePos(father.toStdString());
     255    entity = p.getEntity();
     256    c = new Coord(250,250,250,250);
     257    port_east = entity->getPortEast(c);
     258    port_west = entity->getPortWest(c);
     259    port_north = entity->getPortNorth(c);
     260    port_south = entity->getPortSouth(c);
     261    father = tab[cpt_level];
     262    current = QString::fromStdString(entity->getName());
     263    paint = true;
     264    repaint();
     265    this->setDisabled(false);
    94266  }
    95 
    96   else{
    97     p = base->get_BasePos(father.toStdString());
    98   }
    99 
    100   entity = p.getEntity();
    101   c = new Coord(250,250,250,250);
    102   port_east = entity->getPortEast(c);
    103   port_west = entity->getPortWest(c);
    104   port_north = entity->getPortNorth(c);
    105   port_south = entity->getPortSouth(c);
    106   father = current;
    107   current = QString::fromStdString(entity->getName());
    108   paint = true;
    109   repaint();
    110267}
    111268
  • trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/src/Graphics_parameters_window.cpp

    r21 r26  
    1212  parameters = new QBoxLayout(QBoxLayout::TopToBottom,0);
    1313  wparam->setWindowTitle("parameters");
    14   wparam->setFixedSize(250,300);
    15   wparam->move(678,370);
    16 
    17   lname = new QLabel(wparam);
    18   lname->setText("");
     14  wparam->setFixedSize(350,300);
     15  wparam->move(628,370);
    1916
    2017  QBoxLayout *bpos = new QBoxLayout(QBoxLayout::LeftToRight,0);
     
    4946  bsize2->addWidget(sy);
    5047  bsize2->addWidget(sizeY);
    51  
    52   QBoxLayout *bport = new QBoxLayout(QBoxLayout::LeftToRight,0);
    53   QLabel *lport = new QLabel();
    54   lport->setText("nb ports : ");
    55   nb_ports = new QLineEdit();
    56   nb_ports->setText("");
    57   bport->addWidget(lport);
    58   bport->addWidget(nb_ports);
    59 
    60   parameters->addWidget(lname);
    6148  parameters->addLayout(bpos);
    6249  parameters->addLayout(bpos2);
    6350  parameters->addLayout(bsize);
    6451  parameters->addLayout(bsize2);
    65   parameters->addLayout(bport);
     52  QPushButton *noselect = new QPushButton("cancel selection",wparam);
    6653  QPushButton *back = new QPushButton("back",wparam);
    6754  QPushButton *apply = new QPushButton("apply",wparam);
    6855  connect(back,SIGNAL(clicked()),this,SLOT(_back()));
     56  connect(noselect,SIGNAL(clicked()),this,SLOT(_cancel_selection()));
     57  connect(apply,SIGNAL(clicked()),this,SLOT(_apply()));
     58 
     59  parameters->addWidget(noselect);
    6960  parameters->addWidget(back);
    7061  parameters->addWidget(apply);
     
    7263  wparam->setLayout(parameters);
    7364  wparam->show();
    74 }
    75 
    76 void Window::write_name(string name){
    77   QString n = QString::fromStdString(name);
    78   lname->setText(n);
    79  
    8065}
    8166
     
    9176  str2 = out2.str();
    9277  positionY->setText(QString::fromStdString(str2));
    93  
     78}
     79
     80void Window::erase_position(){
     81  positionX->setText("");
     82  positionY->setText("");
    9483}
    9584
     
    10796}
    10897
    109 void Window::write_ports(int x){
    110   stringstream out;
    111   string str;
    112   out << x;
    113   str = out.str();
    114   nb_ports->setText(QString::fromStdString(str));
    115   wparam->show();
     98void Window::erase_size(){
     99  sizeX->setText("");
     100  sizeY->setText("");
    116101}
    117102
     103void Window::_cancel_selection(){
     104  component_clicked = false;
     105}
    118106
     107void Window::_apply(){
     108  if(positionX->isModified())
     109    cout << "positionX modified : " << positionX->text().toStdString() << endl;
     110  if(positionY->isModified())
     111    cout << "positionY modified : " << positionX->text().toStdString() << endl;
     112  if(sizeX->isModified())
     113    cout << "sizeX modified : " << sizeX->text().toStdString() << endl;
     114  if(sizeY->isModified())
     115    cout << "sizeY modified : " << sizeY->text().toStdString() << endl;
     116}
  • trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Makefile

    r21 r26  
    11#############################################################################
    22# Makefile for building: bin/Viewer
    3 # Generated by qmake (2.01a) (Qt 4.2.2) on: Wed May 9 19:23:22 2007
     3# Generated by qmake (2.01a) (Qt 4.2.2) on: Sun May 20 18:09:08 2007
    44# Project:  Viewer.pro
    55# Template: app app
     
    9393                Bdd/src/ListePorts_searchPort.cpp \
    9494                Parser/src/Parse_alloc.cpp \
     95                Parser/src/Parse_closeBaseV.cpp \
     96                Parser/src/Parse_accessors.cpp \
    9597                Parser/src/Parse_parser_pos.cpp \
    9698                Parser/src/Parse_getBaseV.cpp \
     
    155157                obj/ListePorts_searchPort.o \
    156158                obj/Parse_alloc.o \
     159                obj/Parse_closeBaseV.o \
     160                obj/Parse_accessors.o \
    157161                obj/Parse_parser_pos.o \
    158162                obj/Parse_getBaseV.o \
     
    264268dist:
    265269        @$(CHK_DIR_EXISTS) obj/Viewer1.0.0 || $(MKDIR) obj/Viewer1.0.0
    266         $(COPY_FILE) --parents $(SOURCES) $(DIST) obj/Viewer1.0.0/ && $(COPY_FILE) --parents Bdd/include/Architecture.h Bdd/include/BaseP.h Bdd/include/BaseV.h Bdd/include/Component.h Bdd/include/Coord.h Bdd/include/Entity.h Bdd/include/ListePorts.h Bdd/include/Port.h Bdd/include/PortMap.h Bdd/include/Signal.h Graphics/include/window.h Parser/include/parser.h obj/Viewer1.0.0/ && $(COPY_FILE) --parents Bdd/src/Architecture_accessors.cpp Bdd/src/BaseP_accessors.cpp Bdd/src/Architecture_addComponent.cpp Bdd/src/Architecture_alloc.cpp Bdd/src/Architecture_searchComponent.cpp Bdd/src/Architecture_unalloc.cpp Bdd/src/BaseP_alloc.cpp Bdd/src/BaseP_unalloc.cpp Bdd/src/BaseV_accessors.cpp Bdd/src/BaseV_addBaseP.cpp Bdd/src/BaseV_addParam.cpp Bdd/src/BaseV_afficheBaseConsole.cpp Bdd/src/BaseV_alloc.cpp Bdd/src/BaseV_searchComponent.cpp Bdd/src/BaseV_unalloc.cpp Bdd/src/Component_accessors.cpp Bdd/src/Component_addPortMap.cpp Bdd/src/Component_alloc.cpp Bdd/src/Component_getPosition.cpp Bdd/src/Component_unalloc.cpp Bdd/src/Coord_alloc.cpp Bdd/src/Coord_unalloc.cpp Bdd/src/Signal_unalloc.cpp Bdd/src/ListePorts_getPortSouth.cpp Bdd/src/Port_accessors.cpp Bdd/src/Signal_alloc.cpp Bdd/src/Port_alloc.cpp Bdd/src/Signal_accessors.cpp Bdd/src/Coord_accessors.cpp Bdd/src/Port_unalloc.cpp Bdd/src/ListePorts_getPortEast.cpp Bdd/src/BaseV_getSignal.cpp Bdd/src/PortMap_alloc.cpp Bdd/src/Entity_alloc.cpp Bdd/src/PortMap_unalloc.cpp Bdd/src/ListePorts_alloc.cpp Bdd/src/PortMap_accessors.cpp Bdd/src/ListePorts_unalloc.cpp Bdd/src/ListePorts_countPort.cpp Bdd/src/ListePorts_getPortWest.cpp Bdd/src/Entity_unalloc.cpp Bdd/src/ListePorts_getPortNorth.cpp Bdd/src/Entity_accessors.cpp Bdd/src/ListePorts_addPort.cpp Bdd/src/ListePorts_accessors.cpp Bdd/src/ListePorts_searchPort.cpp Parser/src/Parse_alloc.cpp Parser/src/Parse_parser_pos.cpp Parser/src/Parse_getBaseV.cpp Parser/src/Parse_unalloc.cpp Parser/src/Parse_open_file.cpp Graphics/src/Graphics_main.cpp Graphics/src/Graphics_file_actions.cpp Graphics/src/Graphics_tools_actions.cpp Graphics/src/Graphics_about_actions.cpp Graphics/src/Graphics_main_window.cpp Graphics/src/Graphics_informations_window.cpp Graphics/src/Graphics_drawPort.cpp Graphics/src/Graphics_parameters_window.cpp Graphics/src/Graphics_setParse.cpp Graphics/src/Graphics_drawAll.cpp Graphics/src/Graphics_mouseEvent.cpp obj/Viewer1.0.0/ && (cd `dirname obj/Viewer1.0.0` && $(TAR) Viewer1.0.0.tar Viewer1.0.0 && $(COMPRESS) Viewer1.0.0.tar) && $(MOVE) `dirname obj/Viewer1.0.0`/Viewer1.0.0.tar.gz . && $(DEL_FILE) -r obj/Viewer1.0.0
     270        $(COPY_FILE) --parents $(SOURCES) $(DIST) obj/Viewer1.0.0/ && $(COPY_FILE) --parents Bdd/include/Architecture.h Bdd/include/BaseP.h Bdd/include/BaseV.h Bdd/include/Component.h Bdd/include/Coord.h Bdd/include/Entity.h Bdd/include/ListePorts.h Bdd/include/Port.h Bdd/include/PortMap.h Bdd/include/Signal.h Graphics/include/window.h Parser/include/parser.h obj/Viewer1.0.0/ && $(COPY_FILE) --parents Bdd/src/Architecture_accessors.cpp Bdd/src/BaseP_accessors.cpp Bdd/src/Architecture_addComponent.cpp Bdd/src/Architecture_alloc.cpp Bdd/src/Architecture_searchComponent.cpp Bdd/src/Architecture_unalloc.cpp Bdd/src/BaseP_alloc.cpp Bdd/src/BaseP_unalloc.cpp Bdd/src/BaseV_accessors.cpp Bdd/src/BaseV_addBaseP.cpp Bdd/src/BaseV_addParam.cpp Bdd/src/BaseV_afficheBaseConsole.cpp Bdd/src/BaseV_alloc.cpp Bdd/src/BaseV_searchComponent.cpp Bdd/src/BaseV_unalloc.cpp Bdd/src/Component_accessors.cpp Bdd/src/Component_addPortMap.cpp Bdd/src/Component_alloc.cpp Bdd/src/Component_getPosition.cpp Bdd/src/Component_unalloc.cpp Bdd/src/Coord_alloc.cpp Bdd/src/Coord_unalloc.cpp Bdd/src/Signal_unalloc.cpp Bdd/src/ListePorts_getPortSouth.cpp Bdd/src/Port_accessors.cpp Bdd/src/Signal_alloc.cpp Bdd/src/Port_alloc.cpp Bdd/src/Signal_accessors.cpp Bdd/src/Coord_accessors.cpp Bdd/src/Port_unalloc.cpp Bdd/src/ListePorts_getPortEast.cpp Bdd/src/BaseV_getSignal.cpp Bdd/src/PortMap_alloc.cpp Bdd/src/Entity_alloc.cpp Bdd/src/PortMap_unalloc.cpp Bdd/src/ListePorts_alloc.cpp Bdd/src/PortMap_accessors.cpp Bdd/src/ListePorts_unalloc.cpp Bdd/src/ListePorts_countPort.cpp Bdd/src/ListePorts_getPortWest.cpp Bdd/src/Entity_unalloc.cpp Bdd/src/ListePorts_getPortNorth.cpp Bdd/src/Entity_accessors.cpp Bdd/src/ListePorts_addPort.cpp Bdd/src/ListePorts_accessors.cpp Bdd/src/ListePorts_searchPort.cpp Parser/src/Parse_alloc.cpp Parser/src/Parse_closeBaseV.cpp Parser/src/Parse_accessors.cpp Parser/src/Parse_parser_pos.cpp Parser/src/Parse_getBaseV.cpp Parser/src/Parse_unalloc.cpp Parser/src/Parse_open_file.cpp Graphics/src/Graphics_main.cpp Graphics/src/Graphics_file_actions.cpp Graphics/src/Graphics_tools_actions.cpp Graphics/src/Graphics_about_actions.cpp Graphics/src/Graphics_main_window.cpp Graphics/src/Graphics_informations_window.cpp Graphics/src/Graphics_drawPort.cpp Graphics/src/Graphics_parameters_window.cpp Graphics/src/Graphics_setParse.cpp Graphics/src/Graphics_drawAll.cpp Graphics/src/Graphics_mouseEvent.cpp obj/Viewer1.0.0/ && (cd `dirname obj/Viewer1.0.0` && $(TAR) Viewer1.0.0.tar Viewer1.0.0 && $(COMPRESS) Viewer1.0.0.tar) && $(MOVE) `dirname obj/Viewer1.0.0`/Viewer1.0.0.tar.gz . && $(DEL_FILE) -r obj/Viewer1.0.0
    267271
    268272
     
    449453        $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/Parse_alloc.o Parser/src/Parse_alloc.cpp
    450454
     455obj/Parse_closeBaseV.o: Parser/src/Parse_closeBaseV.cpp
     456        $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/Parse_closeBaseV.o Parser/src/Parse_closeBaseV.cpp
     457
     458obj/Parse_accessors.o: Parser/src/Parse_accessors.cpp
     459        $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/Parse_accessors.o Parser/src/Parse_accessors.cpp
     460
    451461obj/Parse_parser_pos.o: Parser/src/Parse_parser_pos.cpp
    452462        $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/Parse_parser_pos.o Parser/src/Parse_parser_pos.cpp
  • trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Parser/include/parser.h

    r20 r26  
    1717#include "Tools/Viewer/Bdd/include/PortMap.h"
    1818
    19 
     19#define LEVEL_MAX 8
    2020
    2121using namespace std;
     
    3232  string s;
    3333  string absolutePath;
     34  string toplevel;
    3435
    35 protected:
    3636  morpheo::tools::viewer::bdd::BaseV *base;
    3737  morpheo::tools::viewer::bdd::BaseP *pos;
    38   morpheo::tools::viewer::bdd::Entity *ent;
    39   morpheo::tools::viewer::bdd::Architecture *arch;
    40   morpheo::tools::viewer::bdd::Component *ctemp;
    41   //  morpheo::tools::viewer::bdd::Param *param;
    42 
    43 
     38  morpheo::tools::viewer::bdd::Entity *ent[LEVEL_MAX];
     39  morpheo::tools::viewer::bdd::Architecture *arch[LEVEL_MAX];
     40  morpheo::tools::viewer::bdd::Component *ctemp[LEVEL_MAX];
     41 
     42protected:
    4443
    4544public:
     
    4746  Parse(void);
    4847  ~Parse(void);
    49   void parser_pos(QDomNode n);
    50   //void ParseParam(void);
    51   int open_file(string name);
     48  void parser_pos(QDomNode n,int level);
     49
     50  int open_file(string name,int level);
    5251  //void saveFile(string name);
    5352  morpheo::tools::viewer::bdd::BaseV *getBaseV();
    54 
    55  
     53  string getTopLevelName();
     54  string getAbsolutePath();
     55  /*Close and erase baseV*/
     56  void closeBaseV();
    5657 //void refresh();
    5758 
  • trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Parser/src/Parse_open_file.cpp

    r20 r26  
    1010namespace parser{
    1111
    12    int Parse::open_file(string name){
     12   int Parse::open_file(string name,int level){
     13
    1314    QFile file(QString::fromStdString(name));
     15    QString testname,testname2;
    1416    QString tmppath=QString::fromStdString(name);
    15 
    1617    QString path=tmppath.left(tmppath.lastIndexOf('/',-1,Qt::CaseSensitive)+1);
    17 
    1818    absolutePath=path.toStdString();
    19 
     19    testname=tmppath.right(tmppath.lastIndexOf('.',-1,Qt::CaseSensitive)-1);
     20    testname2=testname.left(testname.lastIndexOf('.',-1,Qt::CaseSensitive));
     21   
     22    if(tmppath.contains('-') && level==0) //file not top level (first open file)
     23      {
     24        testname2=testname2.left(testname2.lastIndexOf('-',-1,Qt::CaseSensitive));
     25      }
     26   
     27   
    2028     if( !file.open( QIODevice::ReadOnly ) )
    2129       {
     
    4452         #endif
    4553         //BaseP
    46          if(!base)
    47            base=new morpheo::tools::viewer::bdd::BaseV();
     54         if(!base){
     55           base=new morpheo::tools::viewer::bdd::BaseV();
     56           toplevel=testname2.toStdString();
     57         }
    4858         pos=new morpheo::tools::viewer::bdd::BaseP();
    4959         //base->addBaseP(pos);
    50          parser_pos(root.firstChild());   
     60         parser_pos(root.firstChild(),level);   
    5161         
    5262       }
     63
     64     //     delete pos;
     65     //delete ctemp;
    5366     return 0;
    54 
    55 
    5667   }
    5768
  • trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Parser/src/Parse_parser_pos.cpp

    r20 r26  
    1010namespace parser{     
    1111
    12   void Parse::parser_pos(QDomNode n){
     12  void Parse::parser_pos(QDomNode n,int level){
     13    string fichier;
    1314       while( !n.isNull() )
    1415      {
     
    2526                //BaseP
    2627                pos->setComment(e.text().toStdString());
     28                pos->setLevel(level);
     29               
    2730              }
    2831            if (e.tagName() == "entity" )
    2932              {
    30                 #ifdef DBUG_PARSE
     33                #ifdef DBUG_PARSE
    3134                cout << "entity" <<endl;
    3235                cout << e.attribute("name","").toStdString() <<endl;
    3336                #endif
    34                 ent=new morpheo::tools::viewer::bdd::Entity\
     37
     38                ent[level]=new morpheo::tools::viewer::bdd::Entity\
    3539                  (e.attribute("name","").toStdString(),\
     40                   e.attribute("type","").toStdString(),\
    3641                   e.attribute("schema","").toInt(0,10));
    37                 s=e.attribute("type","").toStdString();
    38                 pos->setEntity(ent);
    39                 parser_pos(n.firstChild());
     42                s=e.attribute("name","").toStdString();
     43                pos->setEntity(ent[level]);
     44
     45                parser_pos(n.firstChild(),level);
    4046               
    4147                if((n.nextSiblingElement()).tagName() !="architecture")
     
    5965                       e.attribute("localisation","").toStdString());
    6066                p->setComment(e.text().toStdString());
    61                 ent->addport(p);
     67                ent[level]->addport(p);
    6268              }
    6369            if (e.tagName() == "architecture" )
     
    6672                cout << "architecture" <<endl;
    6773                #endif
    68                 arch=new morpheo::tools::viewer::bdd::Architecture();
    69                 pos->setArchitecture(arch);
     74                arch[level]=new morpheo::tools::viewer::bdd::Architecture();
     75                pos->setArchitecture(arch[level]);
    7076               
    7177                base->addBaseP(pos,s);
    7278
    73                 parser_pos(n.firstChild());   
     79                parser_pos(n.firstChild(),level);   
    7480              }
    7581            if (e.tagName() == "component" )
     
    8692                            e.attribute("size_x","").toInt(0,10),\
    8793                            e.attribute("size_y","").toInt(0,10));
    88                 arch->addComponent(comp, e.attribute("type","").toStdString());
    89                 ctemp=comp;
     94                ctemp[level]=comp;
     95                arch[level]->addComponent(ctemp[level], e.attribute("name","").toStdString());
    9096               
    91                 string fichier=absolutePath;
    92                 fichier.append(e.attribute("type","").toStdString());
     97                fichier=absolutePath;
     98                fichier.append(ent[level]->getName());
     99                fichier.append("-");
     100                fichier.append((e.attribute("type","").toLower()).toStdString());
    93101                fichier.append(".pos");
    94                 #ifdef DBUG_PARSE
    95                 cout << fichier <<endl;
    96                 #endif
    97                 open_file(fichier);
    98                 parser_pos(n.firstChild());   
     102          #ifdef DBUG_PARSE
     103                cout << fichier <<endl;
     104          #endif
     105                if(open_file(fichier,level+1)==-1)
     106                  exit(1);
     107               
     108                parser_pos(n.firstChild(),level);   
     109               
    99110                //ajout ptr Port du sous composant
    100                 BaseP pt=base->get_BasePos(e.attribute("type","").toStdString());
     111                BaseP pt=base->get_BasePos((e.attribute("type","").toLower()).toStdString());
    101112                QList<Port> *sspor= (pt.getEntity())->getPort();
    102113                for(QList<Port>::iterator it=sspor->begin();it!=sspor->end();++it)
    103                   ctemp->addport(new Port(*it));
     114                  ctemp[level]->addport(new Port(*it));
    104115               
    105116              }
     
    115126                          e.attribute("port","").toStdString());
    116127               
    117                 ctemp->addPortMap(p);
     128                ctemp[level]->addPortMap(p);
    118129               
    119130              }
  • trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Viewer.pro

    r21 r26  
    9292                        Bdd/src/ListePorts_accessors.cpp                                \
    9393                        Bdd/src/ListePorts_searchPort.cpp                               \
    94                         Parser/src/Parse_alloc.cpp                                      \
     94                        Parser/src/Parse_alloc.cpp                                      \               
     95                        Parser/src/Parse_closeBaseV.cpp                                 \
     96                        Parser/src/Parse_accessors.cpp                                  \
    9597                        Parser/src/Parse_parser_pos.cpp                                 \
    9698                        Parser/src/Parse_getBaseV.cpp                                   \
Note: See TracChangeset for help on using the changeset viewer.