Changeset 30


Ignore:
Timestamp:
May 24, 2007, 4:43:17 PM (17 years ago)
Author:
chou
Message:

Morpheo Viewer Release 4.0 :
changements graphiques .

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

Legend:

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

    r22 r30  
    2222      string comment;
    2323      int level;
     24     
    2425    protected:
    2526     
     
    3839      int getLevel();
    3940      void setLevel (int v);
     41      int getSchema();
    4042    };//end class BaseP
    4143
  • trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Bdd/src/BaseP_accessors.cpp

    r26 r30  
    4949  }
    5050
     51  int BaseP::getSchema(){return ent->getSchema();}
    5152};//end bdd
    5253};//end viewer
  • trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Bdd/src/BaseV_searchComponent.cpp

    r26 r30  
    1313  morpheo::tools::viewer::bdd::BaseP BaseV::get_BasePos(string v){
    1414    int tmp=listcomp->indexOf(v,0);
    15     if(tmp==-1)
     15    if(tmp==-1){
     16      cout << "not found\n";
    1617      return NULL;
     18    }
    1719    else
    1820      return pos->operator[](tmp);
  • trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/include/window.h

    r26 r30  
    3939#include <qdirmodel.h>
    4040#include <qevent.h>
     41#include <qfiledialog.h>
    4142
    4243
     
    7475   
    7576  void _open(); //open a file
    76   void _open_end();
    77   void _open_error();
     77 void _open_error();
    7878
    7979  void _save(); //save a file
     
    111111  void drawPort(int x,int y,int pos,string dir); //draw the components ports
    112112  void write_name(string name); //write the name of the component clicked name in the informations window
    113   void write_position(int x, int y);//write the position of the position clicked in the informations window
    114   void write_size(int x, int y);//write the size of the component clicked in the informations window
    115113  void write_comment(string comment);
    116   void erase_position();
    117   void erase_size();
     114  void write_type(string t);
    118115
    119116  QList <Port> port_east; //ports lists
     
    127124  QWidget *ws;
    128125  QWidget *wq;
    129   QWidget *wo;
    130126  QWidget *wa;
    131127
     
    148144  QString current_name; //name of the current file opened
    149145
    150   /*items of the parameters window*/
    151   QLineEdit *positionX; //x position
    152   QLineEdit *positionY;//y position
    153   QLineEdit *sizeX;//x size
    154   QLineEdit *sizeY;//y size
    155  
    156146  /*items of the informations window*/
    157147  QLabel *lname;//name of the component clicked
     148  QLabel *ln;
    158149  QLineEdit *comment;//comment associated with the component clicked
     150  QLabel *lt;
     151  QLabel *ltype;//type of the component
     152 
    159153  int level; //level of architecture
    160154  int mouseX; //mouse position
     
    185179  bool paint; //(re)paint or not
    186180  bool wq_open; //know if Quit/Open ( 2 windows possible)/Save window is open
    187   bool wo_open;
    188   bool ws_open;
    189181  bool wa_open;
    190182  bool quit_demand;//know if user clicked on "quit" (used for saving file before quit)
    191183  bool file_open;//know if a file is still open (used if user wants to open another file)
    192   bool is_parse;//know is the base has been created
    193184  bool signalName;//show or hide signals name
    194185  bool componentName;//show or hide components name
  • trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/src/Graphics_drawAll.cpp

    r26 r30  
    77void Window::paintEvent( QPaintEvent * )
    88{
    9    
    109  /*draw window size*/
    1110  setMinimumSize(600,600);
    12    
     11   
     12  int schema;
     13  QString t;
     14 
    1315  if(paint){
    1416    painter.begin(this);
     
    5355        tailleX = co->get_size_x();
    5456        tailleY = co->get_size_y();
    55         painter.drawRect(posX,posY,tailleX,tailleY);
     57       
     58        t=QString::fromStdString(it->getType()).toLower();
     59        BaseP tp = base->get_BasePos(t.toStdString());
     60        if(&tp != NULL){
     61          schema=tp.getSchema();
     62          switch(schema){
     63          case 0:
     64            painter.drawRect(posX,posY,tailleX,tailleY);
     65            break;
     66          case 1:
     67            painter.drawEllipse(posX,posY,tailleX,tailleY);
     68            break; 
     69          case 2:
     70            painter.drawRect(posX,posY,tailleX,tailleY);
     71            painter.drawLine(posX+tailleX/4,posY+tailleY,posX+tailleX/4,posY);
     72            painter.drawLine(posX+tailleX/2,posY+tailleY,posX+tailleX/2,posY);
     73            painter.drawLine(posX+3*tailleX/4,posY+tailleY,posX+3*tailleX/4,posY);
     74            break;
     75          case 3:
     76            painter.drawRect(posX,posY,tailleX,tailleY);
     77            painter.drawLine(posX,posY+tailleY,posX+tailleX/2,posY+tailleY/2);
     78            painter.drawLine(posX+tailleX,posY+tailleY,posX+tailleX/2,posY+tailleY/2);
     79            break;
     80          }
     81        }
     82
    5683        if (componentName){
    5784          QString compo_name = QString::fromStdString(it->getName());
  • trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/src/Graphics_file_actions.cpp

    r26 r30  
    1010
    1111void Window::_open(){
    12   //if no file open or if the file opened has been saved -> open other file, else -> ask for saving file
    13   if(!file_open || is_save){
    14     wo = new QWidget();
    15     wo_open = true; //the "open" window is open
    16     if(wa_open)
    17       wa->close();
    18     QBoxLayout *open_box = new QBoxLayout(QBoxLayout::TopToBottom,0);
    19     wo->setWindowTitle("open : file name");
    20     wo->setFixedSize(500,500);
    21     wo->move(50,100);
    22     QDirModel *dir = new QDirModel();
    23     QTreeView *tree = new QTreeView(wo);
    24     tree->resize(400,400);
    25     tree->setModel(dir);
    26     tree->setRootIndex(dir->index("./data/"));
    27     file_name = new QLineEdit(wo);
    28     QPushButton *ok_open = new QPushButton("ok",wo);
    29     connect(ok_open,SIGNAL(clicked()),this,SLOT(_open_end()));
    30     open_box->addWidget(tree);
    31     open_box->addWidget(file_name);
    32     open_box->addWidget(ok_open);
    33     wo->setLayout(open_box);
    34     wo->show();
     12  QString current2;
     13  if(!file_open && is_save){//if no file open or if the file opened has been saved -> open other file, else -> ask for saving file
     14    current2 = QFileDialog::getOpenFileName(this,"", "./data");
     15    if(current2!=""){
     16      this->setDisabled(true);
     17      current_name = current2;
     18      if(parse->open_file( current_name.toStdString(),0)==-1)
     19        _open_error();
     20      else{
     21        paint = false;
     22        repaint();
     23        _init_file();
     24      }
     25    }
    3526  }
    3627  else{
    37     wa_open = true;
    3828    file_open = false;
    39     wa = new QWidget();
    40     QBoxLayout *other_box = new QBoxLayout(QBoxLayout::LeftToRight,0);
    41     wa->setFixedSize(500,60);
    42     wa->move(50,100);
    43     QLabel *label = new QLabel("do you want to save this file?");
    44     QPushButton *yes_save = new QPushButton("yes",wa);
    45     QPushButton *no_save = new QPushButton("no",wa);
    46     if(current_name!=NULL)
    47       connect(yes_save,SIGNAL(clicked()),this,SLOT(_save()));
    48     else
    49       connect(yes_save,SIGNAL(clicked()),this,SLOT(_saveAs()));
    50     connect(no_save,SIGNAL(clicked()),this,SLOT(_open()));
    51     other_box->addWidget(label);
    52     other_box->addWidget(yes_save);
    53     other_box->addWidget(no_save);
    54     wa->setLayout(other_box);
    55     wa->show();
    56   }
    57 }
    58 
    59 
    60 void Window::_open_end(){
    61   current_name=file_name->text();
    62   wo->close();
    63   wo_open = false;//the "open" window is now closed
    64   if(!is_parse){
    65     parse = new Parse();
    66     is_parse=true;
    67   }
    68   if(parse->open_file( current_name.toStdString(),0)==-1)
    69     _open_error();
    70   else{
    71   paint = false;
    72   repaint();
    73   _init_file();
     29    if(!is_save){
     30      wa_open = true;
     31      wa = new QWidget();
     32      QBoxLayout *other_box = new QBoxLayout(QBoxLayout::LeftToRight,0);
     33      wa->setFixedSize(500,60);
     34      wa->move(50,100);
     35      QLabel *label = new QLabel("do you want to save this file?");
     36      QPushButton *yes_save = new QPushButton("yes",wa);
     37      QPushButton *no_save = new QPushButton("no",wa);
     38      if(current_name!=NULL)
     39        connect(yes_save,SIGNAL(clicked()),this,SLOT(_save()));
     40      else
     41        connect(yes_save,SIGNAL(clicked()),this,SLOT(_saveAs()));
     42      connect(no_save,SIGNAL(clicked()),this,SLOT(_open()));
     43      other_box->addWidget(label);
     44      other_box->addWidget(yes_save);
     45      other_box->addWidget(no_save);
     46      wa->setLayout(other_box);
     47      wa->show();
     48    }
     49    else{
     50      parse->closeBaseV();
     51      _open();
     52    }
    7453  }
    7554}
     
    9675  paint = true;
    9776  repaint();
     77  this->setDisabled(false);
    9878  setMouseTracking(true);
    9979}
     
    11292      wa->close();
    11393    if(save_as || first_save || (current_name==NULL)){//if "save as" or if it's the first time the user click on save (new file) -> save as
    114       ws = new QWidget();
    115       ws_open = true;//the "save" window is open
    116       QBoxLayout *save_box = new QBoxLayout(QBoxLayout::LeftToRight,0);
    117       ws->setWindowTitle("save : file name");
    118       ws->setFixedSize(300,60);
    119       ws->move(50,100);
    120       file_name = new QLineEdit(ws);
    121       QPushButton *ok_save = new QPushButton("ok",ws);
    122       connect(ok_save,SIGNAL(clicked()),this,SLOT(_saveAsOk()));
    123       save_box->addWidget(file_name);
    124       save_box->addWidget(ok_save);
    125       ws->setLayout(save_box);
    126       ws->show();
     94      current_name = QFileDialog::getSaveFileName(this,"","./data");
    12795      save_as = false;
    12896      first_save = false;
     
    155123
    156124void Window::_saveAsOk(){
    157   current_name = file_name->text();
    158   ws->close();//close the "save" window
    159   ws_open = false;
    160125  is_save = true;
    161126  status->showMessage("file " + current_name + " saved",900);
     
    170135void Window::_close(){
    171136  paint = false;
     137  parse->closeBaseV();
    172138  lname->setText("");
     139  ln->setText("");
     140  lt->setText("");
     141  write_name("");
     142  write_comment("");
     143  comment->hide();
    173144  winfo->show();
    174145  file_open = false;
     
    206177  if(wq_open)
    207178    wq->close();
    208   if(wo_open)
    209     wo->close();
    210   if(ws_open)
    211     ws->close();
    212179  if(wa_open)
    213180    wa->close();
  • trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/src/Graphics_informations_window.cpp

    r26 r30  
    1414  winfo->setFixedSize(350,292);
    1515  winfo->move(628,50);
     16
     17  QBoxLayout *bname = new QBoxLayout(QBoxLayout::LeftToRight,0);
     18  ln = new QLabel();
     19  ln->setText("");
    1620  lname = new QLabel();
    1721  lname->setText("");
     22  bname->addWidget(ln);
     23  bname->addWidget(lname);
     24
     25  QBoxLayout *btype = new QBoxLayout(QBoxLayout::LeftToRight,0);
     26  lt = new QLabel();
     27  lt->setText("");
     28  ltype = new QLabel();
     29  ltype->setText("");
     30  btype->addWidget(lt);
     31  btype->addWidget(ltype);
     32
    1833  comment = new QLineEdit();
    1934  comment->setText("");
    20   informations->addWidget(lname);
     35  comment->setReadOnly(true);
     36
     37  QPushButton *noselect = new QPushButton("cancel selection",wparam);
     38  QPushButton *back = new QPushButton("back",wparam);
     39  connect(back,SIGNAL(clicked()),this,SLOT(_back()));
     40  connect(noselect,SIGNAL(clicked()),this,SLOT(_cancel_selection()));
     41
     42  informations->addLayout(bname);
     43  informations->addLayout(btype);
    2144  informations->addWidget(comment);
     45  informations->addWidget(noselect);
     46  informations->addWidget(back);
     47
    2248  winfo->setLayout(informations);
    2349  winfo->show();
     
    2753  QString c = QString::fromStdString(cm);
    2854  comment->setText(c);
     55  comment->show();
    2956}
    3057
     
    3360  lname->setText(n);
    3461}
     62
     63void Window::write_type(string type){
     64  lt->setText("type");
     65  QString n = QString::fromStdString(type);
     66  ltype->setText(n);
     67}
     68
     69void Window::_cancel_selection(){
     70  component_clicked = false;
     71}
  • trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/src/Graphics_main_window.cpp

    r26 r30  
    1010{
    1111  paint = false;
    12   is_parse = false;
    1312  window_height = 620;
    1413  window_width = 620;
     
    137136
    138137  /*little windows (open, save...), closed at init*/
    139   wo_open = false;
    140138  wq_open = false;
    141   ws_open = false;
    142139  wa_open = false;
    143140
     
    157154    file_open = false;
    158155    paint = false;
    159     is_save = false;
     156    is_save = true;
    160157  }
    161158}
  • trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/src/Graphics_mouseEvent.cpp

    r28 r30  
    77
    88void Window::mousePressEvent (QMouseEvent *e){
    9  
    109  if(paint && (p.getArchitecture() != NULL)){
    1110
    1211    compo = p.getComponent();
    13    
    1412   
    1513    QMouseEvent *mouseEvent = (QMouseEvent *) e;
     
    2018    bool bc = false;
    2119    int cx,cy,tx,ty;
    22     string cc,nc;
     20    string cc,nc,type;
    2321    bool found = false;
    2422
     
    6765        tab[cpt_level] = father;
    6866        paint = true;
    69         this->releaseMouse();
    7067        repaint();
    7168        write_name("");
    7269        write_comment("");
    73         erase_position();
    74         erase_size();
     70        write_type("");
     71        ln->setText("");
     72        lt->setText("");
     73        comment->hide();
    7574        found = false;
    7675        this->setDisabled(false);
     76        component_clicked = false;
    7777      }
    7878     
     
    8585          tx = taillex;
    8686          ty = tailley;
     87          type = it->getType();
    8788          BaseP tp = base->get_BasePos(t.toStdString());
    8889          if(&tp != NULL)
     
    9495    if(bc){
    9596      write_name(nc);
    96       write_position(cx,cy);
    97       write_size(tx,ty);
     97      write_type(type);
     98      ln->setText("component");
     99      lt->setText("type");
    98100      write_comment(cc);
    99101    }
     
    103105
    104106void Window::mouseMoveEvent(QMouseEvent *e){
    105 
    106    bool b  = false;
    107    bool b2 = false;
    108    bool b3 = false;
    109    int px,py,taillex,tailley,ppx,ppy;
    110    string s,s2,c;
     107  bool b  = false;
     108  bool b2 = false;
     109  bool b3 = false;
     110  int px,py,taillex,tailley,ppx,ppy;
     111  string s,s2,c,type;
    111112
    112113   if(paint && (p.getArchitecture() != NULL) && !component_clicked){
     
    125126      taillex = co->get_size_x();
    126127      tailley = co->get_size_y();
    127      
     128      QString t=QString::fromStdString(it->getType()).toLower();
    128129      QList<PortMap> *pm=it->getPortMap();
    129130
     
    132133          b = true;
    133134          s = it->getName();
    134           BaseP tp=base->get_BasePos(it->getName());
     135          type = it->getType();
     136          BaseP tp=base->get_BasePos(t.toStdString());
    135137          if(&tp!=NULL)
    136138            c=tp.getComment();
     
    154156    if(b){
    155157      write_name(s);
    156       write_position(ppx,ppy);
    157       write_size(taillex,tailley);
     158      write_type(type);
     159      ln->setText("component");
    158160      write_comment(c);
     161      lt->setText("type");
    159162      b3 = false;
    160163      b2 = false;
     
    163166    if(b2){
    164167      write_name(s);
    165       erase_position();
     168      write_type("");
     169      lt->setText("");
    166170      write_comment("");
     171      ln->setText("signal");
     172      comment->hide();
    167173      b3 = false;
    168174      b = false;
     
    171177    if(!b && !b2){
    172178      write_name("");
    173       erase_position();
     179      write_type("");
     180      ln->setText("");
     181      lt->setText("");
    174182      write_comment("");
    175       erase_size();
    176     }
    177      
     183      comment->hide();
     184    }
    178185   }
    179186 
     
    217224      b = false;
    218225      write_name("");
    219       erase_position();
    220226      write_name(s2);
    221       erase_size();
     227      write_type(type);
     228      ln->setText("signal");
     229      lt->setText("");
     230      write_comment("");
     231      comment->hide();
    222232    }
    223233}
     
    262272    repaint();
    263273    this->setDisabled(false);
     274    component_clicked = false;
    264275  }
    265276}
  • trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/src/Graphics_parameters_window.cpp

    r26 r30  
    1515  wparam->move(628,370);
    1616
    17   QBoxLayout *bpos = new QBoxLayout(QBoxLayout::LeftToRight,0);
    18   QLabel *lx = new QLabel();
    19   lx->setText("position x : ");
    20   positionX = new QLineEdit();
    21   positionX->setText("");
    22   bpos->addWidget(lx);
    23   bpos->addWidget(positionX);
    2417 
    25   QBoxLayout *bpos2 = new QBoxLayout(QBoxLayout::LeftToRight,0);
    26   QLabel *ly = new QLabel();
    27   ly->setText("position y : ");
    28   positionY = new QLineEdit();
    29   positionY->setText("");
    30   bpos2->addWidget(ly);
    31   bpos2->addWidget(positionY);
    32  
    33   QBoxLayout *bsize = new QBoxLayout(QBoxLayout::LeftToRight,0);
    34   QLabel *sx = new QLabel();
    35   sx->setText("size x : ");
    36   sizeX = new QLineEdit();
    37   sizeX->setText("");
    38   bsize->addWidget(sx);
    39   bsize->addWidget(sizeX);
    40  
    41   QBoxLayout *bsize2 = new QBoxLayout(QBoxLayout::LeftToRight,0);
    42   QLabel *sy = new QLabel();
    43   sy->setText("size y : ");
    44   sizeY = new QLineEdit();
    45   sizeY->setText("");
    46   bsize2->addWidget(sy);
    47   bsize2->addWidget(sizeY);
    48   parameters->addLayout(bpos);
    49   parameters->addLayout(bpos2);
    50   parameters->addLayout(bsize);
    51   parameters->addLayout(bsize2);
    52   QPushButton *noselect = new QPushButton("cancel selection",wparam);
    53   QPushButton *back = new QPushButton("back",wparam);
    5418  QPushButton *apply = new QPushButton("apply",wparam);
    55   connect(back,SIGNAL(clicked()),this,SLOT(_back()));
    56   connect(noselect,SIGNAL(clicked()),this,SLOT(_cancel_selection()));
    5719  connect(apply,SIGNAL(clicked()),this,SLOT(_apply()));
    5820 
    59   parameters->addWidget(noselect);
    60   parameters->addWidget(back);
    6121  parameters->addWidget(apply);
    6222
     
    6525}
    6626
    67 void Window::write_position(int x, int y){
    68   stringstream out;
    69   string str;
    70   out << x;
    71   str = out.str();
    72   positionX->setText( QString::fromStdString(str));
    73   stringstream out2;
    74   string str2;
    75   out2 << y;
    76   str2 = out2.str();
    77   positionY->setText(QString::fromStdString(str2));
    78 }
    79 
    80 void Window::erase_position(){
    81   positionX->setText("");
    82   positionY->setText("");
    83 }
    84 
    85 void Window::write_size(int x,int y){
    86   stringstream out;
    87   string str;
    88   out << x;
    89   str = out.str();
    90   sizeX->setText(QString::fromStdString(str));
    91   stringstream out2;
    92   string str2;
    93   out2 << y;
    94   str2 = out2.str();
    95   sizeY->setText(QString::fromStdString(str2));
    96 }
    97 
    98 void Window::erase_size(){
    99   sizeX->setText("");
    100   sizeY->setText("");
    101 }
    102 
    103 void Window::_cancel_selection(){
    104   component_clicked = false;
    105 }
    10627
    10728void 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;
     29  cout << "apply\n";
    11630}
  • trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Parser/src/Parse_closeBaseV.cpp

    r27 r30  
    1313     int i;
    1414     for(i==0;i<LEVEL_MAX;i++)
    15        {
    16         delete ctemp[i];
    17         delete arch[i];
    18         delete ent[i];
    19        }
     15      {
     16      delete ctemp[i];
     17      delete arch[i];
     18      delete ent[i];
     19     }
    2020     delete pos;
    2121     delete base;
     22     toplevel.clear();
     23     absolutePath.clear();
     24     base=NULL;
    2225     
    2326   }
  • trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/data/two_level_branch_predictor-branch_history_table.pos

    r27 r30  
    99   <entity name="branch_history_table"
    1010           type="Branch_History_Table"
    11            schema="1" >
     11           schema="2" >
    1212
    1313      <port name="clock"           
  • trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/data/two_level_branch_predictor-pattern_history_table.pos

    r27 r30  
    99   <entity name="pattern_history_table"
    1010           type="Pattern_History_Table"
    11            schema="1" >
     11           schema="3" >
    1212
    1313      <port name="clock"           
Note: See TracChangeset for help on using the changeset viewer.