----------------------------------------------------------- Is called when the content (schematic or data display) has to be drawn.
| 394 | // ----------------------------------------------------------- |
| 395 | // Is called when the content (schematic or data display) has to be drawn. |
| 396 | void Schematic::drawContents(QPainter *p, int, int, int, int) |
| 397 | { |
| 398 | ViewPainter Painter; |
| 399 | |
| 400 | Painter.init(p, Scale, -ViewX1, -ViewY1, contentsX(), contentsY()); |
| 401 | |
| 402 | paintGrid(&Painter, contentsX(), contentsY(), |
| 403 | visibleWidth(), visibleHeight()); |
| 404 | |
| 405 | if(!symbolMode) |
| 406 | paintFrame(&Painter); |
| 407 | |
| 408 | for(Component *pc = Components->first(); pc != 0; pc = Components->next()) |
| 409 | pc->paint(&Painter); |
| 410 | |
| 411 | for(Wire *pw = Wires->first(); pw != 0; pw = Wires->next()) { |
| 412 | pw->paint(&Painter); |
| 413 | if(pw->Label) |
| 414 | pw->Label->paint(&Painter); // separate because of paintSelected |
| 415 | } |
| 416 | |
| 417 | Node *pn; |
| 418 | for(pn = Nodes->first(); pn != 0; pn = Nodes->next()) { |
| 419 | pn->paint(&Painter); |
| 420 | if(pn->Label) |
| 421 | pn->Label->paint(&Painter); // separate because of paintSelected |
| 422 | } |
| 423 | |
| 424 | // FIXME disable here, issue with select box goes away |
| 425 | // also, instead of red, line turns blue |
| 426 | for(Diagram *pd = Diagrams->first(); pd != 0; pd = Diagrams->next()) |
| 427 | pd->paint(&Painter); |
| 428 | |
| 429 | for(Painting *pp = Paintings->first(); pp != 0; pp = Paintings->next()) |
| 430 | pp->paint(&Painter); |
| 431 | |
| 432 | if(showBias > 0) { // show DC bias points in schematic ? |
| 433 | int x, y, z; |
| 434 | for(pn = Nodes->first(); pn != 0; pn = Nodes->next()) { |
| 435 | if(pn->Name.isEmpty()) continue; |
| 436 | x = pn->cx; |
| 437 | y = pn->cy + 4; |
| 438 | z = pn->x1; |
| 439 | if(z & 1) x -= Painter.Painter->fontMetrics().width(pn->Name); |
| 440 | if(!(z & 2)) { |
| 441 | y -= (Painter.LineSpacing>>1) + 4; |
| 442 | if(z & 1) x -= 4; |
| 443 | else x += 4; |
| 444 | } |
| 445 | if(z & 0x10) |
| 446 | Painter.Painter->setPen(Qt::darkGreen); // green for currents |
| 447 | else |
| 448 | Painter.Painter->setPen(Qt::blue); // blue for voltages |
| 449 | Painter.drawText(pn->Name, x, y); |
| 450 | } |
| 451 | } |
| 452 | |
| 453 | /* |
nothing calls this directly
no test coverage detected