From c866f91716ca2c9b9acb286867651fdea0ad46a1 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sat, 6 Apr 2019 17:21:40 -0500 Subject: Enhance horizontal cursor labels in scope zoom widget --- clients/tde/src/part/scope/part.cpp | 1 + clients/tde/src/widgets/tracewidget.cpp | 15 ++++++++++++++- clients/tde/src/widgets/tracewidget.h | 3 +++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/clients/tde/src/part/scope/part.cpp b/clients/tde/src/part/scope/part.cpp index 1995e85..44dbb84 100644 --- a/clients/tde/src/part/scope/part.cpp +++ b/clients/tde/src/part/scope/part.cpp @@ -565,6 +565,7 @@ ScopePart::ScopePart( TQWidget *parentWidget, const char *widgetName, TQObject * m_traceWidget->setCursorActiveTraceList(4, activeTraces); m_traceWidget->setZoomBoxEnabled(true); + m_base->traceZoomWidget->setHorizontalRangeModeAbsolute(false); m_base->traceZoomWidget->setSizePolicy(TQSizePolicy(TQSizePolicy::MinimumExpanding, TQSizePolicy::MinimumExpanding)); connect(m_traceWidget, SIGNAL(zoomBoxChanged(const TQRectF&)), this, SLOT(updateZoomWidgetLimits(const TQRectF&))); connect(m_traceWidget, SIGNAL(offsetChanged(uint, double)), m_base->traceZoomWidget, SLOT(setTraceOffset(uint, double))); diff --git a/clients/tde/src/widgets/tracewidget.cpp b/clients/tde/src/widgets/tracewidget.cpp index 6ce3fa2..f875571 100644 --- a/clients/tde/src/widgets/tracewidget.cpp +++ b/clients/tde/src/widgets/tracewidget.cpp @@ -1374,7 +1374,12 @@ void GraticuleWidget::mouseMoveEvent(TQMouseEvent *e) { #if 0 m_base->m_traceArray[trace]->graphStatusLabel->setText(TQString("%1
@%2,%3
").arg(m_base->m_traceArray[trace]->traceName).arg(TraceWidget::prettyFormat(realCursorXPosition, horizontal_range, m_base->m_traceArray[trace]->horizontalUnits)).arg(TraceWidget::prettyFormat(realCursorYPosition, vertical_range, m_base->m_traceArray[trace]->verticalUnits))); #else - m_base->m_traceArray[trace]->graphStatusLabel->setText(TQString("@%2,%3").arg(TraceWidget::prettyFormat(realCursorXPosition, (m_base->m_useAbsoluteHorizontalRange)?m_base->m_traceArray[trace]->rightEdge:horizontal_range, m_base->m_traceArray[trace]->horizontalUnits)).arg(TraceWidget::prettyFormat(realCursorYPosition, vertical_range, m_base->m_traceArray[trace]->verticalUnits))); + if (m_base->m_useAbsoluteHorizontalRange) { + m_base->m_traceArray[trace]->graphStatusLabel->setText(TQString("@%2,%3").arg(TraceWidget::prettyFormat(realCursorXPosition, m_base->m_traceArray[trace]->rightEdge, m_base->m_traceArray[trace]->horizontalUnits)).arg(TraceWidget::prettyFormat(realCursorYPosition, vertical_range, m_base->m_traceArray[trace]->verticalUnits))); + } + else { + m_base->m_traceArray[trace]->graphStatusLabel->setText(TQString("@%2[%3+%4],%5").arg(TraceWidget::prettyFormat(realCursorXPosition, m_base->m_traceArray[trace]->rightEdge, m_base->m_traceArray[trace]->horizontalUnits)).arg(TraceWidget::prettyFormat(m_base->m_traceArray[trace]->leftEdge, m_base->m_traceArray[trace]->rightEdge, m_base->m_traceArray[trace]->horizontalUnits)).arg(TraceWidget::prettyFormat(realCursorXPosition - m_base->m_traceArray[trace]->leftEdge, horizontal_range, m_base->m_traceArray[trace]->horizontalUnits)).arg(TraceWidget::prettyFormat(realCursorYPosition, vertical_range, m_base->m_traceArray[trace]->verticalUnits))); + } #endif m_base->m_traceArray[trace]->graphStatusLabelInner->setText(m_base->m_traceArray[trace]->graphStatusLabel->text()); } @@ -2469,6 +2474,14 @@ void TraceWidget::setTraceTextOffset(uint traceNumber, double offset) { setTraceOffset(traceNumber, offset, false); } +bool TraceWidget::horizontalRangeModeAbsolute() { + return m_useAbsoluteHorizontalRange; +} + +void TraceWidget::setHorizontalRangeModeAbsolute(bool absolute) { + m_useAbsoluteHorizontalRange = absolute; +} + void TraceWidget::setTraceTextOffset(uint traceNumber, double offset, bool deferUpdate) { VERIFY_TRACE_ARRAY_SIZE diff --git a/clients/tde/src/widgets/tracewidget.h b/clients/tde/src/widgets/tracewidget.h index 2f58891..7f63307 100644 --- a/clients/tde/src/widgets/tracewidget.h +++ b/clients/tde/src/widgets/tracewidget.h @@ -320,6 +320,9 @@ class TraceWidget : public TQWidget double traceTextOffset(uint traceNumber); void setTraceTextOffset(uint traceNumber, double offset, bool deferUpdate); + bool horizontalRangeModeAbsolute(); + void setHorizontalRangeModeAbsolute(bool absolute=true); + bool userIsInteractingWithCursor(); static TQString prettyFormat(double value, double rangeDetectValue, TQString baseUnits, unsigned int precision=3); -- cgit v1.2.1