comparison view/Pane.cpp @ 222:cd81066ac7ad

* More useful status bar text -- show the current play time and the extents of the visible area * Add update-i18n.sh to update the i18n/ts and qm files -- I can't get qmake to do the right thing now that the project file has been split up into several project files * Fix missing Q_OBJECTs, etc, reported by lupdate * Update Russian translation from AlexandrE
author Chris Cannam
date Wed, 07 Mar 2007 17:07:02 +0000
parents bd2d0346da0e
children 403bfb88d8d6
comparison
equal deleted inserted replaced
221:9e739f92c0b8 222:cd81066ac7ad
47 m_shiftPressed(false), 47 m_shiftPressed(false),
48 m_ctrlPressed(false), 48 m_ctrlPressed(false),
49 m_navigating(false), 49 m_navigating(false),
50 m_resizing(false), 50 m_resizing(false),
51 m_centreLineVisible(true), 51 m_centreLineVisible(true),
52 m_scaleWidth(0),
52 m_headsUpDisplay(0) 53 m_headsUpDisplay(0)
53 { 54 {
54 setObjectName("Pane"); 55 setObjectName("Pane");
55 setMouseTracking(true); 56 setMouseTracking(true);
56 57
230 231
231 if (m_manager && m_manager->getZoomWheelsEnabled() && 232 if (m_manager && m_manager->getZoomWheelsEnabled() &&
232 width() > 120 && height() > 100) { 233 width() > 120 && height() > 100) {
233 if (!m_headsUpDisplay->isVisible()) { 234 if (!m_headsUpDisplay->isVisible()) {
234 m_headsUpDisplay->show(); 235 m_headsUpDisplay->show();
235 connect(m_manager, SIGNAL(zoomLevelChanged()), 236 connect(m_manager, SIGNAL(viewZoomLevelChanged(View *, unsigned long, bool)),
236 this, SLOT(zoomLevelChanged())); 237 this, SLOT(viewZoomLevelChanged(View *, unsigned long, bool)));
237 } 238 }
238 if (haveVThumb) { 239 if (haveVThumb) {
239 m_headsUpDisplay->setFixedHeight(m_vthumb->height() + m_hthumb->height()); 240 m_headsUpDisplay->setFixedHeight(m_vthumb->height() + m_hthumb->height());
240 m_headsUpDisplay->move(width() - 86, height() - 86); 241 m_headsUpDisplay->move(width() - 86, height() - 86);
241 } else { 242 } else {
243 m_headsUpDisplay->move(width() - 86, height() - 16); 244 m_headsUpDisplay->move(width() - 86, height() - 16);
244 } 245 }
245 } else { 246 } else {
246 m_headsUpDisplay->hide(); 247 m_headsUpDisplay->hide();
247 if (m_manager) { 248 if (m_manager) {
248 disconnect(m_manager, SIGNAL(zoomLevelChanged()), 249 disconnect(m_manager, SIGNAL(viewZoomLevelChanged(View *, unsigned long, bool)),
249 this, SLOT(zoomLevelChanged())); 250 this, SLOT(viewZoomLevelChanged(View *, unsigned long, bool)));
250 } 251 }
251 } 252 }
252 } 253 }
253 254
254 void 255 void
416 417
417 if (!m_manager || !m_manager->shouldShowVerticalScale()) { 418 if (!m_manager || !m_manager->shouldShowVerticalScale()) {
418 break; 419 break;
419 } 420 }
420 421
421 verticalScaleWidth = (*vi)->getVerticalScaleWidth(this, paint); 422 m_scaleWidth = (*vi)->getVerticalScaleWidth(this, paint);
422 423
423 if (verticalScaleWidth > 0 && r.left() < verticalScaleWidth) { 424 if (m_scaleWidth > 0 && r.left() < m_scaleWidth) {
424 425
425 // Profiler profiler("Pane::paintEvent - painting vertical scale", true); 426 // Profiler profiler("Pane::paintEvent - painting vertical scale", true);
426 427
427 // std::cerr << "Pane::paintEvent: calling paint.save() in vertical scale block" << std::endl; 428 // std::cerr << "Pane::paintEvent: calling paint.save() in vertical scale block" << std::endl;
428 paint.save(); 429 paint.save();
429 430
430 paint.setPen(Qt::black); 431 paint.setPen(Qt::black);
431 paint.setBrush(Qt::white); 432 paint.setBrush(Qt::white);
432 paint.drawRect(0, -1, verticalScaleWidth, height()+1); 433 paint.drawRect(0, -1, m_scaleWidth, height()+1);
433 434
434 paint.setBrush(Qt::NoBrush); 435 paint.setBrush(Qt::NoBrush);
435 (*vi)->paintVerticalScale 436 (*vi)->paintVerticalScale
436 (this, paint, QRect(0, 0, verticalScaleWidth, height())); 437 (this, paint, QRect(0, 0, m_scaleWidth, height()));
437 438
438 paint.restore(); 439 paint.restore();
439 } 440 }
440 441
441 if (m_identifyFeatures) { 442 if (m_identifyFeatures) {
702 } 703 }
703 paint.restore(); 704 paint.restore();
704 } 705 }
705 706
706 paint.end(); 707 paint.end();
708 }
709
710 size_t
711 Pane::getFirstVisibleFrame() const
712 {
713 long f0 = getFrameForX(m_scaleWidth);
714 size_t f = View::getFirstVisibleFrame();
715 if (f0 < 0 || f0 < long(f)) return f;
716 return f0;
707 } 717 }
708 718
709 Selection 719 Selection
710 Pane::getSelectionAt(int x, bool &closeToLeftEdge, bool &closeToRightEdge) const 720 Pane::getSelectionAt(int x, bool &closeToLeftEdge, bool &closeToRightEdge) const
711 { 721 {
1617 updateHeadsUpDisplay(); 1627 updateHeadsUpDisplay();
1618 update(); 1628 update();
1619 } 1629 }
1620 1630
1621 void 1631 void
1622 Pane::zoomLevelChanged() 1632 Pane::viewZoomLevelChanged(View *v, unsigned long, bool locked)
1623 { 1633 {
1624 // std::cerr << "Pane[" << this << "]::zoomLevelChanged (global now " 1634 // std::cerr << "Pane[" << this << "]::zoomLevelChanged (global now "
1625 // << (m_manager ? m_manager->getGlobalZoom() : 0) << ")" << std::endl; 1635 // << (m_manager ? m_manager->getGlobalZoom() : 0) << ")" << std::endl;
1636
1637 if (v != this) {
1638 if (!locked || !m_followZoom) return;
1639 }
1626 1640
1627 if (m_manager && m_manager->getZoomWheelsEnabled()) { 1641 if (m_manager && m_manager->getZoomWheelsEnabled()) {
1628 updateHeadsUpDisplay(); 1642 updateHeadsUpDisplay();
1629 } 1643 }
1630 } 1644 }