diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-07-14 21:08:12 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-07-14 21:08:12 -0500 |
commit | 47f193b7dea740d95b0827855d0d4d3faefe3b72 (patch) | |
tree | f352d6bd7a680919a388cc6596c8b1189431790e /clients/tde/src/widgets/tracewidget.cpp | |
parent | 663e2f7a3d1ae0a40f45e760c3ae6998d79c1a2f (diff) | |
download | ulab-47f193b7dea740d95b0827855d0d4d3faefe3b72.tar.gz ulab-47f193b7dea740d95b0827855d0d4d3faefe3b72.zip |
Fix scope
Diffstat (limited to 'clients/tde/src/widgets/tracewidget.cpp')
-rw-r--r-- | clients/tde/src/widgets/tracewidget.cpp | 55 |
1 files changed, 37 insertions, 18 deletions
diff --git a/clients/tde/src/widgets/tracewidget.cpp b/clients/tde/src/widgets/tracewidget.cpp index 2d44afc..eda2c53 100644 --- a/clients/tde/src/widgets/tracewidget.cpp +++ b/clients/tde/src/widgets/tracewidget.cpp @@ -115,11 +115,20 @@ TraceData::TraceData(TraceWidget* parent, TQWidget* labelParent) : TQObject(), p 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); + graphStatusLabel->setText("<qt></qt>"); graphStatusLabel->hide(); graphStatusLabelInner = new TQLabel(labelParent); graphStatusLabelInner->setPaletteBackgroundColor(labelParent->paletteBackgroundColor()); graphStatusLabelInner->setPaletteForegroundColor(color); graphStatusLabelInner->setAlignment(TQt::AlignHCenter|TQt::AlignVCenter|TQt::SingleLine); + font = graphStatusLabelInner->font(); + font.setPointSize(font.pointSize()-1); + graphStatusLabelInner->setFont(font); + graphStatusLabelInner->setText("<qt></qt>"); graphStatusLabelInner->hide(); singleIncrBtn = new TQToolButton(TQt::UpArrow, labelParent); singleDecrBtn = new TQToolButton(TQt::DownArrow, labelParent); @@ -173,9 +182,17 @@ void TraceData::drawTrace(TQPainter* p, int graticule_width, int graticule_heigh y = ((((sampleArray[n]+offset)-topEdge)/(bottomEdge-topEdge))*(graticule_height)); x2 = (((positionArray[n+1]-leftEdge)/(rightEdge-leftEdge))*(graticule_width)); y2 = ((((sampleArray[n+1]+offset)-topEdge)/(bottomEdge-topEdge))*(graticule_height)); - if ((x > 0) && (x < graticule_width) && (y > 0) && (y < graticule_height) && (x2 > 0) && (x2 < graticule_width) && (y2 > 0) && (y2 < graticule_height)) { - p->drawLine(x, y, x2, y2); - } + + if (x < 0) x = 0; + if (x > graticule_width) x = graticule_width; + if (y < 0) y = 0; + if (y > graticule_width) y = graticule_height; + if (x2 < 0) x2 = 0; + if (x2 > graticule_width) x2 = graticule_width; + if (y2 < 0) y2 = 0; + if (y2 > graticule_width) y2 = graticule_height; + + p->drawLine(x, y, x2, y2); } } } @@ -541,7 +558,7 @@ void GraticuleWidget::mouseMoveEvent(TQMouseEvent *e) { } else { for (uint trace=0;trace<m_base->m_traceArray.count();trace++) { - m_base->m_traceArray[trace]->graphStatusLabel->setText(""); + m_base->m_traceArray[trace]->graphStatusLabel->setText("<qt></qt>"); m_base->m_traceArray[trace]->graphStatusLabelInner->setText(m_base->m_traceArray[trace]->graphStatusLabel->text()); } } @@ -572,7 +589,7 @@ void GraticuleWidget::enterEvent(TQEvent *) { void GraticuleWidget::leaveEvent(TQEvent *) { for (uint trace=0;trace<m_base->m_traceArray.count();trace++) { - m_base->m_traceArray[trace]->graphStatusLabel->setText(""); + m_base->m_traceArray[trace]->graphStatusLabel->setText("<qt></qt>"); m_base->m_traceArray[trace]->graphStatusLabelInner->setText(m_base->m_traceArray[trace]->graphStatusLabel->text()); } } @@ -592,8 +609,8 @@ TraceWidget::TraceWidget(TQWidget* parent, const char* name) : TQWidget(parent, m_traceLabelLayout = new TQGridLayout; m_infoLabelLayout = new TQGridLayout; m_cursorLabelLayout = new TQGridLayout; - m_statusLabelLayout = new TQGridLayout; - m_statusLabelLayoutInner = new TQGridLayout; + m_statusLabelLayout = new TQVBoxLayout; + m_statusLabelLayoutInner = new TQVBoxLayout; m_primaryLayout->addLayout(m_traceLabelLayout, 255, 0); m_primaryLayout->addLayout(m_rightPaneLayout, 0, 255); m_primaryLayout->addLayout(m_statusLabelLayout, 255, 255); @@ -720,16 +737,18 @@ void TraceWidget::updateCursorText() { // 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++) { - double horizontal_range = (m_traceArray[trace]->rightEdge-m_traceArray[trace]->leftEdge); - double vertical_range = (m_traceArray[trace]->bottomEdge-m_traceArray[trace]->topEdge); + if (m_traceArray[trace]->enabled) { + 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)); - cursorText.append(TQString("<br>%1: %2").arg(m_traceArray[trace]->traceName).arg(prettyFormat(realCursorPosition, vertical_range, m_traceArray[trace]->verticalUnits))); - } - else { - double realCursorPosition = (m_traceArray[trace]->leftEdge+((m_cursorArray[cursor]->position/100.0)*horizontal_range)); - cursorText.append(TQString("<br>%1: %2").arg(m_traceArray[trace]->traceName).arg(prettyFormat(realCursorPosition, horizontal_range, m_traceArray[trace]->horizontalUnits))); + if (m_cursorArray[cursor]->orientation == TQt::Horizontal) { + double realCursorPosition = (m_traceArray[trace]->topEdge+((m_cursorArray[cursor]->position/100.0)*vertical_range)); + cursorText.append(TQString("<br>%1: %2").arg(m_traceArray[trace]->traceName).arg(prettyFormat(realCursorPosition, vertical_range, m_traceArray[trace]->verticalUnits))); + } + else { + double realCursorPosition = (m_traceArray[trace]->leftEdge+((m_cursorArray[cursor]->position/100.0)*horizontal_range)); + cursorText.append(TQString("<br>%1: %2").arg(m_traceArray[trace]->traceName).arg(prettyFormat(realCursorPosition, horizontal_range, m_traceArray[trace]->horizontalUnits))); + } } } @@ -1212,8 +1231,8 @@ void TraceWidget::resizeTraceArray(uint newsize) { m_traceLabelLayout->addWidget(m_traceArray[i]->singleIncrBtn, 0, (i*2)+1); m_traceLabelLayout->addWidget(m_traceArray[i]->posResetBtn, 1, (i*2)+1); m_traceLabelLayout->addWidget(m_traceArray[i]->singleDecrBtn, 2, (i*2)+1); - m_statusLabelLayout->addWidget(m_traceArray[i]->graphStatusLabel, i, 0); - m_statusLabelLayoutInner->addWidget(m_traceArray[i]->graphStatusLabelInner, i, 0); + m_statusLabelLayout->insertWidget(i, m_traceArray[i]->graphStatusLabel); + m_statusLabelLayoutInner->insertWidget(i, m_traceArray[i]->graphStatusLabelInner); } } } |