|
|
|
@ -378,7 +378,7 @@ TraceData::~TraceData() {
|
|
|
|
|
//
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TraceData::drawTrace(TQPainter* p, int graticule_width, int graticule_height) {
|
|
|
|
|
void TraceData::drawTrace(TQPainter* p, int graticule_width, int graticule_height, int virtual_width, int virtual_height) {
|
|
|
|
|
p->save();
|
|
|
|
|
p->setPen(color);
|
|
|
|
|
|
|
|
|
@ -387,18 +387,22 @@ void TraceData::drawTrace(TQPainter* p, int graticule_width, int graticule_heigh
|
|
|
|
|
unsigned int n;
|
|
|
|
|
unsigned int incr;
|
|
|
|
|
unsigned int activeSamples;
|
|
|
|
|
int x,y,x2,y2;
|
|
|
|
|
int x,y,x2,y2,horizoffset;
|
|
|
|
|
|
|
|
|
|
// Obtain horizontal scrolling offset
|
|
|
|
|
horizoffset = parentWidget->horizScrollOffset();
|
|
|
|
|
|
|
|
|
|
// 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));
|
|
|
|
|
x = (((positionArray[n]-leftEdge)/(rightEdge-leftEdge))*(virtual_width));
|
|
|
|
|
if (leftEdgeIndex < 0) {
|
|
|
|
|
if (x >= 0) {
|
|
|
|
|
leftEdgeIndex = n;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
if (x >= graticule_width) {
|
|
|
|
|
if (x >= virtual_width) {
|
|
|
|
|
rightEdgeIndex = n;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
@ -409,22 +413,30 @@ void TraceData::drawTrace(TQPainter* p, int graticule_width, int graticule_heigh
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
activeSamples = abs(rightEdgeIndex-leftEdgeIndex);
|
|
|
|
|
incr = (activeSamples/graticule_width)+1;
|
|
|
|
|
incr = (activeSamples/virtual_width)+1;
|
|
|
|
|
for (n=leftEdgeIndex; n<numberOfSamples-incr; n=n+incr) {
|
|
|
|
|
x = (((positionArray[n]-leftEdge)/(rightEdge-leftEdge))*(graticule_width));
|
|
|
|
|
y = ((((sampleArray[n]+offset)-topEdge)/(bottomEdge-topEdge))*(graticule_height));
|
|
|
|
|
x2 = (((positionArray[n+incr]-leftEdge)/(rightEdge-leftEdge))*(graticule_width));
|
|
|
|
|
y2 = ((((sampleArray[n+incr]+offset)-topEdge)/(bottomEdge-topEdge))*(graticule_height));
|
|
|
|
|
|
|
|
|
|
if (x < 0) x = 0;
|
|
|
|
|
if (x > graticule_width) x = graticule_width;
|
|
|
|
|
x = (((positionArray[n]-leftEdge)/(rightEdge-leftEdge))*(virtual_width))-horizoffset;
|
|
|
|
|
y = ((((sampleArray[n]+offset)-topEdge)/(bottomEdge-topEdge))*(virtual_height));
|
|
|
|
|
x2 = (((positionArray[n+incr]-leftEdge)/(rightEdge-leftEdge))*(virtual_width))-horizoffset;
|
|
|
|
|
y2 = ((((sampleArray[n+incr]+offset)-topEdge)/(bottomEdge-topEdge))*(virtual_height));
|
|
|
|
|
|
|
|
|
|
// Do not draw lines that are placed fully off the screen
|
|
|
|
|
if ((x < 0) && (x2 < 0)) continue;
|
|
|
|
|
if ((y < 0) && (y2 < 0)) continue;
|
|
|
|
|
if ((x > graticule_width) && (x2 > graticule_width)) continue;
|
|
|
|
|
if ((y > graticule_height) && (y2 > graticule_height)) continue;
|
|
|
|
|
|
|
|
|
|
// Clip lines to screen borders
|
|
|
|
|
if (x < (0-horizoffset)) x = (0-horizoffset);
|
|
|
|
|
if (x > (virtual_width-horizoffset)) x = (virtual_width-horizoffset);
|
|
|
|
|
if (y < 0) y = 0;
|
|
|
|
|
if (y > graticule_height) y = graticule_height;
|
|
|
|
|
if (x2 < 0) x2 = 0;
|
|
|
|
|
if (x2 > graticule_width) x2 = graticule_width;
|
|
|
|
|
if (y > virtual_height) y = virtual_height;
|
|
|
|
|
if (x2 < (0-horizoffset)) x2 = (0-horizoffset);
|
|
|
|
|
if (x2 > (virtual_width-horizoffset)) x2 = (virtual_width-horizoffset);
|
|
|
|
|
if (y2 < 0) y2 = 0;
|
|
|
|
|
if (y2 > graticule_height) y2 = graticule_height;
|
|
|
|
|
if (y2 > virtual_height) y2 = virtual_height;
|
|
|
|
|
|
|
|
|
|
// Draw line!
|
|
|
|
|
p->drawLine(x, y, x2, y2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -580,7 +592,7 @@ CursorData::~CursorData() {
|
|
|
|
|
//
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CursorData::drawCursor(TQPainter* p, int graticule_width, int graticule_height) {
|
|
|
|
|
void CursorData::drawCursor(TQPainter* p, int graticule_width, int graticule_height, int virtual_width, int virtual_height, int offset) {
|
|
|
|
|
if (enabled) {
|
|
|
|
|
if (highlighted) {
|
|
|
|
|
p->setPen(highlightColor.dark(parentWidget->m_cursorDarkness));
|
|
|
|
@ -590,11 +602,13 @@ void CursorData::drawCursor(TQPainter* p, int graticule_width, int graticule_hei
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (orientation == TQt::Vertical) {
|
|
|
|
|
int x = abs(((position)/(100.0))*(graticule_width));
|
|
|
|
|
p->drawLine(x, 0, x, graticule_height);
|
|
|
|
|
int x = (abs(((position)/(100.0))*(virtual_width))-offset);
|
|
|
|
|
if ((x >= 0) && (x < graticule_width)) {
|
|
|
|
|
p->drawLine(x, 0, x, graticule_height);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
int y = abs(((position)/(100.0))*(graticule_height));
|
|
|
|
|
int y = abs(((position)/(100.0))*(virtual_height));
|
|
|
|
|
p->drawLine(0, y, graticule_width, y);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -606,7 +620,7 @@ void CursorData::movePosOneTick() {
|
|
|
|
|
increment = 100.0/parentWidget->m_graticuleWidget->height();
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
increment = 100.0/parentWidget->m_graticuleWidget->width();
|
|
|
|
|
increment = 100.0/parentWidget->m_graticuleWidget->virtualWidth();
|
|
|
|
|
}
|
|
|
|
|
if (orientation == TQt::Horizontal) {
|
|
|
|
|
position -= increment;
|
|
|
|
@ -629,7 +643,7 @@ void CursorData::moveNegOneTick() {
|
|
|
|
|
increment = 100.0/parentWidget->m_graticuleWidget->height();
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
increment = 100.0/parentWidget->m_graticuleWidget->width();
|
|
|
|
|
increment = 100.0/parentWidget->m_graticuleWidget->virtualWidth();
|
|
|
|
|
}
|
|
|
|
|
if (orientation == TQt::Horizontal) {
|
|
|
|
|
position += increment;
|
|
|
|
@ -652,7 +666,7 @@ void CursorData::movePosMultiTicks() {
|
|
|
|
|
increment = 100.0/parentWidget->m_graticuleWidget->height();
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
increment = 100.0/parentWidget->m_graticuleWidget->width();
|
|
|
|
|
increment = 100.0/parentWidget->m_graticuleWidget->virtualWidth();
|
|
|
|
|
}
|
|
|
|
|
if (orientation == TQt::Horizontal) {
|
|
|
|
|
position -= (increment*10.0);
|
|
|
|
@ -675,7 +689,7 @@ void CursorData::moveNegMultiTicks() {
|
|
|
|
|
increment = 100.0/parentWidget->m_graticuleWidget->height();
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
increment = 100.0/parentWidget->m_graticuleWidget->width();
|
|
|
|
|
increment = 100.0/parentWidget->m_graticuleWidget->virtualWidth();
|
|
|
|
|
}
|
|
|
|
|
if (orientation == TQt::Horizontal) {
|
|
|
|
|
position += (increment*10.0);
|
|
|
|
@ -715,6 +729,8 @@ bool CursorData::eventFilter(TQObject *o, TQEvent *e) {
|
|
|
|
|
GraticuleWidget::GraticuleWidget(TraceWidget* parent, const char* name) : TQWidget(parent, name),
|
|
|
|
|
m_base(parent),
|
|
|
|
|
m_graticulePixmap(0),
|
|
|
|
|
m_prevWidgetWidth(-1),
|
|
|
|
|
m_virtualWidth(0),
|
|
|
|
|
m_leftMouseDown(false),
|
|
|
|
|
m_middleMouseDown(false),
|
|
|
|
|
m_closestCursor(-1),
|
|
|
|
@ -737,8 +753,41 @@ TQSizePolicy GraticuleWidget::sizePolicy() const {
|
|
|
|
|
return TQSizePolicy(TQSizePolicy::MinimumExpanding, TQSizePolicy::MinimumExpanding, true, true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int GraticuleWidget::virtualWidth() {
|
|
|
|
|
int widgetWidth = width();
|
|
|
|
|
if (widgetWidth != m_prevWidgetWidth) {
|
|
|
|
|
m_virtualWidth = widgetWidth;
|
|
|
|
|
int minimumHorizWidth = m_base->m_horizDivs * m_base->m_minimumPixelsPerHorizDiv;
|
|
|
|
|
if (m_virtualWidth < minimumHorizWidth) {
|
|
|
|
|
m_virtualWidth = minimumHorizWidth;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (m_base->m_horizScrollBar) {
|
|
|
|
|
int offScreenPixels = m_virtualWidth - widgetWidth;
|
|
|
|
|
if (offScreenPixels > 0) {
|
|
|
|
|
m_base->m_horizScrollBar->setMinValue(0);
|
|
|
|
|
m_base->m_horizScrollBar->setMaxValue(offScreenPixels);
|
|
|
|
|
m_base->m_horizScrollBar->show();
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
m_base->m_horizScrollBar->hide();
|
|
|
|
|
m_base->m_horizScrollBar->setMinValue(0);
|
|
|
|
|
m_base->m_horizScrollBar->setMaxValue(0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return m_virtualWidth;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GraticuleWidget::horizScrollValueChanged(int) {
|
|
|
|
|
updateGraticule();
|
|
|
|
|
repaint(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GraticuleWidget::updateGraticule() {
|
|
|
|
|
unsigned int d,s,x,y;
|
|
|
|
|
int rx;
|
|
|
|
|
|
|
|
|
|
if (m_graticulePixmap) {
|
|
|
|
|
delete m_graticulePixmap;
|
|
|
|
@ -754,7 +803,10 @@ void GraticuleWidget::updateGraticule() {
|
|
|
|
|
s = m_graticulePixmap->width() / m_base->m_horizDivs;
|
|
|
|
|
x = 0;
|
|
|
|
|
for (d=0; d<m_base->m_horizDivs; d++) {
|
|
|
|
|
p.drawLine(x, 0, x, m_graticulePixmap->height());
|
|
|
|
|
rx = x - m_base->horizScrollOffset();
|
|
|
|
|
if ((rx >= 0) && (rx < m_graticulePixmap->width())) {
|
|
|
|
|
p.drawLine(rx, 0, rx, m_graticulePixmap->height());
|
|
|
|
|
}
|
|
|
|
|
x += s;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -773,7 +825,7 @@ void GraticuleWidget::updateGraticule() {
|
|
|
|
|
TQRectF zoomBox = m_base->zoomBox();
|
|
|
|
|
if (!zoomBox.isNull()) {
|
|
|
|
|
// Translate zoombox coordinates to local drawing coordinates
|
|
|
|
|
TQRect drawingRect(abs(((zoomBox.x())/(100.0))*(width())), abs(((zoomBox.y())/(100.0))*(height())), abs(((zoomBox.width())/(100.0))*(width())), abs(((zoomBox.height())/(100.0))*(height())));
|
|
|
|
|
TQRect drawingRect(abs(((zoomBox.x())/(100.0))*(virtualWidth()))-m_base->horizScrollOffset(), abs(((zoomBox.y())/(100.0))*(height())), abs(((zoomBox.width())/(100.0))*(virtualWidth())), abs(((zoomBox.height())/(100.0))*(height())));
|
|
|
|
|
p.fillRect(drawingRect, TQBrush(foregroundColor().dark(m_base->m_zoomBoxDarkness), TQt::BDiagPattern));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -791,18 +843,19 @@ void GraticuleWidget::paintEvent(TQPaintEvent*) {
|
|
|
|
|
|
|
|
|
|
// 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());
|
|
|
|
|
m_base->m_traceArray[trace]->drawTrace(&p, m_graticulePixmap->width(), m_graticulePixmap->height(), virtualWidth(), m_graticulePixmap->height());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Draw the cursors
|
|
|
|
|
for (uint cursor=0;cursor<m_base->m_cursorArray.count();cursor++) {
|
|
|
|
|
m_base->m_cursorArray[cursor]->drawCursor(&p, m_graticulePixmap->width(), m_graticulePixmap->height());
|
|
|
|
|
m_base->m_cursorArray[cursor]->drawCursor(&p, m_graticulePixmap->width(), m_graticulePixmap->height(), virtualWidth(), m_graticulePixmap->height(), ((m_base->m_cursorArray[cursor]->orientation == TQt::Vertical)?m_base->horizScrollOffset():0));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
p.fillRect(x(), y(), width(), height(), backgroundColor());
|
|
|
|
|
p.fillRect(x(), y(), virtualWidth(), height(), backgroundColor());
|
|
|
|
|
}
|
|
|
|
|
p.end();
|
|
|
|
|
|
|
|
|
|
// Paint to window
|
|
|
|
|
bitBlt(this, 0, 0, &updatePixmap, 0, 0, updatePixmap.width(), updatePixmap.height(), TQt::CopyROP);
|
|
|
|
|
}
|
|
|
|
@ -844,7 +897,7 @@ void GraticuleWidget::mouseReleaseEvent(TQMouseEvent *e) {
|
|
|
|
|
|
|
|
|
|
if (m_movingCursor >= 0) {
|
|
|
|
|
TQPoint diff = e->pos() - m_prevDownPos;
|
|
|
|
|
double dx = diff.x()*(100.0/width());
|
|
|
|
|
double dx = diff.x()*(100.0/virtualWidth());
|
|
|
|
|
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;
|
|
|
|
@ -870,10 +923,10 @@ void GraticuleWidget::mouseReleaseEvent(TQMouseEvent *e) {
|
|
|
|
|
double y2 = e->y();
|
|
|
|
|
double pixelDiffX = fabs(x1-x2);
|
|
|
|
|
double pixelDiffY = fabs(y1-y2);
|
|
|
|
|
if ((x1 < width()) && (y1 < height()) && (x2 < width()) && (y2 < height()) && (x1 > 0) && (y1 > 0) && (x2 > 0) && (y2 > 0) && (pixelDiffX>0) && (pixelDiffY>0)) {
|
|
|
|
|
x1 = ((x1/width())*100.0);
|
|
|
|
|
if ((x1 < virtualWidth()) && (y1 < height()) && (x2 < virtualWidth()) && (y2 < height()) && (x1 > 0) && (y1 > 0) && (x2 > 0) && (y2 > 0) && (pixelDiffX>0) && (pixelDiffY>0)) {
|
|
|
|
|
x1 = ((x1/virtualWidth())*100.0);
|
|
|
|
|
y1 = ((y1/height())*100.0);
|
|
|
|
|
x2 = ((x2/width())*100.0);
|
|
|
|
|
x2 = ((x2/virtualWidth())*100.0);
|
|
|
|
|
y2 = ((y2/height())*100.0);
|
|
|
|
|
m_base->setZoomCursorBox(TQRectF(x1, y1, x2, y2));
|
|
|
|
|
}
|
|
|
|
@ -888,13 +941,13 @@ void GraticuleWidget::mouseReleaseEvent(TQMouseEvent *e) {
|
|
|
|
|
if (e->button() == TQt::MidButton) {
|
|
|
|
|
m_middleMouseDown = false;
|
|
|
|
|
|
|
|
|
|
double x1 = m_prevDownPos.x();
|
|
|
|
|
double x1 = m_prevDownPos.x()+m_base->horizScrollOffset();
|
|
|
|
|
double y1 = m_prevDownPos.y();
|
|
|
|
|
double x2 = e->x();
|
|
|
|
|
double x2 = e->x()+m_base->horizScrollOffset();
|
|
|
|
|
double y2 = e->y();
|
|
|
|
|
if ((x1 < width()) && (y1 < height()) && (x2 < width()) && (y2 < height()) && (x1 > 0) && (y1 > 0) && (x2 > 0) && (y2 > 0)) {
|
|
|
|
|
if ((x1 < virtualWidth()) && (y1 < height()) && (x2 < virtualWidth()) && (y2 < height()) && (x1 > 0) && (y1 > 0) && (x2 > 0) && (y2 > 0)) {
|
|
|
|
|
TQPoint diff = e->pos() - m_prevDownPos;
|
|
|
|
|
double dx = diff.x()*(100.0/width());
|
|
|
|
|
double dx = diff.x()*(100.0/virtualWidth());
|
|
|
|
|
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));
|
|
|
|
|
}
|
|
|
|
@ -923,7 +976,7 @@ void GraticuleWidget::mouseMoveEvent(TQMouseEvent *e) {
|
|
|
|
|
if ((!m_leftMouseDown) && (!m_middleMouseDown) && (m_movingCursor < 0)) {
|
|
|
|
|
for (uint cursor=0;cursor<m_base->m_cursorArray.count();cursor++) {
|
|
|
|
|
double scaledYPos = (e->y()*100.0)/height();
|
|
|
|
|
double scaledXPos = (e->x()*100.0)/width();
|
|
|
|
|
double scaledXPos = ((e->x()+m_base->horizScrollOffset())*100.0)/virtualWidth();
|
|
|
|
|
unsigned int pixelDistance;
|
|
|
|
|
if (m_base->m_cursorArray[cursor]->orientation == TQt::Horizontal) {
|
|
|
|
|
pixelDistance = (fabs(m_base->m_cursorArray[cursor]->position - scaledYPos)*height())/100.0;
|
|
|
|
@ -933,7 +986,7 @@ void GraticuleWidget::mouseMoveEvent(TQMouseEvent *e) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
pixelDistance = (fabs(m_base->m_cursorArray[cursor]->position - scaledXPos)*width())/100.0;
|
|
|
|
|
pixelDistance = (fabs(m_base->m_cursorArray[cursor]->position - scaledXPos)*virtualWidth())/100.0;
|
|
|
|
|
if (pixelDistance < m_closestCursorDistance) {
|
|
|
|
|
m_closestCursorDistance = pixelDistance;
|
|
|
|
|
m_closestCursor = cursor;
|
|
|
|
@ -973,11 +1026,11 @@ void GraticuleWidget::mouseMoveEvent(TQMouseEvent *e) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Print current cursor location for all traces
|
|
|
|
|
if ((e->x() < width()) && (e->y() < height())) {
|
|
|
|
|
if ((e->x() < virtualWidth()) && (e->y() < height())) {
|
|
|
|
|
for (uint trace=0;trace<m_base->m_traceArray.count();trace++) {
|
|
|
|
|
// Calculate location
|
|
|
|
|
double scaledYPos = (e->y()*100.0)/height();
|
|
|
|
|
double scaledXPos = (e->x()*100.0)/width();
|
|
|
|
|
double scaledXPos = (e->x()*100.0)/virtualWidth();
|
|
|
|
|
double horizontal_range = (m_base->m_traceArray[trace]->rightEdge-m_base->m_traceArray[trace]->leftEdge);
|
|
|
|
|
double vertical_range = (m_base->m_traceArray[trace]->bottomEdge-m_base->m_traceArray[trace]->topEdge);
|
|
|
|
|
double realCursorYPosition = (m_base->m_traceArray[trace]->topEdge+((scaledYPos/100.0)*vertical_range)-m_base->m_traceArray[trace]->offset);
|
|
|
|
@ -1002,17 +1055,17 @@ void GraticuleWidget::mouseMoveEvent(TQMouseEvent *e) {
|
|
|
|
|
double y1 = m_prevDownPos.y();
|
|
|
|
|
double x2 = e->x();
|
|
|
|
|
double y2 = e->y();
|
|
|
|
|
if ((x1 < width()) && (y1 < height()) && (x2 < width()) && (y2 < height()) && (x1 > 0) && (y1 > 0) && (x2 > 0) && (y2 > 0)) {
|
|
|
|
|
x1 = ((x1/width())*100.0);
|
|
|
|
|
if ((x1 < virtualWidth()) && (y1 < height()) && (x2 < virtualWidth()) && (y2 < height()) && (x1 > 0) && (y1 > 0) && (x2 > 0) && (y2 > 0)) {
|
|
|
|
|
x1 = ((x1/virtualWidth())*100.0);
|
|
|
|
|
y1 = ((y1/height())*100.0);
|
|
|
|
|
x2 = ((x2/width())*100.0);
|
|
|
|
|
x2 = ((x2/virtualWidth())*100.0);
|
|
|
|
|
y2 = ((y2/height())*100.0);
|
|
|
|
|
m_base->setZoomCursorBox(TQRectF(x1, y1, x2, y2));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if ((m_leftMouseDown) && (m_movingCursor >= 0)) {
|
|
|
|
|
TQPoint diff = e->pos() - m_prevDownPos;
|
|
|
|
|
double dx = diff.x()*(100.0/width());
|
|
|
|
|
double dx = diff.x()*(100.0/virtualWidth());
|
|
|
|
|
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;
|
|
|
|
@ -1033,7 +1086,7 @@ void GraticuleWidget::mouseMoveEvent(TQMouseEvent *e) {
|
|
|
|
|
}
|
|
|
|
|
else if (m_middleMouseDown) {
|
|
|
|
|
TQPoint diff = e->pos() - m_prevDownPos;
|
|
|
|
|
double dx = diff.x()*(100.0/width());
|
|
|
|
|
double dx = diff.x()*(100.0/virtualWidth());
|
|
|
|
|
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));
|
|
|
|
|
}
|
|
|
|
@ -1063,6 +1116,7 @@ TraceWidget::TraceWidget(TQWidget* parent, const char* name) : TQWidget(parent,
|
|
|
|
|
m_zoomBoxDarkness(ZOOM_SHADING_DARKNESS_FACTOR),
|
|
|
|
|
m_zoomCursorStartIndex(0),
|
|
|
|
|
m_zoomBoxEnabled(false),
|
|
|
|
|
m_horizScrollBar(0),
|
|
|
|
|
m_useAbsoluteHorizontalRange(true),
|
|
|
|
|
m_showLeftTraceInfoArea(false),
|
|
|
|
|
m_leftTraceInfoLabelsFit(false),
|
|
|
|
@ -1074,7 +1128,7 @@ TraceWidget::TraceWidget(TQWidget* parent, const char* name) : TQWidget(parent,
|
|
|
|
|
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, 1, 254);
|
|
|
|
|
m_primaryLayout->addMultiCellWidget(m_graticuleWidget, 0, 253, 1, 254);
|
|
|
|
|
m_primaryLayout->setAlignment(TQt::AlignTop);
|
|
|
|
|
m_rightPaneLayout = new TQGridLayout;
|
|
|
|
|
m_leftPaneLayout = new TQGridLayout;
|
|
|
|
@ -1109,6 +1163,15 @@ TraceWidget::~TraceWidget() {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int TraceWidget::horizScrollOffset() {
|
|
|
|
|
if (m_horizScrollBar) {
|
|
|
|
|
return m_horizScrollBar->value();
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TraceWidget::setForegroundColor(const TQColor color) {
|
|
|
|
|
setPaletteForegroundColor(color);
|
|
|
|
|
m_graticuleWidget->setPaletteForegroundColor(color);
|
|
|
|
@ -1138,7 +1201,7 @@ void TraceWidget::setBackgroundColor(const TQColor color) {
|
|
|
|
|
void TraceWidget::setNumberOfSamples(uint traceNumber, unsigned int samples, bool deferUpdate) {
|
|
|
|
|
VERIFY_TRACE_ARRAY_SIZE
|
|
|
|
|
|
|
|
|
|
int i;
|
|
|
|
|
unsigned int i;
|
|
|
|
|
int prev_samples = m_traceArray[traceNumber]->sampleArray.count();
|
|
|
|
|
|
|
|
|
|
m_traceArray[traceNumber]->numberOfSamples = samples;
|
|
|
|
@ -1996,33 +2059,68 @@ void TraceWidget::resizeCursorArray(uint newsize) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TQSize TraceWidget::sizeHint() const {
|
|
|
|
|
TQSize widgetSizeHint = TQWidget::sizeHint();
|
|
|
|
|
unsigned int minimumHorizWidth = m_horizDivs * m_minimumPixelsPerHorizDiv;
|
|
|
|
|
return TQSize(TQMAX(minimumHorizWidth, widgetSizeHint.height()), widgetSizeHint.height());
|
|
|
|
|
return TQWidget::sizeHint();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TQSize TraceWidget::minimumSizeHint() const {
|
|
|
|
|
return TQWidget::minimumSizeHint();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TraceScrollWidget::TraceScrollWidget(TQWidget* parent, const char* name) : TQScrollView(parent, name) {
|
|
|
|
|
TraceScrollView::TraceScrollView(TQWidget* parent, const char* name) : TQScrollView(parent, name) {
|
|
|
|
|
m_traceWidget = new TraceWidget(viewport());
|
|
|
|
|
addChild(m_traceWidget);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TraceScrollWidget::~TraceScrollWidget() {
|
|
|
|
|
TraceScrollView::~TraceScrollView() {
|
|
|
|
|
delete m_traceWidget;
|
|
|
|
|
m_traceWidget = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TQSize TraceScrollWidget::sizeHint() const {
|
|
|
|
|
TQSize TraceScrollView::sizeHint() const {
|
|
|
|
|
return TQScrollView::sizeHint();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TQSize TraceScrollWidget::minimumSizeHint() const {
|
|
|
|
|
TQSize TraceScrollView::minimumSizeHint() const {
|
|
|
|
|
return m_traceWidget->minimumSizeHint();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TraceWidget* TraceScrollWidget::traceWidget() {
|
|
|
|
|
TraceWidget* TraceScrollView::traceWidget() {
|
|
|
|
|
return m_traceWidget;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TraceScrollWidget::TraceScrollWidget(TQWidget* parent, const char* name) : TQVBox(parent, name) {
|
|
|
|
|
m_traceScrollView = new TraceScrollView(this);
|
|
|
|
|
m_horizScrollBar = new TQScrollBar(this);
|
|
|
|
|
m_traceScrollView->m_traceWidget->m_horizScrollBar = m_horizScrollBar;
|
|
|
|
|
connect(m_horizScrollBar, TQT_SIGNAL(valueChanged(int)), m_traceScrollView->m_traceWidget->m_graticuleWidget, TQT_SLOT(horizScrollValueChanged(int)));
|
|
|
|
|
m_traceScrollView->setHScrollBarMode(TQScrollView::AlwaysOff);
|
|
|
|
|
m_horizScrollBar->setOrientation(TQt::Horizontal);
|
|
|
|
|
m_horizScrollBarMode = TQScrollView::AlwaysOff;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TraceScrollWidget::~TraceScrollWidget() {
|
|
|
|
|
delete m_traceScrollView;
|
|
|
|
|
m_traceScrollView = NULL;
|
|
|
|
|
delete m_horizScrollBar;
|
|
|
|
|
m_horizScrollBar = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TraceScrollWidget::setResizePolicy(TQScrollView::ResizePolicy rp) {
|
|
|
|
|
m_traceScrollView->setResizePolicy(rp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TQScrollView::ResizePolicy TraceScrollWidget::resizePolicy() const {
|
|
|
|
|
return m_traceScrollView->resizePolicy();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TraceScrollWidget::setHScrollBarMode(TQScrollView::ScrollBarMode sm) {
|
|
|
|
|
m_horizScrollBarMode = sm;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TraceScrollWidget::setVScrollBarMode(TQScrollView::ScrollBarMode sm) {
|
|
|
|
|
m_traceScrollView->setVScrollBarMode(sm);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TraceWidget* TraceScrollWidget::traceWidget() {
|
|
|
|
|
return m_traceScrollView->m_traceWidget;
|
|
|
|
|
}
|