Mercurial > hg > svgui
comparison view/Pane.cpp @ 1239:a496986aa61b
Fix #1792 measure tool crosshairs rendered in wrong colour. Also extend crosshairs over the no-man's-land at the left
| author | Chris Cannam | 
|---|---|
| date | Tue, 21 Feb 2017 11:12:07 +0000 | 
| parents | 6f0d7aa25816 | 
| children | a34a2a25907c | 
   comparison
  equal
  deleted
  inserted
  replaced
| 1238:4d0ca1ab4cd0 | 1239:a496986aa61b | 
|---|---|
| 426 if (e) paint.setClipRect(r); | 426 if (e) paint.setClipRect(r); | 
| 427 | 427 | 
| 428 ViewManager::ToolMode toolMode = ViewManager::NavigateMode; | 428 ViewManager::ToolMode toolMode = ViewManager::NavigateMode; | 
| 429 if (m_manager) toolMode = m_manager->getToolModeFor(this); | 429 if (m_manager) toolMode = m_manager->getToolModeFor(this); | 
| 430 | 430 | 
| 431 if (m_manager && | 431 // Locate some relevant layers and models | 
| 432 m_mouseInWidget && | 432 | 
| 433 toolMode == ViewManager::MeasureMode) { | |
| 434 | |
| 435 for (LayerList::iterator vi = m_layerStack.end(); vi != m_layerStack.begin(); ) { | |
| 436 --vi; | |
| 437 | |
| 438 std::vector<QRect> crosshairExtents; | |
| 439 | |
| 440 if ((*vi)->getCrosshairExtents(this, paint, m_identifyPoint, | |
| 441 crosshairExtents)) { | |
| 442 (*vi)->paintCrosshairs(this, paint, m_identifyPoint); | |
| 443 break; | |
| 444 } else if ((*vi)->isLayerOpaque()) { | |
| 445 break; | |
| 446 } | |
| 447 } | |
| 448 } | |
| 449 | |
| 450 Layer *topLayer = getTopLayer(); | 433 Layer *topLayer = getTopLayer(); | 
| 451 bool haveSomeTimeXAxis = false; | 434 bool haveSomeTimeXAxis = false; | 
| 452 | 435 | 
| 453 const Model *waveformModel = 0; // just for reporting purposes | 436 const Model *waveformModel = 0; // just for reporting purposes | 
| 454 const Model *workModel = 0; | 437 const Model *workModel = 0; | 
| 471 } | 454 } | 
| 472 | 455 | 
| 473 if (waveformModel && workModel && haveSomeTimeXAxis) break; | 456 if (waveformModel && workModel && haveSomeTimeXAxis) break; | 
| 474 } | 457 } | 
| 475 | 458 | 
| 476 m_scaleWidth = 0; | 459 // Block off left and right extents so we can see where the main model ends | 
| 477 | 460 | 
| 478 if (workModel && hasTopLayerTimeXAxis()) { | 461 if (workModel && hasTopLayerTimeXAxis()) { | 
| 479 drawModelTimeExtents(r, paint, workModel); | 462 drawModelTimeExtents(r, paint, workModel); | 
| 480 } | 463 } | 
| 481 | 464 | 
| 465 // Crosshairs for mouse movement in measure mode | |
| 466 | |
| 467 if (m_manager && | |
| 468 m_mouseInWidget && | |
| 469 toolMode == ViewManager::MeasureMode) { | |
| 470 | |
| 471 for (LayerList::iterator vi = m_layerStack.end(); vi != m_layerStack.begin(); ) { | |
| 472 --vi; | |
| 473 | |
| 474 std::vector<QRect> crosshairExtents; | |
| 475 | |
| 476 if ((*vi)->getCrosshairExtents(this, paint, m_identifyPoint, | |
| 477 crosshairExtents)) { | |
| 478 (*vi)->paintCrosshairs(this, paint, m_identifyPoint); | |
| 479 break; | |
| 480 } else if ((*vi)->isLayerOpaque()) { | |
| 481 break; | |
| 482 } | |
| 483 } | |
| 484 } | |
| 485 | |
| 486 // Scale width will be set implicitly during drawVerticalScale call | |
| 487 m_scaleWidth = 0; | |
| 488 | |
| 482 if (m_manager && m_manager->shouldShowVerticalScale() && topLayer) { | 489 if (m_manager && m_manager->shouldShowVerticalScale() && topLayer) { | 
| 483 drawVerticalScale(r, topLayer, paint); | 490 drawVerticalScale(r, topLayer, paint); | 
| 484 } | 491 } | 
| 485 | 492 | 
| 493 // Feature description: the box in top-right showing values from | |
| 494 // the nearest feature to the mouse | |
| 495 | |
| 486 if (m_identifyFeatures && | 496 if (m_identifyFeatures && | 
| 487 m_manager && m_manager->shouldIlluminateLocalFeatures() && | 497 m_manager && m_manager->shouldIlluminateLocalFeatures() && | 
| 488 topLayer) { | 498 topLayer) { | 
| 489 drawFeatureDescription(topLayer, paint); | 499 drawFeatureDescription(topLayer, paint); | 
| 490 } | 500 } | 
| 525 if (m_manager && | 535 if (m_manager && | 
| 526 m_manager->shouldShowLayerNames()) { | 536 m_manager->shouldShowLayerNames()) { | 
| 527 drawLayerNames(r, paint); | 537 drawLayerNames(r, paint); | 
| 528 } | 538 } | 
| 529 | 539 | 
| 540 // The blue box that is shown when you ctrl-click in navigate mode | |
| 541 // to define a zoom region | |
| 542 | |
| 530 if (m_shiftPressed && m_clickedInRange && | 543 if (m_shiftPressed && m_clickedInRange && | 
| 531 (toolMode == ViewManager::NavigateMode || m_navigating)) { | 544 (toolMode == ViewManager::NavigateMode || m_navigating)) { | 
| 532 | 545 | 
| 533 //!!! be nice if this looked a bit more in keeping with the | 546 //!!! be nice if this looked a bit more in keeping with the | 
| 534 //selection block | 547 //selection block | 
