diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2014-01-29 18:37:34 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2014-01-29 18:37:34 -0600 |
commit | 6ae28a47f75bc1096b056ba398a558bd9fcacf73 (patch) | |
tree | 3ea8f851e4a31515137abf7b88f989d6b83bf980 /clients | |
parent | 72e80dda8e3e692e3afd6e1f07fbb69fca2e80bf (diff) | |
download | ulab-6ae28a47f75bc1096b056ba398a558bd9fcacf73.tar.gz ulab-6ae28a47f75bc1096b056ba398a558bd9fcacf73.zip |
Add left trace sidebar option to trace viewer widget
Add scrollbar option to trace viewer widget
Diffstat (limited to 'clients')
-rw-r--r-- | clients/tde/src/part/scope/layout.ui | 7 | ||||
-rw-r--r-- | clients/tde/src/part/scope/part.cpp | 141 | ||||
-rw-r--r-- | clients/tde/src/part/scope/part.h | 2 | ||||
-rw-r--r-- | clients/tde/src/widgets/tracewidget.cpp | 235 | ||||
-rw-r--r-- | clients/tde/src/widgets/tracewidget.h | 29 |
5 files changed, 382 insertions, 32 deletions
diff --git a/clients/tde/src/part/scope/layout.ui b/clients/tde/src/part/scope/layout.ui index dfde26b..ae22434 100644 --- a/clients/tde/src/part/scope/layout.ui +++ b/clients/tde/src/part/scope/layout.ui @@ -53,9 +53,9 @@ <property name="orientation"> <enum>Vertical</enum> </property> - <widget class="TraceWidget" row="0" column="0" colspan="1"> + <widget class="TraceScrollWidget" row="0" column="0" colspan="1"> <property name="name"> - <cstring>traceWidget</cstring> + <cstring>traceScrollWidget</cstring> </property> <property name="minimumSize"> <size> @@ -63,6 +63,9 @@ <height>0</height> </size> </property> + <property name="resizePolicy"> + <enum>AutoOneFit</enum> + </property> </widget> <widget class="TraceWidget" row="1" column="0" colspan="1"> <property name="name"> diff --git a/clients/tde/src/part/scope/part.cpp b/clients/tde/src/part/scope/part.cpp index be54ed4..94990b4 100644 --- a/clients/tde/src/part/scope/part.cpp +++ b/clients/tde/src/part/scope/part.cpp @@ -1,4 +1,4 @@ -//Author: Timothy Pearson <kb9vqf@pearsoncomputing.net>, (C) 2012 +//Author: Timothy Pearson <kb9vqf@pearsoncomputing.net>, (C) 2012-2014 //Copyright: See COPYING file that comes with this distribution #include "define.h" @@ -182,9 +182,11 @@ ScopePart::ScopePart( TQWidget *parentWidget, const char *widgetName, TQObject * // Create widgets m_base = new ScopeBase(widget()); m_traceControlWidgetGrid = new TQGridLayout(m_base->traceControlLayoutWidget); - m_traceWidget = m_base->traceWidget; + m_traceWidget = m_base->traceScrollWidget->traceWidget(); connect(m_traceWidget, SIGNAL(cursorDragged(uint, double)), this, SLOT(cursorLevelChanged(uint, double))); - m_traceWidget->setSizePolicy(TQSizePolicy(TQSizePolicy::MinimumExpanding, TQSizePolicy::MinimumExpanding)); + m_base->traceScrollWidget->setSizePolicy(TQSizePolicy(TQSizePolicy::MinimumExpanding, TQSizePolicy::MinimumExpanding)); + m_base->traceScrollWidget->setHScrollBarMode(TQScrollView::AlwaysOff); + m_base->traceScrollWidget->setVScrollBarMode(TQScrollView::AlwaysOff); m_traceWidget->setNumberOfCursors(5); m_traceWidget->setZoomCursorStartIndex(1); m_traceWidget->setCursorColor(0, TQColor(64, 255, 255)); @@ -458,7 +460,12 @@ void ScopePart::mainEventLoop() { } else { if (!m_updateTimeoutTimer->isActive()) { - UPDATEDISPLAY_TIMEOUT + if (stopTraceUpdate == false) { + UPDATEDISPLAY_TIMEOUT + } + else { + setTickerMessage(i18n("Data acquisition stopped")); + } } } } @@ -496,7 +503,12 @@ void ScopePart::mainEventLoop() { } else { if (!m_updateTimeoutTimer->isActive()) { - UPDATEDISPLAY_TIMEOUT + if (stopTraceUpdate == false) { + UPDATEDISPLAY_TIMEOUT + } + else { + setTickerMessage(i18n("Data acquisition stopped")); + } } } } @@ -537,7 +549,12 @@ void ScopePart::mainEventLoop() { } else { if (!m_updateTimeoutTimer->isActive()) { - UPDATEDISPLAY_TIMEOUT + if (stopTraceUpdate == false) { + UPDATEDISPLAY_TIMEOUT + } + else { + setTickerMessage(i18n("Data acquisition stopped")); + } } } } @@ -578,7 +595,12 @@ void ScopePart::mainEventLoop() { } else { if (!m_updateTimeoutTimer->isActive()) { - UPDATEDISPLAY_TIMEOUT + if (stopTraceUpdate == false) { + UPDATEDISPLAY_TIMEOUT + } + else { + setTickerMessage(i18n("Data acquisition stopped")); + } } } } @@ -624,7 +646,12 @@ void ScopePart::mainEventLoop() { } else { if (!m_updateTimeoutTimer->isActive()) { - UPDATEDISPLAY_TIMEOUT + if (stopTraceUpdate == false) { + UPDATEDISPLAY_TIMEOUT + } + else { + setTickerMessage(i18n("Data acquisition stopped")); + } } } } @@ -681,7 +708,12 @@ void ScopePart::mainEventLoop() { } else { if (!m_updateTimeoutTimer->isActive()) { - UPDATEDISPLAY_TIMEOUT + if (stopTraceUpdate == false) { + UPDATEDISPLAY_TIMEOUT + } + else { + setTickerMessage(i18n("Data acquisition stopped")); + } } } } @@ -730,7 +762,12 @@ void ScopePart::mainEventLoop() { } else { if (!m_updateTimeoutTimer->isActive()) { - UPDATEDISPLAY_TIMEOUT + if (stopTraceUpdate == false) { + UPDATEDISPLAY_TIMEOUT + } + else { + setTickerMessage(i18n("Data acquisition stopped")); + } } } } @@ -783,7 +820,12 @@ void ScopePart::mainEventLoop() { } else { if (!m_updateTimeoutTimer->isActive()) { - UPDATEDISPLAY_TIMEOUT + if (stopTraceUpdate == false) { + UPDATEDISPLAY_TIMEOUT + } + else { + setTickerMessage(i18n("Data acquisition stopped")); + } } } } @@ -832,7 +874,12 @@ void ScopePart::mainEventLoop() { } else { if (!m_updateTimeoutTimer->isActive()) { - UPDATEDISPLAY_TIMEOUT + if (stopTraceUpdate == false) { + UPDATEDISPLAY_TIMEOUT + } + else { + setTickerMessage(i18n("Data acquisition stopped")); + } } } } @@ -880,7 +927,12 @@ void ScopePart::mainEventLoop() { } else { if (!m_updateTimeoutTimer->isActive()) { - UPDATEDISPLAY_TIMEOUT + if (stopTraceUpdate == false) { + UPDATEDISPLAY_TIMEOUT + } + else { + setTickerMessage(i18n("Data acquisition stopped")); + } } } } @@ -922,7 +974,12 @@ void ScopePart::mainEventLoop() { } else { if (!m_updateTimeoutTimer->isActive()) { - UPDATEDISPLAY_TIMEOUT + if (stopTraceUpdate == false) { + UPDATEDISPLAY_TIMEOUT + } + else { + setTickerMessage(i18n("Data acquisition stopped")); + } } } } @@ -969,7 +1026,12 @@ void ScopePart::mainEventLoop() { } else { if (!m_updateTimeoutTimer->isActive()) { - UPDATEDISPLAY_TIMEOUT + if (stopTraceUpdate == false) { + UPDATEDISPLAY_TIMEOUT + } + else { + setTickerMessage(i18n("Data acquisition stopped")); + } } } } @@ -1019,7 +1081,12 @@ void ScopePart::mainEventLoop() { } else { if (!m_updateTimeoutTimer->isActive()) { - UPDATEDISPLAY_TIMEOUT + if (stopTraceUpdate == false) { + UPDATEDISPLAY_TIMEOUT + } + else { + setTickerMessage(i18n("Data acquisition stopped")); + } } } } @@ -1088,7 +1155,12 @@ void ScopePart::mainEventLoop() { } else { if (!m_updateTimeoutTimer->isActive()) { - UPDATEDISPLAY_TIMEOUT + if (stopTraceUpdate == false) { + UPDATEDISPLAY_TIMEOUT + } + else { + setTickerMessage(i18n("Data acquisition stopped")); + } } } } @@ -1160,7 +1232,12 @@ void ScopePart::mainEventLoop() { } else { if (!m_updateTimeoutTimer->isActive()) { - UPDATEDISPLAY_TIMEOUT + if (stopTraceUpdate == false) { + UPDATEDISPLAY_TIMEOUT + } + else { + setTickerMessage(i18n("Data acquisition stopped")); + } } } } @@ -1218,7 +1295,12 @@ void ScopePart::mainEventLoop() { } else { if (!m_updateTimeoutTimer->isActive()) { - UPDATEDISPLAY_TIMEOUT + if (stopTraceUpdate == false) { + UPDATEDISPLAY_TIMEOUT + } + else { + setTickerMessage(i18n("Data acquisition stopped")); + } } } } @@ -1264,7 +1346,12 @@ void ScopePart::mainEventLoop() { } else { if (!m_updateTimeoutTimer->isActive()) { - UPDATEDISPLAY_TIMEOUT + if (stopTraceUpdate == false) { + UPDATEDISPLAY_TIMEOUT + } + else { + setTickerMessage(i18n("Data acquisition stopped")); + } } } } @@ -1312,7 +1399,12 @@ void ScopePart::mainEventLoop() { } else { if (!m_updateTimeoutTimer->isActive()) { - UPDATEDISPLAY_TIMEOUT + if (stopTraceUpdate == false) { + UPDATEDISPLAY_TIMEOUT + } + else { + setTickerMessage(i18n("Data acquisition stopped")); + } } } } @@ -1366,7 +1458,12 @@ void ScopePart::mainEventLoop() { } else { if (!m_updateTimeoutTimer->isActive()) { - UPDATEDISPLAY_TIMEOUT + if (stopTraceUpdate == false) { + UPDATEDISPLAY_TIMEOUT + } + else { + setTickerMessage(i18n("Data acquisition stopped")); + } } } } diff --git a/clients/tde/src/part/scope/part.h b/clients/tde/src/part/scope/part.h index 202919d..351d75e 100644 --- a/clients/tde/src/part/scope/part.h +++ b/clients/tde/src/part/scope/part.h @@ -1,4 +1,4 @@ -//Author: Timothy Pearson <kb9vqf@pearsoncomputing.net>, (C) 2012 +//Author: Timothy Pearson <kb9vqf@pearsoncomputing.net>, (C) 2012-2014 //Copyright: See COPYING file that comes with this distribution #ifndef REMOTELAB_SCOPEPART_H diff --git a/clients/tde/src/widgets/tracewidget.cpp b/clients/tde/src/widgets/tracewidget.cpp index b19ec7b..6f11ffc 100644 --- a/clients/tde/src/widgets/tracewidget.cpp +++ b/clients/tde/src/widgets/tracewidget.cpp @@ -1,4 +1,4 @@ -//Author: Timothy Pearson <kb9vqf@pearsoncomputing.net>, (C) 2012 +//Author: Timothy Pearson <kb9vqf@pearsoncomputing.net>, (C) 2012-2014 //Copyright: See COPYING file that comes with this distribution #include "tracewidget.h" @@ -95,6 +95,169 @@ bool TQRectF::operator!=(const TQRectF &r1) { return !operator==(r1); } +class TraceLabelLayout : public TQLayout +{ + public: + TraceLabelLayout(TraceWidget *traceWidget, TQWidget *parent, int spacing=-1) : TQLayout(parent, 0, spacing), m_traceWidget(traceWidget) { + // + } + TraceLabelLayout(TraceWidget *traceWidget, TQLayout* parent, int spacing=-1) : TQLayout(parent, spacing), m_traceWidget(traceWidget) { + // + } + TraceLabelLayout(TraceWidget *traceWidget, int spacing=-1) : TQLayout(spacing), m_traceWidget(traceWidget) { + // + } + ~TraceLabelLayout(); + + 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 TraceLabelLayoutIterator : public TQGLayoutIterator +{ + public: + TraceLabelLayoutIterator( 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 TraceLabelLayout::iterator() { + return TQLayoutIterator(new TraceLabelLayoutIterator(&list)); +} + +void TraceLabelLayout::addItem(TQLayoutItem *item) { + list.append( item ); +} + +void TraceLabelLayout::addWidget(TQWidget *w, int alignment) { + if (!w) { + return; + } + + TQWidgetItem *b = new TQWidgetItem(w); + b->setAlignment(alignment); + addItem( b ); +} + +TraceLabelLayout::~TraceLabelLayout() { + deleteAllItems(); +} + +void TraceLabelLayout::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]->leftLabel == widget) { + currentTrace = m_traceWidget->m_traceArray[trace]; + break; + } + } + + TQFontMetrics fm(currentTrace->leftLabel->font()); + int font_height = fm.boundingRect(currentTrace->leftLabel->text()).height(); + int font_vertical_offset = font_height/2; + + int graticule_height = m_traceWidget->m_graticuleWidget->height(); + int y = (((currentTrace->offset-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->leftLabel->hide(); + item->setGeometry(TQRect(0, 0, rect.width(), currentTrace->leftLabel->sizeHint().height())); + } + else { + item->setGeometry(TQRect(0, y, rect.width(), currentTrace->leftLabel->sizeHint().height())); + currentTrace->leftLabel->show(); + } + } + else { + currentTrace->leftLabel->hide(); + } + } +} + +void TraceLabelLayout::invalidate() { + setGeometry(geometry()); +} + +TQSize TraceLabelLayout::sizeHint() const +{ + 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()); + } + return s + TQSize(spacing(), spacing()); +} + +TQSize TraceLabelLayout::minimumSize() const +{ + 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()); + } + return s + TQSize(spacing(), spacing()); +} + TraceData::TraceData(TraceWidget* parent, TQWidget* labelParent) : TQObject(), parentWidget(parent) { color = TQColor(0, 255, 0); numberOfSamples = 0; @@ -120,6 +283,15 @@ TraceData::TraceData(TraceWidget* parent, TQWidget* labelParent) : TQObject(), p font.setPointSize(font.pointSize()-1); paramLabel->setFont(font); paramLabel->hide(); + leftLabel = new TQLabel(labelParent); + leftLabel->setPaletteBackgroundColor(labelParent->paletteBackgroundColor()); + leftLabel->setPaletteForegroundColor(color); + leftLabel->setAlignment(TQt::AlignHCenter|TQt::AlignVCenter|TQt::SingleLine); + font = leftLabel->font(); + font.setPointSize(font.pointSize()-1); + leftLabel->setFont(font); + leftLabel->setText("<qt></qt>"); + leftLabel->hide(); graphStatusLabel = new TQLabel(labelParent); graphStatusLabel->setPaletteBackgroundColor(labelParent->paletteBackgroundColor()); graphStatusLabel->setPaletteForegroundColor(color); @@ -175,6 +347,7 @@ TraceData::TraceData(TraceWidget* parent, TQWidget* labelParent) : TQObject(), p } else { paramLabel = NULL; + leftLabel = NULL; graphStatusLabel = NULL; graphStatusLabelInner = NULL; singleIncrBtn = NULL; @@ -873,31 +1046,38 @@ TraceWidget::TraceWidget(TQWidget* parent, const char* name) : TQWidget(parent, m_zoomBoxDarkness(ZOOM_SHADING_DARKNESS_FACTOR), m_zoomCursorStartIndex(0), m_zoomBoxEnabled(false), - m_useAbsoluteHorizontalRange(true) { + m_useAbsoluteHorizontalRange(true), + m_showLeftTraceInfoArea(false) { setBackgroundMode(NoBackground); setSizePolicy(TQSizePolicy(TQSizePolicy::MinimumExpanding, TQSizePolicy::MinimumExpanding)); m_primaryLayout = new TQGridLayout(this); m_graticuleWidget = new GraticuleWidget(this); connect(m_graticuleWidget, SIGNAL(cursorPositionChanged(uint, double)), this, SLOT(processChangedCursor(uint, double))); - m_primaryLayout->addMultiCellWidget(m_graticuleWidget, 0, 254, 0, 254); + m_primaryLayout->addMultiCellWidget(m_graticuleWidget, 0, 254, 1, 254); m_primaryLayout->setAlignment(TQt::AlignTop); m_rightPaneLayout = new TQGridLayout; + m_leftPaneLayout = new TQGridLayout; m_traceLabelLayout = new TQGridLayout; m_infoLabelLayout = new TQGridLayout; m_cursorLabelLayout = new TQGridLayout; + m_traceLeftLabelLayout = new TraceLabelLayout(this); m_statusLabelLayout = new TQVBoxLayout; m_statusLabelLayoutInner = new TQVBoxLayout; - m_primaryLayout->addLayout(m_traceLabelLayout, 255, 0); + m_primaryLayout->addLayout(m_traceLabelLayout, 255, 1); m_primaryLayout->addLayout(m_rightPaneLayout, 0, 255); + m_primaryLayout->addLayout(m_leftPaneLayout, 0, 0); m_primaryLayout->addLayout(m_statusLabelLayout, 255, 255); m_primaryLayout->addLayout(m_statusLabelLayoutInner, 1, 253); - m_rightPaneLayout->addLayout(m_cursorLabelLayout, 0, 0); - m_rightPaneLayout->addLayout(m_infoLabelLayout, 1, 0); + m_rightPaneLayout->addLayout(m_cursorLabelLayout, 0, 1); + m_rightPaneLayout->addLayout(m_infoLabelLayout, 1, 1); + m_leftPaneLayout->addLayout(m_traceLeftLabelLayout, 0, 1); 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); m_primaryLayout->addItem(new TQSpacerItem(0, 0, TQSizePolicy::Expanding, TQSizePolicy::Minimum), 1, 128); m_statusLabelLayout->setSpacing(0); + m_leftPaneLayout->setSpacing(0); setPaletteBackgroundColor(TQt::black); setPaletteForegroundColor(TQColor(0,128,0)); @@ -992,6 +1172,8 @@ void TraceWidget::updateTraceText() { double vertical_range = (m_traceArray[trace]->bottomEdge-m_traceArray[trace]->topEdge); m_traceArray[trace]->paramLabel->setPaletteBackgroundColor(paletteBackgroundColor()); 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]->graphStatusLabel->setPaletteBackgroundColor(paletteBackgroundColor()); m_traceArray[trace]->graphStatusLabel->setPaletteForegroundColor(m_traceArray[trace]->color); m_traceArray[trace]->graphStatusLabelInner->setPaletteBackgroundColor(paletteBackgroundColor()); @@ -1007,6 +1189,7 @@ void TraceWidget::updateTraceText() { } } m_traceArray[trace]->paramLabel->setText(TQString("<qt><nobr>%1%2<br>%3/div,%4/div<br>%5,%6<br>%7,%8</qt>").arg(m_traceArray[trace]->traceName).arg(offsetText).arg(prettyFormat(horizontal_units_per_division, horizontal_range, m_traceArray[trace]->horizontalUnits)).arg(prettyFormat(vertical_units_per_division, vertical_range, m_traceArray[trace]->verticalUnits)).arg(prettyFormat(m_traceArray[trace]->leftEdge, (m_useAbsoluteHorizontalRange)?m_traceArray[trace]->rightEdge:horizontal_range, m_traceArray[trace]->horizontalUnits)).arg(prettyFormat(m_traceArray[trace]->topEdge, vertical_range, m_traceArray[trace]->verticalUnits)).arg(prettyFormat(m_traceArray[trace]->rightEdge, (m_useAbsoluteHorizontalRange)?m_traceArray[trace]->rightEdge:horizontal_range, m_traceArray[trace]->horizontalUnits)).arg(prettyFormat(m_traceArray[trace]->bottomEdge, vertical_range, m_traceArray[trace]->verticalUnits))); + m_traceArray[trace]->leftLabel->setText(TQString("<qt><nobr>%1</qt>").arg(m_traceArray[trace]->traceName)); } } @@ -1138,6 +1321,7 @@ void TraceWidget::setTraceEnabled(uint traceNumber, bool enabled, bool showText) if (enabled) { if (showText) { m_traceArray[traceNumber]->paramLabel->show(); + m_traceArray[traceNumber]->leftLabel->show(); m_traceArray[traceNumber]->graphStatusLabel->show(); m_traceArray[traceNumber]->graphStatusLabelInner->hide(); m_traceArray[traceNumber]->singleIncrBtn->show(); @@ -1147,6 +1331,7 @@ void TraceWidget::setTraceEnabled(uint traceNumber, bool enabled, bool showText) } else { m_traceArray[traceNumber]->paramLabel->hide(); + m_traceArray[traceNumber]->leftLabel->hide(); m_traceArray[traceNumber]->graphStatusLabel->hide(); m_traceArray[traceNumber]->graphStatusLabelInner->show(); m_traceArray[traceNumber]->singleIncrBtn->hide(); @@ -1157,6 +1342,7 @@ void TraceWidget::setTraceEnabled(uint traceNumber, bool enabled, bool showText) } else { m_traceArray[traceNumber]->paramLabel->hide(); + m_traceArray[traceNumber]->leftLabel->hide(); m_traceArray[traceNumber]->graphStatusLabel->hide(); m_traceArray[traceNumber]->graphStatusLabelInner->hide(); m_traceArray[traceNumber]->singleIncrBtn->hide(); @@ -1516,6 +1702,18 @@ void TraceWidget::setZoomBoxEnabled(bool enabled) { m_graticuleWidget->updateGraticule(); } +void TraceWidget::showLeftTraceInfoArea(bool show) { + m_showLeftTraceInfoArea = show; + for (uint i=0;i<m_traceArray.count();i++) { + if (m_showLeftTraceInfoArea) { + m_traceArray[i]->leftLabel->show(); + } + else { + m_traceArray[i]->leftLabel->hide(); + } + } +} + TQString TraceWidget::prettyFormat(double value, double rangeDetectValue, TQString baseUnits, unsigned int precision) { TQString result; TQString unitMultiplier; @@ -1610,6 +1808,7 @@ void TraceWidget::processChangedOffset(double offset) { } } if (tracenumber >= 0) { + m_traceLeftLabelLayout->invalidate(); emit(offsetChanged(tracenumber, offset)); } } @@ -1649,6 +1848,7 @@ void TraceWidget::resizeTraceArray(uint newsize) { m_traceLabelLayout->addWidget(m_traceArray[i]->posResetBtn, 1, (i*2)+1); 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_statusLabelLayout->insertWidget(i, m_traceArray[i]->graphStatusLabel, TQt::AlignTop); m_statusLabelLayoutInner->insertWidget(i, m_traceArray[i]->graphStatusLabelInner); } @@ -1663,6 +1863,7 @@ void TraceWidget::resizeTraceArray(uint newsize) { m_traceLabelLayout->remove(m_traceArray[i]->posResetBtn); m_traceLabelLayout->remove(m_traceArray[i]->posSetBtn); m_traceLabelLayout->remove(m_traceArray[i]->singleDecrBtn); + m_traceLeftLabelLayout->remove(m_traceArray[i]->leftLabel); m_statusLabelLayout->remove(m_traceArray[i]->graphStatusLabel); m_statusLabelLayoutInner->remove(m_traceArray[i]->graphStatusLabelInner); } @@ -1701,4 +1902,26 @@ void TraceWidget::resizeCursorArray(uint newsize) { delete m_cursorArray[i]; } } +} + +TraceScrollWidget::TraceScrollWidget(TQWidget* parent, const char* name) : TQScrollView(parent, name) { + m_traceWidget = new TraceWidget(viewport()); + addChild(m_traceWidget); +} + +TraceScrollWidget::~TraceScrollWidget() { + delete m_traceWidget; + m_traceWidget = NULL; +} + +TQSize TraceScrollWidget::sizeHint() const { + return m_traceWidget->sizeHint(); +} + +TQSize TraceScrollWidget::minimumSizeHint() const { + return m_traceWidget->minimumSizeHint(); +} + +TraceWidget* TraceScrollWidget::traceWidget() { + return m_traceWidget; }
\ No newline at end of file diff --git a/clients/tde/src/widgets/tracewidget.h b/clients/tde/src/widgets/tracewidget.h index f7afa12..c034149 100644 --- a/clients/tde/src/widgets/tracewidget.h +++ b/clients/tde/src/widgets/tracewidget.h @@ -1,7 +1,8 @@ -//Author: Timothy Pearson <kb9vqf@pearsoncomputing.net>, (C) 2012 +//Author: Timothy Pearson <kb9vqf@pearsoncomputing.net>, (C) 2012-2014 //Copyright: See COPYING file that comes with this distribution #include <tqwidget.h> +#include <tqscrollview.h> #include <tqtrla.h> @@ -12,6 +13,7 @@ class TQGridLayout; class TQPushButton; class TQToolButton; class TraceWidget; +class TraceLabelLayout; class TQRectF { @@ -79,6 +81,7 @@ class TraceData : public TQObject TQString horizontalUnits; TQString verticalUnits; TQLabel* paramLabel; + TQLabel* leftLabel; TQLabel* graphStatusLabel; TQLabel* graphStatusLabelInner; TQToolButton* singleIncrBtn; @@ -89,6 +92,7 @@ class TraceData : public TQObject friend class TraceWidget; friend class GraticuleWidget; + friend class TraceLabelLayout; }; typedef TQMemArray<TraceData*> TraceList; @@ -235,6 +239,8 @@ class TraceWidget : public TQWidget unsigned int zoomCursorStartIndex(); void setZoomCursorStartIndex(unsigned int index); + void showLeftTraceInfoArea(bool show); + double traceOffset(uint traceNumber); static TQString prettyFormat(double value, double rangeDetectValue, TQString baseUnits, unsigned int precision=3); @@ -271,15 +277,36 @@ class TraceWidget : public TQWidget CursorList m_cursorArray; TQGridLayout* m_primaryLayout; TQGridLayout* m_rightPaneLayout; + TQGridLayout* m_leftPaneLayout; TQGridLayout* m_traceLabelLayout; TQGridLayout* m_infoLabelLayout; TQGridLayout* m_cursorLabelLayout; + TraceLabelLayout* m_traceLeftLabelLayout; TQVBoxLayout* m_statusLabelLayout; TQVBoxLayout* m_statusLabelLayoutInner; GraticuleWidget* m_graticuleWidget; bool m_useAbsoluteHorizontalRange; + bool m_showLeftTraceInfoArea; friend class GraticuleWidget; friend class TraceData; friend class CursorData; + friend class TraceLabelLayout; +}; + +class TraceScrollWidget : public TQScrollView +{ + Q_OBJECT + + public: + TraceScrollWidget(TQWidget* = 0, const char* = 0); + ~TraceScrollWidget(); + + TraceWidget* traceWidget(); + + virtual TQSize sizeHint() const; + virtual TQSize minimumSizeHint() const; + + private: + TraceWidget* m_traceWidget; };
\ No newline at end of file |