Mercurial > hg > svgui
changeset 217:bd2d0346da0e
* Inhibit making and displaying time selections in slice layers
author | Chris Cannam |
---|---|
date | Mon, 05 Mar 2007 10:53:41 +0000 |
parents | 34bbbcb3c01f |
children | 21a5e4e7cb92 |
files | layer/Layer.h layer/SliceLayer.h view/Pane.cpp view/View.cpp view/View.h |
diffstat | 5 files changed, 30 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/layer/Layer.h Fri Mar 02 14:00:12 2007 +0000 +++ b/layer/Layer.h Mon Mar 05 10:53:41 2007 +0000 @@ -270,6 +270,8 @@ virtual bool needsTextLabelHeight() const { return false; } + virtual bool hasTimeXAxis() const { return true; } + /** * Return the minimum and maximum values for the y axis of the * model in this layer, as well as whether the layer is configured
--- a/layer/SliceLayer.h Fri Mar 02 14:00:12 2007 +0000 +++ b/layer/SliceLayer.h Mon Mar 05 10:53:41 2007 +0000 @@ -61,6 +61,8 @@ virtual bool getValueExtents(float &min, float &max, bool &logarithmic, QString &unit) const; + virtual bool hasTimeXAxis() const { return false; } + virtual bool isLayerScrollable(const View *v) const { return false; } enum EnergyScale { LinearScale, MeterScale, dBScale };
--- a/view/Pane.cpp Fri Mar 02 14:00:12 2007 +0000 +++ b/view/Pane.cpp Mon Mar 05 10:53:41 2007 +0000 @@ -812,6 +812,8 @@ } else if (mode == ViewManager::SelectMode) { + if (!hasTopLayerTimeXAxis()) return; + bool closeToLeft = false, closeToRight = false; Selection selection = getSelectionAt(e->x(), closeToLeft, closeToRight); @@ -909,6 +911,8 @@ } else if (mode == ViewManager::SelectMode) { + if (!hasTopLayerTimeXAxis()) return; + if (m_manager && m_manager->haveInProgressSelection()) { bool exclusive; @@ -970,7 +974,7 @@ if (!m_clickedInRange) { - if (mode == ViewManager::SelectMode) { + if (mode == ViewManager::SelectMode && hasTopLayerTimeXAxis()) { bool closeToLeft = false, closeToRight = false; getSelectionAt(e->x(), closeToLeft, closeToRight); if ((closeToLeft || closeToRight) && !(closeToLeft && closeToRight)) { @@ -1011,6 +1015,8 @@ } else if (mode == ViewManager::SelectMode) { + if (!hasTopLayerTimeXAxis()) return; + dragExtendSelection(e); } else if (mode == ViewManager::DrawMode) { @@ -1690,6 +1696,8 @@ } else if (mode == ViewManager::SelectMode) { + if (!hasTopLayerTimeXAxis()) return; + bool haveSelection = (m_manager && !m_manager->getSelections().empty()); if (haveSelection) {
--- a/view/View.cpp Fri Mar 02 14:00:12 2007 +0000 +++ b/view/View.cpp Mon Mar 05 10:53:41 2007 +0000 @@ -1071,6 +1071,15 @@ return false; } +bool +View::hasTopLayerTimeXAxis() const +{ + LayerList::const_iterator i = m_layers.end(); + if (i == m_layers.begin()) return false; + --i; + return (*i)->hasTimeXAxis(); +} + void View::zoom(bool in) { @@ -1435,6 +1444,8 @@ void View::drawSelections(QPainter &paint) { + if (!hasTopLayerTimeXAxis()) return; + MultiSelection::SelectionList selections; if (m_manager) {
--- a/view/View.h Fri Mar 02 14:00:12 2007 +0000 +++ b/view/View.h Mon Mar 05 10:53:41 2007 +0000 @@ -285,6 +285,12 @@ // rather than with a translucent fill. bool areLayerColoursSignificant() const; + // True if the top layer has a time axis on the x coordinate (this + // is generally the case except for spectrum/slice layers). It + // will not be possible to make or display selections if this is + // false. + bool hasTopLayerTimeXAxis() const; + bool setCentreFrame(size_t f, bool doEmit); void checkProgress(void *object);