comparison view/View.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 9465b5375235
comparison
equal deleted inserted replaced
221:9e739f92c0b8 222:cd81066ac7ad
424 void 424 void
425 View::setZoomLevel(size_t z) 425 View::setZoomLevel(size_t z)
426 { 426 {
427 if (m_zoomLevel != int(z)) { 427 if (m_zoomLevel != int(z)) {
428 m_zoomLevel = z; 428 m_zoomLevel = z;
429 emit zoomLevelChanged(this, z, m_followZoom); 429 emit zoomLevelChanged(z, m_followZoom);
430 update(); 430 update();
431 } 431 }
432 } 432 }
433 433
434 View::LayerProgressBar::LayerProgressBar(QWidget *parent) : 434 View::LayerProgressBar::LayerProgressBar(QWidget *parent) :
535 { 535 {
536 if (m_manager) { 536 if (m_manager) {
537 m_manager->disconnect(this, SLOT(globalCentreFrameChanged(unsigned long))); 537 m_manager->disconnect(this, SLOT(globalCentreFrameChanged(unsigned long)));
538 m_manager->disconnect(this, SLOT(viewCentreFrameChanged(View *, unsigned long))); 538 m_manager->disconnect(this, SLOT(viewCentreFrameChanged(View *, unsigned long)));
539 m_manager->disconnect(this, SLOT(viewManagerPlaybackFrameChanged(unsigned long))); 539 m_manager->disconnect(this, SLOT(viewManagerPlaybackFrameChanged(unsigned long)));
540 m_manager->disconnect(this, SLOT(viewManagerZoomLevelChanged(void *, unsigned long, bool))); 540 m_manager->disconnect(this, SLOT(viewZoomLevelChanged(View *, unsigned long, bool)));
541 m_manager->disconnect(this, SLOT(toolModeChanged())); 541 m_manager->disconnect(this, SLOT(toolModeChanged()));
542 m_manager->disconnect(this, SLOT(selectionChanged())); 542 m_manager->disconnect(this, SLOT(selectionChanged()));
543 m_manager->disconnect(this, SLOT(overlayModeChanged())); 543 m_manager->disconnect(this, SLOT(overlayModeChanged()));
544 m_manager->disconnect(this, SLOT(zoomWheelsEnabledChanged())); 544 m_manager->disconnect(this, SLOT(zoomWheelsEnabledChanged()));
545 disconnect(m_manager, SIGNAL(viewCentreFrameChanged(unsigned long, bool, PlaybackFollowMode))); 545 disconnect(m_manager, SLOT(viewCentreFrameChanged(unsigned long, bool, PlaybackFollowMode)));
546 disconnect(m_manager, SIGNAL(zoomLevelChanged(void *, unsigned long, bool))); 546 disconnect(m_manager, SLOT(zoomLevelChanged(unsigned long, bool)));
547 } 547 }
548 548
549 m_manager = manager; 549 m_manager = manager;
550 if (m_followPan) setCentreFrame(m_manager->getGlobalCentreFrame(), false); 550 if (m_followPan) setCentreFrame(m_manager->getGlobalCentreFrame(), false);
551 if (m_followZoom) setZoomLevel(m_manager->getGlobalZoom()); 551 if (m_followZoom) setZoomLevel(m_manager->getGlobalZoom());
555 connect(m_manager, SIGNAL(viewCentreFrameChanged(View *, unsigned long)), 555 connect(m_manager, SIGNAL(viewCentreFrameChanged(View *, unsigned long)),
556 this, SLOT(viewCentreFrameChanged(View *, unsigned long))); 556 this, SLOT(viewCentreFrameChanged(View *, unsigned long)));
557 connect(m_manager, SIGNAL(playbackFrameChanged(unsigned long)), 557 connect(m_manager, SIGNAL(playbackFrameChanged(unsigned long)),
558 this, SLOT(viewManagerPlaybackFrameChanged(unsigned long))); 558 this, SLOT(viewManagerPlaybackFrameChanged(unsigned long)));
559 559
560 connect(m_manager, SIGNAL(zoomLevelChanged(void *, unsigned long, bool)), 560 connect(m_manager, SIGNAL(viewZoomLevelChanged(View *, unsigned long, bool)),
561 this, SLOT(viewManagerZoomLevelChanged(void *, unsigned long, bool))); 561 this, SLOT(viewZoomLevelChanged(View *, unsigned long, bool)));
562 562
563 connect(m_manager, SIGNAL(toolModeChanged()), 563 connect(m_manager, SIGNAL(toolModeChanged()),
564 this, SLOT(toolModeChanged())); 564 this, SLOT(toolModeChanged()));
565 connect(m_manager, SIGNAL(selectionChanged()), 565 connect(m_manager, SIGNAL(selectionChanged()),
566 this, SLOT(selectionChanged())); 566 this, SLOT(selectionChanged()));
574 connect(this, SIGNAL(centreFrameChanged(unsigned long, bool, 574 connect(this, SIGNAL(centreFrameChanged(unsigned long, bool,
575 PlaybackFollowMode)), 575 PlaybackFollowMode)),
576 m_manager, SLOT(viewCentreFrameChanged(unsigned long, bool, 576 m_manager, SLOT(viewCentreFrameChanged(unsigned long, bool,
577 PlaybackFollowMode))); 577 PlaybackFollowMode)));
578 578
579 connect(this, SIGNAL(zoomLevelChanged(void *, unsigned long, bool)), 579 connect(this, SIGNAL(zoomLevelChanged(unsigned long, bool)),
580 m_manager, SIGNAL(zoomLevelChanged(void *, unsigned long, bool))); 580 m_manager, SLOT(viewZoomLevelChanged(unsigned long, bool)));
581 581
582 toolModeChanged(); 582 toolModeChanged();
583 } 583 }
584 584
585 void 585 void
868 break; 868 break;
869 } 869 }
870 } 870 }
871 871
872 void 872 void
873 View::viewManagerZoomLevelChanged(void *p, unsigned long z, bool locked) 873 View::viewZoomLevelChanged(View *p, unsigned long z, bool locked)
874 { 874 {
875 if (m_followZoom && p != this && locked) { 875 if (m_followZoom && p != this && locked) {
876 if (m_manager && (sender() == m_manager)) { 876 setZoomLevel(z);
877 setZoomLevel(z);
878 if (p == this) repaint();
879 }
880 } 877 }
881 } 878 }
882 879
883 void 880 void
884 View::selectionChanged() 881 View::selectionChanged()
887 delete m_cache; 884 delete m_cache;
888 m_cache = 0; 885 m_cache = 0;
889 m_selectionCached = false; 886 m_selectionCached = false;
890 } 887 }
891 update(); 888 update();
889 }
890
891 size_t
892 View::getFirstVisibleFrame() const
893 {
894 long f0 = getStartFrame();
895 size_t f = getModelsStartFrame();
896 if (f0 < 0 || f0 < long(f)) return f;
897 return f0;
898 }
899
900 size_t
901 View::getLastVisibleFrame() const
902 {
903 size_t f0 = getEndFrame();
904 size_t f = getModelsEndFrame();
905 if (f0 > f) return f;
906 return f0;
892 } 907 }
893 908
894 size_t 909 size_t
895 View::getModelsStartFrame() const 910 View::getModelsStartFrame() const
896 { 911 {