- Timestamp:
- May 30, 2007, 12:08:56 PM (17 years ago)
- Location:
- trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/src
- Files:
-
- 1 deleted
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/src/Graphics_about_actions.cpp
r21 r32 6 6 using namespace morpheo::tools::viewer::graphics; 7 7 8 8 /*about window constructor*/ 9 9 void Window::_about(){ 10 10 QMessageBox *mess = new QMessageBox(this); -
trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/src/Graphics_drawAll.cpp
r30 r32 13 13 QString t; 14 14 15 15 16 if(paint){ 17 /*draw the main component*/ 16 18 painter.begin(this); 17 19 painter.setPen(Qt::blue); 18 20 painter.drawRect(MARGEX,MARGEY,MARGEX+450,MARGEY+450); 21 22 Entity *e = p.getEntity(); 23 string s; 24 s.append(e->getName()); 25 s.append(" : "); 26 s.append(e->getType()); 27 painter.setPen(Qt::black); 28 painter.drawText(50,10,500,60,Qt::AlignCenter,QString::fromStdString(s)); 29 painter.setPen(Qt::blue); 19 30 20 31 /*draw the ports of the main component*/ 21 32 for(QList<Port>::iterator it=port_east.begin(); it!=port_east.end(); ++it){ 22 33 portX = it->get_x(); … … 43 54 portX = it->get_x() ; 44 55 portY = it->get_y() ; 45 drawPort(portX + MARGEX,portY+ MARGEY,SOUTH,it->getDirection());56 drawPort(portX + MARGEX,portY+ MARGEY + 20 ,SOUTH,it->getDirection()); 46 57 47 58 } 48 59 60 /*draw the components inside the main component*/ 49 61 if(p.getArchitecture()!=NULL){ 50 62 compo = p.getComponent(); … … 61 73 schema=tp.getSchema(); 62 74 switch(schema){ 63 case 0: 75 case 0://a basic element 64 76 painter.drawRect(posX,posY,tailleX,tailleY); 65 77 break; 66 case 1: 78 case 1://a combinatoire element 67 79 painter.drawEllipse(posX,posY,tailleX,tailleY); 68 80 break; 69 case 2: 81 case 2://a FIFO 70 82 painter.drawRect(posX,posY,tailleX,tailleY); 71 83 painter.drawLine(posX+tailleX/4,posY+tailleY,posX+tailleX/4,posY); … … 73 85 painter.drawLine(posX+3*tailleX/4,posY+tailleY,posX+3*tailleX/4,posY); 74 86 break; 75 case 3: 87 case 3://a register 76 88 painter.drawRect(posX,posY,tailleX,tailleY); 77 89 painter.drawLine(posX,posY+tailleY,posX+tailleX/2,posY+tailleY/2); … … 83 95 if (componentName){ 84 96 QString compo_name = QString::fromStdString(it->getName()); 85 painter.drawText(posX , posY + tailleY/2,compo_name);97 painter.drawText(posX - compo_name.size()/2 , posY + tailleY/2,compo_name); 86 98 } 99 100 /*draw the ports of the inside components*/ 87 101 Coord *co2=new Coord( co->get_hg_x() + tailleX/2, co->get_hg_y() + tailleY/2,tailleX/2,tailleY/2); 88 102 … … 124 138 QList<PortMap> *pm=it->getPortMap(); 125 139 140 /*draw the signals*/ 126 141 for (QList<PortMap>::iterator it3=pm->begin();it3!=pm->end();++it3) 127 142 { -
trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/src/Graphics_drawPort.cpp
r20 r32 5 5 using namespace morpheo::tools::viewer::graphics; 6 6 7 /*draw the port in rectangular form*/ 7 8 void Window::drawPort(int x,int y,int pos,string dir){ 8 9 if(pos == NORTH){ -
trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/src/Graphics_file_actions.cpp
r30 r32 9 9 /*signals actions implementation*/ 10 10 11 /*open function*/ 11 12 void Window::_open(){ 12 13 QString current2; 13 14 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 15 current2 = QFileDialog::getOpenFileName(this,"", "./data"); 16 this->setDisabled(true); 17 /*if a file has been opened*/ 15 18 if(current2!=""){ 16 this->setDisabled(true);17 19 current_name = current2; 18 20 if(parse->open_file( current_name.toStdString(),0)==-1) … … 54 56 } 55 57 58 /*initialize the database when a file has been opened*/ 56 59 void Window::_init_file(){ 57 60 is_save = true; 58 61 base = parse->getBaseV();//parse the base and open the file 59 #ifdef DEBUG_ALL62 //#ifdef DEBUG_ALL 60 63 base->afficheBaseConsole(); 61 #endif64 //#endif 62 65 cpt_level = 0; 63 66 … … 75 78 paint = true; 76 79 repaint(); 80 display_param(); 77 81 this->setDisabled(false); 78 82 setMouseTracking(true); 79 83 } 80 84 85 /*if user entered a wrong file name*/ 81 86 void Window::_open_error(){ 82 87 QMessageBox *error = new QMessageBox(this); … … 84 89 error->addButton("ok",QMessageBox::YesRole); 85 90 error->show(); 91 this->setDisabled(false); 86 92 } 87 93 88 94 /*save functions*/ 89 95 void Window::_save(){ 90 96 if(file_open){ 91 97 if (wa_open) 92 98 wa->close(); 93 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 as99 if(save_as){//if "save as" 94 100 current_name = QFileDialog::getSaveFileName(this,"","./data"); 95 101 save_as = false; 96 first_save = false;102 parse->save_file(current_name.toStdString(),0); 97 103 } 98 104 else { 99 status->showMessage("file " + current_name + " saved",900); 105 parse->save_file(current.toStdString(),0); 106 status->showMessage("file " + current + " saved",900); 100 107 is_save = true;//file saved 101 108 } … … 133 140 } 134 141 142 /*close function*/ 135 143 void Window::_close(){ 136 144 paint = false; 145 repaint(); 137 146 parse->closeBaseV(); 138 lname->setText(""); 139 ln->setText(""); 140 lt->setText(""); 141 write_name(""); 142 write_comment(""); 143 comment->hide(); 147 erase_line(ln,lname); 148 erase_line(lt,ltype); 149 erase_comment(); 144 150 winfo->show(); 151 wscroll->hide(); 152 scroll_hide = true; 153 wparam->show(); 145 154 file_open = false; 146 repaint();147 155 } 148 156 157 /*quit functions*/ 149 158 void Window::_quit(){ 150 159 //if the file is not saved -> ask to the user if he wants to save it. If yes -> save, else quit. … … 171 180 _quit2(); 172 181 } 173 182 /*close all the windows opened*/ 174 183 void Window::_quit2(){ 175 184 /*test if there are windows (other than the main window) opened*/ -
trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/src/Graphics_informations_window.cpp
r30 r32 7 7 using namespace morpheo::tools::viewer::graphics; 8 8 9 /*informations window constructor*/ 9 10 void Window::winformations() 10 11 { … … 12 13 informations = new QBoxLayout(QBoxLayout::TopToBottom,0); 13 14 winfo->setWindowTitle("informations"); 14 winfo->setFixedSize(3 50,292);15 winfo->setFixedSize(370,180); 15 16 winfo->move(628,50); 17 16 18 19 /*name line*/ 17 20 QBoxLayout *bname = new QBoxLayout(QBoxLayout::LeftToRight,0); 18 21 ln = new QLabel(); … … 23 26 bname->addWidget(lname); 24 27 28 /*type line*/ 25 29 QBoxLayout *btype = new QBoxLayout(QBoxLayout::LeftToRight,0); 26 30 lt = new QLabel(); … … 30 34 btype->addWidget(lt); 31 35 btype->addWidget(ltype); 32 36 37 /*comment line*/ 33 38 comment = new QLineEdit(); 34 39 comment->setText(""); 35 40 comment->setReadOnly(true); 36 41 42 /*buttons*/ 37 43 QPushButton *noselect = new QPushButton("cancel selection",wparam); 38 44 QPushButton *back = new QPushButton("back",wparam); … … 50 56 } 51 57 58 /*write the comment of the componenet selected*/ 52 59 void Window::write_comment(string cm){ 53 60 QString c = QString::fromStdString(cm); 54 61 comment->setText(c); 62 comment->setCursorPosition(1); 55 63 comment->show(); 56 64 } 57 65 58 void Window::write_name(string name){ 59 QString n = QString::fromStdString(name); 60 lname->setText(n); 66 void Window::erase_comment(){ 67 comment->setText(""); 68 comment->hide(); 69 } 70 /*write the name of the component selected*/ 71 void Window::write_name(string type,string name){ 72 QString n = QString::fromStdString(type); 73 ln->setText(n); 74 QString n2 = QString::fromStdString(name); 75 lname->setText(n2); 61 76 } 62 77 78 void Window::erase_line(QLabel *l1, QLabel *l2){ 79 l1->setText(""); 80 l2->setText(""); 81 } 82 83 /*write the type of the component selected*/ 63 84 void Window::write_type(string type){ 64 85 lt->setText("type"); -
trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/src/Graphics_main.cpp
r26 r32 16 16 int main (int argc, char* argv[]) 17 17 { 18 /*if to many arguments*/ 18 19 if(argc>2){ 19 20 cout << "error : argument must be a file name or nothing" << endl; … … 22 23 } 23 24 25 /*construct the base*/ 24 26 Parse *par = new Parse(); 25 27 26 28 /*create the window application*/ 27 29 QApplication *a=new QApplication (argc,argv); 28 30 29 if(argc == 2){31 if(argc == 2){ 30 32 if(par->open_file(argv[1],0)==-1){ 31 33 cout << "file doesn't exist or is not a valid format" << endl; -
trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/src/Graphics_main_window.cpp
r30 r32 16 16 component_clicked = false; 17 17 cpt_level=0; 18 18 apply_display = false; 19 scroll_hide = false; 20 parameter_modify = false; 21 19 22 /*menu bar*/ 20 23 QMenuBar *menu_bar = new QMenuBar(this); … … 122 125 123 126 /*main window title*/ 124 this->setWindowTitle(" Viewer");127 this->setWindowTitle("Morpheo Viewer"); 125 128 126 129 /*parameters window creation*/ … … 145 148 /*file unsaved at init*/ 146 149 save_as = false; 147 first_save = false; //first_save = true for a new file148 150 149 151 current_name = name; -
trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/src/Graphics_mouseEvent.cpp
r30 r32 6 6 using namespace morpheo::tools::viewer::graphics; 7 7 8 /*mouse press event handler*/ 8 9 void Window::mousePressEvent (QMouseEvent *e){ 9 10 if(paint && (p.getArchitecture() != NULL)){ … … 16 17 mouseY = mouseEvent->y(); 17 18 18 bool bc = false;19 bool bc,b3 = false; 19 20 int cx,cy,tx,ty; 20 string cc,nc,type;21 string s2,cc,nc,type,comm; 21 22 bool found = false; 22 23 24 /*search the component under the mouse focus*/ 23 25 for(QList<Component>::iterator it=compo->begin();it!=compo->end();++it){ 24 26 Coord *co = it->get_Position(); … … 28 30 int tailley = co->get_size_y(); 29 31 QString t=QString::fromStdString(it->getType()).toLower(); 32 /*go to the next level if comoponent doubleclicked*/ 30 33 if(e->type() == QMouseEvent::MouseButtonDblClick && e->button() == Qt::LeftButton){ 31 34 … … 66 69 paint = true; 67 70 repaint(); 68 write_name(""); 69 write_comment(""); 70 write_type(""); 71 ln->setText(""); 72 lt->setText(""); 73 comment->hide(); 71 erase_line(lt,ltype); 72 erase_line(ln,lname); 73 erase_comment(); 74 74 found = false; 75 75 this->setDisabled(false); 76 76 component_clicked = false; 77 77 } 78 78 /*search and display the informations of the component clicked*/ 79 79 if(e->type() == QMouseEvent::MouseButtonPress && e->button() == Qt::LeftButton){ 80 80 if(mouseX >= px + MARGEX && mouseY >= py +MARGEY && mouseX <= px+taillex + MARGEX && mouseY <= py+tailley + MARGEY) { … … 88 88 BaseP tp = base->get_BasePos(t.toStdString()); 89 89 if(&tp != NULL) 90 90 cc=tp.getComment(); 91 91 component_clicked = true; 92 } 93 94 for(QList<Port>::iterator it=port_east.begin(); it!=port_east.end(); ++it){ 95 portX = it->get_x(); 96 portY = it->get_y(); 97 if(mouseX >= portX - 15 + MARGEX && mouseY >= portY - 15 + MARGEY && mouseX <= portX + 15 +MARGEX && mouseY <= portY + 15 + MARGEY){ 98 b3 = true; 99 s2 = it->getName(); 100 comm = it->getComment(); 101 type = it->getDirection(); 102 } 103 } 104 105 for(QList<Port>::iterator it=port_west.begin(); it!=port_west.end(); ++it){ 106 portX = it->get_x() ; 107 portY = it->get_y() ; 108 if(mouseX >= portX - 15 + MARGEX && mouseY >= portY - 15 + MARGEY && mouseX <= portX + 15 + MARGEX && mouseY <= portY + 15 + MARGEY){ 109 b3 = true; 110 s2 = it->getName(); 111 comm = it->getComment(); 112 type = it->getDirection(); 113 } 114 } 115 116 for(QList<Port>::iterator it=port_north.begin(); it!=port_north.end(); ++it){ 117 portX = it->get_x() ; 118 portY = it->get_y() ; 119 if(mouseX >= portX - 15 + MARGEX && mouseY >= portY - 15 +MARGEY && mouseX <= portX + 15 + MARGEX && mouseY <= portY + 15 +MARGEY){ 120 b3 = true; 121 s2 = it->getName(); 122 type = it->getDirection(); 123 comm = it->getComment(); 124 } 125 } 126 127 for(QList<Port>::iterator it=port_south.begin(); it!=port_south.end(); ++it){ 128 portX = it->get_x() ; 129 portY = it->get_y() ; 130 if(mouseX >= portX - 15 + MARGEX && mouseY >= portY - 15 + MARGEY && mouseX <= portX + 15 +MARGEX && mouseY <= portY + 15 + MARGEY){ 131 b3 = true; 132 s2 = it->getName(); 133 comm = it->getComment(); 134 type = it->getDirection(); 135 } 92 136 } 93 137 } 94 138 } 95 139 if(bc){ 96 write_name( nc);140 write_name("component",nc); 97 141 write_type(type); 98 ln->setText("component");99 lt->setText("type");100 142 write_comment(cc); 143 } 144 if(b3){ 145 write_name("signal",s2); 146 write_type(type); 147 write_comment(comm); 148 component_clicked = true; 101 149 } 102 150 } 103 151 } 104 152 105 153 /*mouse move event handler*/ 106 154 void Window::mouseMoveEvent(QMouseEvent *e){ 107 155 bool b = false; … … 110 158 int px,py,taillex,tailley,ppx,ppy; 111 159 string s,s2,c,type; 112 113 if(paint && (p.getArchitecture() != NULL) && !component_clicked){ 114 115 compo = p.getComponent(); 116 117 QMouseEvent *mouseEvent = (QMouseEvent *) e; 118 119 mouseX = mouseEvent->x(); 120 mouseY = mouseEvent->y(); 121 122 for(QList<Component>::iterator it=compo->begin();it!=compo->end();++it){ 123 Coord *co = it->get_Position(); 124 px = co->get_hg_x(); 125 py = co->get_hg_y(); 126 taillex = co->get_size_x(); 127 tailley = co->get_size_y(); 128 QString t=QString::fromStdString(it->getType()).toLower(); 129 QList<PortMap> *pm=it->getPortMap(); 130 131 if(e->type() == QMouseEvent::MouseMove){ 132 if(mouseX >= px + MARGEX && mouseY >= py +MARGEY && mouseX <= px+taillex + MARGEX && mouseY <= py+tailley + MARGEY) { 133 b = true; 134 s = it->getName(); 135 type = it->getType(); 136 BaseP tp=base->get_BasePos(t.toStdString()); 137 if(&tp!=NULL) 138 c=tp.getComment(); 139 ppx = px; 140 ppy = py; 141 break; 142 } 143 else{ 144 for (QList<PortMap>::iterator it3=pm->begin();it3!=pm->end();++it3) { 145 Signal *sig=base->getSignal(&p,it->getName(),new PortMap(*it3)); 146 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){ 147 b2 = true; 148 s = it3->getName(); 149 break; 150 } 151 } 152 } 153 } 154 } 155 156 if(b){ 157 write_name(s); 158 write_type(type); 159 ln->setText("component"); 160 write_comment(c); 161 lt->setText("type"); 162 b3 = false; 163 b2 = false; 164 } 165 166 if(b2){ 167 write_name(s); 168 write_type(""); 169 lt->setText(""); 170 write_comment(""); 171 ln->setText("signal"); 172 comment->hide(); 173 b3 = false; 174 b = false; 175 } 176 177 if(!b && !b2){ 178 write_name(""); 179 write_type(""); 180 ln->setText(""); 181 lt->setText(""); 182 write_comment(""); 183 comment->hide(); 184 } 160 string comm; 161 162 if(paint && !component_clicked){ 163 if(p.getArchitecture() != NULL){ 164 165 compo = p.getComponent(); 166 167 QMouseEvent *mouseEvent = (QMouseEvent *) e; 168 169 mouseX = mouseEvent->x(); 170 mouseY = mouseEvent->y(); 171 172 /*display the component under the mouse focus*/ 173 for(QList<Component>::iterator it=compo->begin();it!=compo->end();++it){ 174 Coord *co = it->get_Position(); 175 px = co->get_hg_x(); 176 py = co->get_hg_y(); 177 taillex = co->get_size_x(); 178 tailley = co->get_size_y(); 179 QString t=QString::fromStdString(it->getType()).toLower(); 180 QList<PortMap> *pm=it->getPortMap(); 181 182 if(e->type() == QMouseEvent::MouseMove){ 183 if(mouseX >= px + MARGEX && mouseY >= py +MARGEY && mouseX <= px+taillex + MARGEX && mouseY <= py+tailley + MARGEY) { 184 b = true; 185 s = it->getName(); 186 type = it->getType(); 187 BaseP tp=base->get_BasePos(t.toStdString()); 188 if(&tp!=NULL) 189 c=tp.getComment(); 190 ppx = px; 191 ppy = py; 192 break; 193 } 194 else{ 195 for (QList<PortMap>::iterator it3=pm->begin();it3!=pm->end();++it3) { 196 Signal *sig=base->getSignal(&p,it->getName(),new PortMap(*it3)); 197 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){ 198 b2 = true; 199 s = it3->getName(); 200 break; 201 } 202 } 203 } 204 } 205 } 206 207 if(b){ 208 write_name("component",s); 209 write_type(type); 210 write_comment(c); 211 b3 = false; 212 b2 = false; 213 } 214 215 if(b2){ 216 write_name("signal",s); 217 erase_line(lt,ltype); 218 erase_comment(); 219 b3 = false; 220 b = false; 221 } 222 223 if(!b && !b2){ 224 erase_line(lt,ltype); 225 erase_line(ln,lname); 226 erase_comment(); 227 } 228 } 229 230 p=base->get_BasePos(current.toStdString()); 231 Entity *ent = p.getEntity(); 232 Coord *c = new Coord(250,250,250,250); 233 port_east = ent->getPortEast(c); 234 port_west = ent->getPortWest(c); 235 port_north = ent->getPortNorth(c); 236 port_south = ent->getPortSouth(c); 237 238 /*display the signal under the mouse focus*/ 239 for(QList<Port>::iterator it=port_east.begin(); it!=port_east.end(); ++it){ 240 portX = it->get_x(); 241 portY = it->get_y(); 242 if(mouseX >= portX - 15 + MARGEX && mouseY >= portY - 15 + MARGEY && mouseX <= portX + 15 +MARGEX && mouseY <= portY + 15 + MARGEY){ 243 b3 = true; 244 s2 = it->getName(); 245 comm = it->getComment(); 246 type = it->getDirection(); 247 } 248 } 249 250 for(QList<Port>::iterator it=port_west.begin(); it!=port_west.end(); ++it){ 251 portX = it->get_x() ; 252 portY = it->get_y() ; 253 if(mouseX >= portX - 15 + MARGEX && mouseY >= portY - 15 + MARGEY && mouseX <= portX + 15 + MARGEX && mouseY <= portY + 15 + MARGEY){ 254 b3 = true; 255 s2 = it->getName(); 256 comm = it->getComment(); 257 type = it->getDirection(); 258 } 259 } 260 261 for(QList<Port>::iterator it=port_north.begin(); it!=port_north.end(); ++it){ 262 portX = it->get_x() ; 263 portY = it->get_y() ; 264 if(mouseX >= portX - 15 + MARGEX && mouseY >= portY - 15 +MARGEY && mouseX <= portX + 15 + MARGEX && mouseY <= portY + 15 +MARGEY){ 265 b3 = true; 266 s2 = it->getName(); 267 comm = it->getComment(); 268 type = it->getDirection(); 269 } 270 } 271 272 for(QList<Port>::iterator it=port_south.begin(); it!=port_south.end(); ++it){ 273 portX = it->get_x() ; 274 portY = it->get_y() ; 275 if(mouseX >= portX - 15 + MARGEX && mouseY >= portY - 15 + MARGEY && mouseX <= portX + 15 +MARGEX && mouseY <= portY + 15 + MARGEY){ 276 b3 = true; 277 s2 = it->getName(); 278 comm = it->getComment(); 279 type = it->getDirection(); 280 } 281 } 282 if(b3){ 283 b = false; 284 erase_line(ln,lname); 285 write_type(type); 286 erase_comment(); 287 write_comment(comm); 288 write_name("signal",s2); 289 } 185 290 } 186 187 188 for(QList<Port>::iterator it=port_east.begin(); it!=port_east.end(); ++it){189 portX = it->get_x();190 portY = it->get_y();191 if(mouseX >= portX - 15 + MARGEX && mouseY >= portY - 15 + MARGEY && mouseX <= portX + 15 +MARGEX && mouseY <= portY + 15 + MARGEY){192 b3 = true;193 s2 = it->getName();194 }195 }196 197 for(QList<Port>::iterator it=port_west.begin(); it!=port_west.end(); ++it){198 portX = it->get_x() ;199 portY = it->get_y() ;200 if(mouseX >= portX - 15 + MARGEX && mouseY >= portY - 15 + MARGEY && mouseX <= portX + 15 + MARGEX && mouseY <= portY + 15 + MARGEY){201 b3 = true;202 s2 = it->getName();203 }204 }205 206 for(QList<Port>::iterator it=port_north.begin(); it!=port_north.end(); ++it){207 portX = it->get_x() ;208 portY = it->get_y() ;209 if(mouseX >= portX - 15 + MARGEX && mouseY >= portY - 15 +MARGEY && mouseX <= portX + 15 + MARGEX && mouseY <= portY + 15 +MARGEY){210 b3 = true;211 s2 = it->getName();212 }213 }214 215 for(QList<Port>::iterator it=port_south.begin(); it!=port_south.end(); ++it){216 portX = it->get_x() ;217 portY = it->get_y() ;218 if(mouseX >= portX - 15 + MARGEX && mouseY >= portY - 15 + MARGEY && mouseX <= portX + 15 +MARGEX && mouseY <= portY + 15 + MARGEY){219 b3 = true;220 s2 = it->getName();221 }222 }223 if(b3){224 b = false;225 write_name("");226 write_name(s2);227 write_type(type);228 ln->setText("signal");229 lt->setText("");230 write_comment("");231 comment->hide();232 }233 291 } 234 292 235 293 236 237 294 /*return to the previous level if back button has been clicked*/ 238 295 void Window::_back(){ 239 296 if(cpt_level==0){ -
trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/src/Graphics_parameters_window.cpp
r30 r32 7 7 using namespace morpheo::tools::viewer::graphics; 8 8 9 /*parameters window constructor*/ 9 10 void Window::wparameters() 10 11 { 11 wparam = new QWidget(); 12 wparam = new QMainWindow(); 13 // wparam = new QWidget(); 12 14 parameters = new QBoxLayout(QBoxLayout::TopToBottom,0); 13 15 wparam->setWindowTitle("parameters"); 14 wparam->setFixedSize(350,300); 15 wparam->move(628,370); 16 17 18 QPushButton *apply = new QPushButton("apply",wparam); 19 connect(apply,SIGNAL(clicked()),this,SLOT(_apply())); 20 21 parameters->addWidget(apply); 22 16 wparam->setFixedSize(370,415); 17 wparam->move(628,255); 23 18 wparam->setLayout(parameters); 19 sc = new QScrollArea(wparam); 20 wscroll = new QWidget(); 21 sc->setWidgetResizable(false); 22 sc->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); 23 sc->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); 24 sc->setGeometry(2,2,365,410); 24 25 wparam->show(); 25 26 } 26 27 27 28 /*display the parameters*/ 29 void Window::display_param(){ 30 31 pbox = new QBoxLayout(QBoxLayout::TopToBottom,0); 32 33 string scpu; 34 string lgroup; 35 string sparam; 36 string ecart; 37 38 if(!apply_display){ 39 QPushButton *apply = new QPushButton("apply",wparam); 40 connect(apply,SIGNAL(clicked()),this,SLOT(_apply())); 41 apply->setFixedSize(310,25); 42 pbox->addWidget(apply); 43 apply_display = true; 44 } 45 46 /*top level name display*/ 47 QLabel *cpu = new QLabel(); 48 scpu.append("CPU : "); 49 scpu.append(parse->getTopLevelName()); 50 scpu.append(" \n"); 51 cpu ->setText(QString::fromStdString(scpu)); 52 cpu->setFixedSize(300,50); 53 pbox->addWidget(cpu); 54 55 /*architecture in tree view display*/ 56 group = base->getGroups(); 57 for(QList<Group>::iterator it=group->begin();it!=group->end();++it){ 58 QLabel *lg = new QLabel(); 59 lgroup = ""; 60 lg->setFixedSize(200,30); 61 ecart = ""; 62 if(it->getLevel() == 1) 63 ecart.append(" "); 64 if(it->getLevel() == 2) 65 ecart.append(" "); 66 if(it->getLevel() == 3) 67 ecart.append(" "); 68 if(it->getLevel() == 4) 69 ecart.append(" "); 70 if(it->getLevel() == 5) 71 ecart.append(" "); 72 lgroup.append(ecart); 73 lgroup.append("<"); 74 lgroup.append(it->getName()); 75 lgroup.append(">"); 76 lg->setText(QString::fromStdString(lgroup)); 77 pbox->addWidget(lg); 78 param = it->getParam(); 79 for(QList<Param>::iterator it2=param.begin();it2!=param.end();++it2){ 80 81 if(it2->getName() == "id"){ 82 QBoxLayout *b = new QBoxLayout(QBoxLayout::LeftToRight,0); 83 QLabel *l = new QLabel(); 84 QString st2 = " "; 85 QString st; 86 st2.append(QString::fromStdString(ecart)); 87 st2.append("nb_"); 88 st2.append(QString::fromStdString(it->getName())); 89 90 st.append("nb_"); 91 st.append(QString::fromStdString(it->getName())); 92 LimitParam lp = base->searchLimitParam(st.toStdString()); 93 94 QLabel *lab = new QLabel(); 95 QString s = " "; 96 s.append(QString::fromStdString(ecart)); 97 s.append(QString::fromStdString(it2->getName())); 98 s.append(" : "); 99 stringstream out; 100 string str; 101 out << it2->getValue(); 102 str = out.str(); 103 s.append(QString::fromStdString(str)); 104 lab->setText(s); 105 pbox->addWidget(lab); 106 l->setText(st2); 107 QSpinBox *spin = new QSpinBox(); 108 int min = lp.getMin(); 109 int max = lp.getMax(); 110 QString step = QString::fromStdString(lp.getStep()); 111 112 spin->setValue(base->nbGroup(it->getName())); 113 114 if(step.contains("+")){ 115 step = step.right(step.length()-1); 116 int pas = step.toInt(0,10); 117 spin->setMinimum(min); 118 spin->setMaximum(max); 119 spin->setSingleStep(pas); 120 } 121 122 if(step.contains("*")){ 123 step = step.right(step.length()-1); 124 int pas = step.toInt(0,10); 125 spin->setMinimum(min); 126 spin->setMaximum(max); 127 spin->setSingleStep(pas); 128 } 129 spin->setFixedSize(60,30); 130 131 QString name_obj = (QString::fromStdString(it->getName())); 132 spin->setObjectName(name_obj); 133 134 b->addWidget(l); 135 b->addWidget(spin); 136 pbox->addLayout(b); 137 138 connect(spin,SIGNAL(valueChanged(int)),this,SLOT(valueChanged(int))); 139 140 } 141 else{ 142 QBoxLayout *b = new QBoxLayout(QBoxLayout::LeftToRight,0); 143 QLabel *l = new QLabel(); 144 sparam =" "; 145 sparam.append(ecart); 146 sparam.append(it2->getName()); 147 sparam.append(" : "); 148 stringstream out; 149 string str; 150 out << it2->getValue(); 151 str = out.str(); 152 sparam.append(str); 153 l->setText(QString::fromStdString(sparam)); 154 l->setFixedSize(200,30); 155 parameters->addWidget(l); 156 QComboBox *cb = new QComboBox(); 157 LimitParam lp = base->searchLimitParam(it2->getName()); 158 int min = lp.getMin(); 159 int max = lp.getMax(); 160 QString step = QString::fromStdString(lp.getStep()); 161 int value = min; 162 if(step.contains("+")){ 163 step = step.right(step.length()-1); 164 int pas = step.toInt(0,10); 165 while(value!=max+pas){ 166 stringstream out2; 167 string str2; 168 out2 << value; 169 str2 = out2.str(); 170 cb->addItem(QString::fromStdString(str2)); 171 value = value+pas; 172 } 173 } 174 if(step.contains("*")){ 175 step = step.right(step.length()-1); 176 int pas = step.toInt(0,10); 177 while(value!=max*pas){ 178 stringstream out2; 179 string str2; 180 out2 << value; 181 str2 = out2.str(); 182 cb->addItem(QString::fromStdString(str2)); 183 value = value*pas; 184 } 185 } 186 stringstream out3; 187 string str3; 188 out3 << it2->getValue(); 189 str3 = out3.str(); 190 int index = cb->findText(QString::fromStdString(str3)); 191 cb->setCurrentIndex(index); 192 cb->setFixedSize(60,30); 193 //QPushButton *pb = new QPushButton(); 194 //pb->setText("change"); 195 QString name_obj = (QString::fromStdString(it->getName())); 196 name_obj.append(":"); 197 name_obj.append( QString::fromStdString(it2->getName())); 198 name_obj.append(":"); 199 name_obj.append(cb->currentText()); 200 cb->setObjectName(name_obj); 201 //cb->setFixedSize(60,30); 202 QString new_value = cb->currentText(); 203 connect(cb,SIGNAL(currentIndexChanged(QString)),this,SLOT(currentIndexChanged(QString))); 204 //connect(pb,SIGNAL(clicked()),this,SLOT(_change_value())); 205 b->addWidget(l); 206 b->addWidget(cb); 207 //b->addWidget(pb); 208 pbox->addLayout(b); 209 } 210 } 211 } 212 213 wscroll->setLayout(pbox); 214 parameters->addWidget(wscroll); 215 sc->setWidget(wscroll); 216 if(scroll_hide){ 217 scroll_hide = false; 218 wscroll->show(); 219 } 220 } 221 222 void Window::currentIndexChanged(QString value2){ 223 //cout << QObject::sender()->objectName().toStdString() << endl; 224 225 QString obj = QObject::sender()->objectName(); 226 227 int i,j,v; 228 QString param,group,value; 229 i = obj.indexOf(":"); 230 group = obj.left(i); 231 //cout << "group : " << group.toStdString() << endl; 232 j = obj.indexOf(":",i+1); 233 value = obj.right(obj.size() - j - 1); 234 v = value2.toInt(0,10); 235 cout << "value : " << v << endl; 236 param = obj.section(":",1,1); 237 //cout << "param : " << param.toStdString() << endl; 238 239 base->modifyValue(group.toStdString(),param.toStdString(),v); 240 wparam->close(); 241 apply_display = false; 242 wparameters(); 243 display_param(); 244 parameter_modify = true; 245 } 246 247 248 void Window::valueChanged(int i){ 249 250 //cout << QObject::sender()->objectName().toStdString() << endl; 251 252 QString obj = QObject::sender()->objectName(); 253 int v,j; 254 //cout << "name : " << obj.toStdString() << endl; 255 v = i; 256 //cout << "value : " << v << endl; 257 258 j = base->nbGroup(obj.toStdString()); 259 v = v - j; 260 cout << "value : " << v << " " << j<< endl; 261 if(base->modifyGroup(obj.toStdString(),v)==-1){ 262 cout << "error" << endl; 263 exit(1); 264 } 265 wparam->close(); 266 apply_display = false; 267 wparameters(); 268 parameter_modify = true; 269 display_param(); 270 // base->afficheParamConsole(); 271 } 272 273 /*apply the parameters changes*/ 28 274 void Window::_apply(){ 29 cout << "apply\n"; 30 } 275 if(!parameter_modify){ 276 QMessageBox *m = new QMessageBox(wparam); 277 m->setText("no parameter changed"); 278 m->addButton("ok",QMessageBox::YesRole); 279 m->show(); 280 } 281 else{ 282 parameter_modify = false; 283 cout << "apply\n"; 284 } 285 } -
trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/src/Graphics_tools_actions.cpp
r21 r32 6 6 using namespace morpheo::tools::viewer::graphics; 7 7 8 /*zoom functions*/ 8 9 void Window::_zoomIn(){ 9 10 cout << "zoom in" << endl; … … 22 23 } 23 24 25 /*open or close the informations window*/ 24 26 void Window::_informations(){ 25 27 if(!info_open){//if the informations window is not open, open it,else close it … … 33 35 } 34 36 37 /*open or close the parameters window*/ 35 38 void Window::_parameters(){//if the parameteres window is not open, open it,else close it 36 39 if(!param_open){ 37 40 this->wparameters(); 38 41 param_open = true; 42 if(info_open){ 43 apply_display = false; 44 display_param(); 45 } 39 46 } 40 47 else{ … … 44 51 } 45 52 53 /*display or hide the components name*/ 46 54 void Window::_component_name(){ 47 55 … … 54 62 } 55 63 64 /*display or hide the signals name*/ 56 65 void Window::_signal_name(){ 57 66
Note: See TracChangeset
for help on using the changeset viewer.