Mercurial > hg > svgui
changeset 513:1341e95eeae9
* Make drawing segment divisions optional in segmentation plot style of
time value layer
* Don't follow playback when Alt is held down (complements use of Alt as
peek modifier)
author | Chris Cannam |
---|---|
date | Thu, 26 Feb 2009 16:58:25 +0000 |
parents | ed65126e503d |
children | 4ba0476ebbb6 |
files | layer/TimeValueLayer.cpp layer/TimeValueLayer.h view/View.cpp |
diffstat | 3 files changed, 46 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/layer/TimeValueLayer.cpp Thu Feb 26 14:05:13 2009 +0000 +++ b/layer/TimeValueLayer.cpp Thu Feb 26 16:58:25 2009 +0000 @@ -52,6 +52,7 @@ m_colourMap(0), m_plotStyle(PlotConnectedPoints), m_verticalScale(AutoAlignScale), + m_drawSegmentDivisions(true), m_scaleMinimum(0), m_scaleMaximum(0) { @@ -88,6 +89,7 @@ list.push_back("Plot Type"); list.push_back("Vertical Scale"); list.push_back("Scale Units"); + list.push_back("Draw Segment Division Lines"); return list; } @@ -97,6 +99,7 @@ if (name == "Plot Type") return tr("Plot Type"); if (name == "Vertical Scale") return tr("Vertical Scale"); if (name == "Scale Units") return tr("Scale Units"); + if (name == "Draw Segment Division Lines") return tr("Draw Segment Division Lines"); return SingleColourLayer::getPropertyLabel(name); } @@ -107,6 +110,7 @@ if (name == "Vertical Scale") return ValueProperty; if (name == "Scale Units") return UnitsProperty; if (name == "Colour" && m_plotStyle == PlotSegmentation) return ValueProperty; + if (name == "Draw Segment Division Lines") return ToggleProperty; return SingleColourLayer::getPropertyType(name); } @@ -116,6 +120,9 @@ if (name == "Vertical Scale" || name == "Scale Units") { return tr("Scale"); } + if (name == "Plot Type" || name == "Draw Segment Division Lines") { + return tr("Plot Type"); + } return SingleColourLayer::getPropertyGroupName(name); } @@ -157,6 +164,13 @@ (m_model->getScaleUnits()); } + } else if (name == "Draw Segment Division Lines") { + + if (min) *min = 0; + if (max) *max = 0; + if (deflt) *deflt = 1; + val = (m_drawSegmentDivisions ? 1.0 : 0.0); + } else { val = SingleColourLayer::getPropertyRangeAndValue(name, min, max, deflt); @@ -208,6 +222,8 @@ (UnitDatabase::getInstance()->getUnitById(value)); emit modelChanged(); } + } else if (name == "Draw Segment Division Lines") { + setDrawSegmentDivisions(value > 0.5); } else { SingleColourLayer::setProperty(name, value); } @@ -242,6 +258,14 @@ emit layerParametersChanged(); } +void +TimeValueLayer::setDrawSegmentDivisions(bool draw) +{ + if (m_drawSegmentDivisions == draw) return; + m_drawSegmentDivisions = draw; + emit layerParametersChanged(); +} + bool TimeValueLayer::isLayerScrollable(const View *v) const { @@ -886,9 +910,12 @@ if (nx <= x) continue; - if (illuminateFrame != p.frame && - (nx < x + 5 || x >= v->width() - 1)) { - paint.setPen(Qt::NoPen); + if (illuminateFrame != p.frame) { + if (!m_drawSegmentDivisions || + nx < x + 5 || + x >= v->width() - 1) { + paint.setPen(Qt::NoPen); + } } paint.drawRect(x, -1, nx - x, v->height() + 1); @@ -1623,12 +1650,13 @@ { SingleColourLayer::toXml(stream, indent, extraAttributes + - QString(" colourMap=\"%1\" plotStyle=\"%2\" verticalScale=\"%3\" scaleMinimum=\"%4\" scaleMaximum=\"%5\" ") + QString(" colourMap=\"%1\" plotStyle=\"%2\" verticalScale=\"%3\" scaleMinimum=\"%4\" scaleMaximum=\"%5\" drawDivisions=\"%6\" ") .arg(m_colourMap) .arg(m_plotStyle) .arg(m_verticalScale) .arg(m_scaleMinimum) - .arg(m_scaleMaximum)); + .arg(m_scaleMaximum) + .arg(m_drawSegmentDivisions ? "true" : "false")); } void @@ -1649,6 +1677,9 @@ attributes.value("verticalScale").toInt(&ok); if (ok) setVerticalScale(scale); + bool draw = (attributes.value("drawDivisions").trimmed() == "true"); + setDrawSegmentDivisions(draw); + float min = attributes.value("scaleMinimum").toFloat(&ok); float max = attributes.value("scaleMaximum").toFloat(&alsoOk); if (ok && alsoOk) setDisplayExtents(min, max);
--- a/layer/TimeValueLayer.h Thu Feb 26 14:05:13 2009 +0000 +++ b/layer/TimeValueLayer.h Thu Feb 26 16:58:25 2009 +0000 @@ -103,6 +103,9 @@ void setVerticalScale(VerticalScale scale); VerticalScale getVerticalScale() const { return m_verticalScale; } + void setDrawSegmentDivisions(bool); + bool getDrawSegmentDivisions() const { return m_drawSegmentDivisions; } + virtual bool isLayerScrollable(const View *v) const; virtual bool isLayerEditable() const { return true; } @@ -156,6 +159,7 @@ int m_colourMap; PlotStyle m_plotStyle; VerticalScale m_verticalScale; + bool m_drawSegmentDivisions; mutable float m_scaleMinimum; mutable float m_scaleMaximum;
--- a/view/View.cpp Thu Feb 26 14:05:13 2009 +0000 +++ b/view/View.cpp Thu Feb 26 16:58:25 2009 +0000 @@ -942,10 +942,14 @@ m_playPointerFrame = newFrame; if (!visibleChange) return; + bool somethingGoingOn = + ((QApplication::mouseButtons() != Qt::NoButton) || + (QApplication::keyboardModifiers() & Qt::AltModifier)); + switch (m_followPlay) { case PlaybackScrollContinuous: - if (QApplication::mouseButtons() == Qt::NoButton) { + if (!somethingGoingOn) { setCentreFrame(m_playPointerFrame, false); } break; @@ -986,7 +990,7 @@ #endif if (xnew < width()/8 || xnew > (width()*7)/8) { - if (QApplication::mouseButtons() == Qt::NoButton) { + if (!somethingGoingOn) { long offset = getFrameForX(width()/2) - getStartFrame(); long newCentre = sf + offset; bool changed = setCentreFrame(newCentre, false);