diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-07-16 23:57:45 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-07-16 23:57:45 -0500 |
commit | 192a06da8df1bf95e96d77d2fa0736bb7d2fe58b (patch) | |
tree | 82a7cbffa7f7e18b39f13a76bdbfa9ea6a378c54 /clients/tde/src/widgets | |
parent | 9c5e2aa99427fe125c631d4753b1f944992d8c03 (diff) | |
download | ulab-192a06da8df1bf95e96d77d2fa0736bb7d2fe58b.tar.gz ulab-192a06da8df1bf95e96d77d2fa0736bb7d2fe58b.zip |
Add trigger display
Diffstat (limited to 'clients/tde/src/widgets')
-rw-r--r-- | clients/tde/src/widgets/tracewidget.cpp | 109 | ||||
-rw-r--r-- | clients/tde/src/widgets/tracewidget.h | 11 |
2 files changed, 99 insertions, 21 deletions
diff --git a/clients/tde/src/widgets/tracewidget.cpp b/clients/tde/src/widgets/tracewidget.cpp index e3803ed..e62bdb0 100644 --- a/clients/tde/src/widgets/tracewidget.cpp +++ b/clients/tde/src/widgets/tracewidget.cpp @@ -114,12 +114,15 @@ TraceData::TraceData(TraceWidget* parent, TQWidget* labelParent) : TQObject(), p paramLabel->setPaletteBackgroundColor(labelParent->paletteBackgroundColor()); paramLabel->setPaletteForegroundColor(color); paramLabel->setAlignment(TQt::AlignHCenter|TQt::AlignVCenter|TQt::SingleLine); + TQFont font; + font = paramLabel->font(); + font.setPointSize(font.pointSize()-1); + paramLabel->setFont(font); paramLabel->hide(); graphStatusLabel = new TQLabel(labelParent); graphStatusLabel->setPaletteBackgroundColor(labelParent->paletteBackgroundColor()); graphStatusLabel->setPaletteForegroundColor(color); graphStatusLabel->setAlignment(TQt::AlignHCenter|TQt::AlignVCenter|TQt::SingleLine); - TQFont font; font = graphStatusLabel->font(); font.setPointSize(font.pointSize()-1); graphStatusLabel->setFont(font); @@ -232,6 +235,7 @@ void TraceData::movePosOneTick() { emit(offsetChanged(offset)); parentWidget->updateTraceText(); + parentWidget->updateCursorText(); parentWidget->m_graticuleWidget->repaint(false); } @@ -242,6 +246,7 @@ void TraceData::moveNegOneTick() { emit(offsetChanged(offset)); parentWidget->updateTraceText(); + parentWidget->updateCursorText(); parentWidget->m_graticuleWidget->repaint(false); } @@ -250,6 +255,7 @@ void TraceData::resetVPosition() { emit(offsetChanged(offset)); parentWidget->updateTraceText(); + parentWidget->updateCursorText(); parentWidget->m_graticuleWidget->repaint(false); } @@ -267,11 +273,21 @@ CursorData::CursorData(TraceWidget* parent, TQWidget* labelParent) : TQObject(), paramLabel->setPaletteBackgroundColor(labelParent->paletteBackgroundColor()); paramLabel->setPaletteForegroundColor(color); paramLabel->setAlignment(TQt::AlignHCenter|TQt::AlignVCenter|TQt::SingleLine); + TQFont font; + font = paramLabel->font(); + font.setPointSize(font.pointSize()-1); + paramLabel->setFont(font); paramLabel->hide(); singleIncrBtn = new TQPushButton(labelParent); singleDecrBtn = new TQPushButton(labelParent); multiIncrBtn = new TQPushButton(labelParent); multiDecrBtn = new TQPushButton(labelParent); + font = singleIncrBtn->font(); + font.setPointSize(font.pointSize()-1); + singleIncrBtn->setFont(font); + singleDecrBtn->setFont(font); + multiIncrBtn->setFont(font); + multiDecrBtn->setFont(font); singleIncrBtn->setText("+"); singleDecrBtn->setText("-"); multiIncrBtn->setText("++"); @@ -788,6 +804,7 @@ TraceWidget::TraceWidget(TQWidget* parent, const char* name) : TQWidget(parent, m_vertDivs(0), m_cursorDarkness(CURSOR_DARKNESS_FACTOR), m_zoomBoxDarkness(ZOOM_SHADING_DARKNESS_FACTOR), + m_zoomCursorStartIndex(0), m_zoomBoxEnabled(false) { setBackgroundMode(NoBackground); setSizePolicy(TQSizePolicy(TQSizePolicy::MinimumExpanding, TQSizePolicy::MinimumExpanding)); @@ -943,20 +960,23 @@ void TraceWidget::updateCursorText() { cursorText = TQString("<qt><nobr>%1").arg(m_cursorArray[cursor]->cursorName); // If this is a horizontal cursor, list all vertical positions for all channels // 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) { + 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)); + double realCursorPosition = (m_traceArray[trace]->topEdge+((m_cursorArray[cursor]->position/100.0)*vertical_range)-m_traceArray[trace]->offset); TQString deltaText; - for (uint cursor2=0;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)); - deltaText = trUtf8("Δ") + prettyFormat(fabs(realCursorPosition-realSecondaryCursorPosition), vertical_range, m_traceArray[trace]->verticalUnits); - break; + 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)); + deltaText = trUtf8("Δ") + prettyFormat(fabs(realCursorPosition-realSecondaryCursorPosition), vertical_range, m_traceArray[trace]->verticalUnits); + break; + } } } } @@ -965,12 +985,14 @@ void TraceWidget::updateCursorText() { else { double realCursorPosition = (m_traceArray[trace]->leftEdge+((m_cursorArray[cursor]->position/100.0)*horizontal_range)); TQString deltaText; - for (uint cursor2=0;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 (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; + } } } } @@ -1122,6 +1144,43 @@ void TraceWidget::setCursorPosition(uint cursorNumber, double position) { m_graticuleWidget->repaint(false); } +TQColor TraceWidget::cursorColor(uint cursorNumber) { + VERIFY_CURSOR_ARRAY_SIZE + + return m_cursorArray[cursorNumber]->color; +} + +void TraceWidget::setCursorColor(uint cursorNumber, TQColor color) { + VERIFY_CURSOR_ARRAY_SIZE + + m_cursorArray[cursorNumber]->color = color; + updateCursorText(); + m_graticuleWidget->updateGraticule(); + m_graticuleWidget->repaint(false); +} + +TQColor TraceWidget::cursorHighlightColor(uint cursorNumber) { + VERIFY_CURSOR_ARRAY_SIZE + + return m_cursorArray[cursorNumber]->highlightColor; +} + +void TraceWidget::setCursorHighlightColor(uint cursorNumber, TQColor color) { + VERIFY_CURSOR_ARRAY_SIZE + + m_cursorArray[cursorNumber]->highlightColor = color; + updateCursorText(); + m_graticuleWidget->updateGraticule(); + m_graticuleWidget->repaint(false); +} + +void TraceWidget::setCursorActiveTraceList(uint cursorNumber, TraceNumberList list) { + VERIFY_CURSOR_ARRAY_SIZE + + m_cursorArray[cursorNumber]->activeTraceLabelList = list; + updateCursorText(); +} + bool TraceWidget::cursorEnabled(uint cursorNumber) { VERIFY_CURSOR_ARRAY_SIZE @@ -1188,7 +1247,7 @@ void TraceWidget::setNumberOfCursors(uint cursorNumber) { TQRectF TraceWidget::zoomBox() { uint i; - if ((m_cursorArray.count() < 4) || (!m_zoomBoxEnabled)) { + if ((m_cursorArray.count() < (4+m_zoomCursorStartIndex)) || (!m_zoomBoxEnabled)) { if (!m_zoomBoxPrev.isNull()) { m_zoomBoxPrev = TQRectF(); emit(zoomBoxChanged(m_zoomBoxPrev)); @@ -1202,7 +1261,7 @@ TQRectF TraceWidget::zoomBox() { double vert[2]; int j = 0; int k = 0; - for (i=0;i<m_cursorArray.count(); i++) { + for (i=m_zoomCursorStartIndex;i<m_cursorArray.count(); i++) { if (m_cursorArray[i]->orientation == TQt::Horizontal) { if (j<2) { vert[j] = m_cursorArray[i]->position; @@ -1243,7 +1302,7 @@ TQRectF TraceWidget::zoomBox() { TQRectF TraceWidget::zoomCursorBox() { uint i; - if ((m_cursorArray.count() < 4) || (!m_zoomBoxEnabled)) { + if ((m_cursorArray.count() < (4+m_zoomCursorStartIndex)) || (!m_zoomBoxEnabled)) { return TQRectF(); } else { @@ -1253,7 +1312,7 @@ TQRectF TraceWidget::zoomCursorBox() { double vert[2]; int j = 0; int k = 0; - for (i=0;i<m_cursorArray.count(); i++) { + for (i=m_zoomCursorStartIndex;i<m_cursorArray.count(); i++) { if (m_cursorArray[i]->orientation == TQt::Horizontal) { if (j<2) { vert[j] = m_cursorArray[i]->position; @@ -1309,7 +1368,7 @@ void TraceWidget::setZoomCursorBox(const TQRectF rect) { boundedRect.setHeight(100.0); } - if ((m_cursorArray.count() < 4) || (!m_zoomBoxEnabled)) { + if ((m_cursorArray.count() < (4+m_zoomCursorStartIndex)) || (!m_zoomBoxEnabled)) { return; } else { @@ -1319,7 +1378,7 @@ void TraceWidget::setZoomCursorBox(const TQRectF rect) { CursorData* vert[2]; int j = 0; int k = 0; - for (i=0;i<m_cursorArray.count(); i++) { + for (i=m_zoomCursorStartIndex;i<m_cursorArray.count(); i++) { if (m_cursorArray[i]->orientation == TQt::Horizontal) { if (j<2) { vert[j] = m_cursorArray[i]; @@ -1352,6 +1411,14 @@ void TraceWidget::setZoomCursorBox(const TQRectF rect) { } } +unsigned int TraceWidget::zoomCursorStartIndex() { + return m_zoomCursorStartIndex; +} + +void TraceWidget::setZoomCursorStartIndex(unsigned int index) { + m_zoomCursorStartIndex = index; +} + void TraceWidget::setZoomBoxEnabled(bool enabled) { m_zoomBoxEnabled = enabled; m_graticuleWidget->updateGraticule(); diff --git a/clients/tde/src/widgets/tracewidget.h b/clients/tde/src/widgets/tracewidget.h index 9a478ac..130904f 100644 --- a/clients/tde/src/widgets/tracewidget.h +++ b/clients/tde/src/widgets/tracewidget.h @@ -42,6 +42,8 @@ class TQRectF double m_h; }; +typedef TQValueList<int> TraceNumberList; + class TraceData : public TQObject { Q_OBJECT @@ -114,6 +116,7 @@ class CursorData : public TQObject bool enabled; TQt::Orientation orientation; double position; + TraceNumberList activeTraceLabelList; TQString cursorName; TQLabel* paramLabel; TQPushButton* singleIncrBtn; @@ -199,6 +202,11 @@ class TraceWidget : public TQWidget double cursorPosition(uint cursorNumber); void setCursorPosition(uint cursorNumber, double position); + TQColor cursorColor(uint cursorNumber); + void setCursorColor(uint cursorNumber, TQColor); + TQColor cursorHighlightColor(uint cursorNumber); + void setCursorHighlightColor(uint cursorNumber, TQColor); + void setCursorActiveTraceList(uint cursorNumber, TraceNumberList list); bool cursorEnabled(uint cursorNumber); void setCursorEnabled(uint cursorNumber, bool enabled); TQString cursorName(uint cursorNumber); @@ -213,6 +221,8 @@ class TraceWidget : public TQWidget void setZoomBoxEnabled(bool enabled); TQRectF zoomCursorBox(); void setZoomCursorBox(const TQRectF rect); + unsigned int zoomCursorStartIndex(); + void setZoomCursorStartIndex(unsigned int index); static TQString prettyFormat(double value, double rangeDetectValue, TQString baseUnits, unsigned int precision=3); @@ -237,6 +247,7 @@ class TraceWidget : public TQWidget unsigned int m_vertDivs; unsigned int m_cursorDarkness; unsigned int m_zoomBoxDarkness; + unsigned int m_zoomCursorStartIndex; bool m_zoomBoxEnabled; TQRectF m_zoomBoxPrev; TraceList m_traceArray; |