|
|
@ -97,6 +97,8 @@ bool TQRectF::operator!=(const TQRectF &r1) {
|
|
|
|
TraceData::TraceData(TraceWidget* parent, TQWidget* labelParent) : TQObject(), parentWidget(parent) {
|
|
|
|
TraceData::TraceData(TraceWidget* parent, TQWidget* labelParent) : TQObject(), parentWidget(parent) {
|
|
|
|
color = TQColor(0, 255, 0);
|
|
|
|
color = TQColor(0, 255, 0);
|
|
|
|
numberOfSamples = 0;
|
|
|
|
numberOfSamples = 0;
|
|
|
|
|
|
|
|
leftEdgeIndex = -1;
|
|
|
|
|
|
|
|
rightEdgeIndex = -1;
|
|
|
|
offset = 0.0;
|
|
|
|
offset = 0.0;
|
|
|
|
leftEdge = 0;
|
|
|
|
leftEdge = 0;
|
|
|
|
rightEdge = 0;
|
|
|
|
rightEdge = 0;
|
|
|
@ -178,21 +180,45 @@ void TraceData::drawTrace(TQPainter* p, int graticule_width, int graticule_heigh
|
|
|
|
if ((bottomEdge != topEdge) && (enabled) && (positionArray.count() >= numberOfSamples) && (sampleArray.count() >= numberOfSamples) && (numberOfSamples > 0)) {
|
|
|
|
if ((bottomEdge != topEdge) && (enabled) && (positionArray.count() >= numberOfSamples) && (sampleArray.count() >= numberOfSamples) && (numberOfSamples > 0)) {
|
|
|
|
// Draw the points
|
|
|
|
// Draw the points
|
|
|
|
unsigned int n;
|
|
|
|
unsigned int n;
|
|
|
|
|
|
|
|
unsigned int incr;
|
|
|
|
|
|
|
|
unsigned int activeSamples;
|
|
|
|
int x,y,x2,y2;
|
|
|
|
int x,y,x2,y2;
|
|
|
|
for (n=0; n<numberOfSamples-1; n++) {
|
|
|
|
// Determine how many samples are actually being displayed
|
|
|
|
|
|
|
|
if ((leftEdgeIndex < 0) || (rightEdgeIndex < 0)) {
|
|
|
|
|
|
|
|
for (n=0; n<numberOfSamples; n++) {
|
|
|
|
|
|
|
|
x = (((positionArray[n]-leftEdge)/(rightEdge-leftEdge))*(graticule_width));
|
|
|
|
|
|
|
|
if (leftEdgeIndex < 0) {
|
|
|
|
|
|
|
|
if (x >= 0) {
|
|
|
|
|
|
|
|
leftEdgeIndex = n;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
if (x >= graticule_width) {
|
|
|
|
|
|
|
|
rightEdgeIndex = n;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (rightEdgeIndex < 0) {
|
|
|
|
|
|
|
|
rightEdgeIndex = numberOfSamples-1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
activeSamples = abs(rightEdgeIndex-leftEdgeIndex);
|
|
|
|
|
|
|
|
incr = (activeSamples/graticule_width)+1;
|
|
|
|
|
|
|
|
for (n=leftEdgeIndex; n<numberOfSamples-incr; n=n+incr) {
|
|
|
|
x = (((positionArray[n]-leftEdge)/(rightEdge-leftEdge))*(graticule_width));
|
|
|
|
x = (((positionArray[n]-leftEdge)/(rightEdge-leftEdge))*(graticule_width));
|
|
|
|
y = ((((sampleArray[n]+offset)-topEdge)/(bottomEdge-topEdge))*(graticule_height));
|
|
|
|
y = ((((sampleArray[n]+offset)-topEdge)/(bottomEdge-topEdge))*(graticule_height));
|
|
|
|
x2 = (((positionArray[n+1]-leftEdge)/(rightEdge-leftEdge))*(graticule_width));
|
|
|
|
x2 = (((positionArray[n+incr]-leftEdge)/(rightEdge-leftEdge))*(graticule_width));
|
|
|
|
y2 = ((((sampleArray[n+1]+offset)-topEdge)/(bottomEdge-topEdge))*(graticule_height));
|
|
|
|
y2 = ((((sampleArray[n+incr]+offset)-topEdge)/(bottomEdge-topEdge))*(graticule_height));
|
|
|
|
|
|
|
|
|
|
|
|
if (x < 0) x = 0;
|
|
|
|
if (x < 0) x = 0;
|
|
|
|
if (x > graticule_width) x = graticule_width;
|
|
|
|
if (x > graticule_width) x = graticule_width;
|
|
|
|
if (y < 0) y = 0;
|
|
|
|
if (y < 0) y = 0;
|
|
|
|
if (y > graticule_width) y = graticule_height;
|
|
|
|
if (y > graticule_height) y = graticule_height;
|
|
|
|
if (x2 < 0) x2 = 0;
|
|
|
|
if (x2 < 0) x2 = 0;
|
|
|
|
if (x2 > graticule_width) x2 = graticule_width;
|
|
|
|
if (x2 > graticule_width) x2 = graticule_width;
|
|
|
|
if (y2 < 0) y2 = 0;
|
|
|
|
if (y2 < 0) y2 = 0;
|
|
|
|
if (y2 > graticule_width) y2 = graticule_height;
|
|
|
|
if (y2 > graticule_height) y2 = graticule_height;
|
|
|
|
|
|
|
|
|
|
|
|
p->drawLine(x, y, x2, y2);
|
|
|
|
p->drawLine(x, y, x2, y2);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -535,6 +561,7 @@ void GraticuleWidget::mousePressEvent(TQMouseEvent *e) {
|
|
|
|
if (m_base->m_zoomBoxEnabled) {
|
|
|
|
if (m_base->m_zoomBoxEnabled) {
|
|
|
|
m_middleMouseDown = true;
|
|
|
|
m_middleMouseDown = true;
|
|
|
|
m_prevDownPos = e->pos();
|
|
|
|
m_prevDownPos = e->pos();
|
|
|
|
|
|
|
|
setCursor(tqsizeAllCursor);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -545,7 +572,24 @@ void GraticuleWidget::mouseReleaseEvent(TQMouseEvent *e) {
|
|
|
|
m_leftMouseDown = false;
|
|
|
|
m_leftMouseDown = false;
|
|
|
|
|
|
|
|
|
|
|
|
if (m_movingCursor >= 0) {
|
|
|
|
if (m_movingCursor >= 0) {
|
|
|
|
|
|
|
|
TQPoint diff = e->pos() - m_prevDownPos;
|
|
|
|
|
|
|
|
double dx = diff.x()*(100.0/width());
|
|
|
|
|
|
|
|
double dy = diff.y()*(100.0/height());
|
|
|
|
|
|
|
|
if (m_base->m_cursorArray[m_movingCursor]->orientation == TQt::Horizontal) {
|
|
|
|
|
|
|
|
m_base->m_cursorArray[m_movingCursor]->position = m_prevCursorPos+dy;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
m_base->m_cursorArray[m_movingCursor]->position = m_prevCursorPos+dx;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_base->m_cursorArray[m_movingCursor]->position < 0.0) {
|
|
|
|
|
|
|
|
m_base->m_cursorArray[m_movingCursor]->position = 0.0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_base->m_cursorArray[m_movingCursor]->position > 100.0) {
|
|
|
|
|
|
|
|
m_base->m_cursorArray[m_movingCursor]->position = 100.0;
|
|
|
|
|
|
|
|
}
|
|
|
|
m_movingCursor = -1;
|
|
|
|
m_movingCursor = -1;
|
|
|
|
|
|
|
|
updateGraticule();
|
|
|
|
|
|
|
|
repaint(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
double x1 = m_prevDownPos.x();
|
|
|
|
double x1 = m_prevDownPos.x();
|
|
|
@ -578,13 +622,15 @@ void GraticuleWidget::mouseReleaseEvent(TQMouseEvent *e) {
|
|
|
|
double y2 = e->y();
|
|
|
|
double y2 = e->y();
|
|
|
|
if ((x1 < width()) && (y1 < height()) && (x2 < width()) && (y2 < height()) && (x1 > 0) && (y1 > 0) && (x2 > 0) && (y2 > 0)) {
|
|
|
|
if ((x1 < width()) && (y1 < height()) && (x2 < width()) && (y2 < height()) && (x1 > 0) && (y1 > 0) && (x2 > 0) && (y2 > 0)) {
|
|
|
|
TQPoint diff = e->pos() - m_prevDownPos;
|
|
|
|
TQPoint diff = e->pos() - m_prevDownPos;
|
|
|
|
diff = TQPoint(diff.x()*(100.0/width()), diff.y()*(100.0/height()));
|
|
|
|
double dx = diff.x()*(100.0/width());
|
|
|
|
m_base->setZoomCursorBox(TQRectF(m_prevCursorRect.x()+diff.x(), m_prevCursorRect.y()+diff.y(), m_prevCursorRect.width()+diff.x(), m_prevCursorRect.height()+diff.y()));
|
|
|
|
double dy = diff.y()*(100.0/height());
|
|
|
|
|
|
|
|
m_base->setZoomCursorBox(TQRectF(m_prevCursorRect.x()+dx, m_prevCursorRect.y()+dy, m_prevCursorRect.width()+dx, m_prevCursorRect.height()+dy));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
// Reset original zoom box
|
|
|
|
// Reset original zoom box
|
|
|
|
m_base->setZoomCursorBox(m_prevCursorRect);
|
|
|
|
m_base->setZoomCursorBox(m_prevCursorRect);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
setCursor(tqcrossCursor);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -694,12 +740,13 @@ void GraticuleWidget::mouseMoveEvent(TQMouseEvent *e) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ((m_leftMouseDown) && (m_movingCursor >= 0)) {
|
|
|
|
else if ((m_leftMouseDown) && (m_movingCursor >= 0)) {
|
|
|
|
TQPoint diff = e->pos() - m_prevDownPos;
|
|
|
|
TQPoint diff = e->pos() - m_prevDownPos;
|
|
|
|
diff = TQPoint(diff.x()*(100.0/width()), diff.y()*(100.0/height()));
|
|
|
|
double dx = diff.x()*(100.0/width());
|
|
|
|
|
|
|
|
double dy = diff.y()*(100.0/height());
|
|
|
|
if (m_base->m_cursorArray[m_movingCursor]->orientation == TQt::Horizontal) {
|
|
|
|
if (m_base->m_cursorArray[m_movingCursor]->orientation == TQt::Horizontal) {
|
|
|
|
m_base->m_cursorArray[m_movingCursor]->position = m_prevCursorPos+diff.y();
|
|
|
|
m_base->m_cursorArray[m_movingCursor]->position = m_prevCursorPos+dy;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
m_base->m_cursorArray[m_movingCursor]->position = m_prevCursorPos+diff.x();
|
|
|
|
m_base->m_cursorArray[m_movingCursor]->position = m_prevCursorPos+dx;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (m_base->m_cursorArray[m_movingCursor]->position < 0.0) {
|
|
|
|
if (m_base->m_cursorArray[m_movingCursor]->position < 0.0) {
|
|
|
|
m_base->m_cursorArray[m_movingCursor]->position = 0.0;
|
|
|
|
m_base->m_cursorArray[m_movingCursor]->position = 0.0;
|
|
|
@ -713,8 +760,9 @@ void GraticuleWidget::mouseMoveEvent(TQMouseEvent *e) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (m_middleMouseDown) {
|
|
|
|
else if (m_middleMouseDown) {
|
|
|
|
TQPoint diff = e->pos() - m_prevDownPos;
|
|
|
|
TQPoint diff = e->pos() - m_prevDownPos;
|
|
|
|
diff = TQPoint(diff.x()*(100.0/width()), diff.y()*(100.0/height()));
|
|
|
|
double dx = diff.x()*(100.0/width());
|
|
|
|
m_base->setZoomCursorBox(TQRectF(m_prevCursorRect.x()+diff.x(), m_prevCursorRect.y()+diff.y(), m_prevCursorRect.width()+diff.x(), m_prevCursorRect.height()+diff.y()));
|
|
|
|
double dy = diff.y()*(100.0/height());
|
|
|
|
|
|
|
|
m_base->setZoomCursorBox(TQRectF(m_prevCursorRect.x()+dx, m_prevCursorRect.y()+dy, m_prevCursorRect.width()+dx, m_prevCursorRect.height()+dy));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
m_base->updateCursorText();
|
|
|
|
m_base->updateCursorText();
|
|
|
@ -805,6 +853,8 @@ void TraceWidget::setNumberOfSamples(uint traceNumber, unsigned int samples) {
|
|
|
|
m_traceArray[traceNumber]->numberOfSamples = samples;
|
|
|
|
m_traceArray[traceNumber]->numberOfSamples = samples;
|
|
|
|
m_traceArray[traceNumber]->sampleArray.resize(samples);
|
|
|
|
m_traceArray[traceNumber]->sampleArray.resize(samples);
|
|
|
|
m_traceArray[traceNumber]->positionArray.resize(samples);
|
|
|
|
m_traceArray[traceNumber]->positionArray.resize(samples);
|
|
|
|
|
|
|
|
m_traceArray[traceNumber]->leftEdgeIndex = -1;
|
|
|
|
|
|
|
|
m_traceArray[traceNumber]->rightEdgeIndex = -1;
|
|
|
|
|
|
|
|
|
|
|
|
m_graticuleWidget->updateGraticule();
|
|
|
|
m_graticuleWidget->updateGraticule();
|
|
|
|
updateTraceText();
|
|
|
|
updateTraceText();
|
|
|
@ -831,6 +881,8 @@ void TraceWidget::setDisplayLimits(uint traceNumber, TQRectF limits) {
|
|
|
|
m_traceArray[traceNumber]->rightEdge = limits.width();
|
|
|
|
m_traceArray[traceNumber]->rightEdge = limits.width();
|
|
|
|
m_traceArray[traceNumber]->topEdge = limits.y();
|
|
|
|
m_traceArray[traceNumber]->topEdge = limits.y();
|
|
|
|
m_traceArray[traceNumber]->bottomEdge = limits.height();
|
|
|
|
m_traceArray[traceNumber]->bottomEdge = limits.height();
|
|
|
|
|
|
|
|
m_traceArray[traceNumber]->leftEdgeIndex = -1;
|
|
|
|
|
|
|
|
m_traceArray[traceNumber]->rightEdgeIndex = -1;
|
|
|
|
|
|
|
|
|
|
|
|
m_graticuleWidget->updateGraticule();
|
|
|
|
m_graticuleWidget->updateGraticule();
|
|
|
|
m_graticuleWidget->repaint(false);
|
|
|
|
m_graticuleWidget->repaint(false);
|
|
|
@ -958,6 +1010,8 @@ void TraceWidget::setPositions(uint traceNumber, TQDoubleArray& tqda) {
|
|
|
|
|
|
|
|
|
|
|
|
m_traceArray[traceNumber]->positionArray = tqda;
|
|
|
|
m_traceArray[traceNumber]->positionArray = tqda;
|
|
|
|
m_traceArray[traceNumber]->numberOfSamples = tqda.size();
|
|
|
|
m_traceArray[traceNumber]->numberOfSamples = tqda.size();
|
|
|
|
|
|
|
|
m_traceArray[traceNumber]->leftEdgeIndex = -1;
|
|
|
|
|
|
|
|
m_traceArray[traceNumber]->rightEdgeIndex = -1;
|
|
|
|
|
|
|
|
|
|
|
|
m_graticuleWidget->repaint(false);
|
|
|
|
m_graticuleWidget->repaint(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|