# HG changeset patch # User Chris Cannam # Date 1173287222 0 # Node ID cd81066ac7adf81abe6355fc5e484387bffa6efb # Parent 9e739f92c0b8ea296de8d01208f3069a059f06b1 * 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 diff -r 9e739f92c0b8 -r cd81066ac7ad layer/ColourMapper.h --- a/layer/ColourMapper.h Mon Mar 05 15:32:55 2007 +0000 +++ b/layer/ColourMapper.h Wed Mar 07 17:07:02 2007 +0000 @@ -26,6 +26,8 @@ class ColourMapper : public QObject { + Q_OBJECT + public: ColourMapper(int map, float minValue, float maxValue); virtual ~ColourMapper(); diff -r 9e739f92c0b8 -r cd81066ac7ad layer/SpectrogramLayer.cpp --- a/layer/SpectrogramLayer.cpp Mon Mar 05 15:32:55 2007 +0000 +++ b/layer/SpectrogramLayer.cpp Wed Mar 07 17:07:02 2007 +0000 @@ -2027,7 +2027,10 @@ Preferences::getInstance()->getSpectrogramSmoothing(); if (smoothing == Preferences::SpectrogramInterpolated || smoothing == Preferences::SpectrogramZeroPaddedAndInterpolated) { - interpolate = true; + if (m_binDisplay != PeakBins && + m_binDisplay != PeakFrequencies) { + interpolate = true; + } } diff -r 9e739f92c0b8 -r cd81066ac7ad view/Overview.cpp --- a/view/Overview.cpp Mon Mar 05 15:32:55 2007 +0000 +++ b/view/Overview.cpp Wed Mar 07 17:07:02 2007 +0000 @@ -76,10 +76,9 @@ } void -Overview::viewManagerZoomLevelChanged(void *p, unsigned long z, bool) +Overview::viewZoomLevelChanged(View *v, unsigned long z, bool) { - if (p == this) return; - View *v = (View *)p; + if (v == this) return; if (m_views.find(v) != m_views.end()) { update(); } @@ -111,7 +110,7 @@ ZoomConstraint::RoundUp); if (zoomLevel != m_zoomLevel) { m_zoomLevel = zoomLevel; - emit zoomLevelChanged(this, m_zoomLevel, m_followZoom); + emit zoomLevelChanged(m_zoomLevel, m_followZoom); } size_t centreFrame = startFrame + m_zoomLevel * (width() / 2); if (centreFrame > (startFrame + getModelsEndFrame())/2) { diff -r 9e739f92c0b8 -r cd81066ac7ad view/Overview.h --- a/view/Overview.h Mon Mar 05 15:32:55 2007 +0000 +++ b/view/Overview.h Wed Mar 07 17:07:02 2007 +0000 @@ -45,7 +45,7 @@ virtual void globalCentreFrameChanged(unsigned long); virtual void viewCentreFrameChanged(View *, unsigned long); - virtual void viewManagerZoomLevelChanged(void *, unsigned long, bool); + virtual void viewZoomLevelChanged(View *, unsigned long, bool); virtual void viewManagerPlaybackFrameChanged(unsigned long); protected: diff -r 9e739f92c0b8 -r cd81066ac7ad view/Pane.cpp --- a/view/Pane.cpp Mon Mar 05 15:32:55 2007 +0000 +++ b/view/Pane.cpp Wed Mar 07 17:07:02 2007 +0000 @@ -49,6 +49,7 @@ m_navigating(false), m_resizing(false), m_centreLineVisible(true), + m_scaleWidth(0), m_headsUpDisplay(0) { setObjectName("Pane"); @@ -232,8 +233,8 @@ width() > 120 && height() > 100) { if (!m_headsUpDisplay->isVisible()) { m_headsUpDisplay->show(); - connect(m_manager, SIGNAL(zoomLevelChanged()), - this, SLOT(zoomLevelChanged())); + connect(m_manager, SIGNAL(viewZoomLevelChanged(View *, unsigned long, bool)), + this, SLOT(viewZoomLevelChanged(View *, unsigned long, bool))); } if (haveVThumb) { m_headsUpDisplay->setFixedHeight(m_vthumb->height() + m_hthumb->height()); @@ -245,8 +246,8 @@ } else { m_headsUpDisplay->hide(); if (m_manager) { - disconnect(m_manager, SIGNAL(zoomLevelChanged()), - this, SLOT(zoomLevelChanged())); + disconnect(m_manager, SIGNAL(viewZoomLevelChanged(View *, unsigned long, bool)), + this, SLOT(viewZoomLevelChanged(View *, unsigned long, bool))); } } } @@ -418,9 +419,9 @@ break; } - verticalScaleWidth = (*vi)->getVerticalScaleWidth(this, paint); + m_scaleWidth = (*vi)->getVerticalScaleWidth(this, paint); - if (verticalScaleWidth > 0 && r.left() < verticalScaleWidth) { + if (m_scaleWidth > 0 && r.left() < m_scaleWidth) { // Profiler profiler("Pane::paintEvent - painting vertical scale", true); @@ -429,11 +430,11 @@ paint.setPen(Qt::black); paint.setBrush(Qt::white); - paint.drawRect(0, -1, verticalScaleWidth, height()+1); + paint.drawRect(0, -1, m_scaleWidth, height()+1); paint.setBrush(Qt::NoBrush); (*vi)->paintVerticalScale - (this, paint, QRect(0, 0, verticalScaleWidth, height())); + (this, paint, QRect(0, 0, m_scaleWidth, height())); paint.restore(); } @@ -706,6 +707,15 @@ paint.end(); } +size_t +Pane::getFirstVisibleFrame() const +{ + long f0 = getFrameForX(m_scaleWidth); + size_t f = View::getFirstVisibleFrame(); + if (f0 < 0 || f0 < long(f)) return f; + return f0; +} + Selection Pane::getSelectionAt(int x, bool &closeToLeftEdge, bool &closeToRightEdge) const { @@ -1619,11 +1629,15 @@ } void -Pane::zoomLevelChanged() +Pane::viewZoomLevelChanged(View *v, unsigned long, bool locked) { // std::cerr << "Pane[" << this << "]::zoomLevelChanged (global now " // << (m_manager ? m_manager->getGlobalZoom() : 0) << ")" << std::endl; + if (v != this) { + if (!locked || !m_followZoom) return; + } + if (m_manager && m_manager->getZoomWheelsEnabled()) { updateHeadsUpDisplay(); } diff -r 9e739f92c0b8 -r cd81066ac7ad view/Pane.h --- a/view/Pane.h Mon Mar 05 15:32:55 2007 +0000 +++ b/view/Pane.h Wed Mar 07 17:07:02 2007 +0000 @@ -48,6 +48,8 @@ void setCentreLineVisible(bool visible); bool getCentreLineVisible() const { return m_centreLineVisible; } + virtual size_t getFirstVisibleFrame() const; + virtual QString toXmlString(QString indent = "", QString extraAttributes = "") const; @@ -58,7 +60,7 @@ public slots: virtual void toolModeChanged(); virtual void zoomWheelsEnabledChanged(); - virtual void zoomLevelChanged(); + virtual void viewZoomLevelChanged(View *v, unsigned long z, bool locked); virtual void horizontalThumbwheelMoved(int value); virtual void verticalThumbwheelMoved(int value); @@ -117,6 +119,7 @@ size_t m_selectionStartFrame; Selection m_editingSelection; int m_editingSelectionEdge; + mutable int m_scaleWidth; enum DragMode { UnresolvedDrag, diff -r 9e739f92c0b8 -r cd81066ac7ad view/View.cpp --- a/view/View.cpp Mon Mar 05 15:32:55 2007 +0000 +++ b/view/View.cpp Wed Mar 07 17:07:02 2007 +0000 @@ -426,7 +426,7 @@ { if (m_zoomLevel != int(z)) { m_zoomLevel = z; - emit zoomLevelChanged(this, z, m_followZoom); + emit zoomLevelChanged(z, m_followZoom); update(); } } @@ -537,13 +537,13 @@ m_manager->disconnect(this, SLOT(globalCentreFrameChanged(unsigned long))); m_manager->disconnect(this, SLOT(viewCentreFrameChanged(View *, unsigned long))); m_manager->disconnect(this, SLOT(viewManagerPlaybackFrameChanged(unsigned long))); - m_manager->disconnect(this, SLOT(viewManagerZoomLevelChanged(void *, unsigned long, bool))); + m_manager->disconnect(this, SLOT(viewZoomLevelChanged(View *, unsigned long, bool))); m_manager->disconnect(this, SLOT(toolModeChanged())); m_manager->disconnect(this, SLOT(selectionChanged())); m_manager->disconnect(this, SLOT(overlayModeChanged())); m_manager->disconnect(this, SLOT(zoomWheelsEnabledChanged())); - disconnect(m_manager, SIGNAL(viewCentreFrameChanged(unsigned long, bool, PlaybackFollowMode))); - disconnect(m_manager, SIGNAL(zoomLevelChanged(void *, unsigned long, bool))); + disconnect(m_manager, SLOT(viewCentreFrameChanged(unsigned long, bool, PlaybackFollowMode))); + disconnect(m_manager, SLOT(zoomLevelChanged(unsigned long, bool))); } m_manager = manager; @@ -557,8 +557,8 @@ connect(m_manager, SIGNAL(playbackFrameChanged(unsigned long)), this, SLOT(viewManagerPlaybackFrameChanged(unsigned long))); - connect(m_manager, SIGNAL(zoomLevelChanged(void *, unsigned long, bool)), - this, SLOT(viewManagerZoomLevelChanged(void *, unsigned long, bool))); + connect(m_manager, SIGNAL(viewZoomLevelChanged(View *, unsigned long, bool)), + this, SLOT(viewZoomLevelChanged(View *, unsigned long, bool))); connect(m_manager, SIGNAL(toolModeChanged()), this, SLOT(toolModeChanged())); @@ -576,8 +576,8 @@ m_manager, SLOT(viewCentreFrameChanged(unsigned long, bool, PlaybackFollowMode))); - connect(this, SIGNAL(zoomLevelChanged(void *, unsigned long, bool)), - m_manager, SIGNAL(zoomLevelChanged(void *, unsigned long, bool))); + connect(this, SIGNAL(zoomLevelChanged(unsigned long, bool)), + m_manager, SLOT(viewZoomLevelChanged(unsigned long, bool))); toolModeChanged(); } @@ -870,13 +870,10 @@ } void -View::viewManagerZoomLevelChanged(void *p, unsigned long z, bool locked) +View::viewZoomLevelChanged(View *p, unsigned long z, bool locked) { if (m_followZoom && p != this && locked) { - if (m_manager && (sender() == m_manager)) { - setZoomLevel(z); - if (p == this) repaint(); - } + setZoomLevel(z); } } @@ -892,6 +889,24 @@ } size_t +View::getFirstVisibleFrame() const +{ + long f0 = getStartFrame(); + size_t f = getModelsStartFrame(); + if (f0 < 0 || f0 < long(f)) return f; + return f0; +} + +size_t +View::getLastVisibleFrame() const +{ + size_t f0 = getEndFrame(); + size_t f = getModelsEndFrame(); + if (f0 > f) return f; + return f0; +} + +size_t View::getModelsStartFrame() const { bool first = true; diff -r 9e739f92c0b8 -r cd81066ac7ad view/View.h --- a/view/View.h Mon Mar 05 15:32:55 2007 +0000 +++ b/view/View.h Wed Mar 07 17:07:02 2007 +0000 @@ -224,6 +224,10 @@ virtual QString toXmlString(QString indent = "", QString extraAttributes = "") const; + // First frame actually in model, to right of scale, if present + virtual size_t getFirstVisibleFrame() const; + virtual size_t getLastVisibleFrame() const; + size_t getModelsStartFrame() const; size_t getModelsEndFrame() const; @@ -239,7 +243,7 @@ bool globalScroll, PlaybackFollowMode followMode); - void zoomLevelChanged(void *, unsigned long, bool); + void zoomLevelChanged(unsigned long, bool); void contextHelpChanged(const QString &); @@ -255,7 +259,7 @@ virtual void globalCentreFrameChanged(unsigned long); virtual void viewCentreFrameChanged(View *, unsigned long); virtual void viewManagerPlaybackFrameChanged(unsigned long); - virtual void viewManagerZoomLevelChanged(void *, unsigned long, bool); + virtual void viewZoomLevelChanged(View *, unsigned long, bool); virtual void propertyContainerSelected(View *, PropertyContainer *pc); diff -r 9e739f92c0b8 -r cd81066ac7ad view/ViewManager.cpp --- a/view/ViewManager.cpp Mon Mar 05 15:32:55 2007 +0000 +++ b/view/ViewManager.cpp Wed Mar 07 17:07:02 2007 +0000 @@ -47,10 +47,11 @@ m_zoomWheelsEnabled = settings.value("zoom-wheels-enabled", m_zoomWheelsEnabled).toBool(); settings.endGroup(); - +/*!!! connect(this, SIGNAL(zoomLevelChanged(void *, unsigned long, bool)), SLOT(considerZoomChange(void *, unsigned long, bool))); +*/ } ViewManager::~ViewManager() @@ -379,17 +380,26 @@ } void -ViewManager::considerZoomChange(void *p, unsigned long z, bool locked) +ViewManager::viewZoomLevelChanged(unsigned long z, bool locked) { - emit zoomLevelChanged(); + View *v = dynamic_cast(sender()); + + if (!v) { + std::cerr << "ViewManager::viewZoomLevelChanged: WARNING: sender is not a view" << std::endl; + return; + } + +//!!! emit zoomLevelChanged(); if (locked) { m_globalZoom = z; } #ifdef DEBUG_VIEW_MANAGER - std::cout << "ViewManager::considerZoomChange(" << p << ", " << z << ", " << locked << ")" << std::endl; + std::cout << "ViewManager::viewZoomLevelChanged(" << v << ", " << z << ", " << locked << ")" << std::endl; #endif + + emit viewZoomLevelChanged(v, z, locked); } void diff -r 9e739f92c0b8 -r cd81066ac7ad view/ViewManager.h --- a/view/ViewManager.h Mon Mar 05 15:32:55 2007 +0000 +++ b/view/ViewManager.h Wed Mar 07 17:07:02 2007 +0000 @@ -147,11 +147,8 @@ /** Emitted when user scrolls a view, but doesn't affect global centre. */ void viewCentreFrameChanged(View *v, unsigned long frame); - /** Emitted when a view zooms. The originator identifies the view. */ - void zoomLevelChanged(void *originator, unsigned long zoom, bool locked); - /** Emitted when a view zooms. */ - void zoomLevelChanged(); + void viewZoomLevelChanged(View *v, unsigned long zoom, bool locked); /** Emitted when the playback frame changes. */ void playbackFrameChanged(unsigned long frame); @@ -184,12 +181,13 @@ public slots: void viewCentreFrameChanged(unsigned long, bool, PlaybackFollowMode); + void viewZoomLevelChanged(unsigned long, bool); protected slots: void checkPlayStatus(); void playStatusChanged(bool playing); void seek(unsigned long); - void considerZoomChange(void *, unsigned long, bool); +//!!! void considerZoomChange(void *, unsigned long, bool); protected: AudioPlaySource *m_playSource; diff -r 9e739f92c0b8 -r cd81066ac7ad widgets/ListInputDialog.h --- a/widgets/ListInputDialog.h Mon Mar 05 15:32:55 2007 +0000 +++ b/widgets/ListInputDialog.h Wed Mar 07 17:07:02 2007 +0000 @@ -30,6 +30,8 @@ class ListInputDialog : public QDialog { + Q_OBJECT + public: virtual ~ListInputDialog(); diff -r 9e739f92c0b8 -r cd81066ac7ad widgets/SubdividingMenu.h --- a/widgets/SubdividingMenu.h Mon Mar 05 15:32:55 2007 +0000 +++ b/widgets/SubdividingMenu.h Wed Mar 07 17:07:02 2007 +0000 @@ -36,6 +36,8 @@ class SubdividingMenu : public QMenu { + Q_OBJECT + public: SubdividingMenu(size_t lowerLimit = 0, size_t upperLimit = 0, QWidget *parent = 0);