diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2014-03-04 18:03:33 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2014-03-04 18:03:33 -0600 |
commit | f65487c88290f1c8e40529ab4e0bc02079e6fc34 (patch) | |
tree | c319e1cacbb0ef690a770a29b3304948a02ae77c | |
parent | d7b08ca2de55e68bcb073c49ca9d7def6d59b882 (diff) | |
download | ulab-f65487c88290f1c8e40529ab4e0bc02079e6fc34.tar.gz ulab-f65487c88290f1c8e40529ab4e0bc02079e6fc34.zip |
Add ability to display values of traces at selected cursor position
-rw-r--r-- | clients/tde/src/part/logicanalyzer/part.cpp | 3 | ||||
-rw-r--r-- | clients/tde/src/widgets/tracewidget.cpp | 321 | ||||
-rw-r--r-- | clients/tde/src/widgets/tracewidget.h | 14 |
3 files changed, 311 insertions, 27 deletions
diff --git a/clients/tde/src/part/logicanalyzer/part.cpp b/clients/tde/src/part/logicanalyzer/part.cpp index 97da2e3..fbece40 100644 --- a/clients/tde/src/part/logicanalyzer/part.cpp +++ b/clients/tde/src/part/logicanalyzer/part.cpp @@ -128,8 +128,10 @@ LogicAnalyzerPart::LogicAnalyzerPart( TQWidget *parentWidget, const char *widget m_traceWidget->showLeftTraceInfoArea(true); m_traceWidget->fitLeftTraceInfoArea(true); m_traceWidget->setLeftTraceInfoAreaFitSpacing(10); + m_traceWidget->showLeftCursorTraceInfoArea(true); m_traceWidget->setMinimumPixelsPerHorizDiv(30); m_traceWidget->setNumberOfCursors(2); + m_traceWidget->setTraceInfoCursor(1); m_traceWidget->setCursorColor(0, TQColor(0, 255, 0)); m_traceWidget->setCursorColor(1, TQColor(0, 255, 0)); m_traceWidget->setCursorHighlightColor(0, TQColor(192, 255, 192)); @@ -1272,6 +1274,7 @@ void LogicAnalyzerPart::updateGraticule() { m_traceWidget->setNumberOfSamples(traceno-1, m_samplesInTrace[traceno], true); m_traceWidget->setDigitalTraceMode(traceno-1, true, true); + m_traceWidget->suppressNameInCursorText(traceno-1, true, true); m_traceWidget->setDisplayLimits(traceno-1, TQRectF(0.0, (m_voltsDiv[traceno]*m_vdivs)/2.0, (m_secsDiv[traceno]*m_hdivs), (m_voltsDiv[traceno]*m_vdivs)/-2.0), (traceno<m_maxNumberOfTraces)?true:false); } diff --git a/clients/tde/src/widgets/tracewidget.cpp b/clients/tde/src/widgets/tracewidget.cpp index 3bbcb03..60bc7ce 100644 --- a/clients/tde/src/widgets/tracewidget.cpp +++ b/clients/tde/src/widgets/tracewidget.cpp @@ -5,6 +5,7 @@ #include <stdlib.h> #include <cmath> +#include <float.h> #include <tqpixmap.h> #include <tqpainter.h> @@ -274,6 +275,185 @@ TQSize TraceLabelLayout::minimumSize() const } } +class TraceCursorLabelLayout : public TQLayout +{ + public: + TraceCursorLabelLayout(TraceWidget *traceWidget, TQWidget *parent, int spacing=-1) : TQLayout(parent, 0, spacing), m_traceWidget(traceWidget) { + // + } + TraceCursorLabelLayout(TraceWidget *traceWidget, TQLayout* parent, int spacing=-1) : TQLayout(parent, spacing), m_traceWidget(traceWidget) { + // + } + TraceCursorLabelLayout(TraceWidget *traceWidget, int spacing=-1) : TQLayout(spacing), m_traceWidget(traceWidget) { + // + } + ~TraceCursorLabelLayout(); + + void addItem(TQLayoutItem *item); + void addWidget(TQWidget *w, int alignment); + TQSize sizeHint() const; + TQSize minimumSize() const; + TQLayoutIterator iterator(); + void setGeometry(const TQRect &rect); + virtual void invalidate(); + + private: + TQPtrList<TQLayoutItem> list; + TraceWidget* m_traceWidget; +}; + +class TraceCursorLabelLayoutIterator : public TQGLayoutIterator +{ + public: + TraceCursorLabelLayoutIterator( TQPtrList<TQLayoutItem> *l ) : idx(0), list(l) { + // + } + + TQLayoutItem *current() { + return idx < int(list->count()) ? list->at(idx) : 0; + } + + TQLayoutItem *next() { + idx++; + return current(); + } + + TQLayoutItem *takeCurrent() { + return list->take(idx); + } + + private: + int idx; + TQPtrList<TQLayoutItem> *list; +}; + +TQLayoutIterator TraceCursorLabelLayout::iterator() { + return TQLayoutIterator(new TraceCursorLabelLayoutIterator(&list)); +} + +void TraceCursorLabelLayout::addItem(TQLayoutItem *item) { + list.append( item ); +} + +void TraceCursorLabelLayout::addWidget(TQWidget *w, int alignment) { + if (!w) { + return; + } + + TQWidgetItem *b = new TQWidgetItem(w); + b->setAlignment(alignment); + addItem( b ); +} + +TraceCursorLabelLayout::~TraceCursorLabelLayout() { + deleteAllItems(); +} + +void TraceCursorLabelLayout::setGeometry(const TQRect &rect) { + TQLayout::setGeometry(rect); + + TQPtrListIterator<TQLayoutItem> it(list); + if (it.count() == 0) { + return; + } + + TQLayoutItem *item; + while ((item = it.current()) != 0) { + ++it; + + TQWidgetItem *widgetItem = dynamic_cast<TQWidgetItem*>(item); + if (!widgetItem) { + continue; + } + + TQWidget* widget = widgetItem->widget(); + if (!widget) { + continue; + } + + // Find the trace number + const TraceData* currentTrace = NULL; + for (uint trace=0;trace<m_traceWidget->m_traceArray.count();trace++) { + if (m_traceWidget->m_traceArray[trace]->leftCursorLabel == widget) { + currentTrace = m_traceWidget->m_traceArray[trace]; + break; + } + } + + TQFontMetrics fm(currentTrace->leftCursorLabel->font()); + int font_height = fm.boundingRect(currentTrace->leftCursorLabel->text()).height(); + int font_vertical_offset = font_height/2; + + int graticule_height = m_traceWidget->m_graticuleWidget->height(); + int y = ((((currentTrace->offset+currentTrace->textOffset)-currentTrace->topEdge)/(currentTrace->bottomEdge-currentTrace->topEdge))*(graticule_height))-font_vertical_offset; + if (m_traceWidget->m_showLeftTraceInfoArea) { + if ((y < 0) || ((y+font_height) > graticule_height)) { + currentTrace->leftCursorLabel->hide(); + item->setGeometry(TQRect(rect.x(), 0, rect.width(), currentTrace->leftCursorLabel->sizeHint().height())); + } + else { + item->setGeometry(TQRect(rect.x(), y, rect.width(), currentTrace->leftCursorLabel->sizeHint().height())); + currentTrace->leftCursorLabel->show(); + } + } + else { + currentTrace->leftCursorLabel->hide(); + } + } +} + +void TraceCursorLabelLayout::invalidate() { + setGeometry(geometry()); +} + +TQSize TraceCursorLabelLayout::sizeHint() const +{ + TQSize size; + if (!m_traceWidget->m_showLeftTraceInfoArea) { + return TQSize(0, 0); + } + + TQSize s(0, 0); + TQPtrListIterator<TQLayoutItem> it( list ); + TQLayoutItem *item; + while ((item = it.current()) != 0) { + ++it; + s = s.expandedTo(item->sizeHint()); + } + size = s + TQSize(spacing(), spacing()); + + if (m_traceWidget->m_leftTraceInfoLabelsFit && list.getFirst()) { + return TQSize(size.width(), ((list.getFirst()->sizeHint().height() + m_traceWidget->m_leftTraceInfoAreaFitSpacing) * list.count())); + } + else { + return size; + } +} + +TQSize TraceCursorLabelLayout::minimumSize() const +{ + TQSize minSize; + if (!m_traceWidget->m_showLeftTraceInfoArea) { + return TQSize(0, 0); + } + + TQSize s(0, 0); + TQPtrListIterator<TQLayoutItem> it(list); + TQLayoutItem *item; + while ((item = it.current()) != 0) { + ++it; + s = s.expandedTo(item->minimumSize()); + } + minSize = s + TQSize(spacing(), spacing()); + + if (m_traceWidget->m_leftTraceInfoLabelsFit && list.getFirst()) { + return TQSize(minSize.width(), ((list.getFirst()->minimumSize().height()+ m_traceWidget->m_leftTraceInfoAreaFitSpacing) * list.count())); + } + else { + return minSize; + } +} + TraceData::TraceData(TraceWidget* parent, TQWidget* labelParent) : TQObject(), parentWidget(parent) { color = TQColor(0, 255, 0); numberOfSamples = 0; @@ -289,6 +469,7 @@ TraceData::TraceData(TraceWidget* parent, TQWidget* labelParent) : TQObject(), p horizontalUnits = i18n("Units"); verticalUnits = i18n("Units"); m_digitalTraceDrawing = false; + m_suppressNameInCursorText = false; enabled = false; if (labelParent) { @@ -310,6 +491,15 @@ TraceData::TraceData(TraceWidget* parent, TQWidget* labelParent) : TQObject(), p leftLabel->setFont(font); leftLabel->setText("<qt></qt>"); leftLabel->hide(); + leftCursorLabel = new TQLabel(labelParent); + leftCursorLabel->setPaletteBackgroundColor(labelParent->paletteBackgroundColor()); + leftCursorLabel->setPaletteForegroundColor(color); + leftCursorLabel->setAlignment(TQt::AlignLeft|TQt::AlignVCenter|TQt::SingleLine); + font = leftCursorLabel->font(); + font.setPointSize(font.pointSize()-1); + leftCursorLabel->setFont(font); + leftCursorLabel->setText("<qt></qt>"); + leftCursorLabel->hide(); graphStatusLabel = new TQLabel(labelParent); graphStatusLabel->setPaletteBackgroundColor(labelParent->paletteBackgroundColor()); graphStatusLabel->setPaletteForegroundColor(color); @@ -366,6 +556,7 @@ TraceData::TraceData(TraceWidget* parent, TQWidget* labelParent) : TQObject(), p else { paramLabel = NULL; leftLabel = NULL; + leftCursorLabel = NULL; graphStatusLabel = NULL; graphStatusLabelInner = NULL; singleIncrBtn = NULL; @@ -1154,6 +1345,8 @@ TraceWidget::TraceWidget(TQWidget* parent, const char* name) : TQWidget(parent, m_horizScrollBar(0), m_useAbsoluteHorizontalRange(true), m_showLeftTraceInfoArea(false), + m_showLeftCursorInfoArea(false), + m_traceInfoCursor(0), m_leftTraceInfoLabelsFit(false), m_leftTraceInfoAreaFitSpacing(0), m_minimumPixelsPerHorizDiv(0) { @@ -1171,6 +1364,7 @@ TraceWidget::TraceWidget(TQWidget* parent, const char* name) : TQWidget(parent, m_infoLabelLayout = new TQGridLayout; m_cursorLabelLayout = new TQGridLayout; m_traceLeftLabelLayout = new TraceLabelLayout(this); + m_traceLeftCursorLabelLayout = new TraceCursorLabelLayout(this); m_statusLabelLayout = new TQVBoxLayout; m_statusLabelLayoutInner = new TQVBoxLayout; m_primaryLayout->addLayout(m_traceLabelLayout, 255, 1); @@ -1181,6 +1375,7 @@ TraceWidget::TraceWidget(TQWidget* parent, const char* name) : TQWidget(parent, m_rightPaneLayout->addLayout(m_cursorLabelLayout, 0, 1); m_rightPaneLayout->addLayout(m_infoLabelLayout, 1, 1); m_leftPaneLayout->addLayout(m_traceLeftLabelLayout, 0, 1); + m_leftPaneLayout->addLayout(m_traceLeftCursorLabelLayout, 0, 2); m_traceLabelLayout->addItem(new TQSpacerItem(0, 0, TQSizePolicy::Expanding, TQSizePolicy::Minimum), 0, 255); m_rightPaneLayout->addItem(new TQSpacerItem(0, 0, TQSizePolicy::Minimum, TQSizePolicy::Expanding), 255, 0); m_leftPaneLayout->addItem(new TQSpacerItem(0, 0, TQSizePolicy::Minimum, TQSizePolicy::Expanding), 255, 0); @@ -1261,6 +1456,16 @@ void TraceWidget::setDigitalTraceMode(uint traceNumber, bool enabled, bool defer VERIFY_TRACE_ARRAY_SIZE m_traceArray[traceNumber]->m_digitalTraceDrawing = enabled; + if (!deferUpdate) { + m_graticuleWidget->updateGraticule(); + updateTraceText(); + } +} + +void TraceWidget::suppressNameInCursorText(uint traceNumber, bool suppress, bool deferUpdate) { + VERIFY_TRACE_ARRAY_SIZE + + m_traceArray[traceNumber]->m_suppressNameInCursorText = suppress; if (!deferUpdate) { m_graticuleWidget->updateGraticule(); @@ -1316,6 +1521,8 @@ void TraceWidget::updateTraceText() { m_traceArray[trace]->paramLabel->setPaletteForegroundColor(m_traceArray[trace]->color); m_traceArray[trace]->leftLabel->setPaletteBackgroundColor(paletteBackgroundColor()); m_traceArray[trace]->leftLabel->setPaletteForegroundColor(m_traceArray[trace]->color); + m_traceArray[trace]->leftCursorLabel->setPaletteBackgroundColor(paletteBackgroundColor()); + m_traceArray[trace]->leftCursorLabel->setPaletteForegroundColor(m_traceArray[trace]->color); m_traceArray[trace]->graphStatusLabel->setPaletteBackgroundColor(paletteBackgroundColor()); m_traceArray[trace]->graphStatusLabel->setPaletteForegroundColor(m_traceArray[trace]->color); m_traceArray[trace]->graphStatusLabelInner->setPaletteBackgroundColor(paletteBackgroundColor()); @@ -1358,41 +1565,72 @@ void TraceWidget::updateCursorText() { // If this is a vertical cursor, list the horizontal positions for all channels for (uint trace=0;trace<m_traceArray.count();trace++) { - if ((m_traceArray[trace]->enabled) && (m_cursorArray[cursor]->activeTraceLabelList.contains(trace) > 0)) { - double horizontal_range = (m_traceArray[trace]->rightEdge-m_traceArray[trace]->leftEdge); - double vertical_range = (m_traceArray[trace]->bottomEdge-m_traceArray[trace]->topEdge); - - if (m_cursorArray[cursor]->orientation == TQt::Horizontal) { - double realCursorPosition = (m_traceArray[trace]->topEdge+((m_cursorArray[cursor]->position/100.0)*vertical_range)-m_traceArray[trace]->offset); - TQString deltaText; - if (cursor >= m_zoomCursorStartIndex) { - for (uint cursor2=m_zoomCursorStartIndex;cursor2<m_cursorArray.count();cursor2++) { - if (cursor2 != cursor) { - if (m_cursorArray[cursor2]->orientation == m_cursorArray[cursor]->orientation) { - double realSecondaryCursorPosition = (m_traceArray[trace]->topEdge+((m_cursorArray[cursor2]->position/100.0)*vertical_range)-m_traceArray[trace]->offset); - deltaText = trUtf8("Δ") + prettyFormat(fabs(realCursorPosition-realSecondaryCursorPosition), vertical_range, m_traceArray[trace]->verticalUnits); - break; + if (m_traceArray[trace]->enabled) { + if (m_cursorArray[cursor]->activeTraceLabelList.contains(trace) > 0) { + double horizontal_range = (m_traceArray[trace]->rightEdge-m_traceArray[trace]->leftEdge); + double vertical_range = (m_traceArray[trace]->bottomEdge-m_traceArray[trace]->topEdge); + + if (m_cursorArray[cursor]->orientation == TQt::Horizontal) { + double realCursorPosition = (m_traceArray[trace]->topEdge+((m_cursorArray[cursor]->position/100.0)*vertical_range)-m_traceArray[trace]->offset); + TQString deltaText; + if (cursor >= m_zoomCursorStartIndex) { + for (uint cursor2=m_zoomCursorStartIndex;cursor2<m_cursorArray.count();cursor2++) { + if (cursor2 != cursor) { + if (m_cursorArray[cursor2]->orientation == m_cursorArray[cursor]->orientation) { + double realSecondaryCursorPosition = (m_traceArray[trace]->topEdge+((m_cursorArray[cursor2]->position/100.0)*vertical_range)-m_traceArray[trace]->offset); + deltaText = trUtf8("Δ") + prettyFormat(fabs(realCursorPosition-realSecondaryCursorPosition), vertical_range, m_traceArray[trace]->verticalUnits); + break; + } } } } + cursorText.append(TQString("<br>%1: %2%3").arg(m_traceArray[trace]->traceName).arg(prettyFormat(realCursorPosition, vertical_range, m_traceArray[trace]->verticalUnits)).arg(deltaText)); } - cursorText.append(TQString("<br>%1: %2%3").arg(m_traceArray[trace]->traceName).arg(prettyFormat(realCursorPosition, vertical_range, m_traceArray[trace]->verticalUnits)).arg(deltaText)); - } - else { - double realCursorPosition = (m_traceArray[trace]->leftEdge+((m_cursorArray[cursor]->position/100.0)*horizontal_range)); - TQString deltaText; - if (cursor >= m_zoomCursorStartIndex) { - for (uint cursor2=m_zoomCursorStartIndex;cursor2<m_cursorArray.count();cursor2++) { - if (cursor2 != cursor) { - if (m_cursorArray[cursor2]->orientation == m_cursorArray[cursor]->orientation) { - double realSecondaryCursorPosition = (m_traceArray[trace]->leftEdge+((m_cursorArray[cursor2]->position/100.0)*horizontal_range)); - deltaText = trUtf8("Δ") + prettyFormat(fabs(realCursorPosition-realSecondaryCursorPosition), horizontal_range, m_traceArray[trace]->horizontalUnits); - break; + else { + double realCursorPosition = (m_traceArray[trace]->leftEdge+((m_cursorArray[cursor]->position/100.0)*horizontal_range)); + TQString deltaText; + if (cursor >= m_zoomCursorStartIndex) { + for (uint cursor2=m_zoomCursorStartIndex;cursor2<m_cursorArray.count();cursor2++) { + if (cursor2 != cursor) { + if (m_cursorArray[cursor2]->orientation == m_cursorArray[cursor]->orientation) { + double realSecondaryCursorPosition = (m_traceArray[trace]->leftEdge+((m_cursorArray[cursor2]->position/100.0)*horizontal_range)); + deltaText = trUtf8("Δ") + prettyFormat(fabs(realCursorPosition-realSecondaryCursorPosition), horizontal_range, m_traceArray[trace]->horizontalUnits); + break; + } } } } + if (m_traceArray[trace]->m_suppressNameInCursorText) { + cursorText.append(TQString("<br>%2%3").arg(prettyFormat(realCursorPosition, (m_useAbsoluteHorizontalRange)?m_traceArray[trace]->rightEdge:horizontal_range, m_traceArray[trace]->horizontalUnits)).arg(deltaText)); + } + else { + cursorText.append(TQString("<br>%1: %2%3").arg(m_traceArray[trace]->traceName).arg(prettyFormat(realCursorPosition, (m_useAbsoluteHorizontalRange)?m_traceArray[trace]->rightEdge:horizontal_range, m_traceArray[trace]->horizontalUnits)).arg(deltaText)); + } + } + } + + if (cursor == m_traceInfoCursor) { + double horizontal_range = (m_traceArray[trace]->rightEdge-m_traceArray[trace]->leftEdge); + double realCursorPosition = (m_traceArray[trace]->leftEdge+((m_cursorArray[cursor]->position/100.0)*horizontal_range)); + + // Find closest data point + unsigned int n; + unsigned int closest = 0; + double diff; + double distance = DBL_MAX; + for (n=0; n<m_traceArray[trace]->numberOfSamples; n++) { + diff = fabs(m_traceArray[trace]->positionArray[n] - realCursorPosition); + if (diff < distance) { + distance = diff; + closest = n; + } + } + if (m_traceArray[trace]->m_digitalTraceDrawing) { + m_traceArray[trace]->leftCursorLabel->setText(TQString("<qt><nobr>%2</qt>").arg((m_traceArray[trace]->sampleArray[closest]==0)?"0":"1")); + } + else { + m_traceArray[trace]->leftCursorLabel->setText(TQString("<qt><nobr>%2</qt>").arg(TraceWidget::prettyFormat(m_traceArray[trace]->sampleArray[closest], m_traceArray[trace]->sampleArray[closest], m_traceArray[trace]->verticalUnits))); } - cursorText.append(TQString("<br>%1: %2%3").arg(m_traceArray[trace]->traceName).arg(prettyFormat(realCursorPosition, (m_useAbsoluteHorizontalRange)?m_traceArray[trace]->rightEdge:horizontal_range, m_traceArray[trace]->horizontalUnits)).arg(deltaText)); } } } @@ -1415,6 +1653,7 @@ void TraceWidget::setSamples(uint traceNumber, TQDoubleArray& tqda, bool deferUp m_traceArray[traceNumber]->numberOfSamples = tqda.size(); if (!deferUpdate) { + updateCursorText(); m_graticuleWidget->repaint(false); } } @@ -1434,6 +1673,7 @@ void TraceWidget::setPositions(uint traceNumber, TQDoubleArray& tqda, bool defer m_traceArray[traceNumber]->rightEdgeIndex = -1; if (!deferUpdate) { + updateCursorText(); m_graticuleWidget->repaint(false); } } @@ -1468,6 +1708,7 @@ void TraceWidget::setTraceEnabled(uint traceNumber, bool enabled, TextDisplayTyp if (showText == FullText) { m_traceArray[traceNumber]->paramLabel->show(); m_traceArray[traceNumber]->leftLabel->show(); + m_traceArray[traceNumber]->leftCursorLabel->show(); m_traceArray[traceNumber]->graphStatusLabel->show(); m_traceArray[traceNumber]->graphStatusLabelInner->hide(); m_traceArray[traceNumber]->singleIncrBtn->show(); @@ -1478,6 +1719,7 @@ void TraceWidget::setTraceEnabled(uint traceNumber, bool enabled, TextDisplayTyp else { m_traceArray[traceNumber]->paramLabel->hide(); m_traceArray[traceNumber]->leftLabel->hide(); + m_traceArray[traceNumber]->leftCursorLabel->hide(); m_traceArray[traceNumber]->graphStatusLabel->hide(); if (showText == SummaryText) { m_traceArray[traceNumber]->graphStatusLabelInner->show(); @@ -1494,6 +1736,7 @@ void TraceWidget::setTraceEnabled(uint traceNumber, bool enabled, TextDisplayTyp else { m_traceArray[traceNumber]->paramLabel->hide(); m_traceArray[traceNumber]->leftLabel->hide(); + m_traceArray[traceNumber]->leftCursorLabel->hide(); m_traceArray[traceNumber]->graphStatusLabel->hide(); m_traceArray[traceNumber]->graphStatusLabelInner->hide(); m_traceArray[traceNumber]->singleIncrBtn->hide(); @@ -1665,6 +1908,13 @@ void TraceWidget::setCursorOrientation(uint cursorNumber, TQt::Orientation orien updateCursorText(); } +void TraceWidget::setTraceInfoCursor(uint cursorNumber) { + VERIFY_CURSOR_ARRAY_SIZE + + m_traceInfoCursor = cursorNumber; + updateCursorText(); +} + void TraceWidget::setNumberOfTraces(uint traceNumber) { resizeTraceArray(traceNumber); } @@ -1873,14 +2123,28 @@ void TraceWidget::showLeftTraceInfoArea(bool show) { } } +void TraceWidget::showLeftCursorTraceInfoArea(bool show) { + m_showLeftCursorInfoArea = show; + for (uint i=0;i<m_traceArray.count();i++) { + if (m_showLeftCursorInfoArea) { + m_traceArray[i]->leftCursorLabel->show(); + } + else { + m_traceArray[i]->leftCursorLabel->hide(); + } + } +} + void TraceWidget::fitLeftTraceInfoArea(bool fit) { m_leftTraceInfoLabelsFit = fit; m_traceLeftLabelLayout->invalidate(); + m_traceLeftCursorLabelLayout->invalidate(); } void TraceWidget::setLeftTraceInfoAreaFitSpacing(int spacing) { m_leftTraceInfoAreaFitSpacing = spacing; m_traceLeftLabelLayout->invalidate(); + m_traceLeftCursorLabelLayout->invalidate(); } void TraceWidget::setMinimumPixelsPerHorizDiv(unsigned int pixels) { @@ -2009,6 +2273,7 @@ void TraceWidget::processChangedOffset(double offset) { } if (tracenumber >= 0) { m_traceLeftLabelLayout->invalidate(); + m_traceLeftCursorLabelLayout->invalidate(); emit(offsetChanged(tracenumber, offset)); } } @@ -2049,6 +2314,7 @@ void TraceWidget::resizeTraceArray(uint newsize) { m_traceLabelLayout->addWidget(m_traceArray[i]->posSetBtn, 2, (i*2)+1); m_traceLabelLayout->addWidget(m_traceArray[i]->singleDecrBtn, 3, (i*2)+1); m_traceLeftLabelLayout->addWidget(m_traceArray[i]->leftLabel, TQt::AlignTop); + m_traceLeftCursorLabelLayout->addWidget(m_traceArray[i]->leftCursorLabel, TQt::AlignTop); m_statusLabelLayout->insertWidget(i, m_traceArray[i]->graphStatusLabel, TQt::AlignTop); m_statusLabelLayoutInner->insertWidget(i, m_traceArray[i]->graphStatusLabelInner); } @@ -2064,6 +2330,7 @@ void TraceWidget::resizeTraceArray(uint newsize) { m_traceLabelLayout->remove(m_traceArray[i]->posSetBtn); m_traceLabelLayout->remove(m_traceArray[i]->singleDecrBtn); m_traceLeftLabelLayout->remove(m_traceArray[i]->leftLabel); + m_traceLeftCursorLabelLayout->remove(m_traceArray[i]->leftCursorLabel); m_statusLabelLayout->remove(m_traceArray[i]->graphStatusLabel); m_statusLabelLayoutInner->remove(m_traceArray[i]->graphStatusLabelInner); } diff --git a/clients/tde/src/widgets/tracewidget.h b/clients/tde/src/widgets/tracewidget.h index 0afc9d4..664e9c1 100644 --- a/clients/tde/src/widgets/tracewidget.h +++ b/clients/tde/src/widgets/tracewidget.h @@ -15,6 +15,7 @@ class TQPushButton; class TQToolButton; class TraceWidget; class TraceLabelLayout; +class TraceCursorLabelLayout; class TQRectF { @@ -83,8 +84,10 @@ class TraceData : public TQObject TQString horizontalUnits; TQString verticalUnits; bool m_digitalTraceDrawing; + bool m_suppressNameInCursorText; TQLabel* paramLabel; TQLabel* leftLabel; + TQLabel* leftCursorLabel; TQLabel* graphStatusLabel; TQLabel* graphStatusLabelInner; TQToolButton* singleIncrBtn; @@ -96,6 +99,7 @@ class TraceData : public TQObject friend class TraceWidget; friend class GraticuleWidget; friend class TraceLabelLayout; + friend class TraceCursorLabelLayout; }; typedef TQMemArray<TraceData*> TraceList; @@ -229,6 +233,7 @@ class TraceWidget : public TQWidget TQString traceVerticalUnits(uint traceNumber); void setTraceVerticalUnits(uint traceNumber, TQString units, bool deferUpdate=false); void setDigitalTraceMode(uint traceNumber, bool enabled, bool deferUpdate=false); + void suppressNameInCursorText(uint traceNumber, bool suppress, bool deferUpdate=false); double cursorPosition(uint cursorNumber); void setCursorPosition(uint cursorNumber, double position); @@ -243,6 +248,7 @@ class TraceWidget : public TQWidget void setCursorName(uint cursorNumber, TQString name); TQt::Orientation cursorOrientation(uint cursorNumber); void setCursorOrientation(uint cursorNumber, TQt::Orientation orient); + void setTraceInfoCursor(uint cursorNumber); void setForegroundColor(const TQColor color); void setBackgroundColor(const TQColor color); @@ -255,8 +261,12 @@ class TraceWidget : public TQWidget void setZoomCursorStartIndex(unsigned int index); void showLeftTraceInfoArea(bool show); + void showLeftCursorTraceInfoArea(bool show); void fitLeftTraceInfoArea(bool fit); void setLeftTraceInfoAreaFitSpacing(int spacing); + + void showLeftCursorInfoArea(bool show); + void setMinimumPixelsPerHorizDiv(unsigned int pixels); double traceOffset(uint traceNumber); @@ -308,12 +318,15 @@ class TraceWidget : public TQWidget TQGridLayout* m_infoLabelLayout; TQGridLayout* m_cursorLabelLayout; TraceLabelLayout* m_traceLeftLabelLayout; + TraceCursorLabelLayout* m_traceLeftCursorLabelLayout; TQVBoxLayout* m_statusLabelLayout; TQVBoxLayout* m_statusLabelLayoutInner; GraticuleWidget* m_graticuleWidget; TQScrollBar* m_horizScrollBar; bool m_useAbsoluteHorizontalRange; bool m_showLeftTraceInfoArea; + bool m_showLeftCursorInfoArea; + unsigned int m_traceInfoCursor; bool m_leftTraceInfoLabelsFit; int m_leftTraceInfoAreaFitSpacing; unsigned int m_minimumPixelsPerHorizDiv; @@ -322,6 +335,7 @@ class TraceWidget : public TQWidget friend class TraceData; friend class CursorData; friend class TraceLabelLayout; + friend class TraceCursorLabelLayout; friend class TraceScrollView; friend class TraceScrollWidget; }; |