|
|
@ -288,6 +288,7 @@ TraceData::TraceData(TraceWidget* parent, TQWidget* labelParent) : TQObject(), p
|
|
|
|
traceName = i18n("Unknown");
|
|
|
|
traceName = i18n("Unknown");
|
|
|
|
horizontalUnits = i18n("Units");
|
|
|
|
horizontalUnits = i18n("Units");
|
|
|
|
verticalUnits = i18n("Units");
|
|
|
|
verticalUnits = i18n("Units");
|
|
|
|
|
|
|
|
m_digitalTraceDrawing = false;
|
|
|
|
enabled = false;
|
|
|
|
enabled = false;
|
|
|
|
|
|
|
|
|
|
|
|
if (labelParent) {
|
|
|
|
if (labelParent) {
|
|
|
@ -387,7 +388,7 @@ void TraceData::drawTrace(TQPainter* p, int graticule_width, int graticule_heigh
|
|
|
|
unsigned int n;
|
|
|
|
unsigned int n;
|
|
|
|
unsigned int incr;
|
|
|
|
unsigned int incr;
|
|
|
|
unsigned int activeSamples;
|
|
|
|
unsigned int activeSamples;
|
|
|
|
int x,y,x2,y2,horizoffset;
|
|
|
|
int x,y,x2,y2,baseline,horizoffset;
|
|
|
|
|
|
|
|
|
|
|
|
// Obtain horizontal scrolling offset
|
|
|
|
// Obtain horizontal scrolling offset
|
|
|
|
horizoffset = parentWidget->horizScrollOffset();
|
|
|
|
horizoffset = parentWidget->horizScrollOffset();
|
|
|
@ -419,6 +420,7 @@ void TraceData::drawTrace(TQPainter* p, int graticule_width, int graticule_heigh
|
|
|
|
y = ((((sampleArray[n]+offset)-topEdge)/(bottomEdge-topEdge))*(virtual_height));
|
|
|
|
y = ((((sampleArray[n]+offset)-topEdge)/(bottomEdge-topEdge))*(virtual_height));
|
|
|
|
x2 = (((positionArray[n+incr]-leftEdge)/(rightEdge-leftEdge))*(virtual_width))-horizoffset;
|
|
|
|
x2 = (((positionArray[n+incr]-leftEdge)/(rightEdge-leftEdge))*(virtual_width))-horizoffset;
|
|
|
|
y2 = ((((sampleArray[n+incr]+offset)-topEdge)/(bottomEdge-topEdge))*(virtual_height));
|
|
|
|
y2 = ((((sampleArray[n+incr]+offset)-topEdge)/(bottomEdge-topEdge))*(virtual_height));
|
|
|
|
|
|
|
|
baseline = ((((offset)-topEdge)/(bottomEdge-topEdge))*(virtual_height));
|
|
|
|
|
|
|
|
|
|
|
|
// Do not draw lines that are placed fully off the screen
|
|
|
|
// Do not draw lines that are placed fully off the screen
|
|
|
|
if ((x < 0) && (x2 < 0)) continue;
|
|
|
|
if ((x < 0) && (x2 < 0)) continue;
|
|
|
@ -435,9 +437,42 @@ void TraceData::drawTrace(TQPainter* p, int graticule_width, int graticule_heigh
|
|
|
|
if (x2 > (virtual_width-horizoffset)) x2 = (virtual_width-horizoffset);
|
|
|
|
if (x2 > (virtual_width-horizoffset)) x2 = (virtual_width-horizoffset);
|
|
|
|
if (y2 < 0) y2 = 0;
|
|
|
|
if (y2 < 0) y2 = 0;
|
|
|
|
if (y2 > virtual_height) y2 = virtual_height;
|
|
|
|
if (y2 > virtual_height) y2 = virtual_height;
|
|
|
|
|
|
|
|
if (baseline < 0) baseline = 0;
|
|
|
|
// Draw line!
|
|
|
|
if (baseline > virtual_height) baseline = virtual_height;
|
|
|
|
p->drawLine(x, y, x2, y2);
|
|
|
|
|
|
|
|
|
|
|
|
// Draw line(s)!
|
|
|
|
|
|
|
|
if (m_digitalTraceDrawing) {
|
|
|
|
|
|
|
|
p->drawLine(x+1, y, x2-1, y);
|
|
|
|
|
|
|
|
p->drawLine(x2-1, y, x2+1, y2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Draw fill areas
|
|
|
|
|
|
|
|
if ((sampleArray[n] != 0) && (sampleArray[n+1] != 0)) {
|
|
|
|
|
|
|
|
p->save();
|
|
|
|
|
|
|
|
p->fillRect(x+1, y+1, x2-x, baseline-y-1, TQBrush(color.dark(400)));
|
|
|
|
|
|
|
|
p->restore();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if ((sampleArray[n] != 0) && (sampleArray[n+1] == 0)) {
|
|
|
|
|
|
|
|
p->save();
|
|
|
|
|
|
|
|
// Fill sloping edges
|
|
|
|
|
|
|
|
p->setPen(color.dark(400));
|
|
|
|
|
|
|
|
p->drawLine(x2-3, y+1, x2-1, y2-1);
|
|
|
|
|
|
|
|
p->drawLine(x2-2, y+1, x2, y2-1);
|
|
|
|
|
|
|
|
// Fill rectangle under trace
|
|
|
|
|
|
|
|
p->fillRect(x+2, y+1, (x2-1)-(x+1)-1, baseline-y-1, TQBrush(color.dark(400)));
|
|
|
|
|
|
|
|
p->restore();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if ((sampleArray[n] == 0) && (sampleArray[n+1] != 0)) {
|
|
|
|
|
|
|
|
p->save();
|
|
|
|
|
|
|
|
// Fill sloping edges
|
|
|
|
|
|
|
|
p->setPen(color.dark(400));
|
|
|
|
|
|
|
|
p->drawLine(x2+1, y+1, x2+3, y2-1);
|
|
|
|
|
|
|
|
p->drawLine(x2, y+1, x2+2, y2-1);
|
|
|
|
|
|
|
|
p->restore();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
p->drawLine(x, y, x2, y2);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Draw the zero level indicator
|
|
|
|
// Draw the zero level indicator
|
|
|
@ -800,7 +835,7 @@ void GraticuleWidget::updateGraticule() {
|
|
|
|
p.fillRect(0, 0, m_graticulePixmap->width(), m_graticulePixmap->height(), backgroundColor());
|
|
|
|
p.fillRect(0, 0, m_graticulePixmap->width(), m_graticulePixmap->height(), backgroundColor());
|
|
|
|
p.setPen(TQPen(foregroundColor(), 1, TQt::DotLine));
|
|
|
|
p.setPen(TQPen(foregroundColor(), 1, TQt::DotLine));
|
|
|
|
if (m_base->m_horizDivs > 0) {
|
|
|
|
if (m_base->m_horizDivs > 0) {
|
|
|
|
s = m_graticulePixmap->width() / m_base->m_horizDivs;
|
|
|
|
s = virtualWidth() / m_base->m_horizDivs;
|
|
|
|
x = 0;
|
|
|
|
x = 0;
|
|
|
|
for (d=0; d<m_base->m_horizDivs; d++) {
|
|
|
|
for (d=0; d<m_base->m_horizDivs; d++) {
|
|
|
|
rx = x - m_base->horizScrollOffset();
|
|
|
|
rx = x - m_base->horizScrollOffset();
|
|
|
@ -1222,6 +1257,17 @@ void TraceWidget::setNumberOfSamples(uint traceNumber, unsigned int samples, boo
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void TraceWidget::setDigitalTraceMode(uint traceNumber, bool enabled, bool deferUpdate) {
|
|
|
|
|
|
|
|
VERIFY_TRACE_ARRAY_SIZE
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_traceArray[traceNumber]->m_digitalTraceDrawing = enabled;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!deferUpdate) {
|
|
|
|
|
|
|
|
m_graticuleWidget->updateGraticule();
|
|
|
|
|
|
|
|
updateTraceText();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void TraceWidget::setNumberOfHorizontalDivisions(unsigned int divisions) {
|
|
|
|
void TraceWidget::setNumberOfHorizontalDivisions(unsigned int divisions) {
|
|
|
|
m_horizDivs = divisions;
|
|
|
|
m_horizDivs = divisions;
|
|
|
|
m_graticuleWidget->updateGraticule();
|
|
|
|
m_graticuleWidget->updateGraticule();
|
|
|
|