Changeset 28
- Timestamp:
- May 22, 2007, 3:56:11 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/src/Graphics_mouseEvent.cpp
r26 r28 104 104 void Window::mouseMoveEvent(QMouseEvent *e){ 105 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; 111 106 112 if(paint && (p.getArchitecture() != NULL) && !component_clicked){ 107 113 … … 113 119 mouseY = mouseEvent->y(); 114 120 115 bool b = false;116 bool b2 = false;117 int px,py,taillex,tailley,sx,sy,ppx,ppy;118 string s,c;119 120 121 for(QList<Component>::iterator it=compo->begin();it!=compo->end();++it){ 121 122 Coord *co = it->get_Position(); … … 125 126 tailley = co->get_size_y(); 126 127 128 QList<PortMap> *pm=it->getPortMap(); 129 127 130 if(e->type() == QMouseEvent::MouseMove){ 128 131 if(mouseX >= px + MARGEX && mouseY >= py +MARGEY && mouseX <= px+taillex + MARGEX && mouseY <= py+tailley + MARGEY) { … … 134 137 ppx = px; 135 138 ppy = py; 139 break; 136 140 } 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 // } 141 else{ 142 for (QList<PortMap>::iterator it3=pm->begin();it3!=pm->end();++it3) { 143 Signal *sig=base->getSignal(&p,it->getName(),new PortMap(*it3)); 144 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){ 145 b2 = true; 146 s = it3->getName(); 147 break; 148 } 149 } 150 } 151 } 153 152 } 154 153 … … 158 157 write_size(taillex,tailley); 159 158 write_comment(c); 160 } 161 else{ 159 b3 = false; 160 b2 = false; 161 } 162 163 if(b2){ 164 write_name(s); 165 erase_position(); 166 write_comment(""); 167 b3 = false; 168 b = false; 169 } 170 171 if(!b && !b2){ 162 172 write_name(""); 163 173 erase_position(); 174 write_comment(""); 164 175 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 // } 176 } 177 226 178 } 179 180 181 for(QList<Port>::iterator it=port_east.begin(); it!=port_east.end(); ++it){ 182 portX = it->get_x(); 183 portY = it->get_y(); 184 if(mouseX >= portX - 15 + MARGEX && mouseY >= portY - 15 + MARGEY && mouseX <= portX + 15 +MARGEX && mouseY <= portY + 15 + MARGEY){ 185 b3 = true; 186 s2 = it->getName(); 187 } 188 } 189 190 for(QList<Port>::iterator it=port_west.begin(); it!=port_west.end(); ++it){ 191 portX = it->get_x() ; 192 portY = it->get_y() ; 193 if(mouseX >= portX - 15 + MARGEX && mouseY >= portY - 15 + MARGEY && mouseX <= portX + 15 + MARGEX && mouseY <= portY + 15 + MARGEY){ 194 b3 = true; 195 s2 = it->getName(); 196 } 197 } 198 199 for(QList<Port>::iterator it=port_north.begin(); it!=port_north.end(); ++it){ 200 portX = it->get_x() ; 201 portY = it->get_y() ; 202 if(mouseX >= portX - 15 + MARGEX && mouseY >= portY - 15 +MARGEY && mouseX <= portX + 15 + MARGEX && mouseY <= portY + 15 +MARGEY){ 203 b3 = true; 204 s2 = it->getName(); 205 } 206 } 207 208 for(QList<Port>::iterator it=port_south.begin(); it!=port_south.end(); ++it){ 209 portX = it->get_x() ; 210 portY = it->get_y() ; 211 if(mouseX >= portX - 15 + MARGEX && mouseY >= portY - 15 + MARGEY && mouseX <= portX + 15 +MARGEX && mouseY <= portY + 15 + MARGEY){ 212 b3 = true; 213 s2 = it->getName(); 214 } 215 } 216 if(b3){ 217 b = false; 218 write_name(""); 219 erase_position(); 220 write_name(s2); 221 erase_size(); 222 } 227 223 } 224 225 228 226 229 227
Note: See TracChangeset
for help on using the changeset viewer.