summaryrefslogtreecommitdiffstats
path: root/clients
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-07-12 02:33:58 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-07-12 02:33:58 -0500
commitc485c0ef46c7330eba93226ac0ca09415a765d9d (patch)
tree53cffe4344d910593115491e93274a1d52db58ae /clients
parentad5dff2bdac2afa6272db21aa4ee4908d6564d2b (diff)
downloadulab-c485c0ef46c7330eba93226ac0ca09415a765d9d.tar.gz
ulab-c485c0ef46c7330eba93226ac0ca09415a765d9d.zip
Enhance trace viewer
Diffstat (limited to 'clients')
-rw-r--r--clients/tde/src/app/views/instrumentview.cpp27
-rw-r--r--clients/tde/src/app/views/instrumentview.h3
-rw-r--r--clients/tde/src/part/commanalyzer/part.cpp23
-rw-r--r--clients/tde/src/part/fpgaprogram/part.cpp2
-rw-r--r--clients/tde/src/part/fpgaview/part.cpp1
-rw-r--r--clients/tde/src/widgets/tracewidget.cpp290
-rw-r--r--clients/tde/src/widgets/tracewidget.h64
7 files changed, 319 insertions, 91 deletions
diff --git a/clients/tde/src/app/views/instrumentview.cpp b/clients/tde/src/app/views/instrumentview.cpp
index b2fd5db..4cad117 100644
--- a/clients/tde/src/app/views/instrumentview.cpp
+++ b/clients/tde/src/app/views/instrumentview.cpp
@@ -15,6 +15,7 @@ InstrumentView::InstrumentView(const TQString &library, TQWidget *parentWidget,
: KMdiChildView(parentWidget, name, f)
, m_libraryName(library)
, m_instrumentPart( 0 )
+ , m_fixedSize( false )
, m_canary( NULL )
{
init();
@@ -24,6 +25,7 @@ InstrumentView::InstrumentView(const TQString &library, const TQString &caption,
: KMdiChildView(caption, parentWidget, name, f)
, m_libraryName(library)
, m_instrumentPart( 0 )
+ , m_fixedSize( false )
, m_canary( NULL )
{
init();
@@ -45,18 +47,39 @@ void InstrumentView::init() {
else {
m_instrumentPart = (InstrumentPart *)factory->create(TQT_TQOBJECT(this), "part", "KParts::RemoteInstrumentPart");
connect(m_instrumentPart, SIGNAL(statusMessageSet(const TQString&)), this, SLOT(setStatusMessage(const TQString&)));
+ connect(m_instrumentPart, SIGNAL(usingFixedSizeChanged(bool)), this, SLOT(setUsingFixedSize(bool)));
}
}
-void InstrumentView::resizeEvent(TQResizeEvent *) {
+void InstrumentView::setChildSizeToHint() {
if (m_instrumentPart) {
TQWidget *childPartWidget = m_instrumentPart->widget();
if (childPartWidget) {
- setFixedSize(childPartWidget->sizeHint());
+ if (m_fixedSize) {
+ setFixedSize(childPartWidget->sizeHint());
+ }
+ else {
+ TQSize childSizeHint = childPartWidget->sizeHint();
+ setMinimumSize(childSizeHint.width(), childSizeHint.height());
+ childPartWidget->resize(size());
+ }
}
}
}
+void InstrumentView::setUsingFixedSize(bool fixed) {
+ m_fixedSize = fixed;
+ if (!fixed) {
+ setMinimumSize(0, 0);
+ setMaximumSize(TQWIDGETSIZE_MAX, TQWIDGETSIZE_MAX);
+ }
+ setChildSizeToHint();
+}
+
+void InstrumentView::resizeEvent(TQResizeEvent *) {
+ setChildSizeToHint();
+}
+
TQPtrList<KAction> InstrumentView::menuActionList() {
if (m_instrumentPart) {
return m_instrumentPart->menuActionList();
diff --git a/clients/tde/src/app/views/instrumentview.h b/clients/tde/src/app/views/instrumentview.h
index e62b0de..f51fab8 100644
--- a/clients/tde/src/app/views/instrumentview.h
+++ b/clients/tde/src/app/views/instrumentview.h
@@ -37,6 +37,8 @@ class InstrumentView : public KMdiChildView
private slots:
void setStatusMessage(const TQString& message);
+ void setUsingFixedSize(bool fixed);
+ void setChildSizeToHint();
signals:
void statusMessageSet(const TQString&);
@@ -45,6 +47,7 @@ class InstrumentView : public KMdiChildView
void init();
TQString m_libraryName;
RemoteLab::InstrumentPart *m_instrumentPart;
+ bool m_fixedSize;
bool* m_canary;
};
diff --git a/clients/tde/src/part/commanalyzer/part.cpp b/clients/tde/src/part/commanalyzer/part.cpp
index 7aea8a3..3e53429 100644
--- a/clients/tde/src/part/commanalyzer/part.cpp
+++ b/clients/tde/src/part/commanalyzer/part.cpp
@@ -61,6 +61,11 @@ CommAnalyzerPart::CommAnalyzerPart( TQWidget *parentWidget, const char *widgetNa
// Create widgets
m_base = new CommAnalyzerBase(widget());
m_traceWidget = m_base->traceWidget;
+ m_base->traceWidget->setSizePolicy(TQSizePolicy(TQSizePolicy::MinimumExpanding, TQSizePolicy::MinimumExpanding));
+ m_base->traceWidget->setTraceEnabled(0, true);
+ m_traceWidget->setTraceName(0, "Trace 1");
+ m_traceWidget->setTraceHorizontalUnits(0, "Hz");
+ m_traceWidget->setTraceVerticalUnits(0, "dBm");
m_base->saRefLevel->setFloatMin(-128);
m_base->saRefLevel->setFloatMax(128);
m_base->saRefLevel->setLineStep(1);
@@ -80,7 +85,7 @@ CommAnalyzerPart::~CommAnalyzerPart() {
}
void CommAnalyzerPart::postInit() {
- //
+ setUsingFixedSize(false);
}
bool CommAnalyzerPart::openURL(const KURL &url) {
@@ -480,7 +485,7 @@ void CommAnalyzerPart::mainEventLoop() {
if (result == "ACK") {
// Update display widget(s)
- m_traceWidget->setSamples(trace, 0);
+ m_traceWidget->setSamples(0, trace);
postProcessTrace();
m_traceWidget->repaint();
}
@@ -590,13 +595,23 @@ void CommAnalyzerPart::postProcessTrace() {
}
void CommAnalyzerPart::updateGraticule() {
- m_traceWidget->setNumberOfSamples(m_samplesInTrace, 0);
+ m_traceWidget->setNumberOfSamples(0, m_samplesInTrace);
m_traceWidget->setNumberOfHorizontalDivisions(m_hdivs);
m_traceWidget->setNumberOfVerticalDivisions(m_vdivs);
m_leftFrequency = m_centerfreq - (m_spanfreq/2.0);
m_rightFrequency = m_centerfreq + (m_spanfreq/2.0);
- m_traceWidget->setDisplayLimits(m_leftFrequency, m_rpower, m_rightFrequency, m_rpower-(m_vscale*m_hdivs), 0);
+
+ double freqincr = (m_rightFrequency-m_leftFrequency)/m_samplesInTrace;
+ double freqpos = m_leftFrequency;
+ TQDoubleArray tracepositions;
+ tracepositions.resize(m_samplesInTrace);
+ for (int i=0; i<m_samplesInTrace; i++) {
+ tracepositions[i] = freqpos;
+ freqpos = freqpos + freqincr;
+ }
+ m_traceWidget->setPositions(0, tracepositions);
+ m_traceWidget->setDisplayLimits(0, m_leftFrequency, m_rpower, m_rightFrequency, m_rpower-(m_vscale*m_hdivs));
// Also update controls
m_base->saRefLevel->blockSignals(true);
diff --git a/clients/tde/src/part/fpgaprogram/part.cpp b/clients/tde/src/part/fpgaprogram/part.cpp
index 6723952..aa87145 100644
--- a/clients/tde/src/part/fpgaprogram/part.cpp
+++ b/clients/tde/src/part/fpgaprogram/part.cpp
@@ -140,7 +140,7 @@ void FPGAProgramPart::connectionClosed() {
}
void FPGAProgramPart::postInit() {
- //
+ setUsingFixedSize(true);
}
bool FPGAProgramPart::openURL(const KURL &url) {
diff --git a/clients/tde/src/part/fpgaview/part.cpp b/clients/tde/src/part/fpgaview/part.cpp
index e833f98..0fab034 100644
--- a/clients/tde/src/part/fpgaview/part.cpp
+++ b/clients/tde/src/part/fpgaview/part.cpp
@@ -978,6 +978,7 @@ void FPGAViewPart::connectionClosed() {
}
void FPGAViewPart::postInit() {
+ setUsingFixedSize(true);
connect(m_updateTimer, SIGNAL(timeout()), this, SLOT(updateDisplay()));
}
diff --git a/clients/tde/src/widgets/tracewidget.cpp b/clients/tde/src/widgets/tracewidget.cpp
index 2444bc7..1fe3ff4 100644
--- a/clients/tde/src/widgets/tracewidget.cpp
+++ b/clients/tde/src/widgets/tracewidget.cpp
@@ -4,22 +4,55 @@
#include "tracewidget.h"
#include <stdlib.h>
+#include <cmath>
#include <tqpixmap.h>
#include <tqpainter.h>
+#include <tqlabel.h>
+#include <tqlayout.h>
+
+#include <klocale.h>
+
#define VERIFY_TRACE_ARRAY_SIZE if (traceNumber >= m_traceArray.count()) resizeTraceArray(traceNumber+1);
-TraceData::TraceData() {
+TraceData::TraceData(TQWidget* labelParent) {
color = TQColor(0, 255, 0);
numberOfSamples = 0;
leftEdge = 0;
rightEdge = 0;
topEdge = 0;
bottomEdge = 0;
+ traceName = i18n("Unknown");
+ horizontalUnits = i18n("Units");
+ verticalUnits = i18n("Units");
enabled = false;
+
+ if (labelParent) {
+ infoLabel = new TQLabel(labelParent);
+ infoLabel->setPaletteBackgroundColor(labelParent->paletteBackgroundColor());
+ infoLabel->setPaletteForegroundColor(color);
+ infoLabel->setAlignment(TQt::AlignHCenter|TQt::AlignVCenter|TQt::SingleLine);
+ infoLabel->hide();
+ }
+ else {
+ infoLabel = NULL;
+ }
}
+TraceData::~TraceData() {
+ //
+}
+
+// RAJA FIXME
+// Add cursor support
+
+// RAJA FIXME
+// Add offset (x and y) support
+
+// RAJA FIXME
+// Add scaling support
+
void TraceData::drawTrace(TQPainter* p, int graticule_width, int graticule_height) {
p->setPen(color);
@@ -28,55 +61,159 @@ void TraceData::drawTrace(TQPainter* p, int graticule_width, int graticule_heigh
unsigned int n;
int x,y,x2,y2;
for (n=0; n<numberOfSamples-1; n++) {
- x = abs(((n*1.0)/(numberOfSamples-1))*(graticule_width));
+ x = abs(((positionArray[n]-leftEdge)/(rightEdge-leftEdge))*(graticule_width));
y = abs(((sampleArray[n]-topEdge)/(bottomEdge-topEdge))*(graticule_height));
- x2 = abs(((n+1*1.0)/(numberOfSamples-1))*(graticule_width));
+ x2 = abs(((positionArray[n+1]-leftEdge)/(rightEdge-leftEdge))*(graticule_width));
y2 = abs(((sampleArray[n+1]-topEdge)/(bottomEdge-topEdge))*(graticule_height));
p->drawLine(x, y, x2, y2);
}
}
}
+GraticuleWidget::GraticuleWidget(TraceWidget* parent, const char* name) : TQWidget(parent, name),
+ m_base(parent),
+ m_graticulePixmap(0) {
+ setBackgroundMode(NoBackground);
+ setSizePolicy(TQSizePolicy(TQSizePolicy::MinimumExpanding, TQSizePolicy::MinimumExpanding));
+
+ setPaletteBackgroundColor(TQt::black);
+ setPaletteForegroundColor(TQColor(0,128,0));
+}
+
+GraticuleWidget::~GraticuleWidget() {
+ //
+}
+
+void GraticuleWidget::updateGraticule() {
+ unsigned int d,s,x,y;
+
+ if (m_graticulePixmap) {
+ delete m_graticulePixmap;
+ }
+ m_graticulePixmap = new TQPixmap(width(), height());
+
+ // Draw the graticule into the pixmap
+ TQPainter p(m_graticulePixmap);
+ p.setPen(TQPen(foregroundColor(), 1, TQt::SolidLine));
+ p.fillRect(0, 0, m_graticulePixmap->width(), m_graticulePixmap->height(), backgroundColor());
+ p.setPen(TQPen(foregroundColor(), 1, TQt::DotLine));
+ if (m_base->m_vertDivs > 0) {
+ s = m_graticulePixmap->width() / m_base->m_vertDivs;
+ x = 0;
+ for (d=0; d<m_base->m_vertDivs; d++) {
+ p.drawLine(x, 0, x, m_graticulePixmap->height());
+ x += s;
+ }
+ }
+ if (m_base->m_horizDivs > 0) {
+ s = m_graticulePixmap->height() / m_base->m_horizDivs;
+ y = 0;
+ for (d=0; d<m_base->m_horizDivs; d++) {
+ p.drawLine(0, y, m_graticulePixmap->width(), y);
+ y += s;
+ }
+ }
+ p.setPen(TQPen(foregroundColor(), 1, TQt::SolidLine));
+ p.drawRect(0, 0, m_graticulePixmap->width(), m_graticulePixmap->height());
+
+ // Repaint the widget
+ repaint();
+}
+
+void GraticuleWidget::paintEvent(TQPaintEvent*) {
+ TQPainter p(this);
+
+ if (m_graticulePixmap) {
+ // Draw the graticule pixmap to erase the widget
+ p.drawPixmap(0, 0, *m_graticulePixmap);
+
+ // Draw the traces
+ for (uint trace=0;trace<m_base->m_traceArray.count();trace++) {
+ m_base->m_traceArray[trace]->drawTrace(&p, m_graticulePixmap->width(), m_graticulePixmap->height());
+ }
+ }
+ else {
+ p.fillRect(x(), y(), width(), height(), backgroundColor());
+ }
+}
+
+void GraticuleWidget::resizeEvent(TQResizeEvent *) {
+ updateGraticule();
+}
+
TraceWidget::TraceWidget(TQWidget* parent, const char* name) : TQWidget(parent, name),
m_horizDivs(0),
- m_vertDivs(0),
- m_graticulePixmap(0) {
+ m_vertDivs(0) {
setBackgroundMode(NoBackground);
+ m_primaryLayout = new TQVBoxLayout(this);
+ m_graticuleWidget = new GraticuleWidget(this);
+ m_primaryLayout->addWidget(m_graticuleWidget);
+ m_traceLabelLayout = new TQGridLayout(m_primaryLayout);
+ m_traceLabelLayout->addItem(new TQSpacerItem(0, 0, TQSizePolicy::Expanding, TQSizePolicy::Minimum), 0, 255);
+
setPaletteBackgroundColor(TQt::black);
setPaletteForegroundColor(TQColor(0,128,0));
}
TraceWidget::~TraceWidget() {
- resizeTraceArray(0);
+ for (uint i=0;i<m_traceArray.count();i++) {
+ delete m_traceArray[i];
+ }
}
-void TraceWidget::setNumberOfSamples(unsigned int samples, uint traceNumber) {
+void TraceWidget::setNumberOfSamples(uint traceNumber, unsigned int samples) {
VERIFY_TRACE_ARRAY_SIZE
m_traceArray[traceNumber]->numberOfSamples = samples;
m_traceArray[traceNumber]->sampleArray.resize(samples);
+ m_traceArray[traceNumber]->positionArray.resize(samples);
- updateGraticule();
+ m_graticuleWidget->updateGraticule();
+ updateTraceText();
}
void TraceWidget::setNumberOfHorizontalDivisions(unsigned int divisions) {
m_horizDivs = divisions;
- updateGraticule();
+ m_graticuleWidget->updateGraticule();
+ updateTraceText();
}
void TraceWidget::setNumberOfVerticalDivisions(unsigned int divisions) {
m_vertDivs = divisions;
- updateGraticule();
+ m_graticuleWidget->updateGraticule();
+ updateTraceText();
}
-void TraceWidget::setDisplayLimits(double x, double y, double w, double h, uint traceNumber) {
+void TraceWidget::setDisplayLimits(uint traceNumber, double x, double y, double w, double h) {
VERIFY_TRACE_ARRAY_SIZE
m_traceArray[traceNumber]->leftEdge = x;
m_traceArray[traceNumber]->rightEdge = w;
m_traceArray[traceNumber]->topEdge = y;
m_traceArray[traceNumber]->bottomEdge = h;
+
+ updateTraceText();
+}
+
+void TraceWidget::updateTraceText() {
+ // RAJA FIXME
+ // Display current scaling and offset values for all traces
+
+ // RAJA FIXME
+ // Display upper/lower/left/right boundary values,
+ // possibly in a different routine
+
+ for (uint trace=0;trace<m_traceArray.count();trace++) {
+ double horizontal_units_per_division;
+ double vertical_units_per_division;
+
+ horizontal_units_per_division = fabs(m_traceArray[trace]->rightEdge-m_traceArray[trace]->leftEdge)/m_horizDivs;
+ vertical_units_per_division = fabs(m_traceArray[trace]->topEdge-m_traceArray[trace]->bottomEdge)/m_vertDivs;
+ m_traceArray[trace]->infoLabel->setPaletteBackgroundColor(paletteBackgroundColor());
+ m_traceArray[trace]->infoLabel->setPaletteForegroundColor(m_traceArray[trace]->color);
+ m_traceArray[trace]->infoLabel->setText(TQString("<qt>%1<br>%2 %3/div<br>%4 %5/div</qt>").arg(m_traceArray[trace]->traceName).arg(horizontal_units_per_division).arg(m_traceArray[trace]->horizontalUnits).arg(vertical_units_per_division).arg(m_traceArray[trace]->verticalUnits));
+ }
}
TQDoubleArray& TraceWidget::samples(uint traceNumber) {
@@ -85,23 +222,39 @@ TQDoubleArray& TraceWidget::samples(uint traceNumber) {
return m_traceArray[traceNumber]->sampleArray;
}
-void TraceWidget::setSamples(TQDoubleArray& tqda, uint traceNumber) {
+void TraceWidget::setSamples(uint traceNumber, TQDoubleArray& tqda) {
VERIFY_TRACE_ARRAY_SIZE
m_traceArray[traceNumber]->sampleArray = tqda;
m_traceArray[traceNumber]->numberOfSamples = tqda.size();
}
+TQDoubleArray& TraceWidget::positions(uint traceNumber) {
+ VERIFY_TRACE_ARRAY_SIZE
+
+ return m_traceArray[traceNumber]->positionArray;
+}
+
+void TraceWidget::setPositions(uint traceNumber, TQDoubleArray& tqda) {
+ VERIFY_TRACE_ARRAY_SIZE
+
+ m_traceArray[traceNumber]->positionArray = tqda;
+ m_traceArray[traceNumber]->numberOfSamples = tqda.size();
+}
+
TQColor& TraceWidget::traceColor(uint traceNumber) {
VERIFY_TRACE_ARRAY_SIZE
return m_traceArray[traceNumber]->color;
}
-void TraceWidget::setTraceColor(TQColor& color, uint traceNumber) {
+void TraceWidget::setTraceColor(uint traceNumber, TQColor& color) {
VERIFY_TRACE_ARRAY_SIZE
m_traceArray[traceNumber]->color = color;
+
+ m_graticuleWidget->updateGraticule();
+ updateTraceText();
}
bool TraceWidget::traceEnabled(uint traceNumber) {
@@ -110,82 +263,75 @@ bool TraceWidget::traceEnabled(uint traceNumber) {
return m_traceArray[traceNumber]->enabled;
}
-void TraceWidget::setTraceEnabled(bool enabled, uint traceNumber) {
+void TraceWidget::setTraceEnabled(uint traceNumber, bool enabled) {
VERIFY_TRACE_ARRAY_SIZE
m_traceArray[traceNumber]->enabled = enabled;
-}
-
-void TraceWidget::resizeTraceArray(uint newsize) {
- uint oldcount = m_traceArray.count();
-
- if (newsize > oldcount) {
- m_traceArray.resize(newsize);
- for (uint i=oldcount;i<newsize;i++) {
- m_traceArray[i] = new TraceData;
- }
+ if (enabled) {
+ m_traceArray[traceNumber]->infoLabel->show();
}
else {
- m_traceArray.resize(newsize);
- for (uint i=newsize;i<oldcount;i++) {
- delete m_traceArray[i];
- }
+ m_traceArray[traceNumber]->infoLabel->hide();
}
+
+ m_graticuleWidget->updateGraticule();
+ updateTraceText();
}
-void TraceWidget::updateGraticule() {
- unsigned int d,s,x,y;
+TQString TraceWidget::traceName(uint traceNumber) {
+ VERIFY_TRACE_ARRAY_SIZE
- if (m_graticulePixmap) {
- delete m_graticulePixmap;
- }
- m_graticulePixmap = new TQPixmap(width(), height());
+ return m_traceArray[traceNumber]->traceName;
+}
- // Draw the graticule into the pixmap
- TQPainter p(m_graticulePixmap);
- p.setPen(TQPen(foregroundColor(), 1, TQt::SolidLine));
- p.fillRect(0, 0, m_graticulePixmap->width(), m_graticulePixmap->height(), backgroundColor());
- p.setPen(TQPen(foregroundColor(), 1, TQt::DotLine));
- if (m_vertDivs > 0) {
- s = m_graticulePixmap->width() / m_vertDivs;
- x = 0;
- for (d=0; d<m_vertDivs; d++) {
- p.drawLine(x, 0, x, m_graticulePixmap->height());
- x += s;
- }
- }
- if (m_horizDivs > 0) {
- s = m_graticulePixmap->height() / m_horizDivs;
- y = 0;
- for (d=0; d<m_horizDivs; d++) {
- p.drawLine(0, y, m_graticulePixmap->width(), y);
- y += s;
- }
- }
- p.setPen(TQPen(foregroundColor(), 1, TQt::SolidLine));
- p.drawRect(0, 0, m_graticulePixmap->width(), m_graticulePixmap->height());
+void TraceWidget::setTraceName(uint traceNumber, TQString name) {
+ VERIFY_TRACE_ARRAY_SIZE
- // Repaint the widget
- repaint();
+ m_traceArray[traceNumber]->traceName = name;
+ updateTraceText();
}
-void TraceWidget::paintEvent(TQPaintEvent*) {
- TQPainter p(this);
+TQString TraceWidget::traceHorizontalUnits(uint traceNumber) {
+ VERIFY_TRACE_ARRAY_SIZE
- if (m_graticulePixmap) {
- // Draw the graticule pixmap to erase the widget
- p.drawPixmap(0, 0, *m_graticulePixmap);
+ return m_traceArray[traceNumber]->horizontalUnits;
+}
- // Draw the traces
- for (uint trace=0;trace<m_traceArray.count();trace++) {
- m_traceArray[trace]->drawTrace(&p, m_graticulePixmap->width(), m_graticulePixmap->height());
+void TraceWidget::setTraceHorizontalUnits(uint traceNumber, TQString units) {
+ VERIFY_TRACE_ARRAY_SIZE
+
+ m_traceArray[traceNumber]->horizontalUnits = units;
+ updateTraceText();
+}
+
+TQString TraceWidget::traceVerticalUnits(uint traceNumber) {
+ VERIFY_TRACE_ARRAY_SIZE
+
+ return m_traceArray[traceNumber]->verticalUnits;
+}
+
+void TraceWidget::setTraceVerticalUnits(uint traceNumber, TQString units) {
+ VERIFY_TRACE_ARRAY_SIZE
+
+ m_traceArray[traceNumber]->verticalUnits = units;
+ updateTraceText();
+}
+
+void TraceWidget::resizeTraceArray(uint newsize) {
+ uint oldcount = m_traceArray.count();
+
+ if (newsize > oldcount) {
+ m_traceArray.resize(newsize);
+ for (uint i=oldcount;i<newsize;i++) {
+ m_traceArray[i] = new TraceData(this);
+ m_traceLabelLayout->addWidget(m_traceArray[i]->infoLabel, 0, i);
}
}
else {
- p.fillRect(x(), y(), width(), height(), backgroundColor());
+ m_traceArray.resize(newsize);
+ for (uint i=newsize;i<oldcount;i++) {
+ m_traceLabelLayout->remove(m_traceArray[i]->infoLabel);
+ delete m_traceArray[i];
+ }
}
-}
-
-void TraceWidget::resizeEvent(TQResizeEvent *) {
- updateGraticule();
} \ No newline at end of file
diff --git a/clients/tde/src/widgets/tracewidget.h b/clients/tde/src/widgets/tracewidget.h
index c2a4c1d..b16717c 100644
--- a/clients/tde/src/widgets/tracewidget.h
+++ b/clients/tde/src/widgets/tracewidget.h
@@ -6,15 +6,21 @@
#include <tqtrla.h>
class TQPixmap;
+class TQLabel;
+class TQVBoxLayout;
+class TQGridLayout;
+class TraceWidget;
class TraceData
{
public:
- TraceData();
+ TraceData(TQWidget* labelParent=0);
+ ~TraceData();
void drawTrace(TQPainter* p, int graticule_width, int graticule_height);
public:
TQDoubleArray sampleArray;
+ TQDoubleArray positionArray;
unsigned int numberOfSamples;
TQColor color;
bool enabled;
@@ -22,10 +28,36 @@ class TraceData
double rightEdge;
double topEdge;
double bottomEdge;
+ TQString traceName;
+ TQString horizontalUnits;
+ TQString verticalUnits;
+ TQLabel* infoLabel;
};
typedef TQMemArray<TraceData*> TraceList;
+class GraticuleWidget : public TQWidget
+{
+ Q_OBJECT
+
+ public:
+ GraticuleWidget(TraceWidget*, const char* = 0);
+ ~GraticuleWidget();
+
+ protected:
+ virtual void paintEvent(TQPaintEvent*);
+ virtual void resizeEvent(TQResizeEvent *);
+
+ private slots:
+ void updateGraticule();
+
+ private:
+ TraceWidget* m_base;
+ TQPixmap* m_graticulePixmap;
+
+ friend class TraceWidget;
+};
+
class TraceWidget : public TQWidget
{
Q_OBJECT
@@ -34,24 +66,28 @@ class TraceWidget : public TQWidget
TraceWidget(TQWidget* = 0, const char* = 0);
~TraceWidget();
- void setNumberOfSamples(unsigned int samples, uint traceNumber);
+ void setNumberOfSamples(uint traceNumber, unsigned int samples);
void setNumberOfHorizontalDivisions(unsigned int divisions);
void setNumberOfVerticalDivisions(unsigned int divisions);
- void setDisplayLimits(double x, double y, double w, double h, uint traceNumber);
+ void setDisplayLimits(uint traceNumber, double x, double y, double w, double h);
TQDoubleArray& samples(uint traceNumber);
- void setSamples(TQDoubleArray&, uint traceNumber);
+ void setSamples(uint traceNumber, TQDoubleArray&);
+ TQDoubleArray& positions(uint traceNumber);
+ void setPositions(uint traceNumber, TQDoubleArray&);
TQColor& traceColor(uint traceNumber);
- void setTraceColor(TQColor&, uint traceNumber);
+ void setTraceColor(uint traceNumber, TQColor&);
bool traceEnabled(uint traceNumber);
- void setTraceEnabled(bool enabled, uint traceNumber);
-
- protected:
- virtual void paintEvent(TQPaintEvent*);
- virtual void resizeEvent(TQResizeEvent *);
+ void setTraceEnabled(uint traceNumber, bool enabled);
+ TQString traceName(uint traceNumber);
+ void setTraceName(uint traceNumber, TQString name);
+ TQString traceHorizontalUnits(uint traceNumber);
+ void setTraceHorizontalUnits(uint traceNumber, TQString units);
+ TQString traceVerticalUnits(uint traceNumber);
+ void setTraceVerticalUnits(uint traceNumber, TQString units);
private slots:
- void updateGraticule();
+ void updateTraceText();
private:
void resizeTraceArray(uint newsize);
@@ -60,5 +96,9 @@ class TraceWidget : public TQWidget
unsigned int m_horizDivs;
unsigned int m_vertDivs;
TraceList m_traceArray;
- TQPixmap* m_graticulePixmap;
+ TQVBoxLayout* m_primaryLayout;
+ TQGridLayout* m_traceLabelLayout;
+ GraticuleWidget* m_graticuleWidget;
+
+ friend class GraticuleWidget;
}; \ No newline at end of file